var T=Object.defineProperty,B=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var v=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e||(e={}))$.call(e,r)&&v(t,r,e[r]);if(N)for(var r of N(e))k.call(e,r)&&v(t,r,e[r]);return t},w=(t,e)=>B(t,E(e));(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("clipboard")):typeof define=="function"&&define.amd?define(["exports","vue","clipboard"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";const r=Symbol("dCollapse"),V={modelValue:{type:[String,Number,Array],default:"",required:!0},accordion:{type:Boolean,default:!1}},b={name:{type:[String,Number],default:"",required:!0},title:{type:String,default:""},disabled:{type:Boolean,default:!1}};function h(o,a,i){let u=o;return a&&(u+=`__${a}`),i&&(u+=`--${i}`),u}function g(o,a=!1){const i=a?`.devui-${o}`:`devui-${o}`;return{b:()=>h(i),e:l=>l?h(i,l):"",m:l=>l?h(i,"",l):"",em:(l,f)=>l&&f?h(i,l,f):""}}var P="",C=e.defineComponent({name:"DCollapse",props:V,emits:["change","update:modelValue"],setup(o,a){const i=g("collapse"),u=g("scrollbar"),m=s=>!s&&s!==0?[]:Array.isArray(s)?s:[s],n=s=>{const l=[...m(o.modelValue)],f=l.indexOf(s);if(o.accordion){let p=s;(l[0]||l[0]===0)&&l[0]===s&&(p=""),a.emit("update:modelValue",p),a.emit("change",p)}else f>-1?l.splice(f,1):l.push(s),a.emit("update:modelValue",l),a.emit("change",l)};return e.provide(r,e.reactive(w(L({},e.toRefs(o)),{collapseItemClick:n}))),()=>{var s,l;return e.createVNode("div",{class:[i.b(),u.b()]},[(l=(s=a.slots).default)==null?void 0:l.call(s)])}}});function I(){return e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:`M3.64644661,5.64644661 C3.82001296,5.47288026 4.08943736,5.45359511 4.2843055,5.58859116 L4.35355339,5.64644661 
          L8,9.293 L11.6464466,5.64644661 C11.820013,5.47288026 12.0894374,5.45359511 12.2843055,5.58859116 L12.3535534,5.64644661 
          C12.5271197,5.82001296 12.5464049,6.08943736 12.4114088,6.2843055 L12.3535534,6.35355339 L8.35355339,10.3535534 
          C8.17998704,10.5271197 7.91056264,10.5464049 7.7156945,10.4114088 L7.64644661,10.3535534 L3.64644661,6.35355339 
          C3.45118446,6.15829124 3.45118446,5.84170876 3.64644661,5.64644661 Z`},null)])])}var y=e.defineComponent({name:"DCollapseItem",props:b,setup(o,a){const i=g("collapse"),u=g("collapse-transition"),m=e.shallowRef(),n=e.inject(r,null),s=e.computed(()=>o.disabled?!1:Array.isArray(n==null?void 0:n.modelValue)?Boolean(n==null?void 0:n.modelValue.length)&&(n==null?void 0:n.modelValue.includes(o.name)):Boolean(n==null?void 0:n.modelValue)&&(n==null?void 0:n.modelValue)===o.name),l=d=>{d.preventDefault(),o.disabled||n==null||n.collapseItemClick(o.name)};e.onMounted(()=>{if(m.value){const d=m.value;s.value&&(d.style.height=`${d.offsetHeight}px`)}});const f=d=>{const c=d;c.style.height="";const A=c.offsetHeight;c.style.height="0px",c.offsetHeight,c.style.height=`${A}px`},p=d=>{const c=d;c.style.height="0px"};return()=>e.createVNode("div",{class:i.e("item")},[e.createVNode("div",{class:[i.e("item-title"),i.m("overflow-ellipsis"),s.value&&i.m("open"),o.disabled&&i.em("item","disabled")],onClick:l},[a.slots.title?a.slots.title():o.title,e.createVNode("span",{class:i.e("open-icon")},[e.createVNode(I,null,null)])]),e.createVNode(e.Transition,{name:u.b(),onEnter:f,onLeave:p},{default:()=>{var d,c;return[s.value&&e.createVNode("div",{ref:m,class:i.e("item-content")},[(c=(d=a.slots).default)==null?void 0:c.call(d)])]}})])}}),S={title:"Collapse \u6298\u53E0\u9762\u677F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(o){o.component(C.name,C),o.component(y.name,y)}};t.Collapse=C,t.CollapseItem=y,t.collapseItemProps=b,t.collapseProps=V,t.default=S,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
