@sunpix/claude-code-web
Version:
A web-based interface for interacting with Claude Code CLI
2 lines (1 loc) • 5.1 kB
JavaScript
import{e,A as t,a3 as a,r,a4 as n,j as l,a5 as u,a6 as i,P as o,a7 as s,a8 as c,a9 as v,aa as f,ab as d,ac as p,i as h,ad as g,ae as y,S as b,af as m,ag as q,ah as x,ai as S}from"./sqhd64MX.js";function C(q){const x=q.componentName||"NuxtLink";function S(e){return"string"==typeof e&&e.startsWith("#")}function C(e){const a=t(),r=b(),n=h(()=>!!e.target&&"_self"!==e.target),l=h(()=>{const t=e.to||e.href||"";return"string"==typeof t&&g(t,{acceptRelative:!0})}),u=v("RouterLink"),i=u&&"string"!=typeof u?u.useLink:void 0,o=h(()=>{if(e.external)return!0;const t=e.to||e.href||"";return"object"!=typeof t&&(""===t||l.value)}),s=h(()=>{const t=e.to||e.href||"";return o.value?t:function(e,t,a){const r=a??q.trailingSlash;if(!e||"append"!==r&&"remove"!==r)return e;if("string"==typeof e)return R(e,r);const n="path"in e&&void 0!==e.path?e.path:t(e).path;return{...e,name:void 0,path:R(n,r)}}(t,a.resolve,e.trailingSlash)}),c=o.value?void 0:i?.({...e,to:s}),f=h(()=>{const t=e.trailingSlash??q.trailingSlash;if(!s.value||l.value||S(s.value))return s.value;if(o.value){const e="object"==typeof s.value&&"path"in s.value?d(s.value):s.value;return R("object"==typeof e?a.resolve(e).href:e,t)}return"object"==typeof s.value?a.resolve(s.value)?.href??null:R(y(r.app.baseURL,s.value),t)});return{to:s,hasTarget:n,isAbsoluteUrl:l,isExternal:o,href:f,isActive:c?.isActive??h(()=>s.value===a.currentRoute.value.path),isExactActive:c?.isExactActive??h(()=>s.value===a.currentRoute.value.path),route:c?.route??h(()=>a.resolve(s.value)),async navigate(t){await m(f.value,{replace:e.replace,external:o.value||n.value})}}}return e({name:x,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1},trailingSlash:{type:String,default:void 0,required:!1}},useLink:C,setup(e,{slots:h}){const g=t(),{to:y,href:b,navigate:m,isExternal:x,hasTarget:A,isAbsoluteUrl:R}=C(e),k=a(!1),j=r(null),O=t=>{j.value=e.custom?t?.$el?.nextElementSibling:t?.$el};function L(t){return!k.value&&("string"==typeof e.prefetchOn?e.prefetchOn===t:e.prefetchOn?.[t]??q.prefetchOn?.[t])&&!1!==(e.prefetch??q.prefetch)&&!0!==e.noPrefetch&&"_blank"!==e.target&&!function(){const e=navigator.connection;if(e&&(e.saveData||w.test(e.effectiveType)))return!0;return!1}()}async function E(e=n()){if(k.value)return;k.value=!0;const t="string"==typeof y.value?y.value:x.value?d(y.value):g.resolve(y.value).fullPath,a=x.value?new URL(t,window.location.href).href:t;await Promise.all([e.hooks.callHook("link:prefetch",a).catch(()=>{}),!x.value&&!A.value&&p(y.value,g).catch(()=>{})])}if(L("visibility")){const e=n();let t,a=null;l(()=>{const r=function(){const e=n();if(e._observer)return e._observer;let t=null;const a=new Map,r=(e,r)=>(t||=new IntersectionObserver(e=>{for(const t of e){const e=a.get(t.target);(t.isIntersecting||t.intersectionRatio>0)&&e&&e()}}),a.set(e,r),t.observe(e),()=>{a.delete(e),t?.unobserve(e),0===a.size&&(t?.disconnect(),t=null)}),l=e._observer={observe:r};return l}();u(()=>{t=i(()=>{j?.value?.tagName&&(a=r.observe(j.value,async()=>{a?.(),a=null,await E(e)}))})})}),o(()=>{t&&s(t),a?.(),a=null})}return()=>{if(!x.value&&!A.value&&!S(y.value)){const t={ref:O,to:y.value,activeClass:e.activeClass||q.activeClass,exactActiveClass:e.exactActiveClass||q.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(L("interaction")&&(t.onPointerenter=E.bind(null,void 0),t.onFocus=E.bind(null,void 0)),k.value&&(t.class=e.prefetchedClass||q.prefetchedClass),t.rel=e.rel||void 0),c(v("RouterLink"),t,h.default)}const t=e.target||null,a=((...e)=>e.find(e=>void 0!==e))(e.noRel?"":e.rel,q.externalRelAttribute,R.value||A.value?"noopener noreferrer":"")||null;return e.custom?h.default?h.default({href:b.value,navigate:m,prefetch:E,get route(){if(!b.value)return;const e=new URL(b.value,window.location.href);return{path:e.pathname,fullPath:e.pathname,get query(){return f(e.search)},hash:e.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:b.value}},rel:a,target:t,isExternal:x.value||A.value,isActive:!1,isExactActive:!1}):null:c("a",{ref:j,href:b.value||null,rel:a,target:t,onClick:t=>{if(!x.value&&!A.value)return t.preventDefault(),e.replace?g.replace(b.value):g.push(b.value)}},h.default?.())}}})}const A=C(S);function R(e,t){const a="append"===t?q:x;return g(e)&&!e.startsWith("http")?e:a(e,!0)}const w=/2g/;export{A as _};