var G=Object.defineProperty,T=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var M=(e,t,r)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t)=>{for(var r in t||(t={}))L.call(t,r)&&M(e,r,t[r]);if(R)for(var r of R(t))O.call(t,r)&&M(e,r,t[r]);return e},B=(e,t)=>T(e,V(t));var P=(e,t,r)=>new Promise((h,d)=>{var g=l=>{try{f(r.next(l))}catch(c){d(c)}},p=l=>{try{f(r.throw(l))}catch(c){d(c)}},f=l=>l.done?h(l.value):Promise.resolve(l.value).then(g,p);f((r=r.apply(e,t)).next())});import{d as z,f as Y,S as Z,h as j,Z as _,_ as E,k as q,a5 as S,a1 as F,a6 as I,a4 as w,a8 as H,a0 as A,G as J}from"./vue-72a104e4.js";import{I as K,p as Q,u as U,B as W,o as X,v as x,i as ee,R as te,a2 as ne,G as ae,aY as re,_ as se}from"./index.js";import{a$ as D}from"./antd-0679333d.js";const oe=z({name:"LayoutBreadcrumb",components:{Icon:K,[D.name]:D},props:{theme:Q.oneOf(["dark","light"])},setup(){const e=Y([]),{currentRoute:t}=Z(),{prefixCls:r}=U("layout-breadcrumb"),{getShowBreadCrumbIcon:h}=W(),d=X(),{t:g}=x();j(()=>P(this,null,function*(){var C,y,$;if(t.value.name===te)return;const s=yield ne(),n=t.value.matched,a=n==null?void 0:n[n.length-1];let o=t.value.path;a&&((C=a==null?void 0:a.meta)!=null&&C.currentActiveMenu)&&(o=a.meta.currentActiveMenu);const u=ae(s,o),m=s.filter(N=>N.path===u[0]),i=p(m,u);if(!i||i.length===0)return;const b=f(i);(y=t.value.meta)!=null&&y.currentActiveMenu&&b.push(B(k({},t.value),{name:(($=t.value.meta)==null?void 0:$.title)||t.value.name})),e.value=b}));function p(s,n){const a=[];return s.forEach(o=>{var u,m;n.includes(o.path)&&a.push(B(k({},o),{name:((u=o.meta)==null?void 0:u.title)||o.name})),(m=o.children)!=null&&m.length&&a.push(...p(o.children,n))}),a}function f(s){return re(s,n=>{const{meta:a,name:o}=n;if(!a)return!!o;const{title:u,hideBreadcrumb:m,hideMenu:i}=a;return!(!u||m||i)}).filter(n=>{var a;return!((a=n.meta)!=null&&a.hideBreadcrumb)})}function l(s,n,a){a==null||a.preventDefault();const{children:o,redirect:u,meta:m}=s;if(o!=null&&o.length&&!u){a==null||a.stopPropagation();return}if(!(m!=null&&m.carryParam))if(u&&ee(u))d(u);else{let i="";n.length===1?i=n[0]:i=`${n.slice(1).pop()||""}`,i=/^\//.test(i)?i:`/${i}`,d(i)}}function c(s,n){return s.indexOf(n)!==s.length-1}function v(s){var n;return s.icon||((n=s.meta)==null?void 0:n.icon)}return{routes:e,t:g,prefixCls:r,getIcon:v,getShowBreadCrumbIcon:h,handleClick:l,hasRedirect:c}}});const ce={key:1};function ie(e,t,r,h,d,g){const p=I("Icon"),f=I("router-link"),l=I("a-breadcrumb");return _(),E("div",{class:F([e.prefixCls,`${e.prefixCls}--${e.theme}`])},[q(l,{routes:e.routes},{itemRender:S(({route:c,routes:v,paths:s})=>[e.getShowBreadCrumbIcon&&e.getIcon(c)?(_(),w(p,{key:0,icon:e.getIcon(c)},null,8,["icon"])):H("",!0),e.hasRedirect(v,c)?(_(),w(f,{key:2,to:"",onClick:n=>e.handleClick(c,s,n)},{default:S(()=>[J(A(e.t(c.name||c.meta.title)),1)]),_:2},1032,["onClick"])):(_(),E("span",ce,A(e.t(c.name||c.meta.title)),1))]),_:1},8,["routes"])],2)}const de=se(oe,[["render",ie]]);export{de as default};
