UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

1 lines 166 kB
(function(S,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(S=typeof globalThis!="undefined"?globalThis:S||self,t(S.codex={},S.Vue))})(this,function(S,t){"use strict";var Fr=Object.defineProperty,Pr=Object.defineProperties;var _r=Object.getOwnPropertyDescriptors;var ut=Object.getOwnPropertySymbols;var Hn=Object.prototype.hasOwnProperty,Wn=Object.prototype.propertyIsEnumerable;var _t=(S,t,Y)=>t in S?Fr(S,t,{enumerable:!0,configurable:!0,writable:!0,value:Y}):S[t]=Y,J=(S,t)=>{for(var Y in t||(t={}))Hn.call(t,Y)&&_t(S,Y,t[Y]);if(ut)for(var Y of ut(t))Wn.call(t,Y)&&_t(S,Y,t[Y]);return S},re=(S,t)=>Pr(S,_r(t));var pe=(S,t)=>{var Y={};for(var de in S)Hn.call(S,de)&&t.indexOf(de)<0&&(Y[de]=S[de]);if(S!=null&&ut)for(var de of ut(S))t.indexOf(de)<0&&Wn.call(S,de)&&(Y[de]=S[de]);return Y};var we=(S,t,Y)=>_t(S,typeof t!="symbol"?t+"":t,Y);var te=(S,t,Y)=>new Promise((de,Ge)=>{var pt=ke=>{try{Pe(Y.next(ke))}catch(_e){Ge(_e)}},ft=ke=>{try{Pe(Y.throw(ke))}catch(_e){Ge(_e)}},Pe=ke=>ke.done?de(ke.value):Promise.resolve(ke.value).then(pt,ft);Pe((Y=Y.apply(S,t)).next())});const Y='<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"/>',de='<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"/>',Ge='<path d="M7 14.17 2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/>',pt='<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"/>',ft='<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"/>',Pe='<path d="M10 15 2 5h16z"/>',ke='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',_e='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',Un='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',jn='<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"/>',qn='<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"/>',Qn='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',Gn='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',Yn='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',Xn='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',Zn='<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"/>',Jn='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',eo='<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"/>',to='<path d="m10 5 8 10H2z"/>',zt=Y,no=de,oo=Ge,lo=pt,Ye=ft,ao=Pe,Kt=ke,Ht=_e,so=Un,Wt={langCodeMap:{ar:jn},default:qn},io={ltr:Qn,shouldFlip:!0},ro={ltr:Gn,shouldFlip:!0},Ut={ltr:Yn,shouldFlip:!0},jt={ltr:Xn,shouldFlip:!0},co=Zn,uo=Jn,qt=eo,po=to;function fo(e,n,o){if(typeof e=="string"||"path"in e)return e;if("shouldFlip"in e)return e.ltr;if("rtl"in e)return o==="rtl"?e.rtl:e.ltr;const l=n in e.langCodeMap?e.langCodeMap[n]:e.default;return typeof l=="string"||"path"in l?l:l.ltr}function mo(e,n){if(typeof e=="string")return!1;if("langCodeMap"in e){const o=n in e.langCodeMap?e.langCodeMap[n]:e.default;if(typeof o=="string")return!1;e=o}if("shouldFlipExceptions"in e&&Array.isArray(e.shouldFlipExceptions)){const o=e.shouldFlipExceptions.indexOf(n);return o===void 0||o===-1}return"shouldFlip"in e?e.shouldFlip:!1}function ze(e){const n=t.ref(null);return t.onMounted(()=>{const o=window.getComputedStyle(e.value).direction;n.value=o==="ltr"||o==="rtl"?o:null}),n}function Qt(e){const n=t.ref("");return t.onMounted(()=>{let o=e.value;for(;o&&o.lang==="";)o=o.parentElement;n.value=o?o.lang:null}),n}function ne(e){return n=>typeof n=="string"&&e.includes(n)}const Ke="cdx",ho=["default","progressive","destructive"],go=["normal","primary","quiet"],bo=["medium","large"],yo=["x-small","small","medium"],Gt=ne(["notice","warning","error","success"]),Co=["text","search","number","email","month","password","tel","url","week","date","datetime-local","time"],fe=["default","warning","error","success"],wo=["start","center","end","number"],ko=120,$o=500,Me="cdx-menu-footer-item",Yt=Symbol("CdxTabs"),Xt=Symbol("CdxActiveTab"),Zt=Symbol("CdxAllowArbitrary"),Jt=Symbol("CdxFieldInputId"),Xe=Symbol("CdxFieldDescriptionId"),en=Symbol("CdxFieldStatus"),tn=Symbol("CdxDisabled"),Bo="".concat(Ke,"-no-invert"),Ze=Symbol("CdxTableRowIdentifier"),So=["top","bottom","both"],nn={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"},Io=ne(yo),Vo=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:Io}},setup(e){const n=t.ref(),o=ze(n),l=Qt(n),a=t.computed(()=>{var u;return(u=e.dir)!=null?u:o.value}),d=t.computed(()=>{var u;return(u=e.lang)!=null?u:l.value}),s=t.computed(()=>({"cdx-icon--flipped":a.value==="rtl"&&d.value!==null&&mo(e.icon,d.value),["cdx-icon--".concat(e.size)]:!0})),r=t.computed(()=>{var u,p;return fo(e.icon,(u=d.value)!=null?u:"",(p=a.value)!=null?p:"ltr")}),i=t.computed(()=>typeof r.value=="string"?r.value:""),c=t.computed(()=>typeof r.value!="string"?r.value.path:"");return{rootElement:n,rootClasses:s,iconSvg:i,iconPath:c}}}),_=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},Eo=["aria-hidden"],xo={key:0},No=["innerHTML"],Ao=["d"];function Mo(e,n,o,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",xo,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("v-if",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,No)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,Ao))],8,Eo))],2)}const X=_(Vo,[["render",Mo]]);function on(e){const n=[];for(const o of e)typeof o.type=="string"||typeof o.type=="object"?n.push(o):o.type!==t.Comment&&(typeof o.children=="string"&&o.children.trim()!==""?n.push(o.children):Array.isArray(o.children)&&n.push(...on(o.children)));return n}function ln(e,n){return typeof e.type=="object"&&"name"in e.type?n!==void 0?e.type.name===n:!0:!1}function Do(e,n){return typeof e.type=="string"?e.type===n.toLowerCase():!1}function De(e){const n=typeof e=="function"?e():e;return n?on(n):[]}function Je(e,n){if(e()){t.warn(n);return}const o=t.watch(e,l=>{l&&(t.warn(n),o())})}function an(e,n,o){const l=t.computed(()=>{const a=De(e);if(a.length!==1)return!1;const d=a[0];return!!(typeof d=="object"&&(ln(d,"CdxIcon")||Do(d,"svg")))});return Je(()=>l.value&&!n["aria-label"]&&!n["aria-hidden"],"".concat(o,": 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 Lo=ne(ho),To=ne(go),Ro=ne(bo),Oo=t.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:Lo},weight:{type:String,default:"normal",validator:To},size:{type:String,default:"medium",validator:Ro}},emits:["click"],setup(e,{emit:n,slots:o,attrs:l}){const a=t.ref(),d=an(o.default,l,"CdxButton"),s=t.ref(!1),r=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":s.value})),i=f=>{n("click",f)},c=f=>{s.value=f};function u(){c(!0)}function p(){var f;c(!1),(f=a.value)==null||f.click()}return{button:a,rootClasses:r,onClick:i,onKeyDown:u,onKeyUp:p}}});function vo(e,n,o,l,a,d){return t.openBlock(),t.createElementBlock("button",{ref:"button",class:t.normalizeClass(["cdx-button",e.rootClasses]),onKeydown:n[0]||(n[0]=t.withKeys(t.withModifiers((...s)=>e.onKeyDown&&e.onKeyDown(...s),["prevent"]),["space","enter"])),onKeyup:n[1]||(n[1]=t.withKeys((...s)=>e.onKeyUp&&e.onKeyUp(...s),["space","enter"])),onClick:n[2]||(n[2]=(...s)=>e.onClick&&e.onClick(...s))},[t.renderSlot(e.$slots,"default")],34)}const me=_(Oo,[["render",vo]]);function He(e,n,o,l){return t.computed({get:()=>{var a;return(a=n.value)!=null?a:e.value},set:a=>{n.value!==null?o(l||"update:modelValue",a):e.value=a}})}const Fo=t.defineComponent({name:"CdxAccordion",components:{CdxButton:me,CdxIcon:X},props:{modelValue:{type:[Boolean,null],default:null},actionAlwaysVisible:{type:Boolean,default:!1},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:n,emit:o}){const l=t.ref("open"in n),a=He(l,t.toRef(e,"modelValue"),o),d=()=>{o("action-button-click")},s=c=>{a.value=c.newState==="open",o("toggle",a.value)},r=t.computed(()=>e.actionIcon?a.value?!0:!!e.actionAlwaysVisible:!1),i=t.computed(()=>({"cdx-accordion--has-icon":r.value}));return{emitActionButtonClick:d,rootClasses:i,shouldShowActionButton:r,onToggle:s,computedOpen:a}}}),Po=["open"],_o={class:"cdx-accordion__header__title"},zo={class:"cdx-accordion__header__description"};function Ko(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon"),r=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("details",{class:t.normalizeClass(["cdx-accordion",e.rootClasses]),open:e.computedOpen||void 0,onToggle:n[1]||(n[1]=(...i)=>e.onToggle&&e.onToggle(...i))},[t.createElementVNode("summary",null,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.headingLevel),{class:"cdx-accordion__header"},{default:t.withCtx(()=>[t.createElementVNode("span",_o,[t.renderSlot(e.$slots,"title")]),t.createElementVNode("span",zo,[t.renderSlot(e.$slots,"description")])]),_:3})),e.shouldShowActionButton?(t.openBlock(),t.createBlock(r,{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(s,{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:n[0]||(n[0]=t.withModifiers(()=>{},["stop"]))},[t.renderSlot(e.$slots,"default")])],42,Po)}const Ho=_(Fo,[["render",Ko]]);function sn(e){return e.label===void 0?e.value:e.label===null?"":e.label}function rn(e){const n=t.ref(),o=t.ref(),l=t.ref(new Map),a=ze(n);function d(h,g){const b=h;b&&l.value.set(g,b)}function s(h){o.value=h}function r(){o.value=void 0}function i(h,g){var I;const b=h+g,w=e.value[b];if(w)if(w.disabled)i(b,g);else{const V=(I=l.value.get(b))==null?void 0:I.$el;V==null||V.focus()}}function c(){var h;i((h=o.value)!=null?h:-1,1)}function u(){var h;i((h=o.value)!=null?h:e.value.length,-1)}function p(){a.value==="rtl"?u():c()}function f(){a.value==="rtl"?c():u()}function m(h){switch(h.key){case"ArrowRight":h.preventDefault(),p();break;case"ArrowLeft":h.preventDefault(),f();break;case"ArrowDown":h.preventDefault(),c();break;case"ArrowUp":h.preventDefault(),u();break}}return{rootElement:n,assignTemplateRef:d,onFocus:s,onBlur:r,onKeydown:m}}const Wo=t.defineComponent({name:"CdxButtonGroup",components:{CdxButton:me,CdxIcon:X},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:n,assignTemplateRef:o,onFocus:l,onBlur:a,onKeydown:d}=rn(t.toRef(e,"buttons"));return{rootElement:n,assignTemplateRef:o,onFocus:l,onBlur:a,onKeydown:d,getButtonLabel:sn}}}),Uo={ref:"rootElement",class:"cdx-button-group"};function jo(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon"),r=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",Uo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.buttons,(i,c)=>(t.openBlock(),t.createBlock(r,{key:i.value,ref_for:!0,ref:u=>e.assignTemplateRef(u,c),disabled:i.disabled||e.disabled,"aria-label":i.ariaLabel,onClick:u=>e.$emit("click",i.value),onFocus:u=>e.onFocus(c),onBlur:e.onBlur,onKeydown:e.onKeydown},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{button:i},()=>[i.icon?(t.openBlock(),t.createBlock(s,{key:0,icon:i.icon},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createTextVNode(" "+t.toDisplayString(e.getButtonLabel(i)),1)])]),_:2},1032,["disabled","aria-label","onClick","onFocus","onBlur","onKeydown"]))),128))],512)}const qo=_(Wo,[["render",jo]]),Qo=t.defineComponent({name:"CdxThumbnail",components:{CdxIcon:X},props:{thumbnail:{type:[Object,null],default:null},placeholderIcon:{type:[String,Object],default:so}},setup:e=>{const n=t.ref(!1),o=t.ref({}),l=a=>{const d=a.replace(/([\\"\n])/g,"\\$1"),s=new Image;s.onload=()=>{o.value={backgroundImage:'url("'.concat(d,'")')},n.value=!0},s.onerror=()=>{n.value=!1},s.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)){n.value=!1,o.value={};return}(d==null?void 0:d.url)!==a.url&&(n.value=!1,l(a.url))},{deep:!0}),{thumbnailStyle:o,thumbnailLoaded:n,NoInvertClass:Bo}}}),Go={class:"cdx-thumbnail"},Yo={key:0,class:"cdx-thumbnail__placeholder"};function Xo(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon");return t.openBlock(),t.createElementBlock("span",Go,[e.thumbnailLoaded?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",Yo,[t.createVNode(s,{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 mt=_(Qo,[["render",Xo]]),Zo=t.defineComponent({name:"CdxCard",components:{CdxIcon:X,CdxThumbnail:mt},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 n=t.computed(()=>!!e.url),o=t.computed(()=>n.value?"a":"span"),l=t.computed(()=>n.value?e.url:void 0);return{isLink:n,contentTag:o,cardLink:l}}}),Jo={class:"cdx-card__text"},el={class:"cdx-card__text__title"},tl={key:0,class:"cdx-card__text__description"},nl={key:1,class:"cdx-card__text__supporting-text"};function ol(e,n,o,l,a,d){const s=t.resolveComponent("cdx-thumbnail"),r=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(s,{key:0,thumbnail:e.thumbnail,"placeholder-icon":e.customPlaceholderIcon,class:"cdx-card__thumbnail"},null,8,["thumbnail","placeholder-icon"])):e.icon?(t.openBlock(),t.createBlock(r,{key:1,icon:e.icon,class:"cdx-card__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",Jo,[t.createElementVNode("span",el,[t.renderSlot(e.$slots,"title")]),e.$slots.description?(t.openBlock(),t.createElementBlock("span",tl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0),e.$slots["supporting-text"]?(t.openBlock(),t.createElementBlock("span",nl,[t.renderSlot(e.$slots,"supporting-text")])):t.createCommentVNode("v-if",!0)])]),_:3},8,["href","class"])}const ll=_(Zo,[["render",ol]]);function ht(e){const n=t.inject(tn,t.ref(!1));return t.computed(()=>n.value||e.value)}function ie(e,n,o){const l=ht(e),a=t.inject(en,t.ref("default")),d=t.computed(()=>n!=null&&n.value&&n.value!=="default"?n.value:a.value),s=t.inject(Jt,void 0),r=t.computed(()=>{var i;return(i=s==null?void 0:s.value)!=null?i:o});return{computedDisabled:l,computedStatus:d,computedInputId:r}}function ae(e,n=t.computed(()=>({}))){const o=t.computed(()=>{const d=pe(n.value,[]);return e.class&&e.class.split(" ").forEach(r=>{d[r]=!0}),d}),l=t.computed(()=>{if("style"in e)return e.style}),a=t.computed(()=>{const i=e,{class:d,style:s}=i;return pe(i,["class","style"])});return{rootClasses:o,rootStyle:l,otherAttrs:a}}function Z(e,n,o=[]){const l=t.inject("CdxI18nFunction",void 0);return t.computed(()=>{const a=o.map(s=>typeof s=="function"?s():s.value),d=l==null?void 0:l(e,...a);return d!=null?d:typeof n=="function"?n(...a):n})}function We(e,n,o,l=[]){const a=Z(n,o,l);return t.computed(()=>e.value||a.value)}const al=t.defineComponent({name:"CdxLabel",components:{CdxIcon:X},inheritAttrs:!1,props:{icon:{type:[String,Object],default:null},optional:{type:Boolean,default:!1},optionalFlag:{type:String,default:""},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:n}){const{computedDisabled:o}=ie(t.toRef(e,"disabled")),l=t.computed(()=>({"cdx-label--visually-hidden":e.visuallyHidden,"cdx-label--disabled":o.value})),{rootClasses:a,rootStyle:d,otherAttrs:s}=ae(n,l),r=We(t.toRef(e,"optionalFlag"),"cdx-label-optional-flag","(optional)");return{rootClasses:a,rootStyle:d,otherAttrs:s,translatedOptionalFlag:r}}}),sl=["for"],il={class:"cdx-label__label__text"},rl={key:1,class:"cdx-label__label__optional-flag"},dl=["id"],cl={class:"cdx-label__label"},ul={class:"cdx-label__label__text"},pl={key:1,class:"cdx-label__label__optional-flag"},fl={key:0,class:"cdx-label__description"};function ml(e,n,o,l,a,d){const s=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",cl,[e.icon?(t.openBlock(),t.createBlock(s,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",ul,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",pl,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",fl,[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(s,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",il,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",rl,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)],16,sl),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,dl)):t.createCommentVNode("v-if",!0)],6))}const Le=_(al,[["render",ml]]);function et(e,n,o){Je(()=>De(e).length===0&&!(n!=null&&n["aria-label"])&&!(n!=null&&n["aria-labelledby"]),"".concat(o,": 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 se(e,n,o){return t.computed({get:()=>e.value,set:l=>n(o||"update:modelValue",l)})}const hl=ne(fe),gl=t.defineComponent({name:"CdxCheckbox",components:{CdxLabel:Le},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:hl}},emits:["update:modelValue"],setup(e,{emit:n,slots:o,attrs:l}){var f;et((f=o.default)==null?void 0:f.call(o),l,"CdxCheckbox");const{computedDisabled:a,computedStatus:d}=ie(t.toRef(e,"disabled"),t.toRef(e,"status")),s=t.computed(()=>({"cdx-checkbox--inline":e.inline,["cdx-checkbox--status-".concat(d.value)]:!0})),r=t.computed(()=>({"cdx-checkbox__custom-input--inline":e.inline})),i=t.ref(),c=t.useId(),u=t.useId(),p=se(t.toRef(e,"modelValue"),n);return{rootClasses:s,computedDisabled:a,input:i,checkboxId:c,descriptionId:u,wrappedModel:p,customInputClasses:r}}}),bl={class:"cdx-checkbox__wrapper"},yl=["id","aria-describedby","value","name","disabled",".indeterminate"];function Cl(e,n,o,l,a,d){const s=t.resolveComponent("cdx-label");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["cdx-checkbox",e.rootClasses])},[t.createElementVNode("div",bl,[t.withDirectives(t.createElementVNode("input",{id:e.checkboxId,ref:"input","onUpdate:modelValue":n[0]||(n[0]=r=>e.wrappedModel=r),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,yl),[[t.vModelCheckbox,e.wrappedModel]]),n[1]||(n[1]=t.createElementVNode("span",{class:"cdx-checkbox__icon"},null,-1)),e.$slots.default&&e.$slots.default().length?(t.openBlock(),t.createBlock(s,{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 dn=_(gl,[["render",Cl]]),wl=["top","right","bottom","left"],Be=Math.min,ce=Math.max,tt=Math.round,nt=Math.floor,be=e=>({x:e,y:e}),kl={left:"right",right:"left",bottom:"top",top:"bottom"},$l={start:"end",end:"start"};function gt(e,n,o){return ce(e,Be(n,o))}function Ve(e,n){return typeof e=="function"?e(n):e}function Se(e){return e.split("-")[0]}function Te(e){return e.split("-")[1]}function cn(e){return e==="x"?"y":"x"}function bt(e){return e==="y"?"height":"width"}function Ee(e){return["top","bottom"].includes(Se(e))?"y":"x"}function yt(e){return cn(Ee(e))}function Bl(e,n,o){o===void 0&&(o=!1);const l=Te(e),a=yt(e),d=bt(a);let s=a==="x"?l===(o?"end":"start")?"right":"left":l==="start"?"bottom":"top";return n.reference[d]>n.floating[d]&&(s=ot(s)),[s,ot(s)]}function Sl(e){const n=ot(e);return[Ct(e),n,Ct(n)]}function Ct(e){return e.replace(/start|end/g,n=>$l[n])}function Il(e,n,o){const l=["left","right"],a=["right","left"],d=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return o?n?a:l:n?l:a;case"left":case"right":return n?d:s;default:return[]}}function Vl(e,n,o,l){const a=Te(e);let d=Il(Se(e),o==="start",l);return a&&(d=d.map(s=>s+"-"+a),n&&(d=d.concat(d.map(Ct)))),d}function ot(e){return e.replace(/left|right|bottom|top/g,n=>kl[n])}function El(e){return J({top:0,right:0,bottom:0,left:0},e)}function un(e){return typeof e!="number"?El(e):{top:e,right:e,bottom:e,left:e}}function lt(e){const{x:n,y:o,width:l,height:a}=e;return{width:l,height:a,top:o,left:n,right:n+l,bottom:o+a,x:n,y:o}}function pn(e,n,o){let{reference:l,floating:a}=e;const d=Ee(n),s=yt(n),r=bt(s),i=Se(n),c=d==="y",u=l.x+l.width/2-a.width/2,p=l.y+l.height/2-a.height/2,f=l[r]/2-a[r]/2;let m;switch(i){case"top":m={x:u,y:l.y-a.height};break;case"bottom":m={x:u,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(Te(n)){case"start":m[s]-=f*(o&&c?-1:1);break;case"end":m[s]+=f*(o&&c?-1:1);break}return m}const xl=(e,n,o)=>te(this,null,function*(){const{placement:l="bottom",strategy:a="absolute",middleware:d=[],platform:s}=o,r=d.filter(Boolean),i=yield s.isRTL==null?void 0:s.isRTL(n);let c=yield s.getElementRects({reference:e,floating:n,strategy:a}),{x:u,y:p}=pn(c,l,i),f=l,m={},h=0;for(let g=0;g<r.length;g++){const{name:b,fn:w}=r[g],{x:I,y:V,data:A,reset:N}=yield w({x:u,y:p,initialPlacement:l,placement:f,strategy:a,middlewareData:m,rects:c,platform:s,elements:{reference:e,floating:n}});u=I!=null?I:u,p=V!=null?V:p,m=re(J({},m),{[b]:J(J({},m[b]),A)}),N&&h<=50&&(h++,typeof N=="object"&&(N.placement&&(f=N.placement),N.rects&&(c=N.rects===!0?yield s.getElementRects({reference:e,floating:n,strategy:a}):N.rects),{x:u,y:p}=pn(c,f,i)),g=-1)}return{x:u,y:p,placement:f,strategy:a,middlewareData:m}});function Ue(e,n){return te(this,null,function*(){var o;n===void 0&&(n={});const{x:l,y:a,platform:d,rects:s,elements:r,strategy:i}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Ve(n,e),h=un(m),b=r[f?p==="floating"?"reference":"floating":p],w=lt(yield d.getClippingRect({element:(o=yield d.isElement==null?void 0:d.isElement(b))==null||o?b:b.contextElement||(yield d.getDocumentElement==null?void 0:d.getDocumentElement(r.floating)),boundary:c,rootBoundary:u,strategy:i})),I=p==="floating"?{x:l,y:a,width:s.floating.width,height:s.floating.height}:s.reference,V=yield d.getOffsetParent==null?void 0:d.getOffsetParent(r.floating),A=(yield d.isElement==null?void 0:d.isElement(V))?(yield d.getScale==null?void 0:d.getScale(V))||{x:1,y:1}:{x:1,y:1},N=lt(d.convertOffsetParentRelativeRectToViewportRelativeRect?yield d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:I,offsetParent:V,strategy:i}):I);return{top:(w.top-N.top+h.top)/A.y,bottom:(N.bottom-w.bottom+h.bottom)/A.y,left:(w.left-N.left+h.left)/A.x,right:(N.right-w.right+h.right)/A.x}})}const Nl=e=>({name:"arrow",options:e,fn(o){return te(this,null,function*(){const{x:l,y:a,placement:d,rects:s,platform:r,elements:i,middlewareData:c}=o,{element:u,padding:p=0}=Ve(e,o)||{};if(u==null)return{};const f=un(p),m={x:l,y:a},h=yt(d),g=bt(h),b=yield r.getDimensions(u),w=h==="y",I=w?"top":"left",V=w?"bottom":"right",A=w?"clientHeight":"clientWidth",N=s.reference[g]+s.reference[h]-m[h]-s.floating[g],L=m[h]-s.reference[h],D=yield r.getOffsetParent==null?void 0:r.getOffsetParent(u);let B=D?D[A]:0;(!B||!(yield r.isElement==null?void 0:r.isElement(D)))&&(B=i.floating[A]||s.floating[g]);const y=N/2-L/2,$=B/2-b[g]/2-1,E=Be(f[I],$),x=Be(f[V],$),v=E,H=B-b[g]-x,K=B/2-b[g]/2+y,F=gt(v,K,H),U=!c.arrow&&Te(d)!=null&&K!==F&&s.reference[g]/2-(K<v?E:x)-b[g]/2<0,R=U?K<v?K-v:K-H:0;return{[h]:m[h]+R,data:J({[h]:F,centerOffset:K-F-R},U&&{alignmentOffset:R}),reset:U}})}}),Al=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(o){return te(this,null,function*(){var l,a;const{placement:d,middlewareData:s,rects:r,initialPlacement:i,platform:c,elements:u}=o,K=Ve(e,o),{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0}=K,w=pe(K,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((l=s.arrow)!=null&&l.alignmentOffset)return{};const I=Se(d),V=Ee(i),A=Se(i)===i,N=yield c.isRTL==null?void 0:c.isRTL(u.floating),L=m||(A||!b?[ot(i)]:Sl(i)),D=g!=="none";!m&&D&&L.push(...Vl(i,b,g,N));const B=[i,...L],y=yield Ue(o,w),$=[];let E=((a=s.flip)==null?void 0:a.overflows)||[];if(p&&$.push(y[I]),f){const F=Bl(d,r,N);$.push(y[F[0]],y[F[1]])}if(E=[...E,{placement:d,overflows:$}],!$.every(F=>F<=0)){var x,v;const F=(((x=s.flip)==null?void 0:x.index)||0)+1,U=B[F];if(U)return{data:{index:F,overflows:E},reset:{placement:U}};let R=(v=E.filter(W=>W.overflows[0]<=0).sort((W,Q)=>W.overflows[1]-Q.overflows[1])[0])==null?void 0:v.placement;if(!R)switch(h){case"bestFit":{var H;const W=(H=E.filter(Q=>{if(D){const C=Ee(Q.placement);return C===V||C==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(C=>C>0).reduce((C,O)=>C+O,0)]).sort((Q,C)=>Q[1]-C[1])[0])==null?void 0:H[0];W&&(R=W);break}case"initialPlacement":R=i;break}if(d!==R)return{reset:{placement:R}}}return{}})}}};function fn(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function mn(e){return wl.some(n=>e[n]>=0)}const Ml=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(o){return te(this,null,function*(){const{rects:l}=o,s=Ve(e,o),{strategy:a="referenceHidden"}=s,d=pe(s,["strategy"]);switch(a){case"referenceHidden":{const r=yield Ue(o,re(J({},d),{elementContext:"reference"})),i=fn(r,l.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:mn(i)}}}case"escaped":{const r=yield Ue(o,re(J({},d),{altBoundary:!0})),i=fn(r,l.floating);return{data:{escapedOffsets:i,escaped:mn(i)}}}default:return{}}})}}};function Dl(e,n){return te(this,null,function*(){const{placement:o,platform:l,elements:a}=e,d=yield l.isRTL==null?void 0:l.isRTL(a.floating),s=Se(o),r=Te(o),i=Ee(o)==="y",c=["left","top"].includes(s)?-1:1,u=d&&i?-1:1,p=Ve(n,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 r&&typeof h=="number"&&(m=r==="end"?h*-1:h),i?{x:m*u,y:f*c}:{x:f*c,y:m*u}})}const Ll=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(o){return te(this,null,function*(){var l,a;const{x:d,y:s,placement:r,middlewareData:i}=o,c=yield Dl(o,e);return r===((l=i.offset)==null?void 0:l.placement)&&(a=i.arrow)!=null&&a.alignmentOffset?{}:{x:d+c.x,y:s+c.y,data:re(J({},c),{placement:r})}})}}},Tl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(o){return te(this,null,function*(){const{x:l,y:a,placement:d}=o,w=Ve(e,o),{mainAxis:s=!0,crossAxis:r=!1,limiter:i={fn:I=>{let{x:V,y:A}=I;return{x:V,y:A}}}}=w,c=pe(w,["mainAxis","crossAxis","limiter"]),u={x:l,y:a},p=yield Ue(o,c),f=Ee(Se(d)),m=cn(f);let h=u[m],g=u[f];if(s){const I=m==="y"?"top":"left",V=m==="y"?"bottom":"right",A=h+p[I],N=h-p[V];h=gt(A,h,N)}if(r){const I=f==="y"?"top":"left",V=f==="y"?"bottom":"right",A=g+p[I],N=g-p[V];g=gt(A,g,N)}const b=i.fn(re(J({},o),{[m]:h,[f]:g}));return re(J({},b),{data:{x:b.x-l,y:b.y-a,enabled:{[m]:s,[f]:r}}})})}}},Rl=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(o){return te(this,null,function*(){var l,a;const{placement:d,rects:s,platform:r,elements:i}=o,E=Ve(e,o),{apply:c=()=>{}}=E,u=pe(E,["apply"]),p=yield Ue(o,u),f=Se(d),m=Te(d),h=Ee(d)==="y",{width:g,height:b}=s.floating;let w,I;f==="top"||f==="bottom"?(w=f,I=m===((yield r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(I=f,w=m==="end"?"top":"bottom");const V=b-p.top-p.bottom,A=g-p.left-p.right,N=Be(b-p[w],V),L=Be(g-p[I],A),D=!o.middlewareData.shift;let B=N,y=L;if((l=o.middlewareData.shift)!=null&&l.enabled.x&&(y=A),(a=o.middlewareData.shift)!=null&&a.enabled.y&&(B=V),D&&!m){const x=ce(p.left,0),v=ce(p.right,0),H=ce(p.top,0),K=ce(p.bottom,0);h?y=g-2*(x!==0||v!==0?x+v:ce(p.left,p.right)):B=b-2*(H!==0||K!==0?H+K:ce(p.top,p.bottom))}yield c(re(J({},o),{availableWidth:y,availableHeight:B}));const $=yield r.getDimensions(i.floating);return g!==$.width||b!==$.height?{reset:{rects:!0}}:{}})}}};function at(){return typeof window!="undefined"}function xe(e){return wt(e)?(e.nodeName||"").toLowerCase():"#document"}function ue(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function ye(e){var n;return(n=(wt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function wt(e){return at()?e instanceof Node||e instanceof ue(e).Node:!1}function he(e){return at()?e instanceof Element||e instanceof ue(e).Element:!1}function Ce(e){return at()?e instanceof HTMLElement||e instanceof ue(e).HTMLElement:!1}function hn(e){return!at()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof ue(e).ShadowRoot}function je(e){const{overflow:n,overflowX:o,overflowY:l,display:a}=ge(e);return/auto|scroll|overlay|hidden|clip/.test(n+l+o)&&!["inline","contents"].includes(a)}function Ol(e){return["table","td","th"].includes(xe(e))}function st(e){return[":popover-open",":modal"].some(n=>{try{return e.matches(n)}catch(o){return!1}})}function kt(e){const n=$t(),o=he(e)?ge(e):e;return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(l=>(o.willChange||"").includes(l))||["paint","layout","strict","content"].some(l=>(o.contain||"").includes(l))}function vl(e){let n=Ie(e);for(;Ce(n)&&!Re(n);){if(kt(n))return n;if(st(n))return null;n=Ie(n)}return null}function $t(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Re(e){return["html","body","#document"].includes(xe(e))}function ge(e){return ue(e).getComputedStyle(e)}function it(e){return he(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ie(e){if(xe(e)==="html")return e;const n=e.assignedSlot||e.parentNode||hn(e)&&e.host||ye(e);return hn(n)?n.host:n}function gn(e){const n=Ie(e);return Re(n)?e.ownerDocument?e.ownerDocument.body:e.body:Ce(n)&&je(n)?n:gn(n)}function qe(e,n,o){var l;n===void 0&&(n=[]),o===void 0&&(o=!0);const a=gn(e),d=a===((l=e.ownerDocument)==null?void 0:l.body),s=ue(a);if(d){const r=Bt(s);return n.concat(s,s.visualViewport||[],je(a)?a:[],r&&o?qe(r):[])}return n.concat(a,qe(a,[],o))}function Bt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bn(e){const n=ge(e);let o=parseFloat(n.width)||0,l=parseFloat(n.height)||0;const a=Ce(e),d=a?e.offsetWidth:o,s=a?e.offsetHeight:l,r=tt(o)!==d||tt(l)!==s;return r&&(o=d,l=s),{width:o,height:l,$:r}}function St(e){return he(e)?e:e.contextElement}function Oe(e){const n=St(e);if(!Ce(n))return be(1);const o=n.getBoundingClientRect(),{width:l,height:a,$:d}=bn(n);let s=(d?tt(o.width):o.width)/l,r=(d?tt(o.height):o.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!r||!Number.isFinite(r))&&(r=1),{x:s,y:r}}const Fl=be(0);function yn(e){const n=ue(e);return!$t()||!n.visualViewport?Fl:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Pl(e,n,o){return n===void 0&&(n=!1),!o||n&&o!==ue(e)?!1:n}function Ne(e,n,o,l){n===void 0&&(n=!1),o===void 0&&(o=!1);const a=e.getBoundingClientRect(),d=St(e);let s=be(1);n&&(l?he(l)&&(s=Oe(l)):s=Oe(e));const r=Pl(d,o,l)?yn(d):be(0);let i=(a.left+r.x)/s.x,c=(a.top+r.y)/s.y,u=a.width/s.x,p=a.height/s.y;if(d){const f=ue(d),m=l&&he(l)?ue(l):l;let h=f,g=Bt(h);for(;g&&l&&m!==h;){const b=Oe(g),w=g.getBoundingClientRect(),I=ge(g),V=w.left+(g.clientLeft+parseFloat(I.paddingLeft))*b.x,A=w.top+(g.clientTop+parseFloat(I.paddingTop))*b.y;i*=b.x,c*=b.y,u*=b.x,p*=b.y,i+=V,c+=A,h=ue(g),g=Bt(h)}}return lt({width:u,height:p,x:i,y:c})}function It(e,n){const o=it(e).scrollLeft;return n?n.left+o:Ne(ye(e)).left+o}function Cn(e,n,o){o===void 0&&(o=!1);const l=e.getBoundingClientRect(),a=l.left+n.scrollLeft-(o?0:It(e,l)),d=l.top+n.scrollTop;return{x:a,y:d}}function _l(e){let{elements:n,rect:o,offsetParent:l,strategy:a}=e;const d=a==="fixed",s=ye(l),r=n?st(n.floating):!1;if(l===s||r&&d)return o;let i={scrollLeft:0,scrollTop:0},c=be(1);const u=be(0),p=Ce(l);if((p||!p&&!d)&&((xe(l)!=="body"||je(s))&&(i=it(l)),Ce(l))){const m=Ne(l);c=Oe(l),u.x=m.x+l.clientLeft,u.y=m.y+l.clientTop}const f=s&&!p&&!d?Cn(s,i,!0):be(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-i.scrollLeft*c.x+u.x+f.x,y:o.y*c.y-i.scrollTop*c.y+u.y+f.y}}function zl(e){return Array.from(e.getClientRects())}function Kl(e){const n=ye(e),o=it(e),l=e.ownerDocument.body,a=ce(n.scrollWidth,n.clientWidth,l.scrollWidth,l.clientWidth),d=ce(n.scrollHeight,n.clientHeight,l.scrollHeight,l.clientHeight);let s=-o.scrollLeft+It(e);const r=-o.scrollTop;return ge(l).direction==="rtl"&&(s+=ce(n.clientWidth,l.clientWidth)-a),{width:a,height:d,x:s,y:r}}function Hl(e,n){const o=ue(e),l=ye(e),a=o.visualViewport;let d=l.clientWidth,s=l.clientHeight,r=0,i=0;if(a){d=a.width,s=a.height;const c=$t();(!c||c&&n==="fixed")&&(r=a.offsetLeft,i=a.offsetTop)}return{width:d,height:s,x:r,y:i}}function Wl(e,n){const o=Ne(e,!0,n==="fixed"),l=o.top+e.clientTop,a=o.left+e.clientLeft,d=Ce(e)?Oe(e):be(1),s=e.clientWidth*d.x,r=e.clientHeight*d.y,i=a*d.x,c=l*d.y;return{width:s,height:r,x:i,y:c}}function wn(e,n,o){let l;if(n==="viewport")l=Hl(e,o);else if(n==="document")l=Kl(ye(e));else if(he(n))l=Wl(n,o);else{const a=yn(e);l={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return lt(l)}function kn(e,n){const o=Ie(e);return o===n||!he(o)||Re(o)?!1:ge(o).position==="fixed"||kn(o,n)}function Ul(e,n){const o=n.get(e);if(o)return o;let l=qe(e,[],!1).filter(r=>he(r)&&xe(r)!=="body"),a=null;const d=ge(e).position==="fixed";let s=d?Ie(e):e;for(;he(s)&&!Re(s);){const r=ge(s),i=kt(s);!i&&r.position==="fixed"&&(a=null),(d?!i&&!a:!i&&r.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||je(s)&&!i&&kn(e,s))?l=l.filter(u=>u!==s):a=r,s=Ie(s)}return n.set(e,l),l}function jl(e){let{element:n,boundary:o,rootBoundary:l,strategy:a}=e;const s=[...o==="clippingAncestors"?st(n)?[]:Ul(n,this._c):[].concat(o),l],r=s[0],i=s.reduce((c,u)=>{const p=wn(n,u,a);return c.top=ce(p.top,c.top),c.right=Be(p.right,c.right),c.bottom=Be(p.bottom,c.bottom),c.left=ce(p.left,c.left),c},wn(n,r,a));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function ql(e){const{width:n,height:o}=bn(e);return{width:n,height:o}}function Ql(e,n,o){const l=Ce(n),a=ye(n),d=o==="fixed",s=Ne(e,!0,d,n);let r={scrollLeft:0,scrollTop:0};const i=be(0);if(l||!l&&!d)if((xe(n)!=="body"||je(a))&&(r=it(n)),l){const f=Ne(n,!0,d,n);i.x=f.x+n.clientLeft,i.y=f.y+n.clientTop}else a&&(i.x=It(a));const c=a&&!l&&!d?Cn(a,r):be(0),u=s.left+r.scrollLeft-i.x-c.x,p=s.top+r.scrollTop-i.y-c.y;return{x:u,y:p,width:s.width,height:s.height}}function Vt(e){return ge(e).position==="static"}function $n(e,n){if(!Ce(e)||ge(e).position==="fixed")return null;if(n)return n(e);let o=e.offsetParent;return ye(e)===o&&(o=o.ownerDocument.body),o}function Bn(e,n){const o=ue(e);if(st(e))return o;if(!Ce(e)){let a=Ie(e);for(;a&&!Re(a);){if(he(a)&&!Vt(a))return a;a=Ie(a)}return o}let l=$n(e,n);for(;l&&Ol(l)&&Vt(l);)l=$n(l,n);return l&&Re(l)&&Vt(l)&&!kt(l)?o:l||vl(e)||o}const Gl=function(e){return te(this,null,function*(){const n=this.getOffsetParent||Bn,o=this.getDimensions,l=yield o(e.floating);return{reference:Ql(e.reference,yield n(e.floating),e.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}})};function Yl(e){return ge(e).direction==="rtl"}const Xl={convertOffsetParentRelativeRectToViewportRelativeRect:_l,getDocumentElement:ye,getClippingRect:jl,getOffsetParent:Bn,getElementRects:Gl,getClientRects:zl,getDimensions:ql,getScale:Oe,isElement:he,isRTL:Yl};function Zl(e,n){let o=null,l;const a=ye(e);function d(){var r;clearTimeout(l),(r=o)==null||r.disconnect(),o=null}function s(r,i){r===void 0&&(r=!1),i===void 0&&(i=1),d();const{left:c,top:u,width:p,height:f}=e.getBoundingClientRect();if(r||n(),!p||!f)return;const m=nt(u),h=nt(a.clientWidth-(c+p)),g=nt(a.clientHeight-(u+f)),b=nt(c),I={rootMargin:-m+"px "+-h+"px "+-g+"px "+-b+"px",threshold:ce(0,Be(1,i))||1};let V=!0;function A(N){const L=N[0].intersectionRatio;if(L!==i){if(!V)return s();L?s(!1,L):l=setTimeout(()=>{s(!1,1e-7)},1e3)}V=!1}try{o=new IntersectionObserver(A,re(J({},I),{root:a.ownerDocument}))}catch(N){o=new IntersectionObserver(A,I)}o.observe(e)}return s(!0),d}function Et(e,n,o,l){l===void 0&&(l={});const{ancestorScroll:a=!0,ancestorResize:d=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:i=!1}=l,c=St(e),u=a||d?[...c?qe(c):[],...qe(n)]:[];u.forEach(w=>{a&&w.addEventListener("scroll",o,{passive:!0}),d&&w.addEventListener("resize",o)});const p=c&&r?Zl(c,o):null;let f=-1,m=null;s&&(m=new ResizeObserver(w=>{let[I]=w;I&&I.target===c&&m&&(m.unobserve(n),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var V;(V=m)==null||V.observe(n)})),o()}),c&&!i&&m.observe(c),m.observe(n));let h,g=i?Ne(e):null;i&&b();function b(){const w=Ne(e);g&&(w.x!==g.x||w.y!==g.y||w.width!==g.width||w.height!==g.height)&&o(),g=w,h=requestAnimationFrame(b)}return o(),()=>{var w;u.forEach(I=>{a&&I.removeEventListener("scroll",o),d&&I.removeEventListener("resize",o)}),p==null||p(),(w=m)==null||w.disconnect(),m=null,i&&cancelAnimationFrame(h)}}const xt=Ll,Jl=Tl,Nt=Al,Sn=Rl,At=Ml,ea=Nl,In=(e,n,o)=>{const l=new Map,a=J({platform:Xl},o),d=re(J({},a.platform),{_c:l});return xl(e,n,re(J({},a),{platform:d}))};function ta(e){return e!=null&&typeof e=="object"&&"$el"in e}function Mt(e){if(ta(e)){const n=e.$el;return wt(n)&&xe(n)==="#comment"?null:n}return e}function na(e){return{name:"arrow",options:e,fn(n){const o=Mt(t.unref(e.element));return o==null?{}:ea({element:o,padding:e.padding}).fn(n)}}}function Vn(e){return typeof window=="undefined"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function En(e,n){const o=Vn(e);return Math.round(n*o)/o}function xn(e,n,o){o===void 0&&(o={});const l=o.whileElementsMounted,a=t.computed(()=>{var D;return(D=t.unref(o.open))!=null?D:!0}),d=t.computed(()=>t.unref(o.middleware)),s=t.computed(()=>{var D;return(D=t.unref(o.placement))!=null?D:"bottom"}),r=t.computed(()=>{var D;return(D=t.unref(o.strategy))!=null?D:"absolute"}),i=t.computed(()=>{var D;return(D=t.unref(o.transform))!=null?D:!0}),c=t.computed(()=>Mt(e.value)),u=t.computed(()=>Mt(n.value)),p=t.ref(0),f=t.ref(0),m=t.ref(r.value),h=t.ref(s.value),g=t.shallowRef({}),b=t.ref(!1),w=t.computed(()=>{const D={position:m.value,left:"0",top:"0"};if(!u.value)return D;const B=En(u.value,p.value),y=En(u.value,f.value);return i.value?J(re(J({},D),{transform:"translate("+B+"px, "+y+"px)"}),Vn(u.value)>=1.5&&{willChange:"transform"}):{position:m.value,left:B+"px",top:y+"px"}});let I;function V(){c.value==null||u.value==null||In(c.value,u.value,{middleware:d.value,placement:s.value,strategy:r.value}).then(D=>{p.value=D.x,f.value=D.y,m.value=D.strategy,h.value=D.placement,g.value=D.middlewareData,b.value=!0})}function A(){typeof I=="function"&&(I(),I=void 0)}function N(){if(A(),l===void 0){V();return}if(c.value!=null&&u.value!=null){I=l(c.value,u.value,V);return}}function L(){a.value||(b.value=!1)}return t.watch([d,s,r],V,{flush:"sync"}),t.watch([c,u],N,{flush:"sync"}),t.watch(a,L,{flush:"sync"}),t.getCurrentScope()&&t.onScopeDispose(A),{x:t.shallowReadonly(p),y:t.shallowReadonly(f),strategy:t.shallowReadonly(m),placement:t.shallowReadonly(h),middlewareData:t.shallowReadonly(g),isPositioned:t.shallowReadonly(b),floatingStyles:w,update:V}}function oa(e,n=Ke){let l=Array.from(e).reduce((d,s)=>d*31+s.charCodeAt(0)&4294967295,0);l=l>>>0;const a=l.toString(36);return"".concat(n,"-").concat(a)}const Nn=new Map;class An{constructor(n,o){we(this,"referenceElement");we(this,"tooltipElement");we(this,"textContent");we(this,"placement");we(this,"autoUpdateCleanup");we(this,"referenceElementHandlers");we(this,"tooltipElementHandlers");we(this,"escapeHandler");we(this,"timeoutId");var d,s;const l=n.ownerDocument,a=this.generateTooltipId(o.textContent);this.referenceElement=n,this.textContent=o.textContent,this.placement=(d=o.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,(s=this.referenceElement.parentElement)==null||s.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=Et(this.referenceElement,this.tooltipElement,()=>this.update())}generateTooltipId(n){var a;const o=n.trim(),l=(a=Nn.get(o))!=null?a:0;return Nn.set(o,l+1),oa(o+"-"+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(n){n.key==="Escape"&&this.isVisible()&&this.hide()}addEventListeners(){Object.keys(this.referenceElementHandlers).forEach(n=>{this.referenceElement.addEventListener(n,this.referenceElementHandlers[n])}),Object.keys(this.tooltipElementHandlers).forEach(n=>{this.tooltipElement.addEventListener(n,this.tooltipElementHandlers[n])})}removeEventListeners(){Object.keys(this.referenceElementHandlers).forEach(n=>{this.referenceElement.removeEventListener(n,this.referenceElementHandlers[n])}),Object.keys(this.tooltipElementHandlers).forEach(n=>{this.tooltipElement.removeEventListener(n,this.tooltipElementHandlers[n])})}update(){In(this.referenceElement,this.tooltipElement,{placement:this.placement,middleware:[xt(4),Nt(),Jl(),At()]}).then(({x:n,y:o,middlewareData:l})=>{var d,s,r;const a=(s=(d=l.offset)==null?void 0:d.placement)!=null?s:this.placement;Object.assign(this.tooltipElement.style,{left:"".concat(n,"px"),top:"".concat(o,"px"),visibility:(r=l.hide)!=null&&r.referenceHidden?"hidden":"visible",transformOrigin:nn[a]})})}updateWithOptions(n){var o;this.textContent=n.textContent,this.placement=(o=n.placement)!=null?o:this.placement,this.tooltipElement.textContent=this.textContent,this.update()}remove(){this.tooltipElement.remove(),this.autoUpdateCleanup(),this.removeEventListeners()}}const Dt={mounted(e,{value:n,arg:o}){n&&(typeof n=="string"&&n.trim()===""||(e.tooltip=new An(e,{textContent:String(n),placement:o})))},updated(e,{value:n,arg:o}){n!==null&&(e.tooltip?e.tooltip.updateWithOptions({textContent:String(n),placement:o}):e.tooltip=new An(e,{textContent:String(n),placement:o}))},beforeUnmount(e){e.tooltip&&e.tooltip.remove()}},la=t.defineComponent({name:"CdxInputChip",components:{CdxButton:me,CdxIcon:X},directives:{tooltip:Dt},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:n,slots:o}){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})),s=Z("cdx-input-chip-aria-description","Press Enter to edit or Delete to remove"),r=t.ref(),i=t.ref(!1),c=t.computed(()=>i.value&&r.value&&r.value.scrollWidth>r.value.clientWidth?De(o==null?void 0:o.default)[0]:null);t.onMounted(()=>{i.value=!0});function u(p){var f;switch(p.key){case"Enter":n("click-chip"),p.preventDefault(),p.stopPropagation();break;case"Escape":(f=a.value)==null||f.blur(),p.preventDefault(),p.stopPropagation();break;case"Backspace":case"Delete":n("remove-chip",p.key),p.preventDefault(),p.stopPropagation();break;case"ArrowLeft":n("arrow-left"),p.preventDefault(),p.stopPropagation();break;case"ArrowRight":n("arrow-right"),p.preventDefault(),p.stopPropagation();break}}return{rootElement:a,rootClasses:d,ariaDescription:s,onKeydown:u,cdxIconClose:Ye,tabIndex:l,tooltipContent:c,textElement:r}},methods:{focus(){this.$refs.rootElement.focus()}}}),aa=["tabindex","aria-description"],sa={ref:"textElement",class:"cdx-input-chip__text"};function ia(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon"),r=t.resolveComponent("cdx-button"),i=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:n[1]||(n[1]=(...c)=>e.onKeydown&&e.onKeydown(...c)),onClick:n[2]||(n[2]=c=>e.$emit("click-chip"))},[e.icon?(t.openBlock(),t.createBlock(s,{key:0,icon:e.icon,size:"small"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",sa,[t.renderSlot(e.$slots,"default")],512),t.createVNode(r,{class:"cdx-input-chip__button",we