semaphor 0.0.71 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dashboard-plus-PiXfKT85.js → dashboard-plus--r2Tb_gT.js} +2 -2
- package/dist/chunks/{dashboard-plus-QLGG6FW5.js → dashboard-plus-xkBOLeNV.js} +2 -2
- package/dist/chunks/{index-sYvkC1Tf.js → index-_csobcn7.js} +1 -1
- package/dist/chunks/{index-bprcLVP2.js → index-hTb91YWh.js} +3 -3
- package/dist/chunks/{lucide-react-Dp9nsqo2.js → lucide-react-J8RovW8Z.js} +1 -1
- package/dist/chunks/{lucide-react-RbLnbtSu.js → lucide-react-oWoMIQn8.js} +3 -3
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
|
@@ -404,7 +404,7 @@ Check the top-level render call using <`+fe+">.")}return oe}}function oi(D,oe){{
|
|
|
404
404
|
*/var ble=typeof document<"u"?N.useLayoutEffect:N.useEffect;function yle(e){var t=N.useReducer(function(){return{}},{})[1],n=um({},e,{onChange:function(s,a){a?dr.flushSync(t):t(),e.onChange==null||e.onChange(s,a)}}),r=N.useState(function(){return new mle(n)}),o=r[0];return o.setOptions(n),N.useEffect(function(){return o._didMount()},[]),ble(function(){return o._willUpdate()}),o}function xle(e){return yle(um({observeElementRect:fle,observeElementOffset:hle,scrollToFn:gle},e))}var wle=Object.defineProperty,_le=(e,t,n)=>t in e?wle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dy=(e,t,n)=>(_le(e,typeof t!="symbol"?t+"":t,n),n);let Sle=class{constructor(){dy(this,"current",this.detect()),dy(this,"handoffState","pending"),dy(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},hl=new Sle,Bn=(e,t)=>{hl.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Ri(e){let t=m.useRef(e);return Bn(()=>{t.current=e},[e]),t}function vS(e,t){let[n,r]=m.useState(e),o=Ri(e);return Bn(()=>r(o.current),[o,r,...t]),n}let Rt=function(e){let t=Ri(e);return m.useCallback((...n)=>t.current(...n),[t])};function Cle(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,s=m.useRef(i),a=m.useRef(!1),l=m.useRef(!1);return i&&!s.current&&!a.current?(a.current=!0,s.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&s.current&&!l.current&&(l.current=!0,s.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:r,Rt(c=>(i||o(c),t==null?void 0:t(c)))]}function Ele(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Sl(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Ele(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Sl();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function ph(){let[e]=m.useState(Sl);return m.useEffect(()=>()=>e.dispose(),[e]),e}function Rle(){let e=typeof document>"u";return"useSyncExternalStore"in N?(t=>t.useSyncExternalStore)(N)(()=>()=>{},()=>!1,()=>!e):!1}function bS(){let e=Rle(),[t,n]=N.useState(hl.isHandoffComplete);return t&&hl.isHandoffComplete===!1&&n(!1),N.useEffect(()=>{t!==!0&&n(!0)},[t]),N.useEffect(()=>hl.handoff(),[]),e?!1:t}var o2;let gh=(o2=m.useId)!=null?o2:function(){let e=bS(),[t,n]=m.useState(e?()=>hl.nextId():null);return Bn(()=>{t===null&&n(hl.nextId())},[t]),t!=null?""+t:void 0};function Zn(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Zn),r}function yS(e){return hl.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let i2=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ple=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Ple||{}),Ole=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Ole||{}),$le=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($le||{}),ON=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ON||{});function Tle(e,t=0){var n;return e===((n=yS(e))==null?void 0:n.body)?!1:Zn(t,{0(){return e.matches(i2)},1(){let r=e;for(;r!==null;){if(r.matches(i2))return!0;r=r.parentElement}return!1}})}var Dle=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Dle||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Ale(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let s=o.compareDocumentPosition(i);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function kle(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Mle(){return/Android/gi.test(window.navigator.userAgent)}function $N(){return kle()||Mle()}function Jp(e,t,n){let r=Ri(t);m.useEffect(()=>{function o(i){r.current(i)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function Ile(e,t,n){let r=Ri(t);m.useEffect(()=>{function o(i){r.current(i)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function Nle(e,t,n=!0){let r=m.useRef(!1);m.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(s,a){if(!r.current||s.defaultPrevented)return;let l=a(s);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function u(f){return typeof f=="function"?u(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let u of c){if(u===null)continue;let f=u instanceof HTMLElement?u:u.current;if(f!=null&&f.contains(l)||s.composed&&s.composedPath().includes(f))return}return!Tle(l,ON.Loose)&&l.tabIndex!==-1&&s.preventDefault(),t(s,l)}let i=m.useRef(null);Jp("pointerdown",s=>{var a,l;r.current&&(i.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Jp("mousedown",s=>{var a,l;r.current&&(i.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Jp("click",s=>{$N()||i.current&&(o(s,()=>i.current),i.current=null)},!0),Jp("touchend",s=>o(s,()=>s.target instanceof HTMLElement?s.target:null),!0),Ile("blur",s=>o(s,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Lle(...e){return m.useMemo(()=>yS(...e),[...e])}function s2(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Fle(e,t){let[n,r]=m.useState(()=>s2(e));return Bn(()=>{r(s2(e))},[e.type,e.as]),Bn(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let jle=Symbol();function Il(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=Rt(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[jle]))?void 0:n}function a2(e){return[e.screenX,e.screenY]}function zle(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=a2(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=a2(t)}}}function Ble({container:e,accept:t,walk:n,enabled:r=!0}){let o=m.useRef(t),i=m.useRef(n);m.useEffect(()=>{o.current=t,i.current=n},[t,n]),Bn(()=>{if(!e||!r)return;let s=yS(e);if(!s)return;let a=o.current,l=i.current,c=Object.assign(f=>a(f),{acceptNode:a}),u=s.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[e,r,o,i])}function l2(e,t){let n=m.useRef([]),r=Rt(e);m.useEffect(()=>{let o=[...n.current];for(let[i,s]of t.entries())if(n.current[i]!==s){let a=r(t,o);return n.current=t,a}},[r,...t])}function fm(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var hm=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(hm||{}),ia=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ia||{});function bs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:s,mergeRefs:a}){a=a??Vle;let l=TN(t,e);if(i)return Zp(l,n,r,s,a);let c=o??0;if(c&2){let{static:u=!1,...f}=l;if(u)return Zp(f,n,r,s,a)}if(c&1){let{unmount:u=!0,...f}=l;return Zn(u?0:1,{0(){return null},1(){return Zp({...f,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return Zp(l,n,r,s,a)}function Zp(e,t={},n,r,o){let{as:i=n,children:s,refName:a="ref",...l}=fy(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},u=typeof s=="function"?s(t):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let f={};if(t){let h=!1,p=[];for(let[v,b]of Object.entries(t))typeof b=="boolean"&&(h=!0),b===!0&&p.push(v);h&&(f["data-headlessui-state"]=p.join(" "))}if(i===m.Fragment&&Object.keys(O1(l)).length>0){if(!m.isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(b=>` - ${b}`).join(`
|
|
405
405
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
|
|
406
406
|
`)].join(`
|
|
407
|
-
`));let h=u.props,p=typeof(h==null?void 0:h.className)=="function"?(...b)=>fm(h==null?void 0:h.className(...b),l.className):fm(h==null?void 0:h.className,l.className),v=p?{className:p}:{};return m.cloneElement(u,Object.assign({},TN(u.props,O1(fy(l,["ref"]))),f,c,{ref:o(u.ref,c.ref)},v))}return m.createElement(i,Object.assign({},fy(l,["ref"]),i!==m.Fragment&&c,i!==m.Fragment&&f),u)}function Vle(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function TN(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let s=n[r];for(let a of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...i)}}});return t}function Ii(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function O1(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function fy(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let Hle="div";var DN=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(DN||{});function Wle(e,t){var n;let{features:r=1,...o}=e,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return bs({ourProps:i,theirProps:o,slot:{},defaultTag:Hle,name:"Hidden"})}let Ule=Ii(Wle),xS=m.createContext(null);xS.displayName="OpenClosedContext";var so=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(so||{});function wS(){return m.useContext(xS)}function AN({value:e,children:t}){return m.createElement(xS.Provider,{value:e},t)}function Gle(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let qa=[];Gle(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&qa[0]!==t.target&&(qa.unshift(t.target),qa=qa.filter(n=>n!=null&&n.isConnected),qa.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function qle(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Yle(n)?!1:r}function Yle(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function Kle(e){throw new Error("Unexpected object: "+e)}var jn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(jn||{});function c2(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:Kle(e)}}function kN(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))IN(n,MN(t,r),o);return n}function MN(e,t){return e?e+"["+t+"]":t}function IN(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())IN(e,MN(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):kN(n,t,e)}var to=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(to||{}),Xle=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Xle||{}),Qle=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Qle||{}),Jle=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Jle||{}),Zle=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(Zle||{});function hy(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):Ale(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let ece={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,i,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let u=t.focus===jn.Specific?t.idx:c2(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var h,p;return(p=(h=e.activeOptionIndex)!=null?h:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?p:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===u&&e.activationTrigger===f?e:{...e,activeOptionIndex:u,activationTrigger:f}}let a=hy(e);if(a.activeOptionIndex===null){let u=a.options.findIndex(f=>!f.dataRef.current.disabled);u!==-1&&(a.activeOptionIndex=u)}let l=t.focus===jn.Specific?t.idx:c2(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=hy(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=hy(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},_S=m.createContext(null);_S.displayName="ComboboxActionsContext";function mh(e){let t=m.useContext(_S);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,mh),n}return t}let NN=m.createContext(null);function tce(e){var t;let n=Nl("VirtualProvider"),[r,o]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),i=xle({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return Bn(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(NN.Provider,{value:i},m.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&i.scrollToIndex(n.activeOptionIndex)}}},i.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let SS=m.createContext(null);SS.displayName="ComboboxDataContext";function Nl(e){let t=m.useContext(SS);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nl),n}return t}function nce(e,t){return Zn(t.type,ece,e,t)}let rce=m.Fragment;function oce(e,t){let{value:n,defaultValue:r,onChange:o,form:i,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:u=!1,multiple:f=!1,immediate:h=!1,virtual:p=null,...v}=e,b=!1,x=null,[y=f?[]:void 0,_]=Cle(n,o,r),[S,E]=m.useReducer(nce,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=m.useRef(!1),$=m.useRef({static:!1,hold:!1}),O=m.useRef(null),A=m.useRef(null),I=m.useRef(null),F=m.useRef(null),L=Rt(typeof a=="string"?(te,ie)=>{let me=a;return(te==null?void 0:te[me])===(ie==null?void 0:ie[me])}:a??((te,ie)=>te===ie)),B=Rt(te=>S.options.findIndex(ie=>L(ie.dataRef.current.value,te))),J=m.useCallback(te=>Zn(z.mode,{1:()=>y.some(ie=>L(ie,te)),0:()=>L(y,te)}),[y]),q=Rt(te=>S.activeOptionIndex===B(te)),z=m.useMemo(()=>({...S,immediate:b,optionsPropsRef:$,labelRef:O,inputRef:A,buttonRef:I,optionsRef:F,value:y,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(C.current&&S.activeOptionIndex===null&&S.options.length>0){let te=S.options.findIndex(ie=>!ie.dataRef.current.disabled);if(te!==-1)return te}return S.activeOptionIndex},calculateIndex:B,compare:L,isSelected:J,isActive:q,nullable:u,__demoMode:c}),[y,r,l,f,u,c,S,x]);Bn(()=>{},[x,void 0]),Bn(()=>{S.dataRef.current=z},[z]),Nle([z.buttonRef,z.inputRef,z.optionsRef],()=>ue.closeCombobox(),z.comboboxState===0);let ee=m.useMemo(()=>{var te,ie,me;return{open:z.comboboxState===0,disabled:l,activeIndex:z.activeOptionIndex,activeOption:z.activeOptionIndex===null?null:z.virtual?z.virtual.options[(te=z.activeOptionIndex)!=null?te:0]:(me=(ie=z.options[z.activeOptionIndex])==null?void 0:ie.dataRef.current.value)!=null?me:null,value:y}},[z,l,y]),G=Rt(()=>{if(z.activeOptionIndex!==null){if(z.virtual)M(z.virtual.options[z.activeOptionIndex]);else{let{dataRef:te}=z.options[z.activeOptionIndex];M(te.current.value)}ue.goToOption(jn.Specific,z.activeOptionIndex)}}),Q=Rt(()=>{E({type:0}),C.current=!0}),W=Rt(()=>{E({type:1}),C.current=!1}),T=Rt((te,ie,me)=>(C.current=!1,te===jn.Specific?E({type:2,focus:jn.Specific,idx:ie,trigger:me}):E({type:2,focus:te,trigger:me}))),H=Rt((te,ie)=>(E({type:3,payload:{id:te,dataRef:ie}}),()=>{z.isActive(ie.current.value)&&(C.current=!0),E({type:4,id:te})})),U=Rt(te=>(E({type:5,id:te}),()=>E({type:5,id:null}))),M=Rt(te=>Zn(z.mode,{0(){return _==null?void 0:_(te)},1(){let ie=z.value.slice(),me=ie.findIndex(X=>L(X,te));return me===-1?ie.push(te):ie.splice(me,1),_==null?void 0:_(ie)}})),re=Rt(te=>{E({type:6,trigger:te})}),ue=m.useMemo(()=>({onChange:M,registerOption:H,registerLabel:U,goToOption:T,closeCombobox:W,openCombobox:Q,setActivationTrigger:re,selectActiveOption:G}),[]),de=t===null?{}:{ref:t},pe=m.useRef(null),Z=ph();return m.useEffect(()=>{pe.current&&r!==void 0&&Z.addEventListener(pe.current,"reset",()=>{_==null||_(r)})},[pe,_]),m.createElement(_S.Provider,{value:ue},m.createElement(SS.Provider,{value:z},m.createElement(AN,{value:Zn(z.comboboxState,{0:so.Open,1:so.Closed})},s!=null&&y!=null&&kN({[s]:y}).map(([te,ie],me)=>m.createElement(Ule,{features:DN.Hidden,ref:me===0?X=>{var be;pe.current=(be=X==null?void 0:X.closest("form"))!=null?be:null}:void 0,...O1({key:te,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:i,name:te,value:ie})})),bs({ourProps:de,theirProps:v,slot:ee,defaultTag:rce,name:"Combobox"}))))}let ice="input";function sce(e,t){var n,r,o,i,s;let a=gh(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:u,type:f="text",...h}=e,p=Nl("Combobox.Input"),v=mh("Combobox.Input"),b=Il(p.inputRef,t),x=Lle(p.inputRef),y=m.useRef(!1),_=ph(),S=Rt(()=>{v.onChange(null),p.optionsRef.current&&(p.optionsRef.current.scrollTop=0),v.goToOption(jn.Nothing)}),E=function(){var z;return typeof u=="function"&&p.value!==void 0?(z=u(p.value))!=null?z:"":typeof p.value=="string"?p.value:""}();l2(([z,ee],[G,Q])=>{if(y.current)return;let W=p.inputRef.current;W&&((Q===0&&ee===1||z!==G)&&(W.value=z),requestAnimationFrame(()=>{if(y.current||!W||(x==null?void 0:x.activeElement)!==W)return;let{selectionStart:T,selectionEnd:H}=W;Math.abs((H??0)-(T??0))===0&&T===0&&W.setSelectionRange(W.value.length,W.value.length)}))},[E,p.comboboxState,x]),l2(([z],[ee])=>{if(z===0&&ee===1){if(y.current)return;let G=p.inputRef.current;if(!G)return;let Q=G.value,{selectionStart:W,selectionEnd:T,selectionDirection:H}=G;G.value="",G.value=Q,H!==null?G.setSelectionRange(W,T,H):G.setSelectionRange(W,T)}},[p.comboboxState]);let C=m.useRef(!1),$=Rt(()=>{C.current=!0}),O=Rt(()=>{_.nextFrame(()=>{C.current=!1})}),A=Rt(z=>{switch(y.current=!0,z.key){case to.Enter:if(y.current=!1,p.comboboxState!==0||C.current)return;if(z.preventDefault(),z.stopPropagation(),p.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),p.mode===0&&v.closeCombobox();break;case to.ArrowDown:return y.current=!1,z.preventDefault(),z.stopPropagation(),Zn(p.comboboxState,{0:()=>v.goToOption(jn.Next),1:()=>v.openCombobox()});case to.ArrowUp:return y.current=!1,z.preventDefault(),z.stopPropagation(),Zn(p.comboboxState,{0:()=>v.goToOption(jn.Previous),1:()=>{v.openCombobox(),_.nextFrame(()=>{p.value||v.goToOption(jn.Last)})}});case to.Home:if(z.shiftKey)break;return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.First);case to.PageUp:return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.First);case to.End:if(z.shiftKey)break;return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.Last);case to.PageDown:return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.Last);case to.Escape:return y.current=!1,p.comboboxState!==0?void 0:(z.preventDefault(),p.optionsRef.current&&!p.optionsPropsRef.current.static&&z.stopPropagation(),p.nullable&&p.mode===0&&p.value===null&&S(),v.closeCombobox());case to.Tab:if(y.current=!1,p.comboboxState!==0)return;p.mode===0&&p.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),I=Rt(z=>{c==null||c(z),p.nullable&&p.mode===0&&z.target.value===""&&S(),v.openCombobox()}),F=Rt(z=>{var ee,G,Q;let W=(ee=z.relatedTarget)!=null?ee:qa.find(T=>T!==z.currentTarget);if(y.current=!1,!((G=p.optionsRef.current)!=null&&G.contains(W))&&!((Q=p.buttonRef.current)!=null&&Q.contains(W))&&p.comboboxState===0)return z.preventDefault(),p.mode===0&&(p.nullable&&p.value===null?S():p.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),L=Rt(z=>{var ee,G,Q;let W=(ee=z.relatedTarget)!=null?ee:qa.find(T=>T!==z.currentTarget);(G=p.buttonRef.current)!=null&&G.contains(W)||(Q=p.optionsRef.current)!=null&&Q.contains(W)||p.disabled||p.immediate&&p.comboboxState!==0&&(v.openCombobox(),_.nextFrame(()=>{v.setActivationTrigger(1)}))}),B=vS(()=>{if(p.labelId)return[p.labelId].join(" ")},[p.labelId]),J=m.useMemo(()=>({open:p.comboboxState===0,disabled:p.disabled}),[p]),q={ref:b,id:l,role:"combobox",type:f,"aria-controls":(n=p.optionsRef.current)==null?void 0:n.id,"aria-expanded":p.comboboxState===0,"aria-activedescendant":p.activeOptionIndex===null?void 0:p.virtual?(r=p.options.find(z=>{var ee;return!((ee=p.virtual)!=null&&ee.disabled(z.dataRef.current.value))&&p.compare(z.dataRef.current.value,p.virtual.options[p.activeOptionIndex])}))==null?void 0:r.id:(o=p.options[p.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":B,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:p.defaultValue!==void 0?u==null?void 0:u(p.defaultValue):null)!=null?s:p.defaultValue,disabled:p.disabled,onCompositionStart:$,onCompositionEnd:O,onKeyDown:A,onChange:I,onFocus:L,onBlur:F};return bs({ourProps:q,theirProps:h,slot:J,defaultTag:ice,name:"Combobox.Input"})}let ace="button";function lce(e,t){var n;let r=Nl("Combobox.Button"),o=mh("Combobox.Button"),i=Il(r.buttonRef,t),s=gh(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=ph(),u=Rt(b=>{switch(b.key){case to.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&o.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case to.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),c.nextFrame(()=>{r.value||o.goToOption(jn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case to.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),o.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=Rt(b=>{if(qle(b.currentTarget))return b.preventDefault();r.comboboxState===0?o.closeCombobox():(b.preventDefault(),o.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),h=vS(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),p=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:i,id:a,type:Fle(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":h,disabled:r.disabled,onClick:f,onKeyDown:u};return bs({ourProps:v,theirProps:l,slot:p,defaultTag:ace,name:"Combobox.Button"})}let cce="label";function uce(e,t){let n=gh(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,i=Nl("Combobox.Label"),s=mh("Combobox.Label"),a=Il(i.labelRef,t);Bn(()=>s.registerLabel(r),[r]);let l=Rt(()=>{var u;return(u=i.inputRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:i.comboboxState===0,disabled:i.disabled}),[i]);return bs({ourProps:{ref:a,id:r,onClick:l},theirProps:o,slot:c,defaultTag:cce,name:"Combobox.Label"})}let dce="ul",fce=hm.RenderStrategy|hm.Static;function hce(e,t){let n=gh(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...i}=e,s=Nl("Combobox.Options"),a=Il(s.optionsRef,t),l=wS(),c=l!==null?(l&so.Open)===so.Open:s.comboboxState===0;Bn(()=>{var p;s.optionsPropsRef.current.static=(p=e.static)!=null?p:!1},[s.optionsPropsRef,e.static]),Bn(()=>{s.optionsPropsRef.current.hold=o},[s.optionsPropsRef,o]),Ble({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});let u=vS(()=>{var p,v;return(v=s.labelId)!=null?v:(p=s.buttonRef.current)==null?void 0:p.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),h={"aria-labelledby":u,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(i,{children:m.createElement(tce,null,i.children)}),bs({ourProps:h,theirProps:i,slot:f,defaultTag:dce,features:fce,visible:c,name:"Combobox.Options"})}let pce="li";function gce(e,t){var n;let r=gh(),{id:o=`headlessui-combobox-option-${r}`,disabled:i=!1,value:s,order:a=null,...l}=e,c=Nl("Combobox.Option"),u=mh("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===o,h=c.isSelected(s),p=m.useRef(null),v=Ri({disabled:i,value:s,domRef:p,order:a}),b=m.useContext(NN),x=Il(t,p,b?b.measureElement:null),y=Rt(()=>u.onChange(s));Bn(()=>u.registerOption(o,v),[v,o]);let _=m.useRef(!(c.virtual||c.__demoMode));Bn(()=>{if(!c.virtual||!c.__demoMode)return;let F=Sl();return F.requestAnimationFrame(()=>{_.current=!0}),F.dispose},[c.virtual,c.__demoMode]),Bn(()=>{if(!_.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let F=Sl();return F.requestAnimationFrame(()=>{var L,B;(B=(L=p.current)==null?void 0:L.scrollIntoView)==null||B.call(L,{block:"nearest"})}),F.dispose},[p,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let S=Rt(F=>{var L;if(i||(L=c.virtual)!=null&&L.disabled(s))return F.preventDefault();y(),$N()||requestAnimationFrame(()=>{var B;return(B=c.inputRef.current)==null?void 0:B.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>u.closeCombobox())}),E=Rt(()=>{var F;if(i||(F=c.virtual)!=null&&F.disabled(s))return u.goToOption(jn.Nothing);let L=c.calculateIndex(s);u.goToOption(jn.Specific,L)}),C=zle(),$=Rt(F=>C.update(F)),O=Rt(F=>{var L;if(!C.wasMoved(F)||i||(L=c.virtual)!=null&&L.disabled(s)||f)return;let B=c.calculateIndex(s);u.goToOption(jn.Specific,B,0)}),A=Rt(F=>{var L;C.wasMoved(F)&&(i||(L=c.virtual)!=null&&L.disabled(s)||f&&(c.optionsPropsRef.current.hold||u.goToOption(jn.Nothing)))}),I=m.useMemo(()=>({active:f,selected:h,disabled:i}),[f,h,i]);return bs({ourProps:{id:o,ref:x,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:S,onFocus:E,onPointerEnter:$,onMouseEnter:$,onPointerMove:O,onMouseMove:O,onPointerLeave:A,onMouseLeave:A},theirProps:l,slot:I,defaultTag:pce,name:"Combobox.Option"})}let mce=Ii(oce),vce=Ii(lce),bce=Ii(sce),yce=Ii(uce),xce=Ii(hce),wce=Ii(gce),fc=Object.assign(mce,{Input:bce,Button:vce,Label:yce,Options:xce,Option:wce});function CS(){let e=m.useRef(!1);return Bn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function _ce(e=0){let[t,n]=m.useState(e),r=CS(),o=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),i=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}function Sce(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function py(e,...t){e&&t.length>0&&e.classList.add(...t)}function gy(e,...t){e&&t.length>0&&e.classList.remove(...t)}function Cce(e,t){let n=Sl();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,s]=[r,o].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,f)=>f-u);return c}),a=i+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function Ece(e,t,n,r){let o=n?"enter":"leave",i=Sl(),s=r!==void 0?Sce(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Zn(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Zn(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=Zn(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return gy(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),py(e,...t.base,...a,...c),i.nextFrame(()=>{gy(e,...t.base,...a,...c),py(e,...t.base,...a,...l),Cce(e,()=>(gy(e,...t.base,...a),py(e,...t.base,...t.entered),s()))}),i.dispose}function Rce({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:i}){let s=CS(),a=ph(),l=Ri(n);Bn(()=>{e&&(l.current="enter")},[e]),Bn(()=>{let c=Sl();a.add(c.dispose);let u=t.current;if(u&&l.current!=="idle"&&s.current)return c.dispose(),o.current(l.current),c.add(Ece(u,r.current,l.current==="enter",()=>{c.dispose(),i.current(l.current)})),c.dispose},[n])}function js(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Rv=m.createContext(null);Rv.displayName="TransitionContext";var Pce=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Pce||{});function Oce(){let e=m.useContext(Rv);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function $ce(){let e=m.useContext(Pv);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Pv=m.createContext(null);Pv.displayName="NestingContext";function Ov(e){return"children"in e?Ov(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function LN(e,t){let n=Ri(e),r=m.useRef([]),o=CS(),i=ph(),s=Rt((p,v=ia.Hidden)=>{let b=r.current.findIndex(({el:x})=>x===p);b!==-1&&(Zn(v,{[ia.Unmount](){r.current.splice(b,1)},[ia.Hidden](){r.current[b].state="hidden"}}),i.microTask(()=>{var x;!Ov(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),a=Rt(p=>{let v=r.current.find(({el:b})=>b===p);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,ia.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),u=m.useRef({enter:[],leave:[],idle:[]}),f=Rt((p,v,b)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==p)),t==null||t.chains.current[v].push([p,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([p,new Promise(x=>{Promise.all(u.current[v].map(([y,_])=>_)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(v)):b(v)}),h=Rt((p,v,b)=>{Promise.all(u.current[v].splice(0).map(([x,y])=>y)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>b(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:h,wait:c,chains:u}),[a,s,r,f,h,u,c])}function Tce(){}let Dce=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function u2(e){var t;let n={};for(let r of Dce)n[r]=(t=e[r])!=null?t:Tce;return n}function Ace(e){let t=m.useRef(u2(e));return m.useEffect(()=>{t.current=u2(e)},[e]),t}let kce="div",FN=hm.RenderStrategy;function Mce(e,t){var n,r;let{beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:f,leave:h,leaveFrom:p,leaveTo:v,...b}=e,x=m.useRef(null),y=Il(x,t),_=(n=b.unmount)==null||n?ia.Unmount:ia.Hidden,{show:S,appear:E,initial:C}=Oce(),[$,O]=m.useState(S?"visible":"hidden"),A=$ce(),{register:I,unregister:F}=A;m.useEffect(()=>I(x),[I,x]),m.useEffect(()=>{if(_===ia.Hidden&&x.current){if(S&&$!=="visible"){O("visible");return}return Zn($,{hidden:()=>F(x),visible:()=>I(x)})}},[$,x,I,F,S,_]);let L=Ri({base:js(b.className),enter:js(l),enterFrom:js(c),enterTo:js(u),entered:js(f),leave:js(h),leaveFrom:js(p),leaveTo:js(v)}),B=Ace({beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a}),J=bS();m.useEffect(()=>{if(J&&$==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,$,J]);let q=C&&!E,z=E&&S&&C,ee=!J||q?"idle":S?"enter":"leave",G=_ce(0),Q=Rt(re=>Zn(re,{enter:()=>{G.addFlag(so.Opening),B.current.beforeEnter()},leave:()=>{G.addFlag(so.Closing),B.current.beforeLeave()},idle:()=>{}})),W=Rt(re=>Zn(re,{enter:()=>{G.removeFlag(so.Opening),B.current.afterEnter()},leave:()=>{G.removeFlag(so.Closing),B.current.afterLeave()},idle:()=>{}})),T=LN(()=>{O("hidden"),F(x)},A),H=m.useRef(!1);Rce({immediate:z,container:x,classes:L,direction:ee,onStart:Ri(re=>{H.current=!0,T.onStart(x,re,Q)}),onStop:Ri(re=>{H.current=!1,T.onStop(x,re,W),re==="leave"&&!Ov(T)&&(O("hidden"),F(x))})});let U=b,M={ref:y};return z?U={...U,className:fm(b.className,...L.current.enter,...L.current.enterFrom)}:H.current&&(U.className=fm(b.className,(r=x.current)==null?void 0:r.className),U.className===""&&delete U.className),m.createElement(Pv.Provider,{value:T},m.createElement(AN,{value:Zn($,{visible:so.Open,hidden:so.Closed})|G.flags},bs({ourProps:M,theirProps:U,defaultTag:kce,features:FN,visible:$==="visible",name:"Transition.Child"})))}function Ice(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,s=m.useRef(null),a=Il(s,t);bS();let l=wS();if(n===void 0&&l!==null&&(n=(l&so.Open)===so.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=m.useState(n?"visible":"hidden"),f=LN(()=>{u("hidden")}),[h,p]=m.useState(!0),v=m.useRef([n]);Bn(()=>{h!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);m.useEffect(()=>{if(n)u("visible");else if(!Ov(f))u("hidden");else{let S=s.current;if(!S)return;let E=S.getBoundingClientRect();E.x===0&&E.y===0&&E.width===0&&E.height===0&&u("hidden")}},[n,f]);let x={unmount:o},y=Rt(()=>{var S;h&&p(!1),(S=e.beforeEnter)==null||S.call(e)}),_=Rt(()=>{var S;h&&p(!1),(S=e.beforeLeave)==null||S.call(e)});return m.createElement(Pv.Provider,{value:f},m.createElement(Rv.Provider,{value:b},bs({ourProps:{...x,as:m.Fragment,children:m.createElement(jN,{ref:a,...x,...i,beforeEnter:y,beforeLeave:_})},theirProps:{},defaultTag:m.Fragment,features:FN,visible:c==="visible",name:"Transition"})))}function Nce(e,t){let n=m.useContext(Rv)!==null,r=wS()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement($1,{ref:t,...e}):m.createElement(jN,{ref:t,...e}))}let $1=Ii(Ice),jN=Ii(Mce),Lce=Ii(Nce),Fce=Object.assign($1,{Child:Lce,Root:$1});function jce(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[o,i]=e.split(r);return{operation:r,value:i.trim()}}else return null}function zce(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,o=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return vu.includes(e)?o:r}function Bce({filter:e}){const[t,n]=m.useState([]),[r,o]=m.useState(""),[i,s]=m.useState(""),a=m.useRef(null);ni();const l=Pe(O=>O.filterValues),c=Pe(O=>O.selectedSheetId),u=Pe(O=>O.actions.addOrUpdateFilterValue),f=Pe(O=>O.actions.removeFilterValue),{data:h,isLoading:p,isFetching:v,isError:b,refetch:x}=RN(e),y=m.useMemo(()=>{var O;return(O=h==null?void 0:h.records)==null?void 0:O.map(A=>{let I=e.column.split(".").slice(-1)[0].replace(/"/g,"");return A[I]===void 0&&(I=I.toLowerCase()),{id:A[I],value:A[I]}})},[h,e.column]);m.useEffect(()=>{if(l){const O=l.find(A=>A.filterId===e.id);if(!O){n([]);return}if(O.operation==="in"){const A=y==null?void 0:y.filter(I=>O.values.includes(I.value));A&&n(A)}else o(`${O.operation} ${O.values[0]}`)}},[h,c,l]),m.useEffect(()=>{if(l&&!l.find(A=>A.filterId===e.id)){n([]);return}},[l,e.id]);function _(O){const A=jce(O[0].toString());if(!(A!=null&&A.value)||!(A!=null&&A.operation))return;const I={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:Fg(e),name:e.column,operation:A.operation,values:[Number(A.value)]};u(I)}function S(O){if(Array.isArray(O)||(O=[O]),console.log("onComboBoxChange",O),O.length===1&&y.find(I=>I.value===O[0].value)===void 0){_(O);return}if(n(O),O.length===0){f(e.id);return}const A={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Fg(e),operation:e.operation,values:O.map(I=>I.value)};u(A)}function E(){var O;o(""),f(e.id),console.log(e.id),(O=a.current)==null||O.click()}if(p)return R.jsx("div",{children:R.jsx(Am,{className:"h-8 w-full bg-foreground/10"})});if(b)return R.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"});let C=[];tu.includes(e.dataType)?C=y:C=i===""?y:y==null?void 0:y.filter(O=>O.value.toLowerCase().replace(/\s+/g,"").includes(i.toLowerCase().replace(/\s+/g,"")));const $=e.type==="single";return R.jsx("div",{className:"w-full",children:R.jsx(fc,{value:t,multiple:!$,onChange:S,children:R.jsxs("div",{className:"relative",children:[R.jsxs("div",{className:"relative w-full cursor-default overflow-hidden rounded-sm border bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[R.jsx(fc.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:O=>O.map(I=>I.value).join(", ")||r,onChange:O=>{o(O.target.value),s(O.target.value)}}),R.jsx(fc.Button,{ref:a,className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:R.jsx(_J,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),R.jsx(Fce,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:R.jsxs(fc.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-sm border bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm",children:[tu.includes(e.dataType)&&R.jsxs(fc.Option,{value:r,className:"flex items-center justify-between gap-2 px-3 py-2",children:[R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("span",{className:"font-thin",children:"#"}),R.jsx("span",{children:r})]}),r&&R.jsx(wr,{variant:"link",className:"h-4 w-3 cursor-pointer text-foreground/50 hover:text-foreground/100",onClick:O=>{O.stopPropagation(),E()},children:"Clear"})]},"custom"),(C==null?void 0:C.length)===0&&i!==""?R.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):C==null?void 0:C.map(O=>R.jsx(fc.Option,{className:({active:A})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${A?"bg-muted":"text-foreground-900"}`,value:O,children:({selected:A,active:I})=>R.jsxs("div",{className:"",children:[R.jsx("span",{className:`block ${A?"font-medium":"font-normal"}`,children:typeof O.value=="boolean"?O.value?"True":"False":O.value}),A?R.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:R.jsx(Uk,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},O.value))]})})]})})})}const ES=N.forwardRef(({className:e,...t},n)=>R.jsx("textarea",{className:xe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ES.displayName="Textarea";const zN="Radio",[Vce,BN]=tr(zN),[Hce,Wce]=Vce(zN),Uce=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:i,disabled:s,value:a="on",onCheck:l,...c}=e,[u,f]=m.useState(null),h=St(t,b=>f(b)),p=m.useRef(!1),v=u?!!u.closest("form"):!0;return m.createElement(Hce,{scope:n,checked:o,disabled:s},m.createElement(Qe.button,ce({type:"button",role:"radio","aria-checked":o,"data-state":VN(o),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:Me(e.onClick,b=>{o||l==null||l(),v&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})})),v&&m.createElement(Yce,{control:u,bubbles:!p.current,name:r,value:a,checked:o,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),Gce="RadioIndicator",qce=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,i=Wce(Gce,n);return m.createElement(nr,{present:r||i.checked},m.createElement(Qe.span,ce({"data-state":VN(i.checked),"data-disabled":i.disabled?"":void 0},o,{ref:t})))}),Yce=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=dv(n),a=sv(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",ce({type:"radio","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function VN(e){return e?"checked":"unchecked"}const Kce=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],HN="RadioGroup",[Xce,U1e]=tr(HN,[yu,BN]),WN=yu(),UN=BN(),[Qce,Jce]=Xce(HN),Zce=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:i,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:u=!0,onValueChange:f,...h}=e,p=WN(n),v=$l(c),[b,x]=Sr({prop:i,defaultProp:o,onChange:f});return m.createElement(Qce,{scope:n,name:r,required:s,disabled:a,value:b,onValueChange:x},m.createElement(ww,ce({asChild:!0},p,{orientation:l,dir:v,loop:u}),m.createElement(Qe.div,ce({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:v},h,{ref:t}))))}),eue="RadioGroupItem",tue=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,i=Jce(eue,n),s=i.disabled||r,a=WN(n),l=UN(n),c=m.useRef(null),u=St(t,c),f=i.value===o.value,h=m.useRef(!1);return m.useEffect(()=>{const p=b=>{Kce.includes(b.key)&&(h.current=!0)},v=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),m.createElement(_w,ce({asChild:!0},a,{focusable:!s,active:f}),m.createElement(Uce,ce({disabled:s,required:i.required,checked:f},l,o,{name:i.name,ref:u,onCheck:()=>i.onValueChange(o.value),onKeyDown:Me(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Me(o.onFocus,()=>{var p;h.current&&((p=c.current)===null||p===void 0||p.click())})})))}),nue=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=UN(n);return m.createElement(qce,ce({},o,r,{ref:t}))}),GN=Zce,qN=tue,rue=nue,RS=N.forwardRef(({className:e,...t},n)=>R.jsx(GN,{className:xe("grid gap-2",e),...t,ref:n}));RS.displayName=GN.displayName;const pm=N.forwardRef(({className:e,...t},n)=>R.jsx(qN,{ref:n,className:xe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:R.jsx(rue,{className:"flex items-center justify-center",children:R.jsx(g_,{className:"h-2.5 w-2.5 fill-current text-current"})})}));pm.displayName=qN.displayName;function oue({filter:e}){const[t,n]=m.useState(e.sql),[r,o]=m.useState(!1),{updateFilter:i}=_r();function s(){const c={...e,sql:t};i(c),o(!1)}function a(c){console.log("operation",c);const u={...e,operation:c};i(u)}function l(c){const u={...e,type:c};i(u)}return R.jsxs(yv,{open:r,onOpenChange:o,children:[R.jsx(xv,{children:R.jsx(b_,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),R.jsxs(lh,{onDoubleClick:c=>c.stopPropagation(),className:"m-2 w-full min-w-[350px] space-y-4",children:[R.jsxs("div",{className:"space-y-2",children:[R.jsx("h4",{className:"font-medium leading-none",children:"Customize Filter"}),R.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the filter operation and SQL"})]}),R.jsx(ch,{}),R.jsxs("div",{className:"space-y-2",children:[R.jsx("div",{children:"Type"}),R.jsxs(RS,{onValueChange:l,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[R.jsxs("div",{className:"flex items-center space-x-2",children:[R.jsx(pm,{value:"multiple",id:"r1"}),R.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),R.jsxs("div",{className:"flex items-center space-x-2",children:[R.jsx(pm,{value:"single",id:"r2"}),R.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),R.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{children:"Table Column"}),R.jsx(En,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.column})]}),R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{children:"Data Type"}),R.jsx(En,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.dataType})]}),R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{className:"text-sm",children:"Filter Operation"}),R.jsx(iue,{updateFilterOperation:a,value:e.operation})]})]}),R.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[R.jsx(En,{className:"text-sm",children:"Values SQL"}),R.jsx(ES,{value:t,onChange:c=>n(c.target.value),className:`min-w-full grow resize font-mono text-xs ${Pd}`})]}),R.jsx("div",{className:"flex justify-end gap-2",children:R.jsxs(wr,{onClick:s,size:"sm",variant:"outline",children:[R.jsx(Jf,{className:"mr-2 size-4"}),"Save SQL"]})})]})]})}function iue({value:e,updateFilterOperation:t}){return R.jsxs(ts,{defaultValue:"in",value:e,onValueChange:n=>t(n),children:[R.jsx(pi,{className:"h-8 w-[180px] focus:ring-0 focus:ring-offset-0",children:R.jsx(ns,{placeholder:"Operation"})}),R.jsxs(gi,{children:[R.jsx(An,{value:"=",children:"Equals"}),R.jsx(An,{value:"in",children:"Contains"}),R.jsx(An,{value:"like",children:"Like"})]})]})}function YN({filter:e}){const t=Pe(i=>i.isDashboardEditing),{removeFilterValue:n,removeFilter:r,updateFilter:o}=_r();return R.jsx(Si,{className:"my-1",text:e.title||e.column,onSave:i=>o({...e,title:i}),children:R.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[R.jsxs("div",{className:"flex grow items-center gap-2",children:[R.jsx(En,{className:"inline-block text-sm",children:e.title}),t&&R.jsx(oue,{filter:e})]}),R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("div",{onClick:()=>n(e.id),className:"invisible cursor-pointer text-xs text-muted-foreground hover:text-foreground hover:underline group-hover:visible",children:R.jsx(m_,{className:"size-3.5"})}),t&&R.jsx(lM,{onClick:()=>{n(e.id),r(e.id)},className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})]})]})})}const sue=AP.WidthProvider(AP.Responsive),PS=e=>vu.includes(e.dataType)?R.jsx(lle,{filter:e}):R.jsx(Bce,{filter:e});function aue(){var C,$;const e=Pe(O=>O.isDashboardEditing);Pe(O=>O.currentBreakpoint);const t=Pe(O=>O.themeStyle);m.useState([]);const n=Pe(O=>O.selectedSheetId);Pe(O=>O.selectedLensId);const r=(C=Pe(O=>{var A,I;return(I=(A=O.dashboard)==null?void 0:A.sheets)==null?void 0:I.filter(F=>F.id===n)}))==null?void 0:C[0].layouts,o=Pe(O=>O.dashboard.filters),i=Pe(O=>{var A,I,F;return(F=(I=(A=O.dashboard)==null?void 0:A.sheets)==null?void 0:I.find(L=>L.id===n))==null?void 0:F.frames}),{getSelectedSheet:s,getSelectedSheetLayout:a,getSelectedSheetLayouts:l,setSheetLayout:c,setSheetLayouts:u,setCurrentBreakpoint:f,removeFilter:h,updateFilter:p,removeFilterValue:v}=Pe(O=>O.actions),b=s(),x=m.useCallback(O=>{f(O)},[f]),y=m.useCallback((O,A)=>{b!=null&&b.id&&u(b.id,A)},[b==null?void 0:b.id,u]);if(!n)return null;const _=(O,A)=>R.jsx(KN,{className:"after:content-none",ref:A,handleAxis:O});function S(){return o==null?void 0:o.map(O=>{var A,I,F,L;return O.location==="frame"?null:R.jsxs("div",{style:{borderRadius:(I=(A=t==null?void 0:t.chart)==null?void 0:A.options)==null?void 0:I.borderRadius,fontFamily:(L=(F=t==null?void 0:t.chart)==null?void 0:F.font)==null?void 0:L.family},className:xe("z-50 flex w-full flex-col rounded-md border bg-background px-3 py-2"),children:[R.jsx(YN,{filter:O}),PS(O)]},O.id)})}function E(){return i==null?void 0:i.map(O=>R.jsx("div",{role:"dashboard-frame-container",className:xe("group overflow-hidden",t==null?void 0:t.dashboardCardContainer),children:R.jsx(yie,{frame:O})},O.id))}return R.jsx(R.Fragment,{children:R.jsxs(sue,{margin:[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],className:xe(($=t==null?void 0:t.gridLayout)==null?void 0:$.className),layouts:r,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:x,onLayoutChange:y,resizeHandle:_,children:[S(),E()]})})}const KN=m.forwardRef(({className:e,handleAxis:t,...n},r)=>(Pe(o=>o.themeStyle),R.jsx("div",{ref:r,className:xe(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne","border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw","border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})));KN.displayName="ResizeHandle";let lue=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r};var Cu={exports:{}};const cue=typeof Buffer<"u",d2=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,f2=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function XN(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),cue&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const o=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(o==="ignore"&&i==="ignore")return r;if(o!=="ignore"&&i!=="ignore"){if(d2.test(e)===!1&&f2.test(e)===!1)return r}else if(o!=="ignore"&&i==="ignore"){if(d2.test(e)===!1)return r}else if(f2.test(e)===!1)return r;return QN(r,{protoAction:o,constructorAction:i,safe:n&&n.safe})}function QN(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let o=[e];for(;o.length;){const i=o;o=[];for(const s of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(const a in s){const l=s[a];l&&typeof l=="object"&&o.push(l)}}}return e}function OS(e,t,n){const r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return XN(e,t,n)}finally{Error.stackTraceLimit=r}}function uue(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return XN(e,t,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=n}}Cu.exports=OS;Cu.exports.default=OS;Cu.exports.parse=OS;Cu.exports.safeParse=uue;Cu.exports.scan=QN;var due=Cu.exports;const h2=Pl(due);var JN=lue("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);function fue(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{n=l,t.pop();break}default:{n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const f=e.substring(r,l+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}function hue(e){if(e!=null)try{return h2.parse(e)}catch{try{const n=fue(e);return h2.parse(n)}catch{}}}var cf={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},uf={code:"1",name:"function_call",parse:e=>{if(e==null||typeof e!="object"||!("function_call"in e)||typeof e.function_call!="object"||e.function_call==null||!("name"in e.function_call)||!("arguments"in e.function_call)||typeof e.function_call.name!="string"||typeof e.function_call.arguments!="string")throw new Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},df={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},ff={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},hf={code:"4",name:"assistant_message",parse:e=>{if(e==null||typeof e!="object"||!("id"in e)||!("role"in e)||!("content"in e)||typeof e.id!="string"||typeof e.role!="string"||e.role!=="assistant"||!Array.isArray(e.content)||!e.content.every(t=>t!=null&&typeof t=="object"&&"type"in t&&t.type==="text"&&"text"in t&&t.text!=null&&typeof t.text=="object"&&"value"in t.text&&typeof t.text.value=="string"))throw new Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},pf={code:"5",name:"assistant_control_data",parse:e=>{if(e==null||typeof e!="object"||!("threadId"in e)||!("messageId"in e)||typeof e.threadId!="string"||typeof e.messageId!="string")throw new Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},gf={code:"6",name:"data_message",parse:e=>{if(e==null||typeof e!="object"||!("role"in e)||!("data"in e)||typeof e.role!="string"||e.role!=="data")throw new Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},mf={code:"7",name:"tool_calls",parse:e=>{if(e==null||typeof e!="object"||!("tool_calls"in e)||typeof e.tool_calls!="object"||e.tool_calls==null||!Array.isArray(e.tool_calls)||e.tool_calls.some(t=>t==null||typeof t!="object"||!("id"in t)||typeof t.id!="string"||!("type"in t)||typeof t.type!="string"||!("function"in t)||t.function==null||typeof t.function!="object"||!("arguments"in t.function)||typeof t.function.name!="string"||typeof t.function.arguments!="string"))throw new Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},vf={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},bf={code:"9",name:"tool_call",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string"||!("args"in e)||typeof e.args!="object")throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},yf={code:"a",name:"tool_result",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},xf={code:"b",name:"tool_call_streaming_start",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string")throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},wf={code:"c",name:"tool_call_delta",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("argsTextDelta"in e)||typeof e.argsTextDelta!="string")throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},_f={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string"||!("usage"in e)||e.usage==null||typeof e.usage!="object"||!("promptTokens"in e.usage)||!("completionTokens"in e.usage))throw new Error('"finish_message" parts expect an object with a "finishReason" and "usage" property.');return typeof e.usage.promptTokens!="number"&&(e.usage.promptTokens=Number.NaN),typeof e.usage.completionTokens!="number"&&(e.usage.completionTokens=Number.NaN),{type:"finish_message",value:e}}},pue=[cf,uf,df,ff,hf,pf,gf,mf,vf,bf,yf,xf,wf,_f],gue={[cf.code]:cf,[uf.code]:uf,[df.code]:df,[ff.code]:ff,[hf.code]:hf,[pf.code]:pf,[gf.code]:gf,[mf.code]:mf,[vf.code]:vf,[bf.code]:bf,[yf.code]:yf,[xf.code]:xf,[wf.code]:wf,[_f.code]:_f};cf.name+"",cf.code,uf.name+"",uf.code,df.name+"",df.code,ff.name+"",ff.code,hf.name+"",hf.code,pf.name+"",pf.code,gf.name+"",gf.code,mf.name+"",mf.code,vf.name+"",vf.code,bf.name+"",bf.code,yf.name+"",yf.code,xf.name+"",xf.code,wf.name+"",wf.code,_f.name+"",_f.code;var mue=pue.map(e=>e.code),ZN=e=>{const t=e.indexOf(":");if(t===-1)throw new Error("Failed to parse stream string. No separator found.");const n=e.slice(0,t);if(!mue.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const r=n,o=e.slice(t+1),i=JSON.parse(o);return gue[r].parse(i)},vue=10;function bue(e,t){const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return e.length=0,n}async function*yue(e,{isAborted:t}={}){const n=new TextDecoder,r=[];let o=0;for(;;){const{value:i}=await e.read();if(i&&(r.push(i),o+=i.length,i[i.length-1]!==vue))continue;if(r.length===0)break;const s=bue(r,o);o=0;const a=n.decode(s,{stream:!0}).split(`
|
|
407
|
+
`));let h=u.props,p=typeof(h==null?void 0:h.className)=="function"?(...b)=>fm(h==null?void 0:h.className(...b),l.className):fm(h==null?void 0:h.className,l.className),v=p?{className:p}:{};return m.cloneElement(u,Object.assign({},TN(u.props,O1(fy(l,["ref"]))),f,c,{ref:o(u.ref,c.ref)},v))}return m.createElement(i,Object.assign({},fy(l,["ref"]),i!==m.Fragment&&c,i!==m.Fragment&&f),u)}function Vle(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function TN(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let s=n[r];for(let a of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...i)}}});return t}function Ii(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function O1(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function fy(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let Hle="div";var DN=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(DN||{});function Wle(e,t){var n;let{features:r=1,...o}=e,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return bs({ourProps:i,theirProps:o,slot:{},defaultTag:Hle,name:"Hidden"})}let Ule=Ii(Wle),xS=m.createContext(null);xS.displayName="OpenClosedContext";var so=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(so||{});function wS(){return m.useContext(xS)}function AN({value:e,children:t}){return m.createElement(xS.Provider,{value:e},t)}function Gle(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let qa=[];Gle(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&qa[0]!==t.target&&(qa.unshift(t.target),qa=qa.filter(n=>n!=null&&n.isConnected),qa.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function qle(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Yle(n)?!1:r}function Yle(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function Kle(e){throw new Error("Unexpected object: "+e)}var jn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(jn||{});function c2(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:Kle(e)}}function kN(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))IN(n,MN(t,r),o);return n}function MN(e,t){return e?e+"["+t+"]":t}function IN(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())IN(e,MN(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):kN(n,t,e)}var to=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(to||{}),Xle=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Xle||{}),Qle=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Qle||{}),Jle=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Jle||{}),Zle=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(Zle||{});function hy(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):Ale(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let ece={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,i,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let u=t.focus===jn.Specific?t.idx:c2(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var h,p;return(p=(h=e.activeOptionIndex)!=null?h:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?p:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===u&&e.activationTrigger===f?e:{...e,activeOptionIndex:u,activationTrigger:f}}let a=hy(e);if(a.activeOptionIndex===null){let u=a.options.findIndex(f=>!f.dataRef.current.disabled);u!==-1&&(a.activeOptionIndex=u)}let l=t.focus===jn.Specific?t.idx:c2(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=hy(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=hy(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},_S=m.createContext(null);_S.displayName="ComboboxActionsContext";function mh(e){let t=m.useContext(_S);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,mh),n}return t}let NN=m.createContext(null);function tce(e){var t;let n=Nl("VirtualProvider"),[r,o]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),i=xle({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return Bn(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(NN.Provider,{value:i},m.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&i.scrollToIndex(n.activeOptionIndex)}}},i.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let SS=m.createContext(null);SS.displayName="ComboboxDataContext";function Nl(e){let t=m.useContext(SS);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nl),n}return t}function nce(e,t){return Zn(t.type,ece,e,t)}let rce=m.Fragment;function oce(e,t){let{value:n,defaultValue:r,onChange:o,form:i,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:u=!1,multiple:f=!1,immediate:h=!1,virtual:p=null,...v}=e,b=!1,x=null,[y=f?[]:void 0,_]=Cle(n,o,r),[S,E]=m.useReducer(nce,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=m.useRef(!1),$=m.useRef({static:!1,hold:!1}),O=m.useRef(null),A=m.useRef(null),I=m.useRef(null),F=m.useRef(null),L=Rt(typeof a=="string"?(te,ie)=>{let me=a;return(te==null?void 0:te[me])===(ie==null?void 0:ie[me])}:a??((te,ie)=>te===ie)),B=Rt(te=>S.options.findIndex(ie=>L(ie.dataRef.current.value,te))),J=m.useCallback(te=>Zn(z.mode,{1:()=>y.some(ie=>L(ie,te)),0:()=>L(y,te)}),[y]),q=Rt(te=>S.activeOptionIndex===B(te)),z=m.useMemo(()=>({...S,immediate:b,optionsPropsRef:$,labelRef:O,inputRef:A,buttonRef:I,optionsRef:F,value:y,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(C.current&&S.activeOptionIndex===null&&S.options.length>0){let te=S.options.findIndex(ie=>!ie.dataRef.current.disabled);if(te!==-1)return te}return S.activeOptionIndex},calculateIndex:B,compare:L,isSelected:J,isActive:q,nullable:u,__demoMode:c}),[y,r,l,f,u,c,S,x]);Bn(()=>{},[x,void 0]),Bn(()=>{S.dataRef.current=z},[z]),Nle([z.buttonRef,z.inputRef,z.optionsRef],()=>ue.closeCombobox(),z.comboboxState===0);let ee=m.useMemo(()=>{var te,ie,me;return{open:z.comboboxState===0,disabled:l,activeIndex:z.activeOptionIndex,activeOption:z.activeOptionIndex===null?null:z.virtual?z.virtual.options[(te=z.activeOptionIndex)!=null?te:0]:(me=(ie=z.options[z.activeOptionIndex])==null?void 0:ie.dataRef.current.value)!=null?me:null,value:y}},[z,l,y]),G=Rt(()=>{if(z.activeOptionIndex!==null){if(z.virtual)M(z.virtual.options[z.activeOptionIndex]);else{let{dataRef:te}=z.options[z.activeOptionIndex];M(te.current.value)}ue.goToOption(jn.Specific,z.activeOptionIndex)}}),Q=Rt(()=>{E({type:0}),C.current=!0}),W=Rt(()=>{E({type:1}),C.current=!1}),T=Rt((te,ie,me)=>(C.current=!1,te===jn.Specific?E({type:2,focus:jn.Specific,idx:ie,trigger:me}):E({type:2,focus:te,trigger:me}))),H=Rt((te,ie)=>(E({type:3,payload:{id:te,dataRef:ie}}),()=>{z.isActive(ie.current.value)&&(C.current=!0),E({type:4,id:te})})),U=Rt(te=>(E({type:5,id:te}),()=>E({type:5,id:null}))),M=Rt(te=>Zn(z.mode,{0(){return _==null?void 0:_(te)},1(){let ie=z.value.slice(),me=ie.findIndex(X=>L(X,te));return me===-1?ie.push(te):ie.splice(me,1),_==null?void 0:_(ie)}})),re=Rt(te=>{E({type:6,trigger:te})}),ue=m.useMemo(()=>({onChange:M,registerOption:H,registerLabel:U,goToOption:T,closeCombobox:W,openCombobox:Q,setActivationTrigger:re,selectActiveOption:G}),[]),de=t===null?{}:{ref:t},pe=m.useRef(null),Z=ph();return m.useEffect(()=>{pe.current&&r!==void 0&&Z.addEventListener(pe.current,"reset",()=>{_==null||_(r)})},[pe,_]),m.createElement(_S.Provider,{value:ue},m.createElement(SS.Provider,{value:z},m.createElement(AN,{value:Zn(z.comboboxState,{0:so.Open,1:so.Closed})},s!=null&&y!=null&&kN({[s]:y}).map(([te,ie],me)=>m.createElement(Ule,{features:DN.Hidden,ref:me===0?X=>{var be;pe.current=(be=X==null?void 0:X.closest("form"))!=null?be:null}:void 0,...O1({key:te,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:i,name:te,value:ie})})),bs({ourProps:de,theirProps:v,slot:ee,defaultTag:rce,name:"Combobox"}))))}let ice="input";function sce(e,t){var n,r,o,i,s;let a=gh(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:u,type:f="text",...h}=e,p=Nl("Combobox.Input"),v=mh("Combobox.Input"),b=Il(p.inputRef,t),x=Lle(p.inputRef),y=m.useRef(!1),_=ph(),S=Rt(()=>{v.onChange(null),p.optionsRef.current&&(p.optionsRef.current.scrollTop=0),v.goToOption(jn.Nothing)}),E=function(){var z;return typeof u=="function"&&p.value!==void 0?(z=u(p.value))!=null?z:"":typeof p.value=="string"?p.value:""}();l2(([z,ee],[G,Q])=>{if(y.current)return;let W=p.inputRef.current;W&&((Q===0&&ee===1||z!==G)&&(W.value=z),requestAnimationFrame(()=>{if(y.current||!W||(x==null?void 0:x.activeElement)!==W)return;let{selectionStart:T,selectionEnd:H}=W;Math.abs((H??0)-(T??0))===0&&T===0&&W.setSelectionRange(W.value.length,W.value.length)}))},[E,p.comboboxState,x]),l2(([z],[ee])=>{if(z===0&&ee===1){if(y.current)return;let G=p.inputRef.current;if(!G)return;let Q=G.value,{selectionStart:W,selectionEnd:T,selectionDirection:H}=G;G.value="",G.value=Q,H!==null?G.setSelectionRange(W,T,H):G.setSelectionRange(W,T)}},[p.comboboxState]);let C=m.useRef(!1),$=Rt(()=>{C.current=!0}),O=Rt(()=>{_.nextFrame(()=>{C.current=!1})}),A=Rt(z=>{switch(y.current=!0,z.key){case to.Enter:if(y.current=!1,p.comboboxState!==0||C.current)return;if(z.preventDefault(),z.stopPropagation(),p.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),p.mode===0&&v.closeCombobox();break;case to.ArrowDown:return y.current=!1,z.preventDefault(),z.stopPropagation(),Zn(p.comboboxState,{0:()=>v.goToOption(jn.Next),1:()=>v.openCombobox()});case to.ArrowUp:return y.current=!1,z.preventDefault(),z.stopPropagation(),Zn(p.comboboxState,{0:()=>v.goToOption(jn.Previous),1:()=>{v.openCombobox(),_.nextFrame(()=>{p.value||v.goToOption(jn.Last)})}});case to.Home:if(z.shiftKey)break;return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.First);case to.PageUp:return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.First);case to.End:if(z.shiftKey)break;return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.Last);case to.PageDown:return y.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(jn.Last);case to.Escape:return y.current=!1,p.comboboxState!==0?void 0:(z.preventDefault(),p.optionsRef.current&&!p.optionsPropsRef.current.static&&z.stopPropagation(),p.nullable&&p.mode===0&&p.value===null&&S(),v.closeCombobox());case to.Tab:if(y.current=!1,p.comboboxState!==0)return;p.mode===0&&p.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),I=Rt(z=>{c==null||c(z),p.nullable&&p.mode===0&&z.target.value===""&&S(),v.openCombobox()}),F=Rt(z=>{var ee,G,Q;let W=(ee=z.relatedTarget)!=null?ee:qa.find(T=>T!==z.currentTarget);if(y.current=!1,!((G=p.optionsRef.current)!=null&&G.contains(W))&&!((Q=p.buttonRef.current)!=null&&Q.contains(W))&&p.comboboxState===0)return z.preventDefault(),p.mode===0&&(p.nullable&&p.value===null?S():p.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),L=Rt(z=>{var ee,G,Q;let W=(ee=z.relatedTarget)!=null?ee:qa.find(T=>T!==z.currentTarget);(G=p.buttonRef.current)!=null&&G.contains(W)||(Q=p.optionsRef.current)!=null&&Q.contains(W)||p.disabled||p.immediate&&p.comboboxState!==0&&(v.openCombobox(),_.nextFrame(()=>{v.setActivationTrigger(1)}))}),B=vS(()=>{if(p.labelId)return[p.labelId].join(" ")},[p.labelId]),J=m.useMemo(()=>({open:p.comboboxState===0,disabled:p.disabled}),[p]),q={ref:b,id:l,role:"combobox",type:f,"aria-controls":(n=p.optionsRef.current)==null?void 0:n.id,"aria-expanded":p.comboboxState===0,"aria-activedescendant":p.activeOptionIndex===null?void 0:p.virtual?(r=p.options.find(z=>{var ee;return!((ee=p.virtual)!=null&&ee.disabled(z.dataRef.current.value))&&p.compare(z.dataRef.current.value,p.virtual.options[p.activeOptionIndex])}))==null?void 0:r.id:(o=p.options[p.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":B,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:p.defaultValue!==void 0?u==null?void 0:u(p.defaultValue):null)!=null?s:p.defaultValue,disabled:p.disabled,onCompositionStart:$,onCompositionEnd:O,onKeyDown:A,onChange:I,onFocus:L,onBlur:F};return bs({ourProps:q,theirProps:h,slot:J,defaultTag:ice,name:"Combobox.Input"})}let ace="button";function lce(e,t){var n;let r=Nl("Combobox.Button"),o=mh("Combobox.Button"),i=Il(r.buttonRef,t),s=gh(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=ph(),u=Rt(b=>{switch(b.key){case to.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&o.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case to.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),c.nextFrame(()=>{r.value||o.goToOption(jn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case to.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),o.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=Rt(b=>{if(qle(b.currentTarget))return b.preventDefault();r.comboboxState===0?o.closeCombobox():(b.preventDefault(),o.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),h=vS(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),p=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:i,id:a,type:Fle(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":h,disabled:r.disabled,onClick:f,onKeyDown:u};return bs({ourProps:v,theirProps:l,slot:p,defaultTag:ace,name:"Combobox.Button"})}let cce="label";function uce(e,t){let n=gh(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,i=Nl("Combobox.Label"),s=mh("Combobox.Label"),a=Il(i.labelRef,t);Bn(()=>s.registerLabel(r),[r]);let l=Rt(()=>{var u;return(u=i.inputRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:i.comboboxState===0,disabled:i.disabled}),[i]);return bs({ourProps:{ref:a,id:r,onClick:l},theirProps:o,slot:c,defaultTag:cce,name:"Combobox.Label"})}let dce="ul",fce=hm.RenderStrategy|hm.Static;function hce(e,t){let n=gh(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...i}=e,s=Nl("Combobox.Options"),a=Il(s.optionsRef,t),l=wS(),c=l!==null?(l&so.Open)===so.Open:s.comboboxState===0;Bn(()=>{var p;s.optionsPropsRef.current.static=(p=e.static)!=null?p:!1},[s.optionsPropsRef,e.static]),Bn(()=>{s.optionsPropsRef.current.hold=o},[s.optionsPropsRef,o]),Ble({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});let u=vS(()=>{var p,v;return(v=s.labelId)!=null?v:(p=s.buttonRef.current)==null?void 0:p.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),h={"aria-labelledby":u,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(i,{children:m.createElement(tce,null,i.children)}),bs({ourProps:h,theirProps:i,slot:f,defaultTag:dce,features:fce,visible:c,name:"Combobox.Options"})}let pce="li";function gce(e,t){var n;let r=gh(),{id:o=`headlessui-combobox-option-${r}`,disabled:i=!1,value:s,order:a=null,...l}=e,c=Nl("Combobox.Option"),u=mh("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===o,h=c.isSelected(s),p=m.useRef(null),v=Ri({disabled:i,value:s,domRef:p,order:a}),b=m.useContext(NN),x=Il(t,p,b?b.measureElement:null),y=Rt(()=>u.onChange(s));Bn(()=>u.registerOption(o,v),[v,o]);let _=m.useRef(!(c.virtual||c.__demoMode));Bn(()=>{if(!c.virtual||!c.__demoMode)return;let F=Sl();return F.requestAnimationFrame(()=>{_.current=!0}),F.dispose},[c.virtual,c.__demoMode]),Bn(()=>{if(!_.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let F=Sl();return F.requestAnimationFrame(()=>{var L,B;(B=(L=p.current)==null?void 0:L.scrollIntoView)==null||B.call(L,{block:"nearest"})}),F.dispose},[p,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let S=Rt(F=>{var L;if(i||(L=c.virtual)!=null&&L.disabled(s))return F.preventDefault();y(),$N()||requestAnimationFrame(()=>{var B;return(B=c.inputRef.current)==null?void 0:B.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>u.closeCombobox())}),E=Rt(()=>{var F;if(i||(F=c.virtual)!=null&&F.disabled(s))return u.goToOption(jn.Nothing);let L=c.calculateIndex(s);u.goToOption(jn.Specific,L)}),C=zle(),$=Rt(F=>C.update(F)),O=Rt(F=>{var L;if(!C.wasMoved(F)||i||(L=c.virtual)!=null&&L.disabled(s)||f)return;let B=c.calculateIndex(s);u.goToOption(jn.Specific,B,0)}),A=Rt(F=>{var L;C.wasMoved(F)&&(i||(L=c.virtual)!=null&&L.disabled(s)||f&&(c.optionsPropsRef.current.hold||u.goToOption(jn.Nothing)))}),I=m.useMemo(()=>({active:f,selected:h,disabled:i}),[f,h,i]);return bs({ourProps:{id:o,ref:x,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:S,onFocus:E,onPointerEnter:$,onMouseEnter:$,onPointerMove:O,onMouseMove:O,onPointerLeave:A,onMouseLeave:A},theirProps:l,slot:I,defaultTag:pce,name:"Combobox.Option"})}let mce=Ii(oce),vce=Ii(lce),bce=Ii(sce),yce=Ii(uce),xce=Ii(hce),wce=Ii(gce),fc=Object.assign(mce,{Input:bce,Button:vce,Label:yce,Options:xce,Option:wce});function CS(){let e=m.useRef(!1);return Bn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function _ce(e=0){let[t,n]=m.useState(e),r=CS(),o=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),i=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}function Sce(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function py(e,...t){e&&t.length>0&&e.classList.add(...t)}function gy(e,...t){e&&t.length>0&&e.classList.remove(...t)}function Cce(e,t){let n=Sl();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,s]=[r,o].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,f)=>f-u);return c}),a=i+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function Ece(e,t,n,r){let o=n?"enter":"leave",i=Sl(),s=r!==void 0?Sce(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Zn(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Zn(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=Zn(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return gy(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),py(e,...t.base,...a,...c),i.nextFrame(()=>{gy(e,...t.base,...a,...c),py(e,...t.base,...a,...l),Cce(e,()=>(gy(e,...t.base,...a),py(e,...t.base,...t.entered),s()))}),i.dispose}function Rce({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:i}){let s=CS(),a=ph(),l=Ri(n);Bn(()=>{e&&(l.current="enter")},[e]),Bn(()=>{let c=Sl();a.add(c.dispose);let u=t.current;if(u&&l.current!=="idle"&&s.current)return c.dispose(),o.current(l.current),c.add(Ece(u,r.current,l.current==="enter",()=>{c.dispose(),i.current(l.current)})),c.dispose},[n])}function js(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Rv=m.createContext(null);Rv.displayName="TransitionContext";var Pce=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Pce||{});function Oce(){let e=m.useContext(Rv);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function $ce(){let e=m.useContext(Pv);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Pv=m.createContext(null);Pv.displayName="NestingContext";function Ov(e){return"children"in e?Ov(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function LN(e,t){let n=Ri(e),r=m.useRef([]),o=CS(),i=ph(),s=Rt((p,v=ia.Hidden)=>{let b=r.current.findIndex(({el:x})=>x===p);b!==-1&&(Zn(v,{[ia.Unmount](){r.current.splice(b,1)},[ia.Hidden](){r.current[b].state="hidden"}}),i.microTask(()=>{var x;!Ov(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),a=Rt(p=>{let v=r.current.find(({el:b})=>b===p);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,ia.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),u=m.useRef({enter:[],leave:[],idle:[]}),f=Rt((p,v,b)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==p)),t==null||t.chains.current[v].push([p,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([p,new Promise(x=>{Promise.all(u.current[v].map(([y,_])=>_)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(v)):b(v)}),h=Rt((p,v,b)=>{Promise.all(u.current[v].splice(0).map(([x,y])=>y)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>b(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:h,wait:c,chains:u}),[a,s,r,f,h,u,c])}function Tce(){}let Dce=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function u2(e){var t;let n={};for(let r of Dce)n[r]=(t=e[r])!=null?t:Tce;return n}function Ace(e){let t=m.useRef(u2(e));return m.useEffect(()=>{t.current=u2(e)},[e]),t}let kce="div",FN=hm.RenderStrategy;function Mce(e,t){var n,r;let{beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:f,leave:h,leaveFrom:p,leaveTo:v,...b}=e,x=m.useRef(null),y=Il(x,t),_=(n=b.unmount)==null||n?ia.Unmount:ia.Hidden,{show:S,appear:E,initial:C}=Oce(),[$,O]=m.useState(S?"visible":"hidden"),A=$ce(),{register:I,unregister:F}=A;m.useEffect(()=>I(x),[I,x]),m.useEffect(()=>{if(_===ia.Hidden&&x.current){if(S&&$!=="visible"){O("visible");return}return Zn($,{hidden:()=>F(x),visible:()=>I(x)})}},[$,x,I,F,S,_]);let L=Ri({base:js(b.className),enter:js(l),enterFrom:js(c),enterTo:js(u),entered:js(f),leave:js(h),leaveFrom:js(p),leaveTo:js(v)}),B=Ace({beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a}),J=bS();m.useEffect(()=>{if(J&&$==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,$,J]);let q=C&&!E,z=E&&S&&C,ee=!J||q?"idle":S?"enter":"leave",G=_ce(0),Q=Rt(re=>Zn(re,{enter:()=>{G.addFlag(so.Opening),B.current.beforeEnter()},leave:()=>{G.addFlag(so.Closing),B.current.beforeLeave()},idle:()=>{}})),W=Rt(re=>Zn(re,{enter:()=>{G.removeFlag(so.Opening),B.current.afterEnter()},leave:()=>{G.removeFlag(so.Closing),B.current.afterLeave()},idle:()=>{}})),T=LN(()=>{O("hidden"),F(x)},A),H=m.useRef(!1);Rce({immediate:z,container:x,classes:L,direction:ee,onStart:Ri(re=>{H.current=!0,T.onStart(x,re,Q)}),onStop:Ri(re=>{H.current=!1,T.onStop(x,re,W),re==="leave"&&!Ov(T)&&(O("hidden"),F(x))})});let U=b,M={ref:y};return z?U={...U,className:fm(b.className,...L.current.enter,...L.current.enterFrom)}:H.current&&(U.className=fm(b.className,(r=x.current)==null?void 0:r.className),U.className===""&&delete U.className),m.createElement(Pv.Provider,{value:T},m.createElement(AN,{value:Zn($,{visible:so.Open,hidden:so.Closed})|G.flags},bs({ourProps:M,theirProps:U,defaultTag:kce,features:FN,visible:$==="visible",name:"Transition.Child"})))}function Ice(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,s=m.useRef(null),a=Il(s,t);bS();let l=wS();if(n===void 0&&l!==null&&(n=(l&so.Open)===so.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=m.useState(n?"visible":"hidden"),f=LN(()=>{u("hidden")}),[h,p]=m.useState(!0),v=m.useRef([n]);Bn(()=>{h!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);m.useEffect(()=>{if(n)u("visible");else if(!Ov(f))u("hidden");else{let S=s.current;if(!S)return;let E=S.getBoundingClientRect();E.x===0&&E.y===0&&E.width===0&&E.height===0&&u("hidden")}},[n,f]);let x={unmount:o},y=Rt(()=>{var S;h&&p(!1),(S=e.beforeEnter)==null||S.call(e)}),_=Rt(()=>{var S;h&&p(!1),(S=e.beforeLeave)==null||S.call(e)});return m.createElement(Pv.Provider,{value:f},m.createElement(Rv.Provider,{value:b},bs({ourProps:{...x,as:m.Fragment,children:m.createElement(jN,{ref:a,...x,...i,beforeEnter:y,beforeLeave:_})},theirProps:{},defaultTag:m.Fragment,features:FN,visible:c==="visible",name:"Transition"})))}function Nce(e,t){let n=m.useContext(Rv)!==null,r=wS()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement($1,{ref:t,...e}):m.createElement(jN,{ref:t,...e}))}let $1=Ii(Ice),jN=Ii(Mce),Lce=Ii(Nce),Fce=Object.assign($1,{Child:Lce,Root:$1});function jce(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[o,i]=e.split(r);return{operation:r,value:i.trim()}}else return null}function zce(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,o=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return vu.includes(e)?o:r}function Bce({filter:e}){const[t,n]=m.useState([]),[r,o]=m.useState(""),[i,s]=m.useState(""),a=m.useRef(null);ni();const l=Pe(O=>O.filterValues),c=Pe(O=>O.selectedSheetId),u=Pe(O=>O.actions.addOrUpdateFilterValue),f=Pe(O=>O.actions.removeFilterValue),{data:h,isLoading:p,isFetching:v,isError:b,refetch:x}=RN(e),y=m.useMemo(()=>{var O;return(O=h==null?void 0:h.records)==null?void 0:O.map(A=>{let I=e.column.split(".").slice(-1)[0].replace(/"/g,"");return A[I]===void 0&&(I=I.toLowerCase()),{id:A[I],value:A[I]}})},[h,e.column]);m.useEffect(()=>{if(l){const O=l.find(A=>A.filterId===e.id);if(!O){n([]);return}if(O.operation==="in"){const A=y==null?void 0:y.filter(I=>O.values.includes(I.value));A&&n(A)}else o(`${O.operation} ${O.values[0]}`)}},[h,c,l]),m.useEffect(()=>{if(l&&!l.find(A=>A.filterId===e.id)){n([]);return}},[l,e.id]);function _(O){const A=jce(O[0].toString());if(!(A!=null&&A.value)||!(A!=null&&A.operation))return;const I={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:Fg(e),name:e.column,operation:A.operation,values:[Number(A.value)]};u(I)}function S(O){if(Array.isArray(O)||(O=[O]),console.log("onComboBoxChange",O),O.length===1&&y.find(I=>I.value===O[0].value)===void 0){_(O);return}if(n(O),O.length===0){f(e.id);return}const A={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Fg(e),operation:e.operation,values:O.map(I=>I.value)};u(A)}function E(){var O;o(""),f(e.id),console.log(e.id),(O=a.current)==null||O.click()}if(p)return R.jsx("div",{children:R.jsx(Am,{className:"h-8 w-full bg-foreground/10"})});if(b)return R.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"});let C=[];tu.includes(e.dataType)?C=y:C=i===""?y:y==null?void 0:y.filter(O=>O.value.toLowerCase().replace(/\s+/g,"").includes(i.toLowerCase().replace(/\s+/g,"")));const $=e.type==="single";return R.jsx("div",{className:"w-full",children:R.jsx(fc,{value:t,multiple:!$,onChange:S,children:R.jsxs("div",{className:"relative",children:[R.jsxs("div",{className:"relative w-full cursor-default overflow-hidden rounded-sm border bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[R.jsx(fc.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:O=>O.map(I=>I.value).join(", ")||r,onChange:O=>{o(O.target.value),s(O.target.value)}}),R.jsx(fc.Button,{ref:a,className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:R.jsx(_J,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),R.jsx(Fce,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:R.jsxs(fc.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-sm border bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm",children:[tu.includes(e.dataType)&&R.jsxs(fc.Option,{value:r,className:"flex items-center justify-between gap-2 px-3 py-2",children:[R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("span",{className:"font-thin",children:"#"}),R.jsx("span",{children:r})]}),r&&R.jsx(wr,{variant:"link",className:"h-4 w-3 cursor-pointer text-foreground/50 hover:text-foreground/100",onClick:O=>{O.stopPropagation(),E()},children:"Clear"})]},"custom"),(C==null?void 0:C.length)===0&&i!==""?R.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):C==null?void 0:C.map(O=>R.jsx(fc.Option,{className:({active:A})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${A?"bg-muted":"text-foreground-900"}`,value:O,children:({selected:A,active:I})=>R.jsxs("div",{className:"",children:[R.jsx("span",{className:`block ${A?"font-medium":"font-normal"}`,children:typeof O.value=="boolean"?O.value?"True":"False":O.value}),A?R.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:R.jsx(Uk,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},O.value))]})})]})})})}const ES=N.forwardRef(({className:e,...t},n)=>R.jsx("textarea",{className:xe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ES.displayName="Textarea";const zN="Radio",[Vce,BN]=tr(zN),[Hce,Wce]=Vce(zN),Uce=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:i,disabled:s,value:a="on",onCheck:l,...c}=e,[u,f]=m.useState(null),h=St(t,b=>f(b)),p=m.useRef(!1),v=u?!!u.closest("form"):!0;return m.createElement(Hce,{scope:n,checked:o,disabled:s},m.createElement(Qe.button,ce({type:"button",role:"radio","aria-checked":o,"data-state":VN(o),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:h,onClick:Me(e.onClick,b=>{o||l==null||l(),v&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})})),v&&m.createElement(Yce,{control:u,bubbles:!p.current,name:r,value:a,checked:o,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),Gce="RadioIndicator",qce=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,i=Wce(Gce,n);return m.createElement(nr,{present:r||i.checked},m.createElement(Qe.span,ce({"data-state":VN(i.checked),"data-disabled":i.disabled?"":void 0},o,{ref:t})))}),Yce=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=dv(n),a=sv(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",ce({type:"radio","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function VN(e){return e?"checked":"unchecked"}const Kce=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],HN="RadioGroup",[Xce,U1e]=tr(HN,[yu,BN]),WN=yu(),UN=BN(),[Qce,Jce]=Xce(HN),Zce=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:i,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:u=!0,onValueChange:f,...h}=e,p=WN(n),v=$l(c),[b,x]=Sr({prop:i,defaultProp:o,onChange:f});return m.createElement(Qce,{scope:n,name:r,required:s,disabled:a,value:b,onValueChange:x},m.createElement(ww,ce({asChild:!0},p,{orientation:l,dir:v,loop:u}),m.createElement(Qe.div,ce({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:v},h,{ref:t}))))}),eue="RadioGroupItem",tue=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,i=Jce(eue,n),s=i.disabled||r,a=WN(n),l=UN(n),c=m.useRef(null),u=St(t,c),f=i.value===o.value,h=m.useRef(!1);return m.useEffect(()=>{const p=b=>{Kce.includes(b.key)&&(h.current=!0)},v=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),m.createElement(_w,ce({asChild:!0},a,{focusable:!s,active:f}),m.createElement(Uce,ce({disabled:s,required:i.required,checked:f},l,o,{name:i.name,ref:u,onCheck:()=>i.onValueChange(o.value),onKeyDown:Me(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Me(o.onFocus,()=>{var p;h.current&&((p=c.current)===null||p===void 0||p.click())})})))}),nue=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=UN(n);return m.createElement(qce,ce({},o,r,{ref:t}))}),GN=Zce,qN=tue,rue=nue,RS=N.forwardRef(({className:e,...t},n)=>R.jsx(GN,{className:xe("grid gap-2",e),...t,ref:n}));RS.displayName=GN.displayName;const pm=N.forwardRef(({className:e,...t},n)=>R.jsx(qN,{ref:n,className:xe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:R.jsx(rue,{className:"flex items-center justify-center",children:R.jsx(g_,{className:"h-2.5 w-2.5 fill-current text-current"})})}));pm.displayName=qN.displayName;function oue({filter:e}){const[t,n]=m.useState(e.sql),[r,o]=m.useState(!1),{updateFilter:i}=_r();function s(){const c={...e,sql:t};i(c),o(!1)}function a(c){console.log("operation",c);const u={...e,operation:c};i(u)}function l(c){const u={...e,type:c};i(u)}return R.jsxs(yv,{open:r,onOpenChange:o,children:[R.jsx(xv,{children:R.jsx(b_,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),R.jsxs(lh,{onDoubleClick:c=>c.stopPropagation(),className:"m-2 w-full min-w-[350px] space-y-4",children:[R.jsxs("div",{className:"space-y-2",children:[R.jsx("h4",{className:"font-medium leading-none",children:"Customize Filter"}),R.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the filter operation and SQL"})]}),R.jsx(ch,{}),R.jsxs("div",{className:"space-y-2",children:[R.jsx("div",{children:"Type"}),R.jsxs(RS,{onValueChange:l,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[R.jsxs("div",{className:"flex items-center space-x-2",children:[R.jsx(pm,{value:"multiple",id:"r1"}),R.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),R.jsxs("div",{className:"flex items-center space-x-2",children:[R.jsx(pm,{value:"single",id:"r2"}),R.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),R.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{children:"Table Column"}),R.jsx(En,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.column})]}),R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{children:"Data Type"}),R.jsx(En,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.dataType})]}),R.jsxs("div",{className:"col-span-2 space-y-1",children:[R.jsx(En,{className:"text-sm",children:"Filter Operation"}),R.jsx(iue,{updateFilterOperation:a,value:e.operation})]})]}),R.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[R.jsx(En,{className:"text-sm",children:"Values SQL"}),R.jsx(ES,{value:t,onChange:c=>n(c.target.value),className:`min-w-full grow resize font-mono text-xs ${Pd}`})]}),R.jsx("div",{className:"flex justify-end gap-2",children:R.jsxs(wr,{onClick:s,size:"sm",variant:"outline",children:[R.jsx(Jf,{className:"mr-2 size-4"}),"Save SQL"]})})]})]})}function iue({value:e,updateFilterOperation:t}){return R.jsxs(ts,{defaultValue:"in",value:e,onValueChange:n=>t(n),children:[R.jsx(pi,{className:"h-8 w-[180px] focus:ring-0 focus:ring-offset-0",children:R.jsx(ns,{placeholder:"Operation"})}),R.jsxs(gi,{children:[R.jsx(An,{value:"=",children:"Equals"}),R.jsx(An,{value:"in",children:"Contains"}),R.jsx(An,{value:"like",children:"Like"})]})]})}function YN({filter:e}){const t=Pe(i=>i.isDashboardEditing),{removeFilterValue:n,removeFilter:r,updateFilter:o}=_r();return R.jsx(Si,{className:"my-1",text:e.title||e.column,onSave:i=>o({...e,title:i}),children:R.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[R.jsxs("div",{className:"flex grow items-center gap-2",children:[R.jsx(En,{className:"inline-block text-sm",children:e.title}),t&&R.jsx(oue,{filter:e})]}),R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("div",{onClick:()=>n(e.id),className:"invisible cursor-pointer text-xs text-muted-foreground hover:text-foreground hover:underline group-hover:visible",children:R.jsx(m_,{className:"size-3.5"})}),t&&R.jsx(lM,{onClick:()=>{n(e.id),r(e.id)},className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})]})]})})}const sue=AP.WidthProvider(AP.Responsive),PS=e=>vu.includes(e.dataType)?R.jsx(lle,{filter:e}):R.jsx(Bce,{filter:e});function aue(){var C,$;const e=Pe(O=>O.isDashboardEditing);Pe(O=>O.currentBreakpoint);const t=Pe(O=>O.themeStyle);m.useState([]);const n=Pe(O=>O.selectedSheetId);Pe(O=>O.selectedLensId);const r=(C=Pe(O=>{var A,I;return(I=(A=O.dashboard)==null?void 0:A.sheets)==null?void 0:I.filter(F=>F.id===n)}))==null?void 0:C[0].layouts,o=Pe(O=>O.dashboard.filters),i=Pe(O=>{var A,I,F;return(F=(I=(A=O.dashboard)==null?void 0:A.sheets)==null?void 0:I.find(L=>L.id===n))==null?void 0:F.frames}),{getSelectedSheet:s,getSelectedSheetLayout:a,getSelectedSheetLayouts:l,setSheetLayout:c,setSheetLayouts:u,setCurrentBreakpoint:f,removeFilter:h,updateFilter:p,removeFilterValue:v}=Pe(O=>O.actions),b=s(),x=m.useCallback(O=>{f(O)},[f]),y=m.useCallback((O,A)=>{b!=null&&b.id&&u(b.id,A)},[b==null?void 0:b.id,u]);if(!n)return null;const _=(O,A)=>R.jsx(KN,{className:"after:content-none",ref:A,handleAxis:O});function S(){return o==null?void 0:o.map(O=>{var A,I;return O.location==="frame"?null:R.jsxs("div",{style:{borderRadius:(I=(A=t==null?void 0:t.chart)==null?void 0:A.options)==null?void 0:I.borderRadius},className:xe("z-50 flex w-full flex-col rounded-md border bg-background px-3 py-2"),children:[R.jsx(YN,{filter:O}),PS(O)]},O.id)})}function E(){return i==null?void 0:i.map(O=>R.jsx("div",{role:"dashboard-frame-container",className:xe("group overflow-hidden",t==null?void 0:t.dashboardCardContainer),children:R.jsx(yie,{frame:O})},O.id))}return R.jsx(R.Fragment,{children:R.jsxs(sue,{margin:[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],className:xe(($=t==null?void 0:t.gridLayout)==null?void 0:$.className),layouts:r,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:x,onLayoutChange:y,resizeHandle:_,children:[S(),E()]})})}const KN=m.forwardRef(({className:e,handleAxis:t,...n},r)=>(Pe(o=>o.themeStyle),R.jsx("div",{ref:r,className:xe(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne","border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw","border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})));KN.displayName="ResizeHandle";let lue=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r};var Cu={exports:{}};const cue=typeof Buffer<"u",d2=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,f2=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function XN(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),cue&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const o=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(o==="ignore"&&i==="ignore")return r;if(o!=="ignore"&&i!=="ignore"){if(d2.test(e)===!1&&f2.test(e)===!1)return r}else if(o!=="ignore"&&i==="ignore"){if(d2.test(e)===!1)return r}else if(f2.test(e)===!1)return r;return QN(r,{protoAction:o,constructorAction:i,safe:n&&n.safe})}function QN(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let o=[e];for(;o.length;){const i=o;o=[];for(const s of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(const a in s){const l=s[a];l&&typeof l=="object"&&o.push(l)}}}return e}function OS(e,t,n){const r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return XN(e,t,n)}finally{Error.stackTraceLimit=r}}function uue(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return XN(e,t,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=n}}Cu.exports=OS;Cu.exports.default=OS;Cu.exports.parse=OS;Cu.exports.safeParse=uue;Cu.exports.scan=QN;var due=Cu.exports;const h2=Pl(due);var JN=lue("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);function fue(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{n=l,t.pop();break}default:{n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const f=e.substring(r,l+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}function hue(e){if(e!=null)try{return h2.parse(e)}catch{try{const n=fue(e);return h2.parse(n)}catch{}}}var cf={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},uf={code:"1",name:"function_call",parse:e=>{if(e==null||typeof e!="object"||!("function_call"in e)||typeof e.function_call!="object"||e.function_call==null||!("name"in e.function_call)||!("arguments"in e.function_call)||typeof e.function_call.name!="string"||typeof e.function_call.arguments!="string")throw new Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},df={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},ff={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},hf={code:"4",name:"assistant_message",parse:e=>{if(e==null||typeof e!="object"||!("id"in e)||!("role"in e)||!("content"in e)||typeof e.id!="string"||typeof e.role!="string"||e.role!=="assistant"||!Array.isArray(e.content)||!e.content.every(t=>t!=null&&typeof t=="object"&&"type"in t&&t.type==="text"&&"text"in t&&t.text!=null&&typeof t.text=="object"&&"value"in t.text&&typeof t.text.value=="string"))throw new Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},pf={code:"5",name:"assistant_control_data",parse:e=>{if(e==null||typeof e!="object"||!("threadId"in e)||!("messageId"in e)||typeof e.threadId!="string"||typeof e.messageId!="string")throw new Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},gf={code:"6",name:"data_message",parse:e=>{if(e==null||typeof e!="object"||!("role"in e)||!("data"in e)||typeof e.role!="string"||e.role!=="data")throw new Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},mf={code:"7",name:"tool_calls",parse:e=>{if(e==null||typeof e!="object"||!("tool_calls"in e)||typeof e.tool_calls!="object"||e.tool_calls==null||!Array.isArray(e.tool_calls)||e.tool_calls.some(t=>t==null||typeof t!="object"||!("id"in t)||typeof t.id!="string"||!("type"in t)||typeof t.type!="string"||!("function"in t)||t.function==null||typeof t.function!="object"||!("arguments"in t.function)||typeof t.function.name!="string"||typeof t.function.arguments!="string"))throw new Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},vf={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},bf={code:"9",name:"tool_call",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string"||!("args"in e)||typeof e.args!="object")throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},yf={code:"a",name:"tool_result",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},xf={code:"b",name:"tool_call_streaming_start",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string")throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},wf={code:"c",name:"tool_call_delta",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("argsTextDelta"in e)||typeof e.argsTextDelta!="string")throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},_f={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string"||!("usage"in e)||e.usage==null||typeof e.usage!="object"||!("promptTokens"in e.usage)||!("completionTokens"in e.usage))throw new Error('"finish_message" parts expect an object with a "finishReason" and "usage" property.');return typeof e.usage.promptTokens!="number"&&(e.usage.promptTokens=Number.NaN),typeof e.usage.completionTokens!="number"&&(e.usage.completionTokens=Number.NaN),{type:"finish_message",value:e}}},pue=[cf,uf,df,ff,hf,pf,gf,mf,vf,bf,yf,xf,wf,_f],gue={[cf.code]:cf,[uf.code]:uf,[df.code]:df,[ff.code]:ff,[hf.code]:hf,[pf.code]:pf,[gf.code]:gf,[mf.code]:mf,[vf.code]:vf,[bf.code]:bf,[yf.code]:yf,[xf.code]:xf,[wf.code]:wf,[_f.code]:_f};cf.name+"",cf.code,uf.name+"",uf.code,df.name+"",df.code,ff.name+"",ff.code,hf.name+"",hf.code,pf.name+"",pf.code,gf.name+"",gf.code,mf.name+"",mf.code,vf.name+"",vf.code,bf.name+"",bf.code,yf.name+"",yf.code,xf.name+"",xf.code,wf.name+"",wf.code,_f.name+"",_f.code;var mue=pue.map(e=>e.code),ZN=e=>{const t=e.indexOf(":");if(t===-1)throw new Error("Failed to parse stream string. No separator found.");const n=e.slice(0,t);if(!mue.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const r=n,o=e.slice(t+1),i=JSON.parse(o);return gue[r].parse(i)},vue=10;function bue(e,t){const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return e.length=0,n}async function*yue(e,{isAborted:t}={}){const n=new TextDecoder,r=[];let o=0;for(;;){const{value:i}=await e.read();if(i&&(r.push(i),o+=i.length,i[i.length-1]!==vue))continue;if(r.length===0)break;const s=bue(r,o);o=0;const a=n.decode(s,{stream:!0}).split(`
|
|
408
408
|
`).filter(l=>l!=="").map(ZN);for(const l of a)yield l;if(t!=null&&t()){e.cancel();break}}}function eg(e,t){return!e||!t||!t.length?e:{...e,annotations:[...t]}}async function xue({reader:e,abortControllerRef:t,update:n,onToolCall:r,onFinish:o,generateId:i=JN,getCurrentDate:s=()=>new Date}){var a;const l=s(),c={data:[]};let u;const f={};let h={completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},p="unknown";for await(const{type:v,value:b}of yue(e,{isAborted:()=>(t==null?void 0:t.current)===null})){if(v==="text"&&(c.text?c.text={...c.text,content:(c.text.content||"")+b}:c.text={id:i(),role:"assistant",content:b,createdAt:l}),v==="finish_message"){const{completionTokens:E,promptTokens:C}=b.usage;p=b.finishReason,h={completionTokens:E,promptTokens:C,totalTokens:E+C}}if(v==="tool_call_streaming_start")c.text==null&&(c.text={id:i(),role:"assistant",content:"",createdAt:l}),c.text.toolInvocations==null&&(c.text.toolInvocations=[]),f[b.toolCallId]={text:"",toolName:b.toolName,prefixMapIndex:c.text.toolInvocations.length},c.text.toolInvocations.push({state:"partial-call",toolCallId:b.toolCallId,toolName:b.toolName,args:void 0});else if(v==="tool_call_delta"){const E=f[b.toolCallId];E.text+=b.argsTextDelta,c.text.toolInvocations[E.prefixMapIndex]={state:"partial-call",toolCallId:b.toolCallId,toolName:E.toolName,args:hue(E.text)},c.text.internalUpdateId=i()}else if(v==="tool_call"){if(f[b.toolCallId]!=null?c.text.toolInvocations[f[b.toolCallId].prefixMapIndex]={state:"call",...b}:(c.text==null&&(c.text={id:i(),role:"assistant",content:"",createdAt:l}),c.text.toolInvocations==null&&(c.text.toolInvocations=[]),c.text.toolInvocations.push({state:"call",...b})),c.text.internalUpdateId=i(),r){const E=await r({toolCall:b});E!=null&&(c.text.toolInvocations[c.text.toolInvocations.length-1]={state:"result",...b,result:E})}}else if(v==="tool_result"){const E=(a=c.text)==null?void 0:a.toolInvocations;if(E==null)throw new Error("tool_result must be preceded by a tool_call");const C=E.findIndex($=>$.toolCallId===b.toolCallId);if(C===-1)throw new Error("tool_result must be preceded by a tool_call with the same toolCallId");E[C]={...E[C],state:"result",...b}}let x=null;v==="function_call"&&(c.function_call={id:i(),role:"assistant",content:"",function_call:b.function_call,name:b.function_call.name,createdAt:l},x=c.function_call);let y=null;v==="tool_calls"&&(c.tool_calls={id:i(),role:"assistant",content:"",tool_calls:b.tool_calls,createdAt:l},y=c.tool_calls),v==="data"&&c.data.push(...b);let _=c.text;v==="message_annotations"&&(u?u.push(...b):u=[...b],x=eg(c.function_call,u),y=eg(c.tool_calls,u),_=eg(c.text,u)),u!=null&&u.length&&["text","function_call","tool_calls"].forEach(C=>{c[C]&&(c[C].annotations=[...u])});const S=[x,y,_].filter(Boolean).map(E=>({...eg(E,u)}));n(S,[...c.data])}return o==null||o({prefixMap:c,finishReason:p,usage:h}),{messages:[c.text,c.function_call,c.tool_calls].filter(Boolean),data:c.data}}var wue=()=>fetch;async function _ue({api:e,body:t,streamProtocol:n="data",credentials:r,headers:o,abortController:i,restoreMessagesOnFailure:s,onResponse:a,onUpdate:l,onFinish:c,onToolCall:u,generateId:f,fetch:h=wue()}){var p,v;const b=await h(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...o},signal:(p=i==null?void 0:i())==null?void 0:p.signal,credentials:r}).catch(y=>{throw s(),y});if(a)try{await a(b)}catch(y){throw y}if(!b.ok)throw s(),new Error((v=await b.text())!=null?v:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");const x=b.body.getReader();switch(n){case"text":{const y=Sue(),_={id:f(),createdAt:new Date,role:"assistant",content:""};for(;;){const{done:S,value:E}=await x.read();if(S)break;if(_.content+=y(E),l([{..._}],[]),(i==null?void 0:i())===null){x.cancel();break}}return c==null||c(_,{usage:{completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},finishReason:"unknown"}),{messages:[_],data:[]}}case"data":return await xue({reader:x,abortControllerRef:i!=null?{current:i()}:void 0,update:l,onToolCall:u,onFinish({prefixMap:y,finishReason:_,usage:S}){c&&y.text!=null&&c(y.text,{usage:S,finishReason:_})},generateId:f});default:{const y=n;throw new Error(`Unknown stream protocol: ${y}`)}}}function Sue(e){const t=new TextDecoder;return e?function(n){return t.decode(n,{stream:!0}).split(`
|
|
409
409
|
`).filter(o=>o!=="").map(ZN).filter(Boolean)}:function(n){return n?t.decode(n,{stream:!0}):""}}async function Cue({getStreamedResponse:e,experimental_onFunctionCall:t,experimental_onToolCall:n,updateChatRequest:r,getCurrentMessages:o}){for(;;){const i=await e();if("messages"in i){let s=!1;for(const a of i.messages)if(!((a.function_call===void 0||typeof a.function_call=="string")&&(a.tool_calls===void 0||typeof a.tool_calls=="string"))){if(s=!0,t){const l=a.function_call;if(typeof l!="object"){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}const c=await t(o(),l);if(c===void 0){s=!1;break}r(c)}if(n){const l=a.tool_calls;if(!Array.isArray(l)||l.some(u=>typeof u!="object")){console.warn("experimental_onToolCall should not be defined when using tools");continue}const c=await n(o(),l);if(c===void 0){s=!1;break}r(c)}}if(!s)break}else{let s=function(l){for(const c of l.messages){if(c.tool_calls!==void 0)for(const u of c.tool_calls)typeof u=="object"&&u.function.arguments&&typeof u.function.arguments!="string"&&(u.function.arguments=JSON.stringify(u.function.arguments));c.function_call!==void 0&&typeof c.function_call=="object"&&c.function_call.arguments&&typeof c.function_call.arguments!="string"&&(c.function_call.arguments=JSON.stringify(c.function_call.arguments))}};const a=i;if((a.function_call===void 0||typeof a.function_call=="string")&&(a.tool_calls===void 0||typeof a.tool_calls=="string"))break;if(t){const l=a.function_call;if(typeof l!="object"){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}const c=await t(o(),l);if(c===void 0)break;s(c),r(c)}if(n){const l=a.tool_calls;if(typeof l!="object"){console.warn("experimental_onToolCall should not be defined when using functions");continue}const c=await n(o(),l);if(c===void 0)break;s(c),r(c)}}}}var Eue=lw();const sa=()=>{},Nr=sa(),my=Object,jt=e=>e===Nr,xi=e=>typeof e=="function",va=(e,t)=>({...e,...t}),Rue=e=>xi(e.then),tg=new WeakMap;let Pue=0;const Sf=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(my(e)===e&&!r&&n!=RegExp){if(o=tg.get(e),o)return o;if(o=++Pue+"~",tg.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=Sf(e[i])+",";tg.set(e,o)}if(n==my){o="#";const s=my.keys(e).sort();for(;!jt(i=s.pop());)jt(e[i])||(o+=i+":"+Sf(e[i])+",");tg.set(e,o)}}else o=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return o},os=new WeakMap,vy={},ng={},$S="undefined",$v=typeof window!=$S,T1=typeof document!=$S,Oue=()=>$v&&typeof window.requestAnimationFrame!=$S,e5=(e,t)=>{const n=os.get(e);return[()=>!jt(t)&&e.get(t)||vy,r=>{if(!jt(t)){const o=e.get(t);t in ng||(ng[t]=o),n[5](t,va(o,r),o||vy)}},n[6],()=>!jt(t)&&t in ng?ng[t]:!jt(t)&&e.get(t)||vy]};let D1=!0;const $ue=()=>D1,[A1,k1]=$v&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[sa,sa],Tue=()=>{const e=T1&&document.visibilityState;return jt(e)||e!=="hidden"},Due=e=>(T1&&document.addEventListener("visibilitychange",e),A1("focus",e),()=>{T1&&document.removeEventListener("visibilitychange",e),k1("focus",e)}),Aue=e=>{const t=()=>{D1=!0,e()},n=()=>{D1=!1};return A1("online",t),A1("offline",n),()=>{k1("online",t),k1("offline",n)}},kue={isOnline:$ue,isVisible:Tue},Mue={initFocus:Due,initReconnect:Aue},p2=!m.useId,Cf=!$v||"Deno"in window,Iue=e=>Oue()?window.requestAnimationFrame(e):setTimeout(e,1),by=Cf?m.useEffect:m.useLayoutEffect,yy=typeof navigator<"u"&&navigator.connection,g2=!Cf&&yy&&(["slow-2g","2g"].includes(yy.effectiveType)||yy.saveData),TS=e=>{if(xi(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Sf(e):"",[e,t]};let Nue=0;const M1=()=>++Nue,t5=0,n5=1,r5=2,Lue=3;var hd={__proto__:null,ERROR_REVALIDATE_EVENT:Lue,FOCUS_EVENT:t5,MUTATE_EVENT:r5,RECONNECT_EVENT:n5};async function o5(...e){const[t,n,r,o]=e,i=va({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let s=i.populateCache;const a=i.rollbackOnError;let l=i.optimisticData;const c=h=>typeof a=="function"?a(h):a!==!1,u=i.throwOnError;if(xi(n)){const h=n,p=[],v=t.keys();for(const b of v)!/^\$(inf|sub)\$/.test(b)&&h(t.get(b)._k)&&p.push(b);return Promise.all(p.map(f))}return f(n);async function f(h){const[p]=TS(h);if(!p)return;const[v,b]=e5(t,p),[x,y,_,S]=os.get(t),E=()=>{const J=x[p];return(xi(i.revalidate)?i.revalidate(v().data,h):i.revalidate!==!1)&&(delete _[p],delete S[p],J&&J[0])?J[0](r5).then(()=>v().data):v().data};if(e.length<3)return E();let C=r,$;const O=M1();y[p]=[O,0];const A=!jt(l),I=v(),F=I.data,L=I._c,B=jt(L)?F:L;if(A&&(l=xi(l)?l(B,F):l,b({data:l,_c:B})),xi(C))try{C=C(B)}catch(J){$=J}if(C&&Rue(C))if(C=await C.catch(J=>{$=J}),O!==y[p][0]){if($)throw $;return C}else $&&A&&c($)&&(s=!0,b({data:B,_c:Nr}));if(s&&!$)if(xi(s)){const J=s(C,B);b({data:J,error:Nr,_c:Nr})}else b({data:C,error:Nr,_c:Nr});if(y[p][1]=M1(),Promise.resolve(E()).then(()=>{b({_c:Nr})}),$){if(u)throw $;return}return C}}const m2=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Fue=(e,t)=>{if(!os.has(e)){const n=va(Mue,t),r={},o=o5.bind(Nr,e);let i=sa;const s={},a=(u,f)=>{const h=s[u]||[];return s[u]=h,h.push(f),()=>h.splice(h.indexOf(f),1)},l=(u,f,h)=>{e.set(u,f);const p=s[u];if(p)for(const v of p)v(f,h)},c=()=>{if(!os.has(e)&&(os.set(e,[r,{},{},{},o,l,a]),!Cf)){const u=n.initFocus(setTimeout.bind(Nr,m2.bind(Nr,r,t5))),f=n.initReconnect(setTimeout.bind(Nr,m2.bind(Nr,r,n5)));i=()=>{u&&u(),f&&f(),os.delete(e)}}};return c(),[e,o,c,i]}return[e,os.get(e)[4]]},jue=(e,t,n,r,o)=>{const i=n.errorRetryCount,s=o.retryCount,a=~~((Math.random()+.5)*(1<<(s<8?s:8)))*n.errorRetryInterval;!jt(i)&&s>i||setTimeout(r,a,o)},zue=(e,t)=>Sf(e)==Sf(t),[i5,Bue]=Fue(new Map),Vue=va({onLoadingSlow:sa,onSuccess:sa,onError:sa,onErrorRetry:jue,onDiscarded:sa,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:g2?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:g2?5e3:3e3,compare:zue,isPaused:()=>!1,cache:i5,mutate:Bue,fallback:{}},kue),Hue=(e,t)=>{const n=va(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:s}=t;r&&i&&(n.use=r.concat(i)),o&&s&&(n.fallback=va(o,s))}return n},Wue=m.createContext({}),Uue="$inf$",s5=$v&&window.__SWR_DEVTOOLS_USE__,Gue=s5?window.__SWR_DEVTOOLS_USE__:[],que=()=>{s5&&(window.__SWR_DEVTOOLS_REACT__=m)},Yue=e=>xi(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Kue=()=>va(Vue,m.useContext(Wue)),Xue=e=>(t,n,r)=>e(t,n&&((...i)=>{const[s]=TS(t),[,,,a]=os.get(i5);if(s.startsWith(Uue))return n(...i);const l=a[s];return jt(l)?n(...i):(delete a[s],l)}),r),Que=Gue.concat(Xue),Jue=e=>function(...n){const r=Kue(),[o,i,s]=Yue(n),a=Hue(r,s);let l=e;const{use:c}=a,u=(c||[]).concat(Que);for(let f=u.length;f--;)l=u[f](l);return l(o,i||a.fetcher||null,a)},Zue=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};que();const v2=m.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),xy={dedupe:!0},ede=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:s,revalidateOnMount:a,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:u,refreshWhenOffline:f,keepPreviousData:h}=n,[p,v,b,x]=os.get(r),[y,_]=TS(e),S=m.useRef(!1),E=m.useRef(!1),C=m.useRef(y),$=m.useRef(t),O=m.useRef(n),A=()=>O.current,I=()=>A().isVisible()&&A().isOnline(),[F,L,B,J]=e5(r,y),q=m.useRef({}).current,z=jt(s)?n.fallback[y]:s,ee=(X,be)=>{for(const Se in q){const $e=Se;if($e==="data"){if(!o(X[$e],be[$e])&&(!jt(X[$e])||!o(ue,be[$e])))return!1}else if(be[$e]!==X[$e])return!1}return!0},G=m.useMemo(()=>{const X=!y||!t?!1:jt(a)?A().isPaused()||i?!1:jt(l)?!0:l:a,be=Ie=>{const Ke=va(Ie);return delete Ke._k,X?{isValidating:!0,isLoading:!0,...Ke}:Ke},Se=F(),$e=J(),Te=be(Se),Ue=Se===$e?Te:be($e);let Be=Te;return[()=>{const Ie=be(F());return ee(Ie,Be)?(Be.data=Ie.data,Be.isLoading=Ie.isLoading,Be.isValidating=Ie.isValidating,Be.error=Ie.error,Be):(Be=Ie,Ie)},()=>Ue]},[r,y]),Q=Eue.useSyncExternalStore(m.useCallback(X=>B(y,(be,Se)=>{ee(Se,be)||X()}),[r,y]),G[0],G[1]),W=!S.current,T=p[y]&&p[y].length>0,H=Q.data,U=jt(H)?z:H,M=Q.error,re=m.useRef(U),ue=h?jt(H)?re.current:H:U,de=T&&!jt(M)?!1:W&&!jt(a)?a:A().isPaused()?!1:i?jt(U)?!1:l:jt(U)||l,pe=!!(y&&t&&W&&de),Z=jt(Q.isValidating)?pe:Q.isValidating,te=jt(Q.isLoading)?pe:Q.isLoading,ie=m.useCallback(async X=>{const be=$.current;if(!y||!be||E.current||A().isPaused())return!1;let Se,$e,Te=!0;const Ue=X||{},Be=!b[y]||!Ue.dedupe,Ie=()=>p2?!E.current&&y===C.current&&S.current:y===C.current,Ke={isValidating:!1,isLoading:!1},lt=()=>{L(Ke)},Nt=()=>{const Wt=b[y];Wt&&Wt[1]===$e&&delete b[y]},At={isValidating:!0};jt(F().data)&&(At.isLoading=!0);try{if(Be&&(L(At),n.loadingTimeout&&jt(F().data)&&setTimeout(()=>{Te&&Ie()&&A().onLoadingSlow(y,n)},n.loadingTimeout),b[y]=[be(_),M1()]),[Se,$e]=b[y],Se=await Se,Be&&setTimeout(Nt,n.dedupingInterval),!b[y]||b[y][1]!==$e)return Be&&Ie()&&A().onDiscarded(y),!1;Ke.error=Nr;const Wt=v[y];if(!jt(Wt)&&($e<=Wt[0]||$e<=Wt[1]||Wt[1]===0))return lt(),Be&&Ie()&&A().onDiscarded(y),!1;const he=F().data;Ke.data=o(he,Se)?he:Se,Be&&Ie()&&A().onSuccess(Se,y,n)}catch(Wt){Nt();const he=A(),{shouldRetryOnError:Ee}=he;he.isPaused()||(Ke.error=Wt,Be&&Ie()&&(he.onError(Wt,y,he),(Ee===!0||xi(Ee)&&Ee(Wt))&&(!A().revalidateOnFocus||!A().revalidateOnReconnect||I())&&he.onErrorRetry(Wt,y,he,Le=>{const qe=p[y];qe&&qe[0]&&qe[0](hd.ERROR_REVALIDATE_EVENT,Le)},{retryCount:(Ue.retryCount||0)+1,dedupe:!0})))}return Te=!1,lt(),!0},[y,r]),me=m.useCallback((...X)=>o5(r,C.current,...X),[]);if(by(()=>{$.current=t,O.current=n,jt(H)||(re.current=H)}),by(()=>{if(!y)return;const X=ie.bind(Nr,xy);let be=0;const $e=Zue(y,p,(Te,Ue={})=>{if(Te==hd.FOCUS_EVENT){const Be=Date.now();A().revalidateOnFocus&&Be>be&&I()&&(be=Be+A().focusThrottleInterval,X())}else if(Te==hd.RECONNECT_EVENT)A().revalidateOnReconnect&&I()&&X();else{if(Te==hd.MUTATE_EVENT)return ie();if(Te==hd.ERROR_REVALIDATE_EVENT)return ie(Ue)}});return E.current=!1,C.current=y,S.current=!0,L({_k:_}),de&&(jt(U)||Cf?X():Iue(X)),()=>{E.current=!0,$e()}},[y]),by(()=>{let X;function be(){const $e=xi(c)?c(F().data):c;$e&&X!==-1&&(X=setTimeout(Se,$e))}function Se(){!F().error&&(u||A().isVisible())&&(f||A().isOnline())?ie(xy).then(be):be()}return be(),()=>{X&&(clearTimeout(X),X=-1)}},[c,u,f,y]),m.useDebugValue(ue),i&&jt(U)&&y){if(!p2&&Cf)throw new Error("Fallback data is required when using suspense in SSR.");$.current=t,O.current=n,E.current=!1;const X=x[y];if(!jt(X)){const be=me(X);v2(be)}if(jt(M)){const be=ie(xy);jt(ue)||(be.status="fulfilled",be.value=!0),v2(be)}else throw M}return{mutate:me,get data(){return q.data=!0,ue},get error(){return q.error=!0,M},get isValidating(){return q.isValidating=!0,Z},get isLoading(){return q.isLoading=!0,te}}},rg=Jue(ede);var tde=async(e,t,n,r,o,i,s,a,l,c,u,f,h,p,v,b,x)=>{var y;const _=s.current;n(t.messages,!1);const S=p?t.messages:t.messages.map(({role:E,content:C,experimental_attachments:$,name:O,data:A,annotations:I,toolInvocations:F,function_call:L,tool_calls:B,tool_call_id:J})=>({role:E,content:C,...$!==void 0&&{experimental_attachments:$},...O!==void 0&&{name:O},...A!==void 0&&{data:A},...I!==void 0&&{annotations:I},...F!==void 0&&{toolInvocations:F},tool_call_id:J,...L!==void 0&&{function_call:L},...B!==void 0&&{tool_calls:B}}));return await _ue({api:e,body:(y=v==null?void 0:v({messages:t.messages,requestData:t.data,requestBody:t.body}))!=null?y:{messages:S,data:t.data,...i.current.body,...t.body,...t.functions!==void 0&&{functions:t.functions},...t.function_call!==void 0&&{function_call:t.function_call},...t.tools!==void 0&&{tools:t.tools},...t.tool_choice!==void 0&&{tool_choice:t.tool_choice}},streamProtocol:c,credentials:i.current.credentials,headers:{...i.current.headers,...t.headers},abortController:()=>a.current,restoreMessagesOnFailure(){x||n(_,!1)},onResponse:f,onUpdate(E,C){n([...t.messages,...E],!1),r([...o||[],...C||[]],!1)},onToolCall:h,onFinish:u,generateId:l,fetch:b})};function nde({api:e="/api/chat",id:t,initialMessages:n,initialInput:r="",sendExtraMessageFields:o,experimental_onFunctionCall:i,experimental_onToolCall:s,onToolCall:a,experimental_prepareRequestBody:l,experimental_maxAutomaticRoundtrips:c=0,maxAutomaticRoundtrips:u=c,maxToolRoundtrips:f=u,streamMode:h,streamProtocol:p,onResponse:v,onFinish:b,onError:x,credentials:y,headers:_,body:S,generateId:E=JN,fetch:C,keepLastMessageOnError:$=!1}={}){h&&(p??(p=h==="text"?"text":void 0));const O=m.useId(),A=t??O,I=typeof e=="string"?[e,A]:A,[F]=m.useState([]),{data:L,mutate:B}=rg([I,"messages"],null,{fallbackData:n??F}),{data:J=!1,mutate:q}=rg([I,"loading"],null),{data:z,mutate:ee}=rg([I,"streamData"],null),{data:G=void 0,mutate:Q}=rg([I,"error"],null),W=m.useRef(L||[]);m.useEffect(()=>{W.current=L||[]},[L]);const T=m.useRef(null),H=m.useRef({credentials:y,headers:_,body:S});m.useEffect(()=>{H.current={credentials:y,headers:_,body:S}},[y,_,S]);const U=m.useCallback(async X=>{const be=W.current.length;try{q(!0),Q(void 0);const Te=new AbortController;T.current=Te,await Cue({getStreamedResponse:()=>tde(e,X,B,ee,z,H,W,T,E,p,b,v,a,o,l,C,$),experimental_onFunctionCall:i,experimental_onToolCall:s,updateChatRequest:Ue=>{X=Ue},getCurrentMessages:()=>W.current}),T.current=null}catch(Te){if(Te.name==="AbortError")return T.current=null,null;x&&Te instanceof Error&&x(Te),Q(Te)}finally{q(!1)}const Se=W.current,$e=Se[Se.length-1];Se.length>be&&$e!=null&&f>0&&b2($e)&&rde(Se)<=f&&await U({messages:Se})},[B,q,e,H,v,b,x,Q,ee,z,p,o,i,s,l,a,f,W,T,E,C,$]),M=m.useCallback(async(X,{options:be,functions:Se,function_call:$e,tools:Te,tool_choice:Ue,data:Be,headers:Ie,body:Ke}={})=>{X.id||(X.id=E());const lt={headers:Ie??(be==null?void 0:be.headers),body:Ke??(be==null?void 0:be.body)},Nt={messages:W.current.concat(X),options:lt,headers:lt.headers,body:lt.body,data:Be,...Se!==void 0&&{functions:Se},...$e!==void 0&&{function_call:$e},...Te!==void 0&&{tools:Te},...Ue!==void 0&&{tool_choice:Ue}};return U(Nt)},[U,E]),re=m.useCallback(async({options:X,functions:be,function_call:Se,tools:$e,tool_choice:Te,data:Ue,headers:Be,body:Ie}={})=>{if(W.current.length===0)return null;const Ke={headers:Be??(X==null?void 0:X.headers),body:Ie??(X==null?void 0:X.body)};if(W.current[W.current.length-1].role==="assistant"){const At={messages:W.current.slice(0,-1),options:Ke,headers:Ke.headers,body:Ke.body,data:Ue,...be!==void 0&&{functions:be},...Se!==void 0&&{function_call:Se},...$e!==void 0&&{tools:$e},...Te!==void 0&&{tool_choice:Te}};return U(At)}const Nt={messages:W.current,options:Ke,headers:Ke.headers,body:Ke.body,data:Ue,...be!==void 0&&{functions:be},...Se!==void 0&&{function_call:Se},...$e!==void 0&&{tools:$e},...Te!==void 0&&{tool_choice:Te}};return U(Nt)},[U]),ue=m.useCallback(()=>{T.current&&(T.current.abort(),T.current=null)},[]),de=m.useCallback(X=>{typeof X=="function"&&(X=X(W.current)),B(X,!1),W.current=X},[B]),[pe,Z]=m.useState(r),te=m.useCallback(async(X,be={},Se)=>{var $e,Te,Ue,Be,Ie;if(($e=X==null?void 0:X.preventDefault)==null||$e.call(X),!pe&&!be.allowEmptySubmit)return;Se&&(H.current={...H.current,...Se});const Ke=[],lt=be.experimental_attachments;if(lt)if(lt instanceof FileList)for(const he of Array.from(lt)){const{name:Ee,type:Le}=he,qe=await new Promise((Ze,Ut)=>{const en=new FileReader;en.onload=Xt=>{var vn;Ze((vn=Xt.target)==null?void 0:vn.result)},en.onerror=Xt=>Ut(Xt),en.readAsDataURL(he)});Ke.push({name:Ee,contentType:Le,url:qe})}else if(Array.isArray(lt))for(const he of lt){const{name:Ee,url:Le,contentType:qe}=he;Ke.push({name:Ee,contentType:qe,url:Le})}else throw new Error("Invalid attachments type");const Nt={headers:(Ue=be.headers)!=null?Ue:(Te=be.options)==null?void 0:Te.headers,body:(Ie=be.body)!=null?Ie:(Be=be.options)==null?void 0:Be.body},Wt={messages:!pe&&be.allowEmptySubmit?W.current:W.current.concat({id:E(),createdAt:new Date,role:"user",content:pe,experimental_attachments:Ke.length>0?Ke:void 0}),options:Nt,headers:Nt.headers,body:Nt.body,data:be.data};U(Wt),Z("")},[pe,E,U]),ie=X=>{Z(X.target.value)},me=({toolCallId:X,result:be})=>{const Se=W.current.map((Te,Ue,Be)=>Ue===Be.length-1&&Te.role==="assistant"&&Te.toolInvocations?{...Te,toolInvocations:Te.toolInvocations.map(Ie=>Ie.toolCallId===X?{...Ie,result:be}:Ie)}:Te);B(Se,!1);const $e=Se[Se.length-1];b2($e)&&U({messages:Se})};return{messages:L||[],error:G,append:M,reload:re,stop:ue,setMessages:de,input:pe,setInput:Z,handleInputChange:ie,handleSubmit:te,isLoading:J,data:z,addToolResult:me,experimental_addToolResult:me}}function b2(e){return e.role==="assistant"&&e.toolInvocations&&e.toolInvocations.length>0&&e.toolInvocations.every(t=>"result"in t)}function rde(e){let t=0;for(let n=e.length-1;n>=0&&e[n].role==="assistant";n--)t++;return t}const a5="Switch",[ode,G1e]=tr(a5),[ide,sde]=ode(a5),ade=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),p=St(t,_=>h(_)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,y]=Sr({prop:o,defaultProp:i,onChange:c});return m.createElement(ide,{scope:n,checked:x,disabled:a},m.createElement(Qe.button,ce({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":l5(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:p,onClick:Me(e.onClick,_=>{y(S=>!S),b&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})),b&&m.createElement(ude,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),lde="SwitchThumb",cde=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=sde(lde,n);return m.createElement(Qe.span,ce({"data-state":l5(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),ude=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=dv(n),a=sv(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",ce({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function l5(e){return e?"checked":"unchecked"}const Tv=ade,c5=cde,u5=N.forwardRef(({className:e,...t},n)=>R.jsx(Tv,{className:xe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:R.jsx(c5,{className:xe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));u5.displayName=Tv.displayName;const dde=N.forwardRef(({className:e,...t},n)=>R.jsx(Tv,{className:xe("peer inline-flex h-4 w-8 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:R.jsx(c5,{className:xe("pointer-events-none block h-3 w-3 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));dde.displayName=Tv.displayName;function fde(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const hde=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pde=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gde={};function y2(e,t){return((t||gde).jsx?pde:hde).test(e)}const mde=/[ \t\n\f\r]/g;function vde(e){return typeof e=="object"?e.type==="text"?x2(e.value):!1:x2(e)}function x2(e){return e.replace(mde,"")===""}class vh{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}}vh.prototype.property={};vh.prototype.normal={};vh.prototype.space=null;function d5(e,t){const n={},r={};let o=-1;for(;++o<e.length;)Object.assign(n,e[o].property),Object.assign(r,e[o].normal);return new vh(n,r,t)}function I1(e){return e.toLowerCase()}class Lo{constructor(t,n){this.property=t,this.attribute=n}}Lo.prototype.space=null;Lo.prototype.boolean=!1;Lo.prototype.booleanish=!1;Lo.prototype.overloadedBoolean=!1;Lo.prototype.number=!1;Lo.prototype.commaSeparated=!1;Lo.prototype.spaceSeparated=!1;Lo.prototype.commaOrSpaceSeparated=!1;Lo.prototype.mustUseProperty=!1;Lo.prototype.defined=!1;let bde=0;const vt=Ll(),Mn=Ll(),f5=Ll(),De=Ll(),sn=Ll(),kc=Ll(),Xr=Ll();function Ll(){return 2**++bde}const N1=Object.freeze(Object.defineProperty({__proto__:null,boolean:vt,booleanish:Mn,commaOrSpaceSeparated:Xr,commaSeparated:kc,number:De,overloadedBoolean:f5,spaceSeparated:sn},Symbol.toStringTag,{value:"Module"})),wy=Object.keys(N1);class DS extends Lo{constructor(t,n,r,o){let i=-1;if(super(t,n),w2(this,"space",o),typeof r=="number")for(;++i<wy.length;){const s=wy[i];w2(this,wy[i],(r&N1[s])===N1[s])}}}DS.prototype.defined=!0;function w2(e,t,n){n&&(e[t]=n)}const yde={}.hasOwnProperty;function Eu(e){const t={},n={};let r;for(r in e.properties)if(yde.call(e.properties,r)){const o=e.properties[r],i=new DS(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[I1(r)]=r,n[I1(i.attribute)]=r}return new vh(t,n,e.space)}const h5=Eu({space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),p5=Eu({space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function g5(e,t){return t in e?e[t]:t}function m5(e,t){return g5(e,t.toLowerCase())}const v5=Eu({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:m5,properties:{xmlns:null,xmlnsXLink:null}}),b5=Eu({transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Mn,ariaAutoComplete:null,ariaBusy:Mn,ariaChecked:Mn,ariaColCount:De,ariaColIndex:De,ariaColSpan:De,ariaControls:sn,ariaCurrent:null,ariaDescribedBy:sn,ariaDetails:null,ariaDisabled:Mn,ariaDropEffect:sn,ariaErrorMessage:null,ariaExpanded:Mn,ariaFlowTo:sn,ariaGrabbed:Mn,ariaHasPopup:null,ariaHidden:Mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:sn,ariaLevel:De,ariaLive:null,ariaModal:Mn,ariaMultiLine:Mn,ariaMultiSelectable:Mn,ariaOrientation:null,ariaOwns:sn,ariaPlaceholder:null,ariaPosInSet:De,ariaPressed:Mn,ariaReadOnly:Mn,ariaRelevant:null,ariaRequired:Mn,ariaRoleDescription:sn,ariaRowCount:De,ariaRowIndex:De,ariaRowSpan:De,ariaSelected:Mn,ariaSetSize:De,ariaSort:null,ariaValueMax:De,ariaValueMin:De,ariaValueNow:De,ariaValueText:null,role:null}}),xde=Eu({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:m5,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kc,acceptCharset:sn,accessKey:sn,action:null,allow:null,allowFullScreen:vt,allowPaymentRequest:vt,allowUserMedia:vt,alt:null,as:null,async:vt,autoCapitalize:null,autoComplete:sn,autoFocus:vt,autoPlay:vt,blocking:sn,capture:null,charSet:null,checked:vt,cite:null,className:sn,cols:De,colSpan:null,content:null,contentEditable:Mn,controls:vt,controlsList:sn,coords:De|kc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vt,defer:vt,dir:null,dirName:null,disabled:vt,download:f5,draggable:Mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vt,formTarget:null,headers:sn,height:De,hidden:vt,high:De,href:null,hrefLang:null,htmlFor:sn,httpEquiv:sn,id:null,imageSizes:null,imageSrcSet:null,inert:vt,inputMode:null,integrity:null,is:null,isMap:vt,itemId:null,itemProp:sn,itemRef:sn,itemScope:vt,itemType:sn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vt,low:De,manifest:null,max:null,maxLength:De,media:null,method:null,min:null,minLength:De,multiple:vt,muted:vt,name:null,nonce:null,noModule:vt,noValidate:vt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:vt,optimum:De,pattern:null,ping:sn,placeholder:null,playsInline:vt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vt,referrerPolicy:null,rel:sn,required:vt,reversed:vt,rows:De,rowSpan:De,sandbox:sn,scope:null,scoped:vt,seamless:vt,selected:vt,shadowRootDelegatesFocus:vt,shadowRootMode:null,shape:null,size:De,sizes:null,slot:null,span:De,spellCheck:Mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:De,step:null,style:null,tabIndex:De,target:null,title:null,translate:null,type:null,typeMustMatch:vt,useMap:null,value:Mn,width:De,wrap:null,align:null,aLink:null,archive:sn,axis:null,background:null,bgColor:null,border:De,borderColor:null,bottomMargin:De,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vt,declare:vt,event:null,face:null,frame:null,frameBorder:null,hSpace:De,leftMargin:De,link:null,longDesc:null,lowSrc:null,marginHeight:De,marginWidth:De,noResize:vt,noHref:vt,noShade:vt,noWrap:vt,object:null,profile:null,prompt:null,rev:null,rightMargin:De,rules:null,scheme:null,scrolling:Mn,standby:null,summary:null,text:null,topMargin:De,valueType:null,version:null,vAlign:null,vLink:null,vSpace:De,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vt,disableRemotePlayback:vt,prefix:null,property:null,results:De,security:null,unselectable:null}}),wde=Eu({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:g5,properties:{about:Xr,accentHeight:De,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:De,amplitude:De,arabicForm:null,ascent:De,attributeName:null,attributeType:null,azimuth:De,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:De,by:null,calcMode:null,capHeight:De,className:sn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:De,diffuseConstant:De,direction:null,display:null,dur:null,divisor:De,dominantBaseline:null,download:vt,dx:null,dy:null,edgeMode:null,editable:null,elevation:De,enableBackground:null,end:null,event:null,exponent:De,externalResourcesRequired:null,fill:null,fillOpacity:De,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kc,g2:kc,glyphName:kc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:De,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:De,horizOriginX:De,horizOriginY:De,id:null,ideographic:De,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:De,k:De,k1:De,k2:De,k3:De,k4:De,kernelMatrix:Xr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:De,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:De,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:De,overlineThickness:De,paintOrder:null,panose1:null,path:null,pathLength:De,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:sn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:De,pointsAtY:De,pointsAtZ:De,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xr,rev:Xr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xr,requiredFeatures:Xr,requiredFonts:Xr,requiredFormats:Xr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:De,specularExponent:De,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:De,strikethroughThickness:De,string:null,stroke:null,strokeDashArray:Xr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:De,strokeOpacity:De,strokeWidth:null,style:null,surfaceScale:De,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xr,tabIndex:De,tableValues:null,target:null,targetX:De,targetY:De,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:De,underlineThickness:De,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:De,values:null,vAlphabetic:De,vMathematical:De,vectorEffect:null,vHanging:De,vIdeographic:De,version:null,vertAdvY:De,vertOriginX:De,vertOriginY:De,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:De,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),_de=/^data[-\w.:]+$/i,_2=/-[a-z]/g,Sde=/[A-Z]/g;function Cde(e,t){const n=I1(t);let r=t,o=Lo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_de.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(_2,Rde);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!_2.test(i)){let s=i.replace(Sde,Ede);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=DS}return new o(r,t)}function Ede(e){return"-"+e.toLowerCase()}function Rde(e){return e.charAt(1).toUpperCase()}const Pde={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ode=d5([p5,h5,v5,b5,xde],"html"),AS=d5([p5,h5,v5,b5,wde],"svg");function $de(e){return e.join(" ").trim()}var y5={},S2=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Tde=/\n/g,Dde=/^\s*/,Ade=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,kde=/^:\s*/,Mde=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ide=/^[;\s]*/,Nde=/^\s+|\s+$/g,Lde=`
|
|
410
410
|
`,C2="/",E2="*",Ya="",Fde="comment",jde="declaration",zde=function(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(v){var b=v.match(Tde);b&&(n+=b.length);var x=v.lastIndexOf(Lde);r=~x?v.length-x:r+v.length}function i(){var v={line:n,column:r};return function(b){return b.position=new s(v),c(),b}}function s(v){this.start=v,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(v){var b=new Error(t.source+":"+n+":"+r+": "+v);if(b.reason=v,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(v){var b=v.exec(e);if(b){var x=b[0];return o(x),e=e.slice(x.length),b}}function c(){l(Dde)}function u(v){var b;for(v=v||[];b=f();)b!==!1&&v.push(b);return v}function f(){var v=i();if(!(C2!=e.charAt(0)||E2!=e.charAt(1))){for(var b=2;Ya!=e.charAt(b)&&(E2!=e.charAt(b)||C2!=e.charAt(b+1));)++b;if(b+=2,Ya===e.charAt(b-1))return a("End of comment missing");var x=e.slice(2,b-2);return r+=2,o(x),e=e.slice(b),r+=2,v({type:Fde,comment:x})}}function h(){var v=i(),b=l(Ade);if(b){if(f(),!l(kde))return a("property missing ':'");var x=l(Mde),y=v({type:jde,property:R2(b[0].replace(S2,Ya)),value:x?R2(x[0].replace(S2,Ya)):Ya});return l(Ide),y}}function p(){var v=[];u(v);for(var b;b=h();)b!==!1&&(v.push(b),u(v));return v}return c(),p()};function R2(e){return e?e.replace(Nde,Ya):Ya}var Bde=Gs&&Gs.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y5,"__esModule",{value:!0});var Vde=Bde(zde);function Hde(e,t){var n=null;if(!e||typeof e!="string")return n;var r=(0,Vde.default)(e),o=typeof t=="function";return r.forEach(function(i){if(i.type==="declaration"){var s=i.property,a=i.value;o?t(s,a,i):a&&(n=n||{},n[s]=a)}}),n}var P2=y5.default=Hde;const Wde=P2.default||P2,x5=w5("end"),kS=w5("start");function w5(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Ude(e){const t=kS(e),n=x5(e);if(t&&n)return{start:t,end:n}}function jd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?O2(e.position):"start"in e||"end"in e?O2(e):"line"in e||"column"in e?L1(e):""}function L1(e){return $2(e&&e.line)+":"+$2(e&&e.column)}function O2(e){return L1(e&&e.start)+"-"+L1(e&&e.end)}function $2(e){return e&&typeof e=="number"?e:1}class fr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=o,this.line=a?a.line:void 0,this.name=jd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}fr.prototype.file="";fr.prototype.name="";fr.prototype.reason="";fr.prototype.message="";fr.prototype.stack="";fr.prototype.column=void 0;fr.prototype.line=void 0;fr.prototype.ancestors=void 0;fr.prototype.cause=void 0;fr.prototype.fatal=void 0;fr.prototype.place=void 0;fr.prototype.ruleId=void 0;fr.prototype.source=void 0;const MS={}.hasOwnProperty,Gde=new Map,qde=/[A-Z]/g,Yde=/-([a-z])/g,Kde=new Set(["table","tbody","thead","tfoot","tr"]),Xde=new Set(["td","th"]),_5="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Qde(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ife(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ofe(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?AS:Ode,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=S5(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function S5(e,t,n){if(t.type==="element")return Jde(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Zde(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tfe(e,t,n);if(t.type==="mdxjsEsm")return efe(e,t);if(t.type==="root")return nfe(e,t,n);if(t.type==="text")return rfe(e,t)}function Jde(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=AS,e.schema=o),e.ancestors.push(t);const i=E5(e,t.tagName,!1),s=sfe(e,t);let a=NS(e,t);return Kde.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!vde(l):!0})),C5(e,s,i,t),IS(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function Zde(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ef(e,t.position)}function efe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ef(e,t.position)}function tfe(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=AS,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:E5(e,t.name,!0),s=afe(e,t),a=NS(e,t);return C5(e,s,i,t),IS(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function nfe(e,t,n){const r={};return IS(r,NS(e,t)),e.create(t,e.Fragment,r,n)}function rfe(e,t){return t.value}function C5(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function IS(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ofe(e,t,n){return r;function r(o,i,s,a){const c=Array.isArray(s.children)?n:t;return a?c(i,s,a):c(i,s)}}function ife(e,t){return n;function n(r,o,i,s){const a=Array.isArray(i.children),l=kS(r);return t(o,i,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function sfe(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&MS.call(t.properties,o)){const i=lfe(e,o,t.properties[o]);if(i){const[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&Xde.has(t.tagName)?r=a:n[s]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function afe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ef(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else Ef(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function NS(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:Gde;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=o.get(l)||0;s=l+"-"+c,o.set(l,c+1)}}const a=S5(e,i,s);a!==void 0&&n.push(a)}return n}function lfe(e,t,n){const r=Cde(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?fde(n):$de(n)),r.property==="style"){let o=typeof n=="object"?n:cfe(e,String(n));return e.stylePropertyNameCase==="css"&&(o=ufe(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?Pde[r.property]||r.property:r.attribute,n]}}function cfe(e,t){const n={};try{Wde(t,r)}catch(o){if(!e.ignoreInvalidStyle){const i=o,s=new fr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=_5+"#cannot-parse-style-attribute",s}}return n;function r(o,i){let s=o;s.slice(0,2)!=="--"&&(s.slice(0,4)==="-ms-"&&(s="ms-"+s.slice(4)),s=s.replace(Yde,ffe)),n[s]=i}}function E5(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,s;for(;++i<o.length;){const a=y2(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=s}else r=y2(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return MS.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ef(e)}function Ef(e,t){const n=new fr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=_5+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ufe(e){const t={};let n;for(n in e)MS.call(e,n)&&(t[dfe(n)]=e[n]);return t}function dfe(e){let t=e.replace(qde,hfe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ffe(e,t){return t.toUpperCase()}function hfe(e){return"-"+e.toLowerCase()}const _y={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},pfe={};function gfe(e,t){const n=t||pfe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return R5(e,r,o)}function R5(e,t,n){if(mfe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return T2(e.children,t,n)}return Array.isArray(e)?T2(e,t,n):""}function T2(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=R5(e[o],t,n);return r.join("")}function mfe(e){return!!(e&&typeof e=="object")}const D2=document.createElement("i");function LS(e){const t="&"+e+";";D2.innerHTML=t;const n=D2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ti(e,t,n,r){const o=e.length;let i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Ao(e,t){return e.length>0?(Ti(e,e.length,0,t),e):t}const A2={}.hasOwnProperty;function vfe(e){const t={};let n=-1;for(;++n<e.length;)bfe(t,e[n]);return t}function bfe(e,t){let n;for(n in t){const o=(A2.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){A2.call(o,s)||(o[s]=[]);const a=i[s];yfe(o[s],Array.isArray(a)?a:a?[a]:[])}}}function yfe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ti(e,0,0,r)}function P5(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Mc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xfe=xa(new RegExp("\\p{P}","u")),wi=xa(/[A-Za-z]/),ao=xa(/[\dA-Za-z]/),wfe=xa(/[#-'*+\--9=?A-Z^-~]/);function F1(e){return e!==null&&(e<32||e===127)}const j1=xa(/\d/),_fe=xa(/[\dA-Fa-f]/),O5=xa(/[!-/:-@[-`{-~]/);function ot(e){return e!==null&&e<-2}function Br(e){return e!==null&&(e<0||e===32)}function Ht(e){return e===-2||e===-1||e===32}function Sfe(e){return O5(e)||xfe(e)}const Cfe=xa(/\s/);function xa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ru(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&ao(e.charCodeAt(n+1))&&ao(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function an(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ht(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ht(l)&&i++<o?(e.consume(l),a):(e.exit(n),t(l))}}const Efe={tokenize:Rfe};function Rfe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),an(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ot(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}const Pfe={tokenize:Ofe},k2={tokenize:$fe};function Ofe(e){const t=this,n=[];let r=0,o,i,s;return a;function a(S){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&_();const E=t.events.length;let C=E,$;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){$=t.events[C][1].end;break}y(r);let O=E;for(;O<t.events.length;)t.events[O][1].end=Object.assign({},$),O++;return Ti(t.events,C+1,0,t.events.slice(E)),t.events.length=O,c(S)}return a(S)}function c(S){if(r===n.length){if(!o)return h(S);if(o.currentConstruct&&o.currentConstruct.concrete)return v(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(k2,u,f)(S)}function u(S){return o&&_(),y(r),h(S)}function f(S){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(S)}function h(S){return t.containerState={},e.attempt(k2,p,v)(S)}function p(S){return r++,n.push([t.currentConstruct,t.containerState]),h(S)}function v(S){if(S===null){o&&_(),y(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:o}),b(S)}function b(S){if(S===null){x(e.exit("chunkFlow"),!0),y(0),e.consume(S);return}return ot(S)?(e.consume(S),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(S),b)}function x(S,E){const C=t.sliceStream(S);if(E&&C.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(C),t.parser.lazy[S.start.line]){let $=o.events.length;for(;$--;)if(o.events[$][1].start.offset<s&&(!o.events[$][1].end||o.events[$][1].end.offset>s))return;const O=t.events.length;let A=O,I,F;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(I){F=t.events[A][1].end;break}I=!0}for(y(r),$=O;$<t.events.length;)t.events[$][1].end=Object.assign({},F),$++;Ti(t.events,A+1,0,t.events.slice(O)),t.events.length=$}}function y(S){let E=n.length;for(;E-- >S;){const C=n[E];t.containerState=C[1],C[0].exit.call(t,e)}n.length=S}function _(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function $fe(e,t,n){return an(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function M2(e){if(e===null||Br(e)||Cfe(e))return 1;if(Sfe(e))return 2}function FS(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const z1={name:"attention",tokenize:Dfe,resolveAll:Tfe};function Tfe(e,t){let n=-1,r,o,i,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);I2(f,-l),I2(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ao(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ao(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=Ao(c,FS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ao(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Ao(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Ti(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Dfe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=M2(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=M2(l),f=!u||u===2&&o||n.includes(l),h=!o||o===2&&u||n.includes(r);return c._open=!!(i===42?f:f&&(o||!h)),c._close=!!(i===42?h:h&&(u||!f)),t(l)}}function I2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Afe={name:"autolink",tokenize:kfe};function kfe(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return wi(p)?(e.consume(p),s):c(p)}function s(p){return p===43||p===45||p===46||ao(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||ao(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||F1(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):wfe(p)?(e.consume(p),c):n(p)}function u(p){return ao(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||ao(p))&&r++<63){const v=p===45?h:f;return e.consume(p),v}return n(p)}}const Dv={tokenize:Mfe,partial:!0};function Mfe(e,t,n){return r;function r(i){return Ht(i)?an(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ot(i)?t(i):n(i)}}const $5={name:"blockQuote",tokenize:Ife,continuation:{tokenize:Nfe},exit:Lfe};function Ife(e,t,n){const r=this;return o;function o(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Ht(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function Nfe(e,t,n){const r=this;return o;function o(s){return Ht(s)?an(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt($5,t,n)(s)}}function Lfe(e){e.exit("blockQuote")}const T5={name:"characterEscape",tokenize:Ffe};function Ffe(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return O5(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const D5={name:"characterReference",tokenize:jfe};function jfe(e,t,n){const r=this;let o=0,i,s;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=ao,u(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=_fe,u):(e.enter("characterReferenceValue"),i=7,s=j1,u(f))}function u(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return s===ao&&!LS(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&o++<i?(e.consume(f),u):n(f)}}const N2={tokenize:Bfe,partial:!0},L2={name:"codeFenced",tokenize:zfe,concrete:!0};function zfe(e,t,n){const r=this,o={tokenize:C,partial:!0};let i=0,s=0,a;return l;function l($){return c($)}function c($){const O=r.events[r.events.length-1];return i=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=$,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u($)}function u($){return $===a?(s++,e.consume($),u):s<3?n($):(e.exit("codeFencedFenceSequence"),Ht($)?an(e,f,"whitespace")($):f($))}function f($){return $===null||ot($)?(e.exit("codeFencedFence"),r.interrupt?t($):e.check(N2,b,E)($)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h($))}function h($){return $===null||ot($)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f($)):Ht($)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),an(e,p,"whitespace")($)):$===96&&$===a?n($):(e.consume($),h)}function p($){return $===null||ot($)?f($):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v($))}function v($){return $===null||ot($)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f($)):$===96&&$===a?n($):(e.consume($),v)}function b($){return e.attempt(o,E,x)($)}function x($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),y}function y($){return i>0&&Ht($)?an(e,_,"linePrefix",i+1)($):_($)}function _($){return $===null||ot($)?e.check(N2,b,E)($):(e.enter("codeFlowValue"),S($))}function S($){return $===null||ot($)?(e.exit("codeFlowValue"),_($)):(e.consume($),S)}function E($){return e.exit("codeFenced"),t($)}function C($,O,A){let I=0;return F;function F(z){return $.enter("lineEnding"),$.consume(z),$.exit("lineEnding"),L}function L(z){return $.enter("codeFencedFence"),Ht(z)?an($,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):B(z)}function B(z){return z===a?($.enter("codeFencedFenceSequence"),J(z)):A(z)}function J(z){return z===a?(I++,$.consume(z),J):I>=s?($.exit("codeFencedFenceSequence"),Ht(z)?an($,q,"whitespace")(z):q(z)):A(z)}function q(z){return z===null||ot(z)?($.exit("codeFencedFence"),O(z)):A(z)}}}function Bfe(e,t,n){const r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Sy={name:"codeIndented",tokenize:Hfe},Vfe={tokenize:Wfe,partial:!0};function Hfe(e,t,n){const r=this;return o;function o(c){return e.enter("codeIndented"),an(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):ot(c)?e.attempt(Vfe,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ot(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function Wfe(e,t,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):an(e,i,"linePrefix",5)(s)}function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):ot(s)?o(s):n(s)}}const Ufe={name:"codeText",tokenize:Yfe,resolve:Gfe,previous:qfe};function Gfe(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function qfe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Yfe(e,t,n){let r=0,o,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),o=0,u(f)):ot(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||ot(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function u(f){return f===96?(e.consume(f),o++,u):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",c(f))}}function A5(e){const t={};let n=-1,r,o,i,s,a,l,c;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Kfe(e,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(e[o][1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);o&&(r[1].end=Object.assign({},e[o][1].start),a=e.slice(o,n),a.unshift(r),Ti(e,o,n-o+1,a))}}return!c}function Kfe(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,f,h=-1,p=n,v=0,b=0;const x=[b];for(;p;){for(;e[++o][1]!==p;);i.push(o),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(b=h+1,x.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),h=x.length;h--;){const y=a.slice(x[h],x[h+1]),_=i.pop();l.unshift([_,_+y.length-1]),Ti(e,_,2,y)}for(h=-1;++h<l.length;)c[v+l[h][0]]=v+l[h][1],v+=l[h][1]-l[h][0]-1;return c}const Xfe={tokenize:Zfe,resolve:Jfe},Qfe={tokenize:ehe,partial:!0};function Jfe(e){return A5(e),e}function Zfe(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):ot(a)?e.check(Qfe,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function ehe(e,t,n){const r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),an(e,i,"linePrefix")}function i(s){if(s===null||ot(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function k5(e,t,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return f;function f(y){return y===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(y),e.exit(i),h):y===null||y===32||y===41||F1(y)?n(y):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),h(y)):y===null||y===60||ot(y)?n(y):(e.consume(y),y===92?v:p)}function v(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!u&&(y===null||y===41||Br(y))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(y)):u<c&&y===40?(e.consume(y),u++,b):y===41?(e.consume(y),u--,b):y===null||y===32||y===40||F1(y)?n(y):(e.consume(y),y===92?x:b)}function x(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function M5(e,t,n,r,o,i){const s=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):ot(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ot(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ht(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function I5(e,t,n,r,o,i){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(o),e.consume(h),e.exit(o),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(e.enter(i),c(h))}function c(h){return h===s?(e.exit(i),l(s)):h===null?n(h):ot(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),an(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||ot(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:u)}function f(h){return h===s||h===92?(e.consume(h),u):u(h)}}function zd(e,t){let n;return r;function r(o){return ot(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ht(o)?an(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const the={name:"definition",tokenize:rhe},nhe={tokenize:ohe,partial:!0};function rhe(e,t,n){const r=this;let o;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return M5.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=Mc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Br(p)?zd(e,c)(p):c(p)}function c(p){return k5(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(nhe,f,f)(p)}function f(p){return Ht(p)?an(e,h,"whitespace")(p):h(p)}function h(p){return p===null||ot(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function ohe(e,t,n){return r;function r(a){return Br(a)?zd(e,o)(a):n(a)}function o(a){return I5(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Ht(a)?an(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ot(a)?t(a):n(a)}}const ihe={name:"hardBreakEscape",tokenize:she};function she(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ot(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const ahe={name:"headingAtx",tokenize:che,resolve:lhe};function lhe(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ti(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function che(e,t,n){let r=0;return o;function o(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||Br(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ot(u)?(e.exit("atxHeading"),t(u)):Ht(u)?an(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Br(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const uhe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],F2=["pre","script","style","textarea"],dhe={name:"htmlFlow",tokenize:ghe,resolveTo:phe,concrete:!0},fhe={tokenize:vhe,partial:!0},hhe={tokenize:mhe,partial:!0};function phe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ghe(e,t,n){const r=this;let o,i,s,a,l;return c;function c(M){return u(M)}function u(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),f}function f(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),i=!0,b):M===63?(e.consume(M),o=3,r.interrupt?t:T):wi(M)?(e.consume(M),s=String.fromCharCode(M),x):n(M)}function h(M){return M===45?(e.consume(M),o=2,p):M===91?(e.consume(M),o=5,a=0,v):wi(M)?(e.consume(M),o=4,r.interrupt?t:T):n(M)}function p(M){return M===45?(e.consume(M),r.interrupt?t:T):n(M)}function v(M){const re="CDATA[";return M===re.charCodeAt(a++)?(e.consume(M),a===re.length?r.interrupt?t:B:v):n(M)}function b(M){return wi(M)?(e.consume(M),s=String.fromCharCode(M),x):n(M)}function x(M){if(M===null||M===47||M===62||Br(M)){const re=M===47,ue=s.toLowerCase();return!re&&!i&&F2.includes(ue)?(o=1,r.interrupt?t(M):B(M)):uhe.includes(s.toLowerCase())?(o=6,re?(e.consume(M),y):r.interrupt?t(M):B(M)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?_(M):S(M))}return M===45||ao(M)?(e.consume(M),s+=String.fromCharCode(M),x):n(M)}function y(M){return M===62?(e.consume(M),r.interrupt?t:B):n(M)}function _(M){return Ht(M)?(e.consume(M),_):F(M)}function S(M){return M===47?(e.consume(M),F):M===58||M===95||wi(M)?(e.consume(M),E):Ht(M)?(e.consume(M),S):F(M)}function E(M){return M===45||M===46||M===58||M===95||ao(M)?(e.consume(M),E):C(M)}function C(M){return M===61?(e.consume(M),$):Ht(M)?(e.consume(M),C):S(M)}function $(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),l=M,O):Ht(M)?(e.consume(M),$):A(M)}function O(M){return M===l?(e.consume(M),l=null,I):M===null||ot(M)?n(M):(e.consume(M),O)}function A(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Br(M)?C(M):(e.consume(M),A)}function I(M){return M===47||M===62||Ht(M)?S(M):n(M)}function F(M){return M===62?(e.consume(M),L):n(M)}function L(M){return M===null||ot(M)?B(M):Ht(M)?(e.consume(M),L):n(M)}function B(M){return M===45&&o===2?(e.consume(M),ee):M===60&&o===1?(e.consume(M),G):M===62&&o===4?(e.consume(M),H):M===63&&o===3?(e.consume(M),T):M===93&&o===5?(e.consume(M),W):ot(M)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(fhe,U,J)(M)):M===null||ot(M)?(e.exit("htmlFlowData"),J(M)):(e.consume(M),B)}function J(M){return e.check(hhe,q,U)(M)}function q(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),z}function z(M){return M===null||ot(M)?J(M):(e.enter("htmlFlowData"),B(M))}function ee(M){return M===45?(e.consume(M),T):B(M)}function G(M){return M===47?(e.consume(M),s="",Q):B(M)}function Q(M){if(M===62){const re=s.toLowerCase();return F2.includes(re)?(e.consume(M),H):B(M)}return wi(M)&&s.length<8?(e.consume(M),s+=String.fromCharCode(M),Q):B(M)}function W(M){return M===93?(e.consume(M),T):B(M)}function T(M){return M===62?(e.consume(M),H):M===45&&o===2?(e.consume(M),T):B(M)}function H(M){return M===null||ot(M)?(e.exit("htmlFlowData"),U(M)):(e.consume(M),H)}function U(M){return e.exit("htmlFlow"),t(M)}}function mhe(e,t,n){const r=this;return o;function o(s){return ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function vhe(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Dv,t,n)}}const bhe={name:"htmlText",tokenize:yhe};function yhe(e,t,n){const r=this;let o,i,s;return a;function a(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),l}function l(T){return T===33?(e.consume(T),c):T===47?(e.consume(T),C):T===63?(e.consume(T),S):wi(T)?(e.consume(T),A):n(T)}function c(T){return T===45?(e.consume(T),u):T===91?(e.consume(T),i=0,v):wi(T)?(e.consume(T),_):n(T)}function u(T){return T===45?(e.consume(T),p):n(T)}function f(T){return T===null?n(T):T===45?(e.consume(T),h):ot(T)?(s=f,G(T)):(e.consume(T),f)}function h(T){return T===45?(e.consume(T),p):f(T)}function p(T){return T===62?ee(T):T===45?h(T):f(T)}function v(T){const H="CDATA[";return T===H.charCodeAt(i++)?(e.consume(T),i===H.length?b:v):n(T)}function b(T){return T===null?n(T):T===93?(e.consume(T),x):ot(T)?(s=b,G(T)):(e.consume(T),b)}function x(T){return T===93?(e.consume(T),y):b(T)}function y(T){return T===62?ee(T):T===93?(e.consume(T),y):b(T)}function _(T){return T===null||T===62?ee(T):ot(T)?(s=_,G(T)):(e.consume(T),_)}function S(T){return T===null?n(T):T===63?(e.consume(T),E):ot(T)?(s=S,G(T)):(e.consume(T),S)}function E(T){return T===62?ee(T):S(T)}function C(T){return wi(T)?(e.consume(T),$):n(T)}function $(T){return T===45||ao(T)?(e.consume(T),$):O(T)}function O(T){return ot(T)?(s=O,G(T)):Ht(T)?(e.consume(T),O):ee(T)}function A(T){return T===45||ao(T)?(e.consume(T),A):T===47||T===62||Br(T)?I(T):n(T)}function I(T){return T===47?(e.consume(T),ee):T===58||T===95||wi(T)?(e.consume(T),F):ot(T)?(s=I,G(T)):Ht(T)?(e.consume(T),I):ee(T)}function F(T){return T===45||T===46||T===58||T===95||ao(T)?(e.consume(T),F):L(T)}function L(T){return T===61?(e.consume(T),B):ot(T)?(s=L,G(T)):Ht(T)?(e.consume(T),L):I(T)}function B(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),o=T,J):ot(T)?(s=B,G(T)):Ht(T)?(e.consume(T),B):(e.consume(T),q)}function J(T){return T===o?(e.consume(T),o=void 0,z):T===null?n(T):ot(T)?(s=J,G(T)):(e.consume(T),J)}function q(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||Br(T)?I(T):(e.consume(T),q)}function z(T){return T===47||T===62||Br(T)?I(T):n(T)}function ee(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function G(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),Q}function Q(T){return Ht(T)?an(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):W(T)}function W(T){return e.enter("htmlTextData"),s(T)}}const jS={name:"labelEnd",tokenize:Ehe,resolveTo:Che,resolveAll:She},xhe={tokenize:Rhe},whe={tokenize:Phe},_he={tokenize:Ohe};function She(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function Che(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},u={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return a=[["enter",l,t],["enter",c,t]],a=Ao(a,e.slice(i+1,i+r+3)),a=Ao(a,[["enter",u,t]]),a=Ao(a,FS(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=Ao(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Ao(a,e.slice(s+1)),a=Ao(a,[["exit",l,t]]),Ti(e,i,e.length,a),e}function Ehe(e,t,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(h){return i?i._inactive?f(h):(s=r.parser.defined.includes(Mc(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(xhe,u,s?u:f)(h):h===91?e.attempt(whe,u,s?c:f)(h):s?u(h):f(h)}function c(h){return e.attempt(_he,u,f)(h)}function u(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function Rhe(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return Br(f)?zd(e,i)(f):i(f)}function i(f){return f===41?u(f):k5(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return Br(f)?zd(e,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?I5(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return Br(f)?zd(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Phe(e,t,n){const r=this;return o;function o(a){return M5.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Mc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function Ohe(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const $he={name:"labelStartImage",tokenize:The,resolveAll:jS.resolveAll};function The(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Dhe={name:"labelStartLink",tokenize:Ahe,resolveAll:jS.resolveAll};function Ahe(e,t,n){const r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Cy={name:"lineEnding",tokenize:khe};function khe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),an(e,t,"linePrefix")}}const Ag={name:"thematicBreak",tokenize:Mhe};function Mhe(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ot(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===o?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ht(c)?an(e,a,"whitespace")(c):a(c))}}const kr={name:"list",tokenize:Lhe,continuation:{tokenize:Fhe},exit:zhe},Ihe={tokenize:Bhe,partial:!0},Nhe={tokenize:jhe,partial:!0};function Lhe(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(p){const v=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:j1(p)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ag,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return j1(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Dv,r.interrupt?n:u,e.attempt(Ihe,h,f))}function u(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return Ht(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Fhe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Dv,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,an(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Ht(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Nhe,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,an(e,e.attempt(kr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function jhe(e,t,n){const r=this;return an(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function zhe(e){e.exit(this.containerState.type)}function Bhe(e,t,n){const r=this;return an(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!Ht(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const j2={name:"setextUnderline",tokenize:Hhe,resolveTo:Vhe};function Vhe(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function Hhe(e,t,n){const r=this;let o;return i;function i(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ht(c)?an(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ot(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Whe={tokenize:Uhe};function Uhe(e){const t=this,n=e.attempt(Dv,r,e.attempt(this.parser.constructs.flowInitial,o,an(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Xfe,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Ghe={resolveAll:L5()},qhe=N5("string"),Yhe=N5("text");function N5(e){return{tokenize:t,resolveAll:L5(e==="text"?Khe:void 0)};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const f=o[u];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function L5(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function Khe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,s=-1,a=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}function Xhe(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let s=[],a=[];const l={consume:_,enter:S,exit:E,attempt:O(C),check:O($),interrupt:O($,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:v,defineSkip:b,write:f};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function f(L){return s=Ao(s,L),x(),s[s.length-1]!==null?[]:(A(t,0),c.events=FS(i,c.events,c),c.events)}function h(L,B){return Jhe(p(L),B)}function p(L){return Qhe(s,L)}function v(){const{line:L,column:B,offset:J,_index:q,_bufferIndex:z}=r;return{line:L,column:B,offset:J,_index:q,_bufferIndex:z}}function b(L){o[L.line]=L.column,F()}function x(){let L;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<B.length;)y(B.charCodeAt(r._bufferIndex));else y(B)}}function y(L){u=u(L)}function _(L){ot(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,F()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=L}function S(L,B){const J=B||{};return J.type=L,J.start=v(),c.events.push(["enter",J,c]),a.push(J),J}function E(L){const B=a.pop();return B.end=v(),c.events.push(["exit",B,c]),B}function C(L,B){A(L,B.from)}function $(L,B){B.restore()}function O(L,B){return J;function J(q,z,ee){let G,Q,W,T;return Array.isArray(q)?U(q):"tokenize"in q?U([q]):H(q);function H(de){return pe;function pe(Z){const te=Z!==null&&de[Z],ie=Z!==null&&de.null,me=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return U(me)(Z)}}function U(de){return G=de,Q=0,de.length===0?ee:M(de[Q])}function M(de){return pe;function pe(Z){return T=I(),W=de,de.partial||(c.currentConstruct=de),de.name&&c.parser.constructs.disable.null.includes(de.name)?ue():de.tokenize.call(B?Object.assign(Object.create(c),B):c,l,re,ue)(Z)}}function re(de){return L(W,T),z}function ue(de){return T.restore(),++Q<G.length?M(G[Q]):ee}}}function A(L,B){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Ti(c.events,B,c.events.length-B,L.resolve(c.events.slice(B),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function I(){const L=v(),B=c.previous,J=c.currentConstruct,q=c.events.length,z=Array.from(a);return{restore:ee,from:q};function ee(){r=L,c.previous=B,c.currentConstruct=J,c.events.length=q,a=z,F()}}function F(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Qhe(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function Jhe(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|