@tempots/beatui 0.19.0 → 0.20.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.
Files changed (124) hide show
  1. package/dist/{2019-D0n7sHsB.js → 2019-B4Mw3glM.js} +2 -2
  2. package/dist/{2019-CfIF9XVA.cjs → 2019-u0Cs1ZdE.cjs} +1 -1
  3. package/dist/{2020-D1ziwonq.cjs → 2020-BcwEHv2O.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-BvFyb4Gy.js} +2 -2
  5. package/dist/{ar-DYmDITuw.cjs → ar-DyhaQaJU.cjs} +1 -1
  6. package/dist/{ar-CMndb3tf.js → ar-RkpJ2n6w.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +646 -651
  9. package/dist/beatui.css +1 -1
  10. package/dist/{de-Cgy7XJBg.js → de-BdSVR4Zm.js} +1 -1
  11. package/dist/{de-ClQgQrXM.cjs → de-CnZ4Ik2a.cjs} +1 -1
  12. package/dist/{es-j0qszDAW.js → es-B_Qn5EUy.js} +1 -1
  13. package/dist/{es-BN5Mihv0.cjs → es-ZKraCneL.cjs} +1 -1
  14. package/dist/{fa-BUQvM0nj.cjs → fa-D2p_ch4Q.cjs} +1 -1
  15. package/dist/{fa-COUp2ofv.js → fa-jBaLjqfG.js} +1 -1
  16. package/dist/{fr-B5Ar6QcE.js → fr-B0KaMM2j.js} +1 -1
  17. package/dist/{fr-CwvsJDIZ.cjs → fr-CBeo42lQ.cjs} +1 -1
  18. package/dist/{he-HZvvmFUB.cjs → he-BmqEF3o-.cjs} +1 -1
  19. package/dist/{he-D5HTHvKh.js → he-DjeYjcW7.js} +1 -1
  20. package/dist/{hi-Cnr1RtgA.cjs → hi-BAfIFl1n.cjs} +1 -1
  21. package/dist/{hi-Bcc7iEXp.js → hi-DxBQV0uz.js} +1 -1
  22. package/dist/index-4NoQLiJo.cjs +2 -0
  23. package/dist/{index-DSvEBuy-.cjs → index-9UO7Pd64.cjs} +1 -1
  24. package/dist/{index-tuwLQMCb.js → index-B001qopB.js} +3 -3
  25. package/dist/{index-ykojBEwT.js → index-BIUeLQJ1.js} +4 -4
  26. package/dist/{index-FEy4Hwnx.cjs → index-BInDdLXi.cjs} +1 -1
  27. package/dist/{index-BUKtbimR.cjs → index-BWiQR9j3.cjs} +1 -1
  28. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  29. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  30. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  31. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  32. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  33. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  34. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  35. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  36. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  37. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  38. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  39. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  40. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  41. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  42. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  43. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  44. package/dist/{index-2DKUYRWr.js → index-Cs_PxtnZ.js} +1 -1
  45. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  46. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  47. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  48. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  49. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  50. package/dist/{index-BirEb-BA.js → index-DOlgncMG.js} +2178 -2193
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.cjs} +1 -1
  53. package/dist/{index-C9XAXTDx.cjs → index-DdlxwtnE.cjs} +1 -1
  54. package/dist/{index-_OaxQJX1.js → index-DhJIuRg9.js} +4 -4
  55. package/dist/{index-Bg1QLlyj.js → index-DiV6JJiS.js} +3 -3
  56. package/dist/{index-DD8_efWr.cjs → index-Dl-wY6fc.cjs} +1 -1
  57. package/dist/{index-BguvTLHu.cjs → index-DlaVE6S2.cjs} +1 -1
  58. package/dist/index-JHbFZFZF.cjs +8 -0
  59. package/dist/{index-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  60. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  61. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  62. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  63. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  64. package/dist/{index-CoBM7UvE.js → index-c-O5R5i2.js} +2 -2
  65. package/dist/{index-C4UzgyIA.cjs → index-cjtIcxwt.cjs} +1 -1
  66. package/dist/{index-faGepKVA.js → index-fnMeddEM.js} +2 -2
  67. package/dist/{index-DV7tB1MN.cjs → index-uR3OZ_8K.cjs} +1 -1
  68. package/dist/index.cjs.js +25 -25
  69. package/dist/index.es.js +2248 -2264
  70. package/dist/index.esm-DJRz9AE-.cjs +1 -0
  71. package/dist/{index.esm-CSotgpVw.js → index.esm-DPNh6inz.js} +410 -420
  72. package/dist/{it-CTCKFU5g.js → it-B4qZsicu.js} +1 -1
  73. package/dist/{it-B7KeOLBm.cjs → it-CzKrFTFY.cjs} +1 -1
  74. package/dist/{ja-BGoETTZv.js → ja-BnCSmhkg.js} +1 -1
  75. package/dist/{ja-0ldomgID.cjs → ja-i_9MZ1j0.cjs} +1 -1
  76. package/dist/json-schema/index.cjs.js +1 -1
  77. package/dist/json-schema/index.es.js +1 -1
  78. package/dist/{ko-C4WEkArz.cjs → ko-CF9il-Az.cjs} +1 -1
  79. package/dist/{ko-xHeRs9LU.js → ko-D_gGkjrC.js} +1 -1
  80. package/dist/milkdown/index.cjs.js +1 -1
  81. package/dist/milkdown/index.es.js +1 -1
  82. package/dist/{milkdown-input-BbbZJGDl.js → milkdown-input-CYme9OBn.js} +14757 -14822
  83. package/dist/milkdown-input-KjtVqDzi.cjs +941 -0
  84. package/dist/modal-B-f3LBKr.cjs +1 -0
  85. package/dist/modal-BItfEmu0.js +600 -0
  86. package/dist/monaco/index.cjs.js +2 -2
  87. package/dist/monaco/index.es.js +114 -116
  88. package/dist/{nl-ey2Li7DF.js → nl-CsLCWUFF.js} +1 -1
  89. package/dist/{nl-D-y231ZO.cjs → nl-DfWlqR6T.cjs} +1 -1
  90. package/dist/notice-B7JqE59s.cjs +1 -0
  91. package/dist/notice-CmmpobJd.js +2415 -0
  92. package/dist/{pl-Bf0QaCGx.js → pl-Bsmj1KbZ.js} +1 -1
  93. package/dist/{pl-G6e4Mybr.cjs → pl-wK2sgv7l.cjs} +1 -1
  94. package/dist/{pt-D-_KxA9g.js → pt-BR_NuRJS.js} +1 -1
  95. package/dist/{pt-CD2Eqazl.cjs → pt-DAQIuOPW.cjs} +1 -1
  96. package/dist/{ru-CKh2xgqC.cjs → ru-BnoiCxrw.cjs} +1 -1
  97. package/dist/{ru-Dzbl29K2.js → ru-CiQ_qKD_.js} +1 -1
  98. package/dist/timer-BdH4cK6a.cjs +1 -0
  99. package/dist/timer-CQlK5LhW.js +47 -0
  100. package/dist/{tr-BbpC5gzM.cjs → tr-Bme5PfaE.cjs} +1 -1
  101. package/dist/{tr-yMHT8n7z.js → tr-Q9xP1nE4.js} +1 -1
  102. package/dist/translations-ClgoCEFC.js +1969 -0
  103. package/dist/{translations-DbN-OSLv.js → translations-D4hFMU4P.js} +1 -1
  104. package/dist/translations-DRBh70w8.cjs +2 -0
  105. package/dist/{translations-CXE8Z_Ac.cjs → translations-lnK_6RdU.cjs} +1 -1
  106. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  107. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  108. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  109. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  110. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  111. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  112. package/package.json +6 -6
  113. package/dist/index-B66rNs5i.cjs +0 -2
  114. package/dist/index-DXFKCiah.cjs +0 -8
  115. package/dist/index.esm-8xolKogd.cjs +0 -1
  116. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  117. package/dist/modal-nbZW44XS.js +0 -614
  118. package/dist/modal-wbG_oGOr.cjs +0 -1
  119. package/dist/notice-CIPcSfD5.js +0 -2432
  120. package/dist/notice-Cq02YHoN.cjs +0 -1
  121. package/dist/timer-CcMCjYrq.cjs +0 -1
  122. package/dist/timer-CkgWORR9.js +0 -42
  123. package/dist/translations-DBtfTNnM.js +0 -2005
  124. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -0,0 +1 @@
1
+ "use strict";const o=require("@tempots/dom"),x=require("./timer-BdH4cK6a.cjs"),w=require("./translations-DRBh70w8.cjs"),j=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function W(r){return Array.from(r.querySelectorAll(j)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function B(r={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:a,returnFocus:i,clickOutsideDeactivates:c=!1,onClickOutside:d}=r;return o.WithElement(h=>{let f=t,m=null,u=[];typeof document<"u"&&(m=document.activeElement);const b=()=>{u=W(h)},g=n=>{if(f){if(s&&n.key==="Escape"){n.preventDefault(),e?.();return}if(n.key==="Tab"){if(b(),u.length===0){n.preventDefault();return}const v=u.indexOf(document.activeElement);n.shiftKey?v<=0&&(n.preventDefault(),u[u.length-1]?.focus()):v>=u.length-1&&(n.preventDefault(),u[0]?.focus())}}},p=n=>{if(!f||!c)return;const v=n.target;h.contains(v)||d?.()},y=()=>{if(!f)return;b();let n=null;typeof a=="function"?n=a():a?n=a:u.length>0&&(n=u[0]),n&&setTimeout(()=>{n?.focus()},50),document.addEventListener("keydown",g,!0),c&&document.addEventListener("click",p,!0)},T=()=>{f=!1,document.removeEventListener("keydown",g,!0),document.removeEventListener("click",p,!0);let n=null;typeof i=="function"?n=i():i?n=i:m&&(n=m),n&&document.body.contains(n)&&setTimeout(()=>{n?.focus()},0)};return setTimeout(()=>y(),0),o.OnDispose(()=>{T()})})}function P(r={}){return{activate:()=>B({...r,active:!0}),deactivate:()=>B({...r,active:!1})}}function F({initialStatus:r="closed",openedAfter:t,closedAfter:s}){const e=o.prop(r),a=()=>{e.set("start-opening")},i=()=>{e.set("start-closing")},c=e.map(n=>n!=="closed"&&n!=="start-closing"&&n!=="closing"),d=n=>{n?a():i()},h=()=>{d(!c.value)},f=n=>e.on(v=>{v==="closed"&&n()});let m=()=>{};e.on(n=>{switch(m(),n){case"start-opening":m=x.g(()=>e.set("opening"));break;case"opening":m=t(()=>e.set("opened"));break;case"start-closing":m=x.g(()=>e.set("closing"));break;case"closing":m=s(()=>e.set("closed"));break}}),e.onDispose(()=>m());const u=e.map(n=>n==="closed"),b=e.map(n=>n==="start-opening"),g=e.map(n=>n==="opening"),p=e.map(n=>n==="opened"),y=e.map(n=>n==="closing"),T=e.map(n=>n==="start-closing");return{status:e,open:a,close:i,toggle:h,setOpen:d,display:c,isClosed:u,isStartOpening:b,isOpening:g,isOpened:p,isClosing:y,isStartClosing:T,dispose:()=>e.dispose(),onClosed:f}}function U({initialStatus:r="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return F({initialStatus:r,openedAfter:a=>x.T(a,s),closedAfter:a=>x.T(a,e)})}function $(r,t){let s=!1,e=null;function a(){s||(s=!0,e&&(clearTimeout(e),e=null),t())}function i(f){f.target===r&&a()}function c(f){f.target===r&&a()}const d=()=>{if(typeof r.getAnimations>"u"){e=setTimeout(a,16);return}r.getAnimations().length===0?(r.addEventListener("transitionend",i,{once:!0}),r.addEventListener("animationend",c,{once:!0}),e=setTimeout(a,1e3)):(r.addEventListener("transitionend",i,{once:!0}),r.addEventListener("animationend",c,{once:!0}))},h=x.g(d);return()=>{s=!0,h(),e&&(clearTimeout(e),e=null),r.removeEventListener("transitionend",i),r.removeEventListener("animationend",c)}}function M({initialStatus:r="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...F({initialStatus:r,openedAfter:e=>s==null?(e(),()=>{}):$(s,e),closedAfter:e=>s==null?(e(),()=>{}):$(s,e)})}}function z(r,t){return o.attr.class(o.computedOf(r,t)((s,e)=>`bu-toggle--animated bu-toggle--${s} bu-toggle--${e}`))}function q(r){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=r.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(a=>({message:a.message,path:a.path}))}},types:void 0},safeParse:s=>{const e=r.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(a=>({message:a.message,path:a.path?.map(i=>typeof i=="object"&&"key"in i?i.key.toString():i.toString())||[]}))}}}}}class k{optional(){return new R(this)}default(t){return new H(this,t)}schema(){return q(this)}}class C extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const a=e(t);a&&s.push({message:a})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new C;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>a.length<t?s:null),e}max(t,s){const e=new C;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>a.length>t?s:null),e}regex(t,s){const e=new C;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>t.test(a)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new C;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,a=>s.test(a)?null:t],e}refine(t){const s=new C;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class A extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new A;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const a=e.validate.bind(e);return e.validate=i=>{const c=a(i);return c.success?t(c.data)?c:{success:!1,errors:[{message:s}]}:c},e}literal(t,s){const e=new A;return e.mustBeTrue=!0,e.trueMessage=s,e}}class R extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class H extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class O extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},a=[];for(const[i,c]of Object.entries(this.shape)){const d=c.validate(s[i]);if(d.success)e[i]=d.data;else for(const h of d.errors)a.push({message:h.message,path:[i,...h.path||[]]})}return a.length>0?{success:!1,errors:a}:{success:!0,data:e}}refine(t,s){const e=new O(this.shape),a=e.validate.bind(e);return e.validate=i=>{const c=a(i);if(!c.success)return c;const d=t(c.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:c.data}},e}}const K=()=>new C,N=()=>new A,_=r=>new O(r);function D(r){return o.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(i=>i());return r(({effect:i="opaque",mode:c="capturing",onClickOutside:d,onEscape:h,content:f,container:m="body"})=>{m==="body"&&(t=t.makePortal("body"));const u=M();u.onClosed(e);let b=()=>{},g=()=>{};const p=E=>{E.key==="Escape"&&(h?.(),u.close())},y=()=>{d?.(),u.close()},T=E=>{b(),g(),E==="capturing"?(document.addEventListener("keydown",p),b=()=>document.removeEventListener("keydown",p),t.element.addEventListener("mousedown",y),g=()=>t.element.removeEventListener("mousedown",y)):(b=()=>{},g=()=>{})},n=o.Value.on(c,T);s.push(n),s.push(()=>{b(),g()});const v=()=>{const E=new Set;for(const l of t.element.querySelectorAll(":scope > :not([data-overlay])"))l.hasAttribute("inert")?E.add(l):l.setAttribute("inert","");return s.push(()=>{for(const l of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(l)||l.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),o.html.div(o.WithElement(l=>u.setElement(l)),o.dataAttr.status(u.status.map(String)),o.dataAttr.overlay("true"),o.attr.class(o.computedOf(i??"opaque",c)((l,L)=>`bc-overlay bc-overlay--effect-${l} bc-overlay--mode-${L}`)),f)},V=o.render(v(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(V),x.g(()=>u.open())},e)})}function I(r,t){const{size:s="md",dismissable:e=!0,showCloseButton:a=!0,onClose:i,overlayEffect:c="opaque",container:d="body",position:h="center"}=r;return D((f,m)=>{let u=()=>{};return t(p=>{u=m;const y=o.prop("capturing");o.Value.on(e,l=>{y.set(l?"capturing":"non-capturing")});const T=o.computedOf(p.header!=null,a)((l,L)=>l||L),n=w.sessionId("modal"),v=`${n}-header`,V=`${n}-body`,E=o.html.div(o.attr.class(o.computedOf(s,h)((l,L)=>`bc-modal bc-modal--size-${l} bc-modal--container-${d} bc-modal--position-${L}`)),o.attr.role("dialog"),o.aria.modal(!0),...p.header?[o.aria.labelledby(v)]:[],o.aria.describedby(V),o.attr.tabindex(-1),o.attr.id(n),o.dataAttr.focusTrap("true"),o.on.mousedown(l=>l.stopPropagation()),B({escapeDeactivates:!1,initialFocus:()=>{const l=document.getElementById(n);if(!l)return null;const L=l.querySelector('[aria-label="Close modal"]');if(L)return L;const S=l.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||l}}),o.html.div(o.attr.class("bc-modal__content"),o.When(T,()=>o.html.div(o.attr.class("bc-modal__header"),o.html.div(o.attr.class("bu-font-semibold bu-text-gray"),...p.header?[o.attr.id(v)]:[],p.header),o.When(a,()=>o.Use(w.BeatUII18n,l=>w.CloseButton({size:"sm",label:l.$.closeModal,onClick:()=>{u(),m()}}))))),o.html.div(o.attr.class("bc-modal__body"),o.attr.id(V),p.body),p.footer&&o.html.div(o.attr.class("bc-modal__footer"),p.footer)));f({mode:y,effect:c??"opaque",container:d,content:E,onClickOutside:()=>{i?.(),m()},onEscape:()=>{i?.(),m()}})},()=>{u(),m()})})}function G(r,t){const{confirmText:s,cancelText:e,onConfirm:a,onCancel:i,...c}=r;return o.Use(w.BeatUII18n,d=>I({showCloseButton:!1,...c},(h,f)=>{const m=()=>{a?.(),f()},u=()=>{i?.(),f()};return t(g=>{h({body:g,footer:o.Fragment(o.attr.class("bu-justify-end"),w.Button({variant:"outline",onClick:u},o.coalesce(e,d.$.cancel)),w.Button({color:"primary",variant:"filled",onClick:m},o.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggleClass=z;exports.BooleanValidator=A;exports.ConfirmModal=G;exports.FocusTrap=B;exports.Modal=I;exports.ObjectValidator=O;exports.Overlay=D;exports.StringValidator=C;exports.boolean=N;exports.createStandardSchema=q;exports.object=_;exports.string=K;exports.useAnimatedElementToggle=M;exports.useAnimatedToggle=F;exports.useFocusTrap=P;exports.useTimedToggle=U;
@@ -0,0 +1,600 @@
1
+ import { WithElement as W, OnDispose as N, prop as z, attr as h, computedOf as A, WithBrowserCtx as _, Value as R, render as G, html as x, dataAttr as O, aria as F, on as J, When as D, Use as U, Fragment as Q, coalesce as q } from "@tempots/dom";
2
+ import { g as V, T as I } from "./timer-CQlK5LhW.js";
3
+ import { s as X, B as H, C as Y, a as j } from "./translations-ClgoCEFC.js";
4
+ const Z = [
5
+ "a[href]",
6
+ "button:not([disabled])",
7
+ "input:not([disabled])",
8
+ "select:not([disabled])",
9
+ "textarea:not([disabled])",
10
+ '[tabindex]:not([tabindex="-1"])',
11
+ '[contenteditable="true"]',
12
+ "audio[controls]",
13
+ "video[controls]",
14
+ "details > summary:first-of-type",
15
+ "details[open]"
16
+ ].join(", ");
17
+ function ee(a) {
18
+ return Array.from(a.querySelectorAll(Z)).filter(
19
+ (t) => {
20
+ const s = t;
21
+ return s.offsetWidth > 0 && s.offsetHeight > 0 && !s.hasAttribute("inert") && window.getComputedStyle(s).visibility !== "hidden";
22
+ }
23
+ );
24
+ }
25
+ function $(a = {}) {
26
+ const {
27
+ active: t = !0,
28
+ escapeDeactivates: s = !0,
29
+ onEscape: e,
30
+ initialFocus: o,
31
+ returnFocus: r,
32
+ clickOutsideDeactivates: i = !1,
33
+ onClickOutside: l
34
+ } = a;
35
+ return W((f) => {
36
+ let m = t, d = null, u = [];
37
+ typeof document < "u" && (d = document.activeElement);
38
+ const b = () => {
39
+ u = ee(f);
40
+ }, g = (n) => {
41
+ if (m) {
42
+ if (s && n.key === "Escape") {
43
+ n.preventDefault(), e?.();
44
+ return;
45
+ }
46
+ if (n.key === "Tab") {
47
+ if (b(), u.length === 0) {
48
+ n.preventDefault();
49
+ return;
50
+ }
51
+ const v = u.indexOf(
52
+ document.activeElement
53
+ );
54
+ n.shiftKey ? v <= 0 && (n.preventDefault(), u[u.length - 1]?.focus()) : v >= u.length - 1 && (n.preventDefault(), u[0]?.focus());
55
+ }
56
+ }
57
+ }, p = (n) => {
58
+ if (!m || !i) return;
59
+ const v = n.target;
60
+ f.contains(v) || l?.();
61
+ }, y = () => {
62
+ if (!m) return;
63
+ b();
64
+ let n = null;
65
+ typeof o == "function" ? n = o() : o ? n = o : u.length > 0 && (n = u[0]), n && setTimeout(() => {
66
+ n?.focus();
67
+ }, 50), document.addEventListener("keydown", g, !0), i && document.addEventListener("click", p, !0);
68
+ }, C = () => {
69
+ m = !1, document.removeEventListener("keydown", g, !0), document.removeEventListener("click", p, !0);
70
+ let n = null;
71
+ typeof r == "function" ? n = r() : r ? n = r : d && (n = d), n && document.body.contains(n) && setTimeout(() => {
72
+ n?.focus();
73
+ }, 0);
74
+ };
75
+ return setTimeout(() => y(), 0), N(() => {
76
+ C();
77
+ });
78
+ });
79
+ }
80
+ function le(a = {}) {
81
+ return {
82
+ activate: () => $({ ...a, active: !0 }),
83
+ deactivate: () => $({ ...a, active: !1 })
84
+ };
85
+ }
86
+ function K({
87
+ initialStatus: a = "closed",
88
+ openedAfter: t,
89
+ closedAfter: s
90
+ }) {
91
+ const e = z(a), o = () => {
92
+ e.set("start-opening");
93
+ }, r = () => {
94
+ e.set("start-closing");
95
+ }, i = e.map(
96
+ (n) => n !== "closed" && n !== "start-closing" && n !== "closing"
97
+ ), l = (n) => {
98
+ n ? o() : r();
99
+ }, f = () => {
100
+ l(!i.value);
101
+ }, m = (n) => e.on((v) => {
102
+ v === "closed" && n();
103
+ });
104
+ let d = () => {
105
+ };
106
+ e.on((n) => {
107
+ switch (d(), n) {
108
+ case "start-opening":
109
+ d = V(() => e.set("opening"));
110
+ break;
111
+ case "opening":
112
+ d = t(() => e.set("opened"));
113
+ break;
114
+ case "start-closing":
115
+ d = V(() => e.set("closing"));
116
+ break;
117
+ case "closing":
118
+ d = s(() => e.set("closed"));
119
+ break;
120
+ }
121
+ }), e.onDispose(() => d());
122
+ const u = e.map((n) => n === "closed"), b = e.map((n) => n === "start-opening"), g = e.map((n) => n === "opening"), p = e.map((n) => n === "opened"), y = e.map((n) => n === "closing"), C = e.map((n) => n === "start-closing");
123
+ return {
124
+ status: e,
125
+ open: o,
126
+ close: r,
127
+ toggle: f,
128
+ setOpen: l,
129
+ display: i,
130
+ isClosed: u,
131
+ isStartOpening: b,
132
+ isOpening: g,
133
+ isOpened: p,
134
+ isClosing: y,
135
+ isStartClosing: C,
136
+ dispose: () => e.dispose(),
137
+ onClosed: m
138
+ };
139
+ }
140
+ function de({
141
+ initialStatus: a = "closed",
142
+ duration: t,
143
+ openDuration: s = t ?? 500,
144
+ closeDuration: e = t ?? 500
145
+ } = {}) {
146
+ return K({
147
+ initialStatus: a,
148
+ openedAfter: (o) => I(o, s),
149
+ closedAfter: (o) => I(o, e)
150
+ });
151
+ }
152
+ function P(a, t) {
153
+ let s = !1, e = null;
154
+ function o() {
155
+ s || (s = !0, e && (clearTimeout(e), e = null), t());
156
+ }
157
+ function r(m) {
158
+ m.target === a && o();
159
+ }
160
+ function i(m) {
161
+ m.target === a && o();
162
+ }
163
+ const f = V(() => {
164
+ if (typeof a.getAnimations > "u") {
165
+ e = setTimeout(o, 16);
166
+ return;
167
+ }
168
+ a.getAnimations().length === 0 ? (a.addEventListener("transitionend", r, { once: !0 }), a.addEventListener("animationend", i, { once: !0 }), e = setTimeout(o, 1e3)) : (a.addEventListener("transitionend", r, { once: !0 }), a.addEventListener("animationend", i, { once: !0 }));
169
+ });
170
+ return () => {
171
+ s = !0, f(), e && (clearTimeout(e), e = null), a.removeEventListener("transitionend", r), a.removeEventListener("animationend", i);
172
+ };
173
+ }
174
+ function te({
175
+ initialStatus: a = "closed",
176
+ element: t
177
+ } = {}) {
178
+ let s = t;
179
+ return {
180
+ setElement: (e) => {
181
+ s = e;
182
+ },
183
+ ...K({
184
+ initialStatus: a,
185
+ openedAfter: (e) => s == null ? (e(), () => {
186
+ }) : P(s, e),
187
+ closedAfter: (e) => s == null ? (e(), () => {
188
+ }) : P(s, e)
189
+ })
190
+ };
191
+ }
192
+ function me(a, t) {
193
+ return h.class(
194
+ A(
195
+ a,
196
+ t
197
+ )((s, e) => `bu-toggle--animated bu-toggle--${s} bu-toggle--${e}`)
198
+ );
199
+ }
200
+ function se(a) {
201
+ return {
202
+ "~standard": {
203
+ version: 1,
204
+ vendor: "beatui-custom",
205
+ validate: (s) => {
206
+ const e = a.validate(s);
207
+ return e.success ? { value: e.data } : {
208
+ issues: e.errors.map((o) => ({
209
+ message: o.message,
210
+ path: o.path
211
+ }))
212
+ };
213
+ },
214
+ types: void 0
215
+ },
216
+ safeParse: (s) => {
217
+ const e = a.validate(s);
218
+ return e.success ? { success: !0, data: e.data } : {
219
+ success: !1,
220
+ error: {
221
+ errors: e.errors.map((o) => ({
222
+ message: o.message,
223
+ path: o.path?.map(
224
+ (r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
225
+ ) || []
226
+ }))
227
+ }
228
+ };
229
+ }
230
+ };
231
+ }
232
+ class w {
233
+ optional() {
234
+ return new ne(this);
235
+ }
236
+ default(t) {
237
+ return new oe(this, t);
238
+ }
239
+ schema() {
240
+ return se(this);
241
+ }
242
+ }
243
+ class k extends w {
244
+ minLength;
245
+ maxLength;
246
+ pattern;
247
+ customValidations = [];
248
+ validate(t) {
249
+ if (typeof t != "string")
250
+ return { success: !1, errors: [{ message: "Expected string" }] };
251
+ const s = [];
252
+ this.minLength !== void 0 && t.length < this.minLength && s.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && t.length > this.maxLength && s.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(t) && s.push({ message: "Invalid format" });
253
+ for (const e of this.customValidations) {
254
+ const o = e(t);
255
+ o && s.push({ message: o });
256
+ }
257
+ return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: t };
258
+ }
259
+ min(t, s) {
260
+ const e = new k();
261
+ return e.minLength = t, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
262
+ (o) => o.length < t ? s : null
263
+ ), e;
264
+ }
265
+ max(t, s) {
266
+ const e = new k();
267
+ return e.minLength = this.minLength, e.maxLength = t, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
268
+ (o) => o.length > t ? s : null
269
+ ), e;
270
+ }
271
+ regex(t, s) {
272
+ const e = new k();
273
+ return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = t, e.customValidations = [...this.customValidations], s && e.customValidations.push(
274
+ (o) => t.test(o) ? null : s
275
+ ), e;
276
+ }
277
+ email(t = "Please enter a valid email address") {
278
+ const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, e = new k();
279
+ return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [
280
+ ...this.customValidations,
281
+ (o) => s.test(o) ? null : t
282
+ ], e;
283
+ }
284
+ refine(t) {
285
+ const s = new k();
286
+ return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, t], s;
287
+ }
288
+ }
289
+ class B extends w {
290
+ mustBeTrue = !1;
291
+ trueMessage;
292
+ validate(t) {
293
+ return typeof t != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && t !== !0 ? {
294
+ success: !1,
295
+ errors: [{ message: this.trueMessage || "Must be true" }]
296
+ } : { success: !0, data: t };
297
+ }
298
+ refine(t, s) {
299
+ const e = new B();
300
+ e.mustBeTrue = this.mustBeTrue, e.trueMessage = this.trueMessage;
301
+ const o = e.validate.bind(e);
302
+ return e.validate = (r) => {
303
+ const i = o(r);
304
+ return i.success ? t(i.data) ? i : { success: !1, errors: [{ message: s }] } : i;
305
+ }, e;
306
+ }
307
+ literal(t, s) {
308
+ const e = new B();
309
+ return e.mustBeTrue = !0, e.trueMessage = s, e;
310
+ }
311
+ }
312
+ class ne extends w {
313
+ constructor(t) {
314
+ super(), this.inner = t;
315
+ }
316
+ validate(t) {
317
+ if (t === void 0)
318
+ return { success: !0, data: void 0 };
319
+ const s = this.inner.validate(t);
320
+ return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
321
+ }
322
+ }
323
+ class oe extends w {
324
+ constructor(t, s) {
325
+ super(), this.inner = t, this.defaultValue = s;
326
+ }
327
+ validate(t) {
328
+ return t === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(t);
329
+ }
330
+ }
331
+ class S extends w {
332
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
333
+ constructor(t) {
334
+ super(), this.shape = t;
335
+ }
336
+ validate(t) {
337
+ if (typeof t != "object" || t === null || Array.isArray(t))
338
+ return { success: !1, errors: [{ message: "Expected object" }] };
339
+ const s = t, e = {}, o = [];
340
+ for (const [r, i] of Object.entries(this.shape)) {
341
+ const l = i.validate(s[r]);
342
+ if (l.success)
343
+ e[r] = l.data;
344
+ else
345
+ for (const f of l.errors)
346
+ o.push({
347
+ message: f.message,
348
+ path: [r, ...f.path || []]
349
+ });
350
+ }
351
+ return o.length > 0 ? { success: !1, errors: o } : { success: !0, data: e };
352
+ }
353
+ refine(t, s) {
354
+ const e = new S(this.shape), o = e.validate.bind(e);
355
+ return e.validate = (r) => {
356
+ const i = o(r);
357
+ if (!i.success) return i;
358
+ const l = t(i.data);
359
+ return l ? {
360
+ success: !1,
361
+ errors: [
362
+ {
363
+ message: l,
364
+ path: s?.path
365
+ }
366
+ ]
367
+ } : { success: !0, data: i.data };
368
+ }, e;
369
+ }
370
+ }
371
+ const fe = () => new k(), pe = () => new B(), he = (a) => new S(a);
372
+ function ae(a) {
373
+ return _((t) => {
374
+ const s = [], e = () => s.forEach((r) => r());
375
+ return a(({
376
+ effect: r = "opaque",
377
+ mode: i = "capturing",
378
+ onClickOutside: l,
379
+ onEscape: f,
380
+ content: m,
381
+ container: d = "body"
382
+ }) => {
383
+ d === "body" && (t = t.makePortal("body"));
384
+ const u = te();
385
+ u.onClosed(e);
386
+ let b = () => {
387
+ }, g = () => {
388
+ };
389
+ const p = (E) => {
390
+ E.key === "Escape" && (f?.(), u.close());
391
+ }, y = () => {
392
+ l?.(), u.close();
393
+ }, C = (E) => {
394
+ b(), g(), E === "capturing" ? (document.addEventListener("keydown", p), b = () => document.removeEventListener("keydown", p), t.element.addEventListener("mousedown", y), g = () => t.element.removeEventListener("mousedown", y)) : (b = () => {
395
+ }, g = () => {
396
+ });
397
+ }, n = R.on(i, C);
398
+ s.push(n), s.push(() => {
399
+ b(), g();
400
+ });
401
+ const T = G((() => {
402
+ const E = /* @__PURE__ */ new Set();
403
+ for (const c of t.element.querySelectorAll(
404
+ ":scope > :not([data-overlay])"
405
+ ))
406
+ c.hasAttribute("inert") ? E.add(c) : c.setAttribute("inert", "");
407
+ return s.push(() => {
408
+ for (const c of t.element.querySelectorAll(
409
+ ":scope > :not([data-overlay])"
410
+ ))
411
+ E.has(c) || c.removeAttribute("inert");
412
+ E.clear();
413
+ }), document.activeElement?.blur?.(), x.div(
414
+ W((c) => u.setElement(c)),
415
+ O.status(u.status.map(String)),
416
+ O.overlay("true"),
417
+ h.class(
418
+ A(
419
+ r ?? "opaque",
420
+ i
421
+ )(
422
+ (c, L) => `bc-overlay bc-overlay--effect-${c} bc-overlay--mode-${L}`
423
+ )
424
+ ),
425
+ m
426
+ );
427
+ })(), t.element, {
428
+ disposeWithParent: !0,
429
+ clear: !1,
430
+ providers: t.providers
431
+ });
432
+ s.push(T), V(() => u.open());
433
+ }, e);
434
+ });
435
+ }
436
+ function re(a, t) {
437
+ const {
438
+ size: s = "md",
439
+ dismissable: e = !0,
440
+ showCloseButton: o = !0,
441
+ onClose: r,
442
+ overlayEffect: i = "opaque",
443
+ container: l = "body",
444
+ position: f = "center"
445
+ } = a;
446
+ return ae((m, d) => {
447
+ let u = () => {
448
+ };
449
+ return t((p) => {
450
+ u = d;
451
+ const y = z("capturing");
452
+ R.on(e, (c) => {
453
+ y.set(c ? "capturing" : "non-capturing");
454
+ });
455
+ const C = A(
456
+ p.header != null,
457
+ o
458
+ )((c, L) => c || L), n = X("modal"), v = `${n}-header`, T = `${n}-body`, E = x.div(
459
+ h.class(
460
+ A(
461
+ s,
462
+ f
463
+ )(
464
+ (c, L) => `bc-modal bc-modal--size-${c} bc-modal--container-${l} bc-modal--position-${L}`
465
+ )
466
+ ),
467
+ // Essential ARIA attributes for modal dialog
468
+ h.role("dialog"),
469
+ F.modal(!0),
470
+ ...p.header ? [F.labelledby(v)] : [],
471
+ F.describedby(T),
472
+ h.tabindex(-1),
473
+ // Make modal focusable for initial focus
474
+ h.id(n),
475
+ O.focusTrap("true"),
476
+ // Mark as focus trap container
477
+ J.mousedown((c) => c.stopPropagation()),
478
+ // Prevent overlay click-outside when clicking modal content
479
+ // Focus trap implementation
480
+ $({
481
+ escapeDeactivates: !1,
482
+ // Let Overlay handle escape key
483
+ initialFocus: () => {
484
+ const c = document.getElementById(n);
485
+ if (!c) return null;
486
+ const L = c.querySelector(
487
+ '[aria-label="Close modal"]'
488
+ );
489
+ if (L) return L;
490
+ const M = c.querySelector(
491
+ 'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
492
+ );
493
+ return M || c;
494
+ }
495
+ }),
496
+ // Modal content container
497
+ x.div(
498
+ h.class("bc-modal__content"),
499
+ // Header section
500
+ D(
501
+ C,
502
+ () => x.div(
503
+ h.class("bc-modal__header"),
504
+ x.div(
505
+ h.class("bu-font-semibold bu-text-gray"),
506
+ ...p.header ? [h.id(v)] : [],
507
+ p.header
508
+ ),
509
+ D(
510
+ o,
511
+ () => U(
512
+ H,
513
+ (c) => Y({
514
+ size: "sm",
515
+ label: c.$.closeModal,
516
+ onClick: () => {
517
+ u(), d();
518
+ }
519
+ })
520
+ )
521
+ )
522
+ )
523
+ ),
524
+ // Body section
525
+ x.div(h.class("bc-modal__body"), h.id(T), p.body),
526
+ // Footer section
527
+ p.footer && x.div(h.class("bc-modal__footer"), p.footer)
528
+ )
529
+ );
530
+ m({
531
+ mode: y,
532
+ effect: i ?? "opaque",
533
+ container: l,
534
+ content: E,
535
+ onClickOutside: () => {
536
+ r?.(), d();
537
+ },
538
+ onEscape: () => {
539
+ r?.(), d();
540
+ }
541
+ });
542
+ }, () => {
543
+ u(), d();
544
+ });
545
+ });
546
+ }
547
+ function ge(a, t) {
548
+ const { confirmText: s, cancelText: e, onConfirm: o, onCancel: r, ...i } = a;
549
+ return U(
550
+ H,
551
+ (l) => re({ showCloseButton: !1, ...i }, (f, m) => {
552
+ const d = () => {
553
+ o?.(), m();
554
+ }, u = () => {
555
+ r?.(), m();
556
+ };
557
+ return t((g) => {
558
+ f({
559
+ body: g,
560
+ footer: Q(
561
+ h.class("bu-justify-end"),
562
+ j(
563
+ {
564
+ variant: "outline",
565
+ onClick: u
566
+ },
567
+ q(e, l.$.cancel)
568
+ ),
569
+ j(
570
+ {
571
+ color: "primary",
572
+ variant: "filled",
573
+ onClick: d
574
+ },
575
+ q(s, l.$.confirm)
576
+ )
577
+ )
578
+ });
579
+ }, m);
580
+ })
581
+ );
582
+ }
583
+ export {
584
+ me as A,
585
+ B,
586
+ ge as C,
587
+ $ as F,
588
+ re as M,
589
+ ae as O,
590
+ k as S,
591
+ S as a,
592
+ pe as b,
593
+ se as c,
594
+ le as d,
595
+ K as e,
596
+ de as f,
597
+ he as o,
598
+ fe as s,
599
+ te as u
600
+ };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tempots/dom"),A=require("../timer-CcMCjYrq.cjs"),I=require("../link-portal-_tiDFZqh.cjs"),W=require("../theme-YS3sFklH.cjs"),g="https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/",F=e=>{if(!e||typeof e!="object")return!1;const t=e;return!!(t.editor&&typeof t.editor.create=="function"&&t.languages)};function b(){if(typeof self>"u")return;const e=self.MonacoEnvironment;if(e&&(typeof e.getWorkerUrl=="function"||typeof e.getWorker=="function"))return;const t=()=>{const n=[`self.MonacoEnvironment = { baseUrl: '${g}' };`,`importScripts('${g}vs/base/worker/workerMain.js');`].join(`
2
- `),r=new Blob([n],{type:"text/javascript"});return URL.createObjectURL(r)};self.MonacoEnvironment={getWorkerUrl(n,r){return t()}}}const R=e=>new Promise((t,n)=>{var f;if(document.querySelector(`script[src="${e}"]`))return t();const s=document.createElement("script");s.src=e,s.async=!0;const l=(f=document.querySelector("script[nonce]"))==null?void 0:f.getAttribute("nonce");l&&s.setAttribute("nonce",l),s.onload=()=>t(),s.onerror=y=>{console.error("[BeatUI] Failed to load script",e,y),n(new Error(`Failed to load script ${e}`))},document.head.appendChild(s)}),$=async()=>{var t,n;const e=window;if((!e.require||!e.require.config)&&(await R(`${g}vs/loader.js`),await new Promise(r=>setTimeout(r,100)),!e.require))throw new Error("AMD loader failed to initialize");return(n=(t=e.require).config)==null||n.call(t,{baseUrl:g,paths:{vs:"vs"}}),e.require},B=async()=>{const e=window;if(e.monaco&&F(e.monaco))return e.monaco;b();const t=await $();if(await new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("Timeout loading editor.main")),3e4);try{t(["vs/editor/editor.main"],()=>{clearTimeout(s),n()},l=>{clearTimeout(s),r(l)})}catch(l){clearTimeout(s),r(l)}}),!e.monaco)throw new Error("Monaco failed to initialize after loading editor.main");return e.monaco};let v=null;const M=new Map;let h=!1;async function V(){if(v)return v;!h&&typeof window<"u"&&(b(),h=!0);const e=await B();return v=e,e}async function _(e){if(M.has(e))return M.get(e);const t=(async()=>{const n=await V();switch(e){case"typescript":case"javascript":{n.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1}),n.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1});break}case"json":{n.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[],enableSchemaRequest:!0});break}case"css":case"scss":case"less":{n.languages.css.cssDefaults.setOptions({validate:!0});break}case"html":break;case"markdown":break;case"yaml":{n.languages.getLanguages().some(s=>s.id==="yaml")||n.languages.register({id:"yaml",extensions:[".yml",".yaml"]});break}}})();return M.set(e,t),t}async function S(e){const[t]=await Promise.all([V(),_(e)]);return t}function z(e){if(typeof window>"u")return;const t=window;e?(t.MonacoEnvironment={getWorker:e},h=!0):t.MonacoEnvironment||(b(),h=!0)}const N=e=>{const{value:t,onChange:n,onBlur:r,language:s="plaintext",readOnly:l=!1,editorOptions:f,jsonSchemas:y,autofocus:j,class:q,disabled:D,hasError:L,id:x,name:P,placeholder:T}=e,E=o.Value.toSignal(l);return o.Use(W.Theme,({appearance:U})=>o.html.div((e.cssInjection??"none")==="none"?null:o.Task(()=>Promise.resolve().then(()=>require("../styles-url-CZUL_YRT.cjs")),({default:u})=>I.LinkPortal({id:"beatui-monaco-css",href:u})),o.attr.class("bc-monaco-editor-container"),o.attr.class(q),o.attr.class(o.Value.map(L??!1,u=>u?"bc-input-container--error":"")),o.attr.id(x),o.attr.name(P),o.WithElement(u=>{let d=null;const c=[];return(async()=>{try{let m=function(){const a=i.getValue();n==null||n(a)};const p=o.Value.get(s)??"plaintext";if(d=(await S(p)).editor.create(u,{value:o.Value.get(t)??"",language:p,readOnly:o.Value.get(E)??!1,automaticLayout:!0,minimap:{enabled:!1},...f??{}}),!d)throw new Error("Failed to create Monaco editor");const i=d;c.push(o.effectOf(s,y)(async(a,w)=>{const k=await S(a);if(a==="json"){const C={validate:!0,enableSchemaRequest:!0,schemas:!!(w&&w.length)?w:[]};k.languages.json.jsonDefaults.setDiagnosticsOptions(C)}const O=i.getModel();O&&k.editor.setModelLanguage(O,a)})),c.push(i.onDidChangeModelContent(A.g(500,m)).dispose),c.push(i.onDidBlurEditorText(()=>{m(),r==null||r()}).dispose),c.push(o.Value.on(t,a=>{a!==i.getValue()&&i.setValue(a??"")})),c.push(o.Value.on(E,a=>{i.updateOptions({readOnly:a??!1})})),c.push(o.Value.on(D??!1,a=>{i.updateOptions({readOnly:a??!1})})),c.push(o.Value.on(j??!1,a=>{a&&i.focus()})),c.push(o.Value.on(T??"",a=>{i.updateOptions({placeholder:a??""})})),c.push(U.on(a=>{i.updateOptions({theme:a==="dark"?"vs-dark":"vs"})}))}catch(m){console.error("[BeatUI] Failed to initialize Monaco editor:",m);const p=u;p.textContent="Failed to load Monaco Editor. Please ensure monaco-editor is installed."}})(),o.OnDispose(()=>{try{c.forEach(m=>m())}catch{}try{d==null||d.dispose()}catch{}})})))};exports.MonacoEditorInput=N;exports.configureMonacoEnvironment=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tempots/dom"),A=require("../timer-BdH4cK6a.cjs"),I=require("../link-portal-_tiDFZqh.cjs"),B=require("../theme-YS3sFklH.cjs"),p="https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/",W=e=>{if(!e||typeof e!="object")return!1;const t=e;return!!(t.editor&&typeof t.editor.create=="function"&&t.languages)};function M(){if(typeof self>"u")return;const e=self.MonacoEnvironment;if(e&&(typeof e.getWorkerUrl=="function"||typeof e.getWorker=="function"))return;const t=()=>{const a=[`self.MonacoEnvironment = { baseUrl: '${p}' };`,`importScripts('${p}vs/base/worker/workerMain.js');`].join(`
2
+ `),i=new Blob([a],{type:"text/javascript"});return URL.createObjectURL(i)};self.MonacoEnvironment={getWorkerUrl(a,i){return t()}}}const F=e=>new Promise((t,a)=>{if(document.querySelector(`script[src="${e}"]`))return t();const s=document.createElement("script");s.src=e,s.async=!0;const l=document.querySelector("script[nonce]")?.getAttribute("nonce");l&&s.setAttribute("nonce",l),s.onload=()=>t(),s.onerror=h=>{console.error("[BeatUI] Failed to load script",e,h),a(new Error(`Failed to load script ${e}`))},document.head.appendChild(s)}),R=async()=>{const e=window;if((!e.require||!e.require.config)&&(await F(`${p}vs/loader.js`),await new Promise(t=>setTimeout(t,100)),!e.require))throw new Error("AMD loader failed to initialize");return e.require.config?.({baseUrl:p,paths:{vs:"vs"}}),e.require},$=async()=>{const e=window;if(e.monaco&&W(e.monaco))return e.monaco;M();const t=await R();if(await new Promise((a,i)=>{const s=setTimeout(()=>i(new Error("Timeout loading editor.main")),3e4);try{t(["vs/editor/editor.main"],()=>{clearTimeout(s),a()},l=>{clearTimeout(s),i(l)})}catch(l){clearTimeout(s),i(l)}}),!e.monaco)throw new Error("Monaco failed to initialize after loading editor.main");return e.monaco};let w=null;const v=new Map;let g=!1;async function S(){if(w)return w;!g&&typeof window<"u"&&(M(),g=!0);const e=await $();return w=e,e}async function _(e){if(v.has(e))return v.get(e);const t=(async()=>{const a=await S();switch(e){case"typescript":case"javascript":{a.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1}),a.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1});break}case"json":{a.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[],enableSchemaRequest:!0});break}case"css":case"scss":case"less":{a.languages.css.cssDefaults.setOptions({validate:!0});break}case"html":break;case"markdown":break;case"yaml":{a.languages.getLanguages().some(s=>s.id==="yaml")||a.languages.register({id:"yaml",extensions:[".yml",".yaml"]});break}}})();return v.set(e,t),t}async function O(e){const[t]=await Promise.all([S(),_(e)]);return t}function z(e){if(typeof window>"u")return;const t=window;e?(t.MonacoEnvironment={getWorker:e},g=!0):t.MonacoEnvironment||(M(),g=!0)}const N=e=>{const{value:t,onChange:a,onBlur:i,language:s="plaintext",readOnly:l=!1,editorOptions:h,jsonSchemas:V,autofocus:j,class:q,disabled:D,hasError:C,id:L,name:x,placeholder:P}=e,b=o.Value.toSignal(l);return o.Use(B.Theme,({appearance:T})=>o.html.div((e.cssInjection??"none")==="none"?null:o.Task(()=>Promise.resolve().then(()=>require("../styles-url-CZUL_YRT.cjs")),({default:u})=>I.LinkPortal({id:"beatui-monaco-css",href:u})),o.attr.class("bc-monaco-editor-container"),o.attr.class(q),o.attr.class(o.Value.map(C??!1,u=>u?"bc-input-container--error":"")),o.attr.id(L),o.attr.name(x),o.WithElement(u=>{let m=null;const c=[];return(async()=>{try{let d=function(){const n=r.getValue();a?.(n)};const f=o.Value.get(s)??"plaintext";if(m=(await O(f)).editor.create(u,{value:o.Value.get(t)??"",language:f,readOnly:o.Value.get(b)??!1,automaticLayout:!0,minimap:{enabled:!1},...h??{}}),!m)throw new Error("Failed to create Monaco editor");const r=m;c.push(o.effectOf(s,V)(async(n,y)=>{const E=await O(n);if(n==="json"){const U={validate:!0,enableSchemaRequest:!0,schemas:!!(y&&y.length)?y:[]};E.languages.json.jsonDefaults.setDiagnosticsOptions(U)}const k=r.getModel();k&&E.editor.setModelLanguage(k,n)})),c.push(r.onDidChangeModelContent(A.I(500,d)).dispose),c.push(r.onDidBlurEditorText(()=>{d(),i?.()}).dispose),c.push(o.Value.on(t,n=>{n!==r.getValue()&&r.setValue(n??"")})),c.push(o.Value.on(b,n=>{r.updateOptions({readOnly:n??!1})})),c.push(o.Value.on(D??!1,n=>{r.updateOptions({readOnly:n??!1})})),c.push(o.Value.on(j??!1,n=>{n&&r.focus()})),c.push(o.Value.on(P??"",n=>{r.updateOptions({placeholder:n??""})})),c.push(T.on(n=>{r.updateOptions({theme:n==="dark"?"vs-dark":"vs"})}))}catch(d){console.error("[BeatUI] Failed to initialize Monaco editor:",d);const f=u;f.textContent="Failed to load Monaco Editor. Please ensure monaco-editor is installed."}})(),o.OnDispose(()=>{try{c.forEach(d=>d())}catch{}try{m?.dispose()}catch{}})})))};exports.MonacoEditorInput=N;exports.configureMonacoEnvironment=z;