@wikimedia/codex
Version:
Codex Design System for Wikimedia
9 lines • 171 kB
JavaScript
"use strict";var _n=Object.defineProperty,zn=Object.defineProperties;var Kn=Object.getOwnPropertyDescriptors;var He=Object.getOwnPropertySymbols;var Mt=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var dt=(e,n,o)=>n in e?_n(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,X=(e,n)=>{for(var o in n||(n={}))Mt.call(n,o)&&dt(e,o,n[o]);if(He)for(var o of He(n))Dt.call(n,o)&&dt(e,o,n[o]);return e},ae=(e,n)=>zn(e,Kn(n));var de=(e,n)=>{var o={};for(var l in e)Mt.call(e,l)&&n.indexOf(l)<0&&(o[l]=e[l]);if(e!=null&&He)for(var l of He(e))n.indexOf(l)<0&&Dt.call(e,l)&&(o[l]=e[l]);return o};var me=(e,n,o)=>dt(e,typeof n!="symbol"?n+"":n,o);var ee=(e,n,o)=>new Promise((l,a)=>{var d=i=>{try{r(o.next(i))}catch(u){a(u)}},s=i=>{try{r(o.throw(i))}catch(u){a(u)}},r=i=>i.done?l(i.value):Promise.resolve(i.value).then(d,s);r((o=o.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),Hn='<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"/>',jn='<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"/>',Un='<path d="M7 14.17 2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/>',Wn='<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"/>',qn='<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"/>',Qn='<path d="M10 15 2 5h16z"/>',Gn='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',Yn='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',Xn='<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"/>',Zn='<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"/>',eo='<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"/>',to='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',no='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',oo='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',lo='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',ao='<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"/>',so='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',io='<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"/>',ro='<path d="m10 5 8 10H2z"/>',jt=Hn,uo=jn,co=Un,po=Wn,Xe=qn,fo=Qn,Ut=Gn,Wt=Yn,mo=Xn,ho=Zn,qt={langCodeMap:{ar:Jn},default:eo},vo={ltr:to,shouldFlip:!0},go={ltr:no,shouldFlip:!0},Qt={ltr:oo,shouldFlip:!0},Gt={ltr:lo,shouldFlip:!0},bo=ao,yo=so,Yt=io,Co=ro;function wo(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 ko(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 Pe(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 Xt(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 Y(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 Te="cdx",$o=["default","progressive","destructive"],Bo=["normal","primary","quiet"],So=["small","medium","large"],Io=["x-small","small","medium"],xo=["notice","warning","error","success"],Zt=Y(xo),Vo=["text","search","number","email","month","password","tel","url","week","date","datetime-local","time"],pe=["default","warning","error","success"],Eo=["start","center","end","number"],No=["16:9","3:2","4:3","1:1","3:4","2:3"],Ao=Y(No),Mo=["fill","contain","cover","none","scale-down"],Do=Y(Mo),Lo=["top","bottom","left","right","center"],Ro=Y(Lo),To=120,Oo=500,Ve="cdx-menu-footer-item",Jt=Symbol("CdxTabs"),en=Symbol("CdxActiveTab"),tn=Symbol("CdxAllowArbitrary"),nn=Symbol("CdxFieldInputId"),Ze=Symbol("CdxFieldDescriptionId"),on=Symbol("CdxFieldStatus"),ln=Symbol("CdxDisabled"),Fo="".concat(Te,"-no-invert"),We=Symbol("CdxTableRowIdentifier"),Po=["top","bottom","both"],an={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"},_o=Y(Io),zo=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:_o}},setup(e){const n=t.ref(),o=Pe(n),l=Xt(n),a=t.computed(()=>{var c;return(c=e.dir)!=null?c:o.value}),d=t.computed(()=>{var c;return(c=e.lang)!=null?c:l.value}),s=t.computed(()=>({"cdx-icon--flipped":a.value==="rtl"&&d.value!==null&&ko(e.icon,d.value),["cdx-icon--".concat(e.size)]:!0})),r=t.computed(()=>{var c,p;return wo(e.icon,(c=d.value)!=null?c:"",(p=a.value)!=null?p:"ltr")}),i=t.computed(()=>typeof r.value=="string"?r.value:""),u=t.computed(()=>typeof r.value!="string"?r.value.path:"");return{rootElement:n,rootClasses:s,iconSvg:i,iconPath:u}}}),P=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},Ko=["aria-hidden"],Ho={key:0},jo=["innerHTML"],Uo=["d"];function Wo(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",Ho,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("v-if",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,jo)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,Uo))],8,Ko))],2)}const G=P(zo,[["render",Wo]]);function sn(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(...sn(o.children)));return n}function rn(e,n){return typeof e.type=="object"&&"name"in e.type?n!==void 0?e.type.name===n:!0:!1}function qo(e,n){return typeof e.type=="string"?e.type===n.toLowerCase():!1}function Ae(e){const n=typeof e=="function"?e():e;return n?sn(n):[]}function Je(e,n){if(e()){t.warn(n);return}const o=t.watch(e,l=>{l&&(t.warn(n),o())})}function dn(e,n,o){const l=t.computed(()=>{const a=Ae(e);if(a.length!==1)return!1;const d=a[0];return!!(typeof d=="object"&&(rn(d,"CdxIcon")||qo(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 Qo=Y($o),Go=Y(Bo),Yo=Y(So),Xo=t.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:Qo},weight:{type:String,default:"normal",validator:Go},size:{type:String,default:"medium",validator:Yo}},emits:["click"],setup(e,{emit:n,slots:o,attrs:l}){const a=t.ref(),d=dn(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)},u=f=>{s.value=f};function c(){u(!0)}function p(){var f;u(!1),(f=a.value)==null||f.click()}return{button:a,rootClasses:r,onClick:i,onKeyDown:c,onKeyUp:p}}});function Zo(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 fe=P(Xo,[["render",Zo]]);function _e(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 Jo=t.defineComponent({name:"CdxAccordion",components:{CdxButton:fe,CdxIcon:G},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=_e(l,t.toRef(e,"modelValue"),o),d=()=>{o("action-button-click")},s=u=>{a.value=u.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}}}),el=["open"],tl={class:"cdx-accordion__header__title"},nl={class:"cdx-accordion__header__description"};function ol(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",tl,[t.renderSlot(e.$slots,"title")]),t.createElementVNode("span",nl,[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,el)}const ll=P(Jo,[["render",ol]]);function un(e){return e.label===void 0?e.value:e.label===null?"":e.label}function cn(e){const n=t.ref(),o=t.ref(),l=t.ref(new Map),a=Pe(n);function d(h,g){const v=h;v&&l.value.set(g,v)}function s(h){o.value=h}function r(){o.value=void 0}function i(h,g){var B;const v=h+g,C=e.value[v];if(C)if(C.disabled)i(v,g);else{const S=(B=l.value.get(v))==null?void 0:B.$el;S==null||S.focus()}}function u(){var h;i((h=o.value)!=null?h:-1,1)}function c(){var h;i((h=o.value)!=null?h:e.value.length,-1)}function p(){a.value==="rtl"?c():u()}function f(){a.value==="rtl"?u():c()}function m(h){switch(h.key){case"ArrowRight":h.preventDefault(),p();break;case"ArrowLeft":h.preventDefault(),f();break;case"ArrowDown":h.preventDefault(),u();break;case"ArrowUp":h.preventDefault(),c();break}}return{rootElement:n,assignTemplateRef:d,onFocus:s,onBlur:r,onKeydown:m}}const al=t.defineComponent({name:"CdxButtonGroup",components:{CdxButton:fe,CdxIcon:G},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}=cn(t.toRef(e,"buttons"));return{rootElement:n,assignTemplateRef:o,onFocus:l,onBlur:a,onKeydown:d,getButtonLabel:un}}}),sl={ref:"rootElement",class:"cdx-button-group"};function il(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon"),r=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",sl,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.buttons,(i,u)=>(t.openBlock(),t.createBlock(r,{key:i.value,ref_for:!0,ref:c=>e.assignTemplateRef(c,u),disabled:i.disabled||e.disabled,"aria-label":i.ariaLabel,onClick:c=>e.$emit("click",i.value),onFocus:c=>e.onFocus(u),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 rl=P(al,[["render",il]]),dl=t.defineComponent({name:"CdxThumbnail",components:{CdxIcon:G},props:{thumbnail:{type:[Object,null],default:null},placeholderIcon:{type:[String,Object],default:ho}},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:Fo}}}),ul={class:"cdx-thumbnail"},cl={key:0,class:"cdx-thumbnail__placeholder"};function pl(e,n,o,l,a,d){const s=t.resolveComponent("cdx-icon");return t.openBlock(),t.createElementBlock("span",ul,[e.thumbnailLoaded?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",cl,[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 gt=P(dl,[["render",pl]]),fl=t.defineComponent({name:"CdxCard",components:{CdxIcon:G,CdxThumbnail:gt},props:{url:{type:String,default:""},icon:{type:[String,Object],default:""},thumbnail:{type:[Object,null],default:null},forceThumbnail:{type:Boolean,default:!1},customPlaceholderIcon:{type:[String,Object],default:void 0}},setup(e){const 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}}}),ml={class:"cdx-card__text"},hl={class:"cdx-card__text__title"},vl={key:0,class:"cdx-card__text__description"},gl={key:1,class:"cdx-card__text__supporting-text"};function bl(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",ml,[t.createElementVNode("span",hl,[t.renderSlot(e.$slots,"title")]),e.$slots.description?(t.openBlock(),t.createElementBlock("span",vl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0),e.$slots["supporting-text"]?(t.openBlock(),t.createElementBlock("span",gl,[t.renderSlot(e.$slots,"supporting-text")])):t.createCommentVNode("v-if",!0)])]),_:3},8,["href","class"])}const yl=P(fl,[["render",bl]]);function bt(e){const n=t.inject(ln,t.ref(!1));return t.computed(()=>n.value||e.value)}function se(e,n,o){const l=bt(e),a=t.inject(on,t.ref("default")),d=t.computed(()=>n!=null&&n.value&&n.value!=="default"?n.value:a.value),s=t.inject(nn,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 oe(e,n=t.computed(()=>({}))){const o=t.computed(()=>{const d=de(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 de(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 ze(e,n,o,l=[]){const a=Z(n,o,l);return t.computed(()=>e.value||a.value)}const Cl=t.defineComponent({name:"CdxLabel",components:{CdxIcon:G},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}=se(t.toRef(e,"disabled")),l=t.computed(()=>({"cdx-label--visually-hidden":e.visuallyHidden,"cdx-label--disabled":o.value})),{rootClasses:a,rootStyle:d,otherAttrs:s}=oe(n,l),r=ze(t.toRef(e,"optionalFlag"),"cdx-label-optional-flag","(optional)");return{rootClasses:a,rootStyle:d,otherAttrs:s,translatedOptionalFlag:r}}}),wl=["for"],kl={class:"cdx-label__label__text"},$l={key:1,class:"cdx-label__label__optional-flag"},Bl=["id"],Sl={class:"cdx-label__label"},Il={class:"cdx-label__label__text"},xl={key:1,class:"cdx-label__label__optional-flag"},Vl={key:0,class:"cdx-label__description"};function El(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",Sl,[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",xl,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",Vl,[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",kl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",$l,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)],16,wl),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,Bl)):t.createCommentVNode("v-if",!0)],6))}const Me=P(Cl,[["render",El]]);function et(e,n,o){Je(()=>Ae(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 le(e,n,o){return t.computed({get:()=>e.value,set:l=>n(o||"update:modelValue",l)})}const Nl=Y(pe),Al=t.defineComponent({name:"CdxCheckbox",components:{CdxLabel:Me},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:Nl}},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}=se(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(),u=t.useId(),c=t.useId(),p=le(t.toRef(e,"modelValue"),n);return{rootClasses:s,computedDisabled:a,input:i,checkboxId:u,descriptionId:c,wrappedModel:p,customInputClasses:r}}}),Ml={class:"cdx-checkbox__wrapper"},Dl=["id","aria-describedby","value","name","disabled",".indeterminate"];function Ll(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",Ml,[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,Dl),[[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 pn=P(Al,[["render",Ll]]),Rl=["top","right","bottom","left"],ye=Math.min,ie=Math.max,qe=Math.round,je=Math.floor,he=e=>({x:e,y:e}),Tl={left:"right",right:"left",bottom:"top",top:"bottom"},Ol={start:"end",end:"start"};function pt(e,n,o){return ie(e,ye(n,o))}function Be(e,n){return typeof e=="function"?e(n):e}function Ce(e){return e.split("-")[0]}function De(e){return e.split("-")[1]}function fn(e){return e==="x"?"y":"x"}function yt(e){return e==="y"?"height":"width"}function ke(e){return["top","bottom"].includes(Ce(e))?"y":"x"}function Ct(e){return fn(ke(e))}function Fl(e,n,o){o===void 0&&(o=!1);const l=De(e),a=Ct(e),d=yt(a);let s=a==="x"?l===(o?"end":"start")?"right":"left":l==="start"?"bottom":"top";return n.reference[d]>n.floating[d]&&(s=Qe(s)),[s,Qe(s)]}function Pl(e){const n=Qe(e);return[ft(e),n,ft(n)]}function ft(e){return e.replace(/start|end/g,n=>Ol[n])}function _l(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 zl(e,n,o,l){const a=De(e);let d=_l(Ce(e),o==="start",l);return a&&(d=d.map(s=>s+"-"+a),n&&(d=d.concat(d.map(ft)))),d}function Qe(e){return e.replace(/left|right|bottom|top/g,n=>Tl[n])}function Kl(e){return X({top:0,right:0,bottom:0,left:0},e)}function mn(e){return typeof e!="number"?Kl(e):{top:e,right:e,bottom:e,left:e}}function Ge(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 Lt(e,n,o){let{reference:l,floating:a}=e;const d=ke(n),s=Ct(n),r=yt(s),i=Ce(n),u=d==="y",c=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:c,y:l.y-a.height};break;case"bottom":m={x:c,y:l.y+l.height};break;case"right":m={x:l.x+l.width,y:p};break;case"left":m={x:l.x-a.width,y:p};break;default:m={x:l.x,y:l.y}}switch(De(n)){case"start":m[s]-=f*(o&&u?-1:1);break;case"end":m[s]+=f*(o&&u?-1:1);break}return m}const Hl=(e,n,o)=>ee(exports,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 u=yield s.getElementRects({reference:e,floating:n,strategy:a}),{x:c,y:p}=Lt(u,l,i),f=l,m={},h=0;for(let g=0;g<r.length;g++){const{name:v,fn:C}=r[g],{x:B,y:S,data:E,reset:V}=yield C({x:c,y:p,initialPlacement:l,placement:f,strategy:a,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:n}});c=B!=null?B:c,p=S!=null?S:p,m=ae(X({},m),{[v]:X(X({},m[v]),E)}),V&&h<=50&&(h++,typeof V=="object"&&(V.placement&&(f=V.placement),V.rects&&(u=V.rects===!0?yield s.getElementRects({reference:e,floating:n,strategy:a}):V.rects),{x:c,y:p}=Lt(u,f,i)),g=-1)}return{x:c,y:p,placement:f,strategy:a,middlewareData:m}});function Oe(e,n){return ee(this,null,function*(){var o;n===void 0&&(n={});const{x:l,y:a,platform:d,rects:s,elements:r,strategy:i}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Be(n,e),h=mn(m),v=r[f?p==="floating"?"reference":"floating":p],C=Ge(yield d.getClippingRect({element:(o=yield d.isElement==null?void 0:d.isElement(v))==null||o?v:v.contextElement||(yield d.getDocumentElement==null?void 0:d.getDocumentElement(r.floating)),boundary:u,rootBoundary:c,strategy:i})),B=p==="floating"?{x:l,y:a,width:s.floating.width,height:s.floating.height}:s.reference,S=yield d.getOffsetParent==null?void 0:d.getOffsetParent(r.floating),E=(yield d.isElement==null?void 0:d.isElement(S))?(yield d.getScale==null?void 0:d.getScale(S))||{x:1,y:1}:{x:1,y:1},V=Ge(d.convertOffsetParentRelativeRectToViewportRelativeRect?yield d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:B,offsetParent:S,strategy:i}):B);return{top:(C.top-V.top+h.top)/E.y,bottom:(V.bottom-C.bottom+h.bottom)/E.y,left:(C.left-V.left+h.left)/E.x,right:(V.right-C.right+h.right)/E.x}})}const jl=e=>({name:"arrow",options:e,fn(o){return ee(this,null,function*(){const{x:l,y:a,placement:d,rects:s,platform:r,elements:i,middlewareData:u}=o,{element:c,padding:p=0}=Be(e,o)||{};if(c==null)return{};const f=mn(p),m={x:l,y:a},h=Ct(d),g=yt(h),v=yield r.getDimensions(c),C=h==="y",B=C?"top":"left",S=C?"bottom":"right",E=C?"clientHeight":"clientWidth",V=s.reference[g]+s.reference[h]-m[h]-s.floating[g],M=m[h]-s.reference[h],A=yield r.getOffsetParent==null?void 0:r.getOffsetParent(c);let $=A?A[E]:0;(!$||!(yield r.isElement==null?void 0:r.isElement(A)))&&($=i.floating[E]||s.floating[g]);const b=V/2-M/2,k=$/2-v[g]/2-1,I=ye(f[B],k),x=ye(f[S],k),T=I,K=$-v[g]-x,z=$/2-v[g]/2+b,O=pt(T,z,K),H=!u.arrow&&De(d)!=null&&z!==O&&s.reference[g]/2-(z<T?I:x)-v[g]/2<0,L=H?z<T?z-T:z-K:0;return{[h]:m[h]+L,data:X({[h]:O,centerOffset:z-O-L},H&&{alignmentOffset:L}),reset:H}})}}),Ul=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(o){return ee(this,null,function*(){var l,a;const{placement:d,middlewareData:s,rects:r,initialPlacement:i,platform:u,elements:c}=o,z=Be(e,o),{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0}=z,C=de(z,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((l=s.arrow)!=null&&l.alignmentOffset)return{};const B=Ce(d),S=ke(i),E=Ce(i)===i,V=yield u.isRTL==null?void 0:u.isRTL(c.floating),M=m||(E||!v?[Qe(i)]:Pl(i)),A=g!=="none";!m&&A&&M.push(...zl(i,v,g,V));const $=[i,...M],b=yield Oe(o,C),k=[];let I=((a=s.flip)==null?void 0:a.overflows)||[];if(p&&k.push(b[B]),f){const O=Fl(d,r,V);k.push(b[O[0]],b[O[1]])}if(I=[...I,{placement:d,overflows:k}],!k.every(O=>O<=0)){var x,T;const O=(((x=s.flip)==null?void 0:x.index)||0)+1,H=$[O];if(H)return{data:{index:O,overflows:I},reset:{placement:H}};let L=(T=I.filter(j=>j.overflows[0]<=0).sort((j,q)=>j.overflows[1]-q.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(h){case"bestFit":{var K;const j=(K=I.filter(q=>{if(A){const y=ke(q.placement);return y===S||y==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(y=>y>0).reduce((y,R)=>y+R,0)]).sort((q,y)=>q[1]-y[1])[0])==null?void 0:K[0];j&&(L=j);break}case"initialPlacement":L=i;break}if(d!==L)return{reset:{placement:L}}}return{}})}}};function Rt(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function Tt(e){return Rl.some(n=>e[n]>=0)}const Wl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(o){return ee(this,null,function*(){const{rects:l}=o,s=Be(e,o),{strategy:a="referenceHidden"}=s,d=de(s,["strategy"]);switch(a){case"referenceHidden":{const r=yield Oe(o,ae(X({},d),{elementContext:"reference"})),i=Rt(r,l.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Tt(i)}}}case"escaped":{const r=yield Oe(o,ae(X({},d),{altBoundary:!0})),i=Rt(r,l.floating);return{data:{escapedOffsets:i,escaped:Tt(i)}}}default:return{}}})}}};function ql(e,n){return ee(this,null,function*(){const{placement:o,platform:l,elements:a}=e,d=yield l.isRTL==null?void 0:l.isRTL(a.floating),s=Ce(o),r=De(o),i=ke(o)==="y",u=["left","top"].includes(s)?-1:1,c=d&&i?-1:1,p=Be(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*c,y:f*u}:{x:f*u,y:m*c}})}const Ql=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(o){return ee(this,null,function*(){var l,a;const{x:d,y:s,placement:r,middlewareData:i}=o,u=yield ql(o,e);return r===((l=i.offset)==null?void 0:l.placement)&&(a=i.arrow)!=null&&a.alignmentOffset?{}:{x:d+u.x,y:s+u.y,data:ae(X({},u),{placement:r})}})}}},Gl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(o){return ee(this,null,function*(){const{x:l,y:a,placement:d}=o,C=Be(e,o),{mainAxis:s=!0,crossAxis:r=!1,limiter:i={fn:B=>{let{x:S,y:E}=B;return{x:S,y:E}}}}=C,u=de(C,["mainAxis","crossAxis","limiter"]),c={x:l,y:a},p=yield Oe(o,u),f=ke(Ce(d)),m=fn(f);let h=c[m],g=c[f];if(s){const B=m==="y"?"top":"left",S=m==="y"?"bottom":"right",E=h+p[B],V=h-p[S];h=pt(E,h,V)}if(r){const B=f==="y"?"top":"left",S=f==="y"?"bottom":"right",E=g+p[B],V=g-p[S];g=pt(E,g,V)}const v=i.fn(ae(X({},o),{[m]:h,[f]:g}));return ae(X({},v),{data:{x:v.x-l,y:v.y-a,enabled:{[m]:s,[f]:r}}})})}}},Yl=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(o){return ee(this,null,function*(){var l,a;const{placement:d,rects:s,platform:r,elements:i}=o,I=Be(e,o),{apply:u=()=>{}}=I,c=de(I,["apply"]),p=yield Oe(o,c),f=Ce(d),m=De(d),h=ke(d)==="y",{width:g,height:v}=s.floating;let C,B;f==="top"||f==="bottom"?(C=f,B=m===((yield r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(B=f,C=m==="end"?"top":"bottom");const S=v-p.top-p.bottom,E=g-p.left-p.right,V=ye(v-p[C],S),M=ye(g-p[B],E),A=!o.middlewareData.shift;let $=V,b=M;if((l=o.middlewareData.shift)!=null&&l.enabled.x&&(b=E),(a=o.middlewareData.shift)!=null&&a.enabled.y&&($=S),A&&!m){const x=ie(p.left,0),T=ie(p.right,0),K=ie(p.top,0),z=ie(p.bottom,0);h?b=g-2*(x!==0||T!==0?x+T:ie(p.left,p.right)):$=v-2*(K!==0||z!==0?K+z:ie(p.top,p.bottom))}yield u(ae(X({},o),{availableWidth:b,availableHeight:$}));const k=yield r.getDimensions(i.floating);return g!==k.width||v!==k.height?{reset:{rects:!0}}:{}})}}};function tt(){return typeof window!="undefined"}function Se(e){return wt(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function ge(e){var n;return(n=(wt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function wt(e){return tt()?e instanceof Node||e instanceof re(e).Node:!1}function ue(e){return tt()?e instanceof Element||e instanceof re(e).Element:!1}function ve(e){return tt()?e instanceof HTMLElement||e instanceof re(e).HTMLElement:!1}function Ot(e){return!tt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}function Ke(e){const{overflow:n,overflowX:o,overflowY:l,display:a}=ce(e);return/auto|scroll|overlay|hidden|clip/.test(n+l+o)&&!["inline","contents"].includes(a)}function Xl(e){return["table","td","th"].includes(Se(e))}function nt(e){return[":popover-open",":modal"].some(n=>{try{return e.matches(n)}catch(o){return!1}})}function kt(e){const n=$t(),o=ue(e)?ce(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 Zl(e){let n=we(e);for(;ve(n)&&!Ne(n);){if(kt(n))return n;if(nt(n))return null;n=we(n)}return null}function $t(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ne(e){return["html","body","#document"].includes(Se(e))}function ce(e){return re(e).getComputedStyle(e)}function ot(e){return ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function we(e){if(Se(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Ot(e)&&e.host||ge(e);return Ot(n)?n.host:n}function hn(e){const n=we(e);return Ne(n)?e.ownerDocument?e.ownerDocument.body:e.body:ve(n)&&Ke(n)?n:hn(n)}function Fe(e,n,o){var l;n===void 0&&(n=[]),o===void 0&&(o=!0);const a=hn(e),d=a===((l=e.ownerDocument)==null?void 0:l.body),s=re(a);if(d){const r=mt(s);return n.concat(s,s.visualViewport||[],Ke(a)?a:[],r&&o?Fe(r):[])}return n.concat(a,Fe(a,[],o))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vn(e){const n=ce(e);let o=parseFloat(n.width)||0,l=parseFloat(n.height)||0;const a=ve(e),d=a?e.offsetWidth:o,s=a?e.offsetHeight:l,r=qe(o)!==d||qe(l)!==s;return r&&(o=d,l=s),{width:o,height:l,$:r}}function Bt(e){return ue(e)?e:e.contextElement}function Ee(e){const n=Bt(e);if(!ve(n))return he(1);const o=n.getBoundingClientRect(),{width:l,height:a,$:d}=vn(n);let s=(d?qe(o.width):o.width)/l,r=(d?qe(o.height):o.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!r||!Number.isFinite(r))&&(r=1),{x:s,y:r}}const Jl=he(0);function gn(e){const n=re(e);return!$t()||!n.visualViewport?Jl:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function ea(e,n,o){return n===void 0&&(n=!1),!o||n&&o!==re(e)?!1:n}function $e(e,n,o,l){n===void 0&&(n=!1),o===void 0&&(o=!1);const a=e.getBoundingClientRect(),d=Bt(e);let s=he(1);n&&(l?ue(l)&&(s=Ee(l)):s=Ee(e));const r=ea(d,o,l)?gn(d):he(0);let i=(a.left+r.x)/s.x,u=(a.top+r.y)/s.y,c=a.width/s.x,p=a.height/s.y;if(d){const f=re(d),m=l&&ue(l)?re(l):l;let h=f,g=mt(h);for(;g&&l&&m!==h;){const v=Ee(g),C=g.getBoundingClientRect(),B=ce(g),S=C.left+(g.clientLeft+parseFloat(B.paddingLeft))*v.x,E=C.top+(g.clientTop+parseFloat(B.paddingTop))*v.y;i*=v.x,u*=v.y,c*=v.x,p*=v.y,i+=S,u+=E,h=re(g),g=mt(h)}}return Ge({width:c,height:p,x:i,y:u})}function St(e,n){const o=ot(e).scrollLeft;return n?n.left+o:$e(ge(e)).left+o}function bn(e,n,o){o===void 0&&(o=!1);const l=e.getBoundingClientRect(),a=l.left+n.scrollLeft-(o?0:St(e,l)),d=l.top+n.scrollTop;return{x:a,y:d}}function ta(e){let{elements:n,rect:o,offsetParent:l,strategy:a}=e;const d=a==="fixed",s=ge(l),r=n?nt(n.floating):!1;if(l===s||r&&d)return o;let i={scrollLeft:0,scrollTop:0},u=he(1);const c=he(0),p=ve(l);if((p||!p&&!d)&&((Se(l)!=="body"||Ke(s))&&(i=ot(l)),ve(l))){const m=$e(l);u=Ee(l),c.x=m.x+l.clientLeft,c.y=m.y+l.clientTop}const f=s&&!p&&!d?bn(s,i,!0):he(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-i.scrollLeft*u.x+c.x+f.x,y:o.y*u.y-i.scrollTop*u.y+c.y+f.y}}function na(e){return Array.from(e.getClientRects())}function oa(e){const n=ge(e),o=ot(e),l=e.ownerDocument.body,a=ie(n.scrollWidth,n.clientWidth,l.scrollWidth,l.clientWidth),d=ie(n.scrollHeight,n.clientHeight,l.scrollHeight,l.clientHeight);let s=-o.scrollLeft+St(e);const r=-o.scrollTop;return ce(l).direction==="rtl"&&(s+=ie(n.clientWidth,l.clientWidth)-a),{width:a,height:d,x:s,y:r}}function la(e,n){const o=re(e),l=ge(e),a=o.visualViewport;let d=l.clientWidth,s=l.clientHeight,r=0,i=0;if(a){d=a.width,s=a.height;const u=$t();(!u||u&&n==="fixed")&&(r=a.offsetLeft,i=a.offsetTop)}return{width:d,height:s,x:r,y:i}}function aa(e,n){const o=$e(e,!0,n==="fixed"),l=o.top+e.clientTop,a=o.left+e.clientLeft,d=ve(e)?Ee(e):he(1),s=e.clientWidth*d.x,r=e.clientHeight*d.y,i=a*d.x,u=l*d.y;return{width:s,height:r,x:i,y:u}}function Ft(e,n,o){let l;if(n==="viewport")l=la(e,o);else if(n==="document")l=oa(ge(e));else if(ue(n))l=aa(n,o);else{const a=gn(e);l={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return Ge(l)}function yn(e,n){const o=we(e);return o===n||!ue(o)||Ne(o)?!1:ce(o).position==="fixed"||yn(o,n)}function sa(e,n){const o=n.get(e);if(o)return o;let l=Fe(e,[],!1).filter(r=>ue(r)&&Se(r)!=="body"),a=null;const d=ce(e).position==="fixed";let s=d?we(e):e;for(;ue(s)&&!Ne(s);){const r=ce(s),i=kt(s);!i&&r.position==="fixed"&&(a=null),(d?!i&&!a:!i&&r.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||Ke(s)&&!i&&yn(e,s))?l=l.filter(c=>c!==s):a=r,s=we(s)}return n.set(e,l),l}function ia(e){let{element:n,boundary:o,rootBoundary:l,strategy:a}=e;const s=[...o==="clippingAncestors"?nt(n)?[]:sa(n,this._c):[].concat(o),l],r=s[0],i=s.reduce((u,c)=>{const p=Ft(n,c,a);return u.top=ie(p.top,u.top),u.right=ye(p.right,u.right),u.bottom=ye(p.bottom,u.bottom),u.left=ie(p.left,u.left),u},Ft(n,r,a));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function ra(e){const{width:n,height:o}=vn(e);return{width:n,height:o}}function da(e,n,o){const l=ve(n),a=ge(n),d=o==="fixed",s=$e(e,!0,d,n);let r={scrollLeft:0,scrollTop:0};const i=he(0);if(l||!l&&!d)if((Se(n)!=="body"||Ke(a))&&(r=ot(n)),l){const f=$e(n,!0,d,n);i.x=f.x+n.clientLeft,i.y=f.y+n.clientTop}else a&&(i.x=St(a));const u=a&&!l&&!d?bn(a,r):he(0),c=s.left+r.scrollLeft-i.x-u.x,p=s.top+r.scrollTop-i.y-u.y;return{x:c,y:p,width:s.width,height:s.height}}function ut(e){return ce(e).position==="static"}function Pt(e,n){if(!ve(e)||ce(e).position==="fixed")return null;if(n)return n(e);let o=e.offsetParent;return ge(e)===o&&(o=o.ownerDocument.body),o}function Cn(e,n){const o=re(e);if(nt(e))return o;if(!ve(e)){let a=we(e);for(;a&&!Ne(a);){if(ue(a)&&!ut(a))return a;a=we(a)}return o}let l=Pt(e,n);for(;l&&Xl(l)&&ut(l);)l=Pt(l,n);return l&&Ne(l)&&ut(l)&&!kt(l)?o:l||Zl(e)||o}const ua=function(e){return ee(this,null,function*(){const n=this.getOffsetParent||Cn,o=this.getDimensions,l=yield o(e.floating);return{reference:da(e.reference,yield n(e.floating),e.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}})};function ca(e){return ce(e).direction==="rtl"}const pa={convertOffsetParentRelativeRectToViewportRelativeRect:ta,getDocumentElement:ge,getClippingRect:ia,getOffsetParent:Cn,getElementRects:ua,getClientRects:na,getDimensions:ra,getScale:Ee,isElement:ue,isRTL:ca};function fa(e,n){let o=null,l;const a=ge(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:u,top:c,width:p,height:f}=e.getBoundingClientRect();if(r||n(),!p||!f)return;const m=je(c),h=je(a.clientWidth-(u+p)),g=je(a.clientHeight-(c+f)),v=je(u),B={rootMargin:-m+"px "+-h+"px "+-g+"px "+-v+"px",threshold:ie(0,ye(1,i))||1};let S=!0;function E(V){const M=V[0].intersectionRatio;if(M!==i){if(!S)return s();M?s(!1,M):l=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{o=new IntersectionObserver(E,ae(X({},B),{root:a.ownerDocument}))}catch(V){o=new IntersectionObserver(E,B)}o.observe(e)}return s(!0),d}function It(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,u=Bt(e),c=a||d?[...u?Fe(u):[],...Fe(n)]:[];c.forEach(C=>{a&&C.addEventListener("scroll",o,{passive:!0}),d&&C.addEventListener("resize",o)});const p=u&&r?fa(u,o):null;let f=-1,m=null;s&&(m=new ResizeObserver(C=>{let[B]=C;B&&B.target===u&&m&&(m.unobserve(n),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=m)==null||S.observe(n)})),o()}),u&&!i&&m.observe(u),m.observe(n));let h,g=i?$e(e):null;i&&v();function v(){const C=$e(e);g&&(C.x!==g.x||C.y!==g.y||C.width!==g.width||C.height!==g.height)&&o(),g=C,h=requestAnimationFrame(v)}return o(),()=>{var C;c.forEach(B=>{a&&B.removeEventListener("scroll",o),d&&B.removeEventListener("resize",o)}),p==null||p(),(C=m)==null||C.disconnect(),m=null,i&&cancelAnimationFrame(h)}}const xt=Ql,ma=Gl,Vt=Ul,wn=Yl,ht=Wl,ha=jl,kn=(e,n,o)=>{const l=new Map,a=X({platform:pa},o),d=ae(X({},a.platform),{_c:l});return Hl(e,n,ae(X({},a),{platform:d}))};function va(e){return e!=null&&typeof e=="object"&&"$el"in e}function vt(e){if(va(e)){const n=e.$el;return wt(n)&&Se(n)==="#comment"?null:n}return e}function ga(e){return{name:"arrow",options:e,fn(n){const o=vt(t.unref(e.element));return o==null?{}:ha({element:o,padding:e.padding}).fn(n)}}}function $n(e){return typeof window=="undefined"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _t(e,n){const o=$n(e);return Math.round(n*o)/o}function Bn(e,n,o){o===void 0&&(o={});const l=o.whileElementsMounted,a=t.computed(()=>{var A;return(A=t.unref(o.open))!=null?A:!0}),d=t.computed(()=>t.unref(o.middleware)),s=t.computed(()=>{var A;return(A=t.unref(o.placement))!=null?A:"bottom"}),r=t.computed(()=>{var A;return(A=t.unref(o.strategy))!=null?A:"absolute"}),i=t.computed(()=>{var A;return(A=t.unref(o.transform))!=null?A:!0}),u=t.computed(()=>vt(e.value)),c=t.computed(()=>vt(n.value)),p=t.ref(0),f=t.ref(0),m=t.ref(r.value),h=t.ref(s.value),g=t.shallowRef({}),v=t.ref(!1),C=t.computed(()=>{const A={position:m.value,left:"0",top:"0"};if(!c.value)return A;const $=_t(c.value,p.value),b=_t(c.value,f.value);return i.value?X(ae(X({},A),{transform:"translate("+$+"px, "+b+"px)"}),$n(c.value)>=1.5&&{willChange:"transform"}):{position:m.value,left:$+"px",top:b+"px"}});let B;function S(){u.value==null||c.value==null||kn(u.value,c.value,{middleware:d.value,placement:s.value,strategy:r.value}).then(A=>{p.value=A.x,f.value=A.y,m.value=A.strategy,h.value=A.placement,g.value=A.middlewareData,v.value=!0})}function E(){typeof B=="function"&&(B(),B=void 0)}function V(){if(E(),l===void 0){S();return}if(u.value!=null&&c.value!=null){B=l(u.value,c.value,S);return}}function M(){a.value||(v.value=!1)}return t.watch([d,s,r],S,{flush:"sync"}),t.watch([u,c],V,{flush:"sync"}),t.watch(a,M,{flush:"sync"}),t.getCurrentScope()&&t.onScopeDispose(E),{x:t.shallowReadonly(p),y:t.shallowReadonly(f),strategy:t.shallowReadonly(m),placement:t.shallowReadonly(h),middlewareData:t.shallowReadonly(g),isPositioned:t.shallowReadonly(v),floatingStyles:C,update:S}}function ba(e,n=Te){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 zt=new Map;class Kt{constructor(n,o){me(this,"referenceElement");me(this,"tooltipElement");me(this,"textContent");me(this,"placement");me(this,"autoUpdateCleanup");me(this,"referenceElementHandlers");me(this,"tooltipElementHandlers");me(this,"escapeHandler");me(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=It(this.referenceElement,this.tooltipElement,()=>this.update())}generateTooltipId(n){var a;const o=n.trim(),l=(a=zt.get(o))!=null?a:0;return zt.set(o,l+1),ba(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(){kn(this.referenceElement,this.tooltipElement,{placement:this.placement,middleware:[xt(4),Vt(),ma(),ht()]}).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:an[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 Et={mounted(e,{value:n,arg:o}){n&&(typeof n=="string"&&n.trim()===""||(e.tooltip=new Kt(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 Kt(e,{textContent:String(n),placement:o}))},beforeUnmount(e){e.tooltip&&e.tooltip.remove()}},ya=t.defineComponent({name:"CdxInputChip",components:{CdxButton:fe,CdxIcon:G},directives:{tooltip:Et},props:{icon:{type:[String,Object],default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},className:{type:String,default:""}},emits:["remove-chip","click-chip","arrow-left","arrow-right"],setup(e,{emit: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),u=t.computed(()=>i.value&&r.value&&r.value.scrollWidth>r.value.clientWidth?Ae(o==null?void 0:o.default)[0]:null);t.onMounted(()=>{i.value=!0});function c(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:c,cdxIconClose:Xe,tabIndex:l,tooltipContent:u,textElement:r}},methods:{focus(){this.$refs.rootElement.focus()}}}),Ca=["tabindex","aria-description"],wa={ref:"textElement",class:"cdx-input-chip__tex