@case-framework/survey-ui 0.2.4 → 0.3.0
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/README.md +2 -13
- package/dist/index.d.ts +0 -477
- package/dist/survey-editor-defaults.css +13 -7
- package/dist/survey-ui.cjs.js +148 -28
- package/dist/survey-ui.cjs.js.map +1 -1
- package/dist/survey-ui.css +2 -2
- package/dist/survey-ui.es.js +47547 -17776
- package/dist/survey-ui.es.js.map +1 -1
- package/package.json +26 -18
package/dist/survey-ui.cjs.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`react`);l=c(l);let u=require(`react-dom`);u=c(u);let d=require(`react/jsx-runtime`);function f(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=f(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function p(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=f(e))&&(r&&(r+=` `),r+=t);return r}var m=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e;const h=p,g=(e,t)=>n=>{if(t?.variants==null)return h(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=m(t)||m(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return h(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function _(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function v(...e){return t=>{let n=!1,r=e.map(e=>{let r=_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():_(e[t],null)}}}}function y(...e){return l.useCallback(v(...e),e)}function b(e){let t=S(e),n=l.forwardRef((e,n)=>{let{children:r,...i}=e,a=l.Children.toArray(r),o=a.find(T);if(o){let e=o.props.children,r=a.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return(0,d.jsx)(t,{...i,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,r):null})}return(0,d.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var x=b(`Slot`);function S(e){let t=l.forwardRef((e,t)=>{let{children:n,...r}=e;if(l.isValidElement(n)){let e=D(n),i=E(r,n.props);return n.type!==l.Fragment&&(i.ref=t?v(t,e):e),l.cloneElement(n,i)}return l.Children.count(n)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var C=Symbol(`radix.slottable`);function w(e){let t=({children:e})=>(0,d.jsx)(d.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=C,t}function T(e){return l.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===C}function E(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function D(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var O=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=b(`Primitive.${t}`),r=l.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,d.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function k(e,t){e&&u.flushSync(()=>e.dispatchEvent(t))}var A=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),j=`VisuallyHidden`,M=l.forwardRef((e,t)=>(0,d.jsx)(O.span,{...e,ref:t,style:{...A,...e.style}}));M.displayName=j;var N=M;function P(e,t){let n=l.createContext(t),r=e=>{let{children:t,...r}=e,i=l.useMemo(()=>r,Object.values(r));return(0,d.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=l.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function F(e,t=[]){let n=[];function r(t,r){let i=l.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=l.useMemo(()=>o,Object.values(o));return(0,d.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=l.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>l.createContext(e));return function(n){let r=n?.[e]||t;return l.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,I(i,...t)]}function I(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function L(e){let t=e+`CollectionProvider`,[n,r]=F(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=l.default.useRef(null),a=l.default.useRef(new Map).current;return(0,d.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=b(s),u=l.default.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,d.jsx)(c,{ref:y(t,a(s,n).collectionRef),children:r})});u.displayName=s;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=b(f),h=l.default.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=l.default.useRef(null),s=y(t,o),c=a(f,n);return l.default.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,d.jsx)(m,{[p]:``,ref:s,children:r})});h.displayName=f;function g(t){let n=a(e+`CollectionConsumer`,t);return l.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},g,r]}var R=!!(typeof window<`u`&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var B=globalThis?.document?l.useLayoutEffect:()=>{},V=l.useInsertionEffect||B;function H({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=ee({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=l.useRef(e!==void 0);l.useEffect(()=>{let e=t.current;if(e!==s){let t=e?`controlled`:`uncontrolled`,n=s?`controlled`:`uncontrolled`;console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,r])}return[c,l.useCallback(t=>{if(s){let n=te(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function ee({defaultProp:e,onChange:t}){let[n,r]=l.useState(e),i=l.useRef(n),a=l.useRef(t);return V(()=>{a.current=t},[t]),l.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function te(e){return typeof e==`function`}function U(e,t){return l.useReducer((e,n)=>t[e][n]??e,e)}var W=e=>{let{present:t,children:n}=e,r=ne(t),i=typeof n==`function`?n({present:r.isPresent}):l.Children.only(n),a=y(r.ref,ie(i));return typeof n==`function`||r.isPresent?l.cloneElement(i,{ref:a}):null};W.displayName=`Presence`;function ne(e){let[t,n]=l.useState(),r=l.useRef(null),i=l.useRef(e),a=l.useRef(`none`),[o,s]=U(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return l.useEffect(()=>{let e=re(r.current);a.current=o===`mounted`?e:`none`},[o]),B(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=re(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),B(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=re(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=re(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:l.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function re(e){return e?.animationName||`none`}function ie(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ae=l.useId||(()=>void 0),oe=0;function G(e){let[t,n]=l.useState(ae());return B(()=>{e||n(e=>e??String(oe++))},[e]),e||(t?`radix-${t}`:``)}var se=l.createContext(void 0);function ce(e){let t=l.useContext(se);return e||t||`ltr`}function le(e){let t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...e)=>t.current?.(...e),[])}function ue(e,t=globalThis?.document){let n=le(e);l.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var de=`DismissableLayer`,fe=`dismissableLayer.update`,pe=`dismissableLayer.pointerDownOutside`,me=`dismissableLayer.focusOutside`,he,ge=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_e=l.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,u=l.useContext(ge),[f,p]=l.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=l.useState({}),g=y(t,e=>p(e)),_=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=_.indexOf(v),x=f?_.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=b,w=be(e=>{let t=e.target,n=[...u.branches].some(e=>e.contains(t));!C||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},m),T=xe(e=>{let t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},m);return ue(e=>{x===u.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},m),l.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(he=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Se(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=he)}},[f,m,n,u]),l.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Se())},[f,u]),l.useEffect(()=>{let e=()=>h({});return document.addEventListener(fe,e),()=>document.removeEventListener(fe,e)},[]),(0,d.jsx)(O.div,{...c,ref:g,style:{pointerEvents:S?C?`auto`:`none`:void 0,...e.style},onFocusCapture:z(e.onFocusCapture,T.onFocusCapture),onBlurCapture:z(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:z(e.onPointerDownCapture,w.onPointerDownCapture)})});_e.displayName=de;var ve=`DismissableLayerBranch`,ye=l.forwardRef((e,t)=>{let n=l.useContext(ge),r=l.useRef(null),i=y(t,r);return l.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,d.jsx)(O.div,{...e,ref:i})});ye.displayName=ve;function be(e,t=globalThis?.document){let n=le(e),r=l.useRef(!1),i=l.useRef(()=>{});return l.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Ce(pe,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xe(e,t=globalThis?.document){let n=le(e),r=l.useRef(!1);return l.useEffect(()=>{let e=e=>{e.target&&!r.current&&Ce(me,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Se(){let e=new CustomEvent(fe);document.dispatchEvent(e)}function Ce(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?k(i,a):i.dispatchEvent(a)}var we=`focusScope.autoFocusOnMount`,Te=`focusScope.autoFocusOnUnmount`,Ee={bubbles:!1,cancelable:!0},De=`FocusScope`,Oe=l.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=l.useState(null),u=le(i),f=le(a),p=l.useRef(null),m=y(t,e=>c(e)),h=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(r){let e=function(e){if(h.paused||!s)return;let t=e.target;s.contains(t)?p.current=t:Fe(p.current,{select:!0})},t=function(e){if(h.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Fe(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Fe(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,h.paused]),l.useEffect(()=>{if(s){Ie.add(h);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(we,Ee);s.addEventListener(we,u),s.dispatchEvent(t),t.defaultPrevented||(ke(ze(je(s)),{select:!0}),document.activeElement===e&&Fe(s))}return()=>{s.removeEventListener(we,u),setTimeout(()=>{let t=new CustomEvent(Te,Ee);s.addEventListener(Te,f),s.dispatchEvent(t),t.defaultPrevented||Fe(e??document.body,{select:!0}),s.removeEventListener(Te,f),Ie.remove(h)},0)}}},[s,u,f,h]);let g=l.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Ae(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Fe(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Fe(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,d.jsx)(O.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});Oe.displayName=De;function ke(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Fe(r,{select:t}),document.activeElement!==n)return}function Ae(e){let t=je(e);return[Me(t,e),Me(t.reverse(),e)]}function je(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Me(e,t){for(let n of e)if(!Ne(n,{upTo:t}))return n}function Ne(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Pe(e){return e instanceof HTMLInputElement&&`select`in e}function Fe(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Pe(e)&&t&&e.select()}}var Ie=Le();function Le(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Re(e,t),e.unshift(t)},remove(t){e=Re(e,t),e[0]?.resume()}}}function Re(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ze(e){return e.filter(e=>e.tagName!==`A`)}var Be=`Portal`,Ve=l.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=l.useState(!1);B(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?u.default.createPortal((0,d.jsx)(O.div,{...r,ref:t}),o):null});Ve.displayName=Be;var He=0;function Ue(){l.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??We()),document.body.insertAdjacentElement(`beforeend`,e[1]??We()),He++,()=>{He===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),He--}},[])}function We(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Ge=function(){return Ge=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ge.apply(this,arguments)};function Ke(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function qe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Je(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ye=`right-scroll-bar-position`,Xe=`width-before-scroll-bar`,Ze=`with-scroll-bars-hidden`,Qe=`--removed-body-scroll-bar-size`;function $e(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function et(e,t){var n=(0,l.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var tt=typeof window<`u`?l.useLayoutEffect:l.useEffect,nt=new WeakMap;function rt(e,t){var n=et(t||null,function(t){return e.forEach(function(e){return $e(e,t)})});return tt(function(){var t=nt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||$e(e,null)}),i.forEach(function(e){r.has(e)||$e(e,a)})}nt.set(n,e)},[e]),n}function it(e){return e}function at(e,t){t===void 0&&(t=it);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ot(e){e===void 0&&(e={});var t=at(null);return t.options=Ge({async:!0,ssr:!1},e),t}var st=function(e){var t=e.sideCar,n=Ke(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return l.createElement(r,Ge({},n))};st.isSideCarExport=!0;function ct(e,t){return e.useMedium(t),st}var lt=ot(),ut=function(){},dt=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:ut,onWheelCapture:ut,onTouchMoveCapture:ut}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Ke(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=rt([n,t]),w=Ge(Ge({},x),i);return l.createElement(l.Fragment,null,d&&l.createElement(S,{sideCar:lt,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?l.cloneElement(l.Children.only(s),Ge(Ge({},w),{ref:C})):l.createElement(y,Ge({},w,{className:c,ref:C}),s))});dt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dt.classNames={fullWidth:Xe,zeroRight:Ye};var ft,pt=function(){if(ft)return ft;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function mt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=pt();return t&&e.setAttribute(`nonce`,t),e}function ht(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var _t=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mt())&&(ht(t,n),gt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vt=function(){var e=_t();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},yt=function(){var e=vt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},bt={left:0,top:0,right:0,gap:0},xt=function(e){return parseInt(e||``,10)||0},St=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[xt(n),xt(r),xt(i)]},Ct=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return bt;var t=St(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},wt=yt(),Tt=`data-scroll-locked`,Et=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`react`),d=l(u,1);u=l(u);let f=require(`react-dom`);f=l(f,1);let p=require(`react/jsx-runtime`);function m(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function h(e){let t=m(e);return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function g(e,t=Math.random){let n=[...e];for(let e=n.length-1;e>0;e--){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function _(e,t=Math.random){return g(Array.from({length:e},(e,t)=>t),t)}function v(e){return typeof structuredClone<`u`?structuredClone(e):JSON.parse(JSON.stringify(e))}var y=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function b(){let e=Date.now(),t=``,n=e;for(;n>0;)t=y.charAt(n%62)+t,n=Math.floor(n/62);let r=``;for(let e=0;e<10;e++)r+=y.charAt(Math.floor(Math.random()*62));return r+t}var x=`23456789ABCDEFGHJKLMNPQRSTUVWXYZ`;function S(e=4){let t=``;for(let n=0;n<e;n++)t+=x.charAt(Math.floor(Math.random()*32));return t}var C=`...`,w=class e{_itemId;_name;_slotId;constructor(e){let t=e.split(C);if(t.length!==3)throw Error(`Invalid value reference: `+e);this._itemId=t[0],this._name=t[1],this._slotId=t[2]}get itemId(){return this._itemId}get name(){return this._name}get slotId(){return this._slotId}set itemId(e){this._itemId=e}toString(){return`${this._itemId}${C}${this._name}${this._slotId?C+this._slotId:``}`}static fromParts(t,n,r){return new e(`${t}${C}${n}${C}${r}`)}},T={Const:`const`,ResponseVariable:`responseVariable`,ContextVariable:`contextVariable`,Function:`function`},E={Locale:`locale`,ParticipantFlag:`participantFlag`,CustomValue:`customValue`,CustomExpression:`customExpression`},D=class e{type;editorConfig;constructor(e,t){this.type=e,this.editorConfig=t}static deserialize(e){if(e)switch(e.type){case T.Const:return O.deserialize(e);case T.ResponseVariable:return ee.deserialize(e);case T.ContextVariable:return k.deserialize(e);case T.Function:return j.deserialize(e)}}clone(){return e.deserialize(this.serialize())??(()=>{throw Error(`Failed to clone expression`)})()}},O=class e extends D{value;constructor(e,t){super(T.Const,t),this.value=e,this.type=T.Const}static deserialize(t){if(t.type!==T.Const)throw Error(`Invalid expression type: `+t.type);return new e(t.value,t.editorConfig)}get responseVariableRefs(){return[]}serialize(){return{type:this.type,value:this.value,editorConfig:this.editorConfig}}updateItemKeyReferences(e,t){return!1}},ee=class e extends D{variableRef;constructor(e,t){super(T.ResponseVariable,t),this.variableRef=e,this.type=T.ResponseVariable}static deserialize(t){if(t.type!==T.ResponseVariable)throw Error(`Invalid expression type: `+t.type);return new e(t.variableRef,t.editorConfig)}get responseVariableRefs(){return[new w(this.variableRef)]}get responseVariableRef(){return new w(this.variableRef)}serialize(){return{type:this.type,variableRef:this.variableRef,editorConfig:this.editorConfig}}},k=class e extends D{contextType;key;arguments;asType;constructor(e,t,n,r,i){super(T.ContextVariable,i),this.type=T.ContextVariable,this.contextType=e,this.key=t,this.arguments=n,this.asType=r}static deserialize(t){if(t.type!==T.ContextVariable)throw Error(`Invalid expression type: `+t.type);return new e(t.contextType,D.deserialize(t.key),t.arguments?.map(e=>D.deserialize(e)),t.asType,t.editorConfig)}get responseVariableRefs(){return this.arguments?.flatMap(e=>e?.responseVariableRefs).filter(e=>e!==void 0)??[]}serialize(){return{type:this.type,contextType:this.contextType,key:this.key?.serialize(),arguments:this.arguments?.map(e=>e?.serialize()),asType:this.asType,editorConfig:this.editorConfig}}},A=function(e){return e.and=`and`,e.or=`or`,e.not=`not`,e.list_contains=`list_contains`,e.eq=`eq`,e.gt=`gt`,e.gte=`gte`,e.lt=`lt`,e.lte=`lte`,e.in_range=`in_range`,e.sum=`sum`,e.min=`min`,e.max=`max`,e.str_eq=`str_eq`,e.date_eq=`date_eq`,e}({}),j=class e extends D{functionName;arguments;constructor(e,t,n){super(T.Function),this.type=T.Function,this.functionName=e,this.arguments=t,this.editorConfig=n}static deserialize(t){if(t.type!==T.Function)throw Error(`Invalid expression type: `+t.type);let n=t.functionName;if(!Object.values(A).includes(n))throw Error(`Invalid function name: `+n);let r=new e(n,t.arguments.map(e=>D.deserialize(e)));return r.editorConfig=t.editorConfig,r}get responseVariableRefs(){let e=this.arguments.flatMap(e=>e?.responseVariableRefs).filter(e=>e!==void 0).map(e=>e.toString());return[...new Set(e)].map(e=>new w(e))}serialize(){return{type:this.type,functionName:this.functionName,arguments:this.arguments.map(e=>e?.serialize()),editorConfig:this.editorConfig}}},M=e=>{let t={type:e.type,returnType:e.returnType,expression:e.expression?.serialize()};return e.type===`date2string`&&(t.dateFormat=e.dateFormat),t},N=e=>{let t={};for(let[n,r]of e.entries())t[n]=M(r);return t},P=e=>({type:e.type,expression:e.expression?D.deserialize(e.expression):void 0,returnType:e.returnType,dateFormat:e.dateFormat}),F=e=>new Map(Object.entries(e).map(([e,t])=>[e,P(t)])),I={string:`string`,duration:`duration`,reference:`reference`,number:`number`,boolean:`boolean`,date:`date`,stringArray:`string[]`,durationArray:`duration[]`,referenceArray:`reference[]`,numberArray:`number[]`,dateArray:`date[]`},te={seconds:`seconds`,minutes:`minutes`,hours:`hours`,days:`days`,weeks:`weeks`,months:`months`,years:`years`},ne={int:`int`,float:`float`};function re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ie(e){return typeof e==`number`&&Number.isFinite(e)}function ae(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function oe(e){return Array.isArray(e)&&e.every(e=>ie(e))}function se(e){return e===void 0||e===ne.int||e===ne.float}function ce(e){return typeof e==`string`&&Object.values(te).includes(e)}function le(e){if(!re(e)||typeof e.type!=`string`)return!1;switch(e.type){case I.string:case I.reference:return typeof e.value==`string`;case I.number:return ie(e.value)&&se(e.precision);case I.boolean:return typeof e.value==`boolean`;case I.date:return ie(e.value);case I.duration:return ie(e.value)&&ce(e.unit)&&se(e.precision);case I.stringArray:case I.referenceArray:return ae(e.value);case I.numberArray:case I.dateArray:return oe(e.value)&&(e.type!==I.numberArray||se(e.precision));case I.durationArray:return oe(e.value)&&ce(e.unit)&&se(e.precision);default:return!1}}function ue(e,t){if(!le(e))throw Error(`Invalid response value at '${t}'`)}var de=e=>({root:e.root?D.deserialize(e.root):void 0,components:e.components?Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,D.deserialize(t)])):void 0}),fe=e=>({components:e.components?Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,D.deserialize(t)])):void 0}),pe={ifEmpty:`ifEmpty`},me={itemResponse:`itemResponse`,field:`field`,embeddedField:`embeddedField`};function he(e){switch(e.source.type){case`static`:return{id:e.id,target:e.target,when:D.deserialize(e.when),apply:e.apply,source:{type:`static`,value:e.source.value}};case`expression`:return{id:e.id,target:e.target,when:D.deserialize(e.when),apply:e.apply,source:{type:`expression`,expression:D.deserialize(e.source.expression)??(()=>{throw Error(`Prefill '${e.id}' is missing a valid expression source`)})()}};case`templateValue`:return{id:e.id,target:e.target,when:D.deserialize(e.when),apply:e.apply,source:{type:`templateValue`,key:e.source.key}};case`previousResponse`:return{id:e.id,target:e.target,when:D.deserialize(e.when),apply:e.apply,source:{type:`previousResponse`,ref:e.source.ref,ifUnsupported:e.source.ifUnsupported}};default:throw Error(`Unsupported prefill source type: ${e.source.type}`)}}function ge(e,t){if(e.type!==t.type)return!1;switch(e.type){case me.itemResponse:return!0;case me.field:return e.fieldId===t.fieldId;case me.embeddedField:return e.optionId===t.optionId&&e.fieldId===t.fieldId;default:return!1}}var _e=class{id;key;config;_rawItem;displayConditions;disabledConditions;validations;prefills;constructor(e){this._rawItem=e,this.updateExpressions(),this.id=this._rawItem.id,this.key=this._rawItem.key,this.config=this.parseConfig(this._rawItem.config)}getAdditionalResponseValueSlots(){return{}}getAvailableResponseValueSlots(e){let t={};for(let e of this.getResponseSlotDefinitions())t[`${this.id}...get...${e.slotId}`]=e.valueType,t[`${this.id}...isDefined...${e.slotId}`]=I.boolean;return Object.assign(t,this.getAdditionalResponseValueSlots()),e?Object.fromEntries(Object.entries(t).filter(([,t])=>t===e)):t}get rawItem(){return this._rawItem}get metadata(){return this._rawItem.metadata??{}}set metadata(e){this.updateRawItem({...this._rawItem,metadata:e})}updateRawItem(e){if(e.id!==this.id)throw Error(`Cannot update raw item with a different id`);this._rawItem=e,this.updateExpressions(),this.key=e.key,this.config=this.parseConfig(e.config)}updateExpressions(){this.displayConditions=this._rawItem.displayConditions?de(this._rawItem.displayConditions):void 0,this.disabledConditions=this._rawItem.disabledConditions?fe(this._rawItem.disabledConditions):void 0,this.validations=this._rawItem.validations?Object.fromEntries(Object.entries(this._rawItem.validations).map(([e,t])=>[e,D.deserialize(t)])):void 0,this.prefills=this._rawItem.prefills?.map(e=>he(e))}getReferenceUsages(){let e=[];if(this.displayConditions){for(let t of this.displayConditions.root?.responseVariableRefs||[])e.push({itemId:this.id,usageType:`displayConditions`,valueReference:t});for(let[t,n]of Object.entries(this.displayConditions.components||{}))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:`displayConditions`,valueReference:r})}if(this.disabledConditions)for(let[t,n]of Object.entries(this.disabledConditions.components||{}))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:`disabledConditions`,valueReference:r});if(this.validations)for(let[t,n]of Object.entries(this.validations))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:`validations`,valueReference:r});if(this.prefills)for(let t of this.prefills){for(let n of t.when?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t.id,usageType:`prefills`,valueReference:n});if(t.source.type===`expression`)for(let n of t.source.expression.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t.id,usageType:`prefills`,valueReference:n})}return e}resolvePrefillTarget(e){let t=this.getResponseSlotDefinitions(),n=t.find(t=>t.prefillTarget!==void 0&&ge(t.prefillTarget,e));if(n)return n;if(e.type===me.itemResponse&&t.length===1)return t[0]}normalizePrefillValue(e,t,n){return n.type===t.valueType?n:void 0}},ve=function(e){return e.Group=`group`,e.PageBreak=`page-break`,e}({}),ye=class{_itemKey;_path;_keySeparator;constructor(e,t,n=`.`){this._itemKey=e,this._path=t??[],this._keySeparator=n}get itemKey(){return this._itemKey}get path(){return this._path}get parentFullKey(){return this._path.join(this._keySeparator)}get fullKey(){return[...this._path,this._itemKey].join(this._keySeparator)}get isRoot(){return this._path.length===0}get keySeparator(){return this._keySeparator}set keySeparator(e){this._keySeparator=e}};function be(e,t,n){let r=[...e];return[r[t],r[n]]=[r[n],r[t]],r}function xe(e,t,n){let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}var Se=class extends _e{type=`group`;parseConfig(e){let t=e??{};return{items:t.items,shuffleItems:t.shuffleItems,isRoot:t.isRoot}}serializeConfig(){return this.config}isInteractive(){return!1}getResponseSlotDefinitions(){return[]}isRoot(){return this.config.isRoot??!1}get items(){return this.config.items??[]}addChild(e,t){let n=this.config.items??=[],r=t===void 0?n.length:Math.min(t,n.length);n.splice(r,0,e),this.updateRawItem({...this.rawItem,config:{...this.config}})}removeChild(e){let t=this.config.items??=[],n=t.indexOf(e);n!==-1&&(t.splice(n,1),this.updateRawItem({...this.rawItem,config:{...this.config}}))}hasChild(e){return this.items.includes(e)}get shuffleItems(){return this.config.shuffleItems??!1}set shuffleItems(e){this.config.shuffleItems=e,this.updateRawItem({...this.rawItem,config:{...this.config}})}getChildrenIds(){return[...this.items]}swapItemsByIndex(e,t){let n=this.items;if(e<0||e>=n.length||t<0||t>=n.length)throw Error(`Index out of bounds. Valid range is 0-${n.length-1}`);e!==t&&(this.config.items=be(n,e,t),this.updateRawItem({...this.rawItem,config:{...this.config}}))}swapItemsById(e,t){let n=this.items,r=n.indexOf(e),i=n.indexOf(t);if(r===-1)throw Error(`Item '${e}' not found in group '${this.key}'`);if(i===-1)throw Error(`Item '${t}' not found in group '${this.key}'`);this.swapItemsByIndex(r,i)}moveItemToIndex(e,t){let n=this.items,r=n.indexOf(e);if(r===-1)throw Error(`Item '${e}' not found in group '${this.key}'`);if(t<0||t>=n.length)throw Error(`Index out of bounds. Valid range is 0-${n.length-1}`);r!==t&&(this.config.items=xe(n,r,t),this.updateRawItem({...this.rawItem,config:{...this.config}}))}},Ce=class extends _e{type=`page-break`;parseConfig(e){return{}}serializeConfig(){}isInteractive(){return!1}getResponseSlotDefinitions(){return[]}},we={group:Se,"page-break":Ce},Te=e=>e in we;function Ee(e,t){if(Te(e.itemType)){let t=we[e.itemType];return new t(e)}if(t&&e.itemType in t){let n=t[e.itemType];return new n(e)}throw Error(`Unknown item type: ${e.itemType}`)}function De(e){return{...we,...e}}var Oe=`https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json`,ke=e=>{if(e.trim()===``)throw Error(`Locale cannot be empty`)},Ae=class e{_translations;constructor(){this._translations={}}setContent(e,t,n){if(ke(e),!this._translations?.[e]){if(!n)return;this._translations[e]={}}n?this._translations[e][t]=n:delete this._translations[e][t]}setAllForLocale(e,t){if(ke(e),!this._translations?.[e]){if(!t)return;this._translations[e]={}}this._translations[e]=t||{}}get locales(){return Object.keys(this._translations||{})}getAllForLocale(e){return this._translations?.[e]}getContent(e,t,n){let r=this._translations?.[e]?.[t];if(r)return r;if(n)return this._translations?.[n]?.[t]}clone(){let t=new e;for(let e of this.locales){let n=this.getAllForLocale(e);n&&t.setAllForLocale(e,v(n))}return t}removeContentKey(e){for(let t of this.locales)delete this._translations?.[t]?.[e]}removeContentKeysWithPrefix(e){for(let t of this.locales){let n=this._translations?.[t];if(n)for(let t of Object.keys(n))(t===e||t.startsWith(e+`.`))&&delete n[t]}}compact(){for(let e of this.locales){let t=this._translations?.[e];t&&Object.keys(t).length===0&&delete this._translations?.[e]}return this.locales.length>0?this:void 0}},je=class{_translations;constructor(e){this._translations=e||{}}serialize(){if(this.locales.length!==0)return this._translations}get locales(){return Object.keys(this._translations)}removeLocale(e){ke(e),delete this._translations[e]}renameLocale(e,t){ke(e),ke(t),this._translations[e]&&(this._translations[t]=this._translations[e],delete this._translations[e])}cloneLocaleAs(e,t){ke(e),ke(t),this._translations[e]&&(this._translations[t]=v(this._translations[e]))}get surveyCardContent(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.surveyCardContent;n&&(e[t]=n)}return e}get navigationContent(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.navigationContent;n&&(e[t]=n)}return e}get validationMessages(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.validationMessages;n&&(e[t]=n)}return e}setSurveyCardContent(e,t){if(ke(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].surveyCardContent=t}setNavigationContent(e,t){if(ke(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].navigationContent=t}setValidationMessages(e,t){if(ke(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].validationMessages=t}getItemTranslations(e){let t=new Ae;for(let n of this.locales){let r=this._translations?.[n].itemTranslations?.[e];t.setAllForLocale(n,r)}return t.locales.length>0?t:void 0}setItemTranslations(e,t){let n=t?.clone().compact();if(n?.locales.forEach(e=>ke(e)),n){let t=n.locales;for(let e of t)this.locales.includes(e)||(this._translations[e]={});for(let r of this.locales)t.includes(r)?(this._translations[r]||(this._translations[r]={}),this._translations[r].itemTranslations||(this._translations[r].itemTranslations={}),this._translations[r].itemTranslations[e]=n.getAllForLocale(r)):delete this._translations[r].itemTranslations?.[e]}else for(let t of this.locales)this._translations[t].itemTranslations?.[e]&&delete this._translations[t].itemTranslations?.[e]}onComponentKeyChanged(e,t,n){for(let r of this.locales){let i=this._translations?.[r].itemTranslations?.[e];if(i)for(let e of Object.keys(i))(e.startsWith(t+`.`)||e===t)&&(i[e.replace(t,n)]={...i[e]},delete i[e])}}onComponentDeleted(e,t){for(let n of this.locales){let r=this._translations?.[n].itemTranslations?.[e];if(r)for(let e of Object.keys(r))(e.startsWith(t+`.`)||e===t)&&delete r[e]}}onItemDeleted(e){for(let t of this.locales)delete this._translations[t].itemTranslations?.[e]}},Me=function(e){return e.richText=`richText`,e.plain=`plain`,e.md=`md`,e}({});function Ne(e){switch(e.type){case`paragraph`:return e.children.length>0;case`heading`:return e.children.length>0;case`bulletList`:return e.items.some(e=>e.children.some(e=>e.children.length>0));case`image`:return!0;case`infoBox`:return!0;case`separator`:return!0;case`blockExtension`:return!0}}function Pe(e){return e.doc.blocks.some(e=>Ne(e))}function Fe(e=``){return{type:`richText`,version:1,doc:{type:`doc`,blocks:[{type:`paragraph`,children:e.length>0?e.split(`
|
|
2
|
+
`).flatMap((e,t)=>{let n=[];return t>0&&n.push({type:`lineBreak`}),e.length>0&&n.push({type:`text`,text:e}),n}):[]}]}}}function Ie(e){return e.map(e=>{switch(e.type){case`text`:return e.text;case`template`:return`{${e.key}}`;case`lineBreak`:return`
|
|
3
|
+
`}}).join(``)}function Le(e){return e.map(e=>{switch(e.type){case`text`:return e.text;case`template`:return`{${e.key}}`;case`link`:return Ie(e.children);case`lineBreak`:return`
|
|
4
|
+
`;case`inlineExtension`:return``}}).join(``)}function Re(e){return e.map(e=>Le(e.children)).join(`
|
|
5
|
+
`)}function ze(e){switch(e.type){case`paragraph`:return Le(e.children);case`heading`:return Le(e.children);case`bulletList`:return e.items.map(e=>Re(e.children)).join(`
|
|
6
|
+
`);case`image`:{let t=e.caption?Re(e.caption):``;return[e.alt??``,t].filter(Boolean).join(`
|
|
7
|
+
`)}case`infoBox`:return[e.title?Le(e.title):``,Re(e.children)].filter(Boolean).join(`
|
|
8
|
+
`);case`separator`:return``;case`blockExtension`:return``}}function Be(e){return e.doc.blocks.map(e=>ze(e)).filter(e=>e.length>0).join(`
|
|
9
|
+
`).trim()}function Ve(e){return e?e.type===`richText`?Be(e):e.content??``:``}function He(e){return e?e.type===`richText`?!Pe(e):e.content.trim().length===0:!0}function Ue(e){if(!e||e.type!==`richText`)return[];let t=[];return e.doc.blocks.forEach((e,n)=>{e.type===`image`&&e.source.type===`asset`&&t.push({assetId:e.source.assetId,blockIndex:n})}),t}var We=class e{maxItemsPerPage;metadata;surveyItems=new Map;_templateValues=new Map;_assets=new Map;_translations;constructor(e){this.pluginRegistry=e,this._translations=new je}getPluginRegistry(){return this.pluginRegistry}createItemFromRaw(e){return Ee(e,this.pluginRegistry)}static createBlankSurvey(t,n){let r=n??S(),i={$schema:Oe,surveyItems:[{id:b(),key:r,itemType:`group`,config:{isRoot:!0,items:[],shuffleItems:!1}}]};return e.fromJson(i,t)}static fromJson(t,n){let r=new e(n),i=t;if(i.$schema!==`https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json`)throw Error(`Unsupported survey schema: ${i.$schema}`);if(r.surveyItems=new Map,!i.surveyItems||i.surveyItems.length===0)throw Error(`surveyItems is required`);return i.surveyItems.forEach(e=>{let t=Ee(e,n);r.surveyItems.set(t.id,t)}),i.templateValues&&(r._templateValues=F(i.templateValues)),i.assets&&(r._assets=new Map(Object.entries(i.assets))),r._translations=new je(i.translations),i.maxItemsPerPage&&(r.maxItemsPerPage=i.maxItemsPerPage),i.metadata&&(r.metadata=i.metadata),r}serialize(){let e={$schema:Oe,surveyItems:Array.from(this.surveyItems.values()).map(e=>e.rawItem)};return e.translations=this._translations?.serialize(),this._templateValues&&(e.templateValues=N(this._templateValues)),this._assets&&this._assets.size>0&&(e.assets=Object.fromEntries(this._assets.entries())),this.maxItemsPerPage&&(e.maxItemsPerPage=this.maxItemsPerPage),this.metadata&&(e.metadata=this.metadata),e}get surveyKey(){if(this.rootItem)return this.rootItem.key}get locales(){return this._translations?.locales||[]}get rootItem(){return Array.from(this.surveyItems.values()).find(e=>e instanceof Se&&e.isRoot)}get keyIndex(){let e=[];for(let t of this.surveyItems.values()){let n=this.getItemPath(t.id);e.push({itemId:t.id,key:t.key,keyPath:n.map(e=>this.surveyItems.get(e)?.key??``),path:n})}return e}getItemPath(e){let t=this.surveyItems.get(e);if(!t)throw Error(`Item ${e} not found`);if(t instanceof Se&&t.isRoot())return[];let n=this.getParentItem(e);if(!n)throw Error(`Parent item for ${e} not found`);return[...this.getItemPath(n.id),n.id]}getItemKey(e){let t=this.surveyItems.get(e);if(!t)return;let n=this.getItemPath(e).map(e=>this.surveyItems.get(e)?.key??``);return new ye(t.key,n)}getParentItem(e){let t=this.surveyItems.get(e);if(!t)throw Error(`Item ${e} not found`);if(t instanceof Se&&t.isRoot())return;let n=Array.from(this.surveyItems.values()).find(t=>t instanceof Se&&t.config.items?.includes(e));if(n)return n}getChildrenItems(e){let t=this.surveyItems.get(e);return!t||!(t instanceof Se)?[]:t.config.items?.map(e=>this.surveyItems.get(e))?.filter(e=>e!==void 0)||[]}getSiblings(e){return this.surveyItems.get(e)&&this.getParentItem(e)?.items?.map(e=>this.surveyItems.get(e))?.filter(e=>e!==void 0)||[]}get translations(){return this._translations||=new je,this._translations}getItemTranslations(e){if(!this.surveyItems.get(e))throw Error(`Item ${e} not found`);return this._translations?.getItemTranslations(e)}getTemplateValue(e){return this._templateValues?.get(e)}setTemplateValue(e,t){this._templateValues||=new Map,this._templateValues?.set(e,t)}deleteTemplateValue(e){this._templateValues?.delete(e)}getTemplateValueKeys(){return Array.from(this._templateValues?.keys()||[])}getAsset(e){let t=this._assets?.get(e);return t?v(t):void 0}setAsset(e,t){this._assets||=new Map,this._assets.set(e,v(t))}deleteAsset(e){this._assets?.delete(e)}hasAsset(e){return this._assets?.has(e)??!1}getAssetIds(){return Array.from(this._assets?.keys()||[])}getAssets(){return new Map(Array.from(this._assets?.entries()||[]).map(([e,t])=>[e,v(t)]))}getAssetUsages(e){let t=[],n=(n,r,i,a,o)=>{for(let s of Ue(n))e&&s.assetId!==e||t.push({assetId:s.assetId,itemId:o,locale:a,contentKey:i,usageScope:r,blockIndex:s.blockIndex})},r=this._translations?.serialize(),i=this.rootItem?.id;if(!r)return t;for(let[e,t]of Object.entries(r)){for(let[r,a]of Object.entries(t.surveyCardContent||{}))n(a,`surveyCard`,r,e,i);for(let[r,a]of Object.entries(t.navigationContent||{}))n(a,`navigation`,r,e,i);for(let[r,a]of Object.entries(t.validationMessages||{}))n(a,`validationMessages`,r,e,i);for(let[r,i]of Object.entries(t.itemTranslations||{}))for(let[t,a]of Object.entries(i||{}))n(a,`itemTranslation`,t,e,r)}return t}getAvailableResponseValueSlots(e){let t={};for(let n of this.surveyItems.values())t={...t,...n.getAvailableResponseValueSlots(e)};return t}getResponseSlotDefinitions(){return Array.from(this.surveyItems.values()).map(e=>({itemId:e.id,slots:e.getResponseSlotDefinitions()}))}getReferenceUsages(e){let t=[];for(let n of this.surveyItems.values())e&&n.id!==e&&!this.isDescendantOf(n.id,e)||t.push(...n.getReferenceUsages());if(this._templateValues)for(let[e,n]of this._templateValues.entries())for(let r of n.expression?.responseVariableRefs||[])t.push({itemId:e,usageType:`templateValues`,valueReference:r});return t}isDescendantOf(e,t){return e===t?!0:this.getItemPath(e).includes(t)}},Ge=365.2425,Ke=6048e5,qe=864e5,Je=43200,Ye=1440,Xe=3600*24;Xe*7,Xe*Ge/12*3;var Ze=Symbol.for(`constructDateFrom`);function Qe(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Ze in e?e[Ze](t):e instanceof Date?new e.constructor(t):new Date(t)}function $e(e,t){return Qe(t||e,e)}function et(e,t,n){let r=$e(e,n?.in);return isNaN(t)?Qe(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function tt(e,t,n){let r=$e(e,n?.in);if(isNaN(t))return Qe(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=Qe(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var nt={};function rt(){return nt}function it(e,t){let n=rt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=$e(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function at(e,t){return it(e,{...t,weekStartsOn:1})}function ot(e,t){let n=$e(e,t?.in),r=n.getFullYear(),i=Qe(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=at(i),o=Qe(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=at(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function st(e){let t=$e(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function ct(e,...t){let n=Qe.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function lt(e,t){let n=$e(e,t?.in);return n.setHours(0,0,0,0),n}function ut(e,t,n){let[r,i]=ct(n?.in,e,t),a=lt(r),o=lt(i),s=+a-st(a),c=+o-st(o);return Math.round((s-c)/qe)}function dt(e,t){let n=ot(e,t),r=Qe(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),at(r)}function ft(e,t,n){return et(e,t*7,n)}function pt(e,t,n){return tt(e,t*12,n)}function mt(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Qe.bind(null,e));let t=$e(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),Qe(r,n||NaN)}function ht(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Qe.bind(null,e));let t=$e(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),Qe(r,n||NaN)}function gt(e,t){let n=$e(e)-+$e(t);return n<0?-1:n>0?1:n}function _t(e){return Qe(e,Date.now())}function vt(e,t,n){let[r,i]=ct(n?.in,e,t);return+lt(r)==+lt(i)}function yt(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function bt(e){return!(!yt(e)&&typeof e!=`number`||isNaN(+$e(e)))}function xt(e,t,n){let[r,i]=ct(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function St(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function Ct(e,t){return $e(e)-+$e(t)}function wt(e,t){let n=$e(e,t?.in);return n.setHours(23,59,59,999),n}function Tt(e,t){let n=$e(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Et(e,t){let n=$e(e,t?.in);return+wt(n,t)==+Tt(n,t)}function Dt(e,t,n){let[r,i,a]=ct(n?.in,e,e,t),o=gt(i,a),s=Math.abs(xt(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=gt(i,a)===-o;Et(r)&&s===1&>(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function Ot(e,t,n){let r=Ct(e,t)/1e3;return St(n?.roundingMethod)(r)}function kt(e,t){let[n,r]=ct(e,t.start,t.end);return{start:n,end:r}}function At(e,t){let{start:n,end:r}=kt(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Qe(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function eee(e,t){let n=$e(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function jt(e,t){let n=$e(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Mt(e,t){let n=$e(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Nt(e,t){let{start:n,end:r}=kt(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Qe(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Pt(e,t){let n=rt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=$e(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Ft(e,t){return Pt(e,{...t,weekStartsOn:1})}var It={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Lt=(e,t,n)=>{let r,i=It[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Rt(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var zt={date:Rt({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Rt({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Rt({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Bt={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Vt=(e,t,n,r)=>Bt[e];function Ht(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var Ut={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Ht({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Ht({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ht({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Ht({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Ht({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Wt(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Kt(s,e=>e.test(o)):Gt(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Gt(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Kt(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function qt(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Jt={code:`en-US`,formatDistance:Lt,formatLong:zt,formatRelative:Vt,localize:Ut,match:{ordinalNumber:qt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Wt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Wt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Wt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Wt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Wt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Yt(e,t){let n=$e(e,t?.in);return ut(n,Mt(n))+1}function Xt(e,t){let n=$e(e,t?.in),r=at(n)-+dt(n);return Math.round(r/Ke)+1}function Zt(e,t){let n=$e(e,t?.in),r=n.getFullYear(),i=rt(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Qe(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=it(o,t),c=Qe(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=it(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Qt(e,t){let n=rt(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Zt(e,t),a=Qe(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),it(a,t)}function $t(e,t){let n=$e(e,t?.in),r=it(n,t)-+Qt(n,t);return Math.round(r/Ke)+1}function en(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var tn={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return en(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):en(n+1,2)},d(e,t){return en(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return en(e.getHours()%12||12,t.length)},H(e,t){return en(e.getHours(),t.length)},m(e,t){return en(e.getMinutes(),t.length)},s(e,t){return en(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return en(Math.trunc(r*10**(n-3)),t.length)}},nn={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},rn={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return tn.y(e,t)},Y:function(e,t,n,r){let i=Zt(e,r),a=i>0?i:1-i;return t===`YY`?en(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):en(a,t.length)},R:function(e,t){return en(ot(e),t.length)},u:function(e,t){return en(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return en(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return en(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return tn.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return en(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=$t(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):en(i,t.length)},I:function(e,t,n){let r=Xt(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):en(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):tn.d(e,t)},D:function(e,t,n){let r=Yt(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):en(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return en(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return en(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return en(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?nn.noon:r===0?nn.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?nn.evening:r>=12?nn.afternoon:r>=4?nn.morning:nn.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return tn.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):tn.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):en(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):en(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):tn.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):tn.s(e,t)},S:function(e,t){return tn.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return on(r);case`XXXX`:case`XX`:return sn(r);default:return sn(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return on(r);case`xxxx`:case`xx`:return sn(r);default:return sn(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+an(r,`:`);default:return`GMT`+sn(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+an(r,`:`);default:return`GMT`+sn(r,`:`)}},t:function(e,t,n){return en(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return en(+e,t.length)}};function an(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+en(a,2)}function on(e,t){return e%60==0?(e>0?`-`:`+`)+en(Math.abs(e)/60,2):sn(e,t)}function sn(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=en(Math.trunc(r/60),2),a=en(r%60,2);return n+i+t+a}var cn=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},ln=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},un={p:ln,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return cn(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,cn(r,t)).replace(`{{time}}`,ln(i,t))}},dn=/^D+$/,fn=/^Y+$/,pn=[`D`,`DD`,`YY`,`YYYY`];function mn(e){return dn.test(e)}function hn(e){return fn.test(e)}function gn(e,t,n){let r=_n(e,t,n);if(console.warn(r),pn.includes(e))throw RangeError(r)}function _n(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var vn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,yn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bn=/^'([^]*?)'?$/,xn=/''/g,Sn=/[a-zA-Z]/;function Cn(e,t,n){let r=rt(),i=n?.locale??r.locale??Jt,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=$e(e,n?.in);if(!bt(s))throw RangeError(`Invalid time value`);let c=t.match(yn).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=un[t];return n(e,i.formatLong)}return e}).join(``).match(vn).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:wn(e)};if(rn[t])return{isToken:!0,value:e};if(t.match(Sn))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&hn(a)||!n?.useAdditionalDayOfYearTokens&&mn(a))&&gn(a,t,String(e));let o=rn[a[0]];return o(s,a,i.localize,l)}).join(``)}function wn(e){let t=e.match(bn);return t?t[1].replace(xn,`'`):e}function Tn(e,t,n){let r=rt(),i=n?.locale??r.locale??Jt,a=gt(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=ct(n?.in,...a>0?[t,e]:[e,t]),l=Ot(c,s),u=(st(c)-st(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/Ye);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/Je),i.formatDistance(`aboutXMonths`,f,o);if(f=Dt(c,s),f<12){let e=Math.round(d/Je);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function En(e,t){return Tn(e,_t(e),t)}function Dn(e,t){let n=$e(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=Qe(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function On(e,t){return $e(e,t?.in).getMonth()}function kn(e,t){return $e(e,t?.in).getFullYear()}function An(e,t){return+$e(e)>+$e(t)}function jn(e,t){return+$e(e)<+$e(t)}function Mn(e,t,n){let[r,i]=ct(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function tee(e,t,n){let[r,i]=ct(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function nee(e,t,n){let r=$e(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=Qe(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=Dn(o);return r.setMonth(t,Math.min(a,s)),r}function ree(e,t,n){let r=$e(e,n?.in);return isNaN(+r)?Qe(n?.in||e,NaN):(r.setFullYear(t),r)}var Nn={lessThanXSeconds:{standalone:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`},withPreposition:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`}},xSeconds:{standalone:{one:`1 Sekunde`,other:`{{count}} Sekunden`},withPreposition:{one:`1 Sekunde`,other:`{{count}} Sekunden`}},halfAMinute:{standalone:`eine halbe Minute`,withPreposition:`einer halben Minute`},lessThanXMinutes:{standalone:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`},withPreposition:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`}},xMinutes:{standalone:{one:`1 Minute`,other:`{{count}} Minuten`},withPreposition:{one:`1 Minute`,other:`{{count}} Minuten`}},aboutXHours:{standalone:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`},withPreposition:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`}},xHours:{standalone:{one:`1 Stunde`,other:`{{count}} Stunden`},withPreposition:{one:`1 Stunde`,other:`{{count}} Stunden`}},xDays:{standalone:{one:`1 Tag`,other:`{{count}} Tage`},withPreposition:{one:`1 Tag`,other:`{{count}} Tagen`}},aboutXWeeks:{standalone:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`},withPreposition:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`}},xWeeks:{standalone:{one:`1 Woche`,other:`{{count}} Wochen`},withPreposition:{one:`1 Woche`,other:`{{count}} Wochen`}},aboutXMonths:{standalone:{one:`etwa 1 Monat`,other:`etwa {{count}} Monate`},withPreposition:{one:`etwa 1 Monat`,other:`etwa {{count}} Monaten`}},xMonths:{standalone:{one:`1 Monat`,other:`{{count}} Monate`},withPreposition:{one:`1 Monat`,other:`{{count}} Monaten`}},aboutXYears:{standalone:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahre`},withPreposition:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahren`}},xYears:{standalone:{one:`1 Jahr`,other:`{{count}} Jahre`},withPreposition:{one:`1 Jahr`,other:`{{count}} Jahren`}},overXYears:{standalone:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahre`},withPreposition:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahren`}},almostXYears:{standalone:{one:`fast 1 Jahr`,other:`fast {{count}} Jahre`},withPreposition:{one:`fast 1 Jahr`,other:`fast {{count}} Jahren`}}},iee=(e,t,n)=>{let r,i=n?.addSuffix?Nn[e].withPreposition:Nn[e].standalone;return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:`vor `+r:r},aee={date:Rt({formats:{full:`EEEE, do MMMM y`,long:`do MMMM y`,medium:`do MMM y`,short:`dd.MM.y`},defaultWidth:`full`}),time:Rt({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Rt({formats:{full:`{{date}} 'um' {{time}}`,long:`{{date}} 'um' {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},oee={lastWeek:`'letzten' eeee 'um' p`,yesterday:`'gestern um' p`,today:`'heute um' p`,tomorrow:`'morgen um' p`,nextWeek:`eeee 'um' p`,other:`P`},see=(e,t,n,r)=>oee[e],cee={narrow:[`v.Chr.`,`n.Chr.`],abbreviated:[`v.Chr.`,`n.Chr.`],wide:[`vor Christus`,`nach Christus`]},lee={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1. Quartal`,`2. Quartal`,`3. Quartal`,`4. Quartal`]},Pn={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mär`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Dez`],wide:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]},Fn={narrow:Pn.narrow,abbreviated:[`Jan.`,`Feb.`,`März`,`Apr.`,`Mai`,`Juni`,`Juli`,`Aug.`,`Sep.`,`Okt.`,`Nov.`,`Dez.`],wide:Pn.wide},In={code:`de`,formatDistance:iee,formatLong:aee,formatRelative:see,localize:{ordinalNumber:e=>Number(e)+`.`,era:Ht({values:cee,defaultWidth:`wide`}),quarter:Ht({values:lee,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ht({values:Pn,formattingValues:Fn,defaultWidth:`wide`}),day:Ht({values:{narrow:[`S`,`M`,`D`,`M`,`D`,`F`,`S`],short:[`So`,`Mo`,`Di`,`Mi`,`Do`,`Fr`,`Sa`],abbreviated:[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`],wide:[`Sonntag`,`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`]},defaultWidth:`wide`}),dayPeriod:Ht({values:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachm.`,evening:`Abend`,night:`Nacht`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachm.`,evening:`abends`,night:`nachts`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:qt({matchPattern:/^(\d+)(\.)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:Wt({matchPatterns:{narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^v/i,/^n/i]},defaultParseWidth:`any`}),quarter:Wt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Wt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Wt({matchPatterns:{narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Wt({matchPatterns:{narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},defaultMatchWidth:`wide`,parsePatterns:{any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Ln=class e{itemId;meta;response;itemType;constructor(e,t){this.itemId=e.itemId,this.response=t,this.itemType=e.itemType}serialize(){return{itemId:this.itemId,itemType:this.itemType,meta:this.meta,response:this.response?.serialize()}}static deserialize(t){if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Invalid survey item response payload`);if(typeof t.itemId!=`string`||t.itemId.trim().length===0)throw Error(`Survey item response is missing a valid itemId`);if(typeof t.itemType!=`string`||t.itemType.trim().length===0)throw Error(`Survey item response is missing a valid itemType`);let n=new e({itemId:t.itemId,itemType:t.itemType},t.response?Rn.deserialize(t.response):void 0);return n.meta=t.meta,n}},Rn=class e{_slots;constructor(e){this._slots=new Map(e??[])}get(e){return this._slots.get(e)}setSlotValue(e,t){t?this._slots.set(e,t):this._slots.delete(e)}serialize(){if(this._slots.size!==0)return{slots:Object.fromEntries(this._slots.entries())}}isEmpty(){return this._slots.size===0}clone(){return new e(Array.from(this._slots.entries()))}static deserialize(t){if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Invalid response item payload`);let{slots:n}=t;if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Invalid response slots payload`);return new e(Object.entries(n).map(([e,t])=>{if(e.trim().length===0)throw Error(`Response slot id cannot be empty`);return ue(t,`response.slots.${e}`),[e,t]}))}},zn={openSurvey:`openSurvey`,pageChanged:`pageChanged`,responeChanged:`responeChanged`,languageChanged:`languageChanged`},Bn=class{context;constructor(e){this.context=e}eval(e){if(e!==void 0)switch(e.type){case T.Const:return this.evaluateConst(e);case T.Function:return this.evaluateFunction(e);case T.ResponseVariable:return this.evaluateResponseVariable(e);case T.ContextVariable:return this.evaluateContextVariable(e);default:throw Error(`Unsupported expression type: ${e.type}`)}}setContext(e){this.context=e}evaluateConst(e){return e.value}evaluateResponseVariable(e){let t=e.responseVariableRef;switch(t.name){case`get`:return this.context?.responses[t.itemId]?.response?.get(t.slotId);case`isDefined`:return{type:I.boolean,value:this.context?.responses[t.itemId]?.response?.get(t.slotId)!==void 0};default:throw Error(`Unsupported value reference method: ${t.name}`)}}evaluateFunction(e){switch(e.functionName){case`and`:return this.evaluateAnd(e);case`or`:return this.evaluateOr(e);case`not`:return this.evaluateNot(e);case`str_eq`:return this.evaluateStrEq(e);case`eq`:return this.evaluateEq(e);case`gt`:return this.evaluateGt(e);case`gte`:return this.evaluateGte(e);case`lt`:return this.evaluateLt(e);case`lte`:return this.evaluateLte(e);case`in_range`:return this.evaluateInRange(e);case`sum`:return this.evaluateSum(e);case`min`:return this.evaluateMin(e);case`max`:return this.evaluateMax(e);case`list_contains`:return this.evaluateListContains(e);default:throw Error(`Unsupported function: ${e.functionName}`)}}evaluateContextVariable(e){if(!this.context?.surveyContext)return;let t=this.context.surveyContext;switch(e.contextType){case E.Locale:return{type:I.string,value:t.locale};case E.ParticipantFlag:{if(!e.key)return;let n=this.eval(e.key);if(n?.type!==I.string||n.value===void 0)return;let r=t.participantFlags?.[n.value];switch(e.asType){case I.boolean:return{type:I.boolean,value:r!==void 0};case I.string:return r===void 0?void 0:{type:I.string,value:r};case I.number:{if(r===void 0)return;let e=parseFloat(r);return isNaN(e)?void 0:{type:I.number,value:e}}case I.date:{if(r===void 0)return;let e=parseFloat(r);return isNaN(e)?void 0:{type:I.date,value:e}}default:return r===void 0?void 0:{type:I.string,value:r}}}case E.CustomValue:{if(!e.key)return;let n=this.eval(e.key);if(n?.type!==I.string||n.value===void 0)return;let r=t.customValues?.[n.value];if(r===void 0)return;if(e.asType!==void 0&&r?.type!==e.asType)throw Error(`Custom value type does not match expected type, got ${r?.type} and expected ${e.asType}`);return r}case E.CustomExpression:{if(!e.key)return;let n=this.eval(e.key);if(n?.type!==I.string||n.value===void 0)return;let r=t.customExpressions?.[n.value];if(typeof r!==T.Function||r===void 0)return;try{let t=e.arguments,n=r(t);if(e.asType!==void 0&&n?.type!==e.asType)throw Error(`Custom expression result type does not match expected type, got ${n?.type} and expected ${e.asType}`);return n}catch(e){throw Error(`Error evaluating custom expression: ${e}`)}}}}evaluateAnd(e){return{type:I.boolean,value:e.arguments.every(e=>this.eval(e)?.value===!0)}}evaluateOr(e){return{type:I.boolean,value:e.arguments.some(e=>this.eval(e)?.value===!0)}}evaluateNot(e){if(e.arguments.length!==1||e.arguments[0]===void 0)throw Error(`Not function expects 1 argument, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]);if(t?.type!==I.boolean)throw Error(`Not function expects a boolean argument, got ${t?.type}`);return t===void 0?{type:I.boolean,value:!1}:{type:I.boolean,value:!t.value}}evaluateListContains(e){if(e.arguments.length!==2)throw Error(`List contains function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};let r=[I.stringArray,I.referenceArray],i=[I.string,I.reference],a=t.type,o=n.type;if(!r.includes(a)||!i.includes(o))throw Error(`List contains function expects a string array list and a string item, got ${t?.type} and ${n?.type}`);let s=t.value,c=n.value;return{type:I.boolean,value:s.includes(c)}}evaluateStrEq(e){if(e.arguments.length!==2)throw Error(`String equals function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==I.string||n?.type!==I.string)throw Error(`String equals function expects strings for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value===n.value}}evaluateEq(e){if(e.arguments.length!==2)throw Error(`Equals function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==n?.type)throw Error(`Equals function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value===n.value}}evaluateGt(e){if(e.arguments.length!==2)throw Error(`Greater than function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==n?.type)throw Error(`Greater than function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value>n.value}}evaluateGte(e){if(e.arguments.length!==2)throw Error(`Greater than or equal to function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==n?.type)throw Error(`Greater than or equal to function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value>=n.value}}evaluateLt(e){if(e.arguments.length!==2)throw Error(`Less than function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==n?.type)throw Error(`Less than function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value<n.value}}evaluateLte(e){if(e.arguments.length!==2)throw Error(`Less than or equal to function expects 2 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]);if(t===void 0||n===void 0)return{type:I.boolean,value:!1};if(t?.type!==n?.type)throw Error(`Less than or equal to function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);return{type:I.boolean,value:t.value<=n.value}}evaluateInRange(e){if(e.arguments.length!==4)throw Error(`In range function expects 4 arguments, got ${e.arguments.length}`);let t=this.eval(e.arguments[0]),n=this.eval(e.arguments[1]),r=this.eval(e.arguments[2]),i=this.eval(e.arguments[3])?.value===!0;if(t===void 0||n===void 0||r===void 0)return{type:I.boolean,value:!1};if(t?.type!==I.number||n?.type!==I.number||r?.type!==I.number)throw Error(`In range function expects numbers for all arguments, got ${t?.type} and ${n?.type} and ${r?.type}`);return i?{type:I.boolean,value:t.value>=n.value&&t.value<=r.value}:{type:I.boolean,value:t.value>n.value&&t.value<r.value}}evaluateSum(e){if(e.arguments.length<1)throw Error(`Sum function expects at least 1 argument, got ${e.arguments.length}`);return e.arguments.reduce((e,t)=>{if(t===void 0)return e;let n=this.eval(t);if(n===void 0)return e;if(n?.type===I.number)return{type:I.number,value:e.value+n.value};throw Error(`Sum function expects all arguments to be numbers, got ${n?.type}`)},{type:I.number,value:0})}evaluateMin(e){if(e.arguments.length<1)throw Error(`Min function expects at least 1 argument, got ${e.arguments.length}`);return e.arguments.reduce((e,t)=>{if(t===void 0)return e;let n=this.eval(t);if(n===void 0)return e;if(n?.type===I.number)return{type:I.number,value:Math.min(e.value,n.value)};throw Error(`Min function expects all arguments to be numbers, got ${typeof n}`)},{type:I.number,value:1/0})}evaluateMax(e){if(e.arguments.length<1)throw Error(`Max function expects at least 1 argument, got ${e.arguments.length}`);return e.arguments.reduce((e,t)=>{if(t===void 0)return e;let n=this.eval(t);if(n===void 0)return e;if(n?.type===I.number)return{type:I.number,value:Math.max(e.value,n.value)};throw Error(`Max function expects all arguments to be numbers, got ${typeof n}`)},{type:I.number,value:-1/0})}},Vn=class{surveyDef;renderedSurveyTree;context;locale;sessionSeedValue;responses;prefills;_events;_openedAt;dateLocales;prefillEnvironment;cache;constructor(e,t,n,r,i){if(this._openedAt=this._getTimestamp(),this.sessionSeedValue=b(),this.surveyDef=e,this.context=t||{locale:`en`},this.locale=this.context.locale,this.prefills=n?n.reduce((e,t)=>(e[t.itemId]=Ln.deserialize(t),e),{}):void 0,this.prefillEnvironment=i?.prefillEnvironment,this.dateLocales=r||[{code:`en`,locale:Jt}],this.responses=this.initResponseObject(this.surveyDef.surveyItems),this.initCache(),this.applyConfiguredPrefills(),this.evalExpressions(),!e.rootItem)throw Error(`constructor: root item not found`);this.renderedSurveyTree=this.renderGroup(e.rootItem),this._events=[{type:zn.openSurvey,timestamp:this._getTimestamp(),value:this.context.locale}]}setContext(e){this.context=e}getDateLocales(){return this.dateLocales.slice()}getCurrentDateLocale(){let e=this.dateLocales.find(e=>e.code===this.locale);return e?e?.locale:(console.warn(`Locale '${this.locale}' is not available. Using default locale.`),this.dateLocales.length>0?this.dateLocales[0].locale:Jt)}updateContext(e){this.context=e,this.locale=e.locale,this._registerSurveyEvent({type:zn.languageChanged,timestamp:this._getTimestamp(),value:e.locale}),this.evalExpressions(),this.reRenderSurveyTree()}setResponse(e,t){let n=this.getResponseItem(e);if(!n)throw Error(`setResponse: target not found for key: `+e);n.response=t,this._registerSurveyEvent({type:zn.responeChanged,timestamp:this._getTimestamp(),itemId:e}),this.evalExpressions(),this.reRenderSurveyTree()}get openedAt(){return this._openedAt}get sessionSeed(){return this.sessionSeedValue}get survey(){return this.surveyDef}getSurveyPages(e){let t=Hn(this.renderedSurveyTree),n=[];e||=`large`;let r=[];return t.forEach(t=>{if(t.type===`page-break`){r.length>0&&(n.push([...r]),r=[]);return}if(r.push(t),!this.surveyDef.maxItemsPerPage)return;let i=0;switch(e){case`large`:i=this.surveyDef.maxItemsPerPage.large;break;case`small`:i=this.surveyDef.maxItemsPerPage.small;break}r.length>=i&&(n.push([...r]),r=[])}),r.length>0&&n.push([...r]),n}getRenderedSurveyItem(e){return Hn(this.renderedSurveyTree).find(t=>t.id===e)}onPageChanged(e){this._registerSurveyEvent({type:zn.pageChanged,timestamp:this._getTimestamp(),value:e})}getEvents(){return this._events.slice()}getResponses(){let e=new Map;Hn(this.renderedSurveyTree).filter(e=>e.type!==`page-break`).forEach((t,n)=>{this.responses[t.id]&&e.set(t.id,n)});let t=[];return this.surveyDef.surveyItems.forEach((n,r)=>{if(!n.isInteractive())return;let i=this.getResponseItem(r);if(!i)return;let a=e.get(r);i.meta=a===void 0?void 0:{position:a},t.push(i)}),t}getDisplayConditionValue(e,t){return t?this.cache.displayConditions[e]?.components?.[t]?.result:this.cache.displayConditions[e]?.root?.result}getDisabledConditionValue(e,t){return this.cache.disabledConditions[e]?.components?.[t]?.result}getTemplateValue(e){return this.cache.templateValues[e]?.value}getValidationValues(e){let t=this.cache.validations[e];if(t)return Object.keys(t).reduce((e,n)=>(e[n]=t[n].result,e),{})}initCache(){this.cache={validations:{},displayConditions:{},templateValues:{},disabledConditions:{}},this.surveyDef.getTemplateValueKeys().forEach(e=>{this.cache.templateValues[e]={value:void 0,templateDef:this.surveyDef.getTemplateValue(e)}}),this.surveyDef.surveyItems.forEach((e,t)=>{e.validations&&Object.keys(e.validations).length>0&&(this.cache.validations[t]={},Object.keys(e.validations).forEach(n=>{let r=e.validations[n];if(!r){console.warn(`initCache: validation expression not found: `+t+` `+n);return}this.cache.validations[t][n]={expression:r,result:!1}})),e.displayConditions!==void 0&&(e.displayConditions.root||e.displayConditions.components)&&(this.cache.displayConditions[t]={},e.displayConditions.root&&(this.cache.displayConditions[t].root={expression:e.displayConditions.root,result:!1}),e.displayConditions.components&&(this.cache.displayConditions[t].components={},Object.keys(e.displayConditions.components).forEach(n=>{let r=e.displayConditions?.components?.[n];if(!r){console.warn(`initCache: display condition component expression not found: `+t+` `+n);return}this.cache.displayConditions[t].components[n]={expression:r,result:!1}}))),e.disabledConditions!==void 0&&e.disabledConditions.components!==void 0&&(this.cache.disabledConditions[t]={components:{}},Object.keys(e.disabledConditions.components).forEach(n=>{let r=e.disabledConditions?.components?.[n];if(!r){console.warn(`initCache: disabled condition component expression not found: `+t+` `+n);return}this.cache.disabledConditions[t].components[n]={expression:r,result:!1}}))})}initResponseObject(e){let t={};return e.forEach((e,n)=>{if(e.isInteractive){let r=this.prefills?.[n],i=r&&r.itemType===e.type;t[n]=new Ln({itemId:n,itemType:e.type},i?r.response:void 0)}else return}),t}applyConfiguredPrefills(){let e=new Bn({responses:this.responses,surveyContext:this.context}),t=Math.max(this.surveyDef.surveyItems.size,1);for(let n=0;n<t;n++){this.evalTemplateValues(e);let t=!1;if(this.surveyDef.surveyItems.forEach(n=>{n.isInteractive()&&(t=this.applyConfiguredPrefillsForItem(n,e)||t)}),!t)break}this.evalTemplateValues(e)}applyConfiguredPrefillsForItem(e,t){let n=this.responses[e.id];if(!n)return!1;let r=!1;for(let i of e.prefills??[]){let a=e.resolvePrefillTarget(i.target);if(!a||(i.apply??pe.ifEmpty)===pe.ifEmpty&&n.response?.get(a.slotId)!==void 0||!this.shouldApplyConfiguredPrefill(i,t))continue;let o=this.resolveConfiguredPrefillValue(i,a,t);if(!o)continue;let s=e.normalizePrefillValue(i,a,o);if(!s)continue;let c=n.response?.clone()??new Rn;c.setSlotValue(a.slotId,s),n.response=c.isEmpty()?void 0:c,r=!0}return r}shouldApplyConfiguredPrefill(e,t){if(!e.when)return!0;let n=t.eval(e.when);return n?.type===I.boolean&&n.value===!0}resolveConfiguredPrefillValue(e,t,n){switch(e.source.type){case`static`:return e.source.value;case`expression`:return n.eval(e.source.expression);case`templateValue`:return this.getTemplateValue(e.source.key);case`previousResponse`:{if(!this.prefillEnvironment?.getPreviousResponse)return;let t=e.source.ref.target??e.target;return this.prefillEnvironment.getPreviousResponse({surveyKey:e.source.ref.surveyKey,itemId:e.source.ref.itemId,target:t})||void 0}default:return}}shouldRender(e,t){let n=this.getDisplayConditionValue(e,t);return n===void 0?!0:n}sequentialRender(e){let t=[];for(let n of e.items||[]){if(!this.shouldRender(n))continue;let e=this.surveyDef.surveyItems.get(n);if(!e){console.warn(`sequentialRender: item not found: `+n);continue}if(e.type===`group`){t.push(this.renderGroup(e));continue}t.push({id:n,type:e.type})}return{id:e.id,type:`group`,items:t}}randomizedItemRender(e,t){let n=t.items?.filter(e=>this.shouldRender(e.id))||[],r=e.items||[],i=_(r.length);for(let e of i){let i=r[e];if(t.items?.find(e=>e.id===i)||!this.shouldRender(i))continue;let a=this.surveyDef.surveyItems.get(i);if(!a){console.warn(`randomizedItemRender: item not found: `+i);continue}if(a.type===`group`){n.push(this.renderGroup(a,t));continue}n.push({id:i,type:a.type})}return{id:e.id,type:`group`,items:n}}renderGroup(e,t){return t||={id:e.id,type:`group`,items:[]},e.config.shuffleItems?this.randomizedItemRender(e,t):this.sequentialRender(e)}reRenderSurveyTree(){if(!this.surveyDef.rootItem)throw Error(`reRenderSurveyTree: root item not found`);this.renderedSurveyTree=this.renderGroup(this.surveyDef.rootItem)}_registerSurveyEvent(e){this._events.push(e)}_getTimestamp(){return Math.floor(Date.now()/1e3)}getResponseItem(e){return this.responses[e]}evalExpressions(){let e=new Bn({responses:this.responses,surveyContext:this.context});this.evalTemplateValues(e),this.evalDisplayConditions(e),this.evalDisableConditions(e),this.evalValidations(e)}evalTemplateValues(e){Object.keys(this.cache.templateValues).forEach(t=>{let n=this.cache.templateValues[t];if(this.cache.templateValues[t].value=void 0,!n.templateDef?.expression){console.warn(`evalTemplateValues: template value expression not found: `+t);return}let r=e.eval(n.templateDef.expression);if(r===void 0){console.warn(`evalTemplateValues: template value expression returned undefined: `+t);return}switch(n.templateDef.type){case`date2string`:if(r.type!==I.date){console.warn(`evalTemplateValues: template value expression returned non-date value: `+t);return}r={type:I.string,value:Cn(new Date(r.value*1e3),n.templateDef.dateFormat)};break;default:break}this.cache.templateValues[t].value=r})}evalDisplayConditions(e){Object.keys(this.cache.displayConditions).forEach(t=>{let n=this.cache.displayConditions[t];if(n.root){let r=e.eval(n.root.expression);if(r===void 0||r.type!==I.boolean){console.warn(`evalDisplayConditions: display condition expression returned undefined: `+t);return}this.cache.displayConditions[t].root.result=r.value}n.components&&Object.keys(n.components).forEach(r=>{let i=e.eval(n.components[r].expression);if(i===void 0||i.type!==I.boolean){console.warn(`evalDisplayConditions: display condition component expression returned undefined: `+t+`.`+r);return}this.cache.displayConditions[t].components[r].result=i.value})})}evalDisableConditions(e){Object.keys(this.cache.disabledConditions).forEach(t=>{let n=this.cache.disabledConditions[t];n.components&&Object.keys(n.components).forEach(r=>{let i=e.eval(n.components[r].expression);if(i===void 0||i.type!==I.boolean){console.warn(`evalDisableConditions: disable condition component expression returned undefined: `+t+`.`+r);return}this.cache.disabledConditions[t].components[r].result=i.value})})}evalValidations(e){Object.keys(this.cache.validations).forEach(t=>{let n=this.cache.validations[t];Object.keys(n).forEach(r=>{let i=e.eval(n[r].expression);if(i===void 0||i.type!==I.boolean){console.warn(`evalValidations: validation expression returned undefined: `+t+`.`+r);return}this.cache.validations[t][r].result=i.value})})}},Hn=e=>{let t=[];return e.items?.forEach(e=>{e.type===`group`?t.push(...Hn(e)):t.push({...e})}),t};({default:`default`,mask:`mask`,dateFormat:`dateFormat`}).default;function Un(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Un(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Wn(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Un(e))&&(r&&(r+=` `),r+=t);return r}var Gn=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Kn=Wn,qn=(e,t)=>n=>{if(t?.variants==null)return Kn(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Gn(t)||Gn(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Kn(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function Jn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Yn(...e){return t=>{let n=!1,r=e.map(e=>{let r=Jn(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Jn(e[t],null)}}}}function Xn(...e){return d.useCallback(Yn(...e),e)}function Zn(e){let t=d.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];or(r)&&typeof ur==`function`&&(r=ur(r._payload)),d.Children.forEach(r,e=>{if(ir(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;or(n)&&typeof ur==`function`&&(n=ur(n._payload)),a=tr(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=d.cloneElement(a,void 0,s):!o&&d.Children.count(r)===1&&d.isValidElement(r)&&(a=r);let c=a?rr(a):void 0,l=Xn(n,c);if(!a){if(r||r===0)throw Error(o?lr(e):cr(e));return r}let u=nr(i,a.props??{});return a.type!==d.Fragment&&(u.ref=n?l:c),d.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Qn=Zn(`Slot`),$n=Symbol.for(`radix.slottable`);function er(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=$n,t}var tr=(e,t)=>{if(`child`in e.props){let t=e.props.child;return d.isValidElement(t)?d.cloneElement(t,void 0,e.props.children(t.props.children)):null}return d.isValidElement(t)?t:null};function nr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function rr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ir(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===$n}var ar=Symbol.for(`react.lazy`);function or(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ar&&`_payload`in e&&sr(e._payload)}function sr(e){return typeof e==`object`&&!!e&&`then`in e}var cr=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,lr=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ur=d.use,L=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Zn(`Primitive.${t}`),r=d.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,p.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function dr(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}var fr=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),pr=`VisuallyHidden`,mr=d.forwardRef((e,t)=>(0,p.jsx)(L.span,{...e,ref:t,style:{...fr,...e.style}}));mr.displayName=pr;var hr=mr;function gr(e,t){let n=d.createContext(t);n.displayName=e+`Context`;let r=e=>{let{children:t,...r}=e,i=d.useMemo(()=>r,Object.values(r));return(0,p.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=d.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function _r(e,t=[]){let n=[];function r(t,r){let i=d.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=d.useMemo(()=>o,Object.values(o));return(0,p.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=d.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>d.createContext(e));return function(n){let r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,vr(i,...t)]}function vr(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function yr(e){let t=e+`CollectionProvider`,[n,r]=_r(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=d.useRef(null),a=d.useRef(new Map).current;return(0,p.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Zn(s),l=d.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,p.jsx)(c,{ref:Xn(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,f=`data-radix-collection-item`,m=Zn(u),h=d.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=d.useRef(null),s=Xn(t,o),c=a(u,n);return d.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,p.jsx)(m,{[f]:``,ref:s,children:r})});h.displayName=u;function g(t){let n=a(e+`CollectionConsumer`,t);return d.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},g,r]}typeof window<`u`&&window.document&&window.document.createElement;function R(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var br=globalThis?.document?d.useLayoutEffect:()=>{},xr=d.useInsertionEffect||br;function Sr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Cr({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=d.useRef(e!==void 0);d.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,d.useCallback(t=>{if(s){let n=wr(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Cr({defaultProp:e,onChange:t}){let[n,r]=d.useState(e),i=d.useRef(n),a=d.useRef(t);return xr(()=>{a.current=t},[t]),d.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function wr(e){return typeof e==`function`}function Tr(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}var Er=e=>{let{present:t,children:n}=e,r=Dr(t),i=typeof n==`function`?n({present:r.isPresent}):d.Children.only(n),a=kr(r.ref,jr(i));return typeof n==`function`||r.isPresent?d.cloneElement(i,{ref:a}):null};Er.displayName=`Presence`;function Dr(e){let[t,n]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef(`none`),[o,s]=Tr(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return d.useEffect(()=>{let e=Ar(r.current);a.current=o===`mounted`?e:`none`},[o]),br(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ar(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),br(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ar(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ar(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:d.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Or(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function kr(...e){let t=d.useRef(e);return t.current=e,d.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Or(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Or(n[e],null)}}},[])}function Ar(e){return e?.animationName||`none`}function jr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mr=d.useId||(()=>void 0),Nr=0;function Pr(e){let[t,n]=d.useState(Mr());return br(()=>{e||n(e=>e??String(Nr++))},[e]),e||(t?`radix-${t}`:``)}var Fr=`Collapsible`,[Ir,uee]=_r(Fr),[Lr,Rr]=Ir(Fr),zr=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Sr({prop:r,defaultProp:i??!1,onChange:o,caller:Fr});return(0,p.jsx)(Lr,{scope:n,disabled:a,contentId:Pr(),open:c,onOpenToggle:d.useCallback(()=>l(e=>!e),[l]),children:(0,p.jsx)(L.div,{"data-state":Gr(c),"data-disabled":a?``:void 0,...s,ref:t})})});zr.displayName=Fr;var Br=`CollapsibleTrigger`,Vr=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Rr(Br,n);return(0,p.jsx)(L.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Gr(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:R(e.onClick,i.onOpenToggle)})});Vr.displayName=Br;var Hr=`CollapsibleContent`,Ur=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Rr(Hr,e.__scopeCollapsible);return(0,p.jsx)(Er,{present:n||i.open,children:({present:e})=>(0,p.jsx)(Wr,{...r,ref:t,present:e})})});Ur.displayName=Hr;var Wr=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Rr(Hr,n),[s,c]=d.useState(r),l=d.useRef(null),u=Xn(t,l),f=d.useRef(0),m=f.current,h=d.useRef(0),g=h.current,_=o.open||s,v=d.useRef(_),y=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),br(()=>{let e=l.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();f.current=t.height,h.current=t.width,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(r)}},[o.open,r]),(0,p.jsx)(L.div,{"data-state":Gr(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!_,...a,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:_&&i})});function Gr(e){return e?`open`:`closed`}var Kr=zr,qr=d.createContext(void 0);function Jr(e){let t=d.useContext(qr);return e||t||`ltr`}function Yr(e){let t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}function Xr(e,t=globalThis?.document){let n=Yr(e);d.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Zr=`DismissableLayer`,Qr=`dismissableLayer.update`,$r=`dismissableLayer.pointerDownOutside`,ei=`dismissableLayer.focusOutside`,ti,ni=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ri=d.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=d.useContext(ni),[u,f]=d.useState(null),m=u?.ownerDocument??globalThis?.document,[,h]=d.useState({}),g=Xn(t,e=>f(e)),_=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(v),b=u?_.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=oi(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!S||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},m),w=si(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},m);return Xr(e=>{b===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},m),d.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(ti=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ci(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=ti))}},[u,m,n,l]),d.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ci())},[u,l]),d.useEffect(()=>{let e=()=>h({});return document.addEventListener(Qr,e),()=>document.removeEventListener(Qr,e)},[]),(0,p.jsx)(L.div,{...c,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:R(e.onFocusCapture,w.onFocusCapture),onBlurCapture:R(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:R(e.onPointerDownCapture,C.onPointerDownCapture)})});ri.displayName=Zr;var ii=`DismissableLayerBranch`,ai=d.forwardRef((e,t)=>{let n=d.useContext(ni),r=d.useRef(null),i=Xn(t,r);return d.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,p.jsx)(L.div,{...e,ref:i})});ai.displayName=ii;function oi(e,t=globalThis?.document){let n=Yr(e),r=d.useRef(!1),i=d.useRef(()=>{});return d.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){li($r,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function si(e,t=globalThis?.document){let n=Yr(e),r=d.useRef(!1);return d.useEffect(()=>{let e=e=>{e.target&&!r.current&&li(ei,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ci(){let e=new CustomEvent(Qr);document.dispatchEvent(e)}function li(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?dr(i,a):i.dispatchEvent(a)}var ui=`focusScope.autoFocusOnMount`,di=`focusScope.autoFocusOnUnmount`,fi={bubbles:!1,cancelable:!0},pi=`FocusScope`,mi=d.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=d.useState(null),l=Yr(i),u=Yr(a),f=d.useRef(null),m=Xn(t,e=>c(e)),h=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let e=function(e){if(h.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:yi(f.current,{select:!0})},t=function(e){if(h.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||yi(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&yi(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,h.paused]),d.useEffect(()=>{if(s){bi.add(h);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ui,fi);s.addEventListener(ui,l),s.dispatchEvent(t),t.defaultPrevented||(hi(mee(_i(s)),{select:!0}),document.activeElement===e&&yi(s))}return()=>{s.removeEventListener(ui,l),setTimeout(()=>{let t=new CustomEvent(di,fi);s.addEventListener(di,u),s.dispatchEvent(t),t.defaultPrevented||yi(e??document.body,{select:!0}),s.removeEventListener(di,u),bi.remove(h)},0)}}},[s,l,u,h]);let g=d.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=gi(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&yi(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&yi(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,p.jsx)(L.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});mi.displayName=pi;function hi(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(yi(r,{select:t}),document.activeElement!==n)return}function gi(e){let t=_i(e);return[vi(t,e),vi(t.reverse(),e)]}function _i(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vi(e,t){for(let n of e)if(!dee(n,{upTo:t}))return n}function dee(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function fee(e){return e instanceof HTMLInputElement&&`select`in e}function yi(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fee(e)&&t&&e.select()}}var bi=pee();function pee(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=xi(e,t),e.unshift(t)},remove(t){e=xi(e,t),e[0]?.resume()}}}function xi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function mee(e){return e.filter(e=>e.tagName!==`A`)}var hee=`Portal`,Si=d.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=d.useState(!1);br(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?f.createPortal((0,p.jsx)(L.div,{...r,ref:t}),o):null});Si.displayName=hee;var Ci=0,wi=null;function Ti(){d.useEffect(()=>{wi||={start:Ei(),end:Ei()};let{start:e,end:t}=wi;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Ci++,()=>{Ci===1&&(wi?.start.remove(),wi?.end.remove(),wi=null),Ci=Math.max(0,Ci-1)}},[])}function Ei(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Di=function(){return Di=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Di.apply(this,arguments)};function Oi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ki(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Ai(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ji=`right-scroll-bar-position`,Mi=`width-before-scroll-bar`,Ni=`with-scroll-bars-hidden`,Pi=`--removed-body-scroll-bar-size`;function Fi(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ii(e,t){var n=(0,u.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Li=typeof window<`u`?u.useLayoutEffect:u.useEffect,Ri=new WeakMap;function zi(e,t){var n=Ii(t||null,function(t){return e.forEach(function(e){return Fi(e,t)})});return Li(function(){var t=Ri.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Fi(e,null)}),i.forEach(function(e){r.has(e)||Fi(e,a)})}Ri.set(n,e)},[e]),n}function Bi(e){return e}function Vi(e,t){t===void 0&&(t=Bi);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Hi(e){e===void 0&&(e={});var t=Vi(null);return t.options=Di({async:!0,ssr:!1},e),t}var Ui=function(e){var t=e.sideCar,n=Oi(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return u.createElement(r,Di({},n))};Ui.isSideCarExport=!0;function Wi(e,t){return e.useMedium(t),Ui}var Gi=Hi(),Ki=function(){},qi=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:Ki,onWheelCapture:Ki,onTouchMoveCapture:Ki}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Oi(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=zi([n,t]),w=Di(Di({},x),i);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:Gi,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?u.cloneElement(u.Children.only(s),Di(Di({},w),{ref:C})):u.createElement(y,Di({},w,{className:c,ref:C}),s))});qi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},qi.classNames={fullWidth:Mi,zeroRight:ji};var Ji,Yi=function(){if(Ji)return Ji;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Xi(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Yi();return t&&e.setAttribute(`nonce`,t),e}function Zi(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Qi(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var $i=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Xi())&&(Zi(t,n),Qi(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ea=function(){var e=$i();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ta=function(){var e=ea();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},na={left:0,top:0,right:0,gap:0},ra=function(e){return parseInt(e||``,10)||0},ia=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[ra(n),ra(r),ra(i)]},aa=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return na;var t=ia(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oa=ta(),sa=`data-scroll-locked`,ca=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
10
|
+
.${Ni} {
|
|
3
11
|
overflow: hidden ${r};
|
|
4
12
|
padding-right: ${s}px ${r};
|
|
5
13
|
}
|
|
6
|
-
body[${
|
|
14
|
+
body[${sa}] {
|
|
7
15
|
overflow: hidden ${r};
|
|
8
16
|
overscroll-behavior: contain;
|
|
9
17
|
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
@@ -16,51 +24,163 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
16
24
|
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
.${
|
|
27
|
+
.${ji} {
|
|
20
28
|
right: ${s}px ${r};
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
.${
|
|
31
|
+
.${Mi} {
|
|
24
32
|
margin-right: ${s}px ${r};
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
.${
|
|
35
|
+
.${ji} .${ji} {
|
|
28
36
|
right: 0 ${r};
|
|
29
37
|
}
|
|
30
38
|
|
|
31
|
-
.${
|
|
39
|
+
.${Mi} .${Mi} {
|
|
32
40
|
margin-right: 0 ${r};
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
body[${
|
|
36
|
-
${
|
|
43
|
+
body[${sa}] {
|
|
44
|
+
${Pi}: ${s}px;
|
|
37
45
|
}
|
|
38
|
-
`},
|
|
46
|
+
`},la=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ua=function(){u.useEffect(function(){return document.body.setAttribute(sa,(la()+1).toString()),function(){var e=la()-1;e<=0?document.body.removeAttribute(sa):document.body.setAttribute(sa,e.toString())}},[])},da=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ua();var a=u.useMemo(function(){return aa(i)},[i]);return u.createElement(oa,{styles:ca(a,!t,i,n?``:`!important`)})},fa=!1;if(typeof window<`u`)try{var pa=Object.defineProperty({},`passive`,{get:function(){return fa=!0,!0}});window.addEventListener(`test`,pa,pa),window.removeEventListener(`test`,pa,pa)}catch{fa=!1}var ma=fa?{passive:!1}:!1,ha=function(e){return e.tagName===`TEXTAREA`},ga=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ha(e)&&n[t]===`visible`)},_a=function(e){return ga(e,`overflowY`)},va=function(e){return ga(e,`overflowX`)},ya=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Sa(e,r)){var i=Ca(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ba=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},xa=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Sa=function(e,t){return e===`v`?_a(t):va(t)},Ca=function(e,t){return e===`v`?ba(t):xa(t)},wa=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ta=function(e,t,n,r,i){var a=wa(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ca(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Sa(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ea=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Da=function(e){return[e.deltaX,e.deltaY]},Oa=function(e){return e&&`current`in e?e.current:e},ka=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Aa=function(e){return`
|
|
39
47
|
.block-interactivity-${e} {pointer-events: none;}
|
|
40
48
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},
|
|
49
|
+
`},ja=0,Ma=[];function Na(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),i=u.useState(ja++)[0],a=u.useState(ta)[0],o=u.useRef(e);u.useEffect(function(){o.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ai([e.lockRef.current],(e.shards||[]).map(Oa),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=u.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ea(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ya(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ya(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Ta(h,t,e,h===`h`?s:c,!0)},[]),c=u.useCallback(function(e){var n=e;if(!(!Ma.length||Ma[Ma.length-1]!==a)){var r=`deltaY`in n?Da(n):Ea(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ka(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Oa).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=u.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Pa(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=u.useCallback(function(e){n.current=Ea(e),r.current=void 0},[]),f=u.useCallback(function(t){l(t.type,Da(t),t.target,s(t,e.lockRef.current))},[]),p=u.useCallback(function(t){l(t.type,Ea(t),t.target,s(t,e.lockRef.current))},[]);u.useEffect(function(){return Ma.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,ma),document.addEventListener(`touchmove`,c,ma),document.addEventListener(`touchstart`,d,ma),function(){Ma=Ma.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ma),document.removeEventListener(`touchmove`,c,ma),document.removeEventListener(`touchstart`,d,ma)}},[]);var m=e.removeScrollBar,h=e.inert;return u.createElement(u.Fragment,null,h?u.createElement(a,{styles:Aa(i)}):null,m?u.createElement(da,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Pa(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Fa=Wi(Gi,Na),Ia=u.forwardRef(function(e,t){return u.createElement(qi,Di({},e,{ref:t,sideCar:Fa}))});Ia.classNames=qi.classNames;var La=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ra=new WeakMap,za=new WeakMap,Ba={},Va=0,Ha=function(e){return e&&(e.host||Ha(e.parentNode))},Ua=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ha(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Wa=function(e,t,n,r){var i=Ua(t,Array.isArray(e)?e:[e]);Ba[n]||(Ba[n]=new WeakMap);var a=Ba[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Ra.get(e)||0)+1,l=(a.get(e)||0)+1;Ra.set(e,c),a.set(e,l),o.push(e),c===1&&i&&za.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Va++,function(){o.forEach(function(e){var t=Ra.get(e)-1,i=a.get(e)-1;Ra.set(e,t),a.set(e,i),t||(za.has(e)||e.removeAttribute(r),za.delete(e)),i||e.removeAttribute(n)}),Va--,Va||(Ra=new WeakMap,Ra=new WeakMap,za=new WeakMap,Ba={})}},Ga=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||La(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Wa(r,i,n,`aria-hidden`)):function(){return null}},Ka=`Dialog`,[qa,Ja]=_r(Ka),[Ya,Xa]=qa(Ka),Za=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=d.useRef(null),c=d.useRef(null),[l,u]=Sr({prop:r,defaultProp:i??!1,onChange:a,caller:Ka});return(0,p.jsx)(Ya,{scope:t,triggerRef:s,contentRef:c,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:l,onOpenChange:u,onOpenToggle:d.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Za.displayName=Ka;var Qa=`DialogTrigger`,$a=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Xa(Qa,n),a=Xn(t,i.triggerRef);return(0,p.jsx)(L.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":bo(i.open),...r,ref:a,onClick:R(e.onClick,i.onOpenToggle)})});$a.displayName=Qa;var eo=`DialogPortal`,[to,no]=qa(eo,{forceMount:void 0}),ro=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Xa(eo,t);return(0,p.jsx)(to,{scope:t,forceMount:n,children:d.Children.map(r,e=>(0,p.jsx)(Er,{present:n||a.open,children:(0,p.jsx)(Si,{asChild:!0,container:i,children:e})}))})};ro.displayName=eo;var io=`DialogOverlay`,ao=d.forwardRef((e,t)=>{let n=no(io,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Xa(io,e.__scopeDialog);return a.modal?(0,p.jsx)(Er,{present:r||a.open,children:(0,p.jsx)(so,{...i,ref:t})}):null});ao.displayName=io;var oo=Zn(`DialogOverlay.RemoveScroll`),so=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Xa(io,n);return(0,p.jsx)(Ia,{as:oo,allowPinchZoom:!0,shards:[i.contentRef],children:(0,p.jsx)(L.div,{"data-state":bo(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),co=`DialogContent`,lo=d.forwardRef((e,t)=>{let n=no(co,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Xa(co,e.__scopeDialog);return(0,p.jsx)(Er,{present:r||a.open,children:a.modal?(0,p.jsx)(uo,{...i,ref:t}):(0,p.jsx)(fo,{...i,ref:t})})});lo.displayName=co;var uo=d.forwardRef((e,t)=>{let n=Xa(co,e.__scopeDialog),r=d.useRef(null),i=Xn(t,n.contentRef,r);return d.useEffect(()=>{let e=r.current;if(e)return Ga(e)},[]),(0,p.jsx)(po,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault())})}),fo=d.forwardRef((e,t)=>{let n=Xa(co,e.__scopeDialog),r=d.useRef(!1),i=d.useRef(!1);return(0,p.jsx)(po,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),po=d.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Xa(co,n),c=d.useRef(null),l=Xn(t,c);return Ti(),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(mi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,p.jsx)(ri,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":bo(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(wo,{titleId:s.titleId}),(0,p.jsx)(Eo,{contentRef:c,descriptionId:s.descriptionId})]})]})}),mo=`DialogTitle`,ho=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Xa(mo,n);return(0,p.jsx)(L.h2,{id:i.titleId,...r,ref:t})});ho.displayName=mo;var go=`DialogDescription`,_o=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Xa(go,n);return(0,p.jsx)(L.p,{id:i.descriptionId,...r,ref:t})});_o.displayName=go;var vo=`DialogClose`,yo=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Xa(vo,n);return(0,p.jsx)(L.button,{type:`button`,...r,ref:t,onClick:R(e.onClick,()=>i.onOpenChange(!1))})});yo.displayName=vo;function bo(e){return e?`open`:`closed`}var xo=`DialogTitleWarning`,[So,Co]=gr(xo,{contentName:co,titleName:mo,docsSlug:`dialog`}),wo=({titleId:e})=>{let t=Co(xo),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
42
50
|
|
|
43
51
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
52
|
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return
|
|
53
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},To=`DialogDescriptionWarning`,Eo=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Co(To).contentName}}.`;return d.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Do=Za,Oo=$a,ko=ro,Ao=ao,jo=lo,Mo=ho,No=_o,Po=yo,Fo=`AlertDialog`,[Io,gee]=_r(Fo,[Ja]),Lo=Ja(),Ro=e=>{let{__scopeAlertDialog:t,...n}=e,r=Lo(t);return(0,p.jsx)(Do,{...r,...n,modal:!0})};Ro.displayName=Fo;var zo=`AlertDialogTrigger`,Bo=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Lo(n);return(0,p.jsx)(Oo,{...i,...r,ref:t})});Bo.displayName=zo;var Vo=`AlertDialogPortal`,Ho=e=>{let{__scopeAlertDialog:t,...n}=e,r=Lo(t);return(0,p.jsx)(ko,{...r,...n})};Ho.displayName=Vo;var Uo=`AlertDialogOverlay`,Wo=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Lo(n);return(0,p.jsx)(Ao,{...i,...r,ref:t})});Wo.displayName=Uo;var Go=`AlertDialogContent`,[Ko,qo]=Io(Go),Jo=er(`AlertDialogContent`),Yo=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Lo(n),o=d.useRef(null),s=Xn(t,o),c=d.useRef(null);return(0,p.jsx)(So,{contentName:Go,titleName:Xo,docsSlug:`alert-dialog`,children:(0,p.jsx)(Ko,{scope:n,cancelRef:c,children:(0,p.jsxs)(jo,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:R(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,p.jsx)(Jo,{children:r}),(0,p.jsx)(is,{contentRef:o})]})})})});Yo.displayName=Go;var Xo=`AlertDialogTitle`,Zo=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Lo(n);return(0,p.jsx)(Mo,{...i,...r,ref:t})});Zo.displayName=Xo;var Qo=`AlertDialogDescription`,$o=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Lo(n);return(0,p.jsx)(No,{...i,...r,ref:t})});$o.displayName=Qo;var es=`AlertDialogAction`,ts=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Lo(n);return(0,p.jsx)(Po,{...i,...r,ref:t})});ts.displayName=es;var ns=`AlertDialogCancel`,rs=d.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=qo(ns,n),a=Lo(n),o=Xn(t,i);return(0,p.jsx)(Po,{...a,...r,ref:o})});rs.displayName=ns;var is=({contentRef:e})=>{let t=`\`${Go}\` requires a description for the component to be accessible for screen reader users.
|
|
46
54
|
|
|
47
|
-
You can add a description to the \`${
|
|
55
|
+
You can add a description to the \`${Go}\` by passing a \`${Qo}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
48
56
|
|
|
49
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${
|
|
57
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Go}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
50
58
|
|
|
51
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Tr=ir,Er=cr,Dr=ur,Or=hr,kr=xr,Ar=Cr,jr=_r,Mr=yr;function Nr(e){let[t,n]=l.useState(void 0);return B(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Pr=[`top`,`right`,`bottom`,`left`],Fr=Math.min,Ir=Math.max,Lr=Math.round,Rr=Math.floor,zr=e=>({x:e,y:e}),Br={left:`right`,right:`left`,bottom:`top`,top:`bottom`},Vr={start:`end`,end:`start`};function Hr(e,t,n){return Ir(e,Fr(t,n))}function Ur(e,t){return typeof e==`function`?e(t):e}function Wr(e){return e.split(`-`)[0]}function Gr(e){return e.split(`-`)[1]}function Kr(e){return e===`x`?`y`:`x`}function qr(e){return e===`y`?`height`:`width`}var Jr=new Set([`top`,`bottom`]);function Yr(e){return Jr.has(Wr(e))?`y`:`x`}function Xr(e){return Kr(Yr(e))}function Zr(e,t,n){n===void 0&&(n=!1);let r=Gr(e),i=Xr(e),a=qr(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=oi(o)),[o,oi(o)]}function Qr(e){let t=oi(e);return[$r(e),t,$r(t)]}function $r(e){return e.replace(/start|end/g,e=>Vr[e])}var ei=[`left`,`right`],ti=[`right`,`left`],ni=[`top`,`bottom`],ri=[`bottom`,`top`];function ii(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ti:ei:t?ei:ti;case`left`:case`right`:return t?ni:ri;default:return[]}}function ai(e,t,n,r){let i=Gr(e),a=ii(Wr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map($r)))),a}function oi(e){return e.replace(/left|right|bottom|top/g,e=>Br[e])}function si(e){return{top:0,right:0,bottom:0,left:0,...e}}function ci(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:si(e)}function li(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ui(e,t,n){let{reference:r,floating:i}=e,a=Yr(t),o=Xr(t),s=qr(o),c=Wr(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Gr(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var di=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ui(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ui(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function fi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ur(t,e),p=ci(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=li(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=li(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var pi=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Ur(e,t)||{};if(l==null)return{};let d=ci(u),f={x:n,y:r},p=Xr(i),m=qr(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Fr(d[_],T),D=Fr(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Hr(O,A,k),M=!c.arrow&&Gr(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),mi=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Ur(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Wr(r),_=Yr(o),v=Wr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[oi(o)]:Qr(o)),x=p!==`none`;!d&&x&&b.push(...ai(o,m,p,y));let S=[o,...b],C=await fi(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Zr(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Yr(t))||T.every(e=>Yr(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Yr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function hi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gi(e){return Pr.some(t=>e[t]>=0)}var _i=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=Ur(e,t);switch(r){case`referenceHidden`:{let e=hi(await fi(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:gi(e)}}}case`escaped`:{let e=hi(await fi(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:gi(e)}}}default:return{}}}}},vi=new Set([`left`,`top`]);async function yi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Wr(n),s=Gr(n),c=Yr(n)===`y`,l=vi.has(o)?-1:1,u=a&&c?-1:1,d=Ur(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var bi=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await yi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},xi=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Ur(e,t),l={x:n,y:r},u=await fi(t,c),d=Yr(Wr(i)),f=Kr(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=Hr(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=Hr(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},Si=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Ur(e,t),u={x:n,y:r},d=Yr(i),f=Kr(d),p=u[f],m=u[d],h=Ur(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=vi.has(Wr(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ci=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Ur(e,t),u=await fi(t,l),d=Wr(i),f=Gr(i),p=Yr(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Fr(h-u[g],v),x=Fr(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Ir(u.left,0),t=Ir(u.right,0),n=Ir(u.top,0),r=Ir(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ir(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ir(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function wi(){return typeof window<`u`}function Ti(e){return Oi(e)?(e.nodeName||``).toLowerCase():`#document`}function Ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Di(e){return((Oi(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Oi(e){return wi()?e instanceof Node||e instanceof Ei(e).Node:!1}function ki(e){return wi()?e instanceof Element||e instanceof Ei(e).Element:!1}function Ai(e){return wi()?e instanceof HTMLElement||e instanceof Ei(e).HTMLElement:!1}function ji(e){return!wi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ei(e).ShadowRoot}var Mi=new Set([`inline`,`contents`]);function Ni(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ki(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Mi.has(i)}var Pi=new Set([`table`,`td`,`th`]);function Fi(e){return Pi.has(Ti(e))}var Ii=[`:popover-open`,`:modal`];function Li(e){return Ii.some(t=>{try{return e.matches(t)}catch{return!1}})}var Ri=[`transform`,`translate`,`scale`,`rotate`,`perspective`],zi=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],Bi=[`paint`,`layout`,`strict`,`content`];function Vi(e){let t=Ui(),n=ki(e)?Ki(e):e;return Ri.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||zi.some(e=>(n.willChange||``).includes(e))||Bi.some(e=>(n.contain||``).includes(e))}function Hi(e){let t=Ji(e);for(;Ai(t)&&!Gi(t);){if(Vi(t))return t;if(Li(t))return null;t=Ji(t)}return null}function Ui(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Wi=new Set([`html`,`body`,`#document`]);function Gi(e){return Wi.has(Ti(e))}function Ki(e){return Ei(e).getComputedStyle(e)}function qi(e){return ki(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ji(e){if(Ti(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ji(e)&&e.host||Di(e);return ji(t)?t.host:t}function Yi(e){let t=Ji(e);return Gi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ai(t)&&Ni(t)?t:Yi(t)}function Xi(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Yi(e),i=r===e.ownerDocument?.body,a=Ei(r);if(i){let e=Zi(a);return t.concat(a,a.visualViewport||[],Ni(r)?r:[],e&&n?Xi(e):[])}return t.concat(r,Xi(r,[],n))}function Zi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qi(e){let t=Ki(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ai(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Lr(n)!==a||Lr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function $i(e){return ki(e)?e:e.contextElement}function ea(e){let t=$i(e);if(!Ai(t))return zr(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Qi(t),o=(a?Lr(n.width):n.width)/r,s=(a?Lr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ta=zr(0);function na(e){let t=Ei(e);return!Ui()||!t.visualViewport?ta:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ra(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ei(e)?!1:t}function ia(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=$i(e),o=zr(1);t&&(r?ki(r)&&(o=ea(r)):o=ea(e));let s=ra(a,n,r)?na(a):zr(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ei(a),t=r&&ki(r)?Ei(r):r,n=e,i=Zi(n);for(;i&&r&&t!==n;){let e=ea(i),t=i.getBoundingClientRect(),r=Ki(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ei(i),i=Zi(n)}}return li({width:u,height:d,x:c,y:l})}function aa(e,t){let n=qi(e).scrollLeft;return t?t.left+n:ia(Di(e)).left+n}function oa(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-aa(e,n),y:n.top+t.scrollTop}}function sa(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Di(r),s=t?Li(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zr(1),u=zr(0),d=Ai(r);if((d||!d&&!a)&&((Ti(r)!==`body`||Ni(o))&&(c=qi(r)),Ai(r))){let e=ia(r);l=ea(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?oa(o,c):zr(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ca(e){return Array.from(e.getClientRects())}function la(e){let t=Di(e),n=qi(e),r=e.ownerDocument.body,i=Ir(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ir(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+aa(e),s=-n.scrollTop;return Ki(r).direction===`rtl`&&(o+=Ir(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ua=25;function da(e,t){let n=Ei(e),r=Di(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ui();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=aa(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ua&&(a-=o)}else l<=ua&&(a+=l);return{width:a,height:o,x:s,y:c}}var fa=new Set([`absolute`,`fixed`]);function pa(e,t){let n=ia(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ai(e)?ea(e):zr(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ma(e,t,n){let r;if(t===`viewport`)r=da(e,n);else if(t===`document`)r=la(Di(e));else if(ki(t))r=pa(t,n);else{let n=na(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return li(r)}function ha(e,t){let n=Ji(e);return n===t||!ki(n)||Gi(n)?!1:Ki(n).position===`fixed`||ha(n,t)}function ga(e,t){let n=t.get(e);if(n)return n;let r=Xi(e,[],!1).filter(e=>ki(e)&&Ti(e)!==`body`),i=null,a=Ki(e).position===`fixed`,o=a?Ji(e):e;for(;ki(o)&&!Gi(o);){let t=Ki(o),n=Vi(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&fa.has(i.position)||Ni(o)&&!n&&ha(e,o))?r=r.filter(e=>e!==o):i=t,o=Ji(o)}return t.set(e,r),r}function _a(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Li(t)?[]:ga(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=ma(t,n,i);return e.top=Ir(r.top,e.top),e.right=Fr(r.right,e.right),e.bottom=Fr(r.bottom,e.bottom),e.left=Ir(r.left,e.left),e},ma(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function va(e){let{width:t,height:n}=Qi(e);return{width:t,height:n}}function ya(e,t,n){let r=Ai(t),i=Di(t),a=n===`fixed`,o=ia(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=zr(0);function l(){c.x=aa(i)}if(r||!r&&!a)if((Ti(t)!==`body`||Ni(i))&&(s=qi(t)),r){let e=ia(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?oa(i,s):zr(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ba(e){return Ki(e).position===`static`}function xa(e,t){if(!Ai(e)||Ki(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Di(e)===n&&(n=n.ownerDocument.body),n}function Sa(e,t){let n=Ei(e);if(Li(e))return n;if(!Ai(e)){let t=Ji(e);for(;t&&!Gi(t);){if(ki(t)&&!ba(t))return t;t=Ji(t)}return n}let r=xa(e,t);for(;r&&Fi(r)&&ba(r);)r=xa(r,t);return r&&Gi(r)&&ba(r)&&!Vi(r)?n:r||Hi(e)||n}var Ca=async function(e){let t=this.getOffsetParent||Sa,n=this.getDimensions,r=await n(e.floating);return{reference:ya(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wa(e){return Ki(e).direction===`rtl`}var Ta={convertOffsetParentRelativeRectToViewportRelativeRect:sa,getDocumentElement:Di,getClippingRect:_a,getOffsetParent:Sa,getElementRects:Ca,getClientRects:ca,getDimensions:va,getScale:ea,isElement:ki,isRTL:wa};function Ea(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Da(e,t){let n=null,r,i=Di(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Rr(d),h=Rr(i.clientWidth-(u+f)),g=Rr(i.clientHeight-(d+p)),_=Rr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ir(0,Fr(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ea(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Oa(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=$i(e),u=i||a?[...l?Xi(l):[],...Xi(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Da(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?ia(e):null;c&&g();function g(){let t=ia(e);h&&!Ea(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ka=bi,Aa=xi,ja=mi,Ma=Ci,Na=_i,Pa=pi,Fa=Si,Ia=(e,t,n)=>{let r=new Map,i={platform:Ta,...n},a={...i.platform,_c:r};return di(e,t,{...i,platform:a})},La=typeof document<`u`?l.useLayoutEffect:function(){};function Ra(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ra(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ra(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function za(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ba(e,t){let n=za(e);return Math.round(t*n)/n}function Va(e){let t=l.useRef(e);return La(()=>{t.current=e}),t}function Ha(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[f,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=l.useState(r);Ra(m,r)||h(r);let[g,_]=l.useState(null),[v,y]=l.useState(null),b=l.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=l.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=l.useRef(null),T=l.useRef(null),E=l.useRef(f),D=c!=null,O=Va(c),k=Va(i),A=Va(d),j=l.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),Ia(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Ra(E.current,t)&&(E.current=t,u.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);La(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);let M=l.useRef(!1);La(()=>(M.current=!0,()=>{M.current=!1}),[]),La(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=l.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=l.useMemo(()=>({reference:S,floating:C}),[S,C]),F=l.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Ba(P.floating,f.x),r=Ba(P.floating,f.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...za(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:F}),[f,j,N,P,F])}var Ua=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Pa({element:r.current,padding:i}).fn(n):r?Pa({element:r,padding:i}).fn(n):{}}}},Wa=(e,t)=>({...ka(e),options:[e,t]}),Ga=(e,t)=>({...Aa(e),options:[e,t]}),Ka=(e,t)=>({...Fa(e),options:[e,t]}),qa=(e,t)=>({...ja(e),options:[e,t]}),Ja=(e,t)=>({...Ma(e),options:[e,t]}),Ya=(e,t)=>({...Na(e),options:[e,t]}),Xa=(e,t)=>({...Ua(e),options:[e,t]}),Za=`Arrow`,Qa=l.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,d.jsx)(O.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,d.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Qa.displayName=Za;var $a=Qa,eo=`Popper`,[to,no]=F(eo),[ro,io]=to(eo),ao=e=>{let{__scopePopper:t,children:n}=e,[r,i]=l.useState(null);return(0,d.jsx)(ro,{scope:t,anchor:r,onAnchorChange:i,children:n})};ao.displayName=eo;var oo=`PopperAnchor`,so=l.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=io(oo,n),o=l.useRef(null),s=y(t,o),c=l.useRef(null);return l.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,d.jsx)(O.div,{...i,ref:s})});so.displayName=oo;var co=`PopperContent`,[lo,uo]=to(co),fo=l.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p=`partial`,hideWhenDetached:m=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,..._}=e,v=io(co,n),[b,x]=l.useState(null),S=y(t,e=>x(e)),[C,w]=l.useState(null),T=Nr(C),E=T?.width??0,D=T?.height??0,k=r+(a===`center`?``:`-`+a),A=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(u)?u:[u],M=j.length>0,N={padding:A,boundary:j.filter(go),altBoundary:M},{refs:P,floatingStyles:F,placement:I,isPositioned:L,middlewareData:R}=Ha({strategy:`fixed`,placement:k,whileElementsMounted:(...e)=>Oa(...e,{animationFrame:h===`always`}),elements:{reference:v.anchor},middleware:[Wa({mainAxis:i+D,alignmentAxis:o}),c&&Ga({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ka():void 0,...N}),c&&qa({...N}),Ja({...N,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),C&&Xa({element:C,padding:s}),_o({arrowWidth:E,arrowHeight:D}),m&&Ya({strategy:`referenceHidden`,...N})]}),[z,V]=vo(I),H=le(g);B(()=>{L&&H?.()},[L,H]);let ee=R.arrow?.x,te=R.arrow?.y,U=R.arrow?.centerOffset!==0,[W,ne]=l.useState();return B(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),(0,d.jsx)(`div`,{ref:P.setFloating,"data-radix-popper-content-wrapper":``,style:{...F,transform:L?F.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:W,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,d.jsx)(lo,{scope:n,placedSide:z,onArrowChange:w,arrowX:ee,arrowY:te,shouldHideArrow:U,children:(0,d.jsx)(O.div,{"data-side":z,"data-align":V,..._,ref:S,style:{..._.style,animation:L?void 0:`none`}})})})});fo.displayName=co;var po=`PopperArrow`,mo={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ho=l.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=uo(po,n),a=mo[i.placedSide];return(0,d.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,d.jsx)($a,{...r,ref:t,style:{...r.style,display:`block`}})})});ho.displayName=po;function go(e){return e!==null}var _o=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=vo(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function vo(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var yo=ao,bo=so,xo=fo,So=ho,Co=`rovingFocusGroup.onEntryFocus`,wo={bubbles:!1,cancelable:!0},To=`RovingFocusGroup`,[Eo,Do,Oo]=L(To),[ko,Ao]=F(To,[Oo]),[jo,Mo]=ko(To),No=l.forwardRef((e,t)=>(0,d.jsx)(Eo.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,d.jsx)(Eo.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,d.jsx)(Po,{...e,ref:t})})}));No.displayName=To;var Po=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=l.useRef(null),h=y(t,m),g=ce(a),[_,v]=H({prop:o,defaultProp:s??null,onChange:c,caller:To}),[b,x]=l.useState(!1),S=le(u),C=Do(n),w=l.useRef(!1),[T,E]=l.useState(0);return l.useEffect(()=>{let e=m.current;if(e)return e.addEventListener(Co,S),()=>e.removeEventListener(Co,S)},[S]),(0,d.jsx)(jo,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:l.useCallback(e=>v(e),[v]),onItemShiftTab:l.useCallback(()=>x(!0),[]),onFocusableItemAdd:l.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:l.useCallback(()=>E(e=>e-1),[]),children:(0,d.jsx)(O.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:`none`,...e.style},onMouseDown:z(e.onMouseDown,()=>{w.current=!0}),onFocus:z(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(Co,wo);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);Bo([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),f)}}w.current=!1}),onBlur:z(e.onBlur,()=>x(!1))})})}),Fo=`RovingFocusGroupItem`,Io=l.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=G(),u=a||c,f=Mo(Fo,n),p=f.currentTabStopId===u,m=Do(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:_}=f;return l.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),(0,d.jsx)(Eo.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,d.jsx)(O.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:z(e.onMouseDown,e=>{r?f.onItemFocus(u):e.preventDefault()}),onFocus:z(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:z(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=zo(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?Vo(n,r+1):n.slice(r+1)}setTimeout(()=>Bo(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:_!=null}):o})})});Io.displayName=Fo;var Lo={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ro(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function zo(e,t,n){let r=Ro(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lo[r]}function Bo(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vo(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ho=No,Uo=Io,Wo=[`Enter`,` `],Go=[`ArrowDown`,`PageUp`,`Home`],Ko=[`ArrowUp`,`PageDown`,`End`],qo=[...Go,...Ko],Jo={ltr:[...Wo,`ArrowRight`],rtl:[...Wo,`ArrowLeft`]},Yo={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xo=`Menu`,[Zo,Qo,$o]=L(Xo),[es,ts]=F(Xo,[$o,no,Ao]),ns=no(),rs=Ao(),[is,as]=es(Xo),[os,ss]=es(Xo),cs=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ns(t),[c,u]=l.useState(null),f=l.useRef(!1),p=le(a),m=ce(i);return l.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,d.jsx)(yo,{...s,children:(0,d.jsx)(is,{scope:t,open:n,onOpenChange:p,content:c,onContentChange:u,children:(0,d.jsx)(os,{scope:t,onClose:l.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};cs.displayName=Xo;var ls=`MenuAnchor`,us=l.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ns(n);return(0,d.jsx)(bo,{...i,...r,ref:t})});us.displayName=ls;var ds=`MenuPortal`,[fs,ps]=es(ds,{forceMount:void 0}),ms=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=as(ds,t);return(0,d.jsx)(fs,{scope:t,forceMount:n,children:(0,d.jsx)(W,{present:n||a.open,children:(0,d.jsx)(Ve,{asChild:!0,container:i,children:r})})})};ms.displayName=ds;var hs=`MenuContent`,[gs,_s]=es(hs),vs=l.forwardRef((e,t)=>{let n=ps(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=as(hs,e.__scopeMenu),o=ss(hs,e.__scopeMenu);return(0,d.jsx)(Zo.Provider,{scope:e.__scopeMenu,children:(0,d.jsx)(W,{present:r||a.open,children:(0,d.jsx)(Zo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,d.jsx)(ys,{...i,ref:t}):(0,d.jsx)(bs,{...i,ref:t})})})})}),ys=l.forwardRef((e,t)=>{let n=as(hs,e.__scopeMenu),r=l.useRef(null),i=y(t,r);return l.useEffect(()=>{let e=r.current;if(e)return dn(e)},[]),(0,d.jsx)(Ss,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bs=l.forwardRef((e,t)=>{let n=as(hs,e.__scopeMenu);return(0,d.jsx)(Ss,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xs=b(`MenuContent.ScrollLock`),Ss=l.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=as(hs,n),b=ss(hs,n),x=ns(n),S=rs(n),C=Qo(n),[w,T]=l.useState(null),E=l.useRef(null),D=y(t,E,v.onContentChange),O=l.useRef(0),k=l.useRef(``),A=l.useRef(0),j=l.useRef(null),M=l.useRef(`right`),N=l.useRef(0),P=g?tn:l.Fragment,F=g?{as:xs,allowPinchZoom:!0}:void 0,I=e=>{let t=k.current+e,n=C().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=oc(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){k.current=t,window.clearTimeout(O.current),t!==``&&(O.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};l.useEffect(()=>()=>window.clearTimeout(O.current),[]),Ue();let L=l.useCallback(e=>M.current===j.current?.side&&cc(e,j.current?.area),[]);return(0,d.jsx)(gs,{scope:n,searchRef:k,onItemEnter:l.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:l.useCallback(e=>{L(e)||(E.current?.focus(),T(null))},[L]),onTriggerLeave:l.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:A,onPointerGraceIntentChange:l.useCallback(e=>{j.current=e},[]),children:(0,d.jsx)(P,{...F,children:(0,d.jsx)(Oe,{asChild:!0,trapped:i,onMountAutoFocus:z(a,e=>{e.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,d.jsx)(_e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,d.jsx)(Ho,{asChild:!0,...S,dir:b.dir,orientation:`vertical`,loop:r,currentTabStopId:w,onCurrentTabStopIdChange:T,onEntryFocus:z(c,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,d.jsx)(xo,{role:`menu`,"aria-orientation":`vertical`,"data-state":tc(v.open),"data-radix-menu-content":``,dir:b.dir,...x,..._,ref:D,style:{outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&I(e.key));let i=E.current;if(e.target!==i||!qo.includes(e.key))return;e.preventDefault();let a=C().filter(e=>!e.disabled).map(e=>e.ref.current);Ko.includes(e.key)&&a.reverse(),ic(a)}),onBlur:z(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(O.current),k.current=``)}),onPointerMove:z(e.onPointerMove,lc(e=>{let t=e.target,n=N.current!==e.clientX;e.currentTarget.contains(t)&&n&&(M.current=e.clientX>N.current?`right`:`left`,N.current=e.clientX)}))})})})})})})});vs.displayName=hs;var Cs=`MenuGroup`,ws=l.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,d.jsx)(O.div,{role:`group`,...r,ref:t})});ws.displayName=Cs;var Ts=`MenuLabel`,Es=l.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,d.jsx)(O.div,{...r,ref:t})});Es.displayName=Ts;var Ds=`MenuItem`,Os=`menu.itemSelect`,ks=l.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=l.useRef(null),o=ss(Ds,e.__scopeMenu),s=_s(Ds,e.__scopeMenu),c=y(t,a),u=l.useRef(!1),f=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Os,{bubbles:!0,cancelable:!0});e.addEventListener(Os,e=>r?.(e),{once:!0}),k(e,t),t.defaultPrevented?u.current=!1:o.onClose()}};return(0,d.jsx)(As,{...i,ref:c,disabled:n,onClick:z(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:z(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:z(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ks.displayName=Ds;var As=l.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_s(Ds,n),s=rs(n),c=l.useRef(null),u=y(t,c),[f,p]=l.useState(!1),[m,h]=l.useState(``);return l.useEffect(()=>{let e=c.current;e&&h((e.textContent??``).trim())},[a.children]),(0,d.jsx)(Zo.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,d.jsx)(Uo,{asChild:!0,...s,focusable:!r,children:(0,d.jsx)(O.div,{role:`menuitem`,"data-highlighted":f?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:z(e.onPointerMove,lc(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,lc(e=>o.onItemLeave(e))),onFocus:z(e.onFocus,()=>p(!0)),onBlur:z(e.onBlur,()=>p(!1))})})})}),js=`MenuCheckboxItem`,Ms=l.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,d.jsx)(Bs,{scope:e.__scopeMenu,checked:n,children:(0,d.jsx)(ks,{role:`menuitemcheckbox`,"aria-checked":nc(n)?`mixed`:n,...i,ref:t,"data-state":rc(n),onSelect:z(i.onSelect,()=>r?.(nc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ms.displayName=js;var Ns=`MenuRadioGroup`,[Ps,Fs]=es(Ns,{value:void 0,onValueChange:()=>{}}),Is=l.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=le(r);return(0,d.jsx)(Ps,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,d.jsx)(ws,{...i,ref:t})})});Is.displayName=Ns;var Ls=`MenuRadioItem`,Rs=l.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fs(Ls,e.__scopeMenu),a=n===i.value;return(0,d.jsx)(Bs,{scope:e.__scopeMenu,checked:a,children:(0,d.jsx)(ks,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rc(a),onSelect:z(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rs.displayName=Ls;var zs=`MenuItemIndicator`,[Bs,Vs]=es(zs,{checked:!1}),Hs=l.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vs(zs,n);return(0,d.jsx)(W,{present:r||nc(a.checked)||a.checked===!0,children:(0,d.jsx)(O.span,{...i,ref:t,"data-state":rc(a.checked)})})});Hs.displayName=zs;var Us=`MenuSeparator`,Ws=l.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,d.jsx)(O.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Ws.displayName=Us;var Gs=`MenuArrow`,Ks=l.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ns(n);return(0,d.jsx)(So,{...i,...r,ref:t})});Ks.displayName=Gs;var qs=`MenuSub`,[Js,Ys]=es(qs),Xs=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=as(qs,t),o=ns(t),[s,c]=l.useState(null),[u,f]=l.useState(null),p=le(i);return l.useEffect(()=>(a.open===!1&&p(!1),()=>p(!1)),[a.open,p]),(0,d.jsx)(yo,{...o,children:(0,d.jsx)(is,{scope:t,open:r,onOpenChange:p,content:u,onContentChange:f,children:(0,d.jsx)(Js,{scope:t,contentId:G(),triggerId:G(),trigger:s,onTriggerChange:c,children:n})})})};Xs.displayName=qs;var Zs=`MenuSubTrigger`,Qs=l.forwardRef((e,t)=>{let n=as(Zs,e.__scopeMenu),r=ss(Zs,e.__scopeMenu),i=Ys(Zs,e.__scopeMenu),a=_s(Zs,e.__scopeMenu),o=l.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},f=l.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return l.useEffect(()=>f,[f]),l.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,d.jsx)(us,{asChild:!0,...u,children:(0,d.jsx)(As,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tc(n.open),...e,ref:v(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:z(e.onPointerMove,lc(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:z(e.onPointerLeave,lc(e=>{f();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jo[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qs.displayName=Zs;var $s=`MenuSubContent`,ec=l.forwardRef((e,t)=>{let n=ps(hs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=as(hs,e.__scopeMenu),o=ss(hs,e.__scopeMenu),s=Ys($s,e.__scopeMenu),c=l.useRef(null),u=y(t,c);return(0,d.jsx)(Zo.Provider,{scope:e.__scopeMenu,children:(0,d.jsx)(W,{present:r||a.open,children:(0,d.jsx)(Zo.Slot,{scope:e.__scopeMenu,children:(0,d.jsx)(Ss,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:z(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Yo[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});ec.displayName=$s;function tc(e){return e?`open`:`closed`}function nc(e){return e===`indeterminate`}function rc(e){return nc(e)?`indeterminate`:e?`checked`:`unchecked`}function ic(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ac(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oc(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ac(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cc(e,t){return t?sc({x:e.clientX,y:e.clientY},t):!1}function lc(e){return t=>t.pointerType===`mouse`?e(t):void 0}var uc=cs,dc=us,fc=ms,pc=vs,mc=ws,hc=Es,gc=ks,_c=Ms,vc=Is,yc=Rs,bc=Hs,xc=Ws,Sc=Ks,Cc=Xs,wc=Qs,Tc=ec,Ec=`ContextMenu`,[Dc,Oc]=F(Ec,[ts]),kc=ts(),[Ac,jc]=Dc(Ec),Mc=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=l.useState(!1),c=kc(t),u=le(r),f=l.useCallback(e=>{s(e),u(e)},[u]);return(0,d.jsx)(Ac,{scope:t,open:o,onOpenChange:f,modal:a,children:(0,d.jsx)(uc,{...c,dir:i,open:o,onOpenChange:f,modal:a,children:n})})};Mc.displayName=Ec;var Nc=`ContextMenuTrigger`,Pc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=jc(Nc,n),o=kc(n),s=l.useRef({x:0,y:0}),c=l.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=l.useRef(0),f=l.useCallback(()=>window.clearTimeout(u.current),[]),p=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return l.useEffect(()=>f,[f]),l.useEffect(()=>void(r&&f()),[r,f]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dc,{...o,virtualRef:c}),(0,d.jsx)(O.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:z(e.onContextMenu,e=>{f(),p(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:z(e.onPointerDown,ll(e=>{f(),u.current=window.setTimeout(()=>p(e),700)})),onPointerMove:r?e.onPointerMove:z(e.onPointerMove,ll(f)),onPointerCancel:r?e.onPointerCancel:z(e.onPointerCancel,ll(f)),onPointerUp:r?e.onPointerUp:z(e.onPointerUp,ll(f))})]})});Pc.displayName=Nc;var Fc=`ContextMenuPortal`,Ic=e=>{let{__scopeContextMenu:t,...n}=e,r=kc(t);return(0,d.jsx)(fc,{...r,...n})};Ic.displayName=Fc;var Lc=`ContextMenuContent`,Rc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=jc(Lc,n),a=kc(n),o=l.useRef(!1);return(0,d.jsx)(pc,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Rc.displayName=Lc;var zc=`ContextMenuGroup`,Bc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(mc,{...i,...r,ref:t})});Bc.displayName=zc;var Vc=`ContextMenuLabel`,Hc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(hc,{...i,...r,ref:t})});Hc.displayName=Vc;var Uc=`ContextMenuItem`,Wc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(gc,{...i,...r,ref:t})});Wc.displayName=Uc;var Gc=`ContextMenuCheckboxItem`,Kc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(_c,{...i,...r,ref:t})});Kc.displayName=Gc;var qc=`ContextMenuRadioGroup`,Jc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(vc,{...i,...r,ref:t})});Jc.displayName=qc;var Yc=`ContextMenuRadioItem`,Xc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(yc,{...i,...r,ref:t})});Xc.displayName=Yc;var Zc=`ContextMenuItemIndicator`,Qc=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(bc,{...i,...r,ref:t})});Qc.displayName=Zc;var $c=`ContextMenuSeparator`,el=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(xc,{...i,...r,ref:t})});el.displayName=$c;var tl=`ContextMenuArrow`,nl=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(Sc,{...i,...r,ref:t})});nl.displayName=tl;var rl=`ContextMenuSub`,il=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=kc(t),[s,c]=H({prop:i,defaultProp:a??!1,onChange:r,caller:rl});return(0,d.jsx)(Cc,{...o,open:s,onOpenChange:c,children:n})};il.displayName=rl;var al=`ContextMenuSubTrigger`,ol=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(wc,{...i,...r,ref:t})});ol.displayName=al;var sl=`ContextMenuSubContent`,cl=l.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=kc(n);return(0,d.jsx)(Tc,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});cl.displayName=sl;function ll(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var ul=Mc,dl=Pc,fl=Ic,pl=Rc,ml=Wc,hl=el,gl=il,_l=ol,vl=cl,yl=`DropdownMenu`,[bl,xl]=F(yl,[ts]),Sl=ts(),[Cl,wl]=bl(yl),Tl=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Sl(t),u=l.useRef(null),[f,p]=H({prop:i,defaultProp:a??!1,onChange:o,caller:yl});return(0,d.jsx)(Cl,{scope:t,triggerId:G(),triggerRef:u,contentId:G(),open:f,onOpenChange:p,onOpenToggle:l.useCallback(()=>p(e=>!e),[p]),modal:s,children:(0,d.jsx)(uc,{...c,open:f,onOpenChange:p,dir:r,modal:s,children:n})})};Tl.displayName=yl;var El=`DropdownMenuTrigger`,Dl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=wl(El,n),o=Sl(n);return(0,d.jsx)(dc,{asChild:!0,...o,children:(0,d.jsx)(O.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:v(t,a.triggerRef),onPointerDown:z(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:z(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Dl.displayName=El;var Ol=`DropdownMenuPortal`,kl=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Sl(t);return(0,d.jsx)(fc,{...r,...n})};kl.displayName=Ol;var Al=`DropdownMenuContent`,jl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=wl(Al,n),a=Sl(n),o=l.useRef(!1);return(0,d.jsx)(pc,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:z(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});jl.displayName=Al;var Ml=`DropdownMenuGroup`,Nl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(mc,{...i,...r,ref:t})});Nl.displayName=Ml;var Pl=`DropdownMenuLabel`,Fl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(hc,{...i,...r,ref:t})});Fl.displayName=Pl;var Il=`DropdownMenuItem`,Ll=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(gc,{...i,...r,ref:t})});Ll.displayName=Il;var Rl=`DropdownMenuCheckboxItem`,zl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(_c,{...i,...r,ref:t})});zl.displayName=Rl;var Bl=`DropdownMenuRadioGroup`,Vl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(vc,{...i,...r,ref:t})});Vl.displayName=Bl;var Hl=`DropdownMenuRadioItem`,Ul=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(yc,{...i,...r,ref:t})});Ul.displayName=Hl;var Wl=`DropdownMenuItemIndicator`,Gl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(bc,{...i,...r,ref:t})});Gl.displayName=Wl;var Kl=`DropdownMenuSeparator`,ql=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(xc,{...i,...r,ref:t})});ql.displayName=Kl;var Jl=`DropdownMenuArrow`,Yl=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(Sc,{...i,...r,ref:t})});Yl.displayName=Jl;var Xl=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Sl(t),[s,c]=H({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,d.jsx)(Cc,{...o,open:s,onOpenChange:c,children:n})},Zl=`DropdownMenuSubTrigger`,Ql=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(wc,{...i,...r,ref:t})});Ql.displayName=Zl;var $l=`DropdownMenuSubContent`,eu=l.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Sl(n);return(0,d.jsx)(Tc,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});eu.displayName=$l;var tu=Tl,nu=Dl,ru=kl,iu=jl,au=Nl,ou=Fl,su=Ll,cu=Vl,lu=Ul,uu=Gl,du=ql,fu=Xl,pu=Ql,mu=eu,hu=`Label`,gu=l.forwardRef((e,t)=>(0,d.jsx)(O.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));gu.displayName=hu;var _u=gu;function vu(e,[t,n]){return Math.min(n,Math.max(t,e))}var yu=`Popover`,[bu,xu]=F(yu,[no]),Su=no(),[Cu,wu]=bu(yu),Tu=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Su(t),c=l.useRef(null),[u,f]=l.useState(!1),[p,m]=H({prop:r,defaultProp:i??!1,onChange:a,caller:yu});return(0,d.jsx)(yo,{...s,children:(0,d.jsx)(Cu,{scope:t,contentId:G(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:l.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:l.useCallback(()=>f(!0),[]),onCustomAnchorRemove:l.useCallback(()=>f(!1),[]),modal:o,children:n})})};Tu.displayName=yu;var Eu=`PopoverAnchor`,Du=l.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wu(Eu,n),a=Su(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return l.useEffect(()=>(o(),()=>s()),[o,s]),(0,d.jsx)(bo,{...a,...r,ref:t})});Du.displayName=Eu;var Ou=`PopoverTrigger`,ku=l.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wu(Ou,n),a=Su(n),o=y(t,i.triggerRef),s=(0,d.jsx)(O.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Wu(i.open),...r,ref:o,onClick:z(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,d.jsx)(bo,{asChild:!0,...a,children:s})});ku.displayName=Ou;var Au=`PopoverPortal`,[ju,Mu]=bu(Au,{forceMount:void 0}),Nu=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=wu(Au,t);return(0,d.jsx)(ju,{scope:t,forceMount:n,children:(0,d.jsx)(W,{present:n||a.open,children:(0,d.jsx)(Ve,{asChild:!0,container:i,children:r})})})};Nu.displayName=Au;var Pu=`PopoverContent`,Fu=l.forwardRef((e,t)=>{let n=Mu(Pu,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=wu(Pu,e.__scopePopover);return(0,d.jsx)(W,{present:r||a.open,children:a.modal?(0,d.jsx)(Lu,{...i,ref:t}):(0,d.jsx)(Ru,{...i,ref:t})})});Fu.displayName=Pu;var Iu=b(`PopoverContent.RemoveScroll`),Lu=l.forwardRef((e,t)=>{let n=wu(Pu,e.__scopePopover),r=l.useRef(null),i=y(t,r),a=l.useRef(!1);return l.useEffect(()=>{let e=r.current;if(e)return dn(e)},[]),(0,d.jsx)(tn,{as:Iu,allowPinchZoom:!0,children:(0,d.jsx)(zu,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ru=l.forwardRef((e,t)=>{let n=wu(Pu,e.__scopePopover),r=l.useRef(!1),i=l.useRef(!1);return(0,d.jsx)(zu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),zu=l.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=wu(Pu,n),m=Su(n);return Ue(),(0,d.jsx)(Oe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,d.jsx)(_e,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),children:(0,d.jsx)(xo,{"data-state":Wu(p.open),role:`dialog`,id:p.contentId,...m,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Bu=`PopoverClose`,Vu=l.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wu(Bu,n);return(0,d.jsx)(O.button,{type:`button`,...r,ref:t,onClick:z(e.onClick,()=>i.onOpenChange(!1))})});Vu.displayName=Bu;var Hu=`PopoverArrow`,Uu=l.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Su(n);return(0,d.jsx)(So,{...i,...r,ref:t})});Uu.displayName=Hu;function Wu(e){return e?`open`:`closed`}var Gu=Tu,Ku=Du,qu=ku,Ju=Nu,Yu=Fu;function Xu(e,t){return l.useReducer((e,n)=>t[e][n]??e,e)}var Zu=`ScrollArea`,[Qu,$u]=F(Zu),[ed,td]=Qu(Zu),nd=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=l.useState(null),[u,f]=l.useState(null),[p,m]=l.useState(null),[h,g]=l.useState(null),[_,v]=l.useState(null),[b,x]=l.useState(0),[S,C]=l.useState(0),[w,T]=l.useState(!1),[E,D]=l.useState(!1),k=y(t,e=>c(e)),A=ce(i);return(0,d.jsx)(ed,{scope:n,type:r,dir:A,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:_,onScrollbarYChange:v,scrollbarYEnabled:E,onScrollbarYEnabledChange:D,onCornerWidthChange:x,onCornerHeightChange:C,children:(0,d.jsx)(O.div,{dir:A,...o,ref:k,style:{position:`relative`,"--radix-scroll-area-corner-width":b+`px`,"--radix-scroll-area-corner-height":S+`px`,...e.style}})})});nd.displayName=Zu;var rd=`ScrollAreaViewport`,id=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=td(rd,n),s=y(t,l.useRef(null),o.onViewportChange);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,d.jsx)(O.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,d.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});id.displayName=rd;var ad=`ScrollAreaScrollbar`,od=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=td(ad,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return l.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,d.jsx)(sd,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,d.jsx)(cd,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,d.jsx)(ld,{...r,ref:t,forceMount:n}):i.type===`always`?(0,d.jsx)(ud,{...r,ref:t}):null});od.displayName=ad;var sd=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=td(ad,e.__scopeScrollArea),[a,o]=l.useState(!1);return l.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,d.jsx)(W,{present:n||a,children:(0,d.jsx)(ld,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),cd=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=td(ad,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Ad(()=>c(`SCROLL_END`),100),[s,c]=Xu(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return l.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),l.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,d.jsx)(W,{present:n||s!==`hidden`,children:(0,d.jsx)(ud,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:z(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:z(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),ld=l.forwardRef((e,t)=>{let n=td(ad,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=l.useState(!1),s=e.orientation===`horizontal`,c=Ad(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return jd(n.viewport,c),jd(n.content,c),(0,d.jsx)(W,{present:r||a,children:(0,d.jsx)(ud,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),ud=l.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=td(ad,e.__scopeScrollArea),a=l.useRef(null),o=l.useRef(0),[s,c]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Cd(s.viewport,s.content),f={...r,sizes:s,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function p(e,t){return Td(e,o.current,s,t)}return n===`horizontal`?(0,d.jsx)(dd,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Ed(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):n===`vertical`?(0,d.jsx)(fd,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Ed(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),dd=l.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=td(ad,e.__scopeScrollArea),[o,s]=l.useState(),c=l.useRef(null),u=y(t,c,a.onScrollbarXChange);return l.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,d.jsx)(hd,{"data-orientation":`horizontal`,...i,ref:u,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":wd(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Od(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Sd(o.paddingLeft),paddingEnd:Sd(o.paddingRight)}})}})}),fd=l.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=td(ad,e.__scopeScrollArea),[o,s]=l.useState(),c=l.useRef(null),u=y(t,c,a.onScrollbarYChange);return l.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,d.jsx)(hd,{"data-orientation":`vertical`,...i,ref:u,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":wd(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Od(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Sd(o.paddingTop),paddingEnd:Sd(o.paddingBottom)}})}})}),[pd,md]=Qu(ad),hd=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=td(ad,n),[g,_]=l.useState(null),v=y(t,e=>_(e)),b=l.useRef(null),x=l.useRef(``),S=h.viewport,C=r.content-r.viewport,w=le(f),T=le(c),E=Ad(p,10);function D(e){b.current&&u({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return l.useEffect(()=>{let e=e=>{let t=e.target;g?.contains(t)&&w(e,C)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[S,g,C,w]),l.useEffect(T,[r,T]),jd(g,E),jd(h.content,E),(0,d.jsx)(pd,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:le(a),onThumbPointerUp:le(o),onThumbPositionChange:T,onThumbPointerDown:le(s),children:(0,d.jsx)(O.div,{...m,ref:v,style:{position:`absolute`,...m.style},onPointerDown:z(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,h.viewport&&(h.viewport.style.scrollBehavior=`auto`),D(e))}),onPointerMove:z(e.onPointerMove,D),onPointerUp:z(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,h.viewport&&(h.viewport.style.scrollBehavior=``),b.current=null})})})}),gd=`ScrollAreaThumb`,_d=l.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=md(gd,e.__scopeScrollArea);return(0,d.jsx)(W,{present:n||i.hasThumb,children:(0,d.jsx)(vd,{ref:t,...r})})}),vd=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=td(gd,n),o=md(gd,n),{onThumbPositionChange:s}=o,c=y(t,e=>o.onThumbChange(e)),u=l.useRef(void 0),f=Ad(()=>{u.current&&=(u.current(),void 0)},100);return l.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{f(),u.current||(u.current=kd(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,f,s]),(0,d.jsx)(O.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:z(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:z(e.onPointerUp,o.onThumbPointerUp)})});_d.displayName=gd;var yd=`ScrollAreaCorner`,bd=l.forwardRef((e,t)=>{let n=td(yd,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,d.jsx)(xd,{...e,ref:t}):null});bd.displayName=yd;var xd=l.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=td(yd,n),[a,o]=l.useState(0),[s,c]=l.useState(0),u=!!(a&&s);return jd(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),jd(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,d.jsx)(O.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Sd(e){return e?parseInt(e,10):0}function Cd(e,t){let n=e/t;return isNaN(n)?0:n}function wd(e){let t=Cd(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Td(e,t,n,r=`ltr`){let i=wd(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Dd([c,l],d)(e)}function Ed(e,t,n=`ltr`){let r=wd(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=vu(e,n===`ltr`?[0,o]:[o*-1,0]);return Dd([0,o],[0,s])(c)}function Dd(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Od(e,t){return e>0&&e<t}var kd=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Ad(e,t){let n=le(e),r=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),l.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function jd(e,t){let n=le(t);B(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Md=nd,Nd=id,Pd=bd,Fd=`Separator`,Id=`horizontal`,Ld=[`horizontal`,`vertical`],Rd=l.forwardRef((e,t)=>{let{decorative:n,orientation:r=Id,...i}=e,a=zd(r)?r:Id,o=a===`vertical`?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,d.jsx)(O.div,{"data-orientation":a,...s,...i,ref:t})});Rd.displayName=Fd;function zd(e){return Ld.includes(e)}var Bd=Rd,Vd=`Tabs`,[Hd,Ud]=F(Vd,[Ao]),Wd=Ao(),[Gd,Kd]=Hd(Vd),qd=l.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=ce(s),[f,p]=H({prop:r,onChange:i,defaultProp:a??``,caller:Vd});return(0,d.jsx)(Gd,{scope:n,baseId:G(),value:f,onValueChange:p,orientation:o,dir:u,activationMode:c,children:(0,d.jsx)(O.div,{dir:u,"data-orientation":o,...l,ref:t})})});qd.displayName=Vd;var Jd=`TabsList`,Yd=l.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Kd(Jd,n),o=Wd(n);return(0,d.jsx)(Ho,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,d.jsx)(O.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Yd.displayName=Jd;var Xd=`TabsTrigger`,Zd=l.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Kd(Xd,n),s=Wd(n),c=ef(o.baseId,r),l=tf(o.baseId,r),u=r===o.value;return(0,d.jsx)(Uo,{asChild:!0,...s,focusable:!i,active:u,children:(0,d.jsx)(O.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:z(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:z(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Zd.displayName=Xd;var Qd=`TabsContent`,$d=l.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Kd(Qd,n),c=ef(s.baseId,r),u=tf(s.baseId,r),f=r===s.value,p=l.useRef(f);return l.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,d.jsx)(W,{present:i||f,children:({present:n})=>(0,d.jsx)(O.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});$d.displayName=Qd;function ef(e,t){return`${e}-trigger-${t}`}function tf(e,t){return`${e}-content-${t}`}var nf=qd,rf=Yd,af=Zd,of=$d,[sf,cf]=F(`Tooltip`,[no]),lf=no(),uf=`TooltipProvider`,df=700,ff=`tooltip.open`,[pf,mf]=sf(uf),hf=e=>{let{__scopeTooltip:t,delayDuration:n=df,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=l.useRef(!0),s=l.useRef(!1),c=l.useRef(0);return l.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,d.jsx)(pf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:l.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:l.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:l.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hf.displayName=uf;var gf=`Tooltip`,[_f,vf]=sf(gf),yf=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mf(gf,e.__scopeTooltip),u=lf(t),[f,p]=l.useState(null),m=G(),h=l.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=l.useRef(!1),[y,b]=H({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ff))):c.onClose(),a?.(e)},caller:gf}),x=l.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=l.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=l.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=l.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return l.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,d.jsx)(yo,{...u,children:(0,d.jsx)(_f,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:f,onTriggerChange:p,onTriggerEnter:l.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:l.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};yf.displayName=gf;var bf=`TooltipTrigger`,xf=l.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vf(bf,n),a=mf(bf,n),o=lf(n),s=y(t,l.useRef(null),i.onTriggerChange),c=l.useRef(!1),u=l.useRef(!1),f=l.useCallback(()=>c.current=!1,[]);return l.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,d.jsx)(bo,{asChild:!0,...o,children:(0,d.jsx)(O.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:z(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:z(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:z(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:z(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:z(e.onBlur,i.onClose),onClick:z(e.onClick,i.onClose)})})});xf.displayName=bf;var Sf=`TooltipPortal`,[Cf,wf]=sf(Sf,{forceMount:void 0}),Tf=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vf(Sf,t);return(0,d.jsx)(Cf,{scope:t,forceMount:n,children:(0,d.jsx)(W,{present:n||a.open,children:(0,d.jsx)(Ve,{asChild:!0,container:i,children:r})})})};Tf.displayName=Sf;var Ef=`TooltipContent`,Df=l.forwardRef((e,t)=>{let n=wf(Ef,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vf(Ef,e.__scopeTooltip);return(0,d.jsx)(W,{present:r||o.open,children:o.disableHoverableContent?(0,d.jsx)(Mf,{side:i,...a,ref:t}):(0,d.jsx)(Of,{side:i,...a,ref:t})})}),Of=l.forwardRef((e,t)=>{let n=vf(Ef,e.__scopeTooltip),r=mf(Ef,e.__scopeTooltip),i=l.useRef(null),a=y(t,i),[o,s]=l.useState(null),{trigger:c,onClose:u}=n,f=i.current,{onPointerInTransitChange:p}=r,m=l.useCallback(()=>{s(null),p(!1)},[p]),h=l.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=If(r,Ff(r,n.getBoundingClientRect())),a=Lf(t.getBoundingClientRect());s(zf([...i,...a])),p(!0)},[p]);return l.useEffect(()=>()=>m(),[m]),l.useEffect(()=>{if(c&&f){let e=e=>h(e,f),t=e=>h(e,c);return c.addEventListener(`pointerleave`,e),f.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),f.removeEventListener(`pointerleave`,t)}}},[c,f,h,m]),l.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||f?.contains(t),i=!Rf(n,o);r?m():i&&(m(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,f,o,u,m]),(0,d.jsx)(Mf,{...e,ref:a})}),[kf,Af]=sf(gf,{isInside:!1}),jf=w(`TooltipContent`),Mf=l.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vf(Ef,n),u=lf(n),{onClose:f}=c;return l.useEffect(()=>(document.addEventListener(ff,f),()=>document.removeEventListener(ff,f)),[f]),l.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,f]),(0,d.jsx)(_e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,d.jsxs)(xo,{"data-state":c.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,d.jsx)(jf,{children:r}),(0,d.jsx)(kf,{scope:n,isInside:!0,children:(0,d.jsx)(N,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Df.displayName=Ef;var Nf=`TooltipArrow`,Pf=l.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lf(n);return Af(Nf,n).isInside?null:(0,d.jsx)(So,{...i,...r,ref:t})});Pf.displayName=Nf;function Ff(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function If(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lf(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rf(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),Bf(t)}function Bf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vf=hf,Hf=yf,Uf=xf,Wf=Tf,Gf=Df,Kf=Pf,qf=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Jf=(e,t)=>({classGroupId:e,validator:t}),Yf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xf=`-`,Zf=[],Qf=`arbitrary..`,$f=e=>{let t=np(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return tp(e);let n=e.split(Xf);return ep(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?qf(i,t):t:i||Zf}return n[e]||Zf}}},ep=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ep(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Xf):e.slice(t).join(Xf),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},tp=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Qf+r:void 0})(),np=e=>{let{theme:t,classGroups:n}=e;return rp(n,t)},rp=(e,t)=>{let n=Yf();for(let r in e){let i=e[r];ip(i,n,r,t)}return n},ip=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];ap(i,t,n,r)}},ap=(e,t,n,r)=>{if(typeof e==`string`){op(e,t,n);return}if(typeof e==`function`){sp(e,t,n,r);return}cp(e,t,n,r)},op=(e,t,n)=>{let r=e===``?t:lp(t,e);r.classGroupId=n},sp=(e,t,n,r)=>{if(up(e)){ip(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Jf(n,e))},cp=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ip(o,lp(t,a),n,r)}},lp=(e,t)=>{let n=e,r=t.split(Xf),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Yf(),n.nextPart.set(t,i)),n=i}return n},up=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,dp=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},fp=`!`,pp=`:`,mp=[],hp=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),gp=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===pp){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(fp)?(c=s.slice(0,-1),l=!0):s.startsWith(fp)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return hp(t,l,c,u)};if(t){let e=t+pp,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):hp(mp,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},_p=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},vp=e=>({cache:dp(e.cacheSize),parseClassName:gp(e),sortModifiers:_p(e),...$f(e)}),yp=/\s+/,bp=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(yp),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+fp:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},xp=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Sp(n))&&(i&&(i+=` `),i+=r);return i},Sp=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Sp(e[r]))&&(n&&(n+=` `),n+=t);return n},Cp=(e,...t)=>{let n,r,i,a,o=o=>(n=vp(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=bp(e,n);return i(e,a),a};return a=o,(...e)=>a(xp(...e))},wp=[],Tp=e=>{let t=t=>t[e]||wp;return t.isThemeGetter=!0,t},Ep=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Op=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ap=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Np=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pp=e=>Op.test(e),K=e=>!!e&&!Number.isNaN(Number(e)),Fp=e=>!!e&&Number.isInteger(Number(e)),Ip=e=>e.endsWith(`%`)&&K(e.slice(0,-1)),Lp=e=>kp.test(e),Rp=()=>!0,zp=e=>Ap.test(e)&&!jp.test(e),Bp=()=>!1,Vp=e=>Mp.test(e),Hp=e=>Np.test(e),Up=e=>!q(e)&&!J(e),Wp=e=>am(e,lm,Bp),q=e=>Ep.test(e),Gp=e=>am(e,um,zp),Kp=e=>am(e,dm,K),qp=e=>am(e,pm,Rp),Jp=e=>am(e,fm,Bp),Yp=e=>am(e,sm,Bp),Xp=e=>am(e,cm,Hp),Zp=e=>am(e,mm,Vp),J=e=>Dp.test(e),Qp=e=>om(e,um),$p=e=>om(e,fm),em=e=>om(e,sm),tm=e=>om(e,lm),nm=e=>om(e,cm),rm=e=>om(e,mm,!0),im=e=>om(e,pm,!0),am=(e,t,n)=>{let r=Ep.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},om=(e,t,n=!1)=>{let r=Dp.exec(e);return r?r[1]?t(r[1]):n:!1},sm=e=>e===`position`||e===`percentage`,cm=e=>e===`image`||e===`url`,lm=e=>e===`length`||e===`size`||e===`bg-size`,um=e=>e===`length`,dm=e=>e===`number`,fm=e=>e===`family-name`,pm=e=>e===`number`||e===`weight`,mm=e=>e===`shadow`,hm=()=>{let e=Tp(`color`),t=Tp(`font`),n=Tp(`text`),r=Tp(`font-weight`),i=Tp(`tracking`),a=Tp(`leading`),o=Tp(`breakpoint`),s=Tp(`container`),c=Tp(`spacing`),l=Tp(`radius`),u=Tp(`shadow`),d=Tp(`inset-shadow`),f=Tp(`text-shadow`),p=Tp(`drop-shadow`),m=Tp(`blur`),h=Tp(`perspective`),g=Tp(`aspect`),_=Tp(`ease`),v=Tp(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),J,q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[J,q,c],T=()=>[Pp,`full`,`auto`,...w()],E=()=>[Fp,`none`,`subgrid`,J,q],D=()=>[`auto`,{span:[`full`,Fp,J,q]},Fp,J,q],O=()=>[Fp,`auto`,J,q],k=()=>[`auto`,`min`,`max`,`fr`,J,q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Pp,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Pp,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Pp,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,J,q],L=()=>[...b(),em,Yp,{position:[J,q]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,tm,Wp,{size:[J,q]}],B=()=>[Ip,Qp,Gp],V=()=>[``,`none`,`full`,l,J,q],H=()=>[``,K,Qp,Gp],ee=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[K,Ip,em,Yp],W=()=>[``,`none`,m,J,q],ne=()=>[`none`,K,J,q],re=()=>[`none`,K,J,q],ie=()=>[K,J,q],ae=()=>[Pp,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Lp],breakpoint:[Lp],color:[Rp],container:[Lp],"drop-shadow":[Lp],ease:[`in`,`out`,`in-out`],font:[Up],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Lp],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Lp],shadow:[Lp],spacing:[`px`,K],text:[Lp],"text-shadow":[Lp],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Pp,q,J,g]}],container:[`container`],columns:[{columns:[K,q,J,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Fp,`auto`,J,q]}],basis:[{basis:[Pp,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[K,Pp,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,K,J,q]}],shrink:[{shrink:[``,K,J,q]}],order:[{order:[Fp,`first`,`last`,`none`,J,q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Qp,Gp]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,im,qp]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Ip,q]}],"font-family":[{font:[$p,Jp,t]}],"font-features":[{"font-features":[q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,J,q]}],"line-clamp":[{"line-clamp":[K,`none`,J,Kp]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,J,q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,J,q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ee(),`wavy`]}],"text-decoration-thickness":[{decoration:[K,`from-font`,`auto`,J,Gp]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[K,`auto`,J,q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,J,q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,J,q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Fp,J,q],radial:[``,J,q],conic:[Fp,J,q]},nm,Xp]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":H()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ee(),`hidden`,`none`]}],"divide-style":[{divide:[...ee(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ee(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[K,J,q]}],"outline-w":[{outline:[``,K,Qp,Gp]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,rm,Zp]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,rm,Zp]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[K,Gp]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,rm,Zp]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[K,J,q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[K]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[J,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[K]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,J,q]}],filter:[{filter:[``,`none`,J,q]}],blur:[{blur:W()}],brightness:[{brightness:[K,J,q]}],contrast:[{contrast:[K,J,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,rm,Zp]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,K,J,q]}],"hue-rotate":[{"hue-rotate":[K,J,q]}],invert:[{invert:[``,K,J,q]}],saturate:[{saturate:[K,J,q]}],sepia:[{sepia:[``,K,J,q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,J,q]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[K,J,q]}],"backdrop-contrast":[{"backdrop-contrast":[K,J,q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,K,J,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[K,J,q]}],"backdrop-invert":[{"backdrop-invert":[``,K,J,q]}],"backdrop-opacity":[{"backdrop-opacity":[K,J,q]}],"backdrop-saturate":[{"backdrop-saturate":[K,J,q]}],"backdrop-sepia":[{"backdrop-sepia":[``,K,J,q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,J,q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[K,`initial`,J,q]}],ease:[{ease:[`linear`,`initial`,_,J,q]}],delay:[{delay:[K,J,q]}],animate:[{animate:[`none`,v,J,q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,J,q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[J,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,J,q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,J,q]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[K,Qp,Gp,Kp]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},gm=Cp(hm);function Y(...e){return gm(p(e))}var _m=g(`focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none active:scale-[0.97] transition-transform duration-150`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground`,destructive:`bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function vm({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,d.jsx)(r?x:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Y(_m({variant:t,size:n,className:e})),...i})}function ym({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`skeleton`,className:Y(`animate-pulse rounded-md bg-muted`,e),...t})}const bm=()=>(0,d.jsxs)(`div`,{children:[`SurveyPlayer`,(0,d.jsx)(ym,{className:`w-full h-4`}),(0,d.jsx)(vm,{children:`testing`})]});var xm=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Sm=(e=>e?xm(e):xm),Cm=e=>e;function wm(e,t=Cm){let n=l.default.useSyncExternalStore(e.subscribe,l.default.useCallback(()=>t(e.getState()),[e,t]),l.default.useCallback(()=>t(e.getInitialState()),[e,t]));return l.default.useDebugValue(n),n}const Tm=(0,l.createContext)(null);function X(e){let t=(0,l.useContext)(Tm);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return wm(t,e)}function Em(e){return typeof structuredClone<`u`?structuredClone(e):JSON.parse(JSON.stringify(e))}var Dm=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function Om(){let e=Date.now(),t=``,n=e;for(;n>0;)t=Dm.charAt(n%62)+t,n=Math.floor(n/62);let r=``;for(let e=0;e<10;e++)r+=Dm.charAt(Math.floor(Math.random()*62));return r+t}var km=`23456789ABCDEFGHJKLMNPQRSTUVWXYZ`;function Am(e=4){let t=``;for(let n=0;n<e;n++)t+=km.charAt(Math.floor(Math.random()*32));return t}var jm=`...`,Mm=class e{_itemId;_name;_slotId;constructor(e){let t=e.split(jm);if(t.length!==3)throw Error(`Invalid value reference: `+e);this._itemId=t[0],this._name=t[1],this._slotId=t[2]}get itemId(){return this._itemId}get name(){return this._name}get slotId(){return this._slotId}set itemId(e){this._itemId=e}toString(){return`${this._itemId}${jm}${this._name}${this._slotId?jm+this._slotId:``}`}static fromParts(t,n,r){return new e(`${t}${jm}${n}${jm}${r}`)}},Nm=function(e){return e.displayConditions=`displayConditions`,e.templateValues=`templateValues`,e.validations=`validations`,e.disabledConditions=`disabledConditions`,e}({}),Pm={Const:`const`,ResponseVariable:`responseVariable`,ContextVariable:`contextVariable`,Function:`function`},Fm=class e{type;editorConfig;constructor(e,t){this.type=e,this.editorConfig=t}static deserialize(e){if(e)switch(e.type){case Pm.Const:return Im.deserialize(e);case Pm.ResponseVariable:return Lm.deserialize(e);case Pm.ContextVariable:return Rm.deserialize(e);case Pm.Function:return Bm.deserialize(e)}}clone(){return e.deserialize(this.serialize())??(()=>{throw Error(`Failed to clone expression`)})()}},Im=class e extends Fm{value;constructor(e,t){super(Pm.Const,t),this.value=e,this.type=Pm.Const}static deserialize(t){if(t.type!==Pm.Const)throw Error(`Invalid expression type: `+t.type);return new e(t.value,t.editorConfig)}get responseVariableRefs(){return[]}serialize(){return{type:this.type,value:this.value,editorConfig:this.editorConfig}}updateItemKeyReferences(e,t){return!1}},Lm=class e extends Fm{variableRef;constructor(e,t){super(Pm.ResponseVariable,t),this.variableRef=e,this.type=Pm.ResponseVariable}static deserialize(t){if(t.type!==Pm.ResponseVariable)throw Error(`Invalid expression type: `+t.type);return new e(t.variableRef,t.editorConfig)}get responseVariableRefs(){return[new Mm(this.variableRef)]}get responseVariableRef(){return new Mm(this.variableRef)}serialize(){return{type:this.type,variableRef:this.variableRef,editorConfig:this.editorConfig}}},Rm=class e extends Fm{contextType;key;arguments;asType;constructor(e,t,n,r,i){super(Pm.ContextVariable,i),this.type=Pm.ContextVariable,this.contextType=e,this.key=t,this.arguments=n,this.asType=r}static deserialize(t){if(t.type!==Pm.ContextVariable)throw Error(`Invalid expression type: `+t.type);return new e(t.contextType,Fm.deserialize(t.key),t.arguments?.map(e=>Fm.deserialize(e)),t.asType,t.editorConfig)}get responseVariableRefs(){return this.arguments?.flatMap(e=>e?.responseVariableRefs).filter(e=>e!==void 0)??[]}serialize(){return{type:this.type,contextType:this.contextType,key:this.key?.serialize(),arguments:this.arguments?.map(e=>e?.serialize()),asType:this.asType,editorConfig:this.editorConfig}}},zm=function(e){return e.and=`and`,e.or=`or`,e.not=`not`,e.list_contains=`list_contains`,e.eq=`eq`,e.gt=`gt`,e.gte=`gte`,e.lt=`lt`,e.lte=`lte`,e.in_range=`in_range`,e.sum=`sum`,e.min=`min`,e.max=`max`,e.str_eq=`str_eq`,e.date_eq=`date_eq`,e}({}),Bm=class e extends Fm{functionName;arguments;constructor(e,t,n){super(Pm.Function),this.type=Pm.Function,this.functionName=e,this.arguments=t,this.editorConfig=n}static deserialize(t){if(t.type!==Pm.Function)throw Error(`Invalid expression type: `+t.type);let n=t.functionName;if(!Object.values(zm).includes(n))throw Error(`Invalid function name: `+n);let r=new e(n,t.arguments.map(e=>Fm.deserialize(e)));return r.editorConfig=t.editorConfig,r}get responseVariableRefs(){let e=this.arguments.flatMap(e=>e?.responseVariableRefs).filter(e=>e!==void 0).map(e=>e.toString());return[...new Set(e)].map(e=>new Mm(e))}serialize(){return{type:this.type,functionName:this.functionName,arguments:this.arguments.map(e=>e?.serialize()),editorConfig:this.editorConfig}}},Vm=function(e){return e.Default=`default`,e.Date2String=`date2string`,e}({}),Hm=e=>{let t={type:e.type,returnType:e.returnType,expression:e.expression?.serialize()};return e.type===Vm.Date2String&&(t.dateFormat=e.dateFormat),t},Um=e=>{let t={};for(let[n,r]of e.entries())t[n]=Hm(r);return t},Wm=e=>({type:e.type,expression:e.expression?Fm.deserialize(e.expression):void 0,returnType:e.returnType,dateFormat:e.dateFormat}),Gm=e=>new Map(Object.entries(e).map(([e,t])=>[e,Wm(t)])),Km=e=>({root:e.root?Fm.deserialize(e.root):void 0,components:e.components?Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,Fm.deserialize(t)])):void 0}),qm=e=>({components:e.components?Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,Fm.deserialize(t)])):void 0}),Jm=class{id;key;config;_rawItem;displayConditions;disabledConditions;validations;prefillRules;constructor(e){this._rawItem=e,this.updateExpressions(),this.id=this._rawItem.id,this.key=this._rawItem.key,this.config=this.parseConfig(this._rawItem.config)}get rawItem(){return this._rawItem}get metadata(){return this._rawItem.metadata??{}}set metadata(e){this.updateRawItem({...this._rawItem,metadata:e})}updateRawItem(e){if(e.id!==this.id)throw Error(`Cannot update raw item with a different id`);this._rawItem=e,this.updateExpressions(),this.key=e.key,this.config=this.parseConfig(e.config)}updateExpressions(){this.displayConditions=this._rawItem.displayConditions?Km(this._rawItem.displayConditions):void 0,this.disabledConditions=this._rawItem.disabledConditions?qm(this._rawItem.disabledConditions):void 0,this.validations=this._rawItem.validations?Object.fromEntries(Object.entries(this._rawItem.validations).map(([e,t])=>[e,Fm.deserialize(t)])):void 0,this.prefillRules=this._rawItem.prefillRules?this._rawItem.prefillRules.map(e=>e?Fm.deserialize(e):void 0):void 0}getReferenceUsages(){let e=[];if(this.displayConditions){for(let t of this.displayConditions.root?.responseVariableRefs||[])e.push({itemId:this.id,usageType:Nm.displayConditions,valueReference:t});for(let[t,n]of Object.entries(this.displayConditions.components||{}))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:Nm.displayConditions,valueReference:r})}if(this.disabledConditions)for(let[t,n]of Object.entries(this.disabledConditions.components||{}))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:Nm.disabledConditions,valueReference:r});if(this.validations)for(let[t,n]of Object.entries(this.validations))for(let r of n?.responseVariableRefs||[])e.push({itemId:this.id,fullComponentKey:t,usageType:Nm.validations,valueReference:r});return e}},Ym=function(e){return e.Group=`group`,e.PageBreak=`page-break`,e}({}),Xm=class{_itemKey;_path;_keySeparator;constructor(e,t,n=`.`){this._itemKey=e,this._path=t??[],this._keySeparator=n}get itemKey(){return this._itemKey}get path(){return this._path}get parentFullKey(){return this._path.join(this._keySeparator)}get fullKey(){return[...this._path,this._itemKey].join(this._keySeparator)}get isRoot(){return this._path.length===0}get keySeparator(){return this._keySeparator}set keySeparator(e){this._keySeparator=e}};function Zm(e,t,n){let r=[...e];return[r[t],r[n]]=[r[n],r[t]],r}function Qm(e,t,n){let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}var $m=class extends Jm{type=Ym.Group;parseConfig(e){let t=e??{};return{items:t.items,shuffleItems:t.shuffleItems,isRoot:t.isRoot}}serializeConfig(){return this.config}isInteractive(){return!1}getAvailableResponseValueSlots(){return{}}isRoot(){return this.config.isRoot??!1}get items(){return this.config.items??[]}addChild(e,t){let n=this.config.items??=[],r=t===void 0?n.length:Math.min(t,n.length);n.splice(r,0,e),this.updateRawItem({...this.rawItem,config:{...this.config}})}removeChild(e){let t=this.config.items??=[],n=t.indexOf(e);n!==-1&&(t.splice(n,1),this.updateRawItem({...this.rawItem,config:{...this.config}}))}hasChild(e){return this.items.includes(e)}get shuffleItems(){return this.config.shuffleItems??!1}set shuffleItems(e){this.config.shuffleItems=e,this.updateRawItem({...this.rawItem,config:{...this.config}})}getChildrenIds(){return[...this.items]}swapItemsByIndex(e,t){let n=this.items;if(e<0||e>=n.length||t<0||t>=n.length)throw Error(`Index out of bounds. Valid range is 0-${n.length-1}`);e!==t&&(this.config.items=Zm(n,e,t),this.updateRawItem({...this.rawItem,config:{...this.config}}))}swapItemsById(e,t){let n=this.items,r=n.indexOf(e),i=n.indexOf(t);if(r===-1)throw Error(`Item '${e}' not found in group '${this.key}'`);if(i===-1)throw Error(`Item '${t}' not found in group '${this.key}'`);this.swapItemsByIndex(r,i)}moveItemToIndex(e,t){let n=this.items,r=n.indexOf(e);if(r===-1)throw Error(`Item '${e}' not found in group '${this.key}'`);if(t<0||t>=n.length)throw Error(`Index out of bounds. Valid range is 0-${n.length-1}`);r!==t&&(this.config.items=Qm(n,r,t),this.updateRawItem({...this.rawItem,config:{...this.config}}))}},eh=class extends Jm{type=Ym.PageBreak;parseConfig(e){return{}}serializeConfig(){}isInteractive(){return!1}getAvailableResponseValueSlots(){return{}}},th={[Ym.Group]:$m,[Ym.PageBreak]:eh},nh=e=>e in th;function rh(e,t){if(nh(e.itemType)){let t=th[e.itemType];return new t(e)}if(t&&e.itemType in t){let n=t[e.itemType];return new n(e)}throw Error(`Unknown item type: ${e.itemType}`)}function ih(e){return{...th,...e}}var ah=`https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json`,oh=e=>{if(e.trim()===``)throw Error(`Locale cannot be empty`)},sh=class{_translations;constructor(){this._translations={}}setContent(e,t,n){if(oh(e),!this._translations?.[e]){if(!n)return;this._translations[e]={}}n?this._translations[e][t]=n:delete this._translations[e][t]}setAllForLocale(e,t){if(oh(e),!this._translations?.[e]){if(!t)return;this._translations[e]={}}this._translations[e]=t||{}}get locales(){return Object.keys(this._translations||{})}getAllForLocale(e){return this._translations?.[e]}getContent(e,t,n){let r=this._translations?.[e]?.[t];if(r)return r;if(n)return this._translations?.[n]?.[t]}},ch=class{_translations;constructor(e){this._translations=e||{}}serialize(){if(this.locales.length!==0)return this._translations}get locales(){return Object.keys(this._translations)}removeLocale(e){oh(e),delete this._translations[e]}renameLocale(e,t){oh(e),oh(t),this._translations[e]&&(this._translations[t]=this._translations[e],delete this._translations[e])}cloneLocaleAs(e,t){oh(e),oh(t),this._translations[e]&&(this._translations[t]=Em(this._translations[e]))}get surveyCardContent(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.surveyCardContent;n&&(e[t]=n)}return e}get navigationContent(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.navigationContent;n&&(e[t]=n)}return e}get validationMessages(){let e={};for(let t of this.locales){let n=this._translations?.[t]?.validationMessages;n&&(e[t]=n)}return e}setSurveyCardContent(e,t){if(oh(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].surveyCardContent=t}setNavigationContent(e,t){if(oh(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].navigationContent=t}setValidationMessages(e,t){if(oh(e),!this._translations[e]){if(!t)return;this._translations[e]={}}this._translations[e].validationMessages=t}getItemTranslations(e){let t=new sh;for(let n of this.locales){let r=this._translations?.[n].itemTranslations?.[e];t.setAllForLocale(n,r)}return t}setItemTranslations(e,t){if(t?.locales.forEach(e=>oh(e)),t){let n=t.locales;for(let e of n)this.locales.includes(e)||(this._translations[e]={});for(let r of this.locales)n.includes(r)?(this._translations[r]||(this._translations[r]={}),this._translations[r].itemTranslations||(this._translations[r].itemTranslations={}),this._translations[r].itemTranslations[e]=t.getAllForLocale(r)??{}):delete this._translations[r].itemTranslations[e]}else for(let t of this.locales)this._translations[t].itemTranslations?.[e]&&delete this._translations[t].itemTranslations?.[e]}onComponentKeyChanged(e,t,n){for(let r of this.locales){let i=this._translations?.[r].itemTranslations?.[e];if(i)for(let e of Object.keys(i))(e.startsWith(t+`.`)||e===t)&&(i[e.replace(t,n)]={...i[e]},delete i[e])}}onComponentDeleted(e,t){for(let n of this.locales){let r=this._translations?.[n].itemTranslations?.[e];if(r)for(let e of Object.keys(r))(e.startsWith(t+`.`)||e===t)&&delete r[e]}}onItemDeleted(e){for(let t of this.locales)delete this._translations[t].itemTranslations?.[e]}},lh=class e{maxItemsPerPage;metadata;surveyItems=new Map;_templateValues=new Map;_translations;constructor(e){this.pluginRegistry=e,this._translations=new ch}getPluginRegistry(){return this.pluginRegistry}createItemFromRaw(e){return rh(e,this.pluginRegistry)}static createBlankSurvey(t,n){let r=n??Am(),i={$schema:ah,surveyItems:[{id:Om(),key:r,itemType:Ym.Group,config:{isRoot:!0,items:[],shuffleItems:!1}}]};return e.fromJson(i,t)}static fromJson(t,n){let r=new e(n),i=t;if(i.$schema!==ah)throw Error(`Unsupported survey schema: ${i.$schema}`);if(r.surveyItems=new Map,!i.surveyItems||i.surveyItems.length===0)throw Error(`surveyItems is required`);return i.surveyItems.forEach(e=>{let t=rh(e,n);r.surveyItems.set(t.id,t)}),i.templateValues&&(r._templateValues=Gm(i.templateValues)),r._translations=new ch(i.translations),i.maxItemsPerPage&&(r.maxItemsPerPage=i.maxItemsPerPage),i.metadata&&(r.metadata=i.metadata),r}serialize(){let e={$schema:ah,surveyItems:Array.from(this.surveyItems.values()).map(e=>e.rawItem)};return e.translations=this._translations?.serialize(),this._templateValues&&(e.templateValues=Um(this._templateValues)),this.maxItemsPerPage&&(e.maxItemsPerPage=this.maxItemsPerPage),this.metadata&&(e.metadata=this.metadata),e}get surveyKey(){if(this.rootItem)return this.rootItem.key}get locales(){return this._translations?.locales||[]}get rootItem(){return Array.from(this.surveyItems.values()).find(e=>e instanceof $m&&e.isRoot)}get keyIndex(){let e=[];for(let t of this.surveyItems.values()){let n=this.getItemPath(t.id);e.push({itemId:t.id,key:t.key,keyPath:n.map(e=>this.surveyItems.get(e)?.key??``),path:n})}return e}getItemPath(e){let t=this.surveyItems.get(e);if(!t)throw Error(`Item ${e} not found`);if(t instanceof $m&&t.isRoot())return[];let n=this.getParentItem(e);if(!n)throw Error(`Parent item for ${e} not found`);return[...this.getItemPath(n.id),n.id]}getItemKey(e){let t=this.surveyItems.get(e);if(!t)return;let n=this.getItemPath(e).map(e=>this.surveyItems.get(e)?.key??``);return new Xm(t.key,n)}getParentItem(e){let t=this.surveyItems.get(e);if(!t)throw Error(`Item ${e} not found`);if(t instanceof $m&&t.isRoot())return;let n=Array.from(this.surveyItems.values()).find(t=>t instanceof $m&&t.config.items?.includes(e));if(n)return n}getChildrenItems(e){let t=this.surveyItems.get(e);return!t||!(t instanceof $m)?[]:t.config.items?.map(e=>this.surveyItems.get(e))?.filter(e=>e!==void 0)||[]}getSiblings(e){return this.surveyItems.get(e)&&this.getParentItem(e)?.items?.map(e=>this.surveyItems.get(e))?.filter(e=>e!==void 0)||[]}get translations(){return this._translations||=new ch,this._translations}getItemTranslations(e){if(!this.surveyItems.get(e))throw Error(`Item ${e} not found`);return this._translations?.getItemTranslations(e)}getTemplateValue(e){return this._templateValues?.get(e)}setTemplateValue(e,t){this._templateValues||=new Map,this._templateValues?.set(e,t)}deleteTemplateValue(e){this._templateValues?.delete(e)}getTemplateValueKeys(){return Array.from(this._templateValues?.keys()||[])}getAvailableResponseValueSlots(e){let t={};for(let n of this.surveyItems.values())t={...t,...n.getAvailableResponseValueSlots(e)};return t}getReferenceUsages(e){let t=[];for(let n of this.surveyItems.values())e&&n.id!==e&&!this.isDescendantOf(n.id,e)||t.push(...n.getReferenceUsages());if(this._templateValues)for(let[e,n]of this._templateValues.entries())for(let r of n.expression?.responseVariableRefs||[])t.push({itemId:e,usageType:Nm.templateValues,valueReference:r});return t}isDescendantOf(e,t){return e===t?!0:this.getItemPath(e).includes(t)}};const uh=365.2425,dh=10**8*24*60*60*1e3,fh=43200,ph=1440,mh=3600,hh=3600*24,gh=hh*7,_h=hh*365.2425,vh=31556952/12,yh=2629746*3,bh=Symbol.for(`constructDateFrom`);function xh(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&bh in e?e[bh](t):e instanceof Date?new e.constructor(t):new Date(t)}function Sh(e,t){return xh(t||e,e)}var Ch={};function wh(){return Ch}function Th(e){let t=Sh(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Eh(e,...t){let n=xh.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Dh(e,t){let n=Sh(e)-+Sh(t);return n<0?-1:n>0?1:n}function Oh(e){return xh(e,Date.now())}function kh(e,t,n){let[r,i]=Eh(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ah(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function jh(e,t){return Sh(e)-+Sh(t)}function Mh(e,t){let n=Sh(e,t?.in);return n.setHours(23,59,59,999),n}function Nh(e,t){let n=Sh(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Ph(e,t){let n=Sh(e,t?.in);return+Mh(n,t)==+Nh(n,t)}function Fh(e,t,n){let[r,i,a]=Eh(n?.in,e,e,t),o=Dh(i,a),s=Math.abs(kh(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Dh(i,a)===-o;Ph(r)&&s===1&&Dh(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function Ih(e,t,n){let r=jh(e,t)/1e3;return Ah(n?.roundingMethod)(r)}var Lh={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}};const Rh=(e,t,n)=>{let r,i=Lh[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function zh(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Bh={full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},Vh={full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},Hh={full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`};const Uh={date:zh({formats:Bh,defaultWidth:`full`}),time:zh({formats:Vh,defaultWidth:`full`}),dateTime:zh({formats:Hh,defaultWidth:`full`})};var Wh={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`};const Gh=(e,t,n,r)=>Wh[e];function Kh(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var qh={narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},Jh={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},Yh={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},Xh={narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},Zh={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},Qh={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},$h=(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`};const eg={ordinalNumber:$h,era:Kh({values:qh,defaultWidth:`wide`}),quarter:Kh({values:Jh,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Kh({values:Yh,defaultWidth:`wide`}),day:Kh({values:Xh,defaultWidth:`wide`}),dayPeriod:Kh({values:Zh,defaultWidth:`wide`,formattingValues:Qh,defaultFormattingWidth:`wide`})};function tg(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?rg(s,e=>e.test(o)):ng(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function ng(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function rg(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ig(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var ag=/^(\d+)(th|st|nd|rd)?/i,og=/\d+/i,sg={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},cg={any:[/^b/i,/^(a|c)/i]},lg={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ug={any:[/1/i,/2/i,/3/i,/4/i]},dg={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},fg={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pg={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},mg={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},hg={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gg={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}};const _g={ordinalNumber:ig({matchPattern:ag,parsePattern:og,valueCallback:e=>parseInt(e,10)}),era:tg({matchPatterns:sg,defaultMatchWidth:`wide`,parsePatterns:cg,defaultParseWidth:`any`}),quarter:tg({matchPatterns:lg,defaultMatchWidth:`wide`,parsePatterns:ug,defaultParseWidth:`any`,valueCallback:e=>e+1}),month:tg({matchPatterns:dg,defaultMatchWidth:`wide`,parsePatterns:fg,defaultParseWidth:`any`}),day:tg({matchPatterns:pg,defaultMatchWidth:`wide`,parsePatterns:mg,defaultParseWidth:`any`}),dayPeriod:tg({matchPatterns:hg,defaultMatchWidth:`any`,parsePatterns:gg,defaultParseWidth:`any`})},vg={code:`en-US`,formatDistance:Rh,formatLong:Uh,formatRelative:Gh,localize:eg,match:_g,options:{weekStartsOn:0,firstWeekContainsDate:1}};function yg(e,t,n){let r=wh(),i=n?.locale??r.locale??vg,a=Dh(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Eh(n?.in,...a>0?[t,e]:[e,t]),l=Ih(c,s),u=(Th(c)-Th(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/1440);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/fh),i.formatDistance(`aboutXMonths`,f,o);if(f=Fh(c,s),f<12){let e=Math.round(d/fh);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function bg(e,t){return yg(e,Oh(e),t)}var xg={string:`string`,duration:`duration`,reference:`reference`,number:`number`,boolean:`boolean`,date:`date`,stringArray:`string[]`,durationArray:`duration[]`,referenceArray:`reference[]`,numberArray:`number[]`,dateArray:`date[]`},Sg=function(e){return e.CQM=`CQM`,e.md=`md`,e}({}),Cg={default:`default`,mask:`mask`,dateFormat:`dateFormat`},wg={mode:Cg.default},Tg={tiny:40,focused:150,full:500},Eg=120,Dg=8,Og=120,kg={generic:{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!1},"key-suggestion":{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!0},"label-suggestion":{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!0},"item-generation":{scope:`focused`,includeRawSurvey:!1,includeIndexes:!0,includeFocusItemTree:!0},translation:{scope:`focused`,includeRawSurvey:!1,includeIndexes:!0,includeFocusItemTree:!0},"condition-management":{scope:`full`,includeRawSurvey:!0,includeIndexes:!0,includeFocusItemTree:!0}},Ag=e=>[...e].sort((e,t)=>e.itemId.localeCompare(t.itemId));function jg(e,t){let n=e.surveyItems.get(t);return n instanceof $m?[...n.items??[]]:[]}function Mg(e){let t=new Map;for(let n of e.surveyItems.values())if(n instanceof $m)for(let e of n.items??[])t.set(e,n.id);return t}function Ng(e,t){let n=new Map,r=(i,a=new Set)=>{let o=n.get(i);if(o)return o;let s=e.surveyItems.get(i);if(!s)return i;if(a.has(i))return s.key;let c=t.get(i);if(!c)return n.set(i,s.key),s.key;a.add(i);let l=r(c,a);a.delete(i);let u=`${l}.${s.key}`;return n.set(i,u),u};return r}function Pg(e,t,n){let r=[],i=new Set,a=(r,i)=>{let a=e.surveyItems.get(r);if(!a)return;let o=a instanceof $m?a.items.length:0;return{itemId:r,parentId:t.get(r),depth:i,itemType:a.type,key:a.key,fullKey:n(r),itemLabel:a.metadata?.itemLabel,childCount:o}},o=(t,n)=>{if(i.has(t))return;i.add(t);let s=a(t,n);s&&r.push(s);for(let r of jg(e,t))o(r,n+1)},s=e.rootItem;s&&o(s.id,0);let c=Ag(Array.from(e.surveyItems.values()).filter(e=>!i.has(e.id)).map(e=>({itemId:e.id})));for(let e of c)o(e.itemId,0);return r}function Fg(e,t){let n=new Set,r=e.rootItem;r&&n.add(r.id),n.add(t);for(let r of e.getItemPath(t))n.add(r);for(let r of e.getSiblings(t))n.add(r.id);for(let r of jg(e,t))n.add(r);return n}function Ig(e,t,n,r){let i=[{id:t,depth:0}];for(;i.length>0;){let t=i.shift();if(t&&!(t.depth>=r))for(let r of jg(e,t.id))n.add(r),i.push({id:r,depth:t.depth+1})}}function Lg(e,t){let n=Fg(e,t),r=e.getItemPath(t);Ig(e,t,n,2);for(let r of e.getSiblings(t))r.id!==t&&(n.add(r.id),Ig(e,r.id,n,1));for(let t of r){let r=(e.getParentItem(t)?.items??[]).filter(e=>e!==t);for(let t of r)n.add(t),Ig(e,t,n,1)}return n}function Rg(e,t){if(!e.surveyItems.has(t))return;let n=[...e.getItemPath(t),t];return{focusItemId:t,parentItemId:e.getParentItem(t)?.id,pathItemIds:n,siblingItemIds:e.getSiblings(t).filter(e=>e.id!==t).map(e=>e.id),childItemIds:jg(e,t)}}var zg=(e,t)=>e.trim().replace(/\s+/g,` `).slice(0,t),Bg=(e,t)=>{if(!e)return null;let n=e.content;if(typeof n!=`string`)return null;let r=zg(n,t);return r.length>0?r:null};function Vg(e,t,n,r){let i=[],a=e.getItemTranslations(t);if(!a)return i;for(let e of a.locales){let t=a.getAllForLocale(e);if(t)for(let[a,o]of Object.entries(t)){let t=Bg(o,r);if(t&&(i.push({locale:e,contentKey:a,text:t}),i.length>=n))return i}}return i}function Hg(e,t,n,r){if(!e.surveyItems.has(t))return{truncated:!1};let i=r.treeLimit,a=!1,o=t=>{if(i<=0){a=!0;return}let s=e.surveyItems.get(t);if(!s)return;--i;let c=e.getSiblings(t).filter(e=>e.id!==t).map(e=>e.key),l=[];if(s instanceof $m)for(let e of s.items){let t=o(e);t&&l.push(t)}return{itemId:s.id,itemType:s.type,itemKey:s.key,fullKey:n(s.id),itemLabel:s.metadata?.itemLabel,siblingKeys:c,translations:Vg(e,s.id,r.snippetsPerItem,r.snippetTextLimit),descendants:l}};return{focusItem:o(t),truncated:a}}function Ug(e,t,n){let r={keyIndex:t.map(e=>({itemId:e.itemId,itemType:e.itemType,key:e.key,fullKey:e.fullKey,itemLabel:e.itemLabel,path:e.fullKey.split(`.`).slice(0,-1)}))};return n===`condition-management`&&(r.responseSlots=Object.keys(e.getAvailableResponseValueSlots())),r}function Wg(e,t={}){let n=t.purpose??`generic`,r=kg[n],i=t.scope??r.scope,a=Tg[i],o=Math.max(1,t.outlineLimit??a),s=t.includeRawSurvey??r.includeRawSurvey,c=t.includeIndexes??r.includeIndexes,l=t.includeFocusItemTree??r.includeFocusItemTree,u=t.focusItemId,d=!!(u&&e.surveyItems.has(u)),f=Mg(e),p=Ng(e,f),m=Pg(e,f,p),h=m;if(i===`tiny`&&u&&d){let t=Fg(e,u);h=m.filter(e=>t.has(e.itemId))}else if(i===`focused`&&u&&d){let t=Lg(e,u);h=m.filter(e=>t.has(e.itemId))}let g=h.length>o,_=g?h.slice(0,o):h,v=!1,y;if(l&&u&&d){let n=Hg(e,u,p,{treeLimit:Math.max(1,t.focusItemTreeLimit??Eg),snippetsPerItem:Math.max(1,t.translationSnippetsPerItemLimit??Dg),snippetTextLimit:Math.max(1,t.translationSnippetTextLimit??Og)});v=n.truncated,y=n.focusItem}return{purpose:n,scope:i,surveyKey:e.surveyKey,locales:[...e.locales],itemCount:e.surveyItems.size,outline:_,focus:u?Rg(e,u):void 0,focusItem:y,indexes:c?Ug(e,m,n):void 0,flags:{outlineTruncated:g,rawSurveyIncluded:s,focusItemTreeTruncated:v},rawSurvey:s?e.serialize():void 0}}var Gg=class e{survey;constructor(e){this.survey=e}copyItem(e){if(!this.survey.surveyItems.get(e))throw Error(`Item with id '${e}' not found`);let t=this.collectItemsForCopy(e),n=t.map(e=>{let t=this.survey.surveyItems.get(e);if(!t)throw Error(`Item with id '${e}' not found during copy`);return{itemId:e,itemData:t.rawItem}}),r={};return t.forEach(e=>{try{let t=this.survey.getItemTranslations(e);if(t?.locales?.length){let n={};t.locales.forEach(e=>{let r=t.getAllForLocale(e);r&&(n[e]=r)}),r[e]=n}else r[e]={}}catch{r[e]={}}}),{type:`survey-item`,version:`1.0.0`,items:n,translations:r,rootItemId:e,timestamp:Date.now()}}collectItemsForCopy(e){let t=[e],n=this.survey.surveyItems.get(e);if(!n)return[];if(n instanceof $m){let e=n.items;e.length>0&&e.forEach(e=>{let n=this.collectItemsForCopy(e);t.push(...n)})}return t}addItemToParentGroup(e,t){let n=this.survey.surveyItems.get(e.parentId);if(!n)throw Error(`Parent item with id '${e.parentId}' not found`);if(!(n instanceof $m))throw Error(`Parent item '${e.parentId}' is not a group item`);let r=n.items.map(e=>this.survey.surveyItems.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.key)),a=t.key;if(i.has(a)){let e=1,n=t.key;for(;i.has(a);)a=n+`_${e}`,e++;if(a!==t.key){let e={...t.rawItem,key:a},n=this.survey.createItemFromRaw(e);this.survey.surveyItems.delete(t.id),this.survey.surveyItems.set(n.id,n),t=n}}let o=e.index===void 0?n.items.length:Math.min(e.index,n.items.length);n.addChild(t.id,o)}pasteItem(t,n){if(!e.isValidClipboardData(t))throw Error(`Invalid clipboard data format`);let r={};t.items.forEach(({itemId:e})=>{r[e]=Om()}),t.items.forEach(({itemId:e,itemData:i})=>{let a=r[e];if(a){let o=this.updateItemIdsInData(i,r);o.id=a;let s=this.survey.createItemFromRaw(o);this.survey.surveyItems.set(s.id,s),e===t.rootItemId&&this.addItemToParentGroup(n,s)}});let i=this.updateTranslations(t.translations,r);return Object.keys(i).forEach(e=>{let t=new sh,n=i[e];Object.keys(n).forEach(e=>{t.setAllForLocale(e,n[e])}),this.survey.translations.setItemTranslations(e,t)}),r[t.rootItemId]}updateItemIdsInData(e,t){let n=JSON.parse(JSON.stringify(e));if(n.itemType===Ym.Group&&n.config){let e=n.config;e.items&&=e.items.map(e=>t[e]??e)}return this.updateExpressionsInItemData(n,t),n}updateExpressionsInItemData(e,t){e.displayConditions?.root&&this.updateExpressionReferences(e.displayConditions.root,t),e.displayConditions?.components&&Object.values(e.displayConditions.components).forEach(e=>{e&&this.updateExpressionReferences(e,t)}),e.disabledConditions?.components&&Object.values(e.disabledConditions.components).forEach(e=>{e&&this.updateExpressionReferences(e,t)}),e.validations&&Object.values(e.validations).forEach(e=>{e&&this.updateExpressionReferences(e,t)})}updateExpressionReferences(e,t){if(!e||typeof e!=`object`)return;let n=e;Array.isArray(n.data)&&n.data.forEach(e=>{if(e&&typeof e==`object`&&e&&`str`in e){let n=e;typeof n.str==`string`&&Object.prototype.hasOwnProperty.call(t,n.str)&&(n.str=t[n.str]),this.updateExpressionReferences(e,t)}}),Object.keys(n).forEach(e=>{let r=n[e];r&&typeof r==`object`&&this.updateExpressionReferences(r,t)})}updateTranslations(e,t){let n={};return Object.keys(e).forEach(r=>{let i=e[r],a=t[r];n[a]=i}),n}static isValidClipboardData(e){if(typeof e!=`object`||!e||e===void 0)return!1;let t=e;return t.type===`survey-item`&&t.version===`1.0.0`&&t.rootItemId!==void 0}},Kg={USER:`user`,SYSTEM:`system`},qg=class{static encoder=new TextEncoder;static calculateSize(e){let t=JSON.stringify(e);return this.encoder.encode(t).length}static formatBytes(e){let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`}},Jg=class e{history=[];currentIndex=-1;_config;constructor(e,t={},n={label:`Initial state`,source:Kg.SYSTEM}){this._config={maxTotalMemoryMB:50,minHistorySize:10,maxHistorySize:200,...t},this.saveSnapshot(e,n)}saveSnapshot(e,t){let n=qg.calculateSize(e);this.history=this.history.slice(0,this.currentIndex+1),this.history.push({survey:Em(e),timestamp:Date.now(),meta:t,memorySize:n}),this.currentIndex++,this.cleanupHistory()}cleanupHistory(){let e=this.getTotalMemoryUsage(),t=this._config.maxTotalMemoryMB*1024*1024;for(;this.history.length>this._config.minHistorySize&&(e>t||this.history.length>this._config.maxHistorySize);){let t=this.history.shift();this.currentIndex--,t&&(e-=t.memorySize)}}getTotalMemoryUsage(){return this.history.reduce((e,t)=>e+t.memorySize,0)}commit(e,t){this.saveSnapshot(e,t)}getCurrentState(){if(this.currentIndex<0||this.currentIndex>=this.history.length)throw Error(`Invalid history state`);return Em(this.history[this.currentIndex].survey)}undo(){return this.canUndo()?(this.currentIndex--,this.getCurrentState()):null}redo(){return this.canRedo()?(this.currentIndex++,this.getCurrentState()):null}canUndo(){return this.currentIndex>0}canRedo(){return this.currentIndex<this.history.length-1}getUndoMeta(){return this.canUndo()?this.history[this.currentIndex].meta:null}getRedoMeta(){return this.canRedo()?this.history[this.currentIndex+1].meta:null}getMemoryUsage(){return{totalMB:this.getTotalMemoryUsage()/(1024*1024),entries:this.history.length}}getConfig(){return{...this._config}}getHistory(){return this.history.map((e,t)=>({index:t,meta:e.meta,timestamp:e.timestamp,memorySize:e.memorySize,isCurrent:t===this.currentIndex}))}getCurrentIndex(){return this.currentIndex}getHistoryLength(){return this.history.length}jumpToIndex(e){return e<0||e>=this.history.length||e===this.currentIndex?null:(this.currentIndex=e,this.getCurrentState())}canJumpToIndex(e){return e>=0&&e<this.history.length&&e!==this.currentIndex}serialize(){return{history:this.history.map(e=>({survey:e.survey,timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize})),currentIndex:this.currentIndex,config:{...this._config}}}static deserialize(t){if(!t.history||!Array.isArray(t.history)||t.history.length===0)throw Error(`Invalid object: history must be an array and must not be empty`);if(typeof t.currentIndex!=`number`||t.currentIndex<0||t.currentIndex>=t.history.length)throw Error(`Invalid object: currentIndex must be a valid index within the history array`);if(!t.config)throw Error(`Invalid object: config is required`);let n=new e(t.history[0].survey,t.config);return n.history=t.history.map(e=>({survey:Em(e.survey),timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize})),n.currentIndex=t.currentIndex,n}},Yg=class e{_survey;_undoRedo;_hasUncommittedChanges=!1;_pluginRegistry;constructor(e,t={},n){this._survey=e;let{pluginRegistry:r,...i}=t;this._pluginRegistry=r,this._undoRedo=new Jg(e.serialize(),i,n)}get survey(){let e=this._survey.serialize(),t=this._pluginRegistry??this._survey.getPluginRegistry();return lh.fromJson(e,t)}get hasUncommittedChanges(){return this._hasUncommittedChanges}get undoRedo(){return this._undoRedo}commit(e){this._undoRedo.commit(this._survey.serialize(),e),this._hasUncommittedChanges=!1}commitIfNeeded(){this._hasUncommittedChanges&&this.commit({label:`Latest content changes`,source:Kg.SYSTEM})}undo(){if(this._hasUncommittedChanges)return this._survey=lh.fromJson(this._undoRedo.getCurrentState(),this._pluginRegistry),this._hasUncommittedChanges=!1,!0;{let e=this._undoRedo.undo();return e?(this._survey=lh.fromJson(e,this._pluginRegistry),this._hasUncommittedChanges=!1,!0):!1}}redo(){if(this._hasUncommittedChanges)return!1;let e=this._undoRedo.redo();return e?(this._survey=lh.fromJson(e,this._pluginRegistry),this._hasUncommittedChanges=!1,!0):!1}jumpToIndex(e){if(this._hasUncommittedChanges)return!1;let t=this._undoRedo.jumpToIndex(e);return t?(this._survey=lh.fromJson(t,this._pluginRegistry),this._hasUncommittedChanges=!1,!0):!1}canUndo(){return this._hasUncommittedChanges||this._undoRedo.canUndo()}canRedo(){return!this._hasUncommittedChanges&&this._undoRedo.canRedo()}getUndoMeta(){return this._hasUncommittedChanges?{label:`Latest content changes`,source:Kg.SYSTEM}:this._undoRedo.getUndoMeta()}getRedoMeta(){return this._hasUncommittedChanges?null:this._undoRedo.getRedoMeta()}getMemoryUsage(){return this._undoRedo.getMemoryUsage()}getUndoRedoConfig(){return this._undoRedo.getConfig()}toJson(){return{version:`1.0.0`,survey:this._survey.serialize(),undoRedo:this._undoRedo.serialize(),hasUncommittedChanges:this._hasUncommittedChanges}}static fromJson(t,n){if(!t.survey)throw Error(`Invalid object: survey is required`);if(!t.undoRedo)throw Error(`Invalid object: undoRedo is required`);if(typeof t.hasUncommittedChanges!=`boolean`)throw Error(`Invalid object: hasUncommittedChanges must be a boolean`);t.version&&!t.version.startsWith(`1.`)&&console.warn(`Warning: Loading SurveyEditor with version ${t.version}, current version is 1.0.0`);let r=new e(lh.fromJson(t.survey,n),{pluginRegistry:n});return r._undoRedo=Jg.deserialize(t.undoRedo),r._hasUncommittedChanges=t.hasUncommittedChanges,r}markAsModified(){this._hasUncommittedChanges=!0}addItem(e,t,n){this.markAsModified();let r;if(e){let t=this._survey.surveyItems.get(e.parentId);if(!t)throw Error(`Parent item with id '${e.parentId}' not found`);if(!(t instanceof $m))throw Error(`Parent item '${e.parentId}' is not a group item (${t.type})`);r=t}else{let e=this._survey.rootItem;if(!e)throw Error(`No root group found in survey`);if(!(e instanceof $m))throw Error(`Root item is not a group item`);r=e}if(r.hasChild(t.id))throw Error(`Item ${t.id} already in this group`);let i=Array.from(this._survey.surveyItems.values()).filter(e=>r.items?.includes(e.id)),a=1;for(;i.some(e=>e.key===t.key);)t.key+=`_${a}`,a++;let o;o=e?.index===void 0?r.items.length:Math.min(e.index,r.items.length),this._survey.surveyItems.set(t.id,t),r.addChild(t.id,o),n&&this._survey.translations.setItemTranslations(t.id,n)}removeItem(e,t=!1){this.markAsModified();let n=this._survey.surveyItems.get(e);if(!n)return!1;let r=this._survey.getParentItem(e);if(!r)throw Error(`Item with id '${e}' is the root item`);if(n instanceof $m)for(let e of n.getChildrenIds())this.removeItem(e,!0);return this._survey.surveyItems.delete(e),this._survey.translations?.onItemDeleted(e),t||r.removeChild(e),!0}moveItem(e,t){this.markAsModified();let n=this._survey.surveyItems.get(e);if(!n)throw Error(`Item with id '${e}' not found`);let r=this._survey.surveyItems.get(t.parentId);if(!r)throw Error(`Target parent with id '${t.parentId}' not found`);if(!(r instanceof $m))throw Error(`Target parent '${t.parentId}' is not a group item (${r.type})`);if(this._survey.isDescendantOf(t.parentId,e))throw Error(`Cannot move item '${e}' to its descendant '${t.parentId}'`);let i=this._survey.getParentItem(e);if(i?.id===t.parentId)throw Error(`Item '${e}' is already in the target parent '${t.parentId}'`);i&&i.removeChild(e);let a=r,o=Array.from(this._survey.surveyItems.values()).filter(e=>a.hasChild(e.id)),s=1;for(;o.some(e=>e.key===n.key);)n.key+=`_${s}`,s++;let c=t.index===void 0?a.items.length:Math.min(t.index,a.items.length);return a.items.splice(c,0,e),!0}getItemDataCopy(e){let t=this._survey.surveyItems.get(e);if(!t)throw Error(`Item with id '${e}' not found`);return JSON.parse(JSON.stringify(t.rawItem))}updateItem(e,t){let n=this._survey.surveyItems.get(e);if(!n)throw Error(`Item with id '${e}' not found`);if(`id`in t&&t.id!==void 0&&t.id!==e)throw Error(`Cannot change item id from '${e}' to '${t.id}'`);let r={...n.rawItem,...t,id:e},i=r.key??n.key,a=this._survey.getParentItem(e);if(a){let t=(a.items??[]).filter(t=>t!==e).map(e=>this._survey.surveyItems.get(e)).find(e=>e!==void 0&&e.key===i);if(t)throw Error(`Key '${i}' is already in use by sibling item '${t.id}'`)}let o=this._survey.createItemFromRaw(r);this._survey.surveyItems.set(e,o),this.markAsModified()}updateItemTranslations(e,t){if(this.markAsModified(),!this._survey.surveyItems.get(e))throw Error(`Item with id '${e}' not found`);return this._survey.translations.setItemTranslations(e,t),!0}updateSurveyTranslations(e){this.markAsModified(),e.surveyCard&&this._survey.translations.setSurveyCardContent(e.surveyCard.locale,e.surveyCard.content),e.navigation&&this._survey.translations.setNavigationContent(e.navigation.locale,e.navigation.content),e.validationMessages&&this._survey.translations.setValidationMessages(e.validationMessages.locale,e.validationMessages.content)}getMaxItemsPerPage(){let e=this._survey.maxItemsPerPage;return e?{...e}:void 0}updateMaxItemsPerPage(e){this.markAsModified(),this._survey.maxItemsPerPage=e?{...e}:void 0}getMetadata(){let e=this._survey.metadata;return e?{...e}:void 0}updateMetadata(e){this.markAsModified(),this._survey.metadata=e?{...e}:void 0}getTemplateValue(e){let t=this._survey.getTemplateValue(e);return t?Em(t):void 0}getTemplateValues(){let e=this._survey.getTemplateValueKeys(),t=new Map;for(let n of e){let e=this._survey.getTemplateValue(n);e&&t.set(n,Em(e))}return t}setTemplateValue(e,t){this.markAsModified(),this._survey.setTemplateValue(e,Em(t))}removeTemplateValue(e){this.markAsModified(),this._survey.deleteTemplateValue(e)}copyItem(e){return new Gg(this._survey).copyItem(e)}pasteItem(e,t){return this.markAsModified(),new Gg(this._survey).pasteItem(e,t)}};function Xg({sessionId:e,editor:t,changeTick:n,persistDebounceMs:r,onEditorStateChange:i}){let a=(0,l.useRef)(null),o=(0,l.useRef)({sessionId:e,editor:t,changeTick:n}),s=(0,l.useEffectEvent)(e=>{i?.(e)});(0,l.useEffect)(()=>{o.current={sessionId:e,editor:t,changeTick:n}},[e,t,n]),(0,l.useEffect)(()=>{if(a.current&&=(clearTimeout(a.current),null),!(!t||n===0))return a.current=setTimeout(()=>{s({sessionId:e,state:t.toJson(),revision:n,hasUncommittedChanges:t.hasUncommittedChanges,at:Date.now()})},r),()=>{a.current&&=(clearTimeout(a.current),null)}},[e,t,n,r]),(0,l.useEffect)(()=>()=>{let e=o.current;e.editor&&e.changeTick>0&&s({sessionId:e.sessionId,state:e.editor.toJson(),revision:e.changeTick,hasUncommittedChanges:e.editor.hasUncommittedChanges,at:Date.now()})},[])}function Zg({...e}){return(0,d.jsx)(Tr,{"data-slot":`alert-dialog`,...e})}function Qg({...e}){return(0,d.jsx)(Er,{"data-slot":`alert-dialog-portal`,...e})}function $g({className:e,...t}){return(0,d.jsx)(Dr,{"data-slot":`alert-dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function e_({className:e,size:t=`default`,...n}){return(0,d.jsxs)(Qg,{children:[(0,d.jsx)($g,{}),(0,d.jsx)(Or,{"data-slot":`alert-dialog-content`,"data-size":t,className:Y(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function t_({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Y(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function n_({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Y(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function r_({className:e,...t}){return(0,d.jsx)(jr,{"data-slot":`alert-dialog-title`,className:Y(`text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function i_({className:e,...t}){return(0,d.jsx)(Mr,{"data-slot":`alert-dialog-description`,className:Y(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function a_({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,d.jsx)(vm,{variant:t,size:n,asChild:!0,children:(0,d.jsx)(kr,{"data-slot":`alert-dialog-action`,className:Y(e),...r})})}function o_({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,d.jsx)(vm,{variant:t,size:n,asChild:!0,children:(0,d.jsx)(Ar,{"data-slot":`alert-dialog-cancel`,className:Y(e),...r})})}var s_=(0,l.createContext)(void 0);function c_({isOpen:e,title:t,description:n,buttonLabel:r,dismissButtonClassName:i,dismissButtonVariant:a,children:o,onDismiss:s}){return(0,d.jsx)(Zg,{open:e,onOpenChange:e=>{e||s()},children:(0,d.jsxs)(e_,{children:[(0,d.jsxs)(t_,{children:[(0,d.jsx)(r_,{children:t}),n?(0,d.jsx)(i_,{children:n}):null]}),o==null?null:(0,d.jsx)(`div`,{className:`py-2`,children:o}),(0,d.jsx)(n_,{className:`justify-center sm:justify-center`,children:(0,d.jsx)(o_,{className:Y(`min-w-24 active:scale-[0.97] transition-transform duration-150`,i),variant:a??`default`,children:r})})]})})}const l_=({children:e})=>{let[t,n]=(0,l.useState)({}),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null),o=(0,l.useCallback)(()=>{let e=a.current;e&&e(),a.current=null},[]),s=(0,l.useCallback)(()=>{o(),i(!1)},[o]),c=(0,l.useCallback)(e=>(o(),n(e),i(!0),new Promise(e=>{a.current=e})),[o]),u=(0,l.useMemo)(()=>Object.assign(c,{dismiss:s}),[c,s]);return(0,d.jsxs)(s_.Provider,{value:{alert:u},children:[e,(0,d.jsx)(c_,{isOpen:r,title:t.title??`Notice`,description:t.description??``,buttonLabel:t.buttonLabel??`OK`,dismissButtonClassName:t.dismissButtonClassName,dismissButtonVariant:t.dismissButtonVariant,onDismiss:s,children:t.children})]})},u_=()=>{let e=(0,l.useContext)(s_);if(!e)throw Error(`useAlert must be used within an AlertDialogProvider`);return e.alert};function d_({className:e,type:t,...n}){return(0,d.jsx)(`input`,{type:t,"data-slot":`input`,className:Y(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function f_({className:e,...t}){return(0,d.jsx)(_u,{"data-slot":`label`,className:Y(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var p_=e=>{let[t,n]=(0,l.useState)(``),r=e.requireConfirmationInput,i=r?.confirmTerm??``,a=!r||t===i,o=(r?.label??`Type {{confirmTerm}} to confirm`).split(`{{confirmTerm}}`);return(0,d.jsx)(Zg,{open:e.isOpen,onOpenChange:t=>{t||(n(``),e.onCancel())},children:(0,d.jsxs)(e_,{children:[(0,d.jsxs)(t_,{children:[(0,d.jsx)(r_,{children:e.title}),(0,d.jsx)(i_,{children:e.description})]}),r&&(0,d.jsxs)(`div`,{className:`grid gap-2`,children:[(0,d.jsx)(f_,{htmlFor:`confirm-type-input`,children:o.map((e,t)=>t<o.length-1?(0,d.jsxs)(`span`,{children:[e,(0,d.jsx)(`span`,{className:`font-bold`,children:i})]},t):(0,d.jsx)(`span`,{children:e},t))}),(0,d.jsx)(d_,{id:`confirm-type-input`,value:t,onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a&&(t.preventDefault(),n(``),e.onConfirm())},placeholder:i,autoComplete:`off`}),r.hint&&(0,d.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r.hint})]}),(0,d.jsxs)(n_,{children:[(0,d.jsx)(o_,{className:`active:scale-[0.97] transition-transform duration-150`,onClick:t=>{t.preventDefault(),n(``),e.onCancel()},children:e.cancelButtonText}),(0,d.jsx)(a_,{variant:e.variant,className:`active:scale-[0.97] transition-transform duration-150`,disabled:!a,onClick:t=>{t.preventDefault(),n(``),e.onConfirm()},children:e.confirmButtonText})]})]})})},m_=p_,h_=(0,l.createContext)(void 0);const g_=({children:e})=>{let[t,n]=(0,l.useState)({}),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(null),s=(0,l.useCallback)(e=>(o(e=>(e&&e(!1),null)),n(e),i(!0),new Promise(e=>{o(()=>e)})),[]);return(0,d.jsxs)(h_.Provider,{value:{confirm:s},children:[e,(0,d.jsx)(m_,{isOpen:r,title:t.title||`Confirm Action`,description:t.description||`Are you sure you want to proceed?`,confirmButtonText:t.confirmButtonText||`Confirm`,cancelButtonText:t.cancelButtonText||`Cancel`,variant:t.variant||`default`,requireConfirmationInput:t.requireConfirmationInput,onConfirm:()=>{a&&a(!0),i(!1),o(null)},onCancel:()=>{a&&a(!1),i(!1),o(null)}})]})},__=()=>{let e=(0,l.useContext)(h_);if(!e)throw Error(`useConfirm must be used within a ConfirmDialogProvider`);return e.confirm};var v_=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},y_=[`light`,`dark`],b_=`(prefers-color-scheme: dark)`,x_=typeof window>`u`,S_=l.createContext(void 0),C_={setTheme:e=>{},themes:[]},w_=()=>l.useContext(S_)??C_,T_=e=>l.useContext(S_)?l.createElement(l.Fragment,null,e.children):l.createElement(D_,{...e}),E_=[`light`,`dark`],D_=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=E_,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:u,nonce:d,scriptProps:f})=>{let[p,m]=l.useState(()=>k_(i,o)),[h,g]=l.useState(()=>p===`system`?j_():p),_=c?Object.values(c):a,v=l.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=j_());let a=c?c[i]:i,l=t?A_(d):null,u=document.documentElement,f=e=>{e===`class`?(u.classList.remove(..._),a&&u.classList.add(a)):e.startsWith(`data-`)&&(a?u.setAttribute(e,a):u.removeAttribute(e))};if(Array.isArray(s)?s.forEach(f):f(s),r){let e=y_.includes(o)?o:null,t=y_.includes(i)?i:e;u.style.colorScheme=t}l?.()},[d]),y=l.useCallback(e=>{let t=typeof e==`function`?e(p):e;m(t);try{localStorage.setItem(i,t)}catch{}},[p]),b=l.useCallback(t=>{g(j_(t)),p===`system`&&n&&!e&&v(`system`)},[p,e]);l.useEffect(()=>{let e=window.matchMedia(b_);return e.addListener(b),b(e),()=>e.removeListener(b)},[b]),l.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?m(e.newValue):y(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[y]),l.useEffect(()=>{v(e??p)},[e,p]);let x=l.useMemo(()=>({theme:p,setTheme:y,forcedTheme:e,resolvedTheme:p===`system`?h:p,themes:n?[...a,`system`]:a,systemTheme:n?h:void 0}),[p,y,e,h,n,a]);return l.createElement(S_.Provider,{value:x},l.createElement(O_,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:d,scriptProps:f}),u)},O_=l.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:u})=>{let d=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return l.createElement(`script`,{...u,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${v_.toString()})(${d})`}})}),k_=(e,t)=>{if(x_)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},A_=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},j_=e=>(e||=window.matchMedia(b_),e.matches?`dark`:`light`);function M_(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var N_=e=>{switch(e){case`success`:return I_;case`info`:return R_;case`warning`:return L_;case`error`:return z_;default:return null}},P_=Array(12).fill(0),F_=({visible:e,className:t})=>l.default.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},l.default.createElement(`div`,{className:`sonner-spinner`},P_.map((e,t)=>l.default.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),I_=l.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},l.default.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),L_=l.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},l.default.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),R_=l.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},l.default.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),z_=l.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},l.default.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),B_=l.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},l.default.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l.default.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),V_=()=>{let[e,t]=l.default.useState(document.hidden);return l.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},H_=1,U_=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:H_++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],l.default.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(K_(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!l.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!l.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!l.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!l.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||H_++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},W_=new U_,G_=(e,t)=>{let n=t?.id||H_++;return W_.addToast({title:e,...t,id:n}),n},K_=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,q_=G_,J_=()=>W_.toasts,Y_=()=>W_.getActiveToasts(),Z=Object.assign(q_,{success:W_.success,info:W_.info,warning:W_.warning,error:W_.error,custom:W_.custom,message:W_.message,promise:W_.promise,dismiss:W_.dismiss,loading:W_.loading},{getHistory:J_,getToasts:Y_});M_(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function X_(e){return e.label!==void 0}var Z_=3,Q_=`24px`,$_=`16px`,ev=4e3,tv=356,nv=14,rv=45,iv=200;function av(...e){return e.filter(Boolean).join(` `)}function ov(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var sv=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:u,expanded:d,removeToast:f,defaultRichColors:p,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:_,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=l.default.useState(null),[k,A]=l.default.useState(null),[j,M]=l.default.useState(!1),[N,P]=l.default.useState(!1),[F,I]=l.default.useState(!1),[L,R]=l.default.useState(!1),[z,B]=l.default.useState(!1),[V,H]=l.default.useState(0),[ee,te]=l.default.useState(0),U=l.default.useRef(n.duration||b||ev),W=l.default.useRef(null),ne=l.default.useRef(null),re=c===0,ie=c+1<=o,ae=n.type,oe=n.dismissible!==!1,G=n.className||``,se=n.descriptionClassName||``,ce=l.default.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),le=l.default.useMemo(()=>n.closeButton??m,[n.closeButton,m]),ue=l.default.useMemo(()=>n.duration||b||ev,[n.duration,b]),de=l.default.useRef(0),fe=l.default.useRef(0),pe=l.default.useRef(0),me=l.default.useRef(null),[he,ge]=x.split(`-`),_e=l.default.useMemo(()=>s.reduce((e,t,n)=>n>=ce?e:e+t.height,0),[s,ce]),ve=V_(),ye=n.invert||t,be=ae===`loading`;fe.current=l.default.useMemo(()=>ce*S+_e,[ce,_e]),l.default.useEffect(()=>{U.current=ue},[ue]),l.default.useEffect(()=>{M(!0)},[]),l.default.useEffect(()=>{let e=ne.current;if(e){let t=e.getBoundingClientRect().height;return te(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),l.default.useLayoutEffect(()=>{if(!j)return;let e=ne.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,te(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let xe=l.default.useCallback(()=>{P(!0),H(fe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{f(n)},iv)},[n,f,a,fe]);l.default.useEffect(()=>{if(n.promise&&ae===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return d||i||ve?(()=>{if(pe.current<de.current){let e=new Date().getTime()-de.current;U.current-=e}pe.current=new Date().getTime()})():U.current!==1/0&&(de.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),xe()},U.current)),()=>clearTimeout(e)},[d,i,n,ae,ve,xe]),l.default.useEffect(()=>{n.delete&&(xe(),n.onDismiss==null||n.onDismiss.call(n,n))},[xe,n.delete]);function Se(){return T?.loading?l.default.createElement(`div`,{className:av(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ae===`loading`},T.loading):l.default.createElement(F_,{className:av(w?.loader,n?.classNames?.loader),visible:ae===`loading`})}let Ce=n.icon||T?.[ae]||N_(ae);return l.default.createElement(`li`,{tabIndex:0,ref:ne,className:av(v,G,w?.toast,n?.classNames?.toast,w?.default,w?.[ae],n?.classNames?.[ae]),"data-sonner-toast":``,"data-rich-colors":n.richColors??p,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":z,"data-removed":N,"data-visible":ie,"data-y-position":he,"data-x-position":ge,"data-index":c,"data-front":re,"data-swiping":F,"data-dismissible":oe,"data-type":ae,"data-invert":ye,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(d||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":u.length-c,"--offset":`${N?V:fe.current}px`,"--initial-height":C?`auto`:`${ee}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),me.current=null},onPointerDown:e=>{e.button!==2&&(be||!oe||(W.current=new Date,H(fe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),me.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!oe)return;me.current=null;let e=Number(ne.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ne.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-W.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=rv||a>.11){H(fe.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),xe(),R(!0);return}else{var o,s;(o=ne.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ne.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}B(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!me.current||!oe||window.getSelection()?.toString().length>0)return;let i=t.clientY-me.current.y,a=t.clientX-me.current.x,o=e.swipeDirections??ov(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&B(!0),(n=ne.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ne.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},le&&!n.jsx&&ae!==`loading`?l.default.createElement(`button`,{"aria-label":E,"data-disabled":be,"data-close-button":!0,onClick:be||!oe?()=>{}:()=>{xe(),n.onDismiss==null||n.onDismiss.call(n,n)},className:av(w?.closeButton,n?.classNames?.closeButton)},T?.close??B_):null,(ae||n.icon||n.promise)&&n.icon!==null&&(T?.[ae]!==null||n.icon)?l.default.createElement(`div`,{"data-icon":``,className:av(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Se():null,n.type===`loading`?null:Ce):null,l.default.createElement(`div`,{"data-content":``,className:av(w?.content,n?.classNames?.content)},l.default.createElement(`div`,{"data-title":``,className:av(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?l.default.createElement(`div`,{"data-description":``,className:av(y,se,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),l.default.isValidElement(n.cancel)?n.cancel:n.cancel&&X_(n.cancel)?l.default.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{X_(n.cancel)&&oe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),xe())},className:av(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,l.default.isValidElement(n.action)?n.action:n.action&&X_(n.action)?l.default.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{X_(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&xe())},className:av(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function cv(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function lv(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?$_:Q_;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var uv=l.default.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:d,mobileOffset:f,theme:p=`light`,richColors:m,duration:h,style:g,visibleToasts:_=Z_,toastOptions:v,dir:y=cv(),gap:b=nv,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=l.default.useState([]),T=l.default.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=l.default.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=l.default.useState([]),[k,A]=l.default.useState(!1),[j,M]=l.default.useState(!1),[N,P]=l.default.useState(p===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p),F=l.default.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=l.default.useRef(null),R=l.default.useRef(!1),z=l.default.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||W_.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return l.default.useEffect(()=>W_.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{u.default.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),l.default.useEffect(()=>{if(p!==`system`){P(p);return}if(p===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[p]),l.default.useEffect(()=>{C.length<=1&&A(!1)},[C]),l.default.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),l.default.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),l.default.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?l.default.createElement(`ol`,{key:t,dir:y===`auto`?cv():y,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${tv}px`,"--gap":`${b}px`,...g,...lv(d,f)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>l.default.createElement(sv,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:m,duration:v?.duration??h,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:_,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:z,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),dv=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),fv=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),pv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),mv=e=>{let t=pv(e);return t.charAt(0).toUpperCase()+t.slice(1)},hv={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},gv=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},_v=(0,l.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,l.createElement)(`svg`,{ref:c,...hv,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:dv(`lucide`,i),...!a&&!gv(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,l.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Q=(e,t)=>{let n=(0,l.forwardRef)(({className:n,...r},i)=>(0,l.createElement)(_v,{ref:i,iconNode:t,className:dv(`lucide-${fv(mv(e))}`,`lucide-${e}`,n),...r}));return n.displayName=mv(e),n},vv=[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]],yv=Q(`book-open`,vv),bv=[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]],xv=Q(`check`,bv),Sv=[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]],Cv=Q(`chevron-down`,Sv),wv=[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]],Tv=Q(`chevron-left`,wv),Ev=[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]],Dv=Q(`chevron-right`,Ev),Ov=[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]],kv=Q(`chevrons-up-down`,Ov),Av=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],jv=Q(`circle-alert`,Av),Mv=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]],Nv=Q(`circle-check`,Mv),Pv=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]],Fv=Q(`circle-ellipsis`,Pv),Iv=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],Lv=Q(`circle-question-mark`,Iv),Rv=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]],zv=Q(`clipboard-copy`,Rv),Bv=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M9 14h6`,key:`159ibu`}],[`path`,{d:`M12 17v-6`,key:`1y8rbf`}]],Vv=Q(`clipboard-plus`,Bv),Hv=[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]],Uv=Q(`clipboard`,Hv),Wv=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]],Gv=Q(`copy`,Wv),Kv=[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]],qv=Q(`corner-down-left`,Kv),Jv=[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],Yv=Q(`ellipsis`,Jv),Xv=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]],Zv=Q(`eye`,Xv),Qv=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]],$v=Q(`file-text`,Qv),ey=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]],ty=Q(`file-up`,ey),ny=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]],ry=Q(`folder-open`,ny),iy=[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]],ay=Q(`folder-tree`,iy),oy=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]],sy=Q(`folder`,oy),cy=[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],ly=Q(`funnel`,cy),uy=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]],dy=Q(`git-branch`,uy),fy=[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]],py=Q(`grip-vertical`,fy),my=[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]],hy=Q(`hash`,my),gy=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],_y=Q(`history`,gy),vy=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]],yy=Q(`info`,vy),by=[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]],xy=Q(`languages`,by),Sy=[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]],Cy=Q(`list`,Sy),wy=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],Ty=Q(`loader-circle`,wy),Ey=[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]],Dy=Q(`menu`,Ey),Oy=[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],ky=Q(`octagon-x`,Oy),Ay=[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]],jy=Q(`palette`,Ay),My=[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],Ny=Q(`pen-line`,My),Py=[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]],Fy=Q(`pencil`,Py),Iy=[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]],Ly=Q(`plus`,Iy),Ry=[[`path`,{d:`M21 7v6h-6`,key:`3ptur4`}],[`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`,key:`1kgawr`}]],zy=Q(`redo`,Ry),By=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]],Vy=Q(`refresh-cw`,By),Hy=[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]],Uy=Q(`search`,Hy),Wy=[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],Gy=Q(`sparkles`,Wy),Ky=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]],qy=Q(`square-check`,Ky),Jy=[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]],Yy=Q(`square-play`,Jy),Xy=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],Zy=Q(`square-plus`,Xy),Qy=[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]],$y=Q(`tag`,Qy),eb=[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],tb=Q(`trash-2`,eb),nb=[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],rb=Q(`triangle-alert`,nb),ib=[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]],ab=Q(`type`,ib),ob=[[`path`,{d:`M3 7v6h6`,key:`1v2h90`}],[`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`,key:`1r6uu6`}]],sb=Q(`undo`,ob),cb=[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]],lb=Q(`x`,cb),ub=({...e})=>{let{theme:t=`system`}=w_();return(0,d.jsx)(uv,{theme:t,className:`toaster group`,icons:{success:(0,d.jsx)(Nv,{className:`size-4`}),info:(0,d.jsx)(yy,{className:`size-4`}),warning:(0,d.jsx)(rb,{className:`size-4`}),error:(0,d.jsx)(ky,{className:`size-4`}),loading:(0,d.jsx)(Ty,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},toastOptions:{classNames:{toast:`cn-toast`}},...e})};function db({delayDuration:e=0,...t}){return(0,d.jsx)(Vf,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function fb({...e}){return(0,d.jsx)(Hf,{"data-slot":`tooltip`,...e})}function pb({...e}){return(0,d.jsx)(Uf,{"data-slot":`tooltip-trigger`,...e})}function mb({className:e,sideOffset:t=0,children:n,...r}){return(0,d.jsx)(Wf,{children:(0,d.jsxs)(Gf,{"data-slot":`tooltip-content`,sideOffset:t,className:Y(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,d.jsx)(Kf,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var hb=(0,l.createContext)(void 0);const gb=({children:e,helpLink:t,aiProvider:n=null,fallbackLocale:r=`en`})=>{let i={helpLink:t,aiProvider:n,fallbackLocale:r.trim()||`en`};return(0,d.jsx)(hb.Provider,{value:i,children:(0,d.jsxs)(db,{children:[(0,d.jsx)(l_,{children:(0,d.jsx)(g_,{children:e})}),(0,d.jsx)(ub,{})]})})},_b=()=>{let e=(0,l.useContext)(hb);if(e===void 0)throw Error(`useSurveyEditorConfig must be used within a SurveyEditorConfigProvider`);return e},vb=()=>_b().aiProvider;function yb({...e}){return(0,d.jsx)(Gu,{"data-slot":`popover`,...e})}function bb({...e}){return(0,d.jsx)(qu,{"data-slot":`popover-trigger`,...e})}function xb({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,d.jsx)(Ju,{children:(0,d.jsx)(Yu,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Y(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function Sb({...e}){return(0,d.jsx)(Ku,{"data-slot":`popover-anchor`,...e})}function Cb({className:e,children:t,...n}){return(0,d.jsxs)(Md,{"data-slot":`scroll-area`,className:Y(`relative`,e),...n,children:[(0,d.jsx)(Nd,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,d.jsx)(wb,{}),(0,d.jsx)(Pd,{})]})}function wb({className:e,orientation:t=`vertical`,...n}){return(0,d.jsx)(od,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:Y(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,d.jsx)(_d,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var Tb=()=>{let[e,t]=(0,l.useState)(!1),n=X(e=>e.getUndoRedoHistory),r=X(e=>e.jumpToIndexInHistory),i=n(),a=i.at(i.length-1);return(0,d.jsxs)(yb,{open:e,onOpenChange:t,children:[(0,d.jsx)(bb,{asChild:!0,children:(0,d.jsxs)(vm,{variant:`ghost`,className:`h-(--footer-height) rounded-none -ml-3 gap-2`,children:[(0,d.jsxs)(`span`,{className:`space-x-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-light`,children:`Last modified:`}),(0,d.jsx)(`span`,{className:`text-xs font-medium`,children:bg(new Date(a?.timestamp??0),{addSuffix:!0})})]}),(0,d.jsx)(_y,{className:`size-3.5`})]})}),(0,d.jsxs)(xb,{className:`min-w-96 p-0 gap-0 border-border`,align:`start`,side:`top`,children:[(0,d.jsxs)(`div`,{className:`p-3 border-b border-border shadow-xs drop-shadow-xs bg-muted/50`,children:[(0,d.jsx)(`h4`,{className:`font-medium text-sm`,children:`Recent changes`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click a state to jump to roll back to that point`})]}),(0,d.jsx)(Cb,{className:`h-64`,children:(0,d.jsx)(`ol`,{className:`divide-y divide-border pt-1`,children:i.toSorted((e,t)=>t.timestamp-e.timestamp).map(e=>(0,d.jsx)(`li`,{children:(0,d.jsxs)(`button`,{disabled:e.isCurrent,className:Y(`text-sm px-3 py-1 flex items-center justify-between w-full`,`hover:bg-accent transition-colors focus:bg-accent focus:outline-none`,e.isCurrent&&`bg-primary text-primary-foreground hover:bg-primary focus:bg-primary`),onClick:()=>r(e.index),children:[(0,d.jsxs)(fb,{children:[(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsx)(`p`,{className:`truncate text-xs font-medium`,children:e.meta.label})}),(0,d.jsx)(mb,{children:e.meta.label})]}),(0,d.jsx)(`p`,{className:Y(`text-xs text-muted-foreground`,e.isCurrent&&`text-primary-foreground/80`),children:bg(new Date(e.timestamp),{addSuffix:!0})})]})},e.index))})})]})]})},Eb=Tb,Db=()=>{let{helpLink:e}=_b();return(0,d.jsx)(`footer`,{className:`h-(--footer-height) bg-(--footer-bg-color) text-(--footer-text-color)`,children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between h-full text-sm ps-4 pe-4`,children:[(0,d.jsx)(`div`,{className:`flex items-center h-full`,children:(0,d.jsx)(Eb,{})}),(0,d.jsx)(`div`,{className:``,children:(0,d.jsx)(vm,{variant:`ghost`,className:Y(`h-(--footer-height) rounded-none p-0 gap-2`),asChild:!0,children:(0,d.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,d.jsx)(Lv,{className:`size-3`}),(0,d.jsx)(`span`,{className:`text-xs`,children:`Help`})]})})})]})})},Ob=Db;function kb({...e}){return(0,d.jsx)(tu,{"data-slot":`dropdown-menu`,...e})}function Ab({...e}){return(0,d.jsx)(ru,{"data-slot":`dropdown-menu-portal`,...e})}function jb({...e}){return(0,d.jsx)(nu,{"data-slot":`dropdown-menu-trigger`,...e})}function Mb({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,d.jsx)(ru,{children:(0,d.jsx)(iu,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:Y(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function Nb({...e}){return(0,d.jsx)(au,{"data-slot":`dropdown-menu-group`,...e})}function Pb({className:e,inset:t,variant:n=`default`,...r}){return(0,d.jsx)(su,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Y(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Fb({...e}){return(0,d.jsx)(cu,{"data-slot":`dropdown-menu-radio-group`,...e})}function Ib({className:e,children:t,inset:n,...r}){return(0,d.jsxs)(lu,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:Y(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,d.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,d.jsx)(uu,{children:(0,d.jsx)(xv,{})})}),t]})}function Lb({className:e,inset:t,...n}){return(0,d.jsx)(ou,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Y(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Rb({className:e,...t}){return(0,d.jsx)(du,{"data-slot":`dropdown-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border`,e),...t})}function zb({className:e,...t}){return(0,d.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:Y(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground`,e),...t})}function Bb({...e}){return(0,d.jsx)(fu,{"data-slot":`dropdown-menu-sub`,...e})}function Vb({className:e,inset:t,children:n,...r}){return(0,d.jsxs)(pu,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:Y(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,d.jsx)(Dv,{className:`ml-auto`})]})}function Hb({className:e,...t}){return(0,d.jsx)(mu,{"data-slot":`dropdown-menu-sub-content`,className:Y(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}function Ub({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,d.jsx)(Bd,{"data-slot":`separator`,decorative:n,orientation:t,className:Y(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function Wb(){return Sm((e,t)=>({location:{view:`item-editor`},history:[],adapter:null,setAdapter:n=>{let r=t();r._adapterUnsubscribe&&r._adapterUnsubscribe(),e({adapter:n}),e({location:n.getLocation()}),e({_adapterUnsubscribe:n.subscribe(t=>{e({location:t})})})},clearAdapter:()=>{let n=t();n._adapterUnsubscribe&&n._adapterUnsubscribe(),e({adapter:null,_adapterUnsubscribe:void 0})},navigate:(n,r=!1)=>{let{adapter:i,history:a}=t();if(i){i.navigateTo(n,{replace:r});return}e({location:n,history:r?a:[...a,n]})}}))}var Gb=(0,l.createContext)(null);const Kb=({children:e,adapter:t})=>{let[n]=(0,l.useState)(()=>Wb());return(0,l.useEffect)(()=>(t?n.getState().setAdapter(t):n.getState().clearAdapter(),()=>{n.getState().clearAdapter()}),[n,t]),(0,d.jsx)(Gb.Provider,{value:n,children:e})};function qb(e){let t=(0,l.useContext)(Gb);if(!t)throw Error(`useSurveyEditorNavigationStore must be used within a SurveyEditorNavigationStoreProvider`);return wm(t,e)}var Jb=({icon:e,location:t,label:n,isActive:r})=>{let i=qb(e=>e.navigate);return(0,d.jsx)(`li`,{children:(0,d.jsxs)(fb,{delayDuration:0,children:[(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>i(t),className:`rounded-md h-full block w-full`,children:(0,d.jsx)(`div`,{className:Y(`size-9`,`inline-flex rounded-md items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,`hover:bg-gray-200`,r&&`bg-gray-200 hover:bg-gray-200`),children:e})})}),(0,d.jsx)(mb,{side:`right`,align:`center`,children:(0,d.jsx)(`p`,{children:n})})]})})},Yb=({onSave:e,onUndo:t,onRedo:n})=>{let r=X(e=>e.editor);return(0,d.jsx)(`li`,{className:`space-y-1.5`,children:(0,d.jsxs)(kb,{children:[(0,d.jsxs)(fb,{delayDuration:0,children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsx)(vm,{variant:`ghost`,size:`icon-lg`,children:(0,d.jsx)(Dy,{className:`size-4 text-gray-600`})})})}),(0,d.jsx)(mb,{side:`right`,align:`center`,children:(0,d.jsx)(`p`,{children:`Menu`})})]}),(0,d.jsxs)(Mb,{className:`w-56 border-border`,align:`start`,side:`right`,sideOffset:10,children:[(0,d.jsx)(Lb,{className:`text-xs font-bold`,children:`File`}),(0,d.jsxs)(Nb,{children:[(0,d.jsxs)(Bb,{children:[(0,d.jsx)(Vb,{children:`Legacy survey`}),(0,d.jsx)(Ab,{children:(0,d.jsxs)(Hb,{className:`border-border`,children:[(0,d.jsx)(Pb,{children:`Import from JSON`}),(0,d.jsx)(Pb,{children:`Export as legacy survey`})]})})]}),(0,d.jsxs)(Pb,{onClick:e,children:[`Save to disk`,(0,d.jsx)(zb,{children:`⌘S`})]})]}),(0,d.jsx)(Rb,{}),(0,d.jsxs)(Nb,{children:[(0,d.jsx)(Lb,{className:`text-xs font-bold`,children:`Edit`}),(0,d.jsxs)(Pb,{onClick:t,disabled:!r?.canUndo(),children:[(0,d.jsx)(sb,{className:`size-4`}),`Undo`,(0,d.jsx)(zb,{children:`⌘Z`})]}),(0,d.jsxs)(Pb,{onClick:n,disabled:!r?.canRedo(),children:[(0,d.jsx)(zy,{className:`size-4`}),`Redo`,(0,d.jsx)(zb,{children:`⇧⌘Z`})]})]}),(0,d.jsx)(Rb,{}),(0,d.jsx)(Pb,{children:`Exit`})]})]})})},Xb=({onSave:e,onUndo:t,onRedo:n})=>{let r=qb(e=>e.location);return(0,d.jsx)(`div`,{className:`flex flex-col border-r border-border bg-white p-1`,children:(0,d.jsxs)(`ul`,{className:`space-y-1.5`,children:[(0,d.jsx)(Yb,{onSave:e,onUndo:t,onRedo:n}),(0,d.jsx)(Ub,{className:`my-1`}),(0,d.jsx)(Jb,{location:{view:`item-editor`},icon:(0,d.jsx)(Fy,{className:`size-4 text-gray-600`}),label:`Edit survey`,isActive:r.view===`item-editor`}),(0,d.jsx)(Jb,{location:{view:`translation-mode`},icon:(0,d.jsx)(xy,{className:`size-4 text-gray-600`}),label:`Translation mode`,isActive:r.view===`translation-mode`}),(0,d.jsx)(Jb,{location:{view:`simulator`},icon:(0,d.jsx)(Yy,{className:`size-4 text-gray-600`}),label:`Simulator`,isActive:r.view===`simulator`})]})})},Zb=Xb;function Qb(){return X(e=>e.editor)}function $b(){let e=X(e=>e.editor);return(0,l.useMemo)(()=>e?.survey??null,[e,X(e=>e.changeTick)])}const ex=()=>{let e=qb(e=>e.location),t=qb(e=>e.navigate),n=Qb(),r=X(e=>e.changeTick),i=e.view===`item-editor`?e.itemId:void 0,a=(0,l.useEffectEvent)((e,n)=>{t(e,n)});return(0,l.useEffect)(()=>{n&&i&&!n.survey.surveyItems.get(i)&&a({view:`item-editor`},!0)},[n,r,i]),{selectedItemId:i,navigateToItem:e=>{e!==i&&t(e?{view:`item-editor`,itemId:e}:{view:`item-editor`})}}};function tx({className:e,size:t=`default`,...n}){return(0,d.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:Y(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function nx({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`card-content`,className:Y(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}var rx=()=>(0,d.jsxs)(`div`,{className:`w-full flex flex-col md:flex-row gap-4 items-start relative`,children:[(0,d.jsxs)(`div`,{className:`w-full md:w-auto flex-1 order-2 md:order-1 bg-background rounded-xl border border-border`,children:[(0,d.jsx)(`div`,{className:`py-2 border-b border-border h-[37px] flex items-center`,children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between relative w-full`,children:[(0,d.jsxs)(`div`,{className:`absolute px-4 rounded-s-lg left-0 top-0 bottom-0 flex items-center gap-2 justify-center bg-white`,children:[(0,d.jsx)(ym,{className:`size-5 rounded-full`}),(0,d.jsx)(ym,{className:`h-6 w-16 rounded-lg`})]}),(0,d.jsx)(`div`,{className:`text-center grow px-20`,children:(0,d.jsx)(ym,{className:`h-4 w-32 mx-auto`})})]})}),(0,d.jsx)(nx,{className:`p-0 m-0`,children:(0,d.jsx)(`div`,{className:`w-full`,children:(0,d.jsxs)(`div`,{className:`min-h-[400px] p-6 space-y-6`,children:[(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(ym,{className:`h-6 w-48`}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(ym,{className:`h-4 w-full`}),(0,d.jsx)(ym,{className:`h-4 w-3/4`}),(0,d.jsx)(ym,{className:`h-4 w-1/2`})]})]}),(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(ym,{className:`h-6 w-36`}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,d.jsx)(ym,{className:`h-20 w-full rounded-lg`}),(0,d.jsx)(ym,{className:`h-20 w-full rounded-lg`})]})]}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(ym,{className:`h-6 w-24`}),(0,d.jsx)(ym,{className:`h-32 w-full rounded-lg`})]})]})})})]}),(0,d.jsx)(`div`,{className:`relative md:sticky top-0 order-1 md:order-2 w-full md:w-fit flex justify-end`,children:(0,d.jsx)(tx,{className:`shadow-none w-fit border-border p-0`,children:(0,d.jsxs)(nx,{className:`p-0 flex flex-row md:flex-col`,children:[(0,d.jsx)(`div`,{className:`border-r border-border md:border-b md:border-r-0`,children:(0,d.jsx)(ym,{className:`size-9 rounded-s-xl md:rounded-s-none md:rounded-t-xl`})}),(0,d.jsx)(`div`,{className:`flex flex-row md:flex-col`,children:Array.from({length:6}).map((e,t)=>(0,d.jsx)(ym,{className:Y(`size-9`,t===5?`rounded-e-xl md:rounded-e-none md:rounded-b-xl`:`rounded-none`)},t))})]})})})]}),ix=rx;const ax=`en`;function ox(e,t=`en`){return e[t]??e.en??Object.values(e)[0]??``}const sx={Content:`content`,Label:`label`,Key:`key`,ItemType:`itemType`},cx=e=>{let t=e.survey.surveyItems.get(e.itemId);if(!t||t.type===Ym.PageBreak)return;let n=t.metadata?.itemLabel??``,r=e.searchTerm.toLowerCase(),i=[],a=e.survey.getItemKey(t.id);return t.type.toLowerCase().includes(r)&&i.push({matchType:sx.ItemType,matchText:t.type}),n.toLowerCase().includes(r)&&i.push({matchType:sx.Label,matchText:n}),a?.fullKey.toLowerCase().includes(r)&&i.push({matchType:sx.Key,matchText:a.fullKey}),i};var lx=[Ym.Group,Ym.PageBreak];function ux(e){return e.map(e=>{let t=e.itemType?` [${e.itemType}]`:``;return`${e.code}${t}: ${e.message}`}).join(`
|
|
52
|
-
`)}function dx(e){if(e.errors.length!==0)throw Error(`Invalid item registry entries:\n${ux(e.errors)}`)}function fx(e,t){let n=[],r=[],i=t.requireBuiltInTypes??!0,a=t.requireRenderer??!1,o=new Set;for(let i of e){if(o.has(i.itemType)){n.push({code:`duplicate-item-type`,itemType:i.itemType,message:`Duplicate item registry entry for type: ${i.itemType}`});continue}o.add(i.itemType),!i.constructor&&i.itemType!==`root`&&!lx.includes(i.itemType)&&r.push({code:`missing-constructor`,itemType:i.itemType,message:`Entry has no constructor. This item type will not be deserializable from survey JSON.`}),t.mode===`editor`&&!i.infos&&n.push({code:`missing-editor-infos`,itemType:i.itemType,message:`ItemRegistryEntry "${i.itemType}" must have infos when used in editor.`}),t.mode===`player`&&a&&!i.renderComponent&&n.push({code:`missing-renderer`,itemType:i.itemType,message:`Entry is missing renderComponent while requireRenderer=true.`})}if(t.mode===`editor`&&i)for(let e of lx)o.has(e)||n.push({code:`missing-built-in-type`,itemType:e,message:`Missing registry entry for built-in type: ${e}`});return{errors:n,warnings:r}}function px(e){dx(fx(e,{mode:`player`,requireBuiltInTypes:!1}));let t={};for(let n of e)n.constructor&&(t[n.itemType]=n.constructor);return ih(t)}function mx(e,t={}){dx(fx(e,{mode:`player`,requireRenderer:t.requireRenderer??!1,requireBuiltInTypes:!1}));let n=px(e),r=new Map;for(let t of e)t.renderComponent&&r.set(t.itemType,t.renderComponent);return{coreRegistry:n,getRenderer:e=>r.get(e)}}function hx(e){if(!e.infos)throw Error(`ItemRegistryEntry "${e.itemType}" must have infos when used in editor.`);let t=e.includeDefaultSearchAdapter??!0,n=e.searchAdapters?[...e.searchAdapters]:[];return t&&n.push(cx),{itemType:e.itemType,infos:e.infos,editorComponent:e.editorComponent,renderComponent:e.renderComponent,previewComponent:e.previewComponent,capabilities:e.capabilities,isRootOnly:e.isRootOnly,getInitialItem:e.getInitialItem,createItem:e.createItem,searchAdapters:n,includeDefaultSearchAdapter:t}}function gx(e,t={}){dx(fx(e,{mode:`editor`,requireBuiltInTypes:t.requireBuiltInTypes??!0}));let n=px(e),r={};for(let t of e){if(r[t.itemType])throw Error(`Duplicate item registry entry for type: ${t.itemType}`);r[t.itemType]={...hx(t)}}if(t.requireBuiltInTypes??!0){for(let e of lx)if(!r[e])throw Error(`Missing registry entry for built-in type: ${e}`)}return{coreRegistry:n,definitions:r}}function _x(e,t){return t instanceof $m&&t.isRoot()?e.definitions.root:e.definitions[t.type]}var vx=()=>{let{selectedItemId:e}=ex(),t=X(e=>e.getRootItem),n=X(e=>e.editorItemRegistry),r=t(),i=e||r?.id,a=Qb();if(!a||!i)return(0,d.jsx)(ix,{});let o=a.survey.surveyItems.get(i);if(!o)return(0,d.jsx)(ix,{});let s=_x(n,o);if(s?.editorComponent){let e=s.editorComponent;return(0,d.jsx)(e,{item:o})}return(0,d.jsxs)(`div`,{children:[`Editor for `,o.type,` is not implemented yet.`]})},yx=vx;function bx({...e}){return(0,d.jsx)(Kn,{"data-slot":`dialog`,...e})}function xx({...e}){return(0,d.jsx)(Jn,{"data-slot":`dialog-portal`,...e})}function Sx({className:e,...t}){return(0,d.jsx)(Yn,{"data-slot":`dialog-overlay`,className:Y(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,e),...t})}function Cx({className:e,children:t,showCloseButton:n=!0,closeLabel:r=`Close`,...i}){return(0,d.jsxs)(xx,{children:[(0,d.jsx)(Sx,{}),(0,d.jsxs)(Xn,{"data-slot":`dialog-content`,className:Y(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,e),...i,children:[t,n&&(0,d.jsx)($n,{"data-slot":`dialog-close`,asChild:!0,children:(0,d.jsxs)(vm,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,"aria-label":r,children:[(0,d.jsx)(lb,{}),(0,d.jsx)(`span`,{className:`sr-only`,children:r})]})})]})]})}function wx({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`gap-2 flex flex-col`,e),...t})}function Tx({className:e,showCloseButton:t=!1,closeLabel:n=`Close`,children:r,...i}){return(0,d.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...i,children:[r,t&&(0,d.jsx)($n,{asChild:!0,children:(0,d.jsx)(vm,{variant:`outline`,children:n})})]})}function Ex({className:e,...t}){return(0,d.jsx)(Zn,{"data-slot":`dialog-title`,className:Y(`text-base leading-none font-medium`,e),...t})}function Dx({className:e,...t}){return(0,d.jsx)(Qn,{"data-slot":`dialog-description`,className:Y(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,e),...t})}var Ox=`survey-editor:clipboard-value-updated`;const kx=()=>{typeof window>`u`||window.dispatchEvent(new Event(Ox))},Ax=()=>{let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(null),i=(0,l.useEffectEvent)(async()=>{try{t(await navigator.clipboard.readText())}catch{t(null)}r(new Date)});return(0,l.useEffect)(()=>{if(i(),typeof window>`u`)return;let e=()=>{i()};return window.addEventListener(Ox,e),()=>{window.removeEventListener(Ox,e)}},[]),[e,(0,l.useCallback)(()=>{kx()},[]),n]};var jx=(0,l.createContext)(void 0);const Mx=({children:e})=>{let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(void 0),[a,o]=(0,l.useState)(null),s={addItemDialogOpen:t,setAddItemDialogOpen:n,openAddItemDialog:e=>{i(e),n(!0)},closeAddItemDialog:()=>n(!1),targetParentId:r,preferredPreviewItemId:a,setPreferredPreviewItemId:o};return(0,d.jsx)(jx.Provider,{value:s,children:e})},Nx=()=>{let e=(0,l.useContext)(jx);if(e===void 0)throw Error(`useItemEditor must be used within an ItemEditorProvider`);return e},Px=`case.survey-editor.last-used-item-type`,Fx=[`display`,`singleChoiceQuestion`],Ix=new Set([Ym.Group,Ym.PageBreak]),Lx={entry:`Use arrow keys to select or Esc to cancel.`,structure:`Use arrow keys to select or Esc to cancel.`,"blank-item":`Search or type to filter. Use arrow keys to select or Esc to cancel.`,ai:`Describe the item structure you want and let AI propose the first draft.`,catalogue:`TODO: Add catalogue footer hint.`};var Rx=e=>e.trim().toUpperCase().replace(/[.\s]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``);function zx(e,t,n,r){let i=n.coreRegistry[e.rawItem.itemType];if(!i)throw Error(`Item type "${e.rawItem.itemType}" is not available in this editor registry.`);let a=new i(e.rawItem);if(r({parentId:t},a,e.translations),e.children?.length){if(!(a instanceof $m))throw Error(`Item type "${a.type}" cannot include child items in getInitialItem().`);e.children.forEach(e=>{zx(e,a.id,n,r)})}return a}function Bx({editorItemRegistry:e,addItem:t,pasteItem:n,commitByUser:r,setPreferredPreviewItemId:i,closeDialog:a,targetGroupId:o,rootItemId:s,clipboardValue:c,setLastUsedItemType:u}){return{handleSelectOption:(0,l.useCallback)(n=>{if(!o){Z.error(`No valid group selected.`);return}let s=e.definitions[n.itemType],c=e.coreRegistry[n.itemType];if(!s||!c){Z.error(`Item type "${n.itemType}" is not available in this editor registry.`);return}try{let l,d;if(s.createItem)l=s.createItem({editor:{addItem:(e,n,r)=>t(e,n,r)},targetParentId:o,constructor:c});else{let r=s.getInitialItem?.();if(r){let n=zx(r,o,e,t);l=n.id,d=n.key}else{let e=new c({id:Om(),key:Am(3),itemType:n.itemType});l=e.id,d=e.key,t({parentId:o},e)}}r({label:`Add item: ${n.label}`}),typeof window<`u`&&localStorage.setItem(`case.survey-editor.last-used-item-type`,n.itemType),u(n.itemType),Z.success(`Item added: ${d??l}`),i(l),a()}catch(e){console.error(`Failed to add item:`,e),Z.error(`Failed to add item. Please try again.`)}},[t,a,r,e,u,i,o]),pasteFromClipboard:(0,l.useCallback)(()=>{if(!c)return;let e;try{e=JSON.parse(c)}catch{return}if(!Gg.isValidClipboardData(e))return;let t=o??s;if(!t)return;let l=n(e,{parentId:t});r({label:`Paste item`}),i(l),a()},[c,a,r,n,s,i,o]),createItemsFromIntent:(0,l.useCallback)(n=>{if(!o){Z.error(`No valid target group selected.`);return}if(n.length===0){Z.info(`AI did not return any items to create.`);return}let s=new Map,c=0,l=new Set,u;try{let d=[...n],f=!0;for(;d.length>0&&f;){f=!1;for(let n=d.length-1;n>=0;--n){let r=d[n],i=e.coreRegistry[r.itemType];if(!i){l.add(r.itemType),d.splice(n,1);continue}let a=r.parentTempId?s.get(r.parentTempId):o;if(!a)continue;let p=Rx(r.key||``),m=new i({id:Om(),key:p.length>0?p:Am(3),itemType:r.itemType,metadata:r.itemLabel?{itemLabel:r.itemLabel}:void 0});t({parentId:a},m),s.set(r.tempId,m.id),c+=1,u??=m.id,d.splice(n,1),f=!0}}if(c===0){Z.error(`No valid items were created from AI response.`);return}d.length>0&&Z.warning(`Created ${c} item(s). Skipped ${d.length} item(s) due to unresolved parent references.`),r({label:c===1?`Add item from AI intent`:`Add ${c} items from AI intent`}),i(u??o??null),a(),l.size>0?Z.warning(`Created ${c} item(s). Skipped unsupported types: ${Array.from(l).join(`, `)}`):Z.success(`Created ${c} item(s) from AI intent.`)}catch(e){console.error(`Failed to create items from AI intent:`,e),Z.error(`Failed to create items from AI response.`)}},[t,a,r,e.coreRegistry,i,o])}}var Vx=(e,t)=>({id:t.id,itemKey:t.isRoot()?e.survey.surveyKey:t.key,itemLabel:t.metadata?.itemLabel,isRoot:t.isRoot(),itemCount:t.items?.length??0});function Hx({editor:e,selectedItemId:t,targetParentId:n}){return(0,l.useMemo)(()=>{if(!e)return null;let r=t=>{let n=e.survey.surveyItems.get(t);return n instanceof $m?n:null};if(n){let t=r(n);return t?Vx(e,t):null}if(!t){let t=e.survey.rootItem;return t?Vx(e,t):null}let i=e.survey.surveyItems.get(t);if(!i)return null;if(i instanceof $m&&(i.isRoot()||i.type===Ym.Group))return Vx(e,i);let a=e.survey.getParentItem(i.id);return a instanceof $m?Vx(e,a):null},[e,t,n])}function Ux({options:e,onSelect:t,rowSize:n=1}){let r=(0,l.useRef)(null),[i,a]=(0,l.useState)(0),[o,s]=(0,l.useState)(!1);return{groupRef:r,activeIndex:i,isFocused:o,setActiveIndex:a,focusGroup:(0,l.useCallback)(()=>{requestAnimationFrame(()=>{r.current?.focus(),s(!0)})},[]),reset:(0,l.useCallback)((e=0)=>{a(e),s(!1)},[]),handleGroupFocus:(0,l.useCallback)(()=>{s(!0)},[]),handleGroupBlur:(0,l.useCallback)(e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||s(!1)},[]),handleGroupKeyDown:(0,l.useCallback)(r=>{let o=e.length;if(o<1)return;let s=r.metaKey||r.ctrlKey||r.altKey||r.shiftKey;if(r.key===`Enter`&&s)return;if(r.key===`Enter`||r.key===` `){r.preventDefault();let n=e[i];n&&t(n);return}let c=i;switch(r.key){case`ArrowRight`:c=(i+1)%o;break;case`ArrowLeft`:c=(i-1+o)%o;break;case`ArrowDown`:c=(i+n)%o;break;case`ArrowUp`:c=(i-n+o)%o;break;default:return}r.preventDefault(),a(c)},[i,t,e,n])}}function Wx({onBack:e}){return(0,d.jsxs)(vm,{type:`button`,variant:`outline`,size:`sm`,onClick:e,children:[(0,d.jsx)(Tv,{className:`size-4`}),`Back`]})}function Gx({intent:e,onIntentChange:t,onGenerate:n,onBack:r,isGenerating:i,isEnabled:a}){return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,d.jsx)(Wx,{onBack:r})}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-3`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(f_,{htmlFor:`ai-item-intent`,children:`Describe what to create`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Example: "Create a page with one intro display and two single-choice questions about sleep habits."`})]}),(0,d.jsx)(`textarea`,{id:`ai-item-intent`,value:e,onChange:e=>t(e.target.value),placeholder:`Describe item intent...`,rows:5,className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/30`}),(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`AI can generate multiple items and nested groups.`}),(0,d.jsxs)(vm,{type:`button`,onClick:n,disabled:!a||i||e.trim().length<3,className:`gap-1.5`,children:[i?(0,d.jsx)(Ty,{className:`size-4 animate-spin`}):(0,d.jsx)(Gy,{className:`size-4`}),`Generate`]})]})]})]})}var Kx=1,qx=.9,Jx=.8,Yx=.17,Xx=.1,Zx=.999,Qx=.9999,$x=.99,eS=/[\\\/_+.#"@\[\(\{&]/,tS=/[\\\/_+.#"@\[\(\{&]/g,nS=/[\s-]/,rS=/[\s-]/g;function iS(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Kx:$x;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=iS(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Kx:eS.test(e.charAt(l-1))?(d*=Jx,p=e.slice(i,l-1).match(tS),p&&i>0&&(d*=Zx**+p.length)):nS.test(e.charAt(l-1))?(d*=qx,m=e.slice(i,l-1).match(rS),m&&i>0&&(d*=Zx**+m.length)):(d*=Yx,i>0&&(d*=Zx**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Qx)),(d<Xx&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=iS(e,t,n,r,l+1,a+2,o),f*Xx>d&&(d=f*Xx)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function aS(e){return e.toLowerCase().replace(rS,` `)}function oS(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,iS(e,t,aS(e),aS(t),0,0,{})}var sS=Symbol.for(`react.lazy`),cS=l.use;function lS(e){return typeof e==`object`&&!!e&&`then`in e}function uS(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===sS&&`_payload`in e&&lS(e._payload)}function dS(e){let t=fS(e),n=l.forwardRef((e,n)=>{let{children:r,...i}=e;uS(r)&&typeof cS==`function`&&(r=cS(r._payload));let a=l.Children.toArray(r),o=a.find(mS);if(o){let e=o.props.children,r=a.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return(0,d.jsx)(t,{...i,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,r):null})}return(0,d.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function fS(e){let t=l.forwardRef((e,t)=>{let{children:n,...r}=e;if(uS(n)&&typeof cS==`function`&&(n=cS(n._payload)),l.isValidElement(n)){let e=gS(n),i=hS(r,n.props);return n.type!==l.Fragment&&(i.ref=t?v(t,e):e),l.cloneElement(n,i)}return l.Children.count(n)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pS=Symbol(`radix.slottable`);function mS(e){return l.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===pS}function hS(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function gS(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _S=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=dS(`Primitive.${t}`),r=l.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,d.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),vS=`[cmdk-group=""]`,yS=`[cmdk-group-items=""]`,bS=`[cmdk-group-heading=""]`,xS=`[cmdk-item=""]`,SS=`${xS}:not([aria-disabled="true"])`,CS=`cmdk-item-select`,wS=`data-value`,TS=(e,t,n)=>oS(e,t,n),ES=l.createContext(void 0),DS=()=>l.useContext(ES),OS=l.createContext(void 0),kS=()=>l.useContext(OS),AS=l.createContext(void 0),jS=l.forwardRef((e,t)=>{let n=GS(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=GS(()=>new Set),i=GS(()=>new Map),a=GS(()=>new Map),o=GS(()=>new Set),s=US(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=G(),b=G(),x=G(),S=l.useRef(null),C=JS();WS(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,w.emit()}},[d]),WS(()=>{C(6,A)},[]);let w=l.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=l.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??TS;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(yS);t?t.appendChild(e.parentElement===t?e:e.closest(`${yS} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${yS} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${vS}[${wS}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(wS);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(vS)?.querySelector(bS))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${xS}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(SS)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(wS))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(wS))}function F(e){let t=j()?.closest(vS),n;for(;t&&!n;)t=e>0?VS(t,vS):HS(t,vS),n=t?.querySelector(SS);n?w.setState(`value`,n.getAttribute(wS)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return l.createElement(_S.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:_&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(CS);t.dispatchEvent(e)}}}}},l.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:ZS},c),XS(e,e=>l.createElement(OS.Provider,{value:w},l.createElement(ES.Provider,{value:T},e))))}),MS=l.forwardRef((e,t)=>{let n=G(),r=l.useRef(null),i=l.useContext(AS),a=DS(),o=US(e),s=o.current?.forceMount??i?.forceMount;WS(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=qS(n,r,[e.value,e.children,r],e.keywords),u=kS(),d=KS(e=>e.value&&e.value===c.current),f=KS(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);l.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(CS,p),()=>t.removeEventListener(CS,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){u.setState(`value`,c.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:y,keywords:b,...x}=e;return l.createElement(_S.div,{ref:v(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),NS=l.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=G(),s=l.useRef(null),c=l.useRef(null),u=G(),d=DS(),f=KS(e=>i||d.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);WS(()=>d.group(o),[]),qS(o,s,[e.value,e.heading,c]);let p=l.useMemo(()=>({id:o,forceMount:i}),[i]);return l.createElement(_S.div,{ref:v(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:f?void 0:!0},n&&l.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),XS(e,e=>l.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},l.createElement(AS.Provider,{value:p},e))))}),PS=l.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=l.useRef(null),a=KS(e=>!e.search);return!n&&!a?null:l.createElement(_S.div,{ref:v(i,t),...r,"cmdk-separator":``,role:`separator`})}),FS=l.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=kS(),o=KS(e=>e.search),s=KS(e=>e.selectedItemId),c=DS();return l.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),l.createElement(_S.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),IS=l.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=l.useRef(null),o=l.useRef(null),s=KS(e=>e.selectedItemId),c=DS();return l.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),l.createElement(_S.div,{ref:v(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},XS(e,e=>l.createElement(`div`,{ref:v(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),LS=l.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return l.createElement(Kn,{open:n,onOpenChange:r},l.createElement(Jn,{container:o},l.createElement(Yn,{"cmdk-overlay":``,className:i}),l.createElement(Xn,{"aria-label":e.label,"cmdk-dialog":``,className:a},l.createElement(jS,{ref:t,...s}))))}),RS=l.forwardRef((e,t)=>KS(e=>e.filtered.count===0)?l.createElement(_S.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),zS=l.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return l.createElement(_S.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},XS(e,e=>l.createElement(`div`,{"aria-hidden":!0},e)))}),BS=Object.assign(jS,{List:IS,Item:MS,Input:FS,Group:NS,Separator:PS,Dialog:LS,Empty:RS,Loading:zS});function VS(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function HS(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function US(e){let t=l.useRef(e);return WS(()=>{t.current=e}),t}var WS=typeof window>`u`?l.useEffect:l.useLayoutEffect;function GS(e){let t=l.useRef();return t.current===void 0&&(t.current=e()),t}function KS(e){let t=kS(),n=()=>e(t.snapshot());return l.useSyncExternalStore(t.subscribe,n,n)}function qS(e,t,n,r=[]){let i=l.useRef(),a=DS();return WS(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(wS,s),i.current=s}),i}var JS=()=>{let[e,t]=l.useState(),n=GS(()=>new Map);return WS(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function YS(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function XS({asChild:e,children:t},n){return e&&l.isValidElement(t)?l.cloneElement(YS(t),{ref:t.ref},n(t.props.children)):n(t)}var ZS={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function QS({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:Y(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var $S=g(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function eC({className:e,align:t=`inline-start`,...n}){return(0,d.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Y($S({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var tC=g(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function nC({className:e,...t}){return(0,d.jsx)(BS,{"data-slot":`command`,className:Y(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function rC({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,d.jsxs)(QS,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,d.jsx)(BS.Input,{"data-slot":`command-input`,className:Y(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,d.jsx)(eC,{children:(0,d.jsx)(Uy,{className:`size-4 shrink-0 opacity-50`})})]})})}function iC({className:e,...t}){return(0,d.jsx)(BS.List,{"data-slot":`command-list`,className:Y(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function aC({className:e,...t}){return(0,d.jsx)(BS.Empty,{"data-slot":`command-empty`,className:Y(`py-6 text-center text-sm`,e),...t})}function oC({className:e,...t}){return(0,d.jsx)(BS.Group,{"data-slot":`command-group`,className:Y(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function sC({className:e,children:t,...n}){return(0,d.jsxs)(BS.Item,{"data-slot":`command-item`,className:Y(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,d.jsx)(xv,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function cC({search:e,onSearchChange:t,hasValidClipboardItem:n,onPasteFromClipboard:r,groupedOptions:i,getCategoryLabel:a,onSelectOption:o,onBack:s}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{children:(0,d.jsx)(Wx,{onBack:s})}),(0,d.jsxs)(nC,{className:`border-none rounded-t-none`,shouldFilter:!1,children:[(0,d.jsx)(rC,{placeholder:`Search blank item types...`,value:e,onValueChange:t,className:`border-none rounded-none focus:ring-0`,autoFocus:!0}),(0,d.jsxs)(iC,{className:`max-h-96 border-border`,children:[(0,d.jsx)(aC,{children:`No item types found.`}),n&&(0,d.jsx)(oC,{heading:`Clipboard`,children:(0,d.jsxs)(sC,{value:`Paste from clipboard`,onSelect:r,className:`flex items-center gap-3 px-2 py-1.5 cursor-pointer border border-border mb-1`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center size-7`,children:(0,d.jsx)(Uv,{className:`w-4 h-4`})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`div`,{className:`font-medium`,children:`Paste from clipboard`}),(0,d.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Insert the item copied from the survey editor`})]})]})}),i.map(([e,t])=>(0,d.jsx)(oC,{heading:a(e),children:t.map(e=>{let t=e.icon;return(0,d.jsxs)(sC,{value:e.label,onSelect:()=>o(e),className:`flex items-center gap-3 px-2 py-1.5 cursor-pointer border border-border mb-1`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center size-7`,children:(0,d.jsx)(t,{className:Y(`w-4 h-4`,e.defaultItemClassName)})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,d.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.description})]})]},e.key)})},e))]})]})]})}function lC({options:e,optionGroupRef:t,activeIndex:n,isFocused:r,setActiveIndex:i,onGroupFocus:a,onGroupBlur:o,onGroupKeyDown:s,onSelectOption:c}){return(0,d.jsx)(`div`,{ref:t,role:`listbox`,"aria-label":`Add options`,"aria-activedescendant":`entry-option-${e[n]?.id}`,tabIndex:0,onFocus:a,onBlur:o,onKeyDown:s,className:`grid grid-cols-1 sm:grid-cols-2 gap-3 rounded-xl outline-none`,children:e.map((e,t)=>{let a=e.icon;return(0,d.jsxs)(`button`,{id:`entry-option-${e.id}`,type:`button`,onClick:()=>c(e),onMouseEnter:()=>i(t),tabIndex:-1,role:`option`,"aria-selected":t===n,"aria-disabled":!e.enabled||void 0,className:Y(`relative rounded-xl border border-border bg-background p-4 text-left transition-colors outline-none`,t===n&&r&&`border-ring ring-3 ring-ring/50 bg-accent/20`,e.enabled?`cursor-pointer`:`cursor-not-allowed opacity-80`),children:[!e.enabled&&(0,d.jsx)(`span`,{className:`absolute right-3 top-3 inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Coming soon`}),(0,d.jsx)(`span`,{className:`mb-3 inline-flex size-10 items-center justify-center rounded-lg bg-white text-muted-foreground shadow-xs`,children:(0,d.jsx)(a,{className:`size-5`})}),(0,d.jsx)(`div`,{className:`font-semibold text-base text-foreground`,children:e.title}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.description})]},e.id)})})}function uC({options:e,optionGroupRef:t,activeIndex:n,isFocused:r,setActiveIndex:i,onGroupFocus:a,onGroupBlur:o,onGroupKeyDown:s,onSelectOption:c,onBack:l}){return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,d.jsx)(Wx,{onBack:l})}),(0,d.jsx)(`div`,{ref:t,role:`listbox`,"aria-label":`Group and page break options`,"aria-activedescendant":e[n]?`structure-option-${e[n].itemType}`:void 0,tabIndex:0,onFocus:a,onBlur:o,onKeyDown:s,className:`space-y-2 outline-none`,children:e.map((e,t)=>{let a=e.icon;return(0,d.jsx)(`button`,{id:`structure-option-${e.itemType}`,type:`button`,tabIndex:-1,role:`option`,"aria-selected":t===n,onClick:()=>c(e),onMouseEnter:()=>i(t),className:Y(`w-full rounded-xl border border-border bg-background px-4 py-3 text-left transition-colors outline-none`,t===n&&r&&`border-ring ring-3 ring-ring/50 bg-accent/20`,`hover:bg-accent/40`),children:(0,d.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-md bg-white text-muted-foreground shadow-xs`,children:(0,d.jsx)(a,{className:Y(`size-4`,e.defaultItemClassName)})}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`span`,{className:`block font-semibold`,children:e.label}),(0,d.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]})},e.itemType)})})]})}var dC=e=>{switch(e){case`special`:return`Special Items`;case`display`:return`Display`;case`question`:return`Questions`;default:return e}},fC=[{id:`structure`,title:`Organize`,description:`Add a new group container or insert a page break.`,icon:ay,enabled:!0},{id:`blank-item`,title:`Blank Item`,description:`Start with a blank item type from the current editor registry.`,icon:Zy,enabled:!0},{id:`ai`,title:`AI Assistant`,description:`Describe what you want and our AI agent helps you get started.`,icon:Gy,enabled:!1},{id:`catalogue`,title:`Catalogue`,description:`Add an item from connected shared catalogues or use a custom catalogue.`,icon:yv,enabled:!1}];const pC=()=>{let{addItemDialogOpen:e,setAddItemDialogOpen:t,targetParentId:n,setPreferredPreviewItemId:r}=Nx(),i=vb(),a=Qb(),o=X(e=>e.editorItemRegistry),s=X(e=>e.addItem),c=X(e=>e.pasteItem),u=X(e=>e.commitByUser),{selectedItemId:f}=ex(),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(`entry`),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(()=>{if(!(typeof window>`u`))return localStorage.getItem(`case.survey-editor.last-used-item-type`)??void 0}),[C,w]=Ax(),T=!!i?.generateItemFromIntent,E=(0,l.useMemo)(()=>fC.map(e=>e.id===`ai`?{...e,enabled:T}:e),[T]),D=(0,l.useMemo)(()=>Object.values(o.definitions).filter(e=>!e.isRootOnly).filter(e=>!!o.coreRegistry[e.itemType]).map(e=>({itemType:e.itemType,key:e.itemType,label:ox(e.infos.labelByLocale),description:ox(e.infos.descriptionByLocale),defaultItemClassName:e.infos.defaultItemClassName,icon:e.infos.icon,categories:e.infos.categories})),[o]),O=(0,l.useMemo)(()=>D.filter(e=>Ix.has(e.itemType)),[D]),k=(0,l.useMemo)(()=>D.filter(e=>!Ix.has(e.itemType)),[D]),A=(0,l.useMemo)(()=>{if(!p.trim())return k;let e=p.toLowerCase();return k.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.categories.some(t=>t.toLowerCase().includes(e)))},[k,p]),j=(0,l.useMemo)(()=>{let e=[...A].sort((e,t)=>e.label.localeCompare(t.label)),t=new Set(Fx),n=e.filter(e=>t.has(e.itemType)),r=e.filter(e=>!t.has(e.itemType)),i=x?e.find(e=>e.itemType===x):void 0;return[...i?[i]:[],...n.filter(e=>e.itemType!==i?.itemType),...r.filter(e=>e.itemType!==i?.itemType)]},[A,x]),M=(0,l.useMemo)(()=>{let e={};return j.forEach(t=>{t.categories.forEach(n=>{n!==`structure`&&(e[n]||(e[n]=[]),e[n].push(t))})}),Object.entries(e).filter(([,e])=>e.length>0)},[j]),N=Hx({editor:a,selectedItemId:f??null,targetParentId:n}),P=(0,l.useMemo)(()=>N?N.itemLabel?`${N.itemKey} - ${N.itemLabel}`:N.itemKey:null,[N]),F=(0,l.useMemo)(()=>{if(!C)return!1;try{return Gg.isValidClipboardData(JSON.parse(C))}catch{return!1}},[C]),{handleSelectOption:I,pasteFromClipboard:L,createItemsFromIntent:R}=Bx({editorItemRegistry:o,addItem:s,pasteItem:c,commitByUser:u,setPreferredPreviewItemId:r,closeDialog:()=>{t(!1),g(`entry`),m(``)},targetGroupId:N?.id,rootItemId:a?.survey.rootItem?.id,clipboardValue:C,setLastUsedItemType:S}),z=Ux({options:O,onSelect:I,rowSize:1}),B=e=>{switch(e.id){case`structure`:z.reset(0),g(`structure`),z.focusGroup();break;case`blank-item`:g(`blank-item`);break;case`ai`:if(!T){Z.info(`AI Assistant item creation is not available in this host app.`);return}g(`ai`);break;case`catalogue`:Z.info(`Catalogue item import is coming soon.`);break;default:break}},V=Ux({options:E,onSelect:B,rowSize:2}),H=()=>{V.reset(0),g(`entry`),m(``),b(!1),V.focusGroup()},ee=async()=>{if(!i?.generateItemFromIntent||!a||!N?.id){Z.error(`AI item generation is unavailable.`);return}let e=_.trim();if(e.length<3){Z.info(`Please provide a short intent description first.`);return}b(!0);try{let t=Wg(a.survey,{purpose:`item-generation`,focusItemId:N.id});R((await i.generateItemFromIntent({intent:e,targetParentId:N.id,allowedItemTypes:D.map(e=>e.itemType),maxItems:5,locale:`en`,context:t},{mode:`user`})).items)}catch(e){console.error(`Failed to generate items from AI intent:`,e),Z.error(`AI item generation failed.`)}finally{b(!1)}};return(0,d.jsx)(bx,{open:e,onOpenChange:e=>{if(t(e),e){V.reset(0),z.reset(0),w();return}g(`entry`),m(``),v(``),b(!1),V.reset(0),z.reset(0)},children:(0,d.jsxs)(Cx,{className:`sm:max-w-2xl`,onOpenAutoFocus:e=>{switch(e.preventDefault(),h){case`structure`:z.focusGroup();break;case`entry`:V.focusGroup();break;default:break}},children:[(0,d.jsxs)(wx,{children:[(0,d.jsx)(Ex,{children:`Add to Survey`}),(0,d.jsx)(Dx,{children:N?(0,d.jsxs)(`span`,{className:`flex items-center gap-2 p-2 mt-1 bg-muted/50 rounded-lg border border-border`,children:[(0,d.jsx)(sy,{className:`w-4 h-4 text-muted-foreground`}),(0,d.jsxs)(`span`,{className:`text-xs`,children:[`Adding to: `,(0,d.jsx)(`span`,{className:`font-medium`,children:P}),N.itemCount>0&&(0,d.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,N.itemCount,` items)`]})]})]}):`Choose how you want to expand your questionnaire.`})]}),(()=>{switch(h){case`entry`:return(0,d.jsx)(lC,{options:E,optionGroupRef:V.groupRef,activeIndex:V.activeIndex,isFocused:V.isFocused,setActiveIndex:V.setActiveIndex,onGroupFocus:V.handleGroupFocus,onGroupBlur:V.handleGroupBlur,onGroupKeyDown:V.handleGroupKeyDown,onSelectOption:B});case`structure`:return(0,d.jsx)(uC,{options:O,optionGroupRef:z.groupRef,activeIndex:z.activeIndex,isFocused:z.isFocused,setActiveIndex:z.setActiveIndex,onGroupFocus:z.handleGroupFocus,onGroupBlur:z.handleGroupBlur,onGroupKeyDown:z.handleGroupKeyDown,onSelectOption:I,onBack:H});case`blank-item`:return(0,d.jsx)(cC,{search:p,onSearchChange:m,hasValidClipboardItem:F,onPasteFromClipboard:L,groupedOptions:M,getCategoryLabel:dC,onSelectOption:I,onBack:H});case`ai`:return(0,d.jsx)(Gx,{intent:_,onIntentChange:v,onGenerate:()=>{ee()},onBack:H,isGenerating:y,isEnabled:T});default:return null}})(),(0,d.jsx)(Tx,{children:(0,d.jsx)(`span`,{className:`text-muted-foreground text-xs items-center gap-1 font-medium`,children:Lx[h]})})]})})};function mC({className:e,...t}){return(0,d.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:Y(e),...t})}function hC({className:e,...t}){return(0,d.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:Y(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function gC({className:e,...t}){return(0,d.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:Y(`inline-flex items-center gap-1`,e),...t})}function _C({children:e,className:t,...n}){return(0,d.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:Y(`[&>svg]:size-3.5`,t),...n,children:e??(0,d.jsx)(Dv,{})})}var vC=({itemId:e,children:t})=>{let{navigateToItem:n}=ex();return(0,d.jsx)(`button`,{className:`ring-offset-2 rounded-sm outline-none hover:ring-[3px] hover:ring-ring/50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,onClick:()=>n(e),children:t})},yC=()=>{let e=$b(),{selectedItemId:t,navigateToItem:n}=ex(),{openAddItemDialog:r}=Nx();return(0,d.jsx)(`div`,{className:`px-4 py-1.5 rounded-xl bg-white/70 backdrop-blur-xs border border-border w-fit`,children:(0,d.jsx)(mC,{children:(0,d.jsxs)(hC,{children:[(0,d.jsx)(gC,{children:(0,d.jsxs)(fb,{children:[(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsx)(vC,{itemId:e?.rootItem?.id??``,children:(0,d.jsxs)(`span`,{className:`font-bold flex items-center gap-2 font-mono text-xs`,children:[(0,d.jsx)(ay,{className:`size-4 text-muted-foreground`}),e?.surveyKey]})})}),(0,d.jsx)(mb,{children:`Survey settings`})]})}),(i=>{if(!i||!e||!e.surveyItems.has(i))return null;try{let a=e.getItemPath(i);if(!a||a.length<1)return null;a.push(i);let o=a.slice(1),s=o.length;return o.map((i,a)=>{let o=e.surveyItems.get(i);if(!o)return null;let c=a===s-1,u=e.getSiblings(i),f=e.getParentItem(i)?.id;return(0,d.jsxs)(l.Fragment,{children:[(0,d.jsx)(_C,{}),(0,d.jsx)(gC,{children:c?(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{className:`ring-offset-2 rounded-sm outline-none hover:ring-[3px] hover:ring-ring/50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,children:(0,d.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-xs`,children:[o.key,(0,d.jsx)(`span`,{children:(0,d.jsx)(Cv,{className:`size-4 text-muted-foreground`})})]})}),(0,d.jsxs)(Mb,{align:`start`,className:`border-border max-h-64 overflow-y-auto`,children:[(0,d.jsx)(Lb,{className:`text-xs`,children:`Select sibling`}),(0,d.jsx)(Fb,{value:t??void 0,onValueChange:n,children:u?.map(e=>(0,d.jsx)(Ib,{value:e?.id,className:`font-mono text-xs data-[state=checked]:bg-muted`,children:e?.key},e?.id))}),(0,d.jsx)(Rb,{}),(0,d.jsx)(Pb,{onClick:()=>{f&&r(f)},children:(0,d.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,d.jsx)(Ly,{className:`size-4 text-muted-foreground`}),`Add new sibling`]})})]})]}):(0,d.jsx)(vC,{itemId:i,children:(0,d.jsxs)(`span`,{className:`font-bold flex items-center gap-2 font-mono text-xs`,children:[(0,d.jsx)(ry,{className:`size-4 text-muted-foreground`}),o.key]})})})]},i)})}catch{return null}})(t)]})})})},bC=yC;const xC=e=>{(0,l.useEffect)(()=>{let t=t=>{if(t.metaKey||t.ctrlKey)switch(t.key.toLowerCase()){case`s`:t.preventDefault(),e.onSave?.();break;case`z`:t.preventDefault(),t.shiftKey?e.onRedo?.():e.onUndo?.();break;case`y`:!t.metaKey&&t.ctrlKey&&(t.preventDefault(),e.onRedo?.());break;case`k`:t.preventDefault(),e.onSearch?.();break;default:break}};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e])},SC=[`#404040`,`#b91c1c`,`#c2410c`,`#a16207`,`#4d7c0f`,`#047857`,`#0369a1`,`#4338ca`,`#7e22ce`,`#86198f`,`#be123c`],CC=e=>SC[new TextEncoder().encode(e).reduce((e,t)=>e+t,0)%SC.length],wC=e=>e.metadata?.editorItemColor||CC(e.id),TC=e=>e instanceof $m&&e.isRoot()?`root`:e.type;var EC={key:`unknown`,label:`Unknown`,description:`Item type not found in registry.`,icon:Lv};const DC=(e,t)=>{if(!t)return EC;let n=_x(t,e);return n?{key:n.itemType,label:ox(n.infos.labelByLocale),description:ox(n.infos.descriptionByLocale),defaultItemClassName:n.infos.defaultItemClassName,icon:n.infos.icon}:{...EC,key:e.type,label:e.type}},OC=(e,t)=>{if(e===void 0||!t)return;let n=e===`root`?t.definitions.root:t.definitions[e];return n?{key:n.itemType,label:ox(n.infos.labelByLocale),description:ox(n.infos.descriptionByLocale),defaultItemClassName:n.infos.defaultItemClassName,icon:n.infos.icon}:{...EC,key:e,label:e}};function kC(e){let t=X(e=>e.editorItemRegistry);return(0,l.useMemo)(()=>OC(e,t),[e,t])}var AC=({typeInfos:e,color:t,iconClassName:n})=>(0,d.jsxs)(fb,{delayDuration:0,children:[(0,d.jsx)(pb,{children:(0,d.jsx)(`div`,{className:t?void 0:e.defaultItemClassName,style:{color:t},children:(0,d.jsx)(e.icon,{className:Y(`size-5`,n)})})}),(0,d.jsx)(mb,{align:`start`,side:`bottom`,children:e.label})]}),jC=AC,MC=20,NC=({isOpen:e,onOpenChange:t})=>{let n=$b(),r=X(e=>e.editorItemRegistry),{navigateToItem:i}=ex(),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(0),u=(0,l.useRef)(null),f=(0,l.useRef)([]),p=(0,l.useMemo)(()=>{if(!n?.surveyItems||!a.trim())return[];let e=[],t=new Set,i=a.toLowerCase().trim();return Array.from(n.surveyItems.entries()).forEach(([a,o])=>{let s=o.itemType??o.type;if(!o||!a||t.has(a)||s===Ym.PageBreak||e.length>=MC)return;let c=r.definitions[s]?.searchAdapters??[],l=DC(o,r),u=wC(o),d=n.getItemKey(o.id)?.fullKey??a;for(let r of c){let s=r({itemId:o.id,survey:n,searchTerm:i})?.[0];if(s){e.push({itemId:a,fullKey:d,item:o,itemTypeInfos:l,itemColor:u,matchType:s.matchType===`key`?`key`:s.matchType===`label`?`label`:s.matchType===`itemType`?`itemType`:`content`,matchText:s.matchText}),t.add(a);return}}}),e.slice(0,MC)},[r,a,n]),m=(0,l.useCallback)(e=>{i(e.itemId),t(!1),o(``),c(0)},[i,t]),h=(0,l.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),c(e=>Math.min(e+1,p.length-1))):e.key===`ArrowUp`?(e.preventDefault(),c(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),p[s]&&m(p[s])):e.key===`Escape`&&t(!1)},[p,s,m,t]),g=(0,l.useCallback)(e=>{t(e),e||(o(``),c(0))},[t]);(0,l.useEffect)(()=>{f.current=f.current.slice(0,p.length)},[p.length]),(0,l.useEffect)(()=>{let e=f.current[s];e&&u.current&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},[s,p.length]);let _=e=>{switch(e){case`key`:return(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,d.jsx)(hy,{className:`size-3`}),`Key:`]});case`content`:return(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,d.jsx)($v,{className:`size-3`}),`Content:`]});case`label`:return(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,d.jsx)($y,{className:`size-3`}),`Label:`]});case`itemType`:return(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,d.jsx)(ab,{className:`size-3`}),`Item Type:`]});default:return null}},v=(e,t)=>{if(!t.trim())return e;let n=RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)})`,`gi`);return e.split(n).map((e,t)=>n.test(e)?(0,d.jsx)(`mark`,{className:`bg-yellow-200 rounded px-0.5`,children:e},t):e)};return(0,d.jsx)(bx,{open:e,onOpenChange:g,children:(0,d.jsxs)(Cx,{className:`sm:max-w-2xl p-0 border-border overflow-hidden`,children:[(0,d.jsx)(Ex,{className:`sr-only`,children:`Search Survey Items`}),(0,d.jsxs)(`div`,{className:`flex flex-col`,children:[(0,d.jsxs)(`div`,{className:`flex items-center px-4 py-3 pe-12 border-b border-border`,children:[(0,d.jsx)(Uy,{className:`size-5 text-muted-foreground mr-2`}),(0,d.jsx)(d_,{placeholder:`Search survey items...`,value:a,onChange:e=>{o(e.target.value),c(0)},onKeyDown:h,className:`focus-visible:ring-0 text-sm`,autoFocus:!0}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground ml-2`,children:[(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-xs bg-muted rounded`,children:`↑↓`}),`to navigate`,(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-xs bg-muted rounded ml-1`,children:`↵`}),`to select`]})]}),(0,d.jsx)(`div`,{ref:u,className:`max-h-96 overflow-y-auto divide-y divide-border`,children:p.length>0?p.map((e,t)=>(0,d.jsxs)(`div`,{ref:e=>{f.current[t]=e},className:`px-4 py-3 cursor-pointer space-y-2 ${t===s?`bg-muted`:`hover:bg-muted/50`}`,onClick:()=>m(e),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[(0,d.jsx)(jC,{typeInfos:e.itemTypeInfos,color:e.itemColor,iconClassName:`size-5`}),(0,d.jsx)(`span`,{className:`text-sm font-mono grow text-ellipsis font-medium`,style:{color:e.itemColor},children:e.fullKey}),(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.item.metadata?.itemLabel})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_(e.matchType),(0,d.jsx)(`div`,{className:`text-xs text-foreground truncate`,children:v(e.matchText,a)})]})]},e.itemId)):a.trim()?(0,d.jsxs)(`div`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:[`No items found for "`,a,`"`]}):(0,d.jsx)(`div`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`Start typing to search survey items...`})})]})]})})},PC=NC,FC=typeof navigator<`u`&&/Mac|iPod|iPhone|iPad/.test(navigator.userAgent||``),IC=()=>{let[e,t]=(0,l.useState)(!1);xC({onSearch:()=>t(!0)});let n=FC?`⌘K`:`Ctrl+K`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(fb,{children:[(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsxs)(vm,{variant:`outline`,size:`sm`,onClick:()=>t(!0),className:`px-3 h-[30px] rounded-xl gap-2 bg-white/70 backdrop-blur-xs border border-border hover:bg-white/90`,children:[(0,d.jsx)(Uy,{className:`size-4 text-muted-foreground`}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Search`}),(0,d.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 bg-muted rounded-md px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,children:(0,d.jsx)(`span`,{className:`text-xs tracking-widest`,children:n})})]})}),(0,d.jsxs)(mb,{children:[(0,d.jsx)(`p`,{children:`Search survey items`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]})]}),(0,d.jsx)(PC,{isOpen:e,onOpenChange:t})]})},LC=IC,RC=()=>{let e=X(e=>e.editor),t=X(e=>e.selectedLocale),n=X(e=>e.setSelectedLocale),r=qb(e=>e.navigate),{fallbackLocale:i}=_b(),a=e?.survey?.locales??[],o=a.length>0?a:[i],s=o.includes(t)?t:o[0],c=(0,l.useEffectEvent)(e=>{n(e)});return(0,l.useEffect)(()=>{t!==s&&c(s)},[s,t]),(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsxs)(vm,{variant:`outline`,size:`sm`,className:`gap-2 border-border rounded-xl h-[30px] text-muted-foreground text-xs`,children:[(0,d.jsx)(xy,{className:`size-3.5`}),s,(0,d.jsx)(Cv,{className:`size-4`})]})}),(0,d.jsxs)(Mb,{align:`end`,className:`w-fit`,sideOffset:8,children:[(0,d.jsx)(Lb,{children:`Languages:`}),(0,d.jsx)(Fb,{value:s,onValueChange:n,children:o.map(e=>(0,d.jsx)(Ib,{value:e,children:e},e))}),(0,d.jsx)(Rb,{}),(0,d.jsxs)(Pb,{onClick:()=>{r({view:`translation-mode`})},children:[(0,d.jsx)(Ny,{className:`size-4 mr-2`}),(0,d.jsx)(`span`,{className:`text-nowrap`,children:`Edit languages`})]})]})]})},zC=RC,BC=()=>(0,d.jsxs)(`div`,{className:Y(`flex items-center gap-2 justify-between`,`flex-col @2xl/main:flex-row`,`items-start`),children:[(0,d.jsx)(bC,{}),(0,d.jsxs)(`div`,{className:Y(`flex items-center gap-4`,`w-full @2xl/main:w-auto justify-between`),children:[(0,d.jsx)(LC,{}),(0,d.jsx)(zC,{})]})]}),VC=BC,HC=()=>X(e=>e.editor)?(0,d.jsx)(Mx,{children:(0,d.jsxs)(`div`,{className:`h-full flex flex-col gap-4`,children:[(0,d.jsx)(VC,{}),(0,d.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,d.jsx)(yx,{})}),(0,d.jsx)(pC,{})]})}):(0,d.jsx)(`div`,{className:`relative h-full flex items-center justify-center`,children:(0,d.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(Ty,{className:`size-4 animate-spin`}),`Loading...`]})}),UC=HC,WC=()=>(0,d.jsx)(`div`,{className:`rounded-xl border border-border bg-background p-8 text-center text-muted-foreground`,children:`Translations mode coming soon`}),GC=WC,KC=()=>(0,d.jsx)(`div`,{className:`rounded-xl border border-border bg-background p-8 text-center text-muted-foreground`,children:`Simulator coming soon`}),qC=KC,JC=()=>{let e=qb(e=>e.location);return(0,d.jsx)(`main`,{className:`grow bg-(--main-bg-color) @container/main`,style:{backgroundImage:`
|
|
53
|
-
|
|
54
|
-
`,backgroundSize:`var(--main-bg-dot-grid-size) var(--main-bg-dot-grid-size)`,backgroundPosition:`0 0, 0 0`},children:(0,d.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:(0,d.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:(()=>{switch(e.view){case`item-editor`:return(0,d.jsx)(UC,{});case`translation-mode`:return(0,d.jsx)(GC,{});case`simulator`:return(0,d.jsx)(qC,{})}})()})})})},YC=JC,XC=({onSaveRequested:e})=>{let{undo:t,redo:n,canUndo:r,canRedo:i}=X(e=>e),a=(0,l.useCallback)(()=>{if(e){e();return}Z.info(`No save handler provided by host application.`)},[e]),o=(0,l.useCallback)(()=>{r()&&t()?Z.success(`Undo functionality triggered (Ctrl/Cmd + Z)`):Z.error(`No more actions to undo`)},[t,r]),s=(0,l.useCallback)(()=>{i()&&n()?Z.success(`Redo functionality triggered (Ctrl/Cmd + Shift + Z)`):Z.error(`No more actions to redo`)},[n,i]);return xC({onSave:a,onUndo:o,onRedo:s}),(0,d.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[(0,d.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,d.jsx)(Zb,{onSave:a,onUndo:o,onRedo:s}),(0,d.jsx)(YC,{})]}),(0,d.jsx)(Ob,{})]})},ZC=XC;function QC({className:e,orientation:t=`horizontal`,...n}){return(0,d.jsx)(nf,{"data-slot":`tabs`,"data-orientation":t,className:Y(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var $C=g(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ew({className:e,variant:t=`default`,...n}){return(0,d.jsx)(rf,{"data-slot":`tabs-list`,"data-variant":t,className:Y($C({variant:t}),e),...n})}function tw({className:e,...t}){return(0,d.jsx)(af,{"data-slot":`tabs-trigger`,className:Y(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function nw({className:e,...t}){return(0,d.jsx)(of,{"data-slot":`tabs-content`,className:Y(`flex-1 text-sm outline-none`,e),...t})}const rw=({itemId:e})=>{let t=X(e=>e.copyItem);return(0,d.jsxs)(Pb,{onClick:()=>{try{let n=t(e);navigator.clipboard.writeText(JSON.stringify(n,null,2)).then(()=>{kx(),Z.success(`Item copied to clipboard`)}).catch(()=>{Z.error(`Failed to copy item`)})}catch(e){console.error(`Error copying item:`,e),Z.error(`Failed to copy item`)}},children:[(0,d.jsx)(Gv,{className:`size-4 mr-2`}),`Copy`]})};function iw(e={}){let{selectedItemId:t,navigateToItem:n}=ex(),r=__(),i=u_(),a=$b(),{removeItem:o}=X(e=>e),s=e.itemId??t,c=(0,l.useCallback)(async()=>{if(!s)return;let e=a?.getReferenceUsages(s);if(e&&e.length>0){await i({title:`Remove references before deletion`,description:`This item is referenced in other parts of the survey. You need to remove all references before deleting it.`,buttonLabel:`Ok`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground mb-1`,children:`References found in:`}),(0,d.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,t)=>(0,d.jsx)(`li`,{children:(0,d.jsxs)(vm,{variant:`outline`,size:`sm`,className:`flex items-center gap-1 w-full`,onClick:()=>{n(e.itemId),i.dismiss()},children:[(0,d.jsx)(`span`,{className:`text-sm font-medium`,children:a?.getItemKey(e.itemId)?.fullKey??e.itemId}),(0,d.jsx)(`span`,{className:`text-[0.5rem] text-muted-foreground border border-muted-foreground rounded-md px-1 py-0.5`,children:e.usageType}),(0,d.jsx)(Dv,{className:`ml-auto size-4 text-muted-foreground`})]})},e.itemId+t))})]})});return}if(await r({title:`Delete Survey Item`,description:`Are you sure you want to delete this survey item?`,variant:`destructive`}))try{let e=a?.getParentItem(s),t=a?.surveyItems.get(s);o(s),n(e?.id??a?.rootItem?.id),Z.success(`Item "${t?.key}" deleted successfully`)}catch(e){console.error(`Error deleting item:`,e),Z.error(`Failed to delete item`,{description:e instanceof Error?e.message:`Unknown error`})}},[i,r,s,n,o,a]);return{itemId:s,canDelete:!!s,deleteItem:c}}const aw=({overrideItemId:e})=>{let{canDelete:t,deleteItem:n}=iw({itemId:e});return t?(0,d.jsxs)(Pb,{onSelect:e=>{e.preventDefault(),n()},children:[(0,d.jsx)(tb,{className:`size-4 mr-2 text-destructive`}),`Delete`]}):null};function ow({...e}){return(0,d.jsx)(ul,{"data-slot":`context-menu`,...e})}function sw({className:e,...t}){return(0,d.jsx)(dl,{"data-slot":`context-menu-trigger`,className:Y(`select-none`,e),...t})}function cw({...e}){return(0,d.jsx)(gl,{"data-slot":`context-menu-sub`,...e})}function lw({className:e,...t}){return(0,d.jsx)(fl,{children:(0,d.jsx)(pl,{"data-slot":`context-menu-content`,className:Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function uw({className:e,inset:t,variant:n=`default`,...r}){return(0,d.jsx)(ml,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function dw({className:e,inset:t,children:n,...r}){return(0,d.jsxs)(_l,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:Y(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,d.jsx)(Dv,{className:`ml-auto`})]})}function fw({className:e,...t}){return(0,d.jsx)(vl,{"data-slot":`context-menu-sub-content`,className:Y(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}function pw({className:e,...t}){return(0,d.jsx)(hl,{"data-slot":`context-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border`,e),...t})}var mw=({currentColor:e,onColorChange:t})=>(0,d.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-2`,children:SC.map(n=>(0,d.jsx)(vm,{variant:`ghost`,size:`sm`,className:Y(`w-8 h-8 p-0 rounded-md border-2 hover:scale-110 transition-all`,e===n?`border-foreground ring-2 ring-foreground ring-offset-1`:`border-transparent hover:border-muted-foreground`),style:{backgroundColor:n},onClick:()=>t(n),title:`Color: ${n}`},n))}),hw=mw,gw=e=>{let t=X(e=>e.getItemDataCopy),n=X(e=>e.updateItem),r=X(e=>e.commitByUser),i=$b()?.surveyItems.get(e);return{currentColor:i&&wC(i)||`#404040`,onColorChange:i=>{let a=t(e);if(!a){Z.error(`Failed to update item color.`);return}a.metadata={...a.metadata,editorItemColor:i},n(e,a),r({label:`Update item editor color`}),Z.success(`Item color updated.`)}}};const _w=({itemId:e})=>{let{currentColor:t,onColorChange:n}=gw(e);return(0,d.jsxs)(Bb,{children:[(0,d.jsxs)(Vb,{children:[(0,d.jsx)(jy,{className:`mr-2 h-4 w-4`}),(0,d.jsx)(`span`,{className:`text-nowrap`,children:`Item color`})]}),(0,d.jsx)(Hb,{className:`border-border`,children:(0,d.jsx)(hw,{currentColor:t,onColorChange:n})})]})},vw=({itemId:e})=>{let{currentColor:t,onColorChange:n}=gw(e);return(0,d.jsxs)(cw,{children:[(0,d.jsxs)(dw,{children:[(0,d.jsx)(jy,{className:`mr-2 h-4 w-4`}),(0,d.jsx)(`span`,{children:`Item color`})]}),(0,d.jsx)(fw,{className:`border-border`,children:(0,d.jsx)(hw,{currentColor:t,onColorChange:n})})]})};var yw=({children:e})=>(0,d.jsx)(`div`,{className:`h-full w-full overflow-auto rounded-md border border-border/60 bg-muted/20 p-3`,children:(0,d.jsx)(`div`,{className:`mx-auto`,children:(0,d.jsx)(`div`,{style:{pointerEvents:`none`,userSelect:`none`},"aria-hidden":`true`,children:e})})}),bw=({item:e,mode:t=`interactive`})=>{let n=Qb(),r=X(e=>e.editorItemRegistry),i=X(e=>e.selectedLocale),{navigateToItem:a}=ex(),o=t===`static`;if(!e)return(0,d.jsx)(`div`,{className:`flex items-center justify-center h-full text-center text-muted-foreground`,children:(0,d.jsx)(`p`,{className:`text-sm`,children:`No item selected`})});let s=wC(e),c=DC(e,r),l=_x(r,e),u=n?.survey.getItemTranslations(e.id),f=(0,d.jsxs)(`div`,{className:`text-sm text-muted-foreground flex items-center gap-3 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,d.jsx)(jC,{typeInfos:c,color:s,iconClassName:`size-5`}),(0,d.jsx)(`p`,{className:`font-mono min-w-0 flex-1 truncate`,style:{color:s},children:n?.survey.getItemKey(e.id)?.fullKey})]}),(0,d.jsx)(`p`,{className:`text-muted-foreground font-medium shrink-0 max-w-[40%] truncate`,children:e.metadata?.itemLabel})]}),p=()=>{if(l?.previewComponent){let n=l.previewComponent;return(0,d.jsx)(`div`,{className:`max-w-[832px] w-full mx-auto @container/preview-content`,children:(0,d.jsx)(n,{item:e,itemConfig:e.config,itemContent:u,locale:i,mode:t})})}if(l?.renderComponent){let t=l.renderComponent;return(0,d.jsx)(`div`,{className:`max-w-[832px] w-full mx-auto @container/preview-content`,children:(0,d.jsx)(t,{renderedItem:{id:e.id,type:e.type}})})}return(0,d.jsxs)(`div`,{className:`text-center text-muted-foreground py-10`,children:[`No preview renderer registered for `,(0,d.jsx)(`span`,{className:`font-mono`,children:e.type}),`.`]})};return(0,d.jsx)(`div`,{className:`gap-4 h-full flex flex-col @container/preview`,children:(0,d.jsx)(`div`,{className:`flex items-center justify-center flex-1`,children:(0,d.jsxs)(`div`,{className:`relative w-full space-y-2`,children:[(0,d.jsx)(`div`,{className:`flex justify-center py-2`,children:f}),(0,d.jsx)(`div`,{className:`border border-border shadow-sm rounded-lg bg-white max-w-[min(450px,100%)] mx-auto min-h-[220px] w-full ${o?`overflow-hidden p-2`:`overflow-y-auto p-4`}`,children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`h-full hidden @sm/preview:block`,children:(0,d.jsx)(yw,{children:p()})}),(0,d.jsx)(`div`,{className:`flex min-h-[220px] w-full items-center justify-center rounded-md border border-dashed border-border/70 bg-muted/20 py-6 @sm/preview:hidden`,children:(0,d.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-6 shadow-sm`,style:{color:s},"aria-label":`${e.type} preview icon`,children:(0,d.jsx)(c.icon,{className:`size-10`})})})]}):p()}),(0,d.jsxs)(`div`,{className:`flex items-center gap-4 w-fit mx-auto`,children:[e.type!==Ym.PageBreak&&(0,d.jsxs)(vm,{variant:`ghost`,size:`sm`,onClick:()=>{e&&a(e.id)},className:`flex flex-col gap-1 h-auto py-2`,children:[(0,d.jsx)(Ny,{className:`size-4`}),(0,d.jsx)(`span`,{className:`text-xs`,children:`Open item`})]}),(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsxs)(vm,{variant:`ghost`,size:`sm`,className:`flex flex-col gap-1 h-auto py-2`,children:[(0,d.jsx)(Fv,{className:`size-4`}),(0,d.jsx)(`span`,{className:`text-xs`,children:`More`})]})}),(0,d.jsxs)(Mb,{align:`end`,className:`border-border`,children:[(0,d.jsxs)(Pb,{onClick:()=>{if(e&&n){let t=n.copyItem(e.id);navigator.clipboard.writeText(JSON.stringify(t,null,2)).then(()=>{kx(),Z.success(`Item copied to clipboard`)}).catch(()=>{Z.error(`Failed to copy item`)})}},children:[(0,d.jsx)(Gv,{className:`size-4 mr-2`}),`Copy`]}),(0,d.jsx)(Rb,{}),(0,d.jsx)(_w,{itemId:e.id}),(0,d.jsx)(Rb,{}),(0,d.jsx)(aw,{overrideItemId:e.id})]})]})]})]})})})},xw=bw;function Sw(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,l.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}var Cw=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ww(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Tw(e){return`nodeType`in e}function Ew(e){return e?ww(e)?e:Tw(e)?e.ownerDocument?.defaultView??window:window:window}function Dw(e){let{Document:t}=Ew(e);return e instanceof t}function Ow(e){return ww(e)?!1:e instanceof Ew(e).HTMLElement}function kw(e){return e instanceof Ew(e).SVGElement}function Aw(e){return e?ww(e)?e.document:Tw(e)?Dw(e)?e:Ow(e)||kw(e)?e.ownerDocument:document:document:document}var jw=Cw?l.useLayoutEffect:l.useEffect;function Mw(e){let t=(0,l.useRef)(e);return jw(()=>{t.current=e}),(0,l.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function Nw(){let e=(0,l.useRef)(null);return[(0,l.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,l.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Pw(e,t){t===void 0&&(t=[e]);let n=(0,l.useRef)(e);return jw(()=>{n.current!==e&&(n.current=e)},t),n}function Fw(e,t){let n=(0,l.useRef)();return(0,l.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Iw(e){let t=Mw(e),n=(0,l.useRef)(null);return[n,(0,l.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Lw(e){let t=(0,l.useRef)();return(0,l.useEffect)(()=>{t.current=e},[e]),t.current}var Rw={};function zw(e,t){return(0,l.useMemo)(()=>{if(t)return t;let n=Rw[e]==null?0:Rw[e]+1;return Rw[e]=n,e+`-`+n},[e,t])}function Bw(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Vw=Bw(1),Hw=Bw(-1);function Uw(e){return`clientX`in e&&`clientY`in e}function Ww(e){if(!e)return!1;let{KeyboardEvent:t}=Ew(e.target);return t&&e instanceof t}function Gw(e){if(!e)return!1;let{TouchEvent:t}=Ew(e.target);return t&&e instanceof t}function Kw(e){if(Gw(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Uw(e)?{x:e.clientX,y:e.clientY}:null}var qw=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[qw.Translate.toString(e),qw.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Jw=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Yw(e){return e.matches(Jw)?e:e.querySelector(Jw)}var Xw={display:`none`};function Zw(e){let{id:t,value:n}=e;return l.default.createElement(`div`,{id:t,style:Xw},n)}function Qw(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return l.default.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function $w(){let[e,t]=(0,l.useState)(``);return{announce:(0,l.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var eT=(0,l.createContext)(null);function tT(e){let t=(0,l.useContext)(eT);(0,l.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function nT(){let[e]=(0,l.useState)(()=>new Set),t=(0,l.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,l.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var rT={draggable:`
|
|
55
|
-
|
|
56
|
-
While dragging, use the arrow keys to move the item.
|
|
57
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
58
|
-
`},iT={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function aT(e){let{announcements:t=iT,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=rT}=e,{announce:a,announcement:o}=$w(),s=zw(`DndLiveRegion`),[c,d]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{d(!0)},[]),tT((0,l.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let f=l.default.createElement(l.default.Fragment,null,l.default.createElement(Zw,{id:r,value:i.draggable}),l.default.createElement(Qw,{id:s,announcement:o}));return n?(0,u.createPortal)(f,n):f}var oT;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(oT||={});function sT(){}function cT(e,t){return(0,l.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function lT(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,l.useMemo)(()=>[...t].filter(e=>e!=null),[...t])}var uT=Object.freeze({x:0,y:0});function dT(e,t){let n=Kw(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function fT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pT(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function mT(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var hT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=mT(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(fT)};function gT(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function _T(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:uT}function vT(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var yT=vT(1);function bT(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xT(e,t,n){let r=bT(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ST={ignoreTransform:!1};function CT(e,t){t===void 0&&(t=ST);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Ew(e).getComputedStyle(e);t&&(n=xT(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function wT(e){return CT(e,{ignoreTransform:!0})}function TT(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ET(e,t){return t===void 0&&(t=Ew(e).getComputedStyle(e)),t.position===`fixed`}function DT(e,t){t===void 0&&(t=Ew(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function OT(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Dw(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ow(i)||kw(i)||n.includes(i))return n;let a=Ew(e).getComputedStyle(i);return i!==e&&DT(i,a)&&n.push(i),ET(i,a)?n:r(i.parentNode)}return e?r(e):n}function kT(e){let[t]=OT(e,1);return t??null}function AT(e){return!Cw||!e?null:ww(e)?e:Tw(e)?Dw(e)||e===Aw(e).scrollingElement?window:Ow(e)?e:null:null}function jT(e){return ww(e)?e.scrollX:e.scrollLeft}function MT(e){return ww(e)?e.scrollY:e.scrollTop}function NT(e){return{x:jT(e),y:MT(e)}}var PT;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(PT||={});function FT(e){return!Cw||!e?!1:e===document.scrollingElement}function IT(e){let t={x:0,y:0},n=FT(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var LT={x:.2,y:.2};function RT(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=LT);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=IT(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=PT.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=PT.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=PT.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=PT.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function zT(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function BT(e){return e.reduce((e,t)=>Vw(e,NT(t)),uT)}function VT(e){return e.reduce((e,t)=>e+jT(t),0)}function HT(e){return e.reduce((e,t)=>e+MT(t),0)}function UT(e,t){if(t===void 0&&(t=CT),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);kT(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var WT=[[`x`,[`left`,`right`],VT],[`y`,[`top`,`bottom`],HT]],GT=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=OT(t),r=BT(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of WT)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},KT=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function qT(e){let{EventTarget:t}=Ew(e);return e instanceof t?e:Aw(e)}function JT(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var YT;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(YT||={});function XT(e){e.preventDefault()}function ZT(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var QT={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},$T=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},eE=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new KT(Aw(t)),this.windowListeners=new KT(Ew(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(YT.Resize,this.handleCancel),this.windowListeners.add(YT.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(YT.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&UT(n),t(uT)}handleKeyDown(e){if(Ww(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=QT,coordinateGetter:a=$T,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:uT;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Hw(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=IT(n),p=zT(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Vw(Hw(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};eE.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=QT,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function tE(e){return!!(e&&`distance`in e)}function nE(e){return!!(e&&`delay`in e)}var rE=class{constructor(e,t,n){n===void 0&&(n=qT(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Aw(i),this.documentListeners=new KT(this.document),this.listeners=new KT(n),this.windowListeners=new KT(Ew(i)),this.initialCoordinates=Kw(r)??uT,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(YT.Resize,this.handleCancel),this.windowListeners.add(YT.DragStart,XT),this.windowListeners.add(YT.VisibilityChange,this.handleCancel),this.windowListeners.add(YT.ContextMenu,XT),this.documentListeners.add(YT.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nE(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(tE(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(YT.Click,ZT,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(YT.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Kw(e)??uT,s=Hw(n,o);if(!t&&a){if(tE(a)){if(a.tolerance!=null&&JT(s,a.tolerance))return this.handleCancel();if(JT(s,a.distance))return this.handleStart()}if(nE(a)&&JT(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},iE={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},aE=class extends rE{constructor(e){let{event:t}=e,n=Aw(t.target);super(e,iE,n)}};aE.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var oE={move:{name:`mousemove`},end:{name:`mouseup`}},sE;(function(e){e[e.RightClick=2]=`RightClick`})(sE||={});var cE=class extends rE{constructor(e){super(e,oE,Aw(e.event.target))}};cE.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sE.RightClick?!1:(r?.({event:n}),!0)}}];var lE={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},uE=class extends rE{constructor(e){super(e,lE)}static setup(){return window.addEventListener(lE.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(lE.move.name,e)};function e(){}}};uE.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var dE;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(dE||={});var fE;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(fE||={});function pE(e){let{acceleration:t,activator:n=dE.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=fE.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=hE({delta:f,disabled:!a}),[h,g]=Nw(),_=(0,l.useRef)({x:0,y:0}),v=(0,l.useRef)({x:0,y:0}),y=(0,l.useMemo)(()=>{switch(n){case dE.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case dE.DraggableRect:return i}},[n,i,c]),b=(0,l.useRef)(null),x=(0,l.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,l.useMemo)(()=>s===fE.TreeOrder?[...u].reverse():u,[s,u]);(0,l.useEffect)(()=>{if(!a||!u.length||!y){g();return}for(let e of S){if(r?.(e)===!1)continue;let n=d[u.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=RT(e,n,y,t,p);for(let e of[`x`,`y`])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,o),_.current=a,v.current=i;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var mE={x:{[PT.Backward]:!1,[PT.Forward]:!1},y:{[PT.Backward]:!1,[PT.Forward]:!1}};function hE(e){let{delta:t,disabled:n}=e,r=Lw(t);return Fw(e=>{if(n||!r||!e)return mE;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[PT.Backward]:e.x[PT.Backward]||i.x===-1,[PT.Forward]:e.x[PT.Forward]||i.x===1},y:{[PT.Backward]:e.y[PT.Backward]||i.y===-1,[PT.Forward]:e.y[PT.Forward]||i.y===1}}},[n,t,r])}function gE(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Fw(e=>t==null?null:r??e??null,[r,t])}function _E(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var vE;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(vE||={});var yE;(function(e){e.Optimized=`optimized`})(yE||={});var bE=new Map;function xE(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,l.useState)(null),{frequency:s,measure:c,strategy:u}=i,d=(0,l.useRef)(e),f=_(),p=Pw(f),m=(0,l.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,l.useRef)(null),g=Fw(t=>{if(f&&!n)return bE;if(!t||t===bE||d.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new GT(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,f,c]);return(0,l.useEffect)(()=>{d.current=e},[e]),(0,l.useEffect)(()=>{f||m()},[n,f]),(0,l.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,l.useEffect)(()=>{f||typeof s!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function _(){switch(u){case vE.Always:return!1;case vE.BeforeDragging:return n;default:return!n}}}function SE(e,t){return Fw(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function CE(e,t){return SE(e,t)}function wE(e){let{callback:t,disabled:n}=e,r=Mw(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function TE(e){let{callback:t,disabled:n}=e,r=Mw(t),i=(0,l.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,l.useEffect)(()=>()=>i?.disconnect(),[i]),i}function EE(e){return new GT(CT(e),e)}function DE(e,t,n){t===void 0&&(t=EE);let[r,i]=(0,l.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=wE({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=TE({callback:a});return jw(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function OE(e){return _T(e,SE(e))}var kE=[];function AE(e){let t=(0,l.useRef)(e),n=Fw(n=>e?n&&n!==kE&&e&&t.current&&e.parentNode===t.current.parentNode?n:OT(e):kE,[e]);return(0,l.useEffect)(()=>{t.current=e},[e]),n}function jE(e){let[t,n]=(0,l.useState)(null),r=(0,l.useRef)(e),i=(0,l.useCallback)(e=>{let t=AT(e.target);t&&n(e=>e?(e.set(t,NT(t)),new Map(e)):null)},[]);return(0,l.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=AT(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,NT(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{AT(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,l.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Vw(e,t),uT):BT(e):uT,[e,t])}function ME(e,t){t===void 0&&(t=[]);let n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{n.current=null},t),(0,l.useEffect)(()=>{let t=e!==uT;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Hw(e,n.current):uT}function NE(e){(0,l.useEffect)(()=>{if(!Cw)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function PE(e,t){return(0,l.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function FE(e){return(0,l.useMemo)(()=>e?TT(e):null,[e])}var IE=[];function LE(e,t){t===void 0&&(t=CT);let[n]=e,r=FE(n?Ew(n):null),[i,a]=(0,l.useState)(IE);function o(){a(()=>e.length?e.map(e=>FT(e)?r:new GT(t(e),e)):IE)}let s=TE({callback:o});return jw(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function RE(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Ow(t)?t:e}function zE(e){let{measure:t}=e,[n,r]=(0,l.useState)(null),i=TE({callback:(0,l.useCallback)(e=>{for(let{target:n}of e)if(Ow(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Iw((0,l.useCallback)(e=>{let n=RE(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,l.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var BE=[{sensor:aE,options:{}},{sensor:eE,options:{}}],VE={current:{}},HE={draggable:{measure:wT},droppable:{measure:wT,strategy:vE.WhileDragging,frequency:yE.Optimized},dragOverlay:{measure:CT}},UE=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},WE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new UE,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sT},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:HE,measureDroppableContainers:sT,windowRect:null,measuringScheduled:!1},GE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:sT,draggableNodes:new Map,over:null,measureDroppableContainers:sT},KE=(0,l.createContext)(GE),qE=(0,l.createContext)(WE);function JE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new UE}}}function YE(e,t){switch(t.type){case oT.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case oT.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case oT.DragEnd:case oT.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case oT.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new UE(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case oT.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new UE(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case oT.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new UE(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function XE(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,l.useContext)(KE),a=Lw(r),o=Lw(n?.id);return(0,l.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ww(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Yw(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function ZE(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function QE(e){return(0,l.useMemo)(()=>({draggable:{...HE.draggable,...e?.draggable},droppable:{...HE.droppable,...e?.droppable},dragOverlay:{...HE.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $E(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,l.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;jw(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=_T(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=kT(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var eD=(0,l.createContext)({...uT,scaleX:1,scaleY:1}),tD;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(tD||={});var nD=(0,l.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=BE,collisionDetection:o=hT,measuring:s,modifiers:c,...d}=e,[f,p]=(0,l.useReducer)(YE,void 0,JE),[m,h]=nT(),[g,_]=(0,l.useState)(tD.Uninitialized),v=g===tD.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=f,C=y==null?null:b.get(y),w=(0,l.useRef)({initial:null,translated:null}),T=(0,l.useMemo)(()=>y==null?null:{id:y,data:C?.data??VE,rect:w},[y,C]),E=(0,l.useRef)(null),[D,O]=(0,l.useState)(null),[k,A]=(0,l.useState)(null),j=Pw(d,Object.values(d)),M=zw(`DndDescribedBy`,t),N=(0,l.useMemo)(()=>S.getEnabled(),[S]),P=QE(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=xE(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),R=gE(b,y),z=(0,l.useMemo)(()=>k?Kw(k):null,[k]),B=Te(),V=CE(R,P.draggable.measure);$E({activeNode:y==null?null:b.get(y),config:B.layoutShiftCompensation,initialRect:V,measure:P.draggable.measure});let H=DE(R,P.draggable.measure,V),ee=DE(R?R.parentElement:null),te=(0,l.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),U=S.getNodeFor(te.current.over?.id),W=zE({measure:P.dragOverlay.measure}),ne=W.nodeRef.current??R,re=v?W.rect??H:null,ie=!!(W.nodeRef.current&&W.rect),ae=OE(ie?null:H),oe=FE(ne?Ew(ne):null),G=AE(v?U??R:null),se=LE(G),ce=ZE(c,{transform:{x:x.x-ae.x,y:x.y-ae.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:H,containerNodeRect:ee,draggingNodeRect:re,over:te.current.over,overlayNodeRect:W.rect,scrollableAncestors:G,scrollableAncestorRects:se,windowRect:oe}),le=z?Vw(z,x):null,ue=jE(G),de=ME(ue),fe=ME(ue,[H]),pe=Vw(ce,de),me=re?yT(re,ce):null,he=T&&me?o({active:T,collisionRect:me,droppableRects:F,droppableContainers:N,pointerCoordinates:le}):null,ge=pT(he,`id`),[_e,ve]=(0,l.useState)(null),ye=gT(ie?ce:Vw(ce,fe),_e?.rect??null,H),be=(0,l.useRef)(null),xe=(0,l.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=b.get(E.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:E.current,activeNode:i,event:a,options:r,context:te,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),m({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),m({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,u.unstable_batchedUpdates)(()=>{r?.(i),_(tD.Initializing),p({type:oT.DragStart,initialCoordinates:e,active:t}),m({type:`onDragStart`,event:i}),O(be.current),A(a)})},onMove(e){p({type:oT.DragMove,coordinates:e})},onEnd:o(oT.DragEnd),onCancel:o(oT.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=te.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===oT.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=oT.DragCancel)}E.current=null,(0,u.unstable_batchedUpdates)(()=>{p({type:e}),_(tD.Uninitialized),ve(null),O(null),A(null),be.current=null;let t=e===oT.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),m({type:t,event:o})}})}}},[b]),Se=_E(a,(0,l.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,xe(n,t))},[b,xe]));NE(a),jw(()=>{H&&g===tD.Initializing&&_(tD.Initialized)},[H,g]),(0,l.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=te.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,u.unstable_batchedUpdates)(()=>{e?.(a),m({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,l.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=te.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,u.unstable_batchedUpdates)(()=>{ve(s),a?.(c),m({type:`onDragOver`,event:c})})},[ge]),jw(()=>{te.current={activatorEvent:k,active:T,activeNode:R,collisionRect:me,collisions:he,droppableRects:F,draggableNodes:b,draggingNode:ne,draggingNodeRect:re,droppableContainers:S,over:_e,scrollableAncestors:G,scrollAdjustedTranslate:pe},w.current={initial:re,translated:me}},[T,R,he,me,b,ne,re,F,S,_e,G,pe]),pE({...B,delta:x,draggingRect:me,pointerCoordinates:le,scrollableAncestors:G,scrollableAncestorRects:se});let Ce=(0,l.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:H,activatorEvent:k,collisions:he,containerNodeRect:ee,dragOverlay:W,draggableNodes:b,droppableContainers:S,droppableRects:F,over:_e,measureDroppableContainers:I,scrollableAncestors:G,scrollableAncestorRects:se,measuringConfiguration:P,measuringScheduled:L,windowRect:oe}),[T,R,H,k,he,ee,W,b,S,F,_e,I,G,se,P,L,oe]),we=(0,l.useMemo)(()=>({activatorEvent:k,activators:Se,active:T,activeNodeRect:H,ariaDescribedById:{draggable:M},dispatch:p,draggableNodes:b,over:_e,measureDroppableContainers:I}),[k,Se,T,H,p,M,b,_e,I]);return l.default.createElement(eT.Provider,{value:h},l.default.createElement(KE.Provider,{value:we},l.default.createElement(qE.Provider,{value:Ce},l.default.createElement(eD.Provider,{value:ye},i)),l.default.createElement(XE,{disabled:n?.restoreFocus===!1})),l.default.createElement(aT,{...n,hiddenTextDescribedById:M}));function Te(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=v&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),rD=(0,l.createContext)(null),iD=`button`,aD=`Draggable`;function oD(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=zw(aD),{activators:o,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,l.useContext)(KE),{role:m=iD,roleDescription:h=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,l.useContext)(_?eD:rD),[y,b]=Iw(),[x,S]=Iw(),C=PE(o,t),w=Pw(n);return jw(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=f.get(t);e&&e.key===a&&f.delete(t)}),[f,t]),{active:c,activatorEvent:s,activeNodeRect:u,attributes:(0,l.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&m===iD?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[r,m,g,_,h,d.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function sD(){return(0,l.useContext)(qE)}var cD=`Droppable`,lD={timeout:25};function uD(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=zw(cD),{active:o,dispatch:s,over:c,measureDroppableContainers:u}=(0,l.useContext)(KE),d=(0,l.useRef)({disabled:n}),f=(0,l.useRef)(!1),p=(0,l.useRef)(null),m=(0,l.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...lD,...i},v=Pw(g??r),y=TE({callback:(0,l.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!o}),[b,x]=Iw((0,l.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=Pw(t);return(0,l.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,l.useEffect)(()=>(s({type:oT.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:p,data:S}}),()=>s({type:oT.UnregisterDroppable,key:a,id:r})),[r]),(0,l.useEffect)(()=>{n!==d.current.disabled&&(s({type:oT.SetDroppableDisabled,id:r,key:a,disabled:n}),d.current.disabled=n)},[r,a,n,s]),{active:o,rect:p,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function dD(e){let{animation:t,children:n}=e,[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),s=Lw(n);return!n&&!r&&s&&i(s),jw(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),l.default.createElement(l.default.Fragment,null,n,r?(0,l.cloneElement)(r,{ref:o}):null)}var fD={x:0,y:0,scaleX:1,scaleY:1};function pD(e){let{children:t}=e;return l.default.createElement(KE.Provider,{value:GE},l.default.createElement(eD.Provider,{value:fD},t))}var mD={position:`fixed`,touchAction:`none`},hD=e=>Ww(e)?`transform 250ms ease`:void 0,gD=(0,l.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:u,transition:d=hD}=e;if(!s)return null;let f=i?u:{...u,scaleX:1,scaleY:1},p={...mD,width:s.width,height:s.height,top:s.top,left:s.left,transform:qw.Transform.toString(f),transformOrigin:i&&r?dT(r,s):void 0,transition:typeof d==`function`?d(r):d,...c};return l.default.createElement(n,{className:o,style:p,ref:t},a)}),_D=e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}},vD=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:qw.Transform.toString(t)},{transform:qw.Transform.toString(n)}]},yD={duration:250,easing:`ease`,keyframes:vD,sideEffects:_D({styles:{active:{opacity:`0`}}})};function bD(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Mw((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=RE(a);if(!c)return;let{transform:l}=Ew(a).getComputedStyle(a),u=bT(l);if(!u)return;let d=typeof t==`function`?t:xD(t);return UT(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function xD(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...yD,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var SD=0;function CD(e){return(0,l.useMemo)(()=>{if(e!=null)return SD++,SD},[e])}var wD=l.default.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=sD(),C=(0,l.useContext)(eD),w=CD(f?.id),T=ZE(o,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=SE(p),D=bD({config:r,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return l.default.createElement(pD,null,l.default.createElement(dD,{animation:D},f&&w?l.default.createElement(gD,{key:w,id:f.id,ref:O,as:s,activatorEvent:d,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:u,...i},transform:T},n):null))});function TD(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ED(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function DD(e){return e!==null&&e>=0}function OD(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function kD(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var AD={scaleX:1,scaleY:1},jD=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=MD(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...AD}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...AD}:a<r&&a>=i?{x:o.width+s,y:0,...AD}:{x:0,y:0,...AD}};function MD(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var ND=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=TD(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},PD={scaleX:1,scaleY:1},FD=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...PD}:null}let s=ID(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...PD}:r<t&&r>=a?{x:0,y:o.height+s,...PD}:{x:0,y:0,...PD}};function ID(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var LD=`Sortable`,RD=l.default.createContext({activeIndex:-1,containerId:LD,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ND,disabled:{draggable:!1,droppable:!1}});function zD(e){let{children:t,id:n,items:r,strategy:i=ND,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:u,measureDroppableContainers:d}=sD(),f=zw(LD,n),p=s.rect!==null,m=(0,l.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),h=o!=null,g=o?m.indexOf(o.id):-1,_=u?m.indexOf(u.id):-1,v=(0,l.useRef)(m),y=!OD(m,v.current),b=_!==-1&&g===-1||y,x=kD(a);jw(()=>{y&&h&&d(m)},[y,m,h,d]),(0,l.useEffect)(()=>{v.current=m},[m]);let S=(0,l.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:ED(m,c),strategy:i}),[g,f,x.draggable,x.droppable,b,m,_,c,p,i]);return l.default.createElement(RD.Provider,{value:S},t)}var BD=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return TD(n,r,i).indexOf(t)},VD=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},HD={duration:200,easing:`ease`},UD=`transform`,WD=qw.Transition.toString({property:UD,duration:0,easing:`linear`}),GD={roleDescription:`sortable`};function KD(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,l.useState)(null),s=(0,l.useRef)(n);return jw(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=CT(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,l.useEffect)(()=>{a&&o(null)},[a]),a}function qD(e){let{animateLayoutChanges:t=VD,attributes:n,disabled:r,data:i,getNewIndex:a=BD,id:o,strategy:s,resizeObserverConfig:c,transition:u=HD}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,l.useContext)(RD),b=JD(r,m),x=d.indexOf(o),S=(0,l.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...i}),[f,i,x,d]),C=(0,l.useMemo)(()=>d.slice(d.indexOf(o)),[d,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=uD({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=oD({id:o,data:S,attributes:{...GD,...n},disabled:b.draggable}),R=Sw(D,M),z=!!O,B=z&&!h&&DD(p)&&DD(_),V=!v&&P,H=B?(V&&B?L:null)??(s??y)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:_,index:x}):null,ee=DD(p)&&DD(_)?a({id:o,items:d,activeIndex:p,overIndex:_}):x,te=O?.id,U=(0,l.useRef)({activeId:te,items:d,newIndex:ee,containerId:f}),W=d!==U.current.items,ne=t({active:O,containerId:f,isDragging:P,isSorting:z,id:o,index:x,items:d,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:u,wasDragging:U.current.activeId!=null}),re=KD({disabled:!ne,index:x,node:T,rect:w});return(0,l.useEffect)(()=>{z&&U.current.newIndex!==ee&&(U.current.newIndex=ee),f!==U.current.containerId&&(U.current.containerId=f),d!==U.current.items&&(U.current.items=d)},[z,ee,f,d]),(0,l.useEffect)(()=>{if(te===U.current.activeId)return;if(te!=null&&U.current.activeId==null){U.current.activeId=te;return}let e=setTimeout(()=>{U.current.activeId=te},50);return()=>clearTimeout(e)},[te]),{active:O,activeIndex:p,attributes:j,data:S,rect:w,index:x,newIndex:ee,items:d,isOver:E,isSorting:z,isDragging:P,listeners:N,node:T,overIndex:_,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:re??H,transition:ie()};function ie(){if(re||W&&U.current.newIndex===x)return WD;if(!(V&&!Ww(k)||!u)&&(z||ne))return qw.Transition.toString({...u,property:UD})}}function JD(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}var YD=[$.Down,$.Right,$.Up,$.Left],XD=({nativeEvent:e})=>{let t=e.target;for(;t;){if(t.dataset&&t.dataset.noDnd)return!1;t=t.parentElement}return!0},ZD=class extends cE{static activators=[{eventName:`onMouseDown`,handler:XD}]},QD=class extends uE{static activators=[{eventName:`onTouchStart`,handler:XD}]},$D={distance:5},eO=({onDraggedIdChange:e,...t})=>{let[n,r]=l.default.useState(null),i=n?t.items.find(e=>e.id===n):null,[a,o]=l.default.useState(!1);(0,l.useEffect)(()=>{o(!0)},[]);let s=lT(cT(QD,{activationConstraint:$D}),cT(ZD,{activationConstraint:$D}));return(0,l.useEffect)(()=>{e(n)},[n,e]),a?(0,d.jsxs)(nD,{sensors:s,measuring:{droppable:{strategy:vE.Always}},onDragStart:e=>{let t=e.active.id;t&&r(t)},onDragEnd:e=>{r(null);let{active:n,over:i}=e;if(i&&n.id!==i.id){let e=n.data.current?.sortable.index,r=i.data.current?.sortable.index||0;t.onReorder(e,r)}},id:`${t.sortableID}`,children:[(0,d.jsx)(zD,{id:t.sortableID,items:[...t.items],strategy:t.direction===`horizontal`?jD:FD,children:t.children}),(0,u.createPortal)((0,d.jsx)(wD,{wrapperElement:`ul`,children:n&&i?t.dragOverlayItem:null}),document.body)]}):null},tO=eO;function nO(e){let{listeners:t,setNodeRef:n,transform:r,transition:i,isDragging:a}=qD({id:e.id});return(0,d.jsx)(`li`,{ref:n,style:{transform:qw.Transform.toString(r),transition:i},...t,className:Y(`cursor-pointer relative`,{"opacity-75":a},e.className),children:e.children})}const rO=({itemId:e})=>{let{canDelete:t,deleteItem:n}=iw({itemId:e});return(0,d.jsxs)(uw,{disabled:!t,onSelect:e=>{e.preventDefault(),n()},children:[(0,d.jsx)(tb,{className:`size-4 mr-2 text-destructive`}),`Delete`]})};function iO({className:e,...t}){return(0,d.jsx)(`kbd`,{"data-slot":`kbd`,className:Y(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function aO({className:e,...t}){return(0,d.jsx)(`kbd`,{"data-slot":`kbd-group`,className:Y(`inline-flex items-center gap-1`,e),...t})}var oO=e=>{let t=e;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t?.isContentEditable===!0||t?.closest(`[contenteditable="true"]`)!==null},sO=e=>{let t=e instanceof HTMLElement?e.closest(`[data-group-list-target]`):null;if(!t)return null;let n=t.dataset.groupListTarget;return n===`back`?{kind:`back`}:n===`add`?{kind:`add`}:n===`item`&&t.dataset.groupListItemId?{kind:`item`,itemId:t.dataset.groupListItemId}:null},cO=(e,t)=>e.kind===t.kind&&(e.kind!==`item`||t.kind!==`item`||e.itemId===t.itemId),lO=(e,t)=>[...t?[{kind:`back`}]:[],...e.map(e=>({kind:`item`,itemId:e})),{kind:`add`}],uO=e=>{switch(e.kind){case`back`:return`[data-group-list-target="back"]`;case`add`:return`[data-group-list-target="add"]`;case`item`:return`[data-group-list-target="item"][data-group-list-item-id="${CSS.escape(e.itemId)}"]`}},dO=(e,t)=>{e.querySelector(uO(t))?.focus()},fO=(e,t,n)=>e&&n.includes(e)?{kind:`item`,itemId:e}:t?{kind:`back`}:n.length>0?{kind:`item`,itemId:n[0]}:{kind:`add`},pO=e=>{e instanceof HTMLElement&&e.closest(`[data-group-list-target]`)?.click()};const mO=({addItemDialogOpen:e,containerRef:t,groupId:n,itemIds:r,hasParentGroup:i,clipboardValue:a,previewItemId:o,openAddDialogForCurrentGroup:s,openFocusedItem:c,openParentGroup:u,selectPreviewItem:d,moveItemByOffset:f,parseSurveyItemClipboard:p,pasteItemFromClipboardData:m,onPasteCommitted:h,copyItemToClipboard:g})=>{let _=(0,l.useCallback)(()=>{n&&(async()=>{let e=a;try{e=await navigator.clipboard.readText()}catch{}let t=p(e);if(t)try{h(m(t,n))}catch(e){console.error(`Error pasting item:`,e),Z.error(`Failed to paste item from clipboard`)}})()},[a,n,h,p,m]),v=(0,l.useCallback)(()=>{if(!o){Z.info(`Select an item in the above list to copy`);return}g(o)},[g,o]),y=(0,l.useCallback)((e,t,n)=>{let a=n??fO(o,i,r);if(n||dO(t,a),e===`ArrowUp`||e===`ArrowDown`){let n=lO(r,i),o=n.findIndex(e=>cO(e,a));if(o<0||n.length<1)return;dO(t,n[(o+(e===`ArrowUp`?-1:1)+n.length)%n.length]);return}a.kind===`item`&&f(a.itemId,e===`ArrowLeft`?-1:1)&&requestAnimationFrame(()=>{dO(t,a)})},[i,r,f,o]),b=(0,l.useCallback)(e=>({"data-group-list-target":`item`,"data-group-list-item-id":e,onFocus:()=>{d(e)}}),[d]),x=(0,l.useCallback)(()=>({"data-group-list-target":`back`}),[]),S=(0,l.useCallback)(()=>({"data-group-list-target":`add`}),[]),C=(0,l.useCallback)(t=>{if(e||oO(t.target))return;let n=t.currentTarget,r=sO(t.target);if(t.metaKey||t.ctrlKey)switch(t.key.toLowerCase()){case`enter`:t.preventDefault(),s();return;case`v`:t.preventDefault(),_();return;case`c`:t.preventDefault(),v();return;default:return}if(r)switch(t.key){case`ArrowUp`:case`ArrowDown`:t.preventDefault(),y(t.key,n,r);return;case`ArrowLeft`:case`ArrowRight`:t.preventDefault(),y(t.key,n,r);return;case`Enter`:case` `:if(t.preventDefault(),r.kind===`item`){c(r.itemId);return}if(r.kind===`back`){u();return}pO(t.target);return;default:return}},[e,y,v,_,s,c,u]),w=(0,l.useEffectEvent)(n=>{let r=t.current;if(!(!r||e||oO(n.target)||r.contains(n.target))){if(n.metaKey||n.ctrlKey)switch(n.key.toLowerCase()){case`enter`:n.preventDefault(),s();return;case`c`:n.preventDefault(),v();return;case`v`:n.preventDefault(),_();return;default:return}switch(n.key){case`ArrowUp`:case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:n.preventDefault(),y(n.key,r,null);return;default:return}}});return(0,l.useEffect)(()=>(document.addEventListener(`keydown`,w),()=>{document.removeEventListener(`keydown`,w)}),[]),{getItemButtonProps:b,getBackButtonProps:x,getAddButtonProps:S,onListKeyDown:C}};var hO=()=>(0,d.jsxs)(`svg`,{viewBox:`0 0 220 180`,className:`text-slate-400 h-24 w-36`,fill:`none`,"aria-hidden":`true`,children:[(0,d.jsx)(`rect`,{x:`48`,y:`16`,width:`124`,height:`148`,rx:`14`,fill:`currentColor`,fillOpacity:`0.12`,stroke:`currentColor`,strokeWidth:`3`}),(0,d.jsx)(`rect`,{x:`76`,y:`7`,width:`68`,height:`14`,rx:`10`,fill:`#94A3B8`}),(0,d.jsx)(`rect`,{x:`65`,y:`52`,width:`72`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.2`}),(0,d.jsx)(`rect`,{x:`65`,y:`72`,width:`94`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.16`}),(0,d.jsx)(`rect`,{x:`65`,y:`92`,width:`66`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.18`})]}),gO=({children:e})=>(0,d.jsxs)(fb,{children:[(0,d.jsx)(pb,{asChild:!0,children:e}),(0,d.jsxs)(mb,{align:`center`,side:`bottom`,className:`flex gap-1 flex-col`,children:[(0,d.jsx)(`span`,{className:`text-nowrap`,children:`Add a new item to the group:`}),(0,d.jsxs)(aO,{children:[(0,d.jsx)(iO,{children:`Cmd+Enter`}),(0,d.jsx)(iO,{children:`Ctrl+Enter`})]})]})]}),_O=()=>{let e=X(e=>e.copyItem),t=X(e=>e.editorItemRegistry),n=X(e=>e.updateItem),r=X(e=>e.commitByUser),i=X(e=>e.pasteItem),{selectedItemId:a,navigateToItem:o}=ex(),s=$b(),{addItemDialogOpen:c,openAddItemDialog:u,preferredPreviewItemId:f,setPreferredPreviewItemId:p}=Nx(),[m,h]=Ax(),g=(0,l.useRef)(null),_=(0,l.useRef)(c),v=(0,l.useRef)(null),y=(0,l.useRef)(null),[b,x]=(0,l.useState)(null),S=(0,l.useMemo)(()=>!s||a&&s.surveyItems.get(a)instanceof $m?a:s.rootItem?.id,[a,s]),C=(0,l.useMemo)(()=>{if(!s||!S)return null;let e=s.surveyItems.get(S);return e instanceof $m?e:null},[S,s]),w=(0,l.useCallback)(e=>{if(!e)return null;try{let t=JSON.parse(e);return Gg.isValidClipboardData(t)?t:null}catch{return null}},[]),T=(0,l.useMemo)(()=>w(m),[m,w]),E=(0,l.useMemo)(()=>T?T.items.find(e=>e.itemId===T.rootItemId)?.itemData??null:null,[T]),D=(0,l.useMemo)(()=>E?E.metadata?.itemLabel?`${E.key} - ${E.metadata.itemLabel}`:E.key||E.itemType:null,[E]),O=(0,l.useMemo)(()=>E?OC(E.itemType,t)?.label??E.itemType:null,[E,t]),k=(0,l.useMemo)(()=>{if(!C||!s)return null;let e=s.rootItem?.id;if(!e||C.id===e)return null;let t=s.getParentItem(C.id);return t instanceof $m?t.id:null},[C,s]),A=(0,l.useCallback)(()=>{S&&u(S)},[S,u]),j=(0,l.useCallback)(t=>{try{let n=e(t);navigator.clipboard.writeText(JSON.stringify(n,null,2)).then(()=>{h(),Z.success(`Item copied to clipboard`)}).catch(()=>{Z.error(`Failed to copy item to clipboard`)})}catch(e){console.error(`Error copying item:`,e),Z.error(`Failed to copy item`)}},[e,h]),M=(0,l.useCallback)(()=>{!k||!C||(p(C.id),o(k))},[C,o,k,p]),N=(0,l.useCallback)(e=>{let t=s?.surveyItems.get(e);!t||t.type===Ym.PageBreak||(p(null),o(e))},[o,p,s]),P=(0,l.useCallback)((e,t)=>{if(!C)return!1;let i=C.items.indexOf(e),a=i+t;return i<0||a<0||a>=C.items.length?!1:(C.swapItemsByIndex(i,a),n(C.id,C.rawItem),r({label:`Move item`}),p(e),!0)},[r,C,p,n]),F=(0,l.useMemo)(()=>{let e=C?.items??[];return e.length<1?null:f&&e.includes(f)?f:e[0]},[C?.items,f]);(0,l.useEffect)(()=>{h()},[h]),(0,l.useEffect)(()=>{let e=()=>{h()};return window.addEventListener(`focus`,e),()=>{window.removeEventListener(`focus`,e)}},[h]),(0,l.useEffect)(()=>{let e=g.current;if(g.current=S??null,!C||!e||e===C.id)return;let t=C.items??[];if(!(f&&t.includes(f))){if(t.includes(e)){p(e);return}f&&!t.includes(f)&&p(null)}},[S,C,f,p]),(0,l.useEffect)(()=>{let e=y.current,t=v.current;if(v.current=S??null,!e||c){_.current=c;return}let n=_.current&&!c,r=!e.contains(document.activeElement),i=t!==(S??null);if(_.current=c,!r&&!n&&!i)return;let a=F?`[data-group-list-target="item"][data-group-list-item-id="${CSS.escape(F)}"]`:k?`[data-group-list-target="back"]`:`[data-group-list-target="add"]`,o=0,s=0;return o=window.requestAnimationFrame(()=>{s=window.requestAnimationFrame(()=>{e.querySelector(a)?.focus({preventScroll:!0})})}),()=>{window.cancelAnimationFrame(o),window.cancelAnimationFrame(s)}},[c,S,F,k]);let{getAddButtonProps:I,getBackButtonProps:L,getItemButtonProps:R,onListKeyDown:z}=mO({addItemDialogOpen:c,containerRef:y,groupId:S,itemIds:C?.items??[],hasParentGroup:!!k,clipboardValue:m,previewItemId:F,openAddDialogForCurrentGroup:A,openFocusedItem:N,openParentGroup:M,selectPreviewItem:p,moveItemByOffset:P,parseSurveyItemClipboard:w,pasteItemFromClipboardData:(e,t)=>i(e,{parentId:t}),onPasteCommitted:e=>{r({label:`Paste item`}),p(e),h(),Z.success(`Item pasted from clipboard`)},copyItemToClipboard:j});if(!C||!s)return(0,d.jsx)(`p`,{children:`loading group item...`});let B=C.items?.map(e=>({id:e}))??[],V=b?B.find(e=>e.id===b):null,H=(e,n)=>{let r=B[e].id,i=s.surveyItems.get(r);if(!i)return null;let a={typeInfos:DC(i,t),color:wC(i)};return(0,d.jsxs)(ow,{children:[(0,d.jsx)(sw,{disabled:n,asChild:!0,children:(0,d.jsxs)(`button`,{className:Y(`flex items-center w-full gap-2 py-2 h-auto px-3 text-start group relative`,`hover:bg-muted backdrop-blur-xl transition-colors border rounded-lg`,a.typeInfos.defaultItemClassName,b===i.id&&!n&&`invisible`,{"font-bold ring-4 ring-ring/50":i.id===F}),style:{color:a.color,borderColor:a.color},onClick:n?void 0:()=>{p(i.id)},onDoubleClick:n?void 0:()=>{i.type!==Ym.PageBreak&&(p(null),o(i.id))},...n?{}:R(i.id),children:[(0,d.jsx)(`div`,{children:(0,d.jsx)(a.typeInfos.icon,{className:`size-4`})}),(0,d.jsxs)(`span`,{className:Y(`grow space-x-2`),children:[(0,d.jsx)(`span`,{className:Y(`font-mono text-sm`),style:{borderColor:a.color},children:i.type===Ym.PageBreak?`Page Break`:s.getItemKey(i.id)?.itemKey??i.id}),(0,d.jsx)(`span`,{className:`font-semibold italic`,children:i.metadata?.itemLabel})]}),(0,d.jsx)(`span`,{className:`absolute -left-4 top-0 hidden group-hover:flex items-center h-full`,children:(0,d.jsx)(py,{className:`size-4 text-muted-foreground`})})]})}),(0,d.jsxs)(lw,{className:`border-border`,children:[i.type!==Ym.PageBreak&&(0,d.jsx)(uw,{onClick:()=>{p(null),o(i.id)},children:(0,d.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(Ny,{className:`size-4`}),(0,d.jsx)(`span`,{className:`ml-2`,children:`Open`})]})}),(0,d.jsxs)(uw,{onClick:()=>{j(i.id)},children:[(0,d.jsx)(zv,{className:`size-4`}),(0,d.jsx)(`span`,{className:`ml-2`,children:`Copy`})]}),(0,d.jsx)(pw,{}),(0,d.jsx)(vw,{itemId:i.id}),(0,d.jsx)(pw,{}),(0,d.jsx)(rO,{itemId:i.id})]})]})},ee=(C.items?.length??0)<1,te=D?(0,d.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,d.jsx)(Vv,{className:`size-3.5 text-foreground/70`}),(0,d.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Insert:`}),(0,d.jsx)(`span`,{children:D}),O&&(0,d.jsxs)(`span`,{children:[`(`,O,`)`]})]}),(0,d.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,d.jsx)(`span`,{children:`Press`}),(0,d.jsx)(iO,{children:`Cmd+V`}),(0,d.jsx)(`span`,{children:`or`}),(0,d.jsx)(iO,{children:`Ctrl+V`}),(0,d.jsx)(`span`,{children:`to insert.`})]})]}):null;return(0,d.jsxs)(`div`,{className:`flex grow h-full min-h-0`,children:[(0,d.jsx)(`div`,{className:`flex-1 pt-2 px-4 pb-4 border-r border-border flex flex-col min-h-0`,children:(0,d.jsxs)(`div`,{className:`flex flex-col h-full min-h-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-2 shrink-0`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{children:(0,d.jsxs)(`h3`,{className:`font-semibold text-sm`,children:[`Items`,(0,d.jsxs)(`span`,{className:`text-sm text-muted-foreground ml-2`,children:[`(`,C.items?.length??0,`)`]})]})}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Double click on item to open it, drag and drop to reorder.`})]}),(0,d.jsx)(gO,{children:(0,d.jsx)(vm,{variant:`ghost`,size:`icon`,className:`-mr-2`,onClick:A,children:(0,d.jsx)(Ly,{className:`size-4`})})})]}),(0,d.jsxs)(`div`,{ref:y,className:`flex-1 min-h-0 overflow-y-auto -mx-4 px-4 space-y-4 py-4`,onKeyDown:z,children:[k&&(0,d.jsx)(`div`,{className:`mb-2`,children:(0,d.jsxs)(vm,{variant:`ghost`,size:`sm`,className:`-ml-2 text-muted-foreground w-full justify-start`,onClick:M,...L(),children:[(0,d.jsx)(Tv,{className:`size-4`}),`Back to parent`]})}),ee?(0,d.jsxs)(`div`,{className:`flex flex-col items-center text-center border border-dashed border-border rounded-lg p-8`,children:[(0,d.jsx)(hO,{}),(0,d.jsx)(`h4`,{className:`mt-5 text-base font-semibold text-muted-foreground`,children:`No items yet`}),(0,d.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs text-muted-foreground text-balance mb-4`,children:`Add questions, sections, or other elements to your questionnaire`}),(0,d.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-2`,children:[te,(0,d.jsx)(gO,{children:(0,d.jsxs)(vm,{variant:`default`,className:`border-dashed w-full`,onClick:A,...I(),children:[(0,d.jsx)(Ly,{className:`size-4`}),`Add item`]})})]})]}):(0,d.jsx)(tO,{sortableID:`items-of-${C.id}`,items:B,onDraggedIdChange:e=>{x(e)},onReorder:(e,t)=>{C.moveItemToIndex(B[e].id,t),n(C.id,C.rawItem),r({label:`Move item`})},dragOverlayItem:b&&V?H(B.findIndex(e=>e.id===b),!0):null,children:(0,d.jsx)(`ol`,{className:`space-y-1.5`,children:B.map((e,t)=>(0,d.jsx)(nO,{id:e.id,children:H(t,!1)},e.id))})}),!ee&&(0,d.jsx)(`div`,{className:`flex justify-center`,children:(0,d.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[te,(0,d.jsx)(gO,{children:(0,d.jsxs)(vm,{variant:`outline`,className:`border-dashed w-full`,onClick:A,...I(),children:[(0,d.jsx)(Ly,{className:`size-4`}),`Add item`]})})]})})]})]})}),(0,d.jsx)(`div`,{className:`flex-1 pt-2 px-4 pb-4 flex-col min-h-0 bg-muted/30 hidden @2xl/main:flex`,children:(0,d.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,d.jsx)(l.Suspense,{children:(0,d.jsx)(xw,{item:F?s.surveyItems.get(F):void 0,mode:`static`},F)})})})]})},vO=_O,yO=3,bO=400,xO=3,SO=e=>{let{value:t,onChange:n,placeholder:r,suggestionsAdapter:i=null}=e,[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(!1),[u,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(0),h=(0,l.useRef)(null),g=(0,l.useRef)(null),_=(0,l.useRef)(void 0),v=(0,l.useRef)(0),y=(0,l.useRef)(null),b=(0,l.useRef)(!1),x=(0,l.useRef)(!1),S=i!==null,C=(0,l.useCallback)(()=>{_.current&&=(clearTimeout(_.current),void 0)},[]),w=(0,l.useCallback)(()=>{v.current+=1,y.current?.abort(),y.current=null},[]),T=(0,l.useCallback)(()=>{C(),w(),o([]),c(!1),f(!1),m(0)},[w,C]),E=(0,l.useCallback)(async(t,n)=>{if(!i){T();return}w();let r=v.current,a=new AbortController;y.current=a,f(!0);try{let s=n===`typing`?`background`:`user`,l=await i.onSuggest(t,n,{signal:a.signal,mode:s});if(r!==v.current)return;let u=e.maxSuggestions??i.maxSuggestions??xO,d=t.trim().length>0?[{id:`__input__`,text:t}]:[],f=l.slice(0,Math.max(0,u-d.length)),p=[...d,...f];o(p),c(p.length>0),m(0)}catch(e){if(e?.name===`AbortError`||r!==v.current)return;o([]),c(!1)}finally{r===v.current&&(f(!1),y.current=null)}},[w,T,e.maxSuggestions,i]);(0,l.useEffect)(()=>{g.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[p]),(0,l.useEffect)(()=>{s&&h.current?.focus()},[s]),(0,l.useEffect)(()=>()=>{C(),w()},[w,C]),(0,l.useEffect)(()=>{if(!S){T();return}if(b.current){b.current=!1,T();return}if(!x.current)return;x.current=!1,C();let e=i?.minChars??yO,n=i?.debounceMs??bO;if(t.length>=e){_.current=setTimeout(()=>{E(t,`typing`)},n);return}T()},[S,C,T,E,i,t]);let D=e=>{b.current=!0,n(e.text),c(!1),h.current?.focus()};return(0,d.jsxs)(yb,{open:S?s:!1,onOpenChange:e=>c(S&&e),children:[(0,d.jsx)(Sb,{asChild:!0,children:(0,d.jsxs)(`div`,{className:Y(`relative w-full`,e.containerClassName),children:[(0,d.jsx)(d_,{type:`text`,className:Y(e.className,S?`pr-9`:``),value:t,onChange:e=>{x.current=!0,n(e.target.value)},onKeyDown:t=>{if(s&&a.length>0)switch(t.key){case`ArrowDown`:t.preventDefault(),m(e=>(e+1)%a.length);return;case`ArrowUp`:t.preventDefault(),m(e=>(e-1+a.length)%a.length);return;case`Enter`:case`Tab`:if(a[p]){t.preventDefault(),D(a[p]);return}break;case`Escape`:t.preventDefault(),t.stopPropagation(),c(!1);return;default:break}e.onKeyDown?.(t)},onBlur:t=>{t.relatedTarget?.dataset.aiPopoverInteractive!==`true`&&e.onBlur?.(t)},ref:h,id:e.id,autoComplete:e.autoComplete,autoFocus:e.autoFocus,disabled:e.disabled,placeholder:r}),S&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>{c(!0),E(t||``,`manual`)},disabled:u||e.disabled,"data-ai-popover-interactive":`true`,className:Y(`absolute right-[2px] top-1/2 -translate-y-1/2 flex items-center justify-center p-0.5 rounded hover:bg-muted/50 hover:text-muted-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,e.aiButtonClassName),"aria-label":`Get AI suggestions`,children:u?(0,d.jsx)(Ty,{className:`size-4 text-muted-foreground animate-spin`}):(0,d.jsx)(Gy,{className:`size-4 text-muted-foreground/70`})})]})}),(0,d.jsx)(xb,{className:Y(`w-(--radix-popover-trigger-width) min-w-0 p-0 border-border`,e.popoverContentClassName),align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),h.current?.focus()},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),c(!1),h.current?.focus()},children:(0,d.jsxs)(`div`,{className:`max-h-64 overflow-hidden flex flex-col`,children:[(0,d.jsx)(`div`,{className:`px-3 py-2 border-b border-border bg-muted/50 shrink-0`,children:(0,d.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:u?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Ty,{className:`size-3.5 animate-spin shrink-0`}),(0,d.jsx)(`span`,{children:`Getting AI suggestions…`})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Gy,{className:`size-3.5 shrink-0`}),(0,d.jsx)(`span`,{children:`AI suggestions`})]})})}),(0,d.jsx)(`div`,{className:`overflow-y-auto`,children:a.length===0&&!u?(0,d.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No suggestions found`}):a.map((e,t)=>(0,d.jsxs)(`button`,{ref:t===p?g:void 0,type:`button`,"data-ai-popover-interactive":`true`,onClick:()=>D(e),onMouseEnter:()=>m(t),className:`w-full px-2.5 py-2 text-left transition-colors border-b border-border last:border-b-0 flex items-start justify-between gap-2
|
|
59
|
-
${t===p?`bg-accent text-accent-foreground`:`hover:bg-muted/50`}`,children:[(0,d.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,d.jsxs)(`p`,{className:`text-sm text-foreground wrap-break-word flex items-center gap-2`,children:[(0,d.jsx)(`span`,{children:e.text}),(0,d.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,e.id===`__input__`?`Your input`:`AI`,e.label&&(0,d.jsxs)(d.Fragment,{children:[` • `,e.label]}),`)`]})]})}),t===p&&(0,d.jsx)(xv,{className:`size-4 text-muted-foreground shrink-0 mt-0.5`})]},e.id))}),(0,d.jsx)(`div`,{className:`px-3 py-2 border-t border-border bg-muted/30 shrink-0`,children:(0,d.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded`,children:`↑`}),(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded ml-0.5`,children:`↓`}),(0,d.jsx)(`span`,{className:`mx-1`,children:`navigate`}),(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded mx-1`,children:`Enter`}),(0,d.jsx)(`span`,{children:`select`}),(0,d.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded mx-1`,children:`Esc`}),(0,d.jsx)(`span`,{children:`close`})]})})]})})]})},CO=SO,wO=e=>{let t=vb(),n=$b(),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(e.itemLabel),s=(0,l.useRef)(e.itemLabel),c=(0,l.useRef)(null);(0,l.useEffect)(()=>{!r&&c.current&&c.current.focus()},[r]);let u=(0,l.useEffectEvent)(t=>{o(e.itemLabel),s.current=e.itemLabel,i(t)});(0,l.useEffect)(()=>{r&&e.itemLabel!==s.current&&u(!1)},[e.itemLabel,r]);let f=(0,l.useMemo)(()=>{let r=t?.suggestItemLabel;if(!r||!n)return null;let i=e.maxSuggestions??3;return{minChars:3,debounceMs:400,maxSuggestions:i,onSuggest:async(t,a,o)=>{let s=Wg(n,{purpose:`label-suggestion`,focusItemId:e.itemId});return(await r({draftLabel:t,itemType:e.itemType,locale:`en`,maxSuggestions:i,context:s},{signal:o?.signal,mode:o?.mode})).suggestions.map((e,t)=>({id:`item-label-suggestion-${t}-${e.text}`,text:e.text,label:e.tone}))}}},[t?.suggestItemLabel,e.itemId,e.itemType,e.maxSuggestions,n]),p=t=>{t!==e.itemLabel&&e.onChangeItemLabel(t)},m=()=>{e.itemLabel===s.current&&p(a)};if(!r){let t=e.itemLabel;return(0,d.jsxs)(`button`,{ref:c,type:`button`,className:Y(`group flex items-center gap-1.5`,`font-medium text-xs leading-6`,`cursor-pointer`,`h-full w-full rounded-md px-2 text-center hover:underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30`),onClick:()=>{o(e.itemLabel),s.current=e.itemLabel,i(!0)},children:[(0,d.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[t,t.length<1&&(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:`(click here to add item label)`})]}),(0,d.jsx)(Fy,{className:`size-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100`})]})}return(0,d.jsx)(`div`,{className:`h-full w-full max-h-6 flex items-center`,children:(0,d.jsx)(CO,{value:a,onChange:o,id:`new-item-label`,containerClassName:`w-full h-full`,autoComplete:`off`,autoFocus:!0,className:Y(`w-full max-h-6 rounded-md border-none bg-transparent px-2 text-center pl-6 text-xs font-medium shadow-none`,`focus:border-none focus:outline-none focus-visible:border-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30`),aiButtonClassName:`rounded-sm p-1 hover:bg-muted/60 size-5`,popoverContentClassName:`z-[70]`,placeholder:`Enter item label`,suggestionsAdapter:f,onBlur:()=>{i(!1),m()},onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),o(e.itemLabel),i(!1)),t.key===`Enter`&&(t.preventDefault(),m(),i(!1))}})})},TO=wO,EO=[[`UPDATED`,`ALT`,`V2`,`DRAFT`],[`NEXT`,`CLEAN`,`REFINED`,`CANDIDATE`],[`FINAL`,`REVIEW`,`COPY`,`LATEST`]],DO=e=>e.trim().toUpperCase().replace(/[.\s]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``),OO=24,kO=e=>{if(!e)return[];let t=[],n=e=>{for(let r of e.descendants){if(t.length>=OO)return;let e=[r.fullKey,r.itemLabel].filter(Boolean).join(` | `);e.length>0&&t.push(e);for(let e of r.translations){if(t.length>=OO)break;t.push(`${r.fullKey} | ${e.locale}.${e.contentKey}: ${e.text}`)}n(r)}};return n(e),t.slice(0,OO)},AO=({source:e,seed:t,isValid:n})=>{let r=DO(e||`item`);if(r.length===0)return[];let i=EO[t%EO.length],a=[...i.slice(t%i.length),...i.slice(0,t%i.length)],o=[`${r}_${a[0]}`,`${r}_${a[1]}`,`${r}_${a[2]}`,`${r}_${a[3]}`,`${r}_v${t+2}`,`new_${r}`].map(DO);return Array.from(new Set(o)).filter(n).slice(0,5)},jO=e=>{let t=vb(),n=$b(),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(e.currentItemKey?.itemKey??``),[s,c]=(0,l.useState)(!1),[u,f]=(0,l.useState)(0),[p,m]=(0,l.useState)([]),[h,g]=(0,l.useState)(!1),_=(0,l.useRef)(0),v=(0,l.useRef)(null),y=e.currentItemKey?.itemKey??``,b=t=>t===y?`Key is the same as the current key`:e.siblingKeys.some(e=>e===t)?`Key already exists in the group, cannot use duplicate keys.`:t.includes(`.`)?`Key cannot contain dots`:t.includes(` `)?`Key cannot contain spaces`:t.length===0?`Key cannot be empty`:null,x=b(a),S=(e,t)=>{m(AO({source:e||y,seed:t,isValid:e=>b(e)===null}))},C=async(r,i)=>{let a=++_.current;v.current?.abort();let o=new AbortController;v.current=o,g(!0);try{let s=[];if(t?.suggestItemKey&&n){let i=Wg(n,{purpose:`key-suggestion`,focusItemId:e.itemId}),c=kO(i.focusItem),l=await t.suggestItemKey({draftKey:r,currentKey:y,siblingKeys:e.siblingKeys,childContentHints:c,maxSuggestions:5,context:i},{signal:o.signal,mode:`user`});if(a!==_.current)return;s=Array.from(new Set(l.suggestions.map(e=>DO(e.text)))).filter(e=>b(e)===null).slice(0,5)}if(s.length===0&&(s=AO({source:r||y,seed:i,isValid:e=>b(e)===null})),a!==_.current)return;m(s)}catch(e){if(e?.name===`AbortError`||a!==_.current)return;S(r,i)}finally{a===_.current&&g(!1),v.current===o&&(v.current=null)}},w=()=>{let t=a;if(t===y){i(!1);return}if(b(t)){c(!0);return}e.onChangeItemKey(t),i(!1)},T=()=>{o(y),i(!1)};return(0,d.jsx)(`div`,{className:`h-full w-full flex items-center`,children:(0,d.jsxs)(yb,{open:r,onOpenChange:e=>{if(i(e),e){o(y),c(!1),f(0),C(y,0);return}_.current+=1,v.current?.abort(),v.current=null,g(!1)},children:[(0,d.jsx)(bb,{asChild:!0,children:(0,d.jsxs)(`button`,{className:Y(`group flex h-full min-h-6 w-full items-center gap-1.5 cursor-pointer rounded-none bg-transparent px-1.5 text-left transition-opacity`,`hover:underline underline-offset-2 hover:opacity-90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60 focus-visible:ring-inset`),children:[(0,d.jsx)(`span`,{className:`block truncate font-mono text-sm leading-none text-white`,children:y||`(no-key)`}),(0,d.jsx)(Fy,{className:`size-3.5 shrink-0 text-white/70 opacity-0 transition-opacity group-hover:opacity-100`})]})}),(0,d.jsxs)(xb,{className:`w-[min(36rem,calc(100vw-1rem))] overflow-hidden rounded-xl border-border p-0 shadow-xl`,side:`bottom`,align:`start`,children:[(0,d.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,d.jsx)(`h3`,{className:`text-sm font-semibold tracking-tight`,children:`Key editor`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Define the coding key for this item.`})]}),(0,d.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,d.jsx)(f_,{htmlFor:`keyInput`,className:`text-xs font-medium text-muted-foreground`,children:`Key`}),(0,d.jsx)(d_,{id:`keyInput`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),w()):e.key===`Escape`&&(e.preventDefault(),T())},placeholder:`Enter new key`,autoFocus:!0,className:`h-8 rounded-lg border-border bg-muted/20 px-2.5 font-mono text-sm shadow-none`}),s&&x&&(0,d.jsx)(`p`,{className:`text-xs font-medium text-destructive`,children:x}),e.currentItemKey?.isRoot?(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Survey root item`}):(0,d.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Parent full key: `,(0,d.jsx)(`span`,{className:`font-mono`,children:e.currentItemKey?.parentFullKey??``})]})]}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,d.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Suggestions`}),(0,d.jsxs)(vm,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-1.5 text-xs`,disabled:h,onClick:()=>{let e=u+1;f(e),C(a,e)},children:[h?(0,d.jsx)(Ty,{className:`size-3.5 animate-spin`}):(0,d.jsx)(Vy,{className:`size-3.5`}),`Regenerate`]})]}),(0,d.jsx)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-1.5`,children:h?(0,d.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground`,children:[(0,d.jsx)(Ty,{className:`size-3 animate-spin`}),`Generating suggestions...`]}):p.length>0?p.map(e=>(0,d.jsx)(`button`,{type:`button`,className:Y(`rounded-full border border-border bg-background px-2.5 py-1 font-mono text-xs transition-colors`,`hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,a===e&&`border-primary/60 bg-primary/10 text-foreground`),onClick:()=>{o(e),c(!1)},children:e},e)):(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No valid suggestions available. Try regenerate.`})})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t bg-muted/50 px-3 py-2 sm:px-4`,children:[(0,d.jsx)(vm,{type:`button`,variant:`outline`,size:`sm`,onClick:T,children:`Cancel`}),(0,d.jsx)(vm,{type:`button`,size:`sm`,onClick:w,disabled:x!==null,children:`Save`})]})]})]})})},MO=jO,NO=({surveyItem:e,...t})=>{let[n,r]=(0,l.useState)(t.navItems[0]?.id??``),i=X(e=>e.getItemDataCopy),a=X(e=>e.updateItem),o=X(e=>e.commitByUser),s=$b(),c=kC(TC(e)),u=wC(e),f=Qb(),p=(s?.getParentItem(e.id)?.items??[]).filter(t=>t!==e.id).map(e=>s?.getItemKey(e)?.itemKey).filter(e=>!!e);if(!f||!s)return null;let m=t.navItems.some(e=>e.id===n)?n:t.navItems[0]?.id??``,h=t.navItems.find(e=>e.id===m)??t.navItems[0],g=t.navItems.length>0,_=t.menu.items.length>0||!t.menu.hideDeleteItem,v=(n,r)=>(0,d.jsxs)(Mb,{side:n,align:r,className:`border-border`,children:[(0,d.jsx)(_w,{itemId:e.id}),_&&(0,d.jsx)(Rb,{}),t.menu.items,!t.menu.hideDeleteItem&&(0,d.jsxs)(d.Fragment,{children:[t.menu.items.length>0&&(0,d.jsx)(Rb,{}),(0,d.jsx)(aw,{})]})]});return(0,d.jsxs)(`div`,{className:Y(`w-full h-full flex gap-4 items-start relative overflow-y-hidden`,`flex-col @2xl/main:flex-row`),children:[(0,d.jsxs)(`div`,{className:Y(`h-full flex-1 overflow-hidden bg-background rounded-xl border border-border flex flex-col min-h-0`,`order-2 @2xl/main:order-1 w-full @2xl/main:w-auto`),children:[(0,d.jsx)(`div`,{className:`border-b border-border shrink-0`,children:(0,d.jsxs)(`div`,{className:`flex items-stretch flex-col`,children:[(0,d.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 px-3 py-1 text-white`,style:{backgroundColor:u},children:[c&&(0,d.jsx)(jC,{typeInfos:c,color:`#ffffff`,iconClassName:`size-4`}),(0,d.jsx)(`div`,{className:`min-w-0 flex flex-1 items-center`,children:(0,d.jsx)(MO,{itemId:e.id,currentItemKey:f?.survey.getItemKey(e.id),siblingKeys:p,onChangeItemKey:t=>{try{a(e.id,{key:t}),o({label:`Update item key`}),Z.success(`Item key updated.`)}catch(e){console.error(`Failed to update item key:`,e);let t=e instanceof Error?e.message:`Failed to update item key.`;Z.error(t)}}},e.id)}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1 @2xl/main:hidden`,children:[g&&h&&(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsxs)(vm,{variant:`ghost`,size:`sm`,className:`h-8 gap-1.5 rounded-md px-2 text-xs text-white hover:bg-white/15 focus-visible:ring-white/40`,children:[(0,d.jsx)(h.icon,{className:`size-3.5`}),(0,d.jsx)(`span`,{className:`max-w-32 truncate`,children:h.label}),(0,d.jsx)(kv,{className:`size-3.5 opacity-80`})]})}),(0,d.jsx)(Mb,{align:`end`,side:`bottom`,className:`min-w-44 border-border`,children:t.navItems.map(e=>(0,d.jsxs)(Pb,{onClick:()=>r(e.id),className:`gap-2`,children:[(0,d.jsx)(e.icon,{className:`size-4 text-muted-foreground`}),(0,d.jsx)(`span`,{className:`flex-1`,children:e.label}),m===e.id&&(0,d.jsx)(xv,{className:`size-4`})]},e.id))})]}),(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsx)(vm,{variant:`ghost`,size:`icon`,className:`size-8 rounded-md text-white hover:bg-white/15 focus-visible:ring-white/40`,children:(0,d.jsx)(Yv,{className:`size-4`})})}),v(`bottom`,`end`)]})]})]}),(0,d.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-4 py-0`,style:{backgroundColor:`${u}30`,borderColor:`${u}`},children:(0,d.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,d.jsx)(TO,{itemId:e.id,itemType:e.type,maxSuggestions:5,itemLabel:e.metadata?.itemLabel??``,onChangeItemLabel:t=>{let n=i(e.id);n&&(n.metadata={...n.metadata,itemLabel:t},a(e.id,n),o({label:`Update item label`}),Z.success(`Item label updated.`))}},e.id)})})]})}),(0,d.jsx)(QC,{value:m,onValueChange:r,className:`flex-1 flex flex-col w-full min-h-0`,children:t.children})]}),(0,d.jsx)(`div`,{className:Y(`hidden justify-end @2xl/main:flex p-px`,`w-full @2xl/main:w-fit @2xl/main:sticky`,`order-1 @2xl/main:order-2`),children:(0,d.jsx)(tx,{className:`shadow-none w-fit border-border p-0`,children:(0,d.jsxs)(nx,{className:`p-0 flex flex-row @2xl/main:flex-col`,children:[(0,d.jsx)(`div`,{className:`border-r border-border @2xl/main:border-b @2xl/main:border-r-0`,children:(0,d.jsxs)(kb,{children:[(0,d.jsx)(jb,{asChild:!0,children:(0,d.jsx)(vm,{variant:`ghost`,className:`ring-inset rounded-none size-9 rounded-s-xl @2xl/main:rounded-s-none @2xl/main:rounded-t-xl`,children:(0,d.jsx)(Yv,{className:`size-4`})})}),v(`left`,`start`)]})}),(0,d.jsx)(QC,{value:m,onValueChange:r,orientation:`vertical`,children:(0,d.jsx)(ew,{className:`flex rounded-l-none @2xl/main:rounded-b-lg @2xl/main:rounded-t-none flex-row @2xl/main:flex-col h-auto w-full bg-transparent p-0 @2xl/main:space-y-1 space-x-1 @2xl/main:space-x-0 focus-within:ring-inset focus-within:outline-none focus-within:ring focus-within:ring-ring/30 overflow-hidden`,children:t.navItems.map(e=>(0,d.jsxs)(fb,{children:[(0,d.jsx)(pb,{asChild:!0,children:(0,d.jsx)(tw,{value:e.id,className:Y(`relative rounded-none min-h-9 w-9 p-0 flex flex-col items-center justify-center hover:bg-muted/50 transition-colors focus:outline-none focus-visible:outline-none ring-inset ring-ring/30`,{"bg-primary text-primary-foreground hover:bg-primary/90":m===e.id}),title:e.label,children:(0,d.jsx)(e.icon,{className:`size-4`})},e.id)}),(0,d.jsx)(mb,{align:`center`,side:`left`,children:e.label})]},e.id))})})]})})})]})},PO=NO,FO=[{id:`items`,label:`Items`,icon:Cy},{id:`conditions`,label:`Conditions`,icon:dy,hasIndicator:!0,indicatorCount:3}],IO=e=>(0,d.jsxs)(PO,{surveyItem:e.item,menu:{items:[(0,d.jsx)(rw,{itemId:e.item.id},`copy-item`)]},navItems:FO,children:[(0,d.jsx)(nw,{value:`items`,className:`flex flex-col h-full min-h-0 overflow-hidden`,children:(0,d.jsx)(vO,{})}),(0,d.jsx)(nw,{value:`conditions`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: conditions tab`})]}),LO=IO,RO=[{id:`items`,label:`Items`,icon:Cy}],zO=e=>(0,d.jsxs)(PO,{surveyItem:e.item,menu:{hideDeleteItem:!0,items:[]},navItems:RO,children:[(0,d.jsx)(nw,{value:`items`,className:`flex flex-col h-full min-h-0`,children:(0,d.jsx)(vO,{})}),(0,d.jsx)(nw,{value:`preview`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: preview tab`}),(0,d.jsx)(nw,{value:`conditions`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: conditions tab`})]}),BO=zO,VO=[{id:`structure`,label:`Structure`,icon:Ny,hasIndicator:!1},{id:`preview`,label:`Preview`,icon:Zv,hasIndicator:!1},{id:`conditions`,label:`Conditions`,icon:ly,hasIndicator:!0,indicatorCount:3}],HO=e=>(0,d.jsxs)(PO,{surveyItem:e.item,menu:{items:[(0,d.jsx)(rw,{itemId:e.item.id},`copy-item`)]},navItems:VO,children:[(0,d.jsx)(nw,{value:`structure`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: structure tab`}),(0,d.jsx)(nw,{value:`preview`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: preview tab`}),(0,d.jsx)(nw,{value:`conditions`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:`todo: conditions tab`})]}),UO=HO,WO=()=>(0,d.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Single choice renderer is not configured.`}),GO=WO,KO=class extends Jm{type=`display`;parseConfig(e){return e??{}}serializeConfig(){return this.config}isInteractive(){return!1}getAvailableResponseValueSlots(){return{}}},qO=class extends Jm{type=`singleChoiceQuestion`;parseConfig(e){let t=e??{};return{id:t.id??this.id,options:Array.isArray(t.options)?t.options:[]}}serializeConfig(){return this.config}isInteractive(){return!0}getAvailableResponseValueSlots(){let e=this.config.id??this.id;return{[`${this.id}...get...${e}`]:xg.reference,[`${this.id}...isDefined...${e}`]:xg.boolean}}},JO=class extends Jm{type=`multipleChoiceQuestion`;parseConfig(e){let t=e??{};return{id:t.id??this.id,options:Array.isArray(t.options)?t.options:[]}}serializeConfig(){return this.config}isInteractive(){return!0}getAvailableResponseValueSlots(){let e=this.config.id??this.id;return{[`${this.id}...get...${e}`]:xg.referenceArray,[`${this.id}...isDefined...${e}`]:xg.boolean}}};function YO(e,t){return e&&e.trim().length>0?e:typeof t==`string`&&t.trim().length>0?t:``}const XO=({item:e,itemConfig:t,locale:n})=>{let r=e,i=t,a=Qb(),o=X(e=>e.editorItemRegistry),s=i?.items??r.items??[];return s.length===0?(0,d.jsx)(`div`,{className:`flex grow justify-center items-center text-center text-muted-foreground px-12 py-24 rounded-3xl border-2 border-dashed border-border`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-lg font-medium mb-2`,children:`Empty Group`}),(0,d.jsx)(`p`,{className:`text-sm`,children:`No items in this group yet`})]})}):a?(0,d.jsxs)(`div`,{className:`space-y-1 p-4 bg-muted/30 rounded-lg @container/group-preview`,children:[(0,d.jsxs)(`div`,{className:`text-sm block font-medium text-muted-foreground mb-2`,children:[(0,d.jsx)(`span`,{children:`Items`}),(0,d.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,s.length,`)`]})]}),(0,d.jsx)(`div`,{className:`space-y-1 hidden @sm/group-preview:block`,children:s.map(e=>{let t=a.survey.surveyItems.get(e);if(!t)return(0,d.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-red-50 rounded-lg border border-red-200`,children:[(0,d.jsx)(`div`,{className:`shrink-0 text-red-500`,children:(0,d.jsx)(jv,{className:`size-5`})}),(0,d.jsxs)(`div`,{className:`flex-1`,children:[(0,d.jsx)(`p`,{className:`font-mono text-sm font-medium text-red-700`,children:a.survey.getItemKey(e)?.itemKey}),(0,d.jsx)(`p`,{className:`text-xs text-red-600 mt-1`,children:`Item not found`})]})]},e);let r=DC(t,o),i=wC(t),s=YO(t.metadata?.itemLabel,a?.survey.getItemTranslations(t.id)?.getContent(n,`title`,`en`)?.content);return(0,d.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-white rounded-lg border border-border`,children:[(0,d.jsx)(`div`,{className:`shrink-0`,style:{color:i},children:(0,d.jsx)(r.icon,{className:`size-5`})}),(0,d.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`p`,{className:`font-mono text-sm font-medium truncate grow`,style:{color:i},children:t.type===Ym.PageBreak?`Page Break`:a.survey.getItemKey(e)?.itemKey}),s&&(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:s})]})})]},e)})}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 @sm/group-preview:hidden`,children:s.map((e,t)=>{let n=a.survey.surveyItems.get(e),r=a.survey.getItemKey(e)?.itemKey??`unknown`,i=n?wC(n):`#dc2626`,s=n?DC(n,o):void 0;return(0,d.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1.5`,children:[(0,d.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/70 bg-muted px-1 py-0.5 text-[10px] font-semibold leading-none text-muted-foreground`,"aria-label":`Item ${t+1}`,children:t+1}),(0,d.jsx)(`div`,{className:`shrink-0`,style:{color:i},children:n&&s?(0,d.jsx)(s.icon,{className:`size-4`}):(0,d.jsx)(jv,{className:`size-4`})}),(0,d.jsx)(`p`,{className:`truncate text-xs font-mono`,style:{color:i},children:n?.type===Ym.PageBreak?`Page Break`:r})]},e)})})]}):(0,d.jsx)(`div`,{className:`flex min-h-[220px] items-center justify-center rounded-xl border border-border/60 bg-muted/20`,children:(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading preview…`})})},ZO=({item:e,itemContent:t,locale:n})=>{let r=wC(e),i=DC(e,X(e=>e.editorItemRegistry)),a=t?.getContent(n,`title`,`en`),o=typeof a?.content==`string`&&a.content.trim().length>0?a.content:`Page break`;return(0,d.jsxs)(`div`,{className:`min-h-[220px] rounded-xl border-2 border-dashed border-border bg-muted/20 @container/page-break-preview`,children:[(0,d.jsxs)(`div`,{className:`hidden h-full min-h-[220px] items-center justify-center gap-4 px-6 @sm/page-break-preview:flex`,children:[(0,d.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-5 shadow-sm`,style:{color:r},children:(0,d.jsx)(i.icon,{className:`size-8`})}),(0,d.jsxs)(`div`,{className:`text-left`,children:[(0,d.jsx)(`p`,{className:`text-sm font-semibold tracking-wide`,style:{color:r},children:o}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Next items render on a new page.`})]})]}),(0,d.jsx)(`div`,{className:`flex h-full min-h-[220px] items-center justify-center @sm/page-break-preview:hidden`,children:(0,d.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-6 shadow-sm`,style:{color:r},children:(0,d.jsx)(i.icon,{className:`size-10`})})})]})};var QO=e=>{let t=new sh;return t.setContent(`en`,`title`,{type:Sg.CQM,content:e}),t},$O=e=>({id:e,options:[{id:Om(),key:`optionA`},{id:Om(),key:`optionB`}]});const ek=[{itemType:`root`,infos:{icon:ay,labelByLocale:{en:`Root`},descriptionByLocale:{en:`Survey root item.`},defaultItemClassName:`text-sky-800`,categories:[`structure`]},editorComponent:BO,previewComponent:XO,constructor:$m},{itemType:Ym.Group,infos:{icon:sy,labelByLocale:{en:`Group`},descriptionByLocale:{en:`A container for organizing survey items.`},defaultItemClassName:`text-sky-600`,categories:[`structure`]},editorComponent:LO,previewComponent:XO,constructor:$m,getInitialItem:()=>({rawItem:{id:Om(),key:Am(3),itemType:Ym.Group}})},{itemType:Ym.PageBreak,infos:{icon:qv,labelByLocale:{en:`Page break`},descriptionByLocale:{en:`Force items after this to appear on a new page.`},defaultItemClassName:`text-red-800`,categories:[`structure`]},previewComponent:ZO,constructor:eh,getInitialItem:()=>{let e=Om();return{rawItem:{id:e,key:e,itemType:Ym.PageBreak}}}},{itemType:`display`,constructor:KO,infos:{icon:yy,labelByLocale:{en:`Display`},descriptionByLocale:{en:`Show text or instructions without collecting responses.`},defaultItemClassName:`text-neutral-700`,categories:[`display`]},getInitialItem:()=>({rawItem:{id:Om(),key:Am(3),itemType:`display`,config:{}},translations:QO(`Display item`)})},{itemType:`singleChoiceQuestion`,constructor:qO,renderComponent:GO,infos:{icon:Nv,labelByLocale:{en:`Single choice`},descriptionByLocale:{en:`Allows the participant to select one option.`},defaultItemClassName:`text-fuchsia-800`,categories:[`question`]},editorComponent:UO,getInitialItem:()=>{let e=Om();return{rawItem:{id:e,key:Am(3),itemType:`singleChoiceQuestion`,config:$O(e)},translations:QO(`Single choice question`)}}},{itemType:`multipleChoiceQuestion`,constructor:JO,infos:{icon:qy,labelByLocale:{en:`Multiple choice`},descriptionByLocale:{en:`Allows the participant to select multiple options.`},defaultItemClassName:`text-indigo-800`,categories:[`question`]},editorComponent:UO,getInitialItem:()=>{let e=Om();return{rawItem:{id:e,key:Am(3),itemType:`multipleChoiceQuestion`,config:$O(e)},translations:QO(`Multiple choice question`)}}}];var tk,nk;function rk(e){return{...e,infos:e.infos?{...e.infos,labelByLocale:{...e.infos.labelByLocale},descriptionByLocale:{...e.infos.descriptionByLocale},categories:[...e.infos.categories]}:void 0,searchAdapters:e.searchAdapters?[...e.searchAdapters]:void 0}}function ik(e){return e.map(e=>rk(e))}function ak(e={}){let{includeDefaultEntries:t=!0,entries:n=[],conflictStrategy:r=`override`}=e,i=[],a=new Map,o=e=>{let t=a.get(e.itemType),n=rk(e);if(t===void 0){a.set(e.itemType,i.length),i.push(n);return}if(r===`error`)throw Error(`Duplicate item registry entry for type: ${e.itemType}`);i[t]=n};if(t)for(let e of ek)o(e);for(let e of n)o(e);return i}function ok(){return ik(ek)}function sk(e={}){return gx(ak(e),{requireBuiltInTypes:e.requireBuiltInTypes})}function ck(e={}){return mx(ak(e),{requireRenderer:e.requireRenderer})}function lk(){return tk||=gx(ek),tk}function uk(){return nk||=mx(ek),nk}function dk(){let e=0,t=()=>(e+=1,e);return Sm((e,n)=>({sessionId:null,editor:null,changeTick:0,editorItemRegistry:{coreRegistry:{},definitions:{}},selectedLocale:`en`,setEditor:(n,r)=>{e({sessionId:n,editor:r,selectedLocale:r?.survey.locales[0]??`en`,changeTick:t()})},clearEditor:()=>{e({sessionId:null,editor:null,selectedLocale:`en`,changeTick:t()})},startNewSession:({surveyKey:r,itemRegistryEntries:i})=>{let a=i,o=n().editorItemRegistry,s=Object.keys(o.definitions).length>0,c=a?gx(a):s?o:lk(),l=c.coreRegistry,u=lh.createBlankSurvey(l,r),d=new Yg(u,{pluginRegistry:l});e({sessionId:Om(),editor:d,editorItemRegistry:c,selectedLocale:u.locales[0]??`en`,changeTick:t()})},setEditorItemRegistry:n=>{e({editorItemRegistry:n,changeTick:t()})},setSelectedLocale:t=>{e({selectedLocale:t})},undo:()=>{let{editor:r}=n();if(!r)return!1;let i=r.undo();return i&&e({changeTick:t()}),i},redo:()=>{let{editor:r}=n();if(!r)return!1;let i=r.redo();return i&&e({changeTick:t()}),i},canUndo:()=>n().editor?.canUndo()??!1,canRedo:()=>n().editor?.canRedo()??!1,commit:r=>{n().editor?.commit(r),e({changeTick:t()})},commitByUser:r=>{n().editor?.commit({...r,source:Kg.USER}),e({changeTick:t()})},commitIfNeeded:()=>{let{editor:r}=n();r&&(r.commitIfNeeded(),e({changeTick:t()}))},jumpToIndexInHistory:r=>{let{editor:i}=n();if(!i)return!1;let a=i.jumpToIndex(r);return a&&e({changeTick:t()}),a},getUndoMeta:()=>n().editor?.getUndoMeta()??null,getRedoMeta:()=>n().editor?.getRedoMeta()??null,getUndoRedoHistory:()=>n().editor?.undoRedo.getHistory()??[],addItem:(r,i,a)=>{let{editor:o}=n();if(!o)throw Error(`No editor loaded`);o.addItem(r,i,a),e({changeTick:t()})},removeItem:(r,i=!1)=>{let{editor:a}=n();if(!a)return!1;let o=a.survey.getItemKey(r)?.fullKey??r,s=a.removeItem(r,i);return s&&!i&&a.commit({label:`Delete item: ${o}`,source:Kg.USER}),s&&e({changeTick:t()}),s},moveItem:(r,i)=>{let{editor:a}=n();if(!a)return!1;let o=a.moveItem(r,i);return o&&e({changeTick:t()}),o},updateItemTranslations:(r,i)=>{let{editor:a}=n();if(!a)return!1;let o=a.updateItemTranslations(r,i);return o&&e({changeTick:t()}),o},copyItem:e=>{let{editor:t}=n();if(!t)throw Error(`No editor loaded`);return t.copyItem(e)},pasteItem:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);let o=a.pasteItem(r,i);return e({changeTick:t()}),o},getItemDataCopy:e=>{let{editor:t}=n();if(!t)throw Error(`No editor loaded`);return t.getItemDataCopy(e)},getRootItem:()=>n().editor?.survey.rootItem,updateItem:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);a.updateItem(r,i),e({changeTick:t()})},updateSurveyTranslations:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateSurveyTranslations(r),e({changeTick:t()})},getMaxItemsPerPage:()=>n().editor?.getMaxItemsPerPage(),updateMaxItemsPerPage:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateMaxItemsPerPage(r),e({changeTick:t()})},getMetadata:()=>n().editor?.getMetadata(),updateMetadata:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateMetadata(r),e({changeTick:t()})},getTemplateValue:e=>n().editor?.getTemplateValue(e),getTemplateValues:()=>n().editor?.getTemplateValues()??new Map,setTemplateValue:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);a.setTemplateValue(r,i),e({changeTick:t()})},removeTemplateValue:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.removeTemplateValue(r),e({changeTick:t()})},getMemoryUsage:()=>n().editor?.getMemoryUsage()??{totalMB:0,entries:0},getUndoRedoConfig:()=>n().editor?.getUndoRedoConfig()??{}}))}const fk=({children:e})=>{let[t]=(0,l.useState)(()=>dk());return(0,d.jsx)(Tm.Provider,{value:t,children:e})},pk=({children:e,navigationAdapter:t=null})=>(0,d.jsx)(fk,{children:(0,d.jsx)(Kb,{adapter:t,children:e})});var mk=({initialEditorState:e,initialSessionId:t,fallbackLocale:n=`en`,itemRegistryEntries:r,onEditorStateChange:i,persistDebounceMs:a=500,helpLink:o=`https://case-framework.github.io/case-docs/`,aiProvider:s=null,onSaveRequested:c})=>{let u=X(e=>e.sessionId),f=X(e=>e.editor),p=X(e=>e.changeTick),m=X(e=>e.setEditor),h=X(e=>e.setEditorItemRegistry),g=X(e=>e.clearEditor),_=(0,l.useRef)(!1),v=(0,l.useMemo)(()=>r?gx(r):lk(),[r]),y=v.coreRegistry,b=(0,l.useEffectEvent)((e,t)=>{m(e,Yg.fromJson(t,y))});return(0,l.useEffect)(()=>{if(!e)return;let n=t!==void 0&&u!==null&&u!==t;if(_.current&&!n&&f)return;n&&(_.current=!1);let r=Yg.fromJson(e,y);b(t??Om(),r.toJson()),_.current=!0},[y,f,e,t,u]),(0,l.useEffect)(()=>()=>{g()},[g]),(0,l.useEffect)(()=>{h(v)},[v,h]),Xg({sessionId:u,editor:f,changeTick:p,persistDebounceMs:a,onEditorStateChange:i}),(0,d.jsx)(`div`,{className:`survey-editor absolute inset-0`,children:(0,d.jsx)(gb,{helpLink:o,aiProvider:s,fallbackLocale:n,children:(0,d.jsx)(ZC,{onSaveRequested:c})})})},hk=e=>(0,d.jsx)(pk,{navigationAdapter:e.navigationAdapter,children:(0,d.jsx)(mk,{...e})});function gk(e,t){return new Yg(lh.createBlankSurvey(e,t),{pluginRegistry:e}).toJson()}function _k(e,t){return new Yg(lh.fromJson(e,t),{pluginRegistry:t}).toJson()}function vk(e,t){let n=JSON.parse(e);if(Ck(n)){let e=Yg.fromJson(n,t);return{format:`serialized-editor`,sessionId:Om(),state:e.toJson()}}return{format:`raw-survey`,sessionId:Om(),state:_k(n,t)}}function yk(e){return JSON.stringify(e.survey,null,2)}function bk(e,t=`survey`){let n=Sk(e)?.trim();return n?xk(n):t}function xk(e){return e.replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``)||`survey`}function Sk(e){let t=e.survey.surveyItems.find(e=>!e||typeof e.key!=`string`||!e.config||typeof e.config!=`object`?!1:e.config.isRoot===!0);return t?.key?t.key:e.survey.surveyItems[0]?.key}function Ck(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.version==`string`&&typeof t.hasUncommittedChanges==`boolean`&&typeof t.undoRedo==`object`&&t.undoRedo!==null&&typeof t.survey==`object`&&t.survey!==null}var wk=o((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Tk=o((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,P=f,F=!1;function I(e){return F||(F=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),L(e)||x(e)===l}function L(e){return x(e)===u}function R(e){return x(e)===c}function z(e){return x(e)===s}function B(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function V(e){return x(e)===d}function H(e){return x(e)===i}function ee(e){return x(e)===h}function te(e){return x(e)===m}function U(e){return x(e)===r}function W(e){return x(e)===o}function ne(e){return x(e)===a}function re(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=P,e.isAsyncMode=I,e.isConcurrentMode=L,e.isContextConsumer=R,e.isContextProvider=z,e.isElement=B,e.isForwardRef=V,e.isFragment=H,e.isLazy=ee,e.isMemo=te,e.isPortal=U,e.isProfiler=W,e.isStrictMode=ne,e.isSuspense=re,e.isValidElementType=b,e.typeOf=x})()})),Ek=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=wk():t.exports=Tk()})),Dk=o(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),Ok=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),kk=o(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),Ak=o(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=Ok(),i={},a=kk();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),jk=o(((e,t)=>{var n=Ek(),r=Dk(),i=Ok(),a=kk(),o=Ak(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=F(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+P(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
59
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return d.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},as=Ro,os=Ho,ss=Wo,cs=Yo,ls=ts,us=rs,ds=Zo,fs=$o;function ps(e){let t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ms(e){let[t,n]=d.useState(void 0);return br(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var hs=`Checkbox`,[gs,_ee]=_r(hs),[_s,vs]=gs(hs);function ys(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:f}=e,[m,h]=Sr({prop:n,defaultProp:i??!1,onChange:c,caller:hs}),[g,_]=d.useState(null),[v,y]=d.useState(null),b=d.useRef(!1),x=g?!!o||!!g.closest(`form`):!0,S={checked:m,disabled:a,setChecked:h,control:g,setControl:_,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:b,required:l,defaultChecked:Ds(i)?!1:i,isFormControl:x,bubbleInput:v,setBubbleInput:y};return(0,p.jsx)(_s,{scope:t,...S,children:vee(f)?f(S):r})}var bs=`CheckboxTrigger`,xs=d.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:g}=vs(bs,e),_=Xn(i,u),v=d.useRef(c);return d.useEffect(()=>{let e=a?.form;if(e){let t=()=>f(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,p.jsx)(L.button,{type:`button`,role:`checkbox`,"aria-checked":Ds(c)?`mixed`:c,"aria-required":l,"data-state":Os(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:R(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:R(n,e=>{f(e=>Ds(e)?!0:!e),g&&h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})})});xs.displayName=bs;var Ss=d.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(ys,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(xs,{...d,ref:t,__scopeCheckbox:n}),e&&(0,p.jsx)(Es,{__scopeCheckbox:n})]})})});Ss.displayName=hs;var Cs=`CheckboxIndicator`,ws=d.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=vs(Cs,n);return(0,p.jsx)(Er,{present:r||Ds(a.checked)||a.checked===!0,children:(0,p.jsx)(L.span,{"data-state":Os(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ws.displayName=Cs;var Ts=`CheckboxBubbleInput`,Es=d.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:f,bubbleInput:m,setBubbleInput:h}=vs(Ts,e),g=Xn(n,h),_=ps(a),v=ms(r);d.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(_!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Ds(a),n.call(e,Ds(a)?!1:a),e.dispatchEvent(t)}},[m,_,a,i]);let y=d.useRef(Ds(a)?!1:a);return(0,p.jsx)(L.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??y.current,required:s,disabled:c,name:l,value:u,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Es.displayName=Ts;function vee(e){return typeof e==`function`}function Ds(e){return e===`indeterminate`}function Os(e){return Ds(e)?`indeterminate`:e?`checked`:`unchecked`}var yee=[`top`,`right`,`bottom`,`left`],ks=Math.min,As=Math.max,js=Math.round,Ms=Math.floor,Ns=e=>({x:e,y:e}),bee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ps(e,t,n){return As(e,ks(t,n))}function Fs(e,t){return typeof e==`function`?e(t):e}function Is(e){return e.split(`-`)[0]}function Ls(e){return e.split(`-`)[1]}function Rs(e){return e===`x`?`y`:`x`}function zs(e){return e===`y`?`height`:`width`}function Bs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Vs(e){return Rs(Bs(e))}function Hs(e,t,n){n===void 0&&(n=!1);let r=Ls(e),i=Vs(e),a=zs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Zs(o)),[o,Zs(o)]}function Us(e){let t=Zs(e);return[Ws(e),t,Ws(t)]}function Ws(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Gs=[`left`,`right`],Ks=[`right`,`left`],qs=[`top`,`bottom`],Js=[`bottom`,`top`];function Ys(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ks:Gs:t?Gs:Ks;case`left`:case`right`:return t?qs:Js;default:return[]}}function Xs(e,t,n,r){let i=Ls(e),a=Ys(Is(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ws)))),a}function Zs(e){let t=Is(e);return bee[t]+e.slice(t.length)}function Qs(e){return{top:0,right:0,bottom:0,left:0,...e}}function $s(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Qs(e)}function ec(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function tc(e,t,n){let{reference:r,floating:i}=e,a=Bs(t),o=Vs(t),s=zs(o),c=Is(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ls(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function nc(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Fs(t,e),p=$s(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ec(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ec(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var rc=50,ic=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:nc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=tc(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<rc&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=tc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ac=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Fs(e,t)||{};if(l==null)return{};let d=$s(u),f={x:n,y:r},p=Vs(i),m=zs(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=ks(d[_],T),D=ks(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,A=Ps(O,k,ee),j=!c.arrow&&Ls(i)!=null&&k!==A&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,M=j?k<O?k-O:k-ee:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),oc=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Fs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Is(r),_=Bs(o),v=Is(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Zs(o)]:Us(o)),x=p!==`none`;!d&&x&&b.push(...Xs(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Hs(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Bs(t))||T.every(e=>Bs(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Bs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function sc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cc(e){return yee.some(t=>e[t]>=0)}var lc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Fs(e,t);switch(i){case`referenceHidden`:{let e=sc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:cc(e)}}}case`escaped`:{let e=sc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:cc(e)}}}default:return{}}}}},uc=new Set([`left`,`top`]);async function dc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Is(n),s=Ls(n),c=Bs(n)===`y`,l=uc.has(o)?-1:1,u=a&&c?-1:1,d=Fs(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var fc=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await dc(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},pc=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Fs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Bs(Is(i)),p=Rs(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ps(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ps(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},mc=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Fs(e,t),u={x:n,y:r},d=Bs(i),f=Rs(d),p=u[f],m=u[d],h=Fs(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=uc.has(Is(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},hc=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Fs(e,t),u=await o.detectOverflow(t,l),d=Is(i),f=Ls(i),p=Bs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=ks(h-u[g],v),x=ks(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=As(u.left,0),t=As(u.right,0),n=As(u.top,0),r=As(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:As(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:As(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function gc(){return typeof window<`u`}function _c(e){return bc(e)?(e.nodeName||``).toLowerCase():`#document`}function vc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yc(e){return((bc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function bc(e){return gc()?e instanceof Node||e instanceof vc(e).Node:!1}function xc(e){return gc()?e instanceof Element||e instanceof vc(e).Element:!1}function Sc(e){return gc()?e instanceof HTMLElement||e instanceof vc(e).HTMLElement:!1}function Cc(e){return!gc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof vc(e).ShadowRoot}function wc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Fc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Tc(e){return/^(table|td|th)$/.test(_c(e))}function Ec(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Dc=/transform|translate|scale|rotate|perspective|filter/,Oc=/paint|layout|strict|content/,kc=e=>!!e&&e!==`none`,Ac;function jc(e){let t=xc(e)?Fc(e):e;return kc(t.transform)||kc(t.translate)||kc(t.scale)||kc(t.rotate)||kc(t.perspective)||!Nc()&&(kc(t.backdropFilter)||kc(t.filter))||Dc.test(t.willChange||``)||Oc.test(t.contain||``)}function Mc(e){let t=Lc(e);for(;Sc(t)&&!Pc(t);){if(jc(t))return t;if(Ec(t))return null;t=Lc(t)}return null}function Nc(){return Ac??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ac}function Pc(e){return/^(html|body|#document)$/.test(_c(e))}function Fc(e){return vc(e).getComputedStyle(e)}function Ic(e){return xc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Lc(e){if(_c(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Cc(e)&&e.host||yc(e);return Cc(t)?t.host:t}function Rc(e){let t=Lc(e);return Pc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Sc(t)&&wc(t)?t:Rc(t)}function zc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Rc(e),i=r===e.ownerDocument?.body,a=vc(r);if(i){let e=Bc(a);return t.concat(a,a.visualViewport||[],wc(r)?r:[],e&&n?zc(e):[])}else return t.concat(r,zc(r,[],n))}function Bc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Vc(e){let t=Fc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Sc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=js(n)!==a||js(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Hc(e){return xc(e)?e:e.contextElement}function Uc(e){let t=Hc(e);if(!Sc(t))return Ns(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Vc(t),o=(a?js(n.width):n.width)/r,s=(a?js(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Wc=Ns(0);function Gc(e){let t=vc(e);return!Nc()||!t.visualViewport?Wc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Kc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vc(e)?!1:t}function qc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Hc(e),o=Ns(1);t&&(r?xc(r)&&(o=Uc(r)):o=Uc(e));let s=Kc(a,n,r)?Gc(a):Ns(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=vc(a),t=r&&xc(r)?vc(r):r,n=e,i=Bc(n);for(;i&&r&&t!==n;){let e=Uc(i),t=i.getBoundingClientRect(),r=Fc(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=vc(i),i=Bc(n)}}return ec({width:u,height:d,x:c,y:l})}function Jc(e,t){let n=Ic(e).scrollLeft;return t?t.left+n:qc(yc(e)).left+n}function Yc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Jc(e,n),y:n.top+t.scrollTop}}function Xc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=yc(r),s=t?Ec(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ns(1),u=Ns(0),d=Sc(r);if((d||!d&&!a)&&((_c(r)!==`body`||wc(o))&&(c=Ic(r)),d)){let e=qc(r);l=Uc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Yc(o,c):Ns(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Zc(e){return Array.from(e.getClientRects())}function Qc(e){let t=yc(e),n=Ic(e),r=e.ownerDocument.body,i=As(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=As(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Jc(e),s=-n.scrollTop;return Fc(r).direction===`rtl`&&(o+=As(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var $c=25;function el(e,t){let n=vc(e),r=yc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Nc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Jc(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=$c&&(a-=o)}else l<=$c&&(a+=l);return{width:a,height:o,x:s,y:c}}function tl(e,t){let n=qc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Sc(e)?Uc(e):Ns(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function nl(e,t,n){let r;if(t===`viewport`)r=el(e,n);else if(t===`document`)r=Qc(yc(e));else if(xc(t))r=tl(t,n);else{let n=Gc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ec(r)}function rl(e,t){let n=Lc(e);return n===t||!xc(n)||Pc(n)?!1:Fc(n).position===`fixed`||rl(n,t)}function il(e,t){let n=t.get(e);if(n)return n;let r=zc(e,[],!1).filter(e=>xc(e)&&_c(e)!==`body`),i=null,a=Fc(e).position===`fixed`,o=a?Lc(e):e;for(;xc(o)&&!Pc(o);){let t=Fc(o),n=jc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||wc(o)&&!n&&rl(e,o))?r=r.filter(e=>e!==o):i=t,o=Lc(o)}return t.set(e,r),r}function al(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ec(t)?[]:il(t,this._c):[].concat(n),r],o=nl(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=nl(t,a[e],i);s=As(n.top,s),c=ks(n.right,c),l=ks(n.bottom,l),u=As(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ol(e){let{width:t,height:n}=Vc(e);return{width:t,height:n}}function sl(e,t,n){let r=Sc(t),i=yc(t),a=n===`fixed`,o=qc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ns(0);function l(){c.x=Jc(i)}if(r||!r&&!a)if((_c(t)!==`body`||wc(i))&&(s=Ic(t)),r){let e=qc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Yc(i,s):Ns(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function cl(e){return Fc(e).position===`static`}function ll(e,t){if(!Sc(e)||Fc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return yc(e)===n&&(n=n.ownerDocument.body),n}function ul(e,t){let n=vc(e);if(Ec(e))return n;if(!Sc(e)){let t=Lc(e);for(;t&&!Pc(t);){if(xc(t)&&!cl(t))return t;t=Lc(t)}return n}let r=ll(e,t);for(;r&&Tc(r)&&cl(r);)r=ll(r,t);return r&&Pc(r)&&cl(r)&&!jc(r)?n:r||Mc(e)||n}var dl=async function(e){let t=this.getOffsetParent||ul,n=this.getDimensions,r=await n(e.floating);return{reference:sl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fl(e){return Fc(e).direction===`rtl`}var pl={convertOffsetParentRelativeRectToViewportRelativeRect:Xc,getDocumentElement:yc,getClippingRect:al,getOffsetParent:ul,getElementRects:dl,getClientRects:Zc,getDimensions:ol,getScale:Uc,isElement:xc,isRTL:fl};function ml(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hl(e,t){let n=null,r,i=yc(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ms(d),h=Ms(i.clientWidth-(u+f)),g=Ms(i.clientHeight-(d+p)),_=Ms(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:As(0,ks(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ml(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function gl(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Hc(e),u=i||a?[...l?zc(l):[],...t?zc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?hl(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?qc(e):null;c&&g();function g(){let t=qc(e);h&&!ml(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _l=fc,vl=pc,yl=oc,bl=hc,xl=lc,Sl=ac,Cl=mc,wl=(e,t,n)=>{let r=new Map,i={platform:pl,...n},a={...i.platform,_c:r};return ic(e,t,{...i,platform:a})},Tl=typeof document<`u`?d.useLayoutEffect:function(){};function El(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!El(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!El(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Dl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ol(e,t){let n=Dl(e);return Math.round(t*n)/n}function kl(e){let t=d.useRef(e);return Tl(()=>{t.current=e}),t}function Al(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=d.useState(r);El(m,r)||h(r);let[g,_]=d.useState(null),[v,y]=d.useState(null),b=d.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=d.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=d.useRef(null),T=d.useRef(null),E=d.useRef(u),D=c!=null,O=kl(c),ee=kl(i),k=kl(l),A=d.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};ee.current&&(e.platform=ee.current),wl(w.current,T.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!El(E.current,t)&&(E.current=t,f.flushSync(()=>{p(t)}))})},[m,t,n,ee,k]);Tl(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[l]);let j=d.useRef(!1);Tl(()=>(j.current=!0,()=>{j.current=!1}),[]),Tl(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,A);A()}},[S,C,A,O,D]);let M=d.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),N=d.useMemo(()=>({reference:S,floating:C}),[S,C]),P=d.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ol(N.floating,u.x),r=Ol(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Dl(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return d.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var jl=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Sl({element:r.current,padding:i}).fn(n):r?Sl({element:r,padding:i}).fn(n):{}}}},Ml=(e,t)=>{let n=_l(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nl=(e,t)=>{let n=vl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pl=(e,t)=>({fn:Cl(e).fn,options:[e,t]}),Fl=(e,t)=>{let n=yl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Il=(e,t)=>{let n=bl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ll=(e,t)=>{let n=xl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rl=(e,t)=>{let n=jl(e);return{name:n.name,fn:n.fn,options:[e,t]}},zl=`Arrow`,Bl=d.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,p.jsx)(L.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,p.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Bl.displayName=zl;var Vl=Bl,Hl=`Popper`,[Ul,Wl]=_r(Hl),[Gl,Kl]=Ul(Hl),ql=e=>{let{__scopePopper:t,children:n}=e,[r,i]=d.useState(null),[a,o]=d.useState(void 0);return(0,p.jsx)(Gl,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};ql.displayName=Hl;var Jl=`PopperAnchor`,Yl=d.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Kl(Jl,n),o=d.useRef(null),s=a.onAnchorChange,c=Xn(t,d.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=d.useRef(null);d.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&au(a.placementState),f=u?.[0],m=u?.[1];return r?null:(0,p.jsx)(L.div,{"data-radix-popper-side":f,"data-radix-popper-align":m,...i,ref:c})});Yl.displayName=Jl;var Xl=`PopperContent`,[Zl,Ql]=Ul(Xl),$l=d.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l,collisionPadding:u=0,sticky:f=`partial`,hideWhenDetached:m=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,..._}=e,v=Kl(Xl,n),[y,b]=d.useState(null),x=Xn(t,e=>b(e)),[S,C]=d.useState(null),w=ms(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},ee=l?Array.isArray(l)?l:[l]:void 0,k=ee!==void 0&&ee.length>0,A={padding:O,boundary:ee?.filter(ru),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Al({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>gl(...e,{animationFrame:h===`always`}),elements:{reference:v.anchor},middleware:[Ml({mainAxis:i+E,alignmentAxis:o}),c&&Nl({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Pl():void 0,...A}),c&&Fl({...A}),Il({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),S&&Rl({element:S,padding:s}),iu({arrowWidth:T,arrowHeight:E}),m&&Ll({strategy:`referenceHidden`,...A})]}),I=v.setPlacementState;br(()=>(I(N),()=>{I(void 0)}),[N,I]);let[te,ne]=au(N),re=Yr(g);br(()=>{P&&re?.()},[P,re]);let ie=F.arrow?.x,ae=F.arrow?.y,oe=F.arrow?.centerOffset!==0,[se,ce]=d.useState();return br(()=>{y&&ce(window.getComputedStyle(y).zIndex)},[y]),(0,p.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,p.jsx)(Zl,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:C,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,p.jsx)(L.div,{"data-side":te,"data-align":ne,..._,ref:x,style:{..._.style,animation:P?void 0:`none`}})})})});$l.displayName=Xl;var eu=`PopperArrow`,tu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},nu=d.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Ql(eu,n),a=tu[i.placedSide];return(0,p.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,p.jsx)(Vl,{...r,ref:t,style:{...r.style,display:`block`}})})});nu.displayName=eu;function ru(e){return e!==null}var iu=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=au(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function au(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ou=ql,su=Yl,cu=$l,lu=nu,uu=`rovingFocusGroup.onEntryFocus`,du={bubbles:!1,cancelable:!0},fu=`RovingFocusGroup`,[pu,mu,hu]=yr(fu),[gu,_u]=_r(fu,[hu]),[vu,yu]=gu(fu),bu=d.forwardRef((e,t)=>(0,p.jsx)(pu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(pu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(xu,{...e,ref:t})})}));bu.displayName=fu;var xu=d.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...f}=e,m=d.useRef(null),h=Xn(t,m),g=Jr(a),[_,v]=Sr({prop:o,defaultProp:s??null,onChange:c,caller:fu}),[y,b]=d.useState(!1),x=Yr(l),S=mu(n),C=d.useRef(!1),[w,T]=d.useState(0);return d.useEffect(()=>{let e=m.current;if(e)return e.addEventListener(uu,x),()=>e.removeEventListener(uu,x)},[x]),(0,p.jsx)(vu,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:d.useCallback(e=>v(e),[v]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:d.useCallback(()=>T(e=>e-1),[]),children:(0,p.jsx)(L.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{C.current=!0}),onFocus:R(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(uu,du);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Du([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:R(e.onBlur,()=>b(!1))})})}),Su=`RovingFocusGroupItem`,Cu=d.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Pr(),l=a||c,u=yu(Su,n),f=u.currentTabStopId===l,m=mu(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:_}=u;return d.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),(0,p.jsx)(pu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,p.jsx)(L.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Eu(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ou(n,r+1):n.slice(r+1)}setTimeout(()=>Du(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:_!=null}):o})})});Cu.displayName=Su;var wu={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Tu(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Eu(e,t,n){let r=Tu(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return wu[r]}function Du(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ou(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ku=bu,Au=Cu,ju=[`Enter`,` `],Mu=[`ArrowDown`,`PageUp`,`Home`],Nu=[`ArrowUp`,`PageDown`,`End`],Pu=[...Mu,...Nu],Fu={ltr:[...ju,`ArrowRight`],rtl:[...ju,`ArrowLeft`]},Iu={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Lu=`Menu`,[Ru,zu,Bu]=yr(Lu),[Vu,Hu]=_r(Lu,[Bu,Wl,_u]),Uu=Wl(),Wu=_u(),[Gu,Ku]=Vu(Lu),[qu,Ju]=Vu(Lu),Yu=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Uu(t),[c,l]=d.useState(null),u=d.useRef(!1),f=Yr(a),m=Jr(i);return d.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,p.jsx)(ou,{...s,children:(0,p.jsx)(Gu,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:l,children:(0,p.jsx)(qu,{scope:t,onClose:d.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:m,modal:o,children:r})})})};Yu.displayName=Lu;var Xu=`MenuAnchor`,Zu=d.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Uu(n);return(0,p.jsx)(su,{...i,...r,ref:t})});Zu.displayName=Xu;var Qu=`MenuPortal`,[$u,ed]=Vu(Qu,{forceMount:void 0}),td=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ku(Qu,t);return(0,p.jsx)($u,{scope:t,forceMount:n,children:(0,p.jsx)(Er,{present:n||a.open,children:(0,p.jsx)(Si,{asChild:!0,container:i,children:r})})})};td.displayName=Qu;var nd=`MenuContent`,[rd,id]=Vu(nd),ad=d.forwardRef((e,t)=>{let n=ed(nd,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ku(nd,e.__scopeMenu),o=Ju(nd,e.__scopeMenu);return(0,p.jsx)(Ru.Provider,{scope:e.__scopeMenu,children:(0,p.jsx)(Er,{present:r||a.open,children:(0,p.jsx)(Ru.Slot,{scope:e.__scopeMenu,children:o.modal?(0,p.jsx)(od,{...i,ref:t}):(0,p.jsx)(sd,{...i,ref:t})})})})}),od=d.forwardRef((e,t)=>{let n=Ku(nd,e.__scopeMenu),r=d.useRef(null),i=Xn(t,r);return d.useEffect(()=>{let e=r.current;if(e)return Ga(e)},[]),(0,p.jsx)(ld,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sd=d.forwardRef((e,t)=>{let n=Ku(nd,e.__scopeMenu);return(0,p.jsx)(ld,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cd=Zn(`MenuContent.ScrollLock`),ld=d.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=Ku(nd,n),y=Ju(nd,n),b=Uu(n),x=Wu(n),S=zu(n),[C,w]=d.useState(null),T=d.useRef(null),E=Xn(t,T,v.onContentChange),D=d.useRef(0),O=d.useRef(``),ee=d.useRef(0),k=d.useRef(null),A=d.useRef(`right`),j=d.useRef(0),M=g?Ia:d.Fragment,N=g?{as:cd,allowPinchZoom:!0}:void 0,P=e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=qd(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};d.useEffect(()=>()=>window.clearTimeout(D.current),[]),Ti();let F=d.useCallback(e=>A.current===k.current?.side&&Yd(e,k.current?.area),[]);return(0,p.jsx)(rd,{scope:n,searchRef:O,onItemEnter:d.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:d.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:d.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:d.useCallback(e=>{k.current=e},[]),children:(0,p.jsx)(M,{...N,children:(0,p.jsx)(mi,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,p.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:(0,p.jsx)(ku,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:R(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,p.jsx)(cu,{role:`menu`,"aria-orientation":`vertical`,"data-state":Hd(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=T.current;if(e.target!==i||!Pu.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);Nu.includes(e.key)&&a.reverse(),Gd(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:R(e.onPointerMove,Xd(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});ad.displayName=nd;var ud=`MenuGroup`,dd=d.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,p.jsx)(L.div,{role:`group`,...r,ref:t})});dd.displayName=ud;var fd=`MenuLabel`,pd=d.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,p.jsx)(L.div,{...r,ref:t})});pd.displayName=fd;var md=`MenuItem`,hd=`menu.itemSelect`,gd=d.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=d.useRef(null),o=Ju(md,e.__scopeMenu),s=id(md,e.__scopeMenu),c=Xn(t,a),l=d.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(hd,{bubbles:!0,cancelable:!0});e.addEventListener(hd,e=>r?.(e),{once:!0}),dr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,p.jsx)(_d,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ju.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});gd.displayName=md;var _d=d.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=id(md,n),s=Wu(n),c=d.useRef(null),l=Xn(t,c),[u,f]=d.useState(!1),[m,h]=d.useState(``);return d.useEffect(()=>{let e=c.current;e&&h((e.textContent??``).trim())},[a.children]),(0,p.jsx)(Ru.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,p.jsx)(Au,{asChild:!0,...s,focusable:!r,children:(0,p.jsx)(L.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,Xd(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,Xd(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>f(!0)),onBlur:R(e.onBlur,()=>f(!1))})})})}),vd=`MenuCheckboxItem`,yd=d.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,p.jsx)(Dd,{scope:e.__scopeMenu,checked:n,children:(0,p.jsx)(gd,{role:`menuitemcheckbox`,"aria-checked":Ud(n)?`mixed`:n,...i,ref:t,"data-state":Wd(n),onSelect:R(i.onSelect,()=>r?.(Ud(n)?!0:!n),{checkForDefaultPrevented:!1})})})});yd.displayName=vd;var bd=`MenuRadioGroup`,[xd,Sd]=Vu(bd,{value:void 0,onValueChange:()=>{}}),Cd=d.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Yr(r);return(0,p.jsx)(xd,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,p.jsx)(dd,{...i,ref:t})})});Cd.displayName=bd;var wd=`MenuRadioItem`,Td=d.forwardRef((e,t)=>{let{value:n,...r}=e,i=Sd(wd,e.__scopeMenu),a=n===i.value;return(0,p.jsx)(Dd,{scope:e.__scopeMenu,checked:a,children:(0,p.jsx)(gd,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Wd(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Td.displayName=wd;var Ed=`MenuItemIndicator`,[Dd,Od]=Vu(Ed,{checked:!1}),kd=d.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Od(Ed,n);return(0,p.jsx)(Er,{present:r||Ud(a.checked)||a.checked===!0,children:(0,p.jsx)(L.span,{...i,ref:t,"data-state":Wd(a.checked)})})});kd.displayName=Ed;var Ad=`MenuSeparator`,jd=d.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,p.jsx)(L.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});jd.displayName=Ad;var Md=`MenuArrow`,Nd=d.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Uu(n);return(0,p.jsx)(lu,{...i,...r,ref:t})});Nd.displayName=Md;var Pd=`MenuSub`,[Fd,Id]=Vu(Pd),Ld=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ku(Pd,t),o=Uu(t),[s,c]=d.useState(null),[l,u]=d.useState(null),f=Yr(i);return d.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,p.jsx)(ou,{...o,children:(0,p.jsx)(Gu,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u,children:(0,p.jsx)(Fd,{scope:t,contentId:Pr(),triggerId:Pr(),trigger:s,onTriggerChange:c,children:n})})})};Ld.displayName=Pd;var Rd=`MenuSubTrigger`,zd=d.forwardRef((e,t)=>{let n=Ku(Rd,e.__scopeMenu),r=Ju(Rd,e.__scopeMenu),i=Id(Rd,e.__scopeMenu),a=id(Rd,e.__scopeMenu),o=d.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=d.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return d.useEffect(()=>u,[u]),d.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,p.jsx)(Zu,{asChild:!0,...l,children:(0,p.jsx)(_d,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":Hd(n.open),...e,ref:Yn(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,Xd(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,Xd(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Fu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});zd.displayName=Rd;var Bd=`MenuSubContent`,Vd=d.forwardRef((e,t)=>{let n=ed(nd,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Ku(nd,e.__scopeMenu),s=Ju(nd,e.__scopeMenu),c=Id(Bd,e.__scopeMenu),l=d.useRef(null),u=Xn(t,l);return(0,p.jsx)(Ru.Provider,{scope:e.__scopeMenu,children:(0,p.jsx)(Er,{present:r||o.open,children:(0,p.jsx)(Ru.Slot,{scope:e.__scopeMenu,children:(0,p.jsx)(ld,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Iu[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});Vd.displayName=Bd;function Hd(e){return e?`open`:`closed`}function Ud(e){return e===`indeterminate`}function Wd(e){return Ud(e)?`indeterminate`:e?`checked`:`unchecked`}function Gd(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Kd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function qd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Kd(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Jd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Yd(e,t){return t?Jd({x:e.clientX,y:e.clientY},t):!1}function Xd(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Zd=Yu,Qd=Zu,$d=td,ef=ad,tf=dd,nf=pd,rf=gd,af=yd,of=Cd,sf=Td,cf=kd,lf=jd,uf=Nd,df=Ld,ff=zd,pf=Vd,mf=`ContextMenu`,[hf,xee]=_r(mf,[Hu]),gf=Hu(),[_f,vf]=hf(mf),yf=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=d.useRef(!1);{let e=d.useRef(!1);d.useEffect(()=>{i===!0&&!s.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[c,l]=Sr({prop:i,defaultProp:!1,onChange:r,caller:mf}),u=gf(t);return(0,p.jsx)(_f,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,p.jsx)(Zd,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})};yf.displayName=mf;var bf=`ContextMenuTrigger`,xf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=vf(bf,n),o=gf(n),s=d.useRef({x:0,y:0}),c=d.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=d.useRef(0),u=d.useCallback(()=>window.clearTimeout(l.current),[]),f=e=>{a.hasInteractedRef.current=!0,s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return d.useEffect(()=>u,[u]),d.useEffect(()=>void(r&&u()),[r,u]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Qd,{...o,virtualRef:c}),(0,p.jsx)(L.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:R(e.onContextMenu,e=>{u(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:R(e.onPointerDown,Xf(e=>{u(),a.open&&a.onOpenChange(!1),l.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:R(e.onPointerMove,Xf(u)),onPointerCancel:r?e.onPointerCancel:R(e.onPointerCancel,Xf(u)),onPointerUp:r?e.onPointerUp:R(e.onPointerUp,Xf(u))})]})});xf.displayName=bf;var Sf=`ContextMenuPortal`,Cf=e=>{let{__scopeContextMenu:t,...n}=e,r=gf(t);return(0,p.jsx)($d,{...r,...n})};Cf.displayName=Sf;var wf=`ContextMenuContent`,Tf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=vf(wf,n),a=gf(n),o=d.useRef(!1);return(0,p.jsx)(ef,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Tf.displayName=wf;var Ef=`ContextMenuGroup`,Df=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(tf,{...i,...r,ref:t})});Df.displayName=Ef;var Of=`ContextMenuLabel`,kf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(nf,{...i,...r,ref:t})});kf.displayName=Of;var Af=`ContextMenuItem`,jf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(rf,{...i,...r,ref:t})});jf.displayName=Af;var Mf=`ContextMenuCheckboxItem`,Nf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(af,{...i,...r,ref:t})});Nf.displayName=Mf;var Pf=`ContextMenuRadioGroup`,Ff=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(of,{...i,...r,ref:t})});Ff.displayName=Pf;var If=`ContextMenuRadioItem`,Lf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(sf,{...i,...r,ref:t})});Lf.displayName=If;var Rf=`ContextMenuItemIndicator`,zf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(cf,{...i,...r,ref:t})});zf.displayName=Rf;var Bf=`ContextMenuSeparator`,Vf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(lf,{...i,...r,ref:t})});Vf.displayName=Bf;var Hf=`ContextMenuArrow`,Uf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(uf,{...i,...r,ref:t})});Uf.displayName=Hf;var Wf=`ContextMenuSub`,Gf=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=gf(t),[s,c]=Sr({prop:i,defaultProp:a??!1,onChange:r,caller:Wf});return(0,p.jsx)(df,{...o,open:s,onOpenChange:c,children:n})};Gf.displayName=Wf;var Kf=`ContextMenuSubTrigger`,qf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(ff,{...i,...r,ref:t})});qf.displayName=Kf;var Jf=`ContextMenuSubContent`,Yf=d.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=gf(n);return(0,p.jsx)(pf,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Yf.displayName=Jf;function Xf(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Zf=yf,Qf=xf,$f=Cf,ep=Tf,tp=jf,np=Vf,rp=Gf,ip=qf,ap=Yf,op=`DropdownMenu`,[sp,See]=_r(op,[Hu]),cp=Hu(),[Cee,lp]=sp(op),up=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=cp(t),l=d.useRef(null),[u,f]=Sr({prop:i,defaultProp:a??!1,onChange:o,caller:op});return(0,p.jsx)(Cee,{scope:t,triggerId:Pr(),triggerRef:l,contentId:Pr(),open:u,onOpenChange:f,onOpenToggle:d.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,p.jsx)(Zd,{...c,open:u,onOpenChange:f,dir:r,modal:s,children:n})})};up.displayName=op;var dp=`DropdownMenuTrigger`,fp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=lp(dp,n),o=cp(n);return(0,p.jsx)(Qd,{asChild:!0,...o,children:(0,p.jsx)(L.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Yn(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});fp.displayName=dp;var wee=`DropdownMenuPortal`,pp=e=>{let{__scopeDropdownMenu:t,...n}=e,r=cp(t);return(0,p.jsx)($d,{...r,...n})};pp.displayName=wee;var mp=`DropdownMenuContent`,hp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lp(mp,n),a=cp(n),o=d.useRef(!1);return(0,p.jsx)(ef,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});hp.displayName=mp;var Tee=`DropdownMenuGroup`,Eee=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(tf,{...i,...r,ref:t})});Eee.displayName=Tee;var Dee=`DropdownMenuLabel`,gp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(nf,{...i,...r,ref:t})});gp.displayName=Dee;var Oee=`DropdownMenuItem`,_p=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(rf,{...i,...r,ref:t})});_p.displayName=Oee;var kee=`DropdownMenuCheckboxItem`,Aee=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(af,{...i,...r,ref:t})});Aee.displayName=kee;var jee=`DropdownMenuRadioGroup`,vp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(of,{...i,...r,ref:t})});vp.displayName=jee;var Mee=`DropdownMenuRadioItem`,yp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(sf,{...i,...r,ref:t})});yp.displayName=Mee;var Nee=`DropdownMenuItemIndicator`,bp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(cf,{...i,...r,ref:t})});bp.displayName=Nee;var Pee=`DropdownMenuSeparator`,xp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(lf,{...i,...r,ref:t})});xp.displayName=Pee;var Fee=`DropdownMenuArrow`,Iee=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(uf,{...i,...r,ref:t})});Iee.displayName=Fee;var Lee=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=cp(t),[s,c]=Sr({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,p.jsx)(df,{...o,open:s,onOpenChange:c,children:n})},Ree=`DropdownMenuSubTrigger`,Sp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(ff,{...i,...r,ref:t})});Sp.displayName=Ree;var zee=`DropdownMenuSubContent`,Cp=d.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=cp(n);return(0,p.jsx)(pf,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Cp.displayName=zee;var Bee=up,Vee=fp,Hee=pp,Uee=hp,Wee=gp,Gee=_p,Kee=vp,qee=yp,Jee=bp,Yee=xp,Xee=Lee,Zee=Sp,Qee=Cp,$ee=`Label`,wp=d.forwardRef((e,t)=>(0,p.jsx)(L.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));wp.displayName=$ee;var ete=wp;function Tp(e,[t,n]){return Math.min(n,Math.max(t,e))}var Ep=`Popover`,[Dp,tte]=_r(Ep,[Wl]),Op=Wl(),[kp,Ap]=Dp(Ep),jp=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Op(t),c=d.useRef(null),[l,u]=d.useState(!1),[f,m]=Sr({prop:r,defaultProp:i??!1,onChange:a,caller:Ep});return(0,p.jsx)(ou,{...s,children:(0,p.jsx)(kp,{scope:t,contentId:Pr(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:d.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:l,onCustomAnchorAdd:d.useCallback(()=>u(!0),[]),onCustomAnchorRemove:d.useCallback(()=>u(!1),[]),modal:o,children:n})})};jp.displayName=Ep;var Mp=`PopoverAnchor`,Np=d.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ap(Mp,n),a=Op(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return d.useEffect(()=>(o(),()=>s()),[o,s]),(0,p.jsx)(su,{...a,...r,ref:t})});Np.displayName=Mp;var Pp=`PopoverTrigger`,Fp=d.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ap(Pp,n),a=Op(n),o=Xn(t,i.triggerRef),s=(0,p.jsx)(L.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Xp(i.open),...r,ref:o,onClick:R(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,p.jsx)(su,{asChild:!0,...a,children:s})});Fp.displayName=Pp;var Ip=`PopoverPortal`,[Lp,Rp]=Dp(Ip,{forceMount:void 0}),zp=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Ap(Ip,t);return(0,p.jsx)(Lp,{scope:t,forceMount:n,children:(0,p.jsx)(Er,{present:n||a.open,children:(0,p.jsx)(Si,{asChild:!0,container:i,children:r})})})};zp.displayName=Ip;var Bp=`PopoverContent`,Vp=d.forwardRef((e,t)=>{let n=Rp(Bp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Ap(Bp,e.__scopePopover);return(0,p.jsx)(Er,{present:r||a.open,children:a.modal?(0,p.jsx)(Up,{...i,ref:t}):(0,p.jsx)(Wp,{...i,ref:t})})});Vp.displayName=Bp;var Hp=Zn(`PopoverContent.RemoveScroll`),Up=d.forwardRef((e,t)=>{let n=Ap(Bp,e.__scopePopover),r=d.useRef(null),i=Xn(t,r),a=d.useRef(!1);return d.useEffect(()=>{let e=r.current;if(e)return Ga(e)},[]),(0,p.jsx)(Ia,{as:Hp,allowPinchZoom:!0,children:(0,p.jsx)(Gp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Wp=d.forwardRef((e,t)=>{let n=Ap(Bp,e.__scopePopover),r=d.useRef(!1),i=d.useRef(!1);return(0,p.jsx)(Gp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Gp=d.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Ap(Bp,n),m=Op(n);return Ti(),(0,p.jsx)(mi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,p.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,p.jsx)(cu,{"data-state":Xp(f.open),role:`dialog`,id:f.contentId,...m,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Kp=`PopoverClose`,qp=d.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ap(Kp,n);return(0,p.jsx)(L.button,{type:`button`,...r,ref:t,onClick:R(e.onClick,()=>i.onOpenChange(!1))})});qp.displayName=Kp;var Jp=`PopoverArrow`,Yp=d.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Op(n);return(0,p.jsx)(lu,{...i,...r,ref:t})});Yp.displayName=Jp;function Xp(e){return e?`open`:`closed`}var Zp=jp,Qp=Np,$p=Fp,em=zp,tm=Vp,nm=`Progress`,rm=100,[im,nte]=_r(nm),[am,om]=im(nm),sm=d.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=um,...o}=e;(i||i===0)&&!pm(i)&&console.error(hm(`${i}`,`Progress`));let s=pm(i)?i:rm;r!==null&&!mm(r,s)&&console.error(gm(`${r}`,`Progress`));let c=mm(r,s)?r:null,l=fm(c)?a(c,s):void 0;return(0,p.jsx)(am,{scope:n,value:c,max:s,children:(0,p.jsx)(L.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":fm(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":dm(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});sm.displayName=nm;var cm=`ProgressIndicator`,lm=d.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=om(cm,n);return(0,p.jsx)(L.div,{"data-state":dm(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});lm.displayName=cm;function um(e,t){return`${Math.round(e/t*100)}%`}function dm(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function fm(e){return typeof e==`number`}function pm(e){return fm(e)&&!isNaN(e)&&e>0}function mm(e,t){return fm(e)&&!isNaN(e)&&e<=t&&e>=0}function hm(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${rm}\`.`}function gm(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
60
|
+
- a positive number
|
|
61
|
+
- less than the value passed to \`max\` (or ${rm} if no \`max\` prop is set)
|
|
62
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
63
|
+
|
|
64
|
+
Defaulting to \`null\`.`}var _m=sm,vm=lm,ym=`Radio`,[bm,xm]=_r(ym),[Sm,Cm]=bm(ym);function wm(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[f,m]=d.useState(null),[h,g]=d.useState(null),_={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:f,setControl:m,hasConsumerStoppedPropagationRef:d.useRef(!1),isFormControl:f?!!a||!!f.closest(`form`):!0,bubbleInput:h,setBubbleInput:g,onCheck:()=>s?.()};return(0,p.jsx)(Sm,{scope:t,..._,children:Mm(u)?u(_):r})}var Tm=`RadioTrigger`,Em=d.forwardRef(({__scopeRadio:e,onClick:t,...n},r)=>{let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,isFormControl:u,bubbleInput:d}=Cm(Tm,e),f=Xn(r,s);return(0,p.jsx)(L.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Nm(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:f,onClick:R(t,e=>{i||c(),d&&u&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})});Em.displayName=Tm;var Dm=d.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i,required:a,disabled:o,value:s,onCheck:c,form:l,...u}=e;return(0,p.jsx)(wm,{__scopeRadio:n,checked:i,disabled:o,required:a,onCheck:c,name:r,form:l,value:s,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Em,{...u,ref:t,__scopeRadio:n}),e&&(0,p.jsx)(jm,{__scopeRadio:n})]})})});Dm.displayName=ym;var Om=`RadioIndicator`,km=d.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=Cm(Om,n);return(0,p.jsx)(Er,{present:r||a.checked,children:(0,p.jsx)(L.span,{"data-state":Nm(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});km.displayName=Om;var Am=`RadioBubbleInput`,jm=d.forwardRef(({__scopeRadio:e,...t},n)=>{let{control:r,checked:i,required:a,disabled:o,name:s,value:c,form:l,bubbleInput:u,setBubbleInput:f,hasConsumerStoppedPropagationRef:m}=Cm(Am,e),h=Xn(n,f),g=ps(i),_=ms(r);d.useEffect(()=>{let e=u;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!m.current;if(g!==i&&n){let t=new Event(`click`,{bubbles:r});n.call(e,i),e.dispatchEvent(t)}},[u,g,i,m]);let v=d.useRef(i);return(0,p.jsx)(L.input,{type:`radio`,"aria-hidden":!0,defaultChecked:v.current,required:a,disabled:o,name:s,value:c,form:l,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});jm.displayName=Am;function Mm(e){return typeof e==`function`}function Nm(e){return e?`checked`:`unchecked`}var Pm=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Fm=`RadioGroup`,[Im,rte]=_r(Fm,[_u,xm]),Lm=_u(),Rm=xm(),[zm,Bm]=Im(Fm),Vm=d.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,m=Lm(n),h=Jr(l),[g,_]=Sr({prop:a,defaultProp:i??null,onChange:d,caller:Fm});return(0,p.jsx)(zm,{scope:n,name:r,required:o,disabled:s,value:g,onValueChange:_,children:(0,p.jsx)(ku,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:(0,p.jsx)(L.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:h,...f,ref:t})})})});Vm.displayName=Fm;var Hm=`RadioGroupItem`,Um=`RadioGroupItemProvider`,Wm=`RadioGroupItemTrigger`,Gm=`RadioGroupItemBubbleInput`;function Km(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=Bm(Um,t),s=Rm(t),c=o.disabled||r;return(0,p.jsx)(wm,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}var qm=d.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e,i=Lm(n),a=Rm(n),{checked:o,disabled:s}=Cm(Wm,a.__scopeRadio),c=d.useRef(null),l=Xn(t,c),u=d.useRef(!1);return d.useEffect(()=>{let e=e=>{Pm.includes(e.key)&&(u.current=!0)},t=()=>u.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,p.jsx)(Au,{asChild:!0,...i,focusable:!s,active:o,children:(0,p.jsx)(Em,{...a,...r,ref:l,onKeyDown:R(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:R(r.onFocus,()=>{u.current&&c.current?.click()})})})});qm.displayName=Wm;var Jm=d.forwardRef((e,t)=>{let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,p.jsx)(Km,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(qm,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,p.jsx)(Ym,{__scopeRadioGroup:n})]})})});Jm.displayName=Hm;var Ym=d.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,p.jsx)(jm,{...Rm(n),...r,ref:t})});Ym.displayName=Gm;var Xm=`RadioGroupIndicator`,Zm=d.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,p.jsx)(km,{...Rm(n),...r,ref:t})});Zm.displayName=Xm;function Qm(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}var $m=`ScrollArea`,[eh,ite]=_r($m),[th,nh]=eh($m),rh=d.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=d.useState(null),[l,u]=d.useState(null),[f,m]=d.useState(null),[h,g]=d.useState(null),[_,v]=d.useState(null),[y,b]=d.useState(0),[x,S]=d.useState(0),[C,w]=d.useState(!1),[T,E]=d.useState(!1),D=Xn(t,e=>c(e)),O=Jr(i);return(0,p.jsx)(th,{scope:n,type:r,dir:O,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:w,scrollbarY:_,onScrollbarYChange:v,scrollbarYEnabled:T,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:S,children:(0,p.jsx)(L.div,{dir:O,...o,ref:D,style:{position:`relative`,"--radix-scroll-area-corner-width":y+`px`,"--radix-scroll-area-corner-height":x+`px`,...e.style}})})});rh.displayName=$m;var ih=`ScrollAreaViewport`,ah=d.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=nh(ih,n),s=Xn(t,d.useRef(null),o.onViewportChange);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,p.jsx)(L.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,p.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});ah.displayName=ih;var oh=`ScrollAreaScrollbar`,sh=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=nh(oh,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return d.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,p.jsx)(ch,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,p.jsx)(lh,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,p.jsx)(uh,{...r,ref:t,forceMount:n}):i.type===`always`?(0,p.jsx)(dh,{...r,ref:t,"data-state":`visible`}):null});sh.displayName=oh;var ch=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=nh(oh,e.__scopeScrollArea),[a,o]=d.useState(!1);return d.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,p.jsx)(Er,{present:n||a,children:(0,p.jsx)(uh,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),lh=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=nh(oh,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=jh(()=>c(`SCROLL_END`),100),[s,c]=Qm(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return d.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),d.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,p.jsx)(Er,{present:n||s!==`hidden`,children:(0,p.jsx)(dh,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:R(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:R(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),uh=d.forwardRef((e,t)=>{let n=nh(oh,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=d.useState(!1),s=e.orientation===`horizontal`,c=jh(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Mh(n.viewport,c),Mh(n.content,c),(0,p.jsx)(Er,{present:r||a,children:(0,p.jsx)(dh,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),dh=d.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=nh(oh,e.__scopeScrollArea),a=d.useRef(null),o=d.useRef(0),[s,c]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=wh(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function f(e,t){return Eh(e,o.current,s,t)}return n===`horizontal`?(0,p.jsx)(fh,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Dh(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=f(e,i.dir))}}):n===`vertical`?(0,p.jsx)(ph,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Dh(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=f(e))}}):null}),fh=d.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=nh(oh,e.__scopeScrollArea),[o,s]=d.useState(),c=d.useRef(null),l=Xn(t,c,a.onScrollbarXChange);return d.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,p.jsx)(gh,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Th(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),kh(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Ch(o.paddingLeft),paddingEnd:Ch(o.paddingRight)}})}})}),ph=d.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=nh(oh,e.__scopeScrollArea),[o,s]=d.useState(),c=d.useRef(null),l=Xn(t,c,a.onScrollbarYChange);return d.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,p.jsx)(gh,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Th(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),kh(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Ch(o.paddingTop),paddingEnd:Ch(o.paddingBottom)}})}})}),[mh,hh]=eh(oh),gh=d.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:f,...m}=e,h=nh(oh,n),[g,_]=d.useState(null),v=Xn(t,e=>_(e)),y=d.useRef(null),b=d.useRef(``),x=h.viewport,S=r.content-r.viewport,C=Yr(u),w=Yr(c),T=jh(f,10);function E(e){y.current&&l({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return d.useEffect(()=>{let e=e=>{let t=e.target;g?.contains(t)&&C(e,S)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[x,g,S,C]),d.useEffect(w,[r,w]),Mh(g,T),Mh(h.content,T),(0,p.jsx)(mh,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:Yr(a),onThumbPointerUp:Yr(o),onThumbPositionChange:w,onThumbPointerDown:Yr(s),children:(0,p.jsx)(L.div,{...m,ref:v,style:{position:`absolute`,...m.style},onPointerDown:R(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,h.viewport&&(h.viewport.style.scrollBehavior=`auto`),E(e))}),onPointerMove:R(e.onPointerMove,E),onPointerUp:R(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=``),y.current=null})})})}),_h=`ScrollAreaThumb`,vh=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=hh(_h,e.__scopeScrollArea);return(0,p.jsx)(Er,{present:n||i.hasThumb,children:(0,p.jsx)(yh,{ref:t,...r})})}),yh=d.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=nh(_h,n),o=hh(_h,n),{onThumbPositionChange:s}=o,c=Xn(t,e=>o.onThumbChange(e)),l=d.useRef(void 0),u=jh(()=>{l.current&&=(l.current(),void 0)},100);return d.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=Ah(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,p.jsx)(L.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:R(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:R(e.onPointerUp,o.onThumbPointerUp)})});vh.displayName=_h;var bh=`ScrollAreaCorner`,xh=d.forwardRef((e,t)=>{let n=nh(bh,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,p.jsx)(Sh,{...e,ref:t}):null});xh.displayName=bh;var Sh=d.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=nh(bh,n),[a,o]=d.useState(0),[s,c]=d.useState(0),l=!!(a&&s);return Mh(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Mh(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,p.jsx)(L.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Ch(e){return e?parseInt(e,10):0}function wh(e,t){let n=e/t;return isNaN(n)?0:n}function Th(e){let t=wh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Eh(e,t,n,r=`ltr`){let i=Th(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Oh([c,l],d)(e)}function Dh(e,t,n=`ltr`){let r=Th(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Tp(e,n===`ltr`?[0,o]:[o*-1,0]);return Oh([0,o],[0,s])(c)}function Oh(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function kh(e,t){return e>0&&e<t}var Ah=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function jh(e,t){let n=Yr(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Mh(e,t){let n=Yr(t);br(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Nh=rh,Ph=ah,Fh=xh,Ih=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Lh=[` `,`Enter`],Rh=`Select`,[zh,Bh,Vh]=yr(Rh),[Hh,ate]=_r(Rh,[Vh,Wl]),Uh=Wl(),[Wh,Gh]=Hh(Rh),[Kh,qh]=Hh(Rh),Jh=`SelectProvider`;function Yh(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:m,required:h,form:g,internal_do_not_use_render:_}=e,v=Uh(t),[y,b]=d.useState(null),[x,S]=d.useState(null),[C,w]=d.useState(!1),T=Jr(l),[E,D]=Sr({prop:r,defaultProp:i??!1,onChange:a,caller:Rh}),[O,ee]=Sr({prop:o,defaultProp:s,onChange:c,caller:Rh}),k=d.useRef(null),A=y?!!g||!!y.closest(`form`):!0,[j,M]=d.useState(new Set),N=Pr(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=d.useCallback(e=>{M(t=>new Set(t).add(e))},[]),I=d.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:h,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:N,value:O,onValueChange:ee,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:k,disabled:m,name:u,autoComplete:f,form:g,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,p.jsx)(ou,{...v,children:(0,p.jsx)(Wh,{scope:t,...te,children:(0,p.jsx)(zh.Provider,{scope:t,children:(0,p.jsx)(Kh,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:I,children:Yg(_)?_(te):n})})})})}Yh.displayName=Jh;var Xh=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,p.jsx)(Yh,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[n,e?(0,p.jsx)(Jg,{__scopeSelect:t}):null]})})};Xh.displayName=Rh;var Zh=`SelectTrigger`,Qh=d.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Uh(n),o=Gh(Zh,n),s=o.disabled||r,c=Xn(t,o.onTriggerChange),l=Bh(n),u=d.useRef(`touch`),[f,m,h]=Zg(e=>{let t=l().filter(e=>!e.disabled),n=Qg(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),g=e=>{s||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,p.jsx)(su,{asChild:!0,...a,children:(0,p.jsx)(L.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Xg(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&g(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Ih.includes(e.key)&&(g(),e.preventDefault())})})})});Qh.displayName=Zh;var $h=`SelectValue`,eg=d.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Gh($h,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,f=Xn(t,c.onValueNodeChange);br(()=>{l(u)},[l,u]);let m=Xg(c.value);return(0,p.jsx)(L.span,{...s,asChild:m?!1:s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,p.jsx)(d.Fragment,{children:m?o:a},m?`placeholder`:`value`)})});eg.displayName=$h;var tg=`SelectIcon`,ng=d.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,p.jsx)(L.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ng.displayName=tg;var rg=`SelectPortal`,[ig,ag]=Hh(rg,{forceMount:void 0}),og=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,p.jsx)(ig,{scope:e.__scopeSelect,forceMount:n,children:(0,p.jsx)(Si,{asChild:!0,...r})})};og.displayName=rg;var sg=`SelectContent`,cg=d.forwardRef((e,t)=>{let n=ag(sg,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Gh(sg,e.__scopeSelect),[o,s]=d.useState();return br(()=>{s(new DocumentFragment)},[]),(0,p.jsx)(Er,{present:r||a.open,children:({present:e})=>e?(0,p.jsx)(hg,{...i,ref:t}):(0,p.jsx)(lg,{...i,fragment:o})})});cg.displayName=sg;var lg=d.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?f.createPortal((0,p.jsx)(dg,{scope:n,children:(0,p.jsx)(zh.Slot,{scope:n,children:(0,p.jsx)(`div`,{ref:t,children:r})})}),i):null});lg.displayName=`SelectContentFragment`;var ug=10,[dg,fg]=Hh(sg),pg=`SelectContentImpl`,mg=Zn(`SelectContent.RemoveScroll`),hg=d.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=Gh(sg,n),[x,S]=d.useState(null),[C,w]=d.useState(null),T=Xn(t,e=>S(e)),[E,D]=d.useState(null),[O,ee]=d.useState(null),k=Bh(n),[A,j]=d.useState(!1),M=d.useRef(!1);d.useEffect(()=>{if(x)return Ga(x)},[x]),Ti();let N=d.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,C]),P=d.useCallback(()=>N([E,x]),[N,E,x]);d.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=b;d.useEffect(()=>{if(x){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,I]),d.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[te,ne]=Zg(e=>{let t=k().filter(e=>!e.disabled),n=Qg(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=d.useCallback((e,t,n)=>{let r=!M.current&&!n;(b.value!==void 0&&b.value===t||r)&&(D(e),r&&(M.current=!0))},[b.value]),ie=d.useCallback(()=>x?.focus(),[x]),ae=d.useCallback((e,t,n)=>{let r=!M.current&&!n;(b.value!==void 0&&b.value===t||r)&&ee(e)},[b.value]),oe=r===`popper`?yg:_g,se=oe===yg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,p.jsx)(dg,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:re,selectedItem:E,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:O,position:r,isPositioned:A,searchRef:te,children:(0,p.jsx)(Ia,{as:mg,allowPinchZoom:!0,children:(0,p.jsx)(mi,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,p.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,p.jsx)(oe,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...se,onPlaced:()=>j(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:R(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});hg.displayName=pg;var gg=`SelectItemAlignedPosition`,_g=d.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Gh(sg,n),o=fg(sg,n),[s,c]=d.useState(null),[l,u]=d.useState(null),f=Xn(t,e=>u(e)),m=Bh(n),h=d.useRef(!1),g=d.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=d.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-ug,d=Tp(a,[ug,Math.max(ug,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-ug,d=Tp(a,[ug,Math.max(ug,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=m(),c=window.innerHeight-ug*2,u=_.scrollHeight,d=window.getComputedStyle(l),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-ug,D=c-E,O=v.offsetHeight/2,ee=v.offsetTop+O,k=f+p+ee,A=x-k;if(k<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,_.scrollTop=k-E+_.offsetTop}s.style.margin=`${ug}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);br(()=>x(),[x]);let[S,C]=d.useState();return br(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]),(0,p.jsx)(bg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:d.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,p.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,p.jsx)(L.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});_g.displayName=gg;var vg=`SelectPopperPosition`,yg=d.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=ug,...a}=e,o=Uh(n);return(0,p.jsx)(cu,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});yg.displayName=vg;var[bg,xg]=Hh(sg,{}),Sg=`SelectViewport`,Cg=d.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=fg(Sg,n),o=xg(Sg,n),s=Xn(t,a.onViewportChange),c=d.useRef(0);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,p.jsx)(zh.Slot,{scope:n,children:(0,p.jsx)(L.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-ug*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Cg.displayName=Sg;var wg=`SelectGroup`,[Tg,Eg]=Hh(wg),Dg=d.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pr();return(0,p.jsx)(Tg,{scope:n,id:i,children:(0,p.jsx)(L.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Dg.displayName=wg;var Og=`SelectLabel`,kg=d.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Eg(Og,n);return(0,p.jsx)(L.div,{id:i.id,...r,ref:t})});kg.displayName=Og;var Ag=`SelectItem`,[jg,Mg]=Hh(Ag),Ng=d.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Gh(Ag,n),c=fg(Ag,n),l=s.value===r,[u,f]=d.useState(a??``),[m,h]=d.useState(!1),g=Xn(t,e=>c.itemRefCallback?.(e,r,i)),_=Pr(),v=d.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,p.jsx)(jg,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:d.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,p.jsx)(zh.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,p.jsx)(L.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":l&&m,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:R(o.onFocus,()=>h(!0)),onBlur:R(o.onBlur,()=>h(!1)),onClick:R(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:R(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:R(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Lh.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Ng.displayName=Ag;var Pg=`SelectItemText`,Fg=d.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Gh(Pg,n),s=fg(Pg,n),c=Mg(Pg,n),l=qh(Pg,n),[u,m]=d.useState(null),h=Xn(t,e=>m(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),g=u?.textContent,_=d.useMemo(()=>(0,p.jsx)(`option`,{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return br(()=>(v(_),()=>y(_)),[v,y,_]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(L.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?f.createPortal(a.children,o.valueNode):null]})});Fg.displayName=Pg;var Ig=`SelectItemIndicator`,Lg=d.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Mg(Ig,n).isSelected?(0,p.jsx)(L.span,{"aria-hidden":!0,...r,ref:t}):null});Lg.displayName=Ig;var Rg=`SelectScrollUpButton`,zg=d.forwardRef((e,t)=>{let n=fg(Rg,e.__scopeSelect),r=xg(Rg,e.__scopeSelect),[i,a]=d.useState(!1),o=Xn(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,p.jsx)(Hg,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});zg.displayName=Rg;var Bg=`SelectScrollDownButton`,Vg=d.forwardRef((e,t)=>{let n=fg(Bg,e.__scopeSelect),r=xg(Bg,e.__scopeSelect),[i,a]=d.useState(!1),o=Xn(t,r.onScrollButtonChange);return br(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,p.jsx)(Hg,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Vg.displayName=Bg;var Hg=d.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=fg(`SelectScrollButton`,n),o=d.useRef(null),s=Bh(n),c=d.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),br(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,p.jsx)(L.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Ug=`SelectSeparator`,Wg=d.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,p.jsx)(L.div,{"aria-hidden":!0,...r,ref:t})});Wg.displayName=Ug;var Gg=`SelectArrow`,Kg=d.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Uh(n);return fg(Gg,n).position===`popper`?(0,p.jsx)(lu,{...i,...r,ref:t}):null});Kg.displayName=Gg;var qg=`SelectBubbleInput`,Jg=d.forwardRef(({__scopeSelect:e,...t},n)=>{let r=Gh(qg,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:f,nativeSelectKey:m}=r,h=d.useRef(null),g=Xn(n,h),_=i??``,v=ps(_);return d.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,p.jsxs)(L.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...fr,...t.style},ref:g,defaultValue:_,children:[Xg(i)?(0,p.jsx)(`option`,{value:``}):null,Array.from(f)]},m)});Jg.displayName=qg;function Yg(e){return typeof e==`function`}function Xg(e){return e===``||e===void 0}function Zg(e){let t=Yr(e),n=d.useRef(``),r=d.useRef(0),i=d.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=d.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Qg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=$g(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function $g(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var e_=`Separator`,t_=`horizontal`,n_=[`horizontal`,`vertical`],r_=d.forwardRef((e,t)=>{let{decorative:n,orientation:r=t_,...i}=e,a=i_(r)?r:t_,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,p.jsx)(L.div,{"data-orientation":a,...o,...i,ref:t})});r_.displayName=e_;function i_(e){return n_.includes(e)}var a_=r_,o_=[`PageUp`,`PageDown`],s_=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],c_={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},l_=`Slider`,[u_,d_,f_]=yr(l_),[p_,ote]=_r(l_,[f_]),[m_,h_]=p_(l_),g_=d.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:u,onValueChange:f=()=>{},onValueCommit:m=()=>{},inverted:h=!1,form:g,..._}=e,v=d.useRef(new Set),y=d.useRef(0),b=d.useRef(!1),x=o===`horizontal`?y_:b_,[S=[],C]=Sr({prop:u,defaultProp:l,onChange:e=>{[...v.current][y.current]?.focus({preventScroll:!0,focusVisible:b.current}),b.current=!1,f(e)}}),w=d.useRef(S);function T(e){O(e,z_(S,e))}function E(e){O(e,y.current)}function D(){let e=w.current[y.current];S[y.current]!==e&&m(S)}function O(e,t,{commit:n}={commit:!1}){let o=W_(a),s=Tp(G_(Math.round((e-r)/a)*a+r,o),[r,i]);C((e=[])=>{let r=I_(e,s,t);if(H_(r,c*a)){y.current=r.indexOf(s);let t=String(r)!==String(e);return t&&n&&m(r),t?r:e}else return e})}return(0,p.jsx)(m_,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:y,thumbs:v.current,values:S,orientation:o,form:g,children:(0,p.jsx)(u_.Provider,{scope:e.__scopeSlider,children:(0,p.jsx)(u_.Slot,{scope:e.__scopeSlider,children:(0,p.jsx)(x,{"aria-disabled":s,"data-disabled":s?``:void 0,..._,ref:t,onPointerDown:R(_.onPointerDown,()=>{s||(w.current=S,b.current=!1)}),min:r,max:i,inverted:h,onSlideStart:s?void 0:T,onSlideMove:s?void 0:E,onSlideEnd:s?void 0:D,onHomeKeyDown:()=>{s||(b.current=!0,O(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(b.current=!0,O(i,S.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){b.current=!0;let n=o_.includes(e.key)||e.shiftKey&&s_.includes(e.key)?10:1,r=y.current,i=S[r];O(i+a*n*t,r,{commit:!0})}}})})})})});g_.displayName=l_;var[__,v_]=p_(l_,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),y_=d.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[f,m]=d.useState(null),h=Xn(t,e=>m(e)),g=d.useRef(void 0),_=Jr(i),v=_===`ltr`,y=v&&!a||!v&&a;function b(e){let t=g.current||f.getBoundingClientRect(),i=U_([0,t.width],y?[n,r]:[r,n]);return g.current=t,i(e-t.left)}return(0,p.jsx)(__,{scope:e.__scopeSlider,startEdge:y?`left`:`right`,endEdge:y?`right`:`left`,direction:y?1:-1,size:`width`,children:(0,p.jsx)(x_,{dir:_,"data-orientation":`horizontal`,...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=b(e.clientX);o?.(t)},onSlideMove:e=>{let t=b(e.clientX);s?.(t)},onSlideEnd:()=>{g.current=void 0,c?.()},onStepKeyDown:e=>{let t=c_[y?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),b_=d.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=d.useRef(null),f=Xn(t,u),m=d.useRef(void 0),h=!i;function g(e){let t=m.current||u.current.getBoundingClientRect(),i=U_([0,t.height],h?[r,n]:[n,r]);return m.current=t,i(e-t.top)}return(0,p.jsx)(__,{scope:e.__scopeSlider,startEdge:h?`bottom`:`top`,endEdge:h?`top`:`bottom`,size:`height`,direction:h?1:-1,children:(0,p.jsx)(x_,{"data-orientation":`vertical`,...l,ref:f,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=g(e.clientY);a?.(t)},onSlideMove:e=>{let t=g(e.clientY);o?.(t)},onSlideEnd:()=>{m.current=void 0,s?.()},onStepKeyDown:e=>{let t=c_[h?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),x_=d.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=h_(l_,n);return(0,p.jsx)(L.span,{...l,ref:t,onKeyDown:R(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):o_.concat(s_).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:R(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:R(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:R(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),S_=`SliderTrack`,C_=d.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=h_(S_,n);return(0,p.jsx)(L.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})});C_.displayName=S_;var w_=`SliderRange`,T_=d.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=h_(w_,n),a=v_(w_,n),o=Xn(t,d.useRef(null)),s=i.values.length,c=i.values.map(e=>L_(e,i.min,i.max)),l=s>1?Math.min(...c):0,u=100-Math.max(...c);return(0,p.jsx)(L.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:o,style:{...e.style,[a.startEdge]:l+`%`,[a.endEdge]:u+`%`}})});T_.displayName=w_;var E_=`SliderThumb`,[D_,O_]=p_(E_),k_=`SliderThumbProvider`;function A_(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=h_(k_,t),o=d_(t),[s,c]=d.useState(null),l=d.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=ms(s),f=s?!!a.form||!!s.closest(`form`):!0,m=a.values[l],h=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),g=m===void 0?0:L_(m,a.min,a.max);d.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let _={value:m,name:h,form:a.form,isFormControl:f,index:l,thumb:s,onThumbChange:c,percent:g,size:u};return(0,p.jsx)(D_,{scope:t,..._,children:K_(i)?i(_):r})}A_.displayName=k_;var j_=`SliderThumbTrigger`,M_=d.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=h_(j_,n),a=v_(j_,n),{index:o,value:s,percent:c,size:l,onThumbChange:u}=O_(j_,n),d=Xn(t,e=>u(e)),f=R_(o,i.values.length),m=l?.[a.size],h=m?B_(m,c,a.direction):0;return(0,p.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${h}px)`},children:(0,p.jsx)(u_.ItemSlot,{scope:n,children:(0,p.jsx)(L.span,{role:`slider`,"aria-label":e[`aria-label`]||f,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:d,style:s===void 0?{display:`none`}:e.style,onFocus:R(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})});M_.displayName=j_;var N_=d.forwardRef((e,t)=>{let{__scopeSlider:n,name:r,...i}=e;return(0,p.jsx)(A_,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(M_,{...i,ref:t,__scopeSlider:n}),r?(0,p.jsx)(F_,{__scopeSlider:n},e):null]})})});N_.displayName=E_;var P_=`SliderBubbleInput`,F_=d.forwardRef(({__scopeSlider:e,...t},n)=>{let{value:r,name:i,form:a}=O_(P_,e),o=d.useRef(null),s=Xn(o,n),c=ps(r);return d.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),(0,p.jsx)(L.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})});F_.displayName=P_;function I_(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function L_(e,t,n){return Tp(100/(n-t)*(e-t),[0,100])}function R_(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function z_(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function B_(e,t,n){let r=e/2;return(r-U_([0,50],[0,r])(t)*n)*n}function V_(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function H_(e,t){if(t>0){let n=V_(e);return Math.min(...n)>=t}return!0}function U_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function W_(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}function G_(e,t){let n=10**t;return Math.round(e*n)/n}function K_(e){return typeof e==`function`}var q_=`Switch`,[J_,ste]=_r(q_),[Y_,X_]=J_(q_);function Z_(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:f}=e,[m,h]=Sr({prop:n,defaultProp:i??!1,onChange:c,caller:q_}),[g,_]=d.useState(null),[v,y]=d.useState(null),b={checked:m,setChecked:h,disabled:a,control:g,setControl:_,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:d.useRef(!1),required:l,defaultChecked:i,isFormControl:g?!!o||!!g.closest(`form`):!0,bubbleInput:v,setBubbleInput:y};return(0,p.jsx)(Y_,{scope:t,...b,children:av(f)?f(b):r})}var Q_=`SwitchTrigger`,$_=d.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{value:i,disabled:a,checked:o,required:s,setControl:c,setChecked:l,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:f}=X_(Q_,e),m=Xn(r,c);return(0,p.jsx)(L.button,{type:`button`,role:`switch`,"aria-checked":o,"aria-required":s,"data-state":ov(o),"data-disabled":a?``:void 0,disabled:a,value:i,...n,ref:m,onClick:R(t,e=>{l(e=>!e),f&&d&&(u.current=e.isPropagationStopped(),u.current||e.stopPropagation())})})});$_.displayName=Q_;var ev=d.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(Z_,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)($_,{...d,ref:t,__scopeSwitch:n}),e&&(0,p.jsx)(iv,{__scopeSwitch:n})]})})});ev.displayName=q_;var tv=`SwitchThumb`,nv=d.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=X_(tv,n);return(0,p.jsx)(L.span,{"data-state":ov(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});nv.displayName=tv;var rv=`SwitchBubbleInput`,iv=d.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:f,bubbleInput:m,setBubbleInput:h}=X_(rv,e),g=Xn(n,h),_=ps(a),v=ms(r);d.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(_!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[m,_,a,i]);let y=d.useRef(a);return(0,p.jsx)(L.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??y.current,required:s,disabled:c,name:l,value:u,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});iv.displayName=rv;function av(e){return typeof e==`function`}function ov(e){return e?`checked`:`unchecked`}var sv=`Tabs`,[cv,cte]=_r(sv,[_u]),lv=_u(),[uv,dv]=cv(sv),fv=d.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Jr(s),[d,f]=Sr({prop:r,onChange:i,defaultProp:a??``,caller:sv});return(0,p.jsx)(uv,{scope:n,baseId:Pr(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,p.jsx)(L.div,{dir:u,"data-orientation":o,...l,ref:t})})});fv.displayName=sv;var pv=`TabsList`,mv=d.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=dv(pv,n),o=lv(n);return(0,p.jsx)(ku,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,p.jsx)(L.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});mv.displayName=pv;var hv=`TabsTrigger`,gv=d.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=dv(hv,n),s=lv(n),c=yv(o.baseId,r),l=bv(o.baseId,r),u=r===o.value;return(0,p.jsx)(Au,{asChild:!0,...s,focusable:!i,active:u,children:(0,p.jsx)(L.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:R(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:R(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});gv.displayName=hv;var _v=`TabsContent`,vv=d.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=dv(_v,n),c=yv(s.baseId,r),l=bv(s.baseId,r),u=r===s.value,f=d.useRef(u);return d.useEffect(()=>{let e=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,p.jsx)(Er,{present:i||u,children:({present:n})=>(0,p.jsx)(L.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?`0s`:void 0},children:n&&a})})});vv.displayName=_v;function yv(e,t){return`${e}-trigger-${t}`}function bv(e,t){return`${e}-content-${t}`}var xv=fv,Sv=mv,Cv=gv,wv=vv,Tv=`Toggle`,Ev=d.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Sr({prop:n,onChange:i,defaultProp:r??!1,caller:Tv});return(0,p.jsx)(L.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:R(e.onClick,()=>{e.disabled||s(!o)})})});Ev.displayName=Tv;var Dv=`ToggleGroup`,[Ov,lte]=_r(Dv,[_u]),kv=_u(),Av=d.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,p.jsx)(Nv,{...r,ref:t});if(n===`multiple`)return(0,p.jsx)(Pv,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Dv}\``)});Av.displayName=Dv;var[jv,Mv]=Ov(Dv),Nv=d.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=Sr({prop:n,defaultProp:r??``,onChange:i,caller:Dv});return(0,p.jsx)(jv,{scope:e.__scopeToggleGroup,type:`single`,value:d.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:d.useCallback(()=>s(``),[s]),children:(0,p.jsx)(Lv,{...a,ref:t})})}),Pv=d.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=Sr({prop:n,defaultProp:r??[],onChange:i,caller:Dv}),c=d.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=d.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,p.jsx)(jv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,p.jsx)(Lv,{...a,ref:t})})});Av.displayName=Dv;var[Fv,Iv]=Ov(Dv),Lv=d.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=kv(n),u=Jr(o),d={role:`group`,dir:u,...c};return(0,p.jsx)(Fv,{scope:n,rovingFocus:i,disabled:r,children:i?(0,p.jsx)(ku,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,p.jsx)(L.div,{...d,ref:t})}):(0,p.jsx)(L.div,{...d,ref:t})})}),Rv=`ToggleGroupItem`,zv=d.forwardRef((e,t)=>{let n=Mv(Rv,e.__scopeToggleGroup),r=Iv(Rv,e.__scopeToggleGroup),i=kv(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=d.useRef(null);return r.rovingFocus?(0,p.jsx)(Au,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,p.jsx)(Bv,{...s,ref:t})}):(0,p.jsx)(Bv,{...s,ref:t})});zv.displayName=Rv;var Bv=d.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=Mv(Rv,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,p.jsx)(Ev,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),Vv=Av,Hv=zv,[Uv,ute]=_r(`Tooltip`,[Wl]),Wv=Wl(),Gv=`TooltipProvider`,Kv=700,qv=`tooltip.open`,[Jv,Yv]=Uv(Gv),Xv=e=>{let{__scopeTooltip:t,delayDuration:n=Kv,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=d.useRef(!0),s=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,p.jsx)(Jv,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:d.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:d.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:d.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Xv.displayName=Gv;var Zv=`Tooltip`,[Qv,$v]=Uv(Zv),ey=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Yv(Zv,e.__scopeTooltip),l=Wv(t),[u,f]=d.useState(null),m=Pr(),h=d.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=d.useRef(!1),[y,b]=Sr({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(qv))):c.onClose(),a?.(e)},caller:Zv}),x=d.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=d.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=d.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=d.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return d.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,p.jsx)(ou,{...l,children:(0,p.jsx)(Qv,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:u,onTriggerChange:f,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:d.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};ey.displayName=Zv;var ty=`TooltipTrigger`,ny=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=$v(ty,n),a=Yv(ty,n),o=Wv(n),s=Xn(t,d.useRef(null),i.onTriggerChange),c=d.useRef(!1),l=d.useRef(!1),u=d.useCallback(()=>c.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,p.jsx)(su,{asChild:!0,...o,children:(0,p.jsx)(L.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});ny.displayName=ty;var ry=`TooltipPortal`,[iy,ay]=Uv(ry,{forceMount:void 0}),oy=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=$v(ry,t);return(0,p.jsx)(iy,{scope:t,forceMount:n,children:(0,p.jsx)(Er,{present:n||a.open,children:(0,p.jsx)(Si,{asChild:!0,container:i,children:r})})})};oy.displayName=ry;var sy=`TooltipContent`,cy=d.forwardRef((e,t)=>{let n=ay(sy,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=$v(sy,e.__scopeTooltip);return(0,p.jsx)(Er,{present:r||o.open,children:o.disableHoverableContent?(0,p.jsx)(py,{side:i,...a,ref:t}):(0,p.jsx)(ly,{side:i,...a,ref:t})})}),ly=d.forwardRef((e,t)=>{let n=$v(sy,e.__scopeTooltip),r=Yv(sy,e.__scopeTooltip),i=d.useRef(null),a=Xn(t,i),[o,s]=d.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:f}=r,m=d.useCallback(()=>{s(null),f(!1)},[f]),h=d.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=_y(r,gy(r,n.getBoundingClientRect())),a=vy(t.getBoundingClientRect());s(by([...i,...a])),f(!0)},[f]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(c&&u){let e=e=>h(e,u),t=e=>h(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,h,m]),d.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!yy(n,o);r?m():i&&(m(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,m]),(0,p.jsx)(py,{...e,ref:a})}),[uy,dy]=Uv(Zv,{isInside:!1}),fy=er(`TooltipContent`),py=d.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=$v(sy,n),l=Wv(n),{onClose:u}=c;return d.useEffect(()=>(document.addEventListener(qv,u),()=>document.removeEventListener(qv,u)),[u]),d.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,p.jsx)(ri,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,p.jsxs)(cu,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,p.jsx)(fy,{children:r}),(0,p.jsx)(uy,{scope:n,isInside:!0,children:(0,p.jsx)(hr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});cy.displayName=sy;var my=`TooltipArrow`,hy=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Wv(n);return dy(my,n).isInside?null:(0,p.jsx)(lu,{...i,...r,ref:t})});hy.displayName=my;function gy(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function _y(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function vy(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function yy(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function by(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),xy(t)}function xy(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Sy=Xv,Cy=ey,wy=ny,Ty=oy,Ey=cy,Dy=hy,Oy=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ky=(e,t)=>({classGroupId:e,validator:t}),Ay=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),jy=`-`,My=[],Ny=`arbitrary..`,Py=e=>{let t=Ly(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Iy(e);let n=e.split(jy);return Fy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Oy(i,t):t:i||My}return n[e]||My}}},Fy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Fy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(jy):e.slice(t).join(jy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Iy=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ny+r:void 0})(),Ly=e=>{let{theme:t,classGroups:n}=e;return Ry(n,t)},Ry=(e,t)=>{let n=Ay();for(let r in e){let i=e[r];zy(i,n,r,t)}return n},zy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];By(i,t,n,r)}},By=(e,t,n,r)=>{if(typeof e==`string`){Vy(e,t,n);return}if(typeof e==`function`){Hy(e,t,n,r);return}Uy(e,t,n,r)},Vy=(e,t,n)=>{let r=e===``?t:Wy(t,e);r.classGroupId=n},Hy=(e,t,n,r)=>{if(Gy(e)){zy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ky(n,e))},Uy=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];zy(o,Wy(t,a),n,r)}},Wy=(e,t)=>{let n=e,r=t.split(jy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ay(),n.nextPart.set(t,i)),n=i}return n},Gy=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ky=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},qy=`!`,Jy=`:`,Yy=[],Xy=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Zy=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Jy){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(qy)?(c=s.slice(0,-1),l=!0):s.startsWith(qy)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Xy(t,l,c,u)};if(t){let e=t+Jy,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Xy(Yy,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Qy=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},$y=e=>({cache:Ky(e.cacheSize),parseClassName:Zy(e),sortModifiers:Qy(e),...Py(e)}),eb=/\s+/,tb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(eb),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+qy:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},nb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=rb(n))&&(i&&(i+=` `),i+=r);return i},rb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=rb(e[r]))&&(n&&(n+=` `),n+=t);return n},ib=(e,...t)=>{let n,r,i,a,o=o=>(n=$y(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=tb(e,n);return i(e,a),a};return a=o,(...e)=>a(nb(...e))},ab=[],ob=e=>{let t=t=>t[e]||ab;return t.isThemeGetter=!0,t},sb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ub=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,db=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hb=e=>lb.test(e),gb=e=>!!e&&!Number.isNaN(Number(e)),_b=e=>!!e&&Number.isInteger(Number(e)),vb=e=>e.endsWith(`%`)&&gb(e.slice(0,-1)),yb=e=>ub.test(e),bb=()=>!0,xb=e=>db.test(e)&&!fb.test(e),Sb=()=>!1,Cb=e=>pb.test(e),wb=e=>mb.test(e),Tb=e=>!z(e)&&!B(e),Eb=e=>Vb(e,Gb,Sb),z=e=>sb.test(e),Db=e=>Vb(e,Kb,xb),Ob=e=>Vb(e,qb,gb),kb=e=>Vb(e,Yb,bb),Ab=e=>Vb(e,Jb,Sb),jb=e=>Vb(e,Ub,Sb),Mb=e=>Vb(e,Wb,wb),Nb=e=>Vb(e,Xb,Cb),B=e=>cb.test(e),Pb=e=>Hb(e,Kb),Fb=e=>Hb(e,Jb),Ib=e=>Hb(e,Ub),Lb=e=>Hb(e,Gb),Rb=e=>Hb(e,Wb),zb=e=>Hb(e,Xb,!0),Bb=e=>Hb(e,Yb,!0),Vb=(e,t,n)=>{let r=sb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Hb=(e,t,n=!1)=>{let r=cb.exec(e);return r?r[1]?t(r[1]):n:!1},Ub=e=>e===`position`||e===`percentage`,Wb=e=>e===`image`||e===`url`,Gb=e=>e===`length`||e===`size`||e===`bg-size`,Kb=e=>e===`length`,qb=e=>e===`number`,Jb=e=>e===`family-name`,Yb=e=>e===`number`||e===`weight`,Xb=e=>e===`shadow`,Zb=ib(()=>{let e=ob(`color`),t=ob(`font`),n=ob(`text`),r=ob(`font-weight`),i=ob(`tracking`),a=ob(`leading`),o=ob(`breakpoint`),s=ob(`container`),c=ob(`spacing`),l=ob(`radius`),u=ob(`shadow`),d=ob(`inset-shadow`),f=ob(`text-shadow`),p=ob(`drop-shadow`),m=ob(`blur`),h=ob(`perspective`),g=ob(`aspect`),_=ob(`ease`),v=ob(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),B,z],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[B,z,c],T=()=>[hb,`full`,`auto`,...w()],E=()=>[_b,`none`,`subgrid`,B,z],D=()=>[`auto`,{span:[`full`,_b,B,z]},_b,B,z],O=()=>[_b,`auto`,B,z],ee=()=>[`auto`,`min`,`max`,`fr`,B,z],k=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[hb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[hb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[hb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,B,z],I=()=>[...b(),Ib,jb,{position:[B,z]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Lb,Eb,{size:[B,z]}],re=()=>[vb,Pb,Db],ie=()=>[``,`none`,`full`,l,B,z],ae=()=>[``,gb,Pb,Db],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[gb,vb,Ib,jb],le=()=>[``,`none`,m,B,z],ue=()=>[`none`,gb,B,z],de=()=>[`none`,gb,B,z],fe=()=>[gb,B,z],pe=()=>[hb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[yb],breakpoint:[yb],color:[bb],container:[yb],"drop-shadow":[yb],ease:[`in`,`out`,`in-out`],font:[Tb],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[yb],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[yb],shadow:[yb],spacing:[`px`,gb],text:[yb],"text-shadow":[yb],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,hb,z,B,g]}],container:[`container`],columns:[{columns:[gb,z,B,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[_b,`auto`,B,z]}],basis:[{basis:[hb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[gb,hb,`auto`,`initial`,`none`,z]}],grow:[{grow:[``,gb,B,z]}],shrink:[{shrink:[``,gb,B,z]}],order:[{order:[_b,`first`,`last`,`none`,B,z]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...k(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...k()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...N()]}],"min-inline-size":[{"min-inline":[`auto`,...N()]}],"max-inline-size":[{"max-inline":[`none`,...N()]}],"block-size":[{block:[`auto`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,Pb,Db]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Bb,kb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,vb,z]}],"font-family":[{font:[Fb,Ab,t]}],"font-features":[{"font-features":[z]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,B,z]}],"line-clamp":[{"line-clamp":[gb,`none`,B,Ob]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,B,z]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,B,z]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[gb,`from-font`,`auto`,B,Db]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[gb,`auto`,B,z]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,B,z]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,B,z]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},_b,B,z],radial:[``,B,z],conic:[_b,B,z]},Rb,Mb]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[gb,B,z]}],"outline-w":[{outline:[``,gb,Pb,Db]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,zb,Nb]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,zb,Nb]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ae()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[gb,Db]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,zb,Nb]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[gb,B,z]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[gb]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[B,z]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[gb]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,B,z]}],filter:[{filter:[``,`none`,B,z]}],blur:[{blur:le()}],brightness:[{brightness:[gb,B,z]}],contrast:[{contrast:[gb,B,z]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,zb,Nb]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,gb,B,z]}],"hue-rotate":[{"hue-rotate":[gb,B,z]}],invert:[{invert:[``,gb,B,z]}],saturate:[{saturate:[gb,B,z]}],sepia:[{sepia:[``,gb,B,z]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,B,z]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[gb,B,z]}],"backdrop-contrast":[{"backdrop-contrast":[gb,B,z]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,gb,B,z]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gb,B,z]}],"backdrop-invert":[{"backdrop-invert":[``,gb,B,z]}],"backdrop-opacity":[{"backdrop-opacity":[gb,B,z]}],"backdrop-saturate":[{"backdrop-saturate":[gb,B,z]}],"backdrop-sepia":[{"backdrop-sepia":[``,gb,B,z]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,B,z]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[gb,`initial`,B,z]}],ease:[{ease:[`linear`,`initial`,_,B,z]}],delay:[{delay:[gb,B,z]}],animate:[{animate:[`none`,v,B,z]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,B,z]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[B,z,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,B,z]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,B,z]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[gb,Pb,Db,Ob]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function V(...e){return Zb(Wn(e))}var Qb=qn(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 active:scale-[0.97] transition-transform duration-150`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function H({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,p.jsx)(r?Qn:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:V(Qb({variant:t,size:n,className:e})),...i})}function $b({...e}){return(0,p.jsx)(as,{"data-slot":`alert-dialog`,...e})}function ex({...e}){return(0,p.jsx)(os,{"data-slot":`alert-dialog-portal`,...e})}function tx({className:e,...t}){return(0,p.jsx)(ss,{"data-slot":`alert-dialog-overlay`,className:V(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function nx({className:e,size:t=`default`,...n}){return(0,p.jsxs)(ex,{children:[(0,p.jsx)(tx,{}),(0,p.jsx)(cs,{"data-slot":`alert-dialog-content`,"data-size":t,className:V(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function rx({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:V(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function ix({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:V(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function ax({className:e,...t}){return(0,p.jsx)(ds,{"data-slot":`alert-dialog-title`,className:V(`text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function ox({className:e,...t}){return(0,p.jsx)(fs,{"data-slot":`alert-dialog-description`,className:V(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function sx({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,p.jsx)(H,{variant:t,size:n,asChild:!0,children:(0,p.jsx)(ls,{"data-slot":`alert-dialog-action`,className:V(e),...r})})}function cx({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,p.jsx)(H,{variant:t,size:n,asChild:!0,children:(0,p.jsx)(us,{"data-slot":`alert-dialog-cancel`,className:V(e),...r})})}function lx({className:e,type:t,...n}){return(0,p.jsx)(`input`,{type:t,"data-slot":`input`,className:V(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function ux({className:e,...t}){return(0,p.jsx)(ete,{"data-slot":`label`,className:V(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var dx=e=>{let[t,n]=(0,u.useState)(``),r=e.requireConfirmationInput,i=r?.confirmTerm??``,a=!r||t===i,o=(r?.label??`Type {{confirmTerm}} to confirm`).split(`{{confirmTerm}}`);return(0,p.jsx)($b,{open:e.isOpen,onOpenChange:t=>{t||(n(``),e.onCancel())},children:(0,p.jsxs)(nx,{children:[(0,p.jsxs)(rx,{children:[(0,p.jsx)(ax,{children:e.title}),(0,p.jsx)(ox,{children:e.description})]}),r&&(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(ux,{htmlFor:`confirm-type-input`,children:o.map((e,t)=>t<o.length-1?(0,p.jsxs)(`span`,{children:[e,(0,p.jsx)(`span`,{className:`font-bold`,children:i})]},t):(0,p.jsx)(`span`,{children:e},t))}),(0,p.jsx)(lx,{id:`confirm-type-input`,value:t,onChange:e=>n(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a&&(t.preventDefault(),n(``),e.onConfirm())},placeholder:i,autoComplete:`off`}),r.hint&&(0,p.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r.hint})]}),(0,p.jsxs)(ix,{children:[(0,p.jsx)(cx,{className:`active:scale-[0.97] transition-transform duration-150`,onClick:t=>{t.preventDefault(),n(``),e.onCancel()},children:e.cancelButtonText}),(0,p.jsx)(sx,{variant:e.variant,className:`active:scale-[0.97] transition-transform duration-150`,disabled:!a,onClick:t=>{t.preventDefault(),n(``),e.onConfirm()},children:e.confirmButtonText})]})]})})},fx=(0,u.createContext)(void 0),px=({children:e})=>{let[t,n]=(0,u.useState)({}),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),s=(0,u.useCallback)(e=>(o(e=>(e&&e(!1),null)),n(e),i(!0),new Promise(e=>{o(()=>e)})),[]);return(0,p.jsxs)(fx.Provider,{value:{confirm:s},children:[e,(0,p.jsx)(dx,{isOpen:r,title:t.title||`Confirm Action`,description:t.description||`Are you sure you want to proceed?`,confirmButtonText:t.confirmButtonText||`Confirm`,cancelButtonText:t.cancelButtonText||`Cancel`,variant:t.variant||`default`,requireConfirmationInput:t.requireConfirmationInput,onConfirm:()=>{a&&a(!0),i(!1),o(null)},onCancel:()=>{a&&a(!1),i(!1),o(null)}})]})},mx=()=>{let e=(0,u.useContext)(fx);if(!e)throw Error(`useConfirm must be used within a ConfirmDialogProvider`);return e.confirm},hx={en:{navigation:{previousButtonLabel:`Previous`,nextButtonLabel:`Next`,submitButtonLabel:`Submit`,pageIndicator:`Page {current} of {total}`}}},gx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),_x=(e,t)=>{if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(gx(t)&&gx(r)){n[e]=_x(t,r);continue}n[e]=r}return n},vx=(...e)=>{let t={...hx};for(let n of e)if(n)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=n?_x(n,r):r}return t},yx=e=>e.trim().toLowerCase(),bx=e=>{let t=yx(e||`en`),n=t.split(`-`)[0];return Array.from(new Set([t,n,`en`]))},xx=(e,t)=>{if(!e)return;let n=e;for(let e of t.split(`.`)){if(!gx(n)||!(e in n))return;n=n[e]}return typeof n==`string`?n:void 0},Sx=(e,t)=>t?e.replace(/\{([a-zA-Z0-9_]+)\}/g,(e,n)=>{let r=t[n];return r==null?`{${n}}`:String(r)}):e,Cx=(e,t)=>(n,r)=>{for(let i of bx(e)){let e=xx(t[i],n);if(e!==void 0)return Sx(e,r)}return console.log(`[SurveyPlayer] Missing localization for key "${n}" in language "${e}".`),n},wx=(e,t)=>{let n=t?.trim();return n?(t,r)=>e(`${n}.${t}`,r):e},Tx=(0,u.createContext)(null),Ex=({survey:e,locale:t,surveyEngine:n,surveyPlayerRegistry:r,localizations:i,children:a,onRunExternalHandler:o,onResponseChanged:s})=>{let c=(0,u.useMemo)(()=>vx(r?.localizations,i),[i,r?.localizations]),l={survey:e,locale:t,surveyEngine:n,surveyPlayerRegistry:r,runExternalHandler:o,onResponseChanged:s,translate:(0,u.useMemo)(()=>Cx(t,c),[t,c])};return(0,p.jsx)(Tx.Provider,{value:l,children:(0,p.jsx)(px,{children:a})})},Dx=()=>{let e=(0,u.useContext)(Tx);if(!e)throw Error(`useSurvey must be used within SurveyProvider`);return e},Ox=e=>{let{translate:t}=Dx();return(0,u.useMemo)(()=>wx(t,e),[e,t])},kx=(0,u.createContext)(null),Ax=(0,u.createContext)(null),jx=({children:e,renderedItemInfos:t})=>{let{survey:n,surveyEngine:r,onResponseChanged:i}=Dx(),a=t.id,[o,s]=(0,u.useState)(r.getResponseItem(a)?.response),c=(0,u.useMemo)(()=>n.surveyItems.get(a),[n,a]),l=(0,u.useMemo)(()=>n.getItemTranslations(a),[n,a]),d=(0,u.useCallback)(e=>{r.setResponse(a,e),s(r.getResponseItem(a)?.response),i?.()},[a,i,r]),f=(0,u.useMemo)(()=>({item:c,renderedItemInfos:t,itemTranslations:l,headerId:`${a}-header`}),[c,a,l,t]),m=(0,u.useMemo)(()=>({currentResponse:o,setResponse:d}),[o,d]);return(0,p.jsx)(kx.Provider,{value:f,children:(0,p.jsx)(Ax.Provider,{value:m,children:(0,p.jsx)(`div`,{className:`@container`,children:e})})})},Mx=()=>{let e=(0,u.useContext)(kx);if(!e)throw Error(`useSurveyItemStaticCtx must be used within a SurveyItemContextProvider`);return e},Nx=()=>{let e=(0,u.useContext)(Ax);if(!e)throw Error(`useSurveyItemResponseCtx must be used within a SurveyItemContextProvider`);return e},Px={special:{en:`Special Items`},display:{en:`Display`},form:{en:`Forms`},question:{en:`Questions`},structure:{en:`Structure`}};function Fx(e,t=`en`){return e[t]??e.en??Object.values(e)[0]??``}function Ix(e,t,n=`en`){let r=t[e];return r?Fx(r,n):e}var Lx={Content:`content`,Label:`label`,Key:`key`,ItemType:`itemType`},Rx=e=>{let t=e.survey.surveyItems.get(e.itemId);if(!t)return;let n=t.metadata?.itemLabel??``,r=e.searchTerm.toLowerCase(),i=[],a=e.survey.getItemKey(t.id);return t.type.toLowerCase().includes(r)&&i.push({matchType:Lx.ItemType,matchText:t.type}),n.toLowerCase().includes(r)&&i.push({matchType:Lx.Label,matchText:n}),a?.fullKey.toLowerCase().includes(r)&&i.push({matchType:Lx.Key,matchText:a.fullKey}),i},zx=[ve.Group,ve.PageBreak],Bx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Vx=(e,t,n)=>{let r=e?.[t];if(!Bx(r))return;let i=r;for(let e of n){if(!Bx(i)||!(e in i))return;i=i[e]}return typeof i==`string`?i:void 0};function Hx(e){let t={...Px};for(let[n,r]of Object.entries(e??{}))t[n]={...t[n],...r};return t}function Ux(e,t){if(!e&&!t)return;let n={};for(let[t,r]of Object.entries(e??{}))n[t]={...r};for(let[e,r]of Object.entries(t??{}))n[e]={...n[e]??{},...r};return n}function Wx(e){return e.map(e=>{let t=e.itemType?` [${e.itemType}]`:``;return`${e.code}${t}: ${e.message}`}).join(`
|
|
65
|
+
`)}function Gx(e){if(e.errors.length!==0)throw Error(`Invalid item registry entries:\n${Wx(e.errors)}`)}function Kx(e,t){let n=[],r=[],i=t.requireBuiltInTypes??!0,a=t.requireRenderer??!1,o=new Set;for(let i of e){if(o.has(i.itemType)){n.push({code:`duplicate-item-type`,itemType:i.itemType,message:`Duplicate item registry entry for type: ${i.itemType}`});continue}o.add(i.itemType),!i.constructor&&i.itemType!==`root`&&!zx.includes(i.itemType)&&r.push({code:`missing-constructor`,itemType:i.itemType,message:`Entry has no constructor. This item type will not be deserializable from survey JSON.`}),t.mode===`editor`&&!i.infos&&n.push({code:`missing-editor-infos`,itemType:i.itemType,message:`ItemRegistryEntry "${i.itemType}" must have infos when used in editor.`}),t.mode===`player`&&a&&!i.renderComponent&&n.push({code:`missing-renderer`,itemType:i.itemType,message:`Entry is missing renderComponent while requireRenderer=true.`})}if(t.mode===`editor`&&i)for(let e of zx)o.has(e)||n.push({code:`missing-built-in-type`,itemType:e,message:`Missing registry entry for built-in type: ${e}`});return{errors:n,warnings:r}}function qx(e){Gx(Kx(e,{mode:`player`,requireBuiltInTypes:!1}));let t={};for(let n of e)n.constructor&&(t[n.itemType]=n.constructor);return De(t)}function Jx(e,t={}){Gx(Kx(e,{mode:`player`,requireRenderer:t.requireRenderer??!1,requireBuiltInTypes:!1}));let n=qx(e),r=new Map;for(let t of e)t.renderComponent&&r.set(t.itemType,t.renderComponent);return{coreRegistry:n,getRenderer:e=>r.get(e),localizations:vx(...e.map(e=>e.playerLocalizations))}}function Yx(e,t){return t?e.map(e=>{if(!e.infos)return e;let n={...e.infos.labelByLocale},r={...e.infos.descriptionByLocale};for(let i of Object.keys(t)){let a=Vx(t,i,[`registryLabels`,`items`,e.itemType,`label`]);a!==void 0&&(n[i]=a);let o=Vx(t,i,[`registryLabels`,`items`,e.itemType,`description`]);o!==void 0&&(r[i]=o)}return{...e,infos:{...e.infos,labelByLocale:n,descriptionByLocale:r,categories:[...e.infos.categories]}}}):e}function Xx(e){if(!e)return;let t={};for(let n of Object.keys(e)){let r=e[n],i=Bx(r)&&Bx(r.registryLabels)&&Bx(r.registryLabels.categories)?r.registryLabels.categories:void 0;if(i)for(let[e,r]of Object.entries(i))typeof r==`string`&&(t[e]={...t[e]??{},[n]:r})}return Object.keys(t).length>0?t:void 0}function Zx(e){if(!e.infos)throw Error(`ItemRegistryEntry "${e.itemType}" must have infos when used in editor.`);let t=e.includeDefaultSearchAdapter??!0,n=e.searchAdapters?[...e.searchAdapters]:[];return t&&n.push(Rx),{itemType:e.itemType,infos:e.infos,editorComponent:e.editorComponent,renderComponent:e.renderComponent,previewComponent:e.previewComponent,capabilities:e.capabilities,expressions:e.expressions?[...e.expressions]:void 0,isRootOnly:e.isRootOnly,getInitialItem:e.getInitialItem,createItem:e.createItem,searchAdapters:n,includeDefaultSearchAdapter:t}}function Qx(e,t={}){Gx(Kx(e,{mode:`editor`,requireBuiltInTypes:t.requireBuiltInTypes??!0}));let n=qx(e),r={};for(let t of e){if(r[t.itemType])throw Error(`Duplicate item registry entry for type: ${t.itemType}`);r[t.itemType]={...Zx(t)}}if(t.requireBuiltInTypes??!0){for(let e of zx)if(!r[e])throw Error(`Missing registry entry for built-in type: ${e}`)}return{coreRegistry:n,definitions:r,playerLocalizations:vx(...e.map(e=>e.playerLocalizations)),categoryLabels:Hx(t.categoryLabels)}}function $x(e,t){return t instanceof Se&&t.isRoot()?e.definitions.root:e.definitions[t.type]}var eS=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),tS=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nS=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rS=e=>{let t=nS(e);return t.charAt(0).toUpperCase()+t.slice(1)},iS={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},aS=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},oS=(0,d.createContext)({}),sS=()=>(0,d.useContext)(oS),cS=(0,d.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=sS()??{},h=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,d.createElement)(`svg`,{ref:c,...iS,width:t??l??iS.width,height:t??l??iS.height,stroke:e??p,strokeWidth:h,className:eS(`lucide`,m,i),...!a&&!aS(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(cS,{ref:i,iconNode:t,className:eS(`lucide-${tS(rS(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rS(e),n},lS=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),uS=U(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),dS=U(`asterisk`,[[`path`,{d:`M12 6v12`,key:`1vza4d`}],[`path`,{d:`M17.196 9 6.804 15`,key:`1ah31z`}],[`path`,{d:`m6.804 9 10.392 6`,key:`1b6pxd`}]]),fS=U(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),pS=U(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),mS=U(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),hS=U(`bring-to-front`,[[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`2`,key:`yj20xf`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2`,key:`1ltk23`}],[`path`,{d:`M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2`,key:`1q24h9`}]]),gS=U(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),_S=U(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),vS=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yS=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bS=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xS=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),SS=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),CS=U(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),wS=U(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),TS=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ES=U(`circle-ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]),DS=U(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),OS=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),dte=U(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),fte=U(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),pte=U(`clipboard-plus`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M9 14h6`,key:`159ibu`}],[`path`,{d:`M12 17v-6`,key:`1y8rbf`}]]),mte=U(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),hte=U(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),kS=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),gte=U(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),AS=U(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),_te=U(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),vte=U(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),yte=U(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),bte=U(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),xte=U(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),jS=U(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),MS=U(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),NS=U(`form`,[[`path`,{d:`M4 14h6`,key:`77gv2w`}],[`path`,{d:`M4 2h10`,key:`a2b314`}],[`rect`,{x:`4`,y:`18`,width:`16`,height:`4`,rx:`1`,key:`sybzq6`}],[`rect`,{x:`4`,y:`6`,width:`16`,height:`4`,rx:`1`,key:`1osc9e`}]]),PS=U(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),FS=U(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),IS=U(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ste=U(`heading`,[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]),Cte=U(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),LS=U(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),wte=U(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),RS=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Tte=U(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Ete=U(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),zS=U(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Dte=U(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),BS=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),VS=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ote=U(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),HS=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),kte=U(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),US=U(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),WS=U(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),GS=U(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),KS=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ate=U(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),jte=U(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Mte=U(`remove-formatting`,[[`path`,{d:`M4 7V4h16v3`,key:`9msm58`}],[`path`,{d:`M5 20h6`,key:`1h6pxn`}],[`path`,{d:`M13 4 8 20`,key:`kqq6aj`}],[`path`,{d:`m15 15 5 5`,key:`me55sn`}],[`path`,{d:`m20 15-5 5`,key:`11p7ol`}]]),qS=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Nte=U(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),JS=U(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),YS=U(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Pte=U(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Fte=U(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),XS=U(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),Ite=U(`text-align-justify`,[[`path`,{d:`M3 5h18`,key:`1u36vt`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 19h18`,key:`awlh7x`}]]),ZS=U(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),QS=U(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Lte=U(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),Rte=U(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),zte=U(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),$S=U(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),eC=U(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),tC=U(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Bte=U(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),nC=U(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),rC=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function iC({className:e,orientation:t=`horizontal`,...n}){return(0,p.jsx)(xv,{"data-slot":`tabs`,"data-orientation":t,className:V(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Vte=qn(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function aC({className:e,variant:t=`default`,...n}){return(0,p.jsx)(Sv,{"data-slot":`tabs-list`,"data-variant":t,className:V(Vte({variant:t}),e),...n})}function oC({className:e,...t}){return(0,p.jsx)(Cv,{"data-slot":`tabs-trigger`,className:V(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function sC({className:e,...t}){return(0,p.jsx)(wv,{"data-slot":`tabs-content`,className:V(`flex-1 text-sm outline-none`,e),...t})}function cC({...e}){return(0,p.jsx)(Bee,{"data-slot":`dropdown-menu`,...e})}function lC({...e}){return(0,p.jsx)(Vee,{"data-slot":`dropdown-menu-trigger`,...e})}function uC({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,p.jsx)(Hee,{children:(0,p.jsx)(Uee,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:V(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function dC({className:e,inset:t,variant:n=`default`,...r}){return(0,p.jsx)(Gee,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:V(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function fC({...e}){return(0,p.jsx)(Kee,{"data-slot":`dropdown-menu-radio-group`,...e})}function pC({className:e,children:t,inset:n,...r}){return(0,p.jsxs)(qee,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:V(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,p.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,p.jsx)(Jee,{children:(0,p.jsx)(vS,{})})}),t]})}function mC({className:e,inset:t,...n}){return(0,p.jsx)(Wee,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:V(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function hC({className:e,...t}){return(0,p.jsx)(Yee,{"data-slot":`dropdown-menu-separator`,className:V(`-mx-1 my-1 h-px bg-border`,e),...t})}function Hte({...e}){return(0,p.jsx)(Xee,{"data-slot":`dropdown-menu-sub`,...e})}function Ute({className:e,inset:t,children:n,...r}){return(0,p.jsxs)(Zee,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:V(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,p.jsx)(xS,{className:`ml-auto`})]})}function Wte({className:e,...t}){return(0,p.jsx)(Qee,{"data-slot":`dropdown-menu-sub-content`,className:V(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}var gC=`survey-editor:clipboard-value-updated`,_C=()=>{typeof window>`u`||window.dispatchEvent(new Event(gC))},vC=()=>{let[e,t]=(0,u.useState)(null),[n,r]=(0,u.useState)(null),i=(0,u.useEffectEvent)(async()=>{try{t(await navigator.clipboard.readText())}catch{t(null)}r(new Date)});return(0,u.useEffect)(()=>{if(i(),typeof window>`u`)return;let e=()=>{i()};return window.addEventListener(gC,e),()=>{window.removeEventListener(gC,e)}},[]),[e,(0,u.useCallback)(()=>{_C()},[]),n]},yC=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},bC=(e=>e?yC(e):yC),Gte=e=>e;function xC(e,t=Gte){let n=d.default.useSyncExternalStore(e.subscribe,d.default.useCallback(()=>t(e.getState()),[e,t]),d.default.useCallback(()=>t(e.getInitialState()),[e,t]));return d.default.useDebugValue(n),n}var SC=(0,u.createContext)(null);function W(e){let t=(0,u.useContext)(SC);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return xC(t,e)}function CC(){let e=(0,u.useContext)(SC);if(!e)throw Error(`useEditorStoreApi must be used within an EditorStoreProvider`);return e}function Kte(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var qte=e=>{switch(e){case`success`:return Xte;case`info`:return Qte;case`warning`:return Zte;case`error`:return $te;default:return null}},Jte=Array(12).fill(0),Yte=({visible:e,className:t})=>d.default.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},d.default.createElement(`div`,{className:`sonner-spinner`},Jte.map((e,t)=>d.default.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Xte=d.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},d.default.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Zte=d.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},d.default.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Qte=d.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},d.default.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),$te=d.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},d.default.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),ene=d.default.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},d.default.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),d.default.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),tne=()=>{let[e,t]=d.default.useState(document.hidden);return d.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},wC=1,TC=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:wC++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],d.default.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(DC(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!d.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!d.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!d.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!d.default.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||wC++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},EC=(e,t)=>{let n=t?.id||wC++;return TC.addToast({title:e,...t,id:n}),n},DC=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,OC=Object.assign(EC,{success:TC.success,info:TC.info,warning:TC.warning,error:TC.error,custom:TC.custom,message:TC.message,promise:TC.promise,dismiss:TC.dismiss,loading:TC.loading},{getHistory:()=>TC.toasts,getToasts:()=>TC.getActiveToasts()});Kte(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function kC(e){return e.label!==void 0}var AC=3,jC=`24px`,MC=`16px`,NC=4e3,PC=356,FC=14,IC=45,LC=200;function RC(...e){return e.filter(Boolean).join(` `)}function zC(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var BC=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:f,defaultRichColors:p,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:_,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=d.default.useState(null),[ee,k]=d.default.useState(null),[A,j]=d.default.useState(!1),[M,N]=d.default.useState(!1),[P,F]=d.default.useState(!1),[I,te]=d.default.useState(!1),[ne,re]=d.default.useState(!1),[ie,ae]=d.default.useState(0),[oe,se]=d.default.useState(0),ce=d.default.useRef(n.duration||b||NC),le=d.default.useRef(null),ue=d.default.useRef(null),de=c===0,fe=c+1<=o,pe=n.type,me=n.dismissible!==!1,he=n.className||``,ge=n.descriptionClassName||``,_e=d.default.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ve=d.default.useMemo(()=>n.closeButton??m,[n.closeButton,m]),ye=d.default.useMemo(()=>n.duration||b||NC,[n.duration,b]),be=d.default.useRef(0),xe=d.default.useRef(0),Se=d.default.useRef(0),Ce=d.default.useRef(null),[we,Te]=x.split(`-`),Ee=d.default.useMemo(()=>s.reduce((e,t,n)=>n>=_e?e:e+t.height,0),[s,_e]),De=tne(),Oe=n.invert||t,ke=pe===`loading`;xe.current=d.default.useMemo(()=>_e*S+Ee,[_e,Ee]),d.default.useEffect(()=>{ce.current=ye},[ye]),d.default.useEffect(()=>{j(!0)},[]),d.default.useEffect(()=>{let e=ue.current;if(e){let t=e.getBoundingClientRect().height;return se(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),d.default.useLayoutEffect(()=>{if(!A)return;let e=ue.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,se(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ae=d.default.useCallback(()=>{N(!0),ae(xe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{f(n)},LC)},[n,f,a,xe]);d.default.useEffect(()=>{if(n.promise&&pe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||De?(()=>{if(Se.current<be.current){let e=new Date().getTime()-be.current;ce.current-=e}Se.current=new Date().getTime()})():ce.current!==1/0&&(be.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ae()},ce.current)),()=>clearTimeout(e)},[u,i,n,pe,De,Ae]),d.default.useEffect(()=>{n.delete&&(Ae(),n.onDismiss==null||n.onDismiss.call(n,n))},[Ae,n.delete]);function je(){return T?.loading?d.default.createElement(`div`,{className:RC(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":pe===`loading`},T.loading):d.default.createElement(Yte,{className:RC(w?.loader,n?.classNames?.loader),visible:pe===`loading`})}let Me=n.icon||T?.[pe]||qte(pe);return d.default.createElement(`li`,{tabIndex:0,ref:ue,className:RC(v,he,w?.toast,n?.classNames?.toast,w?.default,w?.[pe],n?.classNames?.[pe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??p,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":ne,"data-removed":M,"data-visible":fe,"data-y-position":we,"data-x-position":Te,"data-index":c,"data-front":de,"data-swiping":P,"data-dismissible":me,"data-type":pe,"data-invert":Oe,"data-swipe-out":I,"data-swipe-direction":ee,"data-expanded":!!(u||C&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?ie:xe.current}px`,"--initial-height":C?`auto`:`${oe}px`,...h,...n.style},onDragEnd:()=>{F(!1),O(null),Ce.current=null},onPointerDown:e=>{e.button!==2&&(ke||!me||(le.current=new Date,ae(xe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),Ce.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!me)return;Ce.current=null;let e=Number(ue.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ue.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-le.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=IC||a>.11){ae(xe.current),n.onDismiss==null||n.onDismiss.call(n,n),k(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ae(),te(!0);return}else{var o,s;(o=ue.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ue.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}re(!1),F(!1),O(null)},onPointerMove:t=>{var n,r;if(!Ce.current||!me||window.getSelection()?.toString().length>0)return;let i=t.clientY-Ce.current.y,a=t.clientX-Ce.current.x,o=e.swipeDirections??zC(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&re(!0),(n=ue.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ue.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ve&&!n.jsx&&pe!==`loading`?d.default.createElement(`button`,{"aria-label":E,"data-disabled":ke,"data-close-button":!0,onClick:ke||!me?()=>{}:()=>{Ae(),n.onDismiss==null||n.onDismiss.call(n,n)},className:RC(w?.closeButton,n?.classNames?.closeButton)},T?.close??ene):null,(pe||n.icon||n.promise)&&n.icon!==null&&(T?.[pe]!==null||n.icon)?d.default.createElement(`div`,{"data-icon":``,className:RC(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||je():null,n.type===`loading`?null:Me):null,d.default.createElement(`div`,{"data-content":``,className:RC(w?.content,n?.classNames?.content)},d.default.createElement(`div`,{"data-title":``,className:RC(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?d.default.createElement(`div`,{"data-description":``,className:RC(y,ge,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),d.default.isValidElement(n.cancel)?n.cancel:n.cancel&&kC(n.cancel)?d.default.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{kC(n.cancel)&&me&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ae())},className:RC(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,d.default.isValidElement(n.action)?n.action:n.action&&kC(n.action)?d.default.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{kC(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ae())},className:RC(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function VC(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function HC(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?MC:jC;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var UC=d.default.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:p=`light`,richColors:m,duration:h,style:g,visibleToasts:_=AC,toastOptions:v,dir:y=VC(),gap:b=FC,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=d.default.useState([]),T=d.default.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=d.default.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=d.default.useState([]),[ee,k]=d.default.useState(!1),[A,j]=d.default.useState(!1),[M,N]=d.default.useState(p===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p),P=d.default.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=d.default.useRef(null),te=d.default.useRef(!1),ne=d.default.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||TC.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return d.default.useEffect(()=>TC.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{f.default.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),d.default.useEffect(()=>{if(p!==`system`){N(p);return}if(p===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[p]),d.default.useEffect(()=>{C.length<=1&&k(!1)},[C]),d.default.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),d.default.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,te.current=!1)}},[P.current]),d.default.createElement(`section`,{ref:t,"aria-label":`${S} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?d.default.createElement(`ol`,{key:t,dir:y===`auto`?VC():y,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${PC}px`,"--gap":`${b}px`,...g,...HC(l,u)},onBlur:e=>{te.current&&!e.currentTarget.contains(e.relatedTarget)&&(te.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te.current||(te.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>d.default.createElement(BC,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:m,duration:v?.duration??h,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:_,closeButton:v?.closeButton??s,interacting:A,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ne,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:ee,swipeDirections:e.swipeDirections}))):null}))}),WC=(0,u.createContext)(void 0);function GC({isOpen:e,title:t,description:n,buttonLabel:r,dismissButtonClassName:i,dismissButtonVariant:a,children:o,onDismiss:s}){return(0,p.jsx)($b,{open:e,onOpenChange:e=>{e||s()},children:(0,p.jsxs)(nx,{children:[(0,p.jsxs)(rx,{children:[(0,p.jsx)(ax,{children:t}),n?(0,p.jsx)(ox,{children:n}):null]}),o==null?null:(0,p.jsx)(`div`,{className:`py-2`,children:o}),(0,p.jsx)(ix,{className:`justify-center sm:justify-center`,children:(0,p.jsx)(cx,{className:V(`min-w-24 active:scale-[0.97] transition-transform duration-150`,i),variant:a??`default`,children:r})})]})})}var KC=({children:e})=>{let[t,n]=(0,u.useState)({}),[r,i]=(0,u.useState)(!1),a=(0,u.useRef)(null),o=(0,u.useCallback)(()=>{let e=a.current;e&&e(),a.current=null},[]),s=(0,u.useCallback)(()=>{o(),i(!1)},[o]),c=(0,u.useCallback)(e=>(o(),n(e),i(!0),new Promise(e=>{a.current=e})),[o]),l=(0,u.useMemo)(()=>Object.assign(c,{dismiss:s}),[c,s]);return(0,p.jsxs)(WC.Provider,{value:{alert:l},children:[e,(0,p.jsx)(GC,{isOpen:r,title:t.title??`Notice`,description:t.description??``,buttonLabel:t.buttonLabel??`OK`,dismissButtonClassName:t.dismissButtonClassName,dismissButtonVariant:t.dismissButtonVariant,onDismiss:s,children:t.children})]})},qC=()=>{let e=(0,u.useContext)(WC);if(!e)throw Error(`useAlert must be used within an AlertDialogProvider`);return e.alert},JC=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},YC=d.createContext(void 0),XC={setTheme:e=>{},themes:[]},ZC=()=>d.useContext(YC)??XC;d.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return d.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${JC.toString()})(${u})`}})});var QC=({...e})=>{let{theme:t=`system`}=ZC();return(0,p.jsx)(UC,{theme:t,className:`toaster group`,icons:{success:(0,p.jsx)(TS,{className:`size-4`}),info:(0,p.jsx)(RS,{className:`size-4`}),warning:(0,p.jsx)(eC,{className:`size-4`}),error:(0,p.jsx)(kte,{className:`size-4`}),loading:(0,p.jsx)(VS,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},toastOptions:{classNames:{toast:`cn-toast`}},...e})};function $C({delayDuration:e=0,...t}){return(0,p.jsx)(Sy,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function ew({...e}){return(0,p.jsx)(Cy,{"data-slot":`tooltip`,...e})}function tw({...e}){return(0,p.jsx)(wy,{"data-slot":`tooltip-trigger`,...e})}function nw({className:e,sideOffset:t=0,children:n,...r}){return(0,p.jsx)(Ty,{children:(0,p.jsxs)(Ey,{"data-slot":`tooltip-content`,sideOffset:t,className:V(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,p.jsx)(Dy,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var rw={en:{common:{actions:{back:`Back`,cancel:`Cancel`,close:`Close`,copy:`Copy`,delete:`Delete`,generate:`Generate`,more:`More`,open:`Open`,save:`Save`,search:`Search`}},history:{updateItemKey:`Update item key`,updateItemLabel:`Update item label`,updateItemContent:`Update item content`,updateItemResponseConfig:`Update response config`,updateSurveyAsset:`Update survey asset`,removeSurveyAsset:`Remove survey asset`,moveItem:`Move item`,pasteItem:`Paste item`,updateItemEditorColor:`Update item editor color`,addItem:`Add item: {itemLabel}`,addItemFromAiIntent:`Add item from AI intent`,addItemsFromAiIntent:`Add {count} items from AI intent`},routes:{editor:{noSaveHandler:`No save handler provided by host application.`,undoTriggered:`Undo functionality triggered (Ctrl/Cmd + Z)`,noMoreUndo:`No more actions to undo`,redoTriggered:`Redo functionality triggered (Ctrl/Cmd + Shift + Z)`,noMoreRedo:`No more actions to redo`},footer:{help:`Help`,assets:`Assets ({count})`,unusedAssetsWarning:`Unused assets: {count}`},historyStack:{lastModified:`Last modified:`,recentChangesTitle:`Recent changes`,recentChangesDescription:`Click a state to roll back to that point`},itemEditor:{loading:`Loading...`},translationMode:{backToItemEditor:`Back to item editor`,comingSoon:`Translations mode coming soon`},assetManager:{backToItemEditor:`Back to item editor`,title:`Image assets`,description:`Upload images and reuse them anywhere in your survey.`}},toolbar:{languagePicker:{languages:`Languages:`,editLanguages:`Edit languages`},searchTrigger:{search:`Search`,searchSurveyItems:`Search survey items`},search:{title:`Search Survey Items`,placeholder:`Search survey items...`,key:`Key:`,content:`Content:`,label:`Label:`,itemType:`Item Type:`,noItemsFound:`No items found for "{searchTerm}"`,startTyping:`Start typing to search survey items...`,navigate:`to navigate`,select:`to select`},breadcrumbs:{selectSibling:`Select sibling`,addNewSibling:`Add new sibling`,surveySettings:`Survey settings`}},aiInput:{getSuggestions:`Get AI suggestions`,gettingSuggestions:`Getting AI suggestions...`,suggestions:`AI suggestions`,noSuggestions:`No suggestions found`,yourInput:`Your input`,ai:`AI`,navigate:`navigate`,select:`select`,close:`close`},itemEditorCard:{goToParentItem:`Go to parent item`,itemKeyUpdated:`Item key updated.`,itemKeyUpdateFailed:`Failed to update item key.`,itemLabelUpdated:`Item label updated.`,preview:`Preview`,open:`Open`,previewDescription:`Open this item in a focused preview dialog.`,previewDialogTitle:`Item preview`,previewDialogDescription:`Preview this item as respondents will see it.`,conditionsDescription:`Visibility and branching rules for this item.`,prefillRules:`Prefill rules`,prefillRulesDescription:`Map existing survey data into this item automatically.`,exportSettings:`Export settings`,exportSettingsDescription:`Control how this item is represented in exports.`,comingSoon:`Coming soon`,comingSoonDescription:`This configuration area is planned but not available yet.`},tabTrigger:{switchToThisView:`Switch to this view`,then:`then`},itemSiblingNavigation:{goToNextSiblingItem:`Go to next sibling item`,nextSibling:`Next sibling`,goToPreviousSiblingItem:`Go to previous sibling item`,previousSibling:`Previous sibling`},copyItem:{copied:`Item copied to clipboard`,failed:`Failed to copy item`,failedToClipboard:`Failed to copy item to clipboard`},deleteItem:{removeReferencesTitle:`Remove references before deletion`,removeReferencesDescription:`This item is referenced in other parts of the survey. You need to remove all references before deleting it.`,ok:`Ok`,referencesFoundIn:`References found in:`,deleteSurveyItemTitle:`Delete survey item`,deleteSurveyItemDescription:`Are you sure you want to delete this survey item?`,deletedSuccessfully:`Item "{itemKey}" deleted successfully`,failed:`Failed to delete item`,unknownError:`Unknown error`},itemPreview:{noItemSelected:`No item selected`,noPreviewRenderer:`No preview renderer registered for {itemType}.`,openItem:`Open item`,previewIconAria:`{itemType} preview icon`},itemKeyEditor:{validation:{sameAsCurrent:`Key is the same as the current key`,duplicate:`Key already exists in the group, cannot use duplicate keys.`,dot:`Key cannot contain dots`,space:`Key cannot contain spaces`,empty:`Key cannot be empty`},noKey:`(no-key)`,editItemKey:`Edit item key`,title:`Key editor`,description:`Define the coding key for this item.`,keyLabel:`Key`,placeholder:`Enter new key`,surveyRootItem:`Survey root item`,parentFullKey:`Parent full key: {parentFullKey}`,suggestions:`Suggestions`,regenerate:`Regenerate`,generatingSuggestions:`Generating suggestions...`,noValidSuggestions:`No valid suggestions available. Try regenerate.`},itemLabelEditor:{emptyLabel:`empty label`,editItemLabel:`Edit item label`,placeholder:`Enter item label`},groupItems:{addNewItemToGroup:`Add a new item to the group:`,loadingGroupItem:`loading group item...`,itemPasted:`Item pasted from clipboard`,pasteFailed:`Failed to paste item from clipboard`,selectItemToCopy:`Select an item in the above list to copy`,pageBreak:`Page Break`,insert:`Insert:`,press:`Press`,or:`or`,toInsert:`to insert.`,items:`Items`,doubleClickHelp:`Double click on an item to open it, drag and drop to reorder.`,noItemsYet:`No items yet`,emptyDescription:`Add questions, sections, or other elements to your questionnaire`,addItem:`Add item`},addItemDialog:{entry:{structure:{title:`Organize`,description:`Add a new group container or insert a page break.`},blankItem:{title:`Blank Item`,description:`Start with a blank item type from the current editor registry.`},ai:{title:`AI Assistant`,description:`Describe what you want and our AI agent helps you get started.`},catalogue:{title:`Catalogue`,description:`Add an item from connected shared catalogues or use a custom catalogue.`},comingSoon:`Coming soon`,ariaLabel:`Add options`},structure:{ariaLabel:`Group and page break options`},blankItem:{searchPlaceholder:`Search blank item types...`,noItemTypesFound:`No item types found.`,clipboardHeading:`Clipboard`,pasteFromClipboard:`Paste from clipboard`,pasteFromClipboardDescription:`Insert the item copied from the survey editor`},ai:{describeLabel:`Describe what to create`,describeExample:`Example: "Create a page with one info item and two choice items about sleep habits."`,placeholder:`Describe item intent...`,multipleItemsHint:`AI can generate multiple items and nested groups.`},title:`Add to survey`,addingTo:`Adding to:`,itemCount:`({count} items)`,chooseHowToExpand:`Choose how you want to expand your questionnaire.`,footer:{entry:`Use arrow keys to select or Esc to cancel.`,structure:`Use arrow keys to select or Esc to cancel.`,"blank-item":`Search or type to filter. Use arrow keys to select or Esc to cancel.`,ai:`Describe the item structure you want and let AI propose the first draft.`,catalogue:`Catalogue support is coming soon.`},aiAssistantNotAvailable:`AI Assistant item creation is not available in this host app.`,catalogueComingSoon:`Catalogue item import is coming soon.`,aiGenerationUnavailable:`AI item generation is unavailable.`,aiNeedDescription:`Please provide a short intent description first.`,aiGenerationFailed:`AI item generation failed.`,noValidGroupSelected:`No valid group selected.`,noValidTargetGroupSelected:`No valid target group selected.`,registryItemTypeUnavailable:`Item type "{itemType}" is not available in this editor registry.`,itemAdded:`Item added: {itemKey}`,itemAddFailed:`Failed to add item. Please try again.`,aiReturnedNoItems:`AI did not return any items to create.`,aiNoValidItemsCreated:`No valid items were created from AI response.`,aiSkippedUnresolvedParents:`Created {createdCount} item(s). Skipped {pendingCount} item(s) due to unresolved parent references.`,aiSkippedUnsupportedTypes:`Created {createdCount} item(s). Skipped unsupported types: {itemTypes}`,aiCreatedItems:`Created {createdCount} item(s) from AI intent.`,aiCreateFailed:`Failed to create items from AI response.`},registryLabels:{categories:{special:`Special Items`,display:`Display`,form:`Forms`,question:`Questions`,structure:`Structure`},items:{root:{label:`Root`,description:`Survey root item.`},group:{label:`Group`,description:`A container for organizing survey items.`},pageBreak:{label:`Page break`,description:`Force items after this to appear on a new page.`},infoItem:{label:`Info`,description:`Display-only content: markdown, info, warnings, media (no responses).`},formItem:{label:`Form`,description:`Composable forms with groups and fields.`},choiceItem:{label:`Choice`,description:`Single or multiple choice groups; options may nest forms later.`}}},itemColor:{failedUpdate:`Failed to update item color.`,updated:`Item color updated.`,label:`Item color`,swatchTitle:`Color: {color}`},defaultEditors:{root:{items:`Items`,previewTodo:`todo: preview tab`,conditionsTodo:`todo: conditions tab`},group:{items:`Items`,conditions:`Conditions`,conditionsTodo:`todo: conditions tab`},pageBreak:{branching:`Branching`,title:`Branching logic`,description:`Use this tab to control when this page break should apply.`,todo:`todo: conditions tab`},groupPreview:{emptyTitle:`Empty Group`,emptyDescription:`No items in this group yet`,loading:`Loading preview...`,items:`Items`,itemNotFound:`Item not found`,itemPosition:`Item {index}`,unknownItemKey:`unknown`},pageBreakPreview:{nextPageDescription:`Next items render on a new page.`},questionPreview:{formPlaceholder:`Form item body will render here.`,choicePlaceholder:`Add options to preview this choice item.`,singleChoice:`Single choice`,multipleChoice:`Multiple choice`,choicePreviewMaxUnlimited:`Multiple choice (unlimited)`,choicePreviewMaxUpTo:`Up to {max} choices`,optionLabel:`Option {index}`},infoEditor:{contentPlaceholder:`Add content here, or type / for commands…`},infoPreview:{emptyContent:`No content yet.`},richTextToolbar:{bold:`Bold`,italic:`Italic`,underline:`Underline`,primaryColor:`Primary color`,accentColor:`Accent color`},questionHeader:{titlePlaceholder:`Add a question title...`,subtitlePlaceholder:`Add a subtitle...`,cardFooterPlaceholder:`Add card footer...`},questionBody:{topContentPlaceholder:`Add content before response...`,bottomContentPlaceholder:`Add content after response...`},formEditor:{responseConfig:`Response config`,addFieldGroup:`Add field group`,fieldGroupMenuButton:`Field group settings`,fieldGroupBranching:`Has branching logic`,fieldsLabel:`Fields`,addField:`Add field`,fieldRequired:`Required field`,fieldHasValidations:`Has validations`,fieldInvalid:`Field configuration is invalid`,openFieldEditor:`Open field editor`,editFieldKey:`Edit key…`,deleteField:`Delete field`,fieldDialogTitle:`Edit field`,fieldDialogDescription:`Configure the {fieldType} field, its wrapper content, and its validations.`,fieldKeyDialogTitle:`Edit field key`,fieldKeyDialogDescription:`Update the coding key stored for this field.`,fieldKeyLabel:`Field key`,fieldKeyPlaceholder:`e.g. RESP_01`,fieldKeyDescription:`Keep keys unique within this form item.`,fieldLabelLabel:`Field label`,fieldLabelPlaceholder:`Enter a field label`,fieldDescriptionLabel:`Help text`,fieldDescriptionPlaceholder:`Optional help text for this field`,fieldPlaceholderLabel:`Placeholder`,fieldPlaceholderPlaceholder:`Enter placeholder text`,fieldDatePlaceholder:`Select a date`,fieldDateModeLabel:`Date precision`,fieldDateModePlaceholder:`Choose what respondents can pick`,fieldDatePlaceholders:{year:`Select a year`,"year-month":`Select month and year`,"year-month-day":`Select a date`},fieldRowsLabel:`Rows`,fieldInputModeLabel:`Input mode`,fieldAutocompleteLabel:`Autocomplete`,fieldAutocompletePlaceholder:`e.g. email or organization`,fieldUnitLabel:`Unit`,fieldUnitPlaceholder:`e.g. years`,fieldDefaultValueLabel:`Default value`,fieldStepLabel:`Step`,fieldCheckedLabelLabel:`Checked label`,fieldCheckedLabelPlaceholder:`Shown when the switch is on`,fieldUncheckedLabelLabel:`Unchecked label`,fieldUncheckedLabelPlaceholder:`Shown when the switch is off`,fieldDefaultCheckedLabel:`Default on state`,fieldAllowClearLabel:`Allow clearing the selection`,fieldOptionsLabel:`Options`,fieldOptionsDescription:`Each select option needs a stored value. Labels can be filled in later.`,fieldAddOption:`Add option`,fieldOptionLabel:`Option {index} label`,fieldOptionValueLabel:`Option value`,fieldRemoveOption:`Remove option`,fieldReorderOption:`Reorder option`,fieldSelectPlaceholder:`Select an option`,fieldMinLabel:`Minimum`,fieldMaxLabel:`Maximum`,fieldShowValueLabel:`Show value`,fieldValidationSettingsTitle:`Validations`,fieldValidationSettingsDescription:`Add type-specific checks for the field value.`,fieldValidationValueLabel:`Validation value`,fieldValidationMessageLabel:`Validation message`,fieldValidationMessagePlaceholder:`Optional override shown when the rule fails`,fieldNoAdditionalValidations:`No additional validations are suggested for this field type.`,fieldRemoveValidation:`Remove validation`,fieldRendererSummaryTitle:`Renderer contract`,fieldRendererSummaryDescription:`The renderer can compose each field with these shadcn building blocks.`,fieldControllerSummaryLabel:`Controller`,fieldSuggestionsTitle:`Type suggestions`,fieldSuggestionsDescription:`Suggested config attributes and validations for this field type.`,fieldConfigSuggestionsLabel:`Suggested config`,fieldValidationSuggestionsLabel:`Suggested validations`,fieldIssuesTitle:`Config issues`,fieldIssuesDescription:`Resolve these issues before saving the field.`,fieldKeyRequired:`Enter a unique field key.`,fieldKeyDuplicate:`Field keys must be unique within a form item.`,fieldSelectOptionsRequired:`Select fields need at least one option.`,fieldSelectOptionIncomplete:`Each select option needs a stored key.`,fieldSelectOptionLabelMissing:`One or more options are missing a visible label.`,fieldSelectOptionDuplicate:`Option keys must be unique within the list.`,fieldSliderRangeInvalid:`Slider minimum must be lower than the maximum.`,fieldSliderStepInvalid:`Slider step must be greater than zero.`,fieldSliderDefaultInvalid:`Slider default value must stay within the configured range.`,fieldNumberStepInvalid:`Number step must be greater than zero.`,fieldDateRangeInvalid:`Earliest date must not be later than the latest date.`,fieldValidationInvalid:`One or more validations are missing a required value.`,fieldValidationDuplicate:`Each validation type can only be added once per field.`,dragHandle:`Reorder field`,sortDialogTitle:`Sort fields`,sortDialogDescription:`Drag fields to update the order in {groupTitle}. Changes are saved immediately.`,sortDialogUntitledGroup:`this field group`,sortDialogEmpty:`No fields yet`,sortDialogClose:`Ready`,groupHeaderDialogTitle:`Change group header`,groupHeaderDialogDescription:`Update the group title and description.`,groupHeaderTitleLabel:`Title`,groupHeaderTitlePlaceholder:`Optional group title`,groupHeaderDescriptionLabel:`Description`,groupHeaderDescriptionPlaceholder:`Optional group description`,layoutDialogTitle:`Field group layout`,layoutDialogDescription:`Set how many columns fields use at each width of the field group card (container queries in rem, not the whole screen). Changes apply when you save.`,layoutBreakpointCompact:`Below @xs — group card under 20rem wide`,layoutBreakpointAtXs:`@xs — group card ≥20rem (320px)`,layoutBreakpointAtSm:`@sm — group card ≥24rem (384px)`,layoutBreakpointAtMd:`@md — group card ≥28rem (448px)`,layoutBreakpointAtXl:`@xl — group card ≥36rem (576px)`,layoutDecreaseColumns:`Fewer columns`,layoutIncreaseColumns:`More columns`,fieldTypes:{input:`Input`,textarea:`Textarea`,number:`Number`,datepicker:`Date picker`,switch:`Switch`,select:`Select`,slider:`Slider`},fieldDateModes:{year:`Year only`,"year-month":`Year and month`,"year-month-day":`Year, month, and day`},fieldInputModes:{text:`Text`,email:`Email`,tel:`Telephone`,url:`URL`,password:`Password`},fieldGroupMenu:{changeTitle:`Change group header`,editBranching:`Edit branching logic`,editLayout:`Edit layout`,sortFields:`Sort fields`,deleteGroup:`Delete field group`}},infoBoxPopover:{typeLabel:`Type`,toneInfo:`Info`,toneWarning:`Warning`,titleLabel:`Title`,titlePlaceholder:`Title`,contentLabel:`Content`,contentPlaceholder:`Body text`,collapsibleBody:`Collapsible body`,openByDefault:`Open by default`,apply:`Apply`},imagePopover:{dialogTitle:`Edit image`,sourceDescription:`Pick a local survey asset or enter an external image URL.`,apply:`Apply`,tabLocalAsset:`Local asset`,tabExternalUrl:`External URL`,uploadAssetDialogTitle:`Upload local asset`,addLocalAsset:`Add local asset`,urlLabel:`Image URL`,alignmentLabel:`Alignment`,alignLeft:`Left`,alignCenter:`Center`,alignRight:`Right`,altLabel:`Alt text`,altPlaceholder:`Describe the image for accessibility`,widthLabel:`Width`,maxWidthLabel:`Max width`,dimensionPlaceholder:`e.g. 320`,unitPx:`px`,unitPercent:`%`,captionLabel:`Caption`,captionPlaceholder:`Optional caption shown below the image`,uploadFailed:`Could not add the image. Try again.`,uploading:`Uploading…`,deleteAssetConfirmTitle:`Delete this survey image?`,deleteAssetConfirmDescription:`This image is not used anywhere else in the survey. You can remove it from the survey's image library, or keep the file for reuse.`,deleteAssetConfirmPrimary:`Delete image`,deleteAssetKeepFile:`Keep file`},choiceEditor:{responseConfig:`Response config`,responseSettings:`Response settings`,responseSettingsDescription:`Control how respondents can select and see these options.`,maxSelectionLabel:`Max selection`,maxSelectionPlaceholder:`Select max selections`,maxSelectionDescription:`1 shows a single-choice control. Any higher number or unlimited shows checkboxes and limits how many options can be selected.`,maxSelectionUnlimited:`Unlimited`,maxSelectionCustomPlaceholder:`Custom`,shuffleOptionsLabel:`Shuffle items`,shuffleOptionsDescription:`Randomize the option order for each respondent.`,shuffleOptions:`Shuffled`,addResponseElement:`Add response element`,addOptionPlaceholder:`Add an option`,createOptionKeyPlaceholder:`OPT-01`,createOptionKeyAriaLabel:`Option key`,createOptionLabelPlaceholder:`Add option label...`,createOptionLabelAriaLabel:`Option label`,createOptionCancel:`Cancel`,createOptionSubmit:`Submit`,createOptionKeyRequired:`Enter an option key.`,createOptionKeyDuplicate:`Option key must be unique.`,createOptionLabelRequired:`Enter an option label.`,optionLabelFallback:`Option {index}`,dragHandle:`Reorder option`,optionContext:{editLabel:`Edit label…`,editKey:`Edit key…`,editBranching:`Display condition…`,editEmbeddedForm:`Embedded form…`,duplicate:`Duplicate option`,delete:`Remove option`},editOptionDialogTitle:`Edit option`,optionIndicators:{displayCondition:`Has display condition`,embeddedForm:`Has embedded form`},embeddedFormDialog:{title:`Embedded form`,description:`Build the inline form shown when respondents select {optionLabel}.`}},assetManager:{uploadLabel:`Upload image assets`,uploadDescription:`Click to browse or drag and drop`,uploadAction:`Pick images`,uploadDrag:`or drag and drop`,uploadActive:`Drop images here`,nameLabel:`Custom name`,namePlaceholder:`Custom name (optional)`,externalPlaceholder:`https://example.com/image.png`,existingAssets:`Image assets`,empty:`No image assets yet.`,replaceAsset:`Replace`,removeAsset:`Remove asset`,usedByLabel:`Used in {count} items`,deleteBlocked:`This asset is in use and cannot be removed.`,unusedAssetWarning:`Unused asset. It can be removed safely.`,surveyRootItem:`Survey root item`,sourceEmbedded:`Embedded`,pickerAssets:`Choose existing asset`,pickerExternal:`Use external URL`,useExternal:`Use URL`,expandPreview:`View full image`,closePreview:`Close preview`,previewTitle:`Image preview`},placeholder:{structure:`Structure`,preview:`Preview`,conditions:`Conditions`,addContentBeforeResponse:`Add content before response`,addContentAfterResponse:`Add content after response`,structureTodo:`todo: structure editor`,previewTodo:`todo: preview`,conditionsTodo:`todo: conditions`}}}},iw=e=>typeof e==`object`&&!!e&&!Array.isArray(e),aw=(e,t)=>{if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(iw(t)&&iw(r)){n[e]=aw(t,r);continue}n[e]=r}return n},ow=e=>{let t={...rw};if(!e)return t;for(let[n,r]of Object.entries(e)){let e=t[n];t[n]=e?aw(e,r):r}return t},sw=e=>e.trim().toLowerCase(),cw=e=>{let t=sw(e||`en`),n=t.split(`-`)[0];return Array.from(new Set([t,n,`en`]))},lw=(e,t)=>{if(!e)return;let n=e;for(let e of t.split(`.`)){if(!iw(n)||!(e in n))return;n=n[e]}return typeof n==`string`?n:void 0},uw=(e,t)=>t?e.replace(/\{([a-zA-Z0-9_]+)\}/g,(e,n)=>{let r=t[n];return r==null?`{${n}}`:String(r)}):e,dw=(e,t)=>(n,r)=>{for(let i of cw(e)){let e=lw(t[i],n);if(e!==void 0)return uw(e,r)}return console.log(`[SurveyEditor] Missing localization for key "${n}" in language "${e}".`),n},fw=(e,t)=>{let n=t?.trim();return n?(t,r)=>e(`${n}.${t}`,r):e},pw={de:In,en:Jt},mw=e=>({...pw,...e??{}}),hw=(e,t=pw)=>{let n=e.trim().toLowerCase(),r=n.split(`-`)[0];return t[n]??t[r]??Jt},gw=(0,u.createContext)(void 0),_w=({children:e,helpLink:t,aiProvider:n=null,fallbackLocale:r=`en`,language:i=`en`,localizations:a,dateLocales:o})=>{let s=r.trim()||`en`,c=i.trim()||`en`,l=(0,u.useMemo)(()=>ow(a),[a]),d=(0,u.useMemo)(()=>dw(c,l),[l,c]),f=(0,u.useMemo)(()=>mw(o),[o]),m={helpLink:t,aiProvider:n,fallbackLocale:s,language:c,localizations:l,dateLocales:f,dateLocale:(0,u.useMemo)(()=>hw(c,f),[f,c]),translate:d};return(0,p.jsx)(gw.Provider,{value:m,children:(0,p.jsxs)($C,{delayDuration:500,children:[(0,p.jsx)(KC,{children:(0,p.jsx)(px,{children:e})}),(0,p.jsx)(QC,{})]})})},vw=()=>{let e=(0,u.useContext)(gw);if(e===void 0)throw Error(`useSurveyEditorConfig must be used within a SurveyEditorConfigProvider`);return e},yw=()=>vw().aiProvider,G=e=>{let{translate:t}=vw();return(0,u.useMemo)(()=>fw(t,e),[e,t])},bw=()=>vw().dateLocale,xw=({itemId:e})=>{let t=G(),n=W(e=>e.copyItem);return(0,p.jsxs)(dC,{onClick:()=>{try{let r=n(e);navigator.clipboard.writeText(JSON.stringify(r,null,2)).then(()=>{_C(),OC.success(t(`copyItem.copied`))}).catch(()=>{OC.error(t(`copyItem.failed`))})}catch(e){console.error(`Error copying item:`,e),OC.error(t(`copyItem.failed`))}},children:[(0,p.jsx)(kS,{className:`size-4 mr-2`}),t(`common.actions.copy`)]})};function Sw(){return W(e=>e.editor)}function Cw(){let e=W(e=>e.editor);return(0,u.useMemo)(()=>e?.survey??null,[e,W(e=>e.changeTick)])}function ww(){return bC((e,t)=>({location:{view:`item-editor`},history:[],adapter:null,setAdapter:n=>{let r=t();r._adapterUnsubscribe&&r._adapterUnsubscribe(),e({adapter:n}),e({location:n.getLocation()}),e({_adapterUnsubscribe:n.subscribe(t=>{e({location:t})})})},clearAdapter:()=>{let n=t();n._adapterUnsubscribe&&n._adapterUnsubscribe(),e({adapter:null,_adapterUnsubscribe:void 0})},navigate:(n,r=!1)=>{let{adapter:i,history:a}=t();if(i){i.navigateTo(n,{replace:r});return}e({location:n,history:r?a:[...a,n]})}}))}var Tw=(0,u.createContext)(null),Ew=({children:e,adapter:t})=>{let[n]=(0,u.useState)(()=>ww());return(0,u.useEffect)(()=>(t?n.getState().setAdapter(t):n.getState().clearAdapter(),()=>{n.getState().clearAdapter()}),[n,t]),(0,p.jsx)(Tw.Provider,{value:n,children:e})};function Dw(e){let t=(0,u.useContext)(Tw);if(!t)throw Error(`useSurveyEditorNavigationStore must be used within a SurveyEditorNavigationStoreProvider`);return xC(t,e)}var Ow=()=>{let e=Dw(e=>e.location),t=Dw(e=>e.navigate),n=Cw(),r=e.view===`item-editor`?e.itemId:void 0,i=(0,u.useEffectEvent)((e,n)=>{t(e,n)});return(0,u.useEffect)(()=>{n&&r&&!n.surveyItems.get(r)&&i({view:`item-editor`},!0)},[n,r]),{selectedItemId:r,navigateToItem:e=>{e!==r&&t(e?{view:`item-editor`,itemId:e}:{view:`item-editor`})}}},kw=Symbol.for(`preact-signals`);function Aw(){if(Iw>1)Iw--;else{var e,t=!1;for((function(){var e=Bw;for(Bw=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o})();Fw!==void 0;){var n=Fw;for(Fw=void 0,Lw++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Gw(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Lw=0,Iw--,t)throw e}}function jw(e){if(Iw>0)return e();zw=++Rw,Iw++;try{return e()}finally{Aw()}}var Mw=void 0;function Nw(e){var t=Mw;Mw=void 0;try{return e()}finally{Mw=t}}var Pw,Fw=void 0,Iw=0,Lw=0,Rw=0,zw=0,Bw=void 0,Vw=0;function Hw(e){if(Mw!==void 0){var t=e.n;if(t===void 0||t.t!==Mw)return t={i:0,S:e,p:Mw.s,n:void 0,t:Mw,e:void 0,x:void 0,r:t},Mw.s!==void 0&&(Mw.s.n=t),Mw.s=t,e.n=t,32&Mw.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Mw.s,t.n=void 0,Mw.s.n=t,Mw.s=t),t}}function Uw(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Uw.prototype.brand=kw,Uw.prototype.h=function(){return!0},Uw.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Nw(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},Uw.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Nw(function(){var e;(e=t.Z)==null||e.call(t)}))}},Uw.prototype.subscribe=function(e){var t=this;return eT(function(){var n=t.value,r=Mw;Mw=void 0;try{e(n)}finally{Mw=r}},{name:`sub`})},Uw.prototype.valueOf=function(){return this.value},Uw.prototype.toString=function(){return this.value+``},Uw.prototype.toJSON=function(){return this.value},Uw.prototype.peek=function(){var e=this;return Nw(function(){return e.value})},Object.defineProperty(Uw.prototype,`value`,{get:function(){var e=Hw(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Lw>100)throw Error(`Cycle detected`);(function(e){Iw!==0&&Lw===0&&e.l!==zw&&(e.l=zw,Bw={S:e,v:e.v,i:e.i,o:Bw})})(this),this.v=e,this.i++,Vw++,Iw++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Aw()}}}});function Ww(e,t){return new Uw(e,t)}function Gw(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Kw(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function qw(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Jw(e,t){Uw.call(this,void 0),this.x=e,this.s=void 0,this.g=Vw-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Jw.prototype=new Uw,Jw.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Vw))return!0;if(this.g=Vw,this.f|=1,this.i>0&&!Gw(this))return this.f&=-2,!0;var e=Mw;try{Kw(this),Mw=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Mw=e,qw(this),this.f&=-2,!0},Jw.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Uw.prototype.S.call(this,e)},Jw.prototype.U=function(e){if(this.t!==void 0&&(Uw.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Jw.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Jw.prototype,`value`,{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=Hw(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Yw(e,t){return new Jw(e,t)}function Xw(e){var t=e.m;if(e.m=void 0,typeof t==`function`){Iw++;var n=Mw;Mw=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Zw(e),t}finally{Mw=n,Aw()}}}function Zw(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Xw(e)}function Qw(e){if(Mw!==this)throw Error(`Out-of-order effect`);qw(this),Mw=e,this.f&=-2,8&this.f&&Zw(this),Aw()}function $w(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Pw&&Pw.push(this)}$w.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},$w.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Xw(this),Kw(this),Iw++;var e=Mw;return Mw=this,Qw.bind(this,e)},$w.prototype.N=function(){2&this.f||(this.f|=2,this.u=Fw,Fw=this)},$w.prototype.d=function(){this.f|=8,1&this.f||Zw(this)},$w.prototype.dispose=function(){this.d()};function eT(e,t){var n=new $w(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var tT=Object.create,nT=Object.defineProperty,rT=Object.defineProperties,iT=Object.getOwnPropertyDescriptor,aT=Object.getOwnPropertyDescriptors,oT=Object.getOwnPropertySymbols,sT=Object.prototype.hasOwnProperty,cT=Object.prototype.propertyIsEnumerable,lT=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),uT=e=>{throw TypeError(e)},dT=(e,t,n)=>t in e?nT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fT=(e,t)=>{for(var n in t||={})sT.call(t,n)&&dT(e,n,t[n]);if(oT)for(var n of oT(t))cT.call(t,n)&&dT(e,n,t[n]);return e},pT=(e,t)=>rT(e,aT(t)),mT=(e,t)=>nT(e,`name`,{value:t,configurable:!0}),hT=e=>[,,,tT(e?.[lT(`metadata`)]??null)],gT=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],_T=e=>e!==void 0&&typeof e!=`function`?uT(`Function expected`):e,vT=(e,t,n,r,i)=>({kind:gT[e],name:t,metadata:r,addInitializer:e=>n._?uT(`Already initialized`):i.push(_T(e||null))}),yT=(e,t)=>dT(t,lT(`metadata`),e[3]),bT=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},xT=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=gT[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&iT(d<4?i:{get[n](){return wT(this,a)},set[n](e){return ET(this,a,e)}},n));d?p&&d<4&&mT(a,(d>2?`set `:d>1?`get `:``)+n):mT(i,n);for(var y=r.length-1;y>=0;y--)l=vT(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>CT(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?wT:DT)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>ET(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?_T(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?uT(`Object expected`):(_T(o=s.get)&&(v.get=o),_T(o=s.set)&&(v.set=o),_T(o=s.init)&&g.unshift(o));return d||yT(e,i),v&&nT(i,n,v),p?d^4?a:v:i},ST=(e,t,n)=>t.has(e)||uT(`Cannot `+n),CT=(e,t)=>Object(t)===t?e.has(t):uT(`Cannot use the "in" operator on this value`),wT=(e,t,n)=>(ST(e,t,`read from private field`),n?n.call(e):t.get(e)),TT=(e,t,n)=>t.has(e)?uT(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),ET=(e,t,n,r)=>(ST(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),DT=(e,t,n)=>(ST(e,t,`access private method`),n);function OT(e,t){if(t){let n;return Yw(()=>{let r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Yw(e)}function kT(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e==`function`&&typeof t==`function`)return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((e,n)=>!kT(e,t[n]));if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?!n.some(n=>!kT(e[n],t[n])):!1}return!1}function AT({get:e},t){return{init(e){return Ww(e)},get(){return e.call(this).value},set(t){let n=e.call(this);n.peek()!==t&&(n.value=t)}}}function jT(e,t){let n=new WeakMap;return function(){let t=n.get(this);return t||(t=OT(e.bind(this)),n.set(this,t)),t.value}}function MT(e=!0){return function(t,n){n.addInitializer(function(){let t=n.kind===`field`||n.static?this:Object.getPrototypeOf(this),r=Object.getOwnPropertyDescriptor(t,n.name);r&&Object.defineProperty(t,n.name,pT(fT({},r),{enumerable:e}))})}}function NT(...e){let t=e.map(e=>eT(e));return()=>t.forEach(e=>e())}var PT,FT,IT,LT,RT,zT=[AT],BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T;RT=[AT],LT=[AT],IT=[MT()],FT=[MT()],PT=[MT()];var eE=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,bT(BT,5,this),TT(this,GT),TT(this,VT,bT(BT,8,this)),bT(BT,11,this),TT(this,KT,bT(BT,12,this)),bT(BT,15,this),TT(this,XT,bT(BT,16,this)),bT(BT,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return wT(this,GT,QT)}get initial(){return wT(this,GT,UT)}get previous(){return wT(this,GT,JT)}set current(e){let t=Nw(()=>wT(this,GT,QT));e&&t&&this.equals(t,e)||jw(()=>{wT(this,GT,UT)||ET(this,GT,e,WT),ET(this,GT,t,YT),ET(this,GT,e,$T)})}reset(e=this.defaultValue){jw(()=>{ET(this,GT,void 0,YT),ET(this,GT,e,WT),ET(this,GT,e,$T)})}};BT=hT(null),VT=new WeakMap,GT=new WeakSet,KT=new WeakMap,XT=new WeakMap,HT=xT(BT,20,`#initial`,zT,GT,VT),UT=HT.get,WT=HT.set,qT=xT(BT,20,`#previous`,RT,GT,KT),JT=qT.get,YT=qT.set,ZT=xT(BT,20,`#current`,LT,GT,XT),QT=ZT.get,$T=ZT.set,xT(BT,2,`current`,IT,eE),xT(BT,2,`initial`,FT,eE),xT(BT,2,`previous`,PT,eE),yT(BT,eE);function tE(e){return Nw(()=>{let t={};for(let n in e)t[n]=e[n];return t})}var nE,rE=class{constructor(){TT(this,nE,new WeakMap)}get(e,t){return e?wT(this,nE).get(e)?.get(t):void 0}set(e,t,n){if(e)return wT(this,nE).has(e)||wT(this,nE).set(e,new Map),wT(this,nE).get(e)?.set(t,n)}clear(e){return e?wT(this,nE).get(e)?.clear():void 0}};nE=new WeakMap;var iE=Object.create,aE=Object.defineProperty,oE=Object.getOwnPropertyDescriptor,sE=Object.getOwnPropertySymbols,cE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,uE=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),dE=e=>{throw TypeError(e)},fE=Math.pow,pE=(e,t,n)=>t in e?aE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mE=(e,t)=>{for(var n in t||={})cE.call(t,n)&&pE(e,n,t[n]);if(sE)for(var n of sE(t))lE.call(t,n)&&pE(e,n,t[n]);return e},hE=(e,t)=>aE(e,`name`,{value:t,configurable:!0}),gE=e=>[,,,iE(e?.[uE(`metadata`)]??null)],_E=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],vE=e=>e!==void 0&&typeof e!=`function`?dE(`Function expected`):e,yE=(e,t,n,r,i)=>({kind:_E[e],name:t,metadata:r,addInitializer:e=>n._?dE(`Already initialized`):i.push(vE(e||null))}),bE=(e,t)=>pE(t,uE(`metadata`),e[3]),xE=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},SE=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=_E[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&oE(d<4?i:{get[n](){return TE(this,a)},set[n](e){return DE(this,a,e)}},n));d?p&&d<4&&hE(a,(d>2?`set `:d>1?`get `:``)+n):hE(i,n);for(var y=r.length-1;y>=0;y--)l=yE(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>wE(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?TE:OE)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>DE(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?vE(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?dE(`Object expected`):(vE(o=s.get)&&(v.get=o),vE(o=s.set)&&(v.set=o),vE(o=s.init)&&g.unshift(o));return d||bE(e,i),v&&aE(i,n,v),p?d^4?a:v:i},CE=(e,t,n)=>t.has(e)||dE(`Cannot `+n),wE=(e,t)=>Object(t)===t?e.has(t):dE(`Cannot use the "in" operator on this value`),TE=(e,t,n)=>(CE(e,t,`read from private field`),n?n.call(e):t.get(e)),EE=(e,t,n)=>t.has(e)?dE(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),DE=(e,t,n,r)=>(CE(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),OE=(e,t,n)=>(CE(e,t,`access private method`),n),kE=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},AE=class e{constructor(e,t,n,r){this.left=e,this.top=t,this.width=n,this.height=r,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){let{top:r,left:i,width:a,height:o,scale:s}=this,c=new e(i+t,r+n,a,o);return c.scale=mE({},s),c}get boundingRectangle(){let{width:e,height:t,left:n,top:r,right:i,bottom:a}=this;return{width:e,height:t,left:n,top:r,right:i,bottom:a}}get center(){let{left:e,top:t,right:n,bottom:r}=this;return new kE((e+n)/2,(t+r)/2)}get area(){let{width:e,height:t}=this;return e*t}equals(t){if(!(t instanceof e))return!1;let{left:n,top:r,width:i,height:a}=this;return n===t.left&&r===t.top&&i===t.width&&a===t.height}containsPoint(e){let{top:t,left:n,bottom:r,right:i}=this;return t<=e.y&&e.y<=r&&n<=e.x&&e.x<=i}intersectionArea(t){return t instanceof e?jE(this,t):0}intersectionRatio(e){let{area:t}=this,n=this.intersectionArea(e);return n/(e.area+t-n)}get bottom(){let{top:e,height:t}=this;return e+t}get right(){let{left:e,width:t}=this;return e+t}get aspectRatio(){let{width:e,height:t}=this;return e/t}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new e(n,t,r,i)}static delta(e,t,n={x:`center`,y:`center`}){let r=(e,t)=>{let r=n[t],i=t===`x`?e.left:e.top,a=t===`x`?e.width:e.height;return r==`start`?i:r==`end`?i+a:i+a/2};return kE.delta({x:r(e,`x`),y:r(e,`y`)},{x:r(t,`x`),y:r(t,`y`)})}static intersectionRatio(t,n){return e.from(t).intersectionRatio(e.from(n))}};function jE(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;return r<i&&n<a?o*s:0}var ME,NE,PE,FE,IE,LE=class extends (PE=eE,NE=[jT],ME=[jT],PE){constructor(e){let t=kE.from(e);super(t,(e,t)=>kE.equals(e,t)),xE(IE,5,this),EE(this,FE,0),this.velocity={x:0,y:0}}get delta(){return kE.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=kE.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-TE(this,FE),o=e=>Math.round(e/a*100);jw(()=>{DE(this,FE,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(kE.from(e)),this.velocity={x:0,y:0}}};IE=gE(PE),FE=new WeakMap,SE(IE,2,`delta`,NE,LE),SE(IE,2,`direction`,ME,LE),bE(IE,LE);function RE({x:e,y:t},n){let r=Math.abs(e),i=Math.abs(t);return typeof n==`number`?Math.sqrt(fE(r,2)+fE(i,2))>n:`x`in n&&`y`in n?r>n.x&&i>n.y:`x`in n?r>n.x:`y`in n?i>n.y:!1}var zE=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(zE||{}),BE=Object.values(zE),VE=Object.create,HE=Object.defineProperty,UE=Object.defineProperties,WE=Object.getOwnPropertyDescriptor,GE=Object.getOwnPropertyDescriptors,KE=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,YE=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),XE=e=>{throw TypeError(e)},ZE=(e,t,n)=>t in e?HE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QE=(e,t)=>{for(var n in t||={})qE.call(t,n)&&ZE(e,n,t[n]);if(KE)for(var n of KE(t))JE.call(t,n)&&ZE(e,n,t[n]);return e},$E=(e,t)=>UE(e,GE(t)),eD=(e,t)=>HE(e,`name`,{value:t,configurable:!0}),tD=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&KE)for(var r of KE(e))t.indexOf(r)<0&&JE.call(e,r)&&(n[r]=e[r]);return n},nD=e=>[,,,VE(e?.[YE(`metadata`)]??null)],rD=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],iD=e=>e!==void 0&&typeof e!=`function`?XE(`Function expected`):e,aD=(e,t,n,r,i)=>({kind:rD[e],name:t,metadata:r,addInitializer:e=>n._?XE(`Already initialized`):i.push(iD(e||null))}),oD=(e,t)=>ZE(t,YE(`metadata`),e[3]),sD=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},cD=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=rD[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&WE(d<4?i:{get[n](){return dD(this,a)},set[n](e){return pD(this,a,e)}},n));d?p&&d<4&&eD(a,(d>2?`set `:d>1?`get `:``)+n):eD(i,n);for(var y=r.length-1;y>=0;y--)l=aD(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>uD(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?dD:mD)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>pD(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?iD(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?XE(`Object expected`):(iD(o=s.get)&&(v.get=o),iD(o=s.set)&&(v.set=o),iD(o=s.init)&&g.unshift(o));return d||oD(e,i),v&&HE(i,n,v),p?d^4?a:v:i},lD=(e,t,n)=>t.has(e)||XE(`Cannot `+n),uD=(e,t)=>Object(t)===t?e.has(t):XE(`Cannot use the "in" operator on this value`),dD=(e,t,n)=>(lD(e,t,`read from private field`),n?n.call(e):t.get(e)),fD=(e,t,n)=>t.has(e)?XE(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),pD=(e,t,n,r)=>(lD(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),mD=(e,t,n)=>(lD(e,t,`access private method`),n);function hD(e,t){return{plugin:e,options:t}}function gD(e){return t=>hD(e,t)}function _D(e){return typeof e==`function`?{plugin:e,options:void 0}:e}var vD=[AT],yD,bD,xD,SD=class{constructor(e,t){this.manager=e,this.options=t,fD(this,bD,sD(yD,8,this,!1)),sD(yD,11,this),fD(this,xD,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return Nw(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){let t=eT(e.bind(this));return dD(this,xD).add(t),t}destroy(){dD(this,xD).forEach(e=>e())}static configure(e){return hD(this,e)}};yD=nD(null),bD=new WeakMap,xD=new WeakMap,cD(yD,4,`disabled`,vD,SD,bD),oD(yD,SD);var CD=class extends SD{},wD,TD=class{constructor(e){this.manager=e,this.instances=new Map,fD(this,wD,[])}get values(){return Array.from(this.instances.values())}set values(e){let t=e.map(_D).reduce((e,t)=>{let n=e.find(({plugin:e})=>e===t.plugin);return n?(n.options=t.options,e):[...e,t]},[]),n=t.map(({plugin:e})=>e);for(let e of dD(this,wD))if(!n.includes(e)){if(e.prototype instanceof CD)continue;this.unregister(e)}for(let{plugin:e,options:n}of t)this.register(e,n);pD(this,wD,n)}get(e){return this.instances.get(e)}register(e,t){let n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;let r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){let t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(let e of this.instances.values())e.destroy();this.instances.clear()}};wD=new WeakMap;function ED(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var DD=[],OD,kD,AD=class extends SD{constructor(e){super(e),fD(this,OD),fD(this,kD),this.computeCollisions=this.computeCollisions.bind(this),pD(this,kD,Ww(DD)),this.destroy=NT(()=>{let e=this.computeCollisions(),t=Nw(()=>this.manager.dragOperation.position.current);if(e!==DD){let e=dD(this,OD);if(pD(this,OD,t),e&&t.x==e.x&&t.y==e.y)return}else pD(this,OD,void 0);dD(this,kD).value=e},()=>{let{dragOperation:e}=this.manager;e.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){Nw(()=>{e?dD(this,kD).value=this.computeCollisions():pD(this,OD,void 0)})}computeCollisions(e,t){let{registry:n,dragOperation:r}=this.manager,{source:i,shape:a,status:o}=r;if(!o.initialized||!a)return DD;let s=[],c=[];for(let a of e??n.droppables){if(a.disabled||i&&!a.accepts(i))continue;let e=t??a.collisionDetector;if(!e)continue;c.push(a),a.shape;let n=Nw(()=>e({droppable:a,dragOperation:r}));n&&(a.collisionPriority!=null&&(n.priority=a.collisionPriority),s.push(n))}return c.length===0?DD:(s.sort(ED),s)}get collisions(){return dD(this,kD).value}};OD=new WeakMap,kD=new WeakMap;var jD,MD,ND=[AT],PD,FD,ID,LD,RD,zD,BD;MD=[AT],jD=[AT];var VD=class e{constructor(e,t){fD(this,LD,sD(ID,8,this)),sD(ID,11,this),fD(this,RD),fD(this,zD,sD(ID,12,this)),sD(ID,15,this),fD(this,BD,sD(ID,16,this)),sD(ID,19,this);let{effects:n,id:r,data:i={},disabled:a=!1,register:o=!0}=e,s=r;pD(this,RD,Ww(r)),this.manager=t,this.data=i,this.disabled=a,this.effects=()=>[()=>{let{id:e,manager:t}=this;if(e!==s)return s=e,t?.registry.register(this),()=>t?.registry.unregister(this)},...n?.()??[]],this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),t&&o&&queueMicrotask(this.register)}get id(){let t=dD(this,RD).value;return e.pendingIdChanges?.get(this)??t}set id(t){t!==(e.pendingIdChanges?.get(this)??dD(this,RD).peek())&&(e.pendingIdChanges||(e.pendingIdChanges=new Map,queueMicrotask(()=>{var t;return mD(t=e,PD,FD).call(t)})),e.pendingIdChanges.set(this,t))}register(){return this.manager?.registry.register(this)}unregister(){var e;(e=this.manager)==null||e.registry.unregister(this)}destroy(){var e;(e=this.manager)==null||e.registry.unregister(this)}};ID=nD(null),PD=new WeakSet,FD=function(){let e=VD.pendingIdChanges;VD.pendingIdChanges=null,e&&jw(()=>{for(let[t,n]of e)dD(t,RD).value=n})},LD=new WeakMap,RD=new WeakMap,zD=new WeakMap,BD=new WeakMap,cD(ID,4,`manager`,ND,VD,LD),cD(ID,4,`data`,MD,VD,zD),cD(ID,4,`disabled`,jD,VD,BD),fD(VD,PD),oD(ID,VD),VD.pendingIdChanges=null;var HD=VD,UD=class{constructor(){this.map=Ww(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{let n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));let a=new Map(n);for(let[r,i]of n)if(i===t&&r!==e){a.delete(r);break}a.set(e,t),this.map.value=a;let o=NT(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{let n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);let r=new Map(n);r.delete(e),this.map.value=r}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(let e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},WD,GD,KD,qD,JD,YD,XD,ZD,QD,$D,eO,tO=class extends (XD=HD,YD=[AT],JD=[AT],qD=[AT],KD=[jT],GD=[jT],WD=[jT],XD){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:a,plugins:o,effects:s}=n,c=tD(n,[`modifiers`,`type`,`sensors`,`plugins`,`effects`]);super($E(QE({},c),{effects:()=>[...s?.()??[],()=>{let{manager:e,plugins:t}=this;if(!(!e||!t))for(let n of t){let{plugin:t}=_D(n);e.registry.plugins.register(t)}}]}),t),sD(ZD,5,this),fD(this,QD,sD(ZD,8,this)),sD(ZD,11,this),fD(this,$D,sD(ZD,12,this)),sD(ZD,15,this),fD(this,eO,sD(ZD,16,this,this.isDragSource?`dragging`:`idle`)),sD(ZD,19,this),this.type=i,this.sensors=a,this.modifiers=r,this.alignment=c.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(let t of this.plugins){let n=_D(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status===`dropping`&&this.isDragSource}get isDragging(){return this.status===`dragging`&&this.isDragSource}get isDragSource(){return this.manager?.dragOperation.source?.id===this.id}};ZD=nD(XD),QD=new WeakMap,$D=new WeakMap,eO=new WeakMap,cD(ZD,4,`type`,YD,tO,QD),cD(ZD,4,`modifiers`,JD,tO,$D),cD(ZD,4,`status`,qD,tO,eO),cD(ZD,2,`isDropping`,KD,tO),cD(ZD,2,`isDragging`,GD,tO),cD(ZD,2,`isDragSource`,WD,tO),oD(ZD,tO);var nO,rO,iO,aO,oO,sO,cO,lO,uO,dO,fO,pO,mO,hO=class extends (cO=HD,sO=[AT],oO=[AT],aO=[AT],iO=[AT],rO=[AT],nO=[jT],cO){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:a,type:o}=n,s=tD(n,[`accept`,`collisionDetector`,`collisionPriority`,`type`]);super(s,t),sD(lO,5,this),fD(this,uO,sD(lO,8,this)),sD(lO,11,this),fD(this,dO,sD(lO,12,this)),sD(lO,15,this),fD(this,fO,sD(lO,16,this)),sD(lO,19,this),fD(this,pO,sD(lO,20,this)),sD(lO,23,this),fD(this,mO,sD(lO,24,this)),sD(lO,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=a,this.type=o}accepts(e){let{accept:t}=this;return t?typeof t==`function`?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){return this.manager?.dragOperation.target?.id===this.id}};lO=nD(cO),uO=new WeakMap,dO=new WeakMap,fO=new WeakMap,pO=new WeakMap,mO=new WeakMap,cD(lO,4,`accept`,sO,hO,uO),cD(lO,4,`type`,oO,hO,dO),cD(lO,4,`collisionDetector`,aO,hO,fO),cD(lO,4,`collisionPriority`,iO,hO,pO),cD(lO,4,`shape`,rO,hO,mO),cD(lO,2,`isDropTarget`,nO,hO),oD(lO,hO);var gO=class{constructor(){this.registry=new Map}addEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){let{registry:n}=this,r=n.get(e);if(r)for(let e of r)e(...t)}},_O=class extends gO{constructor(e){super(),this.manager=e}dispatch(e,t){let n=[t,this.manager];super.dispatch(e,...n)}};function vO(e,t=!0){let n=!1;return $E(QE({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var yO=class extends CD{constructor(e){super(e);let t=(e,t)=>e.map(({id:e})=>e).join(``)===t.map(({id:e})=>e).join(``),n=[];this.destroy=NT(()=>{let{dragOperation:t,collisionObserver:r}=e;t.status.initializing&&(n=[],r.enable())},()=>{let{collisionObserver:r,monitor:i}=e,{collisions:a}=r;if(r.isDisabled()||HD.pendingIdChanges)return;let o=vO({collisions:a});if(i.dispatch(`collision`,o),o.defaultPrevented||t(a,n))return;n=a;let[s]=a;Nw(()=>{s?.id!==e.dragOperation.target?.id&&(r.disable(),e.actions.setDropTarget(s?.id).then(()=>{r.enable()}))})})}},bO=(e=>(e[e.Lowest=0]=`Lowest`,e[e.Low=1]=`Low`,e[e.Normal=2]=`Normal`,e[e.High=3]=`High`,e[e.Highest=4]=`Highest`,e))(bO||{}),xO=(e=>(e[e.Collision=0]=`Collision`,e[e.ShapeIntersection=1]=`ShapeIntersection`,e[e.PointerIntersection=2]=`PointerIntersection`,e))(xO||{}),SO,CO,wO,TO,EO,DO,OO=[AT],kO,AO;DO=[jT],EO=[jT],TO=[jT],wO=[jT],CO=[jT],SO=[jT];var jO=class{constructor(){sD(kO,5,this),fD(this,AO,sD(kO,8,this,`idle`)),sD(kO,11,this)}get current(){return this.value}get idle(){return this.value===`idle`}get initializing(){return this.value===`initializing`}get initialized(){let{value:e}=this;return e!==`idle`&&e!==`initialization-pending`}get dragging(){return this.value===`dragging`}get dropped(){return this.value===`dropped`}set(e){this.value=e}};kO=nD(null),AO=new WeakMap,cD(kO,4,`value`,OO,jO,AO),cD(kO,2,`current`,DO,jO),cD(kO,2,`idle`,EO,jO),cD(kO,2,`initializing`,TO,jO),cD(kO,2,`initialized`,wO,jO),cD(kO,2,`dragging`,CO,jO),cD(kO,2,`dropped`,SO,jO),oD(kO,jO);var MO=class{constructor(e){this.manager=e}setDragSource(e){let{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e==`string`||typeof e==`number`?e:e.id}setDropTarget(e){return Nw(()=>{let{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;let r=vO({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch(`dragover`,r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return Nw(()=>{let{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw Error(`Cannot start a drag operation without a drag source`);if(!t.status.idle)throw Error(`Cannot start a drag operation while another is active`);let n=new AbortController,{event:r,coordinates:i}=e;jw(()=>{t.status.set(`initialization-pending`),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});let a=vO({operation:t.snapshot()});return this.manager.monitor.dispatch(`beforedragstart`,a),a.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set(`initializing`),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;let{status:e}=t;e.current===`initializing`&&jw(()=>{t.status.set(`dragging`),this.manager.monitor.dispatch(`dragstart`,{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return Nw(()=>{let{dragOperation:t}=this.manager,{status:n,controller:r}=t;if(!n.dragging||!r||r.signal.aborted)return;let i=vO({nativeEvent:e.event,operation:t.snapshot(),by:e.by,to:e.to},e.cancelable??!0);(e.propagate??!0)&&this.manager.monitor.dispatch(`dragmove`,i),queueMicrotask(()=>{if(i.defaultPrevented)return;let n=e.to??{x:t.position.current.x+(e.by?.x??0),y:t.position.current.y+(e.by?.y??0)};t.position.current=n})})}stop(e={}){return Nw(()=>{let{dragOperation:t}=this.manager,{controller:n}=t;if(!n||n.signal.aborted)return;let r,i=()=>{let e={resume:()=>{},abort:()=>{}};return r=new Promise((t,n)=>{e.resume=t,e.abort=n}),e};n.abort();let a=()=>{this.manager.renderer.rendering.then(()=>{t.status.set(`dropped`);let e=Nw(()=>t.source?.status===`dropping`),r=()=>{t.controller===n&&(t.controller=void 0),t.reset()};if(e){let{source:e}=t,n=eT(()=>{e?.status===`idle`&&(n(),r())})}else this.manager.renderer.rendering.then(r)})};t.canceled=e.canceled??!1,this.manager.monitor.dispatch(`dragend`,{nativeEvent:e.event,operation:t.snapshot(),canceled:e.canceled??!1,suspend:i}),r?r.then(a).catch(()=>t.reset()):a()})}},NO=class extends SD{constructor(e,t){super(e,t),this.manager=e,this.options=t}},PO=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(let t of e??[])t.controller=this}onEvent(e){if(!this.activated)if(this.constraints?.length)for(let t of this.constraints)t.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},FO,IO=class{constructor(e){this.options=e,fD(this,FO)}set controller(e){pD(this,FO,e),e.signal.addEventListener(`abort`,()=>this.abort())}activate(e){var t;(t=dD(this,FO))==null||t.activate(e)}};FO=new WeakMap;var LO=class extends SD{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},RO=class{constructor(e){this.draggables=new UD,this.droppables=new UD,this.plugins=new TD(e),this.sensors=new TD(e),this.modifiers=new TD(e)}register(e,t){if(e instanceof tO)return this.draggables.register(e.id,e);if(e instanceof hO)return this.droppables.register(e.id,e);if(e.prototype instanceof LO)return this.modifiers.register(e,t);if(e.prototype instanceof NO)return this.sensors.register(e,t);if(e.prototype instanceof SD)return this.plugins.register(e,t);throw Error(`Invalid instance type`)}unregister(e){if(e instanceof HD)return e instanceof tO?this.draggables.unregister(e.id,e):e instanceof hO?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof LO)return this.modifiers.unregister(e);if(e.prototype instanceof NO)return this.sensors.unregister(e);if(e.prototype instanceof SD)return this.plugins.unregister(e);throw Error(`Invalid instance type`)}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},zO,BO,VO,HO,UO,WO,GO,KO,qO=[jT],JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk;KO=[AT],GO=[AT],WO=[AT],UO=[AT],HO=[AT],VO=[jT],BO=[jT],zO=[jT];var ik=class{constructor(e){sD(ZO,5,this),fD(this,JO),fD(this,YO),fD(this,XO,new eE(void 0,(e,t)=>e&&t?e.equals(t):e===t)),this.status=new jO,fD(this,QO,sD(ZO,8,this,!1)),sD(ZO,11,this),fD(this,$O,sD(ZO,12,this,null)),sD(ZO,15,this),fD(this,ek,sD(ZO,16,this,null)),sD(ZO,19,this),fD(this,tk,sD(ZO,20,this,null)),sD(ZO,23,this),fD(this,nk,sD(ZO,24,this,[])),sD(ZO,27,this),this.position=new LE({x:0,y:0}),fD(this,rk,{x:0,y:0}),pD(this,JO,e)}get shape(){let{current:e,initial:t,previous:n}=dD(this,XO);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?dD(this,XO).current=e:dD(this,XO).reset()}get source(){let e=this.sourceIdentifier;if(e==null)return null;let t=dD(this,JO).registry.draggables.get(e);return t&&pD(this,YO,t),t??dD(this,YO)??null}get target(){let e=this.targetIdentifier;return e==null?null:dD(this,JO).registry.droppables.get(e)??null}get transform(){let{x:e,y:t}=this.position.delta,n={x:e,y:t};for(let e of this.modifiers)n=e.apply($E(QE({},this.snapshot()),{transform:n}));return pD(this,rk,n),n}snapshot(){return Nw(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:dD(this,rk),shape:this.shape?tE(this.shape):null,position:tE(this.position),status:tE(this.status),canceled:this.canceled}))}reset(){jw(()=>{this.status.set(`idle`),this.sourceIdentifier=null,this.targetIdentifier=null,dD(this,XO).reset(),this.position.reset({x:0,y:0}),pD(this,rk,{x:0,y:0}),this.modifiers=[]})}};ZO=nD(null),JO=new WeakMap,YO=new WeakMap,XO=new WeakMap,QO=new WeakMap,$O=new WeakMap,ek=new WeakMap,tk=new WeakMap,nk=new WeakMap,rk=new WeakMap,cD(ZO,2,`shape`,qO,ik),cD(ZO,4,`canceled`,KO,ik,QO),cD(ZO,4,`activatorEvent`,GO,ik,$O),cD(ZO,4,`sourceIdentifier`,WO,ik,ek),cD(ZO,4,`targetIdentifier`,UO,ik,tk),cD(ZO,4,`modifiers`,HO,ik,nk),cD(ZO,2,`source`,VO,ik),cD(ZO,2,`target`,BO,ik),cD(ZO,2,`transform`,zO,ik),oD(ZO,ik);var ak={get rendering(){return Promise.resolve()}};function ok(e,t){return typeof e==`function`?e(t):e??t}var sk=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(e=>e.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};let t=e??{},n=ok(t.plugins,[]),r=ok(t.sensors,[]),i=ok(t.modifiers,[]),a=t.renderer??ak,o=new _O(this),s=new RO(this);this.registry=s,this.monitor=o,this.renderer=a,this.actions=new MO(this),this.dragOperation=new ik(this),this.collisionObserver=new AD(this),this.plugins=[yO,...n],this.modifiers=i,this.sensors=r;let{destroy:c}=this,l=NT(()=>{let e=Nw(()=>this.dragOperation.modifiers),t=this.modifiers;for(let n of e)t.includes(n)||n.destroy();this.dragOperation.modifiers=(this.dragOperation.source?.modifiers)?.map(e=>{let{plugin:t,options:n}=_D(e);return new t(this,n)})??t});this.destroy=()=>{l(),c()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},ck=e=>{throw TypeError(e)},lk=(e,t,n)=>t.has(e)||ck(`Cannot `+n),uk=(e,t,n)=>(lk(e,t,`read from private field`),t.get(e)),dk=(e,t,n)=>t.has(e)?ck(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),fk=(e,t,n,r)=>(lk(e,t,`write to private field`),t.set(e,n),n),pk=(e,t,n)=>(lk(e,t,`access private method`),n);function mk(e){return e?e instanceof KeyframeEffect?!0:`getKeyframes`in e&&typeof e.getKeyframes==`function`:!1}function hk(e,t){let n=e.getAnimations(),r=null;for(let e of n){if(e.playState!==`running`)continue;let{effect:n}=e,i=(mk(n)?n.getKeyframes():[]).filter(t);i.length>0&&(r=[i[i.length-1],e])}return r}function gk(e){let{width:t,height:n,top:r,left:i,bottom:a,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:a,right:o}}function _k(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function vk(e){return`nodeType`in e}function yk(e){return e?_k(e)?e:vk(e)?`defaultView`in e?e.defaultView??window:e.ownerDocument?.defaultView??window:window:window}function bk(e){let{Document:t}=yk(e);return e instanceof t||`nodeType`in e&&e.nodeType===Node.DOCUMENT_NODE}function xk(e){return!e||_k(e)?!1:e instanceof yk(e).HTMLElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`html`)}function Sk(e){return e instanceof yk(e).SVGElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`svg`)}function Ck(e){return e?_k(e)?e.document:vk(e)?bk(e)?e:xk(e)||Sk(e)?e.ownerDocument:document:document:document}function wk(e){let{documentElement:t}=Ck(e),n=yk(e).visualViewport,r=n?.width??t.clientWidth,i=n?.height??t.clientHeight,a=n?.offsetTop??0,o=n?.offsetLeft??0;return{top:a,left:o,right:o+r,bottom:a+i,width:r,height:i}}function Tk(e,t){if(Ek(e)&&e.open===!1)return!1;let{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n===`visible`&&r===`visible`&&i===`visible`}function Ek(e){return e.tagName===`DETAILS`}function Dk(e,t=e.getBoundingClientRect(),n=0){let r=t,{ownerDocument:i}=e,a=i.defaultView??window,o=e.parentElement;for(;o&&o!==i.documentElement;){if(!Tk(o)){let e=o.getBoundingClientRect(),t=n*(e.bottom-e.top),i=n*(e.right-e.left),a=n*(e.bottom-e.top),s=n*(e.right-e.left);r={top:Math.max(r.top,e.top-t),right:Math.min(r.right,e.right+i),bottom:Math.min(r.bottom,e.bottom+a),left:Math.max(r.left,e.left-s),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top}o=o.parentElement}let s=a.visualViewport,c=s?.offsetTop??0,l=s?.offsetLeft??0,u=s?.width??a.innerWidth,d=s?.height??a.innerHeight,f=n*d,p=n*u;return r={top:Math.max(r.top,c-f),right:Math.min(r.right,l+u+p),bottom:Math.min(r.bottom,c+d+f),left:Math.max(r.left,l-p),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top,r.width<0&&(r.width=0),r.height<0&&(r.height=0),r}function Ok(e){return{x:e.clientX,y:e.clientY}}var kk=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ak(e=document,t=new Set){if(t.has(e))return[];t.add(e);let n=[e];for(let r of Array.from(e.querySelectorAll(`iframe, frame`)))try{let e=r.contentDocument;e&&!t.has(e)&&n.push(...Ak(e,t))}catch{}try{let r=e.defaultView;if(r&&r!==window.top){let i=r.parent;i&&i.document&&i.document!==e&&n.push(...Ak(i.document,t))}}catch{}return n}function jk(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Mk(){let e=jk()?window.visualViewport:null;return{x:e?.offsetLeft??0,y:e?.offsetTop??0}}function Nk(e){return!e||!vk(e)?!1:e instanceof yk(e).ShadowRoot}function Pk(e){if(e&&vk(e)){let t=e.getRootNode();if(Nk(t)||t instanceof Document)return t}return Ck(e)}function Fk(e){return e.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Ik(e){let t=`input, textarea, select, canvas, [contenteditable]`,n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((e,t)=>{let n=r[t];Lk(e)&&Lk(n)&&(e.type!==`file`&&(e.value=n.value),e.type===`radio`&&e.name&&(e.name=`Cloned__${e.name}`)),Rk(e)&&Rk(n)&&n.width>0&&n.height>0&&e.getContext(`2d`)?.drawImage(n,0,0)}),n}function Lk(e){return`value`in e}function Rk(e){return e.tagName===`CANVAS`}function zk(e,{x:t,y:n}){let r=e.elementFromPoint(t,n);if(Bk(r)){let{contentDocument:e}=r;if(e){let{left:i,top:a}=r.getBoundingClientRect();return zk(e,{x:t-i,y:n-a})}}return r}function Bk(e){return e?.tagName===`IFRAME`}var Vk=new WeakMap;function Hk(e){return!!e.closest(`
|
|
66
|
+
input:not([disabled]),
|
|
67
|
+
select:not([disabled]),
|
|
68
|
+
textarea:not([disabled]),
|
|
69
|
+
button:not([disabled]),
|
|
70
|
+
a[href],
|
|
71
|
+
[contenteditable]:not([contenteditable="false"])
|
|
72
|
+
`)}var Uk=class{constructor(){this.entries=new Set,this.clear=()=>{for(let e of this.entries){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){let n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(let e of n)for(let t of r){let{type:n,listener:r,options:a}=t,o=[e,t];e.addEventListener(n,r,a),this.entries.add(o),i.push(o)}let a=this.entries;return function(){for(let e of i){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i),a.delete(e)}}}};function Wk(e){let t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function Gk(e){let t=new Set,n=Wk(e);for(;n;)t.add(n),n=Wk(n);return t}function Kk(e,t){let n=setTimeout(e,t);return()=>clearTimeout(n)}function qk(e,t){let n=()=>performance.now(),r,i;return function(...a){let o=this;i?(r?.(),r=Kk(()=>{e.apply(o,a),i=n()},t-(n()-i))):(e.apply(o,a),i=n())}}function Jk(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function Yk(e,t=e.getBoundingClientRect()){let{width:n,height:r}=Dk(e,t);return n>0&&r>0}var Xk=kk?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},Zk,Qk=class extends Xk{constructor(e){super(t=>{if(!uk(this,Zk)){fk(this,Zk,!0);return}e(t,this)}),dk(this,Zk,!1)}};Zk=new WeakMap;var $k=Array.from({length:100},(e,t)=>t/100),eA=75,tA,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,dk(this,lA),this.disconnect=()=>{var e,t,n;fk(this,sA,!0),(e=uk(this,rA))==null||e.disconnect(),(t=uk(this,iA))==null||t.disconnect(),uk(this,aA).disconnect(),(n=uk(this,oA))==null||n.remove()},dk(this,tA,!0),dk(this,nA),dk(this,rA),dk(this,iA),dk(this,aA),dk(this,oA),dk(this,sA,!1),dk(this,cA,qk(()=>{var e;let{element:t}=this;if((e=uk(this,iA))==null||e.disconnect(),uk(this,sA)||!uk(this,tA)||!t.isConnected)return;let n=t.ownerDocument??document,{innerHeight:r,innerWidth:i}=n.defaultView??window,a=t.getBoundingClientRect(),{top:o,left:s,bottom:c,right:l}=Dk(t,a),u=-Math.floor(o),d=-Math.floor(s),f=`${u}px ${-Math.floor(i-l)}px ${-Math.floor(r-c)}px ${d}px`;this.boundingClientRect=a,fk(this,iA,new IntersectionObserver(e=>{let[n]=e,{intersectionRect:r}=n;(n.intersectionRatio===1?AE.intersectionRatio(r,Dk(t)):n.intersectionRatio)!==1&&uk(this,cA).call(this)},{threshold:$k,rootMargin:f,root:n})),uk(this,iA).observe(t),pk(this,lA,uA).call(this)},eA)),this.boundingClientRect=e.getBoundingClientRect(),fk(this,tA,Yk(e,this.boundingClientRect));let r=!0;this.callback=e=>{r&&(r=!1,n.skipInitial)||t(e)};let i=e.ownerDocument;n?.debug&&(fk(this,oA,document.createElement(`div`)),uk(this,oA).style.background=`rgba(0,0,0,0.15)`,uk(this,oA).style.position=`fixed`,uk(this,oA).style.pointerEvents=`none`,i.body.appendChild(uk(this,oA))),fk(this,aA,new IntersectionObserver(t=>{var n,r;let{boundingClientRect:i,isIntersecting:a}=t[t.length-1],{width:o,height:s}=i,c=uk(this,tA);fk(this,tA,a),!(!o&&!s)&&(c&&!a?((n=uk(this,iA))==null||n.disconnect(),this.callback(null),(r=uk(this,rA))==null||r.disconnect(),fk(this,rA,void 0),uk(this,oA)&&(uk(this,oA).style.visibility=`hidden`)):uk(this,cA).call(this),a&&!uk(this,rA)&&(fk(this,rA,new Qk(uk(this,cA))),uk(this,rA).observe(e)))},{threshold:$k,root:i})),uk(this,tA)&&!n.skipInitial&&this.callback(this.boundingClientRect),uk(this,aA).observe(e)}};tA=new WeakMap,nA=new WeakMap,rA=new WeakMap,iA=new WeakMap,aA=new WeakMap,oA=new WeakMap,sA=new WeakMap,cA=new WeakMap,lA=new WeakSet,uA=function(){uk(this,sA)||(pk(this,lA,dA).call(this),!Jk(this.boundingClientRect,uk(this,nA))&&(this.callback(this.boundingClientRect),fk(this,nA,this.boundingClientRect)))},dA=function(){if(uk(this,oA)){let{top:e,left:t,width:n,height:r}=Dk(this.element);uk(this,oA).style.overflow=`hidden`,uk(this,oA).style.visibility=`visible`,uk(this,oA).style.top=`${Math.floor(e)}px`,uk(this,oA).style.left=`${Math.floor(t)}px`,uk(this,oA).style.width=`${Math.floor(n)}px`,uk(this,oA).style.height=`${Math.floor(r)}px`}};var pA=new WeakMap,mA=new WeakMap;function hA(e,t){let n=pA.get(e);return n||={disconnect:new fA(e,t=>{let n=pA.get(e);n&&n.callbacks.forEach(e=>e(t))},{skipInitial:!0}).disconnect,callbacks:new Set},n.callbacks.add(t),pA.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(pA.delete(e),n.disconnect())}}function gA(e,t){let n=new Set;for(let r of e){let e=hA(r,t);n.add(e)}return()=>n.forEach(e=>e())}function _A(e,t){let n=e.ownerDocument;if(!mA.has(n)){let e=new AbortController,t=new Set;document.addEventListener(`scroll`,e=>t.forEach(t=>t(e)),{capture:!0,passive:!0,signal:e.signal}),mA.set(n,{disconnect:()=>e.abort(),listeners:t})}let{listeners:r,disconnect:i}=mA.get(n)??{};return!r||!i?()=>{}:(r.add(t),()=>{r.delete(t),r.size===0&&(i(),mA.delete(n))})}var vA,yA,bA,xA,SA=class{constructor(e,t,n){this.callback=t,dk(this,vA),dk(this,yA,!1),dk(this,bA),dk(this,xA,qk(e=>{if(!uk(this,yA)&&e.target&&`contains`in e.target&&typeof e.target.contains==`function`){for(let t of uk(this,bA))if(e.target.contains(t)){this.callback(uk(this,vA).boundingClientRect);break}}},eA));let r=Gk(e),i=gA(r,t),a=_A(e,uk(this,xA));fk(this,bA,r),fk(this,vA,new fA(e,t,n)),this.disconnect=()=>{uk(this,yA)||(fk(this,yA,!0),i(),a(),uk(this,vA).disconnect())}}};vA=new WeakMap,yA=new WeakMap,bA=new WeakMap,xA=new WeakMap;function CA(e){return`showPopover`in e&&`hidePopover`in e&&typeof e.showPopover==`function`&&typeof e.hidePopover==`function`}function wA(e){try{CA(e)&&e.isConnected&&e.hasAttribute(`popover`)&&!e.matches(`:popover-open`)&&e.showPopover()}catch{}}function TA(e){return!kk||!e?!1:e===Ck(e).scrollingElement}function EA(e){let t=yk(e),n=TA(e)?wk(e):gk(e),r=t.visualViewport,i=TA(e)?{height:r?.height??t.innerHeight,width:r?.width??t.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-i.width,y:e.scrollHeight-i.height}};return{rect:n,position:a,isTop:a.current.y<=0,isLeft:a.current.x<=0,isBottom:a.current.y>=a.max.y,isRight:a.current.x>=a.max.x}}function DA(e,t){let{isTop:n,isBottom:r,isLeft:i,isRight:a,position:o}=EA(e),{x:s,y:c}=t??{x:0,y:0},l=!n&&o.current.y+c>0,u=!r&&o.current.y+c<o.max.y,d=!i&&o.current.x+s>0,f=!a&&o.current.x+s<o.max.x;return{top:l,bottom:u,left:d,right:f,x:d||f,y:l||u}}var OA=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}},kA=new OA(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),AA=new OA(e=>setTimeout(e,50)),jA=new Map,MA=jA.clear.bind(jA);function NA(e,t=!1){if(!t)return PA(e);let n=jA.get(e);return n||(n=PA(e),jA.set(e,n),AA.schedule(MA),n)}function PA(e){return yk(e).getComputedStyle(e)}function FA(e,t=NA(e,!0)){return t.position===`fixed`||t.position===`sticky`}function IA(e,t=NA(e,!0)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}var LA={excludeElement:!0,escapeShadowDOM:!0};function RA(e,t=LA){let{limit:n,excludeElement:r,escapeShadowDOM:i}=t,a=new Set;function o(t){if(n!=null&&a.size>=n||!t)return a;if(bk(t)&&t.scrollingElement!=null&&!a.has(t.scrollingElement))return a.add(t.scrollingElement),a;if(i&&Nk(t))return o(t.host);if(!xk(t))return Sk(t)?o(t.parentElement):a;if(a.has(t))return a;let s=NA(t,!0);if(r&&t===e||IA(t,s)&&a.add(t),FA(t,s)){let{scrollingElement:e}=t.ownerDocument;return e&&a.add(e),a}return o(t.parentNode)}return e?o(e):a}function zA(e,t=window.frameElement){let n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=Wk(e);for(;r;){if(r===t)return n;let e=gk(r),{x:i,y:a}=BA(r,e);n.x+=e.left,n.y+=e.top,n.scaleX*=i,n.scaleY*=a,r=Wk(r)}return n}function BA(e,t=gk(e)){let n=Math.round(t.width),r=Math.round(t.height);if(xk(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};let i=NA(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function VA(e){if(e===`none`)return null;let t=e.split(` `),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function HA(e){if(e===`none`)return null;let[t,n,r=`0`]=e.split(` `),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function UA(e){let{scale:t,transform:n,translate:r}=e,i=VA(t),a=HA(r),o=WA(n);if(!o&&!i&&!a)return null;let s={x:i?.x??1,y:i?.y??1},c={x:a?.x??0,y:a?.y??0},l={x:o?.x??0,y:o?.y??0,scaleX:o?.scaleX??1,scaleY:o?.scaleY??1};return{x:c.x+l.x,y:c.y+l.y,z:a?.z??0,scaleX:s.x*l.scaleX,scaleY:s.y*l.scaleY}}function WA(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var GA=(e=>(e[e.Idle=0]=`Idle`,e[e.Forward=1]=`Forward`,e[e.Reverse=-1]=`Reverse`,e))(GA||{}),KA={x:.2,y:.2},qA={x:10,y:10};function JA(e,t,n,r=25,i=KA,a=qA){let{x:o,y:s}=t,{rect:c,isTop:l,isBottom:u,isLeft:d,isRight:f}=EA(e),p=zA(e),m=UA(NA(e,!0)),h=m===null?!1:m?.scaleX<0,g=m===null?!1:m?.scaleY<0,_=new AE(c.left*p.scaleX+p.x,c.top*p.scaleY+p.y,c.width*p.scaleX,c.height*p.scaleY),v={x:0,y:0},y={x:0,y:0},b={height:_.height*i.y,width:_.width*i.x};return b.height>0&&(!l||g&&!u)&&s<=_.top+b.height&&n?.y!==1&&o>=_.left-a.x&&o<=_.right+a.x?(v.y=g?1:-1,y.y=r*Math.abs((_.top+b.height-s)/b.height)):b.height>0&&(!u||g&&!l)&&s>=_.bottom-b.height&&n?.y!==-1&&o>=_.left-a.x&&o<=_.right+a.x&&(v.y=g?-1:1,y.y=r*Math.abs((_.bottom-b.height-s)/b.height)),b.width>0&&(!f||h&&!d)&&o>=_.right-b.width&&n?.x!==-1&&s>=_.top-a.y&&s<=_.bottom+a.y?(v.x=h?-1:1,y.x=r*Math.abs((_.right-b.width-o)/b.width)):b.width>0&&(!d||h&&!f)&&o<=_.left+b.width&&n?.x!==1&&s>=_.top-a.y&&s<=_.bottom+a.y&&(v.x=h?1:-1,y.x=r*Math.abs((_.left+b.width-o)/b.width)),{direction:v,speed:y}}function YA(e,{block:t=`nearest`,inline:n=`nearest`}={}){if(!xk(e))return;let r=RA(e),i=[];for(let a of r){if(!xk(a))continue;let{top:r,left:o}=ZA(e,a),s=r,c=o;for(let e of i)s-=e.scrollTop,c-=e.scrollLeft;if(t!==`none`){let n=s<a.scrollTop;n!==s+e.offsetHeight>a.scrollTop+a.clientHeight&&(t===`center`?a.scrollTop=s-a.clientHeight/2+e.offsetHeight/2:n?a.scrollTop=s:a.scrollTop=s+e.offsetHeight-a.clientHeight)}if(n!==`none`){let t=c<a.scrollLeft;t!==c+e.offsetWidth>a.scrollLeft+a.clientWidth&&(n===`center`?a.scrollLeft=c-a.clientWidth/2+e.offsetWidth/2:t?a.scrollLeft=c:a.scrollLeft=c+e.offsetWidth-a.clientWidth)}i.push(a)}}function XA(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;let e=r.offsetParent;if(!xk(e))break;t+=e.clientTop,n+=e.clientLeft,r=e}return{top:t,left:n}}function ZA(e,t){let n=XA(e),r=XA(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function QA(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left+a+(1-r)*parseFloat(n),c=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width*r:e.width,u=i?e.height*i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function $A(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left-a-(1-r)*parseFloat(n),c=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function ej({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function tj(e,t=NA(e).translate,n=!0){if(n){let t=hk(e,e=>`translate`in e);if(t){let{translate:e=``}=t[0];if(typeof e==`string`){let t=HA(e);if(t)return t}}}if(t){let e=HA(t);if(e)return e}return{x:0,y:0,z:0}}var nj=new OA(e=>setTimeout(e,0)),rj=new Map,ij=rj.clear.bind(rj);function aj(e){let t=e.ownerDocument,n=rj.get(t);if(n)return n;n=t.getAnimations(),rj.set(t,n),nj.schedule(ij);let r=n.filter(t=>mk(t.effect)&&t.effect.target===e);return rj.set(e,r),n}function oj(e,t){let n=aj(e).filter(e=>{if(mk(e.effect)){let{target:n}=e.effect;if((n&&t.isValidTarget?.call(t,n))??!0)return e.effect.getKeyframes().some(e=>{for(let n of t.properties)if(e[n])return!0})}}).map(e=>{let{effect:t,currentTime:n}=e,r=t?.getComputedTiming().duration;if(!(e.pending||e.playState===`finished`)&&typeof r==`number`&&typeof n==`number`&&n<r)return e.currentTime=r,()=>{e.currentTime=n}});if(n.length>0)return()=>n.forEach(e=>e?.())}var sj=class extends AE{constructor(e,t={}){let{frameTransform:n=zA(e),ignoreTransforms:r,getBoundingClientRect:i=gk}=t,a=oj(e,{properties:[`transform`,`translate`,`scale`,`width`,`height`],isValidTarget:t=>(t!==e||jk())&&t.contains(e)}),o=i(e),{top:s,left:c,width:l,height:u}=o,d,f=NA(e),p=UA(f),m={x:p?.scaleX??1,y:p?.scaleY??1},h=cj(e,f);a?.(),p&&(d=$A(o,p,f.transformOrigin),(r||h)&&(s=d.top,c=d.left,l=d.width,u=d.height));let g={width:d?.width??l,height:d?.height??u};if(h&&!r&&d){let e=QA(d,h,f.transformOrigin);s=e.top,c=e.left,l=e.width,u=e.height,m.x=h.scaleX,m.y=h.scaleY}n&&(r||(c*=n.scaleX,l*=n.scaleX,s*=n.scaleY,u*=n.scaleY),c+=n.x,s+=n.y),super(c,s,l,u),this.scale=m,this.intrinsicWidth=g.width,this.intrinsicHeight=g.height}};function cj(e,t){let n=e.getAnimations();if(!n.length)return null;let r,i,a,o=!1;for(let e of n){if(e.playState!==`running`)continue;let t=mk(e.effect)?e.effect.getKeyframes():[],n=t[t.length-1];if(!n)continue;let{transform:s,translate:c,scale:l}=n;typeof s==`string`&&s&&(r=s,o=!0),typeof c==`string`&&c&&(i=c,o=!0),typeof l==`string`&&l&&(a=l,o=!0)}return o?UA({transform:r??t.transform,translate:i??t.translate,scale:a??t.scale}):null}function lj(e){return`style`in e&&typeof e.style==`object`&&e.style!==null&&`setProperty`in e.style&&`removeProperty`in e.style&&typeof e.style.setProperty==`function`&&typeof e.style.removeProperty==`function`}var uj=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=``){let{element:n}=this;if(lj(n))for(let[r,i]of Object.entries(e)){let e=`${t}${r}`;this.initial.has(e)||this.initial.set(e,n.style.getPropertyValue(e)),n.style.setProperty(e,typeof i==`string`?i:`${i}px`)}}remove(e,t=``){let{element:n}=this;if(lj(n))for(let r of e){let e=`${t}${r}`;n.style.removeProperty(e)}}reset(){let{element:e}=this;if(lj(e)){for(let[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute(`style`)===``&&e.removeAttribute(`style`)}}};function dj(e){return e?e instanceof yk(e).Element||vk(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function fj(e){if(!e)return!1;let{KeyboardEvent:t}=yk(e.target);return e instanceof t}function pj(e){if(!e)return!1;let{PointerEvent:t}=yk(e.target);return e instanceof t}function mj(e){if(!dj(e))return!1;let{tagName:t}=e;return t===`INPUT`||t===`TEXTAREA`||hj(e)}function hj(e){return e.hasAttribute(`contenteditable`)&&e.getAttribute(`contenteditable`)!==`false`}var gj={};function _j(e){let t=gj[e]==null?0:gj[e]+1;return gj[e]=t,`${e}-${t}`}var vj=({dragOperation:e,droppable:t})=>{let n=e.position.current;if(!n)return null;let{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/kE.distance(t.shape.center,n),type:xO.PointerIntersection,priority:bO.High}:null},yj=({dragOperation:e,droppable:t})=>{let{shape:n}=e;if(!t.shape||!n?.current)return null;let r=n.current.intersectionArea(t.shape);if(r){let{position:i}=e,a=kE.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/a;return{id:t.id,value:o,type:xO.ShapeIntersection,priority:bO.Normal}}return null},bj=e=>vj(e)??yj(e),xj=e=>{let{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;let a=r?AE.from(r.current.boundingRectangle).corners:void 0,o=AE.from(n.shape.boundingRectangle).corners.reduce((e,t,n)=>e+kE.distance(kE.from(t),a?.[n]??i.current),0)/4;return{id:n.id,value:1/o,type:xO.Collision,priority:bO.Normal}},Sj=Object.create,Cj=Object.defineProperty,wj=Object.defineProperties,Tj=Object.getOwnPropertyDescriptor,Ej=Object.getOwnPropertyDescriptors,Dj=Object.getOwnPropertySymbols,Oj=Object.prototype.hasOwnProperty,kj=Object.prototype.propertyIsEnumerable,Aj=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),jj=e=>{throw TypeError(e)},Mj=(e,t,n)=>t in e?Cj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nj=(e,t)=>{for(var n in t||={})Oj.call(t,n)&&Mj(e,n,t[n]);if(Dj)for(var n of Dj(t))kj.call(t,n)&&Mj(e,n,t[n]);return e},Pj=(e,t)=>wj(e,Ej(t)),Fj=(e,t)=>Cj(e,`name`,{value:t,configurable:!0}),Ij=(e,t)=>{var n={};for(var r in e)Oj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dj)for(var r of Dj(e))t.indexOf(r)<0&&kj.call(e,r)&&(n[r]=e[r]);return n},Lj=e=>[,,,Sj(e?.[Aj(`metadata`)]??null)],Rj=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],zj=e=>e!==void 0&&typeof e!=`function`?jj(`Function expected`):e,Bj=(e,t,n,r,i)=>({kind:Rj[e],name:t,metadata:r,addInitializer:e=>n._?jj(`Already initialized`):i.push(zj(e||null))}),Vj=(e,t)=>Mj(t,Aj(`metadata`),e[3]),Hj=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},Uj=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=Rj[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&Tj(d<4?i:{get[n](){return Kj(this,a)},set[n](e){return Jj(this,a,e)}},n));d?p&&d<4&&Fj(a,(d>2?`set `:d>1?`get `:``)+n):Fj(i,n);for(var y=r.length-1;y>=0;y--)l=Bj(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>Gj(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?Kj:Yj)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>Jj(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?zj(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?jj(`Object expected`):(zj(o=s.get)&&(v.get=o),zj(o=s.set)&&(v.set=o),zj(o=s.init)&&g.unshift(o));return d||Vj(e,i),v&&Cj(i,n,v),p?d^4?a:v:i},Wj=(e,t,n)=>t.has(e)||jj(`Cannot `+n),Gj=(e,t)=>Object(t)===t?e.has(t):jj(`Cannot use the "in" operator on this value`),Kj=(e,t,n)=>(Wj(e,t,`read from private field`),n?n.call(e):t.get(e)),qj=(e,t,n)=>t.has(e)?jj(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Jj=(e,t,n,r)=>(Wj(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),Yj=(e,t,n)=>(Wj(e,t,`access private method`),n),Xj={role:`button`,roleDescription:`draggable`},Zj=`dnd-kit-description`,Qj=`dnd-kit-announcement`,$j={draggable:`To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel.`},eM={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(!(!e||e.id===t?.id))return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function tM(e){let t=e.tagName.toLowerCase();return[`input`,`select`,`textarea`,`a`,`button`].includes(t)}function nM(e,t){let n=document.createElement(`div`);return n.id=e,n.style.setProperty(`display`,`none`),n.textContent=t,n}function rM(e){let t=document.createElement(`div`);return t.id=e,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),t.style.setProperty(`position`,`fixed`),t.style.setProperty(`width`,`1px`),t.style.setProperty(`height`,`1px`),t.style.setProperty(`margin`,`-1px`),t.style.setProperty(`border`,`0`),t.style.setProperty(`padding`,`0`),t.style.setProperty(`overflow`,`hidden`),t.style.setProperty(`clip`,`rect(0 0 0 0)`),t.style.setProperty(`clip-path`,`inset(100%)`),t.style.setProperty(`white-space`,`nowrap`),t}var iM=[`dragover`,`dragmove`],aM=class extends SD{constructor(e,t){super(e);let{id:n,idPrefix:{description:r=Zj,announcement:i=Qj}={},announcements:a=eM,screenReaderInstructions:o=$j,debounce:s=500}=t??{},c=n?`${r}-${n}`:_j(r),l=n?`${i}-${n}`:_j(i),u,d,f,p,m=(e=p)=>{!f||!e||f?.nodeValue!==e&&(f.nodeValue=e)},h=()=>kA.schedule(m),g=oM(h,s),_=Object.entries(a).map(([e,t])=>this.manager.monitor.addEventListener(e,(n,r)=>{let i=f;if(!i)return;let a=t?.(n,r);a&&i.nodeValue!==a&&(p=a,iM.includes(e)?g():(h(),g.cancel()))})),v=()=>{let e=[];u?.isConnected||(u=nM(c,o.draggable),e.push(u)),d?.isConnected||(d=rM(l),f=document.createTextNode(``),d.appendChild(f),e.push(d)),e.length>0&&document.body.append(...e)},y=new Set;function b(){for(let e of y)e()}this.registerEffect(()=>{y.clear();for(let e of this.manager.registry.draggables.value){let t=e.handle??e.element;if(t){(!u||!d)&&y.add(v),(!tM(t)||jk())&&!t.hasAttribute(`tabindex`)&&y.add(()=>t.setAttribute(`tabindex`,`0`)),!t.hasAttribute(`role`)&&t.tagName.toLowerCase()!==`button`&&y.add(()=>t.setAttribute(`role`,Xj.role)),t.hasAttribute(`aria-roledescription`)||y.add(()=>t.setAttribute(`aria-roledescription`,Xj.roleDescription)),t.hasAttribute(`aria-describedby`)||y.add(()=>t.setAttribute(`aria-describedby`,c));for(let n of[`aria-pressed`,`aria-grabbed`]){let r=String(e.isDragging);t.getAttribute(n)!==r&&y.add(()=>t.setAttribute(n,r))}let n=String(e.disabled);t.getAttribute(`aria-disabled`)!==n&&y.add(()=>t.setAttribute(`aria-disabled`,n))}}y.size>0&&kA.schedule(b)}),this.destroy=()=>{super.destroy(),u?.remove(),d?.remove(),_.forEach(e=>e())}}};function oM(e,t){let n,r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var sM=new Map,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM=class extends (fM=CD,dM=[AT],uM=[jT],lM=[jT],cM=[jT],fM){constructor(e,t){super(e,t),Hj(mM,5,this),qj(this,gM),qj(this,pM,new Set),qj(this,hM,Hj(mM,8,this,new Set)),Hj(mM,11,this),this.registerEffect(Yj(this,gM,_M))}register(e){return Kj(this,pM).add(e),()=>{Kj(this,pM).delete(e)}}addRoot(e){return Nw(()=>{let t=new Set(this.additionalRoots);t.add(e),this.additionalRoots=t}),()=>{Nw(()=>{let t=new Set(this.additionalRoots);t.delete(e),this.additionalRoots=t})}}get sourceRoot(){let{source:e}=this.manager.dragOperation;return Pk(e?.element??null)}get targetRoot(){let{target:e}=this.manager.dragOperation;return Pk(e?.element??null)}get roots(){let{status:e}=this.manager.dragOperation;if(e.initializing||e.initialized){let e=[this.sourceRoot,this.targetRoot].filter(e=>e!=null);return new Set([...e,...this.additionalRoots])}return new Set}};mM=Lj(fM),pM=new WeakMap,hM=new WeakMap,gM=new WeakSet,_M=function(){let{roots:e}=this,t=[];for(let n of e)for(let e of Kj(this,pM))t.push(Yj(this,gM,vM).call(this,n,e));return()=>{for(let e of t)e()}},vM=function(e,t){let n=sM.get(e);n||(n=new Map,sM.set(e,n));let r=n.get(t);if(!r){let i=bk(e)?Yj(this,gM,yM).call(this,e,n,t):Yj(this,gM,bM).call(this,e,n,t);if(!i)return()=>{};r=i,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}},yM=function(e,t,n){let r=e.createElement(`style`),{nonce:i}=this.options??{};i&&r.setAttribute(`nonce`,i),r.textContent=n,e.head.prepend(r);let a=new MutationObserver(t=>{for(let n of t)for(let t of Array.from(n.removedNodes))if(t===r){e.head.prepend(r);return}});return a.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{a.disconnect(),r.remove(),t.delete(n),t.size===0&&sM.delete(e)}}},bM=function(e,t,n){!(`adoptedStyleSheets`in e&&Array.isArray(e.adoptedStyleSheets))&&process.env.NODE_ENV!==`production`&&console.error(`Cannot inject styles: This browser doesn't support adoptedStyleSheets`);let{CSSStyleSheet:r}=e.ownerDocument.defaultView??{};if(!r)return process.env.NODE_ENV!==`production`&&console.error(`Cannot inject styles: CSSStyleSheet constructor not available`),null;let i=new r;return i.replaceSync(n),e.adoptedStyleSheets.push(i),{refCount:0,cleanup:()=>{if(Nk(e)&&e.host?.isConnected){let t=e.adoptedStyleSheets.indexOf(i);t!==-1&&e.adoptedStyleSheets.splice(t,1)}t.delete(n),t.size===0&&sM.delete(e)}}},Uj(mM,4,`additionalRoots`,dM,xM,hM),Uj(mM,2,`sourceRoot`,uM,xM),Uj(mM,2,`targetRoot`,lM,xM),Uj(mM,2,`roots`,cM,xM),Vj(mM,xM),xM.configure=gD(xM);var SM=xM,CM=class extends SD{constructor(e,t){super(e,t),this.manager=e;let{cursor:n=`grabbing`}=t??{},r=e.registry.plugins.get(SM)?.register(`* { cursor: ${n} !important; }`);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}}},wM=`data-dnd-`,TM=`${wM}dropping`,EM=`--dnd-`,DM=`${wM}dragging`,OM=`${wM}placeholder`,kM=[DM,OM,`popover`,`aria-pressed`,`aria-grabbing`],AM=[`view-transition-name`],jM=`
|
|
73
|
+
:is(:root,:host) [${DM}] {
|
|
74
|
+
position: fixed !important;
|
|
75
|
+
pointer-events: none !important;
|
|
76
|
+
touch-action: none;
|
|
77
|
+
z-index: calc(infinity);
|
|
78
|
+
will-change: translate;
|
|
79
|
+
top: var(${EM}top, 0px) !important;
|
|
80
|
+
left: var(${EM}left, 0px) !important;
|
|
81
|
+
right: unset !important;
|
|
82
|
+
bottom: unset !important;
|
|
83
|
+
width: var(${EM}width, auto);
|
|
84
|
+
max-width: var(${EM}width, auto);
|
|
85
|
+
height: var(${EM}height, auto);
|
|
86
|
+
max-height: var(${EM}height, auto);
|
|
87
|
+
transform: var(${EM}transform, none) !important;
|
|
88
|
+
transition: var(${EM}transition) !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:is(:root,:host) [${OM}] {
|
|
92
|
+
transition: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:is(:root,:host) [${OM}='hidden'] {
|
|
96
|
+
visibility: hidden;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[${DM}] * {
|
|
100
|
+
pointer-events: none !important;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[${DM}]:not([${TM}]) {
|
|
104
|
+
translate: var(${EM}translate) !important;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[${DM}][style*='${EM}scale'] {
|
|
108
|
+
scale: var(${EM}scale) !important;
|
|
109
|
+
transform-origin: var(${EM}transform-origin) !important;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@layer dnd-kit {
|
|
113
|
+
:where([${DM}][popover]) {
|
|
114
|
+
overflow: visible;
|
|
115
|
+
background: unset;
|
|
116
|
+
border: unset;
|
|
117
|
+
margin: unset;
|
|
118
|
+
padding: unset;
|
|
119
|
+
color: inherit;
|
|
120
|
+
|
|
121
|
+
&:is(input, button) {
|
|
122
|
+
border: revert;
|
|
123
|
+
background: revert;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
[${DM}]::backdrop, [${wM}overlay]:not([${DM}]) {
|
|
128
|
+
display: none;
|
|
129
|
+
visibility: hidden;
|
|
130
|
+
}
|
|
131
|
+
`.replace(/\n+/g,` `).replace(/\s+/g,` `).trim();function MM(e,t=`hidden`){return Nw(()=>{let{element:n,manager:r}=e;if(!n||!r)return;let i=NM(n,r.registry.droppables),a=[],o=Ik(n),{remove:s}=o;return PM(i,o,a),FM(o,t),o.remove=()=>{a.forEach(e=>e()),s.call(o)},o})}function NM(e,t){let n=new Map;for(let r of t)if(r.element&&(e===r.element||e.contains(r.element))){let e=`${wM}${_j(`dom-id`)}`;r.element.setAttribute(e,``),n.set(r,e)}return n}function PM(e,t,n){for(let[r,i]of e){if(!r.element)continue;let e=`[${i}]`,a=t.matches(e)?t:t.querySelector(e);if(r.element.removeAttribute(i),!a)continue;let o=r.element;r.proxy=a,a.removeAttribute(i),Vk.set(o,a),n.push(()=>{Vk.delete(o),r.proxy=void 0})}}function FM(e,t=`hidden`){e.setAttribute(`inert`,`true`),e.setAttribute(`tab-index`,`-1`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(OM,t)}function IM(e,t){return e===t?!0:Wk(e)===Wk(t)}function LM(e){let{target:t}=e;`newState`in e&&e.newState===`closed`&&dj(t)&&t.hasAttribute(`popover`)&&requestAnimationFrame(()=>wA(t))}function RM(e){return e.tagName===`TR`}function zM(e,t,n){let r=new MutationObserver(r=>{let i=!1;for(let n of r){if(n.target!==e){i=!0;continue}if(n.type!==`attributes`)continue;let r=n.attributeName;if(r.startsWith(`aria-`)||kM.includes(r))continue;let a=e.getAttribute(r);if(r===`style`){if(lj(e)&&lj(t)){let n=e.style;for(let e of Array.from(t.style))n.getPropertyValue(e)===``&&t.style.removeProperty(e);for(let e of Array.from(n)){if(AM.includes(e)||e.startsWith(EM))continue;let r=n.getPropertyValue(e);t.style.setProperty(e,r)}}}else a===null?t.removeAttribute(r):t.setAttribute(r,a)}i&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function BM(e,t,n){let r=new MutationObserver(r=>{for(let i of r)if(i.addedNodes.length!==0)for(let r of Array.from(i.addedNodes)){if(r.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement(`afterend`,t),wA(n);return}if(r.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement(`beforebegin`,e),wA(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement(`afterend`,t),wA(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function VM(e){return new ResizeObserver(()=>{var t;let n=new sj(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),r=e.transformOrigin??{x:1,y:1},i=(e.width-n.width)*r.x+e.delta.x,a=(e.height-n.height)*r.y+e.delta.y,o=Mk();if(e.styles.set({width:n.width-e.widthOffset,height:n.height-e.heightOffset,top:e.top+a+o.y,left:e.left+i+o.x},EM),(t=e.getElementMutationObserver())==null||t.takeRecords(),RM(e.element)&&RM(e.placeholder)){let t=Array.from(e.element.cells),n=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(t.map(e=>e.style.width));for(let[e,r]of t.entries()){let t=n[e];r.style.width=`${t.getBoundingClientRect().width}px`}}let s=e.getTranslate()??{x:0,y:0},c=e.left+i+o.x+s.x,l=e.top+a+o.y+s.y,u=n.width-e.widthOffset,d=n.height-e.heightOffset,f=e.frameTransform;e.dragOperation.shape=new AE(c*f.scaleX+f.x,l*f.scaleY+f.y,u*f.scaleX,d*f.scaleY)})}var HM=250,UM=`ease`;function WM(e){var t;let{animation:n}=e;if(typeof n==`function`){let t=n({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(t).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}let{duration:r=HM,easing:i=UM}=n??{};wA(e.feedbackElement);let[,a]=hk(e.feedbackElement,e=>`translate`in e)??[];a?.pause();let o=e.placeholder??e.element,s={frameTransform:IM(e.feedbackElement,o)?null:void 0},c=new sj(e.feedbackElement,s),l=HA(NA(e.feedbackElement).translate)??e.translate,u=new sj(o,s),d=AE.delta(c,u,e.alignment),f={x:l.x-d.x,y:l.y-d.y},p=Math.round(c.intrinsicHeight)===Math.round(u.intrinsicHeight)?{}:{minHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`],maxHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`]},m=Math.round(c.intrinsicWidth)===Math.round(u.intrinsicWidth)?{}:{minWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`],maxWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`]};e.styles.set({transition:e.transition},EM),e.feedbackElement.setAttribute(TM,``),(t=e.getElementMutationObserver())==null||t.takeRecords(),ej({element:e.feedbackElement,keyframes:Pj(Nj(Nj({},p),m),{translate:[`${l.x}px ${l.y}px 0`,`${f.x}px ${f.y}px 0`]}),options:{duration:Fk(yk(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?r:0,easing:i}}).then(()=>{e.feedbackElement.removeAttribute(TM),a?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var GM,KM,qM,JM,YM,XM,ZM,QM=class extends (KM=SD,GM=[AT],KM){constructor(e,t){super(e,t),qj(this,YM),qj(this,JM,Hj(qM,8,this)),Hj(qM,11,this),this.state={initial:{},current:{}};let n=e.registry.plugins.get(SM),r=n?.register(jM);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}this.registerEffect(Yj(this,YM,XM).bind(this,n)),this.registerEffect(Yj(this,YM,ZM))}};qM=Lj(KM),JM=new WeakMap,YM=new WeakSet,XM=function(e){let{overlay:t}=this;if(!t||!e)return;let n=Pk(t);if(n)return e.addRoot(n)},ZM=function(){let{state:e,manager:t,options:n}=this,{dragOperation:r}=t,{position:i,source:a,status:o}=r;if(o.idle){e.current={},e.initial={};return}if(!a)return;let{element:s}=a,c=a.pluginConfig(QM),l=c?.feedback??n?.feedback??`default`,u=typeof l==`function`?l(a,t):l;if(!s||u===`none`||!o.initialized||o.initializing)return;let{initial:d}=e,f=this.overlay??s,p=zA(f),m=zA(s),h=!IM(s,f),g=new sj(s,{frameTransform:h?m:null,ignoreTransforms:!h}),_={x:m.scaleX/p.scaleX,y:m.scaleY/p.scaleY},{width:v,height:y,top:b,left:x}=g;h&&(v/=_.x,y/=_.y);let S=new uj(f),C=NA(s),{transition:w,translate:T,boxSizing:E,paddingBlockStart:D,paddingBlockEnd:O,paddingInlineStart:ee,paddingInlineEnd:k,borderInlineStartWidth:A,borderInlineEndWidth:j,borderBlockStartWidth:M,borderBlockEndWidth:N}=C,P=w.split(`,`).filter(e=>!/^\s*(transform|translate|scale)\b/.test(e)).join(`,`),F=UA(C),I=C.transform,te=u===`clone`,ne=E===`content-box`,re=ne?parseInt(ee)+parseInt(k)+parseInt(A)+parseInt(j):0,ie=ne?parseInt(D)+parseInt(O)+parseInt(M)+parseInt(N):0,ae=u!==`move`&&!this.overlay?MM(a,te?`clone`:`hidden`):null,oe=Nw(()=>fj(t.dragOperation.activatorEvent));if(!d.translate){if(this.overlay&&F)d.translate={x:F.x,y:F.y};else if(T!==`none`){let e=HA(T);e&&(d.translate=e)}}if(!d.transformOrigin){let e=Nw(()=>i.current),t=x+(F?.x??0),n=b+(F?.y??0);d.transformOrigin={x:(e.x-t*p.scaleX-p.x)/(v*p.scaleX),y:(e.y-n*p.scaleY-p.y)/(y*p.scaleY)}}let{transformOrigin:se}=d,ce=b*p.scaleY+p.y,le=x*p.scaleX+p.x;if(!d.coordinates&&(d.coordinates={x:le,y:ce},_.x!==1||_.y!==1)){let{scaleX:e,scaleY:t}=m,{x:n,y:r}=se;d.coordinates.x+=(v*e-v)*n,d.coordinates.y+=(y*t-y)*r}d.dimensions||={width:v,height:y},d.frameTransform||=p;let ue={x:d.coordinates.x-le,y:d.coordinates.y-ce},de={width:(d.dimensions.width*d.frameTransform.scaleX-v*p.scaleX)*se.x,height:(d.dimensions.height*d.frameTransform.scaleY-y*p.scaleY)*se.y},fe={x:ue.x/p.scaleX+de.width,y:ue.y/p.scaleY+de.height},pe={left:x+fe.x,top:b+fe.y};f.setAttribute(DM,`true`);let me=Nw(()=>r.transform),he=d.translate??{x:0,y:0},ge=me.x*p.scaleX+he.x,_e=me.y*p.scaleY+he.y,ve=Mk();S.set({width:v-re,height:y-ie,top:pe.top+ve.y,left:pe.left+ve.x,translate:`${ge}px ${_e}px 0`,transform:this.overlay?`none`:I,transition:P?`${P}, translate 0ms linear`:`translate 0ms linear`,scale:h?`${_.x} ${_.y}`:``,"transform-origin":`${se.x*100}% ${se.y*100}%`},EM),ae&&(s.insertAdjacentElement(`afterend`,ae),n?.rootElement&&(typeof n.rootElement==`function`?n.rootElement(a):n.rootElement).appendChild(s)),CA(f)&&(f.hasAttribute(`popover`)||f.setAttribute(`popover`,`manual`),wA(f),f.addEventListener(`beforetoggle`,LM));let ye,be,xe,Se=VM({placeholder:ae,element:s,feedbackElement:f,frameTransform:p,transformOrigin:se,width:v,height:y,top:b,left:x,widthOffset:re,heightOffset:ie,delta:fe,styles:S,dragOperation:r,getTranslate:()=>e.current.translate,getElementMutationObserver:()=>ye,getSavedCellWidths:()=>xe,setSavedCellWidths:e=>{xe=e}}),Ce=new sj(f);Nw(()=>r.shape=Ce);let we=yk(f),Te=e=>{this.manager.actions.stop({event:e})},Ee=Fk(we);oe&&we.addEventListener(`resize`,Te),Nw(()=>a.status)===`idle`&&requestAnimationFrame(()=>a.status=`dragging`),ae&&(Se.observe(ae),ye=zM(s,ae,te),be=BM(s,ae,f));let De=t.dragOperation.source?.id,Oe=()=>{if(!oe||De==null)return;let e=t.registry.draggables.get(De),n=e?.handle??e?.element;xk(n)&&n.focus()},ke=()=>{if(ye?.disconnect(),be?.disconnect(),Se.disconnect(),we.removeEventListener(`resize`,Te),CA(f)&&(f.removeEventListener(`beforetoggle`,LM),f.removeAttribute(`popover`)),f.removeAttribute(DM),S.reset(),xe&&RM(s)){let e=Array.from(s.cells);for(let[t,n]of e.entries())n.style.width=xe[t]??``}a.status=`idle`;let t=e.current.translate!=null,n=r.status.dragging;ae&&(!n&&t||ae.parentElement!==f.parentElement)&&f.isConnected&&ae.replaceWith(f),ae?.remove()},Ae=n?.dropAnimation,je=this,Me=NT(()=>{let{transform:t,status:i}=r;if(!(!t.x&&!t.y&&!e.current.translate)&&i.dragging){let i=d.translate??{x:0,y:0},a={x:t.x/p.scaleX+i.x,y:t.y/p.scaleY+i.y},o=e.current.translate,s=Nw(()=>r.modifiers),c=Nw(()=>r.shape?.current),l=n?.keyboardTransition,u=oe&&!Ee&&l!==null?`${l?.duration??250}ms ${l?.easing??`cubic-bezier(0.25, 1, 0.5, 1)`}`:`0ms linear`;if(S.set({transition:P?`${P}, translate ${u}`:`translate ${u}`,translate:`${a.x}px ${a.y}px 0`},EM),ye?.takeRecords(),c&&c!==Ce&&o&&!s.length){let e=kE.delta(a,o);r.shape=AE.from(c.boundingRectangle).translate(e.x*p.scaleX,e.y*p.scaleY)}else r.shape=new sj(f);e.current.translate=a}},function(){if(r.status.dropped){this.dispose(),a.status=`dropping`;let n=c?.dropAnimation===void 0?je.dropAnimation===void 0?Ae:je.dropAnimation:c.dropAnimation,r=e.current.translate,i=r!=null;if(!r&&s!==f&&(r={x:0,y:0}),!r||n===null){ke();return}t.renderer.rendering.then(()=>{WM({source:a,element:s,feedbackElement:f,placeholder:ae,translate:r,moved:i,transition:w,alignment:a.alignment,styles:S,animation:n??void 0,getElementMutationObserver:()=>ye,cleanup:ke,restoreFocus:Oe})})}});return()=>{ke(),Me()}},Uj(qM,4,`overlay`,GM,QM,JM),Vj(qM,QM),QM.configure=gD(QM);var $M=QM,eN=!0,tN=!1,nN,rN,iN,aN=(iN=[AT],GA.Forward),oN,sN,cN;rN=(nN=[AT],GA.Reverse);var lN=class{constructor(){qj(this,sN,Hj(oN,8,this,eN)),Hj(oN,11,this),qj(this,cN,Hj(oN,12,this,eN)),Hj(oN,15,this)}isLocked(e){return e===GA.Idle?!1:e==null?this[GA.Forward]===eN&&this[GA.Reverse]===eN:this[e]===eN}unlock(e){e!==GA.Idle&&(this[e]=tN)}};oN=Lj(null),sN=new WeakMap,cN=new WeakMap,Uj(oN,4,aN,iN,lN,sN),Uj(oN,4,rN,nN,lN,cN),Vj(oN,lN);var uN=[GA.Forward,GA.Reverse],dN=class{constructor(){this.x=new lN,this.y=new lN}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},fN=class extends SD{constructor(e){super(e);let t=Ww(new dN),n=null;this.signal=t,eT(()=>{let{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new dN;return}let{delta:i}=e.dragOperation.position;if(n){let e={x:pN(i.x,n.x),y:pN(i.y,n.y)},r=t.peek();jw(()=>{for(let t of BE)for(let n of uN)e[t]===n&&r[t].unlock(n);t.value=r})}n=i})}get current(){return this.signal.peek()}};function pN(e,t){return Math.sign(e-t)}var mN,hN,gN,_N,vN,yN,bN=class extends (hN=CD,mN=[AT],hN){constructor(e){super(e),qj(this,_N,Hj(gN,8,this,!1)),Hj(gN,11,this),qj(this,vN),qj(this,yN,()=>{if(!Kj(this,vN))return;let{element:e,by:t}=Kj(this,vN);t.y&&(e.scrollTop+=t.y),t.x&&(e.scrollLeft+=t.x)}),this.scroll=(e,t)=>{if(this.disabled)return!1;let n=this.getScrollableElements();if(!n)return Jj(this,vN,void 0),!1;let{position:r}=this.manager.dragOperation,i=r?.current;if(i){let{by:r}=e??{},a=r?{x:xN(r.x),y:xN(r.y)}:void 0,o=a?void 0:this.scrollIntentTracker.current;if(o?.isLocked())return!1;for(let e of n){let n=DA(e,r);if(n.x||n.y){let{speed:n,direction:s}=JA(e,i,a,t?.acceleration,t?.threshold);if(o)for(let e of BE)o[e].isLocked(s[e])&&(n[e]=0,s[e]=0);if(s.x||s.y){let{x:t,y:i}=r??s,a=t*n.x,o=i*n.y;if(a||o){let t=Kj(this,vN)?.by;if(this.autoScrolling&&t&&(t.x&&!a||t.y&&!o))continue;return Jj(this,vN,{element:e,by:{x:a,y:o}}),kA.schedule(Kj(this,yN)),!0}}}}}return Jj(this,vN,void 0),!1};let t=null,n=null,r=OT(()=>{let{position:n,source:r}=e.dragOperation;if(!n)return null;let i=zk(Pk(r?.element),n.current);return i&&(t=i),i??t}),i=OT(()=>{let t=r.value,{documentElement:i}=Ck(t);if(!t||t===i){let{target:t}=e.dragOperation,r=t?.element;if(r){let e=RA(r,{excludeElement:!1});return n=e,e}}if(t){let e=RA(t,{excludeElement:!1});return this.autoScrolling&&n&&e.size<n?.size?n:(n=e,e)}return n=null,null},kT);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new fN(e),this.destroy=e.monitor.addEventListener(`dragmove`,t=>{this.disabled||t.defaultPrevented||!fj(e.dragOperation.activatorEvent)||!t.by||this.scroll({by:t.by})&&t.preventDefault()})}};gN=Lj(hN),_N=new WeakMap,vN=new WeakMap,yN=new WeakMap,Uj(gN,4,`autoScrolling`,mN,bN,_N),Vj(gN,bN);function xN(e){return e>0?GA.Forward:e<0?GA.Reverse:GA.Idle}var SN=new class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}}(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),CN=10,wN=class extends SD{constructor(e,t){super(e,t);let n=e.registry.plugins.get(bN);if(!n)throw Error(`AutoScroller plugin depends on Scroller plugin`);this.destroy=eT(()=>{if(this.disabled)return;let{position:t,status:r}=e.dragOperation;if(r.dragging){let e={acceleration:this.options?.acceleration,threshold:typeof this.options?.threshold==`number`?{x:this.options.threshold,y:this.options.threshold}:this.options?.threshold};if(n.scroll(void 0,e)){n.autoScrolling=!0;let t=setInterval(()=>SN.schedule(()=>n.scroll(void 0,e)),CN);return()=>{clearInterval(t)}}else n.autoScrolling=!1}})}};wN.configure=gD(wN);var TN=wN,EN={capture:!0,passive:!0},DN,ON=class extends CD{constructor(e){super(e),qj(this,DN),this.handleScroll=()=>{Kj(this,DN)??Jj(this,DN,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),Jj(this,DN,void 0)},50))};let{dragOperation:t}=this.manager;this.destroy=eT(()=>{if(t.status.dragging){let e=t.source?.element?.ownerDocument??document;return e.addEventListener(`scroll`,this.handleScroll,EN),()=>{e.removeEventListener(`scroll`,this.handleScroll,EN)}}})}};DN=new WeakMap;var kN=`* { user-select: none !important; -webkit-user-select: none !important; }`,AN=class extends SD{constructor(e){super(e),this.manager=e;let t=e.registry.plugins.get(SM)?.register(kN);if(this.destroy=eT(()=>{let{dragOperation:e}=this.manager;if(e.status.initialized)return jN(),document.addEventListener(`selectionchange`,jN,{capture:!0}),()=>{document.removeEventListener(`selectionchange`,jN,{capture:!0})}}),t){let e=this.destroy.bind(this);this.destroy=()=>{t(),e()}}}};function jN(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var MN=Object.freeze({offset:10,keyboardCodes:{start:[`Space`,`Enter`],cancel:[`Escape`],end:[`Space`,`Enter`,`Tab`],up:[`ArrowUp`],down:[`ArrowDown`],left:[`ArrowLeft`],right:[`ArrowRight`]},preventActivation(e,t){let n=t.handle??t.element;return e.target!==n}}),NN,PN=class extends NO{constructor(e,t){super(e),this.manager=e,this.options=t,qj(this,NN,[]),this.listeners=new Uk,this.handleSourceKeyDown=(e,t,n)=>{if(this.disabled||e.defaultPrevented||!dj(e.target)||t.disabled)return;let{keyboardCodes:r=MN.keyboardCodes,preventActivation:i=MN.preventActivation}=n??{};r.start.includes(e.code)&&this.manager.dragOperation.status.idle&&(i?.(e,t)||this.handleStart(e,t,n))}}bind(e,t=this.options){return eT(()=>{let n=e.handle??e.element,r=n=>{fj(n)&&this.handleSourceKeyDown(n,e,t)};if(n)return n.addEventListener(`keydown`,r),()=>{n.removeEventListener(`keydown`,r)}})}handleStart(e,t,n){let{element:r}=t;if(!r)throw Error(`Source draggable does not have an associated element`);e.preventDefault(),e.stopImmediatePropagation(),YA(r);let{center:i}=new sj(r);if(this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y},source:t}).signal.aborted)return this.cleanup();this.sideEffects();let a=Ck(r),o=[this.listeners.bind(a,[{type:`keydown`,listener:e=>this.handleKeyDown(e,t,n),options:{capture:!0}}])];Kj(this,NN).push(...o)}handleKeyDown(e,t,n){let{keyboardCodes:r=MN.keyboardCodes}=n??{};if(IN(e,[...r.end,...r.cancel])){e.preventDefault();let t=IN(e,r.cancel);this.handleEnd(e,t);return}IN(e,r.up)?this.handleMove(`up`,e):IN(e,r.down)&&this.handleMove(`down`,e),IN(e,r.left)?this.handleMove(`left`,e):IN(e,r.right)&&this.handleMove(`right`,e)}handleEnd(e,t){this.manager.actions.stop({event:e,canceled:t}),this.cleanup()}handleMove(e,t){let{shape:n}=this.manager.dragOperation,r=t.shiftKey?5:1,i={x:0,y:0},a=this.options?.offset??MN.offset;if(typeof a==`number`&&(a={x:a,y:a}),n){switch(e){case`up`:i={x:0,y:-a.y*r};break;case`down`:i={x:0,y:a.y*r};break;case`left`:i={x:-a.x*r,y:0};break;case`right`:i={x:a.x*r,y:0};break}(i.x||i.y)&&(t.preventDefault(),this.manager.actions.move({event:t,by:i}))}}sideEffects(){let e=this.manager.registry.plugins.get(TN);e?.disabled===!1&&(e.disable(),Kj(this,NN).push(()=>{e.enable()}))}cleanup(){Kj(this,NN).forEach(e=>e()),Jj(this,NN,[])}destroy(){this.cleanup(),this.listeners.clear()}};NN=new WeakMap,PN.configure=gD(PN),PN.defaults=MN;var FN=PN;function IN(e,t){return t.includes(e.code)}var LN,RN=class extends IO{constructor(){super(...arguments),qj(this,LN)}onEvent(e){switch(e.type){case`pointerdown`:Jj(this,LN,Ok(e));break;case`pointermove`:if(!Kj(this,LN))return;let{x:t,y:n}=Ok(e),r={x:t-Kj(this,LN).x,y:n-Kj(this,LN).y},{tolerance:i}=this.options;if(i&&RE(r,i)){this.abort();return}RE(r,this.options.value)&&this.activate(e);break;case`pointerup`:this.abort();break}}abort(){Jj(this,LN,void 0)}};LN=new WeakMap;var zN,BN,VN=class extends IO{constructor(){super(...arguments),qj(this,zN),qj(this,BN)}onEvent(e){switch(e.type){case`pointerdown`:Jj(this,BN,Ok(e)),Jj(this,zN,setTimeout(()=>this.activate(e),this.options.value));break;case`pointermove`:if(!Kj(this,BN))return;let{x:t,y:n}=Ok(e);RE({x:t-Kj(this,BN).x,y:n-Kj(this,BN).y},this.options.tolerance)&&this.abort();break;case`pointerup`:this.abort();break}}abort(){Kj(this,zN)&&(clearTimeout(Kj(this,zN)),Jj(this,BN,void 0),Jj(this,zN,void 0))}};zN=new WeakMap,BN=new WeakMap;var HN=class{};HN.Delay=VN,HN.Distance=RN;var UN=Object.freeze({activationConstraints(e,t){let{pointerType:n,target:r}=e;if(!(n===`mouse`&&dj(r)&&(t.handle===r||t.handle?.contains(r))))return n===`touch`?[new HN.Delay({value:250,tolerance:5})]:mj(r)&&!e.defaultPrevented?[new HN.Delay({value:200,tolerance:0})]:[new HN.Delay({value:200,tolerance:10}),new HN.Distance({value:5})]},preventActivation(e,t){let{target:n}=e;return n===t.element||n===t.handle||!dj(n)||t.handle?.contains(n)?!1:Hk(n)}}),WN,GN=class extends NO{constructor(e,t){super(e),this.manager=e,this.options=t,qj(this,WN,new Set),this.listeners=new Uk,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{let{event:e,coordinates:t}=this.latest;!e||!t||this.manager.actions.move({event:e,to:t})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,t,n=this.options){let{activationConstraints:r=UN.activationConstraints}=n??{};return typeof r==`function`?r(e,t):r}bind(e,t=this.options){return eT(()=>{let n=new AbortController,{signal:r}=n,i=n=>{pj(n)&&this.handlePointerDown(n,e,t)},a=[e.handle??e.element];t?.activatorElements&&(a=Array.isArray(t.activatorElements)?t.activatorElements:t.activatorElements(e));for(let e of a)e&&(ZN(e.ownerDocument.defaultView),e.addEventListener(`pointerdown`,i,{signal:r}));return()=>n.abort()})}handlePointerDown(e,t,n){if(this.disabled||!e.isPrimary||e.button!==0||!dj(e.target)||t.disabled||qN(e)||!this.manager.dragOperation.status.idle)return;let{preventActivation:r=UN.preventActivation}=n??{};if(r?.(e,t))return;let{target:i}=e,a=xk(i)&&i.draggable&&i.getAttribute(`draggable`)===`true`,o=zA(t.element),{x:s,y:c}=Ok(e);this.initialCoordinates={x:s*o.scaleX+o.x,y:c*o.scaleY+o.y};let l=this.activationConstraints(e,t,n);e.sensor=this;let u=new PO(l,e=>this.handleStart(t,e));u.signal.onabort=()=>this.handleCancel(e),u.onEvent(e),this.controller=u;let d=Ak(),f=this.listeners.bind(d,[{type:`pointermove`,listener:e=>this.handlePointerMove(e,t)},{type:`pointerup`,listener:this.handlePointerUp,options:{capture:!0}},{type:`pointercancel`,listener:this.handleCancel},{type:`dragstart`,listener:a?this.handleCancel:JN,options:{capture:!0}}]);Kj(this,WN).add(()=>{f(),this.initialCoordinates=void 0})}handlePointerMove(e,t){var n;if(this.controller?.activated===!1){(n=this.controller)==null||n.onEvent(e);return}if(this.manager.dragOperation.status.dragging){let n=Ok(e),r=zA(t.element);n.x=n.x*r.scaleX+r.x,n.y=n.y*r.scaleY+r.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=n,kA.schedule(this.handleMove)}}handlePointerUp(e){let{status:t}=this.manager.dragOperation;if(!t.idle){e.preventDefault(),e.stopPropagation();let n=!t.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){e.key===`Escape`&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,t){let{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||t.defaultPrevented)return;if(n.actions.start({coordinates:r,event:t,source:e}).signal.aborted)return this.cleanup();t.preventDefault();let i=Ck(t.target).body;try{i.setPointerCapture(t.pointerId)}catch{this.handleCancel(t);return}let a=dj(t.target)?[t.target,i]:i,o=this.listeners.bind(a,[{type:`touchmove`,listener:JN,options:{passive:!1}},{type:`click`,listener:JN},{type:`contextmenu`,listener:JN},{type:`keydown`,listener:this.handleKeyDown}]);Kj(this,WN).add(o)}handleCancel(e){let{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){let{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},Kj(this,WN).forEach(e=>e()),Kj(this,WN).clear()}destroy(){this.cleanup(),this.listeners.clear()}};WN=new WeakMap,GN.configure=gD(GN),GN.defaults=UN;var KN=GN;function qN(e){return`sensor`in e}function JN(e){e.preventDefault()}function YN(){}var XN=new WeakSet;function ZN(e){!e||XN.has(e)||(e.addEventListener(`touchmove`,YN,{capture:!1,passive:!1}),XN.add(e))}var QN={modifiers:[],plugins:[aM,TN,CM,$M,AN],sensors:[KN,FN]},$N=class extends sk{constructor(e={}){let t=ok(e.plugins,QN.plugins),n=ok(e.sensors,QN.sensors),r=ok(e.modifiers,QN.modifiers);super(Pj(Nj({},e),{plugins:[ON,bN,SM,...t],sensors:n,modifiers:r}))}},eP,tP,nP,rP,iP,aP,oP=class extends (nP=tO,tP=[AT],eP=[AT],nP){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:a}=n,o=Ij(n,[`element`,`effects`,`handle`]);super(Nj({effects:()=>[...i(),()=>{let{manager:e}=this;if(!e)return;let t=(this.sensors?.map(_D)??[...e.sensors]).map(t=>{let n=t instanceof NO?t:e.registry.register(t.plugin),r=t instanceof NO?void 0:t.options;return n.bind(this,r)});return function(){t.forEach(e=>e())}}]},o),t),qj(this,iP,Hj(rP,8,this)),Hj(rP,11,this),qj(this,aP,Hj(rP,12,this)),Hj(rP,15,this),this.element=r,this.handle=a}};rP=Lj(nP),iP=new WeakMap,aP=new WeakMap,Uj(rP,4,`handle`,tP,oP,iP),Uj(rP,4,`element`,eP,oP,aP),Vj(rP,oP);var sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P=class extends (lP=hO,cP=[AT],sP=[AT],lP){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,a=Ij(n,[`element`,`effects`]);let{collisionDetector:o=bj}=a,s=e=>{let{manager:t,element:n}=this;if(!n||e===null){this.shape=void 0;return}if(!t)return;let r=new sj(n),i=Nw(()=>this.shape);return r&&i?.equals(r)?i:(this.shape=r,r)},c=Ww(!1);super(Pj(Nj({},a),{collisionDetector:o,effects:()=>[...i(),()=>{let{element:e,manager:t}=this;if(!t)return;let{dragOperation:n}=t,{source:r}=n;c.value=!!(r&&n.status.initialized&&e&&!this.disabled&&this.accepts(r))},()=>{let{element:e}=this;if(c.value&&e){let t=new SA(e,s);return()=>{t.disconnect(),this.shape=void 0}}},()=>{if(this.manager?.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),qj(this,hP),qj(this,dP,Hj(uP,8,this)),Hj(uP,11,this),qj(this,gP,Hj(uP,12,this)),Hj(uP,15,this),this.element=r,this.refreshShape=()=>s()}set element(e){Jj(this,hP,e,mP)}get element(){return this.proxy??Kj(this,hP,pP)}};uP=Lj(lP),dP=new WeakMap,hP=new WeakSet,gP=new WeakMap,fP=Uj(uP,20,`#element`,cP,hP,dP),pP=fP.get,mP=fP.set,Uj(uP,4,`proxy`,sP,_P,gP),Vj(uP,_P);function vP(e){return typeof e==`object`&&!!e&&`current`in e}function yP(e){if(e!=null)return vP(e)?e.current??void 0:e}var bP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?d.useLayoutEffect:d.useEffect;function xP(){let e=(0,d.useState)(0)[1];return(0,d.useCallback)(()=>{e(e=>e+1)},[e])}function SP(e,t){let n=(0,d.useRef)(new Map),r=xP();return bP(()=>{if(!e){n.current.clear();return}return eT(()=>{let i=!1,a=!1;for(let r of n.current){let[o]=r,s=Nw(()=>r[1]),c=e[o];s!==c&&(i=!0,n.current.set(o,c),a=t?.(o,s,c)??!1)}i&&(a?queueMicrotask(()=>(0,f.flushSync)(r)):r())})},[e]),(0,d.useMemo)(()=>e&&new Proxy(e,{get(e,t){let r=e[t];return n.current.set(t,r),r}}),[e])}function CP(e,t){e()}function wP(e){let t=(0,d.useRef)(e);return bP(()=>{t.current=e},[e]),t}function TP(e,t,n=d.useEffect,r=Object.is){let i=(0,d.useRef)(e);n(()=>{let n=i.current;r(e,n)||(i.current=e,t(e,n))},[t,e])}function EP(e,t){let n=(0,d.useRef)(yP(e));bP(()=>{let r=yP(e);r!==n.current&&(n.current=r,t(r))})}var DP=Object.getOwnPropertySymbols,OP=Object.prototype.hasOwnProperty,kP=Object.prototype.propertyIsEnumerable,AP=(e,t)=>{var n={};for(var r in e)OP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&DP)for(var r of DP(e))t.indexOf(r)<0&&kP.call(e,r)&&(n[r]=e[r]);return n},jP=(0,d.createContext)(new $N),MP=(0,d.memo)((0,d.forwardRef)(({children:e},t)=>{let[n,r]=(0,d.useState)(0),i=(0,d.useRef)(null),a=(0,d.useRef)(null),o=(0,d.useMemo)(()=>({renderer:{get rendering(){return i.current??Promise.resolve()}},trackRendering(e){i.current||=new Promise(e=>{a.current=e}),(0,d.startTransition)(()=>{e(),r(e=>e+1)})}}),[]);return bP(()=>{var e;(e=a.current)==null||e.call(a),i.current=null},[e,n]),(0,d.useImperativeHandle)(t,()=>o),null})),NP=[void 0,kT];function PP(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:a,onDragMove:o,onDragOver:s,onDragEnd:c}=t,l=AP(t,[`children`,`onCollision`,`onBeforeDragStart`,`onDragStart`,`onDragMove`,`onDragOver`,`onDragEnd`]);let u=(0,d.useRef)(null),{plugins:f,modifiers:m,sensors:h}=l,g=ok(f,QN.plugins),_=ok(h,QN.sensors),v=ok(m,QN.modifiers),y=wP(i),b=wP(a),x=wP(s),S=wP(o),C=wP(c),w=wP(r),T=FP(()=>l.manager??new $N(l));return(0,d.useEffect)(()=>{if(!u.current)throw Error(`Renderer not found`);let{renderer:e,trackRendering:t}=u.current,{monitor:n}=T;T.renderer=e;let r=[n.addEventListener(`beforedragstart`,e=>{let n=y.current;n&&t(()=>n(e,T))}),n.addEventListener(`dragstart`,e=>b.current?.call(b,e,T)),n.addEventListener(`dragover`,e=>{let n=x.current;n&&t(()=>n(e,T))}),n.addEventListener(`dragmove`,e=>{let n=S.current;n&&t(()=>n(e,T))}),n.addEventListener(`dragend`,e=>{let n=C.current;n&&t(()=>n(e,T))}),n.addEventListener(`collision`,e=>w.current?.call(w,e,T))];return()=>r.forEach(e=>e())},[T]),TP(g,()=>T&&(T.plugins=g),...NP),TP(_,()=>T&&(T.sensors=_),...NP),TP(v,()=>T&&(T.modifiers=v),...NP),(0,p.jsxs)(jP.Provider,{value:T,children:[(0,p.jsx)(MP,{ref:u,children:n}),n]})}function FP(e){let t=(0,d.useRef)(null);return t.current||=e(),(0,d.useInsertionEffect)(()=>()=>t.current?.destroy(),[]),t.current}function IP(){return(0,d.useContext)(jP)}function LP(e){let t=IP()??void 0,[n]=(0,d.useState)(()=>e(t));return n.manager!==t&&(n.manager=t),bP(n.register,[t,n]),n}var RP=Object.create,zP=Object.defineProperty,BP=Object.getOwnPropertyDescriptor,VP=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),HP=e=>{throw TypeError(e)},UP=(e,t,n)=>t in e?zP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WP=e=>[,,,RP(e?.[VP(`metadata`)]??null)],GP=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],KP=e=>e!==void 0&&typeof e!=`function`?HP(`Function expected`):e,qP=(e,t,n,r,i)=>({kind:GP[e],name:t,metadata:r,addInitializer:e=>n._?HP(`Already initialized`):i.push(KP(e||null))}),JP=(e,t)=>UP(t,VP(`metadata`),e[3]),YP=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)a[i].call(n);return r},XP=(e,t,n,r,i,a)=>{for(var o,s,c,l,u=t&7,d=!1,f=!1,p=2,m=GP[u+5],h=e[p]||(e[p]=[]),g=(i=i.prototype,BP(i,n)),_=r.length-1;_>=0;_--)c=qP(u,n,s={},e[3],h),c.static=d,c.private=f,l=c.access={has:e=>n in e},l.get=e=>e[n],o=(0,r[_])(g[m],c),s._=1,KP(o)&&(g[m]=o);return g&&zP(i,n,g),i},ZP=(e,t,n)=>t.has(e)||HP(`Cannot `+n),QP=(e,t,n)=>(ZP(e,t,`read from private field`),t.get(e)),nne=(e,t,n)=>t.has(e)?HP(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),$P=(e,t,n,r)=>(ZP(e,t,`write to private field`),t.set(e,n),n),eF=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},tF,nF,rF,iF,aF,oF=class extends (rF=eE,nF=[jT],tF=[jT],rF){constructor(e){let t=eF.from(e);super(t,(e,t)=>eF.equals(e,t)),YP(aF,5,this),nne(this,iF,0),this.velocity={x:0,y:0}}get delta(){return eF.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=eF.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-QP(this,iF),o=e=>Math.round(e/a*100);jw(()=>{$P(this,iF,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(eF.from(e)),this.velocity={x:0,y:0}}};aF=WP(rF),iF=new WeakMap,XP(aF,2,`delta`,nF,oF),XP(aF,2,`direction`,tF,oF),JP(aF,oF);var sF=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(sF||{});Object.values(sF);var cF=Object.create,lF=Object.defineProperty,uF=Object.defineProperties,dF=Object.getOwnPropertyDescriptor,fF=Object.getOwnPropertyDescriptors,pF=Object.getOwnPropertySymbols,mF=Object.prototype.hasOwnProperty,hF=Object.prototype.propertyIsEnumerable,gF=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),_F=e=>{throw TypeError(e)},vF=(e,t,n)=>t in e?lF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yF=(e,t)=>{for(var n in t||={})mF.call(t,n)&&vF(e,n,t[n]);if(pF)for(var n of pF(t))hF.call(t,n)&&vF(e,n,t[n]);return e},bF=(e,t)=>uF(e,fF(t)),xF=(e,t)=>{var n={};for(var r in e)mF.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pF)for(var r of pF(e))t.indexOf(r)<0&&hF.call(e,r)&&(n[r]=e[r]);return n},SF=e=>[,,,cF(null)],CF=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],wF=e=>e!==void 0&&typeof e!=`function`?_F(`Function expected`):e,TF=(e,t,n,r,i)=>({kind:CF[e],name:t,metadata:r,addInitializer:e=>n._?_F(`Already initialized`):i.push(wF(e||null))}),EF=(e,t)=>vF(t,gF(`metadata`),e[3]),DF=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},OF=(e,t,n,r,i,a)=>{for(var o,s,c,l,u,d=t&7,f=!1,p=!1,m=e.length+1,h=CF[d+5],g=e[m-1]=[],_=e[m]||(e[m]=[]),v=(i=i.prototype,dF({get[n](){return AF(this,a)},set[n](e){return MF(this,a,e)}},n)),y=r.length-1;y>=0;y--)l=TF(d,n,c={},e[3],_),l.static=f,l.private=p,u=l.access={has:e=>n in e},u.get=e=>e[n],u.set=(e,t)=>e[n]=t,s=(0,r[y])({get:v.get,set:v.set},l),c._=1,s===void 0?wF(s)&&(v[h]=s):typeof s!=`object`||!s?_F(`Object expected`):(wF(o=s.get)&&(v.get=o),wF(o=s.set)&&(v.set=o),wF(o=s.init)&&g.unshift(o));return v&&lF(i,n,v),i},kF=(e,t,n)=>t.has(e)||_F(`Cannot `+n),AF=(e,t,n)=>(kF(e,t,`read from private field`),t.get(e)),jF=(e,t,n)=>t.has(e)?_F(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),MF=(e,t,n,r)=>(kF(e,t,`write to private field`),t.set(e,n),n);function NF(e){return e instanceof hI||e instanceof mI}function PF(e){return NF(e.source)&&NF(e.target)}var FF=10,IF=class extends SD{constructor(e){super(e);let t=eT(()=>{let{dragOperation:t}=e;if(fj(t.activatorEvent)&&NF(t.source)&&t.status.initialized){let t=e.registry.plugins.get(bN);if(t)return t.disable(),()=>t.enable()}}),n=e.monitor.addEventListener(`dragmove`,(e,t)=>{queueMicrotask(()=>{if(this.disabled||e.defaultPrevented||!e.nativeEvent)return;let{dragOperation:n}=t;if(!fj(e.nativeEvent)||!NF(n.source)||!n.shape)return;let{actions:r,collisionObserver:i,registry:a}=t,{by:o}=e;if(!o)return;let s=LF(o),{source:c,target:l}=n,{center:u}=n.shape.current,d=[],f=[];jw(()=>{for(let e of a.droppables){let{id:t}=e;if(!e.accepts(c)||t===l?.id&&NF(e)||!e.element)continue;let n=e.shape,r=new sj(e.element,{getBoundingClientRect:e=>Dk(e,void 0,.2)});!r.height||!r.width||(s==`down`&&u.y+FF<r.center.y||s==`up`&&u.y-FF>r.center.y||s==`left`&&u.x-FF>r.center.x||s==`right`&&u.x+FF<r.center.x)&&(d.push(e),e.shape=r,f.push(()=>e.shape=n))}}),e.preventDefault(),i.disable();let p=i.computeCollisions(d,xj);jw(()=>f.forEach(e=>e()));let[m]=p;if(!m)return;let{id:h}=m,{index:g,group:_}=c.sortable;r.setDropTarget(h).then(()=>{let{source:e,target:t,shape:a}=n;if(!e||!NF(e)||!a)return;let{index:o,group:s,target:c}=e.sortable,l=g!==o||_!==s,u=l?c:t?.element;if(!u)return;YA(u);let d=new sj(u);if(!d)return;let f=AE.delta(d,AE.from(a.current.boundingRectangle),e.alignment);r.move({by:f}),l?r.setDropTarget(e.id).then(()=>i.enable()):i.enable()})})});this.destroy=()=>{n(),t()}}};function LF(e){let{x:t,y:n}=e;if(t>0)return`right`;if(t<0)return`left`;if(n>0)return`down`;if(n<0)return`up`}var RF=Object.defineProperty,zF=Object.defineProperties,BF=Object.getOwnPropertyDescriptors,VF=Object.getOwnPropertySymbols,HF=Object.prototype.hasOwnProperty,UF=Object.prototype.propertyIsEnumerable,WF=(e,t,n)=>t in e?RF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GF=(e,t)=>{for(var n in t||={})HF.call(t,n)&&WF(e,n,t[n]);if(VF)for(var n of VF(t))UF.call(t,n)&&WF(e,n,t[n]);return e},KF=(e,t)=>zF(e,BF(t));function qF(e,t,n){if(t===n)return e;let r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function JF(e){return`initialIndex`in e&&typeof e.initialIndex==`number`&&`index`in e&&typeof e.index==`number`}function YF(e,t,n){let{source:r,target:i,canceled:a}=t.operation;if(!r||!i||a)return`preventDefault`in t&&t.preventDefault(),e;let o=(e,t)=>e===t||typeof e==`object`&&`id`in e&&e.id===t;if(Array.isArray(e)){let s=e.findIndex(e=>o(e,r.id)),c=e.findIndex(e=>o(e,i.id));if(s===-1||c===-1){if(JF(r)){let i=r.initialIndex,a=r.index;return i===a||i<0||i>=e.length?(`preventDefault`in t&&t.preventDefault(),e):n(e,i,a)}return e}if(!a&&`index`in r&&typeof r.index==`number`){let t=r.index;if(t!==s)return n(e,s,t)}return n(e,s,c)}let s=Object.entries(e),c=-1,l,u=-1,d;for(let[e,t]of s)if(c===-1&&(c=t.findIndex(e=>o(e,r.id)),c!==-1&&(l=e)),u===-1&&(u=t.findIndex(e=>o(e,i.id)),u!==-1&&(d=e)),c!==-1&&u!==-1)break;if(c===-1&&JF(r)){let i=r.initialGroup,a=r.initialIndex,o=r.group,s=r.index;if(i==null||o==null||!(i in e)||!(o in e)||i===o&&a===s)return`preventDefault`in t&&t.preventDefault(),e;if(i===o)return KF(GF({},e),{[i]:n(e[i],a,s)});let c=e[i][a];return KF(GF({},e),{[i]:[...e[i].slice(0,a),...e[i].slice(a+1)],[o]:[...e[o].slice(0,s),c,...e[o].slice(s)]})}if(!r.manager)return e;let{dragOperation:f}=r.manager,p=f.shape?.current.center??f.position.current;if(d==null&&i.id in e){let t=i.shape&&p.y>i.shape.center.y?e[i.id].length:0;d=i.id,u=t}if(l==null||d==null||l===d&&c===u){if(l!=null&&l===d&&c===u&&JF(r)){let t=r.group!=null&&r.group!==l,i=r.index!==c;if(t||i){let t=r.group??l;if(t in e){if(l===t)return KF(GF({},e),{[l]:n(e[l],c,r.index)});let i=e[l][c];return KF(GF({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[t]:[...e[t].slice(0,r.index),i,...e[t].slice(r.index)]})}}}return`preventDefault`in t&&t.preventDefault(),e}if(l===d)return KF(GF({},e),{[l]:n(e[l],c,u)});let m=i.shape&&Math.round(p.y)>Math.round(i.shape.center.y)?1:0,h=e[l][c];return KF(GF({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[d]:[...e[d].slice(0,u+m),h,...e[d].slice(u+m)]})}function XF(e,t){return YF(e,t,qF)}var ZF=`__default__`,QF=class extends SD{constructor(e){super(e);let t=()=>{let t=new Map;for(let n of e.registry.droppables)if(n instanceof hI){let{sortable:e}=n,{group:r}=e,i=t.get(r);i||(i=new Set,t.set(r,i)),i.add(e)}for(let[e,n]of t)t.set(e,new Set(tI(n)));return t},n=[e.monitor.addEventListener(`dragover`,(e,n)=>{if(this.disabled)return;let{dragOperation:r}=n,{source:i,target:a}=r;if(!NF(i)||!NF(a)||i.sortable===a.sortable)return;let o=t(),s=i.sortable.group===a.sortable.group,c=o.get(i.sortable.group),l=s?c:o.get(a.sortable.group);!c||!l||queueMicrotask(()=>{e.defaultPrevented||n.renderer.rendering.then(()=>{let r=t();for(let[e,t]of o.entries()){let n=Array.from(t).entries();for(let[t,i]of n)if(i.index!==t||i.group!==e||!r.get(e)?.has(i))return}let u=i.sortable.element,d=a.sortable.element;if(!d||!u||!s&&a.id===i.sortable.group)return;let f=tI(c),p=s?f:tI(l),m=i.sortable.group??ZF,h=a.sortable.group??ZF,g={[m]:f,[h]:p},_=XF(g,e);if(g===_)return;let v=_[h].indexOf(i.sortable),y=_[h].indexOf(a.sortable);n.collisionObserver.disable(),$F(u,v,d,y),jw(()=>{for(let[e,t]of _[m].entries())t.index=e;if(!s)for(let[e,t]of _[h].entries())t.group=a.sortable.group,t.index=e}),n.actions.setDropTarget(i.id).then(()=>n.collisionObserver.enable())})})}),e.monitor.addEventListener(`dragend`,(e,n)=>{if(!e.canceled)return;let{dragOperation:r}=n,{source:i}=r;NF(i)&&(i.sortable.initialIndex===i.sortable.index&&i.sortable.initialGroup===i.sortable.group||queueMicrotask(()=>{let e=t(),r=e.get(i.sortable.initialGroup);r&&n.renderer.rendering.then(()=>{for(let[t,n]of e.entries()){let e=Array.from(n).entries();for(let[n,r]of e)if(r.index!==n||r.group!==t)return}let t=tI(r),n=i.sortable.element,a=t[i.sortable.initialIndex],o=a?.element;!a||!o||!n||($F(n,a.index,o,i.index),jw(()=>{for(let[t,n]of e.entries()){let e=Array.from(n).values();for(let t of e)t.index=t.initialIndex,t.group=t.initialGroup}}))})}))})];this.destroy=()=>{for(let e of n)e()}}};function $F(e,t,n,r){let i=r<t?`afterend`:`beforebegin`;n.insertAdjacentElement(i,e)}function eI(e,t){return e.index-t.index}function tI(e){return Array.from(e).sort(eI)}var nI=[IF,QF],rI={duration:250,easing:`cubic-bezier(0.25, 1, 0.5, 1)`,idle:!1},iI=new rE,aI,oI=[AT],sI,cI,lI,uI,dI,fI;aI=[AT];var pI=class{constructor(e,t){jF(this,cI,DF(sI,8,this)),DF(sI,11,this),jF(this,lI),jF(this,uI),jF(this,dI,DF(sI,12,this)),DF(sI,15,this),jF(this,fI),this.register=()=>(jw(()=>{var e,t;(e=this.manager)==null||e.registry.register(this.droppable),(t=this.manager)==null||t.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{jw(()=>{var e,t;(e=this.manager)==null||e.registry.unregister(this.droppable),(t=this.manager)==null||t.registry.unregister(this.draggable)})},this.destroy=()=>{jw(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],group:i,index:a,sensors:o,type:s,transition:c=rI,plugins:l}=n,u=xF(n,[`effects`,`group`,`index`,`sensors`,`type`,`transition`,`plugins`]);let d=ok(l,nI);this.droppable=new hI(u,t,this),this.draggable=new mI(bF(yF({},u),{plugins:d,effects:()=>[()=>{let e=this.manager?.dragOperation.status;e?.initializing&&this.id===this.manager?.dragOperation.source?.id&&iI.clear(this.manager),e?.dragging&&iI.set(this.manager,this.id,Nw(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:e,group:t,manager:n}=this,r=AF(this,uI),i=AF(this,lI);(e!==r||t!==i)&&(MF(this,uI,e),MF(this,lI,t),this.animate())},()=>{let{target:e}=this,{isDragSource:t}=this.draggable;(this.draggable.pluginConfig($M)?.feedback??`default`)===`move`&&t&&(this.droppable.disabled=!e)},...r()],type:s,sensors:o}),t,this),MF(this,fI,u.element),this.manager=t,this.index=a,MF(this,uI,a),this.group=i,MF(this,lI,i),this.type=s,this.transition=c}get initialIndex(){return iI.get(this.manager,this.id)?.initialIndex??this.index}get initialGroup(){return iI.get(this.manager,this.id)?.initialGroup??this.group}animate(){Nw(()=>{let{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;let{idle:r}=e.dragOperation.status;!n||!t||r&&!t.idle||e.renderer.rendering.then(()=>{let{element:r}=this;if(!r)return;for(let e of r.getAnimations())`transitionProperty`in e&&(e.transitionProperty===`transform`||e.transitionProperty===`translate`||e.transitionProperty===`scale`)&&e.cancel();let i=this.refreshShape();if(!i)return;let a={x:n.boundingRectangle.left-i.boundingRectangle.left,y:n.boundingRectangle.top-i.boundingRectangle.top},{translate:o}=NA(r),s=tj(r,o,!1),c=tj(r,o);if(a.x||a.y){let n=Fk(yk(r))?bF(yF({},t),{duration:0}):t;ej({element:r,keyframes:{translate:[`${s.x+a.x}px ${s.y+a.y}px ${s.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:n}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){jw(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){jw(()=>{let t=AF(this,fI),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),MF(this,fI,e)})}get element(){let e=AF(this,fI);if(e)return Vk.get(e)??e??this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){return this.draggable.disabled&&this.droppable.disabled}set plugins(e){this.draggable.plugins=ok(e,nI)}set disabled(e){jw(()=>{this.droppable.disabled=e,this.draggable.disabled=e})}set data(e){jw(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??bj}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){jw(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};sI=SF(),cI=new WeakMap,lI=new WeakMap,uI=new WeakMap,dI=new WeakMap,fI=new WeakMap,OF(sI,4,`index`,oI,pI,cI),OF(sI,4,`group`,aI,pI,dI),EF(sI,pI);var mI=class extends oP{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},hI=class extends _P{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},gI=Object.defineProperty,_I=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,yI=Object.getOwnPropertySymbols,bI=Object.prototype.hasOwnProperty,xI=Object.prototype.propertyIsEnumerable,SI=(e,t,n)=>t in e?gI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CI=(e,t)=>{for(var n in t||={})bI.call(t,n)&&SI(e,n,t[n]);if(yI)for(var n of yI(t))xI.call(t,n)&&SI(e,n,t[n]);return e},wI=(e,t)=>_I(e,vI(t));function TI(e){let{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:a,element:o,handle:s,index:c,group:l,disabled:u,modifiers:f,sensors:p,target:m,type:h,plugins:g}=e,_=CI(CI({},rI),e.transition),v=LP(t=>new pI(wI(CI({},e),{transition:_,register:!1,handle:yP(s),element:yP(o),target:yP(m)}),t)),y=SP(v,EI);return TP(i,()=>v.id=i),bP(()=>{jw(()=>{v.group=l,v.index=c})},[v,l,c]),TP(h,()=>v.type=h),TP(t,()=>v.accept=t,void 0,kT),TP(a,()=>a&&(v.data=a)),TP(c,()=>{v.manager?.dragOperation.status.idle&&_?.idle&&v.refreshShape()},CP),EP(s,e=>v.handle=e),EP(o,e=>v.element=e),EP(m,e=>v.target=e),TP(u,()=>v.disabled=u===!0),TP(p,()=>v.sensors=p),TP(n,()=>v.collisionDetector=n),TP(r,()=>v.collisionPriority=r),TP(g,()=>v.plugins=g,void 0,kT),TP(_,()=>v.transition=_,void 0,kT),TP(f,()=>v.modifiers=f,void 0,kT),TP(e.alignment,()=>v.alignment=e.alignment),{sortable:y,get isDragging(){return y.isDragging},get isDropping(){return y.isDropping},get isDragSource(){return y.isDragSource},get isDropTarget(){return y.isDropTarget},handleRef:(0,d.useCallback)(e=>{v.handle=e??void 0},[v]),ref:(0,d.useCallback)(e=>{!e&&v.element?.isConnected&&!v.manager?.dragOperation.status.idle||(v.element=e??void 0)},[v]),sourceRef:(0,d.useCallback)(e=>{!e&&v.source?.isConnected&&!v.manager?.dragOperation.status.idle||(v.source=e??void 0)},[v]),targetRef:(0,d.useCallback)(e=>{!e&&v.target?.isConnected&&!v.manager?.dragOperation.status.idle||(v.target=e??void 0)},[v])}}function EI(e,t,n){return!!(e===`isDragSource`&&!n&&t)}var DI=({typeInfos:e,color:t,iconClassName:n})=>(0,p.jsxs)(ew,{delayDuration:500,children:[(0,p.jsx)(tw,{children:(0,p.jsx)(`div`,{className:t?void 0:e.defaultItemClassName,style:{color:t},children:(0,p.jsx)(e.icon,{className:V(`size-5`,n)})})}),(0,p.jsx)(nw,{align:`start`,side:`bottom`,children:e.label})]}),OI=[`#404040`,`#b91c1c`,`#c2410c`,`#a16207`,`#4d7c0f`,`#047857`,`#0369a1`,`#4338ca`,`#7e22ce`,`#86198f`,`#be123c`],kI=e=>OI[new TextEncoder().encode(e).reduce((e,t)=>e+t,0)%OI.length],AI=e=>e.metadata?.editorItemColor||kI(e.id),jI=e=>e instanceof Se&&e.isRoot()?`root`:e.type,MI={key:`unknown`,label:`Unknown`,description:`Item type not found in registry.`,icon:DS},NI=(e,t)=>{if(!t)return MI;let n=$x(t,e);return n?{key:n.itemType,label:Fx(n.infos.labelByLocale),description:Fx(n.infos.descriptionByLocale),defaultItemClassName:n.infos.defaultItemClassName,icon:n.infos.icon}:{...MI,key:e.type,label:e.type}},PI=(e,t)=>{if(e===void 0||!t)return;let n=e===`root`?t.definitions.root:t.definitions[e];return n?{key:n.itemType,label:Fx(n.infos.labelByLocale),description:Fx(n.infos.descriptionByLocale),defaultItemClassName:n.infos.defaultItemClassName,icon:n.infos.icon}:{...MI,key:e,label:e}};function FI(e){let t=W(e=>e.editorItemRegistry);return(0,u.useMemo)(()=>PI(e,t),[e,t])}function II(e={}){let t=G(`deleteItem`),{selectedItemId:n,navigateToItem:r}=Ow(),i=mx(),a=qC(),o=Cw(),{removeItem:s}=W(e=>e),c=e.itemId??n,l=(0,u.useCallback)(async()=>{if(!c)return;let e=o?.getReferenceUsages(c);if(e&&e.length>0){await a({title:t(`removeReferencesTitle`),description:t(`removeReferencesDescription`),buttonLabel:t(`ok`),children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground mb-1`,children:t(`referencesFoundIn`)}),(0,p.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(H,{variant:`outline`,size:`sm`,className:`flex items-center gap-1 w-full`,onClick:()=>{r(e.itemId),a.dismiss()},children:[(0,p.jsx)(`span`,{className:`text-sm font-medium`,children:o?.getItemKey(e.itemId)?.fullKey??e.itemId}),(0,p.jsx)(`span`,{className:`text-[0.5rem] text-muted-foreground border border-muted-foreground rounded-md px-1 py-0.5`,children:e.usageType}),(0,p.jsx)(xS,{className:`ml-auto size-4 text-muted-foreground`})]})},e.itemId+t))})]})});return}if(await i({title:t(`deleteSurveyItemTitle`),description:t(`deleteSurveyItemDescription`),variant:`destructive`}))try{let e=o?.getParentItem(c),n=o?.surveyItems.get(c);s(c),r(e?.id??o?.rootItem?.id),OC.success(t(`deletedSuccessfully`,{itemKey:n?.key??c}))}catch(e){console.error(`Error deleting item:`,e),OC.error(t(`failed`),{description:e instanceof Error?e.message:t(`unknownError`)})}},[a,i,c,r,s,o,t]);return{itemId:c,canDelete:!!c,deleteItem:l}}var LI=({overrideItemId:e})=>{let t=G(),{canDelete:n,deleteItem:r}=II({itemId:e});return n?(0,p.jsxs)(dC,{onSelect:e=>{e.preventDefault(),r()},children:[(0,p.jsx)($S,{className:`size-4 mr-2 text-destructive`}),t(`common.actions.delete`)]}):null};function RI({...e}){return(0,p.jsx)(Zf,{"data-slot":`context-menu`,...e})}function zI({className:e,...t}){return(0,p.jsx)(Qf,{"data-slot":`context-menu-trigger`,className:V(`select-none`,e),...t})}function BI({...e}){return(0,p.jsx)(rp,{"data-slot":`context-menu-sub`,...e})}function VI({className:e,...t}){return(0,p.jsx)($f,{children:(0,p.jsx)(ep,{"data-slot":`context-menu-content`,className:V(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function HI({className:e,inset:t,variant:n=`default`,...r}){return(0,p.jsx)(tp,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:V(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function UI({className:e,inset:t,children:n,...r}){return(0,p.jsxs)(ip,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:V(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,p.jsx)(xS,{className:`ml-auto`})]})}function WI({className:e,...t}){return(0,p.jsx)(ap,{"data-slot":`context-menu-sub-content`,className:V(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}function GI({className:e,...t}){return(0,p.jsx)(np,{"data-slot":`context-menu-separator`,className:V(`-mx-1 my-1 h-px bg-border`,e),...t})}var KI=({currentColor:e,onColorChange:t})=>{let n=G(`itemColor`);return(0,p.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-2`,children:OI.map(r=>(0,p.jsx)(H,{variant:`ghost`,size:`sm`,className:V(`w-8 h-8 p-0 rounded-md border-2 hover:scale-110 transition-all`,e===r?`border-foreground ring-2 ring-foreground ring-offset-1`:`border-transparent hover:border-muted-foreground`),style:{backgroundColor:r},onClick:()=>t(r),title:n(`swatchTitle`,{color:r})},r))})},qI=e=>{let t=G(`history`),n=G(`itemColor`),r=W(e=>e.getItemDataCopy),i=W(e=>e.updateItem),a=W(e=>e.commitByUser),o=Cw()?.surveyItems.get(e);return{currentColor:o&&AI(o)||`#404040`,onColorChange:o=>{let s=r(e);if(!s){OC.error(n(`failedUpdate`));return}s.metadata={...s.metadata,editorItemColor:o},i(e,s),a({label:t(`updateItemEditorColor`)}),OC.success(n(`updated`))}}},JI=({itemId:e})=>{let t=G(`itemColor`),{currentColor:n,onColorChange:r}=qI(e);return(0,p.jsxs)(Hte,{children:[(0,p.jsxs)(Ute,{children:[(0,p.jsx)(US,{className:`mr-2 h-4 w-4`}),(0,p.jsx)(`span`,{className:`text-nowrap`,children:t(`label`)})]}),(0,p.jsx)(Wte,{className:`border-border`,children:(0,p.jsx)(KI,{currentColor:n,onColorChange:r})})]})},YI=({itemId:e})=>{let t=G(`itemColor`),{currentColor:n,onColorChange:r}=qI(e);return(0,p.jsxs)(BI,{children:[(0,p.jsxs)(UI,{children:[(0,p.jsx)(US,{className:`mr-2 h-4 w-4`}),(0,p.jsx)(`span`,{children:t(`label`)})]}),(0,p.jsx)(WI,{className:`border-border`,children:(0,p.jsx)(KI,{currentColor:n,onColorChange:r})})]})},XI=({item:e})=>{let t=Cw(),n=W(e=>e.selectedLocale),r=W(e=>e.editorItemRegistry),i=(0,u.useMemo)(()=>({coreRegistry:r.coreRegistry,getRenderer:e=>r.definitions[e]?.renderComponent,localizations:r.playerLocalizations}),[r]),a=(0,u.useMemo)(()=>t?new Vn(t,{locale:n}):null,[n,t]),o=(0,u.useMemo)(()=>{if(a)return a.getRenderedSurveyItem(e.id)??{id:e.id,type:e.type}},[e.id,e.type,a]);return!t||!a||!o?null:(0,p.jsx)(Ex,{survey:t,locale:n,surveyEngine:a,surveyPlayerRegistry:i,children:(0,p.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,p.jsx)(Q9,{item:o})})})},ZI=({children:e})=>(0,p.jsx)(`div`,{className:`h-full w-full overflow-auto`,children:(0,p.jsx)(`div`,{style:{pointerEvents:`none`,userSelect:`none`},"aria-hidden":`true`,children:e})}),QI=({item:e,mode:t=`interactive`})=>{let n=G(`common.actions`),r=G(`copyItem`),i=G(`itemPreview`),a=Sw(),o=Cw(),s=W(e=>e.editorItemRegistry),c=W(e=>e.selectedLocale),{navigateToItem:l}=Ow(),u=t===`static`;if(!e)return(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full text-center text-muted-foreground`,children:(0,p.jsx)(`p`,{className:`text-sm`,children:i(`noItemSelected`)})});let d=AI(e),f=NI(e,s),m=$x(s,e),h=o?.getItemTranslations(e.id),g=(0,p.jsxs)(`div`,{className:`text-sm text-muted-foreground flex items-center gap-3 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,p.jsx)(DI,{typeInfos:f,color:d,iconClassName:`size-5`}),(0,p.jsx)(`p`,{className:`font-mono min-w-0 flex-1 truncate`,style:{color:d},children:o?.getItemKey(e.id)?.fullKey})]}),(0,p.jsx)(`p`,{className:`text-muted-foreground font-medium shrink-0 max-w-[40%] truncate`,children:e.metadata?.itemLabel})]}),_=()=>{if(u&&m?.renderComponent)return(0,p.jsx)(`div`,{className:`max-w-[832px] w-full mx-auto @container/preview-content`,children:(0,p.jsx)(XI,{item:e})});if(m?.previewComponent){let n=m.previewComponent;return(0,p.jsx)(`div`,{className:`max-w-[832px] w-full mx-auto @container/preview-content`,children:(0,p.jsx)(n,{item:e,itemConfig:e.config,itemContent:h,locale:c,mode:t})})}if(m?.renderComponent){let t=m.renderComponent;return(0,p.jsx)(`div`,{className:`max-w-[832px] w-full mx-auto @container/preview-content`,children:(0,p.jsx)(t,{renderedItem:{id:e.id,type:e.type}})})}return(0,p.jsx)(`div`,{className:`text-center text-muted-foreground py-10`,children:i(`noPreviewRenderer`,{itemType:e.type})})};return(0,p.jsx)(`div`,{className:`gap-3 h-full flex flex-col @container/preview`,children:(0,p.jsx)(`div`,{className:`flex items-center justify-center flex-1`,children:(0,p.jsxs)(`div`,{className:`relative w-full space-y-2`,children:[(0,p.jsx)(`div`,{className:`flex justify-center py-2`,children:g}),u?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`h-full hidden @sm/preview:block`,children:(0,p.jsx)(ZI,{children:_()})}),(0,p.jsx)(`div`,{className:`flex min-h-[220px] w-full items-center justify-center rounded-md border border-dashed border-border/70 bg-(--surface-bg-color) py-6 @sm/preview:hidden`,children:(0,p.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-6 shadow-sm`,style:{color:d},"aria-label":i(`previewIconAria`,{itemType:e.type}),children:(0,p.jsx)(f.icon,{className:`size-10`})})})]}):_(),(0,p.jsxs)(`div`,{className:`flex items-center gap-3 w-fit mx-auto`,children:[(0,p.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:()=>{e&&l(e.id)},className:`flex flex-col gap-1 h-auto py-2`,children:[(0,p.jsx)(WS,{className:`size-4`}),(0,p.jsx)(`span`,{className:`text-xs`,children:i(`openItem`)})]}),(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{asChild:!0,children:(0,p.jsxs)(H,{variant:`ghost`,size:`sm`,className:`flex flex-col gap-1 h-auto py-2`,children:[(0,p.jsx)(ES,{className:`size-4`}),(0,p.jsx)(`span`,{className:`text-xs`,children:n(`more`)})]})}),(0,p.jsxs)(uC,{align:`end`,className:`border-border`,children:[(0,p.jsxs)(dC,{onClick:()=>{if(e&&a){let t=a.copyItem(e.id);navigator.clipboard.writeText(JSON.stringify(t,null,2)).then(()=>{_C(),OC.success(r(`copied`))}).catch(()=>{OC.error(r(`failed`))})}},children:[(0,p.jsx)(kS,{className:`size-4 mr-2`}),n(`copy`)]}),(0,p.jsx)(hC,{}),(0,p.jsx)(JI,{itemId:e.id}),(0,p.jsx)(hC,{}),(0,p.jsx)(LI,{overrideItemId:e.id})]})]})]})]})})})},$I=({itemId:e})=>{let t=G(),{canDelete:n,deleteItem:r}=II({itemId:e});return(0,p.jsxs)(HI,{disabled:!n,onSelect:e=>{e.preventDefault(),r()},children:[(0,p.jsx)($S,{className:`size-4 mr-2 text-destructive`}),t(`common.actions.delete`)]})},eL=(0,u.createContext)(void 0),tL=({children:e})=>{let[t,n]=(0,u.useState)(!1),[r,i]=(0,u.useState)(void 0),[a,o]=(0,u.useState)(null),s={addItemDialogOpen:t,setAddItemDialogOpen:n,openAddItemDialog:e=>{i(e),n(!0)},closeAddItemDialog:()=>n(!1),targetParentId:r,preferredPreviewItemId:a,setPreferredPreviewItemId:o};return(0,p.jsx)(eL.Provider,{value:s,children:e})},nL=()=>{let e=(0,u.useContext)(eL);if(e===void 0)throw Error(`useItemEditor must be used within an ItemEditorProvider`);return e},rL={tiny:40,focused:150,full:500},rne=120,ine=8,ane=120,one={generic:{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!1},"key-suggestion":{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!0},"label-suggestion":{scope:`tiny`,includeRawSurvey:!1,includeIndexes:!1,includeFocusItemTree:!0},"item-generation":{scope:`focused`,includeRawSurvey:!1,includeIndexes:!0,includeFocusItemTree:!0},translation:{scope:`focused`,includeRawSurvey:!1,includeIndexes:!0,includeFocusItemTree:!0},"condition-management":{scope:`full`,includeRawSurvey:!0,includeIndexes:!0,includeFocusItemTree:!0}},sne=e=>[...e].sort((e,t)=>e.itemId.localeCompare(t.itemId));function iL(e,t){let n=e.surveyItems.get(t);return n instanceof Se?[...n.items??[]]:[]}function cne(e){let t=new Map;for(let n of e.surveyItems.values())if(n instanceof Se)for(let e of n.items??[])t.set(e,n.id);return t}function lne(e,t){let n=new Map,r=(i,a=new Set)=>{let o=n.get(i);if(o)return o;let s=e.surveyItems.get(i);if(!s)return i;if(a.has(i))return s.key;let c=t.get(i);if(!c)return n.set(i,s.key),s.key;a.add(i);let l=r(c,a);a.delete(i);let u=`${l}.${s.key}`;return n.set(i,u),u};return r}function une(e,t,n){let r=[],i=new Set,a=(r,i)=>{let a=e.surveyItems.get(r);if(!a)return;let o=a instanceof Se?a.items.length:0;return{itemId:r,parentId:t.get(r),depth:i,itemType:a.type,key:a.key,fullKey:n(r),itemLabel:a.metadata?.itemLabel,childCount:o}},o=(t,n)=>{if(i.has(t))return;i.add(t);let s=a(t,n);s&&r.push(s);for(let r of iL(e,t))o(r,n+1)},s=e.rootItem;s&&o(s.id,0);let c=sne(Array.from(e.surveyItems.values()).filter(e=>!i.has(e.id)).map(e=>({itemId:e.id})));for(let e of c)o(e.itemId,0);return r}function aL(e,t){let n=new Set,r=e.rootItem;r&&n.add(r.id),n.add(t);for(let r of e.getItemPath(t))n.add(r);for(let r of e.getSiblings(t))n.add(r.id);for(let r of iL(e,t))n.add(r);return n}function oL(e,t,n,r){let i=[{id:t,depth:0}];for(;i.length>0;){let t=i.shift();if(t&&!(t.depth>=r))for(let r of iL(e,t.id))n.add(r),i.push({id:r,depth:t.depth+1})}}function dne(e,t){let n=aL(e,t),r=e.getItemPath(t);oL(e,t,n,2);for(let r of e.getSiblings(t))r.id!==t&&(n.add(r.id),oL(e,r.id,n,1));for(let t of r){let r=(e.getParentItem(t)?.items??[]).filter(e=>e!==t);for(let t of r)n.add(t),oL(e,t,n,1)}return n}function fne(e,t){if(!e.surveyItems.has(t))return;let n=[...e.getItemPath(t),t];return{focusItemId:t,parentItemId:e.getParentItem(t)?.id,pathItemIds:n,siblingItemIds:e.getSiblings(t).filter(e=>e.id!==t).map(e=>e.id),childItemIds:iL(e,t)}}var pne=(e,t)=>e.trim().replace(/\s+/g,` `).slice(0,t),mne=(e,t)=>{let n=pne(Ve(e),t);return n.length>0?n:null};function hne(e,t,n,r){let i=[],a=e.getItemTranslations(t);if(!a)return i;for(let e of a.locales){let t=a.getAllForLocale(e);if(t)for(let[a,o]of Object.entries(t)){let t=mne(o,r);if(t&&(i.push({locale:e,contentKey:a,text:t}),i.length>=n))return i}}return i}function gne(e,t,n,r){if(!e.surveyItems.has(t))return{truncated:!1};let i=r.treeLimit,a=!1,o=t=>{if(i<=0){a=!0;return}let s=e.surveyItems.get(t);if(!s)return;--i;let c=e.getSiblings(t).filter(e=>e.id!==t).map(e=>e.key),l=[];if(s instanceof Se)for(let e of s.items){let t=o(e);t&&l.push(t)}return{itemId:s.id,itemType:s.type,itemKey:s.key,fullKey:n(s.id),itemLabel:s.metadata?.itemLabel,siblingKeys:c,translations:hne(e,s.id,r.snippetsPerItem,r.snippetTextLimit),descendants:l}};return{focusItem:o(t),truncated:a}}function _ne(e,t,n){let r={keyIndex:t.map(e=>({itemId:e.itemId,itemType:e.itemType,key:e.key,fullKey:e.fullKey,itemLabel:e.itemLabel,path:e.fullKey.split(`.`).slice(0,-1)}))};return n===`condition-management`&&(r.responseSlots=Object.keys(e.getAvailableResponseValueSlots())),r}function sL(e,t={}){let n=t.purpose??`generic`,r=one[n],i=t.scope??r.scope,a=rL[i],o=Math.max(1,t.outlineLimit??a),s=t.includeRawSurvey??r.includeRawSurvey,c=t.includeIndexes??r.includeIndexes,l=t.includeFocusItemTree??r.includeFocusItemTree,u=t.focusItemId,d=!!(u&&e.surveyItems.has(u)),f=cne(e),p=lne(e,f),m=une(e,f,p),h=m;if(i===`tiny`&&u&&d){let t=aL(e,u);h=m.filter(e=>t.has(e.itemId))}else if(i===`focused`&&u&&d){let t=dne(e,u);h=m.filter(e=>t.has(e.itemId))}let g=h.length>o,_=g?h.slice(0,o):h,v=!1,y;if(l&&u&&d){let n=gne(e,u,p,{treeLimit:Math.max(1,t.focusItemTreeLimit??rne),snippetsPerItem:Math.max(1,t.translationSnippetsPerItemLimit??ine),snippetTextLimit:Math.max(1,t.translationSnippetTextLimit??ane)});v=n.truncated,y=n.focusItem}return{purpose:n,scope:i,surveyKey:e.surveyKey,locales:[...e.locales],itemCount:e.surveyItems.size,outline:_,focus:u?fne(e,u):void 0,focusItem:y,indexes:c?_ne(e,m,n):void 0,flags:{outlineTruncated:g,rawSurveyIncluded:s,focusItemTreeTruncated:v},rawSurvey:s?e.serialize():void 0}}var cL=class e{survey;constructor(e){this.survey=e}copyItem(e){if(!this.survey.surveyItems.get(e))throw Error(`Item with id '${e}' not found`);let t=this.collectItemsForCopy(e),n=t.map(e=>{let t=this.survey.surveyItems.get(e);if(!t)throw Error(`Item with id '${e}' not found during copy`);return{itemId:e,itemData:t.rawItem}}),r={};return t.forEach(e=>{try{let t=this.survey.getItemTranslations(e);if(t?.locales?.length){let n={};t.locales.forEach(e=>{let r=t.getAllForLocale(e);r&&(n[e]=r)}),r[e]=n}else r[e]={}}catch{r[e]={}}}),{type:`survey-item`,version:`1.0.0`,items:n,translations:r,rootItemId:e,timestamp:Date.now()}}collectItemsForCopy(e){let t=[e],n=this.survey.surveyItems.get(e);if(!n)return[];if(n instanceof Se){let e=n.items;e.length>0&&e.forEach(e=>{let n=this.collectItemsForCopy(e);t.push(...n)})}return t}addItemToParentGroup(e,t){let n=this.survey.surveyItems.get(e.parentId);if(!n)throw Error(`Parent item with id '${e.parentId}' not found`);if(!(n instanceof Se))throw Error(`Parent item '${e.parentId}' is not a group item`);let r=n.items.map(e=>this.survey.surveyItems.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.key)),a=t.key;if(i.has(a)){let e=1,n=t.key;for(;i.has(a);)a=n+`_${e}`,e++;if(a!==t.key){let e={...t.rawItem,key:a},n=this.survey.createItemFromRaw(e);this.survey.surveyItems.delete(t.id),this.survey.surveyItems.set(n.id,n),t=n}}let o=e.index===void 0?n.items.length:Math.min(e.index,n.items.length);n.addChild(t.id,o)}pasteItem(t,n){if(!e.isValidClipboardData(t))throw Error(`Invalid clipboard data format`);let r={};t.items.forEach(({itemId:e})=>{r[e]=b()}),t.items.forEach(({itemId:e,itemData:i})=>{let a=r[e];if(a){let o=this.updateItemIdsInData(i,r);o.id=a;let s=this.survey.createItemFromRaw(o);this.survey.surveyItems.set(s.id,s),e===t.rootItemId&&this.addItemToParentGroup(n,s)}});let i=this.updateTranslations(t.translations,r);return Object.keys(i).forEach(e=>{let t=new Ae,n=i[e];Object.keys(n).forEach(e=>{t.setAllForLocale(e,n[e])}),this.survey.translations.setItemTranslations(e,t)}),r[t.rootItemId]}updateItemIdsInData(e,t){let n=JSON.parse(JSON.stringify(e));if(n.itemType===`group`&&n.config){let e=n.config;e.items&&=e.items.map(e=>t[e]??e)}return this.updateExpressionsInItemData(n,t),n}updateExpressionsInItemData(e,t){e.displayConditions?.root&&this.updateExpressionReferences(e.displayConditions.root,t),e.displayConditions?.components&&Object.values(e.displayConditions.components).forEach(e=>{e&&this.updateExpressionReferences(e,t)}),e.disabledConditions?.components&&Object.values(e.disabledConditions.components).forEach(e=>{e&&this.updateExpressionReferences(e,t)}),e.validations&&Object.values(e.validations).forEach(e=>{e&&this.updateExpressionReferences(e,t)}),e.prefills&&e.prefills.forEach(e=>{e.when&&this.updateExpressionReferences(e.when,t),e.source.type===`expression`&&this.updateExpressionReferences(e.source.expression,t),e.source.type===`previousResponse`&&(e.source.ref.itemId=t[e.source.ref.itemId]??e.source.ref.itemId)})}updateExpressionReferences(e,t){if(!e||typeof e!=`object`)return;let n=e;Array.isArray(n.data)&&n.data.forEach(e=>{if(e&&typeof e==`object`&&e&&`str`in e){let n=e;typeof n.str==`string`&&Object.prototype.hasOwnProperty.call(t,n.str)&&(n.str=t[n.str]),this.updateExpressionReferences(e,t)}}),Object.keys(n).forEach(e=>{let r=n[e];r&&typeof r==`object`&&this.updateExpressionReferences(r,t)})}updateTranslations(e,t){let n={};return Object.keys(e).forEach(r=>{let i=e[r],a=t[r];n[a]=i}),n}static isValidClipboardData(e){if(typeof e!=`object`||!e||e===void 0)return!1;let t=e;return t.type===`survey-item`&&t.version===`1.0.0`&&t.rootItemId!==void 0}},lL={USER:`user`,SYSTEM:`system`},uL=class{static encoder=new TextEncoder;static calculateSize(e){let t=JSON.stringify(e);return this.encoder.encode(t).length}static formatBytes(e){let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`}};function dL(e){if(!(!e||Object.keys(e).length===0))return v(e)}function vne(e){return`kind`in e?e.kind===`survey-snapshot`?{kind:`survey-snapshot`,survey:v(e.survey),timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize}:{kind:`asset-change`,changes:v(e.changes),timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize}:{kind:`survey-snapshot`,survey:v(e.survey),timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize}}var fL=class e{history=[];currentIndex=-1;_config;_initialAssets;constructor(e,t={},n={label:`Initial state`,source:lL.SYSTEM},r){this._config={maxTotalMemoryMB:50,minHistorySize:10,maxHistorySize:200,...t},this._initialAssets=dL(r),this.saveSnapshot(e,n)}saveEntry(e){let t=e.kind===`survey-snapshot`?{kind:e.kind,survey:e.survey}:{kind:e.kind,changes:e.changes},n=uL.calculateSize(t);this.history=this.history.slice(0,this.currentIndex+1),this.history.push({...v(e),timestamp:Date.now(),memorySize:n}),this.currentIndex++,this.cleanupHistory()}saveSnapshot(e,t){this.saveEntry({kind:`survey-snapshot`,survey:v(e),meta:t})}getBaseAssetsSize(){return this._initialAssets?uL.calculateSize(this._initialAssets):0}cleanupHistory(){let e=this._config.maxTotalMemoryMB*1024*1024;for(;this.history.length>this._config.minHistorySize&&(this.getTotalMemoryUsage()>e||this.history.length>this._config.maxHistorySize)&&!(this.dropOldestState()<=0););}dropOldestState(){if(this.history.length<=1)return 0;let e=this.getStateAtIndex(1),t=this.getAssetsAtIndex(1),n=this.history[1],r={kind:`survey-snapshot`,survey:e,meta:n.meta,timestamp:n.timestamp,memorySize:uL.calculateSize({kind:`survey-snapshot`,survey:e})},i=this.history[0].memorySize;return this._initialAssets=dL(t),this.history=[r,...this.history.slice(2)],this.currentIndex--,i}getTotalMemoryUsage(){return this.getBaseAssetsSize()+this.history.reduce((e,t)=>e+t.memorySize,0)}getStateAtIndex(e){if(e<0||e>=this.history.length)throw Error(`Invalid history state`);for(let t=e;t>=0;t--){let e=this.history[t];if(e.kind===`survey-snapshot`)return v(e.survey)}throw Error(`Invalid history state`)}applyAssetPatch(e,t){let n=v(e);return t.next?n[t.assetId]=v(t.next):delete n[t.assetId],n}getAssetsAtIndex(e){if(e<0||e>=this.history.length)throw Error(`Invalid history state`);let t=dL(this._initialAssets)??{};for(let n=1;n<=e;n++){let e=this.history[n];if(e.kind===`asset-change`)for(let n of e.changes)t=this.applyAssetPatch(t,n)}return Object.keys(t).length>0?t:void 0}commit(e,t){this.saveSnapshot(e,t)}commitAssetChange(e,t){e.length!==0&&this.saveEntry({kind:`asset-change`,changes:v(e),meta:t})}getCurrentState(){if(this.currentIndex<0||this.currentIndex>=this.history.length)throw Error(`Invalid history state`);return this.getStateAtIndex(this.currentIndex)}getCurrentAssets(){if(this.currentIndex<0||this.currentIndex>=this.history.length)throw Error(`Invalid history state`);return this.getAssetsAtIndex(this.currentIndex)}undo(){return this.canUndo()?(this.currentIndex--,this.getCurrentState()):null}redo(){return this.canRedo()?(this.currentIndex++,this.getCurrentState()):null}canUndo(){return this.currentIndex>0}canRedo(){return this.currentIndex<this.history.length-1}getUndoMeta(){return this.canUndo()?this.history[this.currentIndex].meta:null}getRedoMeta(){return this.canRedo()?this.history[this.currentIndex+1].meta:null}getMemoryUsage(){return{totalMB:this.getTotalMemoryUsage()/(1024*1024),entries:this.history.length}}getConfig(){return{...this._config}}getHistory(){return this.history.map((e,t)=>({index:t,kind:e.kind,meta:e.meta,timestamp:e.timestamp,memorySize:e.memorySize,isCurrent:t===this.currentIndex}))}getCurrentIndex(){return this.currentIndex}getHistoryLength(){return this.history.length}jumpToIndex(e){return e<0||e>=this.history.length||e===this.currentIndex?null:(this.currentIndex=e,this.getCurrentState())}canJumpToIndex(e){return e>=0&&e<this.history.length&&e!==this.currentIndex}serialize(){return{history:this.history.map(e=>e.kind===`survey-snapshot`?{kind:`survey-snapshot`,survey:e.survey,timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize}:{kind:`asset-change`,changes:e.changes,timestamp:e.timestamp,meta:e.meta,memorySize:e.memorySize}),currentIndex:this.currentIndex,config:{...this._config},initialAssets:dL(this._initialAssets)}}static deserialize(t,n){if(!t.history||!Array.isArray(t.history)||t.history.length===0)throw Error(`Invalid object: history must be an array and must not be empty`);if(typeof t.currentIndex!=`number`||t.currentIndex<0||t.currentIndex>=t.history.length)throw Error(`Invalid object: currentIndex must be a valid index within the history array`);if(!t.config)throw Error(`Invalid object: config is required`);let r=t.history.map(vne),i=r[0],a=new e(i.kind===`survey-snapshot`?i.survey:(()=>{throw Error(`Invalid object: first history entry must resolve to a survey snapshot`)})(),t.config,i.meta,n??t.initialAssets);return a.history=r,a.currentIndex=t.currentIndex,a._initialAssets=dL(n??t.initialAssets),a}};function pL(e){let t=v(e);return delete t.assets,t}function yne(e,t){let n=v(e);return t&&Object.keys(t).length>0?n.assets=v(t):delete n.assets,n}var mL=class e{_survey;_undoRedo;_hasUncommittedChanges=!1;_pluginRegistry;constructor(e,t={},n){this._survey=e;let{pluginRegistry:r,...i}=t;this._pluginRegistry=r;let a=e.serialize();this._undoRedo=new fL(pL(a),i,n,a.assets)}get survey(){let e=this._survey.serialize(),t=this._pluginRegistry??this._survey.getPluginRegistry();return We.fromJson(e,t)}get hasUncommittedChanges(){return this._hasUncommittedChanges}get undoRedo(){return this._undoRedo}commit(e){this._hasUncommittedChanges&&=(this._undoRedo.commit(pL(this._survey.serialize()),e),!1)}restoreHistoryState(e,t){this._survey=We.fromJson(yne(e,t),this._pluginRegistry)}commitIfNeeded(){this._hasUncommittedChanges&&this.commit({label:`Latest content changes`,source:lL.SYSTEM})}undo(){if(this._hasUncommittedChanges)return this.restoreHistoryState(this._undoRedo.getCurrentState(),this._undoRedo.getCurrentAssets()),this._hasUncommittedChanges=!1,!0;{let e=this._undoRedo.undo();return e?(this.restoreHistoryState(e,this._undoRedo.getCurrentAssets()),this._hasUncommittedChanges=!1,!0):!1}}redo(){if(this._hasUncommittedChanges)return!1;let e=this._undoRedo.redo();return e?(this.restoreHistoryState(e,this._undoRedo.getCurrentAssets()),this._hasUncommittedChanges=!1,!0):!1}jumpToIndex(e){if(this._hasUncommittedChanges)return!1;let t=this._undoRedo.jumpToIndex(e);return t?(this.restoreHistoryState(t,this._undoRedo.getCurrentAssets()),this._hasUncommittedChanges=!1,!0):!1}canUndo(){return this._hasUncommittedChanges||this._undoRedo.canUndo()}canRedo(){return!this._hasUncommittedChanges&&this._undoRedo.canRedo()}getUndoMeta(){return this._hasUncommittedChanges?{label:`Latest content changes`,source:lL.SYSTEM}:this._undoRedo.getUndoMeta()}getRedoMeta(){return this._hasUncommittedChanges?null:this._undoRedo.getRedoMeta()}getMemoryUsage(){return this._undoRedo.getMemoryUsage()}getUndoRedoConfig(){return this._undoRedo.getConfig()}toJson(){return{version:`1.0.0`,survey:this._survey.serialize(),undoRedo:this._undoRedo.serialize(),hasUncommittedChanges:this._hasUncommittedChanges}}static fromJson(t,n){if(!t.survey)throw Error(`Invalid object: survey is required`);if(!t.undoRedo)throw Error(`Invalid object: undoRedo is required`);if(typeof t.hasUncommittedChanges!=`boolean`)throw Error(`Invalid object: hasUncommittedChanges must be a boolean`);t.version&&!t.version.startsWith(`1.`)&&console.warn(`Warning: Loading SurveyEditor with version ${t.version}, current version is 1.0.0`);let r=new e(We.fromJson(t.survey,n),{pluginRegistry:n});return r._undoRedo=fL.deserialize({...t.undoRedo,history:t.undoRedo.history.map(e=>`survey`in e?{...e,survey:pL(e.survey)}:e)},t.survey.assets),r._hasUncommittedChanges=JSON.stringify(pL(t.survey))!==JSON.stringify(r._undoRedo.getCurrentState()),r}markAsModified(){this._hasUncommittedChanges=!0}addItem(e,t,n){this.markAsModified();let r;if(e){let t=this._survey.surveyItems.get(e.parentId);if(!t)throw Error(`Parent item with id '${e.parentId}' not found`);if(!(t instanceof Se))throw Error(`Parent item '${e.parentId}' is not a group item (${t.type})`);r=t}else{let e=this._survey.rootItem;if(!e)throw Error(`No root group found in survey`);if(!(e instanceof Se))throw Error(`Root item is not a group item`);r=e}if(r.hasChild(t.id))throw Error(`Item ${t.id} already in this group`);let i=Array.from(this._survey.surveyItems.values()).filter(e=>r.items?.includes(e.id)),a=1;for(;i.some(e=>e.key===t.key);)t.key+=`_${a}`,a++;let o;o=e?.index===void 0?r.items.length:Math.min(e.index,r.items.length),this._survey.surveyItems.set(t.id,t),r.addChild(t.id,o),n&&this._survey.translations.setItemTranslations(t.id,n)}removeItem(e,t=!1){this.markAsModified();let n=this._survey.surveyItems.get(e);if(!n)return!1;let r=this._survey.getParentItem(e);if(!r)throw Error(`Item with id '${e}' is the root item`);if(n instanceof Se)for(let e of n.getChildrenIds())this.removeItem(e,!0);return this._survey.surveyItems.delete(e),this._survey.translations?.onItemDeleted(e),t||r.removeChild(e),!0}moveItem(e,t){this.markAsModified();let n=this._survey.surveyItems.get(e);if(!n)throw Error(`Item with id '${e}' not found`);let r=this._survey.surveyItems.get(t.parentId);if(!r)throw Error(`Target parent with id '${t.parentId}' not found`);if(!(r instanceof Se))throw Error(`Target parent '${t.parentId}' is not a group item (${r.type})`);if(this._survey.isDescendantOf(t.parentId,e))throw Error(`Cannot move item '${e}' to its descendant '${t.parentId}'`);let i=this._survey.getParentItem(e);if(i?.id===t.parentId)throw Error(`Item '${e}' is already in the target parent '${t.parentId}'`);i&&i.removeChild(e);let a=r,o=Array.from(this._survey.surveyItems.values()).filter(e=>a.hasChild(e.id)),s=1;for(;o.some(e=>e.key===n.key);)n.key+=`_${s}`,s++;let c=t.index===void 0?a.items.length:Math.min(t.index,a.items.length);return a.items.splice(c,0,e),!0}getItemDataCopy(e){let t=this._survey.surveyItems.get(e);if(!t)throw Error(`Item with id '${e}' not found`);return JSON.parse(JSON.stringify(t.rawItem))}updateItem(e,t){let n=this._survey.surveyItems.get(e);if(!n)throw Error(`Item with id '${e}' not found`);if(`id`in t&&t.id!==void 0&&t.id!==e)throw Error(`Cannot change item id from '${e}' to '${t.id}'`);let r={...n.rawItem,...t,id:e},i=r.key??n.key,a=this._survey.getParentItem(e);if(a){let t=(a.items??[]).filter(t=>t!==e).map(e=>this._survey.surveyItems.get(e)).find(e=>e!==void 0&&e.key===i);if(t)throw Error(`Key '${i}' is already in use by sibling item '${t.id}'`)}let o=this._survey.createItemFromRaw(r);this._survey.surveyItems.set(e,o),this.markAsModified()}updateItemTranslations(e,t){return this._survey.surveyItems.get(e)?(this.markAsModified(),this._survey.translations.setItemTranslations(e,t),!0):!1}updateSurveyTranslations(e){this.markAsModified(),e.surveyCard&&this._survey.translations.setSurveyCardContent(e.surveyCard.locale,e.surveyCard.content),e.navigation&&this._survey.translations.setNavigationContent(e.navigation.locale,e.navigation.content),e.validationMessages&&this._survey.translations.setValidationMessages(e.validationMessages.locale,e.validationMessages.content)}getMaxItemsPerPage(){let e=this._survey.maxItemsPerPage;return e?{...e}:void 0}updateMaxItemsPerPage(e){this.markAsModified(),this._survey.maxItemsPerPage=e?{...e}:void 0}getMetadata(){let e=this._survey.metadata;return e?{...e}:void 0}updateMetadata(e){this.markAsModified(),this._survey.metadata=e?{...e}:void 0}getTemplateValue(e){let t=this._survey.getTemplateValue(e);return t?v(t):void 0}getTemplateValues(){let e=this._survey.getTemplateValueKeys(),t=new Map;for(let n of e){let e=this._survey.getTemplateValue(n);e&&t.set(n,v(e))}return t}setTemplateValue(e,t){this.markAsModified(),this._survey.setTemplateValue(e,v(t))}removeTemplateValue(e){this.markAsModified(),this._survey.deleteTemplateValue(e)}getAsset(e){let t=this._survey.getAsset(e);return t?v(t):void 0}getAssets(){return this._survey.getAssets()}setAsset(e,t){let n=this._survey.getAsset(e);this._survey.setAsset(e,v(t)),this._undoRedo.commitAssetChange([{assetId:e,prev:n,next:v(t)}],{label:`Update asset: ${e}`,source:lL.USER})}removeAsset(e){let t=this._survey.getAsset(e);t&&(this._survey.deleteAsset(e),this._undoRedo.commitAssetChange([{assetId:e,prev:t}],{label:`Remove asset: ${e}`,source:lL.USER}))}copyItem(e){return new cL(this._survey).copyItem(e)}pasteItem(e,t){return this.markAsModified(),new cL(this._survey).pasteItem(e,t)}};function hL({className:e,...t}){return(0,p.jsx)(`kbd`,{"data-slot":`kbd`,className:V(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function gL({className:e,...t}){return(0,p.jsx)(`kbd`,{"data-slot":`kbd-group`,className:V(`inline-flex items-center gap-1`,e),...t})}var _L=e=>{let t=e;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t?.isContentEditable===!0||t?.closest(`[contenteditable="true"]`)!==null},bne=e=>{let t=e instanceof HTMLElement?e.closest(`[data-group-list-target]`):null;if(!t)return null;let n=t.dataset.groupListTarget;return n===`add`?{kind:`add`}:n===`item`&&t.dataset.groupListItemId?{kind:`item`,itemId:t.dataset.groupListItemId}:null},xne=(e,t)=>e.kind===t.kind&&(e.kind!==`item`||t.kind!==`item`||e.itemId===t.itemId),Sne=e=>[...e.map(e=>({kind:`item`,itemId:e})),{kind:`add`}],Cne=e=>{switch(e.kind){case`add`:return`[data-group-list-target="add"]`;case`item`:return`[data-group-list-target="item"][data-group-list-item-id="${CSS.escape(e.itemId)}"]`}},vL=(e,t)=>{e.querySelector(Cne(t))?.focus()},wne=(e,t)=>e&&t.includes(e)?{kind:`item`,itemId:e}:t.length>0?{kind:`item`,itemId:t[0]}:{kind:`add`},Tne=e=>{e instanceof HTMLElement&&e.closest(`[data-group-list-target]`)?.click()},Ene=({addItemDialogOpen:e,containerRef:t,groupId:n,itemIds:r,clipboardValue:i,previewItemId:a,openAddDialogForCurrentGroup:o,openFocusedItem:s,selectPreviewItem:c,moveItemByOffset:l,parseSurveyItemClipboard:d,pasteItemFromClipboardData:f,onPasteCommitted:p,copyItemToClipboard:m})=>{let h=G(`groupItems`),g=(0,u.useCallback)(()=>{n&&(async()=>{let e=i;try{e=await navigator.clipboard.readText()}catch{}let t=d(e);if(t)try{p(f(t,n))}catch(e){console.error(`Error pasting item:`,e),OC.error(h(`pasteFailed`))}})()},[i,n,p,d,f,h]),_=(0,u.useCallback)(()=>{if(!a){OC.info(h(`selectItemToCopy`));return}m(a)},[m,a,h]),v=(0,u.useCallback)((e,t,n)=>{let i=n??wne(a,r);if(n||vL(t,i),e===`ArrowUp`||e===`ArrowDown`){let n=Sne(r),a=n.findIndex(e=>xne(e,i));if(a<0||n.length<1)return;vL(t,n[(a+(e===`ArrowUp`?-1:1)+n.length)%n.length]);return}i.kind===`item`&&l(i.itemId,e===`ArrowLeft`?-1:1)&&requestAnimationFrame(()=>{vL(t,i)})},[r,l,a]),y=(0,u.useCallback)(e=>({"data-group-list-target":`item`,"data-group-list-item-id":e,onFocus:()=>{c(e)}}),[c]),b=(0,u.useCallback)(()=>({"data-group-list-target":`add`}),[]),x=(0,u.useCallback)(t=>{if(e||_L(t.target))return;let n=t.currentTarget,r=bne(t.target);if(t.metaKey||t.ctrlKey)switch(t.key.toLowerCase()){case`enter`:t.preventDefault(),o();return;case`v`:t.preventDefault(),g();return;case`c`:t.preventDefault(),_();return;default:return}if(r)switch(t.key){case`ArrowUp`:case`ArrowDown`:t.preventDefault(),v(t.key,n,r);return;case`ArrowLeft`:case`ArrowRight`:t.preventDefault(),v(t.key,n,r);return;case`Enter`:case` `:if(t.preventDefault(),r.kind===`item`){s(r.itemId);return}Tne(t.target);return;default:return}},[e,v,_,g,o,s]),S=(0,u.useEffectEvent)(n=>{let r=t.current;if(!(!r||e||_L(n.target)||r.contains(n.target))){if(n.metaKey||n.ctrlKey)switch(n.key.toLowerCase()){case`enter`:n.preventDefault(),o();return;case`c`:n.preventDefault(),_();return;case`v`:n.preventDefault(),g();return;default:return}switch(n.key){case`ArrowUp`:case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:n.preventDefault(),v(n.key,r,null);return;default:return}}});return(0,u.useEffect)(()=>(document.addEventListener(`keydown`,S),()=>{document.removeEventListener(`keydown`,S)}),[]),{getItemButtonProps:y,getAddButtonProps:b,onListKeyDown:x}},Dne=()=>(0,p.jsxs)(`svg`,{viewBox:`0 0 220 180`,className:`text-slate-400 h-24 w-36`,fill:`none`,"aria-hidden":`true`,children:[(0,p.jsx)(`rect`,{x:`48`,y:`16`,width:`124`,height:`148`,rx:`14`,fill:`currentColor`,fillOpacity:`0.12`,stroke:`currentColor`,strokeWidth:`3`}),(0,p.jsx)(`rect`,{x:`76`,y:`7`,width:`68`,height:`14`,rx:`10`,fill:`#94A3B8`}),(0,p.jsx)(`rect`,{x:`65`,y:`52`,width:`72`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.2`}),(0,p.jsx)(`rect`,{x:`65`,y:`72`,width:`94`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.16`}),(0,p.jsx)(`rect`,{x:`65`,y:`92`,width:`66`,height:`10`,rx:`5`,fill:`currentColor`,fillOpacity:`0.18`})]}),yL=({children:e})=>{let t=G(`groupItems`);return(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:e}),(0,p.jsxs)(nw,{align:`center`,side:`bottom`,className:`flex gap-1 flex-col`,children:[(0,p.jsx)(`span`,{className:`text-nowrap`,children:t(`addNewItemToGroup`)}),(0,p.jsxs)(gL,{children:[(0,p.jsx)(hL,{children:`Cmd+Enter`}),(0,p.jsx)(hL,{children:`Ctrl+Enter`})]})]})]})},One=({groupId:e,itemID:t,index:n,itemIdForPreview:r,commonActionsT:i,copyItemToClipboard:a,editorItemRegistry:o,getItemButtonProps:s,navigateToItem:c,setPreferredPreviewItemId:l,survey:u,t:d})=>{let{ref:f,isDragging:m}=TI({id:t,index:n,group:e}),h=u.surveyItems.get(t);if(!h)return null;let g={typeInfos:NI(h,o),color:AI(h)};return(0,p.jsx)(`li`,{ref:f,className:V(`group list-none touch-none`,m&&`bg-muted/60 backdrop-blur-xs`),tabIndex:-1,children:(0,p.jsxs)(RI,{children:[(0,p.jsx)(zI,{asChild:!0,children:(0,p.jsxs)(`div`,{tabIndex:0,className:V(`relative flex h-auto w-full items-center gap-2 px-3 py-2 text-start`,`hover:bg-muted backdrop-blur-xl transition-colors border rounded-lg`,g.typeInfos.defaultItemClassName,{"font-bold ring-4 ring-ring/50":h.id===r}),style:{color:g.color,borderColor:g.color},onClick:()=>{l(h.id)},onDoubleClick:()=>{l(null),c(h.id)},...s(h.id),children:[(0,p.jsx)(`span`,{className:`absolute -left-4 top-0 hidden h-full items-center group-hover:flex`,children:(0,p.jsx)(FS,{className:`size-4 text-muted-foreground`})}),(0,p.jsx)(`div`,{children:(0,p.jsx)(g.typeInfos.icon,{className:`size-4`})}),(0,p.jsxs)(`span`,{className:`grow space-x-2`,children:[(0,p.jsx)(`span`,{className:`font-mono text-sm`,style:{borderColor:g.color},children:h.type===ve.PageBreak?d(`pageBreak`):u.getItemKey(h.id)?.itemKey??h.id}),(0,p.jsx)(`span`,{className:`font-semibold italic`,children:h.metadata?.itemLabel})]})]})}),(0,p.jsxs)(VI,{className:`border-border`,children:[(0,p.jsx)(HI,{onClick:()=>{l(null),c(h.id)},children:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(WS,{className:`size-4`}),(0,p.jsx)(`span`,{className:`ml-2`,children:i(`open`)})]})}),(0,p.jsxs)(HI,{onClick:()=>{a(h.id)},children:[(0,p.jsx)(dte,{className:`size-4`}),(0,p.jsx)(`span`,{className:`ml-2`,children:i(`copy`)})]}),(0,p.jsx)(GI,{}),(0,p.jsx)(YI,{itemId:h.id}),(0,p.jsx)(GI,{}),(0,p.jsx)($I,{itemId:h.id})]})]})})},bL=()=>{let e=G(`groupItems`),t=G(`common.actions`),n=G(`copyItem`),r=G(`history`),i=W(e=>e.copyItem),a=W(e=>e.editorItemRegistry),o=W(e=>e.updateItem),s=W(e=>e.commitByUser),c=W(e=>e.pasteItem),{selectedItemId:l,navigateToItem:d}=Ow(),f=Cw(),{addItemDialogOpen:m,openAddItemDialog:h,preferredPreviewItemId:g,setPreferredPreviewItemId:_}=nL(),[v,y]=vC(),b=(0,u.useRef)(null),x=(0,u.useRef)(m),S=(0,u.useRef)(null),C=(0,u.useRef)(null),w=(0,u.useMemo)(()=>!f||l&&f.surveyItems.get(l)instanceof Se?l:f.rootItem?.id,[l,f]),T=(0,u.useMemo)(()=>{if(!f||!w)return null;let e=f.surveyItems.get(w);return e instanceof Se?e:null},[w,f]),E=(0,u.useCallback)(e=>{if(!e)return null;try{let t=JSON.parse(e);return cL.isValidClipboardData(t)?t:null}catch{return null}},[]),D=(0,u.useMemo)(()=>E(v),[v,E]),O=(0,u.useMemo)(()=>D?D.items.find(e=>e.itemId===D.rootItemId)?.itemData??null:null,[D]),ee=(0,u.useMemo)(()=>O?O.metadata?.itemLabel?`${O.key} - ${O.metadata.itemLabel}`:O.key||O.itemType:null,[O]),k=(0,u.useMemo)(()=>O?PI(O.itemType,a)?.label??O.itemType:null,[O,a]),A=(0,u.useCallback)(()=>{w&&h(w)},[w,h]),j=(0,u.useCallback)(e=>{try{let t=i(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)).then(()=>{y(),OC.success(n(`copied`))}).catch(()=>{OC.error(n(`failedToClipboard`))})}catch(e){console.error(`Error copying item:`,e),OC.error(n(`failed`))}},[i,n,y]),M=(0,u.useCallback)(e=>{f?.surveyItems.get(e)&&(_(null),d(e))},[d,_,f]),N=(0,u.useCallback)((e,t)=>{if(!T)return!1;let n=T.items.indexOf(e),i=n+t;return n<0||i<0||i>=T.items.length?!1:(T.swapItemsByIndex(n,i),o(T.id,T.rawItem),s({label:r(`moveItem`)}),_(e),!0)},[s,T,r,_,o]),P=(0,u.useMemo)(()=>{let e=T?.items??[];return e.length<1?null:g&&e.includes(g)?g:e[0]},[T?.items,g]);(0,u.useEffect)(()=>{y()},[y]),(0,u.useEffect)(()=>{let e=()=>{y()};return window.addEventListener(`focus`,e),()=>{window.removeEventListener(`focus`,e)}},[y]),(0,u.useEffect)(()=>{let e=b.current;if(b.current=w??null,!T||!e||e===T.id)return;let t=T.items??[];if(!(g&&t.includes(g))){if(t.includes(e)){_(e);return}g&&!t.includes(g)&&_(null)}},[w,T,g,_]),(0,u.useEffect)(()=>{let e=C.current,t=S.current;if(S.current=w??null,!e||m){x.current=m;return}let n=x.current&&!m,r=!e.contains(document.activeElement),i=t!==(w??null);if(x.current=m,!r&&!n&&!i)return;let a=P?`[data-group-list-target="item"][data-group-list-item-id="${CSS.escape(P)}"]`:`[data-group-list-target="add"]`,o=0,s=0;return o=window.requestAnimationFrame(()=>{s=window.requestAnimationFrame(()=>{e.querySelector(a)?.focus({preventScroll:!0})})}),()=>{window.cancelAnimationFrame(o),window.cancelAnimationFrame(s)}},[m,w,P]);let{getAddButtonProps:F,getItemButtonProps:I,onListKeyDown:te}=Ene({addItemDialogOpen:m,containerRef:C,groupId:w,itemIds:T?.items??[],clipboardValue:v,previewItemId:P,openAddDialogForCurrentGroup:A,openFocusedItem:M,selectPreviewItem:_,moveItemByOffset:N,parseSurveyItemClipboard:E,pasteItemFromClipboardData:(e,t)=>c(e,{parentId:t}),onPasteCommitted:t=>{s({label:r(`pasteItem`)}),_(t),y(),OC.success(e(`itemPasted`))},copyItemToClipboard:j});if(!T||!f)return(0,p.jsx)(`p`,{children:e(`loadingGroupItem`)});let ne=e=>{if(e.canceled||!PF(e.operation)||!e.operation.source)return;let{source:t}=e.operation,{initialIndex:n,index:i}=t;n!==i&&(T.moveItemToIndex(String(t.id),i),o(T.id,T.rawItem),s({label:r(`moveItem`)}))},re=(T.items?.length??0)<1,ie=ee?(0,p.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:[(0,p.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,p.jsx)(pte,{className:`size-3.5 text-foreground/70`}),(0,p.jsx)(`span`,{className:`font-semibold text-foreground`,children:e(`insert`)}),(0,p.jsx)(`span`,{children:ee}),k&&(0,p.jsxs)(`span`,{children:[`(`,k,`)`]})]}),(0,p.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,p.jsx)(`span`,{children:e(`press`)}),(0,p.jsx)(hL,{children:`Cmd+V`}),(0,p.jsx)(`span`,{children:e(`or`)}),(0,p.jsx)(hL,{children:`Ctrl+V`}),(0,p.jsx)(`span`,{children:e(`toInsert`)})]})]}):null;return(0,p.jsxs)(`div`,{className:`flex grow h-full min-h-0`,children:[(0,p.jsx)(`div`,{className:`flex-1 pt-2 px-4 pb-4 border-r border-border flex flex-col min-h-0`,children:(0,p.jsxs)(`div`,{className:`flex flex-col h-full min-h-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-start justify-between gap-2 shrink-0`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{children:(0,p.jsxs)(`h3`,{className:`font-semibold text-sm`,children:[e(`items`),(0,p.jsxs)(`span`,{className:`text-sm text-muted-foreground ml-2`,children:[`(`,T.items?.length??0,`)`]})]})}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`doubleClickHelp`)})]}),(0,p.jsx)(yL,{children:(0,p.jsx)(H,{variant:`ghost`,size:`icon`,className:`-mr-2`,onClick:A,children:(0,p.jsx)(KS,{className:`size-4`})})})]}),(0,p.jsxs)(`div`,{ref:C,className:`flex-1 min-h-0 overflow-y-auto -mx-4 px-4 space-y-4 py-4`,onKeyDown:te,children:[re?(0,p.jsxs)(`div`,{className:`flex flex-col items-center text-center border border-dashed border-border rounded-lg p-8`,children:[(0,p.jsx)(Dne,{}),(0,p.jsx)(`h4`,{className:`mt-5 text-base font-semibold text-muted-foreground`,children:e(`noItemsYet`)}),(0,p.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs text-muted-foreground text-balance mb-4`,children:e(`emptyDescription`)}),(0,p.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-2`,children:[ie,(0,p.jsx)(yL,{children:(0,p.jsxs)(H,{variant:`default`,className:`border-dashed w-full`,onClick:A,...F(),children:[(0,p.jsx)(KS,{className:`size-4`}),e(`addItem`)]})})]})]}):(0,p.jsx)(PP,{sensors:[KN.configure({activationConstraints:[new HN.Distance({value:5})]})],onDragEnd:ne,children:(0,p.jsx)(`ol`,{className:`space-y-1.5`,children:T.items.map((n,r)=>(0,p.jsx)(One,{groupId:T.id,itemID:n,index:r,itemIdForPreview:P,commonActionsT:t,copyItemToClipboard:j,editorItemRegistry:a,getItemButtonProps:I,navigateToItem:d,setPreferredPreviewItemId:_,survey:f,t:e},n))})}),!re&&(0,p.jsx)(`div`,{className:`flex justify-center`,children:(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[ie,(0,p.jsx)(yL,{children:(0,p.jsxs)(H,{variant:`outline`,className:`border-dashed w-full`,onClick:A,...F(),children:[(0,p.jsx)(KS,{className:`size-4`}),e(`addItem`)]})})]})})]})]})}),(0,p.jsx)(`div`,{className:`flex-1 pt-2 px-4 pb-4 flex-col min-h-0 bg-muted/30 hidden @2xl/main:flex`,children:(0,p.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,p.jsx)(u.Suspense,{children:(0,p.jsx)(QI,{item:P?f.surveyItems.get(P):void 0,mode:`static`},P)})})})]})};function xL({...e}){return(0,p.jsx)(Do,{"data-slot":`dialog`,...e})}function kne({...e}){return(0,p.jsx)(Oo,{"data-slot":`dialog-trigger`,...e})}function Ane({...e}){return(0,p.jsx)(ko,{"data-slot":`dialog-portal`,...e})}function jne({className:e,...t}){return(0,p.jsx)(Ao,{"data-slot":`dialog-overlay`,className:V(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,e),...t})}function SL({className:e,children:t,showCloseButton:n=!0,closeLabel:r=`Close`,...i}){return(0,p.jsxs)(Ane,{children:[(0,p.jsx)(jne,{}),(0,p.jsxs)(jo,{"data-slot":`dialog-content`,className:V(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,e),...i,children:[t,n&&(0,p.jsx)(Po,{"data-slot":`dialog-close`,asChild:!0,children:(0,p.jsxs)(H,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,"aria-label":r,children:[(0,p.jsx)(rC,{}),(0,p.jsx)(`span`,{className:`sr-only`,children:r})]})})]})]})}function CL({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`dialog-header`,className:V(`gap-2 flex flex-col`,e),...t})}function wL({className:e,showCloseButton:t=!1,closeLabel:n=`Close`,children:r,...i}){return(0,p.jsxs)(`div`,{"data-slot":`dialog-footer`,className:V(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...i,children:[r,t&&(0,p.jsx)(Po,{asChild:!0,children:(0,p.jsx)(H,{variant:`outline`,children:n})})]})}function TL({className:e,...t}){return(0,p.jsx)(Mo,{"data-slot":`dialog-title`,className:V(`text-base leading-none font-medium`,e),...t})}function EL({className:e,...t}){return(0,p.jsx)(No,{"data-slot":`dialog-description`,className:V(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,e),...t})}var Mne=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return e.isContentEditable||t===`input`||t===`textarea`||t===`select`},DL=(e,{enabled:t=!0,ignoreEditableTargets:n=!0}={})=>{let r=(0,u.useEffectEvent)(e);(0,u.useEffect)(()=>{if(!t)return;let e=e=>{n&&Mne(e.target)||r(e)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n])},Nne=(e,t)=>e.key===t.key&&(t.modKey===void 0?!!e.metaKey==!!t.metaKey:!!(e.metaKey||e.ctrlKey)==!!t.modKey)&&(t.modKey===void 0?!!e.ctrlKey==!!t.ctrlKey:!0)&&!!e.shiftKey==!!t.shiftKey&&!!e.altKey==!!t.altKey,OL=(e,t,{enabled:n=!0,activeDurationMs:r=150,preventDefault:i=!0,ignoreEditableTargets:a=!0}={})=>{let[o,s]=(0,u.useState)(!1),c=(0,u.useRef)(null),l=()=>{let t=e.current;!n||!t||t.disabled||(c.current!==null&&window.clearTimeout(c.current),s(!0),c.current=window.setTimeout(()=>{c.current=null,e.current?.click(),s(!1)},r))};return DL(e=>{e.defaultPrevented||Nne(e,t)&&(i&&e.preventDefault(),l())},{enabled:n,ignoreEditableTargets:a}),(0,u.useEffect)(()=>()=>{c.current!==null&&window.clearTimeout(c.current)},[]),{isShortcutActive:o}},Pne=qn(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Fne({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,p.jsx)(n?Qn:`span`,{"data-slot":`badge`,"data-variant":t,className:V(Pne({variant:t}),e),...r})}var Ine=({value:e,label:t,icon:n,isActive:r,colorAccent:i,colorBorder:a,showShortcutNumber:o,shortcutNumber:s,hasIndicator:c,indicatorCount:l})=>{let u=G(`tabTrigger`),d={"--tab-accent":i,"--tab-accent-bg":`${i}10`,"--tab-accent-ring":`${i}30`,color:r?i:void 0};return(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsxs)(oC,{value:e,className:V(`group/tab relative flex-none rounded-none border-0 px-3 py-2 text-sm font-medium shadow-none after:hidden focus-visible:outline-none focus-visible:ring-0`,r?`text-foreground`:`text-muted-foreground/80 hover:bg-primary/10 hover:text-foreground focus-visible:bg-primary/10 focus-visible:text-foreground focus-visible:shadow-[inset_0_0_0_1px_var(--tab-accent-ring)]`),style:d,children:[(0,p.jsx)(n,{className:`size-3`,style:{color:r?i:void 0}}),(0,p.jsx)(`span`,{children:t}),c&&typeof l==`number`&&(0,p.jsx)(Fne,{variant:`outline`,className:`ms-1 rounded-full px-1.5 text-[11px]`,style:{borderColor:r?`${i}30`:a,color:r?i:void 0,backgroundColor:r?`${i}14`:`transparent`},children:l}),o&&(0,p.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-[3px] right-[3px] z-10 flex min-w-12 items-center justify-end rounded-[inherit] pl-6 pr-2`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 rounded-[inherit] bg-background/45 backdrop-blur-sm mask-[linear-gradient(to_right,transparent_0%,black_45%,black_100%)]`}),(0,p.jsx)(hL,{className:`relative z-10 h-5 min-w-5 rounded-[4px] border border-white/30 bg-background/80 px-1.5 text-[10px] text-foreground shadow-sm`,style:{borderColor:`${i}35`,color:i},children:s})]}),(0,p.jsx)(`div`,{className:V(`absolute bottom-0 left-3 right-3 h-[2px] rounded-full transition-opacity`,r?`opacity-100`:`opacity-0 group-focus-visible/tab:opacity-100`),style:{backgroundColor:i}})]})}),(0,p.jsx)(nw,{side:`bottom`,align:`center`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:u(`switchToThisView`)}),(0,p.jsxs)(gL,{children:[(0,p.jsx)(hL,{children:`V`}),(0,p.jsx)(`span`,{children:u(`then`)}),(0,p.jsx)(hL,{children:s})]})]})})]})},Lne=({armKey:e,enabled:t=!0,maxIndex:n=9,timeoutMs:r=1800,onSelectIndex:i})=>{let[a,o]=(0,u.useState)(!1),s=(0,u.useRef)(null),c=(0,u.useRef)(!1),l=()=>{c.current=!1,o(!1),s.current!==null&&(window.clearTimeout(s.current),s.current=null)},d=()=>{c.current=!0,o(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{s.current=null,c.current=!1,o(!1)},r)};return DL(t=>{if(t.defaultPrevented)return;let r=t.metaKey||t.ctrlKey||t.altKey||t.shiftKey,a=t.key.toLowerCase();if(!c.current){!r&&a===e.toLowerCase()&&(t.preventDefault(),d());return}if(a===`escape`){t.preventDefault(),l();return}if(r)return;let o=Number.parseInt(a,10);l(),!(Number.isNaN(o)||o<1||o>n)&&(t.preventDefault(),i(o-1))},{enabled:t}),(0,u.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]),{isArmed:a}};function kL({...e}){return(0,p.jsx)(Zp,{"data-slot":`popover`,...e})}function AL({...e}){return(0,p.jsx)($p,{"data-slot":`popover-trigger`,...e})}function jL({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,p.jsx)(em,{children:(0,p.jsx)(tm,{"data-slot":`popover-content`,align:t,sideOffset:n,className:V(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function ML({...e}){return(0,p.jsx)(Qp,{"data-slot":`popover-anchor`,...e})}function Rne({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`popover-header`,className:V(`flex flex-col gap-0.5 text-sm`,e),...t})}function zne({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`popover-title`,className:V(`font-medium`,e),...t})}function Bne({className:e,...t}){return(0,p.jsx)(`p`,{"data-slot":`popover-description`,className:V(`text-muted-foreground`,e),...t})}var NL=[[`updated`,`alt`,`v2`,`draft`],[`next`,`clean`,`refined`,`candidate`],[`final`,`review`,`copy`,`latest`]],PL=e=>e.trim().toLowerCase().replace(/[.\s]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``),FL=24,Vne=e=>{if(!e)return[];let t=[],n=e=>{for(let r of e.descendants){if(t.length>=FL)return;let e=[r.fullKey,r.itemLabel].filter(Boolean).join(` | `);e.length>0&&t.push(e);for(let e of r.translations){if(t.length>=FL)break;t.push(`${r.fullKey} | ${e.locale}.${e.contentKey}: ${e.text}`)}n(r)}};return n(e),t.slice(0,FL)},IL=({source:e,seed:t,isValid:n})=>{let r=PL(e||`item`);if(r.length===0)return[];let i=NL[t%NL.length],a=[...i.slice(t%i.length),...i.slice(0,t%i.length)],o=[`${r}_${a[0]}`,`${r}_${a[1]}`,`${r}_${a[2]}`,`${r}_${a[3]}`,`${r}_v${t+2}`,`new_${r}`].map(PL);return Array.from(new Set(o)).filter(n).slice(0,5)},Hne=e=>{let t=G(`common.actions`),n=G(`itemKeyEditor`),r=yw(),i=Cw(),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(e.currentItemKey?.itemKey??``),[l,d]=(0,u.useState)(!1),[f,m]=(0,u.useState)(0),[h,g]=(0,u.useState)([]),[_,v]=(0,u.useState)(!1),y=(0,u.useRef)(0),b=(0,u.useRef)(null),x=(0,u.useRef)(null),S=e.currentItemKey?.itemKey??``,{isShortcutActive:C}=OL(x,{key:`k`},{enabled:!0}),w=t=>t===S?n(`validation.sameAsCurrent`):e.siblingKeys.some(e=>e===t)?n(`validation.duplicate`):t.includes(`.`)?n(`validation.dot`):t.includes(` `)?n(`validation.space`):t.length===0?n(`validation.empty`):null,T=w(s),E=(e,t)=>{g(IL({source:e||S,seed:t,isValid:e=>w(e)===null}))},D=async(t,n)=>{let a=++y.current;b.current?.abort();let o=new AbortController;b.current=o,v(!0);try{let s=[];if(r?.suggestItemKey&&i){let n=sL(i,{purpose:`key-suggestion`,focusItemId:e.itemId}),c=Vne(n.focusItem),l=await r.suggestItemKey({draftKey:t,currentKey:S,siblingKeys:e.siblingKeys,childContentHints:c,maxSuggestions:5,context:n},{signal:o.signal,mode:`user`});if(a!==y.current)return;s=Array.from(new Set(l.suggestions.map(e=>PL(e.text)))).filter(e=>w(e)===null).slice(0,5)}if(s.length===0&&(s=IL({source:t||S,seed:n,isValid:e=>w(e)===null})),a!==y.current)return;g(s)}catch(e){if(e?.name===`AbortError`||a!==y.current)return;E(t,n)}finally{a===y.current&&v(!1),b.current===o&&(b.current=null)}},O=()=>{let t=s;if(t===S){o(!1);return}if(w(t)){d(!0);return}e.onChangeItemKey(t),o(!1)},ee=()=>{c(S),o(!1)};return(0,p.jsxs)(kL,{open:a,onOpenChange:e=>{if(o(e),e){c(S),d(!1),m(0),D(S,0);return}y.current+=1,b.current?.abort(),b.current=null,v(!1)},children:[(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(AL,{asChild:!0,children:(0,p.jsx)(H,{ref:x,variant:`outline`,size:`sm`,className:V(`bg-transparent transition-[background-color,box-shadow,color,transform] duration-150`,C&&`bg-muted text-foreground ring-2 ring-ring/40 scale-[0.98]`),children:(0,p.jsx)(`span`,{className:`block truncate font-mono text-xs leading-none text-foreground`,children:S||n(`noKey`)})})})}),(0,p.jsx)(nw,{side:`bottom`,align:`start`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:n(`editItemKey`)}),(0,p.jsx)(hL,{children:`K`})]})})]}),(0,p.jsxs)(jL,{className:`w-[min(36rem,calc(100vw-1rem))] overflow-hidden rounded-xl border-border p-0 shadow-xl`,side:`bottom`,align:`start`,children:[(0,p.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,p.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,p.jsx)(`h3`,{className:`text-sm font-semibold tracking-tight`,children:n(`title`)}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`description`)})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(ux,{htmlFor:`keyInput`,className:`text-xs font-medium text-muted-foreground`,children:n(`keyLabel`)}),(0,p.jsx)(lx,{id:`keyInput`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),O()):e.key===`Escape`&&(e.preventDefault(),ee())},placeholder:n(`placeholder`),autoFocus:!0,className:`h-8 rounded-lg border-border bg-muted/20 px-2.5 font-mono text-sm shadow-none`}),l&&T&&(0,p.jsx)(`p`,{className:`text-xs font-medium text-destructive`,children:T}),e.currentItemKey?.isRoot?(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`surveyRootItem`)}):(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`parentFullKey`,{parentFullKey:e.currentItemKey?.parentFullKey??``})})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`suggestions`)}),(0,p.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-1.5 text-xs`,disabled:_,onClick:()=>{let e=f+1;m(e),D(s,e)},children:[_?(0,p.jsx)(VS,{className:`size-3.5 animate-spin`}):(0,p.jsx)(jte,{className:`size-3.5`}),n(`regenerate`)]})]}),(0,p.jsx)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-1.5`,children:_?(0,p.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground`,children:[(0,p.jsx)(VS,{className:`size-3 animate-spin`}),n(`generatingSuggestions`)]}):h.length>0?h.map(e=>(0,p.jsx)(`button`,{type:`button`,className:V(`rounded-full border border-border bg-background px-2.5 py-1 font-mono text-xs transition-colors`,`hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,s===e&&`border-primary/60 bg-primary/10 text-foreground`),onClick:()=>{c(e),d(!1)},children:e},e)):(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`noValidSuggestions`)})})]})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t bg-muted/50 px-3 py-2 sm:px-4`,children:[(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:ee,children:t(`cancel`)}),(0,p.jsx)(H,{type:`button`,size:`sm`,onClick:O,disabled:T!==null,children:t(`save`)})]})]})]})},Une=3,Wne=400,Gne=3,Kne=e=>{let t=G(`aiInput`),{value:n,onChange:r,placeholder:i,suggestionsAdapter:a=null}=e,[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!1),[d,f]=(0,u.useState)(!1),[m,h]=(0,u.useState)(0),g=(0,u.useRef)(null),_=(0,u.useRef)(null),v=(0,u.useRef)(void 0),y=(0,u.useRef)(0),b=(0,u.useRef)(null),x=(0,u.useRef)(!1),S=(0,u.useRef)(!1),C=a!==null,w=(0,u.useCallback)(()=>{v.current&&=(clearTimeout(v.current),void 0)},[]),T=(0,u.useCallback)(()=>{y.current+=1,b.current?.abort(),b.current=null},[]),E=(0,u.useCallback)(()=>{w(),T(),s([]),l(!1),f(!1),h(0)},[T,w]),D=(0,u.useCallback)(async(t,n)=>{if(!a){E();return}T();let r=y.current,i=new AbortController;b.current=i,f(!0);try{let o=n===`typing`?`background`:`user`,c=await a.onSuggest(t,n,{signal:i.signal,mode:o});if(r!==y.current)return;let u=e.maxSuggestions??a.maxSuggestions??Gne,d=t.trim().length>0?[{id:`__input__`,text:t}]:[],f=c.slice(0,Math.max(0,u-d.length)),p=[...d,...f];s(p),l(p.length>0),h(0)}catch(e){if(e?.name===`AbortError`||r!==y.current)return;s([]),l(!1)}finally{r===y.current&&(f(!1),b.current=null)}},[T,E,e.maxSuggestions,a]);(0,u.useEffect)(()=>{_.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[m]),(0,u.useEffect)(()=>{c&&g.current?.focus()},[c]),(0,u.useEffect)(()=>()=>{w(),T()},[T,w]),(0,u.useEffect)(()=>{if(!C){E();return}if(x.current){x.current=!1,E();return}if(!S.current)return;S.current=!1,w();let e=a?.minChars??Une,t=a?.debounceMs??Wne;if(n.length>=e){v.current=setTimeout(()=>{D(n,`typing`)},t);return}E()},[C,w,E,D,a,n]);let O=e=>{x.current=!0,r(e.text),l(!1),g.current?.focus()};return(0,p.jsxs)(kL,{open:C?c:!1,onOpenChange:e=>l(C&&e),children:[(0,p.jsx)(ML,{asChild:!0,children:(0,p.jsxs)(`div`,{className:V(`relative w-full`,e.containerClassName),children:[(0,p.jsx)(lx,{type:`text`,className:V(e.className,C?`pr-9`:``),value:n,onChange:e=>{S.current=!0,r(e.target.value)},onKeyDown:t=>{if(c&&o.length>0)switch(t.key){case`ArrowDown`:t.preventDefault(),h(e=>(e+1)%o.length);return;case`ArrowUp`:t.preventDefault(),h(e=>(e-1+o.length)%o.length);return;case`Enter`:case`Tab`:if(o[m]){t.preventDefault(),O(o[m]);return}break;case`Escape`:t.preventDefault(),t.stopPropagation(),l(!1);return;default:break}e.onKeyDown?.(t)},onBlur:t=>{t.relatedTarget?.dataset.aiPopoverInteractive!==`true`&&e.onBlur?.(t)},ref:g,id:e.id,autoComplete:e.autoComplete,autoFocus:e.autoFocus,disabled:e.disabled,placeholder:i}),C&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>{l(!0),D(n||``,`manual`)},disabled:d||e.disabled,"data-ai-popover-interactive":`true`,className:V(`absolute right-[2px] top-1/2 -translate-y-1/2 flex items-center justify-center p-0.5 rounded hover:bg-muted/50 hover:text-muted-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,e.aiButtonClassName),"aria-label":t(`getSuggestions`),children:d?(0,p.jsx)(VS,{className:`size-4 text-muted-foreground animate-spin`}):(0,p.jsx)(YS,{className:`size-4 text-muted-foreground/70`})})]})}),(0,p.jsx)(jL,{className:V(`w-(--radix-popover-trigger-width) min-w-0 p-0 border-border`,e.popoverContentClassName),align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),g.current?.focus()},onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),l(!1),g.current?.focus()},children:(0,p.jsxs)(`div`,{className:`max-h-64 overflow-hidden flex flex-col`,children:[(0,p.jsx)(`div`,{className:`px-3 py-2 border-b border-border bg-muted/50 shrink-0`,children:(0,p.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:d?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(VS,{className:`size-3.5 animate-spin shrink-0`}),(0,p.jsx)(`span`,{children:t(`gettingSuggestions`)})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(YS,{className:`size-3.5 shrink-0`}),(0,p.jsx)(`span`,{children:t(`suggestions`)})]})})}),(0,p.jsx)(`div`,{className:`overflow-y-auto`,children:o.length===0&&!d?(0,p.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:t(`noSuggestions`)}):o.map((e,n)=>(0,p.jsxs)(`button`,{ref:n===m?_:void 0,type:`button`,"data-ai-popover-interactive":`true`,onClick:()=>O(e),onMouseEnter:()=>h(n),className:`w-full px-2.5 py-2 text-left transition-colors border-b border-border last:border-b-0 flex items-start justify-between gap-2
|
|
132
|
+
${n===m?`bg-accent text-accent-foreground`:`hover:bg-muted/50`}`,children:[(0,p.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,p.jsxs)(`p`,{className:`text-sm text-foreground wrap-break-word flex items-center gap-2`,children:[(0,p.jsx)(`span`,{children:e.text}),(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,e.id===`__input__`?t(`yourInput`):t(`ai`),e.label&&(0,p.jsxs)(p.Fragment,{children:[` • `,e.label]}),`)`]})]})}),n===m&&(0,p.jsx)(vS,{className:`size-4 text-muted-foreground shrink-0 mt-0.5`})]},e.id))}),(0,p.jsx)(`div`,{className:`px-3 py-2 border-t border-border bg-muted/30 shrink-0`,children:(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded`,children:`↑`}),(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded ml-0.5`,children:`↓`}),(0,p.jsx)(`span`,{className:`mx-1`,children:t(`navigate`)}),(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded mx-1`,children:`Enter`}),(0,p.jsx)(`span`,{children:t(`select`)}),(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-[10px] font-mono bg-background border border-border rounded mx-1`,children:`Esc`}),(0,p.jsx)(`span`,{children:t(`close`)})]})})]})})]})},qne=e=>{let t=G(`itemLabelEditor`),n=yw(),r=Cw(),[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(e.itemLabel),c=(0,u.useRef)(e.itemLabel),l=(0,u.useRef)(null),{isShortcutActive:d}=OL(l,{key:`l`},{enabled:!i});(0,u.useEffect)(()=>{!i&&l.current&&l.current.focus()},[i]);let f=(0,u.useEffectEvent)(t=>{s(e.itemLabel),c.current=e.itemLabel,a(t)});(0,u.useEffect)(()=>{i&&e.itemLabel!==c.current&&f(!1)},[e.itemLabel,i]);let m=(0,u.useMemo)(()=>{let t=n?.suggestItemLabel;if(!t||!r)return null;let i=e.maxSuggestions??3;return{minChars:3,debounceMs:400,maxSuggestions:i,onSuggest:async(n,a,o)=>{let s=sL(r,{purpose:`label-suggestion`,focusItemId:e.itemId});return(await t({draftLabel:n,itemType:e.itemType,locale:`en`,maxSuggestions:i,context:s},{signal:o?.signal,mode:o?.mode})).suggestions.map((e,t)=>({id:`item-label-suggestion-${t}-${e.text}`,text:e.text,label:e.tone}))}}},[n?.suggestItemLabel,e.itemId,e.itemType,e.maxSuggestions,r]),h=t=>{t!==e.itemLabel&&e.onChangeItemLabel(t)},g=()=>{e.itemLabel===c.current&&h(o)};if(!i){let n=e.itemLabel;return(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(H,{ref:l,type:`button`,variant:`ghost`,size:`sm`,className:V(e.className,`hover:bg-primary/10 hover:underline text-muted-foreground`,d&&`bg-primary/5 text-foreground ring-2 ring-ring/40 scale-[0.98]`),onClick:()=>{s(e.itemLabel),c.current=e.itemLabel,a(!0)},children:(0,p.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[n,n.length<1&&(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:t(`emptyLabel`)})]})})}),(0,p.jsx)(nw,{side:`bottom`,align:`start`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:t(`editItemLabel`)}),(0,p.jsx)(hL,{children:`L`})]})})]})}return(0,p.jsx)(Kne,{value:o,onChange:s,id:`new-item-label`,containerClassName:V(`w-fit h-full`,e.className),autoComplete:`off`,autoFocus:!0,className:V(`min-w-64 w-fit max-h-7 rounded-md border-none bg-transparent px-2 text-xs font-medium shadow-none`,`focus:border-none focus:outline-none focus-visible:border-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30`),aiButtonClassName:`rounded-sm p-1 hover:bg-muted/60 size-5`,popoverContentClassName:`z-[70]`,placeholder:t(`placeholder`),suggestionsAdapter:m,onBlur:()=>{a(!1),g()},onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),s(e.itemLabel),a(!1)),t.key===`Enter`&&(t.preventDefault(),g(),a(!1))}})},Jne=({itemId:e})=>{let t=G(`itemSiblingNavigation`),n=Cw(),{navigateToItem:r}=Ow(),i=(0,u.useRef)(null),a=(0,u.useRef)(null),o=n?.getSiblings(e)??[],s=o.findIndex(t=>t.id===e),c=s>=0&&o.length>0,l=s>0?o[s-1]:void 0,d=s>=0&&s<o.length-1?o[s+1]:void 0,{isShortcutActive:f}=OL(i,{key:`ArrowDown`,metaKey:!0},{enabled:!!d}),{isShortcutActive:m}=OL(a,{key:`ArrowUp`,metaKey:!0},{enabled:!!l});return c?(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsxs)(`span`,{className:`min-w-11 text-center font-medium tabular-nums text-muted-foreground text-xs`,children:[s+1,` / `,o.length]}),(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(H,{ref:i,type:`button`,variant:`ghost`,size:`icon-xs`,className:V(`text-muted-foreground hover:bg-primary/10 hover:text-foreground`,f&&`bg-primary/5 text-foreground ring-2 ring-ring/40 scale-[0.98]`),disabled:!d,"aria-label":t(`goToNextSiblingItem`),onClick:()=>{d&&r(d.id)},children:(0,p.jsx)(yS,{className:`size-4`})})}),(0,p.jsx)(nw,{side:`bottom`,align:`center`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:t(`nextSibling`)}),(0,p.jsxs)(gL,{children:[(0,p.jsx)(hL,{children:`Cmd`}),(0,p.jsx)(hL,{children:`↓`})]})]})})]}),(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(H,{ref:a,type:`button`,variant:`ghost`,size:`icon-xs`,className:V(`text-muted-foreground hover:bg-primary/10 hover:text-foreground`,m&&`bg-primary/5 text-foreground ring-2 ring-ring/40 scale-[0.98]`),disabled:!l,"aria-label":t(`goToPreviousSiblingItem`),onClick:()=>{l&&r(l.id)},children:(0,p.jsx)(SS,{className:`size-4`})})}),(0,p.jsx)(nw,{side:`bottom`,align:`center`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:t(`previousSibling`)}),(0,p.jsxs)(gL,{children:[(0,p.jsx)(hL,{children:`Cmd`}),(0,p.jsx)(hL,{children:`↑`})]})]})})]})]}):null},Yne=({itemId:e,menu:t})=>{let n=t.items.length>0||!t.hideDeleteItem;return(0,p.jsxs)(uC,{side:`bottom`,align:`end`,className:`border-border`,children:[(0,p.jsx)(JI,{itemId:e}),n?(0,p.jsx)(hC,{}):null,t.items,t.hideDeleteItem?null:(0,p.jsxs)(p.Fragment,{children:[t.items.length>0?(0,p.jsx)(hC,{}):null,(0,p.jsx)(LI,{})]})]})},Xne=({navItems:e,activeMode:t,showShortcutNumbers:n,colors:r})=>e.length===0?null:(0,p.jsx)(`div`,{className:`shrink-0 border-b px-2`,style:{borderColor:r.border},children:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsx)(aC,{variant:`line`,className:`h-auto min-w-full justify-start gap-0 rounded-none bg-transparent p-0`,children:e.map((e,i)=>{let a=i+1;return(0,p.jsx)(Ine,{value:e.id,label:e.label,icon:e.icon,isActive:t===e.id,colorAccent:r.accent,colorBorder:r.border,showShortcutNumber:n&&a<=9,shortcutNumber:a,hasIndicator:e.hasIndicator,indicatorCount:e.indicatorCount},e.id)})})})}),Zne=({previewDialog:e,colors:t,labels:n})=>{let[r,i]=(0,u.useState)(!1);return(0,p.jsxs)(xL,{open:r,onOpenChange:i,children:[(0,p.jsx)(kne,{asChild:!0,children:(0,p.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full shadow-sm`,children:[(0,p.jsx)(vte,{className:`size-4`,style:{color:t.accent}}),(0,p.jsx)(`span`,{children:n.preview})]})}),(0,p.jsxs)(SL,{className:`survey-editor gap-0 flex max-h-[min(90svh,60rem)] min-h-104 flex-col overflow-y-auto sm:max-w-5xl bg-muted`,children:[(0,p.jsxs)(CL,{className:``,children:[(0,p.jsx)(TL,{children:e.title??n.previewDialogTitle}),(0,p.jsx)(EL,{className:`text-xs`,children:e.description??n.previewDialogDescription})]}),(0,p.jsx)(`div`,{className:` flex-1 py-12`,children:e.content})]})]})},Qne=({previewDialog:e,sidePanelCards:t,colors:n,className:r,labels:i})=>e||t?.length?(0,p.jsx)(`aside`,{className:V(`flex min-h-0 w-full max-w-full flex-col overflow-x-auto overflow-y-hidden @2xl/editor-card:w-80 @2xl/editor-card:shrink-0 @2xl/editor-card:overflow-y-auto`,r),children:(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,children:[e?(0,p.jsx)(`div`,{className:`flex shrink-0 justify-end`,children:(0,p.jsx)(Zne,{previewDialog:e,colors:n,labels:i})}):null,(0,p.jsx)(`div`,{className:`flex pb-3 min-w-0 flex-1 flex-row flex-nowrap items-stretch gap-3 @2xl/editor-card:w-full @2xl/editor-card:flex-col`,children:t?.map(e=>{let t=e.icon;return(0,p.jsxs)(`section`,{className:`w-fit max-w-full min-w-0 shrink-0 rounded-2xl border bg-card p-3 shadow-sm @2xl/editor-card:w-full`,style:{borderColor:n.border},children:[(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsxs)(`h3`,{className:`text-sm font-medium text-foreground flex items-center gap-2`,children:[(0,p.jsx)(`span`,{style:{color:n.accent},children:(0,p.jsx)(t,{className:`size-3`})}),e.title]}),e.description?(0,p.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null]}),(0,p.jsx)(`div`,{className:`mt-4 rounded-xl border border-dashed border-border/80 bg-muted/35 p-2`,children:e.content??(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:i.comingSoon}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.comingSoonDescription})]})})]},e.id)})})]})}):null,$ne=({children:e,previewDialog:t,sidePanelCards:n,colors:r,labels:i})=>(0,p.jsxs)(`div`,{className:V(`flex h-full min-h-0 w-full flex-col @2xl/editor-card:flex-row`,!!(t||n?.length)&&`min-h-0`),children:[(0,p.jsx)(`div`,{className:`order-2 min-h-0 min-w-0 flex-1 overflow-y-auto @2xl/editor-card:order-1`,children:e}),(0,p.jsx)(Qne,{previewDialog:t,sidePanelCards:n,colors:r,className:`order-1 @2xl/editor-card:order-2`,labels:i})]}),LL=({surveyItem:e,menu:t,navItems:n=[],layoutVariant:r=`tabs`,sidePanelCards:i,previewDialog:a,children:o})=>{let s=G(`history`),c=G(`itemEditorCard`),l=r===`tabs`,[d,f]=(0,u.useState)(n[0]?.id??``),m=(0,u.useRef)(null),h=W(e=>e.getItemDataCopy),g=W(e=>e.updateItem),_=W(e=>e.commitByUser),{navigateToItem:v}=Ow(),y=Cw(),b=Sw(),x=AI(e)??`#404040`,S={accent:x,background:`${x}08`,border:`${x}25`},C={goToParentItem:c(`goToParentItem`),itemKeyUpdated:c(`itemKeyUpdated`),itemKeyUpdateFailed:c(`itemKeyUpdateFailed`),itemLabelUpdated:c(`itemLabelUpdated`),preview:c(`preview`),open:c(`open`),previewDescription:c(`previewDescription`),previewDialogTitle:c(`previewDialogTitle`),previewDialogDescription:c(`previewDialogDescription`),comingSoon:c(`comingSoon`),comingSoonDescription:c(`comingSoonDescription`)},w=FI(jI(e)),T=y?.getParentItem(e.id),E=T?y?.getItemKey(T.id)?.itemKey:void 0,D=(T?.items??[]).filter(t=>t!==e.id).map(e=>y?.getItemKey(e)?.itemKey).filter(e=>!!e),O=!!(T&&E),ee=n.some(e=>e.id===d)?d:n[0]?.id??``,{isShortcutActive:k}=OL(m,{key:`ArrowUp`,metaKey:!0,shiftKey:!0},{enabled:O}),{isArmed:A}=Lne({armKey:`v`,enabled:l&&n.length>1,maxIndex:Math.min(n.length,9),onSelectIndex:e=>{let t=n[e];t&&f(t.id)}});if(!b||!y)return null;let j=t=>{try{g(e.id,{key:t}),_({label:s(`updateItemKey`)}),OC.success(C.itemKeyUpdated)}catch(e){console.error(`Failed to update item key:`,e);let t=e instanceof Error?e.message:C.itemKeyUpdateFailed;OC.error(t)}},M=t=>{let n=h(e.id);n&&(n.metadata={...n.metadata,itemLabel:t},g(e.id,n),_({label:s(`updateItemLabel`)}),OC.success(C.itemLabelUpdated))},N=l?o:(0,p.jsx)($ne,{previewDialog:a,sidePanelCards:i,colors:S,labels:C,children:o}),P=(0,p.jsx)(`div`,{className:`h-full w-full min-h-0 rounded-xl shadow-sm`,children:(0,p.jsxs)(`div`,{className:`@container/editor-card flex h-full w-full min-h-0 flex-col overflow-hidden rounded-xl border bg-(--surface-bg-color)`,style:{borderColor:S.border},children:[(0,p.jsx)(`div`,{className:`shrink-0 border-b border-border`,style:{backgroundColor:S.background,borderColor:S.border},children:(0,p.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-1.5 px-4 py-0.5`,children:[w?(0,p.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md text-white`,style:{backgroundColor:S.accent},children:(0,p.jsx)(DI,{typeInfos:w,color:`#ffffff`,iconClassName:`size-3.5`})}):null,O&&T&&E?(0,p.jsxs)(`div`,{className:`flex items-center`,children:[(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(H,{ref:m,variant:`ghost`,size:`sm`,className:V(`text-muted-foreground hover:bg-primary/10 hover:underline`,k&&`bg-primary/5 text-foreground ring-2 ring-ring/40 scale-[0.98]`),onClick:()=>v(T.id),children:E})}),(0,p.jsx)(nw,{side:`bottom`,align:`start`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:C.goToParentItem}),(0,p.jsxs)(gL,{children:[(0,p.jsx)(hL,{children:`Cmd`}),(0,p.jsx)(hL,{children:`Shift`}),(0,p.jsx)(hL,{children:`↑`})]})]})})]}),(0,p.jsx)(xS,{className:`me-1 size-3.5 text-muted-foreground`})]}):null,(0,p.jsx)(Hne,{itemId:e.id,currentItemKey:b.survey.getItemKey(e.id),siblingKeys:D,onChangeItemKey:j}),(0,p.jsx)(`div`,{className:`order-last min-w-0 basis-full sm:order-0 sm:basis-auto sm:pt-0`,children:(0,p.jsx)(qne,{itemId:e.id,itemType:e.type,maxSuggestions:5,className:`w-full justify-start text-left sm:w-auto`,itemLabel:e.metadata?.itemLabel??``,onChangeItemLabel:M})}),(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{asChild:!0,children:(0,p.jsx)(H,{variant:`ghost`,size:`icon`,className:`size-8 rounded-md text-foreground hover:bg-black/5 focus-visible:ring-ring/40`,children:(0,p.jsx)(_te,{className:`size-4`})})}),(0,p.jsx)(Yne,{itemId:e.id,menu:t})]}),(0,p.jsx)(`span`,{className:`flex-1`}),(0,p.jsx)(`div`,{className:`-me-3 hidden @lg/editor-card:block`,children:(0,p.jsx)(Jne,{itemId:e.id})})]})}),l?(0,p.jsx)(Xne,{navItems:n,activeMode:ee,showShortcutNumbers:A,colors:S}):null,(0,p.jsx)(`div`,{className:`min-h-0 flex-1`,children:N})]})});return l?(0,p.jsx)(iC,{value:ee,onValueChange:f,className:`h-full w-full`,children:P}):P},ere=e=>{let t=G(`defaultEditors.group`),n=[{id:`items`,label:t(`items`),icon:BS},{id:`conditions`,label:t(`conditions`),icon:PS,hasIndicator:!0,indicatorCount:3}];return(0,p.jsxs)(LL,{surveyItem:e.item,menu:{items:[(0,p.jsx)(xw,{itemId:e.item.id},`copy-item`)]},navItems:n,children:[(0,p.jsx)(sC,{value:`items`,className:`flex flex-col h-full min-h-0 overflow-hidden`,children:(0,p.jsx)(bL,{})}),(0,p.jsx)(sC,{value:`conditions`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:t(`conditionsTodo`)})]})},tre=e=>{let t=G(`defaultEditors.pageBreak`),n=[{id:`branching`,label:t(`branching`),icon:PS}];return(0,p.jsx)(LL,{surveyItem:e.item,menu:{items:[(0,p.jsx)(xw,{itemId:e.item.id},`copy-item`)]},navItems:n,children:(0,p.jsx)(sC,{value:`branching`,className:`h-full min-h-0 overflow-y-auto p-4`,children:(0,p.jsxs)(`div`,{className:`space-y-4 rounded-xl border border-border bg-muted/20 p-4`,children:[(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`title`)}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`description`)})]}),(0,p.jsx)(`div`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-sm text-muted-foreground`,children:t(`todo`)})]})})})},nre=e=>{let t=G(`defaultEditors.root`),n=[{id:`items`,label:t(`items`),icon:BS}];return(0,p.jsxs)(LL,{surveyItem:e.item,menu:{hideDeleteItem:!0,items:[]},navItems:n,children:[(0,p.jsx)(sC,{value:`items`,className:`flex flex-col h-full min-h-0`,children:(0,p.jsx)(bL,{})}),(0,p.jsx)(sC,{value:`preview`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:t(`previewTodo`)}),(0,p.jsx)(sC,{value:`conditions`,className:`space-y-4 h-full min-h-0 overflow-y-auto`,children:t(`conditionsTodo`)})]})};function RL({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,p.jsx)(a_,{"data-slot":`separator`,decorative:n,orientation:t,className:V(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function zL({className:e,...t}){return(0,p.jsx)(`fieldset`,{"data-slot":`field-set`,className:V(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function BL({className:e,variant:t=`legend`,...n}){return(0,p.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:V(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function VL({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`field-group`,className:V(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var rre=qn(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function HL({className:e,orientation:t=`vertical`,...n}){return(0,p.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:V(rre({orientation:t}),e),...n})}function UL({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`field-content`,className:V(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function WL({className:e,...t}){return(0,p.jsx)(ux,{"data-slot":`field-label`,className:V(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function GL({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`field-label`,className:V(`flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50`,e),...t})}function KL({className:e,...t}){return(0,p.jsx)(`p`,{"data-slot":`field-description`,className:V(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function qL({className:e,children:t,errors:n,...r}){let i=(0,u.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,p.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,p.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,p.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:V(`text-sm font-normal text-destructive`,e),...r,children:i}):null}function JL({className:e,...t}){return(0,p.jsx)(Vm,{"data-slot":`radio-group`,className:V(`grid w-full gap-2`,e),...t})}function YL({className:e,...t}){return(0,p.jsx)(Jm,{"data-slot":`radio-group-item`,className:V(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,p.jsx)(Zm,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,p.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function XL({className:e,size:t=`default`,...n}){return(0,p.jsx)(ev,{"data-slot":`switch`,"data-size":t,className:V(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,p.jsx)(nv,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var ire=[`year`,`year-month`,`year-month-day`];function ZL(e){let t=e.validations.map(e=>({...e,source:`validation`}));return e.required!==!0||t.some(e=>e.type===`required`)?t:[{id:`${e.id}-required`,type:`required`,source:`required`},...t]}function QL(e){let t=yR(e);return t?{type:Me.plain,content:t}:void 0}function $L(e,t,n,r){let i=e?.getContent(t,n,r);return Ve(i).trim()||void 0}var are=`fields`,ore=`fieldGroups`;function eR(e,t){return t?.trim()?`${t}.${e}`:e}function tR(e,t){return eR(`${ore}.${e}`,t)}function nR(e,t){return`${tR(e,t)}.title`}function rR(e,t){return`${tR(e,t)}.description`}function iR(e,t){return eR(`${are}.${e}`,t)}function aR(e,t){return`${iR(e,t)}.label`}function oR(e,t){return`${iR(e,t)}.description`}function sR(e,t){return`${iR(e,t)}.error`}function cR(e,t){return`${iR(e,t)}.placeholder`}function lR(e,t){return`${iR(e,t)}.unit`}function uR(e,t){return`${iR(e,t)}.checkedLabel`}function dR(e,t){return`${iR(e,t)}.uncheckedLabel`}function fR(e,t,n){return`${iR(e,n)}.options.${t}.label`}function pR(e,t,n){return`${iR(e,n)}.validations.${t}.message`}function mR(e,t){let n=[aR(e.id,t),oR(e.id,t),sR(e.id,t),...e.validations.map(n=>pR(e.id,n.id,t))];switch(e.type){case`textarea`:case`datepicker`:case`input`:n.push(cR(e.id,t));break;case`number`:n.push(cR(e.id,t)),n.push(lR(e.id,t));break;case`switch`:n.push(uR(e.id,t)),n.push(dR(e.id,t));break;case`select`:{n.push(cR(e.id,t));let r=e.controller;n.push(...r.options.map(n=>fR(e.id,n.id,t)));break}case`slider`:break}return n}function sre(e,t,n,r){e.setContent(t,nR(n.id,r),QL(n.title)),e.setContent(t,rR(n.id,r),QL(n.description))}function cre(e,t,n,r){e.setContent(t,aR(n.id,r),QL(n.label)),e.setContent(t,oR(n.id,r),QL(n.description)),e.setContent(t,sR(n.id,r),QL(n.errorMessage));for(let i of n.validations)e.setContent(t,pR(n.id,i.id,r),QL(i.message));switch(n.type){case`textarea`:case`datepicker`:case`input`:{let i=n.controller;e.setContent(t,cR(n.id,r),QL(i.placeholder));break}case`number`:{let i=n.controller;e.setContent(t,cR(n.id,r),QL(i.placeholder)),e.setContent(t,lR(n.id,r),QL(i.unit));break}case`switch`:{let i=n.controller;e.setContent(t,uR(n.id,r),QL(i.checkedLabel)),e.setContent(t,dR(n.id,r),QL(i.uncheckedLabel));break}case`select`:{let i=n.controller;e.setContent(t,cR(n.id,r),QL(i.placeholder));for(let a of i.options)e.setContent(t,fR(n.id,a.id,r),QL(a.label));break}case`slider`:break}}function lre(e,t,n,r,i){let a={...e,label:$L(t,n,aR(e.id,i),r)??e.label,description:$L(t,n,oR(e.id,i),r)??e.description,errorMessage:$L(t,n,sR(e.id,i),r)??e.errorMessage,validations:e.validations.map(a=>({...a,message:$L(t,n,pR(e.id,a.id,i),r)??a.message}))};switch(e.type){case`textarea`:{let o=e.controller;a.controller={...o,placeholder:$L(t,n,cR(e.id,i),r)??o.placeholder};break}case`number`:{let o=e.controller;a.controller={...o,placeholder:$L(t,n,cR(e.id,i),r)??o.placeholder,unit:$L(t,n,lR(e.id,i),r)??o.unit};break}case`datepicker`:{let o=e.controller;a.controller={...o,placeholder:$L(t,n,cR(e.id,i),r)??o.placeholder};break}case`switch`:{let o=e.controller;a.controller={...o,checkedLabel:$L(t,n,uR(e.id,i),r)??o.checkedLabel,uncheckedLabel:$L(t,n,dR(e.id,i),r)??o.uncheckedLabel};break}case`select`:{let o=e.controller;a.controller={...o,placeholder:$L(t,n,cR(e.id,i),r)??o.placeholder,options:o.options.map(a=>({...a,label:$L(t,n,fR(e.id,a.id,i),r)??a.label}))};break}case`slider`:break;default:{let o=e.controller;a.controller={...o,placeholder:$L(t,n,cR(e.id,i),r)??o.placeholder};break}}return a}function ure(e,t,n,r,i){return{...e,title:$L(t,n,nR(e.id,i),r)??e.title,description:$L(t,n,rR(e.id,i),r)??e.description,fields:e.fields.map(e=>lre(e,t,n,r,i))}}function hR(e,t,n,r,i){return{...e,fieldGroups:e.fieldGroups.map(e=>ure(e,t,n,r,i))}}function dre(e){let t={...e,label:void 0,description:void 0,errorMessage:void 0,required:void 0,hasValidations:void 0,isInvalid:void 0,validations:e.validations.map(e=>({...e,message:void 0}))};switch(e.type){case`textarea`:t.controller={...e.controller,placeholder:void 0};break;case`number`:t.controller={...e.controller,placeholder:void 0,unit:void 0};break;case`datepicker`:t.controller={...e.controller,placeholder:void 0};break;case`switch`:t.controller={...e.controller,checkedLabel:void 0,uncheckedLabel:void 0};break;case`select`:{let n=e.controller;t.controller={...n,placeholder:void 0,options:n.options.map(e=>({...e,label:void 0}))};break}case`slider`:break;default:t.controller={...e.controller,placeholder:void 0};break}return t}function fre(e){return{...e,title:void 0,description:void 0,fields:e.fields.map(e=>dre(e))}}function gR(e){return{...e,fieldGroups:e.fieldGroups.map(e=>fre(e))}}function _R(e){return typeof e!=`number`||!Number.isFinite(e)?1:Math.min(4,Math.max(1,Math.round(e)))}function pre(e){let t=e&&typeof e==`object`?e:{},n=Object.prototype.hasOwnProperty.call(t,`base`),r=Object.prototype.hasOwnProperty.call(t,`xs`);if(!n&&!r&&(t.sm!==void 0||t.md!==void 0||t.lg!==void 0)){let e=_R(t.sm);return{base:e,xs:e,sm:_R(t.md??t.sm),md:_R(t.lg??t.md??t.sm),xl:_R(t.lg??t.md??t.sm)}}let i=_R(t.xs??t.sm??1),a=_R(t.sm??1),o=_R(t.md??1),s=_R(t.xl??t.lg??1);return{base:_R(n?t.base:i),xs:i,sm:a,md:o,xl:s}}function vR(e){return{"--form-group-cols-base":String(e.base),"--form-group-cols-xs":String(e.xs),"--form-group-cols-sm":String(e.sm),"--form-group-cols-md":String(e.md),"--form-group-cols-xl":String(e.xl)}}function yR(e){if(typeof e==`string`)return e.trim()||void 0}function bR(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return e}function xR(e){return e===!0?!0:e===!1?!1:void 0}function mre(e,t){return t?.trim()||e.replace(/[^a-zA-Z0-9]/g,``).slice(0,4).toUpperCase()||S(4)}function SR(e){switch(e){case`textarea`:return{type:e,rows:3};case`number`:return{type:e,step:1};case`datepicker`:return{type:e,mode:`year-month-day`};case`switch`:return{type:e,defaultChecked:!1};case`select`:return{type:e,options:[]};case`slider`:return{type:e,min:0,max:100,step:1,defaultValue:50,showValue:!0};default:return{type:`input`,inputMode:`text`}}}function hre(e){switch(e){case`textarea`:return[{type:`required`,label:`Required`,description:`Respondents must provide a value.`,valueKind:`none`},{type:`minLength`,label:`Minimum length`,description:`Require a longer free-text answer.`,valueKind:`number`,defaultValue:10},{type:`maxLength`,label:`Maximum length`,description:`Cap the response length.`,valueKind:`number`,defaultValue:500}];case`number`:return[{type:`required`,label:`Required`,description:`Respondents must provide a value.`,valueKind:`none`},{type:`min`,label:`Minimum value`,description:`Reject values below the threshold.`,valueKind:`number`,defaultValue:0},{type:`max`,label:`Maximum value`,description:`Reject values above the threshold.`,valueKind:`number`,defaultValue:100},{type:`integer`,label:`Integer only`,description:`Allow whole numbers only.`,valueKind:`none`}];case`datepicker`:return[{type:`required`,label:`Required`,description:`Respondents must provide a value.`,valueKind:`none`},{type:`minDate`,label:`Earliest date`,description:`Reject dates before the minimum.`,valueKind:`date`},{type:`maxDate`,label:`Latest date`,description:`Reject dates after the maximum.`,valueKind:`date`}];case`switch`:return[{type:`mustBeTrue`,label:`Must be enabled`,description:`Useful for consent or confirmation switches.`,valueKind:`none`}];case`select`:return[{type:`required`,label:`Required`,description:`Respondents must choose an option.`,valueKind:`none`}];case`slider`:return[{type:`min`,label:`Minimum value`,description:`Reject slider values below the threshold.`,valueKind:`number`,defaultValue:0},{type:`max`,label:`Maximum value`,description:`Reject slider values above the threshold.`,valueKind:`number`,defaultValue:100}];case`input`:return[{type:`required`,label:`Required`,description:`Respondents must provide a value.`,valueKind:`none`},{type:`minLength`,label:`Minimum length`,description:`Require a minimum number of characters.`,valueKind:`number`,defaultValue:2},{type:`maxLength`,label:`Maximum length`,description:`Limit the number of characters.`,valueKind:`number`,defaultValue:120},{type:`pattern`,label:`Pattern`,description:`Validate against a regular expression.`,valueKind:`text`},{type:`email`,label:`Email format`,description:`Require a valid email address.`,valueKind:`none`},{type:`url`,label:`URL format`,description:`Require a valid URL.`,valueKind:`none`}]}}function gre(e){if(!e||typeof e!=`object`)return null;let t=e,n=yR(t.id)??b(),r=yR(t.value),i=yR(t.label);return!r&&!i?null:{id:n,value:r??i??n,label:i}}function _re(e){let t=new Set;for(let n of e){let e=n.value.trim().toLowerCase();if(e){if(t.has(e))return!0;t.add(e)}}return!1}function vre(e){if(!e||typeof e!=`object`)return null;let t=e,n=yR(t.id)??b(),r=yR(t.message);switch(t.type){case`minLength`:case`maxLength`:case`min`:case`max`:{let e=bR(t.value);return e===void 0?null:{id:n,type:t.type,value:e,message:r}}case`pattern`:{let e=yR(t.value);return e?{id:n,type:`pattern`,value:e,message:r}:null}case`minDate`:case`maxDate`:{let e=yR(t.value);return e?{id:n,type:t.type,value:e,message:r}:null}case`email`:case`url`:case`integer`:case`required`:case`mustBeTrue`:return{id:n,type:t.type,message:r};default:return null}}function yre(e,t){let n=e&&typeof e==`object`?e:{};switch(t){case`textarea`:{let e=SR(t);return{type:t,placeholder:yR(n.placeholder),rows:Math.min(12,Math.max(2,Math.round(bR(n.rows)??e.rows??3)))}}case`number`:{let e=SR(t);return{type:t,placeholder:yR(n.placeholder),step:bR(n.step)??e.step,unit:yR(n.unit),defaultValue:bR(n.defaultValue)}}case`datepicker`:{let e=SR(t);return{type:t,placeholder:yR(n.placeholder),mode:n.mode===`year`||n.mode===`year-month`?n.mode:e.mode}}case`switch`:return{type:t,checkedLabel:yR(n.checkedLabel),uncheckedLabel:yR(n.uncheckedLabel),defaultChecked:xR(n.defaultChecked)??!1};case`select`:{let e=SR(t);return{type:t,placeholder:yR(n.placeholder),allowClear:xR(n.allowClear),options:Array.isArray(n.options)?n.options.map(e=>gre(e)).filter(e=>e!==null):e.options}}case`slider`:{let e=SR(t);return{type:t,min:bR(n.min)??e.min,max:bR(n.max)??e.max,step:bR(n.step)??e.step,defaultValue:bR(n.defaultValue)??e.defaultValue,showValue:xR(n.showValue)??e.showValue??!0}}default:return{type:`input`,placeholder:yR(n.placeholder),inputMode:n.inputMode===`email`||n.inputMode===`tel`||n.inputMode===`url`||n.inputMode===`password`?n.inputMode:`text`,autocomplete:yR(n.autocomplete)}}}function bre(e){let t=new Set;for(let n of e){if(t.has(n.type))return!0;t.add(n.type)}return!1}function xre(e){if(!e.key.trim()||bre(e.validations))return!0;switch(e.type){case`number`:{let t=e.controller;return t.step!==void 0&&t.step<=0}case`datepicker`:{let t=e.validations.find(e=>e.type===`minDate`)?.value,n=e.validations.find(e=>e.type===`maxDate`)?.value;return typeof t==`string`&&typeof n==`string`&&t>n}case`select`:{let t=e.controller;return t.options.length===0||t.options.some(e=>!e.value.trim())||_re(t.options)}case`slider`:{let t=e.controller;return t.min===void 0||t.max===void 0||t.step===void 0||t.defaultValue===void 0?!0:t.min>=t.max||t.step<=0||t.defaultValue<t.min||t.defaultValue>t.max}default:return e.validations.some(e=>(e.type===`minLength`||e.type===`maxLength`||e.type===`min`||e.type===`max`)&&typeof e.value==`number`?e.value<0:(e.type===`pattern`||e.type===`minDate`||e.type===`maxDate`)&&typeof e.value==`string`?e.value.trim().length===0:!1)}}function Sre(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.id==`string`?t.id.trim():``,r=typeof t.key==`string`?t.key.trim():``;if(!n)return null;let i=mre(n,r),a=t.type===`textarea`||t.type===`number`||t.type===`datepicker`||t.type===`switch`||t.type===`select`||t.type===`slider`?t.type:`input`,o=Array.isArray(t.validations)?t.validations.map(e=>vre(e)).filter(e=>e!==null):[],s=ZL({id:n,required:t.required===!0?!0:void 0,validations:o}).map(e=>({id:e.id,type:e.type,value:e.value,message:e.message})),c=yre(t.controller,a),l=ZL({id:n,validations:s}).length>0;return{id:n,key:i,type:a,label:yR(t.label),description:yR(t.description),errorMessage:yR(t.errorMessage),required:s.some(e=>e.type===`required`)?!0:void 0,controller:c,validations:s,hasValidations:l?!0:void 0,isInvalid:xre({key:i,type:a,controller:c,validations:s})?!0:void 0}}function Cre(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.id==`string`?t.id.trim():``,r=typeof t.title==`string`?t.title.trim():``,i=typeof t.description==`string`?t.description.trim():``;return n?{id:n,title:r||void 0,description:i||void 0,hasDisplayCondition:t.hasDisplayCondition===!0?!0:void 0,layout:pre(t.layout),fields:Array.isArray(t.fields)?t.fields.map(e=>Sre(e)).filter(e=>e!==null):[]}:null}function CR(e,t){let n=e??{};return{id:typeof n.id==`string`&&n.id.trim()?n.id:t,fieldGroups:Array.isArray(n.fieldGroups)?n.fieldGroups.map(e=>Cre(e)).filter(e=>e!==null):[]}}function wre(){return{id:b(),layout:{base:1,xs:1,sm:1,md:1,xl:1},fields:[]}}function Tre(e){let t=new Set(e.map(e=>e.key.trim().toLowerCase()).filter(Boolean)),n=1;for(;t.has(`f${n}`);)n+=1;return`F${n}`}function Ere(e,t=S(4)){return{id:b(),key:t,type:e,controller:SR(e),validations:[]}}function wR(e){return e===1}function Dre(e){return{id:e,maxSelection:1,shuffleOptions:!1,options:[]}}function TR(e){return`options.${e}.label`}function ER(e){return`embeddedForms.${e}`}function Ore(e){return`embedded.${e}`}function DR(e,t){return`${Ore(e)}.${t}`}function kre(e){return OR(e.key??``)||e.id}function Are(e){return!!(e.embeddedFormItemId||e.embeddedForm?.fieldGroups.length)}function OR(e){return e.trim().toUpperCase().replace(/[.\s]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``)}function jre(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.id==`string`?t.id.trim():``;if(!n)return null;let r=typeof t.key==`string`?t.key.trim():``,i=typeof t.embeddedFormItemId==`string`?t.embeddedFormItemId.trim():``;return{id:n,key:r||void 0,hasDisplayCondition:t.hasDisplayCondition===!0?!0:void 0,embeddedFormItemId:i||void 0,embeddedForm:t.embeddedForm?CR(t.embeddedForm,n):void 0}}function Mre(e){let t=`maxSelection`in e&&e.maxSelection!==void 0,n=e.maxSelection;if(n===null)return null;if(typeof n==`number`&&Number.isFinite(n)){let e=Math.floor(n);return e>=1?e:1}if(typeof n==`string`){let e=Number.parseInt(n.trim(),10);if(Number.isFinite(e)&&e>=1)return e}return!t&&e.mode===`multiple`?null:1}function kR(e,t){let n=e??{};return{id:typeof n.id==`string`&&n.id.trim()?n.id:t,maxSelection:Mre(n),shuffleOptions:n.shuffleOptions===!0,options:Array.isArray(n.options)?n.options.map(e=>jre(e)).filter(e=>e!==null):[]}}function AR(e){let t=new Set(e.map(e=>e.key?.match(/^OPT-(\d+)$/)?.[1]).filter(e=>e!==void 0).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e))),n=1;for(;t.has(n);)n+=1;return{id:b(),key:`OPT-${String(n).padStart(2,`0`)}`}}function Nre(e,t){let n=AR(t);return{...e,id:n.id,key:n.key,embeddedForm:e.embeddedForm?v(e.embeddedForm):void 0}}function K(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jR(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var MR=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Pre=MR&&`documentMode`in document?document.documentMode:null,NR=MR&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),PR=MR&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),FR=!(!MR||!(`InputEvent`in window)||Pre)&&`getTargetRanges`in new window.InputEvent(`input`),IR=MR&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,LR=MR&&/Android/.test(navigator.userAgent),RR=MR&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!LR,zR=MR&&/^(?=.*Chrome).*/i.test(navigator.userAgent),BR=MR&&LR&&zR,VR=MR&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&NR&&!zR,Fre=0,Ire=1,Lre=2,Rre=1,zre=2,Bre=3,Vre=4,Hre=5,Ure=6,HR=RR||IR||VR?`\xA0`:``,UR=`
|
|
133
|
+
|
|
134
|
+
`,WR=PR?`\xA0`:HR,GR={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},KR={directionless:1,unmergeable:2},qR={center:2,end:6,justify:4,left:1,right:3,start:5},JR={[zre]:`center`,[Ure]:`end`,[Vre]:`justify`,[Rre]:`left`,[Bre]:`right`,[Hre]:`start`},YR={normal:0,segmented:2,token:1},XR={[Fre]:`normal`,[Lre]:`segmented`,[Ire]:`token`},ZR=`$config`;function QR(){return JG()._blockCursorElement}var $R=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&K(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&K(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&K(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=ez(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=ez(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function ez(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var tz=class e extends $R{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t!==null&&t===QR()?t:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(VR||IR||RR);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement(`br`);if(n.insertBefore(i,r),e){let e=document.createElement(`img`);e.setAttribute(`data-lexical-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=QR(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=nz(t,n);i.push(r);let a=nz(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function nz(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&K(225),n.reverse()}var rz;try{rz=`0.45.0+prod.esm`}catch{}var iz=rz??`0.45.0+source`,az=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},oz=null;function sz(e,t=1e3){return e instanceof cz?e.clone():e.size<t?new Map(e):new cz().init(new Map(e),void 0,e.size)}var cz=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===oz?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===oz?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==oz&&n!==void 0||(this._size++,n===oz&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,oz),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(t)for(let n of t){let t=n[0],r=e?e.get(t):void 0;r!==oz&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===oz||t&&t.has(n[0])||(yield n)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}};function lz(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(Z(o)&&lz(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var uz=!1,dz=0;function fz(e){dz=e.timeStamp}function pz(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&JW(e,n)!==void 0}function mz(e,t,n){let r=LG(OG(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&sG(t,o,i,a,!1)}function hz(e,t,n){if(Y(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return IW(t)&&n.isAttached()}function gz(e,t,n,r){for(let i=e;i&&!sK(i);i=SG(i)){let e=JW(i,t);if(e!==void 0){let t=KW(e,n);if(t)return nW(t)||!BG(i)?void 0:[i,t]}else if(i===r)return[r,$W(n)]}}function _z(e,t,n){uz=!0;let r=performance.now()-dz>100;try{QU(e,()=>{let i=X()||function(e){return e.getEditorState().read(()=>{let e=X();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=gz(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&J(g)&&IW(p)&&hz(i,p,g)&&mz(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=qW(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!pz(r,a,e)&&!sK(r)){if(PR){let e=(BG(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(pz(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||pz(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&eG(i),PR&&bG(e)&&i.insertRawText(u))})}finally{uz=!1}}function vz(e){let t=e._observer;t!==null&&_z(e,t.takeRecords(),t)}function yz(e){(function(e){dz===0&&OG(e).addEventListener(`textInput`,fz,!0)})(e),e._observer=new MutationObserver((t,n)=>{_z(e,t,n)})}var bz=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Dz).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function xz(e,t){return new bz(e,t)}function Sz(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=lK(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var Cz=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Ez(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Ez(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function wz(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Cz(t,Tz(t));return t.__state=n,n}function Tz(e){return e.__state?e.__state.sharedNodeState:TW(JG(),e.getType()).sharedNodeState}function Ez(e){if(e)for(let t in e)return e}function Dz(e){return e}function Oz(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function kz(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function Az(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function jz(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&Oz(n,e,t)||t&&Oz(n,t,e)||e&&kz(n,e,t)||t&&kz(n,t,e))}(c,l))}function Mz(e,t){let n=e.mergeWithSibling(t),r=LU()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Nz(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&J(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(jz(t,r)){r=Mz(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&J(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(jz(r,n)){r=Mz(r,n);break}break}n.remove()}}else r.remove()}function Pz(e){return Fz(e.anchor),Fz(e.focus),e}function Fz(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),J(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!Z(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Iz=Symbol.for(`@lexical/CachedTextSize`);function Lz(e,t){return eB.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=$z.get(r);if(i===void 0&&K(345,r),Z(i)){let a=tB.get(r);if(a!==void 0&&Z(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=nB.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&K(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[Iz];e===void 0&&K(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:Vz})}function Rz(e){Z(e)||e[Iz]===void 0&&(e[Iz]=J(e)?e.__text.length:e.getTextContentSize())}var zz=4,Bz,Vz,Hz,Uz=``,Wz=null,Gz=null,Kz=null;function qz(){return{firstTextKey:Kz,format:Wz,style:Gz}}function Jz(e){e.firstTextKey!==null&&(Wz=e.format,Gz=e.style,Kz=e.firstTextKey)}function Yz(e){if(Kz!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&K(348),t===null)return;let n=tB.get(t);J(n)&&(Wz=n.getFormat(),Gz=n.getStyle(),Kz=t)}var Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB=!1,sB=!1;function cB(e,t){let n=$z.get(e),r=tB.has(e);if(t!==null){let n=TB(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(Vz._keyToDOMMap.delete(e),Z(n)){let e=fK(n,$z);lB(e,0,e.length-1,null)}n!==void 0&&_G(iB,Hz,Xz,n,`destroyed`)}}function lB(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&cB(t,r)}}function uB(e,t){e.setProperty(`text-align`,t)}var dB=`40px`;function fB(e,t){let n=Bz.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${dB}))`)}function pB(e,t){let n=e.style;t===0?uB(n,``):t===1?uB(n,`left`):t===2?uB(n,`center`):t===3?uB(n,`right`):t===4?uB(n,`justify`):t===5?uB(n,`start`):t===6&&uB(n,`end`)}function mB(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(iW(e))return null;let n=e.getParentOrThrow();return AG(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function hB(e,t){let n=tB.get(e);if(n===void 0&&K(60),t!==null){let r=$z.get(e);if(r!==void 0&&r.__parent!==n.__parent){let n=nB.get(e);if(n!==void 0)return t.insertChild(n),bB(e,t.element)}}let r=aB.$createDOM(n,Vz);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,Vz),J(n)?r.setAttribute(`data-lexical-text`,`true`):nW(n)&&r.setAttribute(`data-lexical-decorator`,`true`),Z(n)){let e=n.__indent,t=n.__size;if(mB(r,n),e!==0&&fB(r,e),t===0)r.__lexicalTextContent=``,r.__lexicalFirstTextKey=null;else{let e=t-1;gB(fK(n,tB),n,0,e,XG(n,r,Vz))}let i=n.__format;i!==0&&pB(r,i),n.isInline()||_B(null,n,r)}else{let t=n.getTextContent();if(nW(n)){let t=n.decorate(Vz,Bz);t!==null&&xB(e,t),r.contentEditable=`false`}Uz+=t}return t!==null&&t.insertChild(r),aB.$decorateDOM(n,null,r,Vz),Rz(n),_G(iB,Hz,Xz,n,`created`),r}function gB(e,t,n,r,i){let a=Uz,o=qz();Uz=``,Wz=null,Gz=null,Kz=null;let s=n;for(;s<=r;++s){let t=qz();hB(e[s],i);let n=tB.get(e[s]);n!==null&&J(n)?Wz===null&&(Wz=n.getFormat(),Gz=n.getStyle(),Kz=n.__key):Z(n)&&s<r&&!n.isInline()&&(Uz+=UR),Jz(t)}let c=Vz._keyToDOMMap.get(t.__key);c===void 0&&K(349,t.__key),c.__lexicalTextContent=Uz,c.__lexicalFirstTextKey=Kz,Uz=a+Uz,Jz(o)}function _B(e,t,n){let r=XG(t,n,Vz),i=r.element.__lexicalLastChildKind??null,a=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return wH(e)?`line-break`:nW(e)&&e.isInline()?`decorator`:null}return`empty`}return null}(t,tB);i!==a&&r.setManagedLineBreak(a)}function vB(e,t,n){var r;Wz=null,Gz=null,Kz=null,function(e,t,n){let r=Uz,i=e.__size,a=t.__size;Uz=``;let o=n.element,s=Vz._keyToDOMMap.get(t.__key);s===void 0&&K(351,t.__key);let c=a-i;if(!oB&&Math.abs(c)<=1&&i>=zz&&e.__first===t.__first&&(c!==0||!Vz._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=rB.get(e.__key);if(!oB&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=tB.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=Lz(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=tB.get(n);if(e===void 0)break;let t=qz();bB(n,o),J(e)&&Wz===null&&(Wz=e.getFormat(),Gz=e.getStyle(),Kz=e.__key),Jz(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=tB.get(n);if(e===void 0)break;let t;if(Z(e)){let r=Vz._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&K(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&Z(e)&&!e.isInline()&&(d+=UR),n=e.__next,c++}let f=i.slice(0,i.length-e)+d;s.__lexicalTextContent=f,Uz=r+f,yB(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=$z.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=tB.get(a),d=$z.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=tB.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=$z.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let b=Lz(l,c);for(let e of _){let t=qz();if(e.kind===`reconcile`)bB(e.key,n.element);else if(e.kind===`destroy`)cB(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=Vz._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}hB(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=tB.get(e.key);t&&J(t)&&Wz===null&&(Wz=t.getFormat(),Gz=t.getStyle(),Kz=t.__key)}Jz(t)}let x=``;for(let e=0;e<o;e++){let t=tB.get(f[e]);if(t===void 0)return!1;let n;if(Z(t)){let r=Vz._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&K(350,t.getType()),n=i}else n=t.getTextContent();x+=n,e<o-1&&Z(t)&&!t.isInline()&&(x+=UR)}return r.__lexicalTextContent=i.slice(0,i.length-b)+x,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&K(353),Uz=r+e,yB(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=tB.get(t);if(e===void 0)break;let r=oB||Qz.has(t)||Zz.has(t),i=qz();if(r)bB(t,o);else{let n,r;if(Z(e)){r=nB.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&K(354,e.getType()),n=i}else n=e.getTextContent();Uz+=n,r!==void 0&&Yz(r)}J(e)?Wz===null&&(Wz=e.getFormat(),Gz=e.getStyle(),Kz=e.__key):Z(e)&&n<a-1&&!e.isInline()&&(Uz+=UR),Jz(i),t=e.__next,n++}s.__lexicalTextContent=Uz,s.__lexicalFirstTextKey=Kz,Uz=r+Uz;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)bB(r,o);else{let e=TB(r),t=hB(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}cB(r,null)}let a=tB.get(i);J(a)&&Wz===null&&(Wz=a.getFormat(),Gz=a.getStyle(),Kz=a.__key)}else{let r=fK(e,$z),s=fK(t,tB);if(r.length!==i&&K(227),s.length!==a&&K(228),i===0)a!==0&&gB(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;lB(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=qz();if(e===r)u=SB(bB(r,a.element)),d++,f++;else{if(l===void 0&&(l=CB(n,f)),c===void 0)c=CB(t,d);else if(!c.has(e)){d++,Jz(i);continue}if(!l.has(e)){u=SB(TB(e)),cB(e,a.element),d++,c.delete(e),Jz(i);continue}if(c.has(r)){let e=xG(Vz,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=SB(bB(r,a.element)),d++,f++}else hB(r,a.withBefore(u??a.before)),f++}let o=tB.get(r);o!==null&&J(o)?Wz===null&&(Wz=o.getFormat(),Gz=o.getStyle(),Kz=o.__key):Z(o)&&f<=s&&!o.isInline()&&(Uz+=UR),Jz(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:Vz.getElementByKey(t);gB(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&lB(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=Uz,s.__lexicalFirstTextKey=Kz,Uz=r+Uz}(e,t,XG(t,n,Vz)),AG(t)||(r=t,Wz==null||Wz===r.__textFormat||sB||r.setTextFormat(Wz),function(e){Gz==null||Gz===e.__textStyle||sB||e.setTextStyle(Gz)}(t))}function yB(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=tB.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=tB.get(r);if(J(e))return Wz=e.getFormat(),void(Gz=e.getStyle())}}t.__lexicalFirstTextKey=Kz}function bB(e,t){let n=$z.get(e),r=tB.get(e);n!==void 0&&r!==void 0||K(61);let i=oB||Qz.has(e)||Zz.has(e),a=xG(Vz,e);if(n===r&&!i){let e;if(Z(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&K(355,n.getType()),e=t,Yz(a)}else e=n.getTextContent();return Uz+=e,a}if(n!==r&&i&&_G(iB,Hz,Xz,r,`updated`),aB.$updateDOM(r,n,a,Vz)){let n=hB(e,null);return t===null&&K(62),t.replaceChild(n,a),cB(e,null),n}if(Z(n)){Z(r)||K(334,e);let t=r.__indent;(oB||t!==n.__indent)&&fB(a,t);let o=r.__format;if((oB||o!==n.__format)&&pB(a,o),i)vB(n,r,a),iW(r)||r.isInline()||_B(0,r,a);else{let e=a.__lexicalTextContent;typeof e!=`string`&&K(356,n.getType()),Uz+=e,Yz(a)}if((oB||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(mB(a,r),iW(r)&&!oB))for(let e of r.getChildren())Z(e)&&mB(xG(Vz,e.getKey()),e)}else{let t=r.getTextContent();if(nW(r)){let t=r.decorate(Vz,Bz);t!==null&&xB(e,t)}Uz+=t}if(!sB&&iW(r)){let e=r.getLatest();if(e.__cachedText!==Uz){let t=e.getWritable();t.__cachedText=Uz,r=t}}return aB.$decorateDOM(r,n,a,Vz),Rz(r),a}function xB(e,t){let n=Vz._pendingDecorators,r=Vz._decorators;if(n===null){if(r[e]===t)return;n=XW(Vz)}n[e]=t}function SB(e){let t=e.nextSibling;return t!==null&&t===Vz._blockCursorElement&&(t=t.nextSibling),t}function CB(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function wB(e,t,n,r,i,a){Uz=``,Wz=null,Gz=null,Kz=null,oB=r===2,Vz=n,Bz=n._config,aB=n._config.dom||_W,Hz=n._nodes,Xz=Vz._listeners.mutation,Zz=i,Qz=a,$z=e._nodeMap,eB=e,tB=t._nodeMap,sB=t._readOnly,nB=sz(n._keyToDOMMap),rB=function(){let e=new Map,t=t=>{for(let n of t){let t=tB.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(Zz.keys()),t(Qz),e}();let o=new Map;return iB=o,bB(`root`,null),Vz=void 0,Hz=void 0,Zz=void 0,Qz=void 0,$z=void 0,eB=void 0,tB=void 0,Bz=void 0,nB=void 0,rB=void 0,iB=void 0,aB=_W,o}function TB(e){let t=nB.get(e);return t===void 0&&K(75,e),t}function q(e){return{type:e}}var EB=q(`SELECTION_CHANGE_COMMAND`),DB=q(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),OB=q(`CLICK_COMMAND`),kB=q(`BEFORE_INPUT_COMMAND`),AB=q(`INPUT_COMMAND`),jB=q(`COMPOSITION_START_COMMAND`),MB=q(`COMPOSITION_END_COMMAND`),NB=q(`DELETE_CHARACTER_COMMAND`),PB=q(`INSERT_LINE_BREAK_COMMAND`),FB=q(`INSERT_PARAGRAPH_COMMAND`),IB=q(`CONTROLLED_TEXT_INSERTION_COMMAND`),LB=q(`PASTE_COMMAND`),RB=q(`REMOVE_TEXT_COMMAND`),zB=q(`DELETE_WORD_COMMAND`),BB=q(`DELETE_LINE_COMMAND`),VB=q(`FORMAT_TEXT_COMMAND`),HB=q(`UNDO_COMMAND`),UB=q(`REDO_COMMAND`),WB=q(`KEYDOWN_COMMAND`),GB=q(`KEY_ARROW_RIGHT_COMMAND`),KB=q(`MOVE_TO_END`),qB=q(`KEY_ARROW_LEFT_COMMAND`),JB=q(`MOVE_TO_START`),YB=q(`KEY_ARROW_UP_COMMAND`),XB=q(`KEY_ARROW_DOWN_COMMAND`),ZB=q(`KEY_ENTER_COMMAND`),QB=q(`KEY_SPACE_COMMAND`),$B=q(`KEY_BACKSPACE_COMMAND`),eV=q(`KEY_ESCAPE_COMMAND`),tV=q(`KEY_DELETE_COMMAND`),nV=q(`KEY_TAB_COMMAND`),rV=q(`INSERT_TAB_COMMAND`),iV=q(`INDENT_CONTENT_COMMAND`),aV=q(`OUTDENT_CONTENT_COMMAND`),oV=q(`DROP_COMMAND`),sV=q(`FORMAT_ELEMENT_COMMAND`),cV=q(`DRAGSTART_COMMAND`),lV=q(`DRAGOVER_COMMAND`),uV=q(`DRAGEND_COMMAND`),dV=q(`COPY_COMMAND`),fV=q(`CUT_COMMAND`),pV=q(`SELECT_ALL_COMMAND`),mV=q(`CLEAR_EDITOR_COMMAND`),hV=q(`CLEAR_HISTORY_COMMAND`),gV=q(`CAN_REDO_COMMAND`),_V=q(`CAN_UNDO_COMMAND`),vV=q(`FOCUS_COMMAND`),yV=q(`BLUR_COMMAND`),bV=q(`KEY_MODIFIER_COMMAND`),xV=Object.freeze({}),SV=[[`keydown`,function(e,t){CV=e.timeStamp,wV=e.key,e.key!==`Backspace`&&KV(),!t.isComposing()&&Q(t,WB,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;VG(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&QU(t,()=>{OW(n)||(MV=!0)})}],[`compositionstart`,function(e,t){Q(t,jB,e)}],[`compositionend`,function(e,t){PR?PV=!0:IR||!RR&&!VR?Q(t,MB,e):(FV=!0,IV=e.data)}],[`input`,function(e,t){e.stopPropagation(),KV(),QU(t,()=>{t.dispatchCommand(AB,e)},{event:e}),EV=null}],[`click`,function(e,t){QU(t,()=>{let n=X(),r=LG(OG(t)),i=pU();if(r){if(Y(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!iW(t)&&QW().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(BG(n)||IW(n))&&eG(fU(i,r,t,e))}}Q(t,OB,e)})}],[`cut`,xV],[`copy`,xV],[`dragstart`,xV],[`dragover`,xV],[`dragend`,xV],[`paste`,xV],[`focus`,xV],[`blur`,xV],[`drop`,xV]];FR&&SV.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||PR&&bG(t)||n!==`insertCompositionText`&&Q(t,kB,e)}(e,t)]);var CV=0,wV=null,TV=0,EV=null,DV=!1,OV=null,kV=new WeakMap,AV=new WeakMap,jV=!1,MV=!1,NV=!1,PV=!1,FV=!1,IV=``,LV=null,RV=[0,``,0,`root`,0];function zV(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=LU(),l=LG(OG(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!J(s)||(!i&&(!FR||TV<r+50)||s.isDirty()&&p<2||nG(n))&&a.offset!==o.offset&&!s.isComposing()||FW(s)||s.isDirty()&&p>1||(i||!FR)&&f!==null&&!s.isComposing()&&u!==QG(s,f,c)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=PW(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(J(t)||Z(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function BV(e,t){return IW(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function VV(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;jV&&(jV=!1,BV(r,i)&&BV(a,o)&&!LV)||QU(t,()=>{if(!n)return void eG(null);if(!AW(t,r,a))return;let s=X();if(LV&&Y(s)&&s.isCollapsed()){let e=s.anchor,t=LV.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=LV.clone(),eG(s))}if(LV=null,Y(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=OG(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=RV,f=QW(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)HV(s,o,c);else if(n.type===`text`)J(r)||K(141),UV(s,r);else if(n.type===`element`&&!p){Z(r)||K(259);let e=n.getNode();e.isEmpty()?function(e,t){HV(e,t.getTextFormat(),t.getTextStyle())}(s,e):HV(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(J(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}Q(t,EB,void 0)})}function HV(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function UV(e,t){HV(e,t.getFormat(),t.getStyle())}function WV(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function GV(e){if(e==null||e.length<=1||wV==null)return;let t=wV.length===1?wV:wV===`Enter`?`
|
|
135
|
+
`:wV===`Tab`?` `:null;if(!t)return;let n=X();if(!Y(n)||!n.isCollapsed())return;let r=n.anchor.getNode();if(!J(r))return;let{offset:i}=n.anchor;if(r.getTextContentSize()===i){let e=r.getNextSibling();if(t===`
|
|
136
|
+
`){if(wH(e))e.selectEnd();else if(!e){let e=dK(r,cU),t=e&&e.getNextSibling();Z(t)&&t.selectStart()}}else t===` `?GH(e)&&e.selectEnd():J(e)&&e.getTextContent()[0]===t&&e.select(1,1)}else r.getTextContent()[i]===t&&r.select(i+1,i+1)}function KV(){DV=!1,OV!==null&&(clearTimeout(OV),OV=null)}function qV(){KV(),DV=!0,OV=setTimeout(KV,0)}function JV(e){let t=e.inputType,n=WV(e),r=LU(),i=X();if(t===`insertText`&&e.data&&DV){if(KV(),e.preventDefault(),Y(i)&&!i.isCollapsed()){let e=i.isBackward()?i.anchor:i.focus;i.anchor.set(e.key,e.offset,e.type),i.focus.set(e.key,e.offset,e.type)}return!0}if(t===`deleteContentBackward`){if(i===null){let e=pU();if(!Y(e))return!0;eG(e.clone())}if(Y(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,wV===`MediaLast`&&a<CV+30&&r.isComposing()&&t){if(WW(null),CV=0,setTimeout(()=>{QU(r,()=>{WW(null)})},30),Y(i)){let e=i.anchor.getNode();e.markDirty(),J(e)||K(142),UV(i,e)}}else{if(WW(null),IR&&n!==null&&!n.collapsed&&(i.applyDOMRange(n),!i.isCollapsed()))return e.preventDefault(),i.removeText(),!0;e.preventDefault();let a=i.anchor.getNode(),o=a.getTextContent(),s=a.canInsertTextAfter(),c=i.anchor.offset===0&&i.focus.offset===o.length,l=BR&&t&&!c&&s;if(l&&i.isCollapsed()&&(l=!nW(yG(i.anchor,!0))),!l){Q(r,NB,!0);let e=X();BR&&Y(e)&&e.isCollapsed()&&(LV=e,setTimeout(()=>LV=null))}}return!0}}var a;if(!Y(i))return!0;let o=e.data;EV!==null&&oG(!1,r,EV),i.dirty&&EV===null||!i.isCollapsed()||iW(i.anchor.getNode())||n===null||i.applyDOMRange(n),EV=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
137
|
+
`)e.preventDefault(),Q(r,PB,!1);else if(o===UR)e.preventDefault(),Q(r,FB,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&zV(i,n,o,e.timeStamp,!0)?(e.preventDefault(),Q(r,IB,o),GV(o)):EV=o;return TV=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:Q(r,IB,e),GV((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:WW(null),Q(r,IB,e);break;case`insertLineBreak`:WW(null),Q(r,PB,!1);break;case`insertParagraph`:WW(null),NV&&!IR?(NV=!1,Q(r,PB,!1)):Q(r,FB,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:Q(r,LB,e);break;case`deleteByComposition`:(function(e,t){return e!==t||Z(e)||Z(t)||!PW(e)||!PW(t)})(l,u)&&Q(r,RB,e);break;case`deleteByDrag`:wG(mH),Q(r,RB,e);break;case`deleteByCut`:Q(r,RB,e);break;case`deleteContent`:Q(r,NB,!1);break;case`deleteWordBackward`:Q(r,zB,!0);break;case`deleteWordForward`:Q(r,zB,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:Q(r,BB,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:Q(r,BB,!1);break;case`formatStrikeThrough`:Q(r,VB,`strikethrough`);break;case`formatBold`:Q(r,VB,`bold`);break;case`formatItalic`:Q(r,VB,`italic`);break;case`formatUnderline`:Q(r,VB,`underline`);break;case`historyUndo`:Q(r,HB,void 0);break;case`historyRedo`:Q(r,UB,void 0)}return!0}function YV(e){if(BG(e.target)&&OW(e.target))return!0;let t=LU(),n=X(),r=e.data,i=WV(e);if(r!=null&&Y(n)&&zV(n,i,r,e.timeStamp,!1)){PV&&=(QV(t,r),!1);let i=n.anchor.getNode(),a=LG(OG(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;FR&&!n.isCollapsed()&&J(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===aG(a.anchorNode)||Q(t,IB,r);let l=r.length;PR&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l,n._cachedNodes=null,n._cachedIsBackward=null),BR&&t.isComposing()&&(CV=0,WW(null))}else oG(!1,t,r===null?void 0:r),PV&&=(QV(t,r||void 0),!1);return function(){PU(),vz(LU())}(),!0}function XV(e){let t=LU(),n=X();if(Y(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();WW(r.key),wG(hH),(e.timeStamp<CV+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||J(i)&&i.getStyle()!==n.style)&&Q(t,IB,WR)}return!0}function ZV(e){return QV(LU(),e.data),wG(gH),!0}function QV(e,t){let n=e._compositionKey;if(WW(null),n!==null&&t!=null){if(t===``){let t=KW(n),r=e.getElementByKey(n),i=r!==null&&J(t)?QG(t,r,e):null;if(i!==null&&i.nodeValue!==null&&J(t)){let n=LG(OG(e)),r=null,a=null;n!==null&&n.anchorNode===i&&(r=n.anchorOffset,a=n.focusOffset),sG(t,i.nodeValue,r,a,!0)}return}if(t[t.length-1]===`
|
|
138
|
+
`){let t=X();if(Y(t)||QH(t)){if(Y(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}Q(e,ZB,null);return}}}oG(!0,e,t)}function $V(e){let t=LU();if(e.key==null)return!0;if(FV){if(mG(e))return QU(t,()=>{QV(t,IV)}),FV=!1,IV=``,!0;FV=!1,IV=``}if(function(e){return dG(e,`ArrowRight`,{shiftKey:`any`})}(e))Q(t,GB,e);else if(function(e){return dG(e,`ArrowRight`,{...fG,shiftKey:`any`})}(e))Q(t,KB,e);else if(function(e){return dG(e,`ArrowLeft`,{shiftKey:`any`})}(e))Q(t,qB,e);else if(function(e){return dG(e,`ArrowLeft`,{...fG,shiftKey:`any`})}(e))Q(t,JB,e);else if(function(e){return dG(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))Q(t,YB,e);else if(function(e){return dG(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))Q(t,XB,e);else if(function(e){return dG(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))NV=!0,Q(t,ZB,e);else if(function(e){return e.key===` `}(e))Q(t,QB,e);else if(function(e){return NR&&dG(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),NV=!0,Q(t,PB,!0);else if(function(e){return dG(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))NV=!1,Q(t,ZB,e);else if(function(e){return dG(e,`Backspace`,{shiftKey:`any`})||NR&&dG(e,`h`,{ctrlKey:!0})}(e))mG(e)?Q(t,$B,e)&&qV():(e.preventDefault(),Q(t,NB,!0));else if(function(e){return e.key===`Escape`}(e))Q(t,eV,e);else if(function(e){return dG(e,`Delete`,{})||NR&&dG(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?Q(t,tV,e):(e.preventDefault(),Q(t,NB,!1));else if(function(e){return dG(e,`Backspace`,pG)}(e))e.preventDefault(),Q(t,zB,!0);else if(function(e){return dG(e,`Delete`,pG)}(e))e.preventDefault(),Q(t,zB,!1);else if(function(e){return NR&&dG(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),Q(t,BB,!0);else if(function(e){return NR&&(dG(e,`Delete`,{metaKey:!0})||dG(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),Q(t,BB,!1);else if(function(e){return dG(e,`b`,fG)}(e))e.preventDefault(),Q(t,VB,`bold`);else if(function(e){return dG(e,`u`,fG)}(e))e.preventDefault(),Q(t,VB,`underline`);else if(function(e){return dG(e,`i`,fG)}(e))e.preventDefault(),Q(t,VB,`italic`);else if(function(e){return dG(e,`Tab`,{shiftKey:`any`})}(e))Q(t,nV,e);else if(function(e){return dG(e,`z`,fG)}(e))e.preventDefault(),Q(t,HB,void 0);else if(function(e){return NR?dG(e,`z`,{metaKey:!0,shiftKey:!0}):dG(e,`y`,{ctrlKey:!0})||dG(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),Q(t,UB,void 0);else{let n=t._editorState._selection;(function(e){return dG(e,`a`,fG)})(e)?(e.preventDefault(),Q(t,pV,e)&&qV()):n===null||Y(n)||(function(e){return dG(e,`c`,fG)}(e)?(e.preventDefault(),Q(t,dV,e)):function(e){return dG(e,`x`,fG)}(e)&&(e.preventDefault(),Q(t,fV,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(bV,e),!0}function eH(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var tH=new Map;function nH(e){let t=RG(e.target);if(t===null)return;let n=MW(t.anchorNode);if(n===null)return;MV&&(MV=!1,QU(n,()=>{let r=pU(),i=t.anchorNode;(BG(i)||IW(i))&&eG(fU(r,t,n,e))}));let r=rG(n),i=r[r.length-1],a=i._key,o=tH.get(a),s=o||i;s!==n&&VV(t,s,!1),VV(t,n,!0),n===i?o&&tH.delete(a):tH.set(a,n)}function rH(e){e._lexicalHandled=!0}function iH(e){return!0===e._lexicalHandled}function aH(e){let t=kV.get(e);if(t===void 0)return;let n=AV.get(t);if(n===void 0)return;let r=n-1;r>=0||K(164),kV.delete(e),AV.set(t,r),r===0&&t.removeEventListener(`selectionchange`,nH);let i=NW(e);jW(i)?(function(e){if(e._parentEditor!==null){let t=rG(e),n=t[t.length-1]._key;tH.get(n)===e&&tH.delete(n)}else tH.delete(e._key)}(i),e.__lexicalEditor=null):i&&K(198);let a=eH(e);for(let e=0;e<a.length;e++)a[e]();e.__lexicalEventHandles=[]}function oH(e,t,n){PU();let r=e.__key,i=e.getParent();if(i===null)return;let a=function(e){let t=X();if(!Y(t)||!Z(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return EG(i,e)&&n.set(e.__key,0,`element`),EG(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(Y(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(gU(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(gU(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else QH(a)&&t&&e.isSelected()&&e.selectPrevious();if(Y(a)&&t&&!o){let t=e.getIndexWithinParent();HW(e),mU(a,i,t,-1)}else HW(e);n||AG(i)||i.canBeEmpty()||!i.isEmpty()||oH(i,t),t&&a&&iW(i)&&i.isEmpty()&&i.selectEnd()}function sH(e){return e}var cH=Symbol.for(`ephemeral`);function lH(e){return e[cH]||!1}var uH={configurable:!0,enumerable:!1,value:void 0,writable:!0},dH=class{__type;__key;__parent;__prev;__next;__state;[Iz];static getType(){let{ownNodeType:e}=lK(this);return e===void 0&&K(64,this.name),e}static clone(e){K(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,`__state`,uH),Object.defineProperty(this,Iz,uH),VW(this,e)}getType(){return this.__type}isInline(){K(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=KW(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||X();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(J(this))return n;if(Y(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(nW(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:KW(e)}getParentOrThrow(){let e=this.getParent();return e===null&&K(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(AG(t))return Z(e)||e===this&&nW(e)||K(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&K(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:KW(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:KW(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=Z(this)?this:this.getParent(),n=Z(e)?e:e.getParent(),r=t&&n?WK(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=WK(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?VK(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&K(279),!1)))}isParentOf(e){let t=WK(this,e);return t!==null&&t.type===`ancestor`}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=Z(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&K(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=LU()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(lH(this))return this;let e=KW(this.__key);return e===null&&K(113),e}getWritable(){if(lH(this))return this;PU();let e=IU(),t=LU(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=X();if(o!==null&&o.setCachedNodes(null),a.has(r))return UW(i),i;let s=nK(i);return a.add(r),UW(s),n.set(r,s),s}getTextContent(){return``}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){K(70)}updateDOM(e,t,n){K(71)}getDOMSlot(e){return new $R(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){K(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of Tz(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&wz(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){oH(this,!0,e)}replace(e,t){PU();let n=X();n!==null&&(n=n.clone()),NG(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();HW(o),l!==null&&Y(n)&&mU(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;oH(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;if(t&&(Z(this)&&Z(o)||K(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren())),Y(n)){eG(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):YH(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):YH(r,o))}return GW()===i&&WW(a),o}insertAfter(e,t=!0){PU(),NG(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),a=X(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(Y(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}HW(r),t&&Y(a)&&mU(a,i,n,-1)}let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Y(a)){let e=this.getIndexWithinParent();mU(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){PU(),NG(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key,a=X(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();HW(r),o!==null&&t&&Y(a)&&mU(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&Y(a)&&mU(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return pW()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){PU();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(Z(n))return n.select();if(!J(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){PU();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(Z(n))return n.select(0,0);if(!J(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}},fH=`history-push`,pH=`history-merge`,mH=`skip-selection-focus`,hH=`composition-start`,gH=`composition-end`,_H=/\s*!important\s*$/i;function vH(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0;for(let l=0;l<e.length;l++){let u=e[l];if(a)u===`*`&&e[l+1]===`/`&&(a=!1,l++);else if(o)s?r+=u:n+=u,o=!1;else if(i===null)if(u!==`/`||e[l+1]!==`*`)if(u!==`"`&&u!==`'`)if(u!==`(`)if(u!==`)`)if(s||u!==`:`||c!==0){if(u===`;`&&c===0){let e=n.trim(),i=r.trim();e!==``&&i!==``&&(t[e]=i),n=``,r=``,s=!1;continue}s?r+=u:n+=u}else s=!0;else c=Math.max(0,c-1),s?r+=u:n+=u;else c++,s?r+=u:n+=u;else i=u,s?r+=u:n+=u;else a=!0,l++;else s?r+=u:n+=u,u===`\\`?o=!0:u===i&&(i=null)}let l=n.trim(),u=r.trim();return l!==``&&u!==``&&(t[l]=u),t}function yH(e,t,n){let r=_H.test(n)?`important`:``,i=r===``?n:n.replace(_H,``).trim();e.setProperty(t,i,r)}function bH(e,t,n=``){if(t===n)return;let r=vH(n),i=vH(t);for(let t in i)delete r[t],yH(e,t,i[t]);for(let t in r)e.removeProperty(t)}var xH=class e extends dH{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
139
|
+
`}createDOM(){return document.createElement(`br`)}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){let t=e.parentElement;if(t!==null&&KG(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&TH(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&TH(n))return!0}}return!1}(e)||function(e){let t=e.parentElement;if(t!==null&&KG(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&TH(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&TH(r))return!0}return!1}(e)?null:{conversion:SH,priority:0}}}static importJSON(e){return CH().updateFromJSON(e)}};function SH(e){return{node:CH()}}function CH(){return MG(new xH)}function wH(e){return e instanceof xH}function TH(e){return IW(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function EH(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function DH(e,t){return 1&t?`strong`:2&t?`em`:`span`}function OH(e,t,n,r,i){let a=r.classList,o=gG(i,`base`);o!==void 0&&a.add(...o),o=gG(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in GR){let r=GR[e];if(o=gG(i,e),o!==void 0)if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}function kH(e,t,n){let r=n.isComposing(),i=e+(r?HR:``),a=JG(),o=YG(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(document.createTextNode(i));let c=s,l=c.nodeValue;if(l!==i)if(r||PR){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}function AH(e,t,n,r,i,a){kH(i,e,t);let o=a.theme.text;o!==void 0&&OH(0,0,r,e,o)}function jH(e,t){let n=document.createElement(t);return n.appendChild(e),n}var MH=class e extends dH{__text;__format;__style;__mode;__detail;static getType(){return`text`}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return XR[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===GW()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=GR[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return zW(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=EH(0,n),i=DH(0,n),a=r===null?i:r,o=document.createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=document.createElement(i),o.appendChild(s)),AH(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&bH(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=EH(0,i),s=EH(0,a),c=DH(0,i),l=DH(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??K(48);let i=document.createElement(l);return AH(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??K(49)),kH(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&OH(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&bH(t.style,p,f),!1}static importDOM(){return{"#text":()=>({conversion:LH,priority:0}),b:()=>({conversion:PH,priority:0}),code:()=>({conversion:BH,priority:0}),em:()=>({conversion:BH,priority:0}),i:()=>({conversion:BH,priority:0}),mark:()=>({conversion:BH,priority:0}),s:()=>({conversion:BH,priority:0}),span:()=>({conversion:NH,priority:0}),strong:()=>({conversion:BH,priority:0}),sub:()=>({conversion:BH,priority:0}),sup:()=>({conversion:BH,priority:0}),u:()=>({conversion:BH,priority:0})}}static importJSON(e){return VH().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return BG(t)||K(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=jH(t,`b`)),this.hasFormat(`italic`)&&(t=jH(t,`i`)),this.hasFormat(`strikethrough`)&&(t=jH(t,`s`)),this.hasFormat(`underline`)&&(t=jH(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?GR[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?KR[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=zW(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=YR[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){PU();let n=e,r=t,i=X(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!Y(i))return lU(o,n,o,r,`text`,`text`);{let e=GW();e!==i.anchor.key&&e!==i.focus.key||WW(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=X();if(r&&Y(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){PU();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=GW(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=X();if(Y(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=VH(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Az(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=VH(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Az(t,n);let a=n.__key;i===r&&WW(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&UW(t),n!==null&&UW(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),Y(v)&&mU(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||K(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;GW()===r&&WW(n);let o=X();if(Y(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&_U(i,t,n,e,a),s!==null&&s.key===r&&_U(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function NH(e){return{forChild:HH(e.style),node:null}}function PH(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:HH(t.style,n?void 0:`bold`),node:null}}var FH=new WeakMap;function IH(e){if(!BG(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function LH(e){let t=e;e.parentElement===null&&K(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=FH.get(n))===void 0&&!IH(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)FH.set(r[e],i);return i}(t)!==null){let e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n];r===`
|
|
140
|
+
`||r===`\r
|
|
141
|
+
`?t.push(CH()):r===` `?t.push(WH()):r!==``&&t.push(VH(r))}return{node:t}}if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=RH(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=RH(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:VH(n)}}function RH(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,BG(n)){let e=n.style.display;if(e===``&&!WG(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(IW(n))return n;if(n.nodeName===`BR`)return null}}var zH={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function BH(e){let t=zH[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:HH(e.style,t),node:null}}function VH(e=``){return MG(new MH(e))}function J(e){return e instanceof MH}function HH(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>J(e)?(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}var UH=class e extends MH{static getType(){return`tab`}static clone(t){return new e(t.__key)}constructor(e){super(` `,e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=gG(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return WH().updateFromJSON(e)}setTextContent(e){return e!==` `&&e!==``&&jR(126),super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||K(286),this}setDetail(e){return e!==2&&K(127),this}setMode(e){return e!==`normal`&&K(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function WH(){return MG(new UH)}function GH(e){return e instanceof UH}var KH=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:BK(eq(GK(this,`next`)),eq(GK(e,`next`)))<0}getNode(){let e=KW(this.key);return e===null&&K(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,NU()||(GW()===a&&WW(e),i!==null&&(i.setCachedNodes(null),Y(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function qH(e,t,n){return new KH(e,t,n)}function JH(e,t){let n=t.__key,r=e.offset,i=`element`;if(J(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!Z(t)){let e=t.getNextSibling();if(J(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function YH(e,t){if(Z(t)){let n=t.getLastDescendant();Z(n)||J(n)?JH(e,n):JH(e,t)}else JH(e,t)}var XH=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!QH(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes(),n=t.length,r=t[n-1],i;if(J(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=KW(e);t!==null&&n.push(t)}return NU()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((X()||pU())===this&&e[0]){let t=DK(e[0],`next`);qK(RK(t,t))}for(let t of e)t.remove()}};function Y(e){return e instanceof ZH}var ZH=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Y(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=new Set;for(let n of e)if(CK(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;Z(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),SK(e.focus)&&Z(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=jK(e.focus.origin,`previous`);CK(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=NK(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!Z(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=eq(e.anchor),r=eq(e.anchor.getFlipped()),i=e=>xK(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(rq(YK(this),`next`));return NU()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=eU(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(Z(d)&&!d.isInline())l||(c+=`
|
|
142
|
+
`),l=!d.isEmpty();else if(l=!1,J(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else !nW(d)&&!wH(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=LU(),n=t.getEditorState()._selection,r=sU(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),Pz(this)}clone(){let t=this.anchor,n=this.focus;return new e(qH(t.key,t.offset,t.type),qH(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=zW(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=GR[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(CU(e))}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,a=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(a=n,o=t),a.type===`element`&&function(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=VH();if(o.setFormat(n),o.setStyle(r),mW(a))a.splice(0,0,[o]);else{let e=iW(i)?pW().append(o):o;a===null?i.append(e):a.insertBefore(e)}e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}(a,o,r,i),o.type===`element`&&KK(o,eq(GK(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];J(d)||K(26);let f=d.getTextContent().length,p=d.getParentOrThrow(),m=l[u-1];if(u===1&&o.type===`element`&&(c=f,o.set(a.key,c,`text`)),this.isCollapsed()&&s===f&&(FW(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling();if(J(t)&&t.canInsertTextBefore()&&!FW(t)||(t=VH(),t.setFormat(r),t.setStyle(i),p.canInsertTextAfter()?d.insertAfter(t):p.insertAfter(t)),t.select(0,0),d=t,e!==``)return void this.insertText(e)}else if(this.isCollapsed()&&s===0&&(FW(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling();if(J(t)&&!FW(t)||(t=VH(),t.setFormat(r),p.canInsertTextBefore()?d.insertBefore(t):p.insertBefore(t)),t.select(),d=t,e!==``)return void this.insertText(e)}else if(d.isSegmented()&&s!==f){let e=VH(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||Z(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),oU(this.anchor,this.focus),void this.insertText(e)}if(u===1){if(PW(d)){let t=VH(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(GH(d)){let t=VH(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=VH(e);if(t.setFormat(r),t.setStyle(i),t.select(),s===0)d.insertBefore(t,!1);else{let[e]=d.splitText(s);e.insertAfter(t,!1)}t.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null);return}d.setFormat(r),d.setStyle(i)}let a=c-s;d=d.spliceText(s,a,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{let t=new Set([...d.getParentKeys(),...m.getParentKeys()]),n=Z(d)?d:d.getParentOrThrow(),r=Z(m)?m:m.getParentOrThrow(),i=m;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline());if(o.type===`text`&&(c!==0||m.getTextContent()===``)||o.type===`element`&&m.getIndexWithinParent()<c)if(J(m)&&!PW(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=VH(m.getTextContent());m.replace(e),m=e}iW(o.getNode())||o.type!==`text`||(m=m.spliceText(0,c,``)),t.add(m.__key)}else{let e=m.getParentOrThrow();e.canBeEmpty()||e.getChildrenSize()!==1?m.remove():e.remove()}else t.add(m.__key);let a=r.getChildren(),p=new Set(l),h=n.is(r),g=n.isInline()&&d.getNextSibling()===null?n:d;for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.is(d)||Z(t)&&t.isParentOf(d))break;t.isAttached()&&(!p.has(t)||t.is(i)?h||g.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;e!==null;){let r=e.getChildren(),i=r.length;(i===0||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(PW(d))if(s===f)d.select();else{let t=VH(e);t.select(),d.replace(t)}else d=d.spliceText(s,f-s,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<u;e++){let n=l[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=X()===this;JK(this,$K(YK(this))),e&&X()!==this&&eG(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void WW(null);let n=this.getNodes(),r=[];for(let e of n)J(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(Z(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},a=r.length;if(a===0)return this.toggleFormat(e),WW(null),void i(t);let o=this.anchor,s=this.focus,c=this.isBackward(),l=c?s:o,u=c?o:s,d=0,f=r[0],p=l.type===`element`?0:l.offset;if(l.type===`text`&&p===f.getTextContentSize()&&(d=1,f=r[1],p=0),f==null)return;let m=f.getFormatFlags(e,t);i(m);let h=a-1,g=r[h],_=u.type===`text`?u.offset:g.getTextContentSize();if(f.is(g)){if(p===_)return;if(FW(f)||p===0&&_===f.getTextContentSize())f.setFormat(m);else{let e=f.splitText(p,_),t=p===0?e[0]:e[1];t.setFormat(m),l.type===`text`&&l.set(t.__key,0,`text`),u.type===`text`&&u.set(t.__key,_-p,`text`)}this.format=m;return}p===0||FW(f)||([,f]=f.splitText(p),p=0),f.setFormat(m);let v=g.getFormatFlags(e,m);_>0&&(_===g.getTextContentSize()||FW(g)||([g]=g.splitText(_)),g.setFormat(v));for(let t=d+1;t<h;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}l.type===`text`&&l.set(f.__key,p,`text`),u.type===`text`&&u.set(g.__key,_,`text`),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key===`root`){this.insertParagraph();let t=X();return Y(t)||K(134),t.insertNodes(e)}let t=(this.isBackward()?this.focus:this.anchor).getNode(),n=dK(t,qG),r=e[e.length-1];if(Z(n)&&`__language`in n){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=wU(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some(e=>(Z(e)||nW(e))&&!e.isInline())){Z(n)||K(211,t.constructor.name,t.getType());let i=wU(this);n.splice(i,0,e),r.selectEnd();return}let i=function(e){let t=pW(),n=null;for(let r=0;r<e.length;r++){let i=e[r],a=wH(i);if(a||nW(i)&&i.isInline()||Z(i)&&i.isInline()||J(i)||i.isParentRequired()){if(n===null&&(n=i.createParentElementNode(),t.append(n),a))continue;n!==null&&n.append(i)}else t.append(i),n=null}return t}(e),a=i.getLastDescendant(),o=i.getChildren(),s=!Z(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1],l=o[0];var u;Z(u=l)&&qG(u)&&!u.isEmpty()&&Z(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Z(n)||K(211,t.constructor.name,t.getType()),n.append(...l.getChildren()),l=o[1]),l&&(n===null&&K(212,t.constructor.name,t.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||K(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(n,l));let d=dK(a,qG);s&&Z(d)&&(s.canMergeWhenEmpty()||qG(c))&&(d.append(...s.getChildren()),s.remove()),Z(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let f=Z(n)?n.getLastChild():null;wH(f)&&d!==n&&f.remove()}insertParagraph(){if(this.anchor.key===`root`){let e=pW();return QW().splice(this.anchor.offset,0,[e]),e.select(),e}let e=wU(this),t=dK(this.anchor.getNode(),qG);Z(t)||K(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=CH();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=eU(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(J(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(J(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),J(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(EU(this,e,t,n))return;let r=e===`move`,i=LU(),a=LG(OG(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();if(s===null||o===null||!Z(c)||c.isInline()||c.canBeEmpty()||IG(o,i,s),this.dirty){let e=xG(i,this.anchor.key),t=xG(i,this.focus.key),n=e,r=t;if(this.anchor.type===`text`){let t=this.anchor.getNode();n=J(t)?QG(t,e,i):null}if(this.focus.type===`text`){let e=this.focus.getNode();r=J(e)?QG(e,t,i):null}n&&r&&vU(a,n,this.anchor.offset,r,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=a.getRangeAt(0),n=this.anchor.getNode(),i=iW(n)?n:kG(n);if(this.applyDOMRange(e),this.dirty=!0,!r){let n=this.getNodes(),r=[],o=!1;for(let e=0;e<n.length;e++){let t=n[e];EG(t,i)?r.push(t):o=!0}if(o&&r.length>0)if(t){let e=r[0];Z(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=r[r.length-1];Z(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}a.anchorNode===e.startContainer&&a.anchorOffset===e.startOffset||function(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}(this)}}n===`lineboundary`&&EU(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&Z(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(Z(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=IK(GK(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(CK(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(Z(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=eq(t);JK(this,RK(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(SK(t)){if(Z(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(nW(t.origin)){if(!t.origin.isIsolated())if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Z(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=dU();e.add(t.origin.getKey()),eG(e)}else t.origin.remove();return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(JK(this,RK(!t.origin.isEmpty()&&n.isEmpty()?XK(DK(n,t.direction)):r.anchor,t)),this.removeText())}}let i=this.focus;if(this.modify(`extend`,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&tU(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void rU(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void rU(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(nG(e)||nU(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&iW(e.getParent())&&e.getPreviousSibling()===null&&tU(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify(`extend`,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify(`extend`,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return NU()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function QH(e){return e instanceof XH}function $H(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function eU(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[$H(n),$H(r)]}function tU(e,t){for(let n=t;n;n=n.getParent()){if(Z(n)){if(n.collapseAtStart(e))return!0;if(AG(n))break}if(n.getPreviousSibling())break}return!1}var nU=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function rU(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function iU(e,t,n,r){let i,a=t,o=!1;if(BG(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),JW(e,r)!==void 0||e===r.getRootElement()||OW(e)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=tG(d),J(i))a=kK(i,s?`next`:`previous`);else{let c=tG(e);if(c===null)return null;if(Z(c)){let o=r.getElementByKey(c.getKey());o===null&&K(214);let l=XG(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),Z(c)||K(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(Z(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=Z(u)?u:u.getParentOrThrow()),a=0}J(u)?(i=u,c=null,a=kK(u,s?`next`:`previous`)):u!==c&&s&&!f&&(Z(c)||K(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=c.getIndexWithinParent(),i=r.getElementByKey(c.getKey()),o=`after`;if(i!==null&&tG(e)===c){let n=XG(c,i,r);n.element===i?t===0&&nW(c)&&(o=`before`):o=n.resolveLeafPosition(i,e,t)}a=o===`before`?n:n+1,c=c.getParentOrThrow()}if(Z(c))return[qH(c.__key,a,`element`),o]}}else i=tG(e);return J(i)?[qH(i.__key,kK(i,a,`clamp`),`text`),o]:null}function aU(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&Z(a)&&a.isInline()){let t=a.getPreviousSibling();J(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else Z(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):J(r)&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&Z(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&Z(a)&&a.isInline()&&!a.canInsertTextAfter()){let t=a.getNextSibling();J(t)&&e.set(t.__key,0,`text`)}}}function oU(e,t,n){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);aU(e,n,r),aU(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function sU(e,t,n,r,i,a){if(e===null||n===null||!AW(i,e,n))return null;let o=iU(e,t,Y(a)?a.anchor:null,i);if(o===null)return null;let s=iU(n,r,Y(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=tG(e),r=tG(n);if(nW(t)&&nW(r))return null}return oU(c,u),[c,u,l||d]}function cU(e){return Z(e)&&!e.isInline()}function lU(e,t,n,r,i,a){let o=IU(),s=new ZH(qH(e,t,i),qH(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function uU(){return new ZH(qH(`root`,0,`element`),qH(`root`,0,`element`),0,``)}function dU(){return new XH(new Set)}function fU(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!uz&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(Y(e)&&!c)return e.clone();if(t===null)return null;if(l=t.anchorNode,u=t.focusNode,d=t.anchorOffset,f=t.focusOffset,(s||o===void 0)&&Y(e)&&!AW(n,l,u))return e.clone();let p=sU(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(Y(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();J(e)?(_=e.getFormat(),v=e.getStyle()):Z(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new ZH(m,h,_,v);return g&&(y.dirty=!0),y}function X(){return IU()._selection}function pU(){return LU()._editorState._selection}function mU(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),hU(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}hU(e)}function hU(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!Z(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(J(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}return}if(Z(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(J(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(Z(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(J(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}function gU(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,J(i)?s=`text`:Z(i)&&(s=`element`)):(a=r.__key,J(r)?(o=r.getTextContentSize(),s=`text`):Z(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function _U(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function vU(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function yU(e,t,n){let r=xG(e,t.getKey());if(Z(t)){let i=XG(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function bU(e,t,n,r,i,a){let o=document.activeElement;if(i.has(`collaboration`)&&o!==a||o!==null&&kW(o))return;if(!Y(t))return void(e!==null&&AW(n,r.anchorNode,r.focusNode)&&r.removeAllRanges());let s=t.anchor,c=t.focus,l=s.getNode(),u=c.getNode(),[d,f]=yU(n,l,s.offset),[p,m]=yU(n,u,c.offset),h=t.format,g=t.style,_=t.isCollapsed(),v=d,y=p,b=!1;var x,S,C,w,T;if((s.type===`text`?(v=J(l)?QG(l,d,n):null,b=l.getFormat()!==h||l.getStyle()!==g):Y(e)&&e.anchor.type===`text`&&(b=!0),c.type===`text`&&(y=J(u)?QG(u,p,n):null),v!==null&&y!==null)&&(_&&(e===null||b||Y(e)&&(e.format!==h||e.style!==g))&&(x=h,S=g,C=f,w=s.key,T=performance.now(),RV=[x,S,C,w,T]),r.type===`Range`&&_||r.anchorOffset!==f||r.focusOffset!==m||r.anchorNode!==v||r.focusNode!==y||(o!==null&&a.contains(o)||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0}),s.type===`element`))){if(vU(r,v,f,y,m),!PR||!t.isCollapsed()||a===null||i.has(`skip-selection-focus`)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let e=Y(t)&&t.anchor.type===`element`?v.childNodes[f]||null:r.rangeCount>0?r.getRangeAt(0):null;if(e!==null){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=CG(n),i=DG(r);if(r===null||i===null)return;let{top:a,bottom:o}=t,s=0,c=0,l=n;for(;l!==null;){let t=l===r.body;if(t){let t=i.visualViewport;if(t){let e=t.offsetTop;s=e,c=e+t.height}else s=0,c=OG(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(s+=a),isFinite(o)&&(c-=o)}else{let e=l.getBoundingClientRect();s=e.top,c=e.bottom}let n=0;if(a<s?n=-(s-a):o>c&&(n=o-c),n!==0)if(t)i.scrollBy(0,n);else{let e=l.scrollTop;l.scrollTop+=n;let t=l.scrollTop-e;a-=t,o-=t}if(t)break;l=SG(l)}})(n,t,a)}}jV=!0}}function xU(e){let t=X()||pU();t===null&&(t=QW().selectEnd()),t.insertNodes(e)}function SU(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
143
|
+
`||n===`\r
|
|
144
|
+
`?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function CU(e){let t=[];return SU(e,{linebreak:()=>t.push(CH()),tab:()=>t.push(WH()),text:e=>t.push(VH(e))}),t}function wU(e){let t=e;e.isCollapsed()||t.removeText();let n=X();Y(n)&&(t=n),Y(t)||K(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!qG(i);){let e=i;if([i,a]=TU(i,a),e.is(i))break}return a}function TU(e,t){let n=e.getParent();if(!n){let e=pW();return QW().append(e),e.select(),[QW(),0]}if(J(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Z(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new ZH(qH(e.__key,t,`element`),qH(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function EU(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=GK(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!tq(c)){for(let e of c){l=!1;let{origin:t}=e;if(!nW(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of IK(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(CK(e))e.origin.isInline()||(c=e);else{if(Z(e.origin))continue;nW(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&nW(c.origin)&&c.origin.isKeyboardSelectable()){let e=dU();return e.add(c.origin.getKey()),eG(e),!0}return c=eq(c),s&&KK(e.anchor,c),KK(e.focus,c),l||!o}var DU=null,OU=null,kU=!1,AU=!1,jU=0,MU={characterData:!0,childList:!0,subtree:!0};function NU(){return kU||DU!==null&&DU._readOnly}function PU(){kU&&K(13)}function FU(){jU>99&&K(14)}function IU(){return DU===null&&K(195,RU()),DU}function LU(){return OU===null&&K(337,RU()),OU}function RU(){let e=0,t=new Set,n=xW.version;if(typeof window<`u`)for(let r of document.querySelectorAll(`[contenteditable]`)){let i=NW(r);if(jW(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function zU(){return OU}function BU(e,t,n){let r=t.__type,i=TW(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function VU(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function HU(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function UU(e){return WU(e,LU()._nodes)}function WU(e,t){let n=e.type,r=t.get(n);r===void 0&&K(17,n);let i=r.klass;e.type!==i.getType()&&K(18,i.name);let a=i.importJSON(e),o=e.children;if(Z(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=WU(o[e],t);a.append(n)}return a}function GU(e,t,n){let r=DU,i=kU,a=OU;DU=t,kU=!0,OU=e;try{return n()}finally{DU=r,kU=i,OU=a}}function KU(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(e._deferred.length>0&&YU(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=DU,u=kU,d=OU,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){OU=e,DU=n,kU=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=wB(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),AU)throw t;hW(e,null,r,n),yz(e),e._dirtyType=2,AU=!0,KU(e,a),AU=!1;return}finally{p.observe(r,MU),e._updating=f,DU=l,kU=u,OU=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags,y=e._deferred;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=XW(e)),delete r[a])}(e,n);let b=i?null:LG(OG(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){OU=e,DU=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&IG(t,e,r),bU(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(Y(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(document.activeElement)){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())FG(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&FG(t)){let n=t.getPreviousSibling();(n===null||FG(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=XG(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=document.createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=dq(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&IG(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,MU),OU=d,DU=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),Y(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(EB,void 0);let x=e._pendingDecorators;x!==null&&(e._decorators=x,e._pendingDecorators=null,qU(`decorator`,e,!0,x)),function(e,t,n){let r=ZW(t),i=ZW(n);r!==i&&qU(`textcontent`,e,!0,i)}(e,t||a,n),qU(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),YU(e,y),function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(e._cascadeCount++>99){e._updates=[],e._cascadeCount=0;try{K(343)}catch(t){t instanceof Error&&e._onError(t)}return}let n=t.shift();if(n){let[t,r]=n;ZU(e,t,r)}}(e)}function qU(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function JU(e,t,n,r){let i=rG(e),a;for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(QU(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{JU(a,t,n,r)}),!1}function YU(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function XU(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&K(191),a._flushSync=!0),o&&e._deferred.push(o),HU(e,i.tag)),a==null?ZU(e,n,i):n()}}return r}function ZU(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,HU(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=aW(c||s),l=!0),c._flushSync=o;let u=DU,d=kU,f=OU,p=e._updating;DU=c,kU=!1,e._updating=!0,OU=e;let m=e._headless||e.getRootElement()===null;CW(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=LG(OG(e));return Y(n)||n==null?fU(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=XU(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(Y(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);J(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Nz(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=GW(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);J(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Nz(r),r!==void 0&&VU(r,a)&&BU(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){jU++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&VU(c,a)&&BU(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,jU++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),XU(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(Z(t)&&lz(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of o)a.delete(e);for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(i.has(e)||n.delete(e),a.delete(e))}}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(Y(i)){let e=c._nodeMap,t=i.anchor.key,n=i.focus.key;e.get(t)!==void 0&&e.get(n)!==void 0||K(19)}else QH(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),KU(e);return}finally{DU=u,kU=d,OU=f,e._updating=p,jU=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,KU(e)):l&&DW(()=>{KU(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function QU(e,t,n){OU===e&&n===void 0?t():ZU(e,t,n)}var $U=class extends dH{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return JR[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=LU()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;t!==null;){if(J(t)&&e.push(t),Z(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Z(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Z(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return Z(e)&&e.getLastDescendant()||e||null}let r=t[e];return Z(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:KW(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&K(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:KW(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&K(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=``,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),Z(i)&&r!==n-1&&!i.isInline()&&(e+=UR)}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),Z(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=qR[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=GR[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return zW(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){PU();let n=X(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(J(e)||Z(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(J(e)||Z(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return Y(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):lU(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==``&&qR[e]||0,this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){lH(this)&&K(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||K(226,String(e),String(t),String(r));let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0)if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&K(100);let t=e.getNextSibling(),n=e.__key;HW(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,HW(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&K(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=X();if(Y(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;eW(r,t,n)&&gU(r,r.getNode(),this,l,c),eW(i,t,n)&&gU(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||AG(this)||this.remove()}}return i}getDOMSlot(e){return new tz(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(BG(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||AG(this)||this.getChildren().some(J)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=XG(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function Z(e){return e instanceof $U}function eW(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var tW=class extends dH{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function nW(e){return e instanceof tW}var rW=class e extends $U{__cachedText;static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){K(51)}getTextContent(){let e=this.__cachedText;return e===null||!NU()&&LU()._dirtyType!==0?super.getTextContent():e}remove(){K(52)}replace(e){K(53)}insertBefore(e){K(54)}insertAfter(e){K(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)Z(e)||nW(e)||K(282);return super.splice(e,t,n)}static importJSON(e){return QW().updateFromJSON(e)}collapseAtStart(){return!0}};function iW(e){return e instanceof rW}function aW(e){return new lW(sz(e._nodeMap))}function oW(){return new lW(new Map([[`root`,new rW]]))}function sW(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&K(130,n.name),Z(e)){let r=t.children;Array.isArray(r)||K(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=sW(i[e]);r.push(t)}}return t}function cW(e){return e instanceof lW}var lW=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return GU(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return GU(null,this,()=>({root:sW(QW())}))}},uW=class extends $U{static getType(){return`artificial`}createDOM(e){return document.createElement(`div`)}},dW=class e extends $U{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`p`),n=gG(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:fW,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(BG(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return pW().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(J);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=pW();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||J(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function fW(e){let t=pW();if(oK(t,e),iK(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in qR&&t.setFormat(n)}return aK(t,e),{node:t}}function pW(){return MG(new dW)}function mW(e){return e instanceof dW}function hW(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=oW(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(e._updateTags=new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null;let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``),n!==null&&(n.textContent=``,a.set(`root`,n))}function gW(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=lK(r),i=r.transform;if(!n.has(i)){n.add(i);let e=r.transform();e&&t.add(e)}if(e){let n=e.$transform;n&&t.add(n),r=e.extends}else{let e=Object.getPrototypeOf(r);r=e.prototype instanceof dH&&e!==dH?e:void 0}}return t}var _W={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=EW(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>Z(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$shouldExclude:(e,t,n)=>Z(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function vW(e){let t=e||{},n=zU(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=oW(),s=t.namespace||(i===null?iG():i._config.namespace),c=t.editorState,l=[rW,MH,xH,UH,dW,uW,...t.nodes||[]],{onError:u,html:d}=t,f=t.editable===void 0||t.editable,p;if(e===void 0&&n!==null)p=n._nodes;else{p=new Map;for(let e=0;e<l.length;e++){let t=l[e],n=null,r=null;if(typeof t!=`function`){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}lK(t);let i=t.getType(),a=gW(t);p.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:Sz(l[e]),transforms:a})}}let m=new xW(o,i,p,{disableEvents:a,dom:{..._W,...e&&e.dom},namespace:s,theme:r},u||console.error,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(p,d?d.import:void 0),f,e);return c!==void 0&&(m._pendingEditorState=c,m._dirtyType=2),function(e){e.registerCommand(kB,JV,0),e.registerCommand(AB,YV,0),e.registerCommand(jB,XV,0),e.registerCommand(MB,ZV,0),e.registerCommand(WB,$V,0)}(m),m}function yW(e,t){let n=e.get(t);e.delete(t),n&&n()}function bW(e,t,n){return e.set(t,n),yW.bind(null,e,t)}var xW=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,a,o,s){this._createEditorArgs=s,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new cz,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=iG(),this._onError=i,this._htmlConversions=a,this._editable=o,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return bW(this._listeners.update,e)}registerEditableListener(e){return bW(this._listeners.editable,e)}registerDecoratorListener(e){return bW(this._listeners.decorator,e)}registerTextContentListener(e){return bW(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return mq(bW(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&K(35);let r=this._commands;r.has(e)||r.set(e,[new az,new az,new az,new az,new az]);let i=r.get(e);i===void 0&&K(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&K(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=tK(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=tK(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=KW(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:pH}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Q(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=gG(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,hW(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||aH(t),n!=null&&t.classList.remove(...n)),e!==null){let t=DG(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,yz(this),this._updateTags.add(pH),KU(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;kV.set(e,n);let r=AV.get(n)??0;r<1&&n.addEventListener(`selectionchange`,nH),AV.set(n,r+1),e.__lexicalEditor=t;let i=eH(e);for(let n=0;n<SV.length;n++){let[r,a]=SV[n],o=typeof a==`function`?e=>{iH(e)||(rH(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(iH(e))return;rH(e);let n=t.isEditable();switch(r){case`cut`:return n&&Q(t,fV,e);case`copy`:return Q(t,dV,e);case`paste`:return n&&Q(t,LB,e);case`dragstart`:return n&&Q(t,cV,e);case`dragover`:return n&&Q(t,lV,e);case`dragend`:return n&&Q(t,uV,e);case`focus`:return n&&Q(t,vV,e);case`blur`:return n&&Q(t,yV,e);case`drop`:return n&&Q(t,oV,e)}};e.addEventListener(r,o),i.push(()=>{e.removeEventListener(r,o)})}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(pH),KU(this);qU(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&K(38);let n=e;n._readOnly&&(n=aW(e),n._selection=e._selection?e._selection.clone():null),vz(this);let r=this._pendingEditorState,i=this._updateTags,a=t===void 0?null:t.tag;r===null||r.isEmpty()||(a!=null&&i.add(a),KU(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||KU(this)}parseEditorState(e,t){return function(e,t,n){let r=oW(),i=DU,a=kU,o=OU,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,DU=r,kU=!1,OU=t,CW(null);try{let i=t._nodes;WU(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,DU=i,kU=a,OU=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(e){return KU(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):ZU(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),QU(this,()=>{let r=X(),i=QW();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||eG(r.clone()),wG(`focus`),TG(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=LG(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,qU(`editable`,this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};xW.version=iz;var SW=null;function CW(e){SW=e}var wW=1;function TW(e,t){let n=EW(e,t);return n===void 0&&K(30,t),n}function EW(e,t){return e._nodes.get(t)}var DW=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function OW(e){return nW(YW(e))}function kW(e){let t=document.activeElement;if(!BG(t))return!1;let n=t.nodeName;return nW(YW(e))&&(n===`INPUT`||n===`TEXTAREA`||t.contentEditable===`true`&&NW(t)==null)}function AW(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!kW(t)&&MW(t)===e}catch{return!1}}function jW(e){return e instanceof xW}function MW(e){let t=e;for(;t!=null;){let e=NW(t);if(jW(e))return e;t=SG(t)}return null}function NW(e){return e?e.__lexicalEditor:null}function PW(e){return GH(e)||e.isToken()}function FW(e){return PW(e)||e.isSegmented()}function IW(e){return VG(e)&&e.nodeType===3}function LW(e){return VG(e)&&e.nodeType===9}function RW(e){let t=e;for(;t!=null;){if(IW(t))return t;t=t.firstChild}return null}function zW(e,t,n){let r=GR[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~GR.superscript:t===`superscript`?i&=~GR.subscript:t===`lowercase`?(i&=~GR.uppercase,i&=~GR.capitalize):t===`uppercase`?(i&=~GR.lowercase,i&=~GR.capitalize):t===`capitalize`&&(i&=~GR.lowercase,i&=~GR.uppercase),i}function BW(e){return J(e)||wH(e)||nW(e)}function VW(e,t){let n=function(){let e=SW;return SW=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);PU(),FU();let r=LU(),i=IU(),a=``+ wW++;i._nodeMap.set(a,e),Z(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function HW(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function UW(e){FU(),lH(e)&&K(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=IU(),i=LU(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),Z(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function WW(e){PU();let t=LU(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=KW(n);e!==null&&e.getWritable()}if(e!==null){let t=KW(e);t!==null&&t.getWritable()}}}function GW(){return NU()?null:LU()._compositionKey}function KW(e,t){let n=(t||IU())._nodeMap.get(e);return n===void 0?null:n}function qW(e,t){let n=JW(e,LU());return n===void 0?null:KW(n,t)}function JW(e,t){return e[`__lexicalKey_${t._key}`]}function YW(e,t){let n=e;for(;n!=null;){let e=qW(n,t);if(e!==null)return e;n=SG(n)}return null}function XW(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function ZW(e){return e.read(()=>QW().getTextContent())}function QW(){return $W(IU())}function $W(e){return e._nodeMap.get(`root`)}function eG(e){PU();let t=IU();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function tG(e){let t=LU(),n=function(e,t){let n=e;for(;n!=null;){let e=JW(n,t);if(e!==void 0)return e;n=SG(n)}return null}(e,t);return n===null?e===t.getRootElement()?KW(`root`):null:KW(n)}function nG(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function rG(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function iG(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function aG(e){return IW(e)?e.nodeValue:null}function oG(e,t,n){let r=LG(OG(t));if(r===null)return;let i=r.anchorNode,{anchorOffset:a,focusOffset:o}=r;if(i!==null){let t=aG(i),r=YW(i);if(t!==null&&J(r)){if((t===HR||t===WR)&&n){let e=n.length;t=n,a=e,o=e}t!==null&&sG(r,t,a,o,e)}}}function sG(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=t;if((o||i)&&(t.endsWith(HR)&&(s=t.slice(0,-HR.length)),i)){let e=WR,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){if(s===``){if(WW(null),RR||IR||VR)a.remove();else{let e=LU();setTimeout(()=>{e.update(()=>{a.isAttached()&&a.remove()})},20)}return}let t=a.getParent(),i=pU(),c=a.getTextContentSize(),l=GW(),u=a.getKey();if(a.isToken()||l!==null&&u===l&&!o||Y(i)&&(t!==null&&!t.canInsertTextBefore()&&i.anchor.offset===0||i.anchor.key===e.__key&&i.anchor.offset===0&&!a.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!a.canInsertTextAfter()&&!o))return void a.markDirty();let d=X();if(!Y(d)||n===null||r===null)return void cG(a,s,d);if(d.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=VH(a.getTextContent());a.replace(e),a=e}cG(a,s,d)}}}function cG(e,t,n){if(e.setTextContent(t),Y(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=kK(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function lG(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function uG(e,t){return lG(e,t,`altKey`)&&lG(e,t,`ctrlKey`)&&lG(e,t,`shiftKey`)&&lG(e,t,`metaKey`)}function dG(e,t,n){if(!uG(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith(`Digit`)&&/^\d$/.test(t))return e.code===`Digit${t}`;let r=`Key`+t.toUpperCase();return e.code===r}var fG={ctrlKey:!NR,metaKey:NR},pG={altKey:NR,ctrlKey:!NR};function mG(e){return e.key===`Backspace`}function hG(e){let t=QW();if(Y(e)){let t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),Pz(e),e}{let e=t.select(0,t.getChildrenSize());return eG(Pz(e)),e}}function gG(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=dq(i);return n[t]=e,e}return i}function _G(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&K(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function vG(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function yG(e,t){let n=e.offset;if(e.type===`element`)return vG(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?vG(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function bG(e){let t=OG(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function Q(e,t,n){return JU(e,t,n,e)}function xG(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&K(75,t),n}function SG(e){let t=e.assignedSlot||e.parentElement;return HG(t)?t.host:t}function CG(e){return LW(e)?e:BG(e)?e.ownerDocument:null}function wG(e){PU(),LU()._updateTags.add(e)}function TG(e){PU(),LU()._deferred.push(e)}function EG(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function DG(e){let t=CG(e);return t?t.defaultView:null}function OG(e){let t=e._window;return t===null&&K(78),t}function kG(e){let t=e.getParentOrThrow();for(;t!==null;){if(AG(t))return t;t=t.getParentOrThrow()}return t}function AG(e){return iW(e)||Z(e)&&e.isShadowRoot()}function jG(e,t=!1){let n=e.constructor.clone(e);return VW(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function MG(e){let t=LU(),n=e.getType(),r=EW(t,n);r===void 0&&K(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||K(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||K(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&K(203,e.constructor.name,n,r.name,r.getType()),t}return e}function NG(e,t){!iW(e.getParent())||Z(t)||nW(t)||K(99)}function PG(e){let t=KW(e);return t===null&&K(63,e),t}function FG(e){return(nW(e)||Z(e)&&!e.canBeEmpty())&&!e.isInline()}function IG(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function LG(e){return MR?(e||window).getSelection():null}function RG(e){let t=DG(e);return t?t.getSelection():null}function zG(e){return BG(e)&&e.tagName===`A`}function BG(e){return VG(e)&&e.nodeType===1}function VG(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function HG(e){return VG(e)&&e.nodeType===11}var UG=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function WG(e){return!(!BG(e)||!e.style.display.startsWith(`inline`))||UG.test(e.nodeName)}var GG=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function KG(e){return(!BG(e)||!e.style.display.startsWith(`inline`))&&GG.test(e.nodeName)}function qG(e){if(nW(e)&&!e.isInline())return!0;if(!Z(e)||AG(e))return!1;let t=e.getFirstChild(),n=t===null||wH(t)||J(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function JG(){return LU()}function YG(e=JG()){return e._config.dom||_W}function XG(e,t,n=JG()){let r=YG(n).$getDOMSlot(e,t,n);return Z(e)&&(ZG(r)||K(344,e.getKey(),e.getType())),r}function ZG(e){return e instanceof tz}function QG(e,t,n=JG()){return RW(XG(e,t,n).element)}var $G=new WeakMap,eK=new Map;function tK(e){if(!e._readOnly&&e.isEmpty())return eK;e._readOnly||K(192);let t=$G.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),$G.set(e,t)),t}function nK(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function rK(e){return(t=nK(e))[cH]=!0,t;var t}function iK(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function aK(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function oK(e,t){let n=t.style.textAlign;return n&&n in qR?e.setFormat(n):e}function sK(e){return!0===e.__lexicalUnmanaged}function cK(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==dH[t]}function lK(e){let t=ZR in e.prototype?e.prototype[ZR]():void 0,n=function(e){if(!(e===dH||e.prototype instanceof dH)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{xW.version&&(n=JSON.parse(xW.version))}catch{}K(290,e.name,t,n)}return e===tW||e===$U||e===dH}(e),r=!n&&cK(e,`getType`)?e.getType():void 0,i,a=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))a=e,i=n;if(!n&&a&&(cK(e,`getType`)||(e.getType=()=>a),cK(e,`clone`)||(e.clone=t=>(CW(t),new e)),cK(e,`importJSON`)||(e.importJSON=i&&i.$importJSON||(t=>new e().updateFromJSON(t))),!cK(e,`importDOM`)&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:a}}function uK(e){let t=JG();return PU(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var dK=(e,t)=>{let n=e;for(;n!=null&&!iW(n);){if(t(n))return n;n=n.getParent()}return null};function fK(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?KW(r):t.get(r);e??K(174),n.push(r),r=e.__next}return n}var pK={next:`previous`,previous:`next`},mK=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return zK({hasNext:SK,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return DK(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return DK(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&K(263,Array.from(o).join(` `))}else i.insert(e);i=DK(e,this.direction)}for(let e of o.values())e.remove();return this}},hK=class e extends mK{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:jK(e,this.direction)}getParentCaret(e=`root`){return DK(vK(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=_K(this.direction);return DK(this.getNodeAtCaret(),e)||jK(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},gK={root:iW,shadowRoot:AG};function _K(e){return pK[e]}function vK(e,t=`root`){return gK[t](e)?null:e}var yK=class e extends mK{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:DK(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Z(this.origin)?jK(this.origin,this.direction):null}getParentCaret(e=`root`){return DK(vK(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=_K(this.direction);return DK(this.getNodeAtCaret(),e)||jK(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof bK)&&this.direction===t.direction&&this.origin.is(t.origin)}},bK=class e extends mK{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:OK(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return DK(vK(this.getParentAtCaret(),e),this.direction)}getFlipped(){return OK(this.origin,_K(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof yK||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return DK(this.origin,this.direction)}};function xK(e){return e instanceof bK}function SK(e){return e instanceof yK}function CK(e){return e instanceof hK}var wK={next:class extends bK{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends bK{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},TK={next:class extends yK{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends yK{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},EK={next:class extends hK{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends hK{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function DK(e,t){return e?new TK[t](e):null}function OK(e,t,n){return e?new wK[t](e,kK(e,n)):null}function kK(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&jR(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function AK(e,t){return new FK(e,t)}function jK(e,t){return Z(e)?new EK[t](e):null}function MK(e){return e&&e.getChildCaret()||e}function NK(e){return e&&MK(e.getAdjacentCaret())}var PK=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return xK(t)?function(e,t){let{direction:n,origin:r}=e;return AK(e,kK(r,t===`focus`?_K(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[AK(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=xK(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=xK(n),i=t=>t.isSameNodeCaret(n)?null:NK(t)||t.getParentCaret(e);return zK({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},FK=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return OK(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function IK(e){return RK(e,DK(QW(),e.direction))}function LK(e){return RK(e,e)}function RK(e,t){return e.direction!==t.direction&&K(265),new PK(e,t,e.direction)}function zK(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function BK(e,t){let n=WK(e.origin,t.origin);switch(n===null&&K(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return VK(n)}}function VK(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function HK(e,t){return t.is(e)}function UK(e){return Z(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function WK(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=UK(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=UK(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(HK(e,r)||K(276),{commonAncestor:r,type:`ancestor`}):i===null?(HK(t,r)||K(277),{commonAncestor:r,type:`descendant`}):((Z(a)||HK(e,a))&&(Z(i)||HK(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||K(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function GK(e,t){let{type:n,key:r,offset:i}=e,a=PG(e.key);return n===`text`?(J(a)||K(266,a.getType(),r),OK(a,t,i)):(Z(a)||K(267,a.getType(),r),iq(a,e.offset,t))}function KK(e,t){let{origin:n,direction:r}=t,i=r===`next`;xK(t)?e.set(n.getKey(),t.offset,`text`):SK(t)?J(n)?e.set(n.getKey(),kK(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(CK(t)&&Z(n)||K(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function qK(e){let t=X(),n=Y(t)?t:uU();return JK(n,e),eG(n),n}function JK(e,t){KK(e.anchor,t.anchor),KK(e.focus,t.focus)}function YK(e){let{anchor:t,focus:n}=e,r=GK(t,`next`),i=GK(n,`next`),a=BK(r,i)<=0?`next`:`previous`;return RK(nq(r,a),nq(i,a))}function XK(e){let{direction:t,origin:n}=e,r=DK(n,_K(t)).getNodeAtCaret();return r?DK(r,t):jK(n.getParentOrThrow(),t)}function ZK(e,t=`root`){let n=[e];for(let r=CK(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(XK(r));return n}function QK(e){return!!e&&e.origin.isAttached()}function $K(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=rq(e,r),o=ZK(a.anchor,n),s=ZK(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(CK(e))c.add(e.origin.getKey());else if(SK(e)){let{origin:t}=e;Z(t)&&!c.has(t.getKey())||l.push(t)}for(let e of l)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=XK(DK(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=VH(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=OK(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let u,d;for(let e of o)if(QK(e)){u=eq(e);break}for(let e of s)if(QK(e)){d=eq(e);break}let f=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c;for(c=0;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(AG(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,qG),d=u&&l(o,e=>n.has(e.getKey())&&qG(e));return u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;jK(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}let p=[u,d,...o,...s].find(QK);if(p)return LK(nq(eq(p),e.direction));K(269,JSON.stringify(o.map(e=>e.origin.__key)))}function eq(e){let t=function(e){let t=e;for(;CK(t);){let e=NK(t);if(!CK(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(J(t.origin))return xK(t)?t:OK(t.origin,n,n);let r=t.getAdjacentCaret();return SK(r)&&J(r.origin)?OK(r.origin,n,_K(n)):t}function tq(e){return xK(e)&&e.offset!==kK(e.origin,e.direction)}function nq(e,t){return e.direction===t?e:e.getFlipped()}function rq(e,t){return e.direction===t?e:RK(nq(e.focus,t),nq(e.anchor,t))}function iq(e,t,n){let r=jK(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return nq(r,n)}function aq(e){let{origin:t,offset:n,direction:r}=e;if(n===kK(t,r))return e.getSiblingCaret();if(n===kK(t,_K(r)))return XK(e.getSiblingCaret());let[i]=t.splitText(n);return J(i)||K(281),nq(DK(i,`next`),r)}function oq(e,t){return!0}function sq(e,{$copyElementNode:t=jG,$splitTextPointCaretNext:n=aq,rootMode:r=`shadowRoot`,$shouldSplit:i=oq,removeEmptyDestination:a=!1}={}){if(xK(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(CK(e)){let e=XK(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}return o}function cq(e){return e}function lq(e){return e}function uq(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function dq(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function fq(e,...t){let n=dq(...t);n.length>0&&e.classList.add(...n)}function pq(e,...t){let n=dq(...t);n.length>0&&e.classList.remove(...n)}function mq(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var hq=2;function gq(e,t,n){let r=n.theme.heading;if(!r)return;let i=r[`h${t}`];if(typeof i==`string`){let t=dq(i);t.length>0&&fq(e,...t)}}function _q(e,t){let n=yq(t);if(e.style?.textAlign&&n.setFormat(e.style.textAlign),iK(e,n),n.getFormatType()===``){let t=e.getAttribute(`align`);(t===`left`||t===`center`||t===`right`||t===`justify`||t===`start`||t===`end`)&&n.setFormat(t)}return n}var vq=class e extends dW{__level;static getType(){return`survey-rich-text-heading`}static clone(t){return new e(t.__level,t.__key)}constructor(e=hq,t){super(t),this.__level=e}getHeadingLevel(){return this.getLatest().__level}createDOM(e){let t=document.createElement(`h${this.__level}`);return gq(t,this.__level,e),t}updateDOM(e){return e.__level!==this.__level}static importDOM(){return{h1:()=>({conversion:e=>({node:_q(e,1)})}),h2:()=>({conversion:e=>({node:_q(e,2)})}),h3:()=>({conversion:e=>({node:_q(e,3)})}),h4:()=>({conversion:e=>({node:_q(e,4)})}),h5:()=>({conversion:e=>({node:_q(e,5)})}),h6:()=>({conversion:e=>({node:_q(e,6)})})}}exportDOM(e){let t=document.createElement(`h${this.__level}`);return this.getFormatType()&&(t.style.textAlign=this.getFormatType()),{element:t}}static importJSON(e){return yq(e.level>=1&&e.level<=6?e.level:hq).updateFromJSON(e)}exportJSON(){let t=super.exportJSON();return t.type=e.getType(),t.level=this.__level,t}collapseAtStart(){let e=pW();return e.setTextFormat(this.getTextFormat()),e.setTextStyle(this.getTextStyle()),e.setDirection(this.getDirection()),e.setFormat(this.getFormatType()),e.setStyle(this.getStyle()),e.setIndent(this.getIndent()),this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}insertNewAfter(e,t){let n=pW();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}};function yq(e=hq){return MG(new vq(e))}function bq(e){return e instanceof vq}function xq(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Sq(e){let t=``;for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Cq(e){let t=JG().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function wq(e){return Cq(iW(e)?e:e.getParentOrThrow())}function Tq(e){let t=wq(e);return t!==null&&t.direction===`rtl`}function Eq(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!FW(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=eU(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=rK(t)),t.__text=p)}}return t}function Dq(e,t){(Y(e)?e.isCollapsed():J(e)||Z(e))||xq(280);let n=vH(Y(e)?e.style:J(e)?e.getStyle():e.getTextStyle()),r=Sq(Object.entries(t).reduce((t,[r,i])=>(typeof i==`function`?t[r]=i(n[r],e):i===null?delete t[r]:t[r]=i,t),{...n}));Y(e)||J(e)?e.setStyle(r):e.setTextStyle(r)}function Oq(e,t){if(Y(e)&&e.isCollapsed()){Dq(e,t);let n=e.anchor.getNode();Z(n)&&n.isEmpty()&&Dq(n,t)}kq(e=>{Dq(e,t)});let n=e.getNodes();if(n.length>0){let e=new Set;for(let r of n){if(!Z(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let n=r.getKey();e.has(n)||(e.add(n),Dq(r,t))}}}function kq(e){let t=X();if(!t)return;let n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(Y(t))for(let e of YK(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());let i=t.getNodes();for(let t of i){if(!J(t)||!t.canHaveFormat())continue;let[n,i]=r(t);i!==n&&(FW(t)||n===0&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[n===0?0:1]))}Y(t)&&t.anchor.type===`text`&&t.focus.type===`text`&&t.anchor.key===t.focus.key&&Aq(t)}function Aq(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:r,offset:i,type:a}=t;t.set(n.key,n.offset,n.type),n.set(r,i,a)}}function jq(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Mq(e,t,n=jq){if(!e)return;let r=e.getStartEndPoints(),i=!1,a=null,o=new Map;if(r){let[e,t]=r,n=dK(e.getNode(),qG);a=dK(t.getNode(),qG),i=Z(a)&&!a.is(n)&&function(e,t){if(e.offset!==0)return!1;let n=e.getNode();if(Z(n)&&n.isEmpty())return!1;for(;!n.is(t);){if(n.getPreviousSibling()!==null)return!1;let e=n.getParent();if(e===null)return!1;n=e}return!0}(t,a),Z(n)&&o.set(n.getKey(),n),Z(a)&&!i&&o.set(a.getKey(),a)}for(let t of e.getNodes())if(Z(t)&&qG(t)){if(i&&t.is(a))continue;o.set(t.getKey(),t)}else if(!r){let e=dK(t,qG);Z(e)&&o.set(e.getKey(),e)}for(let e of o.values()){let r=t();n(e,r),e.replace(r,!0)}}function Nq(e){let t=Pq(e);return t!==null&&t.writingMode===`vertical-rl`}function Pq(e){let t=e.anchor.getNode();return Z(t)?Cq(t):wq(t)}function Fq(e,t){let n=Nq(e)?!t:t;Lq(e)&&(n=!n);let r=GK(e.focus,n?`previous`:`next`);if(tq(r))return!1;for(let e of IK(r)){if(CK(e))return!e.origin.isInline();if(!Z(e.origin)){if(nW(e.origin))return!0;break}}return!1}function Iq(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Lq(e){let t=Pq(e);return t!==null&&t.direction===`rtl`}function Rq(e,t,n){let r=Lq(e),i;i=Nq(e)||r?!n:n,Iq(e,t,i,`character`)}function zq(e,t,n){let r=vH(e.getStyle());return r!==null&&r[t]||n}function Bq(e,t,n=``){let r=null,i=e.getNodes(),a,o;if(Y(e)){if(e.isCollapsed()&&e.style!==``){let n=vH(e.style);if(n!==null&&t in n)return n[t]}let{anchor:n,focus:r}=e,i=e.isBackward(),s=i?r.getNode():n.getNode(),c=i?n.getNode():r.getNode(),l=i?r.offset:n.offset,u=i?n.offset:r.offset;J(s)&&l===s.getTextContentSize()&&(a=s),u===0&&(o=c)}for(let e=0;e<i.length;e++){let s=i[e];if(J(s)&&!s.is(e===0?a:o)){let e=zq(s,t,n);if(r===null)r=e;else if(r!==e){r=``;break}}}return r===null?n:r}function Vq(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Hq(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function Uq(e){let t=dK(e,e=>Z(e)&&!e.isInline());return Z(t)||Vq(4,e.__key),t}function Wq(e){let t=X()||pU(),n;if(Y(t))n=GK(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=DK(r,`next`))}n||=jK(QW(),`previous`).getFlipped().insert(pW())}let r=Gq(e,n),i=NK(r);return qK(LK(CK(i)?eq(i):r)),e.getLatest()}function Gq(e,t,n){let r=nq(t,`next`);xK(r)&&(r.offset===0?r=DK(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=DK(r.origin,`next`))),r.origin.is(e)&&(SK(r)||Vq(342,e.getKey(),e.getType()),r=XK(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=sq(e,n))r=e;return xK(r)&&Vq(283),r.insert(e.isInline()?pW().append(e):e),nq(DK(e.getLatest(),`next`),t.direction)}function Kq(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function qq(e){let t=X();if(!Y(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=dK(i,e=>Z(e)&&!e.isInline());if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}var Jq=Symbol.for(`preact-signals`);function Yq(){if(eJ>1)return void eJ--;let e,t=!1;for(function(){let e=$q;for($q=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();Zq!==void 0;){let n=Zq;for(Zq=void 0,tJ++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&sJ(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(tJ=0,eJ--,t)throw e}var Xq,Zq;function Qq(e){let t=Xq;Xq=void 0;try{return e()}finally{Xq=t}}var $q,eJ=0,tJ=0,nJ=0,rJ=0;function iJ(e){if(Xq===void 0)return;let t=e.n;return t===void 0||t.t!==Xq?(t={i:0,S:e,p:Xq.s,n:void 0,t:Xq,e:void 0,x:void 0,r:t},Xq.s!==void 0&&(Xq.s.n=t),Xq.s=t,e.n=t,32&Xq.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Xq.s,t.n=void 0,Xq.s.n=t,Xq.s=t),t):void 0}function aJ(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function oJ(e,t){return new aJ(e,t)}function sJ(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function cJ(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function lJ(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function uJ(e,t){aJ.call(this,void 0),this.x=e,this.s=void 0,this.g=rJ-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function dJ(e){let t=e.m;if(e.m=void 0,typeof t==`function`){eJ++;let n=Xq;Xq=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,fJ(e),t}finally{Xq=n,Yq()}}}function fJ(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,dJ(e)}function pJ(e){if(Xq!==this)throw Error(`Out-of-order effect`);lJ(this),Xq=e,this.f&=-2,8&this.f&&fJ(this),Yq()}function mJ(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function hJ(e,t){let n=new mJ(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}aJ.prototype.brand=Jq,aJ.prototype.h=function(){return!0},aJ.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?Qq(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},aJ.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Qq(()=>{var e;(e=this.Z)==null||e.call(this)}))}},aJ.prototype.subscribe=function(e){return hJ(()=>{let t=this.value,n=Xq;Xq=void 0;try{e(t)}finally{Xq=n}},{name:`sub`})},aJ.prototype.valueOf=function(){return this.value},aJ.prototype.toString=function(){return this.value+``},aJ.prototype.toJSON=function(){return this.value},aJ.prototype.peek=function(){let e=Xq;Xq=void 0;try{return this.value}finally{Xq=e}},Object.defineProperty(aJ.prototype,`value`,{get(){let e=iJ(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(tJ>100)throw Error(`Cycle detected`);(function(e){eJ!==0&&tJ===0&&e.l!==nJ&&(e.l=nJ,$q={S:e,v:e.v,i:e.i,o:$q})})(this),this.v=e,this.i++,rJ++,eJ++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Yq()}}}}),uJ.prototype=new aJ,uJ.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rJ))return!0;if(this.g=rJ,this.f|=1,this.i>0&&!sJ(this))return this.f&=-2,!0;let e=Xq;try{cJ(this),Xq=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Xq=e,lJ(this),this.f&=-2,!0},uJ.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}aJ.prototype.S.call(this,e)},uJ.prototype.U=function(e){if(this.t!==void 0&&(aJ.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},uJ.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(uJ.prototype,`value`,{get(){if(1&this.f)throw Error(`Cycle detected`);let e=iJ(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),mJ.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},mJ.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,dJ(this),cJ(this),eJ++;let e=Xq;return Xq=this,pJ.bind(this,e)},mJ.prototype.N=function(){2&this.f||(this.f|=2,this.u=Zq,Zq=this)},mJ.prototype.d=function(){this.f|=8,1&this.f||fJ(this)},mJ.prototype.dispose=function(){this.d()};function gJ(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}xz(`format`,{parse:e=>typeof e==`number`?e:0});function _J(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vJ;try{vJ=`0.45.0+prod.esm`}catch{}var yJ=vJ??`0.45.0+source`;function bJ(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)n[e]=bJ(n[e],r[e]);return e}return t}var xJ=0,SJ=1,CJ=2,wJ=3,TJ=4,EJ=5,DJ=6,OJ=7;function kJ(e){return e.id===xJ}function AJ(e){return e.id===CJ}function jJ(e){return function(e){return e.id===SJ}(e)||_J(305,String(e.id),String(SJ)),Object.assign(e,{id:CJ})}var MJ=new Set,NJ=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:xJ}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):uq;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;AJ(t)||_J(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:wJ,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:TJ,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==TJ&&_J(307,String(t.id),String(EJ)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:EJ,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==EJ&&_J(308,String(n.id),String(EJ));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:DJ})}(n),()=>{let e=this.state;e.id!==OJ&&_J(309,String(n.id),String(OJ)),this.state=function(e){return Object.assign(e,{id:EJ})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==DJ&&_J(310,String(t.id),String(DJ)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:OJ})}(t),n}getSignal(){return this._signal===void 0&&_J(311),this._signal}getInitResult(){this.extension.init===void 0&&_J(312,this.extension.name);let e=this.state;return function(e){return e.id>=TJ}(e)||_J(313,String(e.id),String(TJ)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=wJ}(e)||_J(314,String(e.id),String(wJ)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&_J(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&_J(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=OJ}(e)||_J(316,String(e.id),String(OJ)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||MJ}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=EJ})(e)||_J(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},PJ={tag:pH};function FJ(){let e=QW();e.isEmpty()&&e.append(pW())}var IJ=cq({config:lq({setOptions:PJ,updateOptions:PJ}),init:({$initialEditorState:e=FJ})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(cW(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[rW,MH,xH,UH,dW]}),LJ=Symbol.for(`@lexical/extension/LexicalBuilder`);function RJ(){}function zJ(e){throw e}function BJ(e){return Array.isArray(e)?e:[e]}var VJ=yJ,HJ=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=VJ,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[BJ(IJ)];for(let e of t)n.push(BJ(e));return new e(n)}static maybeFromEditor(t){let n=t[LJ];return n&&(n.PACKAGE_VERSION!==VJ&&_J(292,n.PACKAGE_VERSION,VJ),n instanceof e||_J(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&_J(294),n}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(vW({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[LJ]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=RJ;function t(){try{e()}finally{e=RJ}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=mq(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&_J(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&_J(296);let[t]=BJ(e);typeof t.name!=`string`&&_J(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&_J(298,t.name),!n){n=new NJ(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&_J(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&_J(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=BJ(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(AJ(i))return;let a=n.extension.name;var o;kJ(i)||_J(300,a,r||`[unknown]`),kJ(o=i)||_J(304,String(o.id),String(xJ)),i=Object.assign(o,{id:SJ}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=jJ(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())kJ(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&_J(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return mq(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of gJ(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&_J(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&bJ(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=zJ,e}};function UJ(e,t){let n=HJ.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function WJ(e){return UJ(JG(),e)}var GJ=q(`INSERT_HORIZONTAL_RULE_COMMAND`),KJ=class e extends tW{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return JJ().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:qJ,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return fq(t,e.theme.hr),t}getTextContent(){return`
|
|
145
|
+
`}isInline(){return!1}updateDOM(){return!1}};function qJ(){return{node:JJ()}}function JJ(){return uK(KJ)}function YJ(e){return e instanceof KJ}Date.now;function XJ(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ZJ;function QJ(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function $J(e){return ZJ&&ZJ.editor===e?ZJ:void 0}function eY(e,t){let n=$J(t);return n&&n[e]}function tY(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(QJ(e,n))]}return t}function nY(e,t){let n=t;for(let r of e){let[e,i]=tY(n,r),a=e.key;if(n===t&&QJ(n,e)===i)continue;let o=n===t||n===void 0?rY(t):n;o[a]=i,n=o}return n}function rY(e){return Object.create(e||null)}function iY(e,t){return[e,t]}function aY(e,t,n,r=JG()){let i=ZJ,a=$J(r);try{return ZJ={...a,editor:r,[e]:t},n()}finally{ZJ=i}}function oY(e,t=()=>{}){return(n,r=JG())=>i=>{let a=$J(r),o=a&&a[e],s=nY(n,o||t(r));return s&&s!==o?aY(e,s,i,r):i()}}function sY(e,t,n,r){return Object.assign(xz(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}function cY(e){if(!LW(e))return;let t=e;if(t.querySelector(`style`)===null)return;let n=new Map;function r(e){let t=n.get(e);if(t===void 0){t=new Set;for(let n=0;n<e.style.length;n++)t.add(e.style[n]);n.set(e,t)}return t}try{for(let e of Array.from(t.styleSheets)){let n;try{n=e.cssRules}catch{continue}for(let e of Array.from(n)){if(!Kq(e,CSSStyleRule))continue;let n;try{n=t.querySelectorAll(e.selectorText)}catch{continue}for(let t of Array.from(n)){if(!BG(t))continue;let n=r(t);for(let r=0;r<e.style.length;r++){let i=e.style[r];n.has(i)||t.style.setProperty(i,e.style.getPropertyValue(i),e.style.getPropertyPriority(i))}}}}}catch{}}var lY=`@lexical/html/DOM`,uY=Symbol.for(`@lexical/html/DOMExportContext`),dY=`@lexical/html/DOMImport`,fY=Symbol.for(`@lexical/html/DOMImportContext`);function pY(e,t,n){return sY(uY,e,t,n)}pY(`root`,Boolean);var mY=pY(`isExport`,Boolean);function hY(e){let t=UJ(e,lY);return t?t.output.defaults:void 0}function gY(e){let t=UJ(e,lY);return t?t.output.runtime:void 0}function _Y(e=JG()){let t=gY(e);return t?t.getSessionConfig():YG(e)}var vY=oY(uY,hY);new Map([[rW,()=>{let e=document.createElement(`div`);return e.role=`textbox`,{element:e}}]]);var yY=Symbol.for(`@lexical/html/SelectorImpl`);function bY(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?BG:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>bY(e,[...t,n]);return{[yY]:n,attr:(e,t,n)=>i(CY(e,t,n)),classAll:(...e)=>i(SY(e)),classAny:(...e)=>i(function(e){let t=xY(e);return t.length===0?()=>!1:e=>{if(!BG(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>BG(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!BG(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}XJ(362,JSON.stringify(e))}(e,t,n))}}function xY(e){let t=[];for(let n of e)n&&t.push(n);return t}function SY(e){let t=xY(e);return t.length===0?()=>!0:e=>{if(!BG(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function CY(e,t,n){if(!0===t)return t=>BG(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>BG(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!BG(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}XJ(361,JSON.stringify(e))}var wY={kind:`text`,predicate:IW,tags:new Set},TY={[yY]:wY},EY={kind:`comment`,predicate:e=>e.nodeType===8,tags:new Set},DY={[yY]:EY},OY={any:()=>bY(new Set,[]),comment:()=>DY,tag(...e){e.length>0||XJ(363);let t=new Set;for(let n of e)t.add(n.toUpperCase());return bY(t,[])},text:()=>TY},kY=/[A-Za-z0-9_-]/,AY=class{constructor(e,t){this.source=e,this.pos=t}peek(e=0){return this.source[this.pos+e]||``}consume(){return this.source[this.pos++]||``}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){let e=this.pos;for(;!this.eof()&&kY.test(this.peek());)this.pos++;return this.source.slice(e,this.pos)}readQuoted(){let e=this.consume();this.assert(e===`"`||e===`'`,`expected quote`);let t=this.pos;for(;!this.eof()&&this.peek()!==e;)this.peek()===`\\`?this.pos+=2:this.pos++;this.assert(!this.eof(),`unterminated string`);let n=this.source.slice(t,this.pos);return this.pos++,n.replace(/\\(.)/g,`$1`)}assert(e,t){e||XJ(364,String(this.pos+1),t,this.source)}};function jY(e){let t=new Set,n=[],r=[];if(e.skipWhitespace(),e.peek()===`*`)e.consume();else if(kY.test(e.peek())){let n=e.readIdent();n&&t.add(n.toUpperCase())}for(;!e.eof();){let t=e.peek();if(t===`.`){e.consume();let t=e.readIdent();e.assert(t!==``,`expected class name after "."`),r.push(t)}else if(t===`#`){e.consume();let t=e.readIdent();e.assert(t!==``,`expected id after "#"`),n.push(CY(`id`,t))}else{if(t!==`[`)break;{e.consume(),e.skipWhitespace();let t=e.readIdent();e.assert(t!==``,`expected attribute name after "["`),e.skipWhitespace();let r=!0;if(e.peek()===`=`){e.consume(),e.skipWhitespace();let t=e.peek();t===`"`||t===`'`?r=e.readQuoted():(r=e.readIdent(),e.assert(r!==``,`expected attribute value`)),e.skipWhitespace()}e.assert(e.peek()===`]`,`expected "]"`),e.consume(),n.push(CY(t,r))}}}return r.length>0&&n.push(SY(r)),{predicates:n,tags:t}}function MY(e){let t=new AY(e,0),n=[];for(;;){let e=jY(t);if(n.push(e),t.skipWhitespace(),t.eof())break;t.assert(t.peek()===`,`,`expected "," (selector lists are the only supported combinator)`),t.consume(),t.skipWhitespace()}if(n.length===1)return bY(n[0].tags,n[0].predicates);let r=new Set;for(let e of n)for(let t of e.tags)r.add(t);return bY(r,[(e,t)=>{for(let r of n){let n=e.nodeName;if(r.tags.size>0&&!r.tags.has(n))continue;let i=!0;for(let n of r.predicates)if(!n(e,t)){i=!1;break}if(i)return!0}return!1}])}function NY(e,t,n){return sY(fY,e,t,n)}NY(`importSource`,()=>`unknown`),NY(`importSourceDataTransfer`,()=>null),NY(`textFormat`,()=>0),NY(`textStyle`,()=>({}));function PY(e){if(!BG(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function FY(e){if(IW(e))return!0;if(!BG(e))return!1;let t=e.style.display;return t?t.startsWith(`inline`):!KG(e)&&WG(e)}NY(`whitespaceConfig`,()=>({isInline:FY,preservesWhitespace:PY})),NY(`importOverlays`,()=>[]);function IY(e){let t=UJ(e,dY);return t?t.output.defaults:void 0}function LY(e,t=JG()){return QJ(function(e){return eY(fY,e)||IY(e)}(t),e)}var RY=oY(fY,IY),zY=OY;zY.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),zY.text(),zY.tag(`script`,`style`),zY.tag(`br`),zY.tag(`p`);function BY(e,t){return IW(t)?e.textIndices:t.nodeType===8?e.commentIndices:BG(t)?e.byTag.get(t.nodeName)||e.wildcardIndices:VY}var VY=Object.freeze([]);function HY(e){return cU(e)||nW(e)&&!e.isInline()}function UY(e,t){let n=[],r=[],i=()=>{r.length!==0&&(n.push(t().splice(0,0,r)),r=[])};for(let a of e)if(HY(a)){if(i(),Z(a)){let e=UY(a.getChildren(),t);a.splice(0,a.getChildrenSize(),e)}n.push(a)}else r.push(a);return i(),n}var WY=Object.freeze({});function GY(e,t){return{$importChildren:(t,n)=>function(e,t,n){let r=n&&n.rules?n.rules.dispatch:void 0;r&&e.overlays.push(r);try{let r=()=>KY(e,t,n);return n&&n.context?RY(n.context,e.editor)(r):r()}finally{r&&e.overlays.pop()}}(e,t,n),$importOne:(t,n)=>qY(e,t,n),captures:t,get:t=>LY(t,e.editor),session:e.session}}function KY(e,t,n){let r=n&&n.$onChild,i=[];for(let n of Array.from(t.childNodes)){let t=qY(e,n,void 0);for(let e of t){let t=r?r(e):e;t!=null&&i.push(t)}}let a=n&&n.$after?n.$after(i):i,o=n&&n.schema;return o?function(e,t,n,r){let i=[],a=null,o=()=>{if(a===null)return;let t=a;if(a=null,e.$packageRun){let a=e.$packageRun(t,n,r);if(a.length>0){for(let e of a)i.push(e);return}}if(e.onReject===`hoist`)for(let e of t)i.push(e)};for(let r of t)e.$accepts(r,n)?(o(),i.push(r)):(a===null&&(a=[]),a.push(r));return o(),e.$finalize?e.$finalize(i,n):i}(o,a,null,t):a}function qY(e,t,n){let r=()=>function(e,t){let n=function(e,t){let n=[];for(let r=e.overlays.length-1;r>=0;r--){let i=e.overlays[r],a=BY(i,t);a.length>0&&n.push({dispatch:i,indices:a})}let r=BY(e.dispatch,t);return r.length>0&&n.push({dispatch:e.dispatch,indices:r}),n}(e,t);if(n.length===0)return JY(e,t);let r=0,i=0,a=()=>{for(;r<n.length;){let{dispatch:o,indices:s}=n[r];for(;i<s.length;){let n=s[i++],r=o.rules[n],c={};if(r.predicate(t,c)){let n=GY(e,Object.keys(c).length===0?WY:c);try{return r.$import(n,t,a)}catch(e){throw e}}}r++,i=0}return JY(e,t)};return a()}(e,t);return n&&n.context?RY(n.context,e.editor)(r):r()}function JY(e,t){if(t.childNodes.length===0)return[];let n=[];for(let r of Array.from(t.childNodes)){let t=qY(e,r,void 0);for(let e of t)n.push(e)}return n}OY.any(),OY.tag(`hr`);var YY={any:OY.any,comment:OY.comment,css:MY,tag:OY.tag,text:OY.text},XY=new Set([`STYLE`,`SCRIPT`]);function ZY(e,t){cY(t);let n=LW(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!XY.has(t.nodeName)){let n=tX(t,e,i,!1);if(n!==null)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof uW&&t.insertAfter(CH());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function QY(e,t=null,n=JG()){return vY([iY(mY,!0)],n)(()=>{let r=QW(),i=_Y(n),a=e.append.bind(e);for(let e of r.getChildren())eX(n,e,a,t,i);return e})}function $Y(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&XJ(338),QY(document.createElement(`div`),t,e).innerHTML}function eX(e,t,n,r=null,i=YG(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&J(t)&&(s=Eq(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=document.createDocumentFragment(),p=d?d():Z(s)?s.getChildren():[],m=f.append.bind(f);for(let n of p){let o=eX(e,n,m,r,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((BG(c)||HG(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(HG(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function tX(e,t,n,r,i=new Map,a){let o=[];if(XY.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let d=e.childNodes,f=[],p=(s==null||!AG(s))&&(s!=null&&cU(s)||r);for(let e=0;e<d.length;e++)f.push(...tX(d[e],t,n,p,new Map(i),s));if(u!=null&&(f=u(f)),KG(e)&&(f=nX(e,f,p?()=>{let e=new uW;return n.push(e),e}:pW)),s==null)if(f.length>0)for(let e of f)o.push(e);else KG(e)&&function(e){return e.nextSibling==null||e.previousSibling==null?!1:WG(e.nextSibling)&&WG(e.previousSibling)}(e)&&o.push(CH());else Z(s)&&s.append(...f);return o}function nX(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if(cU(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&cU(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}function rX(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function iX(e){let t=1,n=e.getParent();for(;n!=null;){if(CX(n)){let e=n.getParent();if(kX(e)){t++,n=e.getParent();continue}rX(40)}return t}return t}function aX(e){let t=e.getParent();kX(t)||rX(40);let n=t;for(;n!==null;)n=n.getParent(),kX(n)&&(t=n);return t}function oX(e){let t=[],n=e.getChildren().filter(CX);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();kX(i)?t=t.concat(oX(i)):t.push(r)}return t}function sX(e){return CX(e)&&kX(e.getFirstChild())}function cX(e,t){return CX(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function lX(e){let t=X();if(t!==null){let n=t.getNodes();if(Y(t)){let[r]=t.getStartEndPoints(),i=r.getNode(),a=i.getParent();if(AG(i)){let e=i.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=pW();i.append(e),n=e.select().getNodes()}}else if(cX(i,n)){let t=OX(e);if(AG(a)){i.replace(t);let e=SX();Z(i)&&(e.setFormat(i.getFormatType()),e.setIndent(i.getIndent())),t.append(e)}else if(CX(i)){let e=i.getParentOrThrow();uX(t,e.getChildren()),e.replace(t)}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(Z(i)&&i.isEmpty()&&!CX(i)&&!r.has(i.getKey())){dX(i,e);continue}let a=BW(i)?i.getParent():CX(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(kX(a)){if(!r.has(t)){let n=OX(e);uX(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(AG(n)&&!r.has(t)){r.add(t),dX(a,e);break}a=n}}}}}function uX(e,t){e.splice(e.getChildrenSize(),0,t)}function dX(e,t){if(kX(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=SX(),a;if(uX(i,e.getChildren()),kX(n)&&t===n.getListType())n.append(i),kX(r)&&t===r.getListType()&&(uX(n,r.getChildren()),r.remove()),a=n;else if(kX(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=OX(t);n.append(i),e.replace(n),a=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());let o=X();return Y(o)&&(a.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,`element`),a.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,`element`)),e.remove(),a}function fX(e,t){let n=e.getLastChild(),r=t.getFirstChild();n&&r&&sX(n)&&sX(r)&&(fX(n.getFirstChild(),r.getFirstChild()),r.remove());let i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function pX(){let e=X();if(Y(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(cX(r,n))t.add(aX(r));else for(let e=0;e<n.length;e++){let r=n[e];if(BW(r)){let e=Hq(r,vX);e!=null&&t.add(aX(e))}}for(let n of t){let t=n,r=oX(n);for(let n of r){let r=pW().setTextStyle(e.style).setTextFormat(e.format);uX(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&KK(e.anchor,eq(jK(r,`next`))),n.__key===e.focus.key&&KK(e.focus,eq(jK(r,`next`))),n.remove()}n.remove()}}}function mX(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())CX(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),kX(r.getFirstChild())||n++)}function hX(e){let t=new Set;if(sX(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(sX(r)&&sX(i)){let n=i.getFirstChild();if(kX(n)){n.append(e);let i=r.getFirstChild();kX(i)&&(uX(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(sX(r)){let t=r.getFirstChild();if(kX(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(sX(i)){let t=i.getFirstChild();kX(t)&&t.append(e)}else if(kX(n)){let t=jG(e),a=jG(n);t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function gX(e){if(sX(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(kX(n?n.getParent():void 0)&&CX(n)&&kX(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=jG(e),i=jG(t);r.append(i),e.getPreviousSiblings().forEach(e=>i.append(e));let a=jG(e),o=jG(t);a.append(o),uX(o,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(a),n.replace(e)}}}function _X(e=!1){let t=X();if(!Y(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=null;if(CX(n)&&n.getChildrenSize()===0)r=n;else if(J(n)){let e=n.getParent();CX(e)&&e.getChildren().every(e=>J(e)&&e.getTextContent().trim()===``)&&(r=e)}if(r===null)return!1;let i=aX(r),a=r.getParent();kX(a)||rX(40);let o=a.getParent(),s;if(AG(o))s=pW(),i.insertAfter(s);else{if(!CX(o))return!1;s=jG(o),o.insertAfter(s)}s.setTextStyle(t.style).setTextFormat(t.format).select();let c=r.getNextSiblings();if(c.length>0){let t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(a,r):1,n=jG(a).setStart(t);if(CX(s)){let e=jG(s);e.append(n),s.insertAfter(e)}else s.insertAfter(n);n.append(...c)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!CX(e)&&!kX(e))break;t=e}t.remove()}(r),!0}var vX=class extends $U{__value;__checked;$config(){return this.config(`listitem`,{$transform:e=>{let t=e.getParent();if(kX(t))t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){let n=e.createParentElementNode();kX(n)||rX(340);let r=[e];for(let t of[`previous`,`next`]){r.reverse();for(let{origin:n}of DK(e,t)){if(!CX(n))break;r.push(n)}}e.insertBefore(n),n.splice(0,0,r),AG(t)||(Gq(n,XK(DK(n,`next`)),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:$U,importDOM:sH({li:()=>({conversion:yX,priority:0})})})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let t=document.createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){(function(e,t){let n=t.getParent();!kX(n)||n.getListType()!==`check`||kX(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))})(t,this),t.value=this.__value,function(e,t,n){let r=t.list;if(!r)return;let i=r.listitem,a=r.nested&&r.nested.listitem,o=n.getParent(),s=kX(o)&&o.getListType()===`check`,c=n.getChecked(),l=n.getChildren().some(e=>kX(e)),u=[];r.listitemChecked!==void 0&&u.push(r.listitemChecked),r.listitemUnchecked!==void 0&&u.push(r.listitemUnchecked),a!==void 0&&u.push(...dq(a)),u.length>0&&pq(e,...u);let d=[];if(i!==void 0&&d.push(...dq(i)),s){let e=c?r.listitemChecked:r.listitemUnchecked;e!==void 0&&d.push(e)}a!==void 0&&l&&d.push(...dq(a)),d.length>0&&fq(e,...d)}(t,n.theme,this);let r=e?e.__style:``,i=this.__style;r!==i&&bH(t.style,i,r),function(e,t,n){let r=t.__textStyle,i=n?n.__textStyle:``;if(n!==null&&i===r)return;let a=vH(r);for(let t in a)e.style.setProperty(`--listitem-marker-${t}`,a[t]);if(i!==``)for(let t in vH(i))t in a||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),sX(this)?{after(e){if(BG(e)){let t=e.previousElementSibling;if(BG(t)&&t.nodeName===`LI`){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(Z(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(CX(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!kX(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=jG(n),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}let r=this.__key,i=0;if(t&&(Z(e)||rX(139),i=e.getChildrenSize(),e.splice(i,0,this.getChildren())),t&&Z(e)){let t=X();if(Y(t))for(let n of t.getStartEndPoints())n.key===r&&n.type===`element`&&n.set(e.getKey(),i+n.offset,`element`)}return this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(kX(n)||rX(39),CX(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=jG(n);r.forEach(e=>i.append(e)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&sX(t)&&sX(n)&&(fX(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){let n=jG(this);return this.insertAfter(n,t),n}collapseAtStart(e){let t=pW();this.getChildren().forEach(e=>t.append(e));let n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=CX(r);if(n.getChildrenSize()===1)if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();let r=e.anchor,i=e.focus,a=t.getKey();r.type===`element`&&r.getNode().is(this)&&r.set(a,r.offset,`element`),i.type===`element`&&i.getNode().is(this)&&i.set(a,i.offset,`element`)}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return kX(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;CX(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&rX(117),(e=Math.floor(e))>=0||rX(199);let t=this.getIndent();for(;t!==e;)t<e?(hX(this),t++):(gX(this),t--);return this}canInsertAfter(e){return CX(e)}canReplaceWith(e){return CX(e)}canMergeWith(e){return CX(e)||mW(e)}extractWithChild(e,t){if(!Y(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return OX(`bullet`)}canMergeWhenEmpty(){return!0}};function yX(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return bX(t)}if(e.classList.contains(`joplin-checkbox`)){for(let t of e.children)if(t.classList.contains(`checkbox-wrapper`)&&t.children.length>0&&t.children[0].tagName===`INPUT`)return bX(t.children[0])}let t=e.getAttribute(`aria-checked`),n=SX(t===`true`||t!==`false`&&void 0);return oK(n,e),{after:xX.bind(null,n),node:aK(n,e)}}function bX(e){if(e.getAttribute(`type`)!==`checkbox`)return{node:null};let t=SX(e.hasAttribute(`checked`));return{after:xX.bind(null,t),node:t}}function xX(e,t){let n=t[0];return t.length===1&&mW(n)&&!e.getFormatType()&&n.getFormatType()?(e.setFormat(n.getFormatType()),n.getChildren()):t}function SX(e){return MG(new vX(void 0,e))}function CX(e){return e instanceof vX}var wX=class extends $U{__tag;__start;__listType;$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.getNextSibling();kX(t)&&e.getListType()===t.getListType()&&fX(e,t)})(e),mX(e)},extends:$U,importDOM:sH({ol:()=>({conversion:EX,priority:0}),ul:()=>({conversion:EX,priority:0})})})}constructor(e=`number`,t=1,n){super(n);let r=DX[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=document.createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,TX(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(TX(t,n.theme,this),e.__start!==this.__start&&t.setAttribute(`start`,String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let t=this.createDOM(e._config,e);return BG(t)&&(this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`)),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){let t=n[e];CX(t)||(r===n&&(r=[...n]),r[e]=this.createListItemNode().append(!Z(t)||kX(t)||t.isInline()?t:VH(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return CX(e)}createListItemNode(){return SX()}};function TX(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=iX(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...dq(s));for(let t=0;t<e.length;t++)t!==o&&i.push(n.__tag+t)}if(l!==void 0){let e=dq(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&pq(e,...i),r.length>0&&fq(e,...r)}function EX(e){let t;if(function(e){return BG(e)&&e.nodeName.toLowerCase()===`ol`}(e)){let n=e.start;t=OX(`number`,n)}else t=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`)||e.getAttribute(`data-is-checklist`)===`1`)return!0;for(let t of e.childNodes)if(BG(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?OX(`check`):OX(`bullet`);return aK(t,e),{after:e=>function(e,t){let n=t.createListItemNode.bind(t),r=[];for(let t=0;t<e.length;t++){let i=e[t];if(CX(i)){r.push(i);let e=i.getChildren();e.length>1&&e.forEach(e=>{kX(e)&&r.push(n().append(e))})}else r.push(n().append(i))}return r}(e,t),node:t}}var DX={ol:`number`,ul:`bullet`};function OX(e=`number`,t=1){return MG(new wX(e,t))}function kX(e){return e instanceof wX}var AX=q(`UPDATE_LIST_START_COMMAND`),jX=q(`INSERT_UNORDERED_LIST_COMMAND`),MX=q(`INSERT_ORDERED_LIST_COMMAND`),NX=q(`REMOVE_LIST_COMMAND`);function PX(e,t){return mq(e.registerCommand(MX,()=>(lX(`number`),!0),1),e.registerCommand(AX,e=>{let{listNodeKey:t,newStart:n}=e,r=KW(t);return!!kX(r)&&(r.getListType()===`number`&&(r.setStart(n),mX(r)),!0)},1),e.registerCommand(jX,()=>(lX(`bullet`),!0),1),e.registerCommand(NX,()=>(pX(),!0),1),e.registerCommand(FB,()=>_X(!!(t&&t.restoreNumbering)),1),e.registerNodeTransform(vX,e=>{let t=e.getFirstChild();if(t){if(J(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=X();Y(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}}),e.registerNodeTransform(MH,e=>{let t=e.getParent();if(CX(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}}))}function FX(e){let t=e=>{let t=e.getParent();if(kX(e.getFirstChild())||!kX(t))return;let n=dK(e,e=>CX(e)&&kX(e.getParent())&&CX(e.getPreviousSibling()));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(CX(n)){let r=n.getPreviousSibling();if(CX(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;kX(n);){let e=n.getLastChild();if(!CX(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(kX(n)){let r=iX(n);r+1<iX(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(wX,e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(kX(e)){for(let r of e.getChildren())if(CX(r)){t(r);let e=r.getFirstChild();kX(e)&&n.push(e)}}}})}YY.tag(`ol`,`ul`),YY.tag(`li`),YY.tag(`li`).classAll(`task-list-item`),YY.tag(`li`).classAll(`joplin-checkbox`);var IX=(0,u.createContext)({editorVariant:`compact`,editable:!0});function LX({value:e,children:t}){return(0,p.jsx)(IX.Provider,{value:e,children:t})}function RX(){return(0,u.useContext)(IX)}var zX=(0,d.createContext)(null);function BX(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function VX(){let e=(0,d.useContext)(zX);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}var HX=class extends tW{__format;constructor(e,t){super(t),this.__format=e||``}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format}exportJSON(){return{...super.exportJSON(),format:this.__format||``}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||``)}canIndent(){return!1}createDOM(){return document.createElement(`div`)}updateDOM(){return!1}setFormat(e){let t=this.getWritable();return t.__format=e,t}getFormat(){return this.getLatest().__format}isInline(){return!1}},UX=q(`OPEN_RICH_TEXT_IMAGE_EDITOR_COMMAND`),WX=q(`UPDATE_RICH_TEXT_IMAGE_COMMAND`);function GX(e){if(e)return`${e.value}${e.unit}`}function KX(e){let t=`group/image relative my-3 cursor-pointer`;switch(e){case`center`:return`${t} flex flex-col items-center`;case`right`:case`end`:return`${t} flex flex-col items-end`;default:return t}}function qX(e){let t=`mt-2 text-xs text-muted-foreground`;switch(e){case`center`:return`${t} text-center`;case`right`:case`end`:return`${t} text-right`;default:return`${t} text-left`}}function JX({nodeKey:e,source:t,alt:n,caption:r,size:i,format:a}){let[o]=VX(),{editable:s,resolveImageAssetUrl:c}=RX(),l=t.type===`external`?t.url:c?.(t.assetId),u=()=>{o.dispatchCommand(UX,e)},d=()=>{o.update(()=>{let t=KW(e);if(!t)return;t.remove();let n=QW();if(n.getChildrenSize()===0){let e=pW();n.append(e),e.selectStart()}})},f={width:GX(i?.width),maxWidth:i?.maxWidth?GX(i.maxWidth):`100%`},m=r?.trim()??``;return(0,p.jsxs)(`figure`,{className:KX(a),onClick:()=>{s&&u()},children:[l?(0,p.jsx)(`img`,{src:l,alt:n??``,style:f,className:`max-h-80 rounded-lg border border-border/70 object-contain`,draggable:!1}):(0,p.jsx)(`div`,{className:`flex min-h-36 w-full items-center justify-center rounded-lg border border-dashed border-border/80 bg-muted/30 text-sm text-muted-foreground`,children:(0,p.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,p.jsx)(LS,{className:`size-4`}),t.type===`asset`?`Missing asset: ${t.assetId}`:`Image`]})}),m.length>0?(0,p.jsx)(`figcaption`,{className:qX(a),children:m}):null,s?(0,p.jsxs)(`div`,{className:`absolute right-2 top-2 flex gap-1 opacity-0 shadow-sm transition-opacity group-hover/image:opacity-100`,children:[(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:`secondary`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.stopPropagation(),u()},"aria-label":`Edit image`,children:(0,p.jsx)(GS,{className:`size-3`})}),(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:`secondary`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.stopPropagation(),d()},"aria-label":`Remove image`,children:(0,p.jsx)($S,{className:`size-3`})})]}):null]})}var YX=class e extends HX{__source;__alt;__caption;__size;static getType(){return`rich-text-image`}static clone(t){return new e(t.__source,t.__alt,t.__size,t.__caption,t.__format,t.__key)}static importJSON(e){return XX({source:e.source,alt:e.alt,size:e.size,caption:e.caption}).updateFromJSON(e)}constructor(e,t,n,r=``,i,a){super(i,a),this.__source=e,this.__alt=t,this.__size=n,this.__caption=r}updateFromJSON(e){let t=super.updateFromJSON(e);return t.__source=e.source,t.__alt=e.alt,t.__size=e.size,t.__caption=e.caption??``,t}exportJSON(){return{...super.exportJSON(),alt:this.__alt,caption:this.__caption||void 0,size:this.__size,source:this.__source,type:`rich-text-image`,version:1}}getSource(){return this.getLatest().__source}getAlt(){return this.getLatest().__alt}getCaption(){return this.getLatest().__caption}getSize(){return this.getLatest().__size}setSource(e){let t=this.getWritable();return t.__source=e,t}setAlt(e){let t=this.getWritable();return t.__alt=e,t}setCaption(e){let t=this.getWritable();return t.__caption=e,t}setSize(e){let t=this.getWritable();return t.__size=e,t}decorate(){return(0,p.jsx)(JX,{nodeKey:this.getKey(),source:this.__source,alt:this.__alt,caption:this.__caption,size:this.__size,format:this.__format})}};function XX({source:e,alt:t,size:n,caption:r=``,format:i,key:a}){return MG(new YX(e,t,n,r,i,a))}function ZX(e){return e instanceof YX}var QX=q(`INSERT_RICH_TEXT_INFO_BOX_COMMAND`),$X=q(`OPEN_RICH_TEXT_INFO_BOX_EDITOR_COMMAND`),eZ=q(`UPDATE_RICH_TEXT_INFO_BOX_COMMAND`);function tZ(e){return e===`warning`?`border-amber-300/80 bg-amber-50/90 dark:bg-amber-950/25`:`border-sky-300/80 bg-sky-50/90 dark:bg-sky-950/25`}function nZ({nodeKey:e,tone:t,title:n,content:r,collapsible:i}){let[a]=VX(),{editable:o}=RX(),s=()=>{a.dispatchCommand($X,e)},c=()=>{a.update(()=>{let t=KW(e);if(!t)return;t.remove();let n=QW();if(n.getChildrenSize()===0){let e=pW();n.append(e),e.selectStart()}})},l=t===`warning`?eC:RS,u=t===`warning`?`Warning`:`Info`;return(0,p.jsxs)(`div`,{className:`group/info-box relative my-3 rounded-lg border px-3 py-2.5 ${tZ(t)} ${o?`cursor-pointer`:``}`,"data-rich-text-info-box":``,onClick:e=>{o&&(e.target.closest(`button`)||s())},children:[(0,p.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,p.jsx)(`span`,{className:`mt-0.5 shrink-0 text-foreground/80`,"aria-hidden":!0,children:(0,p.jsx)(l,{className:`size-4`})}),(0,p.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,p.jsxs)(`div`,{className:`text-sm font-medium text-foreground flex items-center gap-1`,children:[n.trim().length>0?n:(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:`${u} (no title)`}),i?(0,p.jsx)(CS,{className:`size-3`}):null]}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm text-foreground/90`,children:r.trim().length>0?r:(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:`No content`})})]})]}),o?(0,p.jsxs)(`div`,{className:`absolute right-2 top-2 flex gap-1 opacity-0 transition-opacity group-hover/info-box:opacity-100`,children:[(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:`secondary`,className:`shadow-sm`,onMouseDown:e=>{e.preventDefault()},onClick:s,"aria-label":`Edit callout`,children:(0,p.jsx)(GS,{className:`size-3`})}),(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:`secondary`,className:`shadow-sm`,onMouseDown:e=>{e.preventDefault()},onClick:c,"aria-label":`Remove callout`,children:(0,p.jsx)($S,{className:`size-3`})})]}):null]})}var rZ=class e extends HX{__tone;__title;__content;__collapsible;__defaultOpen;static getType(){return`rich-text-info-box`}static clone(t){return new e(t.__tone,t.__title,t.__content,t.__collapsible,t.__defaultOpen,t.__key)}static importJSON(e){return iZ({tone:e.tone,title:e.title,content:e.content,collapsible:e.collapsible,defaultOpen:e.defaultOpen}).updateFromJSON(e)}constructor(e,t,n,r,i,a){super(void 0,a),this.__tone=e,this.__title=t,this.__content=n,this.__collapsible=r,this.__defaultOpen=i}updateFromJSON(e){let t=super.updateFromJSON(e);return t.__tone=e.tone,t.__title=e.title,t.__content=e.content,t.__collapsible=e.collapsible,t.__defaultOpen=e.defaultOpen,t}exportJSON(){return{...super.exportJSON(),type:`rich-text-info-box`,version:1,tone:this.__tone,title:this.__title,content:this.__content,collapsible:this.__collapsible,defaultOpen:this.__defaultOpen}}getTone(){return this.getLatest().__tone}setTone(e){let t=this.getWritable();t.__tone=e}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();t.__title=e}getContent(){return this.getLatest().__content}setContent(e){let t=this.getWritable();t.__content=e}getCollapsible(){return this.getLatest().__collapsible}setCollapsible(e){let t=this.getWritable();t.__collapsible=e}getDefaultOpen(){return this.getLatest().__defaultOpen}setDefaultOpen(e){let t=this.getWritable();t.__defaultOpen=e}decorate(){return(0,p.jsx)(nZ,{nodeKey:this.getKey(),tone:this.__tone,title:this.__title,content:this.__content,collapsible:this.__collapsible,defaultOpen:this.__defaultOpen})}};function iZ({tone:e=`info`,title:t=``,content:n=``,collapsible:r=!0,defaultOpen:i=!0,key:a}){return MG(new rZ(e,t,n,r,i,a))}function aZ(e){return e instanceof rZ}var oZ=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),sZ=class e extends $U{__url;__target;__rel;__title;static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){let t=document.createElement(`a`);return this.updateLinkDOM(null,t,e),fq(t,e.theme.link),t}updateLinkDOM(e,t,n){if(zG(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:cZ,priority:1})}}static importJSON(e){return lZ().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=pZ(e);try{let t=new URL(pZ(e));if(!oZ.has(t.protocol))return`about:blank`}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=jG(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Y(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function cZ(e){let t=null;if(zG(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=lZ(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function lZ(e=``,t){return MG(new sZ(e,t))}var uZ=class e extends sZ{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return dZ().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){let n=dZ(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function dZ(e=``,t){return MG(new uZ(e,t))}var fZ=/^\+?[0-9\s()-]{5,}$/;function pZ(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:fZ.test(e)?`tel:${e}`:`https://${e}`}YY.tag(`a`);var mZ=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]);function hZ(e){let t=pZ(e.trim());try{let e=new URL(t);if(!mZ.has(e.protocol))return`about:blank`}catch{return`about:blank`}return t}var gZ=`rich-text-editor-sync-from-value`,_Z=`var(--rich-text-editor-primary-color, var(--primary))`,vZ=`var(--rich-text-editor-accent-color, var(--accent))`,yZ=`var(--rich-text-editor-font-weight-strong, 600)`,bZ=`var(--rich-text-editor-font-weight-normal, 400)`,xZ={formatting:0,blocks:1,insert:2};function SZ(e){return`{${e}}`}function CZ(e){return`${e.kind}:${e.value}`}function wZ(e){switch(e.kind){case`weight`:return{label:e.label??(e.value===`strong`?`B`:`N`),title:e.title??(e.value===`strong`?`Bold`:`Normal weight`),property:`font-weight`,value:e.value===`strong`?yZ:bZ};case`italic`:return{label:e.label??(e.value===`italic`?`I`:`Plain`),title:e.title??(e.value===`italic`?`Italic`:`Normal style`),property:`font-style`,value:e.value};case`underline`:return{label:e.label??(e.value===`underline`?`U`:`No U`),title:e.title??(e.value===`underline`?`Underline`:`Remove underline`),property:`text-decoration-line`,value:e.value};case`color`:return{label:e.label??(e.value===`primary`?`P`:`A`),title:e.title??(e.value===`primary`?`Primary color`:`Accent color`),property:`color`,value:e.value===`primary`?_Z:vZ}}}function TZ(e,t,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1){let c=e.map(e=>{let t=wZ(e);return{key:`style:${CZ(e)}`,label:t.title,keywords:[t.title,e.kind,e.value,t.label].map(e=>e.toLowerCase()),group:`formatting`,kind:`style`,control:e}}),l=t.map(e=>({key:`template:${e.key}`,label:`Insert ${e.label??e.key}`,keywords:[`template`,`variable`,e.key,e.label??``].map(e=>e.toLowerCase()),group:`insert`,kind:`template`,templateVariable:e})),u=n?[{key:`link`,label:`Insert link`,keywords:[`link`,`url`,`href`,`anchor`,`website`],group:`insert`,kind:`link`}]:[],d=r?[{key:`bullet-list`,label:`Bullet list`,keywords:[`bullet`,`list`,`unordered`,`ul`,`dots`],group:`blocks`,kind:`bulletList`}]:[],f=i?[1,2,3,4,5,6].map(e=>({key:`heading-h${e}`,label:`Heading ${e}`,keywords:[`heading`,`title`,`h${e}`,`heading ${e}`].map(e=>e.toLowerCase()),group:`blocks`,kind:`heading`,level:e})):[],p=a?[{key:`info-box-info`,label:`Info callout`,keywords:[`info`,`callout`,`note`,`tip`,`aside`,`information`],group:`insert`,kind:`infoBox`,tone:`info`},{key:`info-box-warning`,label:`Warning callout`,keywords:[`warning`,`callout`,`caution`,`alert`,`important`],group:`insert`,kind:`infoBox`,tone:`warning`}]:[],m=o?[{key:`image`,label:`Image`,keywords:[`image`,`photo`,`picture`,`img`,`figure`,`asset`],group:`insert`,kind:`image`}]:[],h=s?[{key:`horizontal-divider`,label:`Horizontal divider`,keywords:[`divider`,`separator`,`horizontal`,`line`,`rule`,`hr`],group:`blocks`,kind:`separator`}]:[];return[...c,...l,...u,...d,...f,...p,...m,...h]}function EZ(e){let t=X();return Y(t)?(Mq(t,()=>yq(e)),!0):!1}function DZ(e){return dK(e.anchor.getNode(),e=>bq(e)||mW(e))}function OZ(e){let t=QW(),n=new Set,r=[],i=e=>{let i=e;for(;i!==null;){let e=i.getParent();if(e===null)return;if(e===t){n.has(i.getKey())||(n.add(i.getKey()),r.push(i));return}i=e}};for(let t of e.getNodes())i(t);return i(e.anchor.getNode()),i(e.focus.getNode()),r}function kZ(e){let t=OZ(e);return t.length===0?!1:t.every(e=>bq(e)||mW(e))}function AZ(e){let t=QW(),n=e;for(;n!==null;){let e=n.getParent();if(e===null)return null;if(e===t)return n;n=e}return null}function jZ(e){let t=e=>{e.setFormat(``);for(let n of e.getChildren())if(mW(n)&&!bq(n)&&n.setFormat(``),kX(n))for(let e of n.getChildren())CX(e)&&t(e)};for(let n of e.getChildren())CX(n)&&t(n)}function MZ(){let e=X();if(!Y(e))return!1;let t=AZ(e.anchor.getNode()),n=t?.getPreviousSibling()??null,r=t?.getNextSibling()??null,i=kX(r)&&r.getListType()===`bullet`,a=kX(n)&&n.getListType()===`bullet`;lX(`bullet`);let o=X(),s=Y(o)?dK(o.anchor.getNode(),e=>CX(e)):null,c=a?n:i?r:s?.getParent();c&&kX(c)&&c.getListType()===`bullet`&&jZ(c);let l=a?n.getLastChild():i?r.getFirstChild():s;return l&&CX(l)&&l.selectStart(),!0}function NZ(){return vW({nodes:[nQ,rQ,wX,vX,KJ,YX,vq,rZ],onError(e){throw e}})}function PZ(e=``){let t=QW();t.clear();let n=pW();e.replace(/\r\n?/g,`
|
|
146
|
+
`).split(`
|
|
147
|
+
`).forEach((e,t)=>{t>0&&n.append(CH()),e.length>0&&n.append(VH(e))}),t.append(n)}function FZ(e=``){let t=NZ();return t.update(()=>{PZ(e)},{discrete:!0}),t.getEditorState().toJSON()}function IZ(e){switch(e.kind){case`weight`:return bZ;case`italic`:return wZ({kind:`italic`,value:`normal`}).value;case`underline`:return wZ({kind:`underline`,value:`none`}).value;case`color`:return`inherit`}}function LZ(e){let t=e.getNodes().filter(e=>e instanceof MH&&!(e instanceof nQ));if(t.length===0)return{};let n=t[0];return{format:t.every(e=>e.getFormat()===n.getFormat())?n.getFormat():void 0,style:t.every(e=>e.getStyle()===n.getStyle())?n.getStyle():void 0}}function RZ(e){let t=X();if(!Y(t))return!1;let n=BZ(e);if(n){let{property:r,value:i}=wZ(e),a=t.hasFormat(n),o=Bq(t,r,``)===i;return Oq(t,{[r]:null}),o&&!a||t.formatText(n),!0}let{property:r,value:i}=wZ(e),a=Bq(t,r,``)===i,o=a?null:i,s=t.isCollapsed()&&a?IZ(e):o;return Oq(t,{[r]:s}),!0}function zZ(e,t){let{property:n,value:r}=wZ(t),i=Bq(e,n,``)===r,a=BZ(t);return a&&e.hasFormat(a)||i}function BZ(e){return e.kind===`weight`&&e.value===`strong`?`bold`:e.kind===`italic`&&e.value===`italic`?`italic`:e.kind===`underline`&&e.value===`underline`?`underline`:null}function VZ(e){let t=X();return Y(t)?(t.insertNodes([iQ(e.key)]),!0):!1}function HZ(e,t){if(e==null||!mW(e)||bq(e)||e.getTextContent().trim().length!==0)return!1;e.replace(t);let n=pW();return t.insertAfter(n),n.selectStart(),!0}function UZ(e){let t=iZ({tone:e.tone,title:``,content:``,collapsible:!0,defaultOpen:!0});if(e.replaceIfEmptyParagraphKey!==void 0&&HZ(KW(e.replaceIfEmptyParagraphKey),t))return t.getKey();let n=X();if(Y(n)||(n=pU()),Y(n)&&HZ(AZ(n.anchor.getNode()),t))return t.getKey();let r=QW();return r.getChildrenSize()===1&&HZ(r.getFirstChild(),t)||Wq(t),t.getKey()}function WZ(e={}){let t=XX({source:{type:`external`,url:``},alt:``,caption:``,format:`center`});if(e.replaceIfEmptyParagraphKey!==void 0&&HZ(KW(e.replaceIfEmptyParagraphKey),t))return t.getKey();let n=X();if(Y(n)||(n=pU()),Y(n)&&HZ(AZ(n.anchor.getNode()),t))return t.getKey();let r=QW();return r.getChildrenSize()===1&&HZ(r.getFirstChild(),t)||Wq(t),t.getKey()}function GZ(e){let t=KW(e.key);if(!ZX(t))return!1;let n=e.alt.trim();return t.setSource(e.source),t.setAlt(n.length>0?n:void 0),t.setCaption(e.caption.replace(/\r\n/g,`
|
|
148
|
+
`)),t.setSize(e.size),t.setFormat(e.format),!0}function KZ(e){let t=KW(e.key);return aZ(t)?(t.setTone(e.tone),t.setTitle(e.title.replace(/\r\n/g,`
|
|
149
|
+
`)),t.setContent(e.content.replace(/\r\n/g,`
|
|
150
|
+
`)),t.setCollapsible(e.collapsible),t.setDefaultOpen(e.collapsible?e.defaultOpen:!0),!0):!1}function qZ(e={}){let t=X();if(!Y(t))return null;let n=t.getTextContent(),r=aQ((e.text??n).trim().length>0?e.text??n:`Link`,e.url??`https://`),{format:i,style:a}=LZ(t);return typeof i==`number`&&r.setFormat(i),a&&r.setStyle(a),t.insertNodes([r]),r.getKey()}function JZ({key:e,text:t,url:n}){let r=KW(e);if(!oQ(r))return!1;let i=t.trim().length>0?t:n.trim().length>0?n:`Link`;return r.setTextContent(i),r.setURL(n),!0}function YZ(e){let t=KW(e);if(!oQ(t))return!1;let n=VH(t.getTextContent());return n.setFormat(t.getFormat()),n.setStyle(t.getStyle()),t.replace(n),!0}var XZ=q(`APPLY_RICH_TEXT_STYLE_COMMAND`),ZZ=q(`INSERT_RICH_TEXT_TEMPLATE_VARIABLE_COMMAND`),QZ=q(`INSERT_RICH_TEXT_LINK_COMMAND`),$Z=q(`OPEN_RICH_TEXT_LINK_EDITOR_COMMAND`),eQ=q(`UPDATE_RICH_TEXT_LINK_COMMAND`),tQ=q(`CONVERT_RICH_TEXT_LINK_TO_TEXT_COMMAND`),nQ=class e extends MH{__templateKey;static getType(){return`template-variable`}static clone(t){return new e(t.__templateKey,t.__key)}static importJSON(e){let t=iQ(e.templateKey);return t.setTextContent(e.text),t.setFormat(e.format),t.setStyle(e.style),t}constructor(e,t){super(SZ(e),t),this.__templateKey=e}afterCloneFrom(e){super.afterCloneFrom(e),this.__mode=e.__mode,this.__detail=e.__detail}createDOM(e){let t=super.createDOM(e);return t.dataset.templateKey=this.__templateKey,t.className=V(t.className,`inline-flex rounded-md border border-border/70 bg-muted px-1.5 py-0.5 align-baseline text-[0.92em] font-medium text-foreground`),t}updateDOM(e,t,n){return t.dataset.templateKey=this.__templateKey,super.updateDOM(e,t,n)}exportJSON(){return{...super.exportJSON(),type:`template-variable`,templateKey:this.__templateKey}}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}isTextEntity(){return!0}},rQ=class e extends MH{__url;static getType(){return`inline-link`}static clone(t){return new e(t.getTextContent(),t.__url,t.__key)}static importJSON(e){let t=aQ(e.text,e.url);return t.setFormat(e.format),t.setStyle(e.style),t}constructor(e,t,n){super(e,n),this.__url=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__mode=e.__mode,this.__detail=e.__detail}createDOM(e){let t=super.createDOM(e);return t.dataset.inlineRichTextLink=`true`,t.dataset.inlineRichTextLinkUrl=this.__url,t.className=V(t.className,`cursor-pointer rounded-sm text-primary underline decoration-current underline-offset-3`),this.__url&&(t.title=this.__url),t}updateDOM(e,t,n){return t.dataset.inlineRichTextLink=`true`,t.dataset.inlineRichTextLinkUrl=this.__url,this.__url?t.title=this.__url:t.removeAttribute(`title`),super.updateDOM(e,t,n)}exportJSON(){return{...super.exportJSON(),type:`inline-link`,url:this.__url}}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){let t=super.splitText(...e),n=this.getURL();return t.map(e=>{if(oQ(e))return e;let t=aQ(e.getTextContent(),n);return t.setFormat(e.getFormat()),t.setStyle(e.getStyle()),t.setDetail(e.getDetail()),e.replace(t),t})}isTextEntity(){return!1}};function iQ(e){return new nQ(e).setMode(`token`).toggleUnmergeable()}function aQ(e,t){return new rQ(e,t).toggleUnmergeable()}function oQ(e){return e instanceof rQ}var sQ={variant:`compact`,allowLinks:!0,allowTemplateVariables:!0,allowLineBreaks:!0,allowedBlockTypes:{paragraph:!0},allowedStyleAttributes:{weight:!0,italic:!0,underline:!0,color:!0}},cQ={...sQ,variant:`block`,allowBlockAlignment:!0,allowedBlockTypes:{paragraph:!0,bulletList:!0,image:!0,separator:!0}};function lQ(e,t){return t?{...e,...t,allowedBlockTypes:{...e.allowedBlockTypes,...t.allowedBlockTypes},allowedStyleAttributes:{...e.allowedStyleAttributes,...t.allowedStyleAttributes}}:e}function uQ(e,t){return t?.allowedBlockTypes?.[e]===void 0?!(e===`heading`||e===`infoBox`):t.allowedBlockTypes[e]}function dQ(e,t){return t?.allowedStyleAttributes?.[e]??!0}function fQ(e){return e?.allowBlockAlignment===!0}function pQ(e,t){if(fQ(t))return e;let n={...e};return delete n.alignment,n}function mQ(e,t){if(!e)return;let n={};return e.weight&&dQ(`weight`,t)&&(n.weight=e.weight),e.italic&&dQ(`italic`,t)&&(n.italic=e.italic),e.underline&&dQ(`underline`,t)&&(n.underline=e.underline),e.color&&dQ(`color`,t)&&(n.color=e.color),Object.keys(n).length>0?n:void 0}function hQ(e,t){return e.flatMap(e=>{switch(e.type){case`text`:return[{...e,style:mQ(e.style,t)}];case`template`:return t?.allowTemplateVariables===!1?[{type:`text`,text:`{${e.key}}`,style:mQ(e.style,t)}]:[{...e,style:mQ(e.style,t)}];case`lineBreak`:return t?.allowLineBreaks===!1?[{type:`text`,text:` `}]:[e];case`link`:{let n=gQ(e.children,t);return n.length===0?[]:t?.allowLinks===!1?n:[{...e,children:n}]}case`inlineExtension`:return[]}})}function gQ(e,t){return e.flatMap(e=>{switch(e.type){case`text`:return[{...e,style:mQ(e.style,t)}];case`template`:return t?.allowTemplateVariables===!1?[{type:`text`,text:`{${e.key}}`,style:mQ(e.style,t)}]:[{...e,style:mQ(e.style,t)}];case`lineBreak`:return t?.allowLineBreaks===!1?[{type:`text`,text:` `}]:[e]}})}function _Q(e,t){return e.map(e=>pQ({...e,children:hQ(e.children,t)},t))}function vQ(e){return e.trim().length>0?[{type:`paragraph`,children:[{type:`text`,text:e}]}]:[]}function yQ(e,t){return uQ(`bulletList`,t)?{...e,items:e.items.map(e=>({...e,children:_Q(e.children,t)}))}:e.items.flatMap(e=>_Q(e.children,t))}function bQ(e,t){switch(e.type){case`paragraph`:return[pQ({...e,children:hQ(e.children,t)},t)];case`bulletList`:{let n=yQ(e,t);return Array.isArray(n)?n:[n]}case`image`:if(uQ(`image`,t)){let n={...e,caption:e.caption?_Q(e.caption,t):void 0};return fQ(t)||delete n.alignment,[n]}return[...vQ(e.alt??``),...e.caption?_Q(e.caption,t):[]];case`separator`:return uQ(`separator`,t)?[e]:[];case`heading`:if(uQ(`heading`,t)){let n={...e,children:hQ(e.children,t)};return fQ(t)||delete n.alignment,[n]}return[pQ({type:`paragraph`,children:hQ(e.children,t)},t)];case`infoBox`:return uQ(`infoBox`,t)?[{...e,title:e.title?hQ(e.title,t):void 0,children:_Q(e.children,t)}]:[...e.title?[{type:`paragraph`,children:hQ(e.title,t)}]:[],..._Q(e.children,t)];case`blockExtension`:return e.name===`separator`&&uQ(`separator`,t)?[{type:`separator`}]:[]}}function xQ(e,t){if(!e||!t||e.type!==Me.richText)return e;let n=e.doc.blocks.flatMap(e=>bQ(e,t));return{...e,doc:{...e.doc,blocks:n}}}function SQ(e){return e?.variant===`block`}function CQ(e){if(e===`start`)return`left`;if(e===`end`)return`right`;if(e===`left`||e===`center`||e===`right`||e===`justify`)return e}function wQ(e){return e}var TQ=`var(--rich-text-editor-primary-color, var(--primary))`,EQ=`var(--rich-text-editor-accent-color, var(--accent))`,DQ=`var(--rich-text-editor-font-weight-strong, 600)`,OQ=`var(--rich-text-editor-font-weight-normal, 400)`;function kQ(e){if(!e)return;let t={};return e.weight&&(t.weight=e.weight),e.italic&&(t.italic=e.italic),e.underline&&(t.underline=e.underline),e.color&&(t.color=e.color),Object.keys(t).length>0?t:void 0}function AQ(e){if(!e)return``;let t=[];return e.color===`primary`?t.push(`color: ${TQ};`):e.color===`accent`?t.push(`color: ${EQ};`):e.color===`default`&&t.push(`color: inherit;`),t.join(` `)}function jQ(e){if(!e.trim())return;let t=new Map;e.split(`;`).map(e=>e.trim()).filter(Boolean).forEach(e=>{let[n,...r]=e.split(`:`);!n||r.length===0||t.set(n.trim(),r.join(`:`).trim())});let n={},r=t.get(`font-weight`),i=t.get(`font-style`),a=t.get(`text-decoration-line`),o=t.get(`color`);return r===DQ||r===`600`||r===`700`?n.weight=`strong`:(r===OQ||r===`400`||r===`normal`)&&(n.weight=`normal`),(i===`italic`||i===`normal`)&&(n.italic=i),(a===`underline`||a===`none`)&&(n.underline=a),o===TQ?n.color=`primary`:o===EQ?n.color=`accent`:o===`inherit`&&(n.color=`default`),kQ(n)}function MQ(e){let t=jQ(e.getStyle())??{};return e.hasFormat(`bold`)&&(t.weight=`strong`),e.hasFormat(`italic`)&&(t.italic=`italic`),e.hasFormat(`underline`)&&(t.underline=`underline`),kQ(t)}function NQ(e,t){let n=AQ(t);n&&e.setStyle(n),t?.weight===`strong`&&e.toggleFormat(`bold`),t?.italic===`italic`&&e.toggleFormat(`italic`),t?.underline===`underline`&&e.toggleFormat(`underline`)}function PQ(e){return e.children.map(e=>{switch(e.type){case`text`:return e.text;case`template`:return`{${e.key}}`;case`lineBreak`:return`
|
|
151
|
+
`}}).join(``)}function FQ(e){let t=e.filter(e=>e.type===`text`||e.type===`template`);if(t.length===0)return;let[n,...r]=t;return r.every(e=>JSON.stringify(e.style??null)===JSON.stringify(n.style??null))?n.style:void 0}function IQ(e,t){t.forEach(t=>{if(t.type===`lineBreak`){e.append(CH());return}if(t.type===`template`){let n=iQ(t.key);NQ(n,t.style),e.append(n);return}if(t.type===`link`){let n=aQ(PQ(t),t.href);NQ(n,FQ(t.children)),e.append(n);return}if(t.type!==`text`)return;let n=VH(t.text);NQ(n,t.style),e.append(n)})}function LQ(e){return e.map(e=>{switch(e.type){case`text`:return e.text;case`template`:return`{${e.key}}`;case`lineBreak`:return`
|
|
152
|
+
`;case`link`:return e.children.map(e=>{switch(e.type){case`text`:return e.text;case`template`:return`{${e.key}}`;case`lineBreak`:return`
|
|
153
|
+
`}}).join(``);case`inlineExtension`:return``}}).join(``)}function RQ(e){return e.map(e=>LQ(e.children)).join(`
|
|
154
|
+
`)}function zQ(e){return e.length===0?[{type:`paragraph`,children:[]}]:e.split(`
|
|
155
|
+
`).map(e=>({type:`paragraph`,children:e?[{type:`text`,text:e}]:[]}))}function BQ(e){return e?.length?e.map(e=>LQ(e.children)).join(`
|
|
156
|
+
`):``}function VQ(e){let t=e.replace(/\r\n/g,`
|
|
157
|
+
`).trim();if(t.length!==0)return t.split(`
|
|
158
|
+
`).map(e=>({type:`paragraph`,children:e?[{type:`text`,text:e}]:[]}))}function HQ(e){return e.map(e=>{let t=pW();if(IQ(t,e.children),e.alignment){let n=wQ(e.alignment);n&&t.setFormat(n)}return t})}function UQ(e){let t=QW();switch(e.type){case`paragraph`:{let n=pW();if(IQ(n,e.children),e.alignment){let t=wQ(e.alignment);t&&n.setFormat(t)}t.append(n);return}case`bulletList`:{let n=OX(`bullet`);e.items.forEach(e=>{let t=SX(),r=HQ(e.children);r.length===0&&r.push(pW()),t.append(...r),n.append(t)}),t.append(n);return}case`image`:t.append(XX({source:e.source,alt:e.alt,size:e.size,caption:BQ(e.caption),format:wQ(e.alignment)}));return;case`separator`:t.append(MG(JJ()));return;case`heading`:{let n=yq(e.level);if(e.alignment){let t=wQ(e.alignment);t&&n.setFormat(t)}IQ(n,e.children),t.append(n);return}case`infoBox`:{let n=e.title?LQ(e.title):``,r=RQ(e.children);t.append(iZ({tone:e.tone===`warning`?`warning`:`info`,title:n,content:r,collapsible:e.collapsible!==!1,defaultOpen:e.defaultOpen!==!1}));return}case`blockExtension`:return}}function WQ(e,t){let n=xQ(e??Fe(``),t)??Fe(``);if(n.type!==Me.richText){PZ(n.content);return}let r=t?.allowedBlockTypes?.heading===!0,i=t?.allowedBlockTypes?.infoBox===!0;if(n.doc.blocks.some(e=>e.type===`blockExtension`||e.type===`heading`&&!r||e.type===`infoBox`&&!i)){PZ(Be(n));return}let a=QW();a.clear(),n.doc.blocks.forEach(e=>{UQ(e)}),a.getChildrenSize()===0&&a.append(pW())}function GQ(e){return e.flatMap(e=>wH(e)?[{type:`lineBreak`}]:e instanceof nQ?[{type:`template`,key:e.__templateKey,style:MQ(e)}]:e instanceof rQ?[{type:`link`,href:e.getURL(),children:[{type:`text`,text:e.getTextContent(),style:MQ(e)}]}]:J(e)?e.getTextContent().length===0?[]:[{type:`text`,text:e.getTextContent(),style:MQ(e)}]:[])}function KQ(e){let t=CQ(e.getFormatType());return{type:`paragraph`,children:GQ(e.getChildren()),...t?{alignment:t}:{}}}function qQ(e){let t=[],n=[],r=()=>{n.length!==0&&(t.push({type:`paragraph`,children:GQ(n)}),n=[])};for(let i of e.getChildren()){if(mW(i)){r(),t.push(KQ(i));continue}if(kX(i)){r();continue}n.push(i)}return r(),{type:`listItem`,children:t.length>0?t:[{type:`paragraph`,children:[]}]}}function JQ(e,t){let n=[];return e.read(()=>{n=QW().getChildren().flatMap(e=>{if(bq(e)){let t=CQ(e.getFormatType());return[{type:`heading`,level:e.getHeadingLevel(),children:GQ(e.getChildren()),...t?{alignment:t}:{}}]}if(mW(e))return[KQ(e)];if(kX(e)&&e.getListType()===`bullet`)return[{type:`bulletList`,items:e.getChildren().filter(CX).map(e=>qQ(e))}];if(ZX(e)){let t=VQ(e.getCaption());return[{type:`image`,source:e.getSource(),alt:e.getAlt(),size:e.getSize(),alignment:CQ(e.getFormat()),...t?{caption:t}:{}}]}if(YJ(e))return[{type:`separator`}];if(aZ(e)){let t=e.getTitle().trim();return[{type:`infoBox`,tone:e.getTone(),...t.length>0?{title:[{type:`text`,text:e.getTitle()}]}:{},collapsible:e.getCollapsible(),defaultOpen:e.getDefaultOpen(),children:zQ(e.getContent())}]}return[]})}),xQ({type:Me.richText,version:1,doc:{type:`doc`,blocks:n.length>0?n:[{type:`paragraph`,children:[]}]}},t)}function YQ(e,t){let n=NZ();return n.update(()=>{WQ(e,t)},{discrete:!0}),n.getEditorState().toJSON()}function XQ(e=``,t){return e.length===0?FZ(``):YQ(Fe(e),t)}function ZQ({defaultSelection:e}){let[t]=VX();return(0,d.useEffect)(()=>{t.focus(()=>{let e=document.activeElement,n=t.getRootElement();n===null||e!==null&&n.contains(e)||n.focus({preventScroll:!0})},{defaultSelection:e})},[e,t]),null}var QQ=MR?d.useLayoutEffect:d.useEffect,$Q={tag:pH};function e$({initialConfig:e,children:t}){let n=(0,d.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:a,html:o}=e,s=BX(null,t),c=vW({editable:e.editable,html:o,namespace:n,nodes:r,onError:e=>i(e,c),theme:t});return function(e,t){if(t!==null){if(t===void 0)e.update(()=>{let t=QW();if(t.isEmpty()){let n=pW();t.append(n);let r=MR?document.activeElement:null;(X()!==null||r!==null&&r===e.getRootElement())&&n.select()}},$Q);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,$Q);break}case`object`:e.setEditorState(t,$Q);break;case`function`:e.update(()=>{QW().isEmpty()&&t(e)},$Q)}}}(c,a),[c,s]},[]);return QQ(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,p.jsx)(zX.Provider,{value:n,children:t})}function t$(){return QW().getTextContent()}function n$(e,t=!0){if(e)return!1;let n=t$();return t&&(n=n.trim()),n===``}function r$(e){if(!n$(e,!1))return!1;let t=QW().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(nW(n))return!1;if(Z(n)){if(!mW(n)||n.__indent!==0)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++){let n=t[e];if(!J(n))return!1}}}return!0}function i$(e){return()=>r$(e)}var a$=MR?d.useLayoutEffect:d.useEffect;function o$({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:f,ariaRequired:m,autoCapitalize:h,className:g,id:_,role:v=`textbox`,spellCheck:y=!0,style:b,tabIndex:x,"data-testid":S,...C},w){let[T,E]=(0,d.useState)(e.isEditable()),D=(0,d.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),O=(0,d.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(w,D),[D,w]);return a$(()=>(E(e.isEditable()),e.registerEditableListener(e=>{E(e)})),[e]),(0,p.jsx)(`div`,{"aria-activedescendant":T?t:void 0,"aria-autocomplete":T?n:`none`,"aria-controls":T?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":T&&v===`combobox`?!!o:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":T?f:void 0,"aria-readonly":!T||void 0,"aria-required":m,autoCapitalize:h,className:g,contentEditable:T,"data-testid":S,id:_,ref:O,role:v,spellCheck:y,style:b,tabIndex:x,...C})}var s$=(0,d.forwardRef)(o$);function c$(e){return e.getEditorState().read(i$(e.isComposing()))}var l$=(0,d.forwardRef)(u$);function u$(e,t){let{placeholder:n,...r}=e,[i]=VX();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s$,{editor:i,...r,ref:t}),n!=null&&(0,p.jsx)(d$,{editor:i,content:n})]})}function d$({content:e,editor:t}){let n=function(e){let[t,n]=(0,d.useState)(()=>c$(e));return a$(()=>{function t(){n(c$(e))}return t(),mq(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,d.useState)(t.isEditable());if((0,d.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,p.jsx)(`div`,{"aria-hidden":!0,children:a})}var f$=(0,d.createContext)(null),p$={didCatch:!1,error:null},m$=class extends d.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=p$}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(p$))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&h$(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(p$))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,d.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,d.createElement)(f$.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function h$(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function g$({children:e,onError:t}){let n=(0,d.useCallback)((e,n)=>{t(e instanceof Error?e:Error(String(e),{cause:e}),n)},[t]);return(0,p.jsx)(m$,{fallback:(0,p.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}),onError:n,children:e})}function _$(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(Y(a)&&Y(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||iW(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&J(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!J(l)||!J(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function v$(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=_$(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(fH);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(Y(a)&&Y(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!J(r)||!J(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function y$(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function b$(e,t,n,r=Date.now,i,a=null){let o=v$(e,n,r),s=()=>{i&&i(t)};return s(),mq(e.registerCommand(HB,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(gV,!0)),i.length===0&&e.dispatchCommand(_V,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(UB,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(_V,!0));let o=r.pop();r.length===0&&e.dispatchCommand(gV,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(mV,()=>(y$(t,i),!1),0),e.registerCommand(hV,()=>(y$(t,i),e.dispatchCommand(gV,!1),e.dispatchCommand(_V,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(gV,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(_V,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function x$(){return{current:null,redoStack:[],undoStack:[]}}Date.now;function S$({delay:e,externalHistoryState:t}){let[n]=VX();return function(e,t,n=1e3){let r=(0,d.useMemo)(()=>t||x$(),[t]);(0,d.useEffect)(()=>b$(e,r,n),[n,e,r])}(n,t,e),null}function C$({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){let[n]=VX();return(0,d.useEffect)(()=>{if(!n.hasNodes([wX,vX]))throw Error(`ListPlugin: ListNode and/or ListItemNode not registered on editor`)},[n]),(0,d.useEffect)(()=>mq(PX(n,{restoreNumbering:t}),e?FX(n):()=>{}),[n,e,t]),function(e){(0,d.useEffect)(()=>PX(e),[e])}(n),null}var w$=MR?d.useLayoutEffect:d.useEffect;function T$({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[r]=VX();return w$(()=>{if(n)return r.registerUpdateListener(({editorState:i,dirtyElements:a,dirtyLeaves:o,prevEditorState:s,tags:c})=>{t&&a.size===0&&o.size===0||e&&c.has(`history-merge`)||s.isEmpty()||n(i,r,c)})},[r,e,t,n]),null}var E$=MR?d.useLayoutEffect:d.useEffect;function D$(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function O$(){return function(e){let[t]=VX(),n=(0,d.useMemo)(()=>e(t),[t,e]),[r,i]=(0,d.useState)(()=>n.initialValueFn()),a=(0,d.useRef)(r);return E$(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}(D$)}var k$=cq({name:`@lexical/react/ReactProvider`});function A$(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if(typeof i==`string`){let t;try{t=JSON.parse(i)}catch{return}if(t&&t.protocol===`nuanria_messaging`&&t.type===`request`){let r=t.payload;if(r&&r.functionId===`makeChanges`){let t=r.args;if(t){let[r,i,a,o,s]=t;e.update(()=>{let e=X();if(Y(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(J(c)&&r>=0&&i>=0&&(l=r,u=r+i,e.setTextNodeRange(c,l,c,u)),l===u&&a===``||(e.insertRawText(a),c=t.getNode()),J(c)){l=o,u=o+s;let t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener(`message`,n,!0),()=>{window.removeEventListener(`message`,n,!0)}}function j$(e,t){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!==`undefined`){let n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function M$(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var N$={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function P$(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}var F$=(e,t)=>{if(!Y(t))return t.insertRawText(e),!0;let n=e=>{let t=X();Y(t)&&e(t)};return SU(e,{linebreak:()=>n(e=>e.insertParagraph()),tab:()=>n(e=>e.insertNodes([WH()])),text:e=>n(t=>t.insertText(e))}),!0},I$={"application/x-lexical-editor":[(e,t,n)=>{try{let n=JG(),r=JSON.parse(e);if(r&&r.namespace===n._config.namespace&&Array.isArray(r.nodes))return J$(n,Z$(r.nodes),t),!0}catch(e){console.error(e)}return n()}],"text/html":[(e,t,n)=>{try{let n=JG();return J$(n,ZY(n,new DOMParser().parseFromString(P$(e),`text/html`)),t),!0}catch(e){return console.error(e),n()}}],"text/plain":[F$],"text/uri-list":[F$]};function L$(e,t,n,r){if(!e)return!1;let i=a=>!!e[a]&&e[a](t,n,i.bind(null,a-1),r);return i(e.length-1)}function R$(e,t,n){let r=t.getData(`text/plain`);for(let i of function(e){return Object.keys(e.$importMimeType).filter(t=>e.$importMimeType[t]!==void 0).sort((t,n)=>{let r=e.priority[t],i=e.priority[n];return r===void 0&&i===void 0?t<n?-1:+(t>n):r===void 0?1:i===void 0?-1:r-i})}(e)){let a=t.getData(i);if(a&&(i!==`text/html`||a!==r)&&L$(e.$importMimeType[i],a,n,t))return!0}return!1}var z$={$importMimeType:I$,$insertDataTransfer:(e,t)=>R$({$importMimeType:I$,priority:N$},e,t),priority:N$},B$=cq({build:(e,t)=>({$importMimeType:t.$importMimeType,$insertDataTransfer:(e,n)=>R$(t,e,n),priority:t.priority}),config:lq({$importMimeType:I$,priority:N$}),mergeConfig(e,t){let n=uq(e,t);if(t.$importMimeType){let r={...e.$importMimeType};for(let[e,n]of Object.entries(t.$importMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$importMimeType=r}return t.priority&&(n.priority={...e.priority,...t.priority}),n},name:`@lexical/clipboard/Import`});function V$(e,t=X()){return t??M$(166),Y(t)&&t.isCollapsed()||t.getNodes().length===0?``:$Y(e,t)}function H$(e,t=X()){return t??M$(166),Y(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(X$(e,t))}function U$(e,t,n){(function(){let e=WJ(B$.name);return e?e.output:z$})().$insertDataTransfer(e,t)}var W$=`application/x-lexical-drag`;function G$(e,t){let n={editorKey:t.getKey()};e.setData(W$,JSON.stringify(n))}function K$(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(W$);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e){let t=j$(e.clientX,e.clientY);if(t===null)return null;let n=YW(t.node);if(n===null)return null;if(J(n))return OK(n,`next`,t.offset);if(Z(n))return iq(n,t.offset,`next`);let r=n.getParent();return r===null?null:iq(r,n.getIndexWithinParent()+1,`next`)}(e);if(a===null)return!1;let o=sq(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=X();if(s){if(!Y(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=rq(YK(t),`next`);return BK(n,e)<0&&BK(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,qK(LK(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){let n=t.querySelectorAll(`[data-lexical-editor="true"]`);for(let t of Array.from(n)){let n=t.__lexicalEditor;if(n&&n.getKey()===e)return t}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function q$(e,t){return K$(e,t,U$)}function J$(e,t,n){e.dispatchCommand(DB,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(Y(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=GK(t,`previous`);if(r)if(xK(r))n=r.origin;else{let e=RK(r,jK(QW(),`next`).getFlipped());for(let t of e){if(J(t.origin)){n=t.origin;break}if(Z(t.origin)&&!t.origin.isInline())break}}if(n&&J(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function Y$(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=Z(n)&&n.excludeFromCopy(`html`),o=n;t!==null&&J(o)&&(o=Eq(t,o,`clone`));let s=Z(o)?o.getChildren():[],c=function(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&M$(58,n.name),Z(e)){let e=t.children;Array.isArray(e)||M$(59,n.name)}return t}(o);J(o)&&o.getTextContentSize()===0&&(i=!1);for(let r=0;r<s.length;r++){let a=s[r],o=Y$(e,t,a,c.children);!i&&Z(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a)r.push(c);else if(Array.isArray(c.children))for(let e=0;e<c.children.length;e++){let t=c.children[e];r.push(t)}return i}function X$(e,t){let n=[],r=QW().getChildren();for(let i=0;i<r.length;i++)Y$(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}function Z$(e){let t=[];for(let n of e)t.push(UU(n));return t}var Q$=null;async function $$(e,t,n){if(Q$!==null)return!1;if(t!==null)return new Promise((r,i)=>{e.update(()=>{r(e1(e,t,n))})});let r=e.getRootElement(),i=e._window||window,a=i.document,o=LG(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.position=`fixed`,s.style.top=`-1000px`,s.append(a.createTextNode(`#`)),r.append(s);let c=new Range;return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise((t,r)=>{let o=e.registerCommand(dV,r=>(Kq(r,ClipboardEvent)&&(o(),Q$!==null&&(i.clearTimeout(Q$),Q$=null),t(e1(e,r,n))),!0),4);Q$=i.setTimeout(()=>{o(),Q$=null,t(!1)},50),a.execCommand(`copy`),s.remove()})}function e1(e,t,n){if(n===void 0){let t=LG(e._window),r=X();if(!r||r.isCollapsed()||!t)return!1;let i=t.anchorNode,a=t.focusNode;if(i!==null&&a!==null&&!AW(e,i,a))return!1;n=n1(r)}t.preventDefault();let r=t.clipboardData;return r!==null&&(r1(r,n),!0)}var t1=[[`text/html`,V$],[`application/x-lexical-editor`,H$]];function n1(e=X()){return function(e,t){let n={"text/plain":``};for(let[r,i]of Object.entries(e))if(i){let e=o1(i,t);e!==null&&(n[r]=e)}return n}(i1(),e)}function r1(e,t){for(let[n]of t1)t[n]===void 0&&e.setData(n,``);for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}function i1(e=JG()){let t=UJ(e,s1.name);return t?t.output:a1}var a1={"application/x-lexical-editor":[(e,t)=>e?H$(JG(),e):t()],"text/html":[(e,t)=>e?V$(JG(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function o1(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}var s1=cq({build:(e,t,n)=>t.$exportMimeType,config:lq({$exportMimeType:a1}),mergeConfig(e,t){let n=uq(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$exportMimeType=r}return n},name:`@lexical/clipboard/GetClipboardData`});YY.tag(`h1`,`h2`,`h3`,`h4`,`h5`,`h6`),YY.tag(`blockquote`),YY.tag(`p`),YY.tag(`span`);var c1=q(`DRAG_DROP_PASTE_FILE`),l1=class e extends $U{static getType(){return`quote`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`blockquote`);return fq(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:m1,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(BG(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return u1().updateFromJSON(e)}insertNewAfter(e,t){let n=pW(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){let e=pW();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function u1(){return MG(new l1)}var d1=class e extends $U{__tag;static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];fq(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:p1,priority:0}),h2:e=>({conversion:p1,priority:0}),h3:e=>({conversion:p1,priority:0}),h4:e=>({conversion:p1,priority:0}),h5:e=>({conversion:p1,priority:0}),h6:e=>({conversion:p1,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&f1(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>f1(e)?{conversion:e=>({node:h1(`h1`)}),priority:3}:null}}exportDOM(e){let{element:t}=super.exportDOM(e);if(BG(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return h1(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){let n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?pW():h1(this.getTag()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){let e=pW();e.select(),this.replace(e,!0)}return i}collapseAtStart(){if(this.isEmpty()){let e=pW();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function f1(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function p1(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=h1(t),iK(e,n),oK(n,e),aK(n,e)),{node:n}}function m1(e){let t=u1();return oK(t,e),iK(e,t),aK(t,e),{node:t}}function h1(e=`h1`){return MG(new d1(e))}function g1(e){let t=null;if(Kq(e,DragEvent)?t=e.dataTransfer:Kq(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function _1(e){return nW(YW(e))}function v1(e,t,n,r){let i=!1,a=null;if(e.isCollapsed()&&e.anchor.type===`text`){let t=e.anchor.getNode();if(J(t)){a=t;let r=e.anchor.offset,o=r===t.getTextContentSize()&&t.getNextSibling()===null,s=r===0&&t.getPreviousSibling()===null;i=n===`end`&&o||n===`start`&&s||n===`both`&&(o||s)}}let o=!1;for(let[n,s]of Object.entries(r)){if(s==null||!s[t])continue;let r=n;if(s.onlyAtBoundary){if(!(i&&a&&J(a)&&a.hasFormat(r)))continue;o=!0}e.hasFormat(r)&&e.toggleFormat(r)}o&&e.setStyle(``)}var y1={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function b1(e,t=oJ(y1)){return mq(e.registerCommand(OB,()=>{let e=X();return QH(e)?(e.clear(),!0):(Y(e)&&v1(e,`click`,`both`,t.peek()),!1)},0),e.registerCommand(NB,e=>{let t=X();return Y(t)?(t.deleteCharacter(e),!0):!!QH(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(zB,e=>{let t=X();return!!Y(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(BB,e=>{let t=X();return!!Y(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(IB,t=>{let n=X();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)U$(r,n,e);else if(Y(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(RB,()=>{let e=X();return!!Y(e)&&(e.removeText(),!0)},0),e.registerCommand(VB,e=>{let t=X();return!!Y(t)&&(t.formatText(e),!0)},0),e.registerCommand(sV,e=>{let t=X();if(!Y(t)&&!QH(t))return!1;let n=t.getNodes();for(let t of n){let n=dK(t,e=>Z(e)&&!e.isInline());n!==null&&n.setFormat(e)}return!0},0),e.registerCommand(PB,e=>{let t=X();return!!Y(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(FB,()=>{let e=X();return!!Y(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(rV,()=>{let e=WH(),t=X();return Y(t)&&(e.setFormat(t.format),e.setStyle(t.style)),xU([e]),!0},0),e.registerCommand(iV,()=>qq(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(aV,()=>qq(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(YB,e=>{let t=X();if(QH(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(Y(t)){let n=yG(t.focus,!0);if(!e.shiftKey&&nW(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},0),e.registerCommand(XB,e=>{let t=X();if(QH(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(Y(t)){if(function(e){let t=e.focus;return t.key===`root`&&t.offset===QW().getChildrenSize()}(t))return e.preventDefault(),!0;let n=yG(t.focus,!1);if(!e.shiftKey&&nW(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},0),e.registerCommand(qB,e=>{let n=X();if(QH(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),Tq(t[0])?t[0].selectNext(0,0):t[0].selectPrevious(),!0}if(!Y(n))return!1;if(e.shiftKey||v1(n,`arrow`,`start`,t.peek()),Fq(n,!0)){let t=e.shiftKey;return e.preventDefault(),Rq(n,t,!0),!0}return!1},0),e.registerCommand(GB,e=>{let n=X();if(QH(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),Tq(t[0])?t[0].selectPrevious():t[0].selectNext(0,0),!0}if(!Y(n))return!1;if(e.shiftKey||v1(n,`arrow`,`end`,t.peek()),Fq(n,!1)){let t=e.shiftKey;return e.preventDefault(),Rq(n,t,!1),!0}return!1},0),e.registerCommand($B,t=>{if(_1(t.target))return!1;let n=X();if(Y(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(iW(n))return!1;let r=Uq(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(aV,void 0);if(IR&&navigator.language===`ko-KR`)return!1}else if(!QH(n))return!1;return t.preventDefault(),e.dispatchCommand(NB,!0)},0),e.registerCommand(tV,t=>{if(_1(t.target))return!1;let n=X();return!(!Y(n)&&!QH(n))&&(t.preventDefault(),e.dispatchCommand(NB,!1))},0),e.registerCommand(ZB,n=>{let r=X();if(QH(r)){let e=r.getNodes();e.length===1&&nW(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!Y(r))return!1;if(v1(r,`enter`,`both`,t.peek()),n!==null){if((IR||RR||VR)&&FR)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(PB,!1)}return e.dispatchCommand(FB,void 0)},0),e.registerCommand(eV,()=>!!Y(X())&&(e.blur(),!0),0),e.registerCommand(oV,t=>{let[,n]=g1(t);if(n.length>0){let r=t.clientX,i=t.clientY,a=j$(r,i);if(a!==null){let{offset:t,node:r}=a,i=YW(r);if(i!==null){let e=uU();if(J(i))e.anchor.set(i.getKey(),t,`text`),e.focus.set(i.getKey(),t,`text`);else{let t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}eG(Pz(e))}e.dispatchCommand(c1,n)}return t.preventDefault(),!0}return q$(t,e)},0),e.registerCommand(cV,t=>{let[n]=g1(t),r=X();return!(n&&!Y(r))&&(Y(r)&&!r.isCollapsed()&&t.dataTransfer!==null&&(r1(t.dataTransfer,n1(r)),G$(t.dataTransfer,e)),!0)},0),e.registerCommand(lV,e=>{let[t]=g1(e),n=X();if(t&&!Y(n))return!1;let r=e.clientX,i=e.clientY,a=j$(r,i);return a!==null&&nW(YW(a.node))&&e.preventDefault(),!0},0),e.registerCommand(pV,()=>(hG(),!0),0),e.registerCommand(dV,t=>($$(e,Kq(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(fV,t=>(async function(e,t){await $$(t,Kq(e,ClipboardEvent)?e:null),t.update(()=>{let e=X();Y(e)?e.removeText():QH(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),0),e.registerCommand(LB,t=>{let[,n,r]=g1(t);return n.length>0&&!r?(e.dispatchCommand(c1,n),!0):VG(t.target)&&kW(t.target)?!1:X()!==null&&(function(e,t){e.preventDefault(),t.update(()=>{let n=X(),r=Kq(e,InputEvent)||Kq(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&U$(r,n,t)},{tag:`paste`})}(t,e),!0)},0),e.registerCommand(QB,()=>{let e=X();return Y(e)&&v1(e,`space`,`both`,t.peek()),!1},0),e.registerCommand(nV,()=>{let e=X();return Y(e)&&v1(e,`tab`,`both`,t.peek()),!1},0),e.registerCommand(KB,e=>{let t=X();if(!Y(t))return!1;let{anchor:n}=t;if(n.type!==`element`||n.offset!==0)return!1;let r=n.getNode();if(!Z(r))return!1;let i=r.getFirstChild();if(!nW(i)||!i.isInline())return!1;let a=r.getLastDescendant();if(a==null||nW(a))return!1;let o=r.getKey(),s=r.selectEnd();return e.shiftKey&&s.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(JB,e=>{let t=X();if(!Y(t))return!1;let{anchor:n,focus:r}=t,i=dK(r.getNode(),e=>Z(e)&&!e.isInline());if(i===null)return!1;let a=i.getFirstChild();if(!nW(a)||!a.isInline())return!1;let o=i.getLastDescendant();if(o==null||nW(o)||dK(n.getNode(),e=>Z(e)&&!e.isInline())!==i)return!1;let s=i.getKey();return(r.type!==`element`||r.key!==s||r.offset!==0)&&(t.focus.set(s,0,`element`),e.shiftKey||t.anchor.set(s,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}function x1(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var S1=MR?d.useLayoutEffect:d.useEffect;function C1({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,d.useState)(()=>e.getDecorators());return S1(()=>e.registerDecoratorListener(e=>{(0,f.flushSync)(()=>{r(e)})}),[e]),(0,d.useEffect)(()=>{r(e.getDecorators())},[e]),(0,d.useMemo)(()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,p.jsx)(t,{onError:t=>e._onError(t),children:(0,p.jsx)(d.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,f.createPortal)(s,c,o))}return r},[t,n,e])}(e,t)}function w1({editor:e,ErrorBoundary:t}){return function(e){let t=HJ.maybeFromEditor(e);if(t&&t.hasExtensionByName(k$.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&x1(320,e);return!0}return!1}(e)?null:(0,p.jsx)(C1,{editor:e,ErrorBoundary:t})}function T1(e){return e.getEditorState().read(i$(e.isComposing()))}function E1({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=VX();return function(e){S1(()=>mq(b1(e),A$(e)),[e])}(r),(0,p.jsxs)(p.Fragment,{children:[e,(0,p.jsx)(D1,{content:t}),(0,p.jsx)(w1,{editor:r,ErrorBoundary:n})]})}function D1({content:e}){let[t]=VX(),n=function(e){let[t,n]=(0,d.useState)(()=>T1(e));return S1(()=>{function t(){n(T1(e))}return t(),mq(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=O$();return n?typeof e==`function`?e(r):e:null}function O1({horizontalRuleCommandEnabled:e=!1}){let[t]=VX();return(0,u.useEffect)(()=>mq(t.registerCommand(XZ,e=>RZ(e),0),t.registerCommand(ZZ,e=>VZ(e),0),t.registerCommand(QZ,e=>{let n=qZ(e);return e?.openEditor&&n&&t.dispatchCommand($Z,n),n!==null},0),t.registerCommand(eQ,e=>JZ(e),0),t.registerCommand(tQ,e=>YZ(e),0),t.registerCommand(QX,e=>{let n=UZ(e);return n&&window.requestAnimationFrame(()=>{t.dispatchCommand($X,n)}),n!==null},0),t.registerCommand(eZ,e=>KZ(e),0),t.registerCommand(WX,e=>GZ(e),0)),[t]),(0,u.useEffect)(()=>{if(e)return mq(t.registerCommand(GJ,()=>{let e=X();return Y(e)?(e.focus.getNode()!==null&&Wq(JJ()),!0):!1},0))},[t,e]),null}function k1({editable:e}){let[t]=VX();return(0,u.useEffect)(()=>{t.setEditable(e)},[t,e]),null}function A1({control:e,variant:t}){let n=t===`toolbar`?`size-3`:`size-4`,r=V(n,`shrink-0`,t===`menu`&&e.kind!==`color`?`text-muted-foreground`:void 0);switch(e.kind){case`weight`:return e.value===`strong`?(0,p.jsx)(fS,{className:r}):(0,p.jsx)(tC,{className:r});case`italic`:return e.value===`italic`?(0,p.jsx)(Tte,{className:r}):(0,p.jsx)(Mte,{className:r});case`underline`:return e.value===`underline`?(0,p.jsx)(Bte,{className:r}):(0,p.jsx)(HS,{className:r});case`color`:return(0,p.jsx)(OS,{className:V(n,`shrink-0`,e.value===`primary`?`fill-(--rich-text-editor-primary-color,var(--primary)) text-(--rich-text-editor-primary-color,var(--primary))`:`fill-(--rich-text-editor-accent-color,var(--accent)) text-(--rich-text-editor-accent-color,var(--accent))`)})}}function j1(e){return e===`center`?`center`:e===`right`||e===`end`?`right`:e===`justify`?`justify`:`left`}var M1=[{value:`left`,key:`left`,title:`Align left`,Icon:QS},{value:`center`,key:`center`,title:`Align center`,Icon:XS},{value:`right`,key:`right`,title:`Align right`,Icon:ZS},{value:`justify`,key:`justify`,title:`Justify`,Icon:Ite}];function N1({editable:e,linksEnabled:t,blockAlignmentEnabled:n,surfaceRef:r,toolbarClassName:i,styleControls:a,templateVariables:o}){let[s]=VX(),[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1),m=(0,u.useEffectEvent)(()=>{let i=s.getRootElement(),c=r.current,u=window.getSelection(),d=document.activeElement;if(!e||!i||!c||!u||!(d instanceof Node)||!i.contains(d)||u.rangeCount===0||a.length===0&&o.length===0&&!t&&!n){l(null),f(!1);return}let p=u.anchorNode;if(!p||!i.contains(p)){l(null),f(!1);return}s.getEditorState().read(()=>{let e=X();if(!Y(e)||e.isCollapsed()){l(null),f(!1);return}let r=u.getRangeAt(0).getBoundingClientRect(),i=c.getBoundingClientRect();if(r.width===0&&r.height===0){l(null),f(!1);return}let s=r.left-i.left+r.width/2,d=r.top-i.top>40,p=new Set(a.flatMap(t=>zZ(e,t)?[CZ(t)]:[])),m=n&&kZ(e)?DZ(e):null,h=m!==null,g=m?j1(m.getFormatType()):`left`;if(a.length===0&&o.length===0&&!t&&!h){l(null),f(!1);return}let _=h?M1.length:0,v=h&&a.length>0?10:0,y=_+a.length+ +(o.length>0)+ +!!t,b=Math.max(52,y*30+12+v)/2,x=i.width;l({left:Math.min(Math.max(s,b+8),Math.max(x-b-8,b+8)),top:d?r.top-i.top-10:r.bottom-i.top+10,side:d?`top`:`bottom`,activeControlKeys:p,showAlignmentControls:h,activeAlignment:g})})});return(0,u.useEffect)(()=>{if(e)return mq(s.registerCommand(EB,()=>(m(),!1),0),s.registerUpdateListener(()=>{m()}),s.registerRootListener(()=>{m()}))},[n,e,s]),(0,u.useEffect)(()=>{if(!e)return;let t=()=>{};return mq(s.registerRootListener(e=>{if(t(),!e){t=()=>{};return}let n=t=>{let n=t.relatedTarget;n instanceof Node&&e.contains(n)||(l(null),f(!1))};e.addEventListener(`focusout`,n),t=()=>{e.removeEventListener(`focusout`,n)}}),()=>{t()})},[e,s]),(0,u.useEffect)(()=>{if(!c)return;let e=()=>{m()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[c]),c?(0,p.jsxs)(`div`,{className:V(`absolute z-60 flex -translate-x-1/2 items-center gap-1 rounded-xl border border-border/80 bg-background/96 p-1 shadow-lg backdrop-blur-sm`,c.side===`top`?`-translate-y-full`:`translate-y-0`,i),style:{left:c.left,top:c.top},children:[c.showAlignmentControls?(0,p.jsx)(p.Fragment,{children:M1.map(({value:e,key:t,title:n,Icon:r})=>{let i=c.activeAlignment===t;return(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:i?`outline`:`ghost`,title:n,"aria-pressed":i,className:V(i&&`border-primary/70 bg-primary/15 text-primary shadow-sm dark:bg-primary/20`),onMouseDown:e=>{e.preventDefault()},onClick:()=>{s.dispatchCommand(sV,e)},children:(0,p.jsx)(r,{className:`size-3`})},t)})}):null,c.showAlignmentControls&&a.length>0?(0,p.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`mx-0.5 h-5 w-px shrink-0 self-center bg-border/80`}):null,a.map(e=>{let t=wZ(e),n=c.activeControlKeys.has(CZ(e));return(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:n?`outline`:`ghost`,title:t.title,"aria-pressed":n,className:V(n&&`border-primary/70 bg-primary/15 text-primary shadow-sm dark:bg-primary/20`),onMouseDown:e=>{e.preventDefault()},onClick:()=>{s.dispatchCommand(XZ,e)},children:(0,p.jsx)(A1,{control:e,variant:`toolbar`})},CZ(e))}),t?(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:`ghost`,title:`Insert link`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{s.dispatchCommand(QZ,{openEditor:!0})},children:(0,p.jsx)(zS,{className:`size-3`})}):null,o.length>0?(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(H,{type:`button`,size:`icon-xs`,variant:d?`outline`:`ghost`,title:`Insert template variable`,className:V(d&&`border-primary/70 bg-primary/15 text-primary shadow-sm dark:bg-primary/20`),onMouseDown:e=>{e.preventDefault()},onClick:()=>{f(e=>!e)},children:(0,p.jsx)(mS,{className:`size-3`})}),d?(0,p.jsx)(`div`,{className:`absolute left-1/2 top-full mt-2 flex min-w-44 -translate-x-1/2 flex-col gap-1 rounded-xl border border-border/80 bg-background p-1.5 shadow-lg`,children:o.map(e=>(0,p.jsxs)(`button`,{type:`button`,className:`flex items-center justify-between gap-3 rounded-lg px-2 py-1.5 text-left text-sm hover:bg-muted`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{s.dispatchCommand(ZZ,e),f(!1)},children:[(0,p.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,p.jsx)(mS,{className:`size-4 shrink-0 text-muted-foreground`}),(0,p.jsx)(`span`,{className:`truncate`,children:e.label??e.key})]}),(0,p.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:SZ(e.key)})]},e.key))}):null]}):null]}):null}var P1=o((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),F1=o((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,ee=h,k=m,A=r,j=o,M=a,N=f,P=!1;function F(e){return P||(P=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),I(e)||x(e)===l}function I(e){return x(e)===u}function te(e){return x(e)===c}function ne(e){return x(e)===s}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function ie(e){return x(e)===d}function ae(e){return x(e)===i}function oe(e){return x(e)===h}function se(e){return x(e)===m}function ce(e){return x(e)===r}function le(e){return x(e)===o}function ue(e){return x(e)===a}function de(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=ee,e.Memo=k,e.Portal=A,e.Profiler=j,e.StrictMode=M,e.Suspense=N,e.isAsyncMode=F,e.isConcurrentMode=I,e.isContextConsumer=te,e.isContextProvider=ne,e.isElement=re,e.isForwardRef=ie,e.isFragment=ae,e.isLazy=oe,e.isMemo=se,e.isPortal=ce,e.isProfiler=le,e.isStrictMode=ue,e.isSuspense=de,e.isValidElementType=b,e.typeOf=x})()})),I1=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=P1():t.exports=F1()})),L1=o(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),R1=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),z1=o(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),B1=o(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=R1(),i={},a=z1();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),V1=o(((e,t)=>{var n=I1(),r=L1(),i=R1(),a=z1(),o=B1(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:ee};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(j(s)!==e){var c=M(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=j(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=j(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=j(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=P(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return M(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=j(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+N(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return k(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=j(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,M(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function ee(e){function t(t,n,o,s,c){var l=t[n],u=j(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,M(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
60
159
|
Bad object: `+JSON.stringify(t[n],null,` `)+`
|
|
61
|
-
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function A(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(A);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!A(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!A(a[1]))return!1}}else return!1;return!0;default:return!1}}function j(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function M(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:j(t,e)?`symbol`:t}function N(e){if(e==null)return``+e;var t=M(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function P(e){var t=N(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function F(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),Mk=o(((e,t)=>{var n=Ok();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Nk=o(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=Ek();t.exports=jk()(n.isElement,!0)}else t.exports=Mk()()}));const Pk=new Map([[`1km`,`application/vnd.1000minds.decision-model+xml`],[`3dml`,`text/vnd.in3d.3dml`],[`3ds`,`image/x-3ds`],[`3g2`,`video/3gpp2`],[`3gp`,`video/3gp`],[`3gpp`,`video/3gpp`],[`3mf`,`model/3mf`],[`7z`,`application/x-7z-compressed`],[`7zip`,`application/x-7z-compressed`],[`123`,`application/vnd.lotus-1-2-3`],[`aab`,`application/x-authorware-bin`],[`aac`,`audio/x-acc`],[`aam`,`application/x-authorware-map`],[`aas`,`application/x-authorware-seg`],[`abw`,`application/x-abiword`],[`ac`,`application/vnd.nokia.n-gage.ac+xml`],[`ac3`,`audio/ac3`],[`acc`,`application/vnd.americandynamics.acc`],[`ace`,`application/x-ace-compressed`],[`acu`,`application/vnd.acucobol`],[`acutc`,`application/vnd.acucorp`],[`adp`,`audio/adpcm`],[`aep`,`application/vnd.audiograph`],[`afm`,`application/x-font-type1`],[`afp`,`application/vnd.ibm.modcap`],[`ahead`,`application/vnd.ahead.space`],[`ai`,`application/pdf`],[`aif`,`audio/x-aiff`],[`aifc`,`audio/x-aiff`],[`aiff`,`audio/x-aiff`],[`air`,`application/vnd.adobe.air-application-installer-package+zip`],[`ait`,`application/vnd.dvb.ait`],[`ami`,`application/vnd.amiga.ami`],[`amr`,`audio/amr`],[`apk`,`application/vnd.android.package-archive`],[`apng`,`image/apng`],[`appcache`,`text/cache-manifest`],[`application`,`application/x-ms-application`],[`apr`,`application/vnd.lotus-approach`],[`arc`,`application/x-freearc`],[`arj`,`application/x-arj`],[`asc`,`application/pgp-signature`],[`asf`,`video/x-ms-asf`],[`asm`,`text/x-asm`],[`aso`,`application/vnd.accpac.simply.aso`],[`asx`,`video/x-ms-asf`],[`atc`,`application/vnd.acucorp`],[`atom`,`application/atom+xml`],[`atomcat`,`application/atomcat+xml`],[`atomdeleted`,`application/atomdeleted+xml`],[`atomsvc`,`application/atomsvc+xml`],[`atx`,`application/vnd.antix.game-component`],[`au`,`audio/x-au`],[`avi`,`video/x-msvideo`],[`avif`,`image/avif`],[`aw`,`application/applixware`],[`azf`,`application/vnd.airzip.filesecure.azf`],[`azs`,`application/vnd.airzip.filesecure.azs`],[`azv`,`image/vnd.airzip.accelerator.azv`],[`azw`,`application/vnd.amazon.ebook`],[`b16`,`image/vnd.pco.b16`],[`bat`,`application/x-msdownload`],[`bcpio`,`application/x-bcpio`],[`bdf`,`application/x-font-bdf`],[`bdm`,`application/vnd.syncml.dm+wbxml`],[`bdoc`,`application/x-bdoc`],[`bed`,`application/vnd.realvnc.bed`],[`bh2`,`application/vnd.fujitsu.oasysprs`],[`bin`,`application/octet-stream`],[`blb`,`application/x-blorb`],[`blorb`,`application/x-blorb`],[`bmi`,`application/vnd.bmi`],[`bmml`,`application/vnd.balsamiq.bmml+xml`],[`bmp`,`image/bmp`],[`book`,`application/vnd.framemaker`],[`box`,`application/vnd.previewsystems.box`],[`boz`,`application/x-bzip2`],[`bpk`,`application/octet-stream`],[`bpmn`,`application/octet-stream`],[`bsp`,`model/vnd.valve.source.compiled-map`],[`btif`,`image/prs.btif`],[`buffer`,`application/octet-stream`],[`bz`,`application/x-bzip`],[`bz2`,`application/x-bzip2`],[`c`,`text/x-c`],[`c4d`,`application/vnd.clonk.c4group`],[`c4f`,`application/vnd.clonk.c4group`],[`c4g`,`application/vnd.clonk.c4group`],[`c4p`,`application/vnd.clonk.c4group`],[`c4u`,`application/vnd.clonk.c4group`],[`c11amc`,`application/vnd.cluetrust.cartomobile-config`],[`c11amz`,`application/vnd.cluetrust.cartomobile-config-pkg`],[`cab`,`application/vnd.ms-cab-compressed`],[`caf`,`audio/x-caf`],[`cap`,`application/vnd.tcpdump.pcap`],[`car`,`application/vnd.curl.car`],[`cat`,`application/vnd.ms-pki.seccat`],[`cb7`,`application/x-cbr`],[`cba`,`application/x-cbr`],[`cbr`,`application/x-cbr`],[`cbt`,`application/x-cbr`],[`cbz`,`application/x-cbr`],[`cc`,`text/x-c`],[`cco`,`application/x-cocoa`],[`cct`,`application/x-director`],[`ccxml`,`application/ccxml+xml`],[`cdbcmsg`,`application/vnd.contact.cmsg`],[`cda`,`application/x-cdf`],[`cdf`,`application/x-netcdf`],[`cdfx`,`application/cdfx+xml`],[`cdkey`,`application/vnd.mediastation.cdkey`],[`cdmia`,`application/cdmi-capability`],[`cdmic`,`application/cdmi-container`],[`cdmid`,`application/cdmi-domain`],[`cdmio`,`application/cdmi-object`],[`cdmiq`,`application/cdmi-queue`],[`cdr`,`application/cdr`],[`cdx`,`chemical/x-cdx`],[`cdxml`,`application/vnd.chemdraw+xml`],[`cdy`,`application/vnd.cinderella`],[`cer`,`application/pkix-cert`],[`cfs`,`application/x-cfs-compressed`],[`cgm`,`image/cgm`],[`chat`,`application/x-chat`],[`chm`,`application/vnd.ms-htmlhelp`],[`chrt`,`application/vnd.kde.kchart`],[`cif`,`chemical/x-cif`],[`cii`,`application/vnd.anser-web-certificate-issue-initiation`],[`cil`,`application/vnd.ms-artgalry`],[`cjs`,`application/node`],[`cla`,`application/vnd.claymore`],[`class`,`application/octet-stream`],[`clkk`,`application/vnd.crick.clicker.keyboard`],[`clkp`,`application/vnd.crick.clicker.palette`],[`clkt`,`application/vnd.crick.clicker.template`],[`clkw`,`application/vnd.crick.clicker.wordbank`],[`clkx`,`application/vnd.crick.clicker`],[`clp`,`application/x-msclip`],[`cmc`,`application/vnd.cosmocaller`],[`cmdf`,`chemical/x-cmdf`],[`cml`,`chemical/x-cml`],[`cmp`,`application/vnd.yellowriver-custom-menu`],[`cmx`,`image/x-cmx`],[`cod`,`application/vnd.rim.cod`],[`coffee`,`text/coffeescript`],[`com`,`application/x-msdownload`],[`conf`,`text/plain`],[`cpio`,`application/x-cpio`],[`cpp`,`text/x-c`],[`cpt`,`application/mac-compactpro`],[`crd`,`application/x-mscardfile`],[`crl`,`application/pkix-crl`],[`crt`,`application/x-x509-ca-cert`],[`crx`,`application/x-chrome-extension`],[`cryptonote`,`application/vnd.rig.cryptonote`],[`csh`,`application/x-csh`],[`csl`,`application/vnd.citationstyles.style+xml`],[`csml`,`chemical/x-csml`],[`csp`,`application/vnd.commonspace`],[`csr`,`application/octet-stream`],[`css`,`text/css`],[`cst`,`application/x-director`],[`csv`,`text/csv`],[`cu`,`application/cu-seeme`],[`curl`,`text/vnd.curl`],[`cww`,`application/prs.cww`],[`cxt`,`application/x-director`],[`cxx`,`text/x-c`],[`dae`,`model/vnd.collada+xml`],[`daf`,`application/vnd.mobius.daf`],[`dart`,`application/vnd.dart`],[`dataless`,`application/vnd.fdsn.seed`],[`davmount`,`application/davmount+xml`],[`dbf`,`application/vnd.dbf`],[`dbk`,`application/docbook+xml`],[`dcr`,`application/x-director`],[`dcurl`,`text/vnd.curl.dcurl`],[`dd2`,`application/vnd.oma.dd2+xml`],[`ddd`,`application/vnd.fujixerox.ddd`],[`ddf`,`application/vnd.syncml.dmddf+xml`],[`dds`,`image/vnd.ms-dds`],[`deb`,`application/x-debian-package`],[`def`,`text/plain`],[`deploy`,`application/octet-stream`],[`der`,`application/x-x509-ca-cert`],[`dfac`,`application/vnd.dreamfactory`],[`dgc`,`application/x-dgc-compressed`],[`dic`,`text/x-c`],[`dir`,`application/x-director`],[`dis`,`application/vnd.mobius.dis`],[`disposition-notification`,`message/disposition-notification`],[`dist`,`application/octet-stream`],[`distz`,`application/octet-stream`],[`djv`,`image/vnd.djvu`],[`djvu`,`image/vnd.djvu`],[`dll`,`application/octet-stream`],[`dmg`,`application/x-apple-diskimage`],[`dmn`,`application/octet-stream`],[`dmp`,`application/vnd.tcpdump.pcap`],[`dms`,`application/octet-stream`],[`dna`,`application/vnd.dna`],[`doc`,`application/msword`],[`docm`,`application/vnd.ms-word.template.macroEnabled.12`],[`docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`dot`,`application/msword`],[`dotm`,`application/vnd.ms-word.template.macroEnabled.12`],[`dotx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.template`],[`dp`,`application/vnd.osgi.dp`],[`dpg`,`application/vnd.dpgraph`],[`dra`,`audio/vnd.dra`],[`drle`,`image/dicom-rle`],[`dsc`,`text/prs.lines.tag`],[`dssc`,`application/dssc+der`],[`dtb`,`application/x-dtbook+xml`],[`dtd`,`application/xml-dtd`],[`dts`,`audio/vnd.dts`],[`dtshd`,`audio/vnd.dts.hd`],[`dump`,`application/octet-stream`],[`dvb`,`video/vnd.dvb.file`],[`dvi`,`application/x-dvi`],[`dwd`,`application/atsc-dwd+xml`],[`dwf`,`model/vnd.dwf`],[`dwg`,`image/vnd.dwg`],[`dxf`,`image/vnd.dxf`],[`dxp`,`application/vnd.spotfire.dxp`],[`dxr`,`application/x-director`],[`ear`,`application/java-archive`],[`ecelp4800`,`audio/vnd.nuera.ecelp4800`],[`ecelp7470`,`audio/vnd.nuera.ecelp7470`],[`ecelp9600`,`audio/vnd.nuera.ecelp9600`],[`ecma`,`application/ecmascript`],[`edm`,`application/vnd.novadigm.edm`],[`edx`,`application/vnd.novadigm.edx`],[`efif`,`application/vnd.picsel`],[`ei6`,`application/vnd.pg.osasli`],[`elc`,`application/octet-stream`],[`emf`,`image/emf`],[`eml`,`message/rfc822`],[`emma`,`application/emma+xml`],[`emotionml`,`application/emotionml+xml`],[`emz`,`application/x-msmetafile`],[`eol`,`audio/vnd.digital-winds`],[`eot`,`application/vnd.ms-fontobject`],[`eps`,`application/postscript`],[`epub`,`application/epub+zip`],[`es`,`application/ecmascript`],[`es3`,`application/vnd.eszigno3+xml`],[`esa`,`application/vnd.osgi.subsystem`],[`esf`,`application/vnd.epson.esf`],[`et3`,`application/vnd.eszigno3+xml`],[`etx`,`text/x-setext`],[`eva`,`application/x-eva`],[`evy`,`application/x-envoy`],[`exe`,`application/octet-stream`],[`exi`,`application/exi`],[`exp`,`application/express`],[`exr`,`image/aces`],[`ext`,`application/vnd.novadigm.ext`],[`ez`,`application/andrew-inset`],[`ez2`,`application/vnd.ezpix-album`],[`ez3`,`application/vnd.ezpix-package`],[`f`,`text/x-fortran`],[`f4v`,`video/mp4`],[`f77`,`text/x-fortran`],[`f90`,`text/x-fortran`],[`fbs`,`image/vnd.fastbidsheet`],[`fcdt`,`application/vnd.adobe.formscentral.fcdt`],[`fcs`,`application/vnd.isac.fcs`],[`fdf`,`application/vnd.fdf`],[`fdt`,`application/fdt+xml`],[`fe_launch`,`application/vnd.denovo.fcselayout-link`],[`fg5`,`application/vnd.fujitsu.oasysgp`],[`fgd`,`application/x-director`],[`fh`,`image/x-freehand`],[`fh4`,`image/x-freehand`],[`fh5`,`image/x-freehand`],[`fh7`,`image/x-freehand`],[`fhc`,`image/x-freehand`],[`fig`,`application/x-xfig`],[`fits`,`image/fits`],[`flac`,`audio/x-flac`],[`fli`,`video/x-fli`],[`flo`,`application/vnd.micrografx.flo`],[`flv`,`video/x-flv`],[`flw`,`application/vnd.kde.kivio`],[`flx`,`text/vnd.fmi.flexstor`],[`fly`,`text/vnd.fly`],[`fm`,`application/vnd.framemaker`],[`fnc`,`application/vnd.frogans.fnc`],[`fo`,`application/vnd.software602.filler.form+xml`],[`for`,`text/x-fortran`],[`fpx`,`image/vnd.fpx`],[`frame`,`application/vnd.framemaker`],[`fsc`,`application/vnd.fsc.weblaunch`],[`fst`,`image/vnd.fst`],[`ftc`,`application/vnd.fluxtime.clip`],[`fti`,`application/vnd.anser-web-funds-transfer-initiation`],[`fvt`,`video/vnd.fvt`],[`fxp`,`application/vnd.adobe.fxp`],[`fxpl`,`application/vnd.adobe.fxp`],[`fzs`,`application/vnd.fuzzysheet`],[`g2w`,`application/vnd.geoplan`],[`g3`,`image/g3fax`],[`g3w`,`application/vnd.geospace`],[`gac`,`application/vnd.groove-account`],[`gam`,`application/x-tads`],[`gbr`,`application/rpki-ghostbusters`],[`gca`,`application/x-gca-compressed`],[`gdl`,`model/vnd.gdl`],[`gdoc`,`application/vnd.google-apps.document`],[`geo`,`application/vnd.dynageo`],[`geojson`,`application/geo+json`],[`gex`,`application/vnd.geometry-explorer`],[`ggb`,`application/vnd.geogebra.file`],[`ggt`,`application/vnd.geogebra.tool`],[`ghf`,`application/vnd.groove-help`],[`gif`,`image/gif`],[`gim`,`application/vnd.groove-identity-message`],[`glb`,`model/gltf-binary`],[`gltf`,`model/gltf+json`],[`gml`,`application/gml+xml`],[`gmx`,`application/vnd.gmx`],[`gnumeric`,`application/x-gnumeric`],[`gpg`,`application/gpg-keys`],[`gph`,`application/vnd.flographit`],[`gpx`,`application/gpx+xml`],[`gqf`,`application/vnd.grafeq`],[`gqs`,`application/vnd.grafeq`],[`gram`,`application/srgs`],[`gramps`,`application/x-gramps-xml`],[`gre`,`application/vnd.geometry-explorer`],[`grv`,`application/vnd.groove-injector`],[`grxml`,`application/srgs+xml`],[`gsf`,`application/x-font-ghostscript`],[`gsheet`,`application/vnd.google-apps.spreadsheet`],[`gslides`,`application/vnd.google-apps.presentation`],[`gtar`,`application/x-gtar`],[`gtm`,`application/vnd.groove-tool-message`],[`gtw`,`model/vnd.gtw`],[`gv`,`text/vnd.graphviz`],[`gxf`,`application/gxf`],[`gxt`,`application/vnd.geonext`],[`gz`,`application/gzip`],[`gzip`,`application/gzip`],[`h`,`text/x-c`],[`h261`,`video/h261`],[`h263`,`video/h263`],[`h264`,`video/h264`],[`hal`,`application/vnd.hal+xml`],[`hbci`,`application/vnd.hbci`],[`hbs`,`text/x-handlebars-template`],[`hdd`,`application/x-virtualbox-hdd`],[`hdf`,`application/x-hdf`],[`heic`,`image/heic`],[`heics`,`image/heic-sequence`],[`heif`,`image/heif`],[`heifs`,`image/heif-sequence`],[`hej2`,`image/hej2k`],[`held`,`application/atsc-held+xml`],[`hh`,`text/x-c`],[`hjson`,`application/hjson`],[`hlp`,`application/winhlp`],[`hpgl`,`application/vnd.hp-hpgl`],[`hpid`,`application/vnd.hp-hpid`],[`hps`,`application/vnd.hp-hps`],[`hqx`,`application/mac-binhex40`],[`hsj2`,`image/hsj2`],[`htc`,`text/x-component`],[`htke`,`application/vnd.kenameaapp`],[`htm`,`text/html`],[`html`,`text/html`],[`hvd`,`application/vnd.yamaha.hv-dic`],[`hvp`,`application/vnd.yamaha.hv-voice`],[`hvs`,`application/vnd.yamaha.hv-script`],[`i2g`,`application/vnd.intergeo`],[`icc`,`application/vnd.iccprofile`],[`ice`,`x-conference/x-cooltalk`],[`icm`,`application/vnd.iccprofile`],[`ico`,`image/x-icon`],[`ics`,`text/calendar`],[`ief`,`image/ief`],[`ifb`,`text/calendar`],[`ifm`,`application/vnd.shana.informed.formdata`],[`iges`,`model/iges`],[`igl`,`application/vnd.igloader`],[`igm`,`application/vnd.insors.igm`],[`igs`,`model/iges`],[`igx`,`application/vnd.micrografx.igx`],[`iif`,`application/vnd.shana.informed.interchange`],[`img`,`application/octet-stream`],[`imp`,`application/vnd.accpac.simply.imp`],[`ims`,`application/vnd.ms-ims`],[`in`,`text/plain`],[`ini`,`text/plain`],[`ink`,`application/inkml+xml`],[`inkml`,`application/inkml+xml`],[`install`,`application/x-install-instructions`],[`iota`,`application/vnd.astraea-software.iota`],[`ipfix`,`application/ipfix`],[`ipk`,`application/vnd.shana.informed.package`],[`irm`,`application/vnd.ibm.rights-management`],[`irp`,`application/vnd.irepository.package+xml`],[`iso`,`application/x-iso9660-image`],[`itp`,`application/vnd.shana.informed.formtemplate`],[`its`,`application/its+xml`],[`ivp`,`application/vnd.immervision-ivp`],[`ivu`,`application/vnd.immervision-ivu`],[`jad`,`text/vnd.sun.j2me.app-descriptor`],[`jade`,`text/jade`],[`jam`,`application/vnd.jam`],[`jar`,`application/java-archive`],[`jardiff`,`application/x-java-archive-diff`],[`java`,`text/x-java-source`],[`jhc`,`image/jphc`],[`jisp`,`application/vnd.jisp`],[`jls`,`image/jls`],[`jlt`,`application/vnd.hp-jlyt`],[`jng`,`image/x-jng`],[`jnlp`,`application/x-java-jnlp-file`],[`joda`,`application/vnd.joost.joda-archive`],[`jp2`,`image/jp2`],[`jpe`,`image/jpeg`],[`jpeg`,`image/jpeg`],[`jpf`,`image/jpx`],[`jpg`,`image/jpeg`],[`jpg2`,`image/jp2`],[`jpgm`,`video/jpm`],[`jpgv`,`video/jpeg`],[`jph`,`image/jph`],[`jpm`,`video/jpm`],[`jpx`,`image/jpx`],[`js`,`application/javascript`],[`json`,`application/json`],[`json5`,`application/json5`],[`jsonld`,`application/ld+json`],[`jsonl`,`application/jsonl`],[`jsonml`,`application/jsonml+json`],[`jsx`,`text/jsx`],[`jxr`,`image/jxr`],[`jxra`,`image/jxra`],[`jxrs`,`image/jxrs`],[`jxs`,`image/jxs`],[`jxsc`,`image/jxsc`],[`jxsi`,`image/jxsi`],[`jxss`,`image/jxss`],[`kar`,`audio/midi`],[`karbon`,`application/vnd.kde.karbon`],[`kdb`,`application/octet-stream`],[`kdbx`,`application/x-keepass2`],[`key`,`application/x-iwork-keynote-sffkey`],[`kfo`,`application/vnd.kde.kformula`],[`kia`,`application/vnd.kidspiration`],[`kml`,`application/vnd.google-earth.kml+xml`],[`kmz`,`application/vnd.google-earth.kmz`],[`kne`,`application/vnd.kinar`],[`knp`,`application/vnd.kinar`],[`kon`,`application/vnd.kde.kontour`],[`kpr`,`application/vnd.kde.kpresenter`],[`kpt`,`application/vnd.kde.kpresenter`],[`kpxx`,`application/vnd.ds-keypoint`],[`ksp`,`application/vnd.kde.kspread`],[`ktr`,`application/vnd.kahootz`],[`ktx`,`image/ktx`],[`ktx2`,`image/ktx2`],[`ktz`,`application/vnd.kahootz`],[`kwd`,`application/vnd.kde.kword`],[`kwt`,`application/vnd.kde.kword`],[`lasxml`,`application/vnd.las.las+xml`],[`latex`,`application/x-latex`],[`lbd`,`application/vnd.llamagraphics.life-balance.desktop`],[`lbe`,`application/vnd.llamagraphics.life-balance.exchange+xml`],[`les`,`application/vnd.hhe.lesson-player`],[`less`,`text/less`],[`lgr`,`application/lgr+xml`],[`lha`,`application/octet-stream`],[`link66`,`application/vnd.route66.link66+xml`],[`list`,`text/plain`],[`list3820`,`application/vnd.ibm.modcap`],[`listafp`,`application/vnd.ibm.modcap`],[`litcoffee`,`text/coffeescript`],[`lnk`,`application/x-ms-shortcut`],[`log`,`text/plain`],[`lostxml`,`application/lost+xml`],[`lrf`,`application/octet-stream`],[`lrm`,`application/vnd.ms-lrm`],[`ltf`,`application/vnd.frogans.ltf`],[`lua`,`text/x-lua`],[`luac`,`application/x-lua-bytecode`],[`lvp`,`audio/vnd.lucent.voice`],[`lwp`,`application/vnd.lotus-wordpro`],[`lzh`,`application/octet-stream`],[`m1v`,`video/mpeg`],[`m2a`,`audio/mpeg`],[`m2v`,`video/mpeg`],[`m3a`,`audio/mpeg`],[`m3u`,`text/plain`],[`m3u8`,`application/vnd.apple.mpegurl`],[`m4a`,`audio/x-m4a`],[`m4p`,`application/mp4`],[`m4s`,`video/iso.segment`],[`m4u`,`application/vnd.mpegurl`],[`m4v`,`video/x-m4v`],[`m13`,`application/x-msmediaview`],[`m14`,`application/x-msmediaview`],[`m21`,`application/mp21`],[`ma`,`application/mathematica`],[`mads`,`application/mads+xml`],[`maei`,`application/mmt-aei+xml`],[`mag`,`application/vnd.ecowin.chart`],[`maker`,`application/vnd.framemaker`],[`man`,`text/troff`],[`manifest`,`text/cache-manifest`],[`map`,`application/json`],[`mar`,`application/octet-stream`],[`markdown`,`text/markdown`],[`mathml`,`application/mathml+xml`],[`mb`,`application/mathematica`],[`mbk`,`application/vnd.mobius.mbk`],[`mbox`,`application/mbox`],[`mc1`,`application/vnd.medcalcdata`],[`mcd`,`application/vnd.mcd`],[`mcurl`,`text/vnd.curl.mcurl`],[`md`,`text/markdown`],[`mdb`,`application/x-msaccess`],[`mdi`,`image/vnd.ms-modi`],[`mdx`,`text/mdx`],[`me`,`text/troff`],[`mesh`,`model/mesh`],[`meta4`,`application/metalink4+xml`],[`metalink`,`application/metalink+xml`],[`mets`,`application/mets+xml`],[`mfm`,`application/vnd.mfmp`],[`mft`,`application/rpki-manifest`],[`mgp`,`application/vnd.osgeo.mapguide.package`],[`mgz`,`application/vnd.proteus.magazine`],[`mid`,`audio/midi`],[`midi`,`audio/midi`],[`mie`,`application/x-mie`],[`mif`,`application/vnd.mif`],[`mime`,`message/rfc822`],[`mj2`,`video/mj2`],[`mjp2`,`video/mj2`],[`mjs`,`application/javascript`],[`mk3d`,`video/x-matroska`],[`mka`,`audio/x-matroska`],[`mkd`,`text/x-markdown`],[`mks`,`video/x-matroska`],[`mkv`,`video/x-matroska`],[`mlp`,`application/vnd.dolby.mlp`],[`mmd`,`application/vnd.chipnuts.karaoke-mmd`],[`mmf`,`application/vnd.smaf`],[`mml`,`text/mathml`],[`mmr`,`image/vnd.fujixerox.edmics-mmr`],[`mng`,`video/x-mng`],[`mny`,`application/x-msmoney`],[`mobi`,`application/x-mobipocket-ebook`],[`mods`,`application/mods+xml`],[`mov`,`video/quicktime`],[`movie`,`video/x-sgi-movie`],[`mp2`,`audio/mpeg`],[`mp2a`,`audio/mpeg`],[`mp3`,`audio/mpeg`],[`mp4`,`video/mp4`],[`mp4a`,`audio/mp4`],[`mp4s`,`application/mp4`],[`mp4v`,`video/mp4`],[`mp21`,`application/mp21`],[`mpc`,`application/vnd.mophun.certificate`],[`mpd`,`application/dash+xml`],[`mpe`,`video/mpeg`],[`mpeg`,`video/mpeg`],[`mpg`,`video/mpeg`],[`mpg4`,`video/mp4`],[`mpga`,`audio/mpeg`],[`mpkg`,`application/vnd.apple.installer+xml`],[`mpm`,`application/vnd.blueice.multipass`],[`mpn`,`application/vnd.mophun.application`],[`mpp`,`application/vnd.ms-project`],[`mpt`,`application/vnd.ms-project`],[`mpy`,`application/vnd.ibm.minipay`],[`mqy`,`application/vnd.mobius.mqy`],[`mrc`,`application/marc`],[`mrcx`,`application/marcxml+xml`],[`ms`,`text/troff`],[`mscml`,`application/mediaservercontrol+xml`],[`mseed`,`application/vnd.fdsn.mseed`],[`mseq`,`application/vnd.mseq`],[`msf`,`application/vnd.epson.msf`],[`msg`,`application/vnd.ms-outlook`],[`msh`,`model/mesh`],[`msi`,`application/x-msdownload`],[`msl`,`application/vnd.mobius.msl`],[`msm`,`application/octet-stream`],[`msp`,`application/octet-stream`],[`msty`,`application/vnd.muvee.style`],[`mtl`,`model/mtl`],[`mts`,`model/vnd.mts`],[`mus`,`application/vnd.musician`],[`musd`,`application/mmt-usd+xml`],[`musicxml`,`application/vnd.recordare.musicxml+xml`],[`mvb`,`application/x-msmediaview`],[`mvt`,`application/vnd.mapbox-vector-tile`],[`mwf`,`application/vnd.mfer`],[`mxf`,`application/mxf`],[`mxl`,`application/vnd.recordare.musicxml`],[`mxmf`,`audio/mobile-xmf`],[`mxml`,`application/xv+xml`],[`mxs`,`application/vnd.triscape.mxs`],[`mxu`,`video/vnd.mpegurl`],[`n-gage`,`application/vnd.nokia.n-gage.symbian.install`],[`n3`,`text/n3`],[`nb`,`application/mathematica`],[`nbp`,`application/vnd.wolfram.player`],[`nc`,`application/x-netcdf`],[`ncx`,`application/x-dtbncx+xml`],[`nfo`,`text/x-nfo`],[`ngdat`,`application/vnd.nokia.n-gage.data`],[`nitf`,`application/vnd.nitf`],[`nlu`,`application/vnd.neurolanguage.nlu`],[`nml`,`application/vnd.enliven`],[`nnd`,`application/vnd.noblenet-directory`],[`nns`,`application/vnd.noblenet-sealer`],[`nnw`,`application/vnd.noblenet-web`],[`npx`,`image/vnd.net-fpx`],[`nq`,`application/n-quads`],[`nsc`,`application/x-conference`],[`nsf`,`application/vnd.lotus-notes`],[`nt`,`application/n-triples`],[`ntf`,`application/vnd.nitf`],[`numbers`,`application/x-iwork-numbers-sffnumbers`],[`nzb`,`application/x-nzb`],[`oa2`,`application/vnd.fujitsu.oasys2`],[`oa3`,`application/vnd.fujitsu.oasys3`],[`oas`,`application/vnd.fujitsu.oasys`],[`obd`,`application/x-msbinder`],[`obgx`,`application/vnd.openblox.game+xml`],[`obj`,`model/obj`],[`oda`,`application/oda`],[`odb`,`application/vnd.oasis.opendocument.database`],[`odc`,`application/vnd.oasis.opendocument.chart`],[`odf`,`application/vnd.oasis.opendocument.formula`],[`odft`,`application/vnd.oasis.opendocument.formula-template`],[`odg`,`application/vnd.oasis.opendocument.graphics`],[`odi`,`application/vnd.oasis.opendocument.image`],[`odm`,`application/vnd.oasis.opendocument.text-master`],[`odp`,`application/vnd.oasis.opendocument.presentation`],[`ods`,`application/vnd.oasis.opendocument.spreadsheet`],[`odt`,`application/vnd.oasis.opendocument.text`],[`oga`,`audio/ogg`],[`ogex`,`model/vnd.opengex`],[`ogg`,`audio/ogg`],[`ogv`,`video/ogg`],[`ogx`,`application/ogg`],[`omdoc`,`application/omdoc+xml`],[`onepkg`,`application/onenote`],[`onetmp`,`application/onenote`],[`onetoc`,`application/onenote`],[`onetoc2`,`application/onenote`],[`opf`,`application/oebps-package+xml`],[`opml`,`text/x-opml`],[`oprc`,`application/vnd.palm`],[`opus`,`audio/ogg`],[`org`,`text/x-org`],[`osf`,`application/vnd.yamaha.openscoreformat`],[`osfpvg`,`application/vnd.yamaha.openscoreformat.osfpvg+xml`],[`osm`,`application/vnd.openstreetmap.data+xml`],[`otc`,`application/vnd.oasis.opendocument.chart-template`],[`otf`,`font/otf`],[`otg`,`application/vnd.oasis.opendocument.graphics-template`],[`oth`,`application/vnd.oasis.opendocument.text-web`],[`oti`,`application/vnd.oasis.opendocument.image-template`],[`otp`,`application/vnd.oasis.opendocument.presentation-template`],[`ots`,`application/vnd.oasis.opendocument.spreadsheet-template`],[`ott`,`application/vnd.oasis.opendocument.text-template`],[`ova`,`application/x-virtualbox-ova`],[`ovf`,`application/x-virtualbox-ovf`],[`owl`,`application/rdf+xml`],[`oxps`,`application/oxps`],[`oxt`,`application/vnd.openofficeorg.extension`],[`p`,`text/x-pascal`],[`p7a`,`application/x-pkcs7-signature`],[`p7b`,`application/x-pkcs7-certificates`],[`p7c`,`application/pkcs7-mime`],[`p7m`,`application/pkcs7-mime`],[`p7r`,`application/x-pkcs7-certreqresp`],[`p7s`,`application/pkcs7-signature`],[`p8`,`application/pkcs8`],[`p10`,`application/x-pkcs10`],[`p12`,`application/x-pkcs12`],[`pac`,`application/x-ns-proxy-autoconfig`],[`pages`,`application/x-iwork-pages-sffpages`],[`pas`,`text/x-pascal`],[`paw`,`application/vnd.pawaafile`],[`pbd`,`application/vnd.powerbuilder6`],[`pbm`,`image/x-portable-bitmap`],[`pcap`,`application/vnd.tcpdump.pcap`],[`pcf`,`application/x-font-pcf`],[`pcl`,`application/vnd.hp-pcl`],[`pclxl`,`application/vnd.hp-pclxl`],[`pct`,`image/x-pict`],[`pcurl`,`application/vnd.curl.pcurl`],[`pcx`,`image/x-pcx`],[`pdb`,`application/x-pilot`],[`pde`,`text/x-processing`],[`pdf`,`application/pdf`],[`pem`,`application/x-x509-user-cert`],[`pfa`,`application/x-font-type1`],[`pfb`,`application/x-font-type1`],[`pfm`,`application/x-font-type1`],[`pfr`,`application/font-tdpfr`],[`pfx`,`application/x-pkcs12`],[`pgm`,`image/x-portable-graymap`],[`pgn`,`application/x-chess-pgn`],[`pgp`,`application/pgp`],[`php`,`application/x-httpd-php`],[`php3`,`application/x-httpd-php`],[`php4`,`application/x-httpd-php`],[`phps`,`application/x-httpd-php-source`],[`phtml`,`application/x-httpd-php`],[`pic`,`image/x-pict`],[`pkg`,`application/octet-stream`],[`pki`,`application/pkixcmp`],[`pkipath`,`application/pkix-pkipath`],[`pkpass`,`application/vnd.apple.pkpass`],[`pl`,`application/x-perl`],[`plb`,`application/vnd.3gpp.pic-bw-large`],[`plc`,`application/vnd.mobius.plc`],[`plf`,`application/vnd.pocketlearn`],[`pls`,`application/pls+xml`],[`pm`,`application/x-perl`],[`pml`,`application/vnd.ctc-posml`],[`png`,`image/png`],[`pnm`,`image/x-portable-anymap`],[`portpkg`,`application/vnd.macports.portpkg`],[`pot`,`application/vnd.ms-powerpoint`],[`potm`,`application/vnd.ms-powerpoint.presentation.macroEnabled.12`],[`potx`,`application/vnd.openxmlformats-officedocument.presentationml.template`],[`ppa`,`application/vnd.ms-powerpoint`],[`ppam`,`application/vnd.ms-powerpoint.addin.macroEnabled.12`],[`ppd`,`application/vnd.cups-ppd`],[`ppm`,`image/x-portable-pixmap`],[`pps`,`application/vnd.ms-powerpoint`],[`ppsm`,`application/vnd.ms-powerpoint.slideshow.macroEnabled.12`],[`ppsx`,`application/vnd.openxmlformats-officedocument.presentationml.slideshow`],[`ppt`,`application/powerpoint`],[`pptm`,`application/vnd.ms-powerpoint.presentation.macroEnabled.12`],[`pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`pqa`,`application/vnd.palm`],[`prc`,`application/x-pilot`],[`pre`,`application/vnd.lotus-freelance`],[`prf`,`application/pics-rules`],[`provx`,`application/provenance+xml`],[`ps`,`application/postscript`],[`psb`,`application/vnd.3gpp.pic-bw-small`],[`psd`,`application/x-photoshop`],[`psf`,`application/x-font-linux-psf`],[`pskcxml`,`application/pskc+xml`],[`pti`,`image/prs.pti`],[`ptid`,`application/vnd.pvi.ptid1`],[`pub`,`application/x-mspublisher`],[`pvb`,`application/vnd.3gpp.pic-bw-var`],[`pwn`,`application/vnd.3m.post-it-notes`],[`pya`,`audio/vnd.ms-playready.media.pya`],[`pyv`,`video/vnd.ms-playready.media.pyv`],[`qam`,`application/vnd.epson.quickanime`],[`qbo`,`application/vnd.intu.qbo`],[`qfx`,`application/vnd.intu.qfx`],[`qps`,`application/vnd.publishare-delta-tree`],[`qt`,`video/quicktime`],[`qwd`,`application/vnd.quark.quarkxpress`],[`qwt`,`application/vnd.quark.quarkxpress`],[`qxb`,`application/vnd.quark.quarkxpress`],[`qxd`,`application/vnd.quark.quarkxpress`],[`qxl`,`application/vnd.quark.quarkxpress`],[`qxt`,`application/vnd.quark.quarkxpress`],[`ra`,`audio/x-realaudio`],[`ram`,`audio/x-pn-realaudio`],[`raml`,`application/raml+yaml`],[`rapd`,`application/route-apd+xml`],[`rar`,`application/x-rar`],[`ras`,`image/x-cmu-raster`],[`rcprofile`,`application/vnd.ipunplugged.rcprofile`],[`rdf`,`application/rdf+xml`],[`rdz`,`application/vnd.data-vision.rdz`],[`relo`,`application/p2p-overlay+xml`],[`rep`,`application/vnd.businessobjects`],[`res`,`application/x-dtbresource+xml`],[`rgb`,`image/x-rgb`],[`rif`,`application/reginfo+xml`],[`rip`,`audio/vnd.rip`],[`ris`,`application/x-research-info-systems`],[`rl`,`application/resource-lists+xml`],[`rlc`,`image/vnd.fujixerox.edmics-rlc`],[`rld`,`application/resource-lists-diff+xml`],[`rm`,`audio/x-pn-realaudio`],[`rmi`,`audio/midi`],[`rmp`,`audio/x-pn-realaudio-plugin`],[`rms`,`application/vnd.jcp.javame.midlet-rms`],[`rmvb`,`application/vnd.rn-realmedia-vbr`],[`rnc`,`application/relax-ng-compact-syntax`],[`rng`,`application/xml`],[`roa`,`application/rpki-roa`],[`roff`,`text/troff`],[`rp9`,`application/vnd.cloanto.rp9`],[`rpm`,`audio/x-pn-realaudio-plugin`],[`rpss`,`application/vnd.nokia.radio-presets`],[`rpst`,`application/vnd.nokia.radio-preset`],[`rq`,`application/sparql-query`],[`rs`,`application/rls-services+xml`],[`rsa`,`application/x-pkcs7`],[`rsat`,`application/atsc-rsat+xml`],[`rsd`,`application/rsd+xml`],[`rsheet`,`application/urc-ressheet+xml`],[`rss`,`application/rss+xml`],[`rtf`,`text/rtf`],[`rtx`,`text/richtext`],[`run`,`application/x-makeself`],[`rusd`,`application/route-usd+xml`],[`rv`,`video/vnd.rn-realvideo`],[`s`,`text/x-asm`],[`s3m`,`audio/s3m`],[`saf`,`application/vnd.yamaha.smaf-audio`],[`sass`,`text/x-sass`],[`sbml`,`application/sbml+xml`],[`sc`,`application/vnd.ibm.secure-container`],[`scd`,`application/x-msschedule`],[`scm`,`application/vnd.lotus-screencam`],[`scq`,`application/scvp-cv-request`],[`scs`,`application/scvp-cv-response`],[`scss`,`text/x-scss`],[`scurl`,`text/vnd.curl.scurl`],[`sda`,`application/vnd.stardivision.draw`],[`sdc`,`application/vnd.stardivision.calc`],[`sdd`,`application/vnd.stardivision.impress`],[`sdkd`,`application/vnd.solent.sdkm+xml`],[`sdkm`,`application/vnd.solent.sdkm+xml`],[`sdp`,`application/sdp`],[`sdw`,`application/vnd.stardivision.writer`],[`sea`,`application/octet-stream`],[`see`,`application/vnd.seemail`],[`seed`,`application/vnd.fdsn.seed`],[`sema`,`application/vnd.sema`],[`semd`,`application/vnd.semd`],[`semf`,`application/vnd.semf`],[`senmlx`,`application/senml+xml`],[`sensmlx`,`application/sensml+xml`],[`ser`,`application/java-serialized-object`],[`setpay`,`application/set-payment-initiation`],[`setreg`,`application/set-registration-initiation`],[`sfd-hdstx`,`application/vnd.hydrostatix.sof-data`],[`sfs`,`application/vnd.spotfire.sfs`],[`sfv`,`text/x-sfv`],[`sgi`,`image/sgi`],[`sgl`,`application/vnd.stardivision.writer-global`],[`sgm`,`text/sgml`],[`sgml`,`text/sgml`],[`sh`,`application/x-sh`],[`shar`,`application/x-shar`],[`shex`,`text/shex`],[`shf`,`application/shf+xml`],[`shtml`,`text/html`],[`sid`,`image/x-mrsid-image`],[`sieve`,`application/sieve`],[`sig`,`application/pgp-signature`],[`sil`,`audio/silk`],[`silo`,`model/mesh`],[`sis`,`application/vnd.symbian.install`],[`sisx`,`application/vnd.symbian.install`],[`sit`,`application/x-stuffit`],[`sitx`,`application/x-stuffitx`],[`siv`,`application/sieve`],[`skd`,`application/vnd.koan`],[`skm`,`application/vnd.koan`],[`skp`,`application/vnd.koan`],[`skt`,`application/vnd.koan`],[`sldm`,`application/vnd.ms-powerpoint.slide.macroenabled.12`],[`sldx`,`application/vnd.openxmlformats-officedocument.presentationml.slide`],[`slim`,`text/slim`],[`slm`,`text/slim`],[`sls`,`application/route-s-tsid+xml`],[`slt`,`application/vnd.epson.salt`],[`sm`,`application/vnd.stepmania.stepchart`],[`smf`,`application/vnd.stardivision.math`],[`smi`,`application/smil`],[`smil`,`application/smil`],[`smv`,`video/x-smv`],[`smzip`,`application/vnd.stepmania.package`],[`snd`,`audio/basic`],[`snf`,`application/x-font-snf`],[`so`,`application/octet-stream`],[`spc`,`application/x-pkcs7-certificates`],[`spdx`,`text/spdx`],[`spf`,`application/vnd.yamaha.smaf-phrase`],[`spl`,`application/x-futuresplash`],[`spot`,`text/vnd.in3d.spot`],[`spp`,`application/scvp-vp-response`],[`spq`,`application/scvp-vp-request`],[`spx`,`audio/ogg`],[`sql`,`application/x-sql`],[`src`,`application/x-wais-source`],[`srt`,`application/x-subrip`],[`sru`,`application/sru+xml`],[`srx`,`application/sparql-results+xml`],[`ssdl`,`application/ssdl+xml`],[`sse`,`application/vnd.kodak-descriptor`],[`ssf`,`application/vnd.epson.ssf`],[`ssml`,`application/ssml+xml`],[`sst`,`application/octet-stream`],[`st`,`application/vnd.sailingtracker.track`],[`stc`,`application/vnd.sun.xml.calc.template`],[`std`,`application/vnd.sun.xml.draw.template`],[`stf`,`application/vnd.wt.stf`],[`sti`,`application/vnd.sun.xml.impress.template`],[`stk`,`application/hyperstudio`],[`stl`,`model/stl`],[`stpx`,`model/step+xml`],[`stpxz`,`model/step-xml+zip`],[`stpz`,`model/step+zip`],[`str`,`application/vnd.pg.format`],[`stw`,`application/vnd.sun.xml.writer.template`],[`styl`,`text/stylus`],[`stylus`,`text/stylus`],[`sub`,`text/vnd.dvb.subtitle`],[`sus`,`application/vnd.sus-calendar`],[`susp`,`application/vnd.sus-calendar`],[`sv4cpio`,`application/x-sv4cpio`],[`sv4crc`,`application/x-sv4crc`],[`svc`,`application/vnd.dvb.service`],[`svd`,`application/vnd.svd`],[`svg`,`image/svg+xml`],[`svgz`,`image/svg+xml`],[`swa`,`application/x-director`],[`swf`,`application/x-shockwave-flash`],[`swi`,`application/vnd.aristanetworks.swi`],[`swidtag`,`application/swid+xml`],[`sxc`,`application/vnd.sun.xml.calc`],[`sxd`,`application/vnd.sun.xml.draw`],[`sxg`,`application/vnd.sun.xml.writer.global`],[`sxi`,`application/vnd.sun.xml.impress`],[`sxm`,`application/vnd.sun.xml.math`],[`sxw`,`application/vnd.sun.xml.writer`],[`t`,`text/troff`],[`t3`,`application/x-t3vm-image`],[`t38`,`image/t38`],[`taglet`,`application/vnd.mynfc`],[`tao`,`application/vnd.tao.intent-module-archive`],[`tap`,`image/vnd.tencent.tap`],[`tar`,`application/x-tar`],[`tcap`,`application/vnd.3gpp2.tcap`],[`tcl`,`application/x-tcl`],[`td`,`application/urc-targetdesc+xml`],[`teacher`,`application/vnd.smart.teacher`],[`tei`,`application/tei+xml`],[`teicorpus`,`application/tei+xml`],[`tex`,`application/x-tex`],[`texi`,`application/x-texinfo`],[`texinfo`,`application/x-texinfo`],[`text`,`text/plain`],[`tfi`,`application/thraud+xml`],[`tfm`,`application/x-tex-tfm`],[`tfx`,`image/tiff-fx`],[`tga`,`image/x-tga`],[`tgz`,`application/x-tar`],[`thmx`,`application/vnd.ms-officetheme`],[`tif`,`image/tiff`],[`tiff`,`image/tiff`],[`tk`,`application/x-tcl`],[`tmo`,`application/vnd.tmobile-livetv`],[`toml`,`application/toml`],[`torrent`,`application/x-bittorrent`],[`tpl`,`application/vnd.groove-tool-template`],[`tpt`,`application/vnd.trid.tpt`],[`tr`,`text/troff`],[`tra`,`application/vnd.trueapp`],[`trig`,`application/trig`],[`trm`,`application/x-msterminal`],[`ts`,`video/mp2t`],[`tsd`,`application/timestamped-data`],[`tsv`,`text/tab-separated-values`],[`ttc`,`font/collection`],[`ttf`,`font/ttf`],[`ttl`,`text/turtle`],[`ttml`,`application/ttml+xml`],[`twd`,`application/vnd.simtech-mindmapper`],[`twds`,`application/vnd.simtech-mindmapper`],[`txd`,`application/vnd.genomatix.tuxedo`],[`txf`,`application/vnd.mobius.txf`],[`txt`,`text/plain`],[`u8dsn`,`message/global-delivery-status`],[`u8hdr`,`message/global-headers`],[`u8mdn`,`message/global-disposition-notification`],[`u8msg`,`message/global`],[`u32`,`application/x-authorware-bin`],[`ubj`,`application/ubjson`],[`udeb`,`application/x-debian-package`],[`ufd`,`application/vnd.ufdl`],[`ufdl`,`application/vnd.ufdl`],[`ulx`,`application/x-glulx`],[`umj`,`application/vnd.umajin`],[`unityweb`,`application/vnd.unity`],[`uoml`,`application/vnd.uoml+xml`],[`uri`,`text/uri-list`],[`uris`,`text/uri-list`],[`urls`,`text/uri-list`],[`usdz`,`model/vnd.usdz+zip`],[`ustar`,`application/x-ustar`],[`utz`,`application/vnd.uiq.theme`],[`uu`,`text/x-uuencode`],[`uva`,`audio/vnd.dece.audio`],[`uvd`,`application/vnd.dece.data`],[`uvf`,`application/vnd.dece.data`],[`uvg`,`image/vnd.dece.graphic`],[`uvh`,`video/vnd.dece.hd`],[`uvi`,`image/vnd.dece.graphic`],[`uvm`,`video/vnd.dece.mobile`],[`uvp`,`video/vnd.dece.pd`],[`uvs`,`video/vnd.dece.sd`],[`uvt`,`application/vnd.dece.ttml+xml`],[`uvu`,`video/vnd.uvvu.mp4`],[`uvv`,`video/vnd.dece.video`],[`uvva`,`audio/vnd.dece.audio`],[`uvvd`,`application/vnd.dece.data`],[`uvvf`,`application/vnd.dece.data`],[`uvvg`,`image/vnd.dece.graphic`],[`uvvh`,`video/vnd.dece.hd`],[`uvvi`,`image/vnd.dece.graphic`],[`uvvm`,`video/vnd.dece.mobile`],[`uvvp`,`video/vnd.dece.pd`],[`uvvs`,`video/vnd.dece.sd`],[`uvvt`,`application/vnd.dece.ttml+xml`],[`uvvu`,`video/vnd.uvvu.mp4`],[`uvvv`,`video/vnd.dece.video`],[`uvvx`,`application/vnd.dece.unspecified`],[`uvvz`,`application/vnd.dece.zip`],[`uvx`,`application/vnd.dece.unspecified`],[`uvz`,`application/vnd.dece.zip`],[`vbox`,`application/x-virtualbox-vbox`],[`vbox-extpack`,`application/x-virtualbox-vbox-extpack`],[`vcard`,`text/vcard`],[`vcd`,`application/x-cdlink`],[`vcf`,`text/x-vcard`],[`vcg`,`application/vnd.groove-vcard`],[`vcs`,`text/x-vcalendar`],[`vcx`,`application/vnd.vcx`],[`vdi`,`application/x-virtualbox-vdi`],[`vds`,`model/vnd.sap.vds`],[`vhd`,`application/x-virtualbox-vhd`],[`vis`,`application/vnd.visionary`],[`viv`,`video/vnd.vivo`],[`vlc`,`application/videolan`],[`vmdk`,`application/x-virtualbox-vmdk`],[`vob`,`video/x-ms-vob`],[`vor`,`application/vnd.stardivision.writer`],[`vox`,`application/x-authorware-bin`],[`vrml`,`model/vrml`],[`vsd`,`application/vnd.visio`],[`vsf`,`application/vnd.vsf`],[`vss`,`application/vnd.visio`],[`vst`,`application/vnd.visio`],[`vsw`,`application/vnd.visio`],[`vtf`,`image/vnd.valve.source.texture`],[`vtt`,`text/vtt`],[`vtu`,`model/vnd.vtu`],[`vxml`,`application/voicexml+xml`],[`w3d`,`application/x-director`],[`wad`,`application/x-doom`],[`wadl`,`application/vnd.sun.wadl+xml`],[`war`,`application/java-archive`],[`wasm`,`application/wasm`],[`wav`,`audio/x-wav`],[`wax`,`audio/x-ms-wax`],[`wbmp`,`image/vnd.wap.wbmp`],[`wbs`,`application/vnd.criticaltools.wbs+xml`],[`wbxml`,`application/wbxml`],[`wcm`,`application/vnd.ms-works`],[`wdb`,`application/vnd.ms-works`],[`wdp`,`image/vnd.ms-photo`],[`weba`,`audio/webm`],[`webapp`,`application/x-web-app-manifest+json`],[`webm`,`video/webm`],[`webmanifest`,`application/manifest+json`],[`webp`,`image/webp`],[`wg`,`application/vnd.pmi.widget`],[`wgt`,`application/widget`],[`wks`,`application/vnd.ms-works`],[`wm`,`video/x-ms-wm`],[`wma`,`audio/x-ms-wma`],[`wmd`,`application/x-ms-wmd`],[`wmf`,`image/wmf`],[`wml`,`text/vnd.wap.wml`],[`wmlc`,`application/wmlc`],[`wmls`,`text/vnd.wap.wmlscript`],[`wmlsc`,`application/vnd.wap.wmlscriptc`],[`wmv`,`video/x-ms-wmv`],[`wmx`,`video/x-ms-wmx`],[`wmz`,`application/x-msmetafile`],[`woff`,`font/woff`],[`woff2`,`font/woff2`],[`word`,`application/msword`],[`wpd`,`application/vnd.wordperfect`],[`wpl`,`application/vnd.ms-wpl`],[`wps`,`application/vnd.ms-works`],[`wqd`,`application/vnd.wqd`],[`wri`,`application/x-mswrite`],[`wrl`,`model/vrml`],[`wsc`,`message/vnd.wfa.wsc`],[`wsdl`,`application/wsdl+xml`],[`wspolicy`,`application/wspolicy+xml`],[`wtb`,`application/vnd.webturbo`],[`wvx`,`video/x-ms-wvx`],[`x3d`,`model/x3d+xml`],[`x3db`,`model/x3d+fastinfoset`],[`x3dbz`,`model/x3d+binary`],[`x3dv`,`model/x3d-vrml`],[`x3dvz`,`model/x3d+vrml`],[`x3dz`,`model/x3d+xml`],[`x32`,`application/x-authorware-bin`],[`x_b`,`model/vnd.parasolid.transmit.binary`],[`x_t`,`model/vnd.parasolid.transmit.text`],[`xaml`,`application/xaml+xml`],[`xap`,`application/x-silverlight-app`],[`xar`,`application/vnd.xara`],[`xav`,`application/xcap-att+xml`],[`xbap`,`application/x-ms-xbap`],[`xbd`,`application/vnd.fujixerox.docuworks.binder`],[`xbm`,`image/x-xbitmap`],[`xca`,`application/xcap-caps+xml`],[`xcs`,`application/calendar+xml`],[`xdf`,`application/xcap-diff+xml`],[`xdm`,`application/vnd.syncml.dm+xml`],[`xdp`,`application/vnd.adobe.xdp+xml`],[`xdssc`,`application/dssc+xml`],[`xdw`,`application/vnd.fujixerox.docuworks`],[`xel`,`application/xcap-el+xml`],[`xenc`,`application/xenc+xml`],[`xer`,`application/patch-ops-error+xml`],[`xfdf`,`application/vnd.adobe.xfdf`],[`xfdl`,`application/vnd.xfdl`],[`xht`,`application/xhtml+xml`],[`xhtml`,`application/xhtml+xml`],[`xhvml`,`application/xv+xml`],[`xif`,`image/vnd.xiff`],[`xl`,`application/excel`],[`xla`,`application/vnd.ms-excel`],[`xlam`,`application/vnd.ms-excel.addin.macroEnabled.12`],[`xlc`,`application/vnd.ms-excel`],[`xlf`,`application/xliff+xml`],[`xlm`,`application/vnd.ms-excel`],[`xls`,`application/vnd.ms-excel`],[`xlsb`,`application/vnd.ms-excel.sheet.binary.macroEnabled.12`],[`xlsm`,`application/vnd.ms-excel.sheet.macroEnabled.12`],[`xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`xlt`,`application/vnd.ms-excel`],[`xltm`,`application/vnd.ms-excel.template.macroEnabled.12`],[`xltx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.template`],[`xlw`,`application/vnd.ms-excel`],[`xm`,`audio/xm`],[`xml`,`application/xml`],[`xns`,`application/xcap-ns+xml`],[`xo`,`application/vnd.olpc-sugar`],[`xop`,`application/xop+xml`],[`xpi`,`application/x-xpinstall`],[`xpl`,`application/xproc+xml`],[`xpm`,`image/x-xpixmap`],[`xpr`,`application/vnd.is-xpr`],[`xps`,`application/vnd.ms-xpsdocument`],[`xpw`,`application/vnd.intercon.formnet`],[`xpx`,`application/vnd.intercon.formnet`],[`xsd`,`application/xml`],[`xsl`,`application/xml`],[`xslt`,`application/xslt+xml`],[`xsm`,`application/vnd.syncml+xml`],[`xspf`,`application/xspf+xml`],[`xul`,`application/vnd.mozilla.xul+xml`],[`xvm`,`application/xv+xml`],[`xvml`,`application/xv+xml`],[`xwd`,`image/x-xwindowdump`],[`xyz`,`chemical/x-xyz`],[`xz`,`application/x-xz`],[`yaml`,`text/yaml`],[`yang`,`application/yang`],[`yin`,`application/yin+xml`],[`yml`,`text/yaml`],[`ymp`,`text/x-suse-ymp`],[`z`,`application/x-compress`],[`z1`,`application/x-zmachine`],[`z2`,`application/x-zmachine`],[`z3`,`application/x-zmachine`],[`z4`,`application/x-zmachine`],[`z5`,`application/x-zmachine`],[`z6`,`application/x-zmachine`],[`z7`,`application/x-zmachine`],[`z8`,`application/x-zmachine`],[`zaz`,`application/vnd.zzazz.deck+xml`],[`zip`,`application/zip`],[`zir`,`application/vnd.zul`],[`zirz`,`application/vnd.zul`],[`zmm`,`application/vnd.handheld-entertainment+xml`],[`zsh`,`text/x-scriptzsh`]]);function Fk(e,t,n){let r=Ik(e),{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&Lk(r,`path`,a),n!==void 0&&Object.defineProperty(r,`handle`,{value:n,writable:!1,configurable:!1,enumerable:!0}),Lk(r,`relativePath`,a),r}function Ik(e){let{name:t}=e;if(t&&t.lastIndexOf(`.`)!==-1&&!e.type){let n=t.split(`.`).pop().toLowerCase(),r=Pk.get(n);r&&Object.defineProperty(e,`type`,{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}function Lk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var Rk=[`.DS_Store`,`Thumbs.db`];function zk(e){return qe(this,void 0,void 0,function*(){return Hk(e)&&Bk(e.dataTransfer)?Gk(e.dataTransfer,e.type):Vk(e)?Uk(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?Wk(e):[]})}function Bk(e){return Hk(e)}function Vk(e){return Hk(e)&&Hk(e.target)}function Hk(e){return typeof e==`object`&&!!e}function Uk(e){return qk(e.target.files).map(e=>Fk(e))}function Wk(e){return qe(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>e.getFile()))).map(e=>Fk(e))})}function Gk(e,t){return qe(this,void 0,void 0,function*(){if(e.items){let n=qk(e.items).filter(e=>e.kind===`file`);return t===`drop`?Kk(Yk(yield Promise.all(n.map(Jk)))):n}return Kk(qk(e.files).map(e=>Fk(e)))})}function Kk(e){return e.filter(e=>Rk.indexOf(e.name)===-1)}function qk(e){if(e===null)return[];let t=[];for(let n=0;n<e.length;n++){let r=e[n];t.push(r)}return t}function Jk(e){if(typeof e.webkitGetAsEntry!=`function`)return Xk(e);let t=e.webkitGetAsEntry();return t&&t.isDirectory?Qk(t):Xk(e,t)}function Yk(e){return e.reduce((e,t)=>[...e,...Array.isArray(t)?Yk(t):[t]],[])}function Xk(e,t){return qe(this,void 0,void 0,function*(){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`){let t=yield e.getAsFileSystemHandle();if(t===null)throw Error(`${e} is not a File`);if(t!==void 0){let e=yield t.getFile();return e.handle=t,Fk(e)}}let n=e.getAsFile();if(!n)throw Error(`${e} is not a File`);return Fk(n,t?.fullPath??void 0)})}function Zk(e){return qe(this,void 0,void 0,function*(){return e.isDirectory?Qk(e):$k(e)})}function Qk(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(t=>qe(this,void 0,void 0,function*(){if(t.length){let e=Promise.all(t.map(Zk));r.push(e),i()}else try{e(yield Promise.all(r))}catch(e){n(e)}}),e=>{n(e)})}i()})}function $k(e){return qe(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(n=>{t(Fk(n,e.fullPath))},e=>{n(e)})})})}var eA=o((e=>{e.__esModule=!0,e.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(`,`);if(n.length===0)return!0;var r=e.name||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}})),tA=c(Nk()),nA=c(eA());function rA(e){return oA(e)||aA(e)||fA(e)||iA()}function iA(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
62
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
63
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
64
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
65
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ej(e,t){if(e){if(typeof e==`string`)return tj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tj(e,t)}}function tj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nj(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function rj(e){if(Array.isArray(e))return e}function ij(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ij(Object(n),!0).forEach(function(t){oj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ij(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sj(e,t){if(e==null)return{};var n=cj(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cj(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lj=(0,l.forwardRef)(function(e,t){var n=e.children,r=fj(sj(e,WA)),i=r.open,a=sj(r,GA);return(0,l.useImperativeHandle)(t,function(){return{open:i}},[i]),l.default.createElement(l.Fragment,null,n(aj(aj({},a),{},{open:i})))});lj.displayName=`Dropzone`;var uj={disabled:!1,getFilesFromEvent:zk,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};lj.defaultProps=uj,lj.propTypes={children:tA.default.func,accept:tA.default.objectOf(tA.default.arrayOf(tA.default.string)),multiple:tA.default.bool,preventDropOnDocument:tA.default.bool,noClick:tA.default.bool,noKeyboard:tA.default.bool,noDrag:tA.default.bool,noDragEventsBubbling:tA.default.bool,minSize:tA.default.number,maxSize:tA.default.number,maxFiles:tA.default.number,disabled:tA.default.bool,getFilesFromEvent:tA.default.func,onFileDialogCancel:tA.default.func,onFileDialogOpen:tA.default.func,useFsAccessApi:tA.default.bool,autoFocus:tA.default.bool,onDragEnter:tA.default.func,onDragLeave:tA.default.func,onDragOver:tA.default.func,onDrop:tA.default.func,onDropAccepted:tA.default.func,onDropRejected:tA.default.func,onError:tA.default.func,validator:tA.default.func};var dj={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function fj(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=aj(aj({},uj),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,u=t.onDragEnter,d=t.onDragLeave,f=t.onDragOver,p=t.onDrop,m=t.onDropAccepted,h=t.onDropRejected,g=t.onFileDialogCancel,_=t.onFileDialogOpen,v=t.useFsAccessApi,y=t.autoFocus,b=t.preventDropOnDocument,x=t.noClick,S=t.noKeyboard,C=t.noDrag,w=t.noDragEventsBubbling,T=t.onError,E=t.validator,D=(0,l.useMemo)(function(){return zA(n)},[n]),O=(0,l.useMemo)(function(){return RA(n)},[n]),k=(0,l.useMemo)(function(){return typeof _==`function`?_:mj},[_]),A=(0,l.useMemo)(function(){return typeof g==`function`?g:mj},[g]),j=(0,l.useRef)(null),M=(0,l.useRef)(null),N=QA((0,l.useReducer)(pj,dj),2),P=N[0],F=N[1],I=P.isFocused,L=P.isFileDialogActive,R=(0,l.useRef)(typeof window<`u`&&window.isSecureContext&&v&&LA()),z=function(){!R.current&&L&&setTimeout(function(){M.current&&(M.current.files.length||(F({type:`closeDialog`}),A()))},300)};(0,l.useEffect)(function(){return window.addEventListener(`focus`,z,!1),function(){window.removeEventListener(`focus`,z,!1)}},[M,L,A,R]);var B=(0,l.useRef)([]),V=(0,l.useRef)([]),H=function(e){j.current&&j.current.contains(e.target)||(e.preventDefault(),B.current=[])};(0,l.useEffect)(function(){return b&&(document.addEventListener(`dragover`,MA,!1),document.addEventListener(`drop`,H,!1)),function(){b&&(document.removeEventListener(`dragover`,MA),document.removeEventListener(`drop`,H))}},[j,b]),(0,l.useEffect)(function(){var e=function(e){V.current=[].concat(JA(V.current),[e.target]),jA(e)&&F({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){V.current=V.current.filter(function(t){return t!==e.target&&t!==null}),!(V.current.length>0)&&F({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){V.current=[],F({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){V.current=[],F({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[j]),(0,l.useEffect)(function(){return!r&&y&&j.current&&j.current.focus(),function(){}},[j,y,r]);var ee=(0,l.useCallback)(function(e){T?T(e):console.error(e)},[T]),te=(0,l.useCallback)(function(e){e.preventDefault(),e.persist(),de(e),B.current=[].concat(JA(B.current),[e.target]),jA(e)&&Promise.resolve(i(e)).then(function(t){if(!(AA(e)&&!w)){var n=t.length,r=n>0&&kA({files:t,accept:D,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:E});F({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),u&&u(e)}}).catch(function(e){return ee(e)})},[i,u,ee,w,D,o,a,s,c,E]),U=(0,l.useCallback)(function(e){e.preventDefault(),e.persist(),de(e);var t=jA(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&f&&f(e),!1},[f,w]),W=(0,l.useCallback)(function(e){e.preventDefault(),e.persist(),de(e);var t=B.current.filter(function(e){return j.current&&j.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),B.current=t,!(t.length>0)&&(F({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),jA(e)&&d&&d(e))},[j,d,w]),ne=(0,l.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=QA(EA(e,D),2),i=t[0],s=t[1],c=QA(DA(e,o,a),2),l=c[0],u=c[1],d=E?E(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[wA]})}),n.splice(0)),F({acceptedFiles:n,fileRejections:r,type:`setFiles`}),p&&p(n,r,t),r.length>0&&h&&h(r,t),n.length>0&&m&&m(n,t)},[F,s,D,o,a,c,p,m,h,E]),re=(0,l.useCallback)(function(e){e.preventDefault(),e.persist(),de(e),B.current=[],jA(e)&&Promise.resolve(i(e)).then(function(t){AA(e)&&!w||ne(t,e)}).catch(function(e){return ee(e)}),F({type:`reset`})},[i,ne,ee,w]),ie=(0,l.useCallback)(function(){if(R.current){F({type:`openDialog`}),k();var e={multiple:s,types:O};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){ne(e,null),F({type:`closeDialog`})}).catch(function(e){BA(e)?(A(e),F({type:`closeDialog`})):VA(e)?(R.current=!1,M.current?(M.current.value=null,M.current.click()):ee(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):ee(e)});return}M.current&&(F({type:`openDialog`}),k(),M.current.value=null,M.current.click())},[F,k,A,v,ne,ee,O,s]),ae=(0,l.useCallback)(function(e){!j.current||!j.current.isEqualNode(e.target)||(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),ie())},[j,ie]),oe=(0,l.useCallback)(function(){F({type:`focus`})},[]),G=(0,l.useCallback)(function(){F({type:`blur`})},[]),se=(0,l.useCallback)(function(){x||(FA()?setTimeout(ie,0):ie())},[x,ie]),ce=function(e){return r?null:e},le=function(e){return S?null:ce(e)},ue=function(e){return C?null:ce(e)},de=function(e){w&&e.stopPropagation()},fe=(0,l.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=sj(e,KA);return aj(aj(oj({onKeyDown:le(IA(a,ae)),onFocus:le(IA(o,oe)),onBlur:le(IA(s,G)),onClick:ce(IA(c,se)),onDragEnter:ue(IA(l,te)),onDragOver:ue(IA(u,U)),onDragLeave:ue(IA(d,W)),onDrop:ue(IA(f,re)),role:typeof i==`string`&&i!==``?i:`presentation`},n,j),!r&&!S?{tabIndex:0}:{}),p)}},[j,ae,oe,G,se,te,U,W,re,S,C,r]),pe=(0,l.useCallback)(function(e){e.stopPropagation()},[]),me=(0,l.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=sj(e,qA);return aj(aj({},oj({accept:D,multiple:s,type:`file`,style:{border:0,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`0 -1px -1px 0`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`},onChange:ce(IA(r,re)),onClick:ce(IA(i,pe)),tabIndex:-1},n,M)),a)}},[M,n,s,re,r]);return aj(aj({},P),{},{isFocused:I&&!r,getRootProps:fe,getInputProps:me,rootRef:j,inputRef:M,open:ce(ie)})}function pj(e,t){switch(t.type){case`focus`:return aj(aj({},e),{},{isFocused:!0});case`blur`:return aj(aj({},e),{},{isFocused:!1});case`openDialog`:return aj(aj({},dj),{},{isFileDialogActive:!0});case`closeDialog`:return aj(aj({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return aj(aj({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return aj(aj({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return aj(aj({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return aj({},dj);default:return e}}function mj(){}var hj=g(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function gj({className:e,orientation:t=`vertical`,...n}){return(0,d.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:Y(hj({orientation:t}),e),...n})}function _j({className:e,...t}){return(0,d.jsx)(`div`,{"data-slot":`field-content`,className:Y(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function vj({className:e,...t}){return(0,d.jsx)(f_,{"data-slot":`field-label`,className:Y(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function yj({className:e,...t}){return(0,d.jsx)(`p`,{"data-slot":`field-description`,className:Y(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function bj({className:e,children:t,errors:n,...r}){let i=(0,l.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,d.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,d.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,d.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:Y(`text-sm font-normal text-destructive`,e),...r,children:i}):null}var xj={upload:`Click to pick file`,drag:`or drag and drop`,active:`Drop files here`,reject:`Some files are not allowed`,rejectInvalidType:`One or more files have an invalid type.`,rejectTooLarge:`One or more files exceed the maximum size.`,rejectTooSmall:`One or more files are below the minimum size.`,rejectTooMany:`Too many files selected.`,selectedCount:`{{count}} files selected`};function Sj(e,t){return e.replace(/\{\{\s*count\s*\}\}|\{count\}/g,String(t))}function Cj({id:e,name:t,label:n,description:r,error:i,accept:a,multiple:o=!1,disabled:s=!1,required:c=!1,maxFiles:u,maxSize:f,minSize:p,icon:m,className:h,labelClassName:g,contentClassName:_,descriptionClassName:v,errorClassName:y,dropzoneClassName:b,labels:x,onChange:S,onDropRejected:C,...w}){let T={...xj,...x},E=r?`${e}-description`:void 0,D=(0,l.useEffectEvent)(e=>{S?.(e)}),{acceptedFiles:O,fileRejections:k,getRootProps:A,getInputProps:j,isDragActive:M,isDragReject:N,isFocused:P}=fj({accept:a,multiple:o,disabled:s,maxFiles:u,maxSize:f,minSize:p,onDropRejected:(0,l.useCallback)(e=>{C?.(e)},[C])}),F=(0,l.useMemo)(()=>{if(k.length===0)return[];let e=new Set(k.flatMap(e=>e.errors.map(e=>e.code))),t=[];return e.has(`file-invalid-type`)&&t.push(T.rejectInvalidType),e.has(`file-too-large`)&&t.push(T.rejectTooLarge),e.has(`file-too-small`)&&t.push(T.rejectTooSmall),e.has(`too-many-files`)&&t.push(T.rejectTooMany),t.length===0&&t.push(T.reject),t},[k,T.reject,T.rejectInvalidType,T.rejectTooLarge,T.rejectTooSmall,T.rejectTooMany]),I=!!i||F.length>0,L=I?`${e}-error`:void 0,R=[E,L].filter(Boolean).join(` `)||void 0;(0,l.useEffect)(()=>{D(O)},[O]);let z=Sj(T.selectedCount,O.length);return(0,d.jsxs)(gj,{"data-component":`filepicker-dropzone`,"data-disabled":s?!0:void 0,"data-invalid":I?!0:void 0,className:Y(h),...w,children:[n&&(0,d.jsx)(vj,{htmlFor:e,className:g,children:n}),(0,d.jsxs)(_j,{className:_,children:[r&&(0,d.jsx)(yj,{id:E,className:v,children:r}),(0,d.jsxs)(`div`,{...A({className:Y(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 relative rounded-lg border border-dashed bg-transparent p-4 transition-colors outline-none focus-visible:ring-3 aria-invalid:ring-3`,s?`bg-input/50 dark:bg-input/80 pointer-events-none cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-muted/30`,M&&`border-primary bg-primary/5`,N&&`border-destructive/60 bg-destructive/5`,P&&`border-ring ring-ring/50 ring-3`,b),"aria-invalid":I?!0:void 0}),children:[(0,d.jsx)(`input`,{...j({id:e,name:t,required:c,"aria-describedby":R,"aria-invalid":I?!0:void 0})}),(0,d.jsxs)(`div`,{className:`flex min-h-14 flex-col items-center justify-center gap-2 text-center`,children:[(0,d.jsx)(`span`,{className:Y(`text-muted-foreground`,M&&`text-primary`,N&&`text-destructive`),"aria-hidden":`true`,children:m??(0,d.jsx)(ty,{className:`size-6`})}),(0,d.jsxs)(`p`,{className:`text-sm`,children:[N&&(0,d.jsx)(`span`,{className:`text-destructive font-medium`,children:T.reject}),!N&&M&&(0,d.jsx)(`span`,{className:`text-primary font-medium`,children:T.active}),!N&&!M&&O.length>0&&(0,d.jsx)(`span`,{className:`font-medium`,children:z}),!N&&!M&&O.length===0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{className:`text-foreground font-medium`,children:T.upload}),` `,(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:T.drag})]})]})]})]}),i?(0,d.jsx)(bj,{id:L,className:y,children:i}):F.length>0?(0,d.jsx)(bj,{id:L,className:y,errors:F.map(e=>({message:e}))}):null]})]})}exports.FilepickerDropzone=Cj,exports.SurveyEditor=hk,exports.SurveyPlayer=bm,exports.buildSurveyFileName=bk,exports.cloneRegistryEntries=ik,exports.createBlankEditorState=gk,exports.createComposedEditorRegistry=sk,exports.createEditorStateFromRawSurvey=_k,exports.createRegistryEntries=ak,exports.createSurveyPlayerRegistry=ck,exports.entriesToComposedEditorRegistry=gx,exports.entriesToItemTypeRegistry=px,exports.entriesToParticipantRegistry=mx,exports.getDefaultComposedEditorRegistry=lk,exports.getDefaultRegistryEntries=ok,exports.getDefaultSurveyPlayerRegistry=uk,exports.parseEditorStateFromJsonText=vk,exports.serializeSurveyStateForFile=yk,exports.validateRegistryEntries=fx;
|
|
160
|
+
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function k(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(k);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!k(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!k(a[1]))return!1}}else return!1;return!0;default:return!1}}function A(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function j(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:A(t,e)?`symbol`:t}function M(e){if(e==null)return``+e;var t=j(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function N(e){var t=M(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function P(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),H1=o(((e,t)=>{var n=R1();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),U1=o(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=I1();t.exports=V1()(n.isElement,!0)}else t.exports=H1()()})),W1=new Map([[`1km`,`application/vnd.1000minds.decision-model+xml`],[`3dml`,`text/vnd.in3d.3dml`],[`3ds`,`image/x-3ds`],[`3g2`,`video/3gpp2`],[`3gp`,`video/3gp`],[`3gpp`,`video/3gpp`],[`3mf`,`model/3mf`],[`7z`,`application/x-7z-compressed`],[`7zip`,`application/x-7z-compressed`],[`123`,`application/vnd.lotus-1-2-3`],[`aab`,`application/x-authorware-bin`],[`aac`,`audio/x-acc`],[`aam`,`application/x-authorware-map`],[`aas`,`application/x-authorware-seg`],[`abw`,`application/x-abiword`],[`ac`,`application/vnd.nokia.n-gage.ac+xml`],[`ac3`,`audio/ac3`],[`acc`,`application/vnd.americandynamics.acc`],[`ace`,`application/x-ace-compressed`],[`acu`,`application/vnd.acucobol`],[`acutc`,`application/vnd.acucorp`],[`adp`,`audio/adpcm`],[`aep`,`application/vnd.audiograph`],[`afm`,`application/x-font-type1`],[`afp`,`application/vnd.ibm.modcap`],[`ahead`,`application/vnd.ahead.space`],[`ai`,`application/pdf`],[`aif`,`audio/x-aiff`],[`aifc`,`audio/x-aiff`],[`aiff`,`audio/x-aiff`],[`air`,`application/vnd.adobe.air-application-installer-package+zip`],[`ait`,`application/vnd.dvb.ait`],[`ami`,`application/vnd.amiga.ami`],[`amr`,`audio/amr`],[`apk`,`application/vnd.android.package-archive`],[`apng`,`image/apng`],[`appcache`,`text/cache-manifest`],[`application`,`application/x-ms-application`],[`apr`,`application/vnd.lotus-approach`],[`arc`,`application/x-freearc`],[`arj`,`application/x-arj`],[`asc`,`application/pgp-signature`],[`asf`,`video/x-ms-asf`],[`asm`,`text/x-asm`],[`aso`,`application/vnd.accpac.simply.aso`],[`asx`,`video/x-ms-asf`],[`atc`,`application/vnd.acucorp`],[`atom`,`application/atom+xml`],[`atomcat`,`application/atomcat+xml`],[`atomdeleted`,`application/atomdeleted+xml`],[`atomsvc`,`application/atomsvc+xml`],[`atx`,`application/vnd.antix.game-component`],[`au`,`audio/x-au`],[`avi`,`video/x-msvideo`],[`avif`,`image/avif`],[`aw`,`application/applixware`],[`azf`,`application/vnd.airzip.filesecure.azf`],[`azs`,`application/vnd.airzip.filesecure.azs`],[`azv`,`image/vnd.airzip.accelerator.azv`],[`azw`,`application/vnd.amazon.ebook`],[`b16`,`image/vnd.pco.b16`],[`bat`,`application/x-msdownload`],[`bcpio`,`application/x-bcpio`],[`bdf`,`application/x-font-bdf`],[`bdm`,`application/vnd.syncml.dm+wbxml`],[`bdoc`,`application/x-bdoc`],[`bed`,`application/vnd.realvnc.bed`],[`bh2`,`application/vnd.fujitsu.oasysprs`],[`bin`,`application/octet-stream`],[`blb`,`application/x-blorb`],[`blorb`,`application/x-blorb`],[`bmi`,`application/vnd.bmi`],[`bmml`,`application/vnd.balsamiq.bmml+xml`],[`bmp`,`image/bmp`],[`book`,`application/vnd.framemaker`],[`box`,`application/vnd.previewsystems.box`],[`boz`,`application/x-bzip2`],[`bpk`,`application/octet-stream`],[`bpmn`,`application/octet-stream`],[`bsp`,`model/vnd.valve.source.compiled-map`],[`btif`,`image/prs.btif`],[`buffer`,`application/octet-stream`],[`bz`,`application/x-bzip`],[`bz2`,`application/x-bzip2`],[`c`,`text/x-c`],[`c4d`,`application/vnd.clonk.c4group`],[`c4f`,`application/vnd.clonk.c4group`],[`c4g`,`application/vnd.clonk.c4group`],[`c4p`,`application/vnd.clonk.c4group`],[`c4u`,`application/vnd.clonk.c4group`],[`c11amc`,`application/vnd.cluetrust.cartomobile-config`],[`c11amz`,`application/vnd.cluetrust.cartomobile-config-pkg`],[`cab`,`application/vnd.ms-cab-compressed`],[`caf`,`audio/x-caf`],[`cap`,`application/vnd.tcpdump.pcap`],[`car`,`application/vnd.curl.car`],[`cat`,`application/vnd.ms-pki.seccat`],[`cb7`,`application/x-cbr`],[`cba`,`application/x-cbr`],[`cbr`,`application/x-cbr`],[`cbt`,`application/x-cbr`],[`cbz`,`application/x-cbr`],[`cc`,`text/x-c`],[`cco`,`application/x-cocoa`],[`cct`,`application/x-director`],[`ccxml`,`application/ccxml+xml`],[`cdbcmsg`,`application/vnd.contact.cmsg`],[`cda`,`application/x-cdf`],[`cdf`,`application/x-netcdf`],[`cdfx`,`application/cdfx+xml`],[`cdkey`,`application/vnd.mediastation.cdkey`],[`cdmia`,`application/cdmi-capability`],[`cdmic`,`application/cdmi-container`],[`cdmid`,`application/cdmi-domain`],[`cdmio`,`application/cdmi-object`],[`cdmiq`,`application/cdmi-queue`],[`cdr`,`application/cdr`],[`cdx`,`chemical/x-cdx`],[`cdxml`,`application/vnd.chemdraw+xml`],[`cdy`,`application/vnd.cinderella`],[`cer`,`application/pkix-cert`],[`cfs`,`application/x-cfs-compressed`],[`cgm`,`image/cgm`],[`chat`,`application/x-chat`],[`chm`,`application/vnd.ms-htmlhelp`],[`chrt`,`application/vnd.kde.kchart`],[`cif`,`chemical/x-cif`],[`cii`,`application/vnd.anser-web-certificate-issue-initiation`],[`cil`,`application/vnd.ms-artgalry`],[`cjs`,`application/node`],[`cla`,`application/vnd.claymore`],[`class`,`application/octet-stream`],[`clkk`,`application/vnd.crick.clicker.keyboard`],[`clkp`,`application/vnd.crick.clicker.palette`],[`clkt`,`application/vnd.crick.clicker.template`],[`clkw`,`application/vnd.crick.clicker.wordbank`],[`clkx`,`application/vnd.crick.clicker`],[`clp`,`application/x-msclip`],[`cmc`,`application/vnd.cosmocaller`],[`cmdf`,`chemical/x-cmdf`],[`cml`,`chemical/x-cml`],[`cmp`,`application/vnd.yellowriver-custom-menu`],[`cmx`,`image/x-cmx`],[`cod`,`application/vnd.rim.cod`],[`coffee`,`text/coffeescript`],[`com`,`application/x-msdownload`],[`conf`,`text/plain`],[`cpio`,`application/x-cpio`],[`cpp`,`text/x-c`],[`cpt`,`application/mac-compactpro`],[`crd`,`application/x-mscardfile`],[`crl`,`application/pkix-crl`],[`crt`,`application/x-x509-ca-cert`],[`crx`,`application/x-chrome-extension`],[`cryptonote`,`application/vnd.rig.cryptonote`],[`csh`,`application/x-csh`],[`csl`,`application/vnd.citationstyles.style+xml`],[`csml`,`chemical/x-csml`],[`csp`,`application/vnd.commonspace`],[`csr`,`application/octet-stream`],[`css`,`text/css`],[`cst`,`application/x-director`],[`csv`,`text/csv`],[`cu`,`application/cu-seeme`],[`curl`,`text/vnd.curl`],[`cww`,`application/prs.cww`],[`cxt`,`application/x-director`],[`cxx`,`text/x-c`],[`dae`,`model/vnd.collada+xml`],[`daf`,`application/vnd.mobius.daf`],[`dart`,`application/vnd.dart`],[`dataless`,`application/vnd.fdsn.seed`],[`davmount`,`application/davmount+xml`],[`dbf`,`application/vnd.dbf`],[`dbk`,`application/docbook+xml`],[`dcr`,`application/x-director`],[`dcurl`,`text/vnd.curl.dcurl`],[`dd2`,`application/vnd.oma.dd2+xml`],[`ddd`,`application/vnd.fujixerox.ddd`],[`ddf`,`application/vnd.syncml.dmddf+xml`],[`dds`,`image/vnd.ms-dds`],[`deb`,`application/x-debian-package`],[`def`,`text/plain`],[`deploy`,`application/octet-stream`],[`der`,`application/x-x509-ca-cert`],[`dfac`,`application/vnd.dreamfactory`],[`dgc`,`application/x-dgc-compressed`],[`dic`,`text/x-c`],[`dir`,`application/x-director`],[`dis`,`application/vnd.mobius.dis`],[`disposition-notification`,`message/disposition-notification`],[`dist`,`application/octet-stream`],[`distz`,`application/octet-stream`],[`djv`,`image/vnd.djvu`],[`djvu`,`image/vnd.djvu`],[`dll`,`application/octet-stream`],[`dmg`,`application/x-apple-diskimage`],[`dmn`,`application/octet-stream`],[`dmp`,`application/vnd.tcpdump.pcap`],[`dms`,`application/octet-stream`],[`dna`,`application/vnd.dna`],[`doc`,`application/msword`],[`docm`,`application/vnd.ms-word.template.macroEnabled.12`],[`docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`dot`,`application/msword`],[`dotm`,`application/vnd.ms-word.template.macroEnabled.12`],[`dotx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.template`],[`dp`,`application/vnd.osgi.dp`],[`dpg`,`application/vnd.dpgraph`],[`dra`,`audio/vnd.dra`],[`drle`,`image/dicom-rle`],[`dsc`,`text/prs.lines.tag`],[`dssc`,`application/dssc+der`],[`dtb`,`application/x-dtbook+xml`],[`dtd`,`application/xml-dtd`],[`dts`,`audio/vnd.dts`],[`dtshd`,`audio/vnd.dts.hd`],[`dump`,`application/octet-stream`],[`dvb`,`video/vnd.dvb.file`],[`dvi`,`application/x-dvi`],[`dwd`,`application/atsc-dwd+xml`],[`dwf`,`model/vnd.dwf`],[`dwg`,`image/vnd.dwg`],[`dxf`,`image/vnd.dxf`],[`dxp`,`application/vnd.spotfire.dxp`],[`dxr`,`application/x-director`],[`ear`,`application/java-archive`],[`ecelp4800`,`audio/vnd.nuera.ecelp4800`],[`ecelp7470`,`audio/vnd.nuera.ecelp7470`],[`ecelp9600`,`audio/vnd.nuera.ecelp9600`],[`ecma`,`application/ecmascript`],[`edm`,`application/vnd.novadigm.edm`],[`edx`,`application/vnd.novadigm.edx`],[`efif`,`application/vnd.picsel`],[`ei6`,`application/vnd.pg.osasli`],[`elc`,`application/octet-stream`],[`emf`,`image/emf`],[`eml`,`message/rfc822`],[`emma`,`application/emma+xml`],[`emotionml`,`application/emotionml+xml`],[`emz`,`application/x-msmetafile`],[`eol`,`audio/vnd.digital-winds`],[`eot`,`application/vnd.ms-fontobject`],[`eps`,`application/postscript`],[`epub`,`application/epub+zip`],[`es`,`application/ecmascript`],[`es3`,`application/vnd.eszigno3+xml`],[`esa`,`application/vnd.osgi.subsystem`],[`esf`,`application/vnd.epson.esf`],[`et3`,`application/vnd.eszigno3+xml`],[`etx`,`text/x-setext`],[`eva`,`application/x-eva`],[`evy`,`application/x-envoy`],[`exe`,`application/octet-stream`],[`exi`,`application/exi`],[`exp`,`application/express`],[`exr`,`image/aces`],[`ext`,`application/vnd.novadigm.ext`],[`ez`,`application/andrew-inset`],[`ez2`,`application/vnd.ezpix-album`],[`ez3`,`application/vnd.ezpix-package`],[`f`,`text/x-fortran`],[`f4v`,`video/mp4`],[`f77`,`text/x-fortran`],[`f90`,`text/x-fortran`],[`fbs`,`image/vnd.fastbidsheet`],[`fcdt`,`application/vnd.adobe.formscentral.fcdt`],[`fcs`,`application/vnd.isac.fcs`],[`fdf`,`application/vnd.fdf`],[`fdt`,`application/fdt+xml`],[`fe_launch`,`application/vnd.denovo.fcselayout-link`],[`fg5`,`application/vnd.fujitsu.oasysgp`],[`fgd`,`application/x-director`],[`fh`,`image/x-freehand`],[`fh4`,`image/x-freehand`],[`fh5`,`image/x-freehand`],[`fh7`,`image/x-freehand`],[`fhc`,`image/x-freehand`],[`fig`,`application/x-xfig`],[`fits`,`image/fits`],[`flac`,`audio/x-flac`],[`fli`,`video/x-fli`],[`flo`,`application/vnd.micrografx.flo`],[`flv`,`video/x-flv`],[`flw`,`application/vnd.kde.kivio`],[`flx`,`text/vnd.fmi.flexstor`],[`fly`,`text/vnd.fly`],[`fm`,`application/vnd.framemaker`],[`fnc`,`application/vnd.frogans.fnc`],[`fo`,`application/vnd.software602.filler.form+xml`],[`for`,`text/x-fortran`],[`fpx`,`image/vnd.fpx`],[`frame`,`application/vnd.framemaker`],[`fsc`,`application/vnd.fsc.weblaunch`],[`fst`,`image/vnd.fst`],[`ftc`,`application/vnd.fluxtime.clip`],[`fti`,`application/vnd.anser-web-funds-transfer-initiation`],[`fvt`,`video/vnd.fvt`],[`fxp`,`application/vnd.adobe.fxp`],[`fxpl`,`application/vnd.adobe.fxp`],[`fzs`,`application/vnd.fuzzysheet`],[`g2w`,`application/vnd.geoplan`],[`g3`,`image/g3fax`],[`g3w`,`application/vnd.geospace`],[`gac`,`application/vnd.groove-account`],[`gam`,`application/x-tads`],[`gbr`,`application/rpki-ghostbusters`],[`gca`,`application/x-gca-compressed`],[`gdl`,`model/vnd.gdl`],[`gdoc`,`application/vnd.google-apps.document`],[`geo`,`application/vnd.dynageo`],[`geojson`,`application/geo+json`],[`gex`,`application/vnd.geometry-explorer`],[`ggb`,`application/vnd.geogebra.file`],[`ggt`,`application/vnd.geogebra.tool`],[`ghf`,`application/vnd.groove-help`],[`gif`,`image/gif`],[`gim`,`application/vnd.groove-identity-message`],[`glb`,`model/gltf-binary`],[`gltf`,`model/gltf+json`],[`gml`,`application/gml+xml`],[`gmx`,`application/vnd.gmx`],[`gnumeric`,`application/x-gnumeric`],[`gpg`,`application/gpg-keys`],[`gph`,`application/vnd.flographit`],[`gpx`,`application/gpx+xml`],[`gqf`,`application/vnd.grafeq`],[`gqs`,`application/vnd.grafeq`],[`gram`,`application/srgs`],[`gramps`,`application/x-gramps-xml`],[`gre`,`application/vnd.geometry-explorer`],[`grv`,`application/vnd.groove-injector`],[`grxml`,`application/srgs+xml`],[`gsf`,`application/x-font-ghostscript`],[`gsheet`,`application/vnd.google-apps.spreadsheet`],[`gslides`,`application/vnd.google-apps.presentation`],[`gtar`,`application/x-gtar`],[`gtm`,`application/vnd.groove-tool-message`],[`gtw`,`model/vnd.gtw`],[`gv`,`text/vnd.graphviz`],[`gxf`,`application/gxf`],[`gxt`,`application/vnd.geonext`],[`gz`,`application/gzip`],[`gzip`,`application/gzip`],[`h`,`text/x-c`],[`h261`,`video/h261`],[`h263`,`video/h263`],[`h264`,`video/h264`],[`hal`,`application/vnd.hal+xml`],[`hbci`,`application/vnd.hbci`],[`hbs`,`text/x-handlebars-template`],[`hdd`,`application/x-virtualbox-hdd`],[`hdf`,`application/x-hdf`],[`heic`,`image/heic`],[`heics`,`image/heic-sequence`],[`heif`,`image/heif`],[`heifs`,`image/heif-sequence`],[`hej2`,`image/hej2k`],[`held`,`application/atsc-held+xml`],[`hh`,`text/x-c`],[`hjson`,`application/hjson`],[`hlp`,`application/winhlp`],[`hpgl`,`application/vnd.hp-hpgl`],[`hpid`,`application/vnd.hp-hpid`],[`hps`,`application/vnd.hp-hps`],[`hqx`,`application/mac-binhex40`],[`hsj2`,`image/hsj2`],[`htc`,`text/x-component`],[`htke`,`application/vnd.kenameaapp`],[`htm`,`text/html`],[`html`,`text/html`],[`hvd`,`application/vnd.yamaha.hv-dic`],[`hvp`,`application/vnd.yamaha.hv-voice`],[`hvs`,`application/vnd.yamaha.hv-script`],[`i2g`,`application/vnd.intergeo`],[`icc`,`application/vnd.iccprofile`],[`ice`,`x-conference/x-cooltalk`],[`icm`,`application/vnd.iccprofile`],[`ico`,`image/x-icon`],[`ics`,`text/calendar`],[`ief`,`image/ief`],[`ifb`,`text/calendar`],[`ifm`,`application/vnd.shana.informed.formdata`],[`iges`,`model/iges`],[`igl`,`application/vnd.igloader`],[`igm`,`application/vnd.insors.igm`],[`igs`,`model/iges`],[`igx`,`application/vnd.micrografx.igx`],[`iif`,`application/vnd.shana.informed.interchange`],[`img`,`application/octet-stream`],[`imp`,`application/vnd.accpac.simply.imp`],[`ims`,`application/vnd.ms-ims`],[`in`,`text/plain`],[`ini`,`text/plain`],[`ink`,`application/inkml+xml`],[`inkml`,`application/inkml+xml`],[`install`,`application/x-install-instructions`],[`iota`,`application/vnd.astraea-software.iota`],[`ipfix`,`application/ipfix`],[`ipk`,`application/vnd.shana.informed.package`],[`irm`,`application/vnd.ibm.rights-management`],[`irp`,`application/vnd.irepository.package+xml`],[`iso`,`application/x-iso9660-image`],[`itp`,`application/vnd.shana.informed.formtemplate`],[`its`,`application/its+xml`],[`ivp`,`application/vnd.immervision-ivp`],[`ivu`,`application/vnd.immervision-ivu`],[`jad`,`text/vnd.sun.j2me.app-descriptor`],[`jade`,`text/jade`],[`jam`,`application/vnd.jam`],[`jar`,`application/java-archive`],[`jardiff`,`application/x-java-archive-diff`],[`java`,`text/x-java-source`],[`jhc`,`image/jphc`],[`jisp`,`application/vnd.jisp`],[`jls`,`image/jls`],[`jlt`,`application/vnd.hp-jlyt`],[`jng`,`image/x-jng`],[`jnlp`,`application/x-java-jnlp-file`],[`joda`,`application/vnd.joost.joda-archive`],[`jp2`,`image/jp2`],[`jpe`,`image/jpeg`],[`jpeg`,`image/jpeg`],[`jpf`,`image/jpx`],[`jpg`,`image/jpeg`],[`jpg2`,`image/jp2`],[`jpgm`,`video/jpm`],[`jpgv`,`video/jpeg`],[`jph`,`image/jph`],[`jpm`,`video/jpm`],[`jpx`,`image/jpx`],[`js`,`application/javascript`],[`json`,`application/json`],[`json5`,`application/json5`],[`jsonld`,`application/ld+json`],[`jsonl`,`application/jsonl`],[`jsonml`,`application/jsonml+json`],[`jsx`,`text/jsx`],[`jxr`,`image/jxr`],[`jxra`,`image/jxra`],[`jxrs`,`image/jxrs`],[`jxs`,`image/jxs`],[`jxsc`,`image/jxsc`],[`jxsi`,`image/jxsi`],[`jxss`,`image/jxss`],[`kar`,`audio/midi`],[`karbon`,`application/vnd.kde.karbon`],[`kdb`,`application/octet-stream`],[`kdbx`,`application/x-keepass2`],[`key`,`application/x-iwork-keynote-sffkey`],[`kfo`,`application/vnd.kde.kformula`],[`kia`,`application/vnd.kidspiration`],[`kml`,`application/vnd.google-earth.kml+xml`],[`kmz`,`application/vnd.google-earth.kmz`],[`kne`,`application/vnd.kinar`],[`knp`,`application/vnd.kinar`],[`kon`,`application/vnd.kde.kontour`],[`kpr`,`application/vnd.kde.kpresenter`],[`kpt`,`application/vnd.kde.kpresenter`],[`kpxx`,`application/vnd.ds-keypoint`],[`ksp`,`application/vnd.kde.kspread`],[`ktr`,`application/vnd.kahootz`],[`ktx`,`image/ktx`],[`ktx2`,`image/ktx2`],[`ktz`,`application/vnd.kahootz`],[`kwd`,`application/vnd.kde.kword`],[`kwt`,`application/vnd.kde.kword`],[`lasxml`,`application/vnd.las.las+xml`],[`latex`,`application/x-latex`],[`lbd`,`application/vnd.llamagraphics.life-balance.desktop`],[`lbe`,`application/vnd.llamagraphics.life-balance.exchange+xml`],[`les`,`application/vnd.hhe.lesson-player`],[`less`,`text/less`],[`lgr`,`application/lgr+xml`],[`lha`,`application/octet-stream`],[`link66`,`application/vnd.route66.link66+xml`],[`list`,`text/plain`],[`list3820`,`application/vnd.ibm.modcap`],[`listafp`,`application/vnd.ibm.modcap`],[`litcoffee`,`text/coffeescript`],[`lnk`,`application/x-ms-shortcut`],[`log`,`text/plain`],[`lostxml`,`application/lost+xml`],[`lrf`,`application/octet-stream`],[`lrm`,`application/vnd.ms-lrm`],[`ltf`,`application/vnd.frogans.ltf`],[`lua`,`text/x-lua`],[`luac`,`application/x-lua-bytecode`],[`lvp`,`audio/vnd.lucent.voice`],[`lwp`,`application/vnd.lotus-wordpro`],[`lzh`,`application/octet-stream`],[`m1v`,`video/mpeg`],[`m2a`,`audio/mpeg`],[`m2v`,`video/mpeg`],[`m3a`,`audio/mpeg`],[`m3u`,`text/plain`],[`m3u8`,`application/vnd.apple.mpegurl`],[`m4a`,`audio/x-m4a`],[`m4p`,`application/mp4`],[`m4s`,`video/iso.segment`],[`m4u`,`application/vnd.mpegurl`],[`m4v`,`video/x-m4v`],[`m13`,`application/x-msmediaview`],[`m14`,`application/x-msmediaview`],[`m21`,`application/mp21`],[`ma`,`application/mathematica`],[`mads`,`application/mads+xml`],[`maei`,`application/mmt-aei+xml`],[`mag`,`application/vnd.ecowin.chart`],[`maker`,`application/vnd.framemaker`],[`man`,`text/troff`],[`manifest`,`text/cache-manifest`],[`map`,`application/json`],[`mar`,`application/octet-stream`],[`markdown`,`text/markdown`],[`mathml`,`application/mathml+xml`],[`mb`,`application/mathematica`],[`mbk`,`application/vnd.mobius.mbk`],[`mbox`,`application/mbox`],[`mc1`,`application/vnd.medcalcdata`],[`mcd`,`application/vnd.mcd`],[`mcurl`,`text/vnd.curl.mcurl`],[`md`,`text/markdown`],[`mdb`,`application/x-msaccess`],[`mdi`,`image/vnd.ms-modi`],[`mdx`,`text/mdx`],[`me`,`text/troff`],[`mesh`,`model/mesh`],[`meta4`,`application/metalink4+xml`],[`metalink`,`application/metalink+xml`],[`mets`,`application/mets+xml`],[`mfm`,`application/vnd.mfmp`],[`mft`,`application/rpki-manifest`],[`mgp`,`application/vnd.osgeo.mapguide.package`],[`mgz`,`application/vnd.proteus.magazine`],[`mid`,`audio/midi`],[`midi`,`audio/midi`],[`mie`,`application/x-mie`],[`mif`,`application/vnd.mif`],[`mime`,`message/rfc822`],[`mj2`,`video/mj2`],[`mjp2`,`video/mj2`],[`mjs`,`application/javascript`],[`mk3d`,`video/x-matroska`],[`mka`,`audio/x-matroska`],[`mkd`,`text/x-markdown`],[`mks`,`video/x-matroska`],[`mkv`,`video/x-matroska`],[`mlp`,`application/vnd.dolby.mlp`],[`mmd`,`application/vnd.chipnuts.karaoke-mmd`],[`mmf`,`application/vnd.smaf`],[`mml`,`text/mathml`],[`mmr`,`image/vnd.fujixerox.edmics-mmr`],[`mng`,`video/x-mng`],[`mny`,`application/x-msmoney`],[`mobi`,`application/x-mobipocket-ebook`],[`mods`,`application/mods+xml`],[`mov`,`video/quicktime`],[`movie`,`video/x-sgi-movie`],[`mp2`,`audio/mpeg`],[`mp2a`,`audio/mpeg`],[`mp3`,`audio/mpeg`],[`mp4`,`video/mp4`],[`mp4a`,`audio/mp4`],[`mp4s`,`application/mp4`],[`mp4v`,`video/mp4`],[`mp21`,`application/mp21`],[`mpc`,`application/vnd.mophun.certificate`],[`mpd`,`application/dash+xml`],[`mpe`,`video/mpeg`],[`mpeg`,`video/mpeg`],[`mpg`,`video/mpeg`],[`mpg4`,`video/mp4`],[`mpga`,`audio/mpeg`],[`mpkg`,`application/vnd.apple.installer+xml`],[`mpm`,`application/vnd.blueice.multipass`],[`mpn`,`application/vnd.mophun.application`],[`mpp`,`application/vnd.ms-project`],[`mpt`,`application/vnd.ms-project`],[`mpy`,`application/vnd.ibm.minipay`],[`mqy`,`application/vnd.mobius.mqy`],[`mrc`,`application/marc`],[`mrcx`,`application/marcxml+xml`],[`ms`,`text/troff`],[`mscml`,`application/mediaservercontrol+xml`],[`mseed`,`application/vnd.fdsn.mseed`],[`mseq`,`application/vnd.mseq`],[`msf`,`application/vnd.epson.msf`],[`msg`,`application/vnd.ms-outlook`],[`msh`,`model/mesh`],[`msi`,`application/x-msdownload`],[`msl`,`application/vnd.mobius.msl`],[`msm`,`application/octet-stream`],[`msp`,`application/octet-stream`],[`msty`,`application/vnd.muvee.style`],[`mtl`,`model/mtl`],[`mts`,`model/vnd.mts`],[`mus`,`application/vnd.musician`],[`musd`,`application/mmt-usd+xml`],[`musicxml`,`application/vnd.recordare.musicxml+xml`],[`mvb`,`application/x-msmediaview`],[`mvt`,`application/vnd.mapbox-vector-tile`],[`mwf`,`application/vnd.mfer`],[`mxf`,`application/mxf`],[`mxl`,`application/vnd.recordare.musicxml`],[`mxmf`,`audio/mobile-xmf`],[`mxml`,`application/xv+xml`],[`mxs`,`application/vnd.triscape.mxs`],[`mxu`,`video/vnd.mpegurl`],[`n-gage`,`application/vnd.nokia.n-gage.symbian.install`],[`n3`,`text/n3`],[`nb`,`application/mathematica`],[`nbp`,`application/vnd.wolfram.player`],[`nc`,`application/x-netcdf`],[`ncx`,`application/x-dtbncx+xml`],[`nfo`,`text/x-nfo`],[`ngdat`,`application/vnd.nokia.n-gage.data`],[`nitf`,`application/vnd.nitf`],[`nlu`,`application/vnd.neurolanguage.nlu`],[`nml`,`application/vnd.enliven`],[`nnd`,`application/vnd.noblenet-directory`],[`nns`,`application/vnd.noblenet-sealer`],[`nnw`,`application/vnd.noblenet-web`],[`npx`,`image/vnd.net-fpx`],[`nq`,`application/n-quads`],[`nsc`,`application/x-conference`],[`nsf`,`application/vnd.lotus-notes`],[`nt`,`application/n-triples`],[`ntf`,`application/vnd.nitf`],[`numbers`,`application/x-iwork-numbers-sffnumbers`],[`nzb`,`application/x-nzb`],[`oa2`,`application/vnd.fujitsu.oasys2`],[`oa3`,`application/vnd.fujitsu.oasys3`],[`oas`,`application/vnd.fujitsu.oasys`],[`obd`,`application/x-msbinder`],[`obgx`,`application/vnd.openblox.game+xml`],[`obj`,`model/obj`],[`oda`,`application/oda`],[`odb`,`application/vnd.oasis.opendocument.database`],[`odc`,`application/vnd.oasis.opendocument.chart`],[`odf`,`application/vnd.oasis.opendocument.formula`],[`odft`,`application/vnd.oasis.opendocument.formula-template`],[`odg`,`application/vnd.oasis.opendocument.graphics`],[`odi`,`application/vnd.oasis.opendocument.image`],[`odm`,`application/vnd.oasis.opendocument.text-master`],[`odp`,`application/vnd.oasis.opendocument.presentation`],[`ods`,`application/vnd.oasis.opendocument.spreadsheet`],[`odt`,`application/vnd.oasis.opendocument.text`],[`oga`,`audio/ogg`],[`ogex`,`model/vnd.opengex`],[`ogg`,`audio/ogg`],[`ogv`,`video/ogg`],[`ogx`,`application/ogg`],[`omdoc`,`application/omdoc+xml`],[`onepkg`,`application/onenote`],[`onetmp`,`application/onenote`],[`onetoc`,`application/onenote`],[`onetoc2`,`application/onenote`],[`opf`,`application/oebps-package+xml`],[`opml`,`text/x-opml`],[`oprc`,`application/vnd.palm`],[`opus`,`audio/ogg`],[`org`,`text/x-org`],[`osf`,`application/vnd.yamaha.openscoreformat`],[`osfpvg`,`application/vnd.yamaha.openscoreformat.osfpvg+xml`],[`osm`,`application/vnd.openstreetmap.data+xml`],[`otc`,`application/vnd.oasis.opendocument.chart-template`],[`otf`,`font/otf`],[`otg`,`application/vnd.oasis.opendocument.graphics-template`],[`oth`,`application/vnd.oasis.opendocument.text-web`],[`oti`,`application/vnd.oasis.opendocument.image-template`],[`otp`,`application/vnd.oasis.opendocument.presentation-template`],[`ots`,`application/vnd.oasis.opendocument.spreadsheet-template`],[`ott`,`application/vnd.oasis.opendocument.text-template`],[`ova`,`application/x-virtualbox-ova`],[`ovf`,`application/x-virtualbox-ovf`],[`owl`,`application/rdf+xml`],[`oxps`,`application/oxps`],[`oxt`,`application/vnd.openofficeorg.extension`],[`p`,`text/x-pascal`],[`p7a`,`application/x-pkcs7-signature`],[`p7b`,`application/x-pkcs7-certificates`],[`p7c`,`application/pkcs7-mime`],[`p7m`,`application/pkcs7-mime`],[`p7r`,`application/x-pkcs7-certreqresp`],[`p7s`,`application/pkcs7-signature`],[`p8`,`application/pkcs8`],[`p10`,`application/x-pkcs10`],[`p12`,`application/x-pkcs12`],[`pac`,`application/x-ns-proxy-autoconfig`],[`pages`,`application/x-iwork-pages-sffpages`],[`pas`,`text/x-pascal`],[`paw`,`application/vnd.pawaafile`],[`pbd`,`application/vnd.powerbuilder6`],[`pbm`,`image/x-portable-bitmap`],[`pcap`,`application/vnd.tcpdump.pcap`],[`pcf`,`application/x-font-pcf`],[`pcl`,`application/vnd.hp-pcl`],[`pclxl`,`application/vnd.hp-pclxl`],[`pct`,`image/x-pict`],[`pcurl`,`application/vnd.curl.pcurl`],[`pcx`,`image/x-pcx`],[`pdb`,`application/x-pilot`],[`pde`,`text/x-processing`],[`pdf`,`application/pdf`],[`pem`,`application/x-x509-user-cert`],[`pfa`,`application/x-font-type1`],[`pfb`,`application/x-font-type1`],[`pfm`,`application/x-font-type1`],[`pfr`,`application/font-tdpfr`],[`pfx`,`application/x-pkcs12`],[`pgm`,`image/x-portable-graymap`],[`pgn`,`application/x-chess-pgn`],[`pgp`,`application/pgp`],[`php`,`application/x-httpd-php`],[`php3`,`application/x-httpd-php`],[`php4`,`application/x-httpd-php`],[`phps`,`application/x-httpd-php-source`],[`phtml`,`application/x-httpd-php`],[`pic`,`image/x-pict`],[`pkg`,`application/octet-stream`],[`pki`,`application/pkixcmp`],[`pkipath`,`application/pkix-pkipath`],[`pkpass`,`application/vnd.apple.pkpass`],[`pl`,`application/x-perl`],[`plb`,`application/vnd.3gpp.pic-bw-large`],[`plc`,`application/vnd.mobius.plc`],[`plf`,`application/vnd.pocketlearn`],[`pls`,`application/pls+xml`],[`pm`,`application/x-perl`],[`pml`,`application/vnd.ctc-posml`],[`png`,`image/png`],[`pnm`,`image/x-portable-anymap`],[`portpkg`,`application/vnd.macports.portpkg`],[`pot`,`application/vnd.ms-powerpoint`],[`potm`,`application/vnd.ms-powerpoint.presentation.macroEnabled.12`],[`potx`,`application/vnd.openxmlformats-officedocument.presentationml.template`],[`ppa`,`application/vnd.ms-powerpoint`],[`ppam`,`application/vnd.ms-powerpoint.addin.macroEnabled.12`],[`ppd`,`application/vnd.cups-ppd`],[`ppm`,`image/x-portable-pixmap`],[`pps`,`application/vnd.ms-powerpoint`],[`ppsm`,`application/vnd.ms-powerpoint.slideshow.macroEnabled.12`],[`ppsx`,`application/vnd.openxmlformats-officedocument.presentationml.slideshow`],[`ppt`,`application/powerpoint`],[`pptm`,`application/vnd.ms-powerpoint.presentation.macroEnabled.12`],[`pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`pqa`,`application/vnd.palm`],[`prc`,`application/x-pilot`],[`pre`,`application/vnd.lotus-freelance`],[`prf`,`application/pics-rules`],[`provx`,`application/provenance+xml`],[`ps`,`application/postscript`],[`psb`,`application/vnd.3gpp.pic-bw-small`],[`psd`,`application/x-photoshop`],[`psf`,`application/x-font-linux-psf`],[`pskcxml`,`application/pskc+xml`],[`pti`,`image/prs.pti`],[`ptid`,`application/vnd.pvi.ptid1`],[`pub`,`application/x-mspublisher`],[`pvb`,`application/vnd.3gpp.pic-bw-var`],[`pwn`,`application/vnd.3m.post-it-notes`],[`pya`,`audio/vnd.ms-playready.media.pya`],[`pyv`,`video/vnd.ms-playready.media.pyv`],[`qam`,`application/vnd.epson.quickanime`],[`qbo`,`application/vnd.intu.qbo`],[`qfx`,`application/vnd.intu.qfx`],[`qps`,`application/vnd.publishare-delta-tree`],[`qt`,`video/quicktime`],[`qwd`,`application/vnd.quark.quarkxpress`],[`qwt`,`application/vnd.quark.quarkxpress`],[`qxb`,`application/vnd.quark.quarkxpress`],[`qxd`,`application/vnd.quark.quarkxpress`],[`qxl`,`application/vnd.quark.quarkxpress`],[`qxt`,`application/vnd.quark.quarkxpress`],[`ra`,`audio/x-realaudio`],[`ram`,`audio/x-pn-realaudio`],[`raml`,`application/raml+yaml`],[`rapd`,`application/route-apd+xml`],[`rar`,`application/x-rar`],[`ras`,`image/x-cmu-raster`],[`rcprofile`,`application/vnd.ipunplugged.rcprofile`],[`rdf`,`application/rdf+xml`],[`rdz`,`application/vnd.data-vision.rdz`],[`relo`,`application/p2p-overlay+xml`],[`rep`,`application/vnd.businessobjects`],[`res`,`application/x-dtbresource+xml`],[`rgb`,`image/x-rgb`],[`rif`,`application/reginfo+xml`],[`rip`,`audio/vnd.rip`],[`ris`,`application/x-research-info-systems`],[`rl`,`application/resource-lists+xml`],[`rlc`,`image/vnd.fujixerox.edmics-rlc`],[`rld`,`application/resource-lists-diff+xml`],[`rm`,`audio/x-pn-realaudio`],[`rmi`,`audio/midi`],[`rmp`,`audio/x-pn-realaudio-plugin`],[`rms`,`application/vnd.jcp.javame.midlet-rms`],[`rmvb`,`application/vnd.rn-realmedia-vbr`],[`rnc`,`application/relax-ng-compact-syntax`],[`rng`,`application/xml`],[`roa`,`application/rpki-roa`],[`roff`,`text/troff`],[`rp9`,`application/vnd.cloanto.rp9`],[`rpm`,`audio/x-pn-realaudio-plugin`],[`rpss`,`application/vnd.nokia.radio-presets`],[`rpst`,`application/vnd.nokia.radio-preset`],[`rq`,`application/sparql-query`],[`rs`,`application/rls-services+xml`],[`rsa`,`application/x-pkcs7`],[`rsat`,`application/atsc-rsat+xml`],[`rsd`,`application/rsd+xml`],[`rsheet`,`application/urc-ressheet+xml`],[`rss`,`application/rss+xml`],[`rtf`,`text/rtf`],[`rtx`,`text/richtext`],[`run`,`application/x-makeself`],[`rusd`,`application/route-usd+xml`],[`rv`,`video/vnd.rn-realvideo`],[`s`,`text/x-asm`],[`s3m`,`audio/s3m`],[`saf`,`application/vnd.yamaha.smaf-audio`],[`sass`,`text/x-sass`],[`sbml`,`application/sbml+xml`],[`sc`,`application/vnd.ibm.secure-container`],[`scd`,`application/x-msschedule`],[`scm`,`application/vnd.lotus-screencam`],[`scq`,`application/scvp-cv-request`],[`scs`,`application/scvp-cv-response`],[`scss`,`text/x-scss`],[`scurl`,`text/vnd.curl.scurl`],[`sda`,`application/vnd.stardivision.draw`],[`sdc`,`application/vnd.stardivision.calc`],[`sdd`,`application/vnd.stardivision.impress`],[`sdkd`,`application/vnd.solent.sdkm+xml`],[`sdkm`,`application/vnd.solent.sdkm+xml`],[`sdp`,`application/sdp`],[`sdw`,`application/vnd.stardivision.writer`],[`sea`,`application/octet-stream`],[`see`,`application/vnd.seemail`],[`seed`,`application/vnd.fdsn.seed`],[`sema`,`application/vnd.sema`],[`semd`,`application/vnd.semd`],[`semf`,`application/vnd.semf`],[`senmlx`,`application/senml+xml`],[`sensmlx`,`application/sensml+xml`],[`ser`,`application/java-serialized-object`],[`setpay`,`application/set-payment-initiation`],[`setreg`,`application/set-registration-initiation`],[`sfd-hdstx`,`application/vnd.hydrostatix.sof-data`],[`sfs`,`application/vnd.spotfire.sfs`],[`sfv`,`text/x-sfv`],[`sgi`,`image/sgi`],[`sgl`,`application/vnd.stardivision.writer-global`],[`sgm`,`text/sgml`],[`sgml`,`text/sgml`],[`sh`,`application/x-sh`],[`shar`,`application/x-shar`],[`shex`,`text/shex`],[`shf`,`application/shf+xml`],[`shtml`,`text/html`],[`sid`,`image/x-mrsid-image`],[`sieve`,`application/sieve`],[`sig`,`application/pgp-signature`],[`sil`,`audio/silk`],[`silo`,`model/mesh`],[`sis`,`application/vnd.symbian.install`],[`sisx`,`application/vnd.symbian.install`],[`sit`,`application/x-stuffit`],[`sitx`,`application/x-stuffitx`],[`siv`,`application/sieve`],[`skd`,`application/vnd.koan`],[`skm`,`application/vnd.koan`],[`skp`,`application/vnd.koan`],[`skt`,`application/vnd.koan`],[`sldm`,`application/vnd.ms-powerpoint.slide.macroenabled.12`],[`sldx`,`application/vnd.openxmlformats-officedocument.presentationml.slide`],[`slim`,`text/slim`],[`slm`,`text/slim`],[`sls`,`application/route-s-tsid+xml`],[`slt`,`application/vnd.epson.salt`],[`sm`,`application/vnd.stepmania.stepchart`],[`smf`,`application/vnd.stardivision.math`],[`smi`,`application/smil`],[`smil`,`application/smil`],[`smv`,`video/x-smv`],[`smzip`,`application/vnd.stepmania.package`],[`snd`,`audio/basic`],[`snf`,`application/x-font-snf`],[`so`,`application/octet-stream`],[`spc`,`application/x-pkcs7-certificates`],[`spdx`,`text/spdx`],[`spf`,`application/vnd.yamaha.smaf-phrase`],[`spl`,`application/x-futuresplash`],[`spot`,`text/vnd.in3d.spot`],[`spp`,`application/scvp-vp-response`],[`spq`,`application/scvp-vp-request`],[`spx`,`audio/ogg`],[`sql`,`application/x-sql`],[`src`,`application/x-wais-source`],[`srt`,`application/x-subrip`],[`sru`,`application/sru+xml`],[`srx`,`application/sparql-results+xml`],[`ssdl`,`application/ssdl+xml`],[`sse`,`application/vnd.kodak-descriptor`],[`ssf`,`application/vnd.epson.ssf`],[`ssml`,`application/ssml+xml`],[`sst`,`application/octet-stream`],[`st`,`application/vnd.sailingtracker.track`],[`stc`,`application/vnd.sun.xml.calc.template`],[`std`,`application/vnd.sun.xml.draw.template`],[`stf`,`application/vnd.wt.stf`],[`sti`,`application/vnd.sun.xml.impress.template`],[`stk`,`application/hyperstudio`],[`stl`,`model/stl`],[`stpx`,`model/step+xml`],[`stpxz`,`model/step-xml+zip`],[`stpz`,`model/step+zip`],[`str`,`application/vnd.pg.format`],[`stw`,`application/vnd.sun.xml.writer.template`],[`styl`,`text/stylus`],[`stylus`,`text/stylus`],[`sub`,`text/vnd.dvb.subtitle`],[`sus`,`application/vnd.sus-calendar`],[`susp`,`application/vnd.sus-calendar`],[`sv4cpio`,`application/x-sv4cpio`],[`sv4crc`,`application/x-sv4crc`],[`svc`,`application/vnd.dvb.service`],[`svd`,`application/vnd.svd`],[`svg`,`image/svg+xml`],[`svgz`,`image/svg+xml`],[`swa`,`application/x-director`],[`swf`,`application/x-shockwave-flash`],[`swi`,`application/vnd.aristanetworks.swi`],[`swidtag`,`application/swid+xml`],[`sxc`,`application/vnd.sun.xml.calc`],[`sxd`,`application/vnd.sun.xml.draw`],[`sxg`,`application/vnd.sun.xml.writer.global`],[`sxi`,`application/vnd.sun.xml.impress`],[`sxm`,`application/vnd.sun.xml.math`],[`sxw`,`application/vnd.sun.xml.writer`],[`t`,`text/troff`],[`t3`,`application/x-t3vm-image`],[`t38`,`image/t38`],[`taglet`,`application/vnd.mynfc`],[`tao`,`application/vnd.tao.intent-module-archive`],[`tap`,`image/vnd.tencent.tap`],[`tar`,`application/x-tar`],[`tcap`,`application/vnd.3gpp2.tcap`],[`tcl`,`application/x-tcl`],[`td`,`application/urc-targetdesc+xml`],[`teacher`,`application/vnd.smart.teacher`],[`tei`,`application/tei+xml`],[`teicorpus`,`application/tei+xml`],[`tex`,`application/x-tex`],[`texi`,`application/x-texinfo`],[`texinfo`,`application/x-texinfo`],[`text`,`text/plain`],[`tfi`,`application/thraud+xml`],[`tfm`,`application/x-tex-tfm`],[`tfx`,`image/tiff-fx`],[`tga`,`image/x-tga`],[`tgz`,`application/x-tar`],[`thmx`,`application/vnd.ms-officetheme`],[`tif`,`image/tiff`],[`tiff`,`image/tiff`],[`tk`,`application/x-tcl`],[`tmo`,`application/vnd.tmobile-livetv`],[`toml`,`application/toml`],[`torrent`,`application/x-bittorrent`],[`tpl`,`application/vnd.groove-tool-template`],[`tpt`,`application/vnd.trid.tpt`],[`tr`,`text/troff`],[`tra`,`application/vnd.trueapp`],[`trig`,`application/trig`],[`trm`,`application/x-msterminal`],[`ts`,`video/mp2t`],[`tsd`,`application/timestamped-data`],[`tsv`,`text/tab-separated-values`],[`ttc`,`font/collection`],[`ttf`,`font/ttf`],[`ttl`,`text/turtle`],[`ttml`,`application/ttml+xml`],[`twd`,`application/vnd.simtech-mindmapper`],[`twds`,`application/vnd.simtech-mindmapper`],[`txd`,`application/vnd.genomatix.tuxedo`],[`txf`,`application/vnd.mobius.txf`],[`txt`,`text/plain`],[`u8dsn`,`message/global-delivery-status`],[`u8hdr`,`message/global-headers`],[`u8mdn`,`message/global-disposition-notification`],[`u8msg`,`message/global`],[`u32`,`application/x-authorware-bin`],[`ubj`,`application/ubjson`],[`udeb`,`application/x-debian-package`],[`ufd`,`application/vnd.ufdl`],[`ufdl`,`application/vnd.ufdl`],[`ulx`,`application/x-glulx`],[`umj`,`application/vnd.umajin`],[`unityweb`,`application/vnd.unity`],[`uoml`,`application/vnd.uoml+xml`],[`uri`,`text/uri-list`],[`uris`,`text/uri-list`],[`urls`,`text/uri-list`],[`usdz`,`model/vnd.usdz+zip`],[`ustar`,`application/x-ustar`],[`utz`,`application/vnd.uiq.theme`],[`uu`,`text/x-uuencode`],[`uva`,`audio/vnd.dece.audio`],[`uvd`,`application/vnd.dece.data`],[`uvf`,`application/vnd.dece.data`],[`uvg`,`image/vnd.dece.graphic`],[`uvh`,`video/vnd.dece.hd`],[`uvi`,`image/vnd.dece.graphic`],[`uvm`,`video/vnd.dece.mobile`],[`uvp`,`video/vnd.dece.pd`],[`uvs`,`video/vnd.dece.sd`],[`uvt`,`application/vnd.dece.ttml+xml`],[`uvu`,`video/vnd.uvvu.mp4`],[`uvv`,`video/vnd.dece.video`],[`uvva`,`audio/vnd.dece.audio`],[`uvvd`,`application/vnd.dece.data`],[`uvvf`,`application/vnd.dece.data`],[`uvvg`,`image/vnd.dece.graphic`],[`uvvh`,`video/vnd.dece.hd`],[`uvvi`,`image/vnd.dece.graphic`],[`uvvm`,`video/vnd.dece.mobile`],[`uvvp`,`video/vnd.dece.pd`],[`uvvs`,`video/vnd.dece.sd`],[`uvvt`,`application/vnd.dece.ttml+xml`],[`uvvu`,`video/vnd.uvvu.mp4`],[`uvvv`,`video/vnd.dece.video`],[`uvvx`,`application/vnd.dece.unspecified`],[`uvvz`,`application/vnd.dece.zip`],[`uvx`,`application/vnd.dece.unspecified`],[`uvz`,`application/vnd.dece.zip`],[`vbox`,`application/x-virtualbox-vbox`],[`vbox-extpack`,`application/x-virtualbox-vbox-extpack`],[`vcard`,`text/vcard`],[`vcd`,`application/x-cdlink`],[`vcf`,`text/x-vcard`],[`vcg`,`application/vnd.groove-vcard`],[`vcs`,`text/x-vcalendar`],[`vcx`,`application/vnd.vcx`],[`vdi`,`application/x-virtualbox-vdi`],[`vds`,`model/vnd.sap.vds`],[`vhd`,`application/x-virtualbox-vhd`],[`vis`,`application/vnd.visionary`],[`viv`,`video/vnd.vivo`],[`vlc`,`application/videolan`],[`vmdk`,`application/x-virtualbox-vmdk`],[`vob`,`video/x-ms-vob`],[`vor`,`application/vnd.stardivision.writer`],[`vox`,`application/x-authorware-bin`],[`vrml`,`model/vrml`],[`vsd`,`application/vnd.visio`],[`vsf`,`application/vnd.vsf`],[`vss`,`application/vnd.visio`],[`vst`,`application/vnd.visio`],[`vsw`,`application/vnd.visio`],[`vtf`,`image/vnd.valve.source.texture`],[`vtt`,`text/vtt`],[`vtu`,`model/vnd.vtu`],[`vxml`,`application/voicexml+xml`],[`w3d`,`application/x-director`],[`wad`,`application/x-doom`],[`wadl`,`application/vnd.sun.wadl+xml`],[`war`,`application/java-archive`],[`wasm`,`application/wasm`],[`wav`,`audio/x-wav`],[`wax`,`audio/x-ms-wax`],[`wbmp`,`image/vnd.wap.wbmp`],[`wbs`,`application/vnd.criticaltools.wbs+xml`],[`wbxml`,`application/wbxml`],[`wcm`,`application/vnd.ms-works`],[`wdb`,`application/vnd.ms-works`],[`wdp`,`image/vnd.ms-photo`],[`weba`,`audio/webm`],[`webapp`,`application/x-web-app-manifest+json`],[`webm`,`video/webm`],[`webmanifest`,`application/manifest+json`],[`webp`,`image/webp`],[`wg`,`application/vnd.pmi.widget`],[`wgt`,`application/widget`],[`wks`,`application/vnd.ms-works`],[`wm`,`video/x-ms-wm`],[`wma`,`audio/x-ms-wma`],[`wmd`,`application/x-ms-wmd`],[`wmf`,`image/wmf`],[`wml`,`text/vnd.wap.wml`],[`wmlc`,`application/wmlc`],[`wmls`,`text/vnd.wap.wmlscript`],[`wmlsc`,`application/vnd.wap.wmlscriptc`],[`wmv`,`video/x-ms-wmv`],[`wmx`,`video/x-ms-wmx`],[`wmz`,`application/x-msmetafile`],[`woff`,`font/woff`],[`woff2`,`font/woff2`],[`word`,`application/msword`],[`wpd`,`application/vnd.wordperfect`],[`wpl`,`application/vnd.ms-wpl`],[`wps`,`application/vnd.ms-works`],[`wqd`,`application/vnd.wqd`],[`wri`,`application/x-mswrite`],[`wrl`,`model/vrml`],[`wsc`,`message/vnd.wfa.wsc`],[`wsdl`,`application/wsdl+xml`],[`wspolicy`,`application/wspolicy+xml`],[`wtb`,`application/vnd.webturbo`],[`wvx`,`video/x-ms-wvx`],[`x3d`,`model/x3d+xml`],[`x3db`,`model/x3d+fastinfoset`],[`x3dbz`,`model/x3d+binary`],[`x3dv`,`model/x3d-vrml`],[`x3dvz`,`model/x3d+vrml`],[`x3dz`,`model/x3d+xml`],[`x32`,`application/x-authorware-bin`],[`x_b`,`model/vnd.parasolid.transmit.binary`],[`x_t`,`model/vnd.parasolid.transmit.text`],[`xaml`,`application/xaml+xml`],[`xap`,`application/x-silverlight-app`],[`xar`,`application/vnd.xara`],[`xav`,`application/xcap-att+xml`],[`xbap`,`application/x-ms-xbap`],[`xbd`,`application/vnd.fujixerox.docuworks.binder`],[`xbm`,`image/x-xbitmap`],[`xca`,`application/xcap-caps+xml`],[`xcs`,`application/calendar+xml`],[`xdf`,`application/xcap-diff+xml`],[`xdm`,`application/vnd.syncml.dm+xml`],[`xdp`,`application/vnd.adobe.xdp+xml`],[`xdssc`,`application/dssc+xml`],[`xdw`,`application/vnd.fujixerox.docuworks`],[`xel`,`application/xcap-el+xml`],[`xenc`,`application/xenc+xml`],[`xer`,`application/patch-ops-error+xml`],[`xfdf`,`application/vnd.adobe.xfdf`],[`xfdl`,`application/vnd.xfdl`],[`xht`,`application/xhtml+xml`],[`xhtml`,`application/xhtml+xml`],[`xhvml`,`application/xv+xml`],[`xif`,`image/vnd.xiff`],[`xl`,`application/excel`],[`xla`,`application/vnd.ms-excel`],[`xlam`,`application/vnd.ms-excel.addin.macroEnabled.12`],[`xlc`,`application/vnd.ms-excel`],[`xlf`,`application/xliff+xml`],[`xlm`,`application/vnd.ms-excel`],[`xls`,`application/vnd.ms-excel`],[`xlsb`,`application/vnd.ms-excel.sheet.binary.macroEnabled.12`],[`xlsm`,`application/vnd.ms-excel.sheet.macroEnabled.12`],[`xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`xlt`,`application/vnd.ms-excel`],[`xltm`,`application/vnd.ms-excel.template.macroEnabled.12`],[`xltx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.template`],[`xlw`,`application/vnd.ms-excel`],[`xm`,`audio/xm`],[`xml`,`application/xml`],[`xns`,`application/xcap-ns+xml`],[`xo`,`application/vnd.olpc-sugar`],[`xop`,`application/xop+xml`],[`xpi`,`application/x-xpinstall`],[`xpl`,`application/xproc+xml`],[`xpm`,`image/x-xpixmap`],[`xpr`,`application/vnd.is-xpr`],[`xps`,`application/vnd.ms-xpsdocument`],[`xpw`,`application/vnd.intercon.formnet`],[`xpx`,`application/vnd.intercon.formnet`],[`xsd`,`application/xml`],[`xsl`,`application/xml`],[`xslt`,`application/xslt+xml`],[`xsm`,`application/vnd.syncml+xml`],[`xspf`,`application/xspf+xml`],[`xul`,`application/vnd.mozilla.xul+xml`],[`xvm`,`application/xv+xml`],[`xvml`,`application/xv+xml`],[`xwd`,`image/x-xwindowdump`],[`xyz`,`chemical/x-xyz`],[`xz`,`application/x-xz`],[`yaml`,`text/yaml`],[`yang`,`application/yang`],[`yin`,`application/yin+xml`],[`yml`,`text/yaml`],[`ymp`,`text/x-suse-ymp`],[`z`,`application/x-compress`],[`z1`,`application/x-zmachine`],[`z2`,`application/x-zmachine`],[`z3`,`application/x-zmachine`],[`z4`,`application/x-zmachine`],[`z5`,`application/x-zmachine`],[`z6`,`application/x-zmachine`],[`z7`,`application/x-zmachine`],[`z8`,`application/x-zmachine`],[`zaz`,`application/vnd.zzazz.deck+xml`],[`zip`,`application/zip`],[`zir`,`application/vnd.zul`],[`zirz`,`application/vnd.zul`],[`zmm`,`application/vnd.handheld-entertainment+xml`],[`zsh`,`text/x-scriptzsh`]]);function G1(e,t,n){let r=K1(e),{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&q1(r,`path`,a),n!==void 0&&Object.defineProperty(r,`handle`,{value:n,writable:!1,configurable:!1,enumerable:!0}),q1(r,`relativePath`,a),r}function K1(e){let{name:t}=e;if(t&&t.lastIndexOf(`.`)!==-1&&!e.type){let n=t.split(`.`).pop().toLowerCase(),r=W1.get(n);r&&Object.defineProperty(e,`type`,{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}function q1(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var J1=[`.DS_Store`,`Thumbs.db`];function Y1(e){return ki(this,void 0,void 0,function*(){return Q1(e)&&X1(e.dataTransfer)?t0(e.dataTransfer,e.type):Z1(e)?$1(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?e0(e):[]})}function X1(e){return Q1(e)}function Z1(e){return Q1(e)&&Q1(e.target)}function Q1(e){return typeof e==`object`&&!!e}function $1(e){return r0(e.target.files).map(e=>G1(e))}function e0(e){return ki(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>e.getFile()))).map(e=>G1(e))})}function t0(e,t){return ki(this,void 0,void 0,function*(){if(e.items){let n=r0(e.items).filter(e=>e.kind===`file`);return t===`drop`?n0(a0(yield Promise.all(n.map(i0)))):n}return n0(r0(e.files).map(e=>G1(e)))})}function n0(e){return e.filter(e=>J1.indexOf(e.name)===-1)}function r0(e){if(e===null)return[];let t=[];for(let n=0;n<e.length;n++){let r=e[n];t.push(r)}return t}function i0(e){if(typeof e.webkitGetAsEntry!=`function`)return o0(e);let t=e.webkitGetAsEntry();return t&&t.isDirectory?c0(t):o0(e,t)}function a0(e){return e.reduce((e,t)=>[...e,...Array.isArray(t)?a0(t):[t]],[])}function o0(e,t){return ki(this,void 0,void 0,function*(){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`){let t=yield e.getAsFileSystemHandle();if(t===null)throw Error(`${e} is not a File`);if(t!==void 0){let e=yield t.getFile();return e.handle=t,G1(e)}}let n=e.getAsFile();if(!n)throw Error(`${e} is not a File`);return G1(n,t?.fullPath??void 0)})}function s0(e){return ki(this,void 0,void 0,function*(){return e.isDirectory?c0(e):l0(e)})}function c0(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(t=>ki(this,void 0,void 0,function*(){if(t.length){let e=Promise.all(t.map(s0));r.push(e),i()}else try{e(yield Promise.all(r))}catch(e){n(e)}}),e=>{n(e)})}i()})}function l0(e){return ki(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(n=>{t(G1(n,e.fullPath))},e=>{n(e)})})})}var u0=o((e=>{e.__esModule=!0,e.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(`,`);if(n.length===0)return!0;var r=e.name||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}})),d0=l(U1()),f0=l(u0());function p0(e){return g0(e)||h0(e)||S0(e)||m0()}function m0(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
161
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function h0(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g0(e){if(Array.isArray(e))return C0(e)}function _0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_0(Object(n),!0).forEach(function(t){y0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b0(e,t){return T0(e)||w0(e,t)||S0(e,t)||x0()}function x0(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
162
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S0(e,t){if(e){if(typeof e==`string`)return C0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C0(e,t)}}function C0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w0(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function T0(e){if(Array.isArray(e))return e}var E0=typeof f0.default==`function`?f0.default:f0.default.default,D0=`file-invalid-type`,O0=`file-too-large`,k0=`file-too-small`,A0=`too-many-files`,j0=function(){var e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:``).split(`,`);return{code:D0,message:`File type must be ${e.length>1?`one of ${e.join(`, `)}`:e[0]}`}},M0=function(e){return{code:O0,message:`File is larger than ${e} ${e===1?`byte`:`bytes`}`}},N0=function(e){return{code:k0,message:`File is smaller than ${e} ${e===1?`byte`:`bytes`}`}},P0={code:A0,message:`Too many files`};function F0(e){return e.type===``&&typeof e.getAsFile==`function`}function I0(e,t){var n=e.type===`application/x-moz-file`||E0(e,t)||F0(e);return[n,n?null:j0(t)]}function L0(e,t,n){if(R0(e.size)){if(R0(t)&&R0(n)){if(e.size>n)return[!1,M0(n)];if(e.size<t)return[!1,N0(t)]}else if(R0(t)&&e.size<t)return[!1,N0(t)];else if(R0(n)&&e.size>n)return[!1,M0(n)]}return[!0,null]}function R0(e){return e!=null}function z0(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(e){var t=b0(I0(e,n),1)[0],a=b0(L0(e,r,i),1)[0],o=s?s(e):null;return t&&a&&!o})}function B0(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble===void 0?!1:e.cancelBubble}function V0(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(e){return e===`Files`||e===`application/x-moz-file`}):!!e.target&&!!e.target.files}function H0(e){e.preventDefault()}function U0(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function W0(e){return e.indexOf(`Edge/`)!==-1}function G0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return U0(e)||W0(e)}function K0(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t.some(function(t){return!B0(e)&&t&&t.apply(void 0,[e].concat(r)),B0(e)})}}function q0(){return`showOpenFilePicker`in window}function J0(e){return R0(e)?[{description:`Files`,accept:Object.entries(e).filter(function(e){var t=b0(e,2),n=t[0],r=t[1],i=!0;return Q0(n)||(console.warn(`Skipped "${n}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),i=!1),(!Array.isArray(r)||!r.every($0))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),i=!1),i}).reduce(function(e,t){var n=b0(t,2),r=n[0],i=n[1];return v0(v0({},e),{},y0({},r,i))},{})}]:e}function Y0(e){if(R0(e))return Object.entries(e).reduce(function(e,t){var n=b0(t,2),r=n[0],i=n[1];return[].concat(p0(e),[r],p0(i))},[]).filter(function(e){return Q0(e)||$0(e)}).join(`,`)}function X0(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function Z0(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function Q0(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||e===`application/*`||/\w+\/[-+.\w]+/g.test(e)}function $0(e){return/^.*\.[\w]+$/.test(e)}var e2=[`children`],t2=[`open`],n2=[`refKey`,`role`,`onKeyDown`,`onFocus`,`onBlur`,`onClick`,`onDragEnter`,`onDragOver`,`onDragLeave`,`onDrop`],r2=[`refKey`,`onChange`,`onClick`];function i2(e){return s2(e)||o2(e)||u2(e)||a2()}function a2(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
163
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o2(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function s2(e){if(Array.isArray(e))return d2(e)}function c2(e,t){return p2(e)||f2(e,t)||u2(e,t)||l2()}function l2(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
164
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u2(e,t){if(e){if(typeof e==`string`)return d2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d2(e,t)}}function d2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f2(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function p2(e){if(Array.isArray(e))return e}function m2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?m2(Object(n),!0).forEach(function(t){g2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g2(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _2(e,t){if(e==null)return{};var n=v2(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function v2(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var y2=(0,u.forwardRef)(function(e,t){var n=e.children,r=S2(_2(e,e2)),i=r.open,a=_2(r,t2);return(0,u.useImperativeHandle)(t,function(){return{open:i}},[i]),u.default.createElement(u.Fragment,null,n(h2(h2({},a),{},{open:i})))});y2.displayName=`Dropzone`;var b2={disabled:!1,getFilesFromEvent:Y1,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};y2.defaultProps=b2,y2.propTypes={children:d0.default.func,accept:d0.default.objectOf(d0.default.arrayOf(d0.default.string)),multiple:d0.default.bool,preventDropOnDocument:d0.default.bool,noClick:d0.default.bool,noKeyboard:d0.default.bool,noDrag:d0.default.bool,noDragEventsBubbling:d0.default.bool,minSize:d0.default.number,maxSize:d0.default.number,maxFiles:d0.default.number,disabled:d0.default.bool,getFilesFromEvent:d0.default.func,onFileDialogCancel:d0.default.func,onFileDialogOpen:d0.default.func,useFsAccessApi:d0.default.bool,autoFocus:d0.default.bool,onDragEnter:d0.default.func,onDragLeave:d0.default.func,onDragOver:d0.default.func,onDrop:d0.default.func,onDropAccepted:d0.default.func,onDropRejected:d0.default.func,onError:d0.default.func,validator:d0.default.func};var x2={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function S2(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=h2(h2({},b2),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,d=t.onDragLeave,f=t.onDragOver,p=t.onDrop,m=t.onDropAccepted,h=t.onDropRejected,g=t.onFileDialogCancel,_=t.onFileDialogOpen,v=t.useFsAccessApi,y=t.autoFocus,b=t.preventDropOnDocument,x=t.noClick,S=t.noKeyboard,C=t.noDrag,w=t.noDragEventsBubbling,T=t.onError,E=t.validator,D=(0,u.useMemo)(function(){return Y0(n)},[n]),O=(0,u.useMemo)(function(){return J0(n)},[n]),ee=(0,u.useMemo)(function(){return typeof _==`function`?_:w2},[_]),k=(0,u.useMemo)(function(){return typeof g==`function`?g:w2},[g]),A=(0,u.useRef)(null),j=(0,u.useRef)(null),M=c2((0,u.useReducer)(C2,x2),2),N=M[0],P=M[1],F=N.isFocused,I=N.isFileDialogActive,te=(0,u.useRef)(typeof window<`u`&&window.isSecureContext&&v&&q0()),ne=function(){!te.current&&I&&setTimeout(function(){j.current&&(j.current.files.length||(P({type:`closeDialog`}),k()))},300)};(0,u.useEffect)(function(){return window.addEventListener(`focus`,ne,!1),function(){window.removeEventListener(`focus`,ne,!1)}},[j,I,k,te]);var re=(0,u.useRef)([]),ie=(0,u.useRef)([]),ae=function(e){A.current&&A.current.contains(e.target)||(e.preventDefault(),re.current=[])};(0,u.useEffect)(function(){return b&&(document.addEventListener(`dragover`,H0,!1),document.addEventListener(`drop`,ae,!1)),function(){b&&(document.removeEventListener(`dragover`,H0),document.removeEventListener(`drop`,ae))}},[A,b]),(0,u.useEffect)(function(){var e=function(e){ie.current=[].concat(i2(ie.current),[e.target]),V0(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){ie.current=ie.current.filter(function(t){return t!==e.target&&t!==null}),!(ie.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){ie.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){ie.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[A]),(0,u.useEffect)(function(){return!r&&y&&A.current&&A.current.focus(),function(){}},[A,y,r]);var oe=(0,u.useCallback)(function(e){T?T(e):console.error(e)},[T]),se=(0,u.useCallback)(function(e){e.preventDefault(),e.persist(),be(e),re.current=[].concat(i2(re.current),[e.target]),V0(e)&&Promise.resolve(i(e)).then(function(t){if(!(B0(e)&&!w)){var n=t.length,r=n>0&&z0({files:t,accept:D,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:E});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return oe(e)})},[i,l,oe,w,D,o,a,s,c,E]),ce=(0,u.useCallback)(function(e){e.preventDefault(),e.persist(),be(e);var t=V0(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&f&&f(e),!1},[f,w]),le=(0,u.useCallback)(function(e){e.preventDefault(),e.persist(),be(e);var t=re.current.filter(function(e){return A.current&&A.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),re.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),V0(e)&&d&&d(e))},[A,d,w]),ue=(0,u.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=c2(I0(e,D),2),i=t[0],s=t[1],c=c2(L0(e,o,a),2),l=c[0],u=c[1],d=E?E(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[P0]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),p&&p(n,r,t),r.length>0&&h&&h(r,t),n.length>0&&m&&m(n,t)},[P,s,D,o,a,c,p,m,h,E]),de=(0,u.useCallback)(function(e){e.preventDefault(),e.persist(),be(e),re.current=[],V0(e)&&Promise.resolve(i(e)).then(function(t){B0(e)&&!w||ue(t,e)}).catch(function(e){return oe(e)}),P({type:`reset`})},[i,ue,oe,w]),fe=(0,u.useCallback)(function(){if(te.current){P({type:`openDialog`}),ee();var e={multiple:s,types:O};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){ue(e,null),P({type:`closeDialog`})}).catch(function(e){X0(e)?(k(e),P({type:`closeDialog`})):Z0(e)?(te.current=!1,j.current?(j.current.value=null,j.current.click()):oe(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):oe(e)});return}j.current&&(P({type:`openDialog`}),ee(),j.current.value=null,j.current.click())},[P,ee,k,v,ue,oe,O,s]),pe=(0,u.useCallback)(function(e){!A.current||!A.current.isEqualNode(e.target)||(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),fe())},[A,fe]),me=(0,u.useCallback)(function(){P({type:`focus`})},[]),he=(0,u.useCallback)(function(){P({type:`blur`})},[]),ge=(0,u.useCallback)(function(){x||(G0()?setTimeout(fe,0):fe())},[x,fe]),_e=function(e){return r?null:e},ve=function(e){return S?null:_e(e)},ye=function(e){return C?null:_e(e)},be=function(e){w&&e.stopPropagation()},xe=(0,u.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=_2(e,n2);return h2(h2(g2({onKeyDown:ve(K0(a,pe)),onFocus:ve(K0(o,me)),onBlur:ve(K0(s,he)),onClick:_e(K0(c,ge)),onDragEnter:ye(K0(l,se)),onDragOver:ye(K0(u,ce)),onDragLeave:ye(K0(d,le)),onDrop:ye(K0(f,de)),role:typeof i==`string`&&i!==``?i:`presentation`},n,A),!r&&!S?{tabIndex:0}:{}),p)}},[A,pe,me,he,ge,se,ce,le,de,S,C,r]),Se=(0,u.useCallback)(function(e){e.stopPropagation()},[]),Ce=(0,u.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=_2(e,r2);return h2(h2({},g2({accept:D,multiple:s,type:`file`,style:{border:0,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`0 -1px -1px 0`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`},onChange:_e(K0(r,de)),onClick:_e(K0(i,Se)),tabIndex:-1},n,j)),a)}},[j,n,s,de,r]);return h2(h2({},N),{},{isFocused:F&&!r,getRootProps:xe,getInputProps:Ce,rootRef:A,inputRef:j,open:_e(fe)})}function C2(e,t){switch(t.type){case`focus`:return h2(h2({},e),{},{isFocused:!0});case`blur`:return h2(h2({},e),{},{isFocused:!1});case`openDialog`:return h2(h2({},x2),{},{isFileDialogActive:!0});case`closeDialog`:return h2(h2({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return h2(h2({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return h2(h2({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return h2(h2({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return h2({},x2);default:return e}}function w2(){}var T2={upload:`Click to pick file`,drag:`or drag and drop`,active:`Drop files here`,reject:`Some files are not allowed`,rejectInvalidType:`One or more files have an invalid type.`,rejectTooLarge:`One or more files exceed the maximum size.`,rejectTooSmall:`One or more files are below the minimum size.`,rejectTooMany:`Too many files selected.`,selectedCount:`{{count}} files selected`};function E2(e,t){return e.replace(/\{\{\s*count\s*\}\}|\{count\}/g,String(t))}function D2({id:e,name:t,label:n,description:r,error:i,accept:a,multiple:o=!1,disabled:s=!1,required:c=!1,maxFiles:l,maxSize:d,minSize:f,icon:m,className:h,labelClassName:g,contentClassName:_,descriptionClassName:v,errorClassName:y,dropzoneClassName:b,labels:x,onChange:S,onDropRejected:C,...w}){let T={...T2,...x},E=r?`${e}-description`:void 0,D=(0,u.useEffectEvent)(e=>{S?.(e)}),{acceptedFiles:O,fileRejections:ee,getRootProps:k,getInputProps:A,isDragActive:j,isDragReject:M,isFocused:N}=S2({accept:a,multiple:o,disabled:s,maxFiles:l,maxSize:d,minSize:f,onDropRejected:(0,u.useCallback)(e=>{C?.(e)},[C])}),P=(0,u.useMemo)(()=>{if(ee.length===0)return[];let e=new Set(ee.flatMap(e=>e.errors.map(e=>e.code))),t=[];return e.has(`file-invalid-type`)&&t.push(T.rejectInvalidType),e.has(`file-too-large`)&&t.push(T.rejectTooLarge),e.has(`file-too-small`)&&t.push(T.rejectTooSmall),e.has(`too-many-files`)&&t.push(T.rejectTooMany),t.length===0&&t.push(T.reject),t},[ee,T.reject,T.rejectInvalidType,T.rejectTooLarge,T.rejectTooSmall,T.rejectTooMany]),F=!!i||P.length>0,I=F?`${e}-error`:void 0,te=[E,I].filter(Boolean).join(` `)||void 0;(0,u.useEffect)(()=>{D(O)},[O]);let ne=E2(T.selectedCount,O.length);return(0,p.jsxs)(HL,{"data-component":`filepicker-dropzone`,"data-disabled":s?!0:void 0,"data-invalid":F?!0:void 0,className:V(h),...w,children:[n&&(0,p.jsx)(WL,{htmlFor:e,className:g,children:n}),(0,p.jsxs)(UL,{className:_,children:[r&&(0,p.jsx)(KL,{id:E,className:v,children:r}),(0,p.jsxs)(`div`,{...k({className:V(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 relative rounded-lg border border-dashed bg-transparent p-4 transition-colors outline-none focus-visible:ring-3 aria-invalid:ring-3`,s?`bg-input/50 dark:bg-input/80 pointer-events-none cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-muted/30`,j&&`border-primary bg-primary/5`,M&&`border-destructive/60 bg-destructive/5`,N&&`border-ring ring-ring/50 ring-3`,b),"aria-invalid":F?!0:void 0}),children:[(0,p.jsx)(`input`,{...A({id:e,name:t,required:c,"aria-describedby":te,"aria-invalid":F?!0:void 0})}),(0,p.jsxs)(`div`,{className:`flex min-h-14 flex-col items-center justify-center gap-2 text-center`,children:[(0,p.jsx)(`span`,{className:V(`text-muted-foreground`,j&&`text-primary`,M&&`text-destructive`),"aria-hidden":`true`,children:m??(0,p.jsx)(bte,{className:`size-6`})}),(0,p.jsxs)(`p`,{className:`text-sm`,children:[M&&(0,p.jsx)(`span`,{className:`text-destructive font-medium`,children:T.reject}),!M&&j&&(0,p.jsx)(`span`,{className:`text-primary font-medium`,children:T.active}),!M&&!j&&O.length>0&&(0,p.jsx)(`span`,{className:`font-medium`,children:ne}),!M&&!j&&O.length===0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`text-foreground font-medium`,children:T.upload}),` `,(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:T.drag})]})]})]})]}),i?(0,p.jsx)(qL,{id:I,className:y,children:i}):P.length>0?(0,p.jsx)(qL,{id:I,className:y,errors:P.map(e=>({message:e}))}):null]})]})}function O2({...e}){return(0,p.jsx)(Xh,{"data-slot":`select`,...e})}function k2({className:e,...t}){return(0,p.jsx)(Dg,{"data-slot":`select-group`,className:V(`scroll-my-1 p-1`,e),...t})}function A2({...e}){return(0,p.jsx)(eg,{"data-slot":`select-value`,...e})}function j2({className:e,size:t=`default`,children:n,...r}){return(0,p.jsxs)(Qh,{"data-slot":`select-trigger`,"data-size":t,className:V(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,p.jsx)(ng,{asChild:!0,children:(0,p.jsx)(yS,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function M2({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,p.jsx)(og,{children:(0,p.jsxs)(cg,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:V(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,p.jsx)(P2,{}),(0,p.jsx)(Cg,{"data-position":n,className:V(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,p.jsx)(F2,{})]})})}function N2({className:e,children:t,...n}){return(0,p.jsxs)(Ng,{"data-slot":`select-item`,className:V(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,p.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,p.jsx)(Lg,{children:(0,p.jsx)(vS,{className:`pointer-events-none`})})}),(0,p.jsx)(Fg,{children:t})]})}function P2({className:e,...t}){return(0,p.jsx)(zg,{"data-slot":`select-scroll-up-button`,className:V(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,p.jsx)(SS,{})})}function F2({className:e,...t}){return(0,p.jsx)(Vg,{"data-slot":`select-scroll-down-button`,className:V(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,p.jsx)(yS,{})})}var I2=qn(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),L2=u.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function R2({className:e,variant:t,size:n,spacing:r=0,orientation:i=`horizontal`,children:a,...o}){return(0,p.jsx)(Vv,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:V(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,p.jsx)(L2.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function z2({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=u.useContext(L2);return(0,p.jsx)(Hv,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:V(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,I2({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function B2({className:e,...t}){return(0,p.jsx)(`textarea`,{"data-slot":`textarea`,className:V(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function V2(e){return e>0?`asset`:`url`}function H2(e){return e===`center`?`center`:e===`right`||e===`end`?`right`:`left`}function U2(e){return e}function W2(e){return e?{value:String(e.value),unit:e.unit}:{value:``,unit:`px`}}function G2(e,t){let n=e.trim();if(n.length===0)return;let r=Number(n);if(!(!Number.isFinite(r)||r<0))return{unit:t,value:r}}function K2(e,t,n,r){let i=G2(e,t),a=G2(n,r);if(!(!i&&!a))return{...i?{width:i}:{},...a?{maxWidth:a}:{}}}function q2({editable:e,enabled:t}){let[n]=VX(),{imageAssets:r=[],registerImageAsset:i,resolveImageAssetUrl:a}=RX(),o=G(`common.actions`),s=G(`defaultEditors.assetManager`),c=G(`defaultEditors.imagePopover`),[l,d]=(0,u.useState)(null),[f,m]=(0,u.useState)(()=>V2(r.length)),[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(``),[y,b]=(0,u.useState)(``),[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)(`center`),[T,E]=(0,u.useState)(``),[D,O]=(0,u.useState)(`px`),[ee,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(`%`),[M,N]=(0,u.useState)(null),[P,F]=(0,u.useState)(!1),[I,te]=(0,u.useState)(0),[ne,re]=(0,u.useState)(!1),ie=(0,u.useRef)(null),ae=(0,u.useRef)(r.length);ae.current=r.length;let oe=(0,u.useCallback)(()=>{d(null),m(V2(ae.current)),g(``),v(``),b(``),S(``),w(`center`),E(``),O(`px`),k(``),j(`%`),N(null),F(!1),te(e=>e+1),re(!1)},[]),se=(0,u.useEffectEvent)(e=>n.read(()=>{let t=KW(e);if(!ZX(t))return null;let n=t.getSource(),r=W2(t.getSize()?.width),i=W2(t.getSize()?.maxWidth);return{source:n,alt:t.getAlt()??``,caption:t.getCaption(),align:H2(t.getFormat()),widthValue:r.value,widthUnit:r.unit,maxWidthValue:i.value,maxWidthUnit:i.unit}})),ce=(0,u.useEffectEvent)(e=>{let t=se(e);if(!t){oe();return}m(t.source.type===`asset`?`asset`:t.source.url.trim().length>0?`url`:V2(r.length)),t.source.type===`asset`?(g(t.source.assetId),v(``)):(v(t.source.url),g(r[0]?.assetId??``)),b(t.alt),S(t.caption),w(t.align),E(t.widthValue),O(t.widthUnit),k(t.maxWidthValue),j(t.maxWidthUnit),N(null),re(!1),d(e)}),le=(0,u.useEffectEvent)(()=>{l&&(se(l)||oe())});(0,u.useEffect)(()=>{if(!(!e||!t))return mq(n.registerCommand(UX,e=>(window.requestAnimationFrame(()=>{ce(e)}),!0),0),n.registerUpdateListener(()=>{le()}))},[e,n,t]);let ue=()=>{if(f===`url`){let e=_.trim();return e.length===0?null:{type:`external`,url:e}}let e=h.trim();return e.length===0?null:{type:`asset`,assetId:e}},de=()=>{if(!l)return;let e=ue();if(!e)return;let t=K2(T,D,ee,A);n.dispatchCommand(WX,{key:l,source:e,alt:y,caption:x,size:t,format:U2(C)}),oe()},fe=async e=>{let t=e[0];if(!(!t||!i)){F(!0),N(null);try{g(await i(t)),m(`asset`),re(!1)}catch{N(c(`uploadFailed`))}finally{F(!1),te(e=>e+1)}}},pe=ue()!==null,me=e=>c(e===`px`?`unitPx`:`unitPercent`);return(0,p.jsx)(xL,{open:l!==null,onOpenChange:e=>{e||oe()},children:(0,p.jsxs)(SL,{showCloseButton:!0,closeLabel:o(`close`),className:V(`flex max-h-[min(90vh,40rem)] w-[min(26rem,calc(100vw-2rem))] max-w-none flex-col gap-0 overflow-hidden p-0 sm:max-w-none`,ne?`z-50`:`z-60`),onOpenAutoFocus:e=>{f===`url`&&(e.preventDefault(),ie.current?.focus())},children:[(0,p.jsx)(CL,{className:`shrink-0 border-b border-border/80 px-4 py-3 text-left`,children:(0,p.jsx)(TL,{className:`text-base`,children:c(`dialogTitle`)})}),(0,p.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`sourceDescription`)}),(0,p.jsxs)(iC,{value:f,onValueChange:e=>m(e),children:[(0,p.jsx)(`div`,{className:`flex justify-center`,children:(0,p.jsxs)(aC,{className:`w-full rounded-full`,children:[(0,p.jsx)(oC,{value:`asset`,className:`text-xs rounded-full`,children:c(`tabLocalAsset`)}),(0,p.jsx)(oC,{value:`url`,className:`text-xs rounded-full`,children:c(`tabExternalUrl`)})]})}),(0,p.jsxs)(`div`,{className:`min-h-26`,children:[(0,p.jsxs)(sC,{value:`asset`,className:`m-0 focus-visible:ring-0`,children:[(0,p.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border/80`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/80 bg-muted/30 ps-2`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:s(`existingAssets`)}),(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0`,disabled:!i,"aria-label":c(`addLocalAsset`),onClick:()=>{N(null),re(!0)},children:(0,p.jsx)(KS,{className:`size-4`})})]}),r.length===0?(0,p.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-muted-foreground`,children:s(`empty`)}):(0,p.jsx)(`ul`,{className:`max-h-46 divide-y divide-border/60 overflow-y-auto`,role:`listbox`,"aria-label":s(`existingAssets`),children:r.map((e,t)=>{let n=h===e.assetId,i=e.previewUrl??a?.(e.assetId),o=t===r.length-1;return(0,p.jsx)(`li`,{role:`presentation`,children:(0,p.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:V(`flex w-full items-center gap-2 px-2 py-2 text-left text-sm transition-colors`,n?`bg-muted/80 ring-1 ring-inset ring-primary/40`:`hover:bg-muted/50`,o&&`rounded-b-lg`),onClick:()=>g(e.assetId),children:[(0,p.jsx)(`div`,{className:`relative size-10 shrink-0 overflow-hidden rounded-md border border-border/80 bg-muted`,children:i?(0,p.jsx)(`img`,{src:i,alt:``,className:`size-full object-cover`}):(0,p.jsx)(`div`,{className:`flex size-full items-center justify-center text-muted-foreground`,children:(0,p.jsx)(LS,{className:`size-4`})})}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.label}),n?(0,p.jsx)(vS,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}):null]})},e.assetId)})})]}),(0,p.jsx)(xL,{open:ne,onOpenChange:re,children:(0,p.jsxs)(SL,{showCloseButton:!0,closeLabel:o(`close`),className:`z-60 w-[min(22rem,calc(100vw-2rem))] max-w-none sm:max-w-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,p.jsx)(CL,{children:(0,p.jsx)(TL,{className:`text-base`,children:c(`uploadAssetDialogTitle`)})}),(0,p.jsx)(D2,{id:`rich-text-image-upload`,accept:{"image/*":[]},multiple:!1,disabled:P,description:P?c(`uploading`):void 0,error:M??void 0,className:`gap-2`,contentClassName:`gap-2 p-0`,dropzoneClassName:`min-h-[5.5rem] py-3`,labels:{upload:s(`uploadLabel`),drag:s(`uploadDescription`),active:s(`uploadActive`)},onChange:e=>{fe(e)}},I)]})})]}),(0,p.jsxs)(sC,{value:`url`,className:`m-0 h-full min-h-0 space-y-2 focus-visible:ring-0`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`urlLabel`)}),(0,p.jsx)(lx,{ref:ie,value:_,placeholder:s(`externalPlaceholder`),onChange:e=>v(e.target.value)})]})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,p.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`widthLabel`)}),(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(lx,{className:`min-w-0 flex-1 h-7`,inputMode:`decimal`,value:T,onChange:e=>E(e.target.value)}),(0,p.jsxs)(O2,{value:D,onValueChange:e=>O(e),children:[(0,p.jsx)(j2,{className:`w-fit shrink-0 rounded-lg!`,size:`sm`,children:(0,p.jsx)(A2,{})}),(0,p.jsxs)(M2,{className:`z-70`,children:[(0,p.jsx)(N2,{value:`px`,children:me(`px`)}),(0,p.jsx)(N2,{value:`%`,children:me(`%`)})]})]})]})]}),(0,p.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`maxWidthLabel`)}),(0,p.jsxs)(`div`,{className:`flex gap-1`,children:[(0,p.jsx)(lx,{className:`min-w-0 flex-1 h-7`,inputMode:`decimal`,value:ee,onChange:e=>k(e.target.value)}),(0,p.jsxs)(O2,{value:A,onValueChange:e=>j(e),children:[(0,p.jsx)(j2,{className:`w-fit shrink-0 rounded-lg!`,size:`sm`,children:(0,p.jsx)(A2,{})}),(0,p.jsxs)(M2,{className:`z-70`,children:[(0,p.jsx)(N2,{value:`px`,children:me(`px`)}),(0,p.jsx)(N2,{value:`%`,children:me(`%`)})]})]})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1 sm:w-auto sm:shrink-0`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`alignmentLabel`)}),(0,p.jsxs)(R2,{type:`single`,value:C,variant:`outline`,size:`sm`,spacing:0,className:`w-full sm:w-fit`,onValueChange:e=>{e&&w(e)},children:[(0,p.jsx)(z2,{value:`left`,className:`min-w-0 flex-1 sm:flex-none`,"aria-label":c(`alignLeft`),title:c(`alignLeft`),children:(0,p.jsx)(QS,{className:`size-4`})}),(0,p.jsx)(z2,{value:`center`,className:`min-w-0 flex-1 sm:flex-none`,"aria-label":c(`alignCenter`),title:c(`alignCenter`),children:(0,p.jsx)(XS,{className:`size-4`})}),(0,p.jsx)(z2,{value:`right`,className:`min-w-0 flex-1 sm:flex-none`,"aria-label":c(`alignRight`),title:c(`alignRight`),children:(0,p.jsx)(ZS,{className:`size-4`})})]})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`altLabel`)}),(0,p.jsx)(lx,{value:y,placeholder:c(`altPlaceholder`),onChange:e=>b(e.target.value)})]}),(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(ux,{className:`text-xs text-muted-foreground`,children:c(`captionLabel`)}),(0,p.jsx)(B2,{value:x,placeholder:c(`captionPlaceholder`),rows:2,onChange:e=>S(e.target.value)})]})]})}),(0,p.jsxs)(wL,{className:`mx-0 mb-0 mt-0 shrink-0 rounded-b-xl border-t border-border/80 bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end`,children:[(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:oe,children:o(`cancel`)}),(0,p.jsx)(H,{type:`button`,size:`sm`,disabled:!pe,onClick:de,children:c(`apply`)})]})]})})}function J2(){let[e]=VX(),{imageAssetDeletion:t}=RX(),n=mx(),r=G(`defaultEditors.imagePopover`);return(0,u.useEffect)(()=>{if(!t)return;let i=t=>e.getEditorState().read(()=>{let e=n=>{if(ZX(n)){let e=n.getSource();return e.type===`asset`&&e.assetId===t}return n instanceof $U?n.getChildren().some(e):!1};return QW().getChildren().some(e)});return e.registerMutationListener(YX,(e,{updateTags:a,prevEditorState:o})=>{if(!a.has(`rich-text-editor-sync-from-value`))for(let[a,s]of e){if(s!==`destroyed`)continue;let e=o.read(()=>{let e=KW(a);return ZX(e)?e.getSource():null});if(!e||e.type!==`asset`)continue;let{assetId:c}=e;t.getUsageCount(c)===1&&queueMicrotask(()=>{n({title:r(`deleteAssetConfirmTitle`),description:r(`deleteAssetConfirmDescription`),confirmButtonText:r(`deleteAssetConfirmPrimary`),cancelButtonText:r(`deleteAssetKeepFile`),variant:`destructive`}).then(e=>{!e||i(c)||t.removeAsset(c)}).catch(e=>{console.error(`Failed to confirm image asset deletion:`,e)})})}})},[e,t,n,r]),null}function Y2({editable:e,enabled:t,surfaceRef:n}){let[r]=VX(),i=G(`common.actions`),a=G(`defaultEditors.infoBoxPopover`),[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)(`info`),[d,f]=(0,u.useState)(``),[m,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(!0),[v,y]=(0,u.useState)(!0),b=(0,u.useRef)(null),x=(0,u.useCallback)(()=>{s(null),f(``),h(``),_(!0),y(!0),l(`info`)},[]),S=(0,u.useEffectEvent)(e=>r.read(()=>{let t=KW(e),i=n.current,a=r.getElementByKey(e);if(!aZ(t)||!i||!a)return null;let o=a.getBoundingClientRect(),s=i.getBoundingClientRect(),c=o.top-s.top>220;return{tone:t.getTone()===`warning`?`warning`:`info`,title:t.getTitle(),content:t.getContent(),collapsible:t.getCollapsible(),defaultOpen:t.getDefaultOpen(),left:o.left-s.left+o.width/2,top:c?o.top-s.top:o.bottom-s.top,side:c?`top`:`bottom`}})),C=(0,u.useEffectEvent)(e=>{let t=S(e);if(!t){x();return}l(t.tone),f(t.title),h(t.content),_(t.collapsible),y(t.defaultOpen),s({key:e,left:t.left,top:t.top,side:t.side})}),w=(0,u.useEffectEvent)(()=>{if(!o)return;let e=S(o.key);if(!e){x();return}o.left===e.left&&o.top===e.top&&o.side===e.side||s({...o,left:e.left,top:e.top,side:e.side})});(0,u.useEffect)(()=>{if(!(!e||!t))return mq(r.registerCommand($X,e=>(window.requestAnimationFrame(()=>{C(e)}),!0),0),r.registerUpdateListener(()=>{w()}))},[e,r,t]),(0,u.useEffect)(()=>{if(!o)return;let e=()=>{w()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[o]);let T=()=>{o&&(r.dispatchCommand(eZ,{key:o.key,tone:c,title:d,content:m,collapsible:g,defaultOpen:v}),x())};return(0,p.jsxs)(kL,{open:o!==null,onOpenChange:e=>{e||x()},children:[o?(0,p.jsx)(ML,{asChild:!0,children:(0,p.jsx)(`div`,{className:`pointer-events-none absolute size-0`,style:{left:o.left,top:o.top}})}):null,(0,p.jsx)(jL,{side:o?.side??`bottom`,align:`center`,sideOffset:12,collisionPadding:12,className:`z-60 w-80 border border-border`,onOpenAutoFocus:e=>{e.preventDefault(),b.current?.focus(),b.current?.select()},onCloseAutoFocus:e=>{e.preventDefault()},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),T()):e.key===`Escape`&&(e.preventDefault(),x())},children:(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`span`,{className:`block text-xs font-medium text-muted-foreground`,children:a(`typeLabel`)}),(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsx)(H,{type:`button`,size:`sm`,variant:c===`info`?`default`:`outline`,className:`flex-1`,onClick:()=>{l(`info`)},children:a(`toneInfo`)}),(0,p.jsx)(H,{type:`button`,size:`sm`,variant:c===`warning`?`default`:`outline`,className:`flex-1`,onClick:()=>{l(`warning`)},children:a(`toneWarning`)})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(ux,{htmlFor:`info-box-title`,className:`text-xs font-medium text-muted-foreground`,children:a(`titleLabel`)}),(0,p.jsx)(lx,{id:`info-box-title`,ref:b,value:d,placeholder:a(`titlePlaceholder`),onChange:e=>{f(e.target.value)}})]}),(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(ux,{htmlFor:`info-box-content`,className:`text-xs font-medium text-muted-foreground`,children:a(`contentLabel`)}),(0,p.jsx)(B2,{id:`info-box-content`,value:m,placeholder:a(`contentPlaceholder`),rows:4,className:`min-h-0 text-sm resize-y`,onChange:e=>{h(e.target.value)}})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsx)(ux,{htmlFor:`info-box-collapsible`,className:`text-xs font-normal`,children:a(`collapsibleBody`)}),(0,p.jsx)(XL,{size:`sm`,id:`info-box-collapsible`,checked:g,onCheckedChange:e=>{_(e),e||y(!0)}})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsx)(ux,{htmlFor:`info-box-default-open`,className:V(`text-xs font-normal`,!g&&`text-muted-foreground`),children:a(`openByDefault`)}),(0,p.jsx)(XL,{id:`info-box-default-open`,size:`sm`,disabled:!g,checked:v,onCheckedChange:y})]}),(0,p.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,p.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,onClick:x,children:i(`cancel`)}),(0,p.jsx)(H,{type:`button`,size:`sm`,onClick:T,children:a(`apply`)})]})]})})]})}function X2({editable:e,enabled:t,surfaceRef:n}){let[r]=VX(),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(``),[c,l]=(0,u.useState)(``),d=(0,u.useRef)(null),f=(0,u.useCallback)(()=>{a(null),s(``),l(``)},[]),m=(0,u.useEffectEvent)(e=>r.read(()=>{let t=KW(e),i=n.current,a=r.getElementByKey(e);if(!oQ(t)||!i||!a)return null;let o=a.getBoundingClientRect(),s=i.getBoundingClientRect(),c=o.top-s.top>180;return{text:t.getTextContent(),url:t.getURL()||`https://`,left:o.left-s.left+o.width/2,top:c?o.top-s.top:o.bottom-s.top,side:c?`top`:`bottom`}})),h=(0,u.useEffectEvent)(e=>{let t=m(e);if(!t){f();return}s(t.text),l(t.url),a({key:e,left:t.left,top:t.top,side:t.side})}),g=(0,u.useEffectEvent)(()=>{if(!i)return;let e=m(i.key);if(!e){s(``),l(``),a(null);return}i.left===e.left&&i.top===e.top&&i.side===e.side||a({...i,left:e.left,top:e.top,side:e.side})});(0,u.useEffect)(()=>{if(!e||!t)return;let n=()=>{};return mq(r.registerCommand($Z,e=>(window.requestAnimationFrame(()=>{h(e)}),!0),0),r.registerUpdateListener(()=>{g()}),r.registerRootListener(e=>{if(n(),!e){n=()=>{};return}let t=e=>{let t=e.target;if(!(t instanceof Node))return;let n=r.read(()=>{let e=YW(t);if(oQ(e))return e;let n=e?.getParent();return oQ(n)?n:null});n&&h(n.getKey())};e.addEventListener(`click`,t),n=()=>{e.removeEventListener(`click`,t)}}),()=>{n()})},[e,r,t]),(0,u.useEffect)(()=>{if(!i)return;let e=()=>{g()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]);let _=()=>{i&&(r.dispatchCommand(eQ,{key:i.key,text:o,url:c}),f())};return(0,p.jsxs)(kL,{open:i!==null,onOpenChange:e=>{e||f()},children:[i?(0,p.jsx)(ML,{asChild:!0,children:(0,p.jsx)(`div`,{className:`pointer-events-none absolute size-0`,style:{left:i.left,top:i.top}})}):null,(0,p.jsx)(jL,{side:i?.side??`bottom`,align:`center`,sideOffset:12,collisionPadding:12,className:`z-60 w-80 border border-border`,onOpenAutoFocus:e=>{e.preventDefault(),d.current?.focus(),d.current?.select()},onCloseAutoFocus:e=>{e.preventDefault()},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),f())},children:(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:`Display`}),(0,p.jsx)(lx,{ref:d,value:o,placeholder:`Link`,onChange:e=>{s(e.target.value)}})]}),(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:`URL`}),(0,p.jsx)(lx,{value:c,placeholder:`https://example.com`,onChange:e=>{l(e.target.value)}})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`px-0 text-muted-foreground hover:text-foreground`,onClick:()=>{i&&(r.dispatchCommand(tQ,i.key),f())},children:`Convert to text`}),(0,p.jsx)(H,{type:`button`,size:`sm`,onClick:_,children:`Apply`})]})]})})]})}var Z2=208,Q2={formatting:`Formatting`,blocks:`Blocks`,insert:`Insert`};function $2(e,t){return[...e].sort((e,n)=>{let r=xZ[e.group],i=xZ[n.group];return r===i?(t.get(e.key)??0)-(t.get(n.key)??0):r-i})}function e4(e){let t=new Set(e.map(e=>e.group)).size>1,n=[],r=null;return e.forEach((e,i)=>{t&&e.group!==r&&(n.push({type:`groupLabel`,group:e.group,key:`group-${e.group}-${i}`}),r=e.group),n.push({type:`item`,item:e,itemIndex:i})}),n}function t4(e,t,n){t&&e.update(()=>{if(n.kind===`link`){let n=X();if(!Y(n))return;let r=KW(t.textNodeKey);if(!J(r))return;n.setTextNodeRange(r,t.startOffset,r,t.endOffset),n.removeText();let i=qZ({openEditor:!1});i&&window.requestAnimationFrame(()=>{e.dispatchCommand($Z,i)});return}let r=X();if(!Y(r))return;let i=KW(t.textNodeKey);if(!J(i))return;let a=n.kind===`infoBox`||n.kind===`image`?AZ(i)?.getKey():void 0;if(r.setTextNodeRange(i,t.startOffset,i,t.endOffset),r.removeText(),n.kind===`style`){RZ(n.control);return}if(n.kind===`bulletList`){MZ();return}if(n.kind===`heading`){EZ(n.level);return}if(n.kind===`infoBox`){let t=UZ({tone:n.tone,...a===void 0?{}:{replaceIfEmptyParagraphKey:a}});t&&window.requestAnimationFrame(()=>{e.dispatchCommand($X,t)});return}if(n.kind===`image`){let t=WZ(a===void 0?{}:{replaceIfEmptyParagraphKey:a});t&&window.requestAnimationFrame(()=>{e.dispatchCommand(UX,t)});return}if(n.kind===`separator`){e.dispatchCommand(GJ,void 0);return}VZ(n.templateVariable)})}function n4({editable:e,linksEnabled:t,bulletListsEnabled:n,headingsEnabled:r,infoBoxesEnabled:i,imagesEnabled:a,separatorsEnabled:o,surfaceRef:s,styleControls:c,templateVariables:l,commandMenuClassName:d}){let[f]=VX(),m=(0,u.useMemo)(()=>TZ(c,l,t,n??!1,r??!1,i??!1,a??!1,o??!1),[n,r,a,i,t,o,c,l]),[h,g]=(0,u.useState)(null),_=(0,u.useRef)(null),v=(0,u.useEffectEvent)(()=>{g(null)}),y=(0,u.useEffectEvent)(()=>{let t=f.getRootElement(),n=s.current,r=window.getSelection();if(!e||m.length===0||!t||!n||!r||r.rangeCount===0){g(null);return}let i=r.anchorNode;if(!i||!t.contains(i)){g(null);return}f.getEditorState().read(()=>{let e=X();if(!Y(e)||!e.isCollapsed()){g(null);return}let t=e.anchor.getNode();if(!J(t)){g(null);return}let i=e.anchor.offset,a=t.getTextContent().slice(0,i).match(/(?:^|\s)\/([a-z0-9_-]*)$/i);if(!a){g(null);return}let o=a[1]?.toLowerCase()??``,s=$2(m.filter(e=>o.length===0||e.keywords.some(e=>e.includes(o))),new Map(m.map((e,t)=>[e.key,t])));if(s.length===0){g(null);return}let c=r.getRangeAt(0).getBoundingClientRect(),l=n.getBoundingClientRect(),u=l.width,d=c.left-l.left,f=Math.max(12,u-Z2-12),p=Math.min(Math.max(d,12),f);g(e=>({left:p,top:c.bottom-l.top+8,query:o,startOffset:i-o.length-1,endOffset:i,textNodeKey:t.getKey(),selectedIndex:e?.query===o?Math.min(e.selectedIndex,s.length-1):0,items:s,rows:e4(s)}))})});return(0,u.useEffect)(()=>{if(e)return mq(f.registerCommand(EB,()=>(y(),!1),0),f.registerUpdateListener(()=>{y()}),f.registerCommand(WB,e=>{if(!h)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),g(e=>e&&{...e,selectedIndex:(e.selectedIndex+1)%e.items.length}),!0;case`ArrowUp`:return e.preventDefault(),g(e=>e&&{...e,selectedIndex:(e.selectedIndex-1+e.items.length)%e.items.length}),!0;case`Enter`:case`Tab`:{e.preventDefault();let t=h.items[h.selectedIndex];return t&&(t4(f,h,t),g(null)),!0}case`Escape`:return e.preventDefault(),v(),!0;default:return!1}},3))},[e,f,h]),(0,u.useEffect)(()=>{if(!e)return;let t=()=>{};return mq(f.registerRootListener(e=>{if(t(),!e){t=()=>{};return}let n=t=>{let n=t.relatedTarget;n instanceof Node&&e.contains(n)||g(null)};e.addEventListener(`focusout`,n),t=()=>{e.removeEventListener(`focusout`,n)}}),()=>{t()})},[e,f]),(0,u.useEffect)(()=>{if(!h)return;let e=()=>{y()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[h]),(0,u.useLayoutEffect)(()=>{if(!h)return;let e=_.current;e&&e.querySelector(`[data-slash-item-index="${h.selectedIndex}"]`)?.scrollIntoView({block:`nearest`})},[h]),h?(0,p.jsx)(`div`,{ref:_,className:V(`absolute z-60 min-w-52 max-w-[min(13rem,calc(100%-1.5rem))] max-h-[min(22rem,50vh)] overflow-y-auto overflow-x-hidden rounded-xl border border-border/80 bg-background/96 p-1 shadow-lg backdrop-blur-sm`,d),style:{left:h.left,top:h.top},children:h.rows.map(e=>{if(e.type===`groupLabel`)return(0,p.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[0.7rem] font-medium uppercase tracking-wide text-muted-foreground first:pt-1`,role:`presentation`,children:Q2[e.group]},e.key);let{item:t,itemIndex:n}=e;return(0,p.jsx)(`button`,{type:`button`,"data-slash-item-index":n,className:V(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm`,n===h.selectedIndex?`bg-muted`:`hover:bg-muted/70`),onMouseDown:e=>{e.preventDefault()},onMouseMove:()=>{g(e=>!e||e.selectedIndex===n?e:{...e,selectedIndex:n})},onClick:()=>{t4(f,h,t),g(null)},children:(0,p.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[t.kind===`style`?(0,p.jsx)(A1,{control:t.control,variant:`menu`}):t.kind===`link`?(0,p.jsx)(zS,{className:`size-4 shrink-0 text-muted-foreground`}):t.kind===`bulletList`?(0,p.jsx)(BS,{className:`size-4 shrink-0 text-muted-foreground`}):t.kind===`heading`?(0,p.jsx)(Ste,{className:`size-4 shrink-0 text-muted-foreground`}):t.kind===`infoBox`?t.tone===`warning`?(0,p.jsx)(eC,{className:`size-4 shrink-0 text-muted-foreground`}):(0,p.jsx)(RS,{className:`size-4 shrink-0 text-muted-foreground`}):t.kind===`image`?(0,p.jsx)(LS,{className:`size-4 shrink-0 text-muted-foreground`}):t.kind===`separator`?(0,p.jsx)(HS,{className:`size-4 shrink-0 text-muted-foreground`}):(0,p.jsx)(mS,{className:`size-4 shrink-0 text-muted-foreground`}),(0,p.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]})},t.key)})}):null}function r4({value:e}){let[t]=VX(),n=(0,u.useMemo)(()=>FZ(``),[]),r=e??n,i=(0,u.useMemo)(()=>JSON.stringify(r),[r]),a=(0,u.useRef)({serialized:i,state:r});return(0,u.useLayoutEffect)(()=>{a.current={serialized:i,state:r};let e=a.current;if(JSON.stringify(t.getEditorState().toJSON())===e.serialized)return;let n=!1;return queueMicrotask(()=>{if(n)return;let e=a.current;JSON.stringify(t.getEditorState().toJSON())!==e.serialized&&t.setEditorState(t.parseEditorState(e.state),{tag:gZ})}),()=>{n=!0}},[t,r,i]),null}function i4({id:e,value:t,placeholder:n,autoFocus:r=!1,editable:i=!0,wrapperClassName:a,surfaceClassName:o,contentClassName:s,placeholderClassName:c,toolbarClassName:l,commandMenuClassName:d,styleControls:f=[],templateVariables:m=[],editorVariant:h=`compact`,contentPolicy:g,resolveImageAssetUrl:_,imageAssets:v=[],registerImageAsset:y,imageAssetDeletion:b,linksEnabled:x=!1,"aria-label":S,onChange:C,onFocus:w,onBlur:T,onKeyDown:E,onKeyDownCapture:D}){let O=(0,u.useId)(),ee=e??O,k=(0,u.useRef)(null),A=(0,u.useMemo)(()=>FZ(``),[]),j=(0,u.useMemo)(()=>lQ(h===`block`?cQ:sQ,g),[g,h]),M=SQ(j)?`block`:`compact`,N=(0,u.useMemo)(()=>f.filter(e=>j.allowedStyleAttributes?.[e.kind]??!0),[j.allowedStyleAttributes,f]),P=j.allowTemplateVariables===!1?[]:m,F=x&&j.allowLinks!==!1,I=M===`block`&&(j.allowedBlockTypes?.bulletList??!0),te=M===`block`&&j.allowedBlockTypes?.heading===!0,ne=M===`block`&&j.allowedBlockTypes?.infoBox===!0,re=M===`block`&&(j.allowedBlockTypes?.image??!0),ie=M===`block`&&(j.allowedBlockTypes?.separator??!0),ae=t??A,oe=(0,u.useMemo)(()=>({namespace:`rich-text-editor-${ee}`,editorState:JSON.stringify(ae),editable:i,onError(e){throw e},theme:{paragraph:`m-0`,text:{bold:`font-semibold`,italic:`italic`,underline:`underline underline-offset-2`},...M===`block`?{heading:{h1:`text-xl font-semibold tracking-tight`,h2:`text-lg font-semibold tracking-tight`,h3:`text-base font-semibold tracking-tight`,h4:`text-sm font-semibold tracking-tight`,h5:`text-sm font-semibold tracking-tight`,h6:`text-sm font-semibold tracking-tight`},list:{ul:`m-0 list-disc pl-5`,ol:`m-0 list-decimal pl-5`,listitem:`pl-1`},hr:`my-3 w-full border-0 border-t border-border`}:{}},nodes:[nQ,rQ,wX,vX,KJ,YX,vq,rZ]}),[ee,i,ae,M]);return(0,p.jsx)(LX,{value:{editorVariant:M,contentPolicy:j,editable:i,resolveImageAssetUrl:_,imageAssets:v,registerImageAsset:y,imageAssetDeletion:b},children:(0,p.jsx)(`div`,{className:V(`relative w-full`,a),children:(0,p.jsx)(`div`,{ref:k,className:V(`relative w-full overflow-visible`,o),children:(0,p.jsxs)(e$,{initialConfig:oe,children:[(0,p.jsx)(k1,{editable:i}),i&&r?(0,p.jsx)(ZQ,{defaultSelection:`rootStart`}):null,(0,p.jsx)(r4,{value:t}),(0,p.jsx)(O1,{horizontalRuleCommandEnabled:ie}),M===`block`?(0,p.jsx)(C$,{}):null,(0,p.jsx)(E1,{contentEditable:(0,p.jsx)(l$,{id:ee,"aria-label":S??n,className:V(`relative z-10 min-h-[1.5em] whitespace-pre-wrap wrap-break-word outline-none`,s),onFocus:w,onBlur:T,onKeyDownCapture:D,onKeyDown:E}),placeholder:i&&n?(0,p.jsx)(`span`,{className:V(`pointer-events-none absolute inset-0 z-0 select-none text-muted-foreground/60`,`min-h-[1.5em] whitespace-pre-wrap wrap-break-word`,s,c),"aria-hidden":!0,children:n}):null,ErrorBoundary:g$}),i?(0,p.jsx)(S$,{}):null,(0,p.jsx)(T$,{ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0,onChange:(e,t,n)=>{if(n.has(`rich-text-editor-sync-from-value`))return;let r=e.read(()=>QW().getTextContent()),i=JQ(e,j),a=M===`block`?He(i):r.trim().length===0;C?.({editorState:e,value:e.toJSON(),plainText:r,isEmpty:a})}}),(0,p.jsx)(N1,{editable:i,linksEnabled:F,blockAlignmentEnabled:j.allowBlockAlignment===!0,surfaceRef:k,toolbarClassName:l,styleControls:N,templateVariables:P}),(0,p.jsx)(n4,{editable:i,linksEnabled:F,bulletListsEnabled:I,headingsEnabled:te,infoBoxesEnabled:ne,imagesEnabled:re,separatorsEnabled:ie,surfaceRef:k,styleControls:N,templateVariables:P,commandMenuClassName:d}),(0,p.jsx)(X2,{editable:i,enabled:F,surfaceRef:k}),(0,p.jsx)(Y2,{editable:i,enabled:ne,surfaceRef:k}),(0,p.jsx)(q2,{editable:i,enabled:re}),i&&re&&b?(0,p.jsx)(J2,{}):null]})})})})}function a4({wrapperClassName:e,surfaceClassName:t,contentClassName:n,placeholderClassName:r,...i}){return(0,p.jsx)(i4,{...i,editorVariant:`block`,wrapperClassName:V(`w-full`,e),surfaceClassName:V(`w-full`,t),contentClassName:V(`w-full min-h-[1.5em] text-sm leading-6 focus-visible:outline-none focus-visible:ring-0`,n),placeholderClassName:V(`text-sm leading-6`,r)})}function o4({...e}){return(0,p.jsx)(Kr,{"data-slot":`collapsible`,...e})}function s4({...e}){return(0,p.jsx)(Vr,{"data-slot":`collapsible-trigger`,...e})}function c4({...e}){return(0,p.jsx)(Ur,{"data-slot":`collapsible-content`,...e})}function l4({char:e}){return(0,p.jsx)(`span`,{className:`text-muted-foreground/90 shrink-0 px-0.5 font-mono text-[0.85em] select-none`,"aria-hidden":!0,children:e})}var u4=`var(--rich-text-editor-primary-color, var(--primary))`,d4=`var(--rich-text-editor-accent-color, var(--accent))`,f4=`var(--rich-text-editor-font-weight-strong, 600)`,p4=`var(--rich-text-editor-font-weight-normal, 400)`;function m4(e){if(!e)return;let t={};return e.weight===`strong`?t.fontWeight=f4:e.weight===`normal`&&(t.fontWeight=p4),e.italic===`italic`?t.fontStyle=`italic`:e.italic===`normal`&&(t.fontStyle=`normal`),e.underline===`underline`?t.textDecorationLine=`underline`:e.underline===`none`&&(t.textDecorationLine=`none`),e.color===`primary`?t.color=u4:e.color===`accent`?t.color=d4:e.color===`default`&&(t.color=`inherit`),Object.keys(t).length>0?t:void 0}function h4(e){if(e)return`${e.value}${e.unit}`}function g4(e){return{width:h4(e?.width),maxWidth:e?.maxWidth?h4(e.maxWidth):`100%`}}function _4(e){return V(`m-0 space-y-2`,e===`center`&&`flex flex-col items-center`,e===`right`&&`flex flex-col items-end`)}function v4(e,t,n){return e.map((e,r)=>e.type===`lineBreak`?n?.singleLine?n.singleLineNewlineIndicator?(0,p.jsx)(l4,{char:n.singleLineNewlineIndicator},`${t}-linebreak-${r}`):(0,p.jsx)(`span`,{children:` `},`${t}-linebreak-${r}`):(0,p.jsx)(`br`,{},`${t}-linebreak-${r}`):e.type===`template`?(0,p.jsx)(`span`,{style:m4(e.style),className:`inline-flex rounded-md border border-border/70 bg-muted px-1.5 py-0.5 align-baseline text-[0.92em] font-medium text-foreground`,children:`{${e.key}}`},`${t}-template-${r}`):e.type===`link`?(0,p.jsxs)(`a`,{href:hZ(e.href),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline decoration-current underline-offset-3`,children:[(0,p.jsx)(`span`,{children:v4(e.children,`${t}-link-${r}-child`,n)}),(0,p.jsx)(uS,{className:`size-3.5 shrink-0`})]},`${t}-link-${r}`):e.type===`text`?(0,p.jsx)(`span`,{style:m4(e.style),children:e.text},`${t}-text-${r}`):null)}var y4={1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`};function b4({paragraphs:e,paragraphClassName:t,singleLine:n,singleLineNewlineIndicator:r}){let i=(e,t)=>e.children.length>0?v4(e.children,t):(0,p.jsx)(`br`,{"aria-hidden":!0});return n?(0,p.jsx)(p.Fragment,{children:e.map((n,i)=>(0,p.jsxs)(`span`,{className:t,children:[v4(n.children,`paragraph-${i}`,{singleLine:!0,singleLineNewlineIndicator:r}),i<e.length-1?r?(0,p.jsx)(l4,{char:r}):` `:null]},`paragraph-${i}`))}):(0,p.jsx)(p.Fragment,{children:e.map((e,n)=>(0,p.jsx)(`p`,{className:V(`m-0`,t,e.alignment===`center`?`text-center`:e.alignment===`right`?`text-right`:e.alignment===`justify`?`text-justify`:void 0),children:i(e,`paragraph-${n}`)},`paragraph-${n}`))})}function x4({block:e,blockIndex:t,paragraphClassName:n,resolveImageAssetUrl:r,singleLine:i,singleLineNewlineIndicator:a}){switch(e.type){case`paragraph`:return(0,p.jsx)(b4,{paragraphs:[e],paragraphClassName:n,singleLine:i,singleLineNewlineIndicator:a});case`heading`:{if(i)return(0,p.jsx)(`span`,{className:n,children:v4(e.children,`heading-${t}`,{singleLine:!0,singleLineNewlineIndicator:a})},`heading-${t}`);let r=y4[e.level];return(0,p.jsx)(r,{className:V(V(`m-0 font-semibold tracking-tight text-foreground`,n,e.level===1&&`text-xl`,e.level===2&&`text-lg`,e.level===3&&`text-base`,e.level>=4&&`text-sm`),e.alignment===`center`?`text-center`:e.alignment===`right`?`text-right`:e.alignment===`justify`?`text-justify`:void 0),children:v4(e.children,`heading-${t}`)},`heading-${t}`)}case`bulletList`:return i?(0,p.jsx)(`span`,{children:e.items.map((r,i)=>(0,p.jsxs)(`span`,{children:[`• `,(0,p.jsx)(b4,{paragraphs:r.children,paragraphClassName:n,singleLine:!0,singleLineNewlineIndicator:a}),i<e.items.length-1?a?(0,p.jsx)(l4,{char:a}):` `:null]},`bullet-item-${t}-${i}`))},`bullet-list-${t}`):(0,p.jsx)(`ul`,{className:`m-0 list-disc pl-5`,children:e.items.map((e,r)=>(0,p.jsx)(`li`,{className:`pl-1`,children:(0,p.jsx)(b4,{paragraphs:e.children,paragraphClassName:n})},`bullet-item-${t}-${r}`))},`bullet-list-${t}`);case`image`:{let i=e.source.type===`external`?e.source.url:r?.(e.source.assetId),a=g4(e.size);return(0,p.jsxs)(`figure`,{className:_4(e.alignment),children:[i?(0,p.jsx)(`img`,{src:i,alt:e.alt??``,style:a,className:`rounded-lg border border-border/70 object-contain`}):(0,p.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/80 bg-muted/40 px-3 py-4 text-sm text-muted-foreground`,children:e.source.type===`asset`?`Image asset: ${e.source.assetId}`:`Image`}),e.caption&&e.caption.length>0?(0,p.jsx)(`figcaption`,{className:`text-sm text-muted-foreground`,children:(0,p.jsx)(b4,{paragraphs:e.caption,paragraphClassName:n})}):null]},`image-${t}`)}case`infoBox`:{let r=(e.tone??`info`)===`warning`,o=r?eC:RS,s=V(`rounded-lg border px-3 py-2.5`,r&&`border-amber-300/80 bg-amber-50/80 dark:bg-amber-950/25`,!r&&`border-sky-300/80 bg-sky-50/80 dark:bg-sky-950/25`),c=e.collapsible!==!1,l=e.defaultOpen!==!1;if(i)return(0,p.jsxs)(`span`,{className:n,children:[e.title?v4(e.title,`info-box-title-${t}`,{singleLine:!0,singleLineNewlineIndicator:a}):null,e.title&&e.children.some(e=>e.children.length>0)?a?(0,p.jsx)(l4,{char:a}):` `:null,(0,p.jsx)(b4,{paragraphs:e.children,paragraphClassName:n,singleLine:!0,singleLineNewlineIndicator:a})]},`info-box-${t}`);let u=e.title&&e.title.length>0?(0,p.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-medium text-foreground`,children:v4(e.title,`info-box-title-${t}`)}):(0,p.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-medium text-muted-foreground`,children:`Notice`}),d=(0,p.jsx)(`div`,{className:`pt-2 text-sm text-foreground/90`,children:(0,p.jsx)(b4,{paragraphs:e.children,paragraphClassName:n})});return(0,p.jsx)(`div`,{className:s,children:(0,p.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,p.jsx)(`span`,{className:`mt-0.5 shrink-0 text-foreground/80`,"aria-hidden":!0,children:(0,p.jsx)(o,{className:`size-4`})}),(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:c?(0,p.jsxs)(o4,{defaultOpen:l,children:[(0,p.jsxs)(s4,{className:`flex w-full items-start gap-2 rounded-sm text-left outline-none hover:opacity-90 [&[data-state=open]_svg]:rotate-180`,children:[u,(0,p.jsx)(yS,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform`})]}),(0,p.jsx)(c4,{children:d})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`flex w-full items-start gap-2 text-left`,children:u}),d]})})]})},`info-box-${t}`)}case`separator`:return(0,p.jsx)(`hr`,{className:`my-3 w-full border-0 border-t border-border`},`separator-${t}`);case`blockExtension`:return e.name===`separator`?(0,p.jsx)(`hr`,{className:`my-3 w-full border-0 border-t border-border`},`separator-${t}`):null}}function S4({content:e,className:t,paragraphClassName:n,resolveImageAssetUrl:r,singleLine:i,singleLineNewlineIndicator:a}){if(!e)return null;if(e.type!==Me.richText){if(e.content.trim().length===0)return null;if(i&&a)return(0,p.jsx)(`div`,{className:t,children:(0,p.jsx)(`span`,{className:n,children:e.content.split(/\r?\n/).map((e,t)=>(0,p.jsxs)(u.Fragment,{children:[t>0?(0,p.jsx)(l4,{char:a}):null,e]},`md-line-${t}`))})});let r=i?e.content.replace(/\s*[\r\n]+\s*/g,` `):e.content;return(0,p.jsx)(`div`,{className:V(!i&&`space-y-1`,t),children:i?(0,p.jsx)(`span`,{className:n,children:r}):(0,p.jsx)(`p`,{className:V(`m-0 whitespace-pre-line`,n),children:r})})}if(!e.doc.blocks.some(e=>Ne(e)))return null;let o=e.doc.blocks.filter(e=>Ne(e)||e.type===`paragraph`);return(0,p.jsx)(`div`,{className:V(!i&&`space-y-2`,t),children:o.map((e,t)=>(0,p.jsxs)(u.Fragment,{children:[i&&a&&t>0?(0,p.jsx)(l4,{char:a}):null,(0,p.jsx)(x4,{block:e,blockIndex:t,paragraphClassName:n,resolveImageAssetUrl:r,singleLine:i,singleLineNewlineIndicator:a})]},`block-${t}`))})}function C4(){let e=G(`defaultEditors.richTextToolbar`),t=Cw();return{templateVariables:(0,u.useMemo)(()=>t?.getTemplateValueKeys().map(e=>({key:e,label:e}))??[],[t]),defaultStyleControls:(0,u.useMemo)(()=>[{kind:`weight`,value:`strong`,title:e(`bold`)},{kind:`italic`,value:`italic`,title:e(`italic`)},{kind:`underline`,value:`underline`,title:e(`underline`)},{kind:`color`,value:`primary`,title:e(`primaryColor`)},{kind:`color`,value:`accent`,title:e(`accentColor`)}],[e]),subtitleStyleControls:(0,u.useMemo)(()=>[{kind:`weight`,value:`strong`,title:e(`bold`)},{kind:`underline`,value:`underline`,title:e(`underline`)},{kind:`color`,value:`primary`,title:e(`primaryColor`)},{kind:`color`,value:`accent`,title:e(`accentColor`)}],[e])}}var w4=({draftKey:e,draftLabelEditorValue:t,keyValidationMessage:n,labelEditorInstanceKey:r,labelAutoFocus:i=!1,keyAutoFocus:a=!1,keyRowTrailing:o,onDraftKeyChange:s,onDraftLabelChange:c,onSubmitShortcut:l})=>{let u=G(`defaultEditors.choiceEditor`),{templateVariables:d,defaultStyleControls:f}=C4();return(0,p.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(i4,{value:t,placeholder:u(`createOptionLabelPlaceholder`),"aria-label":u(`createOptionLabelAriaLabel`),autoFocus:i,onChange:c,contentClassName:`w-full text-sm focus-visible:outline-none focus-visible:ring-0`,styleControls:f,templateVariables:d,linksEnabled:!0,onKeyDownCapture:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),l?.())}},r)}),(0,p.jsxs)(`div`,{children:[n?(0,p.jsx)(`p`,{className:`mb-1 text-xs text-destructive`,children:n}):null,(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(lx,{value:e,autoFocus:a,onChange:e=>s(OR(e.target.value)),placeholder:u(`createOptionKeyPlaceholder`),"aria-label":u(`createOptionKeyAriaLabel`),className:`h-auto bg-muted px-2 font-mono text-xs! shadow-none sm:w-48`,onKeyDown:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),l?.())}}),o?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`flex-1`}),o]}):null]})]})]})};function T4(e){return AR(e).key??``}var E4=({isOpen:e,open:t,existingOptions:n,onCancel:r,onSubmit:i})=>{let a=G(`defaultEditors.choiceEditor`),[o,s]=(0,u.useState)(()=>T4(n)),[c,l]=(0,u.useState)(void 0),[d,f]=(0,u.useState)(()=>FZ(``)),[m,h]=(0,u.useState)(0),g=(0,u.useCallback)(e=>{s(T4(e)),l(void 0),f(FZ(``)),h(e=>e+1)},[]),_=(0,u.useEffectEvent)(()=>{g(n)});(0,u.useEffect)(()=>{_()},[]);let v=OR(o),y=n.some(e=>OR(e.key??``)===v),b=v.length===0?a(`createOptionKeyRequired`):y?a(`createOptionKeyDuplicate`):null,x=b!==null,S=()=>{if(x)return;let e={...AR(n),key:v};i(e,c),g([...n,e])},C=()=>{g(n),r()};return DL(e=>{e.defaultPrevented||e.key!==`Escape`||(e.preventDefault(),C())},{enabled:e,ignoreEditableTargets:!1}),(0,p.jsx)(`div`,{className:`space-y-3`,children:e?(0,p.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-3 shadow-sm`,children:(0,p.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,p.jsx)(w4,{draftKey:o,draftLabelEditorValue:d,keyValidationMessage:b,labelEditorInstanceKey:m,labelAutoFocus:!0,keyRowTrailing:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(H,{type:`button`,size:`sm`,className:`rounded-full`,variant:`ghost`,onClick:C,children:a(`createOptionCancel`)}),(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,disabled:x,onClick:S,children:a(`createOptionSubmit`)})}),(0,p.jsx)(nw,{side:`bottom`,align:`center`,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`span`,{children:a(`createOptionSubmit`)}),(0,p.jsx)(hL,{children:`Enter`})]})})]})]}),onDraftKeyChange:s,onDraftLabelChange:e=>{f(e.value),l(e.isEmpty?void 0:JQ(e.editorState))},onSubmitShortcut:S})})}):(0,p.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full text-muted-foreground min-w-44 flex justify-start gap-1 items-center`,onClick:t,children:[(0,p.jsx)(KS,{className:`size-3`}),a(`addOptionPlaceholder`)]})})};function D4({className:e,size:t=`default`,...n}){return(0,p.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:V(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function O4({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`card-header`,className:V(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function k4({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`card-title`,className:V(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function A4({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`card-description`,className:V(`text-sm text-muted-foreground`,e),...t})}function j4({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`card-content`,className:V(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}var M4=Object.defineProperty,N4=Object.defineProperties,P4=Object.getOwnPropertyDescriptors,F4=Object.getOwnPropertySymbols,I4=Object.prototype.hasOwnProperty,L4=Object.prototype.propertyIsEnumerable,R4=(e,t,n)=>t in e?M4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z4=(e,t)=>{for(var n in t||={})I4.call(t,n)&&R4(e,n,t[n]);if(F4)for(var n of F4(t))L4.call(t,n)&&R4(e,n,t[n]);return e},B4=(e,t)=>N4(e,P4(t)),V4=class extends LO{apply({transform:e}){if(!this.options)return e;let{axis:t,value:n}=this.options;return B4(z4({},e),{[t]:n})}};V4.configure=gD(V4);var H4=V4;H4.configure({axis:`x`,value:0}),H4.configure({axis:`y`,value:0});function U4(e,t,n){let r=z4({},t);return e.boundingRectangle.top+t.y<=n.top?r.y=n.top-e.boundingRectangle.top:e.boundingRectangle.bottom+t.y>=n.top+n.height&&(r.y=n.top+n.height-e.boundingRectangle.bottom),e.boundingRectangle.left+t.x<=n.left?r.x=n.left-e.boundingRectangle.left:e.boundingRectangle.right+t.x>=n.left+n.width&&(r.x=n.left+n.width-e.boundingRectangle.right),r}var W4=class extends LO{apply({transform:e}){let{size:t=20}=this.options??{},n=typeof t==`number`?t:t.x,r=typeof t==`number`?t:t.y;return B4(z4({},e),{x:Math.ceil(e.x/n)*n,y:Math.ceil(e.y/r)*r})}};W4.configure=gD(W4);var G4=class extends LO{constructor(e){super(e);let{dragOperation:t}=e,n=()=>Nw(()=>{let{source:e}=t;this.windowBoundingRectangle=wk(e?.element??document.documentElement)});this.destroy=eT(()=>{if(!t.status.idle)return n(),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`resize`,n)}})}apply({shape:e,transform:t}){if(!this.windowBoundingRectangle||!e)return t;let{initial:n,current:r}=e,{height:i,width:a}=r.boundingRectangle;return U4(new AE(n.center.x-a/2,n.center.y-i/2,a,i),t,this.windowBoundingRectangle)}},K4=class extends LO{constructor(e,t){super(e,t),this.boundingRectangle=Ww(null),this.destroy=eT(()=>{if(!this.options)return;let{dragOperation:t}=e,{status:n}=t;if(n.initialized){let{element:e}=this.options,n=typeof e==`function`?e(t):e;if(!n)return;let r,i=()=>{this.boundingRectangle.value=gk(n)},a=()=>{r||=setTimeout(()=>{i(),r=void 0},25)},o=new ResizeObserver(i);return o.observe(n),document.addEventListener(`scroll`,a,{passive:!0,capture:!0}),()=>{document.removeEventListener(`scroll`,a,{capture:!0}),o.disconnect(),this.boundingRectangle.value=null}}})}apply(e){let{shape:t,transform:n}=e;if(!t)return n;let r=this.boundingRectangle.value;if(!r)return n;let{initial:i,current:a}=t,{height:o,width:s}=a.boundingRectangle;return U4(new AE(i.center.x-s/2,i.center.y-o/2,s,o),n,r)}};K4.configure=gD(K4);var q4=[`input`,`textarea`,`number`,`datepicker`,`switch`,`select`,`slider`],J4={input:Lte,textarea:Rte,number:IS,datepicker:gS,switch:zte,select:CS,slider:JS};function Y4(e,t){return e(`fieldTypes.${t}`)}var X4=`[data-select-option-drag-handle="true"]`,Z4=`
|
|
165
|
+
input:not([disabled]),
|
|
166
|
+
select:not([disabled]),
|
|
167
|
+
textarea:not([disabled]),
|
|
168
|
+
button:not([disabled]),
|
|
169
|
+
a[href],
|
|
170
|
+
[contenteditable]:not([contenteditable="false"])
|
|
171
|
+
`,Q4=[`name`,`given-name`,`family-name`,`nickname`,`email`,`username`,`organization`,`organization-title`,`street-address`,`address-line1`,`address-line2`,`address-level2`,`address-level1`,`postal-code`,`country-name`,`tel`,`url`,`one-time-code`];function $4(e){return e.trim()||void 0}function e3(e){return e===``?void 0:e}function t3(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function n3(e){let t=new Set(e.map(e=>e.value.trim().toLowerCase()).filter(Boolean)),n=1;for(;t.has(`opt-${n}`);)n+=1;return`OPT-${n}`}function r3(e){let{target:t}=e;return!(t instanceof Element)||t.closest(X4)?!1:!!t.closest(Z4)}function i3(e){return new Map(e.map(e=>[e.type,e]))}function a3(e){switch(e.type){case`textarea`:return{...e,placeholder:$4(e.placeholder??``)};case`number`:return{...e,placeholder:$4(e.placeholder??``),unit:$4(e.unit??``)};case`datepicker`:return{...e,placeholder:$4(e.placeholder??``)};case`switch`:return{...e,checkedLabel:$4(e.checkedLabel??``),uncheckedLabel:$4(e.uncheckedLabel??``)};case`select`:return{...e,placeholder:$4(e.placeholder??``)};case`slider`:return e;default:return{...e,placeholder:$4(e.placeholder??``),autocomplete:$4(e.autocomplete??``)}}}function o3(e,t,n){let r=new Set,i=e.key.trim();i||r.add(n(`fieldKeyRequired`));let a=t.some(t=>t.id!==e.id&&t.key.trim().toLowerCase()===i.toLowerCase());i&&a&&r.add(n(`fieldKeyDuplicate`));let o=new Set;for(let t of e.validations){if(o.has(t.type)){r.add(n(`fieldValidationDuplicate`));break}o.add(t.type)}for(let t of e.validations)(t.type===`minLength`||t.type===`maxLength`||t.type===`min`||t.type===`max`)&&typeof t.value!=`number`&&r.add(n(`fieldValidationInvalid`)),(t.type===`pattern`||t.type===`minDate`||t.type===`maxDate`)&&typeof t.value!=`string`&&r.add(n(`fieldValidationInvalid`));if(e.type===`number`){let t=e.controller;t.step!==void 0&&t.step<=0&&r.add(n(`fieldNumberStepInvalid`))}if(e.type===`select`){let t=e.controller;t.options.length===0&&r.add(n(`fieldSelectOptionsRequired`)),t.options.some(e=>!e.value.trim())&&r.add(n(`fieldSelectOptionIncomplete`));let i=new Set;for(let e of t.options){let t=e.value.trim().toLowerCase();if(t){if(i.has(t)){r.add(n(`fieldSelectOptionDuplicate`));break}i.add(t)}}}if(e.type===`slider`){let t=e.controller;(t.min===void 0||t.max===void 0||t.min>=t.max)&&r.add(n(`fieldSliderRangeInvalid`)),(t.step===void 0||t.step<=0)&&r.add(n(`fieldSliderStepInvalid`)),(t.defaultValue===void 0||t.min===void 0||t.max===void 0||t.defaultValue<t.min||t.defaultValue>t.max)&&r.add(n(`fieldSliderDefaultInvalid`))}if(e.type===`datepicker`){let t=e.validations.find(e=>e.type===`minDate`)?.value,i=e.validations.find(e=>e.type===`maxDate`)?.value;typeof t==`string`&&typeof i==`string`&&t>i&&r.add(n(`fieldDateRangeInvalid`))}return[...r]}function s3({controlId:e,suggestion:t,validation:n,onChange:r}){return t.valueKind===`none`?null:t.valueKind===`number`?(0,p.jsx)(lx,{id:e,type:`number`,value:typeof n.value==`number`?String(n.value):``,onChange:e=>r(t3(e.target.value))}):(0,p.jsx)(lx,{id:e,type:t.valueKind===`date`?`date`:`text`,value:typeof n.value==`string`?n.value:``,onChange:e=>r($4(e.target.value))})}function c3({groupId:e,option:t,index:n,onChange:r,onRemove:i}){let a=G(`defaultEditors.formEditor`),{ref:o,isDragging:s}=TI({id:t.id,index:n,group:e});return(0,p.jsx)(`li`,{ref:o,className:V(`list-none touch-none rounded-lg border border-border/70 px-2 py-1 bg-muted`,s&&`opacity-90`),children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted`,"aria-label":a(`fieldReorderOption`),"data-select-option-drag-handle":`true`,children:(0,p.jsx)(FS,{className:`size-4`})}),(0,p.jsxs)(HL,{className:`w-28 shrink-0`,children:[(0,p.jsx)(WL,{className:`sr-only`,htmlFor:`field-option-value-${t.id}`,children:a(`fieldOptionValueLabel`)}),(0,p.jsx)(lx,{id:`field-option-value-${t.id}`,className:`bg-background font-mono text-xs`,value:t.value,placeholder:`OPT-${n+1}`,onChange:e=>r(t.id,t=>({...t,value:e.target.value}))})]}),(0,p.jsxs)(HL,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(WL,{className:`sr-only`,htmlFor:`field-option-label-${t.id}`,children:a(`fieldOptionLabel`,{index:n+1})}),(0,p.jsx)(lx,{id:`field-option-label-${t.id}`,className:`bg-background`,value:t.label,placeholder:a(`fieldOptionLabel`,{index:n+1}),onChange:e=>r(t.id,t=>({...t,label:e.target.value}))})]}),(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,"aria-label":a(`fieldRemoveOption`),onClick:()=>i(t.id),children:(0,p.jsx)(rC,{})})]})})}var l3=({open:e,field:t,allFields:n,onOpenChange:r,onSave:i})=>{let a=G(`defaultEditors.formEditor`),o=G(`common.actions`),s=t??n[0]??null,[c,l]=(0,u.useState)(()=>s??{id:b(),key:``,type:`input`,controller:{type:`input`,inputMode:`text`},validations:[]}),d=e&&t!==null,f=hre(c.type),m=(0,u.useMemo)(()=>i3(f),[f]),h=f.filter(e=>c.validations.every(t=>t.type!==e.type)),g=o3(c,n,a),_=e=>{l(t=>e(t))},v=(e,t)=>{_(n=>({...n,validations:n.validations.map(n=>n.id===e?t(n):n)}))},y=e=>{_(t=>({...t,validations:[...t.validations,{id:b(),type:e.type,value:e.defaultValue}]}))},x=e=>{_(t=>({...t,validations:t.validations.filter(t=>t.id!==e)}))},S=()=>{_(e=>{if(e.type!==`select`)return e;let t=e.controller;return{...e,controller:{...t,options:[...t.options,{id:b(),label:``,value:n3(t.options)}]}}})},C=(e,t)=>{_(n=>{if(n.type!==`select`)return n;let r=n.controller;return{...n,controller:{...r,options:r.options.map(n=>n.id===e?t(n):n)}}})},w=e=>{_(t=>{if(t.type!==`select`)return t;let n=t.controller;return{...t,controller:{...n,options:n.options.filter(t=>t.id!==e)}}})},T=()=>t?(i({...c,key:c.key.trim(),label:$4(c.label??``),description:$4(c.description??``),errorMessage:$4(c.errorMessage??``),controller:a3(c.controller),required:void 0,validations:c.validations.map(e=>({...e,message:$4(e.message??``)}))}),!0):!1,E=e=>{if(e){r(!0);return}if(!t){r(!1);return}T()};return(0,p.jsx)(xL,{open:d,onOpenChange:E,children:(0,p.jsxs)(SL,{showCloseButton:!1,className:`max-h-svh sm:max-w-4xl overflow-y-auto`,children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:a(`fieldDialogTitle`)}),(0,p.jsx)(EL,{children:a(`fieldDialogDescription`,{fieldType:Y4(a,c.type)})})]}),(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-label`,children:a(`fieldLabelLabel`)}),(0,p.jsx)(lx,{id:`field-label`,value:c.label??``,placeholder:a(`fieldLabelPlaceholder`),onChange:e=>_(t=>({...t,label:e.target.value}))})]}),(0,p.jsx)(`div`,{className:`min-w-0`,children:(0,p.jsx)(VL,{className:`gap-4`,children:(0,p.jsx)(D4,{size:`sm`,children:(0,p.jsx)(j4,{children:(()=>{switch(c.type){case`textarea`:{let e=c.controller;return(0,p.jsxs)(VL,{className:`md:flex-row`,children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-placeholder`,children:a(`fieldPlaceholderLabel`)}),(0,p.jsx)(lx,{id:`field-placeholder`,value:e.placeholder??``,placeholder:a(`fieldPlaceholderPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,placeholder:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-rows`,children:a(`fieldRowsLabel`)}),(0,p.jsx)(lx,{id:`field-rows`,type:`number`,min:2,max:12,value:e.rows??3,onChange:t=>_(n=>({...n,controller:{...e,rows:t3(t.target.value)??3}}))})]})]})}case`number`:{let e=c.controller;return(0,p.jsx)(VL,{children:(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-placeholder`,children:a(`fieldPlaceholderLabel`)}),(0,p.jsx)(lx,{id:`field-placeholder`,value:e.placeholder??``,placeholder:a(`fieldPlaceholderPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,placeholder:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-step`,children:a(`fieldStepLabel`)}),(0,p.jsx)(lx,{id:`field-step`,type:`number`,min:.01,step:`any`,value:e.step??``,onChange:t=>_(n=>({...n,controller:{...e,step:t3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-unit`,children:a(`fieldUnitLabel`)}),(0,p.jsx)(lx,{id:`field-unit`,value:e.unit??``,placeholder:a(`fieldUnitPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,unit:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-default-value`,children:a(`fieldDefaultValueLabel`)}),(0,p.jsx)(lx,{id:`field-default-value`,type:`number`,step:`any`,value:e.defaultValue??``,onChange:t=>_(n=>({...n,controller:{...e,defaultValue:t3(t.target.value)}}))})]})]})})}case`datepicker`:{let e=c.controller;return(0,p.jsxs)(VL,{children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-date-mode`,children:a(`fieldDateModeLabel`)}),(0,p.jsxs)(O2,{value:e.mode,onValueChange:t=>_(n=>({...n,controller:{...e,mode:t}})),children:[(0,p.jsx)(j2,{id:`field-date-mode`,className:`w-full`,children:(0,p.jsx)(A2,{placeholder:a(`fieldDateModePlaceholder`)})}),(0,p.jsx)(M2,{children:(0,p.jsx)(k2,{children:ire.map(e=>(0,p.jsx)(N2,{value:e,children:a(`fieldDateModes.${e}`)},e))})})]})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-placeholder`,children:a(`fieldPlaceholderLabel`)}),(0,p.jsx)(lx,{id:`field-placeholder`,value:e.placeholder??``,placeholder:e.mode===`year`?a(`fieldDatePlaceholders.year`):e.mode===`year-month`?a(`fieldDatePlaceholders.year-month`):a(`fieldDatePlaceholders.year-month-day`),onChange:t=>_(n=>({...n,controller:{...e,placeholder:e3(t.target.value)}}))})]})]})}case`switch`:{let e=c.controller;return(0,p.jsxs)(VL,{children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-checked-label`,children:a(`fieldCheckedLabelLabel`)}),(0,p.jsx)(lx,{id:`field-checked-label`,value:e.checkedLabel??``,placeholder:a(`fieldCheckedLabelPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,checkedLabel:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-unchecked-label`,children:a(`fieldUncheckedLabelLabel`)}),(0,p.jsx)(lx,{id:`field-unchecked-label`,value:e.uncheckedLabel??``,placeholder:a(`fieldUncheckedLabelPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,uncheckedLabel:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{orientation:`horizontal`,children:[(0,p.jsx)(WL,{htmlFor:`field-default-checked`,children:a(`fieldDefaultCheckedLabel`)}),(0,p.jsx)(XL,{id:`field-default-checked`,checked:e.defaultChecked===!0,onCheckedChange:t=>_(n=>({...n,controller:{...e,defaultChecked:t}}))})]})]})}case`select`:{let e=c.controller,t=`select-options-${c.id}`,n=e.options.some(e=>!e.label?.trim());return(0,p.jsxs)(VL,{children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-placeholder`,children:a(`fieldPlaceholderLabel`)}),(0,p.jsx)(lx,{id:`field-placeholder`,value:e.placeholder??``,placeholder:a(`fieldSelectPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,placeholder:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{orientation:`horizontal`,children:[(0,p.jsx)(WL,{htmlFor:`field-allow-clear`,children:a(`fieldAllowClearLabel`)}),(0,p.jsx)(XL,{id:`field-allow-clear`,checked:e.allowClear===!0,onCheckedChange:t=>_(n=>({...n,controller:{...e,allowClear:t?!0:void 0}}))})]}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:a(`fieldOptionsLabel`)}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`fieldOptionsDescription`)})]}),(0,p.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:S,children:[(0,p.jsx)(KS,{"data-icon":`inline-start`}),a(`fieldAddOption`)]})]}),(0,p.jsx)(PP,{sensors:[KN.configure({activationConstraints:[new HN.Distance({value:5})],preventActivation:r3})],onDragEnd:(e=>{if(e.canceled||!PF(e.operation)||!e.operation.source)return;let{source:t}=e.operation,{initialIndex:n,index:r}=t;n!==r&&_(e=>{if(e.type!==`select`)return e;let t=e.controller,i=[...t.options],[a]=i.splice(n,1);return a?(i.splice(r,0,a),{...e,controller:{...t,options:i}}):e})}),modifiers:e=>[...e,G4],children:(0,p.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.options.map((e,n)=>(0,p.jsx)(c3,{groupId:t,option:e,index:n,onChange:C,onRemove:w},e.id))})}),n?(0,p.jsx)(qL,{children:a(`fieldSelectOptionLabelMissing`)}):null,(0,p.jsx)(`div`,{className:`flex justify-start`,children:(0,p.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:S,children:[(0,p.jsx)(KS,{"data-icon":`inline-start`}),a(`fieldAddOption`)]})})]})]})}case`slider`:{let e=c.controller;return(0,p.jsxs)(VL,{children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-slider-min`,children:a(`fieldMinLabel`)}),(0,p.jsx)(lx,{id:`field-slider-min`,type:`number`,step:`any`,value:e.min??``,onChange:t=>_(n=>({...n,controller:{...e,min:t3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-slider-max`,children:a(`fieldMaxLabel`)}),(0,p.jsx)(lx,{id:`field-slider-max`,type:`number`,step:`any`,value:e.max??``,onChange:t=>_(n=>({...n,controller:{...e,max:t3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-slider-step`,children:a(`fieldStepLabel`)}),(0,p.jsx)(lx,{id:`field-slider-step`,type:`number`,step:`any`,value:e.step??``,onChange:t=>_(n=>({...n,controller:{...e,step:t3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-slider-default`,children:a(`fieldDefaultValueLabel`)}),(0,p.jsx)(lx,{id:`field-slider-default`,type:`number`,step:`any`,value:e.defaultValue??``,onChange:t=>_(n=>({...n,controller:{...e,defaultValue:t3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{orientation:`horizontal`,children:[(0,p.jsx)(WL,{htmlFor:`field-slider-show-value`,children:a(`fieldShowValueLabel`)}),(0,p.jsx)(XL,{id:`field-slider-show-value`,checked:e.showValue!==!1,onCheckedChange:t=>_(n=>({...n,controller:{...e,showValue:t}}))})]})]})}default:{let e=c.controller;return(0,p.jsxs)(VL,{className:`md:flex-row`,children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-placeholder`,children:a(`fieldPlaceholderLabel`)}),(0,p.jsx)(lx,{id:`field-placeholder`,value:e.placeholder??``,placeholder:a(`fieldPlaceholderPlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,placeholder:e3(t.target.value)}}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-input-mode`,children:a(`fieldInputModeLabel`)}),(0,p.jsxs)(O2,{value:e.inputMode??`text`,onValueChange:t=>_(n=>({...n,controller:{...e,inputMode:t}})),children:[(0,p.jsx)(j2,{id:`field-input-mode`,className:`w-full`,children:(0,p.jsx)(A2,{})}),(0,p.jsx)(M2,{children:(0,p.jsxs)(k2,{children:[(0,p.jsx)(N2,{value:`text`,children:a(`fieldInputModes.text`)}),(0,p.jsx)(N2,{value:`email`,children:a(`fieldInputModes.email`)}),(0,p.jsx)(N2,{value:`tel`,children:a(`fieldInputModes.tel`)}),(0,p.jsx)(N2,{value:`url`,children:a(`fieldInputModes.url`)}),(0,p.jsx)(N2,{value:`password`,children:a(`fieldInputModes.password`)})]})})]})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-autocomplete`,children:a(`fieldAutocompleteLabel`)}),(0,p.jsx)(lx,{id:`field-autocomplete`,list:`field-autocomplete-options`,value:e.autocomplete??``,placeholder:a(`fieldAutocompletePlaceholder`),onChange:t=>_(n=>({...n,controller:{...e,autocomplete:e3(t.target.value)}}))}),(0,p.jsx)(`datalist`,{id:`field-autocomplete-options`,children:Q4.map(e=>(0,p.jsx)(`option`,{value:e},e))})]})]})}}})()})})})}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`field-description`,children:a(`fieldDescriptionLabel`)}),(0,p.jsx)(lx,{id:`field-description`,value:c.description??``,placeholder:a(`fieldDescriptionPlaceholder`),onChange:e=>_(t=>({...t,description:e.target.value}))})]})]}),(0,p.jsx)(RL,{}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(`h3`,{className:`font-medium text-base`,children:a(`fieldValidationSettingsTitle`)}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`fieldValidationSettingsDescription`)})]}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,p.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:h.length>0?h.map(e=>(0,p.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>y(e),children:[(0,p.jsx)(KS,{"data-icon":`inline-start`}),e.label]},e.type)):(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`fieldNoAdditionalValidations`)})}),(0,p.jsx)(VL,{className:`gap-3`,children:c.validations.map(e=>{let t=m.get(e.type),n=`validation-value-${e.id}`,r=`validation-message-${e.id}`;return t?(0,p.jsxs)(`div`,{className:`rounded-lg border border-border/70 p-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t.label}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.description})]}),(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":a(`fieldRemoveValidation`),onClick:()=>x(e.id),children:(0,p.jsx)(rC,{})})]}),(0,p.jsxs)(VL,{className:`mt-3 gap-3`,children:[t.valueKind===`none`?null:(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:n,children:a(`fieldValidationValueLabel`)}),(0,p.jsx)(s3,{controlId:n,suggestion:t,validation:e,onChange:t=>v(e.id,e=>({...e,value:t}))})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:r,children:a(`fieldValidationMessageLabel`)}),(0,p.jsx)(lx,{id:r,value:e.message??``,placeholder:a(`fieldValidationMessagePlaceholder`),onChange:t=>v(e.id,e=>({...e,message:t.target.value}))})]})]})]},e.id):null})})]})]}),(0,p.jsx)(`div`,{className:`min-w-0`,children:(0,p.jsx)(VL,{className:`gap-4`,children:g.length>0?(0,p.jsxs)(D4,{size:`sm`,className:V(`border-destructive/40`),children:[(0,p.jsxs)(O4,{children:[(0,p.jsx)(k4,{children:a(`fieldIssuesTitle`)}),(0,p.jsx)(A4,{children:a(`fieldIssuesDescription`)})]}),(0,p.jsx)(j4,{children:(0,p.jsx)(qL,{children:(0,p.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:g.map(e=>(0,p.jsx)(`li`,{children:e},e))})})})]}):null})}),(0,p.jsx)(wL,{children:(0,p.jsx)(H,{type:`button`,onClick:()=>E(!1),children:o(`close`)})})]})})},u3=({open:e,field:t,allFields:n,onOpenChange:r,onSave:i})=>{let a=G(`defaultEditors.formEditor`),o=G(`common.actions`),[s,c]=(0,u.useState)(t?.key??``),l=e&&t!==null,d=s.trim(),f=d?n.some(e=>e.id!==t?.id&&e.key.trim().toLowerCase()===d.toLowerCase())?a(`fieldKeyDuplicate`):null:a(`fieldKeyRequired`);return(0,p.jsx)(xL,{open:l,onOpenChange:r,children:(0,p.jsxs)(SL,{className:`sm:max-w-md`,children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:a(`fieldKeyDialogTitle`)}),(0,p.jsx)(EL,{children:a(`fieldKeyDialogDescription`)})]}),(0,p.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!(!t||f)&&i(d)},children:[(0,p.jsxs)(HL,{"data-invalid":f?!0:void 0,children:[(0,p.jsx)(WL,{htmlFor:`field-key-dialog-input`,children:a(`fieldKeyLabel`)}),(0,p.jsx)(lx,{id:`field-key-dialog-input`,autoFocus:!0,value:s,"aria-invalid":f?!0:void 0,placeholder:a(`fieldKeyPlaceholder`),onChange:e=>c(e.target.value)}),(0,p.jsx)(KL,{children:a(`fieldKeyDescription`)}),(0,p.jsx)(qL,{children:f})]}),(0,p.jsxs)(wL,{children:[(0,p.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:o(`cancel`)}),(0,p.jsx)(H,{type:`submit`,disabled:f!==null,children:o(`save`)})]})]})]})})},d3=({open:e,initialTitle:t,initialDescription:n,onOpenChange:r,onSave:i})=>{let a=G(`defaultEditors.formEditor`),o=G(`common.actions`),s=(0,u.useId)(),c=(0,u.useId)(),[l,d]=(0,u.useState)(t??``),[f,m]=(0,u.useState)(n??``);return(0,p.jsx)(xL,{open:e,onOpenChange:r,children:(0,p.jsxs)(SL,{showCloseButton:!1,className:`sm:max-w-lg`,children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:a(`groupHeaderDialogTitle`)}),(0,p.jsx)(EL,{children:a(`groupHeaderDialogDescription`)})]}),(0,p.jsxs)(VL,{children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:s,children:a(`groupHeaderTitleLabel`)}),(0,p.jsx)(lx,{id:s,value:l,placeholder:a(`groupHeaderTitlePlaceholder`),onChange:e=>d(e.target.value)})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:c,children:a(`groupHeaderDescriptionLabel`)}),(0,p.jsx)(B2,{id:c,value:f,placeholder:a(`groupHeaderDescriptionPlaceholder`),onChange:e=>m(e.target.value)})]})]}),(0,p.jsxs)(wL,{children:[(0,p.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:o(`cancel`)}),(0,p.jsx)(H,{type:`button`,onClick:()=>{i({title:l.trim()||void 0,description:f.trim()||void 0})},children:o(`save`)})]})]})})},f3=[{key:`base`,labelKey:`layoutBreakpointCompact`},{key:`xs`,labelKey:`layoutBreakpointAtXs`},{key:`sm`,labelKey:`layoutBreakpointAtSm`},{key:`md`,labelKey:`layoutBreakpointAtMd`},{key:`xl`,labelKey:`layoutBreakpointAtXl`}];function p3({columns:e}){return(0,p.jsx)(`div`,{className:`flex w-full gap-1.5`,children:Array.from({length:e},(e,t)=>(0,p.jsx)(`div`,{className:`flex min-h-9 min-w-0 flex-1 items-center justify-center rounded-md border border-border bg-muted/60 text-xs font-medium tabular-nums text-muted-foreground`,children:t+1},t))})}var m3=({open:e,initialLayout:t,onOpenChange:n,onSave:r})=>{let i=G(`defaultEditors.formEditor`),a=G(`common.actions`),[o,s]=(0,u.useState)(()=>({base:t.base,xs:t.xs,sm:t.sm,md:t.md,xl:t.xl})),c=(e,t)=>{s(n=>{let r=Math.min(4,Math.max(1,n[e]+t));return{...n,[e]:r}})};return(0,p.jsx)(xL,{open:e,onOpenChange:n,children:(0,p.jsxs)(SL,{showCloseButton:!1,className:`gap-0 max-h-screen overflow-y-auto sm:max-w-lg`,children:[(0,p.jsxs)(CL,{className:`px-1`,children:[(0,p.jsx)(TL,{children:i(`layoutDialogTitle`)}),(0,p.jsx)(EL,{children:i(`layoutDialogDescription`)})]}),(0,p.jsx)(`div`,{className:`py-4 space-y-4`,children:f3.map(({key:e,labelKey:t})=>(0,p.jsxs)(`section`,{className:``,children:[(0,p.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:i(t)}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mt-2`,children:[(0,p.jsx)(p3,{columns:o[e]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-8 shrink-0 rounded-md`,"aria-label":i(`layoutDecreaseColumns`),disabled:o[e]<=1,onClick:()=>c(e,-1),children:(0,p.jsx)(HS,{className:`size-4`})}),(0,p.jsx)(`span`,{className:`min-w-8 text-center text-sm font-semibold tabular-nums`,children:o[e]}),(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-8 shrink-0 rounded-md`,"aria-label":i(`layoutIncreaseColumns`),disabled:o[e]>=4,onClick:()=>c(e,1),children:(0,p.jsx)(KS,{className:`size-4`})})]})]})]},e))}),(0,p.jsxs)(wL,{children:[(0,p.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:a(`cancel`)}),(0,p.jsx)(H,{type:`button`,onClick:()=>{r(o)},children:a(`save`)})]})]})})};function h3({label:e,children:t,destructive:n=!1}){return(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(`span`,{className:V(`inline-flex size-6 shrink-0 items-center justify-center rounded-md`,n?`text-destructive`:`text-muted-foreground`),"aria-label":e,children:t})}),(0,p.jsx)(nw,{side:`top`,children:e})]})}function g3({codingKey:e,fieldType:t,label:n,required:r=!1,hasValidations:i=!1,isInvalid:a=!1,variant:o=`bordered`,className:s,onClick:c,onEditKey:l,onDelete:u}){let d=G(`defaultEditors.formEditor`),f=J4[t],m=n?.trim()||Y4(d,t),h=typeof c==`function`,g=(0,p.jsxs)(`div`,{role:h?`button`:void 0,tabIndex:h?0:void 0,onClick:c,onKeyDown:e=>{c&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},className:V(`group/field-row flex min-w-0 items-center gap-2 rounded-lg px-2.5 py-1 text-sm transition-colors`,o===`bordered`?`border border-border/70 bg-background shadow-xs`:`border border-transparent bg-transparent`,(h||u)&&`hover:bg-muted/60`,h&&`cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,s),children:[(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:(0,p.jsx)(f,{className:`size-4`})}),(0,p.jsx)(`span`,{className:`inline-flex shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[0.7rem] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:e}),(0,p.jsx)(`span`,{className:V(`min-w-0 flex-1 truncate font-medium`,n?.trim()?`text-foreground`:`text-muted-foreground`),children:m}),(0,p.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[r?(0,p.jsx)(h3,{label:d(`fieldRequired`),children:(0,p.jsx)(dS,{className:`size-3.5`})}):null,a?(0,p.jsx)(h3,{label:d(`fieldInvalid`),destructive:!0,children:(0,p.jsx)(wS,{className:`size-4`})}):i?(0,p.jsx)(h3,{label:d(`fieldHasValidations`),children:(0,p.jsx)(Nte,{className:`size-4`})}):null,h?(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`opacity-0 transition-opacity group-hover/field-row:opacity-100 group-focus-within/field-row:opacity-100`,"aria-label":d(`openFieldEditor`),onClick:e=>{e.stopPropagation(),c()},children:(0,p.jsx)(WS,{className:`size-3.5`})}):null]})]});return!u&&!l?g:(0,p.jsxs)(RI,{children:[(0,p.jsx)(zI,{asChild:!0,children:g}),(0,p.jsxs)(VI,{className:`border-border`,children:[l?(0,p.jsxs)(HI,{onSelect:l,children:[(0,p.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}),d(`editFieldKey`)]}):null,l&&u?(0,p.jsx)(GI,{}):null,(0,p.jsxs)(HI,{variant:`destructive`,onSelect:e=>{e.preventDefault(),u?.()},children:[(0,p.jsx)($S,{className:`size-4`}),d(`deleteField`)]})]})]})}function _3({groupId:e,field:t,index:n}){let r=G(`defaultEditors.formEditor`),{ref:i,isDragging:a}=TI({id:t.id,index:n,group:e});return(0,p.jsx)(`li`,{ref:i,className:V(`list-none touch-none`,a&&`opacity-90`),"aria-label":r(`dragHandle`),children:(0,p.jsxs)(`div`,{className:V(`group flex items-center`),children:[(0,p.jsx)(`span`,{className:`group-hover:opacity-100 opacity-0 transition-opacity inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground`,children:(0,p.jsx)(FS,{className:`size-4`})}),(0,p.jsx)(g3,{codingKey:t.key,fieldType:t.type,label:t.label,required:t.required,hasValidations:t.hasValidations,isInvalid:t.isInvalid,className:`min-w-0 flex-1`})]})})}var v3=({open:e,groupId:t,groupTitle:n,fields:r,onOpenChange:i,onFieldsReorder:a})=>{let o=G(`defaultEditors.formEditor`),s=e&&t!==null;return(0,p.jsx)(xL,{open:s,onOpenChange:i,children:(0,p.jsxs)(SL,{showCloseButton:!1,className:`gap-0 overflow-hidden sm:max-w-2xl`,children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:o(`sortDialogTitle`)}),(0,p.jsx)(EL,{children:o(`sortDialogDescription`,{groupTitle:n?.trim()||o(`sortDialogUntitledGroup`)})})]}),(0,p.jsx)(PP,{sensors:[KN.configure({activationConstraints:[new HN.Distance({value:5})]})],onDragEnd:(e=>{if(e.canceled||!PF(e.operation)||!e.operation.source)return;let{source:t}=e.operation,{initialIndex:n,index:i}=t;if(n===i)return;let o=[...r],[s]=o.splice(n,1);s&&(o.splice(i,0,s),a(o))}),modifiers:e=>[...e,G4],children:(0,p.jsx)(`div`,{className:`max-h-[min(28rem,65svh)] overflow-y-auto py-4`,children:r.length>0?(0,p.jsx)(`ol`,{className:`space-y-2`,children:r.map((e,n)=>(0,p.jsx)(_3,{groupId:t??`form-field-sort`,field:e,index:n},e.id))}):(0,p.jsx)(`div`,{className:`rounded-xl border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground`,children:o(`sortDialogEmpty`)})})}),(0,p.jsx)(wL,{showCloseButton:!0,closeLabel:o(`sortDialogClose`)})]})})},y3=`[data-field-group-header-trigger="true"]`,b3=`
|
|
172
|
+
input:not([disabled]),
|
|
173
|
+
select:not([disabled]),
|
|
174
|
+
textarea:not([disabled]),
|
|
175
|
+
button:not([disabled]),
|
|
176
|
+
a[href],
|
|
177
|
+
[contenteditable]:not([contenteditable="false"])
|
|
178
|
+
`;function x3(e,t){let{target:n}=e;return!(n instanceof Element)||n.closest(y3)||n===t.element||n===t.handle||t.handle?.contains(n)?!1:!!n.closest(b3)}var S3=({onSelectChangeTitle:e,onSelectEditBranching:t,onSelectEditLayout:n,onSelectDeleteGroup:r,onSelectSortFields:i})=>{let a=G(`defaultEditors.formEditor`);return(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{asChild:!0,children:(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,className:`rounded-full text-muted-foreground shadow-sm`,"aria-label":a(`fieldGroupMenuButton`),children:(0,p.jsx)(JS,{className:`size-3.5`})})}),(0,p.jsxs)(uC,{align:`end`,className:`min-w-48`,children:[(0,p.jsxs)(dC,{onSelect:e,children:[(0,p.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}),a(`fieldGroupMenu.changeTitle`)]}),(0,p.jsxs)(dC,{disabled:!0,onSelect:t,children:[(0,p.jsx)(PS,{className:`size-4`}),a(`fieldGroupMenu.editBranching`)]}),(0,p.jsxs)(dC,{onSelect:n,children:[(0,p.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}),a(`fieldGroupMenu.editLayout`)]}),(0,p.jsxs)(dC,{onSelect:i,children:[(0,p.jsx)(hS,{className:`size-4`}),a(`fieldGroupMenu.sortFields`)]}),(0,p.jsx)(hC,{}),(0,p.jsxs)(dC,{variant:`destructive`,onSelect:r,children:[(0,p.jsx)($S,{className:`size-4`}),a(`fieldGroupMenu.deleteGroup`)]})]})]})};function C3({field:e,onEdit:t,onEditKey:n,onDelete:r}){return(0,p.jsx)(`li`,{children:(0,p.jsx)(g3,{codingKey:e.key,fieldType:e.type,label:e.label,required:e.required,hasValidations:e.hasValidations,isInvalid:e.isInvalid,onClick:t,onEditKey:n,onDelete:r})})}function w3({ariaLabel:e,buttonClassName:t,buttonSize:n=`sm`,buttonVariant:r=`ghost`,children:i,onSelectType:a}){let o=G(`defaultEditors.formEditor`);return(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{asChild:!0,children:(0,p.jsx)(H,{type:`button`,variant:r,size:n,className:t,"aria-label":e,children:i})}),(0,p.jsx)(uC,{align:`start`,className:`min-w-52`,children:q4.map(e=>{let t=J4[e];return(0,p.jsxs)(dC,{onSelect:()=>a(e),children:[(0,p.jsx)(t,{className:`size-4`}),Y4(o,e)]},e)})})]})}function T3({groupId:e,item:t,index:n,onAddField:r,onChangeGroupHeader:i,onEditLayout:a,onDeleteGroup:o,onDeleteField:s,onEditField:c,onEditFieldKey:l,onSortFields:u}){let d=G(`defaultEditors.formEditor`),f=G(`itemLabelEditor`),{ref:m,isDragging:h}=TI({id:t.id,index:n,group:e}),g=t.title?.trim(),_=t.description?.trim();return(0,p.jsx)(`li`,{ref:m,className:`list-none touch-none `,children:(0,p.jsxs)(`div`,{className:V(`form-field-group-layout-scope rounded-xl border border-border bg-card p-3 shadow-sm transition-colors`,`hover:border-border/90 hover:bg-muted/40`,h&&`bg-muted/70 backdrop-blur-sm`),style:vR(t.layout),children:[(0,p.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 flex items-start gap-2 rounded-md text-left outline-none transition-colors hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring/60`,onClick:()=>i(t.id),"aria-label":d(`fieldGroupMenu.changeTitle`),"data-field-group-header-trigger":`true`,children:[(0,p.jsx)(hte,{className:`mt-1 size-4 shrink-0 text-muted-foreground`}),g?(0,p.jsx)(`span`,{className:`min-w-0 flex-1 wrap-break-word text-base font-semibold text-foreground`,children:g}):(0,p.jsx)(`span`,{className:`min-w-0 flex-1 wrap-break-word text-base font-semibold text-muted-foreground`,children:f(`emptyLabel`)})]}),t.hasDisplayCondition?(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(`span`,{className:`inline-flex shrink-0 rounded p-1 text-muted-foreground hover:bg-muted/80`,"aria-label":d(`fieldGroupBranching`),children:(0,p.jsx)(PS,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(nw,{side:`top`,children:d(`fieldGroupBranching`)})]}):null,(0,p.jsx)(S3,{onSelectChangeTitle:()=>i(t.id),onSelectEditBranching:()=>void 0,onSelectEditLayout:()=>a(t.id),onSelectDeleteGroup:()=>o(t.id),onSelectSortFields:()=>u(t.id)})]}),(0,p.jsx)(`div`,{children:_?(0,p.jsx)(`button`,{type:`button`,className:`mt-1 block w-full rounded-md text-left text-sm leading-5 text-muted-foreground outline-none transition-colors hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring/60`,onClick:()=>i(t.id),"aria-label":d(`fieldGroupMenu.changeTitle`),"data-field-group-header-trigger":`true`,children:_}):null}),(0,p.jsxs)(`div`,{className:`mt-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:d(`fieldsLabel`)}),(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,className:`rounded-full text-muted-foreground shadow-sm`,"aria-label":d(`fieldGroupMenu.sortFields`),onClick:()=>u(t.id),children:(0,p.jsx)(hS,{className:`size-4`})})]}),(0,p.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[t.fields.length>0&&(0,p.jsx)(`ol`,{className:`space-y-1`,children:t.fields.map(e=>(0,p.jsx)(C3,{field:e,onEdit:()=>c(t.id,e.id),onEditKey:()=>l(t.id,e.id),onDelete:()=>s(t.id,e.id)},e.id))}),(0,p.jsxs)(w3,{ariaLabel:d(`addField`),buttonClassName:`min-w-36 justify-start gap-2 rounded-full text-muted-foreground`,onSelectType:e=>r(t.id,e),children:[(0,p.jsx)(KS,{className:`size-4`}),d(`addField`)]})]})]})]})})}var E3=({itemId:e,items:t,onAddField:n,onChangeGroupHeader:r,onEditLayout:i,onDeleteGroup:a,onDeleteField:o,onEditField:s,onEditFieldKey:c,onSortFields:l,onItemsReorder:u})=>(0,p.jsx)(PP,{sensors:[KN.configure({activationConstraints:[new HN.Distance({value:5})],preventActivation:x3})],onDragEnd:(e=>{if(e.canceled||!PF(e.operation)||!e.operation.source)return;let{source:n}=e.operation,{initialIndex:r,index:i}=n;if(r===i)return;let a=[...t],[o]=a.splice(r,1);o&&(a.splice(i,0,o),u(a))}),modifiers:e=>[...e,G4],children:(0,p.jsx)(`div`,{className:`min-h-0 max-h-[min(40rem,70svh)] overflow-y-auto`,children:(0,p.jsx)(`ol`,{className:`space-y-3 p-px`,children:t.map((t,u)=>(0,p.jsx)(T3,{groupId:e,item:t,index:u,onAddField:n,onChangeGroupHeader:r,onEditLayout:i,onDeleteGroup:a,onDeleteField:o,onEditField:s,onEditFieldKey:c,onSortFields:l},t.id))})})}),D3=({itemId:e,config:t,editingConfig:n,selectedLocale:r,translationNamespace:i,onPersist:a})=>{let o=G(`defaultEditors.formEditor`),s=t.fieldGroups.length,[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(null),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),b=t.fieldGroups.find(e=>e.id===c)??null,x=n.fieldGroups.find(e=>e.id===d)??null,S=t.fieldGroups.find(e=>e.id===m)??null,C=(g?n.fieldGroups.find(e=>e.id===g.groupId)??null:null)?.fields.find(e=>e.id===g?.fieldId)??null,w=(v?n.fieldGroups.find(e=>e.id===v.groupId)??null:null)?.fields.find(e=>e.id===v?.fieldId)??null,T=(0,u.useMemo)(()=>t.fieldGroups.flatMap(e=>e.fields),[t.fieldGroups]),E=()=>{a(e=>{e.fieldGroups=[...e.fieldGroups,wre()]})},D=e=>{a(t=>{t.fieldGroups=e})},O=(e,t)=>{a(n=>{let r=n.fieldGroups.find(t=>t.id===e);if(!r)return;let i=Tre(n.fieldGroups.flatMap(e=>e.fields));r.fields=[...r.fields,Ere(t,i)]})},ee=(e,t)=>{a((n,r)=>{let a=n.fieldGroups.find(t=>t.id===e);a&&(a.fields=a.fields.filter(e=>e.id!==t),r.removeContentKeysWithPrefix(iR(t,i)))}),_(n=>n?.groupId===e&&n.fieldId===t?null:n),y(n=>n?.groupId===e&&n.fieldId===t?null:n)},k=e=>{a((t,n)=>{let r=t.fieldGroups.findIndex(t=>t.id===e);if(!(r<0)){n.removeContentKeysWithPrefix(tR(e,i));for(let e of t.fieldGroups[r].fields)n.removeContentKeysWithPrefix(iR(e.id,i));t.fieldGroups.splice(r,1)}}),l(t=>t===e?null:t),f(t=>t===e?null:t),h(t=>t===e?null:t),_(t=>t?.groupId===e?null:t),y(t=>t?.groupId===e?null:t)},A=e=>{l(e)},j=e=>{f(e)},M=e=>{h(e)},N=(e,t)=>{_({groupId:e,fieldId:t})},P=(e,t)=>{y({groupId:e,fieldId:t})},F=e=>{e||h(null)},I=e=>{if(m){if(JSON.stringify(S?.layout)===JSON.stringify(e)){h(null);return}a(t=>{let n=t.fieldGroups.find(e=>e.id===m);n&&(n.layout=e)}),h(null)}},te=e=>{e||l(null)},ne=e=>{e||f(null)},re=e=>{e||_(null)},ie=e=>{e||y(null)},ae=(e,t)=>{a(n=>{let r=n.fieldGroups.find(t=>t.id===e);r&&(r.fields=t)})};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`section`,{className:`min-h-24`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-sm font-semibold uppercase tracking-wider text-gray-600`,children:[(0,p.jsx)(`span`,{children:o(`responseConfig`)}),(0,p.jsxs)(`span`,{className:`font-normal normal-case tracking-normal text-muted-foreground`,children:[`(`,(0,p.jsx)(`span`,{className:`tabular-nums`,children:s}),`)`]})]}),(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,className:`rounded-full text-muted-foreground shadow-sm`,"aria-label":o(`addFieldGroup`),onClick:E,children:(0,p.jsx)(KS,{className:`size-4`})})]}),(0,p.jsxs)(`div`,{className:`mt-2`,children:[s>0&&(0,p.jsx)(E3,{itemId:e,items:t.fieldGroups,onAddField:O,onChangeGroupHeader:j,onEditLayout:M,onDeleteGroup:k,onDeleteField:ee,onEditField:N,onEditFieldKey:P,onSortFields:A,onItemsReorder:D}),(0,p.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:V(`mt-2 min-w-44 justify-start gap-2 rounded-full text-muted-foreground`),onClick:E,children:[(0,p.jsx)(KS,{className:`size-4`}),o(`addFieldGroup`)]})]})]}),(0,p.jsx)(v3,{open:b!==null,groupId:b?.id??null,groupTitle:b?.title,fields:b?.fields??[],onOpenChange:te,onFieldsReorder:e=>{b&&ae(b.id,e)}}),(0,p.jsx)(d3,{open:x!==null,initialTitle:x?.title,initialDescription:x?.description,onOpenChange:ne,onSave:e=>{if(!(!d||!x)){if(x.title===e.title&&x.description===e.description){f(null);return}a((t,n)=>{let a=t.fieldGroups.find(e=>e.id===d);a&&(a.title=e.title,a.description=e.description,sre(n,r,a,i))}),f(null)}}},`header-${x?.id??`closed`}-${r}-${x===null?`closed`:`open`}`),(0,p.jsx)(m3,{open:S!==null,initialLayout:S?.layout??{base:1,xs:1,sm:1,md:1,xl:1},onOpenChange:F,onSave:I},`layout-${S?.id??`closed`}`),(0,p.jsx)(l3,{open:C!==null,field:C,allFields:T,onOpenChange:re,onSave:e=>{if(!(!g||!C)){if(JSON.stringify(C)===JSON.stringify(e)){_(null);return}a((t,n)=>{let a=t.fieldGroups.find(e=>e.id===g.groupId);if(!a)return;let o=a.fields.findIndex(e=>e.id===g.fieldId);if(o<0)return;let s=a.fields[o],c=new Set(mR(s,i)),l=new Set(mR(e,i));for(let e of c)l.has(e)||n.removeContentKey(e);cre(n,r,e,i),a.fields[o]=e}),_(null)}}},`field-${C?.id??`closed`}`),(0,p.jsx)(u3,{open:w!==null,field:w,allFields:T,onOpenChange:ie,onSave:e=>{if(!(!v||!w)){if(w.key.trim()===e){y(null);return}a(t=>{let n=t.fieldGroups.find(e=>e.id===v.groupId);if(!n)return;let r=n.fields.findIndex(e=>e.id===v.fieldId);r<0||(n.fields[r]={...n.fields[r],key:e})}),y(null)}}},`field-key-${w?.id??`closed`}`)]})},O3=({open:e,optionLabel:t,itemId:n,config:r,editingConfig:i,selectedLocale:a,translationNamespace:o,onOpenChange:s,onPersist:c})=>{let l=G(`defaultEditors.choiceEditor.embeddedFormDialog`);return(0,p.jsx)(xL,{open:e,onOpenChange:s,children:(0,p.jsxs)(SL,{className:`survey-editor max-h-[min(88svh,56rem)] overflow-y-auto sm:max-w-5xl`,children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:l(`title`)}),(0,p.jsx)(EL,{children:l(`description`,{optionLabel:t})})]}),(0,p.jsx)(D3,{itemId:n,config:r,editingConfig:i,selectedLocale:a,translationNamespace:o,onPersist:c})]})})},k3=({open:e,option:t,existingOptions:n,initialLabelContent:r,initialFocusField:i=`label`,onOpenChange:a,onSave:o})=>{let s=G(`defaultEditors.choiceEditor`),c=G(`common.actions`),[l,d]=(0,u.useState)(t?.key??``),[f,m]=(0,u.useState)(r),[h,g]=(0,u.useState)(()=>YQ(r)),[_]=(0,u.useState)(0),v=e&&t!==null,y=OR(l),b=n.some(e=>e.id!==t?.id&&OR(e.key??``)===y),x=y.length===0?s(`createOptionKeyRequired`):b?s(`createOptionKeyDuplicate`):null,S=x!==null||t===null,C=()=>{!t||S||o({...t,key:y},f)};return(0,p.jsx)(xL,{open:v,onOpenChange:a,children:(0,p.jsxs)(SL,{showCloseButton:!1,className:`survey-editor overflow-visible border-0 bg-transparent p-0 shadow-none ring-0 sm:max-w-xl`,children:[(0,p.jsx)(TL,{className:`sr-only`,children:s(`editOptionDialogTitle`)}),(0,p.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-3 shadow-sm`,children:(0,p.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,p.jsx)(w4,{draftKey:l,draftLabelEditorValue:h,keyValidationMessage:x,labelEditorInstanceKey:_,labelAutoFocus:i===`label`,keyAutoFocus:i===`key`,keyRowTrailing:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`rounded-full`,onClick:()=>a(!1),children:c(`cancel`)}),(0,p.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-full`,disabled:S,onClick:C,children:c(`save`)})]}),onDraftKeyChange:d,onDraftLabelChange:e=>{g(e.value),m(e.isEmpty?void 0:JQ(e.editorState))},onSubmitShortcut:C})})})]})})};function A3({sessionId:e,editor:t,changeTick:n,persistDebounceMs:r,onEditorStateChange:i}){let a=(0,u.useRef)(null),o=(0,u.useRef)({sessionId:e,editor:t,changeTick:n}),s=(0,u.useEffectEvent)(e=>{i?.(e)});(0,u.useEffect)(()=>{o.current={sessionId:e,editor:t,changeTick:n}},[e,t,n]),(0,u.useEffect)(()=>{if(a.current&&=(clearTimeout(a.current),null),!(!t||n===0)){if(r<=0){s({sessionId:e,state:t.toJson(),revision:n,hasUncommittedChanges:t.hasUncommittedChanges,at:Date.now()});return}return a.current=setTimeout(()=>{s({sessionId:e,state:t.toJson(),revision:n,hasUncommittedChanges:t.hasUncommittedChanges,at:Date.now()})},r),()=>{a.current&&=(clearTimeout(a.current),null)}}},[e,t,n,r]),(0,u.useEffect)(()=>()=>{let e=o.current;e.editor&&e.changeTick>0&&s({sessionId:e.sessionId,state:e.editor.toJson(),revision:e.changeTick,hasUncommittedChanges:e.editor.hasUncommittedChanges,at:Date.now()})},[])}function j3({className:e,children:t,...n}){return(0,p.jsxs)(Nh,{"data-slot":`scroll-area`,className:V(`relative`,e),...n,children:[(0,p.jsx)(Ph,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,p.jsx)(M3,{}),(0,p.jsx)(Fh,{})]})}function M3({className:e,orientation:t=`vertical`,...n}){return(0,p.jsx)(sh,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:V(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,p.jsx)(vh,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var N3=()=>{let e=G(`routes.historyStack`),t=bw(),[n,r]=(0,u.useState)(!1),i=W(e=>e.getUndoRedoHistory),a=W(e=>e.jumpToIndexInHistory),o=i(),s=o.at(o.length-1);return(0,p.jsxs)(kL,{open:n,onOpenChange:r,children:[(0,p.jsx)(AL,{asChild:!0,children:(0,p.jsxs)(H,{variant:`ghost`,size:`xs`,className:`backdrop-blur-md gap-1 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/50 focus-visible:border-transparent`,children:[(0,p.jsx)(Cte,{className:`size-3.5`}),(0,p.jsxs)(`span`,{className:`space-x-1`,children:[(0,p.jsx)(`span`,{className:`text-xs font-light hidden @sm/main:inline`,children:e(`lastModified`)}),(0,p.jsx)(`span`,{className:`text-xs font-medium`,children:En(new Date(s?.timestamp??0),{addSuffix:!0,locale:t})})]})]})}),(0,p.jsxs)(jL,{className:`min-w-96 p-0 gap-0 border-border`,align:`start`,side:`top`,children:[(0,p.jsxs)(`div`,{className:`p-3 border-b border-border shadow-xs drop-shadow-xs bg-muted/50`,children:[(0,p.jsx)(`h4`,{className:`font-medium text-sm`,children:e(`recentChangesTitle`)}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`recentChangesDescription`)})]}),(0,p.jsx)(j3,{className:`h-64`,children:(0,p.jsx)(`ol`,{className:`divide-y divide-border pt-1`,children:o.toSorted((e,t)=>t.timestamp-e.timestamp).map(e=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{disabled:e.isCurrent,className:V(`text-sm px-3 py-1 flex items-center justify-between w-full`,`hover:bg-accent transition-colors focus:bg-accent focus:outline-none`,e.isCurrent&&`bg-primary text-primary-foreground hover:bg-primary focus:bg-primary`),onClick:()=>a(e.index),children:[(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(`p`,{className:`truncate text-xs font-medium`,children:e.meta.label})}),(0,p.jsx)(nw,{children:e.meta.label})]}),(0,p.jsx)(`p`,{className:V(`text-xs text-muted-foreground`,e.isCurrent&&`text-primary-foreground/80`),children:En(new Date(e.timestamp),{addSuffix:!0,locale:t})})]})},e.index))})})]})]})};function P3(){let e=W(e=>e.changeTick),t=W(e=>e.getAssets);return(0,u.useMemo)(()=>t(),[e,t])}function F3(){let e=P3();return(0,u.useMemo)(()=>Array.from(e.entries()).filter(([,e])=>e.kind===`image`),[e])}function I3(){let e=P3(),t=Cw();return(0,u.useMemo)(()=>{if(e.size===0)return 0;let n=new Set((t?.getAssetUsages()??[]).map(e=>e.assetId)),r=0;for(let t of e.keys())n.has(t)||(r+=1);return r},[e,t])}async function L3(e){return await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`Failed to read file`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`Unexpected file reader result`));return}let[,i=``]=e.split(`,`,2);t(i)},r.readAsDataURL(e)})}function R3(e){if(!(!e||e.kind!==`image`))return`data:${e.source.mediaType};base64,${e.source.data}`}function z3(e,t){let n=e.metadata;return n?.name?.trim()||n?.filename?.trim()||n?.alt?.trim()||t}function B3(e,t){let n={...e.metadata,...t};if(!(!n?.name&&!n?.filename&&!n?.alt&&n?.width===void 0&&n?.height===void 0))return n}var V3=`group/card flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm transition-shadow`;function H3({assetId:e,asset:t,usages:n,getUsageItemLabel:r,onNavigateToUsage:i,onSaveAsset:a,onRemoveAsset:o}){let s=G(`defaultEditors.assetManager`),[c,l]=(0,u.useState)(t.metadata?.name??``),[d,f]=(0,u.useState)(!1),[m,h]=(0,u.useState)(!1),g=(0,u.useRef)(null),_=`data:${t.source.mediaType};base64,${t.source.data}`,v=t.metadata?.filename?.trim()??e,y=t.metadata?.alt??t.metadata?.name??t.metadata?.filename??e,b=n.length===0,x=(0,u.useMemo)(()=>{let e=new Map;for(let t of n){let n=`${t.itemId??`survey`}:${t.usageScope}`;e.has(n)||e.set(n,t)}return[...e.values()]},[n]);(0,u.useEffect)(()=>{l(t.metadata?.name??``)},[t.metadata?.name]);let S=()=>{let n=c.trim();n!==(t.metadata?.name?.trim()??``)&&a(e,{...t,metadata:B3(t,{name:n||void 0})})},C=async n=>{if(!n)return;let r=c.trim();f(!0);try{let i=await L3(n);a(e,{...t,source:{type:`embedded`,mediaType:n.type||`application/octet-stream`,encoding:`base64`,data:i},metadata:B3(t,{name:r||void 0,filename:n.name,width:void 0,height:void 0})})}finally{f(!1),g.current&&(g.current.value=``)}};return(0,p.jsxs)(`article`,{className:V3,children:[(0,p.jsxs)(`div`,{className:`relative aspect-4/3 shrink-0 overflow-hidden bg-muted/30`,children:[(0,p.jsx)(`img`,{src:_,alt:``,className:`pointer-events-none size-full object-cover`,"aria-hidden":!0}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>{h(!0)},className:V(`absolute inset-0 z-1 flex cursor-zoom-in items-start justify-end p-2`,`bg-black/0 transition-colors hover:bg-black/10`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background`),"aria-label":s(`expandPreview`),title:s(`expandPreview`),children:(0,p.jsx)(`span`,{className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md border border-border/80 bg-background/90 text-foreground shadow-sm backdrop-blur-sm`,"aria-hidden":!0,children:(0,p.jsx)(Ote,{className:`size-4`})})})]}),(0,p.jsx)(xL,{open:m,onOpenChange:h,children:(0,p.jsxs)(SL,{className:`max-h-[min(90vh,calc(100vh-2rem))] w-[min(96vw,56rem)] max-w-[min(96vw,56rem)] gap-0 overflow-hidden p-2 sm:max-w-[min(96vw,56rem)]`,closeLabel:s(`closePreview`),children:[(0,p.jsx)(TL,{className:`sr-only`,children:s(`previewTitle`)}),(0,p.jsx)(`div`,{className:`flex max-h-[min(85vh,calc(100vh-4rem))] min-h-0 w-full items-center justify-center overflow-auto p-1`,children:(0,p.jsx)(`img`,{src:_,alt:y,className:`max-h-[min(85vh,calc(100vh-4rem))] w-auto max-w-full object-contain`})})]})}),(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col space-y-2 p-4`,children:[(0,p.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,p.jsx)(`p`,{className:`truncate text-sm font-semibold tracking-tight`,title:v,children:v})}),(0,p.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,p.jsx)(`input`,{ref:g,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{C(e.target.files?.[0])}}),(0,p.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:()=>g.current?.click(),disabled:d,className:`text-muted-foreground hover:text-foreground`,"aria-label":s(`replaceAsset`),title:s(`replaceAsset`),children:(0,p.jsx)(Ate,{className:`size-4`})}),(0,p.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:()=>{o(e)},disabled:!b,className:`text-muted-foreground hover:text-foreground`,"aria-label":s(b?`removeAsset`:`deleteBlocked`),title:s(b?`removeAsset`:`deleteBlocked`),children:(0,p.jsx)($S,{className:`size-4`})})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1 mb-4`,children:[(0,p.jsx)(ux,{className:`sr-only text-xs font-medium text-muted-foreground`,htmlFor:`asset-name-${e}`,children:s(`nameLabel`)}),(0,p.jsx)(lx,{className:`bg-neutral-50 text-sm`,id:`asset-name-${e}`,value:c,onChange:e=>{l(e.target.value)},onBlur:S,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},placeholder:s(`namePlaceholder`)})]}),b?(0,p.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-amber-200/70 bg-amber-50/80 px-3 py-2.5 text-[13px] leading-snug text-amber-950`,children:[(0,p.jsx)(eC,{className:`mt-0.5 size-4 shrink-0 text-amber-600`,"aria-hidden":!0}),(0,p.jsx)(`span`,{children:s(`unusedAssetWarning`)})]}):(0,p.jsxs)(`div`,{className:`border-t border-slate-100 pt-4`,children:[(0,p.jsx)(`p`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-400`,children:s(`usedByLabel`,{count:x.length})}),(0,p.jsx)(`ul`,{className:`divide-y divide-slate-100`,children:x.map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{i(e)},className:`group/row flex w-full items-center gap-2 py-2.5 text-left text-sm text-slate-700 transition-colors hover:text-slate-950`,children:[(0,p.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:r(e)}),(0,p.jsx)(uS,{className:`size-3.5 shrink-0 text-slate-400 transition-colors group-hover/row:text-slate-600`,"aria-hidden":!0})]})},`${e.itemId??`survey`}-${e.usageScope}-${t}`))})]})]})]})}function U3({dropzoneKey:e,onFilesAccepted:t}){let n=G(`defaultEditors.assetManager`);return(0,p.jsx)(`article`,{className:V(`flex h-full min-h-0`),children:(0,p.jsx)(D2,{id:`survey-image-asset-upload`,accept:{"image/*":[]},multiple:!0,className:`flex min-h-0 flex-1 flex-col gap-0`,contentClassName:`flex min-h-0 flex-1 flex-col gap-0 p-0`,dropzoneClassName:`flex min-h-0 flex-1 flex-col items-center justify-center rounded-xl p-4 bg-card shadow-sm`,labels:{upload:n(`uploadLabel`),drag:n(`uploadDescription`),active:n(`uploadActive`)},onChange:t},e)})}function W3({className:e}){let t=G(`defaultEditors.assetManager`),n=Cw(),r=F3(),i=W(e=>e.setAsset),a=W(e=>e.removeAsset),o=Dw(e=>e.navigate),[s,c]=(0,u.useState)(0),l=(0,u.useMemo)(()=>[...r],[r]),d=(0,u.useMemo)(()=>n?.getAssetUsages()??[],[n]),f=(0,u.useMemo)(()=>{let e=new Map;for(let t of d){let n=e.get(t.assetId)??[];n.push(t),e.set(t.assetId,n)}return e},[d]),m=(e,t)=>{i(e,t)},h=e=>{(f.get(e)??[]).length>0||a(e)},g=e=>{if(!n||!e.itemId)return t(`surveyRootItem`);let r=n.surveyItems.get(e.itemId);return!r||e.itemId===n.rootItem?.id&&e.usageScope!==`itemTranslation`?t(`surveyRootItem`):n.getItemKey(e.itemId)?.fullKey??r.key??e.itemId},_=e=>{if(e.itemId){o({view:`item-editor`,itemId:e.itemId});return}o({view:`item-editor`})};return(0,p.jsx)(`div`,{className:V(e),children:(0,p.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3 *:min-h-72`,children:[l.map(([e,t])=>(0,p.jsx)(H3,{assetId:e,asset:t,usages:f.get(e)??[],getUsageItemLabel:g,onNavigateToUsage:_,onSaveAsset:m,onRemoveAsset:h},e)),(0,p.jsx)(U3,{dropzoneKey:s,onFilesAccepted:async e=>{if(e.length!==0){for(let t of e){let e=b(),n=await L3(t);i(e,{kind:`image`,source:{type:`embedded`,mediaType:t.type||`application/octet-stream`,encoding:`base64`,data:n},metadata:{filename:t.name}})}c(e=>e+1)}}})]})})}var G3=()=>{let e=G(`routes.footer`),{helpLink:t}=vw(),n=P3(),r=I3(),i=Dw(e=>e.navigate),a=Dw(e=>e.location),o=n.size,s=r>0,c=a.view===`asset-manager`;return(0,p.jsx)(`footer`,{className:`h-6 mt-0.5`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-between h-full text-muted-foreground`,children:[(0,p.jsxs)(`div`,{className:`flex items-center h-full gap-1`,children:[(0,p.jsx)(N3,{}),(0,p.jsxs)(H,{variant:`ghost`,size:`xs`,onClick:()=>i({view:`asset-manager`}),disabled:c,className:`backdrop-blur-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/50 focus-visible:border-transparent`,children:[(0,p.jsx)(wte,{className:`size-3`}),(0,p.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs`,title:s?e(`unusedAssetsWarning`,{count:r}):void 0,children:[e(`assets`,{count:o}),s?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eC,{className:`size-3 text-amber-600`,"aria-hidden":!0}),(0,p.jsx)(`span`,{className:`sr-only`,children:e(`unusedAssetsWarning`,{count:r})})]}):null]})]})]}),(0,p.jsx)(`div`,{className:``,children:(0,p.jsx)(H,{variant:`ghost`,size:`xs`,asChild:!0,className:`backdrop-blur-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/50 focus-visible:border-transparent`,children:(0,p.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,p.jsx)(DS,{className:`size-3`}),(0,p.jsx)(`span`,{className:`text-xs`,children:e(`help`)})]})})})]})})};function K3({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`skeleton`,className:V(`animate-pulse rounded-md bg-muted`,e),...t})}var q3=()=>(0,p.jsxs)(`div`,{className:`w-full flex flex-col md:flex-row gap-3 items-start relative`,children:[(0,p.jsxs)(`div`,{className:`w-full md:w-auto flex-1 order-2 md:order-1 bg-background rounded-xl border border-border`,children:[(0,p.jsx)(`div`,{className:`py-2 border-b border-border h-[37px] flex items-center`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-between relative w-full`,children:[(0,p.jsxs)(`div`,{className:`absolute px-4 rounded-s-lg left-0 top-0 bottom-0 flex items-center gap-2 justify-center bg-white`,children:[(0,p.jsx)(K3,{className:`size-5 rounded-full`}),(0,p.jsx)(K3,{className:`h-6 w-16 rounded-lg`})]}),(0,p.jsx)(`div`,{className:`text-center grow px-20`,children:(0,p.jsx)(K3,{className:`h-4 w-32 mx-auto`})})]})}),(0,p.jsx)(j4,{className:`p-0 m-0`,children:(0,p.jsx)(`div`,{className:`w-full`,children:(0,p.jsxs)(`div`,{className:`min-h-[400px] p-6 space-y-6`,children:[(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsx)(K3,{className:`h-6 w-48`}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(K3,{className:`h-4 w-full`}),(0,p.jsx)(K3,{className:`h-4 w-3/4`}),(0,p.jsx)(K3,{className:`h-4 w-1/2`})]})]}),(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsx)(K3,{className:`h-6 w-36`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,p.jsx)(K3,{className:`h-20 w-full rounded-lg`}),(0,p.jsx)(K3,{className:`h-20 w-full rounded-lg`})]})]}),(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsx)(K3,{className:`h-6 w-24`}),(0,p.jsx)(K3,{className:`h-32 w-full rounded-lg`})]})]})})})]}),(0,p.jsx)(`div`,{className:`relative md:sticky top-0 order-1 md:order-2 w-full md:w-fit flex justify-end`,children:(0,p.jsx)(D4,{className:`shadow-none w-fit border-border p-0`,children:(0,p.jsxs)(j4,{className:`p-0 flex flex-row md:flex-col`,children:[(0,p.jsx)(`div`,{className:`border-r border-border md:border-b md:border-r-0`,children:(0,p.jsx)(K3,{className:`size-9 rounded-s-xl md:rounded-s-none md:rounded-t-xl`})}),(0,p.jsx)(`div`,{className:`flex flex-row md:flex-col`,children:Array.from({length:6}).map((e,t)=>(0,p.jsx)(K3,{className:V(`size-9`,t===5?`rounded-e-xl md:rounded-e-none md:rounded-b-xl`:`rounded-none`)},t))})]})})})]}),J3=()=>{let{selectedItemId:e}=Ow(),t=W(e=>e.getRootItem),n=W(e=>e.editorItemRegistry),r=t(),i=e||r?.id,a=Sw();if(!a||!i)return(0,p.jsx)(q3,{});let o=a.survey.surveyItems.get(i);if(!o)return(0,p.jsx)(q3,{});let s=$x(n,o);if(s?.editorComponent){let e=s.editorComponent;return(0,p.jsx)(e,{item:o})}return(0,p.jsxs)(`div`,{children:[`Editor for `,o.type,` is not implemented yet.`]})},Y3=`case.survey-editor.last-used-item-type`,X3=[`infoItem`,`formItem`],Z3=new Set([ve.Group,ve.PageBreak]),Q3=e=>e.trim().toUpperCase().replace(/[.\s]+/g,`_`).replace(/_+/g,`_`).replace(/^_+|_+$/g,``);function $3(e,t,n,r){let i=n.coreRegistry[e.rawItem.itemType];if(!i)throw Error(`Item type "${e.rawItem.itemType}" is not available in this editor registry.`);let a=new i(e.rawItem);if(r({parentId:t},a,e.translations),e.children?.length){if(!(a instanceof Se))throw Error(`Item type "${a.type}" cannot include child items in getInitialItem().`);e.children.forEach(e=>{$3(e,a.id,n,r)})}return a}function e6({editorItemRegistry:e,addItem:t,pasteItem:n,commitByUser:r,setPreferredPreviewItemId:i,closeDialog:a,targetGroupId:o,rootItemId:s,clipboardValue:c,setLastUsedItemType:l}){let d=G(`history`),f=G(`addItemDialog`);return{handleSelectOption:(0,u.useCallback)(n=>{if(!o){OC.error(f(`noValidGroupSelected`));return}let s=e.definitions[n.itemType],c=e.coreRegistry[n.itemType];if(!s||!c){OC.error(f(`registryItemTypeUnavailable`,{itemType:n.itemType}));return}try{let u,p;if(s.createItem)u=s.createItem({editor:{addItem:(e,n,r)=>t(e,n,r)},targetParentId:o,constructor:c});else{let r=s.getInitialItem?.();if(r){let n=$3(r,o,e,t);u=n.id,p=n.key}else{let e=new c({id:b(),key:S(3),itemType:n.itemType});u=e.id,p=e.key,t({parentId:o},e)}}r({label:d(`addItem`,{itemLabel:n.label})}),typeof window<`u`&&localStorage.setItem(Y3,n.itemType),l(n.itemType),OC.success(f(`itemAdded`,{itemKey:p??u})),i(u),a()}catch(e){console.error(`Failed to add item:`,e),OC.error(f(`itemAddFailed`))}},[t,a,r,e,d,l,i,f,o]),pasteFromClipboard:(0,u.useCallback)(()=>{if(!c)return;let e;try{e=JSON.parse(c)}catch{return}if(!cL.isValidClipboardData(e))return;let t=o??s;if(!t)return;let l=n(e,{parentId:t});r({label:d(`pasteItem`)}),i(l),a()},[c,a,r,d,n,s,i,o]),createItemsFromIntent:(0,u.useCallback)(n=>{if(!o){OC.error(f(`noValidTargetGroupSelected`));return}if(n.length===0){OC.info(f(`aiReturnedNoItems`));return}let s=new Map,c=0,l=new Set,u;try{let p=[...n],m=!0;for(;p.length>0&&m;){m=!1;for(let n=p.length-1;n>=0;--n){let r=p[n],i=e.coreRegistry[r.itemType];if(!i){l.add(r.itemType),p.splice(n,1);continue}let a=r.parentTempId?s.get(r.parentTempId):o;if(!a)continue;let d=Q3(r.key||``),f=new i({id:b(),key:d.length>0?d:S(3),itemType:r.itemType,metadata:r.itemLabel?{itemLabel:r.itemLabel}:void 0});t({parentId:a},f),s.set(r.tempId,f.id),c+=1,u??=f.id,p.splice(n,1),m=!0}}if(c===0){OC.error(f(`aiNoValidItemsCreated`));return}p.length>0&&OC.warning(f(`aiSkippedUnresolvedParents`,{createdCount:c,pendingCount:p.length})),r({label:c===1?d(`addItemFromAiIntent`):d(`addItemsFromAiIntent`,{count:c})}),i(u??o??null),a(),l.size>0?OC.warning(f(`aiSkippedUnsupportedTypes`,{createdCount:c,itemTypes:Array.from(l).join(`, `)})):OC.success(f(`aiCreatedItems`,{createdCount:c}))}catch(e){console.error(`Failed to create items from AI intent:`,e),OC.error(f(`aiCreateFailed`))}},[t,a,r,e.coreRegistry,d,i,f,o])}}var t6=(e,t)=>({id:t.id,itemKey:t.isRoot()?e.survey.surveyKey:t.key,itemLabel:t.metadata?.itemLabel,isRoot:t.isRoot(),itemCount:t.items?.length??0});function n6({editor:e,selectedItemId:t,targetParentId:n}){return(0,u.useMemo)(()=>{if(!e)return null;let r=t=>{let n=e.survey.surveyItems.get(t);return n instanceof Se?n:null};if(n){let t=r(n);return t?t6(e,t):null}if(!t){let t=e.survey.rootItem;return t?t6(e,t):null}let i=e.survey.surveyItems.get(t);if(!i)return null;if(i instanceof Se&&(i.isRoot()||i.type===ve.Group))return t6(e,i);let a=e.survey.getParentItem(i.id);return a instanceof Se?t6(e,a):null},[e,t,n])}function r6({options:e,onSelect:t,rowSize:n=1}){let r=(0,u.useRef)(null),[i,a]=(0,u.useState)(0),[o,s]=(0,u.useState)(!1);return{groupRef:r,activeIndex:i,isFocused:o,setActiveIndex:a,focusGroup:(0,u.useCallback)(()=>{requestAnimationFrame(()=>{r.current?.focus(),s(!0)})},[]),reset:(0,u.useCallback)((e=0)=>{a(e),s(!1)},[]),handleGroupFocus:(0,u.useCallback)(()=>{s(!0)},[]),handleGroupBlur:(0,u.useCallback)(e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||s(!1)},[]),handleGroupKeyDown:(0,u.useCallback)(r=>{let o=e.length;if(o<1)return;let s=r.metaKey||r.ctrlKey||r.altKey||r.shiftKey;if(r.key===`Enter`&&s)return;if(r.key===`Enter`||r.key===` `){r.preventDefault();let n=e[i];n&&t(n);return}let c=i;switch(r.key){case`ArrowRight`:c=(i+1)%o;break;case`ArrowLeft`:c=(i-1+o)%o;break;case`ArrowDown`:c=(i+n)%o;break;case`ArrowUp`:c=(i-n+o)%o;break;default:return}r.preventDefault(),a(c)},[i,t,e,n])}}function i6({onBack:e}){let t=G(`common.actions`);return(0,p.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:e,children:[(0,p.jsx)(bS,{className:`size-4`}),t(`back`)]})}function a6({intent:e,onIntentChange:t,onGenerate:n,onBack:r,isGenerating:i,isEnabled:a}){let o=G(`common.actions`),s=G(`addItemDialog.ai`);return(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,p.jsx)(i6,{onBack:r})}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-3`,children:[(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(ux,{htmlFor:`ai-item-intent`,children:s(`describeLabel`)}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`describeExample`)})]}),(0,p.jsx)(`textarea`,{id:`ai-item-intent`,value:e,onChange:e=>t(e.target.value),placeholder:s(`placeholder`),rows:5,className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/30`}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`multipleItemsHint`)}),(0,p.jsxs)(H,{type:`button`,onClick:n,disabled:!a||i||e.trim().length<3,className:`gap-1.5`,children:[i?(0,p.jsx)(VS,{className:`size-4 animate-spin`}):(0,p.jsx)(YS,{className:`size-4`}),o(`generate`)]})]})]})]})}var o6=1,s6=.9,c6=.8,l6=.17,u6=.1,d6=.999,f6=.9999,p6=.99,m6=/[\\\/_+.#"@\[\(\{&]/,h6=/[\\\/_+.#"@\[\(\{&]/g,g6=/[\s-]/,_6=/[\s-]/g;function v6(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?o6:p6;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=v6(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=o6:m6.test(e.charAt(l-1))?(d*=c6,p=e.slice(i,l-1).match(h6),p&&i>0&&(d*=d6**+p.length)):g6.test(e.charAt(l-1))?(d*=s6,m=e.slice(i,l-1).match(_6),m&&i>0&&(d*=d6**+m.length)):(d*=l6,i>0&&(d*=d6**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=f6)),(d<u6&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=v6(e,t,n,r,l+1,a+2,o),f*u6>d&&(d=f*u6)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function y6(e){return e.toLowerCase().replace(_6,` `)}function b6(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,v6(e,t,y6(e),y6(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function x6(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function S6(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function C6(...e){return t=>{let n=!1,r=e.map(e=>{let r=S6(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():S6(e[t],null)}}}}function w6(...e){return d.useCallback(C6(...e),e)}function T6(e,t){let n=d.createContext(t),r=e=>{let{children:t,...r}=e,i=d.useMemo(()=>r,Object.values(r));return(0,p.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=d.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function E6(e,t=[]){let n=[];function r(t,r){let i=d.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=d.useMemo(()=>o,Object.values(o));return(0,p.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=d.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>d.createContext(e));return function(n){let r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,D6(i,...t)]}function D6(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var O6=globalThis?.document?d.useLayoutEffect:()=>{},k6=d.useId||(()=>void 0),A6=0;function j6(e){let[t,n]=d.useState(k6());return O6(()=>{e||n(e=>e??String(A6++))},[e]),e||(t?`radix-${t}`:``)}var M6=d.useInsertionEffect||O6;function N6({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=P6({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=d.useRef(e!==void 0);d.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,d.useCallback(t=>{if(s){let n=F6(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function P6({defaultProp:e,onChange:t}){let[n,r]=d.useState(e),i=d.useRef(n),a=d.useRef(t);return M6(()=>{a.current=t},[t]),d.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function F6(e){return typeof e==`function`}function I6(e){let t=L6(e),n=d.forwardRef((e,n)=>{let{children:r,...i}=e,a=d.Children.toArray(r),o=a.find(z6);if(o){let e=o.props.children,r=a.map(t=>t===o?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return(0,p.jsx)(t,{...i,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return(0,p.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function L6(e){let t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(d.isValidElement(n)){let e=V6(n),i=B6(r,n.props);return n.type!==d.Fragment&&(i.ref=t?C6(t,e):e),d.cloneElement(n,i)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var R6=Symbol(`radix.slottable`);function z6(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===R6}function B6(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function V6(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H6=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=I6(`Primitive.${t}`),r=d.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,p.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function U6(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}function W6(e){let t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...e)=>t.current?.(...e),[])}function G6(e,t=globalThis?.document){let n=W6(e);d.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var K6=`DismissableLayer`,q6=`dismissableLayer.update`,J6=`dismissableLayer.pointerDownOutside`,Y6=`dismissableLayer.focusOutside`,X6,Z6=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Q6=d.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=d.useContext(Z6),[u,f]=d.useState(null),m=u?.ownerDocument??globalThis?.document,[,h]=d.useState({}),g=w6(t,e=>f(e)),_=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(v),b=u?_.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=t8(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!S||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},m),w=n8(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},m);return G6(e=>{b===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},m),d.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(X6=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),r8(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=X6)}},[u,m,n,l]),d.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),r8())},[u,l]),d.useEffect(()=>{let e=()=>h({});return document.addEventListener(q6,e),()=>document.removeEventListener(q6,e)},[]),(0,p.jsx)(H6.div,{...c,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:x6(e.onFocusCapture,w.onFocusCapture),onBlurCapture:x6(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:x6(e.onPointerDownCapture,C.onPointerDownCapture)})});Q6.displayName=K6;var $6=`DismissableLayerBranch`,e8=d.forwardRef((e,t)=>{let n=d.useContext(Z6),r=d.useRef(null),i=w6(t,r);return d.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,p.jsx)(H6.div,{...e,ref:i})});e8.displayName=$6;function t8(e,t=globalThis?.document){let n=W6(e),r=d.useRef(!1),i=d.useRef(()=>{});return d.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){i8(J6,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function n8(e,t=globalThis?.document){let n=W6(e),r=d.useRef(!1);return d.useEffect(()=>{let e=e=>{e.target&&!r.current&&i8(Y6,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function r8(){let e=new CustomEvent(q6);document.dispatchEvent(e)}function i8(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?U6(i,a):i.dispatchEvent(a)}var a8=`focusScope.autoFocusOnMount`,o8=`focusScope.autoFocusOnUnmount`,s8={bubbles:!1,cancelable:!0},c8=`FocusScope`,l8=d.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=d.useState(null),l=W6(i),u=W6(a),f=d.useRef(null),m=w6(t,e=>c(e)),h=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let e=function(e){if(h.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:g8(f.current,{select:!0})},t=function(e){if(h.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||g8(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&g8(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,h.paused]),d.useEffect(()=>{if(s){_8.add(h);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(a8,s8);s.addEventListener(a8,l),s.dispatchEvent(t),t.defaultPrevented||(u8(b8(f8(s)),{select:!0}),document.activeElement===e&&g8(s))}return()=>{s.removeEventListener(a8,l),setTimeout(()=>{let t=new CustomEvent(o8,s8);s.addEventListener(o8,u),s.dispatchEvent(t),t.defaultPrevented||g8(e??document.body,{select:!0}),s.removeEventListener(o8,u),_8.remove(h)},0)}}},[s,l,u,h]);let g=d.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=d8(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&g8(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&g8(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,p.jsx)(H6.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});l8.displayName=c8;function u8(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(g8(r,{select:t}),document.activeElement!==n)return}function d8(e){let t=f8(e);return[p8(t,e),p8(t.reverse(),e)]}function f8(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function p8(e,t){for(let n of e)if(!m8(n,{upTo:t}))return n}function m8(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function h8(e){return e instanceof HTMLInputElement&&`select`in e}function g8(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&h8(e)&&t&&e.select()}}var _8=v8();function v8(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=y8(e,t),e.unshift(t)},remove(t){e=y8(e,t),e[0]?.resume()}}}function y8(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function b8(e){return e.filter(e=>e.tagName!==`A`)}var x8=`Portal`,S8=d.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=d.useState(!1);O6(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?f.default.createPortal((0,p.jsx)(H6.div,{...r,ref:t}),o):null});S8.displayName=x8;function C8(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}var w8=e=>{let{present:t,children:n}=e,r=T8(t),i=typeof n==`function`?n({present:r.isPresent}):d.Children.only(n),a=w6(r.ref,Wre(i));return typeof n==`function`||r.isPresent?d.cloneElement(i,{ref:a}):null};w8.displayName=`Presence`;function T8(e){let[t,n]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef(`none`),[o,s]=C8(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return d.useEffect(()=>{let e=E8(r.current);a.current=o===`mounted`?e:`none`},[o]),O6(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=E8(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),O6(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=E8(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=E8(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:d.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function E8(e){return e?.animationName||`none`}function Wre(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var D8=0;function Gre(){d.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??O8()),document.body.insertAdjacentElement(`beforeend`,e[1]??O8()),D8++,()=>{D8===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),D8--}},[])}function O8(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var k8=Hi(),A8=function(){},j8=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:A8,onWheelCapture:A8,onTouchMoveCapture:A8}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Oi(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=zi([n,t]),w=Di(Di({},x),i);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:k8,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?u.cloneElement(u.Children.only(s),Di(Di({},w),{ref:C})):u.createElement(y,Di({},w,{className:c,ref:C}),s))});j8.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},j8.classNames={fullWidth:Mi,zeroRight:ji};var M8=!1;if(typeof window<`u`)try{var N8=Object.defineProperty({},`passive`,{get:function(){return M8=!0,!0}});window.addEventListener(`test`,N8,N8),window.removeEventListener(`test`,N8,N8)}catch{M8=!1}var P8=M8?{passive:!1}:!1,Kre=function(e){return e.tagName===`TEXTAREA`},F8=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Kre(e)&&n[t]===`visible`)},qre=function(e){return F8(e,`overflowY`)},Jre=function(e){return F8(e,`overflowX`)},I8=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),L8(e,r)){var i=R8(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Yre=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Xre=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},L8=function(e,t){return e===`v`?qre(t):Jre(t)},R8=function(e,t){return e===`v`?Yre(t):Xre(t)},Zre=function(e,t){return e===`h`&&t===`rtl`?-1:1},Qre=function(e,t,n,r,i){var a=Zre(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=R8(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&L8(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},z8=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B8=function(e){return[e.deltaX,e.deltaY]},V8=function(e){return e&&`current`in e?e.current:e},$re=function(e,t){return e[0]===t[0]&&e[1]===t[1]},eie=function(e){return`
|
|
179
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
180
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
181
|
+
`},tie=0,H8=[];function nie(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),i=u.useState(tie++)[0],a=u.useState(ta)[0],o=u.useRef(e);u.useEffect(function(){o.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ai([e.lockRef.current],(e.shards||[]).map(V8),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=u.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=z8(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=I8(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=I8(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return Qre(p,t,e,p===`h`?s:c,!0)},[]),c=u.useCallback(function(e){var n=e;if(!(!H8.length||H8[H8.length-1]!==a)){var r=`deltaY`in n?B8(n):z8(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&$re(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(V8).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=u.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:rie(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=u.useCallback(function(e){n.current=z8(e),r.current=void 0},[]),f=u.useCallback(function(t){l(t.type,B8(t),t.target,s(t,e.lockRef.current))},[]),p=u.useCallback(function(t){l(t.type,z8(t),t.target,s(t,e.lockRef.current))},[]);u.useEffect(function(){return H8.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,P8),document.addEventListener(`touchmove`,c,P8),document.addEventListener(`touchstart`,d,P8),function(){H8=H8.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,P8),document.removeEventListener(`touchmove`,c,P8),document.removeEventListener(`touchstart`,d,P8)}},[]);var m=e.removeScrollBar,h=e.inert;return u.createElement(u.Fragment,null,h?u.createElement(a,{styles:eie(i)}):null,m?u.createElement(da,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rie(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var iie=Wi(k8,nie),U8=u.forwardRef(function(e,t){return u.createElement(j8,Di({},e,{ref:t,sideCar:iie}))});U8.classNames=j8.classNames;var W8=`Dialog`,[G8,aie]=E6(W8),[oie,K8]=G8(W8),q8=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=d.useRef(null),c=d.useRef(null),[l,u]=N6({prop:r,defaultProp:i??!1,onChange:a,caller:W8});return(0,p.jsx)(oie,{scope:t,triggerRef:s,contentRef:c,contentId:j6(),titleId:j6(),descriptionId:j6(),open:l,onOpenChange:u,onOpenToggle:d.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};q8.displayName=W8;var J8=`DialogTrigger`,sie=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=K8(J8,n),a=w6(t,i.triggerRef);return(0,p.jsx)(H6.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":o5(i.open),...r,ref:a,onClick:x6(e.onClick,i.onOpenToggle)})});sie.displayName=J8;var Y8=`DialogPortal`,[cie,X8]=G8(Y8,{forceMount:void 0}),Z8=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=K8(Y8,t);return(0,p.jsx)(cie,{scope:t,forceMount:n,children:d.Children.map(r,e=>(0,p.jsx)(w8,{present:n||a.open,children:(0,p.jsx)(S8,{asChild:!0,container:i,children:e})}))})};Z8.displayName=Y8;var Q8=`DialogOverlay`,$8=d.forwardRef((e,t)=>{let n=X8(Q8,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=K8(Q8,e.__scopeDialog);return a.modal?(0,p.jsx)(w8,{present:r||a.open,children:(0,p.jsx)(uie,{...i,ref:t})}):null});$8.displayName=Q8;var lie=I6(`DialogOverlay.RemoveScroll`),uie=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=K8(Q8,n);return(0,p.jsx)(U8,{as:lie,allowPinchZoom:!0,shards:[i.contentRef],children:(0,p.jsx)(H6.div,{"data-state":o5(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),e5=`DialogContent`,t5=d.forwardRef((e,t)=>{let n=X8(e5,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=K8(e5,e.__scopeDialog);return(0,p.jsx)(w8,{present:r||a.open,children:a.modal?(0,p.jsx)(die,{...i,ref:t}):(0,p.jsx)(fie,{...i,ref:t})})});t5.displayName=e5;var die=d.forwardRef((e,t)=>{let n=K8(e5,e.__scopeDialog),r=d.useRef(null),i=w6(t,n.contentRef,r);return d.useEffect(()=>{let e=r.current;if(e)return Ga(e)},[]),(0,p.jsx)(n5,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:x6(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:x6(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:x6(e.onFocusOutside,e=>e.preventDefault())})}),fie=d.forwardRef((e,t)=>{let n=K8(e5,e.__scopeDialog),r=d.useRef(!1),i=d.useRef(!1);return(0,p.jsx)(n5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),n5=d.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=K8(e5,n),c=d.useRef(null),l=w6(t,c);return Gre(),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(l8,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,p.jsx)(Q6,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":o5(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(_ie,{titleId:s.titleId}),(0,p.jsx)(yie,{contentRef:c,descriptionId:s.descriptionId})]})]})}),r5=`DialogTitle`,pie=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=K8(r5,n);return(0,p.jsx)(H6.h2,{id:i.titleId,...r,ref:t})});pie.displayName=r5;var i5=`DialogDescription`,mie=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=K8(i5,n);return(0,p.jsx)(H6.p,{id:i.descriptionId,...r,ref:t})});mie.displayName=i5;var a5=`DialogClose`,hie=d.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=K8(a5,n);return(0,p.jsx)(H6.button,{type:`button`,...r,ref:t,onClick:x6(e.onClick,()=>i.onOpenChange(!1))})});hie.displayName=a5;function o5(e){return e?`open`:`closed`}var s5=`DialogTitleWarning`,[gie,c5]=T6(s5,{contentName:e5,titleName:r5,docsSlug:`dialog`}),_ie=({titleId:e})=>{let t=c5(s5),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
182
|
+
|
|
183
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
184
|
+
|
|
185
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},vie=`DialogDescriptionWarning`,yie=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c5(vie).contentName}}.`;return d.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},bie=q8,xie=Z8,Sie=$8,Cie=t5,wie=Symbol.for(`react.lazy`),l5=d.use;function Tie(e){return typeof e==`object`&&!!e&&`then`in e}function u5(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===wie&&`_payload`in e&&Tie(e._payload)}function Eie(e){let t=Die(e),n=d.forwardRef((e,n)=>{let{children:r,...i}=e;u5(r)&&typeof l5==`function`&&(r=l5(r._payload));let a=d.Children.toArray(r),o=a.find(kie);if(o){let e=o.props.children,r=a.map(t=>t===o?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return(0,p.jsx)(t,{...i,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return(0,p.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Die(e){let t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(u5(n)&&typeof l5==`function`&&(n=l5(n._payload)),d.isValidElement(n)){let e=jie(n),i=Aie(r,n.props);return n.type!==d.Fragment&&(i.ref=t?C6(t,e):e),d.cloneElement(n,i)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Oie=Symbol(`radix.slottable`);function kie(e){return d.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Oie}function Aie(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function jie(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var d5=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Eie(`Primitive.${t}`),r=d.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,p.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),f5=`[cmdk-group=""]`,p5=`[cmdk-group-items=""]`,Mie=`[cmdk-group-heading=""]`,m5=`[cmdk-item=""]`,h5=`${m5}:not([aria-disabled="true"])`,g5=`cmdk-item-select`,_5=`data-value`,Nie=(e,t,n)=>b6(e,t,n),v5=d.createContext(void 0),y5=()=>d.useContext(v5),b5=d.createContext(void 0),x5=()=>d.useContext(b5),S5=d.createContext(void 0),C5=d.forwardRef((e,t)=>{let n=D5(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=D5(()=>new Set),i=D5(()=>new Map),a=D5(()=>new Map),o=D5(()=>new Set),s=T5(e),{label:c,children:l,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=j6(),b=j6(),x=j6(),S=d.useRef(null),C=Wie();E5(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),E5(()=>{C(6,k)},[]);let w=d.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)ee(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||C(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=d.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{ee(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();C(4,()=>{ee(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Nie;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(p5);t?t.appendChild(e.parentElement===t?e:e.closest(`${p5} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${p5} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${f5}[${_5}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(_5);w.setState(`value`,e||void 0)}function ee(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(f5)?.querySelector(Mie))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return S.current?.querySelector(`${m5}[aria-selected="true"]`)}function j(){return Array.from(S.current?.querySelectorAll(h5)||[])}function M(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(_5))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(_5))}function P(e){let t=A()?.closest(f5),n;for(;t&&!n;)t=e>0?Hie(t,f5):Uie(t,f5),n=t?.querySelector(h5);n?w.setState(`value`,n.getAttribute(_5)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},te=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return d.createElement(d5.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:_&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(g5);t.dispatchEvent(e)}}}}},d.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Kie},c),A5(e,e=>d.createElement(b5.Provider,{value:w},d.createElement(v5.Provider,{value:T},e))))}),Pie=d.forwardRef((e,t)=>{let n=j6(),r=d.useRef(null),i=d.useContext(S5),a=y5(),o=T5(e),s=o.current?.forceMount??i?.forceMount;E5(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=k5(n,r,[e.value,e.children,r],e.keywords),l=x5(),u=O5(e=>e.value&&e.value===c.current),f=O5(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);d.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(g5,p),()=>t.removeEventListener(g5,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...b}=e;return d.createElement(d5.div,{ref:C6(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),Fie=d.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=j6(),s=d.useRef(null),c=d.useRef(null),l=j6(),u=y5(),f=O5(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);E5(()=>u.group(o),[]),k5(o,s,[e.value,e.heading,c]);let p=d.useMemo(()=>({id:o,forceMount:i}),[i]);return d.createElement(d5.div,{ref:C6(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:f?void 0:!0},n&&d.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),A5(e,e=>d.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},d.createElement(S5.Provider,{value:p},e))))}),Iie=d.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=d.useRef(null),a=O5(e=>!e.search);return!n&&!a?null:d.createElement(d5.div,{ref:C6(i,t),...r,"cmdk-separator":``,role:`separator`})}),Lie=d.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=x5(),o=O5(e=>e.search),s=O5(e=>e.selectedItemId),c=y5();return d.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),d.createElement(d5.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Rie=d.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=d.useRef(null),o=d.useRef(null),s=O5(e=>e.selectedItemId),c=y5();return d.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),d.createElement(d5.div,{ref:C6(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},A5(e,e=>d.createElement(`div`,{ref:C6(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),zie=d.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return d.createElement(bie,{open:n,onOpenChange:r},d.createElement(xie,{container:o},d.createElement(Sie,{"cmdk-overlay":``,className:i}),d.createElement(Cie,{"aria-label":e.label,"cmdk-dialog":``,className:a},d.createElement(C5,{ref:t,...s}))))}),Bie=d.forwardRef((e,t)=>O5(e=>e.filtered.count===0)?d.createElement(d5.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Vie=d.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return d.createElement(d5.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},A5(e,e=>d.createElement(`div`,{"aria-hidden":!0},e)))}),w5=Object.assign(C5,{List:Rie,Item:Pie,Input:Lie,Group:Fie,Separator:Iie,Dialog:zie,Empty:Bie,Loading:Vie});function Hie(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Uie(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function T5(e){let t=d.useRef(e);return E5(()=>{t.current=e}),t}var E5=typeof window>`u`?d.useEffect:d.useLayoutEffect;function D5(e){let t=d.useRef();return t.current===void 0&&(t.current=e()),t}function O5(e){let t=x5(),n=()=>e(t.snapshot());return d.useSyncExternalStore(t.subscribe,n,n)}function k5(e,t,n,r=[]){let i=d.useRef(),a=y5();return E5(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(_5,s),i.current=s}),i}var Wie=()=>{let[e,t]=d.useState(),n=D5(()=>new Map);return E5(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Gie(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function A5({asChild:e,children:t},n){return e&&d.isValidElement(t)?d.cloneElement(Gie(t),{ref:t.ref},n(t.props.children)):n(t)}var Kie={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function j5({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:V(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var qie=qn(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function M5({className:e,align:t=`inline-start`,...n}){return(0,p.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:V(qie({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function Jie({className:e,...t}){return(0,p.jsx)(`span`,{className:V(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function Yie({className:e,...t}){return(0,p.jsx)(lx,{"data-slot":`input-group-control`,className:V(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function Xie({className:e,...t}){return(0,p.jsx)(w5,{"data-slot":`command`,className:V(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function Zie({className:e,...t}){return(0,p.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,p.jsxs)(j5,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,p.jsx)(w5.Input,{"data-slot":`command-input`,className:V(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,p.jsx)(M5,{children:(0,p.jsx)(qS,{className:`size-4 shrink-0 opacity-50`})})]})})}function Qie({className:e,...t}){return(0,p.jsx)(w5.List,{"data-slot":`command-list`,className:V(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function $ie({className:e,...t}){return(0,p.jsx)(w5.Empty,{"data-slot":`command-empty`,className:V(`py-6 text-center text-sm`,e),...t})}function N5({className:e,...t}){return(0,p.jsx)(w5.Group,{"data-slot":`command-group`,className:V(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function P5({className:e,children:t,...n}){return(0,p.jsxs)(w5.Item,{"data-slot":`command-item`,className:V(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,p.jsx)(vS,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function eae({search:e,onSearchChange:t,hasValidClipboardItem:n,onPasteFromClipboard:r,groupedOptions:i,getCategoryLabel:a,onSelectOption:o,onBack:s}){let c=G(`addItemDialog.blankItem`);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(i6,{onBack:s})}),(0,p.jsxs)(Xie,{className:`border-none rounded-t-none`,shouldFilter:!1,children:[(0,p.jsx)(Zie,{placeholder:c(`searchPlaceholder`),value:e,onValueChange:t,className:`border-none rounded-none focus:ring-0`,autoFocus:!0}),(0,p.jsxs)(Qie,{className:`max-h-96 border-border`,children:[(0,p.jsx)($ie,{children:c(`noItemTypesFound`)}),n&&(0,p.jsx)(N5,{heading:c(`clipboardHeading`),children:(0,p.jsxs)(P5,{value:c(`pasteFromClipboard`),onSelect:r,className:`flex items-center gap-3 px-2 py-1.5 cursor-pointer border border-border mb-1`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-center size-7`,children:(0,p.jsx)(mte,{className:`w-4 h-4`})}),(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`div`,{className:`font-medium`,children:c(`pasteFromClipboard`)}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:c(`pasteFromClipboardDescription`)})]})]})}),i.map(([e,t])=>(0,p.jsx)(N5,{heading:a(e),children:t.map(e=>{let t=e.icon;return(0,p.jsxs)(P5,{value:e.label,onSelect:()=>o(e),className:`flex items-center gap-3 px-2 py-1.5 cursor-pointer border border-border mb-1`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-center size-7`,children:(0,p.jsx)(t,{className:V(`w-4 h-4`,e.defaultItemClassName)})}),(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.description})]})]},e.key)})},e))]})]})]})}function tae({options:e,optionGroupRef:t,activeIndex:n,isFocused:r,setActiveIndex:i,onGroupFocus:a,onGroupBlur:o,onGroupKeyDown:s,onSelectOption:c}){let l=G(`addItemDialog.entry`);return(0,p.jsx)(`div`,{ref:t,role:`listbox`,"aria-label":l(`ariaLabel`),"aria-activedescendant":`entry-option-${e[n]?.id}`,tabIndex:0,onFocus:a,onBlur:o,onKeyDown:s,className:`grid grid-cols-1 sm:grid-cols-2 gap-3 rounded-xl outline-none`,children:e.map((e,t)=>{let a=e.icon;return(0,p.jsxs)(`button`,{id:`entry-option-${e.id}`,type:`button`,onClick:()=>c(e),onMouseEnter:()=>i(t),tabIndex:-1,role:`option`,"aria-selected":t===n,"aria-disabled":!e.enabled||void 0,className:V(`relative rounded-xl border border-border bg-background p-4 text-left transition-colors outline-none`,t===n&&r&&`border-ring ring-3 ring-ring/50 bg-accent/20`,e.enabled?`cursor-pointer`:`cursor-not-allowed opacity-80`),children:[!e.enabled&&(0,p.jsx)(`span`,{className:`absolute right-3 top-3 inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:l(`comingSoon`)}),(0,p.jsx)(`span`,{className:`mb-3 inline-flex size-10 items-center justify-center rounded-lg bg-white text-muted-foreground shadow-xs`,children:(0,p.jsx)(a,{className:`size-5`})}),(0,p.jsx)(`div`,{className:`font-semibold text-base text-foreground`,children:e.title}),(0,p.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.description})]},e.id)})})}function nae({options:e,optionGroupRef:t,activeIndex:n,isFocused:r,setActiveIndex:i,onGroupFocus:a,onGroupBlur:o,onGroupKeyDown:s,onSelectOption:c,onBack:l}){let u=G(`addItemDialog.structure`);return(0,p.jsxs)(`div`,{className:`space-y-3`,children:[(0,p.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,p.jsx)(i6,{onBack:l})}),(0,p.jsx)(`div`,{ref:t,role:`listbox`,"aria-label":u(`ariaLabel`),"aria-activedescendant":e[n]?`structure-option-${e[n].itemType}`:void 0,tabIndex:0,onFocus:a,onBlur:o,onKeyDown:s,className:`space-y-2 outline-none`,children:e.map((e,t)=>{let a=e.icon;return(0,p.jsx)(`button`,{id:`structure-option-${e.itemType}`,type:`button`,tabIndex:-1,role:`option`,"aria-selected":t===n,onClick:()=>c(e),onMouseEnter:()=>i(t),className:V(`w-full rounded-xl border border-border bg-background px-4 py-3 text-left transition-colors outline-none`,t===n&&r&&`border-ring ring-3 ring-ring/50 bg-accent/20`,`hover:bg-accent/40`),children:(0,p.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-md bg-white text-muted-foreground shadow-xs`,children:(0,p.jsx)(a,{className:V(`size-4`,e.defaultItemClassName)})}),(0,p.jsxs)(`span`,{children:[(0,p.jsx)(`span`,{className:`block font-semibold`,children:e.label}),(0,p.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]})},e.itemType)})})]})}var rae=()=>{let e=G(`addItemDialog`),{language:t}=vw(),{addItemDialogOpen:n,setAddItemDialogOpen:r,targetParentId:i,setPreferredPreviewItemId:a}=nL(),o=yw(),s=Sw(),c=W(e=>e.editorItemRegistry),l=W(e=>e.addItem),d=W(e=>e.pasteItem),f=W(e=>e.commitByUser),{selectedItemId:m}=Ow(),[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(`entry`),[y,b]=(0,u.useState)(``),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(()=>{if(!(typeof window>`u`))return localStorage.getItem(`case.survey-editor.last-used-item-type`)??void 0}),[T,E]=vC(),D=!!o?.generateItemFromIntent,O=(0,u.useMemo)(()=>[{id:`structure`,title:e(`entry.structure.title`),description:e(`entry.structure.description`),icon:jS,enabled:!0},{id:`blank-item`,title:e(`entry.blankItem.title`),description:e(`entry.blankItem.description`),icon:Pte,enabled:!0},{id:`ai`,title:e(`entry.ai.title`),description:e(`entry.ai.description`),icon:YS,enabled:!1},{id:`catalogue`,title:e(`entry.catalogue.title`),description:e(`entry.catalogue.description`),icon:pS,enabled:!1}],[e]),ee=(0,u.useCallback)(e=>Ix(e,c.categoryLabels,t),[c.categoryLabels,t]),k=(0,u.useMemo)(()=>O.map(e=>e.id===`ai`?{...e,enabled:D}:e),[O,D]),A=(0,u.useMemo)(()=>Object.values(c.definitions).filter(e=>!e.isRootOnly).filter(e=>!!c.coreRegistry[e.itemType]).map(e=>({itemType:e.itemType,key:e.itemType,label:Fx(e.infos.labelByLocale,t),description:Fx(e.infos.descriptionByLocale,t),defaultItemClassName:e.infos.defaultItemClassName,icon:e.infos.icon,categories:e.infos.categories})),[c,t]),j=(0,u.useMemo)(()=>A.filter(e=>Z3.has(e.itemType)),[A]),M=(0,u.useMemo)(()=>A.filter(e=>!Z3.has(e.itemType)),[A]),N=(0,u.useMemo)(()=>{if(!h.trim())return M;let e=h.toLowerCase();return M.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.categories.some(t=>t.toLowerCase().includes(e)))},[M,h]),P=(0,u.useMemo)(()=>{let e=[...N].sort((e,t)=>e.label.localeCompare(t.label)),t=new Set(X3),n=e.filter(e=>t.has(e.itemType)),r=e.filter(e=>!t.has(e.itemType)),i=C?e.find(e=>e.itemType===C):void 0;return[...i?[i]:[],...n.filter(e=>e.itemType!==i?.itemType),...r.filter(e=>e.itemType!==i?.itemType)]},[N,C]),F=(0,u.useMemo)(()=>{let e={};return P.forEach(t=>{t.categories.forEach(n=>{n!==`structure`&&(e[n]||(e[n]=[]),e[n].push(t))})}),Object.entries(e).filter(([,e])=>e.length>0)},[P]),I=n6({editor:s,selectedItemId:m??null,targetParentId:i}),te=(0,u.useMemo)(()=>I?I.itemLabel?`${I.itemKey} - ${I.itemLabel}`:I.itemKey:null,[I]),ne=(0,u.useMemo)(()=>{if(!T)return!1;try{return cL.isValidClipboardData(JSON.parse(T))}catch{return!1}},[T]),{handleSelectOption:re,pasteFromClipboard:ie,createItemsFromIntent:ae}=e6({editorItemRegistry:c,addItem:l,pasteItem:d,commitByUser:f,setPreferredPreviewItemId:a,closeDialog:()=>{r(!1),v(`entry`),g(``)},targetGroupId:I?.id,rootItemId:s?.survey.rootItem?.id,clipboardValue:T,setLastUsedItemType:w}),oe=r6({options:j,onSelect:re,rowSize:1}),se=t=>{switch(t.id){case`structure`:oe.reset(0),v(`structure`),oe.focusGroup();break;case`blank-item`:v(`blank-item`);break;case`ai`:if(!D){OC.info(e(`aiAssistantNotAvailable`));return}v(`ai`);break;case`catalogue`:OC.info(e(`catalogueComingSoon`));break;default:break}},ce=r6({options:k,onSelect:se,rowSize:2}),le=()=>{ce.reset(0),v(`entry`),g(``),S(!1),ce.focusGroup()},ue=async()=>{if(!o?.generateItemFromIntent||!s||!I?.id){OC.error(e(`aiGenerationUnavailable`));return}let t=y.trim();if(t.length<3){OC.info(e(`aiNeedDescription`));return}S(!0);try{let e=sL(s.survey,{purpose:`item-generation`,focusItemId:I.id});ae((await o.generateItemFromIntent({intent:t,targetParentId:I.id,allowedItemTypes:A.map(e=>e.itemType),maxItems:5,locale:`en`,context:e},{mode:`user`})).items)}catch(t){console.error(`Failed to generate items from AI intent:`,t),OC.error(e(`aiGenerationFailed`))}finally{S(!1)}};return(0,p.jsx)(xL,{open:n,onOpenChange:e=>{if(r(e),e){ce.reset(0),oe.reset(0),E();return}v(`entry`),g(``),b(``),S(!1),ce.reset(0),oe.reset(0)},children:(0,p.jsxs)(SL,{className:`sm:max-w-2xl`,onOpenAutoFocus:e=>{switch(e.preventDefault(),_){case`structure`:oe.focusGroup();break;case`entry`:ce.focusGroup();break;default:break}},children:[(0,p.jsxs)(CL,{children:[(0,p.jsx)(TL,{children:e(`title`)}),(0,p.jsx)(EL,{children:I?(0,p.jsxs)(`span`,{className:`flex items-center gap-2 p-2 mt-1 bg-muted/50 rounded-lg border border-border`,children:[(0,p.jsx)(MS,{className:`w-4 h-4 text-muted-foreground`}),(0,p.jsxs)(`span`,{className:`text-xs`,children:[e(`addingTo`),` `,(0,p.jsx)(`span`,{className:`font-medium`,children:te}),I.itemCount>0&&(0,p.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e(`itemCount`,{count:I.itemCount})]})]})]}):e(`chooseHowToExpand`)})]}),(()=>{switch(_){case`entry`:return(0,p.jsx)(tae,{options:k,optionGroupRef:ce.groupRef,activeIndex:ce.activeIndex,isFocused:ce.isFocused,setActiveIndex:ce.setActiveIndex,onGroupFocus:ce.handleGroupFocus,onGroupBlur:ce.handleGroupBlur,onGroupKeyDown:ce.handleGroupKeyDown,onSelectOption:se});case`structure`:return(0,p.jsx)(nae,{options:j,optionGroupRef:oe.groupRef,activeIndex:oe.activeIndex,isFocused:oe.isFocused,setActiveIndex:oe.setActiveIndex,onGroupFocus:oe.handleGroupFocus,onGroupBlur:oe.handleGroupBlur,onGroupKeyDown:oe.handleGroupKeyDown,onSelectOption:re,onBack:le});case`blank-item`:return(0,p.jsx)(eae,{search:h,onSearchChange:g,hasValidClipboardItem:ne,onPasteFromClipboard:ie,groupedOptions:F,getCategoryLabel:ee,onSelectOption:re,onBack:le});case`ai`:return(0,p.jsx)(a6,{intent:y,onIntentChange:b,onGenerate:()=>{ue()},onBack:le,isGenerating:x,isEnabled:D});default:return null}})(),(0,p.jsx)(wL,{children:(0,p.jsx)(`span`,{className:`text-muted-foreground text-xs items-center gap-1 font-medium`,children:e(`footer.${_}`)})})]})})};function iae({className:e,...t}){return(0,p.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:V(e),...t})}function aae({className:e,...t}){return(0,p.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:V(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function F5({className:e,...t}){return(0,p.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:V(`inline-flex items-center gap-1`,e),...t})}function oae({children:e,className:t,...n}){return(0,p.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:V(`[&>svg]:size-3.5`,t),...n,children:e??(0,p.jsx)(xS,{})})}var I5=({itemId:e,children:t})=>{let{navigateToItem:n}=Ow();return(0,p.jsx)(`button`,{className:`ring-offset-2 rounded-sm outline-none hover:ring-[3px] hover:ring-ring/50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,onClick:()=>n(e),children:t})},sae=()=>{let e=G(`toolbar.breadcrumbs`),t=Cw(),{selectedItemId:n,navigateToItem:r}=Ow(),{openAddItemDialog:i}=nL();return(0,p.jsx)(`div`,{className:`px-4 py-1.5 rounded-xl bg-(--surface-bg-color) backdrop-blur-xs border border-border w-fit`,children:(0,p.jsx)(iae,{children:(0,p.jsxs)(aae,{children:[(0,p.jsx)(F5,{children:(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(I5,{itemId:t?.rootItem?.id??``,children:(0,p.jsxs)(`span`,{className:`font-bold flex items-center gap-2 font-mono text-xs`,children:[(0,p.jsx)(jS,{className:`size-4 text-muted-foreground`}),t?.surveyKey]})})}),(0,p.jsx)(nw,{children:e(`surveySettings`)})]})}),(a=>{if(!a||!t||!t.surveyItems.has(a))return null;try{let o=t.getItemPath(a);if(!o||o.length<1)return null;o.push(a);let s=o.slice(1),c=s.length;return s.map((a,o)=>{let s=t.surveyItems.get(a);if(!s)return null;let l=o===c-1,d=t.getSiblings(a),f=t.getParentItem(a)?.id;return(0,p.jsxs)(u.Fragment,{children:[(0,p.jsx)(oae,{}),(0,p.jsx)(F5,{children:l?(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{className:`ring-offset-2 rounded-sm outline-none hover:ring-[3px] hover:ring-ring/50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,children:(0,p.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-xs`,children:[s.key,(0,p.jsx)(`span`,{children:(0,p.jsx)(yS,{className:`size-4 text-muted-foreground`})})]})}),(0,p.jsxs)(uC,{align:`start`,className:`border-border max-h-64 overflow-y-auto w-fit`,children:[(0,p.jsx)(mC,{className:`text-xs`,children:e(`selectSibling`)}),(0,p.jsx)(fC,{value:n??void 0,onValueChange:r,children:d?.map(e=>(0,p.jsx)(pC,{value:e?.id,className:`font-mono text-xs data-[state=checked]:bg-muted`,children:e?.key},e?.id))}),(0,p.jsx)(hC,{}),(0,p.jsx)(dC,{onClick:()=>{f&&i(f)},children:(0,p.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,p.jsx)(KS,{className:`size-4 text-muted-foreground`}),(0,p.jsx)(`span`,{className:`flex-1 text-nowrap`,children:e(`addNewSibling`)})]})})]})]}):(0,p.jsx)(I5,{itemId:a,children:(0,p.jsxs)(`span`,{className:`font-bold flex items-center gap-2 font-mono text-xs`,children:[(0,p.jsx)(xte,{className:`size-4 text-muted-foreground`}),s.key]})})})]},a)})}catch{return null}})(n)]})})})},L5=e=>{(0,u.useEffect)(()=>{let t=t=>{let n=t.target;if(!(n instanceof HTMLElement&&(n.isContentEditable||n.closest(`[contenteditable="true"]`)||n.closest(`input, textarea, select`)))&&(t.metaKey||t.ctrlKey))switch(t.key.toLowerCase()){case`s`:t.preventDefault(),e.onSave?.();break;case`z`:t.preventDefault(),t.shiftKey?e.onRedo?.():e.onUndo?.();break;case`y`:!t.metaKey&&t.ctrlKey&&(t.preventDefault(),e.onRedo?.());break;case`k`:if(t.shiftKey||t.altKey)break;t.preventDefault(),e.onSearch?.();break;default:break}};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e])},R5=20,cae=({isOpen:e,onOpenChange:t})=>{let n=G(`toolbar.search`),r=Cw(),i=W(e=>e.editorItemRegistry),{navigateToItem:a}=Ow(),[o,s]=(0,u.useState)(``),[c,l]=(0,u.useState)(0),d=(0,u.useRef)(null),f=(0,u.useRef)([]),m=(0,u.useMemo)(()=>{if(!r?.surveyItems||!o.trim())return[];let e=[],t=new Set,n=o.toLowerCase().trim();return Array.from(r.surveyItems.entries()).forEach(([a,o])=>{if(!o||!a||t.has(a))return;let s=o.itemType??o.type;if(e.length>=R5)return;let c=i.definitions[s]?.searchAdapters??[],l=NI(o,i),u=AI(o),d=r.getItemKey(o.id)?.fullKey??a;for(let i of c){let s=i({itemId:o.id,survey:r,searchTerm:n})?.[0];if(s){e.push({itemId:a,fullKey:d,item:o,itemTypeInfos:l,itemColor:u,matchType:s.matchType===`key`?`key`:s.matchType===`label`?`label`:s.matchType===`itemType`?`itemType`:`content`,matchText:s.matchText}),t.add(a);return}}}),e.slice(0,R5)},[i,o,r]),h=(0,u.useCallback)(e=>{a(e.itemId),t(!1),s(``),l(0)},[a,t]),g=(0,u.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),l(e=>Math.min(e+1,m.length-1))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),m[c]&&h(m[c])):e.key===`Escape`&&t(!1)},[m,c,h,t]),_=(0,u.useCallback)(e=>{t(e),e||(s(``),l(0))},[t]);(0,u.useEffect)(()=>{f.current=f.current.slice(0,m.length)},[m.length]),(0,u.useEffect)(()=>{let e=f.current[c];e&&d.current&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},[c,m.length]);let v=e=>{switch(e){case`key`:return(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,p.jsx)(IS,{className:`size-3`}),n(`key`)]});case`content`:return(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,p.jsx)(yte,{className:`size-3`}),n(`content`)]});case`label`:return(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,p.jsx)(Fte,{className:`size-3`}),n(`label`)]});case`itemType`:return(0,p.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-0.5`,children:[(0,p.jsx)(tC,{className:`size-3`}),n(`itemType`)]});default:return null}},y=(e,t)=>{if(!t.trim())return e;let n=RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)})`,`gi`);return e.split(n).map((e,t)=>n.test(e)?(0,p.jsx)(`mark`,{className:`bg-yellow-200 rounded px-0.5`,children:e},t):e)};return(0,p.jsx)(xL,{open:e,onOpenChange:_,children:(0,p.jsxs)(SL,{className:`sm:max-w-2xl p-0 border-border overflow-hidden`,children:[(0,p.jsx)(TL,{className:`sr-only`,children:n(`title`)}),(0,p.jsxs)(`div`,{className:`flex flex-col`,children:[(0,p.jsxs)(`div`,{className:`flex items-center px-4 py-3 pe-12 border-b border-border`,children:[(0,p.jsx)(qS,{className:`size-5 text-muted-foreground mr-2`}),(0,p.jsx)(lx,{placeholder:n(`placeholder`),value:o,onChange:e=>{s(e.target.value),l(0)},onKeyDown:g,className:`focus-visible:ring-0 text-sm`,autoFocus:!0}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground ml-2`,children:[(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-xs bg-muted rounded`,children:`↑↓`}),n(`navigate`),(0,p.jsx)(`kbd`,{className:`px-1.5 py-0.5 text-xs bg-muted rounded ml-1`,children:`↵`}),n(`select`)]})]}),(0,p.jsx)(`div`,{ref:d,className:`max-h-96 overflow-y-auto divide-y divide-border`,children:m.length>0?m.map((e,t)=>(0,p.jsxs)(`div`,{ref:e=>{f.current[t]=e},className:`px-4 py-3 cursor-pointer space-y-2 ${t===c?`bg-muted`:`hover:bg-muted/50`}`,onClick:()=>h(e),children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[(0,p.jsx)(DI,{typeInfos:e.itemTypeInfos,color:e.itemColor,iconClassName:`size-5`}),(0,p.jsx)(`span`,{className:`text-sm font-mono grow text-ellipsis font-medium`,style:{color:e.itemColor},children:e.fullKey}),(0,p.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.item.metadata?.itemLabel})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[v(e.matchType),(0,p.jsx)(`div`,{className:`text-xs text-foreground truncate`,children:y(e.matchText,o)})]})]},e.itemId)):o.trim()?(0,p.jsx)(`div`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:n(`noItemsFound`,{searchTerm:o})}):(0,p.jsx)(`div`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:n(`startTyping`)})})]})]})})},lae=typeof navigator<`u`&&/Mac|iPod|iPhone|iPad/.test(navigator.userAgent||``),uae=()=>{let e=G(`toolbar.searchTrigger`),[t,n]=(0,u.useState)(!1);L5({onSearch:()=>n(!0)});let r=lae?`⌘K`:`Ctrl+K`;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>n(!0),className:`px-3 h-[30px] rounded-xl gap-2 bg-(--surface-bg-color) backdrop-blur-xs border border-border hover:bg-(--surface-bg-color)/60`,children:[(0,p.jsx)(qS,{className:`size-4 text-muted-foreground`}),(0,p.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`search`)}),(0,p.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 bg-muted rounded-md px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,children:(0,p.jsx)(`span`,{className:`text-xs tracking-widest`,children:r})})]})}),(0,p.jsxs)(nw,{children:[(0,p.jsx)(`p`,{children:e(`searchSurveyItems`)}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]})]}),(0,p.jsx)(cae,{isOpen:t,onOpenChange:n})]})},dae=()=>{let e=G(`toolbar.languagePicker`),t=Cw(),n=W(e=>e.selectedLocale),r=W(e=>e.setSelectedLocale),i=Dw(e=>e.navigate),{fallbackLocale:a}=vw(),o=t?.locales??[],s=o.length>0?o:[a],c=s.includes(n)?n:s[0],l=(0,u.useEffectEvent)(e=>{r(e)});return(0,u.useEffect)(()=>{n!==c&&l(c)},[c,n]),(0,p.jsxs)(cC,{children:[(0,p.jsx)(lC,{asChild:!0,children:(0,p.jsxs)(H,{variant:`outline`,size:`sm`,className:`gap-2 border-border rounded-xl h-[30px] text-muted-foreground text-xs bg-(--surface-bg-color) hover:bg-(--surface-bg-color)/60`,children:[(0,p.jsx)(Ete,{className:`size-3.5`}),c,(0,p.jsx)(yS,{className:`size-4`})]})}),(0,p.jsxs)(uC,{align:`end`,className:`w-fit`,sideOffset:8,children:[(0,p.jsx)(mC,{children:e(`languages`)}),(0,p.jsx)(fC,{value:c,onValueChange:r,children:s.map(e=>(0,p.jsx)(pC,{value:e,children:e},e))}),(0,p.jsx)(hC,{}),(0,p.jsxs)(dC,{onClick:()=>{i({view:`translation-mode`})},children:[(0,p.jsx)(WS,{className:`size-4 mr-2`}),(0,p.jsx)(`span`,{className:`text-nowrap`,children:e(`editLanguages`)})]})]})]})},fae=()=>(0,p.jsxs)(`div`,{className:V(`flex items-center gap-2 justify-between`,`flex-col @2xl/main:flex-row`,`items-start`),children:[(0,p.jsx)(sae,{}),(0,p.jsxs)(`div`,{className:V(`flex items-center gap-3`,`w-full @2xl/main:w-auto justify-between`),children:[(0,p.jsx)(uae,{}),(0,p.jsx)(dae,{})]})]}),pae=()=>{let e=G(`routes.itemEditor`);return W(e=>e.editor)?(0,p.jsx)(tL,{children:(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[(0,p.jsx)(fae,{}),(0,p.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,p.jsx)(J3,{})}),(0,p.jsx)(rae,{})]})}):(0,p.jsx)(`div`,{className:`relative flex h-full min-h-0 items-center justify-center`,children:(0,p.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(VS,{className:`size-4 animate-spin`}),e(`loading`)]})})},mae=()=>{let e=G(`routes.translationMode`),t=Dw(e=>e.navigate);return(0,p.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,children:(0,p.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-background p-8`,children:[(0,p.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>t({view:`item-editor`}),children:[(0,p.jsx)(lS,{className:`size-4`}),e(`backToItemEditor`)]}),(0,p.jsx)(`div`,{className:`w-full text-center text-muted-foreground`,children:e(`comingSoon`)})]})})},hae=()=>{let e=G(`routes.assetManager`),t=Dw(e=>e.navigate),n=F3().length;return(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-(--surface-bg-color) shadow-sm`,children:[(0,p.jsx)(`header`,{className:`shrink-0 px-1 py-2`,children:(0,p.jsxs)(H,{variant:`ghost`,onClick:()=>t({view:`item-editor`}),className:`text-muted-foreground hover:text-foreground`,children:[(0,p.jsx)(lS,{className:`size-4`}),e(`backToItemEditor`)]})}),(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:[(0,p.jsxs)(`div`,{className:`mb-4`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3`,children:[(0,p.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e(`title`)}),(0,p.jsx)(`span`,{className:`rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium tabular-nums text-muted-foreground`,children:n})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`description`)})]}),(0,p.jsx)(W3,{})]})]})},gae=()=>{let e=Dw(e=>e.location);return(0,p.jsx)(`div`,{className:V(`grow`,`flex h-full min-h-0 flex-col`),children:(0,p.jsx)(`div`,{className:`flex-1 min-h-0`,children:(()=>{switch(e.view){case`item-editor`:return(0,p.jsx)(pae,{});case`translation-mode`:return(0,p.jsx)(mae,{});case`asset-manager`:return(0,p.jsx)(hae,{})}})()})})},_ae=({onSaveRequested:e})=>{let t=G(`routes.editor`),{undo:n,redo:r,canUndo:i,canRedo:a}=W(e=>e);return L5({onSave:(0,u.useCallback)(()=>{if(e){e();return}OC.info(t(`noSaveHandler`))},[e,t]),onUndo:(0,u.useCallback)(()=>{i()&&n()?OC.success(t(`undoTriggered`)):OC.error(t(`noMoreUndo`))},[n,i,t]),onRedo:(0,u.useCallback)(()=>{a()&&r()?OC.success(t(`redoTriggered`)):OC.error(t(`noMoreRedo`))},[r,a,t])}),(0,p.jsxs)(`div`,{className:`flex h-full w-full min-h-0 flex-col @container/main`,children:[(0,p.jsx)(`div`,{className:`flex flex-1 min-h-0`,children:(0,p.jsx)(gae,{})}),(0,p.jsx)(G3,{})]})};function vae(){let e=0,t=()=>(e+=1,e);return bC((e,n)=>({sessionId:null,editor:null,changeTick:0,editorItemRegistry:{coreRegistry:{},definitions:{},playerLocalizations:vx(),categoryLabels:{...Px}},selectedLocale:`en`,setEditor:(n,r)=>{e({sessionId:n,editor:r,selectedLocale:r?.survey.locales[0]??`en`,changeTick:t()})},clearEditor:()=>{e({sessionId:null,editor:null,selectedLocale:`en`,changeTick:t()})},startNewSession:({surveyKey:r,itemRegistryEntries:i,categoryLabels:a})=>{let o=i,s=n().editorItemRegistry,c=Object.keys(s.definitions).length>0,l=o?Qx(o,{categoryLabels:a}):c?s:X9(),u=l.coreRegistry,d=We.createBlankSurvey(u,r),f=new mL(d,{pluginRegistry:u});e({sessionId:b(),editor:f,editorItemRegistry:l,selectedLocale:d.locales[0]??`en`,changeTick:t()})},setEditorItemRegistry:n=>{e({editorItemRegistry:n,changeTick:t()})},setSelectedLocale:t=>{e({selectedLocale:t})},undo:()=>{let{editor:r}=n();if(!r)return!1;let i=r.undo();return i&&e({changeTick:t()}),i},redo:()=>{let{editor:r}=n();if(!r)return!1;let i=r.redo();return i&&e({changeTick:t()}),i},canUndo:()=>n().editor?.canUndo()??!1,canRedo:()=>n().editor?.canRedo()??!1,commit:r=>{n().editor?.commit(r),e({changeTick:t()})},commitByUser:r=>{n().editor?.commit({...r,source:lL.USER}),e({changeTick:t()})},commitIfNeeded:()=>{let{editor:r}=n();r&&(r.commitIfNeeded(),e({changeTick:t()}))},jumpToIndexInHistory:r=>{let{editor:i}=n();if(!i)return!1;let a=i.jumpToIndex(r);return a&&e({changeTick:t()}),a},getUndoMeta:()=>n().editor?.getUndoMeta()??null,getRedoMeta:()=>n().editor?.getRedoMeta()??null,getUndoRedoHistory:()=>n().editor?.undoRedo.getHistory()??[],addItem:(r,i,a)=>{let{editor:o}=n();if(!o)throw Error(`No editor loaded`);o.addItem(r,i,a),e({changeTick:t()})},removeItem:(r,i=!1)=>{let{editor:a}=n();if(!a)return!1;let o=a.survey.getItemKey(r)?.fullKey??r,s=a.removeItem(r,i);return s&&!i&&a.commit({label:`Delete item: ${o}`,source:lL.USER}),s&&e({changeTick:t()}),s},moveItem:(r,i)=>{let{editor:a}=n();if(!a)return!1;let o=a.moveItem(r,i);return o&&e({changeTick:t()}),o},updateItemTranslations:(r,i)=>{let{editor:a}=n();if(!a)return!1;let o=a.updateItemTranslations(r,i);return o&&e({changeTick:t()}),o},copyItem:e=>{let{editor:t}=n();if(!t)throw Error(`No editor loaded`);return t.copyItem(e)},pasteItem:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);let o=a.pasteItem(r,i);return e({changeTick:t()}),o},getItemDataCopy:e=>{let{editor:t}=n();if(!t)throw Error(`No editor loaded`);return t.getItemDataCopy(e)},getRootItem:()=>n().editor?.survey.rootItem,updateItem:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);a.updateItem(r,i),e({changeTick:t()})},updateSurveyTranslations:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateSurveyTranslations(r),e({changeTick:t()})},getMaxItemsPerPage:()=>n().editor?.getMaxItemsPerPage(),updateMaxItemsPerPage:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateMaxItemsPerPage(r),e({changeTick:t()})},getMetadata:()=>n().editor?.getMetadata(),updateMetadata:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.updateMetadata(r),e({changeTick:t()})},getTemplateValue:e=>n().editor?.getTemplateValue(e),getTemplateValues:()=>n().editor?.getTemplateValues()??new Map,setTemplateValue:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);a.setTemplateValue(r,i),e({changeTick:t()})},removeTemplateValue:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.removeTemplateValue(r),e({changeTick:t()})},getAsset:e=>n().editor?.getAsset(e),getAssets:()=>n().editor?.getAssets()??new Map,setAsset:(r,i)=>{let{editor:a}=n();if(!a)throw Error(`No editor loaded`);a.setAsset(r,i),e({changeTick:t()})},removeAsset:r=>{let{editor:i}=n();if(!i)throw Error(`No editor loaded`);i.removeAsset(r),e({changeTick:t()})},getMemoryUsage:()=>n().editor?.getMemoryUsage()??{totalMB:0,entries:0},getUndoRedoConfig:()=>n().editor?.getUndoRedoConfig()??{}}))}var yae=({children:e})=>{let[t]=(0,u.useState)(()=>vae());return(0,p.jsx)(SC.Provider,{value:t,children:e})},bae=({children:e,navigationAdapter:t=null})=>(0,p.jsx)(yae,{children:(0,p.jsx)(Ew,{adapter:t,children:e})});function xae(e,t,n){if(e)return Qx(Yx(e,t),{categoryLabels:n});let r=Yx(Y9(),t);return n&&Object.keys(n).length>0?Qx(r,{categoryLabels:n}):Qx(r)}var Sae=({initialEditorState:e,initialSessionId:t,fallbackLocale:n=`en`,language:r,localizations:i,dateLocales:a,itemRegistryEntries:o,categoryLabels:s,onEditorStateChange:c,persistDebounceMs:l=500,helpLink:d=`https://case-framework.github.io/case-docs/`,aiProvider:f=null,onSaveRequested:m})=>{let h=(0,u.useMemo)(()=>ow(i),[i]),g=(0,u.useMemo)(()=>Xx(h),[h]),_=(0,u.useMemo)(()=>Ux(g,s),[s,g]),v=W(e=>e.sessionId),y=W(e=>e.editor),x=W(e=>e.changeTick),S=W(e=>e.setEditor),C=W(e=>e.setEditorItemRegistry),w=W(e=>e.clearEditor),T=(0,u.useRef)(!1),E=(0,u.useMemo)(()=>xae(o,h,_),[o,_,h]),D=E.coreRegistry,O=(0,u.useEffectEvent)((e,t)=>{S(e,mL.fromJson(t,D))});return(0,u.useEffect)(()=>{if(!e)return;let n=t!==void 0&&v!==null&&v!==t;if(T.current&&!n&&y)return;n&&(T.current=!1);let r=mL.fromJson(e,D);O(t??b(),r.toJson()),T.current=!0},[D,y,e,t,v]),(0,u.useEffect)(()=>()=>{w()},[w]),(0,u.useEffect)(()=>{C(E)},[E,C]),A3({sessionId:v,editor:y,changeTick:x,persistDebounceMs:l,onEditorStateChange:c}),(0,p.jsx)(`div`,{className:`survey-editor absolute inset-0`,children:(0,p.jsx)(_w,{helpLink:d,aiProvider:f,fallbackLocale:n,language:r,localizations:h,dateLocales:a,children:(0,p.jsx)(_ae,{onSaveRequested:m})})})},Cae=e=>(0,p.jsx)(bae,{navigationAdapter:e.navigationAdapter,children:(0,p.jsx)(Sae,{...e})});function wae(e,t){return new mL(We.createBlankSurvey(e,t),{pluginRegistry:e}).toJson()}function z5(e,t){return new mL(We.fromJson(e,t),{pluginRegistry:t}).toJson()}function Tae(e,t){let n=JSON.parse(e);if(Aae(n)){let e=mL.fromJson(n,t);return{format:`serialized-editor`,sessionId:b(),state:e.toJson()}}return{format:`raw-survey`,sessionId:b(),state:z5(n,t)}}function Eae(e){return JSON.stringify(e.survey,null,2)}function Dae(e,t=`survey`){let n=kae(e)?.trim();return n?Oae(n):t}function Oae(e){return e.replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``)||`survey`}function kae(e){let t=e.survey.surveyItems.find(e=>!e||typeof e.key!=`string`||!e.config||typeof e.config!=`object`?!1:e.config.isRoot===!0);return t?.key?t.key:e.survey.surveyItems[0]?.key}function Aae(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.version==`string`&&typeof t.hasUncommittedChanges==`boolean`&&typeof t.undoRedo==`object`&&t.undoRedo!==null&&typeof t.survey==`object`&&t.survey!==null}var B5=`↵`;function jae({text:e}){let t=e.split(/\r?\n/);return t.length<=1?e:(0,p.jsx)(p.Fragment,{children:t.map((e,t)=>(0,p.jsxs)(u.Fragment,{children:[t>0?(0,p.jsx)(`span`,{className:`text-muted-foreground/90 shrink-0 px-0.5 font-mono text-[0.85em] select-none`,"aria-hidden":!0,children:B5}):null,e]},`opt-label-line-${t}`))})}function Mae({item:e,displayConditionLabel:t,embeddedFormLabel:n,className:r,isOverlay:i,isSourceWhileDragging:a,surfaceOnParent:o}){let s=e.labelContent?Ve(e.labelContent).trim().length>0:!1,c=e.option.hasDisplayCondition?(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(`span`,{className:`inline-flex rounded p-1 hover:bg-muted/80`,"aria-label":t,children:(0,p.jsx)(PS,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(nw,{side:`left`,children:t})]}):null,l=Are(e.option)?(0,p.jsxs)(ew,{children:[(0,p.jsx)(tw,{asChild:!0,children:(0,p.jsx)(`span`,{className:`inline-flex rounded p-1 hover:bg-muted/80`,"aria-label":n,children:(0,p.jsx)(NS,{className:`size-4`,"aria-hidden":!0})})}),(0,p.jsx)(nw,{side:`left`,children:n})]}):null;return(0,p.jsxs)(`div`,{className:V(`flex w-full min-w-0 items-center gap-2 rounded-lg ps-3 py-2 text-sm transition-colors`,!i&&!o&&`hover:bg-muted/70`,i&&`border border-border bg-background shadow-md`,a&&`opacity-90 bg-muted/70 backdrop-blur-sm`,r),children:[(0,p.jsx)(`span`,{className:`inline-flex shrink-0 rounded-md bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground`,children:e.option.key??`OPTION`}),s?(0,p.jsx)(S4,{content:e.labelContent,className:`min-w-0 flex-1 truncate text-foreground`,paragraphClassName:`text-foreground/90`,singleLine:!0,singleLineNewlineIndicator:B5}):(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/90`,children:(0,p.jsx)(jae,{text:e.label})}),(0,p.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-muted-foreground`,children:[c,l]})]})}function Nae({groupId:e,item:t,index:n,displayConditionLabel:r,embeddedFormLabel:i,onEditLabel:a,onEditKey:o,onEditEmbeddedForm:s,onDuplicate:c,onDelete:l,t:d}){let[f,m]=(0,u.useState)(!1),{ref:h,isDragging:g}=TI({id:t.option.id,index:n,group:e});return(0,p.jsx)(`li`,{ref:h,className:V(`group relative touch-none`),"aria-label":d(`dragHandle`),children:(0,p.jsxs)(RI,{onOpenChange:m,children:[(0,p.jsx)(zI,{asChild:!0,children:(0,p.jsx)(`div`,{tabIndex:0,onDoubleClick:()=>a(t.option.id),className:V(`w-full rounded-lg text-start transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring`,`hover:bg-muted/70`,f&&`bg-muted/70`),children:(0,p.jsx)(Mae,{item:t,displayConditionLabel:r,embeddedFormLabel:i,isSourceWhileDragging:g,revealHandleOnHover:!0,surfaceOnParent:!0})})}),(0,p.jsxs)(VI,{className:`border-border`,children:[(0,p.jsxs)(HI,{onSelect:()=>a(t.option.id),children:[(0,p.jsx)(WS,{className:`size-4`}),d(`optionContext.editLabel`)]}),(0,p.jsxs)(HI,{onSelect:()=>o(t.option.id),children:[(0,p.jsx)(`span`,{className:`size-4 shrink-0`,"aria-hidden":!0}),d(`optionContext.editKey`)]}),(0,p.jsxs)(HI,{disabled:!0,children:[(0,p.jsx)(PS,{className:`size-4`}),d(`optionContext.editBranching`)]}),(0,p.jsxs)(HI,{onSelect:()=>s(t.option.id),children:[(0,p.jsx)(NS,{className:`size-4`}),d(`optionContext.editEmbeddedForm`)]}),(0,p.jsx)(GI,{}),(0,p.jsxs)(HI,{onSelect:()=>{c(t.option.id)},children:[(0,p.jsx)(kS,{className:`size-4`}),d(`optionContext.duplicate`)]}),(0,p.jsxs)(HI,{variant:`destructive`,onSelect:e=>{e.preventDefault(),l(t.option.id)},children:[(0,p.jsx)($S,{className:`size-4`}),d(`optionContext.delete`)]})]})]})})}var Pae=({itemId:e,items:t,onItemEditLabel:n,onItemEditKey:r,onItemEditEmbeddedForm:i,onItemDuplicate:a,onItemDelete:o,onItemsReorder:s})=>{let c=G(`defaultEditors.choiceEditor`),l=G(`defaultEditors.choiceEditor.optionIndicators`),u=l(`displayCondition`),d=l(`embeddedForm`);return(0,p.jsx)(PP,{sensors:[KN.configure({activationConstraints:[new HN.Distance({value:5})]})],onDragEnd:(e=>{if(e.canceled||!PF(e.operation)||!e.operation.source)return;let{source:n}=e.operation,{initialIndex:r,index:i}=n;if(r===i)return;let a=t.map(e=>e.option),[o]=a.splice(r,1);o&&(a.splice(i,0,o),s(a))}),modifiers:e=>[...e,G4],children:(0,p.jsx)(`div`,{className:`min-h-0 max-h-[min(22rem,50svh)] overflow-y-auto`,children:(0,p.jsx)(`ol`,{className:`space-y-0.5 p-px`,children:t.map((t,s)=>(0,p.jsx)(Nae,{groupId:e,item:t,index:s,displayConditionLabel:u,embeddedFormLabel:d,onEditLabel:n,onEditKey:r,onEditEmbeddedForm:i,onDuplicate:a,onDelete:o,t:c},t.option.id))})})})},V5=({itemId:e,locale:t,contentKey:n,label:r,placeholder:i,description:a,bare:o=!1,contentPolicy:s,wrapperClassName:c,surfaceClassName:l,contentClassName:d,placeholderClassName:f,styleControls:m,templateVariables:h,resolveImageAssetUrl:g,imageAssets:_})=>{let v=G(`history`),y=Cw(),x=CC(),S=W(e=>e.updateItemTranslations),C=W(e=>e.commitByUser),w=W(e=>e.removeAsset),T=W(e=>e.setAsset),E=(0,u.useCallback)(async e=>{let t=b(),n=await L3(e);return T(t,{kind:`image`,source:{type:`embedded`,mediaType:e.type||`application/octet-stream`,encoding:`base64`,data:n},metadata:{filename:e.name}}),t},[T]),D=(0,u.useMemo)(()=>{if(y)return{getUsageCount:e=>y.getAssetUsages(e).length,removeAsset:e=>{w(e),C({label:v(`removeSurveyAsset`)})}}},[y,w,C,v]),O=(0,u.useMemo)(()=>y?.getItemTranslations(e)?.getContent(t,n),[n,e,t,y]),ee=(0,u.useMemo)(()=>Ve(O),[O]),k=(0,u.useMemo)(()=>YQ(O,s),[s,O]),[A,j]=(0,u.useState)(ee),[M,N]=(0,u.useState)(O),[P,F]=(0,u.useState)(()=>YQ(O,s)),[I,te]=(0,u.useState)(!1),ne=(0,u.useCallback)(r=>{let i=x.getState().editor?.survey??null,a=i?.surveyItems.get(e);if(!i||!a)return;let o=i.getItemTranslations(e),s=o?.getContent(t,n),c=r?.value??A,l=r?.content??M??Fe(c),u=He(l)?void 0:l;if(JSON.stringify(s)===JSON.stringify(u))return;let d=o?.clone()??new Ae;d.setContent(t,n,u),S(e,d)&&C({label:v(`updateItemContent`)})},[C,n,M,A,x,v,e,t,S]),re=(0,u.useEffectEvent)(()=>{I&&ne({content:M,value:A})});(0,u.useEffect)(()=>()=>{re()},[]);let ie=()=>{j(ee),N(O),F(YQ(O,s)),te(!0)},ae=()=>{te(!1),ne()},oe=e=>{e.key===`Escape`&&(e.preventDefault(),e.currentTarget.blur())},se=`${e}-${t}-${n}`,ce=I?P:k,le=(0,p.jsx)(s?.variant===`block`?a4:i4,{id:se,value:ce,placeholder:i,onChange:e=>{let t=JQ(e.editorState,s);j(e.plainText),N(t),F(e.value),I||ne({content:t,value:e.plainText})},onFocus:ie,onBlur:ae,onKeyDown:oe,wrapperClassName:c,surfaceClassName:l,contentClassName:d,placeholderClassName:f,styleControls:m,templateVariables:h,contentPolicy:s,resolveImageAssetUrl:g,imageAssets:_,registerImageAsset:E,imageAssetDeletion:D,linksEnabled:!0});return o?le:(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:se,children:r}),a&&(0,p.jsx)(KL,{children:a}),le]})},Fae={...sQ,variant:`compact`,allowedBlockTypes:{paragraph:!0},allowedStyleAttributes:{weight:!0,italic:!0,underline:!0,color:!0}},Iae={...sQ,variant:`compact`,allowedBlockTypes:{paragraph:!0},allowedStyleAttributes:{weight:!0,underline:!0,color:!0}},H5={...cQ,variant:`block`,allowedBlockTypes:{paragraph:!0,bulletList:!0,image:!0,separator:!0}},U5={...H5,allowedBlockTypes:{...H5.allowedBlockTypes,heading:!0,infoBox:!0}},Lae=U5,Rae={...sQ,variant:`compact`,allowedBlockTypes:{paragraph:!0},allowedStyleAttributes:{weight:!0,italic:!0,underline:!0,color:!0}};function W5(){let e=Cw(),t=F3();return{imageAssets:(0,u.useMemo)(()=>t.map(([e,t])=>({assetId:e,alt:t.metadata?.alt,label:z3(t,e),previewUrl:R3(t)})),[t]),resolveImageAssetUrl:(0,u.useCallback)(t=>R3(e?.getAsset(t)),[e])}}var zae=({itemId:e,locale:t})=>{let n=G(`defaultEditors.questionHeader`),{templateVariables:r,defaultStyleControls:i}=C4();return(0,p.jsx)(V5,{itemId:e,locale:t,contentKey:`cardFooter`,label:``,placeholder:n(`cardFooterPlaceholder`),bare:!0,contentPolicy:Rae,contentClassName:`w-full py-1 text-sm focus-visible:outline-none focus-visible:ring-0`,styleControls:i,templateVariables:r})},G5=({itemId:e,locale:t,contentKey:n,placeholder:r,allowAdvancedBlocks:i=!1})=>{let{imageAssets:a,resolveImageAssetUrl:o}=W5(),{templateVariables:s,defaultStyleControls:c}=C4();return(0,p.jsx)(V5,{itemId:e,locale:t,contentKey:n,label:``,placeholder:r,bare:!0,contentPolicy:i?U5:H5,styleControls:c,templateVariables:s,resolveImageAssetUrl:o,imageAssets:a})},Bae=({itemId:e,locale:t,placeholder:n})=>{let{imageAssets:r,resolveImageAssetUrl:i}=W5(),{templateVariables:a,defaultStyleControls:o}=C4();return(0,p.jsx)(V5,{itemId:e,locale:t,contentKey:`content`,label:``,placeholder:n,bare:!0,contentPolicy:Lae,styleControls:o,templateVariables:a,resolveImageAssetUrl:i,imageAssets:r})},Vae=({itemId:e,locale:t})=>{let n=G(`defaultEditors.questionHeader`),{templateVariables:r,defaultStyleControls:i,subtitleStyleControls:a}=C4();return(0,p.jsx)(`div`,{className:`space-y-4`,children:(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsx)(V5,{itemId:e,locale:t,contentKey:`title`,label:``,placeholder:n(`titlePlaceholder`),bare:!0,contentPolicy:Fae,contentClassName:`w-full py-1 text-lg font-medium focus-visible:outline-none focus-visible:ring-0`,styleControls:i,templateVariables:r}),(0,p.jsx)(V5,{itemId:e,locale:t,contentKey:`subtitle`,label:``,placeholder:n(`subtitlePlaceholder`),bare:!0,contentPolicy:Iae,contentClassName:`w-full text-sm italic focus-visible:outline-none focus-visible:ring-0`,styleControls:a,templateVariables:r})]})})},K5=({itemId:e,locale:t,responseSection:n})=>{let r=G(`defaultEditors.questionBody`);return(0,p.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-4 px-4 py-3 text-base`,children:[(0,p.jsx)(Vae,{itemId:e,locale:t}),(0,p.jsx)(G5,{itemId:e,locale:t,contentKey:`topContent`,placeholder:r(`topContentPlaceholder`),allowAdvancedBlocks:!0}),n,(0,p.jsx)(RL,{}),(0,p.jsx)(G5,{itemId:e,locale:t,contentKey:`bottomContent`,placeholder:r(`bottomContentPlaceholder`),allowAdvancedBlocks:!0}),(0,p.jsx)(zae,{itemId:e,locale:t})]})},q5=[1,2,3,4,5,10],J5=`grow cursor-pointer font-normal hover:bg-muted/70 rounded-md px-1.5 -mx-1.5 py-1 transition-colors`;function Y5(e){return e===null||q5.includes(e)}function Hae(e,t){return e===null?t:String(e)}function X5(e){return e===null?`unlimited`:q5.includes(e)?String(e):`custom`}var Uae=({maxSelection:e,shuffleOptions:t,onMaxSelectionChange:n,onShuffleOptionsChange:r})=>{let i=G(`defaultEditors.choiceEditor`),a=(0,u.useId)(),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(()=>X5(e)),[d,f]=(0,u.useState)(``),m=(0,u.useEffectEvent)(e=>{l(X5(e)),typeof e==`number`&&!Y5(e)?f(String(e)):f(``)});(0,u.useEffect)(()=>{o&&m(e)},[o]);let h=()=>{if(c!==`custom`)return;let e=Number.parseInt(d.trim(),10);!Number.isFinite(e)||e<1||(n(e),s(!1))};return(0,p.jsxs)(kL,{children:[(0,p.jsx)(AL,{asChild:!0,children:(0,p.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,className:`rounded-full text-muted-foreground shadow-sm`,"aria-label":i(`responseSettings`),children:(0,p.jsx)(JS,{className:`size-3.5`})})}),(0,p.jsxs)(jL,{align:`end`,className:`p-0`,children:[(0,p.jsxs)(Rne,{className:`sr-only`,children:[(0,p.jsx)(zne,{children:i(`responseSettings`)}),(0,p.jsx)(Bne,{children:i(`responseSettingsDescription`)})]}),(0,p.jsxs)(HL,{className:`flex gap-1 p-2 pb-0`,children:[(0,p.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(IS,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,p.jsx)(GL,{className:`grow text-xs`,children:i(`maxSelectionLabel`)})]}),(0,p.jsxs)(kL,{modal:!1,open:o,onOpenChange:s,children:[(0,p.jsx)(AL,{asChild:!0,children:(0,p.jsxs)(H,{type:`button`,variant:`outline`,className:`h-8 w-full min-w-0 justify-between gap-2 px-2 font-normal active:scale-100`,"aria-label":i(`maxSelectionPlaceholder`),children:[(0,p.jsx)(`span`,{className:`truncate`,children:Hae(e,i(`maxSelectionUnlimited`))}),(0,p.jsx)(yS,{className:`size-4 shrink-0 opacity-60`,"aria-hidden":!0})]})}),(0,p.jsxs)(jL,{align:`start`,sideOffset:6,className:`z-60 w-56 gap-0 p-2`,children:[(0,p.jsx)(`p`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:i(`maxSelectionLabel`)}),(0,p.jsxs)(JL,{className:`gap-0`,value:c,onValueChange:t=>{if(l(t),t===`unlimited`){n(null),s(!1);return}if(t===`custom`){typeof e==`number`&&!Y5(e)?f(String(e)):f(``);return}let r=Number.parseInt(t,10);Number.isFinite(r)&&r>=1&&(n(r),s(!1))},children:[(0,p.jsxs)(ux,{htmlFor:`${a}-unlimited`,className:J5,children:[(0,p.jsx)(YL,{value:`unlimited`,id:`${a}-unlimited`}),i(`maxSelectionUnlimited`)]}),q5.map(e=>(0,p.jsxs)(ux,{htmlFor:`${a}-n-${e}`,className:J5,children:[(0,p.jsx)(YL,{value:String(e),id:`${a}-n-${e}`}),String(e)]},e)),(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,p.jsxs)(ux,{htmlFor:`${a}-custom`,className:V(J5,`grow-0 shrink-0`),children:[(0,p.jsx)(YL,{value:`custom`,id:`${a}-custom`}),i(`maxSelectionCustomPlaceholder`)]}),(0,p.jsx)(lx,{inputMode:`numeric`,className:`h-7 min-w-0 flex-1 text-sm`,placeholder:i(`maxSelectionCustomPlaceholder`),disabled:c!==`custom`,value:d,onChange:e=>f(e.target.value),onClick:()=>l(`custom`),onFocus:()=>l(`custom`),onBlur:()=>{c===`custom`&&d.trim()&&h()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h())}})]})]})]})]})]}),(0,p.jsx)(KL,{className:`text-xs`,children:i(`maxSelectionDescription`)})]}),(0,p.jsx)(RL,{}),(0,p.jsxs)(HL,{orientation:`horizontal`,className:`p-2 pt-0`,children:[(0,p.jsxs)(UL,{children:[(0,p.jsx)(GL,{className:`text-xs`,children:i(`shuffleOptionsLabel`)}),(0,p.jsx)(KL,{className:`text-xs`,children:i(`shuffleOptionsDescription`)})]}),(0,p.jsx)(XL,{checked:t,onCheckedChange:r,"aria-label":i(`shuffleOptionsLabel`)})]})]})]})},Wae=({itemId:e})=>{let t=G(`defaultEditors.choiceEditor`),n=G(`history`),r=Cw(),i=W(e=>e.selectedLocale),a=W(e=>e.getItemDataCopy),o=W(e=>e.updateItem),s=W(e=>e.updateItemTranslations),c=W(e=>e.commitByUser),[l,d]=(0,u.useState)(!1),[f,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),_=(0,u.useRef)(null),y=r?.surveyItems.get(e),b=kR(y?.rawItem.config,e),x=(0,u.useMemo)(()=>{let n=r?.getItemTranslations(e);return b.options.map((e,r)=>{let a=n?.getContent(i,TR(e.id),`en`);return{option:e,labelContent:a,label:(a?Ve(a).trim():``)||e.key?.trim()||t(`optionLabelFallback`,{index:r+1})}})},[b.options,e,i,r,t]),S=(0,u.useMemo)(()=>f?b.options.find(e=>e.id===f.optionId)??null:null,[b.options,f]),C=(0,u.useMemo)(()=>S?r?.getItemTranslations(e)?.getContent(i,TR(S.id)):void 0,[S,e,i,r]),w=(0,u.useMemo)(()=>h?b.options.find(e=>e.id===h)??null:null,[b.options,h]),T=w?ER(w.id):void 0,E=(0,u.useMemo)(()=>w?hR(CR(w.embeddedForm,w.id),r?.getItemTranslations(e),i,`en`,T):null,[w,T,e,i,r]),D=(0,u.useMemo)(()=>w?hR(CR(w.embeddedForm,w.id),r?.getItemTranslations(e),i,void 0,T):null,[w,T,e,i,r]),O=b.options.length,ee=(e,t,n)=>{for(let r of e.locales){let i=e.getAllForLocale(r);if(i)for(let[a,o]of Object.entries(i)){if(a!==t&&!a.startsWith(`${t}.`))continue;let i=`${n}${a.slice(t.length)}`;e.setContent(r,i,v(o))}}},k=t=>{let r=kR(a(e).config,e);t(r),o(e,{config:r}),c({label:n(`updateItemResponseConfig`)})},A=e=>{k(t=>{t.options=e})},j=e=>{e!==b.maxSelection&&k(t=>{t.maxSelection=e})},M=e=>{e!==b.shuffleOptions&&k(t=>{t.shuffleOptions=e})},N=(t,l)=>{let u=kR(a(e).config,e);u.options=[...u.options,t];let d=r?.getItemTranslations(e)?.clone()??new Ae;d.setContent(i,TR(t.id),l),o(e,{config:u}),s(e,d),c({label:n(`updateItemResponseConfig`)})},P=t=>{let i=kR(a(e).config,e),l=i.options.filter(e=>e.id!==t);if(l.length===i.options.length)return;i.options=l;let u=r?.getItemTranslations(e)?.clone()??new Ae;u.removeContentKey(TR(t)),u.removeContentKeysWithPrefix(ER(t)),o(e,{config:i}),s(e,u),c({label:n(`updateItemResponseConfig`)})},F=t=>{let i=kR(a(e).config,e),l=i.options.findIndex(e=>e.id===t);if(l===-1)return;let u=i.options[l],d=Nre(u,i.options),f=[...i.options];f.splice(l+1,0,d),i.options=f;let p=r?.getItemTranslations(e),m=p?.clone()??new Ae,h=TR(t),g=TR(d.id),_=ER(t),y=ER(d.id);p?.locales.forEach(e=>{let t=p.getContent(e,h);t&&m.setContent(e,g,v(t))}),ee(m,_,y),o(e,{config:i}),s(e,m),c({label:n(`updateItemResponseConfig`)})},I=(t,l)=>{let u=kR(a(e).config,e),d=u.options.findIndex(e=>e.id===t.id);if(m(null),d===-1)return;let f=u.options[d],p={...f,...t,key:OR(t.key??``)},h=TR(t.id),g=r?.getItemTranslations(e),_=g?.getContent(i,h),v=f.key===p.key&&f.hasDisplayCondition===p.hasDisplayCondition&&f.embeddedFormItemId===p.embeddedFormItemId,y=JSON.stringify(_)===JSON.stringify(l);if(v&&y)return;u.options[d]=p;let b=g?.clone()??new Ae;b.setContent(i,h,l),o(e,{config:u}),s(e,b),c({label:n(`updateItemResponseConfig`)})},te=()=>{d(!0)},ne=e=>{m({optionId:e,focusField:`label`})},re=e=>{m({optionId:e,focusField:`key`})},ie=e=>{g(e)},ae=(t,i)=>{let l=kR(a(e).config,e),u=l.options.findIndex(e=>e.id===t);if(u<0)return!1;let d=l.options[u],f=CR(d.embeddedForm,t),p=(r?.getItemTranslations(e))?.clone()??new Ae,m=ER(t);if(i(f,p)===!1)return!1;let h=gR(f),g=h.fieldGroups.length>0?h:void 0;return l.options[u]={...d,embeddedForm:g},g||p.removeContentKeysWithPrefix(m),o(e,{config:l}),s(e,p.clone().compact()),c({label:n(`updateItemResponseConfig`)}),!0},{isShortcutActive:oe}=OL(_,{key:`c`},{enabled:!l});return(0,p.jsxs)(`section`,{className:`min-h-24`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,p.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-sm font-semibold uppercase tracking-wider text-gray-600`,children:[(0,p.jsx)(`span`,{children:t(`responseConfig`)}),(0,p.jsxs)(`span`,{className:`font-normal normal-case tracking-normal text-muted-foreground`,children:[`(`,(0,p.jsx)(`span`,{className:`tabular-nums`,children:O}),`)`]})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(Uae,{maxSelection:b.maxSelection,shuffleOptions:b.shuffleOptions,onMaxSelectionChange:j,onShuffleOptionsChange:M}),(0,p.jsx)(H,{ref:_,type:`button`,variant:`outline`,size:`icon-sm`,className:V(`rounded-full text-muted-foreground shadow-sm`,oe&&`bg-primary/5 text-foreground ring-2 ring-ring/40 scale-[0.98]`),"aria-label":t(`addResponseElement`),onClick:te,children:(0,p.jsx)(KS,{className:`size-4`})})]})]}),(0,p.jsxs)(`div`,{className:`mt-2`,children:[(0,p.jsx)(Pae,{itemId:e,items:x,onItemEditLabel:ne,onItemEditKey:re,onItemEditEmbeddedForm:ie,onItemDuplicate:F,onItemDelete:P,onItemsReorder:A}),(0,p.jsx)(E4,{isOpen:l,open:te,existingOptions:b.options,onCancel:()=>d(!1),onSubmit:N}),S&&f?(0,p.jsx)(k3,{open:!0,option:S,existingOptions:b.options,initialLabelContent:C,initialFocusField:f.focusField,onOpenChange:e=>{e||m(null)},onSave:I},`${S.id}:${f.focusField}:${i}`):null,w&&E&&D&&T?(0,p.jsx)(O3,{open:!0,itemId:e,optionLabel:x.find(e=>e.option.id===w.id)?.label??w.key??``,config:E,editingConfig:D,selectedLocale:i,translationNamespace:T,onOpenChange:e=>{e||g(null)},onPersist:e=>ae(w.id,e)}):null]})]})},Gae=e=>{let t=G(`defaultEditors.placeholder`),n=G(`itemEditorCard`),r=W(e=>e.selectedLocale),i=[{id:`conditions`,title:t(`conditions`),description:n(`conditionsDescription`),icon:PS},{id:`prefill-rules`,title:n(`prefillRules`),description:n(`prefillRulesDescription`),icon:nC},{id:`export-settings`,title:n(`exportSettings`),description:n(`exportSettingsDescription`),icon:AS}];return(0,p.jsx)(LL,{surveyItem:e.item,menu:{items:[(0,p.jsx)(xw,{itemId:e.item.id},`copy-item`)]},layoutVariant:`stacked`,sidePanelCards:i,previewDialog:{title:n(`preview`),description:n(`previewDialogDescription`),content:(0,p.jsx)(XI,{item:e.item})},children:(0,p.jsx)(K5,{itemId:e.item.id,locale:r,responseSection:(0,p.jsx)(Wae,{itemId:e.item.id})})})},Kae=({itemId:e})=>{let t=G(`history`),n=Cw(),r=CC(),i=W(e=>e.selectedLocale),a=W(e=>e.getItemDataCopy),o=W(e=>e.updateItem),s=W(e=>e.updateItemTranslations),c=W(e=>e.commitByUser),l=n?.surveyItems.get(e),d=n?.getItemTranslations(e),f=(0,u.useMemo)(()=>CR(l?.rawItem.config,e),[l?.rawItem.config,e]),m=(0,u.useMemo)(()=>hR(f,d,i,`en`),[f,d,i]),h=(0,u.useMemo)(()=>hR(f,d,i),[f,d,i]),g=e=>{let t=e?.clone().compact();if(t)return Object.fromEntries(t.locales.map(e=>[e,t.getAllForLocale(e)??{}]))};return(0,p.jsx)(D3,{itemId:e,config:m,editingConfig:h,selectedLocale:i,onPersist:n=>{let i=r.getState().editor;if(!i)return!1;let l=a(e),u=CR(l.config,e),d=i.survey.getItemTranslations(e),f=d?.clone()??new Ae;if(n(u,f)===!1)return!1;let p=gR(u),m=f.clone().compact();return JSON.stringify(l.config)===JSON.stringify(p)&&JSON.stringify(g(d))===JSON.stringify(g(m))?!1:(o(e,{config:p}),s(e,m),c({label:t(`updateItemResponseConfig`)}),!0)}})},qae=e=>{let t=G(`defaultEditors.placeholder`),n=G(`itemEditorCard`),r=W(e=>e.selectedLocale),i=[{id:`conditions`,title:t(`conditions`),description:n(`conditionsDescription`),icon:PS},{id:`prefill-rules`,title:n(`prefillRules`),description:n(`prefillRulesDescription`),icon:nC},{id:`export-settings`,title:n(`exportSettings`),description:n(`exportSettingsDescription`),icon:AS}];return(0,p.jsx)(LL,{surveyItem:e.item,menu:{items:[(0,p.jsx)(xw,{itemId:e.item.id},`copy-item`)]},layoutVariant:`stacked`,sidePanelCards:i,previewDialog:{title:n(`preview`),description:n(`previewDialogDescription`),content:(0,p.jsx)(XI,{item:e.item})},children:(0,p.jsx)(K5,{itemId:e.item.id,locale:r,responseSection:(0,p.jsx)(Kae,{itemId:e.item.id})})})},Jae=e=>{let t=G(`defaultEditors.infoEditor`),n=G(`itemEditorCard`),r=G(`defaultEditors.placeholder`),i=W(e=>e.selectedLocale),a=[{id:`conditions`,title:r(`conditions`),description:n(`conditionsDescription`),icon:PS}];return(0,p.jsx)(LL,{surveyItem:e.item,menu:{items:[(0,p.jsx)(xw,{itemId:e.item.id},`copy-item`)]},layoutVariant:`stacked`,sidePanelCards:a,previewDialog:{title:n(`preview`),description:n(`previewDialogDescription`),content:(0,p.jsx)(XI,{item:e.item})},children:(0,p.jsx)(`div`,{className:`flex w-full max-w-3xl flex-col gap-4 px-4 py-3 text-base`,children:(0,p.jsx)(Bae,{itemId:e.item.id,locale:i,placeholder:t(`contentPlaceholder`)})})})};function Z5(e){return e.type===`number`||e.type===`slider`?I.number:e.type===`datepicker`?I.date:e.type===`switch`?I.boolean:I.string}var Yae=class extends _e{type=`infoItem`;parseConfig(e){return e??{}}isInteractive(){return!1}getResponseSlotDefinitions(){return[]}},Xae=class extends _e{type=`formItem`;parseConfig(e){return CR(e,this.id)}isInteractive(){return!0}getResponseSlotDefinitions(){return this.config.fieldGroups.flatMap(e=>e.fields.map(e=>({slotId:e.key,key:e.key,keyPath:[`response`],valueType:Z5(e),prefillTarget:{type:me.field,fieldId:e.id}})))}},Zae=class extends _e{type=`choiceItem`;parseConfig(e){return kR(e,this.id)}isInteractive(){return!0}getResponseSlotDefinitions(){let e=this.config.id??this.id,t=this.config.maxSelection===1?I.reference:I.referenceArray,n=this.config.options.flatMap(e=>{let t=e.embeddedForm?CR(e.embeddedForm,e.id):void 0;return t?t.fieldGroups.flatMap(t=>t.fields.map(t=>({slotId:DR(e.id,t.key),key:t.key,keyPath:[`embedded`,kre(e)],valueType:Z5(t),prefillTarget:{type:me.embeddedField,optionId:e.id,fieldId:t.id}}))):[]});return[{slotId:e,key:`response`,keyPath:[],valueType:t,prefillTarget:{type:me.itemResponse}},...n]}normalizePrefillValue(e,t,n){if(t.prefillTarget?.type!==me.itemResponse)return super.normalizePrefillValue(e,t,n);let r=new Set(this.config.options.map(e=>e.id));if(this.config.maxSelection===1)return n.type!==I.reference||!r.has(n.value)?void 0:n;if(n.type!==I.referenceArray)return;let i=n.value.filter(e=>r.has(e));if(i.length!==0)return i.length===n.value.length?n:{...n,value:i}}};function Qae(e){return e.config.id??e.id}function Q5(e,t){return`${e.id}...${t}...${Qae(e)}`}function $5(e){return new O({type:I.boolean,value:e})}function e7(e){return new O({type:I.reference,value:e})}function t7(e){return new ee(Q5(e,`get`))}function n7(e){return new ee(Q5(e,`isDefined`))}function r7(e){return e.length===0?$5(!1):e.length===1&&e[0]?e[0]:new j(A.or,e)}function i7(e){return e.length===0?$5(!0):e.length===1&&e[0]?e[0]:new j(A.and,e)}function a7(e){return new j(A.not,[e])}function $ae(e){return e===`all`||e===`none`||e===`either`?e:`either`}function o7(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function s7(e){return e.config.options.map(e=>({value:e.id,label:e.key??e.id,description:e.key&&e.key!==e.id?e.id:void 0}))}function c7(e,t,n){if(n.length===0)return $5(t!==`either`);if(wR(e.config.maxSelection)){let r=n.map(t=>new j(A.eq,[t7(e),e7(t)]));return t===`all`?i7(r):t===`none`?a7(r7(r)):r7(r)}let r=n.map(t=>new j(A.list_contains,[t7(e),e7(t)]));return t===`all`?i7(r):t===`none`?a7(r7(r)):r7(r)}function eoe(e,t){if(t.length===0)return a7(n7(e));if(wR(e.config.maxSelection))return t.length===1?new j(A.eq,[t7(e),e7(t[0])]):$5(!1);let n=new Set(t),r=e.config.options.map(e=>e.id).filter(e=>!n.has(e));return i7([c7(e,`all`,t),c7(e,`none`,r)])}var toe=[{id:`choice.selectionIncludesOptions`,label:`Selection includes options`,description:`Checks whether the selected options match all, none, or either of the chosen options.`,returnType:I.boolean,parameters:[{key:`mode`,label:`Match mode`,input:`singleSelect`,required:!0,defaultValue:`either`,getOptions:()=>[{value:`all`,label:`All`},{value:`none`,label:`None`},{value:`either`,label:`Either`}]},{key:`optionIds`,label:`Options`,input:`multiSelect`,required:!0,getOptions:s7}],buildExpression:(e,t)=>c7(e,$ae(t?.mode),o7(t?.optionIds))},{id:`choice.selectionMatchesExactly`,label:`Selection matches exactly`,description:`Checks whether the answer contains exactly the chosen option set and no other options.`,returnType:I.boolean,parameters:[{key:`optionIds`,label:`Options`,input:`multiSelect`,required:!0,getOptions:s7}],buildExpression:(e,t)=>eoe(e,o7(t?.optionIds))},{id:`choice.hasSelection`,label:`Has selection`,description:`Checks whether the question has any selected option.`,returnType:I.boolean,buildExpression:e=>n7(e)}];function l7(e,t,n){return!t||e.length<2?[...e]:g(e,h(n))}function noe({className:e,...t}){return(0,p.jsx)(Ss,{"data-slot":`checkbox`,className:V(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,p.jsx)(ws,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,p.jsx)(vS,{})})})}function roe(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var ioe={},u7={};function d7(e,t){try{let n=(ioe[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in u7?u7[n]:f7(n,n.split(`:`))}catch{if(e in u7)return u7[e];let t=e?.match(aoe);return t?f7(e,t.slice(1)):NaN}}var aoe=/([+-]\d\d):?(\d\d)?/;function f7(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return u7[e]=n*60+r>0?n*60+r+i:n*60-r-i}var p7=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(d7(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),g7(this,NaN),h7(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-d7(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),h7(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},m7=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!m7.test(e))return;let t=e.replace(m7,`$1UTC`);p7.prototype[t]&&(e.startsWith(`get`)?p7.prototype[e]=function(){return this.internal[t]()}:(p7.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),ooe(this),+this},p7.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),h7(this),+this}))});function h7(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-d7(e.timeZone,e)*60))}function ooe(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),g7(e)}function g7(e){let t=d7(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(d7(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=d7(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=d7(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var _7=class e extends p7{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${roe(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},v7=5,soe=4;function coe(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,v7*7-1);return t.getMonth(e)===t.getMonth(a)?v7:soe}function y7(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function loe(e,t){let n=y7(e,t),r=coe(e,t);return t.addDays(n,r*7-1)}var b7={...Jt,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>Cn(e,t,{locale:Jt,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>Cn(e,n,{locale:Jt,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>Cn(e,t,{locale:Jt,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>Cn(e,n,{locale:Jt,...t}),r(e,`cccc`)}}},x7=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?_7.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new _7(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):et(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):tt(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):ft(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):pt(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):ut(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):xt(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):At(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):Nt(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):loe(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):Ft(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Tt(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Pt(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):jt(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):Cn(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):Xt(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):On(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):kn(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):$t(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):An(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):jn(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):yt(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):vt(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):Mn(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):tee(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):mt(e),this.min=e=>this.overrides?.min?this.overrides.min(e):ht(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):nee(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):ree(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):y7(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):lt(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):at(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):eee(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):it(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Mt(e),this.options={locale:b7,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};x7.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var S7=new x7,C7=class{constructor(e,t,n=S7){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},uoe=class{constructor(e,t){this.date=e,this.weeks=t}},doe=class{constructor(e,t){this.days=t,this.weekNumber=e}};function foe(e){return d.default.createElement(`button`,{...e})}function poe(e){return d.default.createElement(`span`,{...e})}function moe(e){let{size:t=24,orientation:n=`left`,className:r}=e;return d.default.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&d.default.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&d.default.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&d.default.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&d.default.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function hoe(e){let{day:t,modifiers:n,...r}=e;return d.default.createElement(`td`,{...r})}function goe(e){let{day:t,modifiers:n,...r}=e,i=d.default.useRef(null);return d.default.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),d.default.createElement(`button`,{ref:i,...r})}var $;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})($||={});var w7;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(w7||={});var T7;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(T7||={});var E7;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(E7||={});function _oe(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[$.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return d.default.createElement(`span`,{"data-disabled":a.disabled,className:i[$.DropdownRoot]},d.default.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>d.default.createElement(r.Option,{key:e,value:e,disabled:n},t))),d.default.createElement(`span`,{className:i[$.CaptionLabel],"aria-hidden":!0},s?.label,d.default.createElement(r.Chevron,{orientation:`down`,size:18,className:i[$.Chevron]})))}function voe(e){return d.default.createElement(`div`,{...e})}function yoe(e){return d.default.createElement(`div`,{...e})}function boe(e){let{calendarMonth:t,displayIndex:n,...r}=e;return d.default.createElement(`div`,{...r},e.children)}function xoe(e){let{calendarMonth:t,displayIndex:n,...r}=e;return d.default.createElement(`div`,{...r})}function Soe(e){return d.default.createElement(`table`,{...e})}function Coe(e){return d.default.createElement(`div`,{...e})}var D7=(0,d.createContext)(void 0);function O7(){let e=(0,d.useContext)(D7);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function woe(e){let{components:t}=O7();return d.default.createElement(t.Dropdown,{...e})}function Toe(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=O7(),u=(0,d.useCallback)(e=>{i&&n?.(e)},[i,n]),f=(0,d.useCallback)(e=>{r&&t?.(e)},[r,t]);return d.default.createElement(`nav`,{...a},d.default.createElement(o.PreviousMonthButton,{type:`button`,className:s[$.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:f},d.default.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[$.Chevron],orientation:`left`})),d.default.createElement(o.NextMonthButton,{type:`button`,className:s[$.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},d.default.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[$.Chevron]})))}function Eoe(e){let{components:t}=O7();return d.default.createElement(t.Button,{...e})}function Doe(e){return d.default.createElement(`option`,{...e})}function Ooe(e){let{components:t}=O7();return d.default.createElement(t.Button,{...e})}function koe(e){let{rootRef:t,...n}=e;return d.default.createElement(`div`,{...n,ref:t})}function Aoe(e){return d.default.createElement(`select`,{...e})}function joe(e){let{week:t,...n}=e;return d.default.createElement(`tr`,{...n})}function Moe(e){return d.default.createElement(`th`,{...e})}function Noe(e){return d.default.createElement(`thead`,{"aria-hidden":!0},d.default.createElement(`tr`,{...e}))}function Poe(e){let{week:t,...n}=e;return d.default.createElement(`th`,{...n})}function Foe(e){return d.default.createElement(`th`,{...e})}function Ioe(e){return d.default.createElement(`tbody`,{...e})}function Loe(e){let{components:t}=O7();return d.default.createElement(t.Dropdown,{...e})}var Roe=s({Button:()=>foe,CaptionLabel:()=>poe,Chevron:()=>moe,Day:()=>hoe,DayButton:()=>goe,Dropdown:()=>_oe,DropdownNav:()=>voe,Footer:()=>yoe,Month:()=>boe,MonthCaption:()=>xoe,MonthGrid:()=>Soe,Months:()=>Coe,MonthsDropdown:()=>woe,Nav:()=>Toe,NextMonthButton:()=>Eoe,Option:()=>Doe,PreviousMonthButton:()=>Ooe,Root:()=>koe,Select:()=>Aoe,Week:()=>joe,WeekNumber:()=>Poe,WeekNumberHeader:()=>Foe,Weekday:()=>Moe,Weekdays:()=>Noe,Weeks:()=>Ioe,YearsDropdown:()=>Loe});function k7(e,t,n=!1,r=S7){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function A7(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function j7(e){return!!(e&&typeof e==`object`&&`from`in e)}function M7(e){return!!(e&&typeof e==`object`&&`after`in e)}function N7(e){return!!(e&&typeof e==`object`&&`before`in e)}function P7(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function F7(e,t){return Array.isArray(e)&&e.every(t.isDate)}function I7(e,t,n=S7){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(F7(t,n))return t.some(t=>i(e,t));if(j7(t))return k7(t,e,!1,n);if(P7(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(A7(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return M7(t)?a(e,t.after)>0:N7(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function zoe(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[w7.focused]:[],[w7.outside]:[],[w7.disabled]:[],[w7.hidden]:[],[w7.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&I7(e,a,i)),S=!!(o&&I7(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&I7(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[w7.focused]:!1,[w7.disabled]:!1,[w7.hidden]:!1,[w7.outside]:!1,[w7.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Boe(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[w7[r]]?e.push(t[w7[r]]):t[T7[r]]&&e.push(t[T7[r]]),e),[t[$.Day]])}function Voe(e){return{...Roe,...e}}function Hoe(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function L7(){let e={};for(let t in $)e[$[t]]=`rdp-${$[t]}`;for(let t in w7)e[w7[t]]=`rdp-${w7[t]}`;for(let t in T7)e[T7[t]]=`rdp-${T7[t]}`;for(let t in E7)e[E7[t]]=`rdp-${E7[t]}`;return e}function R7(e,t,n){return(n??new x7(t)).formatMonthYear(e)}var Uoe=R7;function Woe(e,t,n){return(n??new x7(t)).format(e,`d`)}function Goe(e,t=S7){return t.format(e,`LLLL`)}function Koe(e,t,n){return(n??new x7(t)).format(e,`cccccc`)}function qoe(e,t=S7){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Joe(){return``}function z7(e,t=S7){return t.format(e,`yyyy`)}var Yoe=z7,Xoe=s({formatCaption:()=>R7,formatDay:()=>Woe,formatMonthCaption:()=>Uoe,formatMonthDropdown:()=>Goe,formatWeekNumber:()=>qoe,formatWeekNumberHeader:()=>Joe,formatWeekdayName:()=>Koe,formatYearCaption:()=>Yoe,formatYearDropdown:()=>z7});function Zoe(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...Xoe,...e}}function B7(e,t,n,r){let i=(r??new x7(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var Qoe=B7;function V7(e,t,n){return(n??new x7(t)).formatMonthYear(e)}var $oe=V7;function H7(e,t,n,r){let i=(r??new x7(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function U7(e){return`Choose the Month`}function W7(){return``}var ese=`Go to the Next Month`;function G7(e,t){return ese}function K7(e){return`Go to the Previous Month`}function q7(e,t,n){return(n??new x7(t)).format(e,`cccc`)}function J7(e,t){return`Week ${e}`}function Y7(e){return`Week Number`}function X7(e){return`Choose the Year`}var tse=s({labelCaption:()=>$oe,labelDay:()=>Qoe,labelDayButton:()=>B7,labelGrid:()=>V7,labelGridcell:()=>H7,labelMonthDropdown:()=>U7,labelNav:()=>W7,labelNext:()=>G7,labelPrevious:()=>K7,labelWeekNumber:()=>J7,labelWeekNumberHeader:()=>Y7,labelWeekday:()=>q7,labelYearDropdown:()=>X7}),Z7=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function nse(e,t){let n=t.locale?.labels??{};return{...tse,...e??{},labelDayButton:Z7(B7,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Z7(U7,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Z7(G7,e?.labelNext,n.labelNext),labelPrevious:Z7(K7,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Z7(J7,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Z7(X7,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Z7(V7,e?.labelGrid,n.labelGrid),labelGridcell:Z7(H7,e?.labelGridcell,n.labelGridcell),labelNav:Z7(W7,e?.labelNav,n.labelNav),labelWeekNumberHeader:Z7(Y7,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Z7(q7,e?.labelWeekday,n.labelWeekday)}}function rse(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function ise(e,t={},n={}){let r={...t?.[$.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function ase(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function ose(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function sse(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new _7(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(_7.tz(e)),newDate:(t,n,r)=>new _7(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new _7(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new _7(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new _7(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new _7(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>$t(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>Xt(o(e)),differenceInCalendarDays:(e,t)=>ut(o(e),o(t)),differenceInCalendarMonths:(e,t)=>xt(o(e),o(t))}}var Q7=e=>e instanceof HTMLElement?e:null,$7=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],cse=e=>Q7(e.querySelector(`[data-animated-month]`)),e9=e=>Q7(e.querySelector(`[data-animated-caption]`)),t9=e=>Q7(e.querySelector(`[data-animated-weeks]`)),lse=e=>Q7(e.querySelector(`[data-animated-nav]`)),use=e=>Q7(e.querySelector(`[data-animated-weekdays]`));function dse(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,d.useRef)(null),s=(0,d.useRef)(r),c=(0,d.useRef)(!1);(0,d.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[E7.caption_after_enter]:n[E7.caption_before_enter],p=d?n[E7.weeks_after_enter]:n[E7.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?($7(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=cse(e);t&&e.contains(t)&&e.removeChild(t);let n=e9(e);n&&n.classList.remove(f);let r=t9(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?$7(m):[],_=$7(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=lse(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=e9(i);s&&s.classList.add(f);let l=t9(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=use(o);m&&(m.style.opacity=`0`);let h=e9(o);h&&(h.classList.add(d?n[E7.caption_before_exit]:n[E7.caption_after_exit]),h.addEventListener(`animationend`,u));let _=t9(o);_&&_.classList.add(d?n[E7.weeks_before_exit]:n[E7.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function fse(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function pse(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function mse(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function n9(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function hse(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new uoe(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new C7(t,m,r);return a?a.days.push(o):e.push(new doe(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function gse(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function _se(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function vse(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function yse(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function r9(e,t){let[n,r]=(0,d.useState)(e);return[t===void 0?n:t,r]}function bse(e,t){let[n,r]=gse(e,t),{startOfMonth:i,endOfMonth:a}=t,o=n9(e,n,r,t),[s,c]=r9(o,e.month?o:void 0);(0,d.useEffect)(()=>{c(n9(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:f,previousMonth:p,nextMonth:m}=(0,d.useMemo)(()=>{let i=mse(s,r,{numberOfMonths:e.numberOfMonths},t),o=hse(i,fse(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:yse(o),days:pse(o),previousMonth:vse(s,n,e,t),nextMonth:_se(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:h,onMonthChange:g}=e,_=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),v=e=>{if(h)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),g?.(t)};return{months:l,weeks:u,days:f,navStart:n,navEnd:r,previousMonth:p,nextMonth:m,goToMonth:v,goToDay:e=>{_(e)||v(e.date)}}}var i9;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(i9||={});function a9(e){return!e[w7.disabled]&&!e[w7.hidden]&&!e[w7.outside]}function xse(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);a9(e)&&(e[w7.focused]&&a<i9.FocusedModifier?(i=o,a=i9.FocusedModifier):r?.isEqualTo(o)&&a<i9.LastFocused?(i=o,a=i9.LastFocused):n(o.date)&&a<i9.Selected?(i=o,a=i9.Selected):e[w7.today]&&a<i9.Today&&(i=o,a=i9.Today))}return i||=e.find(e=>a9(t(e))),i}function Sse(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function o9(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=Sse(e,t,n.date,r,i,a,o),l=!!(a.disabled&&I7(c,a.disabled,o)),u=!!(a.hidden&&I7(c,a.hidden,o)),d=new C7(c,c,o);return!l&&!u?d:o9(e,t,d,r,i,a,o,s+1)}function Cse(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,d.useState)(),c=xse(t.days,n,r||(()=>!1),o),[l,u]=(0,d.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=o9(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function wse(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=r9(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function Tse(e,t,n=0,r=0,i=!1,a=S7){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function Ese(e,t,n=S7){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function s9(e,t,n=S7){return k7(e,t.from,!1,n)||k7(e,t.to,!1,n)||k7(t,e.from,!1,n)||k7(t,e.to,!1,n)}function Dse(e,t,n=S7){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?k7(e,t,!1,n):F7(t,n)?t.some(t=>k7(e,t,!1,n)):j7(t)?t.from&&t.to?s9(e,{from:t.from,to:t.to},n):!1:P7(t)?Ese(e,t.dayOfWeek,n):A7(t)?n.isAfter(t.before,t.after)?s9(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):I7(e.from,t,n)||I7(e.to,t,n):M7(t)||N7(t)?I7(e.from,t,n)||I7(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function Ose(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=r9(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:Tse(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&Dse({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&k7(u,e,!1,t)}}function kse(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=r9(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function Ase(e,t){let n=kse(e,t),r=wse(e,t),i=Ose(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function c9(e,t){return e instanceof _7&&e.timeZone===t?e:new _7(e,t)}function l9(e,t,n){if(!n)return c9(e,t);let r=c9(e,t),i=new _7(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function u9(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?l9(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?l9(e,t,n):e):j7(e)?{...e,from:e.from?c9(e.from,t):e.from,to:e.to?c9(e.to,t):e.to}:A7(e)?{before:l9(e.before,t,n),after:l9(e.after,t,n)}:M7(e)?{after:l9(e.after,t,n)}:N7(e)?{before:l9(e.before,t,n)}:e}function d9(e,t,n){return e&&(Array.isArray(e)?e.map(e=>u9(e,t,n)):u9(e,t,n))}function jse(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=c9(t.today,n),t.month&&=c9(t.month,n),t.defaultMonth&&=c9(t.defaultMonth,n),t.startMonth&&=c9(t.startMonth,n),t.endMonth&&=c9(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=c9(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>c9(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?c9(t.selected.from,n):t.selected.from,to:t.selected.to?c9(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=d9(t.disabled,n)),t.hidden!==void 0&&(t.hidden=d9(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=d9(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,d.useMemo)(()=>{let e={...b7,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?sse(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new x7({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Voe(t.components),formatters:Zoe(t.formatters),labels:nse(t.labels,a.options),locale:e,classNames:{...L7(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:f,numberOfMonths:p=1,onDayBlur:m,onDayClick:h,onDayFocus:g,onDayKeyDown:_,onDayMouseEnter:v,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:ee,formatYearDropdown:k}=i,A=bse(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:te}=A,ne=zoe(j,t,N,P,o),{isSelected:re,select:ie,selected:ae}=Ase(t,o)??{},{blur:oe,focused:se,isFocusTarget:ce,moveFocus:le,setFocused:ue}=Cse(t,A,ne,re??(()=>!1),o),{labelDayButton:de,labelGridcell:fe,labelGrid:pe,labelMonthDropdown:me,labelNav:he,labelPrevious:ge,labelNext:_e,labelWeekday:ve,labelWeekNumber:ye,labelWeekNumberHeader:be,labelYearDropdown:xe}=a,Se=(0,d.useMemo)(()=>ase(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Ce=u!==void 0||h!==void 0,we=(0,d.useCallback)(()=>{F&&(te(F),x?.(F))},[F,te,x]),Te=(0,d.useCallback)(()=>{I&&(te(I),b?.(I))},[te,I,b]),Ee=(0,d.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),ue(e),!t.disabled&&(ie?.(e.date,t,n),h?.(e.date,t,n))},[ie,h,ue]),De=(0,d.useCallback)((e,t)=>n=>{ue(e),g?.(e.date,t,n)},[g,ue]),Oe=(0,d.useCallback)((e,t)=>n=>{oe(),m?.(e.date,t,n)},[oe,m]),ke=(0,d.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];le(e,t)}_?.(e.date,n,r)},[le,_,t.dir]),Ae=(0,d.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),je=(0,d.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Me=(0,d.useCallback)(e=>t=>{let n=Number(t.target.value);te(o.setMonth(o.startOfMonth(e),n))},[o,te]),Ne=(0,d.useCallback)(e=>t=>{let n=Number(t.target.value);te(o.setYear(o.startOfMonth(e),n))},[o,te]),{className:Pe,style:Fe}=(0,d.useMemo)(()=>({className:[c[$.Root],t.className].filter(Boolean).join(` `),style:{...C?.[$.Root],...t.style}}),[c,t.className,t.style,C]),Ie=Hoe(t),Le=(0,d.useRef)(null);dse(Le,!!t.animate,{classNames:c,months:M,focused:se,dateLib:o});let Re={dayPickerProps:t,selected:ae,select:ie,isSelected:re,months:M,nextMonth:I,previousMonth:F,goToMonth:te,getModifiers:ne,components:r,classNames:c,styles:C,labels:a,formatters:i};return d.default.createElement(D7.Provider,{value:Re},d.default.createElement(r.Root,{rootRef:t.animate?Le:void 0,className:Pe,style:Fe,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Ie},d.default.createElement(r.Months,{className:c[$.Months],style:C?.[$.Months]},!t.hideNavigation&&!f&&d.default.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":he(),onPreviousClick:we,onNextClick:Te,previousMonth:F,nextMonth:I}),M.map((e,n)=>d.default.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[$.Month],style:C?.[$.Month],key:n,displayIndex:n,calendarMonth:e},f===`around`&&!t.hideNavigation&&n===0&&d.default.createElement(r.PreviousMonthButton,{type:`button`,className:c[$.PreviousMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":ge(F),onClick:we,"data-animated-button":t.animate?`true`:void 0},d.default.createElement(r.Chevron,{disabled:F?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),d.default.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[$.MonthCaption],style:C?.[$.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?d.default.createElement(r.DropdownNav,{className:c[$.Dropdowns],style:C?.[$.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?d.default.createElement(r.MonthsDropdown,{key:`month`,className:c[$.MonthsDropdown],"aria-label":me(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Me(e.date),options:rse(e.date,N,P,i,o),style:C?.[$.Dropdown],value:o.getMonth(e.date)}):d.default.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?d.default.createElement(r.YearsDropdown,{key:`year`,className:c[$.YearsDropdown],"aria-label":xe(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ne(e.date),options:ose(N,P,i,o,!!t.reverseYears),style:C?.[$.Dropdown],value:o.getYear(e.date)}):d.default.createElement(`span`,{key:`year`},k(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),d.default.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):d.default.createElement(r.CaptionLabel,{className:c[$.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),f===`around`&&!t.hideNavigation&&n===p-1&&d.default.createElement(r.NextMonthButton,{type:`button`,className:c[$.NextMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":_e(I),onClick:Te,"data-animated-button":t.animate?`true`:void 0},d.default.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===p-1&&f===`after`&&!t.hideNavigation&&d.default.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":he(),onPreviousClick:we,onNextClick:Te,previousMonth:F,nextMonth:I}),d.default.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":pe(e.date,o.options,o)||void 0,className:c[$.MonthGrid],style:C?.[$.MonthGrid]},!t.hideWeekdays&&d.default.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[$.Weekdays],style:C?.[$.Weekdays]},S&&d.default.createElement(r.WeekNumberHeader,{"aria-label":be(o.options),className:c[$.WeekNumberHeader],style:C?.[$.WeekNumberHeader],scope:`col`},O()),Se.map(e=>d.default.createElement(r.Weekday,{"aria-label":ve(e,o.options,o),className:c[$.Weekday],key:String(e),style:C?.[$.Weekday],scope:`col`},ee(e,o.options,o)))),d.default.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[$.Weeks],style:C?.[$.Weeks]},e.weeks.map(e=>d.default.createElement(r.Week,{className:c[$.Week],key:e.weekNumber,style:C?.[$.Week],week:e},S&&d.default.createElement(r.WeekNumber,{week:e,style:C?.[$.WeekNumber],"aria-label":ye(e.weekNumber,{locale:s}),className:c[$.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ne(e);if(i[w7.focused]=!i.hidden&&!!se?.isEqualTo(e),i[T7.selected]=re?.(n)||i.selected,j7(ae)){let{from:e,to:t}=ae;i[T7.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[T7.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[T7.range_middle]=k7(ae,n,!0,o)}let a=ise(i,C,t.modifiersStyles),s=Boe(i,c,t.modifiersClassNames),l=!Ce&&!i.hidden?fe(n,i,o.options,o):void 0;return d.default.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&Ce?d.default.createElement(r.DayButton,{className:c[$.DayButton],style:C?.[$.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:ce(e)?0:-1,"aria-label":de(n,i,o.options,o),onClick:Ee(e,i),onBlur:Oe(e,i),onFocus:De(e,i),onKeyDown:ke(e,i),onMouseEnter:Ae(e,i),onMouseLeave:je(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&d.default.createElement(r.Footer,{className:c[$.Footer],style:C?.[$.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function Mse({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,locale:a,formatters:o,components:s,...c}){let l=L7();return(0,p.jsx)(jse,{showOutsideDays:n,className:V(`group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,locale:a,formatters:{formatMonthDropdown:e=>e.toLocaleString(a?.code,{month:`short`}),...o},classNames:{root:V(`w-fit`,l.root),months:V(`relative flex flex-col gap-4 md:flex-row`,l.months),month:V(`flex w-full flex-col gap-4`,l.month),nav:V(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,l.nav),button_previous:V(Qb({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,l.button_previous),button_next:V(Qb({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,l.button_next),month_caption:V(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,l.month_caption),dropdowns:V(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,l.dropdowns),dropdown_root:V(`relative rounded-(--cell-radius)`,l.dropdown_root),dropdown:V(`absolute inset-0 bg-popover opacity-0`,l.dropdown),caption_label:V(`font-medium select-none`,r===`label`?`text-sm`:`flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,l.caption_label),table:`w-full border-collapse`,weekdays:V(`flex`,l.weekdays),weekday:V(`flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none`,l.weekday),week:V(`mt-2 flex w-full`,l.week),week_number_header:V(`w-(--cell-size) select-none`,l.week_number_header),week_number:V(`text-[0.8rem] text-muted-foreground select-none`,l.week_number),day:V(`group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)`,c.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)`:`[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)`,l.day),range_start:V(`relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted`,l.range_start),range_middle:V(`rounded-none`,l.range_middle),range_end:V(`relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted`,l.range_end),today:V(`rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none`,l.today),outside:V(`text-muted-foreground aria-selected:text-muted-foreground`,l.outside),disabled:V(`text-muted-foreground opacity-50`,l.disabled),hidden:V(`invisible`,l.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,p.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:V(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,p.jsx)(bS,{className:V(`size-4`,e),...n}):t===`right`?(0,p.jsx)(xS,{className:V(`size-4`,e),...n}):(0,p.jsx)(yS,{className:V(`size-4`,e),...n}),DayButton:({...e})=>(0,p.jsx)(Nse,{locale:a,...e}),WeekNumber:({children:e,...t})=>(0,p.jsx)(`td`,{...t,children:(0,p.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...s},...c})}function Nse({className:e,day:t,modifiers:n,locale:r,...i}){let a=L7(),o=u.useRef(null);return u.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),(0,p.jsx)(H,{ref:o,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(r?.code),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:V(`relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70`,a.day,e),...i})}function Pse({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=u.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,p.jsxs)(g_,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:V(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...a,children:[(0,p.jsx)(C_,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,p.jsx)(T_,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,p.jsx)(N_,{"data-slot":`slider-thumb`,className:`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`},t))]})}function Fse(e){if(!e)return;let t=Ve(e).trim();return t.length>0?t:void 0}var f9=({title:e,subtitle:t,topContent:n,bottomContent:r,footer:i,resolveImageAssetUrl:a,legendFallback:o=`Question`,className:s,children:c})=>{let l=Fse(e)??o;return(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsxs)(zL,{className:V(`rounded-xl border border-border bg-card pb-2`,s),children:[(0,p.jsxs)(`div`,{className:`px-4 pt-4`,children:[(0,p.jsx)(BL,{className:`sr-only`,children:l}),e?(0,p.jsx)(`div`,{"aria-hidden":`true`,children:(0,p.jsx)(S4,{content:e,resolveImageAssetUrl:a,paragraphClassName:`text-lg font-medium`})}):null,t?(0,p.jsx)(S4,{content:t,resolveImageAssetUrl:a,paragraphClassName:`text-sm leading-relaxed text-muted-foreground italic`}):null,n?(0,p.jsx)(`div`,{className:`pt-3`,children:(0,p.jsx)(S4,{content:n,resolveImageAssetUrl:a,paragraphClassName:`text-sm`})}):null]}),c,r?(0,p.jsx)(`div`,{className:`px-4 pb-2`,children:(0,p.jsx)(S4,{content:r,resolveImageAssetUrl:a,paragraphClassName:`text-sm`})}):null]}),i?(0,p.jsx)(`div`,{className:`px-3`,children:(0,p.jsx)(S4,{content:i,resolveImageAssetUrl:a,paragraphClassName:`text-xs text-muted-foreground`})}):null]})},Ise=V(`grid gap-x-4 gap-y-6`,`grid-cols-[repeat(var(--form-group-cols-base),minmax(0,1fr))]`,`@xs/form-field-group:grid-cols-[repeat(var(--form-group-cols-xs),minmax(0,1fr))]`,`@sm/form-field-group:grid-cols-[repeat(var(--form-group-cols-sm),minmax(0,1fr))]`,`@md/form-field-group:grid-cols-[repeat(var(--form-group-cols-md),minmax(0,1fr))]`,`@xl/form-field-group:grid-cols-[repeat(var(--form-group-cols-xl),minmax(0,1fr))]`),p9=`!bg-card dark:!bg-card`;function Lse(e,t,n){let r=e?.clone()??new Rn;return r.setSlotValue(t,n),r.isEmpty()?void 0:r}function m9(e){return e.key}function Rse(e,t){return e?.get(m9(t))!==void 0}function h9(e,t){let n=e?.get(m9(t));return n?.type===I.string?n.value:void 0}function g9(e,t){let n=e?.get(m9(t));return n?.type===I.number?n.value:void 0}function _9(e,t){let n=e?.get(m9(t));return n?.type===I.boolean?n.value:void 0}function v9(e,t){let n=e?.get(m9(t));return n?.type===I.date?n.value:void 0}var y9=1900,b9=2100,x9=Array.from({length:b9-y9+1},(e,t)=>b9-t);function zse(e){let t=e.trim().toLowerCase(),n=t.split(`-`)[0];return t===`de`||n===`de`?In:Jt}function S9(e){if(e===void 0)return;let t=new Date(e*1e3);return Number.isNaN(t.getTime())?void 0:t}function Bse(e,t){return t===`year`?new Date(e.getFullYear(),0,1):t===`year-month`?new Date(e.getFullYear(),e.getMonth(),1):new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Vse(e){return Math.floor(e.getTime()/1e3)}function Hse(e,t,n){let r=S9(e);if(r)return t===`year`?Cn(r,`yyyy`,{locale:n}):t===`year-month`?Cn(r,`MMMM yyyy`,{locale:n}):Cn(r,`PPP`,{locale:n})}function Use(e,t){return e.placeholder?.trim()?e.placeholder:e.mode===`year`?t(`datePickerSelectYear`):e.mode===`year-month`?t(`datePickerSelectMonthAndYear`):t(`datePickerSelectDate`)}function Wse(e,t){switch(t.type){case`switch`:return Rse(e,t);case`number`:case`slider`:return g9(e,t)!==void 0;case`datepicker`:return v9(e,t)!==void 0;default:{let n=h9(e,t);return typeof n==`string`&&n.length>0}}}function Gse(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function Kse(e){try{return new URL(e),!0}catch{return!1}}function C9(e){if(!e?.trim())return;let t=new Date(`${e}T00:00:00`).getTime();return Number.isNaN(t)?void 0:t}function w9(e,t,n){return t?.trim()||e.errorMessage?.trim()||n}function qse(e,t,n,r){if(!n.has(m9(e)))return;let i=h9(t,e)?.trim(),a=g9(t,e),o=_9(t,e),s=v9(t,e),c=Wse(t,e);for(let t of e.validations)switch(t.type){case`required`:if(!c)return w9(e,t.message,r(`requiredError`));break;case`minLength`:if(i!==void 0&&typeof t.value==`number`&&i.length<t.value)return w9(e,t.message,r(`invalidError`));break;case`maxLength`:if(i!==void 0&&typeof t.value==`number`&&i.length>t.value)return w9(e,t.message,r(`invalidError`));break;case`pattern`:if(i!==void 0&&typeof t.value==`string`)try{if(!new RegExp(t.value).test(i))return w9(e,t.message,r(`invalidError`))}catch{}break;case`email`:if(i!==void 0&&!Gse(i))return w9(e,t.message,r(`invalidError`));break;case`url`:if(i!==void 0&&!Kse(i))return w9(e,t.message,r(`invalidError`));break;case`integer`:if(a!==void 0&&!Number.isInteger(a))return w9(e,t.message,r(`invalidError`));break;case`min`:if(a!==void 0&&typeof t.value==`number`&&a<t.value)return w9(e,t.message,r(`invalidError`));break;case`max`:if(a!==void 0&&typeof t.value==`number`&&a>t.value)return w9(e,t.message,r(`invalidError`));break;case`minDate`:{let n=typeof t.value==`string`?C9(t.value):void 0;if(s!==void 0&&n!==void 0&&s*1e3<n)return w9(e,t.message,r(`invalidError`));break}case`maxDate`:{let n=typeof t.value==`string`?C9(t.value):void 0;if(s!==void 0&&n!==void 0&&s*1e3>n)return w9(e,t.message,r(`invalidError`));break}case`mustBeTrue`:if(o!==!0)return w9(e,t.message,r(`invalidError`));break;default:break}}function Jse({controlId:e,controller:t,value:n,describedBy:r,invalid:i,readOnly:a,onTouched:o,onValueChange:s}){let[c,l]=(0,u.useState)(!1),{locale:d}=Dx(),f=Ox(`defaultRenderers.form`),m=zse(d),h=S9(n),[g,_]=(0,u.useState)(h?.getFullYear()),[v,y]=(0,u.useState)(h?.getMonth()),b=Hse(n,t.mode,m),x=Array.from({length:12},(e,t)=>({value:String(t),label:Cn(new Date(2e3,t,1),`MMMM`,{locale:m})})),S=e=>{s(e?Vse(Bse(e,t.mode)):void 0),o()},C=e=>{if(l(e),e){_(h?.getFullYear()),y(h?.getMonth());return}o()},w=(e,t)=>{e===void 0||t===void 0||(S(new Date(e,t,1)),l(!1))},T=h?(0,p.jsx)(`div`,{className:`mt-3 flex justify-end border-t pt-3`,children:(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:()=>{S(void 0),l(!1)},children:f(`clearDateSelection`)})}):null;return(0,p.jsxs)(kL,{open:c,onOpenChange:C,children:[(0,p.jsx)(AL,{asChild:!0,children:(0,p.jsxs)(H,{id:e,type:`button`,variant:`outline`,className:V(`w-full justify-start text-left font-normal`,p9,!b&&`text-muted-foreground`),"aria-describedby":r,"aria-invalid":i||void 0,disabled:a,children:[(0,p.jsx)(_S,{"data-icon":`inline-start`}),b??(0,p.jsx)(`span`,{children:Use(t,f)})]})}),t.mode===`year`?(0,p.jsxs)(jL,{align:`start`,className:`w-52 p-3`,children:[(0,p.jsx)(VL,{children:(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`${e}-year`,children:f(`datePickerYearLabel`)}),(0,p.jsxs)(O2,{value:g===void 0?void 0:String(g),onValueChange:e=>{let t=Number(e);_(t),S(new Date(t,0,1)),l(!1)},children:[(0,p.jsx)(j2,{id:`${e}-year`,className:V(`w-full`,p9),children:(0,p.jsx)(A2,{placeholder:f(`datePickerSelectYear`)})}),(0,p.jsx)(M2,{children:(0,p.jsx)(k2,{children:x9.map(e=>(0,p.jsx)(N2,{value:String(e),children:e},e))})})]})]})}),T]}):null,t.mode===`year-month`?(0,p.jsxs)(jL,{align:`start`,className:`w-72 p-3`,children:[(0,p.jsxs)(VL,{className:`gap-3 @sm/field-group:grid @sm/field-group:grid-cols-2`,children:[(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`${e}-year`,children:f(`datePickerYearLabel`)}),(0,p.jsxs)(O2,{value:g===void 0?void 0:String(g),onValueChange:e=>{let t=Number(e);_(t),w(t,v)},children:[(0,p.jsx)(j2,{id:`${e}-year`,className:V(`w-full`,p9),children:(0,p.jsx)(A2,{placeholder:f(`datePickerSelectYear`)})}),(0,p.jsx)(M2,{children:(0,p.jsx)(k2,{children:x9.map(e=>(0,p.jsx)(N2,{value:String(e),children:e},e))})})]})]}),(0,p.jsxs)(HL,{children:[(0,p.jsx)(WL,{htmlFor:`${e}-month`,children:f(`datePickerMonthLabel`)}),(0,p.jsxs)(O2,{value:v===void 0?void 0:String(v),onValueChange:e=>{let t=Number(e);y(t),w(g,t)},children:[(0,p.jsx)(j2,{id:`${e}-month`,className:V(`w-full`,p9),children:(0,p.jsx)(A2,{placeholder:f(`datePickerSelectMonth`)})}),(0,p.jsx)(M2,{children:(0,p.jsx)(k2,{children:x.map(e=>(0,p.jsx)(N2,{value:e.value,children:e.label},e.value))})})]})]})]}),T]}):null,t.mode===`year-month-day`?(0,p.jsx)(jL,{align:`start`,className:`w-auto p-0`,children:(0,p.jsxs)(`div`,{className:`p-0`,children:[(0,p.jsx)(Mse,{mode:`single`,selected:h,captionLayout:`dropdown`,locale:m,startMonth:new Date(y9,0),endMonth:new Date(b9,11),onSelect:e=>{S(e),e&&l(!1)}}),h?(0,p.jsx)(`div`,{className:`flex justify-end border-t p-3 pt-2`,children:(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:()=>{S(void 0),l(!1)},children:f(`clearDateSelection`)})}):null]})}):null]})}var T9=({itemId:e,groups:t,currentResponse:n,onResponseChange:r,readOnly:i=!1,controlIdPrefix:a,className:o,emptyState:s=(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No fields available.`})})=>{let[c,l]=(0,u.useState)(()=>new Set),d=Ox(`defaultRenderers.form`),f=e=>{let t=m9(e);l(e=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n})},m=(e,t,i)=>{i?.touched&&f(e),r?.(Lse(n,m9(e),t))},h=t=>{let r=`${a??`player-${e}`}-${t.id}`,o=`${r}-label`,s=t.description?.trim()?`${r}-description`:void 0,l=qse(t,n,c,d),u=l?`${r}-error`:void 0,h=[s,u].filter(Boolean).join(` `)||void 0,g=!!l,_=t.label?.trim()||t.key;switch(t.type){case`textarea`:{let e=t.controller,a=h9(n,t)??``;return(0,p.jsxs)(HL,{className:`gap-1`,"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,htmlFor:r,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),(0,p.jsx)(B2,{id:r,rows:e.rows,placeholder:e.placeholder,value:a,className:p9,"aria-describedby":h,"aria-invalid":g||void 0,disabled:i,onBlur:()=>f(t),onChange:e=>{m(t,e.target.value?{type:I.string,value:e.target.value}:void 0)}}),s?(0,p.jsx)(KL,{className:`text-xs`,id:s,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}case`number`:{let e=t.controller,a=g9(n,t),c={id:r,type:`number`,inputMode:`decimal`,placeholder:e.placeholder,value:a??e.defaultValue??``,step:e.step,className:p9,"aria-describedby":h,"aria-invalid":g||void 0,disabled:i,onBlur:()=>f(t),onChange:e=>{let n=e.target.value;if(n===``){m(t,void 0);return}let r=Number(n);Number.isFinite(r)&&m(t,{type:I.number,value:r})}};return(0,p.jsxs)(HL,{"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,htmlFor:r,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),e.unit?(0,p.jsxs)(j5,{className:p9,children:[(0,p.jsx)(Yie,{...c}),(0,p.jsx)(M5,{align:`inline-end`,children:(0,p.jsx)(Jie,{children:e.unit})})]}):(0,p.jsx)(lx,{...c}),s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}case`datepicker`:{let e=t.controller,a=v9(n,t);return(0,p.jsxs)(HL,{"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,htmlFor:r,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),(0,p.jsx)(Jse,{controlId:r,controller:e,value:a,describedBy:h,invalid:g,readOnly:i,onTouched:()=>f(t),onValueChange:e=>{m(t,e===void 0?void 0:{type:I.date,value:e})}}),s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}case`switch`:{let e=t.controller,a=_9(n,t)??e.defaultChecked??!1,o=a?e.checkedLabel?.trim():e.uncheckedLabel?.trim();return(0,p.jsx)(WL,{htmlFor:r,className:`border-border`,children:(0,p.jsxs)(HL,{orientation:`horizontal`,"data-disabled":i?`true`:void 0,"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(UL,{children:[(0,p.jsxs)(GL,{children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,o?(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]}),(0,p.jsx)(XL,{id:r,checked:a,disabled:i,"aria-describedby":h,"aria-invalid":g||void 0,onCheckedChange:e=>{m(t,{type:I.boolean,value:e},{touched:!0})}})]})},t.id)}case`select`:{let e=t.controller,a=h9(n,t),c=!!(e.allowClear&&a),v=e.allowClear===!0,y=(0,p.jsxs)(O2,{value:a??``,onOpenChange:e=>{e||f(t)},onValueChange:e=>{m(t,e===``?void 0:{type:I.string,value:e},{touched:!0})},disabled:i,children:[(0,p.jsx)(j2,{id:r,className:V(`min-w-0 py-2 outline-none`,p9,v?V(`h-8 flex-1 border-0 bg-transparent shadow-none ring-0 data-[size=default]:h-8 data-[size=sm]:h-7`,`rounded-none focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset`,c?`rounded-l-lg rounded-r-none pr-1 pl-2.5`:`rounded-lg`):`w-full`),"aria-labelledby":o,"aria-describedby":h,"aria-invalid":g||void 0,children:(0,p.jsx)(A2,{placeholder:e.placeholder||`Select an option`})}),(0,p.jsx)(M2,{children:(0,p.jsx)(k2,{children:e.options.map(e=>(0,p.jsx)(N2,{value:e.value,children:e.label?.trim()||e.value},e.id))})})]});return(0,p.jsxs)(HL,{"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),v?(0,p.jsxs)(`div`,{"data-slot":`button-group`,role:`group`,className:V(`flex w-full min-w-0 rounded-lg border border-input bg-transparent transition-colors select-none`,p9,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`dark:bg-input/30 dark:hover:bg-input/50`,g&&`border-destructive ring-3 ring-destructive/20 dark:border-destructive/50 dark:ring-destructive/40`,i&&`opacity-50`),children:[y,c?(0,p.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":d(`clearSelection`,{label:_}),disabled:i,onClick:e=>{e.preventDefault(),e.stopPropagation(),m(t,void 0,{touched:!0})},children:(0,p.jsx)(rC,{})}):null]}):y,s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}case`slider`:{let e=t.controller,r=g9(n,t)??e.defaultValue??e.min??0;return(0,p.jsxs)(HL,{"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(Pse,{value:[r],min:e.min,max:e.max,step:e.step,disabled:i,"aria-labelledby":o,"aria-describedby":h,"aria-invalid":g||void 0,onValueChange:e=>{let n=e[0];typeof n==`number`&&m(t,{type:I.number,value:n})},onValueCommit:()=>f(t)}),e.showValue?(0,p.jsx)(`output`,{className:`w-12 shrink-0 text-right text-sm font-medium text-foreground`,children:r}):null]}),s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}default:{let e=t.controller,a=h9(n,t)??``;return(0,p.jsxs)(HL,{"data-invalid":g?`true`:void 0,children:[(0,p.jsxs)(WL,{id:o,htmlFor:r,children:[_,t.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}):null]}),(0,p.jsx)(lx,{id:r,type:e.inputMode===`password`?`password`:`text`,inputMode:e.inputMode===`password`?void 0:e.inputMode,autoComplete:e.autocomplete,placeholder:e.placeholder,value:a,className:p9,"aria-describedby":h,"aria-invalid":g||void 0,disabled:i,onBlur:()=>f(t),onChange:e=>{m(t,e.target.value?{type:I.string,value:e.target.value}:void 0)}}),s?(0,p.jsx)(KL,{id:s,className:`text-xs`,children:t.description}):null,l?(0,p.jsx)(qL,{id:u,children:l}):null]},t.id)}}};return(0,p.jsx)(`div`,{className:V(`flex flex-col gap-4`,o),children:t.length>0?t.map(t=>{let n=t.title?.trim(),r=t.description?.trim(),i=r?`player-${e}-${t.id}-description`:void 0,a=t.fields.length>0?(0,p.jsx)(`div`,{className:`@container/form-field-group`,style:vR(t.layout),children:(0,p.jsx)(VL,{className:Ise,children:t.fields.map(h)})}):(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No fields available.`});return n?(0,p.jsxs)(zL,{className:`gap-3`,"aria-describedby":i,children:[(0,p.jsx)(BL,{variant:`label`,children:n}),r?(0,p.jsx)(KL,{id:i,children:r}):null,a]},t.id):(0,p.jsxs)(`div`,{className:`space-y-3`,children:[r?(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,a]},t.id)}):s})},Yse=({itemId:e,title:t,subtitle:n,topContent:r,bottomContent:i,footer:a,resolveImageAssetUrl:o,groups:s,currentResponse:c,onResponseChange:l,readOnly:u=!1})=>(0,p.jsx)(f9,{title:t,subtitle:n,topContent:r,bottomContent:i,footer:a,resolveImageAssetUrl:o,legendFallback:`Form`,className:`gap-3`,children:(0,p.jsx)(`div`,{className:`px-4 pb-2`,children:(0,p.jsx)(T9,{itemId:e,groups:s,currentResponse:c,onResponseChange:l,readOnly:u})})});function Xse(e){if(!e)return;let t=Ve(e).trim();return t.length>0?t:void 0}function E9(e){return Xse(e.labelContent)??e.label}var D9=`flex w-full cursor-pointer items-start gap-3 px-4 py-2 transition-colors hover:bg-muted/60 has-[:disabled]:cursor-not-allowed has-[:disabled]:hover:bg-transparent`,O9=`flex min-w-0 flex-1 flex-col`;function k9(e,t){if(!e)return;let n=t.target;if(n?.closest(`[data-choice-embedded-form]`))return;let r=t.target;e===r||e.contains(r)||n?.closest(`a[href], button`)||e.click()}function A9({text:e,content:t,className:n}){return t?(0,p.jsx)(S4,{content:t,className:n,paragraphClassName:n}):(0,p.jsx)(`span`,{className:n,children:e})}function Zse(e,t,n){let r=e?.clone()??new Rn;return r.setSlotValue(t,{type:I.reference,value:n}),r}function Qse(e,t,n){let r=e?.clone()??new Rn;return r.setSlotValue(t,n.length>0?{type:I.referenceArray,value:n}:void 0),r}function j9(e,t){for(let n of t.embeddedFormGroups??[])for(let r of n.fields)e.setSlotValue(DR(t.id,r.key),void 0)}function M9(e){return e.isEmpty()?void 0:e}function N9(e,t){let n=t.embeddedFormGroups?.flatMap(n=>n.fields.flatMap(n=>{let r=e?.get(DR(t.id,n.key));return r?[[n.key,r]]:[]}))??[];return n.length>0?new Rn(n):void 0}function $se(e,t){return N9(e,t)!==void 0}function P9({option:e,itemId:t,controlIdPrefix:n,currentResponse:r,readOnly:i,open:a,onResponseChange:o}){return(e.embeddedFormGroups?.length??0)===0?null:(0,p.jsx)(o4,{open:a,children:(0,p.jsx)(c4,{className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out data-[state=closed]:grid-rows-[0fr] data-[state=open]:grid-rows-[1fr] data-[state=closed]:opacity-0 data-[state=open]:opacity-100`,children:(0,p.jsx)(`div`,{className:`overflow-hidden`,children:(0,p.jsx)(`div`,{className:`mb-2 rounded-lg border border-border/70 bg-muted/25 px-4 py-4`,children:(0,p.jsx)(T9,{itemId:t,groups:e.embeddedFormGroups??[],currentResponse:N9(r,e),onResponseChange:t=>{let n=r?.clone()??new Rn;for(let r of e.embeddedFormGroups??[])for(let i of r.fields)n.setSlotValue(DR(e.id,i.key),t?.get(i.key));o?.(M9(n))},readOnly:i,controlIdPrefix:`${n}-${e.id}-embedded`,className:`gap-5`,emptyState:null})})})})})}var ece=({itemId:e,title:t,subtitle:n,topContent:r,bottomContent:i,footer:a,resolveImageAssetUrl:o,maxSelection:s,options:c,emptyState:l,legendFallback:d=`Question`,responseSlotId:f,currentResponse:m,onResponseChange:h,name:g,controlIdPrefix:_=`choice-question`,readOnly:v=!1})=>{let y=mx(),b=Ox(`defaultRenderers.choice`),x=(0,u.useRef)({}),S=m?.get(f),C=S?.type===I.reference?S.value:void 0,w=S?.type===I.referenceArray?S.value:[],T=!wR(s),E=s,D=E!==null&&w.length>=E,O=async e=>$se(m,e)?y({title:b(`embeddedFormResetTitle`),description:b(`embeddedFormResetDescription`,{optionLabel:E9(e)}),confirmButtonText:b(`embeddedFormResetConfirm`),cancelButtonText:b(`embeddedFormResetCancel`),variant:`destructive`}):!0;return(0,p.jsx)(f9,{title:t,subtitle:n,topContent:r,bottomContent:i,footer:a,resolveImageAssetUrl:o,legendFallback:d,className:`has-[>[data-slot=checkbox-group]]:gap-2 has-[>[data-slot=radio-group]]:gap-2`,children:(0,p.jsx)(p.Fragment,{children:c.length===0?(0,p.jsx)(`p`,{className:`px-4 py-2 text-sm text-muted-foreground`,children:l}):T?(0,p.jsx)(`div`,{"data-slot":`checkbox-group`,className:`flex flex-col gap-0`,children:c.map(t=>{let n=`${_}-${t.id}`,r=`${n}-label`,i=E9(t),a=w.includes(t.id),o=v||t.disabled===!0||!a&&D;return(0,p.jsx)(HL,{orientation:`horizontal`,"data-disabled":o?`true`:void 0,className:`items-stretch p-0`,children:(0,p.jsxs)(`div`,{className:D9,onClick:e=>{o||k9(x.current[n],e)},children:[(0,p.jsx)(noe,{id:n,ref:e=>{x.current[n]=e},checked:a,disabled:o,className:`mt-1`,"aria-labelledby":r,onCheckedChange:e=>{(async()=>{if(v||!h||e!==!0&&!await O(t))return;let n=Qse(m,f,e===!0?w.includes(t.id)||E!==null&&w.length>=E?w:[...w,t.id]:w.filter(e=>e!==t.id));e!==!0&&j9(n,t),h(M9(n))})()}}),(0,p.jsxs)(`div`,{className:O9,children:[(0,p.jsx)(`div`,{id:r,className:`min-w-0 flex-1`,children:(0,p.jsx)(A9,{text:i,content:t.labelContent,className:`text-base text-foreground`})}),(0,p.jsx)(`div`,{"data-choice-embedded-form":!0,children:(0,p.jsx)(P9,{option:t,itemId:e,controlIdPrefix:_,currentResponse:m,readOnly:v||!a,open:a,onResponseChange:h})})]})]})},t.id)})}):(0,p.jsx)(JL,{name:g,value:C,onValueChange:e=>{(async()=>{if(v||!h)return;let t=c.find(e=>e.id===C);if(t&&t.id!==e&&!await O(t))return;let n=Zse(m,f,e);for(let t of c)t.id!==e&&j9(n,t);h(M9(n))})()},className:`gap-0`,children:c.map(t=>{let n=`${_}-${t.id}`,r=`${n}-label`,i=E9(t),a=v||t.disabled===!0;return(0,p.jsx)(HL,{orientation:`horizontal`,"data-disabled":a?`true`:void 0,className:`items-stretch p-0`,children:(0,p.jsxs)(`div`,{className:D9,onClick:e=>{a||k9(x.current[n],e)},children:[(0,p.jsx)(YL,{id:n,ref:e=>{x.current[n]=e},value:t.id,disabled:a,className:`mt-1`,"aria-labelledby":r}),(0,p.jsxs)(`div`,{className:O9,children:[(0,p.jsx)(`div`,{id:r,className:`min-w-0 flex-1`,children:(0,p.jsx)(A9,{text:i,content:t.labelContent,className:`text-base text-foreground`})}),(0,p.jsx)(`div`,{"data-choice-embedded-form":!0,children:(0,p.jsx)(P9,{option:t,itemId:e,controlIdPrefix:_,currentResponse:m,readOnly:v||C!==t.id,open:C===t.id,onResponseChange:h})})]})]})},t.id)})})})})};function tce(e){if(!e)return;let t=Ve(e).trim();return t.length>0?t:void 0}var F9=({content:e,resolveImageAssetUrl:t,legendFallback:n=`Information`,emptyState:r})=>(0,p.jsx)(`div`,{className:`space-y-1`,children:(0,p.jsx)(zL,{className:`rounded-xl border border-border bg-card pb-2`,children:(0,p.jsxs)(`div`,{className:`px-4 pt-4 pb-2`,children:[(0,p.jsx)(BL,{className:`sr-only`,children:tce(e)??n}),e?(0,p.jsx)(S4,{content:e,resolveImageAssetUrl:t,paragraphClassName:`text-sm`}):r??null]})})});function I9(e){return He(e)?void 0:e}function L9(e,t){return{title:I9(e?.getContent(t,`title`,`en`)),subtitle:I9(e?.getContent(t,`subtitle`,`en`)),topContent:I9(e?.getContent(t,`topContent`,`en`)),bottomContent:I9(e?.getContent(t,`bottomContent`,`en`)),footer:I9(e?.getContent(t,`cardFooter`,`en`))}}function nce(e){let{locale:t,survey:n}=Dx(),{itemTranslations:r}=Mx(),i=I9(r?.getContent(t,`content`,`en`));return(0,p.jsx)(F9,{content:i,resolveImageAssetUrl:e=>R3(n.getAsset(e)),emptyState:(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No content to display.`})})}function rce(e){let{locale:t,survey:n,surveyEngine:r}=Dx(),{item:i,itemTranslations:a}=Mx(),{currentResponse:o,setResponse:s}=Nx(),{title:c,subtitle:l,topContent:u,bottomContent:d,footer:f}=L9(a,t),m=e=>R3(n.getAsset(e)),h=hR(CR(i.config,i.id),a,t,`en`).fieldGroups.filter(e=>r.getDisplayConditionValue(i.id,e.id)!==!1);return(0,p.jsx)(Yse,{itemId:i.id,title:c,subtitle:l,topContent:u,bottomContent:d,footer:f,resolveImageAssetUrl:m,groups:h,currentResponse:o,onResponseChange:s})}function ice(e){let{locale:t,survey:n,surveyEngine:r}=Dx(),{item:i,itemTranslations:a}=Mx(),{currentResponse:o,setResponse:s}=Nx(),{title:c,subtitle:l,topContent:u,bottomContent:d,footer:f}=L9(a,t),m=kR(i.config,i.id),h=e=>R3(n.getAsset(e)),g=m.id??i.id,_=l7(m.options.map((e,t)=>({option:e,index:t})),m.shuffleOptions,`${r.sessionSeed}:${i.id}`).filter(({option:e})=>r.getDisplayConditionValue(i.id,e.id)!==!1).map(({option:e,index:n})=>{let o=I9(a?.getContent(t,TR(e.id),`en`)),s=(o?Ve(o).trim():``)||e.key?.trim()||`Option ${n+1}`;return{id:e.id,label:s,labelContent:o,disabled:r.getDisabledConditionValue(i.id,e.id)===!0,embeddedFormGroups:e.embeddedForm?hR(CR(e.embeddedForm,e.id),a,t,`en`,ER(e.id)).fieldGroups.filter(e=>r.getDisplayConditionValue(i.id,e.id)!==!1):void 0}});return(0,p.jsx)(ece,{itemId:i.id,title:c,subtitle:l,topContent:u,bottomContent:d,footer:f,resolveImageAssetUrl:h,maxSelection:m.maxSelection,options:_,emptyState:`No options available.`,responseSlotId:g,currentResponse:o,onResponseChange:s,controlIdPrefix:`player-${i.id}`,name:`player-${i.id}`})}function ace(e,t){return e&&e.trim().length>0?e:typeof t==`string`&&t.trim().length>0?t:``}var R9=({item:e,itemConfig:t,locale:n})=>{let r=G(`defaultEditors.groupPreview`),i=G(`registryLabels.items.pageBreak`),a=e,o=t,s=Sw(),c=W(e=>e.editorItemRegistry),l=o?.items??a.items??[];return l.length===0?(0,p.jsx)(`div`,{className:`flex grow justify-center items-center text-center text-muted-foreground px-12 py-24 rounded-3xl border-2 border-dashed border-border`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`p`,{className:`text-lg font-medium mb-2`,children:r(`emptyTitle`)}),(0,p.jsx)(`p`,{className:`text-sm`,children:r(`emptyDescription`)})]})}):s?(0,p.jsxs)(`div`,{className:`space-y-1 p-4 bg-muted/30 rounded-lg @container/group-preview`,children:[(0,p.jsxs)(`div`,{className:`text-sm block font-medium text-muted-foreground mb-2`,children:[(0,p.jsx)(`span`,{children:r(`items`)}),(0,p.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,l.length,`)`]})]}),(0,p.jsx)(`div`,{className:`space-y-1 hidden @sm/group-preview:block`,children:l.map(e=>{let t=s.survey.surveyItems.get(e);if(!t)return(0,p.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-red-50 rounded-lg border border-red-200`,children:[(0,p.jsx)(`div`,{className:`shrink-0 text-red-500`,children:(0,p.jsx)(wS,{className:`size-5`})}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(`p`,{className:`font-mono text-sm font-medium text-red-700`,children:s.survey.getItemKey(e)?.itemKey}),(0,p.jsx)(`p`,{className:`text-xs text-red-600 mt-1`,children:r(`itemNotFound`)})]})]},e);let a=NI(t,c),o=AI(t),l=ace(t.metadata?.itemLabel,Ve(s?.survey.getItemTranslations(t.id)?.getContent(n,`title`,`en`)));return(0,p.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-white rounded-lg border border-border`,children:[(0,p.jsx)(`div`,{className:`shrink-0`,style:{color:o},children:(0,p.jsx)(a.icon,{className:`size-5`})}),(0,p.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`p`,{className:`font-mono text-sm font-medium truncate grow`,style:{color:o},children:t.type===ve.PageBreak?i(`label`):s.survey.getItemKey(e)?.itemKey}),l&&(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:l})]})})]},e)})}),(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-2 @sm/group-preview:hidden`,children:l.map((e,t)=>{let n=s.survey.surveyItems.get(e),a=s.survey.getItemKey(e)?.itemKey??r(`unknownItemKey`),o=n?AI(n):`#dc2626`,l=n?NI(n,c):void 0;return(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1.5`,children:[(0,p.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/70 bg-muted px-1 py-0.5 text-[10px] font-semibold leading-none text-muted-foreground`,"aria-label":r(`itemPosition`,{index:t+1}),children:t+1}),(0,p.jsx)(`div`,{className:`shrink-0`,style:{color:o},children:n&&l?(0,p.jsx)(l.icon,{className:`size-4`}):(0,p.jsx)(wS,{className:`size-4`})}),(0,p.jsx)(`p`,{className:`truncate text-xs font-mono`,style:{color:o},children:n?.type===ve.PageBreak?i(`label`):a})]},e)})})]}):(0,p.jsx)(`div`,{className:`flex min-h-[220px] items-center justify-center rounded-xl border border-border/60 bg-muted/20`,children:(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`loading`)})})},oce=({item:e,itemContent:t,locale:n})=>{let r=G(`defaultEditors.pageBreakPreview`),i=G(`registryLabels.items.pageBreak`),a=AI(e),o=NI(e,W(e=>e.editorItemRegistry)),s=t?.getContent(n,`title`,`en`),c=Ve(s).trim(),l=c.length>0?c:i(`label`);return(0,p.jsxs)(`div`,{className:`min-h-[220px] rounded-xl border-2 border-dashed border-border bg-muted/20 @container/page-break-preview`,children:[(0,p.jsxs)(`div`,{className:`hidden h-full min-h-[220px] items-center justify-center gap-3 px-6 @sm/page-break-preview:flex`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-5 shadow-sm`,style:{color:a},children:(0,p.jsx)(o.icon,{className:`size-8`})}),(0,p.jsxs)(`div`,{className:`text-left`,children:[(0,p.jsx)(`p`,{className:`text-sm font-semibold tracking-wide`,style:{color:a},children:l}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`nextPageDescription`)})]})]}),(0,p.jsx)(`div`,{className:`flex h-full min-h-[220px] items-center justify-center @sm/page-break-preview:hidden`,children:(0,p.jsx)(`div`,{className:`flex items-center justify-center rounded-full border border-border bg-background p-6 shadow-sm`,style:{color:a},children:(0,p.jsx)(o.icon,{className:`size-10`})})})]})};function z9(e,t,n){let r=e?.getContent(t,n,`en`);if(!He(r))return r}function B9({title:e,subtitle:t,resolveImageAssetUrl:n}){return!e&&!t?null:(0,p.jsxs)(`div`,{className:``,children:[e&&(0,p.jsx)(S4,{content:e,resolveImageAssetUrl:n,paragraphClassName:`text-base font-medium text-foreground`}),t&&(0,p.jsx)(S4,{content:t,resolveImageAssetUrl:n,paragraphClassName:`text-sm leading-relaxed text-muted-foreground italic`})]})}var sce=({itemContent:e,locale:t})=>{let n=G(`defaultEditors.questionPreview`),r=Cw(),i=z9(e,t,`title`),a=z9(e,t,`subtitle`),o=z9(e,t,`topContent`),s=z9(e,t,`bottomContent`),c=z9(e,t,`cardFooter`),l=e=>R3(r?.getAsset(e));return(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsxs)(`div`,{className:`rounded-xl border border-border p-4 bg-card space-y-2`,children:[(0,p.jsx)(B9,{title:i,subtitle:a,resolveImageAssetUrl:l}),o?(0,p.jsx)(S4,{content:o,resolveImageAssetUrl:l,paragraphClassName:`text-sm leading-6 text-foreground/90`}):null,(0,p.jsx)(`div`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-sm text-muted-foreground`,children:n(`formPlaceholder`)}),s?(0,p.jsx)(S4,{content:s,resolveImageAssetUrl:l,paragraphClassName:`text-sm leading-6 text-muted-foreground`}):null]}),(0,p.jsx)(`div`,{className:`px-3`,children:(0,p.jsx)(S4,{content:c,resolveImageAssetUrl:l,paragraphClassName:`text-xs text-muted-foreground`})})]})},V9=({item:e,itemConfig:t,itemContent:n,locale:r})=>{let i=G(`defaultEditors.questionPreview`),a=Cw(),o=z9(n,r,`title`),s=z9(n,r,`subtitle`),c=z9(n,r,`topContent`),l=z9(n,r,`bottomContent`),u=z9(n,r,`cardFooter`),d=kR(t,e.id),f=e=>R3(a?.getAsset(e)),m=l7(d.options.map((e,t)=>({option:e,index:t})),d.shuffleOptions,`preview:${e.id}`).map(({option:e,index:t})=>{let a=z9(n,r,TR(e.id));return{option:e,labelContent:a,label:(a?Ve(a).trim():``)||e.key?.trim()||i(`optionLabel`,{index:t+1})}});return(0,p.jsxs)(`div`,{className:`space-y-1`,children:[(0,p.jsxs)(`div`,{className:`rounded-xl border border-border p-4 bg-card space-y-2`,children:[(0,p.jsx)(B9,{title:o,subtitle:s,resolveImageAssetUrl:f}),c?(0,p.jsx)(S4,{content:c,resolveImageAssetUrl:f,paragraphClassName:`text-sm leading-6 text-foreground/90`}):null,(0,p.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,p.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:d.maxSelection===1?i(`singleChoice`):d.maxSelection===null?i(`choicePreviewMaxUnlimited`):i(`choicePreviewMaxUpTo`,{max:d.maxSelection})})}),(0,p.jsx)(`div`,{className:`space-y-2`,children:m.length>0?m.map(({option:e,labelContent:t,label:n})=>(0,p.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border/70 px-3 py-2 text-sm text-foreground`,children:[(0,p.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center border border-border bg-muted/50 ${d.maxSelection===1?`rounded-full`:`rounded-[4px]`}`}),t?(0,p.jsx)(S4,{content:t,className:`min-w-0 flex-1`,paragraphClassName:`text-sm leading-5 text-foreground`}):(0,p.jsx)(`span`,{children:n})]},e.id)):(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`choicePlaceholder`)})}),l?(0,p.jsx)(S4,{content:l,resolveImageAssetUrl:f,paragraphClassName:`text-sm leading-6 text-muted-foreground`}):null]}),(0,p.jsx)(`div`,{className:`px-3`,children:(0,p.jsx)(S4,{content:u,resolveImageAssetUrl:f,paragraphClassName:`text-xs text-muted-foreground`})})]})},cce=({itemContent:e,locale:t})=>{let n=G(`defaultEditors.infoPreview`),r=Cw(),i=z9(e,t,`content`);return(0,p.jsx)(F9,{content:i,resolveImageAssetUrl:e=>R3(r?.getAsset(e)),emptyState:(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`emptyContent`)})})},lce=[`title`,`subtitle`,`topContent`,`bottomContent`,`description`,`cardFooter`];function uce(e,t){return e.find(e=>e.toLowerCase().includes(t))}var H9=[{itemType:`root`,infos:{icon:jS,labelByLocale:{en:`Root`},descriptionByLocale:{en:`Survey root item.`},defaultItemClassName:`text-sky-800`,categories:[`structure`]},editorComponent:nre,previewComponent:R9,constructor:Se},{itemType:ve.Group,infos:{icon:MS,labelByLocale:{en:`Group`},descriptionByLocale:{en:`A container for organizing survey items.`},defaultItemClassName:`text-sky-600`,categories:[`structure`]},editorComponent:ere,previewComponent:R9,constructor:Se,getInitialItem:()=>({rawItem:{id:b(),key:S(3),itemType:ve.Group}})},{itemType:ve.PageBreak,infos:{icon:gte,labelByLocale:{en:`Page break`},descriptionByLocale:{en:`Force items after this to appear on a new page.`},defaultItemClassName:`text-red-800`,categories:[`structure`]},editorComponent:tre,previewComponent:oce,constructor:Ce,getInitialItem:()=>{let e=b();return{rawItem:{id:e,key:e,itemType:ve.PageBreak}}}},{itemType:`infoItem`,constructor:Yae,renderComponent:nce,previewComponent:cce,searchAdapters:[e=>{let t=e.survey.getItemTranslations(e.itemId);if(t)for(let n of t.locales){let r=Ve(t.getContent(n,`content`)).trim();if(r.toLowerCase().includes(e.searchTerm))return[{matchType:Lx.Content,matchText:r}]}}],infos:{icon:RS,labelByLocale:{en:`Info`},descriptionByLocale:{en:`Display-only content: markdown, info, warnings, media (no responses).`},defaultItemClassName:`text-neutral-700`,categories:[`display`]},editorComponent:Jae,getInitialItem:()=>{let e=b(),t=new Ae;return t.setContent(`en`,`content`,Fe(``)),{rawItem:{id:e,key:S(3),itemType:`infoItem`,config:{}},translations:t}}},{itemType:`formItem`,constructor:Xae,renderComponent:rce,playerLocalizations:{en:{defaultRenderers:{form:{clearSelection:`Clear {label}`,clearDateSelection:`Clear selected date`,requiredError:`This field is required.`,invalidError:`Invalid response.`,datePickerSelectDate:`Select a date`,datePickerSelectMonth:`Select a month`,datePickerSelectMonthAndYear:`Select month and year`,datePickerSelectYear:`Select a year`,datePickerMonthLabel:`Month`,datePickerYearLabel:`Year`}}},de:{defaultRenderers:{form:{clearSelection:`Auswahl fuer {label} loeschen`,clearDateSelection:`Ausgewaehltes Datum loeschen`,requiredError:`Dieses Feld ist erforderlich.`,invalidError:`Ungueltige Antwort.`,datePickerSelectDate:`Datum auswaehlen`,datePickerSelectMonth:`Monat auswaehlen`,datePickerSelectMonthAndYear:`Monat und Jahr auswaehlen`,datePickerSelectYear:`Jahr auswaehlen`,datePickerMonthLabel:`Monat`,datePickerYearLabel:`Jahr`}}}},previewComponent:sce,infos:{icon:fte,labelByLocale:{en:`Form`},descriptionByLocale:{en:`Composable forms with groups and fields.`},defaultItemClassName:`text-emerald-800`,categories:[`form`]},editorComponent:qae,getInitialItem:()=>({rawItem:{id:b(),key:S(3),itemType:`formItem`,config:{}}})},{itemType:`choiceItem`,constructor:Zae,renderComponent:ice,previewComponent:V9,searchAdapters:[e=>{let t=e.survey.surveyItems.get(e.itemId);if(!t)return;let n=e.survey.getItemTranslations(e.itemId);if(!n)return;let r=kR(t.rawItem.config,e.itemId),i=n.locales,a=[];for(let e of lce)for(let t of i){let r=Ve(n.getContent(t,e)).trim();r.length>0&&a.push(r)}for(let e of r.options){let t=TR(e.id);for(let e of i){let r=Ve(n.getContent(e,t)).trim();r.length>0&&a.push(r)}}let o=uce(a,e.searchTerm);if(o)return[{matchType:Lx.Content,matchText:o}]}],playerLocalizations:{en:{defaultRenderers:{choice:{embeddedFormResetTitle:`Reset embedded form?`,embeddedFormResetDescription:`Changing {optionLabel} will clear the answers entered in its embedded form.`,embeddedFormResetConfirm:`Reset form`,embeddedFormResetCancel:`Keep answers`}}},de:{defaultRenderers:{choice:{embeddedFormResetTitle:`Eingebettetes Formular zuruecksetzen?`,embeddedFormResetDescription:`Wenn {optionLabel} geaendert wird, werden die Antworten im eingebetteten Formular entfernt.`,embeddedFormResetConfirm:`Formular zuruecksetzen`,embeddedFormResetCancel:`Antworten behalten`}}}},infos:{icon:Dte,labelByLocale:{en:`Choice`},descriptionByLocale:{en:`Choice groups with a configurable maximum number of selections; options may nest forms later.`},defaultItemClassName:`text-fuchsia-800`,categories:[`question`]},expressions:toe,editorComponent:Gae,getInitialItem:()=>{let e=b();return{rawItem:{id:e,key:S(3),itemType:`choiceItem`,config:Dre(e)}}}}],U9,W9;function G9(e){let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`string`?r:G9(r);return t}function dce(e){let t={};for(let[n,r]of Object.entries(e))t[n]=G9(r);return t}function K9(e){return{...e,infos:e.infos?{...e.infos,labelByLocale:{...e.infos.labelByLocale},descriptionByLocale:{...e.infos.descriptionByLocale},categories:[...e.infos.categories]}:void 0,playerLocalizations:e.playerLocalizations?dce(e.playerLocalizations):void 0,expressions:e.expressions?[...e.expressions]:void 0,searchAdapters:e.searchAdapters?[...e.searchAdapters]:void 0}}function q9(e){return e.map(e=>K9(e))}function J9(e={}){let{includeDefaultEntries:t=!0,entries:n=[],conflictStrategy:r=`override`}=e,i=[],a=new Map,o=e=>{let t=a.get(e.itemType),n=K9(e);if(t===void 0){a.set(e.itemType,i.length),i.push(n);return}if(r===`error`)throw Error(`Duplicate item registry entry for type: ${e.itemType}`);i[t]=n};if(t)for(let e of H9)o(e);for(let e of n)o(e);return i}function Y9(){return q9(H9)}function fce(e={}){return Qx(J9(e),{requireBuiltInTypes:e.requireBuiltInTypes,categoryLabels:e.categoryLabels})}function pce(e={}){return Jx(J9(e),{requireRenderer:e.requireRenderer})}function X9(){return U9||=Qx(H9),U9}function Z9(){return W9||=Jx(H9),W9}var Q9=({item:e})=>{let{surveyPlayerRegistry:t}=Dx(),n=(t??Z9()).getRenderer(e.type);return(0,p.jsx)(jx,{renderedItemInfos:e,children:n?u.default.createElement(n,{renderedItem:e}):(0,p.jsx)(`p`,{children:`not implemented`})})};function mce({className:e,value:t,...n}){return(0,p.jsx)(_m,{"data-slot":`progress`,className:V(`relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted`,e),...n,children:(0,p.jsx)(vm,{"data-slot":`progress-indicator`,className:`size-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}function $9(e){if(!e)return;let t=Ve(e).trim();return t.length>0?t:void 0}function hce(e){let t=e.translations.navigationContent;if(!t)return;let n={};for(let[e,r]of Object.entries(t)){let t=$9(r.previousButtonText),i=$9(r.nextButtonText),a=$9(r.submitButtonText),o=$9(r.pageIndicatorText);!t&&!i&&!a&&!o||(n[e]={navigation:{...t?{previousButtonLabel:t}:{},...i?{nextButtonLabel:i}:{},...a?{submitButtonLabel:a}:{},...o?{pageIndicator:o}:{}}})}return Object.keys(n).length>0?n:void 0}var gce=({survey:e,locale:t=`en`,size:n=`large`,surveyEngine:r,surveyPlayerRegistry:i,localizations:a,onSubmit:o,className:s})=>{let[c,l]=(0,u.useState)(0),[d,f]=(0,u.useState)(0),[m,h]=(0,u.useState)(e);e!==m&&(h(e),f(0),l(0));let g=i??Z9(),_=vx(a,hce(e)),v=Cx(t,vx(g.localizations,_)),y=(0,u.useMemo)(()=>new Vn(e,{locale:t}),[e,t]),b=r??y;(0,u.useEffect)(()=>{b.updateContext({locale:t})},[b,t]);let x=b.getSurveyPages(n);x.length===0?d!==0&&f(0):d>=x.length&&f(x.length-1);let S=x[d]??[],C=x.length>0&&d>=x.length-1,w=x.length>0?(d+1)/x.length*100:0,T=v(`navigation.previousButtonLabel`),E=v(`navigation.nextButtonLabel`),D=v(`navigation.submitButtonLabel`),O=v(`navigation.pageIndicator`,{current:d+1,total:x.length});return(0,p.jsx)(Ex,{survey:e,locale:t,surveyEngine:b,surveyPlayerRegistry:g,localizations:_,onResponseChanged:()=>{l(e=>e+1)},children:(0,p.jsx)(`div`,{className:s??`mx-auto flex w-full flex-col gap-4`,children:x.length>0?(0,p.jsxs)(`div`,{className:`space-y-4`,children:[x.length>1&&(0,p.jsxs)(`div`,{className:`space-y-2 px-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,p.jsx)(`p`,{className:`grow uppercase tracking-wide`,children:O}),(0,p.jsxs)(`p`,{children:[Math.round(w),`%`]})]}),(0,p.jsx)(mce,{value:w})]}),S.map(e=>(0,p.jsx)(Q9,{item:e},e.id)),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[d>0?(0,p.jsx)(H,{variant:`outline`,onClick:()=>{f(e=>Math.max(e-1,0))},children:T}):null,C?(0,p.jsx)(H,{onClick:()=>{o?.(b.getResponses(),b)},children:D}):(0,p.jsx)(H,{onClick:()=>{f(e=>Math.min(e+1,Math.max(x.length-1,0)))},children:E})]})]}):(0,p.jsx)(`div`,{className:`rounded-xl border border-dashed border-border bg-card/60 px-6 py-10 text-center text-sm text-muted-foreground`,children:`This survey does not currently render any player-visible items.`})})})};exports.APPLY_RICH_TEXT_STYLE_COMMAND=XZ,exports.CONVERT_RICH_TEXT_LINK_TO_TEXT_COMMAND=tQ,exports.DEFAULT_BLOCK_CONTENT_POLICY=cQ,exports.DEFAULT_CATEGORY_LABELS=Px,exports.DEFAULT_COMPACT_CONTENT_POLICY=sQ,exports.FilepickerDropzone=D2,exports.INSERT_RICH_TEXT_LINK_COMMAND=QZ,exports.INSERT_RICH_TEXT_TEMPLATE_VARIABLE_COMMAND=ZZ,exports.OPEN_RICH_TEXT_LINK_EDITOR_COMMAND=$Z,exports.RichTextBlockEditor=a4,exports.RichTextContentView=S4,exports.RichTextEditor=i4,exports.SurveyContextProvider=Ex,exports.SurveyEditor=Cae,exports.SurveyImageAssetManager=W3,exports.SurveyItemRenderer=Q9,exports.SurveyPlayer=gce,exports.UPDATE_RICH_TEXT_LINK_COMMAND=eQ,exports.buildSurveyFileName=Dae,exports.cloneRegistryEntries=q9,exports.createBlankEditorState=wae,exports.createComposedEditorRegistry=fce,exports.createEditorStateFromRawSurvey=z5,exports.createRegistryEntries=J9,exports.createRichTextEditorValueFromContent=YQ,exports.createRichTextEditorValueFromPlainText=FZ,exports.createRichTextEditorValueFromText=XQ,exports.createSurveyPlayerRegistry=pce,exports.entriesToComposedEditorRegistry=Qx,exports.entriesToItemTypeRegistry=qx,exports.entriesToParticipantRegistry=Jx,exports.getDefaultComposedEditorRegistry=X9,exports.getDefaultRegistryEntries=Y9,exports.getDefaultSurveyPlayerRegistry=Z9,exports.getRichTextContentFromEditorState=JQ,exports.isBlockContentPolicyVariant=SQ,exports.mergeRichTextContentPolicy=lQ,exports.parseEditorStateFromJsonText=Tae,exports.resolveCategoryLabel=Ix,exports.sanitizeContentForPolicy=xQ,exports.serializeSurveyStateForFile=Eae,exports.useSurveyAssets=P3,exports.useSurveyCtx=Dx,exports.useSurveyImageAssets=F3,exports.useSurveyTranslation=Ox,exports.useUnusedSurveyAssetCount=I3,exports.validateRegistryEntries=Kx;
|
|
66
186
|
//# sourceMappingURL=survey-ui.cjs.js.map
|