import{d as e,m as t,n,s as r,t as i,y as a}from"./hooks.module-5xe-uC6c.js";import{E as o}from"./content_renderer-CoENEE63.js";import{p as s}from"./compat.module-PCbCX7TU.js";import{t as c}from"./jsxRuntime.module--xb8gfv5.js";import{Y as l,l as u}from"./hooks-CSTgmcXO.js";import{t as d}from"./Dropdown-CzkWLbhy.js";import{a as f}from"./FormList-BjfvxCF_.js";import{t as p}from"./Icon-rHGhZ_GT.js";function m({values:e,keyProperty:t,titleProperty:n,titleSuffixProperty:r,descriptionProperty:i,currentValue:o,onChange:s,...l}){let u=e.find(e=>e[t]===o),p=e=>{let t=e[n],i=r?e[r]:null;return i?c(a,{children:[t,` `,c(`small`,{children:i})]}):t};return c(d,{text:u?p(u):``,...l,children:e.map(e=>c(f,{onClick:()=>s(e[t]),checked:o===e[t],description:i&&e[i],selected:o===e[t],children:p(e)}))})}function h(){return c(`span`,{className:`bx bx-loader bx-spin`})}e();function g({initiallyExpanded:e,...t}){let[n,i]=r(e);return c(_,{...t,expanded:n,setExpanded:i})}function _({title:e,children:n,className:a,expanded:s,setExpanded:d}){let f=i(null),m=i(null),{height:h}=u(m)??{},g=l(),[_,v]=r(!1),[y,b]=r(!1);return t(()=>{let e=setTimeout(()=>{v(!0)},200);return()=>clearTimeout(e)},[]),t(()=>{if(s)if(_){let e=setTimeout(()=>{b(!0)},250);return()=>clearTimeout(e)}else b(!0);else b(!1)},[s,_]),c(`div`,{className:o(`collapsible`,a,{expanded:s,"with-transition":_}),children:[c(`button`,{className:`collapsible-title tn-low-profile`,onClick:()=>d(!s),"aria-expanded":s,"aria-controls":g,children:[c(p,{className:`arrow`,icon:`bx bx-chevron-right`}),`\xA0`,e]}),c(`div`,{id:g,ref:f,className:o(`collapsible-body`,{"fully-expanded":y}),style:{height:s?h:`0`},"aria-hidden":!s,children:c(`div`,{ref:m,className:`collapsible-inner-body`,children:n})})]})}s();function v({apiRef:e,currentValue:r,editor:a,config:o,disableNewlines:s,disableSpellcheck:l,onChange:u,onClick:d,onInitialized:f,...p}){let m=i(null),h=i(null);return n(e,()=>({focus(){h.current?.editing.view.focus(),h.current?.model.change(e=>{let t=h.current?.editing.model.document.getRoot();t&&e.setSelection(e.createPositionAt(t,`end`))})},setText(e){h.current?.setData(e)}}),[m]),t(()=>{m.current&&a.create(m.current,o).then(e=>{if(h.current=e,s&&e.editing.view.document.on(`enter`,(e,t)=>{t.preventDefault(),e.stop()},{priority:`high`}),l){let t=e.editing.view.document.getRoot();t&&e.editing.view.change(e=>e.setAttribute(`spellcheck`,`false`,t))}u&&e.model.document.on(`change:data`,()=>{u(e.getData())}),r&&e.setData(r),f?.(e)})},[]),t(()=>{h.current&&h.current.setData(r??``)},[r]),c(`div`,{ref:m,onClick:e=>{if(d){let t=h.current?.model.document.selection.getFirstPosition();d(e,t)}},...p})}export{m as a,h as i,g as n,_ as r,v as t};