@abw/badger-react-ui
Version:
React UI Components
1 lines • 203 kB
JavaScript
var r0=Object.defineProperty;var o0=(u,a,b)=>a in u?r0(u,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[a]=b;var P=(u,a,b)=>(o0(u,typeof a!="symbol"?a+"":a,b),b);(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u["@abw/badger-react-ui"]={},u["react/jsx-runtime"],u.react,u.ReactDOM))})(this,function(u,a,b,At){var Ge,Ee,Pt,oe;"use strict";function qo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const A=qo(b),Gu=qo(At);var Zu=Object.defineProperty,Ju=(e,t,n)=>t in e?Zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,et=(e,t,n)=>Ju(e,typeof t!="symbol"?t+"":t,n);function Qu(e){return typeof e=="string"}function Ru(e){return Array.isArray(e)}function fr(e){return typeof e=="function"}function Xo(...e){throw new Error(e.join(""))}const Yo=(e,...t)=>fr(e)?e(...t):e;function eh(){return Intl.DateTimeFormat().resolvedOptions().locale}eh();function th(e={},t={},n={}){return Object.entries(t).reduce((s,[r,o])=>{const i=n[o];return i!==null&&typeof i<"u"&&(s[r]=i),s},{...e})}function nh(e,t=[]){return(Qu(t)?t.split(/,\s*|\s+/):t).reduce((n,s)=>{const r=e[s]||Xo(`Cannot expose non-existent action method: ${s}`);return fr(r)?n[s]=r.bind(e):Xo(`Cannot bind to non-function method: ${s}`),n},{})}function sh(e,t){const n=e.debug??t.debug,s=Yo(e.debugPrefix??t.debugPrefix,e),r=Yo(e.debugColor??t.debugColor,e);return n?s?(o,...i)=>console.log(`%c${s}%c${o}`,`color: ${r}`,"color:black",...i):console.log.bind(console):()=>{}}const rh=e=>Ru(e)?e:[e],Ae=(e,t={})=>{const n=t.defaultState||{},s=t.context||b.createContext(n);return{Context:s,Provider:r=>a.jsx(e,{...r,render:o=>a.jsx(s.Provider,{value:o,children:r.children})}),Consumer:r=>o=>a.jsx(s.Consumer,{children:i=>a.jsx(r,{...i,...o})}),Children:({children:r})=>rh(r).map((o,i)=>fr(o)?a.jsx(s.Consumer,{children:o},i):o),Use:()=>b.useContext(s)}};let Ne=class extends b.Component{constructor(t){super(t),et(this,"debug"),et(this,"actions");const n=this.constructor,s=n.debug,r=n.debugPrefix,o=n.debugColor;this.debug=sh(t,{debug:s,debugPrefix:r,debugColor:o}),this.state=th(n.initialState,n.initialProps,t),this.actions=this.initActions(n.actions)}initActions(t){return nh(this,t)}getContext(){return{...this.props,...this.state,...this.actions}}getRenderProps(){return this.getContext()}render(){return this.props.render(this.getRenderProps())}};et(Ne,"initialState",{}),et(Ne,"initialProps",{}),et(Ne,"actions",[]),et(Ne,"debug",!1),et(Ne,"debugPrefix"),et(Ne,"debugColor");const Rn=Ae(({render:e,open:t})=>{const[n,s]=b.useState(t),r=()=>s(l=>!l),o=()=>s(!0),i=()=>s(!1);return b.useEffect(()=>{s(t)},[t]),e({isOpen:n,open:o,close:i,toggleOpen:r})}),oh=Rn.Use,ih="svg",Go="-",Zo="fill",ah="path",lh="line",ch="rect",gr="array",dh="circle",uh="ellipse",hh="polygon",fh="polyline",pr=/-(?!\d)/,Jo="currentColor",br=512,vr=512,es={defaults:{width:512,height:512,type:"line"},icons:{alpha:"M102,448L256,64L410,448 M152,333L360,333",angle:"M448,336L256,144L64,336",angles:"M448,448L256,256L64,448M448,256L256,64L64,256",arrow:"M96,224L256,64L416,224M256,86L256,448",arrows:"M160,128L256,32L352,128M352,384L256,480L160,384M256,48L256,464",arrowhead:"M176,112L256,32L336,112M256,48L256,192",asterisk:"M76,152L436,360M76,360L436,152M256,48L256,464",at:"M256,160C309,160 352,203 352,256C352,309 309,352 256,352C203,352 160,309 160,256C160,203 203,160 256,160M256,480C132,480 32,380 32,256C32,132 132,32 256,32C380,32 480,132 480,256L480,288C480,323 451,352 416,352C381,352 352,323 352,288L352,176",ban:"M100,412L412,100 M256,32C380,32 480,132 480,255C480,379 380,480 256,480C132,480 32,379 32,255C32,132 132,32 256,32Z",bars:"M64,96L448,96M64,256L448,256M64,416L448,416",card:"rect:32 96 448 320 32 32",caret:"M448,336L256,144L64,336L448,336Z",check:"M48,248L192,392L464,120",circle:"circle:256 256 224",clipboard:"M192,80L80,80L80,496L432,496L432,80L320,80L320,112L192,112L192,80ZM256,16C282,16 304,38 304,64C304,90 282,112 256,112C230,112 208,90 208,64C208,38 230,16 256,16Z",clone:"M304,416L304,444C304,468 284,488 260,488L68,488C44,488 24,468 24,444L24,252C24,228 44,208 68,208L96,208M480,75L480,277C480,301 461,320 437,320L235,320C211,320 192,301 192,277L192,75C192,51 211,32 235,32L437,32C461,32 480,51 480,75Z",cloud:"M480,293C480,234 437,177 362,196C346,161 319,116 240,120C180,124 139,165 125,224C121,223 116,223 111,223C68,223 32,260 32,307C32,354 68,392 111,392C120,392 366,392 380,392C462,392 480,335 480,293Z",cog:"M306,21L206,21L187,91L147,114L78,95L28,182L78,233L78,279L28,330L78,417L147,398L187,421L206,491L306,491L325,421L365,398L434,417L484,330L434,279L434,233L484,182L434,95L365,114L325,91L306,21Z M256,176C300,176 336,212 336,256C336,300 300,336 256,336C212,336 176,300 176,256C176,212 212,176 256,176Z",columns:["rect:32 32 448 448 45 45","line:180,32 180,480","line:332,32 332,480"],comment:"M256,64C371,64 464,139 464,232C464,325 371,400 256,400C236,400 217,398 199,394C184,390 163,448 80,464C111,426 118,358 110,352C72,321 48,279 48,232C48,139 141,64 256,64Z",crop:"M32,80L288,80 M80,32L80,288M432,480L432,224M480,432L224,432M80,428L432,80",cross:"M112,112L400,400M400,112L112,400",crosshairs:["circle:256 256 192","M256,16L256,112 M496,256L400,256 M16,256L112,256 M256,496L256,400"],diamond:"M256,32L480,256L256,480L32,256L256,32",download:"M256,64L256,320L352,224M256,320L160,224M384,320L425,320C438,320 448,330 448,342L448,426C448,438 438,448 425,448L86,448C74,448 64,438 64,426L64,342C64,330 74,320 86,320L128,320",drag:"M96,128L256,32L416,128M96,384L256,480L416,384M144,256L368,256",envelope:["rect:32 96 448 320 32 32","M32,144C32,144 158.906,243.712 221.676,293.031C241.821,308.86 270.179,308.86 290.324,293.031C353.094,243.712 480,144 480,144"],equals:"M96,320L416,320 M96,192L416,192",exclamation:"M256,96L256,310M254,416L258,416",eye:["M21,256C131,42 381,43 493,256 M21,256C130,470 383,469 493,256","circle:256 256 80"],eyeshut:"M21,256C131,42 381,43 493,256M21,256C130,320 383,320 493,256M21,256C130,470 383,469 493,256",filter:"M64,32L448,32L448,128L320,256L320,432L192,480L192,256L64,128L64,32Z",folder:"M480,128L480,448L32,448L32,64L176,64L240,128L480,128Z",globe:["circle:256 256 224","ellipse:256 256 116 224","M32,255.997L480,256.115M53.867,160L458.413,160M53.867,352.587L458.413,352M256.14,32L256.14,480"],heart:"M256,128C298,48 382,48 424,88C466,128 466,208 424,288C394,348 319,408 256,448C193,408 118,348 88,288C46,208 46,128 88,88C130,48 214,48 256,128Z",hourglass:"M80,32L432,32M80,480L432,480M128,32C128,256 384,256 384,480M384,32C384,256 128,256 128,480",image:["rect:32 80 448 366 32","M32,304L128,240L384,432M272,345L367,281L480,366","circle:288 192 16"],info:"M212,202L256,202L256,416M182,416L330,416M252,96L256,96",key:["M189,246C183,229 180,212 180,194C180,118 242,56 318,56C394,56 456,118 456,194C456,270 394,332 318,332C300,332 283,329 266,323L232,360L184,360L184,408L136,408L136,456L56,456L56,379L189,246Z","circle:344 168 8"],list:"M176,96L448,96M176,256L448,256M176,416L448,416M64,96L80,96M64,256L80,256M64,416L80,416",locked:["M144,224L144,166C144,105 195,54 256,54C317,54 368,105 368,166L368,224M256,320L256,368","rect:80 224 352 240 32 32"],login:"M192,128L320,256L192,384M304,256L64,256M320,64L448,64L448,448L320,448",logout:"M320,128L448,256L320,384M432,256L192,256M192,448L64,448L64,64L192,64",minus:"M96,256L416,256",mobile:["rect:128 48 256 416 32 32","M128,120L384,120M128,392L384,392"],move:"M192,96L256,32L320,96M416,192L480,256L416,320M320,416L256,480L192,416M96,192L32,256L96,320M48,256L464,256M256,48L256,464",number:"M256,448L256,64L176,128 M160,448L336,449",page:"M416,170L416,480L96,480L96,32L288,32L416,170M288,32L288,176L416,176",pen:"M482,143C491,134 491,120 482,112L401,30C392,21 378,21 369,30L72,326L22,489L186,439L482,143M305,93L418,206",phone:"M51,59C40,62 32,72 32,84C41,321 192,472 428,480C440,480 451,471 453,459C459,435 469,395 475,371C478,360 472,348 462,343C438,331 395,309 370,297C360,292 347,295 339,304C325,323 303,352 304,352C255,352 160,257 160,208C160,207 188,186 207,172C217,165 220,152 215,141C202,117 181,74 169,50C164,39 152,34 141,37C116,43 75,53 51,59Z",plus:"M256,96L256,416M96,256L416,256",point:"M448,224L256,16L64,224L160,224L160,480L352,480L352,224L448,224Z",prime:"M256,128L256,256",question:"M160,160C160,126 197,80 255,80C314,80 336,128 336,160C336,236 255,235 255,320 M255,416L256,416",rotate:"M392,120C356,84 307,64 256,64C150,64 64,150 64,256C64,362 150,448 256,448C303,448 349,430 384,399C349,430 303,448 256,448C150,448 64,362 64,256C64,150 150,64 256,64C307,64 356,84 392,120Z M352,208L480,208L480,80",search:"M204,32C300,32 384,111 384,208C384,305 305,384 208,384C111,384 32,305 32,208C32,111 107,32 204,32M480,480L332,332",slash:"M64,448L448,64",square:"rect:32 32 448 448",square10:"rect:32 32 448 448 45 45",square20:"rect:32 32 448 448 90 90",square30:"rect:32 32 448 448 135 135",square40:"rect:32 32 448 448 180 180",star:"M256,32L324,183L489,202L367,313L400,476L256,394L112,476L145,313L23,202L188,183L256,32Z",thumb:"M149,174L32,174L32,448L149,448L149,184 M149,217C277,160 246,36 282,38C372,44 324,192 324,192L440,192C462,192 480,210 480,232C480,254 462,272 440,272L368,272M424,272C446,272 464,290 464,312C464,334 446,352 424,352L352,352M392,352C414,352 432,370 432,392C432,414 414,432 392,432L256,432C220,432 149,409 149,409",time:"M256,128L256,256L336,336",trash:"M32,80L480,80 M80,80C80,80 100,344 109,452C111,477 131,496 156,496C211,496 301,496 356,496C381,496 401,477 403,452C412,344 432,80 432,80 M160,80L208,16L304,16L352,74",triangle:"M256,64L32,448L480,448L256,64Z",unlocked:["M144,224L144,166C144,105 195,54 256,54C304,54 346,85 361,128M256,320L256,368","rect:80 224 352 240 32 32"],upload:"M256,320L256,64L160,160M256,64L352,160M384,320L425,320C438,320 448,330 448,342L448,426C448,438 438,448 425,448L86,448C74,448 64,438 64,426L64,342C64,330 74,320 86,320L128,320",user:["M448,400C448,349 410,308 364,308L149,308C102,308 64,349 64,400C64,424 64,480 64,480L448,480C448,480 448,423 448,400Z","circle:256,144,96"],vertical:"line:256,48 256,464",wrench:"M486,108C493,124 496,142 496,160C496,239 431,304 352,304C330,304 309,299 290,290L98,482C79,501 49,501 30,482C11,463 11,433 30,414L222,222C213,203 208,182 208,160C208,81 273,16 352,16C370,16 388,19 404,26L336,96L352,160L416,176L486,108Z"}};function Qo(e,t,n=es){n.icons[e]=t}function gh(e,t=es){Object.entries(e).forEach(([n,s])=>Qo(n,s,t))}function Ro(e){return Array.isArray(e)}function ph(e){return typeof e=="function"}function ei(e){return typeof e=="object"&&!Ro(e)&&!bh(e)}function bh(e){return e===null}function vh(){return Intl.DateTimeFormat().resolvedOptions().locale}vh();const mh=()=>{const e=b.createContext({});return{Context:e,Provider:({children:t,...n})=>a.jsx(e.Provider,{value:n,children:t}),Themed:(t,n=t.displayName||t.name)=>b.forwardRef((s,r)=>a.jsx(e.Consumer,{children:o=>{let i=t;const l=o[n];let c;if(!l)return a.jsx(t,{ref:r,...s});if(Ro(l)?(i=l[0],c=l[1]):c=l,ph(c)){const d=c(s,r,o);if(b.isValidElement(d))return d;if(ei(d))return a.jsx(i,{ref:r,...d})}return ei(c)?a.jsx(i,{ref:r,...c,...s}):a.jsx(i,{ref:r,...s})}}))}},Ch=mh(),yh=Ch.Themed;function ge(e){return typeof e=="string"}function pn(e){return Array.isArray(e)}function Vt(e){return typeof e=="object"&&!pn(e)&&!ni(e)}function ti(e){return typeof e>"u"}function ni(e){return e===null}function ts(e){return!(ti(e)||ni(e))}function Sh(e){return!ts(e)}function Ve(...e){throw new Error(e.join(""))}function wh(){return Intl.DateTimeFormat().resolvedOptions().locale}wh();function mr(e,t=/,\s*|\s+/){return Sh(e)?[]:ge(e)?e.length?e.split(t):[]:pn(e)?e:[e]}function bn(e){return e.split(/\s*[;&]\s*/).filter(t=>t.length>0).reduce((t,n)=>{const[s,r]=n.split(/\s*[:=]\s*/);return t[s]=ti(r)?!0:r,t},{})}const Cr=e=>e.filter(ts).join(" "),Mh=e=>Object.entries(e).filter(([,t])=>t).map(([t])=>t),Lh=(...e)=>Cr(e.flatMap(t=>Vt(t)?Mh(t):t)),Nh=4.42,Be=e=>`${Nh*e}%`,Dh={},yr={outline:{fill:"none",stroke:"currentColor",strokeWidth:Be(2),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"1.5"},solid:{fill:"currentColor",stroke:"none"},round:{strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"1.5"},square:{strokeLinecap:"square",strokeLinejoin:"miter",strokeMiterlimit:"1.5"},butt:{strokeLinecap:"butt"},bevel:{strokeLinejoin:"bevel"},thinnest:{strokeWidth:Be(.5)},thinner:{strokeWidth:Be(1)},thin:{strokeWidth:Be(1.5)},medium:{strokeWidth:Be(2)},thick:{strokeWidth:Be(2.5)},thicker:{strokeWidth:Be(3)},thickest:{strokeWidth:Be(3.5)},line:{}};yr.line=yr.outline;const xh={...Object.entries(yr).reduce((e,[t,n])=>(e[t]=s=>Object.assign(s,n),e),{}),fill:(e,t)=>e.fill=t===!0?Jo:t,stroke:(e,t)=>e.stroke=t===!0?Jo:t,nofill:e=>delete e.fill,nostroke:e=>delete e.stroke,strokewidth:(e,t)=>e.strokeWidth=t.match(/^[\d.]+$/)?Be(parseFloat(t)):t,opacity:(e,t)=>e.opacity=t,fillopacity:(e,t)=>e.fillOpacity=t,strokeopacity:(e,t)=>e.strokeOpacity=t,dasharray:(e,t)=>e.strokeDasharray=t,drawlength:(e,t)=>e["--draw-length"]=t,drawtime:(e,t)=>e["--draw-time"]=t,filltime:(e,t)=>e["--fill-time"]=t},tt=e=>ge(e)?parseFloat(e):e,$h=e=>ge(e)?parseInt(e):e,si={x:0,y:0,size:16,scaleX:1,scaleY:1,flipX:!1,flipY:!1,rotate:0},nt={flip:(e,t)=>{ge(t)&&t.match(/^y$/i)?e.flipY=!e.flipY:e.flipX=!e.flipX},flipx:e=>e.flipX=!e.flipX,flipy:e=>e.flipY=!e.flipY,grow:(e,t)=>e.size+=tt(t),shrink:(e,t)=>e.size-=tt(t),scalex:(e,t)=>e.scaleX*=tt(t),scaley:(e,t)=>e.scaleY*=tt(t),left:(e,t)=>t===!0?e.rotate-=90:e.x-=tt(t),right:(e,t)=>t===!0?e.rotate+=90:e.x+=tt(t),up:(e,t)=>t===!0?e.rotate+=0:e.y-=tt(t),down:(e,t)=>t===!0?e.rotate+=180:e.y+=tt(t),rotate:(e,t)=>e.rotate+=$h(t)};nt.flop=nt.flipy,nt["flip-x"]=nt.flipx,nt["flip-y"]=nt.flipy;function ri(e,t={...si}){const n=ge(e)?bn(e):e||{};return Object.entries(n).reduce((s,[r,o])=>{const i=r.toLowerCase();return(nt[i]||Ve(`Invalid transform: ${i}`))(s,o),s},t)}function ns(e,t){return(ge(t)?t.split(pr):t).forEach(n=>{const[s,r=!0]=n.split(/[:=]/),o=s.toLowerCase(),i=xh[o];if(i){i(e.style||(e.style={...Dh}),r);return}(nt[o]||Ve(`Invalid style or transform: ${o}`))(e.transform||(e.transform={...si}),r)})}function Th(e){const t=e.match(/^(.*?):(.*)/);return t?{path:t[2],type:t[1]}:{path:e}}function ss(e,t){const n=pn(t)?[...t]:mr(t);return mr(e).reduce((s,r)=>{if(n.length){const o=n.shift();s[o]=r}return s},{})}const oi={svg:e=>({element:ih,svg:e}),array:e=>({element:gr,items:e}),path:e=>({element:ah,d:e}),polygon:e=>({element:hh,points:e}),polyline:e=>({element:fh,points:e}),circle:e=>({element:dh,...ss(e,"cx cy r")}),ellipse:e=>({element:uh,...ss(e,"cx cy rx ry")}),line:e=>({element:lh,...ss(e,"x1 y1 x2 y2")}),rect:e=>({element:ch,...ss(e,"x y width height rx ry")})},Oh={width:br,height:vr,type:Zo},ii=e=>{const[t,n=""]=e.split("?"),[s,...r]=t.split(/\.(?!\d)/),o=s.split(pr).filter(l=>l.length),i=bn(n);return{dashes:o,classes:r,style:i}},kh=(e,t)=>{for(let n=e.length;n>0;n--){const s=e.slice(0,n).join(Go);if(t[s])return[s,e.slice(n),t[s]]}return null},ai=(e,t,n={})=>{const{icons:s,defaults:r}=t,{dashes:o,classes:i,style:l}=ii(e),[c,d,h]=kh(o,s)||Ve(`No icon found matching any leading subset of ${o.join(Go)}`),f={...Oh,...r,...n,name:c};if(Eh(f,h),(i.length||n.className)&&(f.className=Cr([...i||[],n.className||null])),f.transform&&(f.transform=ri(f.transform)),f.style?(f.style=ge(f.style)?bn(f.style):{...f.style},l&&Object.assign(f.style,l)):l&&(f.style=l),f.type){const p=f.style&&{...f.style};ns(f,f.type),delete f.type,p&&Object.assign(f.style,p)}return d.length&&ns(f,d),Object.keys(l).length&&(f.style=Object.assign(f.style||{},l)),f},Eh=(e,t)=>{if(Vt(t)&&t.body){const{body:n,...s}=t;e.body=Sr(n),Object.assign(e,s)}else e.body=Sr(t),Vt(t)&&t.type&&(e.type=t.type);return e},Sr=e=>{if(ge(e))return Ih(e);if(Vt(e))return Ph(e);if(pn(e))return Fh(e);Ve(`Cannot parse icon data: ${e}`)};function Ih(e){if(e.match(/^\s*</))return{element:"svg",svg:e.replace(/^\s*/,"")};const t=e.match(/^(.*?):(.*)/);if(t){const[,n,s]=t,{dashes:r,classes:o}=ii(n),i=r.shift(),l=(oi[i]||Ve(`Invalid icon data element: ${i}`))(s);return o.length&&(l.className=Cr(o)),r.length&&ns(l,r),l}return{element:"path",d:e}}function Ph(e){const t={...e};if(t.element)return t;for(const[n,s]of Object.entries(oi)){const r=t[n];if(ts(r))return s(r)}Ve(`Cannot parse icon data: ${JSON.stringify(e)}`)}function Fh(e){return{element:gr,items:e.flatMap(t=>{const n=Sr(t);return n.element===gr?n.items:n})}}const li=e=>mr(e,/\s+/),Ah=({size:e,...t})=>{t.width??(t.width=e||br),t.height??(t.height=e||vr),t.path&&Object.assign(t,Th(t.path));let n;return t.style&&(ge(t.style)?(n=bn(t.style),t.style={}):n={...t.style}),ns(t,t.type?t.type.split(pr).filter(s=>s.length):Zo),delete t.type,t.style&&n&&Object.assign(t.style,n),t.transform&&(t.transform=ri(t.transform)),t},wr=e=>Vt(e)?Object.entries(e).reduce((t,[n,s])=>(t[n.replace(/(?!-)-./g,r=>r[1].toUpperCase())]=s,t),{}):e,Vh=e=>ts(e)?wr(bn(e)):null,je=({style:e,className:t,...n})=>({style:ge(e)?Vh(e):wr(e),className:t,...n}),Bh=e=>a.jsx("circle",{...je(e)}),jh=e=>a.jsx("ellipse",{...je(e)}),Wh=e=>a.jsx("line",{...je(e)}),ci=e=>a.jsx("path",{...je(e)}),Hh=e=>a.jsx("polygon",{...je(e)}),Uh=e=>a.jsx("polyline",{...je(e)}),zh=e=>a.jsx("rect",{...je(e)}),Kh=e=>{const{svg:t,...n}=e;return a.jsx("g",{dangerouslySetInnerHTML:{__html:t},...je(n)})},_h=e=>{const{items:t,...n}=e;return a.jsx("g",{...je(n),children:t.map((s,r)=>a.jsx(rs,{body:s},r))})},qh={array:_h,circle:Bh,ellipse:jh,line:Wh,path:ci,polygon:Hh,polyline:Uh,rect:zh,svg:Kh},rs=e=>{const{path:t,body:n}=e;if(t)return a.jsx(ci,{d:t,...e});if(ge(n))return a.jsx("g",{dangerouslySetInnerHTML:{__html:n}});if(Vt(n)){const{element:s,...r}=n,o=qh[s]||Ve(`Invalid element type: ${s} => `,JSON.stringify(n));return a.jsx(o,{...r})}if(pn(n))return n.map((s,r)=>a.jsx(rs,{body:s},r));Ve(`Don't know how to handle body: ${n}`)};function Xh({width:e,height:t,transform:n,children:s}){const r=e/2,o=t/2,i=n.x*e/16,l=n.y*t/16,c=n.size/16*(n.flipX?-1:1)*n.scaleX,d=n.size/16*(n.flipY?-1:1)*n.scaleY,h=n.rotate;return a.jsx("g",{transform:`translate(${r} ${o})`,children:a.jsx("g",{transform:`translate(${i}, ${l}) scale(${c}, ${d}) rotate(${h} 0 0)`,children:a.jsx("g",{transform:`translate(-${r} -${o})`,children:s})})})}const Mr=({onClick:e,minx:t=0,miny:n=0,width:s=br,height:r=vr,style:o,transform:i,className:l="",...c})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true",focusable:"false",viewBox:`${t} ${n} ${s} ${r}`,className:`${l} icon`,style:wr(o),onClick:e,children:i?a.jsx(Xh,{width:s,height:r,transform:i,children:a.jsx(rs,{...c})}):a.jsx(rs,{...c})}),Yh=({name:e,iconsClass:t="icons",library:n=es,...s})=>{if(!e)return a.jsx(Mr,{...Ah(s)});try{const r=li(e);return r.length===1?a.jsx(Mr,{...s,...ai(e,n,s)}):a.jsx("div",{className:Lh(t,s.className),children:r.map(o=>a.jsx(Mr,{...s,...ai(o,n,s)},o))})}catch(r){const o=ge(r)?r:r.message;Ve(`Badger Icon failed to render icon "${e}". ${o}`)}},di=yh(Yh,"Icon"),Gh=({names:e,className:t})=>a.jsx("div",{className:`grid overlap ${t}`,children:li(e).map(n=>a.jsx(di,{name:n},n))});function St(e){return typeof e=="boolean"}function ye(e){return typeof e=="string"}function Bt(e){return typeof e=="number"}function vn(e){return Number.isInteger(e)}function De(e){return Array.isArray(e)}function wt(e){return typeof e=="function"}function Zh(e){return e instanceof RegExp}function ae(e){return typeof e=="object"&&!De(e)&&!Lr(e)}function ui(e){return ye(e)||Bt(e)||St(e)}function hi(e){return typeof e>"u"}function Lr(e){return e===null}function E(e){return!(hi(e)||Lr(e))}function os(e){return!E(e)}function is(...e){throw new Error(e.join(""))}const J=(e,...t)=>wt(e)?e(...t):e;function F(...e){}const Mt=e=>e,fi=e=>{const t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)},as=(...e)=>e.reduce((t,n)=>{const s=fi(t),r=fi(n);return s>r?s:r},-1/0),st=(...e)=>e.reduce((t,n)=>{const s=as(t,n);return t*s*(n*s)/(s*s)},1),ls=(...e)=>e.reduce((t,n)=>{const s=as(t,n);return t*s/(n*s)}),gi=(...e)=>{const t=as(...e);return e.reduce((n,s)=>n+t*s,0)/t},Jh=(...e)=>{const t=as(...e),[n,...s]=e;return s.reduce((r,o)=>r-t*o,n*t)/t},q=(e,t,n)=>Math.min(Math.max(e,t),n);function Qh(){return Intl.DateTimeFormat().resolvedOptions().locale}let pi={locale:Qh(),currency:"GBP",currencySign:"£",thousands:","};const bi=(e,t,n=1)=>{const s=t<e?-Math.abs(n):n;return Array(1+Math.floor(Math.abs((t-e)/n))).fill(e).map((r,o)=>r+o*s)};function jt(e,t={}){return new Intl.NumberFormat(t.locale,t).format(e)}function Rh(e,t={}){return jt(e,{style:"currency",currency:pi.currency,...t})}function ef(e,t=pi.thousands){if(os(e))return"";const n=e.toString().split("."),s=/(\d+)(\d{3})/;for(;s.test(n[0]);)n[0]=n[0].replace(s,`$1${t}$2`);return n.join(".")}function Wt(e,t=/,\s*|\s+/){return os(e)?[]:ye(e)?e.length?e.split(t):[]:De(e)?e:[e]}function Lt(e,t=!0,n={}){return ae(e)?e:Wt(e).reduce((s,r)=>(s[r]=wt(t)?t(r):t,s),n)}function Nr(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function tf(e,t={}){const n=t[e];if(E(n))return n;let s;return e.match(/(ss?|sh|ch|x)$/)?e+"es":(s=e.match(/(.*?[^aeiou])y$/))?s[1]+"ies":e.match(/([^s\d\W])$/)?e+"s":e}function nf(e,t,n,s="no"){return(e?ef(e):s)+" "+(e===1?t:n||tf(t))}const sf=Nr;function rf(e){if(wt(e))return e;if(Zh(e))return t=>e.test(t);if(ae(e))return t=>!!e[t];if(De(e)||ye(e)){const t=Lt(e);return n=>!!t[n]}else is("Invalid selector() specification: "+e)}const mn=(e,t,n={})=>{let s={};const r={delete:!1,...n},o=rf(t);return Object.keys(e).map(i=>{if(o(i)){let l=e[i];r.delete&&delete e[i],r.key&&(i=r.key(i)),r.value&&(l=r.value(l)),s={...s,[i]:l}}}),s},Dr=(e,t)=>wt(t)?t(e):e[t],vi=(e,t)=>{const n=Dr(e,t);return vn(n)?n:ye(n)&&parseInt(n)||0},mi=(e,t)=>{const n=Dr(e,t);return Bt(n)?n:ye(n)&&parseFloat(n)||0},Ci=(e,t)=>(Dr(e,t)||"").toString(),yi=e=>(t,n)=>vi(t,e)-vi(n,e),xr=e=>(t,n)=>mi(t,e)-mi(n,e),$r=e=>(t,n)=>{const s=Ci(t,e).toLowerCase(),r=Ci(n,e).toLowerCase();return s>r?1:r>s?-1:0},of=e=>(t,n)=>e(n,t);function af(e,t=300){let n;return(...s)=>{clearTimeout(n),n=setTimeout(()=>e(...s),t)}}function Tr(e){return new Promise(t=>setTimeout(t,e))}const Si=e=>e.filter(E).join(" "),wi=e=>Object.entries(e).filter(([,t])=>t).map(([t])=>t),$=(...e)=>Si(e.flatMap(t=>ae(t)?wi(t):t)),cs=e=>{if(!e)return null;const[t,n,s,r,o]=e.split("-");return $(t,$i(n),Ti(s),Oi(r),ki(o))},Or=({className:e,size:t,color:n,...s})=>({...s,className:$(e,t,cs(n))}),Mi=({className:e,size:t,color:n,border:s,radius:r,shadow:o,grid:i,stack:l,gap:c,pad:d,mar:h,padding:f=d,margin:p=h,...g},...m)=>({...g,className:$(...m,e,t,cs(n),We(s),Ue(r),He(o),Li(i),us(c),Ni(l),Di(f),xi(p))}),ds=(...e)=>{const{className:t,...n}=Mi(...e);return $(t,n)},We=e=>fs(e,"border",t=>`border bdw-${t}`),He=e=>fs(e,"shadow-1",t=>`shadow-${t}`),Li=e=>hs(e,"grid-1",t=>`grid-${t}`),Ni=e=>e?`stack-${e}`:null,Di=e=>kr(e,"pad"),xi=e=>kr(e,"mar"),Ue=e=>fs(e,"bdr-1",t=>`bdr-${t}`),$i=e=>Cn(e,t=>`fgc-${t}`),Ti=e=>Cn(e,t=>`bgc-${t}`),Oi=e=>Cn(e,t=>`fgd-${t}`),ki=e=>Cn(e,t=>`bgd-${t}`),us=e=>hs(e,"gap-1",t=>{const n=Wt(t);return n.length===2?gs("gap",["v","h"],n):`gap-${t}`}),Cn=(e,t)=>vn(parseInt(e))?J(t,e):null,hs=(e,t,n)=>e===!0?t:E(e)?J(n,e):null,fs=(e,t,n)=>e===!0?t:vn(parseInt(e))?J(n,e):null,kr=(e,t)=>hs(e,t,n=>Ei(t,Wt(n))),Ei=(e,t)=>t.length===2?gs(e,["v","h"],t):t.length===4?gs(e,["t","r","b","l"],t):t.map(n=>`${e}-${n}`).join(" "),gs=(e,t,n)=>n.map((s,r)=>`${e}-${t[r]}-${s}`).join(" ");function lf(e){return typeof e=="string"}function Ii(e){return Array.isArray(e)}function cf(e){return typeof e=="function"}function Pi(e){return typeof e=="object"&&!Ii(e)&&!df(e)}function df(e){return e===null}function uf(...e){throw new Error(e.join(""))}function hf(){return Intl.DateTimeFormat().resolvedOptions().locale}hf();const ff=()=>{const e=b.createContext({});return{Context:e,Provider:({children:t,...n})=>a.jsx(e.Provider,{value:n,children:t}),Themed:(t,n=t.displayName||t.name)=>b.forwardRef((s,r)=>a.jsx(e.Consumer,{children:o=>{let i=t;const l=o[n];let c;if(!l)return a.jsx(t,{ref:r,...s});if(Ii(l)?(i=l[0],c=l[1]):c=l,cf(c)){const d=c(s,r,o);if(b.isValidElement(d))return d;if(Pi(d))return a.jsx(i,{ref:r,...d})}return Pi(c)?a.jsx(i,{ref:r,...c,...s}):a.jsx(i,{ref:r,...s})}}))}},Fi=ff(),D=Fi.Themed,gf=(e={})=>t=>Object.entries(e).reduce((n,[s,r])=>{const o=n[s];if(!o||!(lf(o)||o===!0))return n;const i={...o===!0?r:r[o]||uf(`Invalid variants value for ${s}: ${o}`),...n};return delete i[s],i},t),U=D(e=>a.jsx(di,{...Or(e)}),"Icon");function Ai(e,t,n={}){return E(t)&&(n[e]=vn(t)?`${t}deg`:t),Object.keys(n).length?n:null}const Vi=(e,t,n={})=>({...Object.entries(e).reduce((s,[r,o])=>{const i=t[r];return E(i)&&(s[o]=i),s},t.style||{}),...n}),ps=(e,{side:t=""}={})=>{const n=`icon${t}`,s=e[n],r=ae(s)?s:{name:s},o=$(r.className,e[`${n}Class`],t?`on-${t.toLowerCase()}`:null);o.length&&(r.className=o);const i=e[`${n}Rotate`];return E(i)&&(r.style=Ai("--icon-rotate",i,r.style)),r},Er=e=>ye(e)?{name:e}:e,ze=D(({icon:e,iconLeft:t,iconRight:n,spanText:s,spanClass:r,text:o,children:i,...l})=>a.jsxs(a.Fragment,{children:[!!e&&a.jsx(U,{...ps({icon:e,...l}),fixedWidth:!0}),!!t&&a.jsx(U,{...ps({iconLeft:t,...l},{side:"Left"}),fixedWidth:!0}),s?a.jsx("span",{className:r??"",children:o||i}):o||i,!!n&&a.jsx(U,{...ps({iconRight:n,...l},{side:"Right"}),fixedWidth:!0})]}),"WithIcons"),Bi=({summary:e,summaryClass:t,toggleOpen:n,detailsSummaryClass:s="summary",summarySpanClass:r="summary-text",...o})=>a.jsx("div",{onClick:n,className:$(s,t),children:a.jsx(ze,{text:e,spanText:!0,spanClass:r,...mn(o,/^(icon|text)/)})}),Ir=({content:e,children:t,contentClass:n})=>a.jsx("div",{className:n,children:e||t}),pf=({className:e,size:t,color:n,lined:s,border:r,radius:o,shaded:i,shadow:l,isOpen:c,toggleOpen:d,detailsClass:h="details",noIconClass:f="no-icon",wideSummary:p,wideSummaryClass:g="wide-summary",Summary:m=Bi,Content:v=Ir,...C})=>a.jsxs("div",{className:$(h,f,e,n,We(r),Ue(o),He(l),{size:t,color:n,lined:s,shaded:i,open:c,[g]:p}),children:[a.jsx(m,{toggleOpen:d,...C}),!!c&&a.jsx(v,{...C})]}),ji=Rn.Consumer(pf),bf=({summary:e,summaryClass:t})=>a.jsx("summary",{className:t,children:e}),vf=({className:e,size:t,color:n,lined:s,border:r,radius:o,shaded:i,shadow:l,open:c,Summary:d=bf,Content:h=Ir,...f})=>a.jsxs("details",{className:$(e,n,We(r),Ue(o),He(l),{size:t,color:n,lined:s,shaded:i}),open:c,children:[a.jsx(d,{...f}),a.jsx(h,{...f})]}),mf={iconLeft:"angle-right",iconLeftRotate:90,iconRightRotate:-90},Wi=D(({native:e,open:t,Container:n=e?vf:ji,...s})=>a.jsx(Rn.Provider,{open:t,children:a.jsx(n,{...mf,...s})}),"Details"),Cf=D(({items:e,shadow:t,radius:n,className:s,accordionClass:r="accordion",...o})=>a.jsx("div",{className:$(s,r,He(t),Ue(n)),children:e.map((i,l)=>a.jsx(Wi,{radius:n,...o,...i},i.key??i.id??l))}),"Accordion"),yf=D(e=>a.jsx(Gh,{...Or(e)}),"Icons"),Hi=D(({dismissable:e,dismiss:t,revealable:n,isRevealed:s,openIcon:r="angle-down",closedIcon:o="angle-left",dismissIcon:i="cross"})=>a.jsxs("div",{className:"on-right",children:[!!e&&a.jsx(U,{name:i,fixedWidth:!0,className:"dismiss",onClick:()=>t(!0)}),!!n&&a.jsx(U,{name:s?r:o,fixedWidth:!0,className:"reveal"})]}),"AlertControls"),Sf=D(({headline:e,headIcon:t,headicon:n=t,toggle:s,revealable:r=!1,controlProps:o,Controls:i=Hi})=>a.jsxs("div",{className:"headline flex space",onClick:r?s:null,children:[a.jsxs("div",{children:[!!n&&a.jsx(U,{name:n,fixedWidth:!0,className:"on-left"}),e]}),a.jsx(i,{...o})]}),"AlertHeadline"),Ui=D(({title:e,text:t,children:n})=>a.jsxs(a.Fragment,{children:[e&&a.jsx("h3",{children:e}),t?a.jsx("p",{children:t}):n]}),"AlertContent"),wf=D(({icon:e,Content:t=Ui,...n})=>a.jsxs("div",{className:"side-icon",children:[a.jsx(U,{name:e}),a.jsx("div",{className:"wide",children:a.jsx(t,{...n})})]}),"AlertIcon");function Mf(e){return e.split(/\s*[;&]\s*/).filter(t=>t.length>0).reduce((t,n)=>{const[s,r]=n.split(/\s*[:=]\s*/);return t[s]=hi(r)?!0:r,t},{})}const zi="unknown",Ki="mobile",_i="tablet",qi="laptop",Xi="desktop",Yi="widescreen",Gi="ultra",yn={[zi]:0,[Ki]:480,[_i]:720,[qi]:960,[Xi]:1200,[Yi]:1440},Lf={breakpoints:yn,largest:Gi},bs=(e=0,t={})=>{const n={...Lf,...t},s=Object.entries(n.breakpoints).find(([,r])=>e<=r);return s?s[0]:n.largest},Zi=(e=window)=>typeof e>"u"?!1:e.innerWidth,Nf=(e,t)=>bs(Zi(e),t),Ht=e=>ui(e)||!e.separator&&!e.heading&&!e.disabled,Pr=e=>ui(e)?e:e.value??e.id,Fr=(e,t,n=Pr)=>{if(os(t))return[];const s=n(t),r=e.findIndex(o=>s===n(o));return r>=0?[e[r],r]:[]},Ji=(e,t)=>{const n=e.toLowerCase().split(/\s+/);return t.filter(s=>{const r=ae(s),o=r?s.search??s.text??s.label??s.name??s.value:s;if(r&&s.fixed)return!0;if(E(o)){const i=o.toString().toLowerCase();return n.every(l=>i.indexOf(l)>=0)}return!1})};function Qi(e,t=Ht){const n=e.findIndex(t);return n<0?null:n}function Ri(e,t=Ht){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return null}function ea(e,t,n=Ht){for(let s=1;s<=e.length;s++){const r=(t+s)%e.length;if(n(e[r]))return r}return null}function ta(e,t,n=Ht){for(let s=1;s<=e.length;s++){const r=(t+e.length-s)%e.length;if(n(e[r]))return r}return null}const na=e=>e==null?void 0:e.stopPropagation(),sa={...yn,cols:!0},ra=e=>{const t={...e};return[mn(t,sa,{delete:!0}),t]},oa=(e,t)=>{const[n,s]=ra(e);return[ia(n,t),s]},ia=(e,t)=>{if(!t)return`grid-${e.cols||1}`;let n=e.cols||1;const s=Object.keys(yn),r=s.indexOf(t);if(r>=0){const i=s.slice(r).find(l=>e[l]);i&&(n=e[i])}return`grid-${n}`},rt=e=>Bt(e)?e:parseFloat(e),vs=(e,t,n)=>Wt(e).find(s=>t[s]!==n[s]),ms=e=>t=>{e.forEach(n=>{wt(n)?n(t):n!=null&&(n.current=t)})},ot=e=>{const t=`HINT: define ${e}() to render this value`;return n=>ye(n)||Bt(n)?n:ae(n)?n.text??n.label??n.name??n.heading??t:t},aa=e=>ye(e)||Bt(e)?e:a.jsx(ze,{...e}),Ar=(e,t)=>{if(!e||!t)return;const n=t.offsetTop,s=n+t.offsetHeight,r=e.scrollTop,o=r+e.offsetHeight;n<r?e.scrollTo({top:n}):s>o&&e.scrollTo({top:r+(s-o)})},la=e=>{const t=e.match(/^(\d+)px$/);if(t)return parseInt(t[1]);const n=e.match(/^(\d+)rem$/);if(n)return parseInt(n[1]*16);const s=e.match(/^(\d+)$/);return s?parseInt(s[1]):yn[e]||is(`Invalid size specified: ${e}`)};function ca(){let e={};return{clear:()=>e={},getItem:t=>e[t],setItem:(t,n)=>e[t]=n,removeItem:t=>delete e[t]}}const Sn=typeof window<"u"&&window.localStorage||ca(),wn=(e,t)=>[e,t].join("-");function Cs(e){return{get:(t,n)=>{const s=Sn.getItem(wn(e,t));return E(s)?JSON.parse(s):E(n)?(Sn.setItem(wn(e,t),JSON.stringify(n)),n):null},set:(t,n)=>Sn.setItem(wn(e,t),JSON.stringify(n)),delete:t=>Sn.removeItem(wn(e,t))}}const Vr=e=>e.charAt(0).toUpperCase()+e.slice(1),Df=(e={},t={})=>Object.entries(t).reduce((n,[s,r])=>{const o=n[s];if(!o)return n;const l={...r[o]||is(`Invalid themedProps() value for ${s}: ${o}`),...n};return delete l[s],l},e),xf=(e,t,n={})=>{const s=e.variant||Object.keys(t).find(r=>e[r])||"default";return t[s]||t.default||n},Ke=({title:e,headline:t,headicon:n,headIcon:s=n,type:r,size:o,color:i,compact:l,stripe:c,border:d,radius:h,shadow:f,className:p,text:g,children:m,onDismiss:v,icon:C,dismissable:y=!1,revealable:w=!1,revealed:S=!1,openIcon:M,closedIcon:L,dismissIcon:T,Headline:N=Sf,Controls:x=Hi,Content:I=Ui,Icon:k=wf})=>{const[O,j]=b.useState(w?S:!0),[V,H]=b.useState(!1),ve=$("alert",r,o,i,p,{compact:l,revealable:w,dismissable:y,stripe:c},O?"revealed":null,He(f),We(d),Ue(h)),Q=()=>j(ne=>!ne),_={dismissable:y,revealable:w,isRevealed:O,dismiss:()=>{H(!0),v&&v()},openIcon:M,closedIcon:L,dismissIcon:T},R={title:e,text:g,children:m},ie={...R,icon:C,Content:I},ln={headline:t,headIcon:s,toggle:Q,revealable:w,controlProps:_,Controls:x};return V?null:a.jsxs("div",{className:ve,children:[!!t&&a.jsx(N,{...ln}),O&&(C?a.jsx(k,{...ie}):a.jsx(I,{...R}))]})},da=D(e=>a.jsx(Ke,{...e,type:"info"}),"Info"),ua=D(e=>a.jsx(Ke,{...e,type:"success"}),"Success"),ha=D(e=>a.jsx(Ke,{...e,type:"warning"}),"Warning"),fa=D(e=>a.jsx(Ke,{...e,type:"error"}),"Error");Ke.Info=da,Ke.Success=ua,Ke.Warning=ha,Ke.Error=fa;const $f=D(Ke,"Alert"),Tf=({prefix:e,prefixClass:t="prefix"})=>a.jsx("div",{className:t,children:e}),Of=({suffix:e,suffixClass:t="suffix"})=>a.jsx("div",{className:t,children:e}),kf=D(({size:e,color:t,compact:n,className:s,tag:r,shadow:o,border:i,radius:l,tooltip:c,icon:d,iconClass:h,iconLeft:f,iconLeftClass:p,iconRight:g,iconRightClass:m,label:v,text:C,prefix:y,suffix:w,children:S,Prefix:M=Tf,Suffix:L=Of,Content:T=ze,...N})=>{const x=$("badge",e,t,s,{compact:n,tag:r,icon:d},He(o),We(i),Ue(l)),I={icon:d,iconClass:h,iconLeft:f,iconLeftClass:p,iconRight:g,iconRightClass:m,text:C,children:S};return a.jsxs("div",{className:x,"data-tooltip":c,"aria-label":v,...N,children:[!!y&&a.jsx(M,{prefix:y,...N}),a.jsx(T,{...I}),!!w&&a.jsx(L,{suffix:w,...N})]})},"Badge"),le=D(({type:e="button",size:t,color:n,className:s,disabled:r,bright:o,dark:i,outline:l,bare:c,shaded:d,shadow:h,border:f,radius:p,label:g,tooltip:m,tabIndex:v=0,icon:C,iconClass:y,iconLeft:w,iconLeftClass:S,iconRight:M,iconRightClass:L,text:T,children:N,Content:x=ze,...I})=>{const k=$(t,n,s,{bright:o,dark:i,outline:l,bare:c,shaded:d,icon:C},He(h),We(f),Ue(p)),O={icon:C,iconClass:y,iconLeft:w,iconLeftClass:S,iconRight:M,iconRightClass:L,text:T,children:N};return a.jsx("button",{className:k,"aria-label":g,tabIndex:v,type:e,disabled:r,"aria-disabled":r,"data-tooltip":m,...I,children:a.jsx(x,{...O})})},"Button"),ys=D(({buttons:e,children:t,className:n="buttons",buttonClass:s,Button:r=le,...o})=>a.jsx("div",{className:n,children:e?e.map((i,l)=>a.jsx(r,{className:s,...o,...i},l)):t}),"Buttons"),Ef=D(({className:e,disabled:t,children:n,ref:s})=>a.jsx("label",{className:$(e,{disabled:t}),ref:s,children:n}),"CheckboxLabel"),If=D(({disabled:e=!1,tabIndex:t=0,onChange:n=F,inputClass:s,round:r,square:o,ref:i,switch:l,...c})=>a.jsx("input",{type:"checkbox",ref:i,"aria-disabled":e,tabIndex:e?-1:t,onChange:d=>n(d.target.checked),className:$(s,{round:r,square:o}),role:l?"switch":null,...c}),"CheckboxInput"),Br=D(({size:e,color:t,border:n,inline:s,className:r="checkbox",text:o,ref:i,inputRef:l,checked:c,checkedText:d=o,uncheckedText:h=o,Label:f=Ef,Input:p=If,...g})=>a.jsxs(f,{className:$(e,t,r,We(n),{inline:s}),ref:i,checked:c,...g,children:[a.jsx(p,{ref:l,checked:c,...g}),c?d:h]}),"Checkbox"),ga=({checked:e=!1}={})=>{const[t,n]=b.useState(e);return{isChecked:t,setChecked:n,check:()=>n(!0),uncheck:()=>n(!1)}},Pf=({checked:e=!1,onChange:t,...n})=>{const{isChecked:s,setChecked:r}=ga({checked:e}),o=i=>{r(i),t&&t(i)};return a.jsx(Br,{checked:s,onChange:o,...n})},Ss=({visible:e=!1}={})=>{const[t,n]=b.useState(e);return{isVisible:t,setVisible:n,show:()=>n(!0),hide:()=>n(!1)}},pa=D(({close:e,icon:t="cross",className:n="close"})=>a.jsx("div",{className:n,onClick:e,children:a.jsx(U,{name:t})}),"ModalClose"),ba=D(({title:e,header:t})=>e||t?a.jsxs("header",{children:[!!e&&a.jsx("h3",{children:e}),t]}):null,"ModalHeader"),va=D(({footer:e})=>!!e&&a.jsx("footer",{children:e}),"ModalFooter"),ma=D(({text:e,children:t,Header:n=ba,Footer:s=va,...r})=>a.jsxs("article",{onClick:na,children:[a.jsx(n,{...r}),e||t,a.jsx(s,{...r})]}),"ModalContent"),jr=D(({ref:e,open:t,close:n,className:s,closeClass:r="close",closeIcon:o="cross",Close:i=pa,Content:l=ma,closeOnClick:c,onClick:d=c?n:null,onCancel:h=n||F,style:f={},maxWidth:p,maxHeight:g,...m})=>{e||(e=b.useRef(null)),b.useEffect(()=>{const{current:C}=e;t?C.showModal():C.close()},[t]);const v={...f};return p&&(v["--max-width"]=p),g&&(v["--max-height"]=g),a.jsxs("dialog",{ref:e,className:s,style:v,onClick:d,onCancel:h,children:[!!n&&a.jsx(i,{close:n,icon:o,className:r}),a.jsx(l,{...m})]})},"Modal"),Ff=({isVisible:e,title:t,header:n,prompt:s,modalClass:r,...o})=>a.jsx(jr,{...o,open:e,title:t,header:n,className:r,text:s??a.jsx(Ca,{...o}),footer:!!s&&a.jsx(Ca,{...o})}),Ca=({buttonClass:e,cancel:t,confirm:n})=>a.jsxs("div",{className:"flex space gap-4",children:[a.jsx(le,{className:e,...t}),a.jsx(le,{className:e,...n})]}),Af=D(({initiallyRevealed:e=!1,open:t=e,confirmIcon:n="check",confirmText:s="Confirm",confirmColor:r="red",confirmClass:o,cancelIcon:i="cross",cancelText:l="Cancel",cancelColor:c="grey",cancelClass:d,confirm:h={iconRight:n,text:s,color:r,className:o},cancel:f={iconLeft:i,text:l,color:c,className:d},buttonsClass:p,className:g=p,buttonClass:m,modal:v,modalClass:C,onClick:y=()=>window.alert("No confirm action defined"),...w})=>{const{isVisible:S,hide:M,show:L}=Ss({visible:t}),N={iconRight:n,text:s,color:r,className:o,...h,onClick:I=>{I.preventDefault(),M(),y()}},x={iconLeft:i,text:l,color:c,className:d,outline:!0,...f,onClick:M};return v?a.jsxs(a.Fragment,{children:[a.jsx(ys,{className:g,buttonClass:m,buttons:[{...w,onClick:L}]}),a.jsx(Ff,{isVisible:S,confirm:N,cancel:x,modalClass:C,...w})]}):a.jsx(ys,{className:g,buttonClass:m,buttons:S?[x,N]:[{...w,onClick:L}]})},"Confirm"),Vf=e=>{const t=e,n="text",s=Nr(t);return{field:t,type:n,label:s}},ws=e=>{ye(e)&&(e={field:e});const{field:t}=e;return e.type||(e.type="text"),e.label||(e.label=Nr(t)),e.heading||(e.heading=e.label),e.id||(e.id=t),e.sortable??(e.sortable=!0),e.filterable??(e.filterable=!0),e},ya=e=>{if(ye(e))return Lt(e,ws);if(De(e))return e.reduce((t,n)=>{const s=ws(n);return t[s.field]=s,t},{});if(ae(e))return Object.entries(e).reduce((t,[n,s])=>{if(St(s)&&!s)return t;const r=ws({...ae(s)?s:{},field:n});return t[r.field]=r,t},{});is("Invalid columns definition")},Sa=(e,t)=>{if(t){const n=t.filter(s=>e[s]);if(n.length)return n}return Object.keys(e).filter(n=>!e[n].hidden)},wa=(e,t)=>{if(t){const n=t.filter(r=>e[r]),s=Lt(n);if(n.push(...Object.keys(e).filter(r=>!s[r])),n.length)return n}return Object.keys(e)},Ma=(e,t,n)=>t&&e[t]?[t,n]:[null,null],La=({value:e,search:t})=>E(e)?e.toString()===t.toString():!1,Nt=({value:e,search:t})=>{const n=t.toLowerCase().split(/\s+/);if(E(e)){const s=e.toString().toLowerCase();return n.every(r=>s.indexOf(r)>-1)}else return!1},Na=({value:e,search:t})=>E(e)?parseInt(e)===parseInt(t):!1,Da=({value:e,search:t})=>E(e)?parseFloat(e)===parseFloat(t):!1,Ms=e=>ye(e)?!!parseInt(e):!!e,xa=({value:e=!1,search:t})=>Ms(e)===Ms(t),Wr={string:Nt,text:Nt,id:Nt,number:Nt,price:Nt,pounds:Nt,select:La,boolean:xa,integer:Na,float:Da},$a=(e,t,n)=>{const s=Object.keys(n).filter(r=>t[r]);return s.length===0?e:e.filter(r=>s.every(o=>{const i=n[o],l=t[o],c=l.field||o,d=r[c],h=l.filterType||l.type,f=l.filter||Wr[h]||Wr.text;return E(i)&&(St(i)||i.length)?f({row:r,field:c,value:d,search:i}):!0}))},Ta=(e,t=1,n=e.length)=>{const s=e.length,r=Math.ceil(s/n);t=Math.min(t,r);const o=t-1,i=n*o,l=Math.min(i+n-1,s-1),c=e.slice(i,l+1);return{pageSize:n,pages:r,page:o,pageNo:t,total:s,firstIndex:i,lastIndex:l,firstPage:1,lastPage:r,thisSize:c.length,from:i+1,to:l+1,all:i===l,one:s===1,none:s===0,rows:c}},Hr={string:$r,text:$r,select:$r,number:xr,price:xr,currency:xr,integer:yi,id:yi},Oa=(e,t,n,s)=>{if(!n||!t[n])return e;const r=t[n],o=r.sort,i=r.type||"text",l=wt(o)?o:(Hr[i]||Hr.text)(n);return e.sort(s?of(l):l)},K=Ae(({render:e,rows:t=[],storageKey:n,storageItem:s="state",debug:r,...o})=>{const i=r?console.log:F,[l,c]=b.useMemo(()=>{const k=n&&Cs(n),O=k?k.get(s,{}):{};return[k,O]},[n]),[d,h,f,p,g]=b.useMemo(()=>{i("computing columns: ",o.columns);const k=ya(o.columns);return[k,Sa(k,c.visibleColumns),wa(k,c.columnOrder),...Ma(k,c.sortColumn??o.sortColumn,c.sortReverse??o.sortReverse)]},[o.columns,o.sortColumn,o.sortReverse,c]),[m,v]=Wu({pageNo:c.pageNo??o.pageNo??1,pageSize:c.pageSize??o.pageSize??10,sortColumn:p,sortReverse:g,columnOrder:f,visibleColumns:h}),[C,y]=b.useState(!1),[w,S]=b.useState({}),M=k=>{k.preventDefault(),k.stopPropagation(),y(O=>!O)},L=(k,O)=>{S(j=>{const V={...j};return E(O)&&(St(O)||O.length)?V[k]=O:delete V[k],V}),v.setPageNo(1)};b.useEffect(()=>{i("columns have changed: ",d),v.setSortColumn(p),v.setSortReverse(g),v.setColumnOrder(f),v.setVisibleColumns(h)},[p,g,f,h]),b.useEffect(()=>{i("rows, filters or sorting order has changed"),v.setPageNo(1)},[t,m.sortColumn,m.sortReverse,m.filters]),b.useEffect(()=>{l&&(i("Saving state in local storage:",m),l.set(s,m))},[m,l]);const T=k=>{m.sortColumn===k?(i(`Sort column already set to ${k}, changing direction`),v.setSortReverse(O=>!O)):(i(`Setting sort column to ${k}`),v.setSortColumn(k),v.setSortReverse(!1))},N=k=>v.setVisibleColumns(O=>{const j=Lt(O),V=j[k]?O.filter(H=>H!==k):Object.keys(d).filter(H=>H===k||j[H]);return i("New visible columns:",V),V}),x=k=>{let O=[],j=[];const V=Lt(m.visibleColumns);k.forEach(H=>{O.push(H),V[H]&&j.push(H)}),i("New order of all columns:",O),i("New order of visible columns:",j),v.setVisibleColumns(j),v.setColumnOrder(O)},I=b.useMemo(()=>Ta(Oa($a(t,d,w),d,m.sortColumn,m.sortReverse),m.pageNo,m.pageSize),[t,d,w,m.sortColumn,m.sortReverse,m.pageNo,m.pageSize]);return e({...o,rows:t,columns:d,page:I,showFilters:C,toggleFilters:M,filters:w,setFilter:L,hasFilters:Object.keys(w).length,toggleSortColumn:T,toggleVisibleColumn:N,changeColumnOrder:x,...m,...v})}),Bf=K.Use,jf=K.Consumer,Wf=({page:e,summaryClass:t="flex center balance mar-b-2"})=>a.jsxs("div",{className:t,children:["Page ",e.pageNo,"/",e.lastPage," ",e.none?"no rows":e.one?"one row":e.all?`all ${jt(e.total)} rows`:`rows ${jt(e.from)}-${jt(e.to)} of ${jt(e.total)}`," "]}),ka=K.Consumer(Wf),Hf="-",Dt="",xt="any",Ea="ArrowLeft",Ia="ArrowRight",Mn="ArrowUp",Ln="ArrowDown",Pa="Tab",Nn="Enter",Ls=" ",Dn="Escape",Fa="Backspace",Ur="True",zr="False",Uf=512,zf=512;let Aa=(Ge=class extends Ne{componentDidMount(){this.mounted=!0,this.props.onLoad(this)}componentWillUnmount(){this.mounted=!1,this.props.onUnload(this)}onMouseEnter(){this.debug("onMouseEnter()"),this.setState({hasHover:!0},this.props.openOnHover?()=>{this.open(),this.focusTrigger()}:null)}onMouseLeave(){this.debug("onMouseLeave()"),this.setState({hasHover:!1},this.props.openOnHover?()=>this.closeSoon():null)}onFocus(){this.debug("onFocus()"),this.setState({hasFocus:!0},this.props.onFocus)}onBlur(){this.debug("onBlur()"),this.setState({hasFocus:!1},this.props.onBlur),this.props.closeOnBlur&&this.closeSoon()}onClick(){this.debug("onClick()"),this.state.isOpen?this.close():this.open()}open(){this.debug("open()"),this.setState({isOpen:!0},this.props.onOpen)}close(){this.debug("close()"),this.setState(this.closeState(),this.props.onClose)}closeState(){return this.constructor.inactiveState}closeSoon(t=!1){this.debug(`closeSoon() force:${t}`),Tr(this.props.closeDelay).then(()=>{this.closeable(t)?this.close():this.debug(`NOT closing force:${t} hasHover:${this.state.hasHover}`)})}closeable(t){return t||!this.state.hasHover}onKeyDown(t){switch(this.debug(`onKeyDown(${t.key})`),t.key){case Nn:case Ls:this.state.isOpen?this.close():this.open();break;case Dn:this.close();break;default:this.debug(`ignored key ${t.key}`);return}t.preventDefault()}triggerRef(t){this._triggerRef=t}focusTrigger(){this._triggerRef?(this.debug("focussing trigger"),this._triggerRef.focus()):this.debug("no trigger to focus")}},P(Ge,"debug",!1),P(Ge,"defaultProps",{options:[],openOnHover:!1,closeOnBlur:!0,closeDelay:300,onLoad:F,onUnload:F,onFocus:F,onBlur:F,onClick:F,onOpen:F,onClose:F}),P(Ge,"inactiveState",{isOpen:!1}),P(Ge,"initialState",{...Ge.inactiveState}),Ge);const It=class It extends Aa{open(t=this.initialCursor()??this.cursorFirstIndex()){this.debug(`open(${t})`),this.setState({isOpen:!0,cursor:t},this.props.onOpen)}onKeyDown(t){switch(this.debug(`onKeyDown(${t.key})`),this.debug("alt: ",t.altKey),this.debug("ctrl: ",t.ctrlKey),this.debug("meta: ",t.metaKey),t.key){case Ln:this.state.isOpen?this.setCursor(this.cursorNextIndex()):this.open(this.initialCursor()??this.cursorFirstIndex());break;case Mn:this.state.isOpen?this.setCursor(this.cursorPrevIndex()):this.open(this.initialCursor()??this.cursorLastIndex());break;case Nn:case Ls:this.state.isOpen?this.selectCursor():this.open(this.initialCursor()??this.cursorFirstIndex());break;case Dn:this.close();break;default:this.debug(`ignored key ${t.key}`);return}t.preventDefault()}menuOptions(){return this.props.options}initialCursor(){return null}cursorFirstIndex(){return Qi(this.menuOptions(),this.props.validOption)}cursorLastIndex(){return Ri(this.menuOptions(),this.props.validOption)}cursorNextIndex(){return ea(this.menuOptions(),this.state.cursor,this.props.validOption)}cursorPrevIndex(){return ta(this.menuOptions(),this.state.cursor,this.props.validOption)}setCursor(t){this.debug(`setCursor(${t})`),this.setState({cursor:t})}selectCursor(){this.debug("selectCursor()");const{cursor:t}=this.state,n=this.menuOptions();if(n&&n.length&&E(t)){const s=n[t];this.debug(`selectCursor() ${t} =>`,s),this.selectOption(s)}else this.debug("Not selecting: cursor out of range")}selectOption(t){this.debug("selectOption()",t),this.setState(this.selectState(t),()=>this.props.onSelect(t)),this.props.closeOnSelect?(this.debug("closeOnSelect is set, closing"),this.closeSoon(!0)):this.debug("closeOnSelect is not set, NOT closing")}selectState(t){return{selected:t}}menuRef(t){this._menuRef=t}activeRef(t){Ar(this._menuRef,t)}};P(It,"debug",!1),P(It,"defaultProps",{options:[],openOnHover:!1,closeOnBlur:!0,closeDelay:300,onLoad:F,onUnload:F,onFocus:F,onBlur:F,onClick:F,onOpen:F,onClose:F,onSelect:F,closeOnSelect:!0}),P(It,"inactiveState",{isOpen:!1,cursor:void 0,selected:void 0}),P(It,"initialState",{...It.inactiveState});let Ns=It,Kf=(Ee=class extends Ns{},P(Ee,"debug",!1),P(Ee,"debugPrefix","Dropdown > "),P(Ee,"debugColor","MediumVioletRed"),P(Ee,"defaultProps",{...Ee.defaultProps,options:[],displayOption:aa}),P(Ee,"actions",["onMouseEnter","onMouseLeave","onFocus","onBlur","onClick","onKeyDown","open","close","setCursor","selectCursor","selectOption","triggerRef","menuRef","activeRef"]),Ee);const $t=Ae(Kf),_f=$t.Use,qf=({triggerClass:e="trigger",triggerRef:t,triggerColor:n,triggerSize:s,button:r,icon:o,floatingRef:i,safeAreaClass:l="safe-area",onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,onClick:g,...m})=>a.jsxs("div",{className:$(e,n,s,{button:r,icon:o}),onClick:g,onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,tabIndex:0,ref:ms([t,i]),children:[a.jsx(ze,{icon:o,...mn(m,/^(icon|text)/)}),a.jsx("div",{className:l})]}),Va=$t.Consumer(qf),Xf=({option:e,active:t,activeRef:n,selected:s,onClick:r,onMouseEnter:o,optionClass:i="item no-hover",activeClass:l="active",selectedClass:c="selected",disabledClass:d="disabled",displayOption:h})=>a.jsx("div",{className:$(i,e.className,e.indent?`indent-${e.indent}`:null,t?l:null,s?c:null,e.disabled?d:null),onMouseEnter:o,onClick:r,ref:t?n:null,"aria-disabled":e.disabled,children:h(e)}),Ba=$t.Consumer(Xf),ja=({option:e,separatorClass:t="separator"})=>a.jsx("div",{className:$(t,e.className)}),Wa=({option:e,optionClass:t="item no-hover",headingClass:n="heading"})=>a.jsx("h4",{className:$(n,t,e.className),children:e.heading}),Yf=({options:e=[],menuClass:t="menu border bdr-1",menuRef:n,floatingRef:s,floatingStyle:r,cursor:o,selected:i,selectOption:l,setCursor:c,onMouseEnter:d,onMouseLeave:h,Option:f=Ba,Separator:p=ja,Heading:g=Wa})=>a.jsx("div",{className:t,ref:ms([n,s]),onMouseEnter:d,onMouseLeave:h,style:r,children:e.map((m,v)=>m.separator?a.jsx(p,{option:m},v):m.heading?a.jsx(g,{option:m},v):a.jsx(f,{option:m,active:E(o)&&e[o]===m,selected:i===m,onClick:()=>l(m),onMouseEnter:()=>c(v)},m.id??m.value??v))}),Ha=$t.Consumer(Yf);function Ds(){return typeof window<"u"}function Ut(e){return Ua(e)?(e.nodeName||"").toLowerCase():"#document"}function ce(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _e(e){var t;return(t=(Ua(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ua(e){return Ds()?e instanceof Node||e instanceof ce(e).Node:!1}function te(e){return Ds()?e instanceof Element||e instanceof ce(e).Element:!1}function xe(e){return Ds()?e instanceof HTMLElement||e instanceof ce(e).HTMLElement:!1}function za(e){return!Ds()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ce(e).ShadowRoot}function xn(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Se(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function Gf(e){return["table","td","th"].includes(Ut(e))}function xs(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Kr(e){const t=_r(),n=te(e)?Se(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function Zf(e){let t=it(e);for(;xe(t)&&!zt(t);){if(Kr(t))return t;if(xs(t))return null;t=it(t)}return null}function _r(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function zt(e){return["html","body","#document"].includes(Ut(e))}function Se(e){return ce(e).getComputedStyle(e)}function $s(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function it(e){if(Ut(e)==="html")return e;const t=e.assignedSlot||e.parentNode||za(e)&&e.host||_e(e);return za(t)?t.host:t}function Ka(e){const t=it(e);return zt(t)?e.ownerDocument?e.ownerDocument.body:e.body:xe(t)&&xn(t)?t:Ka(t)}function qr(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ka(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=ce(r);if(o){const l=Xr(i);return t.concat(i,i.visualViewport||[],xn(r)?r:[],l&&n?qr(l):[])}return t.concat(r,qr(r,[],n))}function Xr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ts=Math.min,we=Math.max,Os=Math.round,$e=e=>({x:e,y:e});function Yr(e,t){return typeof e=="function"?e(t)