text: var e,t,n=Object.defineProperty,o=Object.defineProperties,r=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,i=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&c(e,n,t[n]);if(a)for(var n of a(t))l.call(t,n)&&c(e,n,t[n]);return e},u=(e,t)=>o(e,r(t)),p=(e,t)=>{var n={};for(var o in e)s.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&a)for(var o of a(e))t.indexOf(o)<0&&l.call(e,o)&&(n[o]=e[o]);return n};import{i as d,B as m,a as h,b as f,R as g,s as x,f as E,u as v,r as b,G as _,Q as w,c as y,d as C,e as k,g as N,X as L,E as P,h as I,j as R,k as A,T as S,M as T,l as O,y as U,F as j,m as B,n as z,o as M,p as D,q as $,H as F,I as W,S as q,t as V,v as J,x as G,w as H,z as K}from"./vendor.3b6f54f7.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const Q={},Y=function(e,t){return t&&0!==t.length?Promise.all(t.map((e=>{if((e=`./${e}`)in Q)return;Q[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script",o.crossOrigin=""),o.href=e,document.head.appendChild(o),t?new Promise(((e,t)=>{o.addEventListener("load",e),o.addEventListener("error",t)})):void 0}))).then((()=>e())):e()},Z={zh:Y((()=>import("./zh.d85002f6.js")),[]),en:Y((()=>import("./en.41adc249.js")),[])};d.use(m).use(h).use(f).init({debug:!1,backend:{loadPath:"/__{{lng}}/{{ns}}.json",request:function(e,t,n,o){let r;switch(t){case"/__zh/translation.json":case"/__zh-CN/translation.json":r=Z.zh;break;case"/__en/translation.json":default:r=Z.en}r&&r.then((e=>{o(null,{status:200,data:e.data})}))}},supportedLngs:["en","zh"],fallbackLng:"en",interpolation:{escapeValue:!1}});function X(e){return e.replace(/\/$/,"")}function ee(e,t){let n=String(e);for(;n.length<t;)n="0"+n;return n}const te={"Content-Type":"application/json"};function ne(e,t,n){const o="?"+t.toString(),r=new URL(e);return"https:"===r.protocol?r.protocol="wss:":r.protocol="ws:",`${X(r.href)}${n}${o}`}function oe({baseURL:e,secret:t}){return{url:e,init:{headers:function({secret:e}){const t=i({},te);return e&&(t.Authorization=`Bearer ${e}`),t}({secret:t})}}}function re(e,t){const{baseURL:n,secret:o}=e;return ne(n,new URLSearchParams({token:o}),t)}function ae(e,t){const{baseURL:n,secret:o,logLevel:r}=e;return ne(n,new URLSearchParams({token:o,level:r}),t)}var se="_root_1o14m_1",le="_h1_1o14m_7";var ce=g.memo((function({title:e}){return g.createElement("div",{className:se},g.createElement("h1",{className:le},e))}));x(!1);const{createContext:ie,memo:ue,useMemo:pe,useRef:de,useEffect:me,useCallback:he,useContext:fe,useState:ge}=g,xe=ie(null),Ee=ie(null),ve=ie(null);function be(){return fe(ve)}function _e({initialState:e,actions:t={},children:n}){const o=de(e),[r,a]=ge(e),s=he((()=>o.current),[]);me((()=>{}),[s]);const l=he(((e,t)=>{if("function"==typeof e)return e(l,s);const n=E(s(),t);n!==o.current&&(o.current=n,a(n))}),[s]),c=pe((()=>Ce(t,l)),[t,l]);return g.createElement(xe.Provider,{value:r},g.createElement(Ee.Provider,{value:l},g.createElement(ve.Provider,{value:c},n)))}function we(e){return t=>{const n=ue(t);return function(t){const o=fe(xe),r=fe(Ee),a=e(o,t),s=i(i({dispatch:r},t),a);return g.createElement(n,i({},s))}}}function ye(e,t){return function(...n){return t(e.apply(this,n))}}function Ce(e,t){const n={};for(const o in e){const r=e[o];"function"==typeof r?n[o]=ye(r,t):"object"==typeof r&&(n[o]=Ce(r,t))}return n}function ke(e){try{const t=JSON.stringify(e);localStorage.setItem("yacd.haishan.me",t)}catch(t){}}async function Ne(e){const{url:t,init:n}=oe(e);return await fetch(t+"/configs",n)}const Le=new TextDecoder("utf-8"),Pe={labels:Array(150),up:Array(150),down:Array(150),size:150,subscribers:[],appendData(e){this.up.push(e.up),this.down.push(e.down);const t=new Date,n=""+t.getMinutes()+t.getSeconds();this.labels.push(n),this.up.length>this.size&&this.up.shift(),this.down.length>this.size&&this.down.shift(),this.labels.length>this.size&&this.labels.shift(),this.subscribers.forEach((t=>t(e)))},subscribe(e){return this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}}};let Ie,Re=!1,Ae="";function Se(e){Pe.appendData(JSON.parse(e))}function Te(e){return e.read().then((({done:t,value:n})=>{const o=Le.decode(n,{stream:!t});Ae+=o;const r=Ae.split("\n"),a=r[r.length-1];for(let e=0;e<r.length-1;e++)Se(r[e]);return t?(Se(a),Ae="",console.log("GET /traffic streaming done"),void(Re=!1)):(Ae=a,Te(e))}))}function Oe(e){if(Re||1===Ie)return Pe;Ie=1;const t=re(e,"/traffic"),n=new WebSocket(t);return n.addEventListener("error",(function(e){Ie=3})),n.addEventListener("close",(function(t){Ie=3,function(e){if(Re)return Pe;Re=!0;const{url:t,init:n}=oe(e);fetch(t+"/traffic",n).then((e=>{if(e.ok){Te(e.body.getReader())}else Re=!1}),(e=>{console.log("fetch /traffic error",e),Re=!1}))}(e)})),n.addEventListener("message",(function(e){Se(e.data)})),Pe}function Ue(e){return t=>{t(`openModal:${e}`,(t=>{t.modals[e]=!0}))}}const je=e=>e.configs.configs,Be=e=>e.configs.configs["log-level"];function ze(e){return async(t,n)=>{let o;try{o=await Ne(e)}catch(a){return void t(Ue("apiConfig"))}if(!o.ok)return console.log("Error fetch configs",o.statusText),void t(Ue("apiConfig"));const r=await o.json();t("store/configs#fetchConfigs",(e=>{e.configs.configs=r}));n().configs.haveFetchedConfig?Oe(e):t((e=>{e("store/configs#markHaveFetchedConfig",(e=>{e.configs.haveFetchedConfig=!0}))}))}}function Me(e,t){return async n=>{(async function(e,t){const{url:n,init:o}=oe(e),r=JSON.stringify(function(e){return"socks-port"in e&&(e["socket-port"]=e["socks-port"]),e}(t));return await fetch(n+"/configs",u(i({},o),{body:r,method:"PATCH"}))})(e,t).then((e=>{!1===e.ok&&console.log("Error update configs",e.statusText)}),(e=>{throw console.log("Error update configs",e),e})).then((()=>{n(ze(e))})),n("storeConfigsOptimisticUpdateConfigs",(e=>{e.configs.configs=i(i({},e.configs.configs),t)}))}}const De=e=>{const t=e.app.selectedClashAPIConfigIndex;return e.app.clashAPIConfigs[t]},$e=e=>e.app.selectedClashAPIConfigIndex,Fe=e=>e.app.clashAPIConfigs,We=e=>e.app.theme,qe=e=>e.app.selectedChartStyleIndex,Ve=e=>e.app.latencyTestUrl,Je=e=>e.app.collapsibleIsOpen,Ge=e=>e.app.proxySortBy,He=e=>e.app.hideUnavailableProxies,Ke=e=>e.app.autoCloseOldConns,Qe=function(e,t){let n;return(...o)=>{n&&clearTimeout(n),n=setTimeout((()=>{e(...o)}),t)}}(ke,600);function Ye(e,{baseURL:t,secret:n}){const o=Fe(e());for(let r=0;r<o.length;r++){const e=o[r];if(e.baseURL===t&&e.secret===n)return r}}const Ze=document.querySelector("html"),Xe=document.querySelector('meta[name="theme-color"]');function et(e="dark"){"dark"===e?(Ze.setAttribute("data-theme","dark"),Xe.setAttribute("content","#202020")):(Ze.setAttribute("data-theme","light"),Xe.setAttribute("content","#eeeeee"))}function tt(e,t){return(n,o)=>{n("appUpdateAppConfig",(n=>{n.app[e]=t})),ke(o().app)}}const nt={selectedClashAPIConfigIndex:0,clashAPIConfigs:[{baseURL:null!=(t=null==(e=document.getElementById("app"))?void 0:e.getAttribute("data-base-url"))?t:"http://127.0.0.1:9090",secret:"",addedAt:0}],latencyTestUrl:"http://www.gstatic.com/generate_204",selectedChartStyleIndex:0,theme:"dark",collapsibleIsOpen:{},proxySortBy:"Natural",hideUnavailableProxies:!1,autoCloseOldConns:!1};var ot="_root_dn70c_1",rt="_mono_dn70c_10",at="_link_dn70c_14";function st({name:e,link:t,version:n}){return b.exports.createElement("div",{className:ot},b.exports.createElement("h2",null,e),b.exports.createElement("p",null,b.exports.createElement("span",null,"Version "),b.exports.createElement("span",{className:rt},n)),b.exports.createElement("p",null,b.exports.createElement("a",{className:at,href:t,target:"_blank",rel:"noopener noreferrer"},b.exports.createElement(_,{size:20}),b.exports.createElement("span",null,"Source"))))}const lt=we((e=>({apiConfig:De(e)})))((function(e){const{data:t}=v(["/version",e.apiConfig],(()=>async function(e,t){let n={};try{const{url:o,init:r}=oe(t),a=await fetch(o+e,r);a.ok&&(n=await a.json())}catch(o){console.log(`failed to fetch ${e}`,o)}return n}("/version",e.apiConfig)));return b.exports.createElement(b.exports.Fragment,null,b.exports.createElement(ce,{title:"About"}),t&&t.version?b.exports.createElement(st,{name:"Clash",version:t.version,link:"https://github.com/Dreamacro/clash"}):null,b.exports.createElement(st,{name:"Yacd",version:"0.3.3",link:"https://github.com/haishanh/yacd"}))}));var ct="_loading_74j3j_1",it="_spinner_74j3j_9";const ut=({height:e})=>{const t=e?{height:e}:{};return g.createElement("div",{className:ct,style:t},g.createElement("div",{className:it}))};const pt=we((e=>({apiConfig:De(e),apiConfigs:Fe(e)})))((function({apiConfig:e,apiConfigs:t}){return b.exports.useEffect((()=>{let n="yacd";if(t.length>1)try{n=`${new URL(e.baseURL).host} - yacd`}catch(o){}document.title=n})),b.exports.createElement(b.exports.Fragment,null)})),dt=new y({queryCache:new w,defaultOptions:{queries:{suspense:!0}}}),mt=e=>e.logs.logs,ht=e=>e.logs.tail,ft=e=>e.logs.searchText,gt=C(mt,ht,ft,((e,t,n)=>{const o=[];for(let r=t;r>=0;r--)o.push(e[r]);if(300===e.length)for(let r=299;r>t;r--)o.push(e[r]);return""===n?o:o.filter((e=>e.payload.toLowerCase().indexOf(n)>=0))}));function xt(e){return t=>{t("logsUpdateSearchText",(t=>{t.logs.searchText=e.toLowerCase()}))}}function Et(e){return(t,n)=>{const o=n(),r=mt(o),a=ht(o),s=a>=299?0:a+1;r[s]=e,t("logsAppendLog",(e=>{e.logs.tail=s}))}}const vt=[];let bt;function _t(e,t){if(1===bt&&t)return wt(t);bt=1;const n=re(e,"/connections"),o=new WebSocket(n);return o.addEventListener("error",(()=>bt=3)),o.addEventListener("message",(e=>function(e){let t;try{t=JSON.parse(e)}catch(n){console.log("JSON.parse error",JSON.parse(e))}vt.forEach((e=>e(t)))}(e.data))),t?wt(t):void 0}function wt(e){return vt.push(e),function(){const t=vt.indexOf(e);vt.splice(t,1)}}async function yt(e){const{url:t,init:n}=oe(e);return await fetch(t+"/connections",u(i({},n),{method:"DELETE"}))}async function Ct(e){const{url:t,init:n}=oe(e),o=await fetch(t+"/proxies",n);return await o.json()}async function kt(e){const{url:t,init:n}=oe(e),o=await fetch(t+"/providers/proxies",n);return 404===o.status?{providers:{}}:await o.json()}async function Nt(e,t){const{url:n,init:o}=oe(e),r=u(i({},o),{method:"PUT"});return await fetch(n+"/providers/proxies/"+t,r)}const Lt=()=>null,Pt=["Direct","Fallback","Reject","Selector","URLTest","LoadBalance","Unknown"],It=e=>e.proxies.proxies,Rt=e=>e.proxies.delay,At=e=>e.proxies.groupNames,St=e=>e.proxies.proxyProviders||[],Tt=e=>e.proxies.dangleProxyNames,Ot=e=>e.proxies.showModalClosePrevConns;function Ut(e){return async(t,n)=>{const[o,r]=await Promise.all([Ct(e),kt(e)]),{providers:a,proxies:s}=function(e){const t=Object.keys(e),n=[],o={};for(let r=0;r<t.length;r++){const a=e[t[r]];if("default"===a.name||"Compatible"===a.vehicleType)continue;const s=a.proxies,l=[];for(let e=0;e<s.length;e++){const t=s[e];o[t.name]=t,l.push(t.name)}a.proxies=l,n.push(a)}return{providers:n,proxies:o}}(r.providers),l=i(i({},s),o.proxies),[c,u]=function(e){let t,n=[];const o=[];for(const r in e){const a=e[r];a.all&&Array.isArray(a.all)?(n.push(r),"GLOBAL"===r&&(t=a.all)):Pt.indexOf(a.type)<0&&o.push(r)}t&&(t.push("GLOBAL"),n=n.map((e=>[t.indexOf(e),e])).sort(((e,t)=>e[0]-t[0])).map((e=>e[1])));return[n,o]}(l),p=Rt(n()),d=i({},p);for(let e=0;e<u.length;e++){const t=u[e],{history:n}=l[t]||{history:[]},o=n[n.length-1];o&&"number"==typeof o.delay&&(d[t]={number:o.delay})}const m=[];for(const e of u)s[e]||m.push(e);t("store/proxies#fetchProxies",(e=>{e.proxies.proxies=l,e.proxies.groupNames=c,e.proxies.delay=d,e.proxies.proxyProviders=a,e.proxies.dangleProxyNames=m}))}}function jt(e,t){return async n=>{try{await Nt(e,t)}catch(o){}n(Ut(e))}}function Bt(e,t){return async n=>{for(let r=0;r<t.length;r++)try{await Nt(e,t[r])}catch(o){}n(Ut(e))}}async function zt(e,t){try{await async function(e,t){const{url:n,init:o}=oe(e),r=u(i({},o),{method:"GET"});return await fetch(n+"/providers/proxies/"+t+"/healthcheck",r)}(e,t)}catch(n){}}function Mt(e,t){return async n=>{await zt(e,t),await n(Ut(e))}}async function Dt(e,t,n){const o=await async function(e){const{url:t,init:n}=oe(e);return await fetch(t+"/connections",i({},n))}(e);o.ok||console.log("unable to fetch all connections",o.statusText);const r=(await o.json()).connections,a=[];for(const s of r)s.chains.indexOf(t)>-1&&s.chains.indexOf(n)<0&&a.push(s.id);await Promise.all(a.map((t=>async function(e,t){const{url:n,init:o}=oe(e),r=`${n}/connections/${t}`;return await fetch(r,u(i({},o),{method:"DELETE"}))}(e,t).catch(Lt))))}async function $t(e,t,n,o,r){try{if(!1===(await async function(e,t,n){const o={name:n},{url:r,init:a}=oe(e),s=`${r}/proxies/${t}`;return await fetch(s,u(i({},a),{method:"PUT",body:JSON.stringify(o)}))}(n,o,r)).ok)throw new Error("failed to switch proxy: res.statusText")}catch(a){throw console.log(a,"failed to swith proxy"),a}e(Ut(n));if(Ke(t())){Wt(n,It(t()),{groupName:o,itemName:r})}}function Ft(){return e=>{e("closeModalClosePrevConns",(e=>{e.proxies.showModalClosePrevConns=!1}))}}function Wt(e,t,n){const o=function(e,t,n){const o=[n,t];let r,a=n;for(;(r=e[a])&&r.now;)o.unshift(r.now),a=r.now;return o}(t,n.groupName,n.itemName);Dt(e,n.groupName,o[0])}function qt(e,t,n){return async(o,r)=>{$t(o,r,e,t,n).catch(Lt),o("store/proxies#switchProxy",(e=>{const o=e.proxies.proxies;o[t]&&o[t].now&&(o[t].now=n)}))}}function Vt(e,t){return async(n,o)=>{const r=Ve(o()),a=await async function(e,t,n="http://www.gstatic.com/generate_204"){const{url:o,init:r}=oe(e),a=`timeout=5000&url=${n}`,s=`${o}/proxies/${encodeURIComponent(t)}/delay?${a}`;return await fetch(s,r)}(e,t,r);let s="";!1===a.ok&&(s=a.statusText);const{delay:l}=await a.json(),c=Rt(o()),p=u(i({},c),{[t]:{error:s,number:l}});n("requestDelayForProxyOnce",(e=>{e.proxies.delay=p}))}}function Jt(e,t){return async n=>{await n(Vt(e,t))}}function Gt(e){return async(t,n)=>{const o=Tt(n());await Promise.all(o.map((n=>t(Jt(e,n)))));const r=St(n());for(const a of r)await zt(e,a.name);await t(Ut(e))}}const Ht={requestDelayForProxies:function(e,t){return async(n,o)=>{const r=Tt(o()),a=t.filter((e=>r.indexOf(e)>-1)).map((t=>n(Jt(e,t))));await Promise.all(a),await n(Ut(e))}},closeModalClosePrevConns:Ft,closePrevConnsAndTheModal:function(e){return async(t,n)=>{var o;const r=n(),a=null==(o=r.proxies.switchProxyCtx)?void 0:o.to;if(!a)return void t((e=>{e("closeModalClosePrevConns",(e=>{e.proxies.showModalClosePrevConns=!1}))}));const s=r.proxies.proxies;Wt(e,s,a),t("closePrevConnsAndTheModal",(e=>{e.proxies.showModalClosePrevConns=!1,e.proxies.switchProxyCtx=void 0}))}}},Kt=k({key:"proxyFilterText",default:""}),Qt={app:function(){let e=function(){try{const e=localStorage.getItem("yacd.haishan.me");if(!e)return;return JSON.parse(e)}catch(e){return}}();e=i(i({},nt),e);const t=function(){const{search:e}=window.location,t={};if("string"!=typeof e||""===e)return t;const n=e.replace(/^\?/,"").split("&");for(let o=0;o<n.length;o++){const[e,r]=n[o].split("=");t[e]=encodeURIComponent(r)}return t}(),n=e.clashAPIConfigs[e.selectedClashAPIConfigIndex];if(n){const e=new URL(n.baseURL);t.hostname&&(e.hostname=t.hostname),t.port&&(e.port=t.port),n.baseURL=X(e.href),t.secret&&(n.secret=t.secret)}return"dark"!==t.theme&&"light"!==t.theme||(e.theme=t.theme),et(e.theme),e}(),modals:{apiConfig:!1},configs:{configs:{port:7890,"socks-port":7891,"redir-port":0,"allow-lan":!1,mode:"Rule","log-level":"uninit"},haveFetchedConfig:!1},proxies:{proxies:{},delay:{},groupNames:[],showModalClosePrevConns:!1},logs:{searchText:"",logs:[],tail:-1}},Yt={selectChartStyleIndex:function(e){return(t,n)=>{t("appSelectChartStyleIndex",(t=>{t.app.selectedChartStyleIndex=Number(e)})),ke(n().app)}},updateAppConfig:tt,app:{updateCollapsibleIsOpen:function(e,t,n){return(o,r)=>{o("updateCollapsibleIsOpen",(o=>{o.app.collapsibleIsOpen[`${e}:${t}`]=n})),Qe(r().app)}},updateAppConfig:tt,removeClashAPIConfig:function({baseURL:e,secret:t}){return async(n,o)=>{const r=Ye(o,{baseURL:e,secret:t});n("removeClashAPIConfig",(e=>{e.app.clashAPIConfigs.splice(r,1)})),ke(o().app)}},selectClashAPIConfig:function({baseURL:e,secret:t}){return async(n,o)=>{const r=Ye(o,{baseURL:e,secret:t});$e(o())!==r&&n("selectClashAPIConfig",(e=>{e.app.selectedClashAPIConfigIndex=r})),ke(o().app);try{window.location.reload()}catch(a){}}}},proxies:Ht},{useState:Zt,useCallback:Xt}=g;var en={ul:"_ul_1d6f2_1",li:"_li_1d6f2_10",close:"_close_1d6f2_28",eye:"_eye_1d6f2_36",hasSecret:"_hasSecret_1d6f2_45",url:"_url_1d6f2_50",secret:"_secret_1d6f2_54",btn:"_btn_1d6f2_72"};const tn=we((e=>({apiConfigs:Fe(e),selectedClashAPIConfigIndex:$e(e)})))((function({apiConfigs:e,selectedClashAPIConfigIndex:t}){const{app:{removeClashAPIConfig:n,selectClashAPIConfig:o}}=be(),r=b.exports.useCallback((e=>{n(e)}),[n]),a=b.exports.useCallback((e=>{o(e)}),[o]);return b.exports.createElement(b.exports.Fragment,null,b.exports.createElement("ul",{className:en.ul},e.map(((e,n)=>b.exports.createElement("li",{className:N(en.li,{[en.hasSecret]:e.secret,[en.isSelected]:n===t}),key:e.baseURL+e.secret},b.exports.createElement(nn,{disableRemove:n===t,baseURL:e.baseURL,secret:e.secret,onRemove:r,onSelect:a}))))))}));function nn({baseURL:e,secret:t,disableRemove:n,onRemove:o,onSelect:r}){const[a,s]=function(e=!1){const[t,n]=Zt(e);return[t,Xt((()=>n((e=>!e))),[])]}(),l=a?P:I,c=b.exports.useCallback((e=>{e.stopPropagation()}),[]);return b.exports.createElement(b.exports.Fragment,null,b.exports.createElement(on,{disabled:n,onClick:()=>o({baseURL:e,secret:t}),className:en.close},b.exports.createElement(L,{size:20})),b.exports.createElement("span",{className:en.url,tabIndex:0,role:"button",onClick:()=>r({baseURL:e,secret:t}),onKeyUp:c},e),b.exports.createElement("span",null),t?b.exports.createElement(b.exports.Fragment,null,b.exports.createElement("span",{className:en.secret},a?t:"***"),b.exports.createElement(on,{onClick:s,className:en.eye},b.exports.createElement(l,{size:20}))):null)}function on({children:e,onClick:t,className:n,disabled:o}){return b.exports.createElement("button",{disabled:o,className:N(n,en.btn),onClick:t},e)}var rn="_root_zwtea_1",an="_header_zwtea_5",sn="_icon_zwtea_10",ln="_body_zwtea_20",cn="_hostnamePort_zwtea_24",un="_error_zwtea_36",pn="_footer_zwtea_42";var dn="_btn_1h2nv_1",mn="_minimal_1h2nv_34",hn="_btnStart_1h2nv_51",fn="_loadingContainer_1h2nv_58";var gn="_sectionNameType_1w5id_1",xn="_loadingDot_1w5id_65";function En({name:e,type:t}){return g.createElement("h2",{className:gn},g.createElement("span",null,e),g.createElement("span",null,t))}function vn(){return g.createElement("span",{className:xn})}const{forwardRef:bn,useCallback:_n}=R;function wn({children:e,label:t,text:n,start:o}){return b.exports.createElement(b.exports.Fragment,null,o?b.exports.createElement("span",{className:hn},"function"==typeof o?o():o):null,e||t||n)}var yn=bn((function(e,t){const n=e,{onClick:o,disabled:r=!1,isLoading:a,kind:s="primary",className:l,children:c,label:u,text:d,start:m}=n,h=p(n,["onClick","disabled","isLoading","kind","className","children","label","text","start"]),f={children:c,label:u,text:d,start:m},g=_n((e=>{a||o&&o(e)}),[a,o]),x=N(dn,{[mn]:"minimal"===s},l);return b.exports.createElement("button",i({className:x,ref:t,onClick:g,disabled:r},h),a?b.exports.createElement(b.exports.Fragment,null,b.exports.createElement("span",{style:{display:"inline-flex",opacity:0}},b.exports.createElement(wn,i({},f))),b.exports.createElement("span",{className:fn},b.exports.createElement(vn,null))):b.exports.createElement(wn,i({},f)))}));var Cn="_root_1or8t_1",kn="_floatAbove_1or8t_32";const{useCallback:Nn}=R;function Ln(e){var t=e,{id:n,label:o,value:r,onChange:a}=t,s=p(t,["id","label","value","onChange"]);const l=Nn((e=>a(e)),[a]);return b.exports.createElement("div",{className:Cn},b.exports.createElement("input",i({id:n,value:r,onChange:l},s)),b.exports.createElement("label",{htmlFor:n,className:kn},o))}var Pn="_path_r8pm3_1";function In({width:e=320,height:t=320,animate:n=!1,c0:o="currentColor",stroke:r="#eee",eye:a="#eee",mouth:s="#eee"}){const l=N({[Pn]:n});return b.exports.createElement("svg",{width:e,height:t,viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg"},b.exports.createElement("g",{fill:"none",fillRule:"evenodd"},b.exports.createElement("path",{d:"M71.689 53.055c9.23-1.487 25.684 27.263 41.411 56.663 18.572-8.017 71.708-7.717 93.775 0 4.714-15.612 31.96-57.405 41.626-56.663 3.992.088 13.07 31.705 23.309 94.96 2.743 16.949 7.537 47.492 14.38 91.63-42.339 17.834-84.37 26.751-126.095 26.751-41.724 0-83.756-8.917-126.095-26.751C52.973 116.244 65.536 54.047 71.689 53.055z",stroke:r,strokeWidth:"4",strokeLinecap:"round",fill:o,className:l}),b.exports.createElement("circle",{fill:a,cx:"216.5",cy:"181.5",r:"14.5"}),b.exports.createElement("circle",{fill:a,cx:"104.5",cy:"181.5",r:"14.5"}),b.exports.createElement("g",{stroke:s,strokeLinecap:"round",strokeWidth:"4"},b.exports.createElement("path",{d:"M175.568 218.694c-2.494 1.582-5.534 2.207-8.563 1.508-3.029-.7-5.487-2.594-7.035-5.11M143.981 218.694c2.494 1.582 5.534 2.207 8.563 1.508 3.03-.7 5.488-2.594 7.036-5.11"}))))}const{useState:Rn,useRef:An,useCallback:Sn,useEffect:Tn}=R;var On=we((e=>({apiConfig:De(e)})))((function({dispatch:e}){const[t,n]=Rn(""),[o,r]=Rn(""),[a,s]=Rn(""),l=An(!1),c=An(null),i=Sn((e=>{l.current=!0,s("");const t=e.target,{name:o}=t,a=t.value;switch(o){case"baseURL":n(a);break;case"secret":r(a);break;default:throw new Error(`unknown input name ${o}`)}}),[]),u=Sn((()=>{(async function(e){try{new URL(e.baseURL)}catch(t){if(e.baseURL){const t=e.baseURL.substring(0,7);if("http://"!==t&&"https:/"!==t)return[1,"Must starts with http:// or https://"]}return[1,"Invalid URL"]}try{const t=await Ne(e);return t.status>399?[1,t.statusText]:[0]}catch(t){return[1,"Failed to connect"]}})({baseURL:t,secret:o}).then((n=>{0!==n[0]?s(n[1]):e(function({baseURL:e,secret:t}){return async(n,o)=>{if(Ye(o,{baseURL:e,secret:t}))return;const r={baseURL:e,secret:t,addedAt:Date.now()};n("addClashAPIConfig",(e=>{e.app.clashAPIConfigs.push(r)})),ke(o().app)}}({baseURL:t,secret:o}))}))}),[t,o,e]),p=Sn((e=>{e.target instanceof Element&&(!e.target.tagName||"INPUT"!==e.target.tagName.toUpperCase())||"Enter"===e.key&&u()}),[u]);return Tn((()=>{(async()=>{(await fetch("/")).json().then((e=>{"clash"===e.hello&&n(window.location.origin)}))})()}),[]),b.exports.createElement("div",{className:rn,ref:c,onKeyDown:p},b.exports.createElement("div",{className:an},b.exports.createElement("div",{className:sn},b.exports.createElement(In,{width:160,height:160,stroke:"var(--stroke)"}))),b.exports.createElement("div",{className:ln},b.exports.createElement("div",{className:cn},b.exports.createElement(Ln,{id:"baseURL",name:"baseURL",label:"API Base URL",type:"text",placeholder:"http://127.0.0.1:9090",value:t,onChange:i}),b.exports.createElement(Ln,{id:"secret",name:"secret",label:"Secret(optional)",value:o,type:"text",onChange:i}))),b.exports.createElement("div",{className:un},a||null),b.exports.createElement("div",{className:pn},b.exports.createElement(yn,{label:"Add",onClick:u})),b.exports.createElement("div",{style:{height:20}}),b.exports.createElement(tn,null))}));const Un=function(e){let t={};const n={},o={};function r(r="default"){return n[r]=e(r).then((e=>{delete n[r],t[r]=e})).catch((e=>{o[r]=e})),n[r]}return{preload:function(e="default"){void 0!==t[e]||n[e]||r(e)},read:function(e="default"){if(void 0!==t[e])return t[e];throw o[e]?o[e]:n[e]?n[e]:r(e)},clear:function(e){e?delete t[e]:t={}}}}((()=>Y((()=>import("./index.f268908c.js")),["assets/index.f268908c.js","assets/vendor.3b6f54f7.js"])));var jn="_iconWrapper_5pz1j_1",Bn="_themeSwitchContainer_5pz1j_23";function zn(){const e=Un.read().motion;return b.exports.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},b.exports.createElement(e.path,{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z",initial:{rotate:-30},animate:{rotate:0},transition:{duration:.7}}))}function Mn(){const e=Un.read().motion;return b.exports.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},b.exports.createElement("circle",{cx:"12",cy:"12",r:"5"}),b.exports.createElement(e.g,{initial:{scale:.8},animate:{scale:1},transition:{duration:.7}},b.exports.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),b.exports.createElement("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),b.exports.createElement("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),b.exports.createElement("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),b.exports.createElement("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),b.exports.createElement("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),b.exports.createElement("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),b.exports.createElement("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})))}const Dn=we((e=>({theme:We(e)})))((function({theme:e,dispatch:t}){const{t:n}=A(),o=b.exports.useCallback((()=>{t(((e,t)=>{const n="light"===We(t())?"dark":"light";et(n),e("storeSwitchTheme",(e=>{e.app.theme=n})),ke(t().app)}))}),[t]);return b.exports.createElement(S,{label:n("theme"),"aria-label":"switch to "+("light"===e?"dark":"light")+" theme"},b.exports.createElement("button",{className:N(jn,Bn),onClick:o},"light"===e?b.exports.createElement(zn,null):b.exports.createElement(Mn,null)))})),$n={0:{message:"Browser not supported!",detail:'This browser does not support "fetch", please choose another one.'},default:{message:"Oops, something went wrong!"}};var Fn="_content_b98hm_1",Wn="_container_b98hm_16",qn="_overlay_b98hm_22",Vn="_fixed_b98hm_26";var Jn={overlay:"_overlay_85t19_1",content:"_content_85t19_11"};var Gn=b.exports.memo((function(e){var t=e,{isOpen:n,onRequestClose:o,className:r,overlayClassName:a,children:s}=t,l=p(t,["isOpen","onRequestClose","className","overlayClassName","children"]);const c=N(r,Jn.content),u=N(a,Jn.overlay);return b.exports.createElement(T,i({isOpen:n,onRequestClose:o,className:c,overlayClassName:u},l),s)}));const{useCallback:Hn,useEffect:Kn}=R;var Qn=we((e=>({modals:e.modals,apiConfig:De(e)})))((function({dispatch:e,apiConfig:t,modals:n}){if(!window.fetch){const{detail:e}=$n[0],t=new Error(e);throw t.code=0,t}const o=Hn((()=>{var t;e((t="apiConfig",e=>{e(`closeModal:${t}`,(e=>{e.modals[t]=!1}))}))}),[e]);return Kn((()=>{e(ze(t))}),[e,t]),b.exports.createElement(Gn,{isOpen:n.apiConfig,className:Fn,overlayClassName:qn,shouldCloseOnOverlayClick:!1,shouldCloseOnEsc:!1,onRequestClose:o},b.exports.createElement("div",{className:Wn},b.exports.createElement(On,null)),b.exports.createElement("div",{className:Vn},b.exports.createElement(Dn,null)))}));var Yn="_root_4m2cd_1",Zn="_yacd_4m2cd_14",Xn="_link_4m2cd_23";function eo({width:e=24,height:t=24}={}){return g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.createElement("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"}))}function to({message:e,detail:t}){return g.createElement("div",{className:Yn},g.createElement("div",{className:Zn},g.createElement(In,{width:150,height:150})),e?g.createElement("h1",null,e):null,t?g.createElement("p",null,t):null,g.createElement("p",null,g.createElement("a",{className:Xn,href:"https://github.com/haishanh/yacd/issues"},g.createElement(eo,{width:16,height:16}),"haishanh/yacd")))}class no extends b.exports.Component{constructor(){var e;super(...arguments),c(this,"symbol"!=typeof(e="state")?e+"":e,{error:null})}static getDerivedStateFromError(e){return{error:e}}render(){if(this.state.error){const{message:e,detail:t}=function(e){const{code:t}=e;return"number"==typeof t?$n[t]:$n.default}(this.state.error);return b.exports.createElement(to,{message:e,detail:t})}return this.props.children}}var oo={root:"_root_ecp08_1"};const ro=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];function ao(e){if(e<1e3)return e+" B";const t=Math.min(Math.floor(Math.log10(e)/3),ro.length-1);return(e=Number((e/Math.pow(1e3,t)).toPrecision(3)))+" "+ro[t]}const so=O.exports.unstable_createResource((()=>Y((()=>import("./Chart.min.d34448a4.js").then((function(e){return e.C}))),["assets/Chart.min.d34448a4.js","assets/vendor.3b6f54f7.js"]).then((e=>e.default)))),lo={borderWidth:1,lineTension:0,pointRadius:0},co={responsive:!0,maintainAspectRatio:!0,title:{display:!1},legend:{display:!0,position:"top",labels:{fontColor:"#ccc",boxWidth:20}},tooltips:{enabled:!1,mode:"index",intersect:!1,animationDuration:100},hover:{mode:"nearest",intersect:!0},scales:{xAxes:[{display:!1,gridLines:{display:!1}}],yAxes:[{display:!0,gridLines:{display:!0,color:"#555",borderDash:[3,6],drawBorder:!1},ticks:{callback:e=>ao(e)+"/s "}}]}},io=[{down:{backgroundColor:"rgba(176, 209, 132, 0.8)",borderColor:"rgb(176, 209, 132)"},up:{backgroundColor:"rgba(181, 220, 231, 0.8)",borderColor:"rgb(181, 220, 231)"}},{up:{backgroundColor:"rgb(98, 190, 100)",borderColor:"rgb(78,146,79)"},down:{backgroundColor:"rgb(160, 230, 66)",borderColor:"rgb(110, 156, 44)"}},{up:{backgroundColor:"rgba(94, 175, 223, 0.3)",borderColor:"rgb(94, 175, 223)"},down:{backgroundColor:"rgba(139, 227, 195, 0.3)",borderColor:"rgb(139, 227, 195)"}},{up:{backgroundColor:"rgba(242, 174, 62, 0.3)",borderColor:"rgb(242, 174, 62)"},down:{backgroundColor:"rgba(69, 154, 248, 0.3)",borderColor:"rgb(69, 154, 248)"}}],{useEffect:uo}=g,po=co;function mo(e,t,n,o,r={}){uo((()=>{const a=document.getElementById(t).getContext("2d"),s=new e(a,{type:"line",data:n,options:i(i({},po),r)}),l=o&&o.subscribe((()=>s.update()));return()=>{l&&l(),s.destroy()}}),[e,t,n,o,r])}const{useMemo:ho}=R,fo={position:"relative",maxWidth:1e3};var go=we((e=>({apiConfig:De(e),selectedChartStyleIndex:qe(e)})))((function({apiConfig:e,selectedChartStyleIndex:t}){const n=so.read(),o=Oe(e),{t:r}=A(),a=ho((()=>({labels:o.labels,datasets:[u(i(i({},lo),io[t].up),{label:r("Up"),data:o.up}),u(i(i({},lo),io[t].down),{label:r("Down"),data:o.down})]})),[o,t,r]);return mo(n,"trafficChart",a,o),b.exports.createElement("div",{style:fo},b.exports.createElement("canvas",{id:"trafficChart"}))}));var xo="_TrafficNow_1wdp6_1",Eo="_sec_1wdp6_7";const{useState:vo,useEffect:bo,useCallback:_o}=R;var wo=we((e=>({apiConfig:De(e)})))((function({apiConfig:e}){const{t:t}=A(),{upStr:n,downStr:o}=function(e){const[t,n]=vo({upStr:"0 B/s",downStr:"0 B/s"});return bo((()=>Oe(e).subscribe((e=>n({upStr:ao(e.up)+"/s",downStr:ao(e.down)+"/s"})))),[e]),t}(e),{upTotal:r,dlTotal:a,connNumber:s}=function(e){const[t,n]=vo({upTotal:"0 B",dlTotal:"0 B",connNumber:0}),o=_o((({downloadTotal:e,uploadTotal:t,connections:o})=>{n({upTotal:ao(t),dlTotal:ao(e),connNumber:o.length})}),[n]);return bo((()=>_t(e,o)),[e,o]),t}(e);return b.exports.createElement("div",{className:xo},b.exports.createElement("div",{className:Eo},b.exports.createElement("div",null,t("Upload")),b.exports.createElement("div",null,n)),b.exports.createElement("div",{className:Eo},b.exports.createElement("div",null,t("Download")),b.exports.createElement("div",null,o)),b.exports.createElement("div",{className:Eo},b.exports.createElement("div",null,t("Upload Total")),b.exports.createElement("div",null,r)),b.exports.createElement("div",{className:Eo},b.exports.createElement("div",null,t("Download Total")),b.exports.createElement("div",null,a)),b.exports.createElement("div",{className:Eo},b.exports.createElement("div",null,t("Active Connections")),b.exports.createElement("div",null,s)))}));function yo(){const{t:e}=A();return g.createElement("div",null,g.createElement(ce,{title:e("Overview")}),g.createElement("div",{className:oo.root},g.createElement("div",null,g.createElement(wo,null)),g.createElement("div",{className:oo.chart},g.createElement(b.exports.Suspense,{fallback:g.createElement(ut,{height:"200px"})},g.createElement(go,null)))))}var Co="_lo_pmly2_1";function ko(){return g.createElement("div",{className:Co},g.createElement(In,{width:280,height:280,animate:!0,c0:"transparent",c1:"#646464"}))}var No="_app_1q2jw_1",Lo="_content_1q2jw_17";var Po="_root_wh224_1",Io="_logoPlaceholder_wh224_7",Ro="_rows_wh224_17",Ao="_row_wh224_17",So="_rowActive_wh224_54",To="_label_wh224_64",Oo="_footer_wh224_80",Uo="_iconWrapper_wh224_92";const jo={activity:j,globe:B,command:z,file:M,settings:D,link:$},Bo=b.exports.memo((function({isActive:e,to:t,iconId:n,labelText:o}){const r=jo[n],a=N(Ao,e?So:null);return b.exports.createElement(U,{to:t,className:a},b.exports.createElement(r,null),b.exports.createElement("div",{className:To},o))})),zo=[{to:"/",iconId:"activity",labelText:"Overview"},{to:"/proxies",iconId:"globe",labelText:"Proxies"},{to:"/rules",iconId:"command",labelText:"Rules"},{to:"/connections",iconId:"link",labelText:"Conns"},{to:"/configs",iconId:"settings",labelText:"Config"},{to:"/logs",iconId:"file",labelText:"Logs"}];function Mo(){const{t:e}=A(),t=F();return b.exports.createElement("div",{className:Po},b.exports.createElement("div",{className:Io}),b.exports.createElement("div",{className:Ro},zo.map((({to:n,iconId:o,labelText:r})=>b.exports.createElement(Bo,{key:n,to:n,isActive:t.pathname===n,iconId:o,labelText:e(r)})))),b.exports.createElement("div",{className:Oo},b.exports.createElement(Dn,null),b.exports.createElement(S,{label:e("about")},b.exports.createElement(U,{to:"/about",className:Uo},b.exports.createElement(W,{size:20})))))}var Do={input:"_input_4ejw0_1"};const $o=q.default?q.default:q;var Fo=we((e=>({theme:We(e)})))((function({checked:e=!1,onChange:t,theme:n,name:o}){const r="dark"===n?"#393939":"#e9e9e9";return g.createElement($o,{onChange:t,checked:e,uncheckedIcon:!1,checkedIcon:!1,offColor:r,onColor:"#047aff",offHandleColor:"#fff",onHandleColor:"#fff",handleDiameter:24,height:28,width:44,className:"rs",name:o})}));var Wo="_ToggleSwitch_10mtp_1",qo="_slider_10mtp_28";g.memo((function({options:e,value:t,name:n,onChange:o}){const r=b.exports.useMemo((()=>e.map((e=>e.value)).indexOf(t)),[e,t]),a=b.exports.useCallback((t=>{const n=Math.floor(100/e.length);return t===e.length-1?100-e.length*n+n:t>-1?n:void 0}),[e]),s=b.exports.useMemo((()=>({width:a(r)+"%",left:r*a(0)+"%"})),[r,a]);return g.createElement("div",{className:Wo},g.createElement("div",{className:qo,style:s}),e.map(((e,r)=>{const s=`${n}-${e.label}`,l=0===r?"":"border-left";return g.createElement("label",{htmlFor:s,key:s,className:l,style:{width:a(r)+"%"}},g.createElement("input",{id:s,name:n,type:"radio",value:e.value,checked:t===e.value,onChange:o}),g.createElement("div",null,e.label))})))}));const Vo=b.exports.lazy((()=>Y((()=>import("./Connections.7d6651c1.js")),["assets/Connections.7d6651c1.js","assets/Connections.48138f3b.css","assets/vendor.3b6f54f7.js","assets/useRemainingViewPortHeight.c7e29e4e.js","assets/Fab.5d9770ec.js","assets/Fab.44f13fef.css"]))),Jo=b.exports.lazy((()=>Y((()=>import("./Config.8419de3c.js")),["assets/Config.8419de3c.js","assets/Config.58870520.css","assets/vendor.3b6f54f7.js","assets/logs.f9f72571.js","assets/Select.55100629.js","assets/Select.9a98fc65.css"]))),Go=b.exports.lazy((()=>Y((()=>import("./Logs.7685cadf.js")),["assets/Logs.7685cadf.js","assets/Logs.6851de94.css","assets/vendor.3b6f54f7.js","assets/index.esm.023d01c8.js","assets/logs.f9f72571.js","assets/debounce.cc85a806.js","assets/useRemainingViewPortHeight.c7e29e4e.js"]))),Ho=b.exports.lazy((()=>Y((()=>import("./Proxies.d11259f1.js")),["assets/Proxies.d11259f1.js","assets/Proxies.568ae8cd.css","assets/vendor.3b6f54f7.js","assets/Fab.5d9770ec.js","assets/Fab.44f13fef.css","assets/TextFitler.11aeeb98.js","assets/TextFitler.3d9182a0.css","assets/debounce.cc85a806.js","assets/Select.55100629.js","assets/Select.9a98fc65.css"]))),Ko=b.exports.lazy((()=>Y((()=>import("./Rules.8a7681ec.js")),["assets/Rules.8a7681ec.js","assets/Rules.a609ca62.css","assets/vendor.3b6f54f7.js","assets/index.esm.023d01c8.js","assets/TextFitler.11aeeb98.js","assets/TextFitler.3d9182a0.css","assets/debounce.cc85a806.js","assets/Fab.5d9770ec.js","assets/Fab.44f13fef.css","assets/useRemainingViewPortHeight.c7e29e4e.js"]))),Qo=[{path:"/",element:g.createElement(yo,null)},{path:"/connections",element:g.createElement(Vo,null)},{path:"/configs",element:g.createElement(Jo,null)},{path:"/logs",element:g.createElement(Go,null)},{path:"/proxies",element:g.createElement(Ho,null)},{path:"/rules",element:g.createElement(Ko,null)},{path:"/about",element:g.createElement(lt,null)},!1].filter(Boolean);function Yo(){return H(Qo)}function Zo(){return g.createElement(g.Fragment,null,g.createElement(Qn,null),g.createElement(Mo,null),g.createElement("div",{className:Lo},g.createElement(b.exports.Suspense,{fallback:g.createElement(ko,null)},g.createElement(Yo,null))))}function Xo(){return H([{path:"/backend",element:g.createElement(On,null)},{path:"*",element:g.createElement(Zo,null)}])}const er=()=>g.createElement(no,null,g.createElement(V,null,g.createElement(_e,{initialState:Qt,actions:Yt},g.createElement(J,{client:dt},g.createElement(G,null,g.createElement("div",{className:No},g.createElement(pt,null),g.createElement(b.exports.Suspense,{fallback:g.createElement(ut,null)},g.createElement(Xo,null)))))))),tr=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function nr(e,t){navigator.serviceWorker.register(e).then((e=>{e.onupdatefound=()=>{const n=e.installing;null!=n&&(n.onstatechange=()=>{"installed"===n.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See https://cra.link/PWA."),t&&t.onUpdate&&t.onUpdate(e)):(console.log("Content is cached for offline use."),t&&t.onSuccess&&t.onSuccess(e)))})}})).catch((e=>{console.error("Error during service worker registration:",e)}))}const or=document.getElementById("app");T.setAppElement(or),K.render(g.createElement(g.StrictMode,null,g.createElement(er,null)),or),function(e){if("serviceWorker"in navigator){if(new URL("./",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(()=>{const t=".//sw.js";tr?(!function(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then((n=>{const o=n.headers.get("content-type");404===n.status||null!=o&&-1===o.indexOf("javascript")?navigator.serviceWorker.ready.then((e=>{e.unregister().then((()=>{window.location.reload()}))})):nr(e,t)})).catch((()=>{console.log("No internet connection found. App is running in offline mode.")}))}(t,e),navigator.serviceWorker.ready.then((()=>{console.log("This web app is being served cache-first by a service worker")}))):nr(t,e)}))}}(),console.log("Checkout the repo: https://github.com/haishanh/yacd"),console.log("Version:","0.3.3");export{Be as A,yn as B,ce as C,En as D,Kt as E,It as F,Rt as G,qt as H,Je as I,Ge as J,He as K,jt as L,Bt as M,Pt as N,Gt as O,Un as P,Mt as Q,Ke as R,In as S,Ut as T,At as U,St as V,Ot as W,yt as a,so as b,we as c,lo as d,io as e,_t as f,De as g,ze as h,Me as i,be as j,Fo as k,je as l,Jn as m,qe as n,Ue as o,ao as p,Ve as q,ae as r,Do as s,oe as t,mo as u,ee as v,ft as w,xt as x,Et as y,gt as z};
  