@mrakomor/core 0.0.11 → 0.0.12

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 (111) hide show
  1. package/dist/blockChrome.mjs +2 -2
  2. package/dist/blockInsertMenu.mjs +1 -1
  3. package/dist/chunk-2C6UDFD4.mjs +1 -0
  4. package/dist/chunk-5HWTMPF4.mjs +2 -0
  5. package/dist/{chunk-NR2BAMSW.mjs → chunk-6CG6EGQM.mjs} +2 -2
  6. package/dist/{chunk-K2DMHAUD.mjs → chunk-7CJLTNHZ.mjs} +1 -1
  7. package/dist/chunk-ERNLRJPB.mjs +1 -0
  8. package/dist/chunk-EXDY5TZH.mjs +1 -0
  9. package/dist/chunk-FAXIFXQK.mjs +4 -0
  10. package/dist/{chunk-2VURZA2E.mjs → chunk-GDDVUIEH.mjs} +1 -1
  11. package/dist/{chunk-VYTSZ4S6.mjs → chunk-JVQ2YGII.mjs} +1 -1
  12. package/dist/{chunk-SCFD3XBH.mjs → chunk-P7TUN2KD.mjs} +1 -1
  13. package/dist/chunk-S2W6LYHT.mjs +1 -0
  14. package/dist/chunk-TL5BHWDU.mjs +2 -0
  15. package/dist/chunk-ZHOZPQZH.mjs +1 -0
  16. package/dist/clipboard.cjs +3 -3
  17. package/dist/clipboard.mjs +3 -3
  18. package/dist/footer.cjs +2 -2
  19. package/dist/footer.mjs +2 -2
  20. package/dist/headline.cjs +2 -2
  21. package/dist/headline.mjs +1 -1
  22. package/dist/help.mjs +2 -2
  23. package/dist/index.cjs +6 -6
  24. package/dist/index.mjs +4 -4
  25. package/dist/link.mjs +2 -2
  26. package/dist/list.cjs +3 -3
  27. package/dist/list.mjs +1 -1
  28. package/dist/paragraph.cjs +2 -2
  29. package/dist/paragraph.mjs +1 -1
  30. package/dist/slashCommand.cjs +2 -2
  31. package/dist/slashCommand.mjs +1 -1
  32. package/dist/tooltip.cjs +1 -1
  33. package/dist/tooltip.mjs +2 -2
  34. package/dist/tts.cjs +8 -8
  35. package/dist/tts.mjs +3 -3
  36. package/dist/types/Mrakomor.d.mts +230 -0
  37. package/dist/types/component/AbstractComponent.d.mts +69 -0
  38. package/dist/types/component/Editor.d.mts +8 -0
  39. package/dist/types/component/block/BlockComponent.d.mts +105 -0
  40. package/dist/types/component/block/BlockRegister.d.mts +29 -0
  41. package/dist/types/component/block/ExternalComponent.d.mts +42 -0
  42. package/dist/types/component/block/UnknownComponent.d.mts +3 -0
  43. package/dist/types/component/block/blockItemEquals.d.mts +6 -0
  44. package/dist/types/component/block/helpers.d.mts +319 -0
  45. package/dist/types/component/editorContext.d.mts +4 -0
  46. package/dist/types/component/entityRange/EntityRangeElement.d.mts +15 -0
  47. package/dist/types/component/inlineStyle/Bold.d.mts +4 -0
  48. package/dist/types/component/inlineStyle/InlineElement.d.mts +10 -0
  49. package/dist/types/component/inlineStyle/Italic.d.mts +4 -0
  50. package/dist/types/component/inlineStyle/Subscript.d.mts +4 -0
  51. package/dist/types/component/inlineStyle/Superscript.d.mts +4 -0
  52. package/dist/types/component/inlineStyle/Underline.d.mts +4 -0
  53. package/dist/types/component/inlineStyle/index.d.mts +5 -0
  54. package/dist/types/component/overlayMount.d.mts +46 -0
  55. package/dist/types/dom.d.mts +161 -0
  56. package/dist/types/emitter.d.mts +38 -0
  57. package/dist/types/index.d.mts +7 -0
  58. package/dist/types/namespaces.d.mts +17 -0
  59. package/dist/types/plugin/blockChrome/BlockChrome.d.mts +11 -0
  60. package/dist/types/plugin/blockChrome/index.d.mts +1 -0
  61. package/dist/types/plugin/blockInsertMenu/BlockInsertMenu.d.mts +6 -0
  62. package/dist/types/plugin/blockInsertMenu/index.d.mts +1 -0
  63. package/dist/types/plugin/clipboard/clipboardHelpers.d.mts +151 -0
  64. package/dist/types/plugin/clipboard/clipboardPlugin.d.mts +6 -0
  65. package/dist/types/plugin/clipboard/index.d.mts +1 -0
  66. package/dist/types/plugin/default/defaultMrakomorPlugin.d.mts +21 -0
  67. package/dist/types/plugin/dialog/Dialog.d.mts +23 -0
  68. package/dist/types/plugin/footer/footerPlugin.d.mts +7 -0
  69. package/dist/types/plugin/footer/index.d.mts +1 -0
  70. package/dist/types/plugin/headline/Headline.d.mts +29 -0
  71. package/dist/types/plugin/headline/index.d.mts +1 -0
  72. package/dist/types/plugin/help/HelpRegister.d.mts +15 -0
  73. package/dist/types/plugin/help/helpPlugin.d.mts +26 -0
  74. package/dist/types/plugin/help/helpSchema.d.mts +11 -0
  75. package/dist/types/plugin/help/index.d.mts +1 -0
  76. package/dist/types/plugin/linkEntity/LinkEntity.d.mts +37 -0
  77. package/dist/types/plugin/linkEntity/index.d.mts +1 -0
  78. package/dist/types/plugin/list/List.d.mts +61 -0
  79. package/dist/types/plugin/list/index.d.mts +1 -0
  80. package/dist/types/plugin/list/listHelpers.d.mts +166 -0
  81. package/dist/types/plugin/menu/Menu.d.mts +22 -0
  82. package/dist/types/plugin/menu/menuPlugin.d.mts +6 -0
  83. package/dist/types/plugin/paragraph/Paragraph.d.mts +16 -0
  84. package/dist/types/plugin/paragraph/index.d.mts +1 -0
  85. package/dist/types/plugin/slashCommand/SlashActionRegister.d.mts +12 -0
  86. package/dist/types/plugin/slashCommand/index.d.mts +1 -0
  87. package/dist/types/plugin/slashCommand/slashActionSchema.d.mts +29 -0
  88. package/dist/types/plugin/slashCommand/slashCommandHelpers.d.mts +77 -0
  89. package/dist/types/plugin/slashCommand/slashCommandPlugin.d.mts +11 -0
  90. package/dist/types/plugin/slashCommand/slashHelp.d.mts +12 -0
  91. package/dist/types/plugin/tooltip/Tooltip.d.mts +16 -0
  92. package/dist/types/plugin/tooltip/index.d.mts +1 -0
  93. package/dist/types/plugin/tts/TtsHeadline.d.mts +27 -0
  94. package/dist/types/plugin/tts/TtsList.d.mts +19 -0
  95. package/dist/types/plugin/tts/TtsParagraph.d.mts +9 -0
  96. package/dist/types/plugin/tts/TtsVoice.d.mts +52 -0
  97. package/dist/types/plugin/tts/index.d.mts +4 -0
  98. package/dist/types/register/Register.d.mts +50 -0
  99. package/dist/types/register/sortRegisterEntries.d.mts +7 -0
  100. package/dist/types/schema/blockContent.d.mts +34 -0
  101. package/dist/types/schema/blockRegister.d.mts +14 -0
  102. package/dist/types/schema/config.d.mts +6 -0
  103. package/dist/types/types.d.mts +636 -0
  104. package/package.json +35 -22
  105. package/dist/chunk-5VPYPKGA.mjs +0 -1
  106. package/dist/chunk-BCE45I7Q.mjs +0 -2
  107. package/dist/chunk-N4I2WZWF.mjs +0 -1
  108. package/dist/chunk-T7OO472O.mjs +0 -1
  109. package/dist/chunk-WQWE5UCN.mjs +0 -1
  110. package/dist/chunk-YO4ZA6PJ.mjs +0 -2
  111. package/dist/chunk-ZDMD7SRT.mjs +0 -4
package/dist/tts.cjs CHANGED
@@ -1,9 +1,9 @@
1
- 'use strict';var Qn={abortEarly:true};function st(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function Zn(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(st(e.errors[r],n));}function Kt(e,t,n,r){if(n!==false){let o=st(e.error,t);return {success:false,error:o,errors:[o]}}Zn(e,r,t);}function be(e){return e?.abortEarly!==void 0?e:Qn}function tt(e,t){b(e,"_parse",(n,r,o)=>{let s=n(r,o);return !s.success&&t(r)?{success:true,data:r}:s});}var ae=e=>typeof e=="string"||e instanceof String,nt=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),rt=e=>e===true||e===false,er=e=>e instanceof Date&&!Number.isNaN(e.getTime()),tr=e=>typeof e=="function",nr=e=>Array.isArray(e),ot=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Gt(e,t){let n=R(ot,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,s])=>`${o}: ${s._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:s="always"}={}){return b(this,"_parse",(i,a,c)=>{let l=i(a,c);if(!l.success)return l;let u=o(l.data,{context:c?.context});if(!ot(u)){let p={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:p,errors:[p]}}if(s==="missing"){let p={...l.data};for(let m in u)p[m]===void 0&&(p[m]=u[m]);return {success:true,data:p}}return {success:true,data:{...l.data,...u}}}),this},b(n,"_parse",(o,s,i)=>{let a=o(s,i),{abortEarly:c}=be(i);if(a.success===false)return a;let l={},u=[];for(let p in e){let m=e[p]._parse(a.data[p],i);if(m.success)l[p]=m.data;else {let d=Kt(m,p,c,u);if(d)return d}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:l}}),r}function it(e){return R(ae,{...e,type:"string"})}function at(e){return R(nt,{...e,type:"number"})}function ct(e){return R(rt,{...e,type:"boolean"})}function lt(e){return R(er,{...e,type:"date"})}function Yt(e){return R(tr,{...e,type:"function"})}function Wt(e,t){let n=i=>e.includes(i),r=i=>`Invalid ${o} value. Expected ${e.map(a=>`"${a}"`).join(" | ")}, received "${i}".`,o="enum",s=R(n,{message:r,...t,type:o});return s._getDescription=()=>`enum(${e.map(i=>`"${i}"`).join(" | ")})`,s._getDefinition=()=>e,s}function zt(e,t){let n=R(nr,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,b(n,"_parse",(r,o,s)=>{let i=r(o,s),{abortEarly:a}=be(s);if(i.success===false)return i;let c=[],l=[],u=s;for(let p=0;p<i.data.length;p++){let m={...u,context:{...u?.context,index:p}},d=e._parse(i.data[p],m);if(d.success)c.push(d.data);else {let S=Kt(d,p,a,l);if(S)return S}}return l.length>0?{success:false,error:l[0],errors:l}:{success:true,data:c}}),n}function Xt(){return R(()=>true)}function ee(e,t){return b(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function Jt(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((s,i)=>` ${i+1}. ${s._getDescription()}`).join(",")} but received "${typeof o}" with value: ${ot(o)?JSON.stringify(o):`"${o}"`}`,r=R(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,b(r,"_parse",(o,s,i)=>{let a=i,c=[];for(let m=0;m<e.length;m++){let d=e[m]._parse(s,a);if(d.success)return d;c.push(d);}let{abortEarly:l}=be(a),u={message:typeof n=="function"?n(s):n};if(l!==false)return {success:false,error:u,errors:[u]};let p=[];for(let m=0;m<c.length;m++){let d=c[m].errors;if(d?.length)for(let S=0;S<d.length;S++)d[S].cause?.key&&p.push(st(d[S],`branch ${m}`));}return p.length===0&&p.push(u),{success:false,error:p[0],errors:p}}),r}function Qt(e,t){let n=R(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function Zt(e){let t=R(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,b(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function en(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var tn={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return ee(n=>{let r;return ae(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},ct({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return ee(n=>{if(rt(n))return Number(n);if(ae(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},at({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return ee(n=>rt(n)||nt(n)&&Number.isFinite(n)?String(n):n,it({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return ee(n=>{let r;return ae(n)&&(r=n.trim()),nt(n)&&Number.isFinite(n)||r?new Date(r??n):n},lt({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return b(e,"_parse",(r,o,s)=>{if(ae(o))try{o=JSON.parse(o);}catch{let i={message:typeof n=="function"?n(o):n};return {success:false,error:i,errors:[i]}}return r(o,s)}),e}},nn={},f={object:Gt,string:it,number:at,boolean:ct,date:lt,function:Yt,enum:Wt,array:zt,any:Xt,preprocess:ee,union:Jt,literal:Qt,contextRef:Zt,withContext:en,coerce:nn,cast:tn};function Ut(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function b(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function R(e,{type:t="any",name:n,message:r}={}){r=r||Ut(t);let o={name:n,message:r,type:t},s={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(i,a){let c=e(i);if(c===true)return {success:true,data:i};if(typeof c=="object"&&c?.success===true)return c;let l={message:typeof r=="function"?r(i):r};return {success:false,error:l,errors:[l]}},parse(i,a){let c=this._parse(i,a);if(!c.success)throw c=c,new Error(c.error.message,{cause:c.error.cause});return c.data},safeParse(i,a){return this._parse(i,a)},transform(i){return b(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success&&(u.data=i(u.data)),u}),this},optional(){return tt(this,i=>i===void 0),this},nullable(){return tt(this,i=>i===null),this},nullish(){return tt(this,i=>i==null),this},default(i){return b(this,"_parse",(a,c,l)=>(c===void 0&&(c=typeof i=="function"?i({context:l?.context}):i),a(c,l))),this},catch(i){return b(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success?u:{success:true,data:typeof i=="function"?i({input:c,error:u.error}):i}}),this},pipe(i){return b(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success?i._parse(u.data,l):u}),this},refine(i,{message:a,type:c,jsonSchema:l}={}){if(c&&(a=a||Ut(c),t=c),l){let u=[...this._getJsonSchemaHints?.()??[],l];this._getJsonSchemaHints=()=>u;}return b(this,"_parse",(u,p,m)=>{let d=u(p,m),{abortEarly:S}=be(m);if(!d.success)return d;let _=i(d.data);if(_===true||typeof _=="object"&&_?.success===true)return d;let x={message:typeof a=="function"?a(p):a};return {success:false,error:x,errors:[x]}}),this},clone(){return {...this}}};return qt.length>0?qt.reduce((i,a)=>a(i,e,o)??i,s):s}var qt=[];var rn=class{next(...e){}error(...e){}complete(...e){}},ut=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var Ce=Symbol("@esmj/signals:type"),ce=Symbol("@esmj/signals:name");var k=null,ft=false,pt=[];function A(e){let t=k;k=null;let n=e();return k=t,n}function sr(){ft=false;let e=cn();for(let n of e)n.get();let t=pt;pt=[];for(let n of t)n();}function on(){ft||(ft=true,queueMicrotask(sr));}function mt(e){pt.push(e),on();}var sn=Symbol("@esmj/signals:internal observable"),M=Symbol("@esmj/signals:original function"),ir=class extends ut{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>A(()=>{this.#e.add(e),this.#r();}),e.next[M]=void 0),e instanceof fn&&e.next[M]===void 0){let t=e.next.bind(e);e.next=()=>A(()=>{this.#e.add(e),t(),this.#r();}),e.next[M]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[M]){let n=t.get,r=n.bind(t);t.get=()=>A(()=>(this.#e.delete(t),r())),t.get[M]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[M]?e.next[M]:e.next,e.get=e.get[M]?e.get[M]:e.get,this.#e.delete(e),this.unsubscribe(e)}},Ae=null;function an(e){Ae=new ir(e);}an(()=>{on();});function cn(){return Ae.getPending()}function ln(e){return Ae.watch(e)}function un(e){return Ae.unwatch(e)}var w=Symbol("@esmj/signals:no error"),fn=class pn extends rn{#e=true;#r=false;#t=null;#o=this.#p();#l=null;#c=null;#i=0;#s=new Map;#n=w;constructor(t,n){super(),this.#l=t,this.#c=n,this.debug=n?.debug,this[Ce]="computed",this[ce]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[ce],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof pn&&A(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#t[sn].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#t||(this.#t=Y(this.#a(),this.#c)),(this.#e||this.#n!==w)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),k&&k.sourceRevisions.set(this,this.#i),this.#n!==w)throw this.#n;return this.#t.get()}peek(){if(this.#t||(this.#t=Y(this.#a(),this.#c)),(this.#e||this.#n!==w)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),this.#n!==w)throw this.#n;return this.#t.peek()}#a(){this.#r=true,this.#e=false,this.#n=w,this.#u(),this.#o.sourceRevisions.clear();let t=k;k=this.#o;let n;try{n=this.#l();}catch(r){this.#n=r;}return k=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#n=w,this.#t.set(r);}).catch(r=>{this.#n=r;})),this.#n===w&&this.#t&&this.#t.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#n=w;}};function W(e,t){return new fn(e,t)}function N(e,t){let n,{debug:r,...o}={},s=W(()=>{n?.(),n=e();},{equals:()=>false,...o});s.get(),ln(s);let i=()=>{n?.(),s.destroy(),un(s);};return i[Symbol.dispose]=i,i[Ce]="effect",i[ce]=r??null,i.__RX_COMPUTED__=s,i}function Y(e,t={}){let n=t?.equals??Object.is,r=0,o=new ut;function s(){return k&&(k.dependencies.set(o,o.subscribe(k.observer)),k.sourceRevisions.set(l,r)),e}function i(){return e}function a(u){if(!n(e,u)){e=u,r++,o.next();}return e}function c(){return r}let l={get:s,set:a,peek:i,getRevision:c,[sn]:o,[Ce]:"signal",[ce]:t?.debug??null};return l}function Re(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var bn=Symbol("node-component"),ke=Symbol("node-internal"),ar=Symbol("keep-literal"),Ie=Symbol("raw-props");function yt(e){return typeof e=="function"?e:e!=null&&typeof e.get=="function"?()=>e.get():()=>e}function St(e,t){let n=e.children!==void 0?e.children:t;return Array.isArray(n)?n[0]:n}var cr=new Set(["template","script"]);function lr(e,t){let n=(e==null?"span":String(e)).trim(),r=n;cr.has(n.toLowerCase())&&(console.warn(`[esmj-dom] tagName "${e}" cannot render children in normal flow and is not supported as a reconciliation wrapper; falling back to "span".`),r="span");let o=document.createElement(r);return r==="span"&&(o.style.display="contents"),o.setAttribute(t,Re()),o}function xt(e,t,n){let r=lr(e,t);return n?.id&&r.setAttribute("id",n.id),r}function bt(e){let t=null,n=()=>t,r=s=>(t=s??null,t),o={get:n,set:r,[Symbol.toPrimitive](){return t?String(t):""}};return Object.defineProperty(o,"current",{get(){return t},set(s){r(s);},enumerable:true,configurable:false}),new Proxy(o,{get(s,i,a){if(Reflect.has(s,i))return Reflect.get(s,i,a);if(!t)return;let c=t[i];return typeof c=="function"?c.bind(t):c},set(s,i,a,c){return Reflect.has(s,i)||!t?Reflect.set(s,i,a,c):(t[i]=a,true)},has(s,i){return Reflect.has(s,i)||!!t&&i in t}})}var Cn=null;function z(){return Cn}function Ne(e){Cn=e;}function Le(e){return e?.[bn]||null}function mn(e,t){e[bn]=t;}function _e(e,t={disposers:[],id:Re()}){return e?.[ke]?e[ke]:(e&&(e[ke]=t),t)}function ur(e){return e[ke]}function j(e,t){let n=ur(e);n||(n=_e(e)),n.disposers.push(t);}function gt(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function H(e,t){let n=z();Ne(e);try{return t()}finally{Ne(n);}}var ht=new Map,ve=new Map,dn=new Map;function An(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let s=e[o];o==="children"||n(o)?r[o]=s:s?.[ar]?r[o]=s():s!=null&&typeof s.get=="function"?r[o]=s:typeof s=="function"?r[o]=W(s):r[o]=Y(s);}return r}function Me(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?false:n.every(o=>{let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return false;let a="value"in s?s.value:s.get?.call(e),c="value"in i?i.value:i.get?.call(t);return Me(a,c)})}function Ct(e){return {id:Symbol("context-id"),defaultValue:e}}function fe(e){let t=z();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function P(e){mt(()=>{setTimeout(e,0);});}function pe(e){let t=e.componentId,n=ht.get(t);if(n){ht.delete(t);for(let r of n){let o=r();typeof o=="function"&&gt(ve,t,o);}}}function fr(e){let t=ve.get(e);if(t){ve.delete(e);for(let n of t)n();}}function pr(e){let t=dn.get(e);if(t){dn.delete(e);for(let n of t)n();}}function we(e){if(!e)return;let t=_e(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=Le(e);if(n&&(fr(n.componentId),pr(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;we(r),r=o;}}}function X(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function gn(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function mr(e,t,n){let r=Re(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let s=gn(e)?void 0:e[Ie],i={...An(t??{},s),children:n},a=z(),c={disposers:[],id:r,contexts:new Map(a?.contexts)};Ne(c);let l;if(gn(e)){o.ClassConstructor=e;let p=new e(i);o.classInstance=p,typeof p.onMount=="function"&&gt(ht,r,()=>{p.onMount?.();}),typeof p.onUnmount=="function"&&gt(ve,r,()=>{p.onUnmount?.();}),l=p.render();}else l=e(i);Ne(a);let u=dr(l);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let p of u.childNodes)_e(p,c),mn(p,o);else _e(u,c),u instanceof Node&&mn(u,o);return u}};return o}function At(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{pe(t);});}function dr(e){return e instanceof Node?e:X(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var hn={className:"class",htmlFor:"for"},En=new Set(["value","defaultValue","checked","selected","indeterminate"]),gr=new Set(["srcdoc"]),hr=new Set(["href","src","action","formaction","xlink:href"]),Er=new Set(["securitypolicyviolation"]),yr=new Set(["contenteditable","draggable","spellcheck"]);function ue(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var Rn=Symbol("Fragment");function E(e,t,n){if(e===Rn){let o=document.createDocumentFragment();return Et(o,Sn(n)),o}if(typeof e=="function")return mr(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),Pe(r,t),Et(r,Sn(n)),r}function dt(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function Sr(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function xr(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return gr.has(n)?true:hr.has(n)&&t!==null&&t!==void 0&&Sr(String(t))}function kn(e){return typeof e!="string"?e:hn[e]?hn[e]:e}function br(e,t){let n=kn(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return yr.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function yn(e,t,n){let r=br(t,n);if(r===null){e.removeAttribute(t);return}if(xr(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function Pe(e,t){let n=z();for(let[r,o]of Reflect.ownKeys(t).map(s=>[s,t[s]]))if(r!=="id"){if(r=kn(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(ue(o)){let s=N(()=>{H(n,()=>{dt(e,o.get());});});j(e,s);}else if(typeof o=="function"){let s=N(()=>{H(n,()=>{dt(e,o());});});j(e,s);}else dt(e,o);continue}if(r==="style"){if(ue(o)){let s=N(()=>{H(n,()=>{Object.assign(e.style,o.get());});});j(e,s);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let s=r.slice(2).toLowerCase();if(Er.has(s)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(s,o);continue}if(ue(o)||typeof o=="function"){let s=r,i=N(()=>{H(n,()=>{let a=typeof o=="function"?o():o.get();En.has(s)?e[s]=a??"":yn(e,s,a);});});j(e,i);continue}En.has(r)||typeof r=="symbol"?e[r]=o??"":yn(e,r,o);}}function Sn(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function Et(e,t){for(let n of t)Nn(e,n);}function Nn(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){xn(e,t);return}if(X(t)){At(e,t);return}if(ue(t)){xn(e,()=>t.get());return}if(Array.isArray(t)){Et(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function te(e){let t=null,n=e;return X(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function Te(e,t=true){for(let n of e)t&&we(n),n.remove();}function xn(e,t){let n=z(),r=document.createComment("");e.appendChild(r);let o=[],s=N(()=>{H(n,()=>{let i=t(),{nodes:a,instance:c}=te(i);Te(o),a.length&&r.after(...a),c&&queueMicrotask(()=>pe(c)),o=a;});});j(e,s);}var Oe=class{constructor(e){this.props=e;}};function _n(e,t,n,r){let{equals:o=Me,tagName:s="span",...i}=r??{},a=xt(s,"data-for",i);Pe(a,i);let c=z(),l=[],u=new Map,p=W(()=>e()),m=N(()=>{let d=p.get(),S=Array.isArray(d)?d:[],_=[],x=[],K=new Set;for(let h=0;h<S.length;h++){let C=S[h],v=t(C,h);if(K.has(v)){console.error(`For: duplicate key "${String(v)}" detected; ignoring later item at index ${h}`);continue}K.add(v),_.push(C),x.push(v);}let Z=new Map(l.map(h=>[h.key,h])),D=[];for(let h=0;h<_.length;h++){let C=x[h],v=_[h],G=Z.get(C);if(G)u.get(C).set(v),D.push(G),Z.delete(C);else {let $t=Y(v,{equals:o});u.set(C,$t);let zn={...$t,set(){}},Ft={key:C,nodes:[]};H(c,()=>{let Xn=n(zn,h),{nodes:Jn,instance:Vt}=te(Xn);Ft.nodes=Jn,Vt&&queueMicrotask(()=>pe(Vt));}),D.push(Ft);}}for(let[h,C]of Z)Te(C.nodes),u.delete(h);let L=null;for(let h=D.length-1;h>=0;h--){let C=D[h].nodes;for(let v=C.length-1;v>=0;v--){let G=C[v];(G.parentNode!==a||G.nextSibling!==L)&&a.insertBefore(G,L),L=G;}}l=D;});return j(a,m),a}function Rt(e,t,n,r){if(typeof e=="function")return _n(e,t,n,r);let{each:o,keyFn:s,equals:i,tagName:a,children:c,...l}=e??{};if(typeof s!="function")throw new Error('For: "keyFn" prop is required and must be a function');let u=yt(o),p=St(e??{},t);return _n(u,s,p,{...l,equals:i,tagName:a})}Rt[Ie]=e=>e!=="each";function In(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(we(e),e.innerHTML=""),X(t)?At(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var kt=_t(),Nt=_t(),Ln=_t(),Ar=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function _t(){return Math.floor(Math.random()*16777215)}function Rr(){return Nt=(Nt+1)%16777215,Nt}function y(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=Rr(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,kt>>16&255,kt>>8&255,kt&255,Ln>>8&255,Ln&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=Ar[n.charCodeAt(o)];return r}var vt=Symbol("block-element"),kr=Symbol("block-element-body"),T=Symbol("selectable-element");function It(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function Nr(e){return e?It(e.startContainer,vt):null}function $(e){return It(e,vt)}function Mn(e){return e?It(e.startContainer,T):null}function _r(e){return e?e[T]!==void 0?[e]:[...e.children].filter(t=>t[T]!==void 0):[]}function vr(e,t){return t?_r(e).indexOf(t):-1}function me(e,t){let n=Mn(t);return !n||!e?.contains(n)?null:{element:n,index:vr(e,n)}}function wn(){return window.getSelection()}function O(){let e=wn();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function Pn(){let e=O();if(!e)return 0;e.collapse(true);let t=Mn(e),n=Nr(e),r=t??de(n);return Be(r,e.startContainer,e.startOffset)}function Be(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let i=0,a=e.childNodes,c=Math.min(n,a.length);for(let l=0;l<c;l++)i+=a[l].textContent.length;return i}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=o.nextNode();for(;s;){if(s===t)return r+n;r+=s.textContent.length,s=o.nextNode();}return r}function Ir(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let s=o.pop();if(s.nodeType===Node.TEXT_NODE){let i=s.textContent.length;if(r+i>=t)return n.setEnd(s,t-r),n.setStart(s,t-r),n;r+=i;}else if(s.childNodes&&s.childNodes.length>0)for(let i=s.childNodes.length-1;i>=0;i--)o.push(s.childNodes[i]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function F(e,t){let n=Ir(e,t),r=wn();r.removeAllRanges(),r.addRange(n);}function de(e){if(!e)return null;let t=Lr(e);return t?.firstElementChild??t?.firstChild}function Lt(e){if(!e?.[vt])return null;let t=de(e);return t?Le(t)?.classInstance:null}function Lr(e){if(!e)return null;for(let t of e.children)if(t[kr])return t;return null}var I="molecule.paragraph.Paragraph",De="molecule.list.List";var Mt="molecule.headline.H1",wt="molecule.headline.H2",Pt="molecule.headline.H3",Tt="molecule.headline.H4",Ot="molecule.headline.H5",Tn="molecule.headline.";function g(e){return e===`
1
+ 'use strict';var nr={abortEarly:true};function it(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function rr(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(it(e.errors[r],n));}function zt(e,t,n,r){if(n!==false){let o=it(e.error,t);return {success:false,error:o,errors:[o]}}rr(e,r,t);}function Ae(e){return e?.abortEarly!==void 0?e:nr}function nt(e,t){b(e,"_parse",(n,r,o)=>{let s=n(r,o);return !s.success&&t(r)?{success:true,data:r}:s});}var ue=e=>typeof e=="string"||e instanceof String,rt=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),ot=e=>e===true||e===false,or=e=>e instanceof Date&&!Number.isNaN(e.getTime()),sr=e=>typeof e=="function",ir=e=>Array.isArray(e),st=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Wt(e,t){let n=A(st,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,s])=>`${o}: ${s._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:s="always"}={}){return b(this,"_parse",(i,c,a)=>{let l=i(c,a);if(!l.success)return l;let u=o(l.data,{context:a?.context});if(!st(u)){let p={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:p,errors:[p]}}if(s==="missing"){let p={...l.data};for(let m in u)p[m]===void 0&&(p[m]=u[m]);return {success:true,data:p}}return {success:true,data:{...l.data,...u}}}),this},b(n,"_parse",(o,s,i)=>{let c=o(s,i),{abortEarly:a}=Ae(i);if(c.success===false)return c;let l={},u=[];for(let p in e){let m=e[p]._parse(c.data[p],i);if(m.success)l[p]=m.data;else {let d=zt(m,p,a,u);if(d)return d}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:l}}),r}function ct(e){return A(ue,{...e,type:"string"})}function at(e){return A(rt,{...e,type:"number"})}function lt(e){return A(ot,{...e,type:"boolean"})}function ut(e){return A(or,{...e,type:"date"})}function Xt(e){return A(sr,{...e,type:"function"})}function Jt(e,t){let n=i=>e.includes(i),r=i=>`Invalid ${o} value. Expected ${e.map(c=>`"${c}"`).join(" | ")}, received "${i}".`,o="enum",s=A(n,{message:r,...t,type:o});return s._getDescription=()=>`enum(${e.map(i=>`"${i}"`).join(" | ")})`,s._getDefinition=()=>e,s}function Qt(e,t){let n=A(ir,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,b(n,"_parse",(r,o,s)=>{let i=r(o,s),{abortEarly:c}=Ae(s);if(i.success===false)return i;let a=[],l=[],u=s;for(let p=0;p<i.data.length;p++){let m={...u,context:{...u?.context,index:p}},d=e._parse(i.data[p],m);if(d.success)a.push(d.data);else {let E=zt(d,p,c,l);if(E)return E}}return l.length>0?{success:false,error:l[0],errors:l}:{success:true,data:a}}),n}function Zt(){return A(()=>true)}function te(e,t){return b(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function en(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((s,i)=>` ${i+1}. ${s._getDescription()}`).join(",")} but received "${typeof o}" with value: ${st(o)?JSON.stringify(o):`"${o}"`}`,r=A(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,b(r,"_parse",(o,s,i)=>{let c=i,a=[];for(let m=0;m<e.length;m++){let d=e[m]._parse(s,c);if(d.success)return d;a.push(d);}let{abortEarly:l}=Ae(c),u={message:typeof n=="function"?n(s):n};if(l!==false)return {success:false,error:u,errors:[u]};let p=[];for(let m=0;m<a.length;m++){let d=a[m].errors;if(d?.length)for(let E=0;E<d.length;E++)d[E].cause?.key&&p.push(it(d[E],`branch ${m}`));}return p.length===0&&p.push(u),{success:false,error:p[0],errors:p}}),r}function tn(e,t){let n=A(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function nn(e){let t=A(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,b(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function rn(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var on={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return te(n=>{let r;return ue(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},lt({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return te(n=>{if(ot(n))return Number(n);if(ue(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},at({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return te(n=>ot(n)||rt(n)&&Number.isFinite(n)?String(n):n,ct({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return te(n=>{let r;return ue(n)&&(r=n.trim()),rt(n)&&Number.isFinite(n)||r?new Date(r??n):n},ut({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return b(e,"_parse",(r,o,s)=>{if(ue(o))try{o=JSON.parse(o);}catch{let i={message:typeof n=="function"?n(o):n};return {success:false,error:i,errors:[i]}}return r(o,s)}),e}},sn={},f={object:Wt,string:ct,number:at,boolean:lt,date:ut,function:Xt,enum:Jt,array:Qt,any:Zt,preprocess:te,union:en,literal:tn,contextRef:nn,withContext:rn,coerce:sn,cast:on};function Gt(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function b(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function A(e,{type:t="any",name:n,message:r}={}){r=r||Gt(t);let o={name:n,message:r,type:t},s={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(i,c){let a=e(i);if(a===true)return {success:true,data:i};if(typeof a=="object"&&a?.success===true)return a;let l={message:typeof r=="function"?r(i):r};return {success:false,error:l,errors:[l]}},parse(i,c){let a=this._parse(i,c);if(!a.success)throw a=a,new Error(a.error.message,{cause:a.error.cause});return a.data},safeParse(i,c){return this._parse(i,c)},transform(i){return b(this,"_parse",(c,a,l)=>{let u=c(a,l);return u.success&&(u.data=i(u.data)),u}),this},optional(){return nt(this,i=>i===void 0),this},nullable(){return nt(this,i=>i===null),this},nullish(){return nt(this,i=>i==null),this},default(i){return b(this,"_parse",(c,a,l)=>(a===void 0&&(a=typeof i=="function"?i({context:l?.context}):i),c(a,l))),this},catch(i){return b(this,"_parse",(c,a,l)=>{let u=c(a,l);return u.success?u:{success:true,data:typeof i=="function"?i({input:a,error:u.error}):i}}),this},pipe(i){return b(this,"_parse",(c,a,l)=>{let u=c(a,l);return u.success?i._parse(u.data,l):u}),this},refine(i,{message:c,type:a,jsonSchema:l}={}){if(a&&(c=c||Gt(a),t=a),l){let u=[...this._getJsonSchemaHints?.()??[],l];this._getJsonSchemaHints=()=>u;}return b(this,"_parse",(u,p,m)=>{let d=u(p,m),{abortEarly:E}=Ae(m);if(!d.success)return d;let C=i(d.data);if(C===true||typeof C=="object"&&C?.success===true)return d;let y={message:typeof c=="function"?c(p):c};return {success:false,error:y,errors:[y]}}),this},clone(){return {...this}}};return Yt.length>0?Yt.reduce((i,c)=>c(i,e,o)??i,s):s}var Yt=[];var cn=class{next(...e){}error(...e){}complete(...e){}},ft=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var _e=Symbol("@esmj/signals:type"),fe=Symbol("@esmj/signals:name");var _=null,pt=false,mt=[];function R(e){let t=_;_=null;let n=e();return _=t,n}function lr(){pt=false;let e=fn();for(let n of e)n.get();let t=mt;mt=[];for(let n of t)n();}function an(){pt||(pt=true,queueMicrotask(lr));}function dt(e){mt.push(e),an();}var ln=Symbol("@esmj/signals:internal observable"),w=Symbol("@esmj/signals:original function"),ur=class extends ft{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>R(()=>{this.#e.add(e),this.#r();}),e.next[w]=void 0),e instanceof dn&&e.next[w]===void 0){let t=e.next.bind(e);e.next=()=>R(()=>{this.#e.add(e),t(),this.#r();}),e.next[w]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[w]){let n=t.get,r=n.bind(t);t.get=()=>R(()=>(this.#e.delete(t),r())),t.get[w]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[w]?e.next[w]:e.next,e.get=e.get[w]?e.get[w]:e.get,this.#e.delete(e),this.unsubscribe(e)}},Ne=null;function un(e){Ne=new ur(e);}un(()=>{an();});function fn(){return Ne.getPending()}function pn(e){return Ne.watch(e)}function mn(e){return Ne.unwatch(e)}var P=Symbol("@esmj/signals:no error"),dn=class gn extends cn{#e=true;#r=false;#t=null;#o=this.#p();#l=null;#a=null;#i=0;#s=new Map;#n=P;constructor(t,n){super(),this.#l=t,this.#a=n,this.debug=n?.debug,this[_e]="computed",this[fe]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[fe],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof gn&&R(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#t[ln].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#t||(this.#t=z(this.#c(),this.#a)),(this.#e||this.#n!==P)&&(this.#s.size===0||this.#f()?this.#c():this.#e=false),_&&_.sourceRevisions.set(this,this.#i),this.#n!==P)throw this.#n;return this.#t.get()}peek(){if(this.#t||(this.#t=z(this.#c(),this.#a)),(this.#e||this.#n!==P)&&(this.#s.size===0||this.#f()?this.#c():this.#e=false),this.#n!==P)throw this.#n;return this.#t.peek()}#c(){this.#r=true,this.#e=false,this.#n=P,this.#u(),this.#o.sourceRevisions.clear();let t=_;_=this.#o;let n;try{n=this.#l();}catch(r){this.#n=r;}return _=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#n=P,this.#t.set(r);}).catch(r=>{this.#n=r;})),this.#n===P&&this.#t&&this.#t.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#n=P;}};function W(e,t){return new dn(e,t)}function N(e,t){let n,{debug:r,...o}={},s=W(()=>{n?.(),n=e();},{equals:()=>false,...o});s.get(),pn(s);let i=()=>{n?.(),s.destroy(),mn(s);};return i[Symbol.dispose]=i,i[_e]="effect",i[fe]=r??null,i.__RX_COMPUTED__=s,i}function z(e,t={}){let n=t?.equals??Object.is,r=0,o=new ft;function s(){return _&&(_.dependencies.set(o,o.subscribe(_.observer)),_.sourceRevisions.set(l,r)),e}function i(){return e}function c(u){if(!n(e,u)){e=u,r++,o.next();}return e}function a(){return r}let l={get:s,set:c,peek:i,getRevision:a,[ln]:o,[_e]:"signal",[fe]:t?.debug??null};return l}function ve(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var Rn=Symbol("node-component"),Ie=Symbol("node-internal"),fr=Symbol("keep-literal"),Te=Symbol("raw-props");function St(e){return typeof e=="function"?e:e!=null&&typeof e.get=="function"?()=>e.get():()=>e}function xt(e,t){let n=e.children!==void 0?e.children:t;return Array.isArray(n)?n[0]:n}var pr=new Set(["template","script"]);function mr(e,t){let n=(e==null?"span":String(e)).trim(),r=n;pr.has(n.toLowerCase())&&(console.warn(`[esmj-dom] tagName "${e}" cannot render children in normal flow and is not supported as a reconciliation wrapper; falling back to "span".`),r="span");let o=document.createElement(r);return r==="span"&&(o.style.display="contents"),o.setAttribute(t,ve()),o}function Ct(e,t,n){let r=mr(e,t);return n?.id&&r.setAttribute("id",n.id),r}function bt(e){let t=null,n=()=>t,r=s=>(t=s??null,t),o={get:n,set:r,[Symbol.toPrimitive](){return t?String(t):""}};return Object.defineProperty(o,"current",{get(){return t},set(s){r(s);},enumerable:true,configurable:false}),new Proxy(o,{get(s,i,c){if(Reflect.has(s,i))return Reflect.get(s,i,c);if(!t)return;let a=t[i];return typeof a=="function"?a.bind(t):a},set(s,i,c,a){return Reflect.has(s,i)||!t?Reflect.set(s,i,c,a):(t[i]=c,true)},has(s,i){return Reflect.has(s,i)||!!t&&i in t}})}var An=null;function X(){return An}function Le(e){An=e;}function we(e){return e?.[Rn]||null}function hn(e,t){e[Rn]=t;}function Be(e,t={disposers:[],id:ve()}){return e?.[Ie]?e[Ie]:(e&&(e[Ie]=t),t)}function dr(e){return e[Ie]}function H(e,t){let n=dr(e);n||(n=Be(e)),n.disposers.push(t);}function ht(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function $(e,t){let n=X();Le(e);try{return t()}finally{Le(n);}}var Et=new Map,Me=new Map,En=new Map;function _n(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let s=e[o];o==="children"||n(o)?r[o]=s:s?.[fr]?r[o]=s():s!=null&&typeof s.get=="function"?r[o]=s:typeof s=="function"?r[o]=W(s):r[o]=z(s);}return r}function Pe(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?false:n.every(o=>{let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return false;let c="value"in s?s.value:s.get?.call(e),a="value"in i?i.value:i.get?.call(t);return Pe(c,a)})}function kt(e){return {id:Symbol("context-id"),defaultValue:e}}function de(e){let t=X();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function v(e){dt(()=>{setTimeout(e,0);});}function ge(e){let t=e.componentId,n=Et.get(t);if(n){Et.delete(t);for(let r of n){let o=r();typeof o=="function"&&ht(Me,t,o);}}}function gr(e){let t=Me.get(e);if(t){Me.delete(e);for(let n of t)n();}}function hr(e){let t=En.get(e);if(t){En.delete(e);for(let n of t)n();}}function Oe(e){if(!e)return;let t=Be(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=we(e);if(n&&(gr(n.componentId),hr(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;Oe(r),r=o;}}}function J(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function yn(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function Er(e,t,n){let r=ve(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let s=yn(e)?void 0:e[Te],i={..._n(t??{},s),children:n},c=X(),a={disposers:[],id:r,contexts:new Map(c?.contexts)};Le(a);let l;if(yn(e)){o.ClassConstructor=e;let p=new e(i);o.classInstance=p,typeof p.onMount=="function"&&ht(Et,r,()=>{p.onMount?.();}),typeof p.onUnmount=="function"&&ht(Me,r,()=>{p.onUnmount?.();}),l=p.render();}else l=e(i);Le(c);let u=yr(l);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let p of u.childNodes)Be(p,a),hn(p,o);else Be(u,a),u instanceof Node&&hn(u,o);return u}};return o}function Rt(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{ge(t);});}function yr(e){return e instanceof Node?e:J(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var Sn={className:"class",htmlFor:"for"},xn=new Set(["value","defaultValue","checked","selected","indeterminate"]),Sr=new Set(["srcdoc"]),xr=new Set(["href","src","action","formaction","xlink:href"]),Cr=new Set(["securitypolicyviolation"]),br=new Set(["contenteditable","draggable","spellcheck"]);function me(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var Nn=Symbol("Fragment");function S(e,t,n){if(e===Nn){let o=document.createDocumentFragment();return yt(o,bn(n)),o}if(typeof e=="function")return Er(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),De(r,t),yt(r,bn(n)),r}function gt(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function kr(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function Rr(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return Sr.has(n)?true:xr.has(n)&&t!==null&&t!==void 0&&kr(String(t))}function vn(e){return typeof e!="string"?e:Sn[e]?Sn[e]:e}function Ar(e,t){let n=vn(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return br.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function Cn(e,t,n){let r=Ar(t,n);if(r===null){e.removeAttribute(t);return}if(Rr(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function De(e,t){let n=X();for(let[r,o]of Reflect.ownKeys(t).map(s=>[s,t[s]]))if(r!=="id"){if(r=vn(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(me(o)){let s=N(()=>{$(n,()=>{gt(e,o.get());});});H(e,s);}else if(typeof o=="function"){let s=N(()=>{$(n,()=>{gt(e,o());});});H(e,s);}else gt(e,o);continue}if(r==="style"){if(me(o)){let s=N(()=>{$(n,()=>{Object.assign(e.style,o.get());});});H(e,s);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let s=r.slice(2).toLowerCase();if(Cr.has(s)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(s,o);continue}if(me(o)||typeof o=="function"){let s=r,i=N(()=>{$(n,()=>{let c=typeof o=="function"?o():o.get();xn.has(s)?e[s]=c??"":Cn(e,s,c);});});H(e,i);continue}xn.has(r)||typeof r=="symbol"?e[r]=o??"":Cn(e,r,o);}}function bn(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function yt(e,t){for(let n of t)In(e,n);}function In(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){kn(e,t);return}if(J(t)){Rt(e,t);return}if(me(t)){kn(e,()=>t.get());return}if(Array.isArray(t)){yt(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function ne(e){let t=null,n=e;return J(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function je(e,t=true){for(let n of e)t&&Oe(n),n.remove();}function kn(e,t){let n=X(),r=document.createComment("");e.appendChild(r);let o=[],s=N(()=>{$(n,()=>{let i=t(),{nodes:c,instance:a}=ne(i);je(o),c.length&&r.after(...c),a&&queueMicrotask(()=>ge(a)),o=c;});});H(e,s);}var He=class{constructor(e){this.props=e;}};function Ln(e,t,n,r){let{equals:o=Pe,tagName:s="span",...i}=r??{},c=Ct(s,"data-for",i);De(c,i);let a=X(),l=[],u=new Map,p=W(()=>e()),m=N(()=>{let d=p.get(),E=Array.isArray(d)?d:[],C=[],y=[],G=new Set;for(let h=0;h<E.length;h++){let k=E[h],I=t(k,h);if(G.has(I)){console.error(`For: duplicate key "${String(I)}" detected; ignoring later item at index ${h}`);continue}G.add(I),C.push(k),y.push(I);}let ee=new Map(l.map(h=>[h.key,h])),j=[];for(let h=0;h<C.length;h++){let k=y[h],I=C[h],Y=ee.get(k);if(Y)u.get(k).set(I),j.push(Y),ee.delete(k);else {let Vt=z(I,{equals:o});u.set(k,Vt);let Zn={...Vt,set(){}},Ut={key:k,nodes:[]};$(a,()=>{let er=n(Zn,h),{nodes:tr,instance:qt}=ne(er);Ut.nodes=tr,qt&&queueMicrotask(()=>ge(qt));}),j.push(Ut);}}for(let[h,k]of ee)je(k.nodes),u.delete(h);let T=null;for(let h=j.length-1;h>=0;h--){let k=j[h].nodes;for(let I=k.length-1;I>=0;I--){let Y=k[I];(Y.parentNode!==c||Y.nextSibling!==T)&&c.insertBefore(Y,T),T=Y;}}l=j;});return H(c,m),c}function At(e,t,n,r){if(typeof e=="function")return Ln(e,t,n,r);let{each:o,keyFn:s,equals:i,tagName:c,children:a,...l}=e??{};if(typeof s!="function")throw new Error('For: "keyFn" prop is required and must be a function');let u=St(o),p=xt(e??{},t);return Ln(u,s,p,{...l,equals:i,tagName:c})}At[Te]=e=>e!=="each";function Mn(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(Oe(e),e.innerHTML=""),J(t)?Rt(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var _t=vt(),Nt=vt(),Tn=vt(),Nr=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function vt(){return Math.floor(Math.random()*16777215)}function vr(){return Nt=(Nt+1)%16777215,Nt}function x(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=vr(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,_t>>16&255,_t>>8&255,_t&255,Tn>>8&255,Tn&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=Nr[n.charCodeAt(o)];return r}var It=Symbol("block-element"),Ir=Symbol("block-element-body"),O=Symbol("selectable-element");function Lt(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function Bt(e){return e?Lt(e.startContainer,It):null}function F(e){return Lt(e,It)}function wn(e){return e?Lt(e.startContainer,O):null}function Lr(e){return e?e[O]!==void 0?[e]:[...e.children].filter(t=>t[O]!==void 0):[]}function Br(e,t){return t?Lr(e).indexOf(t):-1}function he(e,t){let n=wn(t);return !n||!e?.contains(n)?null:{element:n,index:Br(e,n)}}function Pn(){return window.getSelection()}function B(){let e=Pn();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function $e(){let e=B();if(!e)return 0;e.collapse(true);let t=wn(e),n=Bt(e),r=t??K(n);return Fe(r,e.startContainer,e.startOffset)}function Fe(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let i=0,c=e.childNodes,a=Math.min(n,c.length);for(let l=0;l<a;l++)i+=c[l].textContent.length;return i}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=o.nextNode();for(;s;){if(s===t)return r+n;r+=s.textContent.length,s=o.nextNode();}return r}function Mr(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let s=o.pop();if(s.nodeType===Node.TEXT_NODE){let i=s.textContent.length;if(r+i>=t)return n.setEnd(s,t-r),n.setStart(s,t-r),n;r+=i;}else if(s.childNodes&&s.childNodes.length>0)for(let i=s.childNodes.length-1;i>=0;i--)o.push(s.childNodes[i]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function M(e,t){let n=Mr(e,t),r=Pn();r.removeAllRanges(),r.addRange(n);}function K(e){if(!e)return null;let t=Tr(e);return t?.firstElementChild??t?.firstChild}function Ee(e){if(!e?.[It])return null;let t=K(e);return t?we(t)?.classInstance:null}function Tr(e){if(!e)return null;for(let t of e.children)if(t[Ir])return t;return null}var L="molecule.paragraph.Paragraph",ye="molecule.list.List";var Mt="molecule.headline.H1",Tt="molecule.headline.H2",wt="molecule.headline.H3",Pt="molecule.headline.H4",Ot="molecule.headline.H5",On="molecule.headline.";function g(e){return e===`
2
2
  `||e===`\r
3
- `?"":e??""}function J({component:e,originComponent:t,properties:n,settings:r}={}){let o=n??{},s=Array.isArray(o.items)?o.items:[{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}];return {...e?{component:e}:{},...t?{originComponent:t}:{},properties:{items:s},...r?{settings:r}:{}}}function je(e){let t="",n=[],r=[];return (e??[]).forEach((o,s)=>{s>0&&(t+=`
4
- `);let i=t.length;t+=g(o?.text);for(let a of o?.inlineStyleRanges??[])n.push({...a,offset:a.offset+i});for(let a of o?.entityRanges??[])r.push({...a,offset:a.offset+i});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function B(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function jn(e){let t=e?.component??"";return t===I||t.startsWith(Tn)}function He(e){return Array.isArray(e?.properties?.items)}function Mr(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function On(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function wr(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=e;for(let i of t){let a=r.find(c=>c.match(i));a&&(s=E(a,{},s));}for(let i of n){let a=o.find(c=>c.match(i));a&&(s=E(a,i,s));}return s}function re(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=g(e.properties.text),s=e.properties.inlineStyleRanges??[],i=e.properties.entityRanges??[];if(!o)return r;let a=Mr([...s,...i],o.length);for(let c=0;c<a.length-1;c+=1){let l=a[c],u=a[c+1];if(l>=u)continue;let p=o.slice(l,u),m=wr(p,On(s,l,u),On(i,l,u),{inlineStyleComponents:t,entityRangeComponents:n});In(r,m);}return r}function ne(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=n;for(let i of e){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let a=r.find(l=>l.match(i));if(a){let l=i.textContent.length;t.properties.inlineStyleRanges.push({style:a.style,offset:s,length:l}),s=ne(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}let c=o.find(l=>l.match(i));if(c){let l=i.textContent.length;t.properties.entityRanges.push({...c.getStateSchema(i).parse(),offset:s,length:l}),s=ne(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}s=ne(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});}return s}function ge(e,t){let n=g(e.properties.text),r=g(t.properties.text);return {state:{...e,properties:{...t.properties,...e.properties,text:n+r,inlineStyleRanges:[...e.properties.inlineStyleRanges??[],...(t.properties.inlineStyleRanges??[]).map(o=>({...o,offset:o.offset+n.length}))],entityRanges:[...e.properties.entityRanges??[],...(t.properties.entityRanges??[]).map(o=>({...o,offset:o.offset+n.length}))]},settings:{...t.settings,...e.settings}},cursor:n.length}}function Bn(e,t){return (e??[]).filter(n=>n.offset<t).map(n=>({...n,length:Math.min(n.length,t-n.offset)}))}function Dn(e,t){return (e??[]).filter(n=>n.offset+n.length>t).map(n=>({...n,offset:Math.max(0,n.offset-t),length:n.offset+n.length-Math.max(n.offset,t)}))}function Bt(e,t){let n=structuredClone(e),r=structuredClone(e);return n.properties.text=e.properties.text.slice(0,t),r.properties.text=e.properties.text.slice(t),n.properties.inlineStyleRanges=Bn(e.properties.inlineStyleRanges,t),r.properties.inlineStyleRanges=Dn(e.properties.inlineStyleRanges,t),n.properties.entityRanges=Bn(e.properties.entityRanges,t),r.properties.entityRanges=Dn(e.properties.entityRanges,t),r.componentId=y(),{originalLineState:n,newLineState:r}}function $e(e,t,{namespace:n=e.constructor.NAMESPACE}={}){if(t.key!=="Enter")return false;t.preventDefault();let{originalLineState:r,newLineState:o}=Bt(e.getState(),Pn(e.element));return e.mrakomor.command.insertBlockElement({range:O(),cursor:0,newLineState:o,originalLineState:r,namespace:n}),true}function Fe(e,t){let n=e.constructor;if(!t)return n.getStateSchema(t).parse();let r=structuredClone(n.getStateSchema(t).parse());return ne(t.childNodes,r,0,{inlineStyleComponents:e.getInlineStyleComponents(),entityRangeComponents:e.getEntityRangeComponents()}),r.properties.text=g(r.properties.text),r}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/headline/Headline.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.mrakomor-content h1,.mrakomor-content h2,.mrakomor-content h3,.mrakomor-content h4,.mrakomor-content h5{margin-top:0}
5
- `,document.head.appendChild(n);}}})();var Ve={INPUT:"mrakomor:input",TRANSFORM_BLOCK_ELEMENT:"mrakomor:transform-block-element"};var Ue=Ct();var qe=class extends Oe{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=fe(Ue),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return f.object({component:f.string().default(this.NAMESPACE),properties:f.object().default({}),settings:f.object().default({})}).default({})}static getPropsSchema(){return f.object({state:this.getStateSchema(),observeDOMChanges:f.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(Ve.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var V=class extends qe{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor(t){let n=()=>{if(!this.element?.isConnected)return;let r=typeof t=="number"?t:g(this.getState()?.properties?.text).length;F(this.element,r);};n(),P(n);}onKeydown(t){}static toExchangeState(t){let n=t?.properties,r={text:g(n?.text)};return n?.inlineStyleRanges!==void 0&&(r.inlineStyleRanges=n.inlineStyleRanges),n?.entityRanges!==void 0&&(r.entityRanges=n.entityRanges),J({originComponent:this.NAMESPACE,properties:{items:[r]},settings:t?.settings})}static fromExchangeState(t){let n=t?.properties?.items?.[0];return {properties:{text:n?.text??"",inlineStyleRanges:n?.inlineStyleRanges??[],entityRanges:n?.entityRanges??[]},settings:t?.settings}}static appendExchangeState(t,n){let r=je(n?.properties?.items);return ge(t,B(r))}};function Ke(){return f.object({length:f.number(),offset:f.number(),style:f.string()})}function Q({type:e,data:t=f.any(),length:n,offset:r}={}){let o=e!=null,s=f.object({type:o?f.string().default(e):f.string(),data:t}),i=n??(o?0:void 0),a=r??(o?0:void 0);return f.object({entity:o?s.default({}):s,length:i==null?f.number():f.number().default(i),offset:a==null?f.number():f.number().default(a)})}function oe(){return f.array(Q()).transform(e=>e.filter(t=>t.entity.type==="atom.tts.Voice")).default([])}function U(e,{component:t,properties:n,settings:r=f.object({}).default({})}){return f.object({component:f.string().default(t),componentId:f.string().default(e?.getAttribute("data-componentid")||y()),properties:f.object(n).default({}),settings:r}).default({})}var Ge=class extends V{constructor(t){super(t),this._level=1;}static getStateSchema(t){return U(t,{component:this.NAMESPACE,properties:{text:f.string().default(t?.textContent??t?.innerText??"")}})}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse());return n.properties.text=g(n.properties.text),n}_buildContent(t){return t.properties?.text??""}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return E(`h${this._level}`,{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[T]:true,$ref:n=>{this.element=n;},$dangerouslySetInnerHTML:()=>{let n=this.state.get(),r=n.properties?.text??"";return g(r)?A(()=>this._buildContent(n)):"<br>"}})}onKeydown(t){if(t.key==="Backspace"){this.#e(t);return}$e(this,t,{namespace:I});}#e(t){if(!O()?.collapsed)return;let r=$(this.element);if(r?.previousElementSibling||g(this.getState()?.properties?.text))return;t.preventDefault(),this.mrakomor.command.transformBlockElement({blockElement:r,namespace:I});let o=()=>{let s=this.mrakomor.getRoot()?.querySelector(".mrakomor-content .mrakomor-block-element"),i=de(s);i?.isConnected&&F(i,0);};o(),P(o);}};var q=class extends Ge{static getStateSchema(t){return U(t,{component:this.NAMESPACE,properties:{text:f.string().default(t?.textContent??t?.innerText??""),entityRanges:oe()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return Fe(this,t)}_buildContent(t){return re(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}},Ye=class extends q{static get NAMESPACE(){return Mt}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},he=class extends q{static get NAMESPACE(){return wt}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},Ee=class extends q{static get NAMESPACE(){return Pt}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},ye=class extends q{static get NAMESPACE(){return Tt}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},We=class extends q{static get NAMESPACE(){return Ot}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function Pr(){return {resolveConfig:e=>(e.blockComponents.push(he,Ee,ye),e),resolveComponent:e=>{if(e===Ye.NAMESPACE)return Ye;if(e===he.NAMESPACE)return he;if(e===Ee.NAMESPACE)return Ee;if(e===ye.NAMESPACE)return ye;if(e===We.NAMESPACE)return We}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/list/List.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.molecule-list-list{margin:0 0 1em;padding-inline-start:1.5em}.molecule-list-list li{margin:.25em 0;outline:none}.molecule-list-list li:focus{outline:none}.molecule-list-list li[data-depth="1"]{margin-inline-start:1.5em}.molecule-list-list li[data-depth="2"]{margin-inline-start:3em}.molecule-list-list li[data-depth="3"]{margin-inline-start:4.5em}
6
- `,document.head.appendChild(n);}}})();function ze(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function Se(e=[]){let t=new Set;return e.map(n=>{if(n?.componentId&&!t.has(n.componentId))return t.add(n.componentId),n;let r=y();return t.add(r),{...n,componentId:r}})}function $n(e){return e?[...e.children].filter(t=>t.nodeName==="LI"):[]}function Dt(e,t){return !e||!t?0:Be(e,t.startContainer,t.startOffset)}function Fn(e,t){let n=B(e),{originalLineState:r,newLineState:o}=Bt(n,t);return {before:{componentId:e.componentId,depth:e.depth??0,text:r.properties.text,inlineStyleRanges:r.properties.inlineStyleRanges??[],entityRanges:r.properties.entityRanges??[]},after:{componentId:y(),depth:e.depth??0,text:o.properties.text,inlineStyleRanges:o.properties.inlineStyleRanges??[],entityRanges:o.properties.entityRanges??[]}}}function Vn(e,{style:t="UNORDERED"}={}){let n=e?.properties?.items,r=Array.isArray(n)&&n.length?n.map(o=>({componentId:o?.componentId??y(),depth:o?.depth??0,text:g(o?.text??""),inlineStyleRanges:[...o?.inlineStyleRanges??[]],entityRanges:[...o?.entityRanges??[]]})):[{componentId:y(),depth:0,text:g(e?.properties?.text??""),inlineStyleRanges:[...e?.properties?.inlineStyleRanges??[]],entityRanges:[...e?.properties?.entityRanges??[]]}];return {component:De,componentId:y(),properties:{items:r},settings:{style:t==="ORDERED"?"ORDERED":"UNORDERED"}}}function jt(e,t,{namespace:n=I,Constructor:r}={}){let o=e.properties?.items??[],s=o[t];if(!s)return {blocks:[e],paragraphIndex:0};let i=o.slice(0,t),a=o.slice(t+1),c=J({properties:{text:s.text,inlineStyleRanges:s.inlineStyleRanges,entityRanges:s.entityRanges}}),l={component:n,componentId:y(),settings:{},...r?.fromExchangeState(c)??B(s)},u=[];return i.length&&u.push({...e,properties:{...e.properties,items:i}}),u.push(l),a.length&&u.push({...e,componentId:i.length?y():e.componentId,properties:{...e.properties,items:a}}),{blocks:u,paragraphIndex:i.length?1:0}}function Hn(e){return He(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function Tr(e,t){let n=Hn(e),r=Hn(t);return n!=null&&n===r}function Un(e,t,n){if(t<0||n!==t+1||n>=e.length)return null;let r=e[t],o=e[n];if(!Tr(r,o))return null;let s=[...r.properties?.items??[]],i=[...o.properties?.items??[]];if(i.length===0){let m=[...e];m.splice(n,1);let d=s.length-1,S=d>=0?g(s[d]?.text).length:0;return {content:m,listIndex:t,cursor:S}}let[a,...c]=i,l=0;if(s.length===0)s.push(a,...c),l=0;else {let m=s.length-1,d=s[m],S=B(d),_=B(a),{state:x,cursor:K}=ge(S,_);s[m]={...d,text:x.properties.text,inlineStyleRanges:x.properties.inlineStyleRanges,entityRanges:x.properties.entityRanges},c.length&&s.push(...c),l=K;}let u={...r,properties:{...r.properties,items:Se(s)}},p=[...e];return p[t]=u,p.splice(n,1),{content:p,listIndex:t,cursor:l}}function qn(e,t){let n=e.properties?.items??[],r=n.length-1;if(r<0)return null;let o=n[r],s=B(o),i=je(J({properties:t?.properties}).properties.items),a=B(i),{state:c,cursor:l}=ge(s,a);return {state:{...e,properties:{...e.properties,items:n.map((u,p)=>p===r?{...u,text:c.properties.text,inlineStyleRanges:c.properties.inlineStyleRanges,entityRanges:c.properties.entityRanges}:u)}},cursor:l}}function Kn(e,t){return re({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},t)}function Gn(e,t){let n=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:g(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return ne(e.childNodes,r,0,t),{componentId:e.getAttribute("data-componentid")||void 0,depth:n,text:g(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}var Xe=e=>f.object({componentId:f.string().default(()=>e?.getAttribute?.("data-componentid")||y()),depth:f.number().default(0),text:f.string().default(""),inlineStyleRanges:f.array(Ke()).default([]),entityRanges:f.array(Q()).default([])}).default({}),Je=class e extends V{static get NAMESPACE(){return De}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let n=ze(t);return f.object({component:f.string().default(e.NAMESPACE),componentId:f.string().default(t?.getAttribute("data-componentid")||y()),properties:f.object({items:f.array(Xe()).default([Xe().parse()]).transform(Se)}).default({}),settings:f.object({style:f.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}static toExchangeState(t){let r=(t?.properties?.items??[]).map(o=>{let s={componentId:o?.componentId,text:g(o?.text),depth:o?.depth??0};return o?.inlineStyleRanges!==void 0&&(s.inlineStyleRanges=o.inlineStyleRanges),o?.entityRanges!==void 0&&(s.entityRanges=o.entityRanges),s});return J({originComponent:this.NAMESPACE,properties:{items:r},settings:t?.settings})}static fromExchangeState(t){return Vn(t,{style:t?.settings?.style})}static appendExchangeState(t,n){return qn(t,n)}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse()),r={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},o=$n(t);if(o.length)n.properties.items=o.map(s=>Xe(s).parse(Gn(s,r)));else {let s=this.state?.peek?.()?.properties?.items;n.properties.items=s?.length?structuredClone(s):[Xe().parse()];}return n.settings={...n.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??n.settings?.style??"UNORDERED"},n}_commitState(t){let n=$(this.element)??this.mrakomor._getBlockElementByComponentId(t.componentId),r=this.mrakomor._getBlockElementIndex(n);if(r===-1)return;let o=this.mrakomor.getContent();o.splice(r,1,t),this.mrakomor.setContent(o);}_buildItemContent(t){return Kn(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),n=this.state.peek(),r=n.settings?.style==="ORDERED"?"ol":"ul",o=Rt(()=>this.state.get().properties?.items??[],(s,i)=>s.componentId??String(i),(s,i)=>E("li",{contentEditable:true,[T]:true,"data-componentid":()=>s.get().componentId,"data-item-index":()=>{let a=s.get()?.componentId,l=(this.state.get().properties?.items??[]).findIndex(u=>u.componentId===a);return String(l>=0?l:i)},"data-depth":()=>String(s.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let a=s.get(),c=a?.text??"";return g(c)?A(()=>this._buildItemContent(a)):"<br>"}}),{tagName:r});return o.className=t,n.componentId&&o.setAttribute("data-componentid",n.componentId),this.element=o,o}onKeydown(t){if(t.key==="Enter"){this.#r(t);return}t.key==="Backspace"&&this.#t(t);}setCursor(t){let n=this.getState()?.properties?.items??[],r=n.length-1;if(r<0)return;let o=typeof t=="number"?t:g(n[r]?.text).length,s=()=>{let i=this.element?.querySelector(`li[data-item-index="${r}"]`);i?.isConnected&&F(i,o);};s(),P(s);}#e(t){let n=this.getState(),r=[...n.properties.items??[]],o=r[t];if(!o)return;if((o.depth??0)>0){r[t]={...o,depth:o.depth-1},this._commitState({...n,properties:{...n.properties,items:r}});let p=()=>{let m=this.element?.querySelector(`li[data-item-index="${t}"]`);m?.isConnected&&F(m,0);};p(),P(p);return}let s=$(this.element),i=this.mrakomor._getBlockElementIndex(s),a=s?.previousElementSibling??null,c=a?this.mrakomor._getBlockElementIndex(a):-1;if(t===0&&c>=0&&i===c+1){let p=this.mrakomor.getContent(),m=Un(p,c,i);if(m){this.mrakomor._setContentState(m.content.map(d=>this.mrakomor.normalizeComponentState(d))),Lt(a)?.setCursor?.(m.cursor);return}}let{blocks:l,paragraphIndex:u}=jt(n,t,{Constructor:this.mrakomor.register.blocks.getByNamespace(I)});this.mrakomor.command.replaceBlockElement({blockElement:$(this.element),blocks:l,cursor:0,cursorBlockIndex:u});}#r(t){t.preventDefault();let n=O(),r=me(this.element,n);if(!r)return;let{element:o,index:s}=r,i=Dt(o,n),a=this.getState(),c=[...a.properties.items??[]],l=c[s];if(!l)return;if(!g(l.text)){this.#e(s);return}let{before:u,after:p}=Fn(l,i);c.splice(s,1,u,p),this._commitState({...a,properties:{...a.properties,items:c}}),P(()=>{let m=this.element?.querySelector(`li[data-item-index="${s+1}"]`);m&&F(m,0);});}#t(t){let n=O();if(!n?.collapsed)return;let r=me(this.element,n);if(!r){let a=n.startContainer;if(!(a===this.element||this.element?.contains?.(a)))return;t.preventDefault(),this.#e(0);return}let{element:o,index:s}=r;Dt(o,n)===0&&(t.preventDefault(),this.#e(s));}};function Or(e){let{mrakomor:t,blockElement:n,namespace:r}=e;if(!t||!n||!r)return;let o=t._getBlockElementState(n);if(!o||!jn({component:r})||!He(o))return;e.preventDefault();let i=Lt(n)?.element,a=e.range??O(),c=me(i,a);if(!c)return;let{index:l}=c,{blocks:u,paragraphIndex:p}=jt(o,l,{namespace:r,Constructor:t.register.blocks.getByNamespace(r)});t.command.replaceBlockElement({blockElement:n,blocks:u,cursor:0,cursorBlockIndex:p});}function Yn(e){return {resolveConfig:t=>(t.blockComponents.push({component:e,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:e,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===e.NAMESPACE)return e},registerCommands(t){t.emitter.on(Ve.TRANSFORM_BLOCK_ELEMENT,Or);}}}var Wn=e=>f.object({componentId:f.string().default(()=>y()),depth:f.number().default(0),text:f.string().default(""),entityRanges:oe()}).default({}),Qe=class e extends Je{static getStateSchema(t){let n=ze(t);return f.object({component:f.string().default(e.NAMESPACE),componentId:f.string().default(t?.getAttribute("data-componentid")||y()),properties:f.object({items:f.array(Wn()).default([Wn().parse()]).transform(Se)}).default({}),settings:f.object({style:f.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function Br(){return Yn(Qe)}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/paragraph/Paragraph.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.mrakomor-content p{margin-top:0}
7
- `,document.head.appendChild(n);}}})();var Ze=class e extends V{static get NAMESPACE(){return I}static get LABEL(){return "P"}static get KEYWORDS(){return ["p","paragraph","text"]}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){return U(t,{component:e.NAMESPACE,properties:{entityRanges:f.array(Q()).default([]),inlineStyleRanges:f.array(Ke()).default([]),text:f.string().default(t?.innerText??t?.textContent??"")}})}parseFromHTML(t){return Fe(this,t)}_buildContent(t){return re(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return E("p",{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[T]:true,$ref:n=>{this.element=n;},$dangerouslySetInnerHTML:()=>{let n=this.state.get(),r=n.properties?.text??"";return g(r)?A(()=>this._buildContent(n)):"<br>"}})}onKeydown(t){$e(this,t);}};var se=class e extends Ze{static getStateSchema(t){return U(t,{component:e.NAMESPACE,properties:{entityRanges:oe(),text:f.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function Dr(){return {resolveConfig:e=>(e.blockComponents.push(se),e),resolveComponent:e=>{if(e===se.NAMESPACE)return se}}}var et=class extends Oe{static get nodeName(){return "span"}static get NAMESPACE(){return "namespace.EntityRangeElement"}static match(t){return t?.nodeName===this.nodeName.toUpperCase()||t?.entity?.type===this.NAMESPACE}static getStateSchema(t){return f.any()}constructor(t){super(t),this.mrakomor=fe(Ue),this.element=bt();}render(){return E(this.constructor.nodeName,{},this.props.children)}};(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man,.tts-voice--woman{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 14%,white);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice--man:before,.tts-voice--woman:before{background:var(--tts-voice-color, #1a73e8);color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man,.tts-voice-toolbar__voice--woman{border-color:var(--tts-voice-color, #1a73e8);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active,.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 16%,white)}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
8
- `,document.head.appendChild(n);}}})();var xe=[{id:"Jarda",label:"Voice Jarda",gender:"man",color:"#1a73e8"},{id:"Pavel",label:"Voice Pavel",gender:"man",color:"#1e8e3e"},{id:"Radek",label:"Voice Radek",gender:"man",color:"#00838f"},{id:"Magda",label:"Voice Magda",gender:"woman",color:"#7b1fa2"},{id:"Marketa",label:"Voice Marketa",gender:"woman",color:"#d81b60"},{id:"Silva",label:"Voice Silva",gender:"woman",color:"#c62828"}],jr='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function Ht(e){return xe.find(t=>t.id===e)??xe[0]}function Hr(e){let t=xe.find(o=>o.id===e);if(t)return t.color;let n=0;for(let o=0;o<e.length;o++)n=n*31+e.charCodeAt(o)|0;return `hsl(${Math.abs(n)%360}, 65%, 45%)`}var ie=class e extends et{#e;static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let n;if(t?.getAttribute?.("data-state"))try{n=JSON.parse(t.getAttribute("data-state"));}catch{}let r=n?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return Q({type:e.NAMESPACE,data:f.object({voice:f.string().default(r)}).default({}),length:n?.length??0,offset:n?.offset??0}).default({})}#r({entity:t,length:n,offset:r}){let o=t.peek()?.data?.voice??"";return E("div",{className:"tts-voice-toolbar"},[E("div",{className:"tts-voice-toolbar__row"},[...xe.map(s=>E("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${s.gender}${o===s.id?" tts-voice-toolbar__voice--active":""}`,$ref:i=>i?.style.setProperty("--tts-voice-color",s.color),title:s.label,onClick:()=>{t.set({...t.peek(),data:{voice:s.id}}),this.mrakomor.command.closeDialog();}},s.label)),E("span",{className:"tts-voice-toolbar__sep"}),E("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:jr,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:n.peek(),offset:r.peek()},blockElement:$(this.element)});}})])])}#t(t){this.mrakomor.command.openDialog({element:this.element,children:this.#r(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||this.#t(this.props),this.#e=N(()=>{let n=t.get()?.data?.voice??"";this.element.current?.style.setProperty("--tts-voice-color",Hr(n));});}onUnmount(){this.#e?.();}render(){let{entity:t,length:n,offset:r,children:o}=this.props;return E("span",{className:()=>{let s=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${Ht(s||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let s=t.get()?.data?.voice??"";return s?Ht(s).label:""},$ref:this.element,onClick:s=>{s.preventDefault(),this.#t({entity:t,length:n,offset:r});},"data-state":()=>JSON.stringify({entity:t.get(),length:n.get(),offset:r.get()})},o)}};function $r(){return {resolveConfig:e=>(e.entityRanges.push(ie),e),resolveComponent:e=>{if(e===ie.NAMESPACE)return ie}}}
9
- exports.TtsHeadlineComponent=q;exports.TtsList=Qe;exports.TtsParagraph=se;exports.TtsVoice=ie;exports.VOICES=xe;exports.getVoice=Ht;exports.ttsHeadlinePlugin=Pr;exports.ttsListPlugin=Br;exports.ttsParagraphPlugin=Dr;exports.ttsVoicePlugin=$r;
3
+ `?"":e??""}function Q({component:e,originComponent:t,properties:n,settings:r}={}){let o=n??{},s=Array.isArray(o.items)?o.items:[{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}];return {...e?{component:e}:{},...t?{originComponent:t}:{},properties:{items:s},...r?{settings:r}:{}}}function $n(e){let t="",n=[],r=[];return (e??[]).forEach((o,s)=>{s>0&&(t+=`
4
+ `);let i=t.length;t+=g(o?.text);for(let c of o?.inlineStyleRanges??[])n.push({...c,offset:c.offset+i});for(let c of o?.entityRanges??[])r.push({...c,offset:c.offset+i});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function D(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function Fn({mrakomor:e,resultIndex:t,cursor:n,fallbackBlockElement:r,itemIndex:o}){let s=()=>{if(typeof n!="number")return;let i=e._getBlockElements()[t]??r,c=Ee(i);if(c?.setCursor){c.setCursor({cursor:n,itemIndex:o});return}let a=K(i);a?.isConnected&&M(a,n);};s(),v(s);}function Dt(e){let t=e?.component??"";return t===L||t.startsWith(On)}function Ke(e){return Array.isArray(e?.properties?.items)}function wr(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function Dn(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function Pr(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=e;for(let i of t){let c=r.find(a=>a.match(i));c&&(s=S(c,{},s));}for(let i of n){let c=o.find(a=>a.match(i));c&&(s=S(c,i,s));}return s}function oe(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=g(e.properties.text),s=e.properties.inlineStyleRanges??[],i=e.properties.entityRanges??[];if(!o)return r;let c=wr([...s,...i],o.length);for(let a=0;a<c.length-1;a+=1){let l=c[a],u=c[a+1];if(l>=u)continue;let p=o.slice(l,u),m=Pr(p,Dn(s,l,u),Dn(i,l,u),{inlineStyleComponents:t,entityRangeComponents:n});Mn(r,m);}return r}function re(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=n;for(let i of e){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let c=r.find(l=>l.match(i));if(c){let l=i.textContent.length;t.properties.inlineStyleRanges.push({style:c.style,offset:s,length:l}),s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}let a=o.find(l=>l.match(i));if(a){let l=i.textContent.length;t.properties.entityRanges.push({...a.getStateSchema(i).parse(),offset:s,length:l}),s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});}return s}function Se(e,t){let n=g(e.properties.text),r=g(t.properties.text);return {state:{...e,properties:{...t.properties,...e.properties,text:n+r,inlineStyleRanges:[...e.properties.inlineStyleRanges??[],...(t.properties.inlineStyleRanges??[]).map(o=>({...o,offset:o.offset+n.length}))],entityRanges:[...e.properties.entityRanges??[],...(t.properties.entityRanges??[]).map(o=>({...o,offset:o.offset+n.length}))]},settings:{...t.settings,...e.settings}},cursor:n.length}}function jn(e,t){return (e??[]).filter(n=>n.offset<t).map(n=>({...n,length:Math.min(n.length,t-n.offset)}))}function Hn(e,t){return (e??[]).filter(n=>n.offset+n.length>t).map(n=>({...n,offset:Math.max(0,n.offset-t),length:n.offset+n.length-Math.max(n.offset,t)}))}function jt(e,t){let n=structuredClone(e),r=structuredClone(e);return n.properties.text=e.properties.text.slice(0,t),r.properties.text=e.properties.text.slice(t),n.properties.inlineStyleRanges=jn(e.properties.inlineStyleRanges,t),r.properties.inlineStyleRanges=Hn(e.properties.inlineStyleRanges,t),n.properties.entityRanges=jn(e.properties.entityRanges,t),r.properties.entityRanges=Hn(e.properties.entityRanges,t),r.componentId=x(),{originalLineState:n,newLineState:r}}function Ve(e,t,{namespace:n=e.constructor.NAMESPACE}={}){if(t.key!=="Enter")return false;t.preventDefault();let{originalLineState:r,newLineState:o}=jt(e.getState(),$e(e.element));return e.mrakomor.command.insertBlockElement({range:B(),cursor:0,newLineState:o,originalLineState:r,namespace:n}),true}function Ue(e,t){let n=e.constructor;if(!t)return n.getStateSchema(t).parse();let r=structuredClone(n.getStateSchema(t).parse());return re(t.childNodes,r,0,{inlineStyleComponents:e.getInlineStyleComponents(),entityRangeComponents:e.getEntityRangeComponents()}),r.properties.text=g(r.properties.text),r}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/headline/Headline.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.mrakomor-content h1,.mrakomor-content h2,.mrakomor-content h3,.mrakomor-content h4,.mrakomor-content h5{margin-top:0}
5
+ `,document.head.appendChild(n);}}})();var xe={KEYDOWN:"mrakomor:keydown",INPUT:"mrakomor:input",TRANSFORM_BLOCK_ELEMENT:"mrakomor:transform-block-element"};var qe=kt();var Ge=class extends He{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=de(qe),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return f.object({component:f.string().default(this.NAMESPACE),properties:f.object().default({}),settings:f.object().default({})}).default({})}static getPropsSchema(){return f.object({state:this.getStateSchema(),observeDOMChanges:f.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(xe.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var V=class extends Ge{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor({cursor:t}={}){let n=()=>{if(!this.element?.isConnected)return;let r=typeof t=="number"?t:g(this.getState()?.properties?.text).length;M(this.element,r);};n(),v(n);}onKeydown(t){}static toExchangeState(t){let n=t?.properties,r={text:g(n?.text)};return n?.inlineStyleRanges!==void 0&&(r.inlineStyleRanges=n.inlineStyleRanges),n?.entityRanges!==void 0&&(r.entityRanges=n.entityRanges),Q({originComponent:this.NAMESPACE,properties:{items:[r]},settings:t?.settings})}static fromExchangeState(t){let n=t?.properties?.items?.[0];return {properties:{text:n?.text??"",inlineStyleRanges:n?.inlineStyleRanges??[],entityRanges:n?.entityRanges??[]},settings:t?.settings}}static appendExchangeState(t,n){let r=$n(n?.properties?.items);return Se(t,D(r))}};function Ye(){return f.object({length:f.number(),offset:f.number(),style:f.string()})}function Z({type:e,data:t=f.any(),length:n,offset:r}={}){let o=e!=null,s=f.object({type:o?f.string().default(e):f.string(),data:t}),i=n??(o?0:void 0),c=r??(o?0:void 0);return f.object({entity:o?s.default({}):s,length:i==null?f.number():f.number().default(i),offset:c==null?f.number():f.number().default(c)})}function se(){return f.array(Z()).transform(e=>e.filter(t=>t.entity.type==="atom.tts.Voice")).default([])}function U(e,{component:t,properties:n,settings:r=f.object({}).default({})}){return f.object({component:f.string().default(t),componentId:f.string().default(e?.getAttribute("data-componentid")||x()),properties:f.object(n).default({}),settings:r}).default({})}var ze=class extends V{constructor(t){super(t),this._level=1;}static getStateSchema(t){return U(t,{component:this.NAMESPACE,properties:{text:f.string().default(t?.textContent??t?.innerText??"")}})}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse());return n.properties.text=g(n.properties.text),n}_buildContent(t){return t.properties?.text??""}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return S(`h${this._level}`,{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[O]:true,$ref:n=>{this.element=n;},$dangerouslySetInnerHTML:()=>{let n=this.state.get(),r=n.properties?.text??"";return g(r)?R(()=>this._buildContent(n)):"<br>"}})}onKeydown(t){if(t.key==="Backspace"){this.#e(t);return}Ve(this,t,{namespace:L});}#e(t){if(!B()?.collapsed)return;let r=F(this.element);if(r?.previousElementSibling||g(this.getState()?.properties?.text))return;t.preventDefault(),this.mrakomor.command.transformBlockElement({blockElement:r,namespace:L});let o=()=>{let s=this.mrakomor.getRoot()?.querySelector(".mrakomor-content .mrakomor-block-element"),i=K(s);i?.isConnected&&M(i,0);};o(),v(o);}};var q=class extends ze{static getStateSchema(t){return U(t,{component:this.NAMESPACE,properties:{text:f.string().default(t?.textContent??t?.innerText??""),entityRanges:se()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return Ue(this,t)}_buildContent(t){return oe(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}},We=class extends q{static get NAMESPACE(){return Mt}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},Ce=class extends q{static get NAMESPACE(){return Tt}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},be=class extends q{static get NAMESPACE(){return wt}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},ke=class extends q{static get NAMESPACE(){return Pt}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},Xe=class extends q{static get NAMESPACE(){return Ot}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function Or(){return {resolveConfig:e=>(e.blockComponents.push(Ce,be,ke),e),resolveComponent:e=>{if(e===We.NAMESPACE)return We;if(e===Ce.NAMESPACE)return Ce;if(e===be.NAMESPACE)return be;if(e===ke.NAMESPACE)return ke;if(e===Xe.NAMESPACE)return Xe}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/list/List.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.molecule-list-list{margin:0 0 1em;padding-inline-start:1.5em}.molecule-list-list li{margin:.25em 0;outline:none}.molecule-list-list li:focus{outline:none}.molecule-list-list li[data-depth="1"]{margin-inline-start:1.5em}.molecule-list-list li[data-depth="2"]{margin-inline-start:3em}.molecule-list-list li[data-depth="3"]{margin-inline-start:4.5em}
6
+ `,document.head.appendChild(n);}}})();function Kn(e,t,n){let r=e._getBlockElementIndex(t);if(r===-1)return false;let o=e.getContent();return o.splice(r,1,e.normalizeComponentState(n)),e._setContentState(o),true}function Je(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function ie(e=[]){let t=new Set;return e.map(n=>{if(n?.componentId&&!t.has(n.componentId))return t.add(n.componentId),n;let r=x();return t.add(r),{...n,componentId:r}})}function Un(e){return e?[...e.children].filter(t=>t.nodeName==="LI"):[]}function Ht(e,t){return !e||!t?0:Fe(e,t.startContainer,t.startOffset)}function qn(e,t){let n=D(e),{originalLineState:r,newLineState:o}=jt(n,t);return {before:{componentId:e.componentId,depth:e.depth??0,text:r.properties.text,inlineStyleRanges:r.properties.inlineStyleRanges??[],entityRanges:r.properties.entityRanges??[]},after:{componentId:x(),depth:e.depth??0,text:o.properties.text,inlineStyleRanges:o.properties.inlineStyleRanges??[],entityRanges:o.properties.entityRanges??[]}}}function Gn(e,{style:t="UNORDERED"}={}){let n=e?.properties?.items,r=Array.isArray(n)&&n.length?n.map(o=>({componentId:o?.componentId??x(),depth:o?.depth??0,text:g(o?.text??""),inlineStyleRanges:[...o?.inlineStyleRanges??[]],entityRanges:[...o?.entityRanges??[]]})):[{componentId:x(),depth:0,text:g(e?.properties?.text??""),inlineStyleRanges:[...e?.properties?.inlineStyleRanges??[]],entityRanges:[...e?.properties?.entityRanges??[]]}];return {component:ye,componentId:x(),properties:{items:r},settings:{style:t==="ORDERED"?"ORDERED":"UNORDERED"}}}function $t(e,t,{namespace:n=L,Constructor:r}={}){let o=e.properties?.items??[],s=o[t];if(!s)return {blocks:[e],paragraphIndex:0};let i=o.slice(0,t),c=o.slice(t+1),a=Q({properties:{text:s.text,inlineStyleRanges:s.inlineStyleRanges,entityRanges:s.entityRanges}}),l={component:n,componentId:x(),settings:{},...r?.fromExchangeState(a)??D(s)},u=[];return i.length&&u.push({...e,properties:{...e.properties,items:i}}),u.push(l),c.length&&u.push({...e,componentId:i.length?x():e.componentId,properties:{...e.properties,items:c}}),{blocks:u,paragraphIndex:i.length?1:0}}function Vn(e){return Ke(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function Ft(e,t){let n=Vn(e),r=Vn(t);return n!=null&&n===r}function Yn(e,t,n){if(t<0||n!==t+1||n>=e.length)return null;let r=e[t],o=e[n];if(!Ft(r,o))return null;let s=[...r.properties?.items??[]],i=[...o.properties?.items??[]];if(i.length===0){let m=[...e];m.splice(n,1);let d=s.length-1,E=d>=0?g(s[d]?.text).length:0;return {content:m,listIndex:t,cursor:E}}let[c,...a]=i,l=0;if(s.length===0)s.push(c,...a),l=0;else {let m=s.length-1,d=s[m],E=D(d),C=D(c),{state:y,cursor:G}=Se(E,C);s[m]={...d,text:y.properties.text,inlineStyleRanges:y.properties.inlineStyleRanges,entityRanges:y.properties.entityRanges},a.length&&s.push(...a),l=G;}let u={...r,properties:{...r.properties,items:ie(s)}},p=[...e];return p[t]=u,p.splice(n,1),{content:p,listIndex:t,cursor:l}}function zn(e,t){let n=e.properties?.items??[],r=n.length-1;if(r<0)return null;let o=Q({properties:t?.properties}).properties.items,[s,...i]=o,c=n[r],a=D(c),l=D(s),{state:u,cursor:p}=Se(a,l),m=n.map((d,E)=>E===r?{...d,text:u.properties.text,inlineStyleRanges:u.properties.inlineStyleRanges,entityRanges:u.properties.entityRanges}:d);return i.length&&m.push(...i.map(d=>({componentId:d?.componentId??x(),depth:d?.depth??0,text:g(d?.text??""),inlineStyleRanges:d?.inlineStyleRanges??[],entityRanges:d?.entityRanges??[]}))),{state:{...e,properties:{...e.properties,items:ie(m)}},cursor:p,itemIndex:r}}function Wn(e,t){return oe({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},t)}function Xn(e,t){let n=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:g(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return re(e.childNodes,r,0,t),{componentId:e.getAttribute("data-componentid")||void 0,depth:n,text:g(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}var Qe=e=>f.object({componentId:f.string().default(()=>e?.getAttribute?.("data-componentid")||x()),depth:f.number().default(0),text:f.string().default(""),inlineStyleRanges:f.array(Ye()).default([]),entityRanges:f.array(Z()).default([])}).default({}),Re=class e extends V{static get NAMESPACE(){return ye}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let n=Je(t);return f.object({component:f.string().default(e.NAMESPACE),componentId:f.string().default(t?.getAttribute("data-componentid")||x()),properties:f.object({items:f.array(Qe()).default([Qe().parse()]).transform(ie)}).default({}),settings:f.object({style:f.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}static toExchangeState(t){let r=(t?.properties?.items??[]).map(o=>{let s={componentId:o?.componentId,text:g(o?.text),depth:o?.depth??0};return o?.inlineStyleRanges!==void 0&&(s.inlineStyleRanges=o.inlineStyleRanges),o?.entityRanges!==void 0&&(s.entityRanges=o.entityRanges),s});return Q({originComponent:this.NAMESPACE,properties:{items:r},settings:t?.settings})}static fromExchangeState(t){return Gn(t,{style:t?.settings?.style})}static appendExchangeState(t,n){return zn(t,n)}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse()),r={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},o=Un(t);if(o.length)n.properties.items=o.map(s=>Qe(s).parse(Xn(s,r)));else {let s=this.state?.peek?.()?.properties?.items;n.properties.items=s?.length?structuredClone(s):[Qe().parse()];}return n.settings={...n.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??n.settings?.style??"UNORDERED"},n}_commitState(t){let n=F(this.element)??this.mrakomor._getBlockElementByComponentId(t.componentId);Kn(this.mrakomor,n,t);}_buildItemContent(t){return Wn(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),n=this.state.peek(),r=n.settings?.style==="ORDERED"?"ol":"ul",o=At(()=>this.state.get().properties?.items??[],(s,i)=>s.componentId??String(i),(s,i)=>S("li",{contentEditable:true,[O]:true,"data-componentid":()=>s.get().componentId,"data-item-index":()=>{let c=s.get()?.componentId,l=(this.state.get().properties?.items??[]).findIndex(u=>u.componentId===c);return String(l>=0?l:i)},"data-depth":()=>String(s.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let c=s.get(),a=c?.text??"";return g(a)?R(()=>this._buildItemContent(c)):"<br>"}}),{tagName:r});return o.className=t,n.componentId&&o.setAttribute("data-componentid",n.componentId),this.element=o,o}onKeydown(t){if(t.key==="Enter"){this.#r(t);return}t.key==="Backspace"&&this.#t(t);}setCursor({cursor:t,itemIndex:n}={}){let r=this.getState()?.properties?.items??[],o=r.length-1;if(o<0)return;let s=typeof n=="number"&&n>=0&&n<=o?n:o,i=typeof t=="number"?t:g(r[s]?.text).length,c=()=>{let a=this.element?.querySelector(`li[data-item-index="${s}"]`);a?.isConnected&&M(a,i);};c(),v(c);}#e(t){let n=this.getState(),r=[...n.properties.items??[]],o=r[t];if(!o)return;if((o.depth??0)>0){r[t]={...o,depth:o.depth-1},this._commitState({...n,properties:{...n.properties,items:r}});let p=()=>{let m=this.element?.querySelector(`li[data-item-index="${t}"]`);m?.isConnected&&M(m,0);};p(),v(p);return}let s=F(this.element),i=this.mrakomor._getBlockElementIndex(s),c=s?.previousElementSibling??null,a=c?this.mrakomor._getBlockElementIndex(c):-1;if(t===0&&a>=0&&i===a+1){let p=this.mrakomor.getContent(),m=Yn(p,a,i);if(m){let d=m.content.map((E,C)=>C===m.listIndex?this.mrakomor.normalizeComponentState(E):E);this.mrakomor._setContentState(d),Ee(c)?.setCursor?.({cursor:m.cursor});return}}let{blocks:l,paragraphIndex:u}=$t(n,t,{Constructor:this.mrakomor.register.blocks.getByNamespace(L)});this.mrakomor.command.replaceBlockElement({blockElement:F(this.element),blocks:l,cursor:0,cursorBlockIndex:u});}#r(t){t.preventDefault();let n=B(),r=he(this.element,n);if(!r)return;let{element:o,index:s}=r,i=Ht(o,n),c=this.getState(),a=[...c.properties.items??[]],l=a[s];if(!l)return;if(!g(l.text)){this.#e(s);return}let{before:u,after:p}=qn(l,i);a.splice(s,1,u,p),this._commitState({...c,properties:{...c.properties,items:a}}),v(()=>{let m=this.element?.querySelector(`li[data-item-index="${s+1}"]`);m&&M(m,0);});}#t(t){let n=B();if(!n?.collapsed)return;let r=he(this.element,n);if(!r){let c=n.startContainer;if(!(c===this.element||this.element?.contains?.(c)))return;t.preventDefault(),this.#e(0);return}let{element:o,index:s}=r;Ht(o,n)===0&&(t.preventDefault(),this.#e(s));}};function Dr(e){let{mrakomor:t,blockElement:n,namespace:r}=e;if(!t||!n||!r)return;let o=t._getBlockElementState(n);if(!o||!Dt({component:r})||!Ke(o))return;e.preventDefault();let i=Ee(n)?.element,c=e.range??B(),a=he(i,c);if(!a)return;let{index:l}=a,{blocks:u,paragraphIndex:p}=$t(o,l,{namespace:r,Constructor:t.register.blocks.getByNamespace(r)});t.command.replaceBlockElement({blockElement:n,blocks:u,cursor:0,cursorBlockIndex:p});}function jr(e){if(e.key!=="Backspace")return;let t=B();if(!t?.collapsed)return;let n=Bt(t);if(!n)return;let r=K(n),o=!g(r?.textContent),s=t.startOffset===0||$e()===0||o;if(!o||!s)return;let i=n.previousSibling;if(!i)return;let{mrakomor:c}=e,a=c._getBlockElementIndex(n),l=c._getBlockElementIndex(i);if(a<0||l<0)return;let u=c._getBlockElementState(n),p=c._getBlockElementState(i);if(!u||!Dt(u)||!p||p.component!==ye)return;let m=c.getContent(),d=m[a+1];if(!Ft(p,d))return;let C=c.register.blocks.getByNamespace(d.component)?.toExchangeState?.(d),y=C&&Re.appendExchangeState(p,C);y&&(e.preventDefault(),m.splice(a,1),m.splice(l,2,c.normalizeComponentState(y.state)),c._setContentState(m),Fn({mrakomor:c,resultIndex:l,cursor:y.cursor,fallbackBlockElement:i,itemIndex:y.itemIndex}));}function Jn(e){return {resolveConfig:t=>(t.blockComponents.push({component:e,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:e,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===e.NAMESPACE)return e},registerCommands(t){t.emitter.on(xe.TRANSFORM_BLOCK_ELEMENT,Dr),t.emitter.on(xe.KEYDOWN,jr);}}}var Qn=e=>f.object({componentId:f.string().default(()=>x()),depth:f.number().default(0),text:f.string().default(""),entityRanges:se()}).default({}),Ze=class e extends Re{static getStateSchema(t){let n=Je(t);return f.object({component:f.string().default(e.NAMESPACE),componentId:f.string().default(t?.getAttribute("data-componentid")||x()),properties:f.object({items:f.array(Qn()).default([Qn().parse()]).transform(ie)}).default({}),settings:f.object({style:f.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function Hr(){return Jn(Ze)}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/paragraph/Paragraph.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.mrakomor-content p{margin-top:0}
7
+ `,document.head.appendChild(n);}}})();var et=class e extends V{static get NAMESPACE(){return L}static get LABEL(){return "P"}static get KEYWORDS(){return ["p","paragraph","text"]}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){return U(t,{component:e.NAMESPACE,properties:{entityRanges:f.array(Z()).default([]),inlineStyleRanges:f.array(Ye()).default([]),text:f.string().default(t?.innerText??t?.textContent??"")}})}parseFromHTML(t){return Ue(this,t)}_buildContent(t){return oe(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return S("p",{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[O]:true,$ref:n=>{this.element=n;},$dangerouslySetInnerHTML:()=>{let n=this.state.get(),r=n.properties?.text??"";return g(r)?R(()=>this._buildContent(n)):"<br>"}})}onKeydown(t){Ve(this,t);}};var ce=class e extends et{static getStateSchema(t){return U(t,{component:e.NAMESPACE,properties:{entityRanges:se(),text:f.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function $r(){return {resolveConfig:e=>(e.blockComponents.push(ce),e),resolveComponent:e=>{if(e===ce.NAMESPACE)return ce}}}var tt=class extends He{static get nodeName(){return "span"}static get NAMESPACE(){return "namespace.EntityRangeElement"}static match(t){return t?.nodeName===this.nodeName.toUpperCase()||t?.entity?.type===this.NAMESPACE}static getStateSchema(t){return f.any()}constructor(t){super(t),this.mrakomor=de(qe),this.element=bt();}render(){return S(this.constructor.nodeName,{},this.props.children)}};(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man,.tts-voice--woman{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 14%,white);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice--man:before,.tts-voice--woman:before{background:var(--tts-voice-color, #1a73e8);color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man,.tts-voice-toolbar__voice--woman{border-color:var(--tts-voice-color, #1a73e8);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active,.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 16%,white)}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
8
+ `,document.head.appendChild(n);}}})();var le=[{id:"Jarda",label:"Voice Jarda",gender:"man",color:"#1a73e8"},{id:"Pavel",label:"Voice Pavel",gender:"man",color:"#1e8e3e"},{id:"Radek",label:"Voice Radek",gender:"man",color:"#00838f"},{id:"Magda",label:"Voice Magda",gender:"woman",color:"#7b1fa2"},{id:"Marketa",label:"Voice Marketa",gender:"woman",color:"#d81b60"},{id:"Silva",label:"Voice Silva",gender:"woman",color:"#c62828"}],Fr='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function Kt(e){return le.find(t=>t.id===e)??le[0]}function Kr(e){let t=le.find(o=>o.id===e);if(t)return t.color;let n=0;for(let o=0;o<e.length;o++)n=n*31+e.charCodeAt(o)|0;return `hsl(${Math.abs(n)%360}, 65%, 45%)`}var ae=class e extends tt{#e;static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let n;if(t?.getAttribute?.("data-state"))try{n=JSON.parse(t.getAttribute("data-state"));}catch{}let r=n?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return Z({type:e.NAMESPACE,data:f.object({voice:f.string().default(r)}).default({}),length:n?.length??0,offset:n?.offset??0}).default({})}#r({entity:t,length:n,offset:r}){let o=t.peek()?.data?.voice??"";return S("div",{className:"tts-voice-toolbar"},[S("div",{className:"tts-voice-toolbar__row"},[...le.map(s=>S("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${s.gender}${o===s.id?" tts-voice-toolbar__voice--active":""}`,$ref:i=>i?.style.setProperty("--tts-voice-color",s.color),title:s.label,onClick:()=>{t.set({...t.peek(),data:{voice:s.id}}),this.mrakomor.command.closeDialog();}},s.label)),S("span",{className:"tts-voice-toolbar__sep"}),S("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:Fr,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:n.peek(),offset:r.peek()},blockElement:F(this.element)});}})])])}#t(t){this.mrakomor.command.openDialog({element:this.element,children:this.#r(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||(t.set({...t.peek(),data:{voice:le[0].id}}),this.#t(this.props)),this.#e=N(()=>{let n=t.get()?.data?.voice??"";this.element.current?.style.setProperty("--tts-voice-color",Kr(n));});}onUnmount(){this.#e?.();}render(){let{entity:t,length:n,offset:r,children:o}=this.props;return S("span",{className:()=>{let s=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${Kt(s||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let s=t.get()?.data?.voice??"";return s?Kt(s).label:""},$ref:this.element,onClick:s=>{s.preventDefault(),this.#t({entity:t,length:n,offset:r});},"data-state":()=>JSON.stringify({entity:t.get(),length:n.get(),offset:r.get()})},o)}};function Vr(){return {resolveConfig:e=>(e.entityRanges.push(ae),e),resolveComponent:e=>{if(e===ae.NAMESPACE)return ae}}}
9
+ exports.TtsHeadlineComponent=q;exports.TtsList=Ze;exports.TtsParagraph=ce;exports.TtsVoice=ae;exports.VOICES=le;exports.getVoice=Kt;exports.ttsHeadlinePlugin=Or;exports.ttsListPlugin=Hr;exports.ttsParagraphPlugin=$r;exports.ttsVoicePlugin=Vr;
package/dist/tts.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import {a as a$4}from'./chunk-NR2BAMSW.mjs';import {a}from'./chunk-YO4ZA6PJ.mjs';import {c as c$1,a as a$2,b as b$1,d as d$2}from'./chunk-BCE45I7Q.mjs';import'./chunk-2VURZA2E.mjs';import {a as a$5}from'./chunk-N4I2WZWF.mjs';import {d as d$1,c,b as b$2}from'./chunk-VYTSZ4S6.mjs';import'./chunk-T7OO472O.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {z as z$1,s as s$1,e,f as f$2,g as g$1,h as h$1,i}from'./chunk-ZDMD7SRT.mjs';import'./chunk-B6JJAATK.mjs';import {a as a$3,f as f$1}from'./chunk-SCFD3XBH.mjs';import {o,c as c$2}from'./chunk-K2DMHAUD.mjs';var s=class extends a{static getStateSchema(t){return d$1(t,{component:this.NAMESPACE,properties:{text:a$1.string().default(t?.textContent??t?.innerText??""),entityRanges:c()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return z$1(this,t)}_buildContent(t){return s$1(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}},h=class extends s{static get NAMESPACE(){return e}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},u=class extends s{static get NAMESPACE(){return f$2}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},d=class extends s{static get NAMESPACE(){return g$1}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},g=class extends s{static get NAMESPACE(){return h$1}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},b=class extends s{static get NAMESPACE(){return i}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function $(){return {resolveConfig:e=>(e.blockComponents.push(u,d,g),e),resolveComponent:e=>{if(e===h.NAMESPACE)return h;if(e===u.NAMESPACE)return u;if(e===d.NAMESPACE)return d;if(e===g.NAMESPACE)return g;if(e===b.NAMESPACE)return b}}}var j=e=>a$1.object({componentId:a$1.string().default(()=>a$3()),depth:a$1.number().default(0),text:a$1.string().default(""),entityRanges:c()}).default({}),E=class e extends c$1{static getStateSchema(t){let o=a$2(t);return a$1.object({component:a$1.string().default(e.NAMESPACE),componentId:a$1.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a$1.object({items:a$1.array(j()).default([j().parse()]).transform(b$1)}).default({}),settings:a$1.object({style:a$1.enum(["ORDERED","UNORDERED"]).default(o??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function F(){return d$2(E)}var p=class e extends a$4{static getStateSchema(t){return d$1(t,{component:e.NAMESPACE,properties:{entityRanges:c(),text:a$1.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function J(){return {resolveConfig:e=>(e.blockComponents.push(p),e),resolveComponent:e=>{if(e===p.NAMESPACE)return p}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(i){return i.getAttribute("data-mrakomor-css-path")===e});if(!t){var o=document.createElement("style");o.setAttribute("data-mrakomor-css",""),o.setAttribute("data-mrakomor-css-path",e),o.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man,.tts-voice--woman{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 14%,white);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice--man:before,.tts-voice--woman:before{background:var(--tts-voice-color, #1a73e8);color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man,.tts-voice-toolbar__voice--woman{border-color:var(--tts-voice-color, #1a73e8);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active,.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 16%,white)}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
2
- `,document.head.appendChild(o);}}})();var f=[{id:"Jarda",label:"Voice Jarda",gender:"man",color:"#1a73e8"},{id:"Pavel",label:"Voice Pavel",gender:"man",color:"#1e8e3e"},{id:"Radek",label:"Voice Radek",gender:"man",color:"#00838f"},{id:"Magda",label:"Voice Magda",gender:"woman",color:"#7b1fa2"},{id:"Marketa",label:"Voice Marketa",gender:"woman",color:"#d81b60"},{id:"Silva",label:"Voice Silva",gender:"woman",color:"#c62828"}],U='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function x(e){return f.find(t=>t.id===e)??f[0]}function q(e){let t=f.find(a=>a.id===e);if(t)return t.color;let o=0;for(let a=0;a<e.length;a++)o=o*31+e.charCodeAt(a)|0;return `hsl(${Math.abs(o)%360}, 65%, 45%)`}var m=class e extends a$5{#t;static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let o;if(t?.getAttribute?.("data-state"))try{o=JSON.parse(t.getAttribute("data-state"));}catch{}let i=o?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return b$2({type:e.NAMESPACE,data:a$1.object({voice:a$1.string().default(i)}).default({}),length:o?.length??0,offset:o?.offset??0}).default({})}#o({entity:t,length:o$1,offset:i}){let a=t.peek()?.data?.voice??"";return o("div",{className:"tts-voice-toolbar"},[o("div",{className:"tts-voice-toolbar__row"},[...f.map(n=>o("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${n.gender}${a===n.id?" tts-voice-toolbar__voice--active":""}`,$ref:S=>S?.style.setProperty("--tts-voice-color",n.color),title:n.label,onClick:()=>{t.set({...t.peek(),data:{voice:n.id}}),this.mrakomor.command.closeDialog();}},n.label)),o("span",{className:"tts-voice-toolbar__sep"}),o("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:U,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:o$1.peek(),offset:i.peek()},blockElement:f$1(this.element)});}})])])}#e(t){this.mrakomor.command.openDialog({element:this.element,children:this.#o(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||this.#e(this.props),this.#t=c$2(()=>{let o=t.get()?.data?.voice??"";this.element.current?.style.setProperty("--tts-voice-color",q(o));});}onUnmount(){this.#t?.();}render(){let{entity:t,length:o$1,offset:i,children:a}=this.props;return o("span",{className:()=>{let n=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${x(n||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let n=t.get()?.data?.voice??"";return n?x(n).label:""},$ref:this.element,onClick:n=>{n.preventDefault(),this.#e({entity:t,length:o$1,offset:i});},"data-state":()=>JSON.stringify({entity:t.get(),length:o$1.get(),offset:i.get()})},a)}};function z(){return {resolveConfig:e=>(e.entityRanges.push(m),e),resolveComponent:e=>{if(e===m.NAMESPACE)return m}}}
3
- export{s as TtsHeadlineComponent,E as TtsList,p as TtsParagraph,m as TtsVoice,f as VOICES,x as getVoice,$ as ttsHeadlinePlugin,F as ttsListPlugin,J as ttsParagraphPlugin,z as ttsVoicePlugin};
1
+ import {a as a$4}from'./chunk-6CG6EGQM.mjs';import {a}from'./chunk-TL5BHWDU.mjs';import {c as c$1,a as a$2,b as b$1,d as d$2}from'./chunk-5HWTMPF4.mjs';import'./chunk-S2W6LYHT.mjs';import'./chunk-GDDVUIEH.mjs';import {a as a$5}from'./chunk-2C6UDFD4.mjs';import {d as d$1,c,b as b$2}from'./chunk-JVQ2YGII.mjs';import'./chunk-ZHOZPQZH.mjs';import {a as a$1}from'./chunk-P7IKAZYZ.mjs';import {A,t,e,f as f$2,g as g$1,h as h$1,i}from'./chunk-FAXIFXQK.mjs';import'./chunk-B6JJAATK.mjs';import {a as a$3,f as f$1}from'./chunk-P7TUN2KD.mjs';import {p as p$1,d as d$3}from'./chunk-7CJLTNHZ.mjs';var s=class extends a{static getStateSchema(t){return d$1(t,{component:this.NAMESPACE,properties:{text:a$1.string().default(t?.textContent??t?.innerText??""),entityRanges:c()}})}getInlineStyleComponents(){return []}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}parseFromHTML(t){return A(this,t)}_buildContent(t$1){return t(t$1,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}},h=class extends s{static get NAMESPACE(){return e}static get LABEL(){return "H1"}constructor(t){super(t),this._level=1;}},d=class extends s{static get NAMESPACE(){return f$2}static get LABEL(){return "H2"}constructor(t){super(t),this._level=2;}},g=class extends s{static get NAMESPACE(){return g$1}static get LABEL(){return "H3"}constructor(t){super(t),this._level=3;}},f=class extends s{static get NAMESPACE(){return h$1}static get LABEL(){return "H4"}constructor(t){super(t),this._level=4;}},b=class extends s{static get NAMESPACE(){return i}static get LABEL(){return "H5"}constructor(t){super(t),this._level=5;}};function $(){return {resolveConfig:e=>(e.blockComponents.push(d,g,f),e),resolveComponent:e=>{if(e===h.NAMESPACE)return h;if(e===d.NAMESPACE)return d;if(e===g.NAMESPACE)return g;if(e===f.NAMESPACE)return f;if(e===b.NAMESPACE)return b}}}var j=e=>a$1.object({componentId:a$1.string().default(()=>a$3()),depth:a$1.number().default(0),text:a$1.string().default(""),entityRanges:c()}).default({}),E=class e extends c$1{static getStateSchema(t){let o=a$2(t);return a$1.object({component:a$1.string().default(e.NAMESPACE),componentId:a$1.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a$1.object({items:a$1.array(j()).default([j().parse()]).transform(b$1)}).default({}),settings:a$1.object({style:a$1.enum(["ORDERED","UNORDERED"]).default(o??"UNORDERED")}).default({})}).default({})}getInlineStyleComponents(){return []}parseFromHTML(t){return this.constructor.getStateSchema(t).parse(super.parseFromHTML(t))}};function F(){return d$2(E)}var p=class e extends a$4{static getStateSchema(t){return d$1(t,{component:e.NAMESPACE,properties:{entityRanges:c(),text:a$1.string().default(t?.innerText??t?.textContent??"")}})}getInlineStyleComponents(){return []}};function J(){return {resolveConfig:e=>(e.blockComponents.push(p),e),resolveComponent:e=>{if(e===p.NAMESPACE)return p}}}(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/tts/TtsVoice.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(i){return i.getAttribute("data-mrakomor-css-path")===e});if(!t){var o=document.createElement("style");o.setAttribute("data-mrakomor-css",""),o.setAttribute("data-mrakomor-css-path",e),o.textContent=`.atom-tts-voice{position:relative;border-radius:2px;display:inline-block}.atom-tts-voice:before{content:attr(data-voice-label);position:absolute;top:-1.1em;left:0;font-size:10px;line-height:1;white-space:nowrap;padding:1px 4px;border-radius:3px;pointer-events:none;font-weight:600}.tts-voice--man,.tts-voice--woman{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 14%,white);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice--man:before,.tts-voice--woman:before{background:var(--tts-voice-color, #1a73e8);color:#fff}.tts-voice-toolbar{display:flex;flex-direction:column;gap:6px}.tts-voice-toolbar__row{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}.tts-voice-toolbar__voice{flex-shrink:0;border:1px solid #dadce0;border-radius:4px;padding:4px 8px;font-size:12px;background:#fff;color:#333}.tts-voice-toolbar__voice--man,.tts-voice-toolbar__voice--woman{border-color:var(--tts-voice-color, #1a73e8);color:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 75%,black)}.tts-voice-toolbar__voice--active{font-weight:600}.tts-voice-toolbar__voice--man.tts-voice-toolbar__voice--active,.tts-voice-toolbar__voice--woman.tts-voice-toolbar__voice--active{background:color-mix(in srgb,var(--tts-voice-color, #1a73e8) 16%,white)}.tts-voice-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.tts-voice-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.tts-voice-toolbar__btn:hover{background:#f0f0f0;color:#222}.tts-voice-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
2
+ `,document.head.appendChild(o);}}})();var u=[{id:"Jarda",label:"Voice Jarda",gender:"man",color:"#1a73e8"},{id:"Pavel",label:"Voice Pavel",gender:"man",color:"#1e8e3e"},{id:"Radek",label:"Voice Radek",gender:"man",color:"#00838f"},{id:"Magda",label:"Voice Magda",gender:"woman",color:"#7b1fa2"},{id:"Marketa",label:"Voice Marketa",gender:"woman",color:"#d81b60"},{id:"Silva",label:"Voice Silva",gender:"woman",color:"#c62828"}],U='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';function x(e){return u.find(t=>t.id===e)??u[0]}function q(e){let t=u.find(a=>a.id===e);if(t)return t.color;let o=0;for(let a=0;a<e.length;a++)o=o*31+e.charCodeAt(a)|0;return `hsl(${Math.abs(o)%360}, 65%, 45%)`}var m=class e extends a$5{#t;static get NAMESPACE(){return "atom.tts.Voice"}static get LABEL(){return "VOICE"}static match(t){return t?.entity?.type===e.NAMESPACE||t?.nodeName==="SPAN"&&t?.getAttribute?.("data-entity-type")===e.NAMESPACE}static getStateSchema(t){let o;if(t?.getAttribute?.("data-state"))try{o=JSON.parse(t.getAttribute("data-state"));}catch{}let i=o?.entity?.data?.voice??t?.getAttribute?.("data-voice")??"";return b$2({type:e.NAMESPACE,data:a$1.object({voice:a$1.string().default(i)}).default({}),length:o?.length??0,offset:o?.offset??0}).default({})}#o({entity:t,length:o,offset:i}){let a=t.peek()?.data?.voice??"";return p$1("div",{className:"tts-voice-toolbar"},[p$1("div",{className:"tts-voice-toolbar__row"},[...u.map(n=>p$1("button",{type:"button",className:`tts-voice-toolbar__voice tts-voice-toolbar__voice--${n.gender}${a===n.id?" tts-voice-toolbar__voice--active":""}`,$ref:S=>S?.style.setProperty("--tts-voice-color",n.color),title:n.label,onClick:()=>{t.set({...t.peek(),data:{voice:n.id}}),this.mrakomor.command.closeDialog();}},n.label)),p$1("span",{className:"tts-voice-toolbar__sep"}),p$1("button",{type:"button",className:"tts-voice-toolbar__btn tts-voice-toolbar__btn--danger",title:"Remove TTS voice",$dangerouslySetInnerHTML:U,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:t.peek(),length:o.peek(),offset:i.peek()},blockElement:f$1(this.element)});}})])])}#e(t){this.mrakomor.command.openDialog({element:this.element,children:this.#o(t)});}onMount(){let{entity:t}=this.props;t.peek()?.data?.voice||(t.set({...t.peek(),data:{voice:u[0].id}}),this.#e(this.props)),this.#t=d$3(()=>{let o=t.get()?.data?.voice??"";this.element.current?.style.setProperty("--tts-voice-color",q(o));});}onUnmount(){this.#t?.();}render(){let{entity:t,length:o,offset:i,children:a}=this.props;return p$1("span",{className:()=>{let n=t.get()?.data?.voice??"";return `atom-tts-voice tts-voice--${x(n||"man1").gender}`},"data-entity-type":this.constructor.NAMESPACE,"data-voice":()=>t.get()?.data?.voice??"","data-voice-label":()=>{let n=t.get()?.data?.voice??"";return n?x(n).label:""},$ref:this.element,onClick:n=>{n.preventDefault(),this.#e({entity:t,length:o,offset:i});},"data-state":()=>JSON.stringify({entity:t.get(),length:o.get(),offset:i.get()})},a)}};function z(){return {resolveConfig:e=>(e.entityRanges.push(m),e),resolveComponent:e=>{if(e===m.NAMESPACE)return m}}}
3
+ export{s as TtsHeadlineComponent,E as TtsList,p as TtsParagraph,m as TtsVoice,u as VOICES,x as getVoice,$ as ttsHeadlinePlugin,F as ttsListPlugin,J as ttsParagraphPlugin,z as ttsVoicePlugin};
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Create and boot a Mrakomor editor. Validates `config` with
3
+ * `createMrakomorConfigSchema`, then always ensures `dialogPlugin`,
4
+ * `menuPlugin`, and `defaultMrakomorPlugin` (last).
5
+ * CSS is loaded via side-effect stylesheet imports on core / plugin modules.
6
+ * @public
7
+ * @param {import('#src/types.mjs').CreateMrakomorConfig} config
8
+ * @returns {import('#src/types.mjs').Mrakomor}
9
+ */
10
+ export function createMrakomor(config: import("#src/types.mjs").CreateMrakomorConfig): import("#src/types.mjs").Mrakomor;
11
+ export class Mrakomor {
12
+ /**
13
+ * @public
14
+ * @param {import('#src/types.mjs').MrakomorConfig} config
15
+ */
16
+ constructor(config: import("#src/types.mjs").MrakomorConfig);
17
+ listenerAbortController: AbortController;
18
+ /** @type {import('#src/types.mjs').MrakomorCommand} */
19
+ command: import("#src/types.mjs").MrakomorCommand;
20
+ /** @type {import('@esmj/emitter').Emitter} */
21
+ emitter: import("@esmj/emitter").Emitter;
22
+ /** @type {import('#src/types.mjs').MrakomorRegister} */
23
+ register: import("#src/types.mjs").MrakomorRegister;
24
+ /**
25
+ * Boot plugins and the content signal.
26
+ * @internal
27
+ */
28
+ _init(): void;
29
+ /**
30
+ * Emit on the editor bus with `event.mrakomor` set. Always use this, not `emitter.emit`.
31
+ * @public
32
+ * @param {string} eventName
33
+ * @param {object} [payload] event-specific fields
34
+ * @returns {import('#src/types.mjs').EmitterEvent}
35
+ */
36
+ public emit(eventName: string, payload?: object): import("#src/types.mjs").EmitterEvent;
37
+ /**
38
+ * Subscribe to an editor bus event. Same as `emitter.on`; prefer this from host code.
39
+ * @public
40
+ * @param {string} eventName
41
+ * @param {function(import('#src/types.mjs').EmitterEvent): void} handler
42
+ * @returns {function(): void} unsubscribe
43
+ */
44
+ public on(eventName: string, handler: (arg0: import("#src/types.mjs").EmitterEvent) => void): () => void;
45
+ /**
46
+ * Subscribe to `EVENT.CONTENT_CHANGE`. Same as `on(EVENT.CONTENT_CHANGE, handler)`.
47
+ * @public
48
+ * @param {function(import('#src/types.mjs').EmitterEvent): void} handler
49
+ * @returns {function(): void} unsubscribe
50
+ */
51
+ public onChangeContent(handler: (arg0: import("#src/types.mjs").EmitterEvent) => void): () => void;
52
+ /**
53
+ * Bridge a native DOM event onto the emitter; sync `preventDefault` back to the native event.
54
+ * @public
55
+ * @param {string} eventName
56
+ * @param {Event} event
57
+ * @returns {boolean} whether the emitter event was `defaultPrevented`
58
+ */
59
+ public emitDomEvent(eventName: string, event: Event): boolean;
60
+ /**
61
+ * Resolved editor config after plugin `resolveConfig`.
62
+ * @public
63
+ * @returns {import('#src/types.mjs').MrakomorConfig}
64
+ */
65
+ public getConfig(): import("#src/types.mjs").MrakomorConfig;
66
+ /**
67
+ * Let plugins wrap a block vnode (gutter chrome). First non-null wrapper wins.
68
+ * @public
69
+ * @param {*} blockComponent
70
+ * @returns {*}
71
+ */
72
+ public wrapBlockElement(blockComponent: any): any;
73
+ /**
74
+ * Mount root element.
75
+ * @public
76
+ * @returns {Element | null}
77
+ */
78
+ public getRoot(): Element | null;
79
+ /**
80
+ * `.mrakomor-content` element (the contenteditable block-list container),
81
+ * set once by `Editor`'s `$ref` on mount. Prefer this over
82
+ * `getRoot().querySelector('.mrakomor-content')` for anything internal.
83
+ * @internal
84
+ * @returns {Element | null}
85
+ */
86
+ _getContentRoot(): Element | null;
87
+ /**
88
+ * Store the `.mrakomor-content` element. Called by `Editor`'s `$ref`;
89
+ * not for plugin/host use.
90
+ * @internal
91
+ * @param {Element | null} element
92
+ */
93
+ _setContentRoot(element: Element | null): void;
94
+ /**
95
+ * Generated editor DOM id used by the Editor component.
96
+ * @internal
97
+ * @returns {string}
98
+ */
99
+ get _id(): string;
100
+ /**
101
+ * Live block states from the DOM (`getState()` per block).
102
+ * @public
103
+ * @returns {import('#src/types.mjs').BlockState[]}
104
+ */
105
+ public getContent(): import("#src/types.mjs").BlockState[];
106
+ /**
107
+ * Replace editor content (normalized through each block schema).
108
+ * @public
109
+ * @param {import('#src/types.mjs').BlockStateInput[]} [content]
110
+ */
111
+ public setContent(content?: import("#src/types.mjs").BlockStateInput[]): void;
112
+ /**
113
+ * Re-read `.mrakomor-block-element` nodes after render. Do not treat as source of truth.
114
+ * @internal
115
+ */
116
+ _syncBlockElementsFromDom(): void;
117
+ /**
118
+ * Live block wrapper nodes (parallel to content). Not source of truth.
119
+ * @internal
120
+ * @returns {Element[]}
121
+ */
122
+ _getBlockElements(): Element[];
123
+ /**
124
+ * Content signal (subscribes in render).
125
+ * @internal
126
+ * @returns {import('#src/types.mjs').BlockState[]}
127
+ */
128
+ _getContentState(): import("#src/types.mjs").BlockState[];
129
+ /**
130
+ * Write the content signal, emit `CONTENT_CHANGE`, then sync `#blockElements` in `afterRender`.
131
+ * Listeners must use `event.content`; `getContent()` can still see old block nodes until after render.
132
+ * @internal
133
+ * @param {import('#src/types.mjs').BlockState[]} [content]
134
+ */
135
+ _setContentState(content?: import("#src/types.mjs").BlockState[]): void;
136
+ /**
137
+ * Schema-parse every block (clone). Drops entries that fail to normalize
138
+ * (e.g. a stale/unresolvable read) instead of leaving an `undefined` hole.
139
+ * @internal
140
+ * @param {import('#src/types.mjs').BlockStateInput[]} [content]
141
+ * @returns {import('#src/types.mjs').BlockState[]}
142
+ */
143
+ _normalizeContentState(content?: import("#src/types.mjs").BlockStateInput[]): import("#src/types.mjs").BlockState[];
144
+ /**
145
+ * Register a block wrapper node (Editor Each `onMount`).
146
+ * @internal
147
+ * @param {Element} blockElement
148
+ * @param {number} [index]
149
+ */
150
+ _setBlockElement(blockElement: Element, index?: number): void;
151
+ /**
152
+ * Drop a block wrapper (Editor Each `onUnmount`).
153
+ * @internal
154
+ * @param {Element} blockElement
155
+ */
156
+ _removeBlockElement(blockElement: Element): void;
157
+ /**
158
+ * Index of a block wrapper in `#blockElements`. Identity first; if the node is
159
+ * not in the map (stale ref after re-render), match by `componentId`.
160
+ * @internal
161
+ * @param {Element | null | undefined} blockElement
162
+ * @returns {number}
163
+ */
164
+ _getBlockElementIndex(blockElement: Element | null | undefined): number;
165
+ /**
166
+ * Mounted wrapper for a stable `componentId`, or `null`.
167
+ * @internal
168
+ * @param {string | null | undefined} componentId
169
+ * @returns {Element | null}
170
+ */
171
+ _getBlockElementByComponentId(componentId: string | null | undefined): Element | null;
172
+ /**
173
+ * Live `getState()` for one mounted wrapper (parses DOM when stale).
174
+ * Resolves a stale wrapper ref via `componentId`. Prefer this over
175
+ * `_getBlockElementIndex` + `getContent()[i]`.
176
+ * @internal
177
+ * @param {Element | null | undefined} blockElement
178
+ * @returns {import('#src/types.mjs').BlockState | undefined}
179
+ */
180
+ _getBlockElementState(blockElement: Element | null | undefined): import("#src/types.mjs").BlockState | undefined;
181
+ /**
182
+ * Mount the editor into `#root`.
183
+ * @public
184
+ * @returns {*}
185
+ */
186
+ public mount(): any;
187
+ /**
188
+ * Unmount the editor tree.
189
+ * @public
190
+ */
191
+ public unmount(): void;
192
+ /**
193
+ * Abort DOM listeners, plugin `onUnmount`, and clear the emitter.
194
+ * @internal
195
+ */
196
+ _onUnmount(): void;
197
+ /**
198
+ * Plugin `onMount`, then sync `#blockElements` in `afterRender`.
199
+ * @internal
200
+ */
201
+ _onMount(): void;
202
+ /**
203
+ * Vnode for a content block (`UnknownComponent` if the namespace is missing).
204
+ * @public
205
+ * @param {string} namespace
206
+ * @param {import('#src/types.mjs').Signal<import('#src/types.mjs').BlockState>} stateSignal
207
+ * @returns {*}
208
+ */
209
+ public resolveComponent(namespace: string, stateSignal: import("#src/types.mjs").Signal<import("#src/types.mjs").BlockState>): any;
210
+ /**
211
+ * Component constructor for a namespace (`register.blocks.byNamespace()`, then plugins).
212
+ * @public
213
+ * @param {string} namespace
214
+ * @returns {import('#src/types.mjs').ComponentConstructor | undefined}
215
+ */
216
+ public resolveComponentConstructor(namespace: string): import("#src/types.mjs").ComponentConstructor | undefined;
217
+ /**
218
+ * `Constructor.getStateSchema().parse(state)` for a block or entity namespace.
219
+ * Returns `undefined` (with a `console.warn`) for a nullish `state` instead of
220
+ * throwing — a defensive guard against a stale/unresolvable block read (e.g.
221
+ * `getContent()` producing a hole when a wrapper's live instance isn't resolvable
222
+ * yet, see `agents/domains/content-sync.md`), so one bad entry can't crash an
223
+ * otherwise-valid `_normalizeContentState()` pass over the rest of the content.
224
+ * @public
225
+ * @param {import('#src/types.mjs').ComponentStateInput} state
226
+ * @returns {import('#src/types.mjs').ComponentState | undefined}
227
+ */
228
+ public normalizeComponentState(state: import("#src/types.mjs").ComponentStateInput): import("#src/types.mjs").ComponentState | undefined;
229
+ #private;
230
+ }