@wikimedia/codex
Version:
Codex Design System for Wikimedia
1 lines • 172 kB
JavaScript
"use strict";var jo=Object.defineProperty,Uo=Object.defineProperties;var Wo=Object.getOwnPropertyDescriptors;var qe=Object.getOwnPropertySymbols;var At=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var dt=(e,o,n)=>o in e?jo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,X=(e,o)=>{for(var n in o||(o={}))At.call(o,n)&&dt(e,n,o[n]);if(qe)for(var n of qe(o))Dt.call(o,n)&&dt(e,n,o[n]);return e},le=(e,o)=>Uo(e,Wo(o));var re=(e,o)=>{var n={};for(var l in e)At.call(e,l)&&o.indexOf(l)<0&&(n[l]=e[l]);if(e!=null&&qe)for(var l of qe(e))o.indexOf(l)<0&&Dt.call(e,l)&&(n[l]=e[l]);return n};var fe=(e,o,n)=>dt(e,typeof o!="symbol"?o+"":o,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),qo='<path d="M11.53 2.3A1.85 1.85 0 0010 1.21 1.85 1.85 0 008.48 2.3L.36 16.36C-.48 17.81.21 19 1.88 19h16.24c1.67 0 2.36-1.19 1.52-2.64zM11 16H9v-2h2zm0-4H9V6h2z"/>',Qo='<path d="M12.43 14.34A5 5 0 0110 15a5 5 0 113.95-2L17 16.09V3a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 001.45-.63z"/><circle cx="10" cy="10" r="3"/>',Go='<path d="M7 14.17 2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/>',Yo='<path d="M10 0a10 10 0 1010 10A10 10 0 0010 0m5.66 14.24-1.41 1.41L10 11.41l-4.24 4.25-1.42-1.42L8.59 10 4.34 5.76l1.42-1.42L10 8.59l4.24-4.24 1.41 1.41L11.41 10z"/>',Xo='<path d="m4.34 2.93 12.73 12.73-1.41 1.41L2.93 4.35z"/><path d="M17.07 4.34 4.34 17.07l-1.41-1.41L15.66 2.93z"/>',Jo='<path d="M10 15 2 5h16z"/>',Zo='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',en='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',tn='<path d="M2 2a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V4a2 2 0 00-2-2zm-.17 13 4.09-5.25 2.92 3.51L12.92 8l5.25 7z"/>',on='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',nn='<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7"/>',ln='<path d="M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0M9 5h2v2H9zm0 4h2v6H9z"/>',an='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',sn='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',rn='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',dn='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',un='<path d="M12.2 13.6a7 7 0 111.4-1.4l5.4 5.4-1.4 1.4zM3 8a5 5 0 1010 0A5 5 0 003 8"/>',cn='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',pn='<path d="M10 20a10 10 0 010-20 10 10 0 110 20m-2-5 9-8.5L15.5 5 8 12 4.5 8.5 3 10z"/>',fn='<path d="m10 5 8 10H2z"/>',Ht=qo,mn=Qo,hn=Go,vn=Yo,tt=Xo,gn=Jo,jt=Zo,Ut=en,bn=tn,yn=on,Wt={langCodeMap:{ar:nn},default:ln},Cn={ltr:an,shouldFlip:!0},wn={ltr:sn,shouldFlip:!0},qt={ltr:rn,shouldFlip:!0},Qt={ltr:dn,shouldFlip:!0},kn=un,$n=cn,Gt=pn,Bn=fn;function Sn(e,o,n){if(typeof e=="string"||"path"in e)return e;if("shouldFlip"in e)return e.ltr;if("rtl"in e)return n==="rtl"?e.rtl:e.ltr;const l=o in e.langCodeMap?e.langCodeMap[o]:e.default;return typeof l=="string"||"path"in l?l:l.ltr}function In(e,o){if(typeof e=="string")return!1;if("langCodeMap"in e){const n=o in e.langCodeMap?e.langCodeMap[o]:e.default;if(typeof n=="string")return!1;e=n}if("shouldFlipExceptions"in e&&Array.isArray(e.shouldFlipExceptions)){const n=e.shouldFlipExceptions.indexOf(o);return n===void 0||n===-1}return"shouldFlip"in e?e.shouldFlip:!1}function Ke(e){const o=t.ref(null);return t.onMounted(()=>{const n=window.getComputedStyle(e.value).direction;o.value=n==="ltr"||n==="rtl"?n:null}),o}function Yt(e){const o=t.ref("");return t.onMounted(()=>{let n=e.value;for(;n&&n.lang==="";)n=n.parentElement;o.value=n?n.lang:null}),o}function G(e){return o=>typeof o=="string"&&e.includes(o)}const Fe="cdx",Vn=["default","progressive","destructive"],xn=["normal","primary","quiet"],En=["small","medium","large"],Nn=["x-small","small","medium"],An=["notice","warning","error","success"],Xt=G(An),Dn=["text","search","number","email","month","password","tel","url","week","date","datetime-local","time"],pe=["default","warning","error","success"],Mn=["start","center","end","number"],Ln=["16:9","3:2","4:3","1:1","3:4","2:3"],Tn=G(Ln),Rn=["fill","contain","cover","none","scale-down"],On=G(Rn),Pn=["top","bottom","left","right","center"],Fn=G(Pn),zn=["none","minimal","divider","outline"],_n=120,Kn=500,Ae="cdx-menu-footer-item",Jt=Symbol("CdxTabs"),Zt=Symbol("CdxActiveTab"),eo=Symbol("CdxAllowArbitrary"),to=Symbol("CdxFieldInputId"),ot=Symbol("CdxFieldDescriptionId"),oo=Symbol("CdxFieldStatus"),no=Symbol("CdxDisabled"),Hn="".concat(Fe,"-no-invert"),Ye=Symbol("CdxTableRowIdentifier"),jn=["top","bottom","both"],lo={left:"right","left-start":"right","left-end":"right",top:"bottom","top-start":"bottom","top-end":"bottom",bottom:"top","bottom-start":"top","bottom-end":"top",right:"left","right-start":"left","right-end":"left"},Un=G(Nn),Wn=t.defineComponent({name:"CdxIcon",props:{icon:{type:[String,Object],required:!0},iconLabel:{type:String,default:""},lang:{type:String,default:null},dir:{type:String,default:null},size:{type:String,default:"medium",validator:Un}},setup(e){const o=t.ref(),n=Ke(o),l=Yt(o),a=t.computed(()=>{var c;return(c=e.dir)!=null?c:n.value}),d=t.computed(()=>{var c;return(c=e.lang)!=null?c:l.value}),i=t.computed(()=>({"cdx-icon--flipped":a.value==="rtl"&&d.value!==null&&In(e.icon,d.value),["cdx-icon--".concat(e.size)]:!0})),s=t.computed(()=>{var c,p;return Sn(e.icon,(c=d.value)!=null?c:"",(p=a.value)!=null?p:"ltr")}),r=t.computed(()=>typeof s.value=="string"?s.value:""),u=t.computed(()=>typeof s.value!="string"?s.value.path:"");return{rootElement:o,rootClasses:i,iconSvg:r,iconPath:u}}}),_=(e,o)=>{const n=e.__vccOpts||e;for(const[l,a]of o)n[l]=a;return n},qn=["aria-hidden"],Qn={key:0},Gn=["innerHTML"],Yn=["d"];function Xn(e,o,n,l,a,d){return t.openBlock(),t.createElementBlock("span",{ref:"rootElement",class:t.normalizeClass(["cdx-icon",e.rootClasses])},[(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":e.iconLabel?void 0:!0},[e.iconLabel?(t.openBlock(),t.createElementBlock("title",Qn,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("v-if",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,Gn)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,Yn))],8,qn))],2)}const Y=_(Wn,[["render",Xn]]);function ao(e){const o=[];for(const n of e)typeof n.type=="string"||typeof n.type=="object"?o.push(n):n.type!==t.Comment&&(typeof n.children=="string"&&n.children.trim()!==""?o.push(n.children):Array.isArray(n.children)&&o.push(...ao(n.children)));return o}function so(e,o){return typeof e.type=="object"&&"name"in e.type?o!==void 0?e.type.name===o:!0:!1}function Jn(e,o){return typeof e.type=="string"?e.type===o.toLowerCase():!1}function Le(e){const o=typeof e=="function"?e():e;return o?ao(o):[]}function nt(e,o){if(e()){t.warn(o);return}const n=t.watch(e,l=>{l&&(t.warn(o),n())})}function io(e,o,n){const l=t.computed(()=>{const a=Le(e);if(a.length!==1)return!1;const d=a[0];return!!(typeof d=="object"&&(so(d,"CdxIcon")||Jn(d,"svg")))});return nt(()=>l.value&&!o["aria-label"]&&!o["aria-hidden"],"".concat(n,": Icon-only buttons require one of the following attributes: aria-label or aria-hidden. See documentation at https://doc.wikimedia.org/codex/latest/components/demos/button.html#icon-only-button")),l}const Zn=G(Vn),el=G(xn),tl=G(En),ol=t.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:Zn},weight:{type:String,default:"normal",validator:el},size:{type:String,default:"medium",validator:tl}},emits:["click"],setup(e,{emit:o,slots:n,attrs:l}){const a=t.ref(),d=io(n.default,l,"CdxButton"),i=t.ref(!1),s=t.computed(()=>({["cdx-button--action-".concat(e.action)]:!0,["cdx-button--weight-".concat(e.weight)]:!0,["cdx-button--size-".concat(e.size)]:!0,"cdx-button--framed":e.weight!=="quiet","cdx-button--icon-only":d.value,"cdx-button--is-active":i.value})),r=f=>{o("click",f)},u=f=>{i.value=f};function c(){u(!0)}function p(){var f;u(!1),(f=a.value)==null||f.click()}return{button:a,rootClasses:s,onClick:r,onKeyDown:c,onKeyUp:p}}});function nl(e,o,n,l,a,d){return t.openBlock(),t.createElementBlock("button",{ref:"button",class:t.normalizeClass(["cdx-button",e.rootClasses]),onKeydown:o[0]||(o[0]=t.withKeys(t.withModifiers((...i)=>e.onKeyDown&&e.onKeyDown(...i),["prevent"]),["space","enter"])),onKeyup:o[1]||(o[1]=t.withKeys((...i)=>e.onKeyUp&&e.onKeyUp(...i),["space","enter"])),onClick:o[2]||(o[2]=(...i)=>e.onClick&&e.onClick(...i))},[t.renderSlot(e.$slots,"default")],34)}const de=_(ol,[["render",nl]]);function He(e,o,n,l){return t.computed({get:()=>{var a;return(a=o.value)!=null?a:e.value},set:a=>{o.value!==null?n(l||"update:modelValue",a):e.value=a}})}const ll=G(zn),al=t.defineComponent({name:"CdxAccordion",components:{CdxButton:de,CdxIcon:Y},props:{modelValue:{type:[Boolean,null],default:null},actionAlwaysVisible:{type:Boolean,default:!1},separation:{type:String,default:"divider",validator:ll},actionIcon:{type:[String,Object],default:null},actionButtonLabel:{type:String,default:""},headingLevel:{type:String,default:"h3"}},emits:["action-button-click","update:modelValue","toggle"],setup(e,{attrs:o,emit:n}){const l=t.ref("open"in o),a=He(l,t.toRef(e,"modelValue"),n),d=()=>{n("action-button-click")},i=u=>{a.value=u.newState==="open",n("toggle",a.value)},s=t.computed(()=>e.actionIcon?a.value?!0:!!e.actionAlwaysVisible:!1),r=t.computed(()=>({"cdx-accordion--has-icon":s.value,["cdx-accordion--separation-".concat(e.separation)]:!0}));return{emitActionButtonClick:d,rootClasses:r,shouldShowActionButton:s,onToggle:i,computedOpen:a}}}),sl=["open"],il={class:"cdx-accordion__header__title"},rl={class:"cdx-accordion__header__description"};function dl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("details",{class:t.normalizeClass(["cdx-accordion",e.rootClasses]),open:e.computedOpen||void 0,onToggle:o[1]||(o[1]=(...r)=>e.onToggle&&e.onToggle(...r))},[t.createElementVNode("summary",null,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.headingLevel),{class:"cdx-accordion__header"},{default:t.withCtx(()=>[t.createElementVNode("span",il,[t.renderSlot(e.$slots,"title")]),t.createElementVNode("span",rl,[t.renderSlot(e.$slots,"description")])]),_:3})),e.shouldShowActionButton?(t.openBlock(),t.createBlock(s,{key:0,class:"cdx-accordion__action","aria-label":e.actionButtonLabel,type:"button",weight:"quiet",onClick:t.withModifiers(e.emitActionButtonClick,["stop"])},{default:t.withCtx(()=>[t.createVNode(i,{icon:e.actionIcon,"icon-label":e.actionButtonLabel,size:"medium"},null,8,["icon","icon-label"])]),_:1},8,["aria-label","onClick"])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",{class:"cdx-accordion__content",onClick:o[0]||(o[0]=t.withModifiers(()=>{},["stop"]))},[t.renderSlot(e.$slots,"default")])],42,sl)}const ul=_(al,[["render",dl]]);function ro(e){return e.label===void 0?e.value:e.label===null?"":e.label}function uo(e){const o=t.ref(),n=t.ref(),l=t.ref(new Map),a=Ke(o);function d(h,v){const g=h;g&&l.value.set(v,g)}function i(h){n.value=h}function s(){n.value=void 0}function r(h,v){var B;const g=h+v,w=e.value[g];if(w)if(w.disabled)r(g,v);else{const I=(B=l.value.get(g))==null?void 0:B.$el;I==null||I.focus()}}function u(){var h;r((h=n.value)!=null?h:-1,1)}function c(){var h;r((h=n.value)!=null?h:e.value.length,-1)}function p(){a.value==="rtl"?c():u()}function f(){a.value==="rtl"?u():c()}function m(h){switch(h.key){case"ArrowRight":h.preventDefault(),p();break;case"ArrowLeft":h.preventDefault(),f();break;case"ArrowDown":h.preventDefault(),u();break;case"ArrowUp":h.preventDefault(),c();break}}return{rootElement:o,assignTemplateRef:d,onFocus:i,onBlur:s,onKeydown:m}}const cl=t.defineComponent({name:"CdxButtonGroup",components:{CdxButton:de,CdxIcon:Y},props:{buttons:{type:Array,required:!0,validator:e=>Array.isArray(e)&&e.length>=1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(e){const{rootElement:o,assignTemplateRef:n,onFocus:l,onBlur:a,onKeydown:d}=uo(t.toRef(e,"buttons"));return{rootElement:o,assignTemplateRef:n,onFocus:l,onBlur:a,onKeydown:d,getButtonLabel:ro}}}),pl={ref:"rootElement",class:"cdx-button-group"};function fl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",pl,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.buttons,(r,u)=>(t.openBlock(),t.createBlock(s,{key:r.value,ref_for:!0,ref:c=>e.assignTemplateRef(c,u),disabled:r.disabled||e.disabled,"aria-label":r.ariaLabel,onClick:c=>e.$emit("click",r.value),onFocus:c=>e.onFocus(u),onBlur:e.onBlur,onKeydown:e.onKeydown},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{button:r},()=>[r.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:r.icon},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createTextVNode(" "+t.toDisplayString(e.getButtonLabel(r)),1)])]),_:2},1032,["disabled","aria-label","onClick","onFocus","onBlur","onKeydown"]))),128))],512)}const ml=_(cl,[["render",fl]]),hl=t.defineComponent({name:"CdxThumbnail",components:{CdxIcon:Y},props:{thumbnail:{type:[Object,null],default:null},placeholderIcon:{type:[String,Object],default:yn}},setup:e=>{const o=t.ref(!1),n=t.ref({}),l=a=>{const d=a.replace(/([\\"\n])/g,"\\$1"),i=new Image;i.onload=()=>{n.value={backgroundImage:'url("'.concat(d,'")')},o.value=!0},i.onerror=()=>{o.value=!1},i.src=d};return t.onMounted(()=>{var a;(a=e.thumbnail)!=null&&a.url&&l(e.thumbnail.url)}),t.watch(t.toRef(e,"thumbnail"),(a,d)=>{if(!(a!=null&&a.url)){o.value=!1,n.value={};return}(d==null?void 0:d.url)!==a.url&&(o.value=!1,l(a.url))},{deep:!0}),{thumbnailStyle:n,thumbnailLoaded:o,NoInvertClass:Hn}}}),vl={class:"cdx-thumbnail"},gl={key:0,class:"cdx-thumbnail__placeholder"};function bl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-icon");return t.openBlock(),t.createElementBlock("span",vl,[e.thumbnailLoaded?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",gl,[t.createVNode(i,{icon:e.placeholderIcon,class:"cdx-thumbnail__placeholder__icon--vue"},null,8,["icon"])])),t.createVNode(t.Transition,{name:"cdx-thumbnail__image"},{default:t.withCtx(()=>[e.thumbnailLoaded?(t.openBlock(),t.createElementBlock("span",{key:0,style:t.normalizeStyle(e.thumbnailStyle),class:t.normalizeClass([e.NoInvertClass,"cdx-thumbnail__image"])},null,6)):t.createCommentVNode("v-if",!0)]),_:1})])}const gt=_(hl,[["render",bl]]),yl=t.defineComponent({name:"CdxCard",components:{CdxIcon:Y,CdxThumbnail:gt},props:{url:{type:String,default:""},icon:{type:[String,Object],default:""},thumbnail:{type:[Object,null],default:null},forceThumbnail:{type:Boolean,default:!1},customPlaceholderIcon:{type:[String,Object],default:void 0}},setup(e){const o=t.computed(()=>!!e.url),n=t.computed(()=>o.value?"a":"span"),l=t.computed(()=>o.value?e.url:void 0);return{isLink:o,contentTag:n,cardLink:l}}}),Cl={class:"cdx-card__text"},wl={class:"cdx-card__text__title"},kl={key:0,class:"cdx-card__text__description"},$l={key:1,class:"cdx-card__text__supporting-text"};function Bl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-thumbnail"),s=t.resolveComponent("cdx-icon");return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.contentTag),{href:e.cardLink,class:t.normalizeClass(["cdx-card",{"cdx-card--is-link":e.isLink,"cdx-card--title-only":!e.$slots.description&&!e.$slots["supporting-text"]}])},{default:t.withCtx(()=>[e.thumbnail||e.forceThumbnail?(t.openBlock(),t.createBlock(i,{key:0,thumbnail:e.thumbnail,"placeholder-icon":e.customPlaceholderIcon,class:"cdx-card__thumbnail"},null,8,["thumbnail","placeholder-icon"])):e.icon?(t.openBlock(),t.createBlock(s,{key:1,icon:e.icon,class:"cdx-card__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",Cl,[t.createElementVNode("span",wl,[t.renderSlot(e.$slots,"title")]),e.$slots.description?(t.openBlock(),t.createElementBlock("span",kl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0),e.$slots["supporting-text"]?(t.openBlock(),t.createElementBlock("span",$l,[t.renderSlot(e.$slots,"supporting-text")])):t.createCommentVNode("v-if",!0)])]),_:3},8,["href","class"])}const Sl=_(yl,[["render",Bl]]);function bt(e){const o=t.inject(no,t.ref(!1));return t.computed(()=>o.value||e.value)}function ae(e,o,n){const l=bt(e),a=t.inject(oo,t.ref("default")),d=t.computed(()=>o!=null&&o.value&&o.value!=="default"?o.value:a.value),i=t.inject(to,void 0),s=t.computed(()=>{var r;return(r=i==null?void 0:i.value)!=null?r:n});return{computedDisabled:l,computedStatus:d,computedInputId:s}}function oe(e,o=t.computed(()=>({}))){const n=t.computed(()=>{const d=re(o.value,[]);return e.class&&e.class.split(" ").forEach(s=>{d[s]=!0}),d}),l=t.computed(()=>{if("style"in e)return e.style}),a=t.computed(()=>{const r=e,{class:d,style:i}=r;return re(r,["class","style"])});return{rootClasses:n,rootStyle:l,otherAttrs:a}}function J(e,o,n=[]){const l=t.inject("CdxI18nFunction",void 0);return t.computed(()=>{const a=n.map(i=>typeof i=="function"?i():i.value),d=l==null?void 0:l(e,...a);return d!=null?d:typeof o=="function"?o(...a):o})}function je(e,o,n,l=[]){const a=J(o,n,l);return t.computed(()=>e.value||a.value)}const Il=t.defineComponent({name:"CdxLabel",components:{CdxIcon:Y},inheritAttrs:!1,props:{icon:{type:[String,Object],default:null},optional:{type:Boolean,default:!1},optionalFlag:{type:String,default:"",validator:(e,o)=>e.length>0&&!o.optional?(console.warn("[CdxLabel]: The boolean `optional` prop is required to show the optional flag.\n\nRefer to https://doc.wikimedia.org/codex/latest/components/demos/label.html#props."),!1):!0},visuallyHidden:{type:Boolean,default:!1},isLegend:{type:Boolean,default:!1},inputId:{type:String,default:""},descriptionId:{type:String,default:""},disabled:{type:Boolean,default:!1}},setup(e,{attrs:o}){const{computedDisabled:n}=ae(t.toRef(e,"disabled")),l=t.computed(()=>({"cdx-label--visually-hidden":e.visuallyHidden,"cdx-label--disabled":n.value})),{rootClasses:a,rootStyle:d,otherAttrs:i}=oe(o,l),s=je(t.toRef(e,"optionalFlag"),"cdx-label-optional-flag","(optional)");return{rootClasses:a,rootStyle:d,otherAttrs:i,translatedOptionalFlag:s}}}),Vl=["for"],xl={class:"cdx-label__label__text"},El={key:1,class:"cdx-label__label__optional-flag"},Nl=["id"],Al={class:"cdx-label__label"},Dl={class:"cdx-label__label__text"},Ml={key:1,class:"cdx-label__label__optional-flag"},Ll={key:0,class:"cdx-label__description"};function Tl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-icon");return e.isLegend?(t.openBlock(),t.createElementBlock("legend",t.mergeProps({key:1,class:["cdx-label",e.rootClasses],style:e.rootStyle},e.otherAttrs),[t.createElementVNode("span",Al,[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",Dl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",Ml,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)]),e.$slots.description&&e.$slots.description().length>0?(t.openBlock(),t.createElementBlock("span",Ll,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0)],16)):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cdx-label",e.rootClasses]),style:t.normalizeStyle(e.rootStyle)},[t.createElementVNode("label",t.mergeProps({class:"cdx-label__label",for:e.inputId?e.inputId:void 0},e.otherAttrs),[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",xl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",El,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)],16,Vl),e.$slots.description&&e.$slots.description().length>0?(t.openBlock(),t.createElementBlock("span",{key:0,id:e.descriptionId||void 0,class:"cdx-label__description"},[t.renderSlot(e.$slots,"description")],8,Nl)):t.createCommentVNode("v-if",!0)],6))}const Te=_(Il,[["render",Tl]]);function lt(e,o,n){nt(()=>Le(e).length===0&&!(o!=null&&o["aria-label"])&&!(o!=null&&o["aria-labelledby"]),"".concat(n,": Inputs must have an associated label. Provide one of the following:\n - A label via the appropriate slot\n - An `aria-label` attribute set to the label text\n - An `aria-labelledby` attribute set to the ID of the label element"))}function ne(e,o,n){return t.computed({get:()=>e.value,set:l=>o(n||"update:modelValue",l)})}const Rl=G(pe),Ol=t.defineComponent({name:"CdxCheckbox",components:{CdxLabel:Te},props:{modelValue:{type:[Boolean,Array],default:!1},inputValue:{type:[String,Number,Boolean],default:!1},name:{type:String,default:null},disabled:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},inline:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},status:{type:String,default:"default",validator:Rl}},emits:["update:modelValue"],setup(e,{emit:o,slots:n,attrs:l}){var f;lt((f=n.default)==null?void 0:f.call(n),l,"CdxCheckbox");const{computedDisabled:a,computedStatus:d}=ae(t.toRef(e,"disabled"),t.toRef(e,"status")),i=t.computed(()=>({"cdx-checkbox--inline":e.inline,["cdx-checkbox--status-".concat(d.value)]:!0})),s=t.computed(()=>({"cdx-checkbox__custom-input--inline":e.inline})),r=t.ref(),u=t.useId(),c=t.useId(),p=ne(t.toRef(e,"modelValue"),o);return{rootClasses:i,computedDisabled:a,input:r,checkboxId:u,descriptionId:c,wrappedModel:p,customInputClasses:s}}}),Pl={class:"cdx-checkbox__wrapper"},Fl=["id","aria-describedby","value","name","disabled",".indeterminate"];function zl(e,o,n,l,a,d){const i=t.resolveComponent("cdx-label");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["cdx-checkbox",e.rootClasses])},[t.createElementVNode("div",Pl,[t.withDirectives(t.createElementVNode("input",{id:e.checkboxId,ref:"input","onUpdate:modelValue":o[0]||(o[0]=s=>e.wrappedModel=s),class:"cdx-checkbox__input",type:"checkbox","aria-describedby":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,value:e.inputValue,name:e.name,disabled:e.computedDisabled,".indeterminate":e.indeterminate},null,40,Fl),[[t.vModelCheckbox,e.wrappedModel]]),o[1]||(o[1]=t.createElementVNode("span",{class:"cdx-checkbox__icon"},null,-1)),e.$slots.default&&e.$slots.default().length?(t.openBlock(),t.createBlock(i,{key:0,class:"cdx-checkbox__label","input-id":e.checkboxId,"description-id":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,disabled:e.computedDisabled,"visually-hidden":e.hideLabel},t.createSlots({default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:2},[e.$slots.description&&e.$slots.description().length>0?{name:"description",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"description")]),key:"0"}:void 0]),1032,["input-id","description-id","disabled","visually-hidden"])):t.createCommentVNode("v-if",!0)]),e.$slots["custom-input"]?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cdx-checkbox__custom-input",e.customInputClasses])},[t.renderSlot(e.$slots,"custom-input")],2)):t.createCommentVNode("v-if",!0)],2)}const co=_(Ol,[["render",zl]]),_l=["top","right","bottom","left"],ye=Math.min,se=Math.max,Xe=Math.round,Qe=Math.floor,me=e=>({x:e,y:e}),Kl={left:"right",right:"left",bottom:"top",top:"bottom"},Hl={start:"end",end:"start"};function pt(e,o,n){return se(e,ye(o,n))}function Be(e,o){return typeof e=="function"?e(o):e}function Ce(e){return e.split("-")[0]}function Re(e){return e.split("-")[1]}function po(e){return e==="x"?"y":"x"}function yt(e){return e==="y"?"height":"width"}function ke(e){return["top","bottom"].includes(Ce(e))?"y":"x"}function Ct(e){return po(ke(e))}function jl(e,o,n){n===void 0&&(n=!1);const l=Re(e),a=Ct(e),d=yt(a);let i=a==="x"?l===(n?"end":"start")?"right":"left":l==="start"?"bottom":"top";return o.reference[d]>o.floating[d]&&(i=Je(i)),[i,Je(i)]}function Ul(e){const o=Je(e);return[ft(e),o,ft(o)]}function ft(e){return e.replace(/start|end/g,o=>Hl[o])}function Wl(e,o,n){const l=["left","right"],a=["right","left"],d=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?o?a:l:o?l:a;case"left":case"right":return o?d:i;default:return[]}}function ql(e,o,n,l){const a=Re(e);let d=Wl(Ce(e),n==="start",l);return a&&(d=d.map(i=>i+"-"+a),o&&(d=d.concat(d.map(ft)))),d}function Je(e){return e.replace(/left|right|bottom|top/g,o=>Kl[o])}function Ql(e){return X({top:0,right:0,bottom:0,left:0},e)}function fo(e){return typeof e!="number"?Ql(e):{top:e,right:e,bottom:e,left:e}}function Ze(e){const{x:o,y:n,width:l,height:a}=e;return{width:l,height:a,top:n,left:o,right:o+l,bottom:n+a,x:o,y:n}}function Mt(e,o,n){let{reference:l,floating:a}=e;const d=ke(o),i=Ct(o),s=yt(i),r=Ce(o),u=d==="y",c=l.x+l.width/2-a.width/2,p=l.y+l.height/2-a.height/2,f=l[s]/2-a[s]/2;let m;switch(r){case"top":m={x:c,y:l.y-a.height};break;case"bottom":m={x:c,y:l.y+l.height};break;case"right":m={x:l.x+l.width,y:p};break;case"left":m={x:l.x-a.width,y:p};break;default:m={x:l.x,y:l.y}}switch(Re(o)){case"start":m[i]-=f*(n&&u?-1:1);break;case"end":m[i]+=f*(n&&u?-1:1);break}return m}const Gl=async(e,o,n)=>{const{placement:l="bottom",strategy:a="absolute",middleware:d=[],platform:i}=n,s=d.filter(Boolean),r=await(i.isRTL==null?void 0:i.isRTL(o));let u=await i.getElementRects({reference:e,floating:o,strategy:a}),{x:c,y:p}=Mt(u,l,r),f=l,m={},h=0;for(let v=0;v<s.length;v++){const{name:g,fn:w}=s[v],{x:B,y:I,data:V,reset:A}=await w({x:c,y:p,initialPlacement:l,placement:f,strategy:a,middlewareData:m,rects:u,platform:i,elements:{reference:e,floating:o}});c=B!=null?B:c,p=I!=null?I:p,m=le(X({},m),{[g]:X(X({},m[g]),V)}),A&&h<=50&&(h++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(u=A.rects===!0?await i.getElementRects({reference:e,floating:o,strategy:a}):A.rects),{x:c,y:p}=Mt(u,f,r)),v=-1)}return{x:c,y:p,placement:f,strategy:a,middlewareData:m}};async function ze(e,o){var n;o===void 0&&(o={});const{x:l,y:a,platform:d,rects:i,elements:s,strategy:r}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Be(o,e),h=fo(m),g=s[f?p==="floating"?"reference":"floating":p],w=Ze(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(g)))==null||n?g:g.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:r})),B=p==="floating"?{x:l,y:a,width:i.floating.width,height:i.floating.height}:i.reference,I=await(d.getOffsetParent==null?void 0:d.getOffsetParent(s.floating)),V=await(d.isElement==null?void 0:d.isElement(I))?await(d.getScale==null?void 0:d.getScale(I))||{x:1,y:1}:{x:1,y:1},A=Ze(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:B,offsetParent:I,strategy:r}):B);return{top:(w.top-A.top+h.top)/V.y,bottom:(A.bottom-w.bottom+h.bottom)/V.y,left:(w.left-A.left+h.left)/V.x,right:(A.right-w.right+h.right)/V.x}}const Yl=e=>({name:"arrow",options:e,async fn(o){const{x:n,y:l,placement:a,rects:d,platform:i,elements:s,middlewareData:r}=o,{element:u,padding:c=0}=Be(e,o)||{};if(u==null)return{};const p=fo(c),f={x:n,y:l},m=Ct(a),h=yt(m),v=await i.getDimensions(u),g=m==="y",w=g?"top":"left",B=g?"bottom":"right",I=g?"clientHeight":"clientWidth",V=d.reference[h]+d.reference[m]-f[m]-d.floating[h],A=f[m]-d.reference[m],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let x=E?E[I]:0;(!x||!await(i.isElement==null?void 0:i.isElement(E)))&&(x=s.floating[I]||d.floating[h]);const L=V/2-A/2,b=x/2-v[h]/2-1,k=ye(p[w],b),C=ye(p[B],b),$=k,D=x-v[h]-C,P=x/2-v[h]/2+L,H=pt($,P,D),j=!r.arrow&&Re(a)!=null&&P!==H&&d.reference[h]/2-(P<$?k:C)-v[h]/2<0,F=j?P<$?P-$:P-D:0;return{[m]:f[m]+F,data:X({[m]:H,centerOffset:P-H-F},j&&{alignmentOffset:F}),reset:j}}}),Xl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(o){var n,l;const{placement:a,middlewareData:d,rects:i,initialPlacement:s,platform:r,elements:u}=o,P=Be(e,o),{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0}=P,g=re(P,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const w=Ce(a),B=ke(s),I=Ce(s)===s,V=await(r.isRTL==null?void 0:r.isRTL(u.floating)),A=f||(I||!v?[Je(s)]:Ul(s)),E=h!=="none";!f&&E&&A.push(...ql(s,v,h,V));const x=[s,...A],L=await ze(o,g),b=[];let k=((l=d.flip)==null?void 0:l.overflows)||[];if(c&&b.push(L[w]),p){const H=jl(a,i,V);b.push(L[H[0]],L[H[1]])}if(k=[...k,{placement:a,overflows:b}],!b.every(H=>H<=0)){var C,$;const H=(((C=d.flip)==null?void 0:C.index)||0)+1,j=x[H];if(j)return{data:{index:H,overflows:k},reset:{placement:j}};let F=($=k.filter(T=>T.overflows[0]<=0).sort((T,z)=>T.overflows[1]-z.overflows[1])[0])==null?void 0:$.placement;if(!F)switch(m){case"bestFit":{var D;const T=(D=k.filter(z=>{if(E){const U=ke(z.placement);return U===B||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,S)=>U+S,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:D[0];T&&(F=T);break}case"initialPlacement":F=s;break}if(a!==F)return{reset:{placement:F}}}return{}}}};function Lt(e,o){return{top:e.top-o.height,right:e.right-o.width,bottom:e.bottom-o.height,left:e.left-o.width}}function Tt(e){return _l.some(o=>e[o]>=0)}const Jl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(o){const{rects:n}=o,d=Be(e,o),{strategy:l="referenceHidden"}=d,a=re(d,["strategy"]);switch(l){case"referenceHidden":{const i=await ze(o,le(X({},a),{elementContext:"reference"})),s=Lt(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Tt(s)}}}case"escaped":{const i=await ze(o,le(X({},a),{altBoundary:!0})),s=Lt(i,n.floating);return{data:{escapedOffsets:s,escaped:Tt(s)}}}default:return{}}}}};async function Zl(e,o){const{placement:n,platform:l,elements:a}=e,d=await(l.isRTL==null?void 0:l.isRTL(a.floating)),i=Ce(n),s=Re(n),r=ke(n)==="y",u=["left","top"].includes(i)?-1:1,c=d&&r?-1:1,p=Be(o,e);let{mainAxis:f,crossAxis:m,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return s&&typeof h=="number"&&(m=s==="end"?h*-1:h),r?{x:m*c,y:f*u}:{x:f*u,y:m*c}}const ea=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(o){var n,l;const{x:a,y:d,placement:i,middlewareData:s}=o,r=await Zl(o,e);return i===((n=s.offset)==null?void 0:n.placement)&&(l=s.arrow)!=null&&l.alignmentOffset?{}:{x:a+r.x,y:d+r.y,data:le(X({},r),{placement:i})}}}},ta=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(o){const{x:n,y:l,placement:a}=o,g=Be(e,o),{mainAxis:d=!0,crossAxis:i=!1,limiter:s={fn:w=>{let{x:B,y:I}=w;return{x:B,y:I}}}}=g,r=re(g,["mainAxis","crossAxis","limiter"]),u={x:n,y:l},c=await ze(o,r),p=ke(Ce(a)),f=po(p);let m=u[f],h=u[p];if(d){const w=f==="y"?"top":"left",B=f==="y"?"bottom":"right",I=m+c[w],V=m-c[B];m=pt(I,m,V)}if(i){const w=p==="y"?"top":"left",B=p==="y"?"bottom":"right",I=h+c[w],V=h-c[B];h=pt(I,h,V)}const v=s.fn(le(X({},o),{[f]:m,[p]:h}));return le(X({},v),{data:{x:v.x-n,y:v.y-l,enabled:{[f]:d,[p]:i}}})}}},oa=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(o){var n,l;const{placement:a,rects:d,platform:i,elements:s}=o,k=Be(e,o),{apply:r=()=>{}}=k,u=re(k,["apply"]),c=await ze(o,u),p=Ce(a),f=Re(a),m=ke(a)==="y",{width:h,height:v}=d.floating;let g,w;p==="top"||p==="bottom"?(g=p,w=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(w=p,g=f==="end"?"top":"bottom");const B=v-c.top-c.bottom,I=h-c.left-c.right,V=ye(v-c[g],B),A=ye(h-c[w],I),E=!o.middlewareData.shift;let x=V,L=A;if((n=o.middlewareData.shift)!=null&&n.enabled.x&&(L=I),(l=o.middlewareData.shift)!=null&&l.enabled.y&&(x=B),E&&!f){const C=se(c.left,0),$=se(c.right,0),D=se(c.top,0),P=se(c.bottom,0);m?L=h-2*(C!==0||$!==0?C+$:se(c.left,c.right)):x=v-2*(D!==0||P!==0?D+P:se(c.top,c.bottom))}await r(le(X({},o),{availableWidth:L,availableHeight:x}));const b=await i.getDimensions(s.floating);return h!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function at(){return typeof window!="undefined"}function Se(e){return wt(e)?(e.nodeName||"").toLowerCase():"#document"}function ie(e){var o;return(e==null||(o=e.ownerDocument)==null?void 0:o.defaultView)||window}function ve(e){var o;return(o=(wt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:o.documentElement}function wt(e){return at()?e instanceof Node||e instanceof ie(e).Node:!1}function ue(e){return at()?e instanceof Element||e instanceof ie(e).Element:!1}function he(e){return at()?e instanceof HTMLElement||e instanceof ie(e).HTMLElement:!1}function Rt(e){return!at()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof ie(e).ShadowRoot}function Ue(e){const{overflow:o,overflowX:n,overflowY:l,display:a}=ce(e);return/auto|scroll|overlay|hidden|clip/.test(o+l+n)&&!["inline","contents"].includes(a)}function na(e){return["table","td","th"].includes(Se(e))}function st(e){return[":popover-open",":modal"].some(o=>{try{return e.matches(o)}catch(n){return!1}})}function kt(e){const o=$t(),n=ue(e)?ce(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!o&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!o&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(l=>(n.willChange||"").includes(l))||["paint","layout","strict","content"].some(l=>(n.contain||"").includes(l))}function la(e){let o=we(e);for(;he(o)&&!Me(o);){if(kt(o))return o;if(st(o))return null;o=we(o)}return null}function $t(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Me(e){return["html","body","#document"].includes(Se(e))}function ce(e){return ie(e).getComputedStyle(e)}function it(e){return ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function we(e){if(Se(e)==="html")return e;const o=e.assignedSlot||e.parentNode||Rt(e)&&e.host||ve(e);return Rt(o)?o.host:o}function mo(e){const o=we(e);return Me(o)?e.ownerDocument?e.ownerDocument.body:e.body:he(o)&&Ue(o)?o:mo(o)}function _e(e,o,n){var l;o===void 0&&(o=[]),n===void 0&&(n=!0);const a=mo(e),d=a===((l=e.ownerDocument)==null?void 0:l.body),i=ie(a);if(d){const s=mt(i);return o.concat(i,i.visualViewport||[],Ue(a)?a:[],s&&n?_e(s):[])}return o.concat(a,_e(a,[],n))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ho(e){const o=ce(e);let n=parseFloat(o.width)||0,l=parseFloat(o.height)||0;const a=he(e),d=a?e.offsetWidth:n,i=a?e.offsetHeight:l,s=Xe(n)!==d||Xe(l)!==i;return s&&(n=d,l=i),{width:n,height:l,$:s}}function Bt(e){return ue(e)?e:e.contextElement}function De(e){const o=Bt(e);if(!he(o))return me(1);const n=o.getBoundingClientRect(),{width:l,height:a,$:d}=ho(o);let i=(d?Xe(n.width):n.width)/l,s=(d?Xe(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const aa=me(0);function vo(e){const o=ie(e);return!$t()||!o.visualViewport?aa:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function sa(e,o,n){return o===void 0&&(o=!1),!n||o&&n!==ie(e)?!1:o}function $e(e,o,n,l){o===void 0&&(o=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),d=Bt(e);let i=me(1);o&&(l?ue(l)&&(i=De(l)):i=De(e));const s=sa(d,n,l)?vo(d):me(0);let r=(a.left+s.x)/i.x,u=(a.top+s.y)/i.y,c=a.width/i.x,p=a.height/i.y;if(d){const f=ie(d),m=l&&ue(l)?ie(l):l;let h=f,v=mt(h);for(;v&&l&&m!==h;){const g=De(v),w=v.getBoundingClientRect(),B=ce(v),I=w.left+(v.clientLeft+parseFloat(B.paddingLeft))*g.x,V=w.top+(v.clientTop+parseFloat(B.paddingTop))*g.y;r*=g.x,u*=g.y,c*=g.x,p*=g.y,r+=I,u+=V,h=ie(v),v=mt(h)}}return Ze({width:c,height:p,x:r,y:u})}function St(e,o){const n=it(e).scrollLeft;return o?o.left+n:$e(ve(e)).left+n}function go(e,o,n){n===void 0&&(n=!1);const l=e.getBoundingClientRect(),a=l.left+o.scrollLeft-(n?0:St(e,l)),d=l.top+o.scrollTop;return{x:a,y:d}}function ia(e){let{elements:o,rect:n,offsetParent:l,strategy:a}=e;const d=a==="fixed",i=ve(l),s=o?st(o.floating):!1;if(l===i||s&&d)return n;let r={scrollLeft:0,scrollTop:0},u=me(1);const c=me(0),p=he(l);if((p||!p&&!d)&&((Se(l)!=="body"||Ue(i))&&(r=it(l)),he(l))){const m=$e(l);u=De(l),c.x=m.x+l.clientLeft,c.y=m.y+l.clientTop}const f=i&&!p&&!d?go(i,r,!0):me(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-r.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-r.scrollTop*u.y+c.y+f.y}}function ra(e){return Array.from(e.getClientRects())}function da(e){const o=ve(e),n=it(e),l=e.ownerDocument.body,a=se(o.scrollWidth,o.clientWidth,l.scrollWidth,l.clientWidth),d=se(o.scrollHeight,o.clientHeight,l.scrollHeight,l.clientHeight);let i=-n.scrollLeft+St(e);const s=-n.scrollTop;return ce(l).direction==="rtl"&&(i+=se(o.clientWidth,l.clientWidth)-a),{width:a,height:d,x:i,y:s}}function ua(e,o){const n=ie(e),l=ve(e),a=n.visualViewport;let d=l.clientWidth,i=l.clientHeight,s=0,r=0;if(a){d=a.width,i=a.height;const u=$t();(!u||u&&o==="fixed")&&(s=a.offsetLeft,r=a.offsetTop)}return{width:d,height:i,x:s,y:r}}function ca(e,o){const n=$e(e,!0,o==="fixed"),l=n.top+e.clientTop,a=n.left+e.clientLeft,d=he(e)?De(e):me(1),i=e.clientWidth*d.x,s=e.clientHeight*d.y,r=a*d.x,u=l*d.y;return{width:i,height:s,x:r,y:u}}function Ot(e,o,n){let l;if(o==="viewport")l=ua(e,n);else if(o==="document")l=da(ve(e));else if(ue(o))l=ca(o,n);else{const a=vo(e);l={x:o.x-a.x,y:o.y-a.y,width:o.width,height:o.height}}return Ze(l)}function bo(e,o){const n=we(e);return n===o||!ue(n)||Me(n)?!1:ce(n).position==="fixed"||bo(n,o)}function pa(e,o){const n=o.get(e);if(n)return n;let l=_e(e,[],!1).filter(s=>ue(s)&&Se(s)!=="body"),a=null;const d=ce(e).position==="fixed";let i=d?we(e):e;for(;ue(i)&&!Me(i);){const s=ce(i),r=kt(i);!r&&s.position==="fixed"&&(a=null),(d?!r&&!a:!r&&s.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||Ue(i)&&!r&&bo(e,i))?l=l.filter(c=>c!==i):a=s,i=we(i)}return o.set(e,l),l}function fa(e){let{element:o,boundary:n,rootBoundary:l,strategy:a}=e;const i=[...n==="clippingAncestors"?st(o)?[]:pa(o,this._c):[].concat(n),l],s=i[0],r=i.reduce((u,c)=>{const p=Ot(o,c,a);return u.top=se(p.top,u.top),u.right=ye(p.right,u.right),u.bottom=ye(p.bottom,u.bottom),u.left=se(p.left,u.left),u},Ot(o,s,a));return{width:r.right-r.left,height:r.bottom-r.top,x:r.left,y:r.top}}function ma(e){const{width:o,height:n}=ho(e);return{width:o,height:n}}function ha(e,o,n){const l=he(o),a=ve(o),d=n==="fixed",i=$e(e,!0,d,o);let s={scrollLeft:0,scrollTop:0};const r=me(0);if(l||!l&&!d)if((Se(o)!=="body"||Ue(a))&&(s=it(o)),l){const f=$e(o,!0,d,o);r.x=f.x+o.clientLeft,r.y=f.y+o.clientTop}else a&&(r.x=St(a));const u=a&&!l&&!d?go(a,s):me(0),c=i.left+s.scrollLeft-r.x-u.x,p=i.top+s.scrollTop-r.y-u.y;return{x:c,y:p,width:i.width,height:i.height}}function ut(e){return ce(e).position==="static"}function Pt(e,o){if(!he(e)||ce(e).position==="fixed")return null;if(o)return o(e);let n=e.offsetParent;return ve(e)===n&&(n=n.ownerDocument.body),n}function yo(e,o){const n=ie(e);if(st(e))return n;if(!he(e)){let a=we(e);for(;a&&!Me(a);){if(ue(a)&&!ut(a))return a;a=we(a)}return n}let l=Pt(e,o);for(;l&&na(l)&&ut(l);)l=Pt(l,o);return l&&Me(l)&&ut(l)&&!kt(l)?n:l||la(e)||n}const va=async function(e){const o=this.getOffsetParent||yo,n=this.getDimensions,l=await n(e.floating);return{reference:ha(e.reference,await o(e.floating),e.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function ga(e){return ce(e).direction==="rtl"}const ba={convertOffsetParentRelativeRectToViewportRelativeRect:ia,getDocumentElement:ve,getClippingRect:fa,getOffsetParent:yo,getElementRects:va,getClientRects:ra,getDimensions:ma,getScale:De,isElement:ue,isRTL:ga};function ya(e,o){let n=null,l;const a=ve(e);function d(){var s;clearTimeout(l),(s=n)==null||s.disconnect(),n=null}function i(s,r){s===void 0&&(s=!1),r===void 0&&(r=1),d();const{left:u,top:c,width:p,height:f}=e.getBoundingClientRect();if(s||o(),!p||!f)return;const m=Qe(c),h=Qe(a.clientWidth-(u+p)),v=Qe(a.clientHeight-(c+f)),g=Qe(u),B={rootMargin:-m+"px "+-h+"px "+-v+"px "+-g+"px",threshold:se(0,ye(1,r))||1};let I=!0;function V(A){const E=A[0].intersectionRatio;if(E!==r){if(!I)return i();E?i(!1,E):l=setTimeout(()=>{i(!1,1e-7)},1e3)}I=!1}try{n=new IntersectionObserver(V,le(X({},B),{root:a.ownerDocument}))}catch(A){n=new IntersectionObserver(V,B)}n.observe(e)}return i(!0),d}function It(e,o,n,l){l===void 0&&(l={});const{ancestorScroll:a=!0,ancestorResize:d=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:r=!1}=l,u=Bt(e),c=a||d?[...u?_e(u):[],..._e(o)]:[];c.forEach(w=>{a&&w.addEventListener("scroll",n,{passive:!0}),d&&w.addEventListener("resize",n)});const p=u&&s?ya(u,n):null;let f=-1,m=null;i&&(m=new ResizeObserver(w=>{let[B]=w;B&&B.target===u&&m&&(m.unobserve(o),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var I;(I=m)==null||I.observe(o)})),n()}),u&&!r&&m.observe(u),m.observe(o));let h,v=r?$e(e):null;r&&g();function g(){const w=$e(e);v&&(w.x!==v.x||w.y!==v.y||w.width!==v.width||w.height!==v.height)&&n(),v=w,h=requestAnimationFrame(g)}return n(),()=>{var w;c.forEach(B=>{a&&B.removeEventListener("scroll",n),d&&B.removeEventListener("resize",n)}),p==null||p(),(w=m)==null||w.disconnect(),m=null,r&&cancelAnimationFrame(h)}}const Vt=ea,Ca=ta,xt=Xl,Co=oa,ht=Jl,wa=Yl,wo=(e,o,n)=>{const l=new Map,a=X({platform:ba},n),d=le(X({},a.platform),{_c:l});return Gl(e,o,le(X({},a),{platform:d}))};function ka(e){return e!=null&&typeof e=="object"&&"$el"in e}function vt(e){if(ka(e)){const o=e.$el;return wt(o)&&Se(o)==="#comment"?null:o}return e}function $a(e){return{name:"arrow",options:e,fn(o){const n=vt(t.unref(e.element));return n==null?{}:wa({element:n,padding:e.padding}).fn(o)}}}function ko(e){return typeof window=="undefined"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ft(e,o){const n=ko(e);return Math.round(o*n)/n}function $o(e,o,n){n===void 0&&(n={});const l=n.whileElementsMounted,a=t.computed(()=>{var x;return(x=t.unref(n.open))!=null?x:!0}),d=t.computed(()=>t.unref(n.middleware)),i=t.computed(()=>{var x;return(x=t.unref(n.placement))!=null?x:"bottom"}),s=t.computed(()=>{var x;return(x=t.unref(n.strategy))!=null?x:"absolute"}),r=t.computed(()=>{var x;return(x=t.unref(n.transform))!=null?x:!0}),u=t.computed(()=>vt(e.value)),c=t.computed(()=>vt(o.value)),p=t.ref(0),f=t.ref(0),m=t.ref(s.value),h=t.ref(i.value),v=t.shallowRef({}),g=t.ref(!1),w=t.computed(()=>{const x={position:m.value,left:"0",top:"0"};if(!c.value)return x;const L=Ft(c.value,p.value),b=Ft(c.value,f.value);return r.value?X(le(X({},x),{transform:"translate("+L+"px, "+b+"px)"}),ko(c.value)>=1.5&&{willChange:"transform"}):{position:m.value,left:L+"px",top:b+"px"}});let B;function I(){u.value==null||c.value==null||wo(u.value,c.value,{middleware:d.value,placement:i.value,strategy:s.value}).then(x=>{p.value=x.x,f.value=x.y,m.value=x.strategy,h.value=x.placement,v.value=x.middlewareData,g.value=!0})}function V(){typeof B=="function"&&(B(),B=void 0)}function A(){if(V(),l===void 0){I();return}if(u.value!=null&&c.value!=null){B=l(u.value,c.value,I);return}}function E(){a.value||(g.value=!1)}return t.watch([d,i,s],I,{flush:"sync"}),t.watch([u,c],A,{flush:"sync"}),t.watch(a,E,{flush:"sync"}),t.getCurrentScope()&&t.onScopeDispose(V),{x:t.shallowReadonly(p),y:t.shallowReadonly(f),strategy:t.shallowReadonly(m),placement:t.shallowReadonly(h),middlewareData:t.shallowReadonly(v),isPositioned:t.shallowReadonly(g),floatingStyles:w,update:I}}function Ba(e,o=Fe){let l=Array.from(e).reduce((d,i)=>d*31+i.charCodeAt(0)&4294967295,0);l=l>>>0;const a=l.toString(36);return"".concat(o,"-").concat(a)}const zt=new Map;class _t{constructor(o,n){fe(this,"referenceElement");fe(this,"tooltipElement");fe(this,"textContent");fe(this,"placement");fe(this,"autoUpdateCleanup");fe(this,"referenceElementHandlers");fe(this,"tooltipElementHandlers");fe(this,"escapeHandler");fe(this,"timeoutId");var d,i;const l=o.ownerDocument,a=this.generateTooltipId(n.textContent);this.referenceElement=o,this.textContent=n.textContent,this.placement=(d=n.placement)!=null?d:"bottom",this.timeoutId=null,this.tooltipElement=l.createElement("div"),this.tooltipElement.classList.add("cdx-tooltip"),this.tooltipElement.role="tooltip",this.tooltipElement.id=a,this.referenceElement.setAttribute("aria-describedby",a),this.tooltipElement.textContent=this.textContent,(i=this.referenceElement.parentElement)==null||i.appendChild(this.tooltipElement),this.referenceElementHandlers={},this.referenceElementHandlers.mouseenter=this.show.bind(this),this.referenceElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.referenceElementHandlers.focus=this.show.bind(this),this.referenceElementHandlers.blur=this.hide.bind(this),this.tooltipElementHandlers={},this.tooltipElementHandlers.mouseenter=this.show.bind(this),this.tooltipElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.escapeHandler=this.onKeyup.bind(this),this.addEventListeners(),this.autoUpdateCleanup=It(this.referenceElement,this.tooltipElement,()=>this.update())}generateTooltipId(o){var a;const n=o.trim(),l=(a=zt.get(n))!=null?a:0;return zt.set(n,l+1),Ba(n+"-"+l,"cdx-tooltip")}isVisible(){return this.tooltipElement.style.display==="block"}show(){this.timeoutId&&clearTimeout(this.timeoutId),this.tooltipElement.style.display="block",this.tooltipElement.ownerDocument.addEventListener("keyup",this.escapeHandler)}hide(){this.tooltipElement.style.display="none",this.tooltipElement.ownerDocument.removeEventListener("keyup",this.escapeHandler)}hideAfterDelay(){this.timeoutId=setTimeout(this.hide.bind(this),250)}onKeyup(o){o.key==="Escape"&&this.isVisible()&&this.hide()}addEventListeners(){Object.keys(this.referenceElementHandlers).forEach(o=>{this.referenceElement.addEventListener(o,this.referenceElementHandlers[o])}),Object.keys(this.tooltipElementHandlers).forEach(o=>{this.tooltipElement.addEventListener(o,this.tooltipElementHandlers[o])})}removeEventListeners(){Object.keys(this.referenceElementHandlers).forEach(o=>{this.referenceElement.removeEventListener(o,this.referenceElementHandlers[o])}),Object.keys(this.tooltipElementHandlers).forEach(o=>{this.tooltipElement.removeEventListener(o,this.tooltipElementHandlers[o])})}update(){wo(this.referenceElement,this.tooltipElement,{placement:this.placement,middleware:[Vt(4),xt(),Ca(),ht()]}).then(({x:o,y:n,middlewareData:l})=>{var d,i,s;const a=(i=(d=l.offset)==null?void 0:d.placement)!=null?i:this.placement;Object.assign(this.tooltipElement.style,{left:"".concat(o,"px"),top:"".concat(n,"px"),visibility:(s=l.hide)!=null&&s.referenceHidden?"hidden":"visible",transformOrigin:lo[a]})})}updateWithOptions(o){var n;this.textContent=o.textContent,this.placement=(n=o.placement)!=null?n:this.placement,this.tooltipElement.textContent=this.textContent,this.update()}remove(){this.tooltipElement.remove(),this.autoUpdateCleanup(),this.removeEventListeners()}}const Et={mounted(e,{value:o,arg:n}){o&&(typeof o=="string"&&o.trim()===""||(e.tooltip=new _t(e,{textContent:String(o),placement:n})))},updated(e,{value:o,arg:n}){o!==null&&(e.tooltip?e.tooltip.updateWithOptions({textContent:String(o),placement:n}):e.tooltip=new _t(e,{textContent:String(o),placement:n}))},beforeUnmount(e){e.tooltip&&e.tooltip.remove()}},Sa=t.defineComponent({name:"CdxInputChip",components:{CdxButton:de,CdxIcon:Y},directives:{tooltip:Et},props:{icon:{type:[String,Object],default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},className:{type:String,default:""}},emits:["remove-chip","click-chip","arrow-left","arrow-right"],setup(e,{emit:o,slots:n}){const l=t.computed(()=>e.disabled?-1:0),a=t.ref(),d=t.computed(()=>({"cdx-input-chip--disabled":e.disabled,"cdx-input-chip--readonly":e.readonly,[e.className]:e.className.length>0})),i=J("cdx-input-chip-aria-description","Press Enter to edit or Delete to remove"),s=t.ref(),r=t.ref(!1),u=t.computed(()=>r.value&&s.value&&s.value.scrollWidth>s.value.clientWidth?Le(n==null?void 0:n.default)[0]:null);t.onMounted(()=>{r.value=!0});function c(p){var f;switch(p.key){case"Enter":o("click-chip"),p.preventDefault(),p.stopPropagation();break;case"Escape":(f=a.value)==null||f.blur(),p.preventDefault(),p.stopPropagation();break;case"Backspace":case"Delete":o("remove-chip",p.key),p.preventDefault(),p.stopPropagation();break;case"ArrowLeft":o("arrow-left"),p.preventDefault(),p.stopPropagation();break;case"ArrowRight":o("arrow-right"),p.preventDefault(),p.stopPropagation();break}}return{rootElement:a,rootClasses:d,ariaDescription:i,onKeydown:c,cdxIconClose:tt,tabIndex:l,tooltipContent:u,textElement:s}},methods:{focus(){this.$refs.rootElement.focus()}}}),Ia=["tabindex","aria-description"],Va={ref:"textElement",class:"cdx-input-chip__text"};function xa(e,o,n,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button"),r=t.resolveDirective("tooltip");return t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-input-chip",e.rootClasses]),tabindex:e.tabIndex,role:"option","aria-description":e.ariaDescription,onKeydown:o[1]||(o[1]=(...u)=>e.onKeydown&&e.onKeydown(...u)),onClick:o[2]||(o[2]=u=>e.$emit("click-chip"))},[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,size:"small"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",Va,[t.renderSlot(e.$slots,"default")],512),t.createVNode(s,{class:"cdx-input-chip