UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

9 lines 171 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 Qr=Object.defineProperty,Gr=Object.defineProperties;var Yr=Object.getOwnPropertyDescriptors;var ut=Object.getOwnPropertySymbols;var Hn=Object.prototype.hasOwnProperty,jn=Object.prototype.propertyIsEnumerable;var _t=(S,t,Y)=>t in S?Qr(S,t,{enumerable:!0,configurable:!0,writable:!0,value:Y}):S[t]=Y,ee=(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))jn.call(t,Y)&&_t(S,Y,t[Y]);return S},re=(S,t)=>Gr(S,Yr(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&&jn.call(S,de)&&(Y[de]=S[de]);return Y};var we=(S,t,Y)=>_t(S,typeof t!="symbol"?t+"":t,Y);var ne=(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="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"/>',Wn='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',qn='<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"/>',Gn='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',Yn='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',Xn='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',Zn='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',Jn='<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"/>',eo='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',to='<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"/>',no='<path d="m10 5 8 10H2z"/>',zt=Y,oo=de,lo=Ge,ao=pt,Ye=ft,so=Pe,Kt=ke,Ht=_e,io=Un,ro=Wn,jt={langCodeMap:{ar:qn},default:Qn},co={ltr:Gn,shouldFlip:!0},uo={ltr:Yn,shouldFlip:!0},Ut={ltr:Xn,shouldFlip:!0},Wt={ltr:Zn,shouldFlip:!0},po=Jn,fo=eo,qt=to,mo=no;function ho(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 go(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 Z(e){return n=>typeof n=="string"&&e.includes(n)}/*! * This file contains all constants used in the codex package. * * Exported constants should be marked with `@public` comments in this file, AND explicitly * exported in lib.ts. * * IMPORTANT NOTE: All constants should be added to the Types and Constants page on the Codex docs * site. Refer to `packages/codex-docs/docs/components/types-and-constants.md`. */const Ke="cdx",bo=["default","progressive","destructive"],yo=["normal","primary","quiet"],Co=["small","medium","large"],wo=["x-small","small","medium"],Gt=Z(["notice","warning","error","success"]),ko=["text","search","number","email","month","password","tel","url","week","date","datetime-local","time"],fe=["default","warning","error","success"],$o=["start","center","end","number"],Bo=Z(["16:9","3:2","4:3","1:1","3:4","2:3"]),So=Z(["fill","contain","cover","none","scale-down"]),Io=Z(["top","bottom","left","right","center"]),Vo=120,Eo=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"),xo="".concat(Ke,"-no-invert"),Ze=Symbol("CdxTableRowIdentifier"),No=["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"},Ao=Z(wo),Mo=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:Ao}},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&&go(e.icon,d.value),["cdx-icon--".concat(e.size)]:!0})),r=t.computed(()=>{var u,p;return ho(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},Do=["aria-hidden"],Lo={key:0},Ro=["innerHTML"],To=["d"];function Oo(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",Lo,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("v-if",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,Ro)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,To))],8,Do))],2)}const X=_(Mo,[["render",Oo]]);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 vo(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")||vo(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 Fo=Z(bo),Po=Z(yo),_o=Z(Co),zo=t.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:Fo},weight:{type:String,default:"normal",validator:Po},size:{type:String,default:"medium",validator:_o}},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 Ko(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=_(zo,[["render",Ko]]);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 Ho=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}}}),jo=["open"],Uo={class:"cdx-accordion__header__title"},Wo={class:"cdx-accordion__header__description"};function qo(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",Uo,[t.renderSlot(e.$slots,"title")]),t.createElementVNode("span",Wo,[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,jo)}const Qo=_(Ho,[["render",qo]]);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,b){const g=h;g&&l.value.set(b,g)}function s(h){o.value=h}function r(){o.value=void 0}function i(h,b){var I;const g=h+b,w=e.value[g];if(w)if(w.disabled)i(g,b);else{const V=(I=l.value.get(g))==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 Go=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}}}),Yo={ref:"rootElement",class:"cdx-button-group"};function Xo(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon"),r=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",Yo,[(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 Zo=_(Go,[["render",Xo]]),Jo=t.defineComponent({name:"CdxThumbnail",components:{CdxIcon:X},props:{thumbnail:{type:[Object,null],default:null},placeholderIcon:{type:[String,Object],default:ro}},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:xo}}}),el={class:"cdx-thumbnail"},tl={key:0,class:"cdx-thumbnail__placeholder"};function nl(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon");return t.openBlock(),t.createElementBlock("span",el,[e.thumbnailLoaded?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",tl,[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=_(Jo,[["render",nl]]),ol=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}}}),ll={class:"cdx-card__text"},al={class:"cdx-card__text__title"},sl={key:0,class:"cdx-card__text__description"},il={key:1,class:"cdx-card__text__supporting-text"};function rl(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",ll,[t.createElementVNode("span",al,[t.renderSlot(e.$slots,"title")]),e.$slots.description?(t.openBlock(),t.createElementBlock("span",sl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0),e.$slots["supporting-text"]?(t.openBlock(),t.createElementBlock("span",il,[t.renderSlot(e.$slots,"supporting-text")])):t.createCommentVNode("v-if",!0)])]),_:3},8,["href","class"])}const dl=_(ol,[["render",rl]]);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 le(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 J(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 je(e,n,o,l=[]){const a=J(n,o,l);return t.computed(()=>e.value||a.value)}const cl=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:"",validator:(e,n)=>e.length>0&&!n.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: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}=le(n,l),r=je(t.toRef(e,"optionalFlag"),"cdx-label-optional-flag","(optional)");return{rootClasses:a,rootStyle:d,otherAttrs:s,translatedOptionalFlag:r}}}),ul=["for"],pl={class:"cdx-label__label__text"},fl={key:1,class:"cdx-label__label__optional-flag"},ml=["id"],hl={class:"cdx-label__label"},gl={class:"cdx-label__label__text"},bl={key:1,class:"cdx-label__label__optional-flag"},yl={key:0,class:"cdx-label__description"};function Cl(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",hl,[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",gl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",bl,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",yl,[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",pl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",fl,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)],16,ul),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,ml)):t.createCommentVNode("v-if",!0)],6))}const Le=_(cl,[["render",Cl]]);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 wl=Z(fe),kl=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:wl}},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}}}),$l={class:"cdx-checkbox__wrapper"},Bl=["id","aria-describedby","value","name","disabled",".indeterminate"];function Sl(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",$l,[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,Bl),[[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=_(kl,[["render",Sl]]),Il=["top","right","bottom","left"],Be=Math.min,ce=Math.max,tt=Math.round,nt=Math.floor,be=e=>({x:e,y:e}),Vl={left:"right",right:"left",bottom:"top",top:"bottom"},El={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 Re(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 xl(e,n,o){o===void 0&&(o=!1);const l=Re(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 Nl(e){const n=ot(e);return[Ct(e),n,Ct(n)]}function Ct(e){return e.replace(/start|end/g,n=>El[n])}function Al(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 Ml(e,n,o,l){const a=Re(e);let d=Al(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=>Vl[n])}function Dl(e){return ee({top:0,right:0,bottom:0,left:0},e)}function un(e){return typeof e!="number"?Dl(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(Re(n)){case"start":m[s]-=f*(o&&c?-1:1);break;case"end":m[s]+=f*(o&&c?-1:1);break}return m}const Ll=(e,n,o)=>ne(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 b=0;b<r.length;b++){const{name:g,fn:w}=r[b],{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(ee({},m),{[g]:ee(ee({},m[g]),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)),b=-1)}return{x:u,y:p,placement:f,strategy:a,middlewareData:m}});function Ue(e,n){return ne(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),g=r[f?p==="floating"?"reference":"floating":p],w=lt(yield d.getClippingRect({element:(o=yield d.isElement==null?void 0:d.isElement(g))==null||o?g:g.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 Rl=e=>({name:"arrow",options:e,fn(o){return ne(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),b=bt(h),g=yield r.getDimensions(u),w=h==="y",I=w?"top":"left",V=w?"bottom":"right",A=w?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[h]-m[h]-s.floating[b],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[b]);const y=N/2-L/2,$=B/2-g[b]/2-1,E=Be(f[I],$),x=Be(f[V],$),v=E,H=B-g[b]-x,K=B/2-g[b]/2+y,F=gt(v,K,H),j=!c.arrow&&Re(d)!=null&&K!==F&&s.reference[b]/2-(K<v?E:x)-g[b]/2<0,T=j?K<v?K-v:K-H:0;return{[h]:m[h]+T,data:ee({[h]:F,centerOffset:K-F-T},j&&{alignmentOffset:T}),reset:j}})}}),Tl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(o){return ne(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:b="none",flipAlignment:g=!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||!g?[ot(i)]:Nl(i)),D=b!=="none";!m&&D&&L.push(...Ml(i,g,b,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=xl(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,j=B[F];if(j)return{data:{index:F,overflows:E},reset:{placement:j}};let T=(v=E.filter(U=>U.overflows[0]<=0).sort((U,Q)=>U.overflows[1]-Q.overflows[1])[0])==null?void 0:v.placement;if(!T)switch(h){case"bestFit":{var H;const U=(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];U&&(T=U);break}case"initialPlacement":T=i;break}if(d!==T)return{reset:{placement:T}}}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 Il.some(n=>e[n]>=0)}const Ol=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(o){return ne(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(ee({},d),{elementContext:"reference"})),i=fn(r,l.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:mn(i)}}}case"escaped":{const r=yield Ue(o,re(ee({},d),{altBoundary:!0})),i=fn(r,l.floating);return{data:{escapedOffsets:i,escaped:mn(i)}}}default:return{}}})}}};function vl(e,n){return ne(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=Re(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 Fl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(o){return ne(this,null,function*(){var l,a;const{x:d,y:s,placement:r,middlewareData:i}=o,c=yield vl(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(ee({},c),{placement:r})}})}}},Pl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(o){return ne(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],b=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=b+p[I],N=b-p[V];b=gt(A,b,N)}const g=i.fn(re(ee({},o),{[m]:h,[f]:b}));return re(ee({},g),{data:{x:g.x-l,y:g.y-a,enabled:{[m]:s,[f]:r}}})})}}},_l=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(o){return ne(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=Re(d),h=Ee(d)==="y",{width:b,height:g}=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=g-p.top-p.bottom,A=b-p.left-p.right,N=Be(g-p[w],V),L=Be(b-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=b-2*(x!==0||v!==0?x+v:ce(p.left,p.right)):B=g-2*(H!==0||K!==0?H+K:ce(p.top,p.bottom))}yield c(re(ee({},o),{availableWidth:y,availableHeight:B}));const $=yield r.getDimensions(i.floating);return b!==$.width||g!==$.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 We(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 zl(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 Kl(e){let n=Ie(e);for(;Ce(n)&&!Te(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 Te(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 Te(n)?e.ownerDocument?e.ownerDocument.body:e.body:Ce(n)&&We(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||[],We(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 Hl=be(0);function yn(e){const n=ue(e);return!$t()||!n.visualViewport?Hl:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function jl(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=jl(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,b=Bt(h);for(;b&&l&&m!==h;){const g=Oe(b),w=b.getBoundingClientRect(),I=ge(b),V=w.left+(b.clientLeft+parseFloat(I.paddingLeft))*g.x,A=w.top+(b.clientTop+parseFloat(I.paddingTop))*g.y;i*=g.x,c*=g.y,u*=g.x,p*=g.y,i+=V,c+=A,h=ue(b),b=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 Ul(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"||We(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 Wl(e){return Array.from(e.getClientRects())}function ql(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 Ql(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 Gl(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=Ql(e,o);else if(n==="document")l=ql(ye(e));else if(he(n))l=Gl(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)||Te(o)?!1:ge(o).position==="fixed"||kn(o,n)}function Yl(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)&&!Te(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)||We(s)&&!i&&kn(e,s))?l=l.filter(u=>u!==s):a=r,s=Ie(s)}return n.set(e,l),l}function Xl(e){let{element:n,boundary:o,rootBoundary:l,strategy:a}=e;const s=[...o==="clippingAncestors"?st(n)?[]:Yl(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 Zl(e){const{width:n,height:o}=bn(e);return{width:n,height:o}}function Jl(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"||We(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&&!Te(a);){if(he(a)&&!Vt(a))return a;a=Ie(a)}return o}let l=$n(e,n);for(;l&&zl(l)&&Vt(l);)l=$n(l,n);return l&&Te(l)&&Vt(l)&&!kt(l)?o:l||Kl(e)||o}const ea=function(e){return ne(this,null,function*(){const n=this.getOffsetParent||Bn,o=this.getDimensions,l=yield o(e.floating);return{reference:Jl(e.reference,yield n(e.floating),e.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}})};function ta(e){return ge(e).direction==="rtl"}const na={convertOffsetParentRelativeRectToViewportRelativeRect:Ul,getDocumentElement:ye,getClippingRect:Xl,getOffsetParent:Bn,getElementRects:ea,getClientRects:Wl,getDimensions:Zl,getScale:Oe,isElement:he,isRTL:ta};function oa(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)),b=nt(a.clientHeight-(u+f)),g=nt(c),I={rootMargin:-m+"px "+-h+"px "+-b+"px "+-g+"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(ee({},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?oa(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,b=i?Ne(e):null;i&&g();function g(){const w=Ne(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&o(),b=w,h=requestAnimationFrame(g)}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=Fl,la=Pl,Nt=Tl,Sn=_l,At=Ol,aa=Rl,In=(e,n,o)=>{const l=new Map,a=ee({platform:na},o),d=re(ee({},a.platform),{_c:l});return Ll(e,n,re(ee({},a),{platform:d}))};function sa(e){return e!=null&&typeof e=="object"&&"$el"in e}function Mt(e){if(sa(e)){const n=e.$el;return wt(n)&&xe(n)==="#comment"?null:n}return e}function ia(e){return{name:"arrow",options:e,fn(n){const o=Mt(t.unref(e.element));return o==null?{}:aa({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),b=t.shallowRef({}),g=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?ee(re(ee({},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,b.value=D.middlewareData,g.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||(g.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(b),isPositioned:t.shallowReadonly(g),floatingStyles:w,update:V}}function ra(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),ra(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(),la(),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()}},da=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=J("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,