var V=Object.defineProperty,T=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var M=(e,t,r)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,C=(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},y=(e,t)=>T(e,G(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 U,S as Z,h as j,Z as _,_ as E,k as q,a5 as S,a1 as F,a6 as B,a4 as w,a8 as H,a0 as A,G as J}from"./vue-08ef39cb.js";import{I as K,p as Q,u as W,y as X,k as Y,o as x,i as ee,R as te,$ as ne,B as ae,aV as re,_ as se}from"./index.js";import{aU as D}from"./antd-fb8ca017.js";const oe=z({name:"LayoutBreadcrumb",components:{Icon:K,[D.name]:D},props:{theme:Q.oneOf(["dark","light"])},setup(){const e=U([]),{currentRoute:t}=Z(),{prefixCls:r}=W("layout-breadcrumb"),{getShowBreadCrumbIcon:h}=X(),d=Y(),{t:g}=x();j(()=>P(this,null,function*(){var k,I,$;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&&((k=a==null?void 0:a.meta)!=null&&k.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 v=f(i);(I=t.value.meta)!=null&&I.currentActiveMenu&&v.push(y(C({},t.value),{name:(($=t.value.meta)==null?void 0:$.title)||t.value.name})),e.value=v}));function p(s,n){const a=[];return s.forEach(o=>{var u,m;n.includes(o.path)&&a.push(y(C({},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 b(s){var n;return s.icon||((n=s.meta)==null?void 0:n.icon)}return{routes:e,t:g,prefixCls:r,getIcon:b,getShowBreadCrumbIcon:h,handleClick:l,hasRedirect:c}}});const ce={key:1};function ie(e,t,r,h,d,g){const p=B("Icon"),f=B("router-link"),l=B("a-breadcrumb");return _(),E("div",{class:F([e.prefixCls,`${e.prefixCls}--${e.theme}`])},[q(l,{routes:e.routes},{itemRender:S(({route:c,routes:b,paths:s})=>[e.getShowBreadCrumbIcon&&e.getIcon(c)?(_(),w(p,{key:0,icon:e.getIcon(c)},null,8,["icon"])):H("",!0),e.hasRedirect(b,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};
