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