@astl/astrolabe 0.1.2 → 0.1.3

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 (29) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cdn/astrolabe-editor.js +2 -2
  3. package/dist/cdn/astrolabe.standalone.js +67 -42
  4. package/dist/cdn/chunks/{help-form-CDg3TCwI.js → help-form-DhIyMziw.js} +14 -10
  5. package/dist/cdn/chunks/help-form-DhIyMziw.js.map +1 -0
  6. package/dist/cdn/chunks/{insert-menu-7vANVmTK.js → insert-menu-Cn2E54V9.js} +2 -2
  7. package/dist/cdn/chunks/{insert-menu-7vANVmTK.js.map → insert-menu-Cn2E54V9.js.map} +1 -1
  8. package/dist/cdn/chunks/{issue-list-BT9qvnZU.js → issue-list-CQKAW39i.js} +2 -2
  9. package/dist/cdn/chunks/{issue-list-BT9qvnZU.js.map → issue-list-CQKAW39i.js.map} +1 -1
  10. package/dist/cdn/chunks/messages-Qzse5KMX.js +2 -0
  11. package/dist/cdn/chunks/messages-Qzse5KMX.js.map +1 -0
  12. package/dist/cdn/chunks/{source-view-CZVxgTNQ.js → source-view-BlJ2mRns.js} +2 -2
  13. package/dist/cdn/chunks/{source-view-CZVxgTNQ.js.map → source-view-BlJ2mRns.js.map} +1 -1
  14. package/dist/cdn/chunks/{style-form-DUGbG_kL.js → style-form-D1C2sHzg.js} +2 -2
  15. package/dist/cdn/chunks/{style-form-DUGbG_kL.js.map → style-form-D1C2sHzg.js.map} +1 -1
  16. package/dist/cdn/chunks/{style-messages-qdf3pZbT.js → style-messages-B136zSom.js} +2 -2
  17. package/dist/cdn/chunks/{style-messages-qdf3pZbT.js.map → style-messages-B136zSom.js.map} +1 -1
  18. package/dist/cdn/chunks/{style-rules-D17QGzXk.js → style-rules-ChqPVgZn.js} +2 -2
  19. package/dist/cdn/chunks/{style-rules-D17QGzXk.js.map → style-rules-ChqPVgZn.js.map} +1 -1
  20. package/dist/cdn/chunks/{styles-CdJT6Pp9.js → styles-CXkkL_Qi.js} +2 -2
  21. package/dist/cdn/chunks/{styles-CdJT6Pp9.js.map → styles-CXkkL_Qi.js.map} +1 -1
  22. package/dist/cdn/chunks/surface-BhmSAte0.js +1058 -0
  23. package/dist/cdn/chunks/surface-BhmSAte0.js.map +1 -0
  24. package/package.json +9 -9
  25. package/dist/cdn/chunks/help-form-CDg3TCwI.js.map +0 -1
  26. package/dist/cdn/chunks/messages-D1aJfyS_.js +0 -2
  27. package/dist/cdn/chunks/messages-D1aJfyS_.js.map +0 -1
  28. package/dist/cdn/chunks/surface-C6wtQkTY.js +0 -1037
  29. package/dist/cdn/chunks/surface-C6wtQkTY.js.map +0 -1
@@ -4568,7 +4568,7 @@ overflow-wrap: anywhere;
4568
4568
  <summary lang=${n.lang} dir=${n.dir}>${this.t(`ui.transcript`)}</summary>
4569
4569
  <div class="text"><slot data-tag="astl-transcript"></slot></div>
4570
4570
  </details>`:R}
4571
- </div>`}},Rj={manifest:$p,element:Lj,messages:Pj}})),Bj=[{tag:`astl-gap`,load:async()=>(await Promise.resolve().then(()=>(ED(),vD))).gapElement},{tag:`astl-choice`,load:async()=>(await Promise.resolve().then(()=>(HD(),RD))).choiceElement},{tag:`astl-select`,load:async()=>(await Promise.resolve().then(()=>(cO(),KD))).selectElement},{tag:`astl-true-false`,load:async()=>(await Promise.resolve().then(()=>(_O(),fO))).trueFalseElement},{tag:`astl-order`,load:async()=>(await Promise.resolve().then(()=>(LO(),OO))).orderElement},{tag:`astl-categorise`,load:async()=>(await Promise.resolve().then(()=>(ZO(),UO))).categoriseElement},{tag:`astl-match`,load:async()=>(await Promise.resolve().then(()=>(ck(),tk))).matchElement},{tag:`astl-word-bank`,load:async()=>(await Promise.resolve().then(()=>(yk(),fk))).wordBankElement},{tag:`astl-drop`,load:async()=>(await Promise.resolve().then(()=>(Ok(),Ck))).dropElement},{tag:`astl-word-search`,load:async()=>(await Promise.resolve().then(()=>(Bk(),Mk))).wordSearchElement},{tag:`astl-memory`,load:async()=>(await Promise.resolve().then(()=>(Qk(),Wk))).memoryElement},{tag:`astl-crossword`,load:async()=>(await Promise.resolve().then(()=>(cA(),nA))).crosswordElement},{tag:`astl-flash-cards`,load:async()=>(await Promise.resolve().then(()=>(gA(),fA))).flashCardsElement},{tag:`astl-long-answer`,load:async()=>(await Promise.resolve().then(()=>(TA(),bA))).longAnswerElement},{tag:`astl-mark-words`,load:async()=>(await Promise.resolve().then(()=>(NA(),kA))).markWordsElement},{tag:`astl-callout`,load:async()=>(await Promise.resolve().then(()=>(VA(),LA))).calloutElement},{tag:`astl-hotspot`,load:async()=>(await Promise.resolve().then(()=>(ij(),ej))).hotspotElement},{tag:`astl-image-drop`,load:async()=>(await Promise.resolve().then(()=>(hj(),cj))).imageDropElement},{tag:`astl-image-label`,load:async()=>(await Promise.resolve().then(()=>(Cj(),yj))).imageLabelElement},{tag:`astl-video`,load:async()=>(await Promise.resolve().then(()=>(Mj(),Dj))).videoElement},{tag:`astl-audio`,load:async()=>(await Promise.resolve().then(()=>(zj(),Ij))).audioElement}];function Vj(e){return e===32||e===9||e===10||e===12||e===13}function Hj(e){return e>=65&&e<=90||e>=97&&e<=122}function Uj(e,t){if(e.startsWith(`<!-->`,t))return t+5;if(e.startsWith(`<!--->`,t))return t+6;let n=[e.indexOf(`-->`,t+4),e.indexOf(`--!>`,t+4)].filter(e=>e>=0);if(n.length===0)return e.length;let r=Math.min(...n);return r+(e.startsWith(`-->`,r)?3:4)}function Wj(e,t){let n=e.indexOf(`>`,t);return n<0?e.length:n+1}function Gj(e,t,n){let r=RegExp(`</${n}(?=[\\t\\n\\f\\r />])`,`gi`);return r.lastIndex=t,r.exec(e)?.index??e.length}function Kj(e,t,n){let r=e.length,i=t+(n===`end`?2:1),a=i;for(;i<r;){let t=e.charCodeAt(i);if(Vj(t)||t===47||t===62)break;i++}let o=e.slice(a,i).toLowerCase(),s=[],c=(e,r)=>({type:n,name:o,start:t,end:e,attributes:s,selfClosing:r});for(;i<r;){let t=e.charCodeAt(i);if(Vj(t)){i++;continue}if(t===62)return c(i+1,!1);if(t===47){if(e.charCodeAt(i+1)===62)return c(i+2,!0);i++;continue}let n=i;for(i++;i<r;){let t=e.charCodeAt(i);if(Vj(t)||t===47||t===62||t===61)break;i++}let a=e.slice(n,i).toLowerCase(),o=i;for(;o<r&&Vj(e.charCodeAt(o));)o++;if(e.charCodeAt(o)!==61){s.push({name:a,raw:null,start:n,end:i});continue}for(o++;o<r&&Vj(e.charCodeAt(o));)o++;let l=e[o];if(l===`"`||l===`'`){let t=e.indexOf(l,o+1),c=t<0?r:t+1;s.push({name:a,raw:e.slice(o+1,t<0?r:t),start:n,end:c}),i=c}else{let t=o;for(;t<r&&!Vj(e.charCodeAt(t))&&e.charCodeAt(t)!==62;)t++;s.push({name:a,raw:e.slice(o,t),start:n,end:t}),i=t}}return c(r,!1)}function qj(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.indexOf(`<`,r);if(i<0)break;r=i;let a=e.charCodeAt(r+1);if(e.startsWith(`<!--`,r))r=Uj(e,r);else if(a===33||a===63)r=Wj(e,r+2);else if(a===47){let n=e.charCodeAt(r+2);if(Hj(n)){let n=Kj(e,r,`end`);t.push(n),r=n.end}else r=n===62?r+3:Wj(e,r+2)}else if(Hj(a)){let i=Kj(e,r,`start`);t.push(i),r=i.end,oM.has(i.name)?r=Gj(e,r,i.name):i.name===`plaintext`&&(r=n)}else r++}return t}function Jj(e){return e.includes(`-`)}function Yj(e){let t=[],n=[],r=e=>(n[n.length-1]?.children??t).push(e),i=(e,t,n)=>r({name:e.name,start:e.start,end:t,startTag:e.startTag,endTag:n,children:e.children});for(let t of qj(e)){if(t.type===`start`){sM.has(t.name)||t.selfClosing&&Jj(t.name)?r({name:t.name,start:t.start,end:t.end,startTag:t,endTag:null,children:[]}):n.push({name:t.name,start:t.start,startTag:t,children:[]});continue}let e=n.length-1;for(;e>=0&&n[e]?.name!==t.name;)e--;if(!(e<0)){for(;n.length-1>e;)i(n.pop(),t.start,null);i(n.pop(),t.end,t)}}for(;n.length>0;)i(n.pop(),e.length,null);return t}function Xj(e){if(!e.includes(`&`))return e;let[t]=Rc(`<b title="${e.replaceAll(`"`,`&quot;`)}"></b>`);return t?.type===`element`?t.attrs.title??e:e}function Zj(e,t){let n=e.attributes.find(e=>e.name===t);return n===void 0?null:n.raw===null?``:Xj(n.raw)}function Qj(e){let t=[],n=e=>{for(let r of e){let{name:e}=r;if(e===`astl-style`||e===`astl-columns`||e===`astl-column`||Je.has(e))n(r.children);else{if(e===`astl-page`||Jj(e)&&e!==cM){let n=Zj(r.startTag,`id`);if(t.push({tag:e,id:n,start:r.start,end:r.end,range:r}),e!==`astl-page`)continue}n(r.children)}}};return n(Yj(e)),t}function $j(e){return Qj(e).map(({tag:e,id:t,start:n,end:r})=>({tag:e,id:t,start:n,end:r}))}function eM(e){let t=new Set;for(let n of qj(e)){if(n.type!==`start`)continue;let e=Zj(n,`id`);e!==null&&t.add(e)}return t}function tM(e){return e.replace(uM,mM)}function nM(e){return e.replace(dM,mM)}function rM(e){return e.replace(fM,mM)}function iM(e,t){let n=e;for(let e of[...t].sort((e,t)=>t.start-e.start))n=n.slice(0,e.start)+e.text+n.slice(e.end);return n}function aM(e,t){let n=t;for(;n>0&&Vj(e.charCodeAt(n-1));)n--;return n}var oM,sM,cM,lM,uM,dM,fM,pM,mM,hM=n((()=>{w(),Qp(),oM=new Set([`script`,`style`,`textarea`,`title`,`xmp`,`iframe`,`noembed`,`noframes`,`noscript`]),sM=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),cM=`astl-doc`,lM=String.fromCodePoint(160),uM=RegExp(`[&<>${lM}]`,`g`),dM=RegExp(`[&"<>${lM}]`,`g`),fM=RegExp(`[&<>"'${lM}]`,`g`),pM={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,[lM]:`&nbsp;`},mM=e=>pM[e]??e}));function gM(e,t,n,r){if(!TM.test(n))throw TypeError(`Invalid attribute name "${n}"`);let i=t.attributes.filter(e=>e.name===n),a=i[0];if(r===null||r===!1)return i.map(t=>({start:aM(e,t.start),end:t.end,text:``}));if(a!==void 0){let e=Zj(t,n)??``;if(r===!0?e===``||e.toLowerCase()===n:e===r)return[]}let o=r===!0?n:`${n}="${nM(r)}"`;if(a!==void 0)return[{start:a.start,end:a.end,text:o}];let s=t.attributes[t.attributes.length-1]?.end??t.start+1+t.name.length;return[{start:s,end:s,text:` ${o}`}]}function _M(e,t){return e.children.flatMap(e=>e.name===t?[e]:_M(e,t))}function vM(e,t){let[n]=Rc(e.slice(t.start,t.end));return h(n)?g(n):``}function yM(e){return e.endTag?.start??e.end}function bM(e,t,n){let r=t.startTag;if(r.selfClosing&&t.endTag===null){let i=e.slice(r.start,aM(e,r.end-2));return{start:t.start,end:t.end,text:`${i}>${n}</${t.name}>`}}return{start:r.end,end:yM(t),text:n}}function xM(e,t,n){return t.startTag.selfClosing&&t.endTag===null?bM(e,t,n):t.endTag===null?{start:t.end,end:t.end,text:`${n}</${t.name}>`}:{start:t.endTag.start,end:t.endTag.start,text:n}}function SM(e,t,n){let[r,i]=n;if(r===void 0)return``;let a=i===void 0?e.slice(Math.max(t.startTag.end,aM(e,r.start)),r.start):e.slice(r.end,i.start);return/^\s*$/.test(a)?a:``}function CM(e,t,n,r){let i=_M(t,n),a=[];if(i.forEach((t,n)=>{let i=r[n];i===void 0?a.push({start:aM(e,t.start),end:t.end,text:``}):vM(e,t)!==i&&a.push(bM(e,t,tM(i)))}),r.length>i.length){let o=SM(e,t,i),s=r.slice(i.length).map(e=>`<${n}>${tM(e)}</${n}>`),c=i[i.length-1];c===void 0?a.push(xM(e,t,s.join(o))):a.push({start:c.end,end:c.end,text:s.map(e=>o+e).join(``)})}return a}function wM(e,t){let n=Yj(e)[0];if(n===void 0)return e;switch(t.kind){case`attribute`:return iM(e,gM(e,n.startTag,t.name,t.value));case`child-flag`:case`child-choice`:{let r=_M(n,t.tag)[t.index];return r===void 0?e:iM(e,gM(e,r.startTag,t.attribute,t.value))}case`text-list`:return iM(e,CM(e,n,t.tag,t.values));case`child-attributes`:{let n=e;for(let[e,r]of Object.entries(t.attributes))n=wM(n,{kind:`child-choice`,tag:t.tag,attribute:e,index:t.index,value:r});return n}case`child-add`:{if(!TM.test(t.tag))throw TypeError(`Invalid tag name "${t.tag}"`);let r=Object.entries(t.attributes).map(([e,t])=>{if(!TM.test(e))throw TypeError(`Invalid attribute name "${e}"`);return` ${e}="${nM(t)}"`}),i=`<${t.tag}${r.join(``)}></${t.tag}>`,a=_M(n,t.tag),o=a.at(-1)??n.children.at(-1);if(o===void 0)return iM(e,[xM(e,n,i)]);let s=SM(e,n,a.length>0?a:n.children);return iM(e,[{start:o.end,end:o.end,text:s+i}])}case`child-remove`:{let r=_M(n,t.tag)[t.index];return r===void 0?e:iM(e,[{start:aM(e,r.start),end:r.end,text:``}])}}}var TM,EM=n((()=>{w(),Qp(),hM(),TM=/^[a-z][a-z0-9-]*$/}));function DM(e){let t=e=>({kind:`attribute`,name:e.name,label:`editor.${e.name}`}),n=e=>e.visibility!==`derived`,r=e.scoring===null?[]:[`scoring`,`points`],i=jt(e).filter(e=>r.includes(e.name));return[...e.attributes.filter(n).map(t),...e.children.filter(e=>e.visibility===`private`&&e.content===`text`).map(e=>({kind:`text-list`,tag:e.tag,label:`editor.${e.tag}`})),...e.children.flatMap(e=>e.attributes.filter(e=>(e.type===`boolean`||e.type===`enum`)&&n(e)).map(t=>({kind:t.type===`boolean`?`child-flag`:`child-choice`,tag:e.tag,attribute:t.name,label:`editor.${e.tag}.${t.name}`}))),...i.map(t)]}function OM(e,t,n){return(t.name===`scoring`&&e.scoring!==null?Object.keys(e.scoring.modes):[...t.values??[]]).map(e=>({value:e,label:n.message(`editor.value.${t.name}.${e}`,e)}))}function kM(e,t){return t.name===`scoring`&&e.scoring!==null?e.scoring.default:t.default===void 0?null:String(t.default)}function AM(e,t,n,r,i=n.name,a=()=>null){let o=jt(t).find(e=>e.name===n.name);if(o===void 0)return null;let s=o.name,c=r.message(n.label,i),l=n.help===void 0?null:r.message(n.help,``),u={kind:`attribute`,name:s,label:c,help:l===``?null:l},d=GM(e,s),f=o.required===!0,p=n.options===void 0?null:a(GM(e,n.options.from)??``);if(p!==null&&n.options!==void 0){let e=d??``;return{...u,control:`select`,value:e,options:RM(p,n.options.tag,r)(e)}}let m=s===`scoring`&&t.scoring!==null;if(o.type===`enum`||m){let e=OM(t,o,r),n=d??kM(t,o)??``;return n===``&&!e.some(e=>e.value===``)?e.unshift({value:``,label:r.unset}):e.some(e=>e.value===n)||e.push({value:n,label:n}),{...u,control:`select`,value:n,options:e}}if(o.type===`number`||o.type===`integer`)return{...u,control:`number`,value:d??kM(t,o)??``,min:o.min??null,max:o.max??null,step:o.type===`integer`?`1`:`any`,required:f};if(o.type===`boolean`)return{...u,control:`checkbox`,checked:d!==null};let h=o.type===`url`?n.accept??null:null;return{...u,control:`text`,value:d??``,required:f,accept:h}}function jM(e){return new Map(e.flatMap(e=>e.kind===`picture-regions`||e.kind===`picture-points`?[[e.tag,e.kind]]:[]))}function MM(e,t){let n=e.children.find(e=>e.tag===t)?.attributes.find(e=>e.name===`shape`);if(n===void 0)return[`rect`];let r=[`rect`,`circle`,`polygon`].filter(e=>n.values?.includes(e));return r.length>0?r:[`rect`]}function NM(e,t,n,r,i=[n],a=()=>null){let o=n.help===void 0?null:r.message(n.help,``)||null,s=`tag`in n?jM(i).get(n.tag):void 0,c=(e,t)=>LM(e,t,r,s);switch(n.kind){case`attribute`:return AM(e,t,n,r,n.name,a);case`text-list`:return{kind:`text-list`,tag:n.tag,label:r.message(n.label,n.tag),help:o,values:KM(e,n.tag).map(g),max:t.children.find(e=>e.tag===n.tag)?.max??null,multiline:n.multiline===!0};case`child-flag`:{let t=KM(e,n.tag).map((e,t)=>({index:t,id:GM(e,`id`),label:c(e,t),checked:GM(e,n.attribute)!==null})),i={count:t.length,checked:t.filter(e=>e.checked).length},a=`${n.tag} ${n.attribute}`,o=n.help===void 0?null:r.message(n.help,``,i)||null;return{kind:`child-flag`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,a,i),help:o,children:t}}case`child-text`:return{kind:`child-text`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,`${n.tag} ${n.attribute}`),help:o,children:KM(e,n.tag).map((e,t)=>({index:t,id:GM(e,`id`),label:c(e,t),value:GM(e,n.attribute)??``}))};case`child-choice`:{let i=zM(e,t,n,r);return i===null?null:{kind:`child-choice`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,`${n.tag} ${n.attribute}`),help:o,control:i.control,children:KM(e,n.tag).map((e,t)=>{let r=GM(e,n.attribute)??``,a=i.options(r);return{index:t,id:GM(e,`id`),label:c(e,t),value:r,options:a}})}}case`child-table`:return PM(e,t,n,r,o);case`picture-regions`:case`picture-points`:{let a={tag:n.tag,label:r.message(n.label,n.tag),help:o,elementTag:e.tag,srcAttribute:n.src,src:GM(e,n.src)??``},s=KM(e,n.tag);if(n.kind===`picture-points`)return{...a,kind:`picture-points`,points:s.map((e,t)=>({index:t,id:GM(e,`id`)??``,x:FM(GM(e,`x`)),y:FM(GM(e,`y`)),label:GM(e,`label`)??``}))};let c=i.find(e=>e.kind===`child-flag`&&e.tag===n.tag),l=c!==void 0&&`attribute`in c?c.attribute:null;return{...a,kind:`picture-regions`,shapes:MM(t,n.tag),flag:l,regions:s.map((e,t)=>{let n=GM(e,`shape`);return{index:t,id:GM(e,`id`)??``,shape:n===`circle`||n===`polygon`?n:`rect`,x:FM(GM(e,`x`)),y:FM(GM(e,`y`)),width:FM(GM(e,`width`)),height:FM(GM(e,`height`)),r:FM(GM(e,`r`)),points:IM(GM(e,`points`)),label:GM(e,`label`)??``,flagged:l!==null&&GM(e,l)!==null}})}}}}function PM(e,t,n,r,i){let a=t.children.find(e=>e.tag===n.tag);if(a===void 0)return null;let o=n.columns.flatMap(e=>{let t=a.attributes.find(t=>t.name===e.attribute);if(t===void 0)return[];let n=t.type===`integer`||t.type===`number`;return[{attribute:t.name,label:r.message(e.label,t.name),control:t.type===`enum`?`select`:n?`number`:`text`,options:(t.values??[]).map(e=>({value:e,label:r.message(`editor.value.${t.name}.${e}`,e)})),min:t.min??null,max:t.max??null,step:t.type===`integer`?`1`:`any`,required:t.required===!0}]}),s=KM(e,n.tag),c=n.tag.replace(/^astl-/,``),l=new Set(s.map(e=>GM(e,`id`))),u=s.length+1;for(;l.has(`${c}-${u}`);)u++;let d={id:`${c}-${u}`};for(let e of a.attributes)e.required===!0&&e.name!==`id`&&(d[e.name]=e.values?.[0]??(e.min===void 0?``:String(e.min)));return{kind:`child-table`,tag:n.tag,label:r.message(n.label,n.tag),help:i,columns:o,rows:s.map((e,t)=>({index:t,id:GM(e,`id`),label:LM(e,t,r),values:o.map(t=>GM(e,t.attribute)??``)})),added:d,min:a.min,max:a.max}}function FM(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}function IM(e){return(e??``).trim().split(/\s+/).filter(e=>e!==``).map(e=>{let[t=``,n=``]=e.split(`,`);return[FM(t),FM(n)]})}function LM(e,t,n,r){let i=qM(e).replace(/\s+/g,` `).trim();return i!==``||r===void 0?i||n.untitled(t+1):(GM(e,`label`)??``).replace(/\s+/g,` `).trim()||(r===`picture-regions`?n.region(t+1):n.point(t+1))}function RM(e,t,n){let r=KM(e,t).flatMap((e,t)=>{let r=GM(e,`id`);return r===null||r===``?[]:[{value:r,label:LM(e,t,n)}]});return e=>e===``?[{value:``,label:n.unset},...r]:r.some(t=>t.value===e)?r:[...r,{value:e,label:e}]}function zM(e,t,n,r){if(n.options===void 0){let e=t.children.find(e=>e.tag===n.tag)?.attributes.find(e=>e.name===n.attribute);if(e?.type!==`enum`)return null;let i=(e.values??[]).map(t=>({value:t,label:r.message(`editor.value.${e.name}.${t}`,t)}));return{control:`radios`,options:()=>i}}return{control:`select`,options:RM(e,n.options,r)}}function BM(e,t,n,r){let i=GM(e,`style-template`)??``,a=[{value:``,label:n},...r];return a.some(e=>e.value===i)||a.push({value:i,label:i}),{kind:`attribute`,control:`select`,name:wt,label:t,help:null,value:i,options:a}}function VM(e,t){if(t.variants===null)return null;let n=GM(e,`variant`);return n!==null&&t.variants.values.includes(n)?n:t.variants.default}function HM(e,t){return e.kind!==`attribute`||e.variants===void 0||e.variants.includes(t??``)}function UM(e,t,n,r,i){let a=e=>n.some(t=>t.kind===`attribute`&&t.name===e),o=[];if(t.variants!==null&&!a(`variant`)){let n=AM(e,t,{kind:`attribute`,name:`variant`,label:`editor.variant`},r,r.variant);n!==null&&o.push(n)}let s=GM(e,wt)!==null;if((i.length>0||s)&&!a(`style-template`)){let t=r.message(`editor.${wt}`,r.styleTemplate);o.push(BM(e,t,r.sameAsDocument,i))}return o}function WM(e,t,n,r,i=[],a=()=>null){let o=n?.fields??DM(t),s=VM(e,t),c=o.filter(e=>HM(e,s)).flatMap(n=>NM(e,t,n,r,o,a)??[]);return{tag:e.tag,id:GM(e,`id`),label:n===null?e.tag:r.message(n.label,e.tag),icon:n?.icon??null,fields:[...c,...UM(e,t,c,r,i)]}}var GM,KM,qM,JM=n((()=>{w(),GM=(e,t)=>Object.hasOwn(e.attrs,t)?e.attrs[t]??``:null,KM=(e,t)=>e.children.flatMap(e=>e.type===`element`?e.tag===t?[e]:KM(e,t):[]),qM=e=>e.type===`text`?e.value:e.tag===`img`?` ${e.attrs.alt??``} `:e.children.map(qM).join(``)})),YM,XM=n((()=>{YM={"insert.title":`Insert`,"insert.components":`Components`,"insert.exercises":`Exercises`,"insert.content":`Content`,"insert.picture":`Picture`,"insert.picture.description":`A picture with alt text and an optional caption`,"insert.pageBreak":`Page break`,"insert.pageBreak.description":`Split the exercise into steps at the cursor`,"insert.hint":`Hint`,"insert.hint.description":`One students ask for: for the question at the cursor, else for the page`,"insert.explanation":`Explanation`,"insert.explanation.description":`Why the answer is right, shown once it is checked`,"insert.feedback":`Feedback`,"insert.feedback.description":`A text by the verdict, shown once the answer is checked`,"insert.text":`Text`,"insert.text.description":`A paragraph after this block`,"insert.noMatch":`Nothing matches “{query}”.`,"toolbar.label":`Format and insert`,"toolbar.style":`Text style: {style}`,"toolbar.paragraph":`Paragraph`,"toolbar.heading":`Heading`,"toolbar.subheading":`Subheading`,"toolbar.bold":`Bold`,"toolbar.italic":`Italic`,"toolbar.underline":`Underline`,"toolbar.link":`Link`,"toolbar.link.address":`Link address`,"toolbar.link.apply":`Apply`,"toolbar.link.remove":`Remove link`,"toolbar.link.blocked":`This address is not allowed here.`,"toolbar.bulleted":`Bulleted list`,"toolbar.numbered":`Numbered list`,"toolbar.undo":`Undo`,"toolbar.redo":`Redo`,"toolbar.elements":`Elements`,"toolbar.templates":`Templates`,"toolbar.layouts":`Layout`,"toolbar.view":`View`,"toolbar.search":`Search`,"block.text":`Text`,"block.gap":`Gap`,"issue.onPage":`{n} on page {page}`,"picture.title":`Add a picture`,"picture.editTitle":`Edit the picture`,"picture.file":`Upload a picture`,"picture.library":`Choose from the library`,"picture.urlOnly":`This editor adds pictures by their address only: it has no upload.`,"picture.src":`Picture address (URL)`,"picture.alt":`Alt text`,"picture.altHelp":`What the picture shows, for students who cannot see it. Do not give an answer away.`,"picture.decorative":`Decorative: screen readers skip it (alt="")`,"picture.caption":`Caption (optional)`,"picture.cancel":`Cancel`,"picture.insert":`Insert`,"picture.save":`Save`,"picture.uploading":`Uploading…`,"picture.uploaded":`Uploaded.`,"picture.uploadFailed":`The upload failed. Try again, or give the picture's address.`,"picture.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"picture.picked":`Chosen from the library.`,"picture.pickFailed":`The library did not open. Try again, or give the picture's address.`,"picture.pickBlocked":`The library returned an address the URL policy does not allow.`,"picture.srcMissing":`Give the picture's address, or upload it.`,"picture.srcBlocked":`The URL policy does not allow this address.`,"picture.altMissing":`Describe the picture, or mark it as decorative.`,"picture.altRequired":`Describe the picture: students who cannot see it need its alt text for the task.`,"picture.pasteRefused":`This editor has no upload, so a picture file cannot be pasted or dropped. Add it with Insert, Picture, by its address.`,"field.picture.src":`Picture address (URL)`,"field.regions.draw":`Drag on the picture to draw a zone, or add one and type its numbers.`,"field.points.place":`Click the picture to place a pin, or add one and type its position.`,"field.region":`Zone {n}`,"field.region.add":`Add a zone`,"field.region.remove":`Remove zone {n}`,"field.point":`Pin {n}`,"field.point.add":`Add a pin`,"field.point.remove":`Remove pin {n}`,"field.shape":`Shape`,"field.shape.rect":`Rectangle`,"field.shape.circle":`Circle`,"field.shape.polygon":`Polygon`,"field.x":`From the left (%)`,"field.y":`From the top (%)`,"field.width":`Width (%)`,"field.height":`Height (%)`,"field.cx":`Centre from the left (%)`,"field.cy":`Centre from the top (%)`,"field.r":`Radius (% of the width)`,"field.vertex.x":`Point {n} from the left (%)`,"field.vertex.y":`Point {n} from the top (%)`,"field.vertex.add":`Add a point`,"field.vertex.remove":`Remove point {n}`,"field.label":`Label`,"field.label.optional":`Label (optional)`,"field.more":`Only the first {shown} of {count} are listed here: edit the others in the source.`,"inspector.title":`Properties`,"inspector.delete":`Delete`,"inspector.moveUp":`Move up`,"inspector.moveDown":`Move down`,"inspector.empty":`Put the cursor in an exercise element to edit its answers and settings.`,"inspector.unsupported":`Element {tag} cannot be edited here.`,"inspector.unset":`(not set)`,"inspector.item":`{label} {n}`,"inspector.add":`Add`,"inspector.remove":`Remove`,"inspector.removeItem":`Remove: {label} {n}`,"inspector.untitled":`Item {n} (empty)`,"inspector.variant":`Variant`,"inspector.styleTemplate":`Element style`,"inspector.styleTemplate.inherit":`Same as the exercise`,"inspector.styleTemplate.default":`Default look`,"inspector.document":`Exercise`,"inspector.documentStyle":`Look of the whole exercise`,"inspector.upload":`Upload a file`,"inspector.uploadItem":`Upload a file: {label}`,"inspector.uploading":`Uploading…`,"inspector.uploaded":`Uploaded.`,"inspector.uploadFailed":`The upload failed. Try again, or type its address.`,"inspector.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"issues.title":`Problems`,"issues.errors":`{count, plural, one {# error} other {# errors}}`,"issues.warnings":`{count, plural, one {# warning} other {# warnings}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`No errors or warnings.`,"severity.error":`Error`,"severity.warning":`Warning`,"label.text":`{label}: {text}`,"preview.title":`Student view`,"preview.show":`Preview`,"preview.refresh":`Refresh preview`,"preview.hint":`Press Preview to try the exercise the way a student will see it.`,"preview.loading":`Preparing the preview…`,"preview.stale":`The document changed after this preview. Refresh it to see the changes.`,"preview.invalid":`{count, plural, one {Fix this error to see the preview:} other {Fix these # errors to see the preview:}}`,"preview.failed":`The preview could not be shown.`,"surface.label":`Exercise content`,"surface.pageNumber":`Page {page} of {pages}`,"surface.pageTitle":`Page title`,"surface.pageJoin":`Join with page {previous}`,"surface.pageAdded":`Page {page} added`,"surface.pageJoined":`Page {page} joined with page {previous}`,"surface.pageDelete":`Delete page`,"surface.pageDeleted":`Deleted page {n}`,"surface.pageAddTitle":`Add title`,"surface.pageRemoveTitle":`Remove title`,"surface.pageTitleOf":`Title of page {page}`,"surface.pageTitleRemoved":`Removed the title of page {page}`,"surface.points":`{points, plural, one {# pt} other {# pts}}`,"surface.items":`{n, plural, one {# item} other {# items}}`,"surface.blockMovedUp":`Block moved up, now block {n}`,"surface.blockMovedDown":`Block moved down, now block {n}`,"surface.blockRemoved":`Block {n} deleted`,"surface.addOption":`Add option`,"surface.chip.empty":`No answer`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Picture: {alt}`,"surface.picture.decorative":`Picture, decorative (no alt text)`,"surface.picture.noAlt":`Picture without alt text`,"surface.picture.blocked":`(not shown: the URL policy does not allow its address)`,"surface.picture.edit":`Edit`,"surface.loading":`Loading the editor…`,"surface.failed":`The editor could not be loaded. Reload the page to try again.`,"view.visual":`Visual`,"view.source":`HTML`,"view.visualHint":`Edit the exercise as formatted text`,"view.sourceHint":`Edit the exercise as HTML`,"view.sourceLabel":`The exercise as HTML`,"view.sourceErrors":`{n, plural, one {The HTML has # error. Fix it to go back.} other {The HTML has # errors. Fix them to go back.}}`,"status.elements":`{n, plural, one {# element} other {# elements}}`,"status.errors":`{n, plural, one {# error} other {# errors}}`,"status.warnings":`{n, plural, one {# warning} other {# warnings}}`,"status.ready":`Ready to share`,"insert.layouts":`Layout`,"insert.layout.two":`Two columns`,"insert.layout.two.description":`Two columns of the same width.`,"insert.layout.three":`Three columns`,"insert.layout.three.description":`Three columns of the same width.`,"insert.layout.wide-narrow":`Wide + narrow`,"insert.layout.wide-narrow.description":`A wide column, then a narrow one.`,"insert.layout.narrow-wide":`Narrow + wide`,"insert.layout.narrow-wide.description":`A narrow column, then a wide one.`,"insert.layout.picture-text":`Picture beside text`,"insert.layout.picture-text.description":`A picture you choose, with text next to it.`,"layout.section":`Columns`,"layout.change":`Change layout`,"layout.other":`Another layout`,"layout.unwrap":`Remove layout`,"layout.delete":`Delete with content`,"layout.confirm":`Delete the layout and its content?`,"layout.confirmDelete":`Yes, delete`,"layout.cancel":`Cancel`,"toolbar.font":`Font: {value}`,"toolbar.font.name":`Font`,"toolbar.size":`Size: {value}`,"toolbar.size.name":`Size`,"toolbar.color":`Text colour`,"toolbar.highlight":`Highlight`,"toolbar.align":`Alignment`,"toolbar.align.start":`Left`,"toolbar.align.center":`Centre`,"toolbar.align.end":`Right`,"toolbar.align.justify":`Justified`,"toolbar.spacing":`Spacing`,"toolbar.spacing.line":`Line height`,"toolbar.spacing.after":`Space after`,"toolbar.spacing.none":`None`,"toolbar.spacing.small":`Small`,"toolbar.spacing.medium":`Medium`,"toolbar.spacing.large":`Large`,"toolbar.clear":`Clear formatting`,"toolbar.default":`Default`,"toolbar.myStyles":`My styles`,"toolbar.readyStyles":`Ready styles`,"style.preset.note":`Note`,"style.preset.tip":`Tip`,"style.preset.important":`Important`,"style.preset.definition":`Definition`,"style.preset.example":`Example`,"style.preset.quote":`Quote`,"style.preset.highlight":`Highlight`,"style.preset.small-print":`Small print`,"style.color.theme":`Theme colours`,"style.color.swatch":`Theme colour {n}`,"style.color.custom":`Custom colour`,"style.color.picker":`Pick a colour`,"style.color.invalid":`Write a colour as #rrggbb.`,"style.color.none":`No colour`,"style.close":`Close`,"style.form.none":`Put the cursor in what you want to style.`,"style.target.picture":`Picture style`,"style.target.figure":`Picture and caption style`,"style.target.block":`Block style`,"style.target.component":`Element style`,"style.target.column":`Column style`,"style.target.layout":`Layout style`,"style.position.inline":`In the text`,"style.position.start":`On the left`,"style.position.end":`On the right`,"style.position.center":`Centred`,"style.position.full":`Full width`,"style.rules.open":`Manage styles…`,"style.rules.title":`Styles`,"inspector.style":`Style`,"surface.picture.place":`Position and size: {position}, {width}`,"surface.picture.placeAuto":`Position and size: {position}`,"style.target.more":`{target}…`,"help.cost":`costs {percent}%`,"help.when.correct":`Correct`,"help.when.incorrect":`Wrong`,"help.when.partial":`Partly correct`,"help.when.omitted":`Skipped`,"help.costLabel":`Cost of the hint`,"help.whenLabel":`For the result`}})),ZM,QM=n((()=>{ZM={"insert.title":`Wstaw`,"insert.components":`Elementy`,"insert.exercises":`Ćwiczenia`,"insert.content":`Treść`,"insert.picture":`Obrazek`,"insert.picture.description":`Obrazek z tekstem alternatywnym i podpisem do wyboru`,"insert.pageBreak":`Podział strony`,"insert.pageBreak.description":`Podziel ćwiczenie na kroki od miejsca kursora`,"insert.hint":`Podpowiedź`,"insert.hint.description":`Na prośbę ucznia: do pytania przy kursorze, a poza nim do strony`,"insert.explanation":`Wyjaśnienie`,"insert.explanation.description":`Dlaczego odpowiedź jest dobra, widoczne po sprawdzeniu`,"insert.feedback":`Informacja zwrotna`,"insert.feedback.description":`Tekst zależny od wyniku, widoczny po sprawdzeniu`,"insert.text":`Tekst`,"insert.text.description":`Akapit po tym bloku`,"insert.noMatch":`Nic nie pasuje do „{query}”.`,"toolbar.label":`Formatowanie i wstawianie`,"toolbar.style":`Styl tekstu: {style}`,"toolbar.paragraph":`Akapit`,"toolbar.heading":`Nagłówek`,"toolbar.subheading":`Podtytuł`,"toolbar.bold":`Pogrubienie`,"toolbar.italic":`Kursywa`,"toolbar.underline":`Podkreślenie`,"toolbar.link":`Link`,"toolbar.link.address":`Adres linku`,"toolbar.link.apply":`Zastosuj`,"toolbar.link.remove":`Usuń link`,"toolbar.link.blocked":`Tego adresu nie można tu użyć.`,"toolbar.bulleted":`Lista punktowana`,"toolbar.numbered":`Lista numerowana`,"toolbar.undo":`Cofnij`,"toolbar.redo":`Ponów`,"toolbar.elements":`Elementy`,"toolbar.templates":`Szablony`,"toolbar.layouts":`Układ`,"toolbar.view":`Widok`,"toolbar.search":`Szukaj`,"block.text":`Tekst`,"block.gap":`Luka`,"issue.onPage":`{n} na stronie {page}`,"picture.title":`Dodaj obrazek`,"picture.editTitle":`Edytuj obrazek`,"picture.file":`Wgraj obrazek`,"picture.library":`Wybierz z biblioteki`,"picture.urlOnly":`Ten edytor dodaje obrazki tylko po adresie: nie ma wgrywania.`,"picture.src":`Adres obrazka (URL)`,"picture.alt":`Tekst alternatywny`,"picture.altHelp":`Co przedstawia obrazek, dla uczniów, którzy go nie widzą. Nie zdradzaj odpowiedzi.`,"picture.decorative":`Ozdobny: czytniki ekranu go pomijają (alt="")`,"picture.caption":`Podpis (opcjonalny)`,"picture.cancel":`Anuluj`,"picture.insert":`Wstaw`,"picture.save":`Zapisz`,"picture.uploading":`Wgrywam…`,"picture.uploaded":`Wgrano.`,"picture.uploadFailed":`Nie udało się wgrać obrazka. Spróbuj ponownie albo podaj jego adres.`,"picture.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"picture.picked":`Wybrano z biblioteki.`,"picture.pickFailed":`Nie udało się otworzyć biblioteki. Spróbuj ponownie albo podaj adres obrazka.`,"picture.pickBlocked":`Biblioteka zwróciła adres, na który nie pozwala polityka adresów.`,"picture.srcMissing":`Podaj adres obrazka albo go wgraj.`,"picture.srcBlocked":`Polityka adresów nie pozwala na ten adres.`,"picture.altMissing":`Opisz obrazek albo oznacz go jako ozdobny.`,"picture.altRequired":`Opisz obrazek: uczniowie, którzy go nie widzą, potrzebują tekstu alternatywnego do zadania.`,"picture.pasteRefused":`Ten edytor nie ma wgrywania, więc nie można wkleić ani upuścić pliku obrazka. Dodaj go przez Wstaw, Obrazek, podając adres.`,"field.picture.src":`Adres obrazka (URL)`,"field.regions.draw":`Przeciągnij po obrazku, aby narysować strefę, albo dodaj ją i wpisz jej liczby.`,"field.points.place":`Kliknij obrazek, aby wbić pinezkę, albo dodaj ją i wpisz jej położenie.`,"field.region":`Strefa {n}`,"field.region.add":`Dodaj strefę`,"field.region.remove":`Usuń strefę {n}`,"field.point":`Pinezka {n}`,"field.point.add":`Dodaj pinezkę`,"field.point.remove":`Usuń pinezkę {n}`,"field.shape":`Kształt`,"field.shape.rect":`Prostokąt`,"field.shape.circle":`Koło`,"field.shape.polygon":`Wielokąt`,"field.x":`Od lewej (%)`,"field.y":`Od góry (%)`,"field.width":`Szerokość (%)`,"field.height":`Wysokość (%)`,"field.cx":`Środek od lewej (%)`,"field.cy":`Środek od góry (%)`,"field.r":`Promień (% szerokości)`,"field.vertex.x":`Punkt {n} od lewej (%)`,"field.vertex.y":`Punkt {n} od góry (%)`,"field.vertex.add":`Dodaj punkt`,"field.vertex.remove":`Usuń punkt {n}`,"field.label":`Etykieta`,"field.label.optional":`Etykieta (opcjonalna)`,"field.more":`Tu widać tylko pierwsze {shown} z {count}: pozostałe edytuj w źródle.`,"inspector.title":`Właściwości`,"inspector.delete":`Usuń`,"inspector.moveUp":`Przenieś wyżej`,"inspector.moveDown":`Przenieś niżej`,"inspector.empty":`Umieść kursor w elemencie ćwiczenia, aby edytować jego odpowiedzi i ustawienia.`,"inspector.unsupported":`Elementu {tag} nie można tu edytować.`,"inspector.unset":`(nie ustawiono)`,"inspector.item":`{label} {n}`,"inspector.add":`Dodaj`,"inspector.remove":`Usuń`,"inspector.removeItem":`Usuń: {label} {n}`,"inspector.untitled":`Element {n} (pusty)`,"inspector.variant":`Wariant`,"inspector.styleTemplate":`Styl elementu`,"inspector.styleTemplate.inherit":`Jak całe ćwiczenie`,"inspector.styleTemplate.default":`Domyślny wygląd`,"inspector.document":`Ćwiczenie`,"inspector.documentStyle":`Wygląd całego ćwiczenia`,"inspector.upload":`Wgraj plik`,"inspector.uploadItem":`Wgraj plik: {label}`,"inspector.uploading":`Wgrywam…`,"inspector.uploaded":`Wgrano.`,"inspector.uploadFailed":`Nie udało się wgrać pliku. Spróbuj ponownie albo wpisz jego adres.`,"inspector.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"issues.title":`Problemy`,"issues.errors":`{count, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"issues.warnings":`{count, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`Brak błędów i ostrzeżeń.`,"severity.error":`Błąd`,"severity.warning":`Ostrzeżenie`,"label.text":`{label}: {text}`,"preview.title":`Widok ucznia`,"preview.show":`Podgląd`,"preview.refresh":`Odśwież podgląd`,"preview.hint":`Naciśnij „Podgląd”, aby wypróbować ćwiczenie tak, jak zobaczy je uczeń.`,"preview.loading":`Przygotowuję podgląd…`,"preview.stale":`Dokument zmienił się po tym podglądzie. Odśwież go, aby zobaczyć zmiany.`,"preview.invalid":`{count, plural, one {Popraw ten błąd, aby zobaczyć podgląd:} few {Popraw te # błędy, aby zobaczyć podgląd:} many {Popraw tych # błędów, aby zobaczyć podgląd:} other {Popraw te # błędu, aby zobaczyć podgląd:}}`,"preview.failed":`Nie udało się pokazać podglądu.`,"surface.label":`Treść ćwiczenia`,"surface.pageNumber":`Strona {page} z {pages}`,"surface.pageTitle":`Tytuł strony`,"surface.pageJoin":`Połącz ze stroną {previous}`,"surface.pageAdded":`Dodano stronę {page}`,"surface.pageJoined":`Strona {page} połączona ze stroną {previous}`,"surface.pageDelete":`Usuń stronę`,"surface.pageDeleted":`Usunięto stronę {n}`,"surface.pageAddTitle":`Dodaj tytuł`,"surface.pageRemoveTitle":`Usuń tytuł`,"surface.pageTitleOf":`Tytuł strony {page}`,"surface.pageTitleRemoved":`Usunięto tytuł strony {page}`,"surface.points":`{points, plural, one {# pkt} few {# pkt} many {# pkt} other {# pkt}}`,"surface.items":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"surface.blockMovedUp":`Blok przesunięty w górę, teraz to blok {n}`,"surface.blockMovedDown":`Blok przesunięty w dół, teraz to blok {n}`,"surface.blockRemoved":`Usunięto blok {n}`,"surface.addOption":`Dodaj odpowiedź`,"surface.chip.empty":`Brak odpowiedzi`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Obrazek: {alt}`,"surface.picture.decorative":`Obrazek ozdobny (bez tekstu alternatywnego)`,"surface.picture.noAlt":`Obrazek bez tekstu alternatywnego`,"surface.picture.blocked":`(niepokazany: polityka adresów nie pozwala na jego adres)`,"surface.picture.edit":`Edytuj`,"surface.loading":`Wczytuję edytor…`,"surface.failed":`Nie udało się wczytać edytora. Odśwież stronę, aby spróbować ponownie.`,"view.visual":`Wizualny`,"view.source":`HTML`,"view.visualHint":`Edytuj ćwiczenie jako sformatowany tekst`,"view.sourceHint":`Edytuj ćwiczenie jako HTML`,"view.sourceLabel":`Ćwiczenie jako HTML`,"view.sourceErrors":`{n, plural, one {HTML ma # błąd. Popraw go, aby wrócić.} few {HTML ma # błędy. Popraw je, aby wrócić.} many {HTML ma # błędów. Popraw je, aby wrócić.} other {HTML ma # błędu. Popraw go, aby wrócić.}}`,"status.elements":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"status.errors":`{n, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"status.warnings":`{n, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"status.ready":`Gotowe do udostępnienia`,"insert.layouts":`Układ`,"insert.layout.two":`Dwie kolumny`,"insert.layout.two.description":`Dwie kolumny tej samej szerokości.`,"insert.layout.three":`Trzy kolumny`,"insert.layout.three.description":`Trzy kolumny tej samej szerokości.`,"insert.layout.wide-narrow":`Szeroka + wąska`,"insert.layout.wide-narrow.description":`Szeroka kolumna, a po niej wąska.`,"insert.layout.narrow-wide":`Wąska + szeroka`,"insert.layout.narrow-wide.description":`Wąska kolumna, a po niej szeroka.`,"insert.layout.picture-text":`Obrazek obok tekstu`,"insert.layout.picture-text.description":`Wybrany obrazek, a obok niego tekst.`,"layout.section":`Kolumny`,"layout.change":`Zmień układ`,"layout.other":`Inny układ`,"layout.unwrap":`Usuń układ`,"layout.delete":`Usuń z zawartością`,"layout.confirm":`Usunąć układ razem z zawartością?`,"layout.confirmDelete":`Tak, usuń`,"layout.cancel":`Anuluj`,"toolbar.font":`Czcionka: {value}`,"toolbar.font.name":`Czcionka`,"toolbar.size":`Rozmiar: {value}`,"toolbar.size.name":`Rozmiar`,"toolbar.color":`Kolor tekstu`,"toolbar.highlight":`Wyróżnienie`,"toolbar.align":`Wyrównanie`,"toolbar.align.start":`Do lewej`,"toolbar.align.center":`Do środka`,"toolbar.align.end":`Do prawej`,"toolbar.align.justify":`Wyjustowane`,"toolbar.spacing":`Odstępy`,"toolbar.spacing.line":`Interlinia`,"toolbar.spacing.after":`Odstęp po`,"toolbar.spacing.none":`Brak`,"toolbar.spacing.small":`Mały`,"toolbar.spacing.medium":`Średni`,"toolbar.spacing.large":`Duży`,"toolbar.clear":`Wyczyść formatowanie`,"toolbar.default":`Domyślnie`,"toolbar.myStyles":`Moje style`,"toolbar.readyStyles":`Gotowe style`,"style.preset.note":`Uwaga`,"style.preset.tip":`Wskazówka`,"style.preset.important":`Ważne`,"style.preset.definition":`Definicja`,"style.preset.example":`Przykład`,"style.preset.quote":`Cytat`,"style.preset.highlight":`Wyróżnienie`,"style.preset.small-print":`Mały druk`,"style.color.theme":`Kolory motywu`,"style.color.swatch":`Kolor motywu {n}`,"style.color.custom":`Własny kolor`,"style.color.picker":`Wybierz kolor`,"style.color.invalid":`Wpisz kolor jako #rrggbb.`,"style.color.none":`Bez koloru`,"style.close":`Zamknij`,"style.form.none":`Ustaw kursor w tym, co chcesz ostylować.`,"style.target.picture":`Styl obrazka`,"style.target.figure":`Styl obrazka z podpisem`,"style.target.block":`Styl bloku`,"style.target.component":`Styl elementu`,"style.target.column":`Styl kolumny`,"style.target.layout":`Styl układu`,"style.position.inline":`W tekście`,"style.position.start":`Po lewej`,"style.position.end":`Po prawej`,"style.position.center":`Na środku`,"style.position.full":`Cała szerokość`,"style.rules.open":`Zarządzaj stylami…`,"style.rules.title":`Style`,"inspector.style":`Styl`,"surface.picture.place":`Położenie i rozmiar: {position}, {width}`,"surface.picture.placeAuto":`Położenie i rozmiar: {position}`,"style.target.more":`{target}…`,"help.cost":`koszt {percent}%`,"help.when.correct":`Dobrze`,"help.when.incorrect":`Źle`,"help.when.partial":`Częściowo dobrze`,"help.when.omitted":`Pominięte`,"help.costLabel":`Koszt podpowiedzi`,"help.whenLabel":`Dla wyniku`}})),H,$M,eN=n((()=>{XM(),QM(),H=`astl.editor`,$M=[{namespace:H,locale:`en`,messages:YM},{namespace:H,locale:`pl`,messages:ZM}]}));function tN(e,t=``){let n=e===`picture-text`?cN(t.startsWith(`<figure`)?t:`<p>${t}</p>`)+cN():sN[e].map(e=>cN(`<p></p>`,e)).join(``);return`<astl-columns${e===`picture-text`?` style="align-items: start"`:``}>${n}</astl-columns>`}var nN,rN,iN,aN,oN,sN,cN,lN=n((()=>{nN=e=>new Map(e.split(`;`).flatMap(e=>{let t=e.indexOf(`:`);return t<0?[]:[[e.slice(0,t).trim().toLowerCase(),e.slice(t+1).trim().toLowerCase()]]})),rN=[{name:`Arial`,stack:`Arial, Helvetica, sans-serif`},{name:`Verdana`,stack:`Verdana, Geneva, sans-serif`},{name:`Georgia`,stack:`Georgia, serif`},{name:`Times New Roman`,stack:`"Times New Roman", Times, serif`},{name:`Courier New`,stack:`"Courier New", Courier, monospace`}],iN=[{name:`note`,style:`background-color: #fff4d6; border-inline-start: 4px solid #b7791f; padding: 12px 16px; border-radius: 6px`},{name:`tip`,style:`background-color: #e7f6ec; border-inline-start: 4px solid #2f855a; padding: 12px 16px; border-radius: 6px`},{name:`important`,style:`background-color: #fdecec; border-inline-start: 4px solid #c53030; padding: 12px 16px; border-radius: 6px`},{name:`definition`,style:`background-color: #eef1fe; border: 1px solid #5a67d8; padding: 12px 16px; border-radius: 6px`},{name:`example`,style:`border: 2px dashed #718096; padding: 12px 16px; border-radius: 6px`},{name:`quote`,style:`border-inline-start: 3px solid #a0aec0; padding-inline-start: 16px; font-style: italic; color: #4a5568`},{name:`highlight`,style:`background-color: #fff3a3`,text:!0},{name:`small-print`,style:`font-size: 14px; color: #4a5568`,text:!0}],aN=[`two`,`three`,`wide-narrow`,`narrow-wide`,`picture-text`],oN=[`two`,`three`,`wide-narrow`,`narrow-wide`],sN={two:[null,null],three:[null,null,null],"wide-narrow":[2,null],"narrow-wide":[null,2]},cN=(e=`<p></p>`,t=null)=>`<astl-column${t===null?``:` style="flex-grow: ${t}"`}>${e}</astl-column>`}));function uN(e){let t=Fn(`font-family: ${e.stack}`).declarations[0]?.[1];if(t===void 0)throw TypeError(`Font "${e.name}": the style allow-list refuses its stack`);return{name:e.name,stack:t}}function dN(e,t){let n=new Set;return e.map(e=>{let{name:r}=e;if(!kn(r))throw TypeError(`Style "${r}": not a style name`);if(n.has(r))throw TypeError(`Style "${r}" is given twice`);n.add(r);let{style:i,removed:a}=Fn(e.style);if(a.length>0)throw TypeError(`Style "${r}": the style allow-list refuses ${a.join(`, `)}`);return{...e,style:i,label:e.label??t(r)}})}function fN(e){return e instanceof Error&&e.name===`UploadRefused`&&e.message.trim()!==``?e.message:void 0}function pN(e){let t=typeof e==`number`?e:typeof e==`string`&&/^[1-9]\d*$/.test(e)?Number(e):NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function mN(e){let t=(e,t)=>{let n=pN(t);return n===void 0?``:` ${e}="${n}"`},n=`<img src="${rM(String(e.src))}" alt="${rM(String(e.alt))}"${t(`width`,e.width)}${t(`height`,e.height)}>`,r=String(e.caption??``).trim();return r===``?n:`<figure>${n}<figcaption>${rM(r)}</figcaption></figure>`}function hN(){let e=crypto.getRandomValues(new Uint8Array(16));return`preview-${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}`}function gN(e,t){for(let n=1;;n++){let r=`${e}-${n}`;if(!t.has(r))return r}}function _N(e){return e.find(e=>e.type===`element`)??null}function vN(e){let t=e.filter(e=>e!==null);return t.length===0?null:Math.round(t.reduce((e,t)=>e+t,0)*100)/100}function yN(e,t){let n={errors:0,warnings:0};for(let r of e)t(r)&&(r.severity===`error`?n.errors++:n.warnings++);return n}function bN(e){let{engine:t,locale:n}=e,r=new Map(t.manifests.map(e=>[e.tag,e])),i=new Map;for(let t of e.descriptors){let e=t.manifest.tag;if(i.has(e))throw TypeError(`Editor descriptor for <${e}> is given twice`);if(!r.has(e))throw TypeError(`Editor descriptor <${e}> has no component in the engine`);if(!Ae(`${t.idPrefix}-1`))throw TypeError(`Editor descriptor <${e}>: idPrefix "${t.idPrefix}" does not make valid ids`);let n=(t.templates??[]).map(e=>e.id);if(n.some((e,t)=>!SN.test(e)||n.indexOf(e)!==t))throw TypeError(`Editor descriptor <${e}>: template ids must be distinct kebab-case names`);i.set(e,t)}let a=e.styleTemplates??[],o=t=>vt({catalogs:[...$M,...zf,...e.descriptors.flatMap(e=>e.messages??[]),...t,...a.flatMap(e=>e.catalogs??[]),...e.catalogs??[]]}),s=o([]),c=[],l=e=>{let t=e.filter(e=>!c.includes(e));t.length!==0&&(c=[...c,...t],s=o(c))},u=null,d=(e,t,r)=>s.t(n,e,t,r),f=e=>i.get(e)?.manifest??r.get(e)??null,m=hN(),g=e=>({message:(t,n,r)=>{let i=d(e.messages,t,r);return i===t?n:i},unset:d(H,`inspector.unset`),untitled:e=>d(H,`inspector.untitled`,{n:e}),region:e=>d(H,`field.region`,{n:e}),point:e=>d(H,`field.point`,{n:e}),variant:d(H,`inspector.variant`),styleTemplate:d(H,`inspector.styleTemplate`),sameAsDocument:d(H,`inspector.styleTemplate.inherit`)}),_=(e,t)=>a.filter(n=>n.scopes.includes(e)&&(t===void 0||n.components===void 0||n.components.includes(t))).map(e=>{let t=d(e.messages,`label`);return{value:e.name,label:t===`label`?e.name:t}}),v=e=>{let t=i.get(e);if(t===void 0)return e;let n=d(t.manifest.messages,t.label);return n===t.label?e:n},y=e=>{if(r.get(e.tag)?.graded!==!0)return null;let t=Object.hasOwn(e.attrs,`points`)?Number(e.attrs.points):NaN;return Number.isFinite(t)&&t>0?t:wN},b=e=>{let{issues:n}=t.validate(e),i=e=>Object.hasOwn(e.attrs,`id`)?e.attrs.id??null:null,a=e=>{let t=i(e),r=yN(n,e=>t!==null&&e.at.element===t);return{id:t,tag:e.tag,label:v(e.tag),points:y(e),...r}},o=(e,t=[])=>{for(let n of e)n.type===`element`&&(r.has(n.tag)?t.push(a(n)):o(n.children,t));return t},s=(e,t,r)=>{let a=new Set(r.flatMap(e=>e.id===null?[]:[e.id])),o=vN(r.map(e=>e.points)),s=t===null?d(H,o===null?`block.text`:`block.gap`):v(t.tag);return{kind:e,id:t===null?null:i(t),tag:t?.tag??null,label:s,points:o,components:r,...yN(n,e=>e.at.element!==null&&a.has(e.at.element))}},c=e=>{let t=[],n=[],i=()=>{n.some(e=>e.type===`element`||e.value.trim()!==``)&&t.push(s(`text`,null,o(n))),n=[]};for(let o of e)if(o.type===`element`&&o.tag===`astl-columns`){i();for(let e of o.children)h(e,`astl-column`)&&t.push(...c(e.children))}else o.type===`element`&&r.get(o.tag)?.display===`block`?(i(),t.push(s(`component`,o,[a(o)]))):n.push(o);return i(),t},l=(e,t,r)=>{let i=c(r);return{id:e,label:t,...yN(n,t=>e===null?t.at.page===null&&t.at.tag!==null&&t.at.tag!==`astl-doc`:t.at.page===e),components:o(r),blocks:i,points:vN(i.map(e=>e.points))}},u=Rc(e),f=u.find(e=>h(e,Fe)),p=CN(f?.children??u),m=[];if(p.some(e=>h(e,`astl-page`))){let e=[],t=()=>{let t=l(null,null,e);t.components.length>0&&m.push(t),e=[]};for(let n of p){if(!h(n,`astl-page`)){e.push(n);continue}t();let r=e=>Object.hasOwn(n.attrs,e)?n.attrs[e]??null:null;m.push(l(r(`id`),r(`label`),n.children))}t()}else m.push(l(null,null,p));return{pages:m,...yN(n,()=>!0),points:vN(m.map(e=>e.points))}},x=null,ee=e=>{if(x?.source===e)return x.names;let t=new Map,n=Rc(e),i=CN(n.find(e=>h(e,`astl-doc`))?.children??n),a=i.some(e=>h(e,Ie)),o=(e,n,r)=>{let i=Object.hasOwn(e.attrs,`id`)?e.attrs.id:void 0;i===void 0||i===``||t.has(i)||t.set(i,{n,page:r})},s=(e,t,n)=>{for(let i of e){if(i.type!==`element`)continue;if(!r.has(i.tag)){s(i.children,t,n);continue}let e=(n.get(i.tag)??0)+1;n.set(i.tag,e),o(i,e,t)}},c=(e,t)=>{let n=new Map,i=0,a=!1,c=e=>{for(let l of e)if(l.type===`element`&&l.tag===`astl-columns`){for(let e of l.children)a=!1,h(e,`astl-column`)&&c(e.children);a=!1}else l.type===`element`&&r.get(l.tag)?.display===`block`?(i++,a=!1,o(l,i,t)):(!a&&(l.type===`element`||l.value.trim()!==``)&&(i++,a=!0),s([l],t,n))};c(e)};return a?i.filter(e=>h(e,Ie)).forEach((e,t)=>{c(e.children,t+1)}):c(i,null),x={source:e,names:t},t};function te(e,t){let n=[];for(let{tag:a,id:o,range:s}of Qj(e)){if(o!==null&&o.trim()!==``||a!==`astl-page`&&!r.has(a))continue;let e=a===`astl-page`?`page`:i.get(a)?.idPrefix??a.replace(/^astl-/,``),c=gN(Ae(`${e}-1`)?e:`item`,t);t.add(c);let l=s.startTag.attributes.find(e=>e.name===`id`),u=s.startTag.start+1+a.length;n.push(l===void 0?{start:u,end:u,text:` id="${c}"`}:{start:l.start,end:l.end,text:`id="${c}"`})}return iM(e,n)}function ie(e,t,n){let r=[];for(let{tag:a,range:o}of Qj(e)){let s=i.get(a)?.companion,c=s===void 0?void 0:i.get(s.tag);if(s===void 0||c===void 0||Zj(o.startTag,s.attribute))continue;let l=e=>$j(e).find(e=>e.tag===s.tag&&e.id)?.id,u=l(e)??l(t)??gN(c.idPrefix,n),d=wM(e.slice(o.start,o.end),{kind:`attribute`,name:s.attribute,value:u});r.push({start:o.start,end:o.end,text:d})}return iM(e,r)}function ae(e,t,n,r=``){let a=i.get(e);if(a===void 0)throw TypeError(`No editor descriptor for <${e}>`);let o=n===void 0?null:a.templates?.find(e=>e.id===n);if(o===void 0)throw TypeError(`Editor descriptor <${e}> has no template "${n}"`);let s=eM(t),c=gN(a.idPrefix,s),l=a.manifest.messages,u=(o?.template??a.template).replace(/\{\{t:([^}]+)\}\}/g,(e,t)=>rM(d(l,t.trim()))).replace(/\{\{id\}\}/g,c).replace(/\{\{selection\}\}/g,()=>rM(r));for(let e of eM(u))s.add(e);return ie(te(u,s),t,s)}return{engine:t,locale:n,descriptors:[...i.values()],elements:e.elements??[],styleTemplates:a,urlPolicy:re(e.urlPolicy??ne),fonts:(e.fonts??rN).map(uN),styles:dN(e.styles??iN,e=>{let t=`style.preset.${e}`,n=d(H,t);return n===t?e:n}),uploadAsset:e.uploadAsset??null,pickPicture:e.pickPicture??null,descriptor:e=>i.get(e)??null,templates:e=>i.get(e)?.templates??[],t:d,loadMenuMessages:()=>u??=Promise.resolve(e.menuMessages?.()??[]).then(l,e=>{u=null,console.error(e)}),addMessages:l,instantiate:ae,withCompanion(e,t,n){let r=i.get(e)?.companion;if(r===void 0||!i.has(r.tag))return null;let a=Yj(t).find(e=>e.name===Fe);if(a===void 0)return null;let o=a.children.filter(e=>e.name===Ie),s=Qj(t),c=e=>o.find(t=>t.start<=e.start&&e.end<=t.end)??a,l=e=>s.flatMap(t=>t.tag===r.tag&&t.id&&e.start<=t.start&&t.end<=e.end?[t.id]:[]),u=e=>Zj(e.startTag,r.attribute)??``,d=s.find(t=>t.tag===e&&(n===void 0?!l(c(t.range)).includes(u(t.range)):t.id===n));if(d===void 0)return null;let f=c(d.range),p=l(f);if(p.includes(u(d.range)))return null;let[m]=p,h=m===void 0?ae(r.tag,t):``,g=m??$j(h).find(e=>e.tag===r.tag)?.id??``,_=t.slice(d.start,d.end),v=f.endTag?.start??f.end;return iM(t,[{start:d.start,end:d.end,text:wM(_,{kind:`attribute`,name:r.attribute,value:g})},{start:v,end:v,text:h}])},inspect(e,t){let n=_N(Rc(e));if(n===null)return null;let r=f(n.tag);if(r===null)return null;let a=_(`component`,n.tag);return WM(n,r,i.get(n.tag)??null,g(r),a,e=>{if(t===void 0||e===``)return null;let n=$j(t).find(t=>t.id===e);return n===void 0?null:_N(Rc(t.slice(n.start,n.end)))})},inspectDocument(e){let t=qj(e).find(e=>e.type===`start`);if(t?.name!==`astl-doc`)return null;let n=Zj(t,wt),r=_(`document`);if(r.length===0&&n===null)return null;let i=p(Fe,n===null?{}:{[wt]:n}),a=d(H,`inspector.documentStyle`),o=d(H,`inspector.styleTemplate.default`);return{tag:Fe,id:null,label:d(H,`inspector.document`),icon:null,fields:[BM(i,a,o,r)]}},update:wM,validate:e=>t.validate(e),describe(e,r,i){let{id:a}=e.params,o=r!==void 0&&e.namespace!==`astl.engine`&&a===e.at.element&&typeof a==`string`?ee(r).get(a):void 0,s=o===void 0?void 0:o.page===null||i?.page===!1?String(o.n):d(H,`issue.onPage`,{n:o.n,page:o.page}),c=s===void 0?e:{...e,params:{...e.params,id:s}},l=d(c.namespace,c.code,c.params);return l===c.code?t.describe(c,n):l},assignIds:e=>te(e,eM(e)),outline:b,async preview(e,n){let r=await t.compile(e,{salt:m});return r.ok?{ok:!0,view:r.view,checker:En(t,r.key,n?.policy),issues:r.issues}:{ok:!1,issues:r.issues}}}}var xN,SN,CN,wN,TN=n((()=>{w(),Or(),Qp(),EM(),JM(),eN(),hM(),lN(),xN=class extends Error{constructor(e,t){super(e,t),this.name=`UploadRefused`}},SN=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,CN=e=>e.flatMap(e=>h(e,`astl-style`)?CN(e.children):[e]),wN=Number(It.find(e=>e.name===`points`)?.default??1)})),EN,DN=n((()=>{w(),z(),eN(),EN=class extends OC{static properties={authoring:{attribute:!1},adapter:{attribute:!1}};#e=null;constructor(){super(),this.authoring=null,this.adapter=null}connectedCallback(){super.connectedCallback(),this.#t()}disconnectedCallback(){super.disconnectedCallback(),this.#n()}willUpdate(e){e.has(`adapter`)&&this.#t()}#t(){let e=this.isConnected?this.adapter:null;if((this.#e?.adapter??null)===e||(this.#n(),e===null))return;let t=[e.onChange(()=>this.sourceChanged()),e.onSelectionChange(e=>this.selectionChanged(e)),e.onCursorChange?.(()=>this.cursorChanged())??(()=>{})];this.#e={adapter:e,off:()=>{for(let e of t)e()}}}#n(){this.#e?.off(),this.#e=null}sourceChanged(){this.requestUpdate()}selectionChanged(e){this.requestUpdate()}cursorChanged(){}t(e,t){return this.authoring?.t(`astl.editor`,e,t)??e}get ui(){let e=this.authoring?.locale??`en`;return{lang:e,dir:Me(e)}}}})),ON,kN=n((()=>{ON={"style.section.text":`Text`,"style.section.box":`Background and border`,"style.section.spacing":`Spacing`,"style.section.size":`Size and position`,"style.section.named":`Named style`,"style.section.own":`Own CSS`,"style.field.font-family":`Font`,"style.field.font-size":`Font size`,"style.field.font-weight":`Weight`,"style.field.font-style":`Slant`,"style.field.color":`Text colour`,"style.field.text-align":`Alignment`,"style.field.line-height":`Line height`,"style.field.background-color":`Background`,"style.field.border-width":`Border width`,"style.field.border-style":`Border style`,"style.field.border-color":`Border colour`,"style.field.border-radius":`Corners`,"style.field.padding":`Padding`,"style.field.margin-block-start":`Space before`,"style.field.margin-block-end":`Space after`,"style.field.width":`Width`,"style.field.position":`Position`,"style.field.gap":`Space between columns`,"style.field.align-items":`Align columns`,"style.field.flex-grow":`Share of the width`,"style.field.named":`Style`,"style.field.own":`CSS declarations`,"style.value.normal":`Normal`,"style.value.bold":`Bold`,"style.value.italic":`Italic`,"style.value.start":`Left`,"style.value.center":`Centre`,"style.value.end":`Right`,"style.value.justify":`Justified`,"style.value.none":`None`,"style.value.solid":`Solid`,"style.value.dashed":`Dashed`,"style.value.dotted":`Dotted`,"style.value.double":`Double`,"style.value.stretch":`Same height`,"style.named.none":`No style`,"style.save.label":`Name of the new style`,"style.save":`Save as a style`,"style.refused.property":`"{name}" is not allowed: an exercise's style cannot move it out of its place, cover other content or load anything.`,"style.refused.value":`This value of "{name}" is not allowed: check its unit and its limits.`,"style.refused.text":`"{name}" is not a declaration: write it as property: value.`,"style.refused.length":`This style is too long: at most {max} characters.`,"style.rules.tags":`Text styles`,"style.rules.empty":`No styles of your own yet. Add one here, or save an element's style.`,"style.rules.edit":`Edit style: {label}`,"style.rules.rename":`Rename style: {label}`,"style.rules.renameShort":`Rename`,"style.rules.renameField":`New name of style: {label}`,"style.rules.delete":`Delete style: {label}`,"style.rules.deleteShort":`Delete`,"style.rules.newLabel":`Name of a new style`,"style.rules.add":`Add style`,"style.tag.paragraph":`Paragraph`,"style.tag.heading":`Heading`,"style.tag.subheading":`Subheading`,"style.tag.quote":`Quote`,"style.tag.list":`List`,"style.tag.caption":`Caption`,"style.tag.picture":`Picture`}})),AN,jN=n((()=>{AN={"style.section.text":`Tekst`,"style.section.box":`Tło i obramowanie`,"style.section.spacing":`Odstępy`,"style.section.size":`Rozmiar i położenie`,"style.section.named":`Styl nazwany`,"style.section.own":`Własny CSS`,"style.field.font-family":`Czcionka`,"style.field.font-size":`Rozmiar czcionki`,"style.field.font-weight":`Grubość`,"style.field.font-style":`Pochylenie`,"style.field.color":`Kolor tekstu`,"style.field.text-align":`Wyrównanie`,"style.field.line-height":`Interlinia`,"style.field.background-color":`Tło`,"style.field.border-width":`Grubość obramowania`,"style.field.border-style":`Rodzaj obramowania`,"style.field.border-color":`Kolor obramowania`,"style.field.border-radius":`Narożniki`,"style.field.padding":`Wypełnienie`,"style.field.margin-block-start":`Odstęp przed`,"style.field.margin-block-end":`Odstęp po`,"style.field.width":`Szerokość`,"style.field.position":`Położenie`,"style.field.gap":`Odstęp między kolumnami`,"style.field.align-items":`Wyrównanie kolumn`,"style.field.flex-grow":`Udział w szerokości`,"style.field.named":`Styl`,"style.field.own":`Deklaracje CSS`,"style.value.normal":`Normalna`,"style.value.bold":`Pogrubiona`,"style.value.italic":`Pochylona`,"style.value.start":`Do lewej`,"style.value.center":`Do środka`,"style.value.end":`Do prawej`,"style.value.justify":`Wyjustowane`,"style.value.none":`Brak`,"style.value.solid":`Ciągłe`,"style.value.dashed":`Kreskowane`,"style.value.dotted":`Kropkowane`,"style.value.double":`Podwójne`,"style.value.stretch":`Równa wysokość`,"style.named.none":`Bez stylu`,"style.save.label":`Nazwa nowego stylu`,"style.save":`Zapisz jako styl`,"style.refused.property":`„{name}” jest niedozwolone: styl ćwiczenia nie może przenosić go poza jego miejsce, zasłaniać innych treści ani niczego wczytywać.`,"style.refused.value":`Ta wartość „{name}” jest niedozwolona: sprawdź jednostkę i dopuszczalny zakres.`,"style.refused.text":`„{name}” to nie jest deklaracja: wpisz ją jako właściwość: wartość.`,"style.refused.length":`Ten styl jest za długi: najwyżej {max} znaków.`,"style.rules.tags":`Style tekstu`,"style.rules.empty":`Nie masz jeszcze własnych stylów. Dodaj styl tutaj albo zapisz styl elementu.`,"style.rules.edit":`Edytuj styl: {label}`,"style.rules.rename":`Zmień nazwę stylu: {label}`,"style.rules.renameShort":`Zmień nazwę`,"style.rules.renameField":`Nowa nazwa stylu: {label}`,"style.rules.delete":`Usuń styl: {label}`,"style.rules.deleteShort":`Usuń`,"style.rules.newLabel":`Nazwa nowego stylu`,"style.rules.add":`Dodaj styl`,"style.tag.paragraph":`Akapit`,"style.tag.heading":`Nagłówek`,"style.tag.subheading":`Podtytuł`,"style.tag.quote":`Cytat`,"style.tag.list":`Lista`,"style.tag.caption":`Podpis`,"style.tag.picture":`Obrazek`}})),MN,NN=n((()=>{kN(),jN(),eN(),MN=[{namespace:H,locale:`en`,messages:ON},{namespace:H,locale:`pl`,messages:AN}]}));function PN(e){let t=nN(e),n=t.get(`float`);if(n===`inline-start`||n===`left`)return`start`;if(n===`inline-end`||n===`right`)return`end`;if(t.get(`width`)===`100%`&&(t.get(`display`)===`block`||!t.has(`display`)))return`full`;let r=t.get(`margin`)?.split(/\s+/);return t.get(`margin-inline`)===`auto`||[`left`,`right`].every(e=>t.get(`margin-${e}`)===`auto`)||r!==void 0&&r.length===2&&r[1]===`auto`?`center`:`inline`}function FN(e,t,n=!1){let r={};for(let e of VN)r[e]=null;return PN(t)===`full`&&(r.width=null),n&&e===`center`&&(PN(t)===`full`||!nN(t).has(`width`))&&(r.width=`50%`),{...r,...HN[e]}}function IN(e,t){return{width:`${t}%`,...PN(e)===`full`&&t<100?{display:null}:{}}}function LN(e){let t=[],n=[];for(let[r,i]of nN(e))(UN.has(r)?t:n).push(`${r}: ${i}`);return{placed:t.join(`; `),rest:n.join(`; `)}}function RN(e){let t=/^(\d+(?:\.\d+)?)%$/.exec(nN(e).get(`width`)??``);return t===null?null:Number(t[1])}function zN(e,t){let n=e.normalize(`NFD`).replace(/\p{M}/gu,``).replace(/[łŁ]/g,`l`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^[^a-z]+|-+$/g,``).slice(0,56),r=kn(n)?n:`style`;if(r!==`style`&&!t.has(r))return r;let i=1;for(;t.has(`${r}-${i}`);)i++;return`${r}-${i}`}var BN,VN,HN,UN,WN=n((()=>{Or(),lN(),BN=[`inline`,`start`,`end`,`center`,`full`],VN=[`float`,`display`,`margin`,...[`left`,`right`,`bottom`].map(e=>`margin-${e}`),`margin-inline`,`margin-inline-start`,`margin-inline-end`,`margin-block-end`],HN={inline:{},start:{float:`inline-start`,"margin-inline-end":`16px`,"margin-block-end":`8px`},end:{float:`inline-end`,"margin-inline-start":`16px`,"margin-block-end":`8px`},center:{display:`block`,"margin-inline":`auto`},full:{display:`block`,width:`100%`}},UN=new Set([...VN,`width`])}));function GN(e){let t=e==null?null:Mn(e);if(t===null)return null;let n=e=>Math.round(e).toString(16).padStart(2,`0`);return`#${n(t[0])}${n(t[1])}${n(t[2])}`}function KN(e){let{id:t,value:n,t:r,invalid:i,ground:a=!1}=e,o=GN(n),s=e=>`var(--astl-palette-${e}${a?`-soft`:``})`;return I`<div class="swatches" role="group" aria-label=${r(`style.color.theme`)}>
4571
+ </div>`}},Rj={manifest:$p,element:Lj,messages:Pj}})),Bj=[{tag:`astl-gap`,load:async()=>(await Promise.resolve().then(()=>(ED(),vD))).gapElement},{tag:`astl-choice`,load:async()=>(await Promise.resolve().then(()=>(HD(),RD))).choiceElement},{tag:`astl-select`,load:async()=>(await Promise.resolve().then(()=>(cO(),KD))).selectElement},{tag:`astl-true-false`,load:async()=>(await Promise.resolve().then(()=>(_O(),fO))).trueFalseElement},{tag:`astl-order`,load:async()=>(await Promise.resolve().then(()=>(LO(),OO))).orderElement},{tag:`astl-categorise`,load:async()=>(await Promise.resolve().then(()=>(ZO(),UO))).categoriseElement},{tag:`astl-match`,load:async()=>(await Promise.resolve().then(()=>(ck(),tk))).matchElement},{tag:`astl-word-bank`,load:async()=>(await Promise.resolve().then(()=>(yk(),fk))).wordBankElement},{tag:`astl-drop`,load:async()=>(await Promise.resolve().then(()=>(Ok(),Ck))).dropElement},{tag:`astl-word-search`,load:async()=>(await Promise.resolve().then(()=>(Bk(),Mk))).wordSearchElement},{tag:`astl-memory`,load:async()=>(await Promise.resolve().then(()=>(Qk(),Wk))).memoryElement},{tag:`astl-crossword`,load:async()=>(await Promise.resolve().then(()=>(cA(),nA))).crosswordElement},{tag:`astl-flash-cards`,load:async()=>(await Promise.resolve().then(()=>(gA(),fA))).flashCardsElement},{tag:`astl-long-answer`,load:async()=>(await Promise.resolve().then(()=>(TA(),bA))).longAnswerElement},{tag:`astl-mark-words`,load:async()=>(await Promise.resolve().then(()=>(NA(),kA))).markWordsElement},{tag:`astl-callout`,load:async()=>(await Promise.resolve().then(()=>(VA(),LA))).calloutElement},{tag:`astl-hotspot`,load:async()=>(await Promise.resolve().then(()=>(ij(),ej))).hotspotElement},{tag:`astl-image-drop`,load:async()=>(await Promise.resolve().then(()=>(hj(),cj))).imageDropElement},{tag:`astl-image-label`,load:async()=>(await Promise.resolve().then(()=>(Cj(),yj))).imageLabelElement},{tag:`astl-video`,load:async()=>(await Promise.resolve().then(()=>(Mj(),Dj))).videoElement},{tag:`astl-audio`,load:async()=>(await Promise.resolve().then(()=>(zj(),Ij))).audioElement}];function Vj(e){return e===32||e===9||e===10||e===12||e===13}function Hj(e){return e>=65&&e<=90||e>=97&&e<=122}function Uj(e,t){if(e.startsWith(`<!-->`,t))return t+5;if(e.startsWith(`<!--->`,t))return t+6;let n=[e.indexOf(`-->`,t+4),e.indexOf(`--!>`,t+4)].filter(e=>e>=0);if(n.length===0)return e.length;let r=Math.min(...n);return r+(e.startsWith(`-->`,r)?3:4)}function Wj(e,t){let n=e.indexOf(`>`,t);return n<0?e.length:n+1}function Gj(e,t,n){let r=RegExp(`</${n}(?=[\\t\\n\\f\\r />])`,`gi`);return r.lastIndex=t,r.exec(e)?.index??e.length}function Kj(e,t,n){let r=e.length,i=t+(n===`end`?2:1),a=i;for(;i<r;){let t=e.charCodeAt(i);if(Vj(t)||t===47||t===62)break;i++}let o=e.slice(a,i).toLowerCase(),s=[],c=(e,r)=>({type:n,name:o,start:t,end:e,attributes:s,selfClosing:r});for(;i<r;){let t=e.charCodeAt(i);if(Vj(t)){i++;continue}if(t===62)return c(i+1,!1);if(t===47){if(e.charCodeAt(i+1)===62)return c(i+2,!0);i++;continue}let n=i;for(i++;i<r;){let t=e.charCodeAt(i);if(Vj(t)||t===47||t===62||t===61)break;i++}let a=e.slice(n,i).toLowerCase(),o=i;for(;o<r&&Vj(e.charCodeAt(o));)o++;if(e.charCodeAt(o)!==61){s.push({name:a,raw:null,start:n,end:i});continue}for(o++;o<r&&Vj(e.charCodeAt(o));)o++;let l=e[o];if(l===`"`||l===`'`){let t=e.indexOf(l,o+1),c=t<0?r:t+1;s.push({name:a,raw:e.slice(o+1,t<0?r:t),start:n,end:c}),i=c}else{let t=o;for(;t<r&&!Vj(e.charCodeAt(t))&&e.charCodeAt(t)!==62;)t++;s.push({name:a,raw:e.slice(o,t),start:n,end:t}),i=t}}return c(r,!1)}function qj(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.indexOf(`<`,r);if(i<0)break;r=i;let a=e.charCodeAt(r+1);if(e.startsWith(`<!--`,r))r=Uj(e,r);else if(a===33||a===63)r=Wj(e,r+2);else if(a===47){let n=e.charCodeAt(r+2);if(Hj(n)){let n=Kj(e,r,`end`);t.push(n),r=n.end}else r=n===62?r+3:Wj(e,r+2)}else if(Hj(a)){let i=Kj(e,r,`start`);t.push(i),r=i.end,oM.has(i.name)?r=Gj(e,r,i.name):i.name===`plaintext`&&(r=n)}else r++}return t}function Jj(e){return e.includes(`-`)}function Yj(e){let t=[],n=[],r=e=>(n[n.length-1]?.children??t).push(e),i=(e,t,n)=>r({name:e.name,start:e.start,end:t,startTag:e.startTag,endTag:n,children:e.children});for(let t of qj(e)){if(t.type===`start`){sM.has(t.name)||t.selfClosing&&Jj(t.name)?r({name:t.name,start:t.start,end:t.end,startTag:t,endTag:null,children:[]}):n.push({name:t.name,start:t.start,startTag:t,children:[]});continue}let e=n.length-1;for(;e>=0&&n[e]?.name!==t.name;)e--;if(!(e<0)){for(;n.length-1>e;)i(n.pop(),t.start,null);i(n.pop(),t.end,t)}}for(;n.length>0;)i(n.pop(),e.length,null);return t}function Xj(e){if(!e.includes(`&`))return e;let[t]=Rc(`<b title="${e.replaceAll(`"`,`&quot;`)}"></b>`);return t?.type===`element`?t.attrs.title??e:e}function Zj(e,t){let n=e.attributes.find(e=>e.name===t);return n===void 0?null:n.raw===null?``:Xj(n.raw)}function Qj(e){let t=[],n=e=>{for(let r of e){let{name:e}=r;if(e===`astl-style`||e===`astl-columns`||e===`astl-column`||Je.has(e))n(r.children);else{if(e===`astl-page`||Jj(e)&&e!==cM){let n=Zj(r.startTag,`id`);if(t.push({tag:e,id:n,start:r.start,end:r.end,range:r}),e!==`astl-page`)continue}n(r.children)}}};return n(Yj(e)),t}function $j(e){return Qj(e).map(({tag:e,id:t,start:n,end:r})=>({tag:e,id:t,start:n,end:r}))}function eM(e){let t=new Set;for(let n of qj(e)){if(n.type!==`start`)continue;let e=Zj(n,`id`);e!==null&&t.add(e)}return t}function tM(e){return e.replace(uM,mM)}function nM(e){return e.replace(dM,mM)}function rM(e){return e.replace(fM,mM)}function iM(e,t){let n=e;for(let e of[...t].sort((e,t)=>t.start-e.start))n=n.slice(0,e.start)+e.text+n.slice(e.end);return n}function aM(e,t){let n=t;for(;n>0&&Vj(e.charCodeAt(n-1));)n--;return n}var oM,sM,cM,lM,uM,dM,fM,pM,mM,hM=n((()=>{w(),Qp(),oM=new Set([`script`,`style`,`textarea`,`title`,`xmp`,`iframe`,`noembed`,`noframes`,`noscript`]),sM=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),cM=`astl-doc`,lM=String.fromCodePoint(160),uM=RegExp(`[&<>${lM}]`,`g`),dM=RegExp(`[&"<>${lM}]`,`g`),fM=RegExp(`[&<>"'${lM}]`,`g`),pM={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,[lM]:`&nbsp;`},mM=e=>pM[e]??e}));function gM(e,t,n,r){if(!TM.test(n))throw TypeError(`Invalid attribute name "${n}"`);let i=t.attributes.filter(e=>e.name===n),a=i[0];if(r===null||r===!1)return i.map(t=>({start:aM(e,t.start),end:t.end,text:``}));if(a!==void 0){let e=Zj(t,n)??``;if(r===!0?e===``||e.toLowerCase()===n:e===r)return[]}let o=r===!0?n:`${n}="${nM(r)}"`;if(a!==void 0)return[{start:a.start,end:a.end,text:o}];let s=t.attributes[t.attributes.length-1]?.end??t.start+1+t.name.length;return[{start:s,end:s,text:` ${o}`}]}function _M(e,t){return e.children.flatMap(e=>e.name===t?[e]:_M(e,t))}function vM(e,t){let[n]=Rc(e.slice(t.start,t.end));return h(n)?g(n):``}function yM(e){return e.endTag?.start??e.end}function bM(e,t,n){let r=t.startTag;if(r.selfClosing&&t.endTag===null){let i=e.slice(r.start,aM(e,r.end-2));return{start:t.start,end:t.end,text:`${i}>${n}</${t.name}>`}}return{start:r.end,end:yM(t),text:n}}function xM(e,t,n){return t.startTag.selfClosing&&t.endTag===null?bM(e,t,n):t.endTag===null?{start:t.end,end:t.end,text:`${n}</${t.name}>`}:{start:t.endTag.start,end:t.endTag.start,text:n}}function SM(e,t,n){let[r,i]=n;if(r===void 0)return``;let a=i===void 0?e.slice(Math.max(t.startTag.end,aM(e,r.start)),r.start):e.slice(r.end,i.start);return/^\s*$/.test(a)?a:``}function CM(e,t,n,r){let i=_M(t,n),a=[];if(i.forEach((t,n)=>{let i=r[n];i===void 0?a.push({start:aM(e,t.start),end:t.end,text:``}):vM(e,t)!==i&&a.push(bM(e,t,tM(i)))}),r.length>i.length){let o=SM(e,t,i),s=r.slice(i.length).map(e=>`<${n}>${tM(e)}</${n}>`),c=i[i.length-1];c===void 0?a.push(xM(e,t,s.join(o))):a.push({start:c.end,end:c.end,text:s.map(e=>o+e).join(``)})}return a}function wM(e,t){let n=Yj(e)[0];if(n===void 0)return e;switch(t.kind){case`attribute`:return iM(e,gM(e,n.startTag,t.name,t.value));case`child-flag`:case`child-choice`:{let r=_M(n,t.tag)[t.index];return r===void 0?e:iM(e,gM(e,r.startTag,t.attribute,t.value))}case`text-list`:return iM(e,CM(e,n,t.tag,t.values));case`child-attributes`:{let n=e;for(let[e,r]of Object.entries(t.attributes))n=wM(n,{kind:`child-choice`,tag:t.tag,attribute:e,index:t.index,value:r});return n}case`child-add`:{if(!TM.test(t.tag))throw TypeError(`Invalid tag name "${t.tag}"`);let r=Object.entries(t.attributes).map(([e,t])=>{if(!TM.test(e))throw TypeError(`Invalid attribute name "${e}"`);return` ${e}="${nM(t)}"`}),i=`<${t.tag}${r.join(``)}></${t.tag}>`,a=_M(n,t.tag),o=a.at(-1)??n.children.at(-1);if(o===void 0)return iM(e,[xM(e,n,i)]);let s=SM(e,n,a.length>0?a:n.children);return iM(e,[{start:o.end,end:o.end,text:s+i}])}case`child-remove`:{let r=_M(n,t.tag)[t.index];return r===void 0?e:iM(e,[{start:aM(e,r.start),end:r.end,text:``}])}}}var TM,EM=n((()=>{w(),Qp(),hM(),TM=/^[a-z][a-z0-9-]*$/}));function DM(e){let t=e=>({kind:`attribute`,name:e.name,label:`editor.${e.name}`}),n=e=>e.visibility!==`derived`,r=e.scoring===null?[]:[`scoring`,`points`],i=jt(e).filter(e=>r.includes(e.name));return[...e.attributes.filter(n).map(t),...e.children.filter(e=>e.visibility===`private`&&e.content===`text`).map(e=>({kind:`text-list`,tag:e.tag,label:`editor.${e.tag}`})),...e.children.flatMap(e=>e.attributes.filter(e=>(e.type===`boolean`||e.type===`enum`)&&n(e)).map(t=>({kind:t.type===`boolean`?`child-flag`:`child-choice`,tag:e.tag,attribute:t.name,label:`editor.${e.tag}.${t.name}`}))),...i.map(t)]}function OM(e,t,n){return(t.name===`scoring`&&e.scoring!==null?Object.keys(e.scoring.modes):[...t.values??[]]).map(e=>({value:e,label:n.message(`editor.value.${t.name}.${e}`,e)}))}function kM(e,t){return t.name===`scoring`&&e.scoring!==null?e.scoring.default:t.default===void 0?null:String(t.default)}function AM(e,t,n,r,i=n.name,a=()=>null){let o=jt(t).find(e=>e.name===n.name);if(o===void 0)return null;let s=o.name,c=r.message(n.label,i),l=n.help===void 0?null:r.message(n.help,``),u={kind:`attribute`,name:s,label:c,help:l===``?null:l},d=GM(e,s),f=o.required===!0,p=n.options===void 0?null:a(GM(e,n.options.from)??``);if(p!==null&&n.options!==void 0){let e=d??``;return{...u,control:`select`,value:e,options:RM(p,n.options.tag,r)(e)}}let m=s===`scoring`&&t.scoring!==null;if(o.type===`enum`||m){let e=OM(t,o,r),n=d??kM(t,o)??``;return n===``&&!e.some(e=>e.value===``)?e.unshift({value:``,label:r.unset}):e.some(e=>e.value===n)||e.push({value:n,label:n}),{...u,control:`select`,value:n,options:e}}if(o.type===`number`||o.type===`integer`)return{...u,control:`number`,value:d??kM(t,o)??``,min:o.min??null,max:o.max??null,step:o.type===`integer`?`1`:`any`,required:f};if(o.type===`boolean`)return{...u,control:`checkbox`,checked:d!==null};let h=o.type===`url`?n.accept??null:null;return{...u,control:`text`,value:d??``,required:f,accept:h}}function jM(e){return new Map(e.flatMap(e=>e.kind===`picture-regions`||e.kind===`picture-points`?[[e.tag,e.kind]]:[]))}function MM(e,t){let n=e.children.find(e=>e.tag===t)?.attributes.find(e=>e.name===`shape`);if(n===void 0)return[`rect`];let r=[`rect`,`circle`,`polygon`].filter(e=>n.values?.includes(e));return r.length>0?r:[`rect`]}function NM(e,t,n,r,i=[n],a=()=>null){let o=n.help===void 0?null:r.message(n.help,``)||null,s=`tag`in n?jM(i).get(n.tag):void 0,c=(e,t)=>LM(e,t,r,s);switch(n.kind){case`attribute`:return AM(e,t,n,r,n.name,a);case`text-list`:return{kind:`text-list`,tag:n.tag,label:r.message(n.label,n.tag),help:o,values:KM(e,n.tag).map(g),max:t.children.find(e=>e.tag===n.tag)?.max??null,multiline:n.multiline===!0};case`child-flag`:{let t=KM(e,n.tag).map((e,t)=>({index:t,id:GM(e,`id`),label:c(e,t),checked:GM(e,n.attribute)!==null})),i={count:t.length,checked:t.filter(e=>e.checked).length},a=`${n.tag} ${n.attribute}`,o=n.help===void 0?null:r.message(n.help,``,i)||null;return{kind:`child-flag`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,a,i),help:o,children:t}}case`child-text`:return{kind:`child-text`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,`${n.tag} ${n.attribute}`),help:o,children:KM(e,n.tag).map((e,t)=>({index:t,id:GM(e,`id`),label:c(e,t),value:GM(e,n.attribute)??``}))};case`child-choice`:{let i=zM(e,t,n,r);return i===null?null:{kind:`child-choice`,tag:n.tag,attribute:n.attribute,label:r.message(n.label,`${n.tag} ${n.attribute}`),help:o,control:i.control,children:KM(e,n.tag).map((e,t)=>{let r=GM(e,n.attribute)??``,a=i.options(r);return{index:t,id:GM(e,`id`),label:c(e,t),value:r,options:a}})}}case`child-table`:return PM(e,t,n,r,o);case`picture-regions`:case`picture-points`:{let a={tag:n.tag,label:r.message(n.label,n.tag),help:o,elementTag:e.tag,srcAttribute:n.src,src:GM(e,n.src)??``},s=KM(e,n.tag);if(n.kind===`picture-points`)return{...a,kind:`picture-points`,points:s.map((e,t)=>({index:t,id:GM(e,`id`)??``,x:FM(GM(e,`x`)),y:FM(GM(e,`y`)),label:GM(e,`label`)??``}))};let c=i.find(e=>e.kind===`child-flag`&&e.tag===n.tag),l=c!==void 0&&`attribute`in c?c.attribute:null;return{...a,kind:`picture-regions`,shapes:MM(t,n.tag),flag:l,regions:s.map((e,t)=>{let n=GM(e,`shape`);return{index:t,id:GM(e,`id`)??``,shape:n===`circle`||n===`polygon`?n:`rect`,x:FM(GM(e,`x`)),y:FM(GM(e,`y`)),width:FM(GM(e,`width`)),height:FM(GM(e,`height`)),r:FM(GM(e,`r`)),points:IM(GM(e,`points`)),label:GM(e,`label`)??``,flagged:l!==null&&GM(e,l)!==null}})}}}}function PM(e,t,n,r,i){let a=t.children.find(e=>e.tag===n.tag);if(a===void 0)return null;let o=n.columns.flatMap(e=>{let t=a.attributes.find(t=>t.name===e.attribute);if(t===void 0)return[];let n=t.type===`integer`||t.type===`number`;return[{attribute:t.name,label:r.message(e.label,t.name),control:t.type===`enum`?`select`:n?`number`:`text`,options:(t.values??[]).map(e=>({value:e,label:r.message(`editor.value.${t.name}.${e}`,e)})),min:t.min??null,max:t.max??null,step:t.type===`integer`?`1`:`any`,required:t.required===!0}]}),s=KM(e,n.tag),c=n.tag.replace(/^astl-/,``),l=new Set(s.map(e=>GM(e,`id`))),u=s.length+1;for(;l.has(`${c}-${u}`);)u++;let d={id:`${c}-${u}`};for(let e of a.attributes)e.required===!0&&e.name!==`id`&&(d[e.name]=e.values?.[0]??(e.min===void 0?``:String(e.min)));return{kind:`child-table`,tag:n.tag,label:r.message(n.label,n.tag),help:i,columns:o,rows:s.map((e,t)=>({index:t,id:GM(e,`id`),label:LM(e,t,r),values:o.map(t=>GM(e,t.attribute)??``)})),added:d,min:a.min,max:a.max}}function FM(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}function IM(e){return(e??``).trim().split(/\s+/).filter(e=>e!==``).map(e=>{let[t=``,n=``]=e.split(`,`);return[FM(t),FM(n)]})}function LM(e,t,n,r){let i=qM(e).replace(/\s+/g,` `).trim();return i!==``||r===void 0?i||n.untitled(t+1):(GM(e,`label`)??``).replace(/\s+/g,` `).trim()||(r===`picture-regions`?n.region(t+1):n.point(t+1))}function RM(e,t,n){let r=KM(e,t).flatMap((e,t)=>{let r=GM(e,`id`);return r===null||r===``?[]:[{value:r,label:LM(e,t,n)}]});return e=>e===``?[{value:``,label:n.unset},...r]:r.some(t=>t.value===e)?r:[...r,{value:e,label:e}]}function zM(e,t,n,r){if(n.options===void 0){let e=t.children.find(e=>e.tag===n.tag)?.attributes.find(e=>e.name===n.attribute);if(e?.type!==`enum`)return null;let i=(e.values??[]).map(t=>({value:t,label:r.message(`editor.value.${e.name}.${t}`,t)}));return{control:`radios`,options:()=>i}}return{control:`select`,options:RM(e,n.options,r)}}function BM(e,t,n,r){let i=GM(e,`style-template`)??``,a=[{value:``,label:n},...r];return a.some(e=>e.value===i)||a.push({value:i,label:i}),{kind:`attribute`,control:`select`,name:wt,label:t,help:null,value:i,options:a}}function VM(e,t){if(t.variants===null)return null;let n=GM(e,`variant`);return n!==null&&t.variants.values.includes(n)?n:t.variants.default}function HM(e,t){return e.kind!==`attribute`||e.variants===void 0||e.variants.includes(t??``)}function UM(e,t,n,r,i){let a=e=>n.some(t=>t.kind===`attribute`&&t.name===e),o=[];if(t.variants!==null&&!a(`variant`)){let n=AM(e,t,{kind:`attribute`,name:`variant`,label:`editor.variant`},r,r.variant);n!==null&&o.push(n)}let s=GM(e,wt)!==null;if((i.length>0||s)&&!a(`style-template`)){let t=r.message(`editor.${wt}`,r.styleTemplate);o.push(BM(e,t,r.sameAsDocument,i))}return o}function WM(e,t,n,r,i=[],a=()=>null){let o=n?.fields??DM(t),s=VM(e,t),c=o.filter(e=>HM(e,s)).flatMap(n=>NM(e,t,n,r,o,a)??[]);return{tag:e.tag,id:GM(e,`id`),label:n===null?e.tag:r.message(n.label,e.tag),icon:n?.icon??null,fields:[...c,...UM(e,t,c,r,i)]}}var GM,KM,qM,JM=n((()=>{w(),GM=(e,t)=>Object.hasOwn(e.attrs,t)?e.attrs[t]??``:null,KM=(e,t)=>e.children.flatMap(e=>e.type===`element`?e.tag===t?[e]:KM(e,t):[]),qM=e=>e.type===`text`?e.value:e.tag===`img`?` ${e.attrs.alt??``} `:e.children.map(qM).join(``)})),YM,XM=n((()=>{YM={"insert.title":`Insert`,"insert.components":`Components`,"insert.exercises":`Exercises`,"insert.content":`Content`,"insert.picture":`Picture`,"insert.picture.description":`A picture with alt text and an optional caption`,"insert.pageBreak":`Page break`,"insert.pageBreak.description":`Split the exercise into steps at the cursor`,"insert.hint":`Hint`,"insert.hint.description":`One students ask for: for the question at the cursor, else for the page`,"insert.explanation":`Explanation`,"insert.explanation.description":`Why the answer is right, shown once it is checked`,"insert.feedback":`Feedback`,"insert.feedback.description":`A text by the verdict, shown once the answer is checked`,"insert.text":`Text`,"insert.text.description":`A paragraph after this block`,"insert.noMatch":`Nothing matches “{query}”.`,"toolbar.label":`Format and insert`,"toolbar.style":`Text style: {style}`,"toolbar.paragraph":`Paragraph`,"toolbar.heading":`Heading`,"toolbar.subheading":`Subheading`,"toolbar.bold":`Bold`,"toolbar.italic":`Italic`,"toolbar.underline":`Underline`,"toolbar.link":`Link`,"toolbar.link.address":`Link address`,"toolbar.link.apply":`Apply`,"toolbar.link.remove":`Remove link`,"toolbar.link.blocked":`This address is not allowed here.`,"toolbar.bulleted":`Bulleted list`,"toolbar.numbered":`Numbered list`,"toolbar.undo":`Undo`,"toolbar.redo":`Redo`,"toolbar.elements":`Elements`,"toolbar.templates":`Templates`,"toolbar.layouts":`Layout`,"toolbar.view":`View`,"toolbar.search":`Search`,"block.text":`Text`,"block.gap":`Gap`,"issue.onPage":`{n} on page {page}`,"picture.title":`Add a picture`,"picture.editTitle":`Edit the picture`,"picture.file":`Upload a picture`,"picture.library":`Choose from the library`,"picture.urlOnly":`This editor adds pictures by their address only: it has no upload.`,"picture.src":`Picture address (URL)`,"picture.alt":`Alt text`,"picture.altHelp":`What the picture shows, for students who cannot see it. Do not give an answer away.`,"picture.decorative":`Decorative: screen readers skip it (alt="")`,"picture.caption":`Caption (optional)`,"picture.cancel":`Cancel`,"picture.insert":`Insert`,"picture.save":`Save`,"picture.uploading":`Uploading…`,"picture.uploaded":`Uploaded.`,"picture.uploadFailed":`The upload failed. Try again, or give the picture's address.`,"picture.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"picture.picked":`Chosen from the library.`,"picture.pickFailed":`The library did not open. Try again, or give the picture's address.`,"picture.pickBlocked":`The library returned an address the URL policy does not allow.`,"picture.srcMissing":`Give the picture's address, or upload it.`,"picture.srcBlocked":`The URL policy does not allow this address.`,"picture.altMissing":`Describe the picture, or mark it as decorative.`,"picture.altRequired":`Describe the picture: students who cannot see it need its alt text for the task.`,"picture.pasteRefused":`This editor has no upload, so a picture file cannot be pasted or dropped. Add it with Insert, Picture, by its address.`,"field.picture.src":`Picture address (URL)`,"field.regions.draw":`Drag on the picture to draw a zone, or add one and type its numbers.`,"field.points.place":`Click the picture to place a pin, or add one and type its position.`,"field.region":`Zone {n}`,"field.region.add":`Add a zone`,"field.region.remove":`Remove zone {n}`,"field.point":`Pin {n}`,"field.point.add":`Add a pin`,"field.point.remove":`Remove pin {n}`,"field.shape":`Shape`,"field.shape.rect":`Rectangle`,"field.shape.circle":`Circle`,"field.shape.polygon":`Polygon`,"field.x":`From the left (%)`,"field.y":`From the top (%)`,"field.width":`Width (%)`,"field.height":`Height (%)`,"field.cx":`Centre from the left (%)`,"field.cy":`Centre from the top (%)`,"field.r":`Radius (% of the width)`,"field.vertex.x":`Point {n} from the left (%)`,"field.vertex.y":`Point {n} from the top (%)`,"field.vertex.add":`Add a point`,"field.vertex.remove":`Remove point {n}`,"field.label":`Label`,"field.label.optional":`Label (optional)`,"field.more":`Only the first {shown} of {count} are listed here: edit the others in the source.`,"inspector.title":`Properties`,"inspector.delete":`Delete`,"inspector.moveUp":`Move up`,"inspector.moveDown":`Move down`,"inspector.empty":`Put the cursor in an exercise element to edit its answers and settings.`,"inspector.unsupported":`Element {tag} cannot be edited here.`,"inspector.unset":`(not set)`,"inspector.item":`{label} {n}`,"inspector.add":`Add`,"inspector.remove":`Remove`,"inspector.removeItem":`Remove: {label} {n}`,"inspector.untitled":`Item {n} (empty)`,"inspector.variant":`Variant`,"inspector.styleTemplate":`Element style`,"inspector.styleTemplate.inherit":`Same as the exercise`,"inspector.styleTemplate.default":`Default look`,"inspector.document":`Exercise`,"inspector.documentStyle":`Look of the whole exercise`,"inspector.upload":`Upload a file`,"inspector.uploadItem":`Upload a file: {label}`,"inspector.uploading":`Uploading…`,"inspector.uploaded":`Uploaded.`,"inspector.uploadFailed":`The upload failed. Try again, or type its address.`,"inspector.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"issues.title":`Problems`,"issues.errors":`{count, plural, one {# error} other {# errors}}`,"issues.warnings":`{count, plural, one {# warning} other {# warnings}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`No errors or warnings.`,"severity.error":`Error`,"severity.warning":`Warning`,"label.text":`{label}: {text}`,"preview.title":`Student view`,"preview.show":`Preview`,"preview.refresh":`Refresh preview`,"preview.hint":`Press Preview to try the exercise the way a student will see it.`,"preview.loading":`Preparing the preview…`,"preview.stale":`The document changed after this preview. Refresh it to see the changes.`,"preview.invalid":`{count, plural, one {Fix this error to see the preview:} other {Fix these # errors to see the preview:}}`,"preview.failed":`The preview could not be shown.`,"surface.label":`Exercise content`,"surface.pageNumber":`Page {page} of {pages}`,"surface.pageTitle":`Page title`,"surface.pageJoin":`Join with page {previous}`,"surface.pageAdded":`Page {page} added`,"surface.pageJoined":`Page {page} joined with page {previous}`,"surface.pageDelete":`Delete page`,"surface.pageDeleted":`Deleted page {n}`,"surface.pageAddTitle":`Add title`,"surface.pageRemoveTitle":`Remove title`,"surface.pageTitleOf":`Title of page {page}`,"surface.pageTitleRemoved":`Removed the title of page {page}`,"surface.points":`{points, plural, one {# pt} other {# pts}}`,"surface.items":`{n, plural, one {# item} other {# items}}`,"surface.blockMovedUp":`Block moved up, now block {n}`,"surface.blockMovedDown":`Block moved down, now block {n}`,"surface.blockRemoved":`Block {n} deleted`,"surface.addOption":`Add option`,"surface.addPrompt":`Add prompt`,"surface.chip.empty":`No answer`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Picture: {alt}`,"surface.picture.decorative":`Picture, decorative (no alt text)`,"surface.picture.noAlt":`Picture without alt text`,"surface.picture.blocked":`(not shown: the URL policy does not allow its address)`,"surface.picture.edit":`Edit`,"surface.loading":`Loading the editor…`,"surface.failed":`The editor could not be loaded. Reload the page to try again.`,"view.visual":`Visual`,"view.source":`HTML`,"view.visualHint":`Edit the exercise as formatted text`,"view.sourceHint":`Edit the exercise as HTML`,"view.sourceLabel":`The exercise as HTML`,"view.sourceErrors":`{n, plural, one {The HTML has # error. Fix it to go back.} other {The HTML has # errors. Fix them to go back.}}`,"status.elements":`{n, plural, one {# element} other {# elements}}`,"status.errors":`{n, plural, one {# error} other {# errors}}`,"status.warnings":`{n, plural, one {# warning} other {# warnings}}`,"status.ready":`Ready to share`,"insert.layouts":`Layout`,"insert.layout.two":`Two columns`,"insert.layout.two.description":`Two columns of the same width.`,"insert.layout.three":`Three columns`,"insert.layout.three.description":`Three columns of the same width.`,"insert.layout.wide-narrow":`Wide + narrow`,"insert.layout.wide-narrow.description":`A wide column, then a narrow one.`,"insert.layout.narrow-wide":`Narrow + wide`,"insert.layout.narrow-wide.description":`A narrow column, then a wide one.`,"insert.layout.picture-text":`Picture beside text`,"insert.layout.picture-text.description":`A picture you choose, with text next to it.`,"layout.section":`Columns`,"layout.change":`Change layout`,"layout.other":`Another layout`,"layout.unwrap":`Remove layout`,"layout.delete":`Delete with content`,"layout.confirm":`Delete the layout and its content?`,"layout.confirmDelete":`Yes, delete`,"layout.cancel":`Cancel`,"toolbar.font":`Font: {value}`,"toolbar.font.name":`Font`,"toolbar.size":`Size: {value}`,"toolbar.size.name":`Size`,"toolbar.color":`Text colour`,"toolbar.highlight":`Highlight`,"toolbar.align":`Alignment`,"toolbar.align.start":`Left`,"toolbar.align.center":`Centre`,"toolbar.align.end":`Right`,"toolbar.align.justify":`Justified`,"toolbar.spacing":`Spacing`,"toolbar.spacing.line":`Line height`,"toolbar.spacing.after":`Space after`,"toolbar.spacing.none":`None`,"toolbar.spacing.small":`Small`,"toolbar.spacing.medium":`Medium`,"toolbar.spacing.large":`Large`,"toolbar.clear":`Clear formatting`,"toolbar.default":`Default`,"toolbar.myStyles":`My styles`,"toolbar.readyStyles":`Ready styles`,"style.preset.note":`Note`,"style.preset.tip":`Tip`,"style.preset.important":`Important`,"style.preset.definition":`Definition`,"style.preset.example":`Example`,"style.preset.quote":`Quote`,"style.preset.highlight":`Highlight`,"style.preset.small-print":`Small print`,"style.color.theme":`Theme colours`,"style.color.swatch":`Theme colour {n}`,"style.color.custom":`Custom colour`,"style.color.picker":`Pick a colour`,"style.color.invalid":`Write a colour as #rrggbb.`,"style.color.none":`No colour`,"style.close":`Close`,"style.form.none":`Put the cursor in what you want to style.`,"style.target.picture":`Picture style`,"style.target.figure":`Picture and caption style`,"style.target.block":`Block style`,"style.target.component":`Element style`,"style.target.column":`Column style`,"style.target.layout":`Layout style`,"style.position.inline":`In the text`,"style.position.start":`On the left`,"style.position.end":`On the right`,"style.position.center":`Centred`,"style.position.full":`Full width`,"style.rules.open":`Manage styles…`,"style.rules.title":`Styles`,"inspector.style":`Style`,"surface.picture.place":`Position and size: {position}, {width}`,"surface.picture.placeAuto":`Position and size: {position}`,"style.target.more":`{target}…`,"help.cost":`costs {percent}%`,"help.when.correct":`Correct`,"help.when.incorrect":`Wrong`,"help.when.partial":`Partly correct`,"help.when.omitted":`Skipped`,"help.costLabel":`Cost of the hint`,"help.whenLabel":`For the result`,"surface.helpRemove":`{kind, select, hint {Remove the hint} explanation {Remove the explanation} other {Remove the feedback}}`}})),ZM,QM=n((()=>{ZM={"insert.title":`Wstaw`,"insert.components":`Elementy`,"insert.exercises":`Ćwiczenia`,"insert.content":`Treść`,"insert.picture":`Obrazek`,"insert.picture.description":`Obrazek z tekstem alternatywnym i podpisem do wyboru`,"insert.pageBreak":`Podział strony`,"insert.pageBreak.description":`Podziel ćwiczenie na kroki od miejsca kursora`,"insert.hint":`Podpowiedź`,"insert.hint.description":`Na prośbę ucznia: do pytania przy kursorze, a poza nim do strony`,"insert.explanation":`Wyjaśnienie`,"insert.explanation.description":`Dlaczego odpowiedź jest dobra, widoczne po sprawdzeniu`,"insert.feedback":`Informacja zwrotna`,"insert.feedback.description":`Tekst zależny od wyniku, widoczny po sprawdzeniu`,"insert.text":`Tekst`,"insert.text.description":`Akapit po tym bloku`,"insert.noMatch":`Nic nie pasuje do „{query}”.`,"toolbar.label":`Formatowanie i wstawianie`,"toolbar.style":`Styl tekstu: {style}`,"toolbar.paragraph":`Akapit`,"toolbar.heading":`Nagłówek`,"toolbar.subheading":`Podtytuł`,"toolbar.bold":`Pogrubienie`,"toolbar.italic":`Kursywa`,"toolbar.underline":`Podkreślenie`,"toolbar.link":`Link`,"toolbar.link.address":`Adres linku`,"toolbar.link.apply":`Zastosuj`,"toolbar.link.remove":`Usuń link`,"toolbar.link.blocked":`Tego adresu nie można tu użyć.`,"toolbar.bulleted":`Lista punktowana`,"toolbar.numbered":`Lista numerowana`,"toolbar.undo":`Cofnij`,"toolbar.redo":`Ponów`,"toolbar.elements":`Elementy`,"toolbar.templates":`Szablony`,"toolbar.layouts":`Układ`,"toolbar.view":`Widok`,"toolbar.search":`Szukaj`,"block.text":`Tekst`,"block.gap":`Luka`,"issue.onPage":`{n} na stronie {page}`,"picture.title":`Dodaj obrazek`,"picture.editTitle":`Edytuj obrazek`,"picture.file":`Wgraj obrazek`,"picture.library":`Wybierz z biblioteki`,"picture.urlOnly":`Ten edytor dodaje obrazki tylko po adresie: nie ma wgrywania.`,"picture.src":`Adres obrazka (URL)`,"picture.alt":`Tekst alternatywny`,"picture.altHelp":`Co przedstawia obrazek, dla uczniów, którzy go nie widzą. Nie zdradzaj odpowiedzi.`,"picture.decorative":`Ozdobny: czytniki ekranu go pomijają (alt="")`,"picture.caption":`Podpis (opcjonalny)`,"picture.cancel":`Anuluj`,"picture.insert":`Wstaw`,"picture.save":`Zapisz`,"picture.uploading":`Wgrywam…`,"picture.uploaded":`Wgrano.`,"picture.uploadFailed":`Nie udało się wgrać obrazka. Spróbuj ponownie albo podaj jego adres.`,"picture.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"picture.picked":`Wybrano z biblioteki.`,"picture.pickFailed":`Nie udało się otworzyć biblioteki. Spróbuj ponownie albo podaj adres obrazka.`,"picture.pickBlocked":`Biblioteka zwróciła adres, na który nie pozwala polityka adresów.`,"picture.srcMissing":`Podaj adres obrazka albo go wgraj.`,"picture.srcBlocked":`Polityka adresów nie pozwala na ten adres.`,"picture.altMissing":`Opisz obrazek albo oznacz go jako ozdobny.`,"picture.altRequired":`Opisz obrazek: uczniowie, którzy go nie widzą, potrzebują tekstu alternatywnego do zadania.`,"picture.pasteRefused":`Ten edytor nie ma wgrywania, więc nie można wkleić ani upuścić pliku obrazka. Dodaj go przez Wstaw, Obrazek, podając adres.`,"field.picture.src":`Adres obrazka (URL)`,"field.regions.draw":`Przeciągnij po obrazku, aby narysować strefę, albo dodaj ją i wpisz jej liczby.`,"field.points.place":`Kliknij obrazek, aby wbić pinezkę, albo dodaj ją i wpisz jej położenie.`,"field.region":`Strefa {n}`,"field.region.add":`Dodaj strefę`,"field.region.remove":`Usuń strefę {n}`,"field.point":`Pinezka {n}`,"field.point.add":`Dodaj pinezkę`,"field.point.remove":`Usuń pinezkę {n}`,"field.shape":`Kształt`,"field.shape.rect":`Prostokąt`,"field.shape.circle":`Koło`,"field.shape.polygon":`Wielokąt`,"field.x":`Od lewej (%)`,"field.y":`Od góry (%)`,"field.width":`Szerokość (%)`,"field.height":`Wysokość (%)`,"field.cx":`Środek od lewej (%)`,"field.cy":`Środek od góry (%)`,"field.r":`Promień (% szerokości)`,"field.vertex.x":`Punkt {n} od lewej (%)`,"field.vertex.y":`Punkt {n} od góry (%)`,"field.vertex.add":`Dodaj punkt`,"field.vertex.remove":`Usuń punkt {n}`,"field.label":`Etykieta`,"field.label.optional":`Etykieta (opcjonalna)`,"field.more":`Tu widać tylko pierwsze {shown} z {count}: pozostałe edytuj w źródle.`,"inspector.title":`Właściwości`,"inspector.delete":`Usuń`,"inspector.moveUp":`Przenieś wyżej`,"inspector.moveDown":`Przenieś niżej`,"inspector.empty":`Umieść kursor w elemencie ćwiczenia, aby edytować jego odpowiedzi i ustawienia.`,"inspector.unsupported":`Elementu {tag} nie można tu edytować.`,"inspector.unset":`(nie ustawiono)`,"inspector.item":`{label} {n}`,"inspector.add":`Dodaj`,"inspector.remove":`Usuń`,"inspector.removeItem":`Usuń: {label} {n}`,"inspector.untitled":`Element {n} (pusty)`,"inspector.variant":`Wariant`,"inspector.styleTemplate":`Styl elementu`,"inspector.styleTemplate.inherit":`Jak całe ćwiczenie`,"inspector.styleTemplate.default":`Domyślny wygląd`,"inspector.document":`Ćwiczenie`,"inspector.documentStyle":`Wygląd całego ćwiczenia`,"inspector.upload":`Wgraj plik`,"inspector.uploadItem":`Wgraj plik: {label}`,"inspector.uploading":`Wgrywam…`,"inspector.uploaded":`Wgrano.`,"inspector.uploadFailed":`Nie udało się wgrać pliku. Spróbuj ponownie albo wpisz jego adres.`,"inspector.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"issues.title":`Problemy`,"issues.errors":`{count, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"issues.warnings":`{count, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`Brak błędów i ostrzeżeń.`,"severity.error":`Błąd`,"severity.warning":`Ostrzeżenie`,"label.text":`{label}: {text}`,"preview.title":`Widok ucznia`,"preview.show":`Podgląd`,"preview.refresh":`Odśwież podgląd`,"preview.hint":`Naciśnij „Podgląd”, aby wypróbować ćwiczenie tak, jak zobaczy je uczeń.`,"preview.loading":`Przygotowuję podgląd…`,"preview.stale":`Dokument zmienił się po tym podglądzie. Odśwież go, aby zobaczyć zmiany.`,"preview.invalid":`{count, plural, one {Popraw ten błąd, aby zobaczyć podgląd:} few {Popraw te # błędy, aby zobaczyć podgląd:} many {Popraw tych # błędów, aby zobaczyć podgląd:} other {Popraw te # błędu, aby zobaczyć podgląd:}}`,"preview.failed":`Nie udało się pokazać podglądu.`,"surface.label":`Treść ćwiczenia`,"surface.pageNumber":`Strona {page} z {pages}`,"surface.pageTitle":`Tytuł strony`,"surface.pageJoin":`Połącz ze stroną {previous}`,"surface.pageAdded":`Dodano stronę {page}`,"surface.pageJoined":`Strona {page} połączona ze stroną {previous}`,"surface.pageDelete":`Usuń stronę`,"surface.pageDeleted":`Usunięto stronę {n}`,"surface.pageAddTitle":`Dodaj tytuł`,"surface.pageRemoveTitle":`Usuń tytuł`,"surface.pageTitleOf":`Tytuł strony {page}`,"surface.pageTitleRemoved":`Usunięto tytuł strony {page}`,"surface.points":`{points, plural, one {# pkt} few {# pkt} many {# pkt} other {# pkt}}`,"surface.items":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"surface.blockMovedUp":`Blok przesunięty w górę, teraz to blok {n}`,"surface.blockMovedDown":`Blok przesunięty w dół, teraz to blok {n}`,"surface.blockRemoved":`Usunięto blok {n}`,"surface.addOption":`Dodaj odpowiedź`,"surface.addPrompt":`Dodaj polecenie`,"surface.chip.empty":`Brak odpowiedzi`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Obrazek: {alt}`,"surface.picture.decorative":`Obrazek ozdobny (bez tekstu alternatywnego)`,"surface.picture.noAlt":`Obrazek bez tekstu alternatywnego`,"surface.picture.blocked":`(niepokazany: polityka adresów nie pozwala na jego adres)`,"surface.picture.edit":`Edytuj`,"surface.loading":`Wczytuję edytor…`,"surface.failed":`Nie udało się wczytać edytora. Odśwież stronę, aby spróbować ponownie.`,"view.visual":`Wizualny`,"view.source":`HTML`,"view.visualHint":`Edytuj ćwiczenie jako sformatowany tekst`,"view.sourceHint":`Edytuj ćwiczenie jako HTML`,"view.sourceLabel":`Ćwiczenie jako HTML`,"view.sourceErrors":`{n, plural, one {HTML ma # błąd. Popraw go, aby wrócić.} few {HTML ma # błędy. Popraw je, aby wrócić.} many {HTML ma # błędów. Popraw je, aby wrócić.} other {HTML ma # błędu. Popraw go, aby wrócić.}}`,"status.elements":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"status.errors":`{n, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"status.warnings":`{n, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"status.ready":`Gotowe do udostępnienia`,"insert.layouts":`Układ`,"insert.layout.two":`Dwie kolumny`,"insert.layout.two.description":`Dwie kolumny tej samej szerokości.`,"insert.layout.three":`Trzy kolumny`,"insert.layout.three.description":`Trzy kolumny tej samej szerokości.`,"insert.layout.wide-narrow":`Szeroka + wąska`,"insert.layout.wide-narrow.description":`Szeroka kolumna, a po niej wąska.`,"insert.layout.narrow-wide":`Wąska + szeroka`,"insert.layout.narrow-wide.description":`Wąska kolumna, a po niej szeroka.`,"insert.layout.picture-text":`Obrazek obok tekstu`,"insert.layout.picture-text.description":`Wybrany obrazek, a obok niego tekst.`,"layout.section":`Kolumny`,"layout.change":`Zmień układ`,"layout.other":`Inny układ`,"layout.unwrap":`Usuń układ`,"layout.delete":`Usuń z zawartością`,"layout.confirm":`Usunąć układ razem z zawartością?`,"layout.confirmDelete":`Tak, usuń`,"layout.cancel":`Anuluj`,"toolbar.font":`Czcionka: {value}`,"toolbar.font.name":`Czcionka`,"toolbar.size":`Rozmiar: {value}`,"toolbar.size.name":`Rozmiar`,"toolbar.color":`Kolor tekstu`,"toolbar.highlight":`Wyróżnienie`,"toolbar.align":`Wyrównanie`,"toolbar.align.start":`Do lewej`,"toolbar.align.center":`Do środka`,"toolbar.align.end":`Do prawej`,"toolbar.align.justify":`Wyjustowane`,"toolbar.spacing":`Odstępy`,"toolbar.spacing.line":`Interlinia`,"toolbar.spacing.after":`Odstęp po`,"toolbar.spacing.none":`Brak`,"toolbar.spacing.small":`Mały`,"toolbar.spacing.medium":`Średni`,"toolbar.spacing.large":`Duży`,"toolbar.clear":`Wyczyść formatowanie`,"toolbar.default":`Domyślnie`,"toolbar.myStyles":`Moje style`,"toolbar.readyStyles":`Gotowe style`,"style.preset.note":`Uwaga`,"style.preset.tip":`Wskazówka`,"style.preset.important":`Ważne`,"style.preset.definition":`Definicja`,"style.preset.example":`Przykład`,"style.preset.quote":`Cytat`,"style.preset.highlight":`Wyróżnienie`,"style.preset.small-print":`Mały druk`,"style.color.theme":`Kolory motywu`,"style.color.swatch":`Kolor motywu {n}`,"style.color.custom":`Własny kolor`,"style.color.picker":`Wybierz kolor`,"style.color.invalid":`Wpisz kolor jako #rrggbb.`,"style.color.none":`Bez koloru`,"style.close":`Zamknij`,"style.form.none":`Ustaw kursor w tym, co chcesz ostylować.`,"style.target.picture":`Styl obrazka`,"style.target.figure":`Styl obrazka z podpisem`,"style.target.block":`Styl bloku`,"style.target.component":`Styl elementu`,"style.target.column":`Styl kolumny`,"style.target.layout":`Styl układu`,"style.position.inline":`W tekście`,"style.position.start":`Po lewej`,"style.position.end":`Po prawej`,"style.position.center":`Na środku`,"style.position.full":`Cała szerokość`,"style.rules.open":`Zarządzaj stylami…`,"style.rules.title":`Style`,"inspector.style":`Styl`,"surface.picture.place":`Położenie i rozmiar: {position}, {width}`,"surface.picture.placeAuto":`Położenie i rozmiar: {position}`,"style.target.more":`{target}…`,"help.cost":`koszt {percent}%`,"help.when.correct":`Dobrze`,"help.when.incorrect":`Źle`,"help.when.partial":`Częściowo dobrze`,"help.when.omitted":`Pominięte`,"help.costLabel":`Koszt podpowiedzi`,"help.whenLabel":`Dla wyniku`,"surface.helpRemove":`{kind, select, hint {Usuń podpowiedź} explanation {Usuń wyjaśnienie} other {Usuń informację zwrotną}}`}})),H,$M,eN=n((()=>{XM(),QM(),H=`astl.editor`,$M=[{namespace:H,locale:`en`,messages:YM},{namespace:H,locale:`pl`,messages:ZM}]}));function tN(e,t=``){let n=e===`picture-text`?cN(t.startsWith(`<figure`)?t:`<p>${t}</p>`)+cN():sN[e].map(e=>cN(`<p></p>`,e)).join(``);return`<astl-columns${e===`picture-text`?` style="align-items: start"`:``}>${n}</astl-columns>`}var nN,rN,iN,aN,oN,sN,cN,lN=n((()=>{nN=e=>new Map(e.split(`;`).flatMap(e=>{let t=e.indexOf(`:`);return t<0?[]:[[e.slice(0,t).trim().toLowerCase(),e.slice(t+1).trim().toLowerCase()]]})),rN=[{name:`Arial`,stack:`Arial, Helvetica, sans-serif`},{name:`Verdana`,stack:`Verdana, Geneva, sans-serif`},{name:`Georgia`,stack:`Georgia, serif`},{name:`Times New Roman`,stack:`"Times New Roman", Times, serif`},{name:`Courier New`,stack:`"Courier New", Courier, monospace`}],iN=[{name:`note`,style:`background-color: #fff4d6; border-inline-start: 4px solid #b7791f; padding: 12px 16px; border-radius: 6px`},{name:`tip`,style:`background-color: #e7f6ec; border-inline-start: 4px solid #2f855a; padding: 12px 16px; border-radius: 6px`},{name:`important`,style:`background-color: #fdecec; border-inline-start: 4px solid #c53030; padding: 12px 16px; border-radius: 6px`},{name:`definition`,style:`background-color: #eef1fe; border: 1px solid #5a67d8; padding: 12px 16px; border-radius: 6px`},{name:`example`,style:`border: 2px dashed #718096; padding: 12px 16px; border-radius: 6px`},{name:`quote`,style:`border-inline-start: 3px solid #a0aec0; padding-inline-start: 16px; font-style: italic; color: #4a5568`},{name:`highlight`,style:`background-color: #fff3a3`,text:!0},{name:`small-print`,style:`font-size: 14px; color: #4a5568`,text:!0}],aN=[`two`,`three`,`wide-narrow`,`narrow-wide`,`picture-text`],oN=[`two`,`three`,`wide-narrow`,`narrow-wide`],sN={two:[null,null],three:[null,null,null],"wide-narrow":[2,null],"narrow-wide":[null,2]},cN=(e=`<p></p>`,t=null)=>`<astl-column${t===null?``:` style="flex-grow: ${t}"`}>${e}</astl-column>`}));function uN(e){let t=Fn(`font-family: ${e.stack}`).declarations[0]?.[1];if(t===void 0)throw TypeError(`Font "${e.name}": the style allow-list refuses its stack`);return{name:e.name,stack:t}}function dN(e,t){let n=new Set;return e.map(e=>{let{name:r}=e;if(!kn(r))throw TypeError(`Style "${r}": not a style name`);if(n.has(r))throw TypeError(`Style "${r}" is given twice`);n.add(r);let{style:i,removed:a}=Fn(e.style);if(a.length>0)throw TypeError(`Style "${r}": the style allow-list refuses ${a.join(`, `)}`);return{...e,style:i,label:e.label??t(r)}})}function fN(e){return e instanceof Error&&e.name===`UploadRefused`&&e.message.trim()!==``?e.message:void 0}function pN(e){let t=typeof e==`number`?e:typeof e==`string`&&/^[1-9]\d*$/.test(e)?Number(e):NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function mN(e){let t=(e,t)=>{let n=pN(t);return n===void 0?``:` ${e}="${n}"`},n=`<img src="${rM(String(e.src))}" alt="${rM(String(e.alt))}"${t(`width`,e.width)}${t(`height`,e.height)}>`,r=String(e.caption??``).trim();return r===``?n:`<figure>${n}<figcaption>${rM(r)}</figcaption></figure>`}function hN(){let e=crypto.getRandomValues(new Uint8Array(16));return`preview-${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}`}function gN(e,t){for(let n=1;;n++){let r=`${e}-${n}`;if(!t.has(r))return r}}function _N(e){return e.find(e=>e.type===`element`)??null}function vN(e){let t=e.filter(e=>e!==null);return t.length===0?null:Math.round(t.reduce((e,t)=>e+t,0)*100)/100}function yN(e,t){let n={errors:0,warnings:0};for(let r of e)t(r)&&(r.severity===`error`?n.errors++:n.warnings++);return n}function bN(e){let{engine:t,locale:n}=e,r=new Map(t.manifests.map(e=>[e.tag,e])),i=new Map;for(let t of e.descriptors){let e=t.manifest.tag;if(i.has(e))throw TypeError(`Editor descriptor for <${e}> is given twice`);if(!r.has(e))throw TypeError(`Editor descriptor <${e}> has no component in the engine`);if(!Ae(`${t.idPrefix}-1`))throw TypeError(`Editor descriptor <${e}>: idPrefix "${t.idPrefix}" does not make valid ids`);let n=(t.templates??[]).map(e=>e.id);if(n.some((e,t)=>!SN.test(e)||n.indexOf(e)!==t))throw TypeError(`Editor descriptor <${e}>: template ids must be distinct kebab-case names`);i.set(e,t)}let a=e.styleTemplates??[],o=t=>vt({catalogs:[...$M,...zf,...e.descriptors.flatMap(e=>e.messages??[]),...t,...a.flatMap(e=>e.catalogs??[]),...e.catalogs??[]]}),s=o([]),c=[],l=e=>{let t=e.filter(e=>!c.includes(e));t.length!==0&&(c=[...c,...t],s=o(c))},u=null,d=(e,t,r)=>s.t(n,e,t,r),f=e=>i.get(e)?.manifest??r.get(e)??null,m=hN(),g=e=>({message:(t,n,r)=>{let i=d(e.messages,t,r);return i===t?n:i},unset:d(H,`inspector.unset`),untitled:e=>d(H,`inspector.untitled`,{n:e}),region:e=>d(H,`field.region`,{n:e}),point:e=>d(H,`field.point`,{n:e}),variant:d(H,`inspector.variant`),styleTemplate:d(H,`inspector.styleTemplate`),sameAsDocument:d(H,`inspector.styleTemplate.inherit`)}),_=(e,t)=>a.filter(n=>n.scopes.includes(e)&&(t===void 0||n.components===void 0||n.components.includes(t))).map(e=>{let t=d(e.messages,`label`);return{value:e.name,label:t===`label`?e.name:t}}),v=e=>{let t=i.get(e);if(t===void 0)return e;let n=d(t.manifest.messages,t.label);return n===t.label?e:n},y=e=>{if(r.get(e.tag)?.graded!==!0)return null;let t=Object.hasOwn(e.attrs,`points`)?Number(e.attrs.points):NaN;return Number.isFinite(t)&&t>0?t:wN},b=e=>{let{issues:n}=t.validate(e),i=e=>Object.hasOwn(e.attrs,`id`)?e.attrs.id??null:null,a=e=>{let t=i(e),r=yN(n,e=>t!==null&&e.at.element===t);return{id:t,tag:e.tag,label:v(e.tag),points:y(e),...r}},o=(e,t=[])=>{for(let n of e)n.type===`element`&&(r.has(n.tag)?t.push(a(n)):o(n.children,t));return t},s=(e,t,r)=>{let a=new Set(r.flatMap(e=>e.id===null?[]:[e.id])),o=vN(r.map(e=>e.points)),s=t===null?d(H,o===null?`block.text`:`block.gap`):v(t.tag);return{kind:e,id:t===null?null:i(t),tag:t?.tag??null,label:s,points:o,components:r,...yN(n,e=>e.at.element!==null&&a.has(e.at.element))}},c=e=>{let t=[],n=[],i=()=>{n.some(e=>e.type===`element`||e.value.trim()!==``)&&t.push(s(`text`,null,o(n))),n=[]};for(let o of e)if(o.type===`element`&&o.tag===`astl-columns`){i();for(let e of o.children)h(e,`astl-column`)&&t.push(...c(e.children))}else o.type===`element`&&r.get(o.tag)?.display===`block`?(i(),t.push(s(`component`,o,[a(o)]))):n.push(o);return i(),t},l=(e,t,r)=>{let i=c(r);return{id:e,label:t,...yN(n,t=>e===null?t.at.page===null&&t.at.tag!==null&&t.at.tag!==`astl-doc`:t.at.page===e),components:o(r),blocks:i,points:vN(i.map(e=>e.points))}},u=Rc(e),f=u.find(e=>h(e,Fe)),p=CN(f?.children??u),m=[];if(p.some(e=>h(e,`astl-page`))){let e=[],t=()=>{let t=l(null,null,e);t.components.length>0&&m.push(t),e=[]};for(let n of p){if(!h(n,`astl-page`)){e.push(n);continue}t();let r=e=>Object.hasOwn(n.attrs,e)?n.attrs[e]??null:null;m.push(l(r(`id`),r(`label`),n.children))}t()}else m.push(l(null,null,p));return{pages:m,...yN(n,()=>!0),points:vN(m.map(e=>e.points))}},x=null,ee=e=>{if(x?.source===e)return x.names;let t=new Map,n=Rc(e),i=CN(n.find(e=>h(e,`astl-doc`))?.children??n),a=i.some(e=>h(e,Ie)),o=(e,n,r)=>{let i=Object.hasOwn(e.attrs,`id`)?e.attrs.id:void 0;i===void 0||i===``||t.has(i)||t.set(i,{n,page:r})},s=(e,t,n)=>{for(let i of e){if(i.type!==`element`)continue;if(!r.has(i.tag)){s(i.children,t,n);continue}let e=(n.get(i.tag)??0)+1;n.set(i.tag,e),o(i,e,t)}},c=(e,t)=>{let n=new Map,i=0,a=!1,c=e=>{for(let l of e)if(l.type===`element`&&l.tag===`astl-columns`){for(let e of l.children)a=!1,h(e,`astl-column`)&&c(e.children);a=!1}else l.type===`element`&&r.get(l.tag)?.display===`block`?(i++,a=!1,o(l,i,t)):(!a&&(l.type===`element`||l.value.trim()!==``)&&(i++,a=!0),s([l],t,n))};c(e)};return a?i.filter(e=>h(e,Ie)).forEach((e,t)=>{c(e.children,t+1)}):c(i,null),x={source:e,names:t},t};function te(e,t){let n=[];for(let{tag:a,id:o,range:s}of Qj(e)){if(o!==null&&o.trim()!==``||a!==`astl-page`&&!r.has(a))continue;let e=a===`astl-page`?`page`:i.get(a)?.idPrefix??a.replace(/^astl-/,``),c=gN(Ae(`${e}-1`)?e:`item`,t);t.add(c);let l=s.startTag.attributes.find(e=>e.name===`id`),u=s.startTag.start+1+a.length;n.push(l===void 0?{start:u,end:u,text:` id="${c}"`}:{start:l.start,end:l.end,text:`id="${c}"`})}return iM(e,n)}function ie(e,t,n){let r=[];for(let{tag:a,range:o}of Qj(e)){let s=i.get(a)?.companion,c=s===void 0?void 0:i.get(s.tag);if(s===void 0||c===void 0||Zj(o.startTag,s.attribute))continue;let l=e=>$j(e).find(e=>e.tag===s.tag&&e.id)?.id,u=l(e)??l(t)??gN(c.idPrefix,n),d=wM(e.slice(o.start,o.end),{kind:`attribute`,name:s.attribute,value:u});r.push({start:o.start,end:o.end,text:d})}return iM(e,r)}function ae(e,t,n,r=``){let a=i.get(e);if(a===void 0)throw TypeError(`No editor descriptor for <${e}>`);let o=n===void 0?null:a.templates?.find(e=>e.id===n);if(o===void 0)throw TypeError(`Editor descriptor <${e}> has no template "${n}"`);let s=eM(t),c=gN(a.idPrefix,s),l=a.manifest.messages,u=(o?.template??a.template).replace(/\{\{t:([^}]+)\}\}/g,(e,t)=>rM(d(l,t.trim()))).replace(/\{\{id\}\}/g,c).replace(/\{\{selection\}\}/g,()=>rM(r));for(let e of eM(u))s.add(e);return ie(te(u,s),t,s)}return{engine:t,locale:n,descriptors:[...i.values()],elements:e.elements??[],styleTemplates:a,urlPolicy:re(e.urlPolicy??ne),fonts:(e.fonts??rN).map(uN),styles:dN(e.styles??iN,e=>{let t=`style.preset.${e}`,n=d(H,t);return n===t?e:n}),uploadAsset:e.uploadAsset??null,pickPicture:e.pickPicture??null,descriptor:e=>i.get(e)??null,templates:e=>i.get(e)?.templates??[],t:d,loadMenuMessages:()=>u??=Promise.resolve(e.menuMessages?.()??[]).then(l,e=>{u=null,console.error(e)}),addMessages:l,instantiate:ae,withCompanion(e,t,n){let r=i.get(e)?.companion;if(r===void 0||!i.has(r.tag))return null;let a=Yj(t).find(e=>e.name===Fe);if(a===void 0)return null;let o=a.children.filter(e=>e.name===Ie),s=Qj(t),c=e=>o.find(t=>t.start<=e.start&&e.end<=t.end)??a,l=e=>s.flatMap(t=>t.tag===r.tag&&t.id&&e.start<=t.start&&t.end<=e.end?[t.id]:[]),u=e=>Zj(e.startTag,r.attribute)??``,d=s.find(t=>t.tag===e&&(n===void 0?!l(c(t.range)).includes(u(t.range)):t.id===n));if(d===void 0)return null;let f=c(d.range),p=l(f);if(p.includes(u(d.range)))return null;let[m]=p,h=m===void 0?ae(r.tag,t):``,g=m??$j(h).find(e=>e.tag===r.tag)?.id??``,_=t.slice(d.start,d.end),v=f.endTag?.start??f.end;return iM(t,[{start:d.start,end:d.end,text:wM(_,{kind:`attribute`,name:r.attribute,value:g})},{start:v,end:v,text:h}])},inspect(e,t){let n=_N(Rc(e));if(n===null)return null;let r=f(n.tag);if(r===null)return null;let a=_(`component`,n.tag);return WM(n,r,i.get(n.tag)??null,g(r),a,e=>{if(t===void 0||e===``)return null;let n=$j(t).find(t=>t.id===e);return n===void 0?null:_N(Rc(t.slice(n.start,n.end)))})},inspectDocument(e){let t=qj(e).find(e=>e.type===`start`);if(t?.name!==`astl-doc`)return null;let n=Zj(t,wt),r=_(`document`);if(r.length===0&&n===null)return null;let i=p(Fe,n===null?{}:{[wt]:n}),a=d(H,`inspector.documentStyle`),o=d(H,`inspector.styleTemplate.default`);return{tag:Fe,id:null,label:d(H,`inspector.document`),icon:null,fields:[BM(i,a,o,r)]}},update:wM,validate:e=>t.validate(e),describe(e,r,i){let{id:a}=e.params,o=r!==void 0&&e.namespace!==`astl.engine`&&a===e.at.element&&typeof a==`string`?ee(r).get(a):void 0,s=o===void 0?void 0:o.page===null||i?.page===!1?String(o.n):d(H,`issue.onPage`,{n:o.n,page:o.page}),c=s===void 0?e:{...e,params:{...e.params,id:s}},l=d(c.namespace,c.code,c.params);return l===c.code?t.describe(c,n):l},assignIds:e=>te(e,eM(e)),outline:b,async preview(e,n){let r=await t.compile(e,{salt:m});return r.ok?{ok:!0,view:r.view,checker:En(t,r.key,n?.policy),issues:r.issues}:{ok:!1,issues:r.issues}}}}var xN,SN,CN,wN,TN=n((()=>{w(),Or(),Qp(),EM(),JM(),eN(),hM(),lN(),xN=class extends Error{constructor(e,t){super(e,t),this.name=`UploadRefused`}},SN=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,CN=e=>e.flatMap(e=>h(e,`astl-style`)?CN(e.children):[e]),wN=Number(It.find(e=>e.name===`points`)?.default??1)})),EN,DN=n((()=>{w(),z(),eN(),EN=class extends OC{static properties={authoring:{attribute:!1},adapter:{attribute:!1}};#e=null;constructor(){super(),this.authoring=null,this.adapter=null}connectedCallback(){super.connectedCallback(),this.#t()}disconnectedCallback(){super.disconnectedCallback(),this.#n()}willUpdate(e){e.has(`adapter`)&&this.#t()}#t(){let e=this.isConnected?this.adapter:null;if((this.#e?.adapter??null)===e||(this.#n(),e===null))return;let t=[e.onChange(()=>this.sourceChanged()),e.onSelectionChange(e=>this.selectionChanged(e)),e.onCursorChange?.(()=>this.cursorChanged())??(()=>{})];this.#e={adapter:e,off:()=>{for(let e of t)e()}}}#n(){this.#e?.off(),this.#e=null}sourceChanged(){this.requestUpdate()}selectionChanged(e){this.requestUpdate()}cursorChanged(){}t(e,t){return this.authoring?.t(`astl.editor`,e,t)??e}get ui(){let e=this.authoring?.locale??`en`;return{lang:e,dir:Me(e)}}}})),ON,kN=n((()=>{ON={"style.section.text":`Text`,"style.section.box":`Background and border`,"style.section.spacing":`Spacing`,"style.section.size":`Size and position`,"style.section.named":`Named style`,"style.section.own":`Own CSS`,"style.field.font-family":`Font`,"style.field.font-size":`Font size`,"style.field.font-weight":`Weight`,"style.field.font-style":`Slant`,"style.field.color":`Text colour`,"style.field.text-align":`Alignment`,"style.field.line-height":`Line height`,"style.field.background-color":`Background`,"style.field.border-width":`Border width`,"style.field.border-style":`Border style`,"style.field.border-color":`Border colour`,"style.field.border-radius":`Corners`,"style.field.padding":`Padding`,"style.field.margin-block-start":`Space before`,"style.field.margin-block-end":`Space after`,"style.field.width":`Width`,"style.field.position":`Position`,"style.field.gap":`Space between columns`,"style.field.align-items":`Align columns`,"style.field.flex-grow":`Share of the width`,"style.field.named":`Style`,"style.field.own":`CSS declarations`,"style.value.normal":`Normal`,"style.value.bold":`Bold`,"style.value.italic":`Italic`,"style.value.start":`Left`,"style.value.center":`Centre`,"style.value.end":`Right`,"style.value.justify":`Justified`,"style.value.none":`None`,"style.value.solid":`Solid`,"style.value.dashed":`Dashed`,"style.value.dotted":`Dotted`,"style.value.double":`Double`,"style.value.stretch":`Same height`,"style.named.none":`No style`,"style.save.label":`Name of the new style`,"style.save":`Save as a style`,"style.refused.property":`"{name}" is not allowed: an exercise's style cannot move it out of its place, cover other content or load anything.`,"style.refused.value":`This value of "{name}" is not allowed: check its unit and its limits.`,"style.refused.text":`"{name}" is not a declaration: write it as property: value.`,"style.refused.length":`This style is too long: at most {max} characters.`,"style.rules.tags":`Text styles`,"style.rules.empty":`No styles of your own yet. Add one here, or save an element's style.`,"style.rules.edit":`Edit style: {label}`,"style.rules.rename":`Rename style: {label}`,"style.rules.renameShort":`Rename`,"style.rules.renameField":`New name of style: {label}`,"style.rules.delete":`Delete style: {label}`,"style.rules.deleteShort":`Delete`,"style.rules.newLabel":`Name of a new style`,"style.rules.add":`Add style`,"style.tag.paragraph":`Paragraph`,"style.tag.heading":`Heading`,"style.tag.subheading":`Subheading`,"style.tag.quote":`Quote`,"style.tag.list":`List`,"style.tag.caption":`Caption`,"style.tag.picture":`Picture`}})),AN,jN=n((()=>{AN={"style.section.text":`Tekst`,"style.section.box":`Tło i obramowanie`,"style.section.spacing":`Odstępy`,"style.section.size":`Rozmiar i położenie`,"style.section.named":`Styl nazwany`,"style.section.own":`Własny CSS`,"style.field.font-family":`Czcionka`,"style.field.font-size":`Rozmiar czcionki`,"style.field.font-weight":`Grubość`,"style.field.font-style":`Pochylenie`,"style.field.color":`Kolor tekstu`,"style.field.text-align":`Wyrównanie`,"style.field.line-height":`Interlinia`,"style.field.background-color":`Tło`,"style.field.border-width":`Grubość obramowania`,"style.field.border-style":`Rodzaj obramowania`,"style.field.border-color":`Kolor obramowania`,"style.field.border-radius":`Narożniki`,"style.field.padding":`Wypełnienie`,"style.field.margin-block-start":`Odstęp przed`,"style.field.margin-block-end":`Odstęp po`,"style.field.width":`Szerokość`,"style.field.position":`Położenie`,"style.field.gap":`Odstęp między kolumnami`,"style.field.align-items":`Wyrównanie kolumn`,"style.field.flex-grow":`Udział w szerokości`,"style.field.named":`Styl`,"style.field.own":`Deklaracje CSS`,"style.value.normal":`Normalna`,"style.value.bold":`Pogrubiona`,"style.value.italic":`Pochylona`,"style.value.start":`Do lewej`,"style.value.center":`Do środka`,"style.value.end":`Do prawej`,"style.value.justify":`Wyjustowane`,"style.value.none":`Brak`,"style.value.solid":`Ciągłe`,"style.value.dashed":`Kreskowane`,"style.value.dotted":`Kropkowane`,"style.value.double":`Podwójne`,"style.value.stretch":`Równa wysokość`,"style.named.none":`Bez stylu`,"style.save.label":`Nazwa nowego stylu`,"style.save":`Zapisz jako styl`,"style.refused.property":`„{name}” jest niedozwolone: styl ćwiczenia nie może przenosić go poza jego miejsce, zasłaniać innych treści ani niczego wczytywać.`,"style.refused.value":`Ta wartość „{name}” jest niedozwolona: sprawdź jednostkę i dopuszczalny zakres.`,"style.refused.text":`„{name}” to nie jest deklaracja: wpisz ją jako właściwość: wartość.`,"style.refused.length":`Ten styl jest za długi: najwyżej {max} znaków.`,"style.rules.tags":`Style tekstu`,"style.rules.empty":`Nie masz jeszcze własnych stylów. Dodaj styl tutaj albo zapisz styl elementu.`,"style.rules.edit":`Edytuj styl: {label}`,"style.rules.rename":`Zmień nazwę stylu: {label}`,"style.rules.renameShort":`Zmień nazwę`,"style.rules.renameField":`Nowa nazwa stylu: {label}`,"style.rules.delete":`Usuń styl: {label}`,"style.rules.deleteShort":`Usuń`,"style.rules.newLabel":`Nazwa nowego stylu`,"style.rules.add":`Dodaj styl`,"style.tag.paragraph":`Akapit`,"style.tag.heading":`Nagłówek`,"style.tag.subheading":`Podtytuł`,"style.tag.quote":`Cytat`,"style.tag.list":`Lista`,"style.tag.caption":`Podpis`,"style.tag.picture":`Obrazek`}})),MN,NN=n((()=>{kN(),jN(),eN(),MN=[{namespace:H,locale:`en`,messages:ON},{namespace:H,locale:`pl`,messages:AN}]}));function PN(e){let t=nN(e),n=t.get(`float`);if(n===`inline-start`||n===`left`)return`start`;if(n===`inline-end`||n===`right`)return`end`;if(t.get(`width`)===`100%`&&(t.get(`display`)===`block`||!t.has(`display`)))return`full`;let r=t.get(`margin`)?.split(/\s+/);return t.get(`margin-inline`)===`auto`||[`left`,`right`].every(e=>t.get(`margin-${e}`)===`auto`)||r!==void 0&&r.length===2&&r[1]===`auto`?`center`:`inline`}function FN(e,t,n=!1){let r={};for(let e of VN)r[e]=null;return PN(t)===`full`&&(r.width=null),n&&e===`center`&&(PN(t)===`full`||!nN(t).has(`width`))&&(r.width=`50%`),{...r,...HN[e]}}function IN(e,t){return{width:`${t}%`,...PN(e)===`full`&&t<100?{display:null}:{}}}function LN(e){let t=[],n=[];for(let[r,i]of nN(e))(UN.has(r)?t:n).push(`${r}: ${i}`);return{placed:t.join(`; `),rest:n.join(`; `)}}function RN(e){let t=/^(\d+(?:\.\d+)?)%$/.exec(nN(e).get(`width`)??``);return t===null?null:Number(t[1])}function zN(e,t){let n=e.normalize(`NFD`).replace(/\p{M}/gu,``).replace(/[łŁ]/g,`l`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^[^a-z]+|-+$/g,``).slice(0,56),r=kn(n)?n:`style`;if(r!==`style`&&!t.has(r))return r;let i=1;for(;t.has(`${r}-${i}`);)i++;return`${r}-${i}`}var BN,VN,HN,UN,WN=n((()=>{Or(),lN(),BN=[`inline`,`start`,`end`,`center`,`full`],VN=[`float`,`display`,`margin`,...[`left`,`right`,`bottom`].map(e=>`margin-${e}`),`margin-inline`,`margin-inline-start`,`margin-inline-end`,`margin-block-end`],HN={inline:{},start:{float:`inline-start`,"margin-inline-end":`16px`,"margin-block-end":`8px`},end:{float:`inline-end`,"margin-inline-start":`16px`,"margin-block-end":`8px`},center:{display:`block`,"margin-inline":`auto`},full:{display:`block`,width:`100%`}},UN=new Set([...VN,`width`])}));function GN(e){let t=e==null?null:Mn(e);if(t===null)return null;let n=e=>Math.round(e).toString(16).padStart(2,`0`);return`#${n(t[0])}${n(t[1])}${n(t[2])}`}function KN(e){let{id:t,value:n,t:r,invalid:i,ground:a=!1}=e,o=GN(n),s=e=>`var(--astl-palette-${e}${a?`-soft`:``})`;return I`<div class="swatches" role="group" aria-label=${r(`style.color.theme`)}>
4572
4572
  ${qN.map(t=>I`<button
4573
4573
  type="button"
4574
4574
  class="swatch"
@@ -5166,7 +5166,7 @@ font-size: var(--astl-size-small);
5166
5166
  </section>`}}}));function gP(e){let t=Yj(e)[0],n=[],r=null,i={};for(let a of t===void 0?[]:CP(t)){let t=SP(e,a);if(a.name===`astl-hint`)n.push({html:t,cost:Zj(a.startTag,`cost`)});else if(a.name===`astl-explanation`)r??=t;else{let e=Zj(a.startTag,`when`);wP(e)&&(i[e]??=t)}}return{hints:n,explanation:r,feedback:i}}function _P(e){let t=e=>e===null?``:` cost="${nM(e)}"`;return[...e.hints.map(e=>`<${Ge}${t(e.cost)}>${e.html}</${Ge}>`),...e.explanation===null?[]:[`<${Ke}>${e.explanation}</${Ke}>`],...Ye.flatMap(t=>{let n=e.feedback[t];return n===void 0?[]:[`<${qe} when="${t}">${n}</${qe}>`]})]}function vP(e,t){let n=Yj(e)[0];if(n===void 0)return e;let r=iM(e,CP(n).map(t=>({start:aM(e,t.start),end:t.end,text:``}))),i=_P(t),a=Yj(r)[0];if(a===void 0||i.length===0)return r;let o=a.children.at(-1);if(o===void 0){let e=a.endTag?.start??a.end;return a.endTag===null&&a.startTag.selfClosing?`${r.slice(0,a.start)}${r.slice(a.start,aM(r,a.startTag.end-2))}>${i.join(``)}</${a.name}>${r.slice(a.end)}`:iM(r,[{start:e,end:e,text:i.join(``)}])}let s=r.slice(aM(r,o.start),o.start),c=/^\s*$/.test(s)?s:``;return iM(r,[{start:o.end,end:o.end,text:i.map(e=>c+e).join(``)}])}function yP(e){return(e=>e.flatMap(e=>h(e)?e.tag===`p`||e.tag===`li`?[`\n\n${TP(e).trim()}\n\n`]:[TP(e)]:[g(e)]))(Rc(e)).join(``).replace(/[ \t]+/g,` `).split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).join(`
5167
5167
 
5168
5168
  `)}function bP(e,t){let n=(e,n)=>!t&&Object.keys(e.attrs).length===0&&(n===0?e.tag===`p`:n===1&&e.tag===`br`),r=(e,t)=>e.some(e=>h(e)&&(!n(e,t)||r(e.children,t+1)));return r(Rc(e),0)}function xP(e,t){return t?tM(e.replace(/\s+/g,` `).trim()):e.split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean).map(e=>`<p>${tM(e).replace(/\n/g,`<br>`)}</p>`).join(``)}var SP,CP,wP,TP,EP=n((()=>{w(),Qp(),hM(),SP=(e,t)=>t.endTag===null&&t.startTag.selfClosing?``:e.slice(t.startTag.end,t.endTag?.start??t.end),CP=e=>e.children.filter(e=>Je.has(e.name)),wP=e=>Ye.includes(e),TP=e=>h(e)?e.tag===`br`?`
5169
- `:e.children.map(TP).join(``):g(e)})),DP,OP=n((()=>{DP={"help.title":`Help for students`,"help.hints":`Hints`,"help.hintsNote":`Students ask for them one at a time, in this order. A cost is the share of the question's points a student loses for using that hint.`,"help.hintN":`Hint {n}`,"help.cost":`Cost (% of the points)`,"help.costN":`Hint {n}: cost (% of the points)`,"help.addHint":`Add a hint`,"help.up":`Up`,"help.down":`Down`,"help.upN":`Move hint {n} up`,"help.downN":`Move hint {n} down`,"help.removeN":`Remove hint {n}`,"help.drag":`Drag to reorder`,"help.explanationNote":`Students open it under "Why?" once their answer is checked. Leave it empty for none.`,"help.feedbackNote":`Shown after a check, by the verdict. Leave a text empty for none.`,"help.formatted":`This text has formatting. A change in this field keeps only the text.`}})),kP,AP=n((()=>{kP={"help.title":`Pomoc dla ucznia`,"help.hints":`Podpowiedzi`,"help.hintsNote":`Uczeń prosi o nie po kolei, w tej kolejności. Koszt to część punktów za to pytanie, którą uczeń traci, gdy użyje podpowiedzi.`,"help.hintN":`Podpowiedź {n}`,"help.cost":`Koszt (% punktów)`,"help.costN":`Podpowiedź {n}: koszt (% punktów)`,"help.addHint":`Dodaj podpowiedź`,"help.up":`W górę`,"help.down":`W dół`,"help.upN":`Przenieś podpowiedź {n} w górę`,"help.downN":`Przenieś podpowiedź {n} w dół`,"help.removeN":`Usuń podpowiedź {n}`,"help.drag":`Przeciągnij, aby zmienić kolejność`,"help.explanationNote":`Uczeń otwiera je pod „Dlaczego?”, gdy jego odpowiedź zostanie sprawdzona. Zostaw puste, jeśli nie ma.`,"help.feedbackNote":`Widać ją po sprawdzeniu, zależnie od wyniku. Zostaw tekst pusty, jeśli nie ma.`,"help.formatted":`Ten tekst ma formatowanie. Zmiana w tym polu zostawi sam tekst.`}})),jP=r({AstlHelpForm:()=>zP,addHelp:()=>MP});function MP(e,t,n){let r=t.getSelection(),i=r===null?null:t.getElement(r.id);if(r===null||i===null||!FP(e,r.tag)){let e=n===`feedback`?`<astl-feedback when="correct"><p></p></astl-feedback>`:`<astl-${n}><p></p></astl-${n}>`;return t.insert(e),e}let a=gP(i),o,s;if(n===`hint`)o={...a,hints:[...a.hints,{html:``,cost:null}]},s=`hint-${a.hints.length}`;else if(n===`explanation`)o={...a,explanation:a.explanation??``},s=`explanation`;else{let e=IP.find(e=>a.feedback[e]===void 0)??`correct`;o={...a,feedback:{...a.feedback,[e]:a.feedback[e]??``}},s=`feedback-${e}`}return PP={element:r.id,field:s},t.replaceElement(r.id,vP(i,o)),null}var NP,PP,FP,IP,LP,RP,zP,BP=n((()=>{w(),z(),fD(),EP(),OP(),AP(),eN(),DN(),$N(),NP=[{namespace:H,locale:`en`,messages:DP},{namespace:H,locale:`pl`,messages:kP}],PP=null,FP=(e,t)=>e.descriptor(t)?.manifest.graded===!0,IP=[`correct`,`incorrect`,`omitted`,`partial`],LP=e=>{if(e===null)return`0`;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?String(Math.round(t*100)):``},RP=e=>e.target.value,zP=class extends EN{static properties={...EN.properties,element:{},inline:{type:Boolean}};static styles=[QN,F`
5169
+ `:e.children.map(TP).join(``):g(e)})),DP,OP=n((()=>{DP={"help.title":`Help for students`,"help.hints":`Hints`,"help.hintsNote":`Students ask for them one at a time, in this order. A cost is the share of the question's points a student loses for using that hint.`,"help.hintN":`Hint {n}`,"help.cost":`Cost (% of the points)`,"help.costN":`Hint {n}: cost (% of the points)`,"help.addHint":`Add a hint`,"help.up":`Up`,"help.down":`Down`,"help.upN":`Move hint {n} up`,"help.downN":`Move hint {n} down`,"help.removeN":`Remove hint {n}`,"help.removeExplanation":`Remove the explanation`,"help.removeFeedback":`Remove the feedback: {when}`,"help.drag":`Drag to reorder`,"help.explanationNote":`Students open it under "Why?" once their answer is checked. Leave it empty for none.`,"help.feedbackNote":`Shown after a check, by the verdict. Leave a text empty for none.`,"help.formatted":`This text has formatting. A change in this field keeps only the text.`}})),kP,AP=n((()=>{kP={"help.title":`Pomoc dla ucznia`,"help.hints":`Podpowiedzi`,"help.hintsNote":`Uczeń prosi o nie po kolei, w tej kolejności. Koszt to część punktów za to pytanie, którą uczeń traci, gdy użyje podpowiedzi.`,"help.hintN":`Podpowiedź {n}`,"help.cost":`Koszt (% punktów)`,"help.costN":`Podpowiedź {n}: koszt (% punktów)`,"help.addHint":`Dodaj podpowiedź`,"help.up":`W górę`,"help.down":`W dół`,"help.upN":`Przenieś podpowiedź {n} w górę`,"help.downN":`Przenieś podpowiedź {n} w dół`,"help.removeN":`Usuń podpowiedź {n}`,"help.removeExplanation":`Usuń wyjaśnienie`,"help.removeFeedback":`Usuń informację zwrotną: {when}`,"help.drag":`Przeciągnij, aby zmienić kolejność`,"help.explanationNote":`Uczeń otwiera je pod „Dlaczego?”, gdy jego odpowiedź zostanie sprawdzona. Zostaw puste, jeśli nie ma.`,"help.feedbackNote":`Widać ją po sprawdzeniu, zależnie od wyniku. Zostaw tekst pusty, jeśli nie ma.`,"help.formatted":`Ten tekst ma formatowanie. Zmiana w tym polu zostawi sam tekst.`}})),jP=r({AstlHelpForm:()=>zP,addHelp:()=>MP});function MP(e,t,n){let r=t.getSelection(),i=r===null?null:t.getElement(r.id);if(r===null||i===null||!FP(e,r.tag)){let e=n===`feedback`?`<astl-feedback when="correct"><p></p></astl-feedback>`:`<astl-${n}><p></p></astl-${n}>`;return t.insert(e),e}let a=gP(i),o,s;if(n===`hint`)o={...a,hints:[...a.hints,{html:``,cost:null}]},s=`hint-${a.hints.length}`;else if(n===`explanation`)o={...a,explanation:a.explanation??``},s=`explanation`;else{let e=IP.find(e=>a.feedback[e]===void 0)??`correct`;o={...a,feedback:{...a.feedback,[e]:a.feedback[e]??``}},s=`feedback-${e}`}return PP={element:r.id,field:s},t.replaceElement(r.id,vP(i,o)),null}var NP,PP,FP,IP,LP,RP,zP,BP=n((()=>{w(),z(),fD(),EP(),OP(),AP(),eN(),DN(),$N(),NP=[{namespace:H,locale:`en`,messages:DP},{namespace:H,locale:`pl`,messages:kP}],PP=null,FP=(e,t)=>e.descriptor(t)?.manifest.graded===!0,IP=[`correct`,`incorrect`,`omitted`,`partial`],LP=e=>{if(e===null)return`0`;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?String(Math.round(t*100)):``},RP=e=>e.target.value,zP=class extends EN{static properties={...EN.properties,element:{},inline:{type:Boolean}};static styles=[QN,F`
5170
5170
  :host {
5171
5171
  display: block;
5172
5172
  }
@@ -5291,18 +5291,22 @@ color: var(--astl-danger);
5291
5291
  <button type="button" class="delete" aria-label=${this.t(`help.removeN`,{n:r})}
5292
5292
  @click=${()=>{this.#e.clear(),this.#r(e=>({...e,hints:e.hints.filter((e,n)=>n!==t)})),PP={element:this.element??``,field:e.hints.length>1?`hint-${Math.max(0,t-1)}`:`add-hint`}}}>${this.t(`inspector.remove`)}</button>
5293
5293
  </div>
5294
- </li>`}#u(e,t,n,r){let i=this.#a(e,n??``);return I`<div class="field">
5294
+ </li>`}#u(e,t,n,r,i){let a=this.#a(e,r??``);return I`<div class="field">
5295
5295
  <label for=${e}>${t}</label>
5296
5296
  <textarea
5297
5297
  id=${e}
5298
5298
  data-help=${e}
5299
5299
  dir="auto"
5300
- aria-describedby=${i===null?R:`${e}-formatted`}
5301
- .value=${V(this.#i(e,n??``))}
5302
- @input=${t=>{let n=this.#o(e,t);r(n===``?null:n)}}
5300
+ aria-describedby=${a===null?R:`${e}-formatted`}
5301
+ .value=${V(this.#i(e,r??``))}
5302
+ @input=${t=>{let n=this.#o(e,t);i(n===``?null:n)}}
5303
5303
  @change=${()=>this.#s(e)}
5304
5304
  ></textarea>
5305
- ${i??R}
5305
+ ${a??R}
5306
+ ${r==null?R:I`<div class="row">
5307
+ <button type="button" class="delete" aria-label=${n}
5308
+ @click=${()=>{this.#e.delete(e),PP={element:this.element??``,field:e},i(null)}}>${this.t(`inspector.remove`)}</button>
5309
+ </div>`}
5306
5310
  </div>`}render(){let e=this.#n();if(e===null||this.authoring===null)return R;let{help:t}=e,{lang:n,dir:r}=this.ui;return I`<section class="kit" part="help" lang=${n} dir=${r} aria-labelledby="help-title">
5307
5311
  <h3 id="help-title">${this.t(`help.title`)}</h3>
5308
5312
  <fieldset aria-describedby="hints-note">
@@ -5314,12 +5318,12 @@ color: var(--astl-danger);
5314
5318
  @click=${()=>{PP={element:this.element??``,field:`hint-${t.hints.length}`},this.#r(e=>({...e,hints:[...e.hints,{html:``,cost:null}]}))}}>${this.t(`help.addHint`)}</button>
5315
5319
  </div>
5316
5320
  </fieldset>
5317
- ${this.#u(`explanation`,this.t(`insert.explanation`),t.explanation,e=>this.#r(t=>({...t,explanation:e})))}
5321
+ ${this.#u(`explanation`,this.t(`insert.explanation`),this.t(`help.removeExplanation`),t.explanation,e=>this.#r(t=>({...t,explanation:e})))}
5318
5322
  <p class="note">${this.t(`help.explanationNote`)}</p>
5319
5323
  <fieldset aria-describedby="feedback-note">
5320
5324
  <legend>${this.t(`insert.feedback`)}</legend>
5321
5325
  <p class="note" id="feedback-note">${this.t(`help.feedbackNote`)}</p>
5322
- ${Ye.map(e=>this.#u(`feedback-${e}`,this.t(`help.when.${e}`),t.feedback[e],t=>this.#r(n=>{let r={...n.feedback};return t===null?delete r[e]:r[e]=t,{...n,feedback:r}})))}
5326
+ ${Ye.map(e=>this.#u(`feedback-${e}`,this.t(`help.when.${e}`),this.t(`help.removeFeedback`,{when:this.t(`help.when.${e}`)}),t.feedback[e],t=>this.#r(n=>{let r={...n.feedback};return t===null?delete r[e]:r[e]=t,{...n,feedback:r}})))}
5323
5327
  </fieldset>
5324
5328
  </section>`}}}));function VP(e){GP=e}function HP(){return KP??=Promise.all([Promise.resolve().then(()=>(dP(),eP)),Promise.resolve().then(()=>(hP(),fP))]).then(([{AstlStyleForm:e},{AstlStyleRules:t}])=>{let n=GP??customElements;n.get(`astl-style-form`)===void 0&&n.define(`astl-style-form`,e),n.get(`astl-style-rules`)===void 0&&n.define(`astl-style-rules`,t)},e=>{throw KP=null,e}),KP}function UP(){let e=Promise.resolve().then(()=>(BP(),jP));return qP??=e.then(({AstlHelpForm:e})=>{let t=GP??customElements;t.get(`astl-help-form`)===void 0&&t.define(`astl-help-form`,e)},e=>{throw qP=null,e}),qP.then(()=>e)}var WP,GP,KP,qP,JP=n((()=>{WP=`astl-style-open`,GP=null,KP=null,qP=null}));function YP(e){for(let t of e.fields??[])if(t.kind===`picture-regions`||t.kind===`picture-points`)return t.src;return null}function XP(e,t,n,r,i){let a=$j(t).find(e=>e.tag===n),o=e.descriptor(n)?.manifest;if(a===void 0||o===void 0)return t;let s=e=>o.attributes.some(t=>t.name===e),c=[[r,i.src],[`alt`,s(`alt`)?i.alt:void 0],[`width`,s(`width`)?i.width?.toString():void 0],[`height`,s(`height`)?i.height?.toString():void 0]],l=t.slice(a.start,a.end);for(let[t,n]of c)n!==void 0&&(l=e.update(l,{kind:`attribute`,name:t,value:n}));return t.slice(0,a.start)+l+t.slice(a.end)}var ZP,QP,$P,eF,tF,nF,rF,iF=n((()=>{z(),TN(),hM(),lN(),DN(),JP(),$N(),ZP={inline:L`<rect x="2.5" y="6.5" width="15" height="7" rx="1.5"/><path d="M6 10h5"/>`,block:L`<path d="M3.5 5h13M3.5 10h13M3.5 15h8"/>`,picture:L`<rect x="2.5" y="3.5" width="15" height="13" rx="1.5"/><path d="M4.5 14l4-4.5 3 3 2-2 2.5 3.5"/><circle cx="13.5" cy="7" r="1.5"/>`,page:L`<path d="M4.5 2.5v4h11v-4M4.5 17.5v-4h11v4M2.5 10h2.5M8.75 10h2.5M15 10h2.5"/>`,columns:L`<rect x="2.5" y="3.5" width="15" height="13" rx="1.5"/><path d="M10 3.5v13"/>`},QP=new Map([[`list-checks`,L`<path d="M3 6a2 2 0 1 0 4 0 2 2 0 1 0-4 0m0 8a2 2 0 1 0 4 0 2 2 0 1 0-4 0M10 6h7m-7 8h7"/><circle cx="5" cy="6" r="1"/>`],[`list-numbers`,L`<path d="M6.5 16V4M3.5 7l3-3 3 3m4 9V4m-3 9l3 3 3-3"/>`],[`kanban`,L`<path d="M3.5 3.5h5v5h-5zm8 0h5v5h-5zm-8 8h5v5h-5zm8 0h5v5h-5z"/>`],[`help-hint`,L`<path d="M7.5 15.5h5M8.5 18h3M10 2.5a5 5 0 0 0-3 9c.6.5 1 1.2 1 2v.5h4v-.5c0-.8.4-1.5 1-2a5 5 0 0 0-3-9z"/>`],[`help-explanation`,L`<circle cx="10" cy="10" r="7.5"/><path d="M10 9v5m0-7.5v.5"/>`],[`help-feedback`,L`<path d="M3.5 4.5h13v9h-7l-4 3v-3h-2z"/>`]]),$P=[`hint`,`explanation`,`feedback`],eF=[`components`,`exercises`,`content`,`layouts`],tF=`astl-inserted`,nF=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).toLocaleLowerCase(),rF=class extends EN{static properties={...EN.properties,filter:{},groups:{attribute:!1},dialog:{attribute:!1}};constructor(){super(),this.filter=``,this.groups=eF,this.dialog=null}#e=null;updated(e){super.updated(e);let t=this.authoring,n=this.closest(`[popover]`);t!==null&&t!==this.#e&&n?.matches(`:popover-open`)!==!1&&(this.#e=t,t.loadMenuMessages().then(()=>this.requestUpdate()))}#t(){return this.dialog??this.renderRoot.querySelector(`astl-picture-dialog`)}static styles=[QN,ZN(`astl-picture-dialog`),F`
5325
5329
  .group {
@@ -6895,9 +6899,9 @@ outline-offset: var(--astl-focus-offset);
6895
6899
  `);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}function wJ(e){let t=0;for(let n of e)t=n===` `?t+vX-t%vX:t+1;return t}function TJ(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=wJ(a);return(wJ(n)>=r?n:` `.repeat(r))+e},o=r.split(`
6896
6900
  `).map(e=>n(e||``)).join(`
6897
6901
  `);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function EJ(e,t){let n={...e};return SJ(e)&&SJ(t)&&Object.keys(t).forEach(r=>{SJ(t[r])&&SJ(e[r])?n[r]=EJ(e[r],t[r]):n[r]=t[r]}),n}function DJ(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}function OJ(e){let{editor:t,from:n,to:r,text:i,insertText:a}=e;if(!a)return{inputTransaction:null,tr:t.view.state.tr};let o=t.view.state.tr.insertText(i,n,r);return{inputTransaction:o,tr:eB.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function kJ(e){let{editor:t,from:n,to:r,text:i,rule:a,match:o,plugin:s,insertText:c}=e,{view:l}=t,{inputTransaction:u,tr:d}=OJ({editor:t,from:n,to:r,text:i,insertText:c}),f=u?n+i.length:r,p=vK({state:l.state,transaction:d}),m={from:n-(o[0].length-i.length),to:f},{commands:h,chain:g,can:_}=new VJ({editor:t,state:p});return a.handler({state:p,range:m,match:o,commands:h,chain:g,can:_})===null||!d.steps.length?!1:(u&&(l.dispatch(u),!l.state.doc.eq(u.doc))||(tK(d),d.setMeta(`inputRule`,!0),a.undoable&&d.setMeta(s,{transform:d,from:n,to:f,text:i}),l.dispatch(d)),!0)}function AJ(e,t,n){let r=t[0].length-n.length;if(r<=0)return!0;let i=e.parentOffset-r;return i>=0&&e.parent.textBetween(i,e.parentOffset)===t[0].slice(0,r)}function jJ(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o,insertText:s}=e,{view:c}=t;if(c.composing)return!1;let l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let u=RY(l)+i;for(let e of a){let a=bX(u,e.find);if(a&&AJ(l,a,i)&&kJ({editor:t,from:n,to:r,text:i,rule:e,match:a,plugin:o,insertText:s}))return!0}return!1}function MJ(e){let{editor:t,rules:n}=e,r=new J({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:XK(U.from(e),a.schema);let{from:i}=s,o=i+e.length;jJ({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return jJ({editor:t,from:i,to:a,text:o,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&jJ({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?jJ({editor:t,from:a.pos,to:a.pos,text:`
6898
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function NJ(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new VJ({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);if(m>=h)return;let g=e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``);wX(g,a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}function PJ(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=vK({state:e,transaction:c});if(NJ({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{TX===t&&(TX=null)}),n.map(e=>new J({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(TX=t)},i=()=>{TX&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=TX;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:XK(U.from(t),r.schema);let{from:n}=d,i=n+t.length,a=EX(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(bJ(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function FJ(e){if(zX)return;zX=!0;let t;try{let n=Tz.fromJSON(e,{from:0,to:0});if(!Rq(n))return;t=n.slice.content}catch{return}t instanceof U||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}function IJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=oq(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Oq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function LJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=oq(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function RJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=oq(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function zJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=oq(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&kR(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&VR(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function BJ(e){return new CX({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=oq(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Oq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,Z,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX=n((()=>{GI(),Nz(),HB(),UB(),WB(),$B(),EG(),HG(),_K(),VJ=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:vK({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},HJ=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),UJ=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),WJ=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=DR(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},GJ=e=>t=>e(t),KJ=()=>({state:e,dispatch:t})=>AB(e,t),qJ=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new K(r.doc.resolve(Math.max(o-1,0)))),!0},JJ=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},YJ=e=>({tr:t,state:n,dispatch:r})=>{let i=yK(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},XJ=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},ZJ=e=>e.content?/^text(\*|\+)/.test(e.content):!1,QJ=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return ZJ(r)?n===`left`?e.start()-1:e.end()+1:e.pos},$J=(e,t,n)=>({from:QJ(e,n,`left`),to:QJ(t,n,`right`)}),eY=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),a=n.doc.resolve(r.map(t.$from.pos)),o=n.doc.resolve(r.map(t.$to.pos)),{from:s,to:c}=$J(a,o,e.schema);n.deleteRange(s,c)}),n.selection.empty||n.setSelection(K.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},tY=()=>({commands:e})=>e.keyboardShortcut(`Enter`),nY=()=>({state:e,dispatch:t})=>kB(e,t),rY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=TK(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=wK(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=K.create(o,e.from,e.to);n.setSelection(t)}}return!0},iY=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},aY=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(AK()||kK())&&r.dom.focus(),jK()&&!AK()&&!kK()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!EK(n.state.selection))return o(),!0;let s=OK(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},oY=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),sY=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),cY=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&cY(r)}return e},lY=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{PK(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=PK(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=FK(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):NK(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=U.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&IK(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0},uY=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=LK(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=PK(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&IK(t,t.steps.length-1,-1)),!0):!1},dY=()=>({state:e,dispatch:t})=>TB(e,t),fY=()=>({state:e,dispatch:t})=>EB(e,t),pY=()=>({state:e,dispatch:t})=>yB(e,t),mY=()=>({state:e,dispatch:t})=>CB(e,t),hY=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},gY=()=>({state:e,dispatch:t,tr:n})=>{try{let r=WR(e.doc,e.selection.$from.pos,-1);return r==null||!hY(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},_Y=()=>({state:e,dispatch:t,tr:n})=>{try{let r=WR(e.doc,e.selection.$from.pos,1);return r==null||!hY(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},vY=()=>({state:e,dispatch:t})=>bB(e,t),yY=()=>({state:e,dispatch:t})=>xB(e,t),bY=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=zK(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0},xY=(e,t={})=>({state:n,dispatch:r})=>BK(n,yK(e,n.schema),t)?DB(n,r):!1,SY=()=>({state:e,dispatch:t})=>jB(e,t),CY=e=>({state:t,dispatch:n})=>JB(yK(e,t.schema))(t,n),wY=()=>({state:e,dispatch:t})=>OB(e,t),TY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VK(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yK(e,r.schema)),s===`mark`&&(o=TK(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,HK(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(HK(a.attrs,t))))})})}),c},EY=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),DY=()=>({tr:e,dispatch:t})=>{if(t){let t=new Gz(e.doc);e.setSelection(t)}return!0},OY=()=>({state:e,dispatch:t})=>SB(e,t),kY=()=>({state:e,dispatch:t})=>wB(e,t),AY=()=>({state:e,dispatch:t})=>NB(e,t),jY=()=>({state:e,dispatch:t})=>IB(e,t),MY=()=>({state:e,dispatch:t})=>FB(e,t),NY=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=UK(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=FK(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})},PY={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},FY={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`},IY=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},LY=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)},RY=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n},zY=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=JK(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},BY=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)},VY=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}},HY=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=TK(e,r.schema);if(i){if(o){let e=WK(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return Vq(r,n,c)},UY=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),WY=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=yK(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>gB(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>gB(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},GY=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=DK(e,0,n.content.size),i=q.create(n,r);t.setSelection(i)}return!0},KY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},qY=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=K.atStart(n).from,o=K.atEnd(n).to,s=DK(r,a,o),c=DK(i,a,o),l=K.create(n,s,c);t.setSelection(l)}return!0},JY=e=>({state:t,dispatch:n})=>ZB(yK(e,t.schema))(t,n),YY=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Aq(l,s.node().type.name,s.node().attrs);if(a instanceof q&&a.node.isBlock)return!s.parentOffset||!zR(o,s.pos)?!1:(r&&(e&&Hq(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:LK(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof K&&!a.empty?eB.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=zR(h,g,1,p);if(!p&&!_&&zR(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof K&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&Hq(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},XY=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=yK(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=U.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=U.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Aq(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(U.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new W(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(K.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Aq(d,u.type.name,u.attrs),...t},m={...Aq(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!zR(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},ZY=(e,t)=>{let n=JK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&VR(e.doc,n.pos))||!Zq(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},QY=(e,t)=>{let n=JK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&VR(e.doc,r))||!Zq(n.node.attrs.type,i?.attrs.type)||e.join(r),!0},$Y=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=yK(e,o.schema),m=yK(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=JK(e=>Pq(e.type.name,d))(h),ee=h.from===0&&h.to===o.doc.content.size,te=o.doc.content.content,ne=te.length===1?te[0]:null,re=ee&&ne&&Pq(ne.type.name,d)?{node:ne,pos:0,depth:0}:null,ie=x??re,ae=!!x&&y.depth>=1&&y.depth-x.depth<=1,oe=!!re;if((ae||oe)&&ie){if(ie.node.type===p)return ee&&oe?c().command(({tr:e,dispatch:t})=>{let n=Qq(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Pq(ie.node.type.name,d)&&p.validContent(ie.node.content))return c().command(()=>(a.setNodeMarkup(ie.pos,p),!0)).command(()=>ZY(a,p)).command(()=>QY(a,p)).run();if(Pq(ie.node.type.name,d)){let e=ie.node.firstChild?.type;if(e&&e!==m){let e=Jq(ie.node,{listType:p,itemType:m,isListNode:e=>Pq(e.type.name,d)}),t=e?U.from(e):null;return!t||!p.validContent(t)?!1:c().command(()=>{let{$anchor:e,$head:n}=a.selection,i=e.parent,o=n.parent,s=e.parentOffset,c=n.parentOffset,l;try{l=p.create(r,t)}catch{return!1}if(a.replaceWith(ie.pos,ie.pos+ie.node.nodeSize,l),i.inlineContent&&o.inlineContent){let e=Yq(l,i),t=Yq(l,o);if(e!==null&&t!==null){let n=ie.pos+e+2+s,r=ie.pos+t+2+c;a.setSelection(K.create(a.doc,n,r))}}return!0}).command(()=>ZY(a,p)).command(()=>QY(a,p)).run()}}}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>ZY(a,p)).command(()=>QY(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>ZY(a,p)).command(()=>QY(a,p)).run()},eX=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=TK(e,r.schema);return jq(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},tX=(e,t,n={})=>({state:r,commands:i})=>{let a=yK(e,r.schema),o=yK(t,r.schema),s=BK(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},nX=(e,t={})=>({state:n,commands:r})=>{let i=yK(e,n.schema);return BK(n,i,t)?r.lift(i):r.wrapIn(i,t)},rX=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},iX=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},aX=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=TK(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=wK(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},oX=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},sX=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VK(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yK(e,r.schema)),s===`mark`&&(o=TK(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},cX=new nB(`__tiptap_decorations__`),lX=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(cX,{type:`force`,name:e}),!0),uX=(e,t={})=>({state:n,dispatch:r})=>hB(yK(e,n.schema),t)(n,r),dX=(e,t={})=>({state:n,dispatch:r})=>GB(yK(e,n.schema),t)(n,r),fX=WI({blur:()=>HJ,clearContent:()=>UJ,clearNodes:()=>WJ,command:()=>GJ,createParagraphNear:()=>KJ,cut:()=>qJ,deleteCurrentNode:()=>JJ,deleteNode:()=>YJ,deleteRange:()=>XJ,deleteSelection:()=>eY,enter:()=>tY,exitCode:()=>nY,extendMarkRange:()=>rY,first:()=>iY,focus:()=>aY,forEach:()=>oY,insertContent:()=>sY,insertContentAt:()=>lY,insertDefaultBlock:()=>uY,joinBackward:()=>pY,joinDown:()=>fY,joinForward:()=>mY,joinItemBackward:()=>gY,joinItemForward:()=>_Y,joinTextblockBackward:()=>vY,joinTextblockForward:()=>yY,joinUp:()=>dY,keyboardShortcut:()=>bY,lift:()=>xY,liftEmptyBlock:()=>SY,liftListItem:()=>CY,newlineInCode:()=>wY,resetAttributes:()=>TY,scrollIntoView:()=>EY,selectAll:()=>DY,selectNodeBackward:()=>OY,selectNodeForward:()=>kY,selectParentNode:()=>AY,selectTextblockEnd:()=>jY,selectTextblockStart:()=>MY,setContent:()=>NY,setMark:()=>HY,setMeta:()=>UY,setNode:()=>WY,setNodeSelection:()=>GY,setTextDirection:()=>KY,setTextSelection:()=>qY,sinkListItem:()=>JY,splitBlock:()=>YY,splitListItem:()=>XY,toggleList:()=>$Y,toggleMark:()=>eX,toggleNode:()=>tX,toggleWrap:()=>nX,undoInputRule:()=>rX,unsetAllMarks:()=>iX,unsetMark:()=>aX,unsetTextDirection:()=>oX,updateAttributes:()=>sX,updateDecorations:()=>lX,wrapIn:()=>uX,wrapInList:()=>dX}),pX=new WeakMap,mX=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},hX=typeof process<`u`&&process.env.NODE_ENV!==`production`,gX=new Set,_X=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=cX.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>gJ(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return cX.getState(this.editor.state)?.widgetKeys??gX}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new J({key:cX,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:hJ(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(cX),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return $q(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!_J(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=pJ(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:hJ(u)}}},props:{decorations(e){return cX.getState(e)?.mergedDecorationSet??pG.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=dJ(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??pG.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=fJ(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>iJ({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=oJ(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=nJ(aJ({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return rJ(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!hX)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=sJ(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:mJ(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):mJ(n.doc,r)}},vX=4,yX=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},bX=(e,t)=>{if(bK(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r},xX=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...oq(X(this,`addOptions`,{name:this.name}))}}get storage(){return{...oq(X(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>EJ(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},SX=class e extends xX{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},CX=class{constructor(e){this.find=e.find,this.handler=e.handler}},wX=(e,t,n)=>{if(bK(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]},TX=null,EX=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n},DX=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=yq(e),this.hasSchemaSpec=t.options.schemaSpec!==void 0,this.schema=_q(this.extensions,t,t.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=X(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:kq(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=vq([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:kq(t.name,this.schema)},r=[],i=X(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&X(t,`exitable`,n)&&(a.ArrowRight=()=>SX.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=LG(a);r.push(o);let s=X(t,`addInputRules`,n);if(Nq(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=MJ({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=X(t,`addPasteRules`,n);if(Nq(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=PJ({editor:e,rules:t});r.push(...n)}}let l=X(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=X(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:kq(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new _X({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){let e=iq(this.extensions);return this.hasSchemaSpec?ZK(e,this.schema):e}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=rq(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:yK(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=dq(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return vq([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kq(n.name,this.schema)},i=X(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return vq([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kq(n.name,this.schema)},i=X(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=rq(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:TK(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=dq(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{DJ(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:kq(e.name,this.schema)};e.type===`mark`&&((oq(X(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(oq(X(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=X(e,`onBeforeCreate`,t),r=X(e,`onCreate`,t),i=X(e,`onUpdate`,t),a=X(e,`onSelectionUpdate`,t),o=X(e,`onTransaction`,t),s=X(e,`onFocus`,t),c=X(e,`onBlur`,t),l=X(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}},DX.resolve=yq,DX.sort=vq,DX.flatten=YK,Z=class e extends xX{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},OX=Z.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new J({key:new nB(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=Sq(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>bq(r,{from:e.pos,to:t.pos},s)).join(o??`
6902
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function NJ(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new VJ({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);if(m>=h)return;let g=e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``);wX(g,a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}function PJ(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=vK({state:e,transaction:c});if(NJ({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{TX===t&&(TX=null)}),n.map(e=>new J({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(TX=t)},i=()=>{TX&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=TX;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:XK(U.from(t),r.schema);let{from:n}=d,i=n+t.length,a=EX(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(bJ(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function FJ(e){if(BX)return;BX=!0;let t;try{let n=Tz.fromJSON(e,{from:0,to:0});if(!Rq(n))return;t=n.slice.content}catch{return}t instanceof U||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}function IJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=oq(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Oq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function LJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=oq(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function RJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=oq(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function zJ(e){return new yX({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=oq(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&kR(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&VR(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function BJ(e){return new CX({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=oq(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Oq(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX=n((()=>{GI(),Nz(),HB(),UB(),WB(),$B(),EG(),HG(),_K(),VJ=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:vK({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},HJ=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),UJ=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),WJ=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=DR(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},GJ=e=>t=>e(t),KJ=()=>({state:e,dispatch:t})=>AB(e,t),qJ=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new K(r.doc.resolve(Math.max(o-1,0)))),!0},JJ=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},YJ=e=>({tr:t,state:n,dispatch:r})=>{let i=yK(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},XJ=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},ZJ=e=>e.content?/^text(\*|\+)/.test(e.content):!1,QJ=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return ZJ(r)?n===`left`?e.start()-1:e.end()+1:e.pos},$J=(e,t,n)=>({from:QJ(e,n,`left`),to:QJ(t,n,`right`)}),eY=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),a=n.doc.resolve(r.map(t.$from.pos)),o=n.doc.resolve(r.map(t.$to.pos)),{from:s,to:c}=$J(a,o,e.schema);n.deleteRange(s,c)}),n.selection.empty||n.setSelection(K.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},tY=()=>({commands:e})=>e.keyboardShortcut(`Enter`),nY=()=>({state:e,dispatch:t})=>kB(e,t),rY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=TK(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=wK(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=K.create(o,e.from,e.to);n.setSelection(t)}}return!0},iY=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},aY=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(AK()||kK())&&r.dom.focus(),jK()&&!AK()&&!kK()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!EK(n.state.selection))return o(),!0;let s=OK(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},oY=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),sY=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),cY=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&cY(r)}return e},lY=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{PK(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=PK(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=FK(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):NK(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=U.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&IK(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0},uY=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=LK(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=PK(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&IK(t,t.steps.length-1,-1)),!0):!1},dY=()=>({state:e,dispatch:t})=>TB(e,t),fY=()=>({state:e,dispatch:t})=>EB(e,t),pY=()=>({state:e,dispatch:t})=>yB(e,t),mY=()=>({state:e,dispatch:t})=>CB(e,t),hY=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},gY=()=>({state:e,dispatch:t,tr:n})=>{try{let r=WR(e.doc,e.selection.$from.pos,-1);return r==null||!hY(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},_Y=()=>({state:e,dispatch:t,tr:n})=>{try{let r=WR(e.doc,e.selection.$from.pos,1);return r==null||!hY(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},vY=()=>({state:e,dispatch:t})=>bB(e,t),yY=()=>({state:e,dispatch:t})=>xB(e,t),bY=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=zK(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0},xY=(e,t={})=>({state:n,dispatch:r})=>BK(n,yK(e,n.schema),t)?DB(n,r):!1,SY=()=>({state:e,dispatch:t})=>jB(e,t),CY=e=>({state:t,dispatch:n})=>JB(yK(e,t.schema))(t,n),wY=()=>({state:e,dispatch:t})=>OB(e,t),TY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VK(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yK(e,r.schema)),s===`mark`&&(o=TK(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,HK(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(HK(a.attrs,t))))})})}),c},EY=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),DY=()=>({tr:e,dispatch:t})=>{if(t){let t=new Gz(e.doc);e.setSelection(t)}return!0},OY=()=>({state:e,dispatch:t})=>SB(e,t),kY=()=>({state:e,dispatch:t})=>wB(e,t),AY=()=>({state:e,dispatch:t})=>NB(e,t),jY=()=>({state:e,dispatch:t})=>IB(e,t),MY=()=>({state:e,dispatch:t})=>FB(e,t),NY=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=UK(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=FK(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})},PY={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},FY={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`},IY=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},LY=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)},RY=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n},zY=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=JK(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},BY=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)},VY=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}},HY=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=TK(e,r.schema);if(i){if(o){let e=WK(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return Vq(r,n,c)},UY=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),WY=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=yK(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>gB(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>gB(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},GY=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=DK(e,0,n.content.size),i=q.create(n,r);t.setSelection(i)}return!0},KY=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},qY=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=K.atStart(n).from,o=K.atEnd(n).to,s=DK(r,a,o),c=DK(i,a,o),l=K.create(n,s,c);t.setSelection(l)}return!0},JY=e=>({state:t,dispatch:n})=>ZB(yK(e,t.schema))(t,n),YY=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Aq(l,s.node().type.name,s.node().attrs);if(a instanceof q&&a.node.isBlock)return!s.parentOffset||!zR(o,s.pos)?!1:(r&&(e&&Hq(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:LK(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof K&&!a.empty?eB.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=zR(h,g,1,p);if(!p&&!_&&zR(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof K&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&Hq(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},XY=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=yK(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=U.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=U.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Aq(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(U.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new W(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(K.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Aq(d,u.type.name,u.attrs),...t},m={...Aq(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!zR(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},ZY=(e,t)=>{let n=JK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&VR(e.doc,n.pos))||!Zq(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},QY=(e,t)=>{let n=JK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&VR(e.doc,r))||!Zq(n.node.attrs.type,i?.attrs.type)||e.join(r),!0},$Y=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=yK(e,o.schema),m=yK(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=JK(e=>Pq(e.type.name,d))(h),ee=h.from===0&&h.to===o.doc.content.size,te=o.doc.content.content,ne=te.length===1?te[0]:null,re=ee&&ne&&Pq(ne.type.name,d)?{node:ne,pos:0,depth:0}:null,ie=x??re,ae=!!x&&y.depth>=1&&y.depth-x.depth<=1,oe=!!re;if((ae||oe)&&ie){if(ie.node.type===p)return ee&&oe?c().command(({tr:e,dispatch:t})=>{let n=Qq(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Pq(ie.node.type.name,d)&&p.validContent(ie.node.content))return c().command(()=>(a.setNodeMarkup(ie.pos,p),!0)).command(()=>ZY(a,p)).command(()=>QY(a,p)).run();if(Pq(ie.node.type.name,d)){let e=ie.node.firstChild?.type;if(e&&e!==m){let e=Jq(ie.node,{listType:p,itemType:m,isListNode:e=>Pq(e.type.name,d)}),t=e?U.from(e):null;return!t||!p.validContent(t)?!1:c().command(()=>{let{$anchor:e,$head:n}=a.selection,i=e.parent,o=n.parent,s=e.parentOffset,c=n.parentOffset,l;try{l=p.create(r,t)}catch{return!1}if(a.replaceWith(ie.pos,ie.pos+ie.node.nodeSize,l),i.inlineContent&&o.inlineContent){let e=Yq(l,i),t=Yq(l,o);if(e!==null&&t!==null){let n=ie.pos+e+2+s,r=ie.pos+t+2+c;a.setSelection(K.create(a.doc,n,r))}}return!0}).command(()=>ZY(a,p)).command(()=>QY(a,p)).run()}}}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>ZY(a,p)).command(()=>QY(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>ZY(a,p)).command(()=>QY(a,p)).run()},eX=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=TK(e,r.schema);return jq(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},tX=(e,t,n={})=>({state:r,commands:i})=>{let a=yK(e,r.schema),o=yK(t,r.schema),s=BK(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},nX=(e,t={})=>({state:n,commands:r})=>{let i=yK(e,n.schema);return BK(n,i,t)?r.lift(i):r.wrapIn(i,t)},rX=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},iX=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},aX=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=TK(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=wK(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},oX=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},sX=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VK(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=yK(e,r.schema)),s===`mark`&&(o=TK(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},cX=new nB(`__tiptap_decorations__`),lX=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(cX,{type:`force`,name:e}),!0),uX=(e,t={})=>({state:n,dispatch:r})=>hB(yK(e,n.schema),t)(n,r),dX=(e,t={})=>({state:n,dispatch:r})=>GB(yK(e,n.schema),t)(n,r),fX=WI({blur:()=>HJ,clearContent:()=>UJ,clearNodes:()=>WJ,command:()=>GJ,createParagraphNear:()=>KJ,cut:()=>qJ,deleteCurrentNode:()=>JJ,deleteNode:()=>YJ,deleteRange:()=>XJ,deleteSelection:()=>eY,enter:()=>tY,exitCode:()=>nY,extendMarkRange:()=>rY,first:()=>iY,focus:()=>aY,forEach:()=>oY,insertContent:()=>sY,insertContentAt:()=>lY,insertDefaultBlock:()=>uY,joinBackward:()=>pY,joinDown:()=>fY,joinForward:()=>mY,joinItemBackward:()=>gY,joinItemForward:()=>_Y,joinTextblockBackward:()=>vY,joinTextblockForward:()=>yY,joinUp:()=>dY,keyboardShortcut:()=>bY,lift:()=>xY,liftEmptyBlock:()=>SY,liftListItem:()=>CY,newlineInCode:()=>wY,resetAttributes:()=>TY,scrollIntoView:()=>EY,selectAll:()=>DY,selectNodeBackward:()=>OY,selectNodeForward:()=>kY,selectParentNode:()=>AY,selectTextblockEnd:()=>jY,selectTextblockStart:()=>MY,setContent:()=>NY,setMark:()=>HY,setMeta:()=>UY,setNode:()=>WY,setNodeSelection:()=>GY,setTextDirection:()=>KY,setTextSelection:()=>qY,sinkListItem:()=>JY,splitBlock:()=>YY,splitListItem:()=>XY,toggleList:()=>$Y,toggleMark:()=>eX,toggleNode:()=>tX,toggleWrap:()=>nX,undoInputRule:()=>rX,unsetAllMarks:()=>iX,unsetMark:()=>aX,unsetTextDirection:()=>oX,updateAttributes:()=>sX,updateDecorations:()=>lX,wrapIn:()=>uX,wrapInList:()=>dX}),pX=new WeakMap,mX=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},hX=typeof process<`u`&&process.env.NODE_ENV!==`production`,gX=new Set,_X=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=cX.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>gJ(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return cX.getState(this.editor.state)?.widgetKeys??gX}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new J({key:cX,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:hJ(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(cX),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return $q(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!_J(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=pJ(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:hJ(u)}}},props:{decorations(e){return cX.getState(e)?.mergedDecorationSet??pG.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=dJ(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??pG.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=fJ(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>iJ({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=oJ(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=nJ(aJ({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return rJ(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!hX)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=sJ(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:mJ(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):mJ(n.doc,r)}},vX=4,yX=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},bX=(e,t)=>{if(bK(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r},xX=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...oq(X(this,`addOptions`,{name:this.name}))}}get storage(){return{...oq(X(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>EJ(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},SX=class e extends xX{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},CX=class{constructor(e){this.find=e.find,this.handler=e.handler}},wX=(e,t,n)=>{if(bK(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]},TX=null,EX=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n},DX=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=yq(e),this.hasSchemaSpec=t.options.schemaSpec!==void 0,this.schema=_q(this.extensions,t,t.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=X(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:kq(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=vq([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:kq(t.name,this.schema)},r=[],i=X(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&X(t,`exitable`,n)&&(a.ArrowRight=()=>SX.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=LG(a);r.push(o);let s=X(t,`addInputRules`,n);if(Nq(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=MJ({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=X(t,`addPasteRules`,n);if(Nq(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=PJ({editor:e,rules:t});r.push(...n)}}let l=X(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=X(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:kq(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new _X({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){let e=iq(this.extensions);return this.hasSchemaSpec?ZK(e,this.schema):e}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=rq(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:yK(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=dq(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return vq([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kq(n.name,this.schema)},i=X(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return vq([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kq(n.name,this.schema)},i=X(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=rq(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:TK(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=dq(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{DJ(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:kq(e.name,this.schema)};e.type===`mark`&&((oq(X(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(oq(X(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=X(e,`onBeforeCreate`,t),r=X(e,`onCreate`,t),i=X(e,`onUpdate`,t),a=X(e,`onSelectionUpdate`,t),o=X(e,`onTransaction`,t),s=X(e,`onFocus`,t),c=X(e,`onBlur`,t),l=X(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}},DX.resolve=yq,DX.sort=vq,DX.flatten=YK,OX=class e extends xX{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},kX=OX.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new J({key:new nB(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=Sq(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>bq(r,{from:e.pos,to:t.pos},s)).join(o??`
6899
6903
 
6900
- `)}}})]}}),kX=Z.create({name:`commands`,addCommands(){return{...fX}}}),AX=Z.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=GK(e.before,[e,...t]);Dq(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof Sz){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),jX=Z.create({name:`drop`,addProseMirrorPlugins(){return[new J({key:new nB(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),MX=Z.create({name:`editable`,addProseMirrorPlugins(){return[new J({key:new nB(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),NX=new nB(`focusEvents`),PX=Z.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new J({key:NX,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),FX=Z.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:G.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return AK()||RK()?i:r},addProseMirrorPlugins(){return[new J({key:new nB(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=G.atStart(t.doc).from,l=G.atEnd(t.doc).to;if(a||o!==c||s!==l||!Fq(n.doc))return;let u=n.tr,d=vK({state:n,transaction:u}),{commands:f}=new VJ({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),IX=Z.create({name:`paste`,addProseMirrorPlugins(){return[new J({key:new nB(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),LX=Z.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new J({key:new nB(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),RX=Z.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=rq(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new J({key:new nB(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),zX=!1,BX=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},VX=`.ProseMirror {
6904
+ `)}}})]}}),AX=OX.create({name:`commands`,addCommands(){return{...fX}}}),jX=OX.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=GK(e.before,[e,...t]);Dq(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof Sz){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),MX=OX.create({name:`drop`,addProseMirrorPlugins(){return[new J({key:new nB(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),NX=OX.create({name:`editable`,addProseMirrorPlugins(){return[new J({key:new nB(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),PX=new nB(`focusEvents`),FX=OX.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new J({key:PX,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),IX=OX.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:G.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return AK()||RK()?i:r},addProseMirrorPlugins(){return[new J({key:new nB(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=G.atStart(t.doc).from,l=G.atEnd(t.doc).to;if(a||o!==c||s!==l||!Fq(n.doc))return;let u=n.tr,d=vK({state:n,transaction:u}),{commands:f}=new VJ({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),LX=OX.create({name:`paste`,addProseMirrorPlugins(){return[new J({key:new nB(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),RX=OX.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new J({key:new nB(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),zX=OX.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=rq(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new J({key:new nB(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),BX=!1,VX=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},HX=`.ProseMirror {
6901
6905
  position: relative;
6902
6906
  }
6903
6907
 
@@ -6967,18 +6971,18 @@ img.ProseMirror-separator {
6967
6971
 
6968
6972
  .ProseMirror-focused .ProseMirror-gapcursor {
6969
6973
  display: block;
6970
- }`,HX=class extends mX{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:zq,createMappablePosition:Bq},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=OK(t,this.options.autofocus);this.editorState=eB.create({doc:t,schema:this.schema,selection:e||void 0})}FJ(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():VJ.createFakeChain()}can(){return this.commandManager?this.commandManager.can():VJ.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=yJ(VX,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return hX&&!this.hasWarnedStaleDecorationRead&&eJ(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=aq(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[MX,OX.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),kX,PX,FX,LX.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),jX,IX,AX,RX.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new DX(n,this)}createCommandManager(){this.commandManager=new VJ({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=UK(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=UK(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=eB.create({doc:t,schema:this.schema,selection:OK(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return aq(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new wG(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return wq(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Mq(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XK(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
6974
+ }`,UX=class extends mX{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:zq,createMappablePosition:Bq},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=OK(t,this.options.autofocus);this.editorState=eB.create({doc:t,schema:this.schema,selection:e||void 0})}FJ(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():VJ.createFakeChain()}can(){return this.commandManager?this.commandManager.can():VJ.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=yJ(HX,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return hX&&!this.hasWarnedStaleDecorationRead&&eJ(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=aq(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[NX,kX.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),AX,FX,IX,RX.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),MX,LX,jX,zX.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new DX(n,this)}createCommandManager(){this.commandManager=new VJ({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=UK(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=UK(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=eB.create({doc:t,schema:this.schema,selection:OK(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return aq(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new wG(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return wq(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Mq(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XK(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
6971
6975
 
6972
- `,textSerializers:n={}}=e||{};return xq(this.state.doc,{blockSeparator:t,textSerializers:{...Sq(this.schema),...n}})}get isEmpty(){return Fq(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new BX(t,this,!1,n)}get $doc(){return this.$pos(0)}},UX=class e extends xX{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}}}));function GX(e){let t=qX.createElement(`div`);return t.append(e),t.innerHTML}function KX(e){let t=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`),n=e=>Object.entries(e).map(([e,n])=>` ${e}="${t(n)}"`).join(``),r=e.attrs.rules.map(e=>`<${he}${n(e)}></${he}>`).join(``),i=hR.fromSchema(e.type.schema);return`<astl-doc${n(e.attrs.attributes)}>${r}${GX(i.serializeFragment(e.content,{document:qX}))}</astl-doc>`}var qX,JX=n((()=>{w(),WB(),qX=document.implementation.createHTMLDocument(``)}));function YX(e,t,n){let r=[],i={parent:e,parentStart:t},a=null;return e.forEach((e,o,s)=>{let c=t+o,l=c+e.nodeSize,u=e.type.name===uZ;u||n(e)?(a!==null&&r.push(a),a=null,r.push({from:c,to:l,start:s,end:s+1,component:u?null:e,...i})):a=a===null?{from:c,to:l,start:s,end:s+1,component:null,...i}:{...a,to:l,end:s+1}}),a!==null&&r.push(a),r}function XX(e,t,n){return YX(e,t,n).flatMap(t=>{let r=e.child(t.start);if(r.type.name!==`astlLayout`)return[t];let i=[];return r.forEach((e,r)=>{i.push(...XX(e,t.from+r+2,n))}),i})}function ZX(e,t){if(e.firstChild?.type.name!==lZ)return[{page:null,node:e,start:0,blocks:XX(e,0,t)}];let n=[];return e.forEach((e,r)=>{let i=e.attrs.attributes?.id;n.push({page:i===void 0||i===``?null:i,node:e,start:r+1,blocks:XX(e,r+1,t)})}),n}function QX(e,t){let{doc:n,selection:r}=e,i=n.firstChild?.type.name===lZ,a=+!!i,{$from:o}=r;if(o.depth<a)return null;let s=ZX(n,t),c=i?s[o.index(0)]:s[0],l=c?.blocks.at(-1);if(c===void 0||l===void 0)return null;let u=Math.min(o.pos,l.to-1),d=c.blocks.findIndex(e=>u>=e.from&&u<e.to);return d<0?null:{page:c.page,index:d}}function $X(e,t,n,r){return hZ(e,t,r)?.blocks.findIndex(e=>n>=e.from&&n<e.to)??-1}function eZ(e,t){let n=e.nodeAt(t);return n?.isAtom===!0&&q.isSelectable(n)?q.create(e,t):G.near(e.resolve(t+1))}function tZ(e,t,n,r){let i=hZ(e.doc,t.page,r)?.blocks[t.index];if(i===void 0)return null;let a=YX(i.parent,i.parentStart,r),o=a[a.findIndex(e=>e.from===i.from)+(n===`up`?-1:1)];if(o===void 0)return null;let[s,c]=n===`up`?[o,i]:[i,o],l=[];for(let e=c.start;e<c.end;e++)l.push(i.parent.child(e));let u=U.from(l);e.delete(c.from,c.to),e.insert(s.from,u);let d=n===`up`?s.from:s.from+u.size;e.setSelection(eZ(e.doc,d));let f=$X(e.doc,t.page,d,r);return tK(e).setMeta(mZ,{key:n===`up`?`surface.blockMovedUp`:`surface.blockMovedDown`,params:{n:f+1}}).scrollIntoView(),f}function nZ(e,t,n){let r=hZ(e.doc,t.page,n)?.blocks[t.index],i=e.doc.type.schema.nodes.paragraph;if(r===void 0||i===void 0)return!1;let a=r.end===r.parent.childCount,o=a&&r.start===0;return o?e.replaceWith(r.from,r.to,i.create()):e.delete(r.from,r.to),e.setSelection(o?K.create(e.doc,r.from+1):a?G.near(e.doc.resolve(r.from),-1):eZ(e.doc,r.from)),tK(e).setMeta(mZ,{key:`surface.blockRemoved`,params:{n:t.index+1}}).scrollIntoView(),!0}function rZ(e){let t=Number(e.attrs.attributes?.points);return Number.isFinite(t)&&t>0?t:1}function iZ(e){let t=document.createElementNS(gZ,`svg`);return t.setAttribute(`viewBox`,`0 0 20 20`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`),t.classList.add(`astl-icon`),typeof e==`string`?t.appendChild(document.createElementNS(gZ,`path`)).setAttribute(`d`,_Z[e]):TC(e,t),t}function aZ(e,t){let n=t.target;if(!(t.ctrlKey||t.metaKey)||t.altKey||n.localName===`input`)return;let r=t.key.toLowerCase(),i=r===`z`?t.shiftKey?hK:mK:r===`y`&&!t.shiftKey?hK:null;i!==null&&(t.preventDefault(),e.focus(),i(e.state,e.dispatch))}function oZ(e,t,n){let r=e(`style.position.${t}`);return n===null?{text:r,label:e(`surface.picture.placeAuto`,{position:r})}:{text:`${r} · ${n}%`,label:e(`surface.picture.place`,{position:r,width:`${n}%`})}}function sZ(e){let t=e.attrs.attributes?.style??``,{placed:n}=LN(t);if(n===``)return``;let r=PN(t),i=r===`start`?`inline-start`:r===`end`?`inline-end`:`none`;return i===`none`?n:`${n}; clear: ${i}`}function cZ(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a={lang:e.locale,dir:Me(e.locale)},o=pZ(t),s=t=>{let n=e.descriptor(t.tag);if(n===null)return t.tag;let r=e.t(n.manifest.messages,n.label);return r===n.label?t.tag:r},c=(e,t)=>{let r=new Set(t.children.filter(e=>e.max!==1).map(e=>n(e.tag)));if(r.size===0)return null;if(e.isAtom)return e.attrs.children.filter(e=>typeof e!=`string`&&r.has(n(e.tag))).length;let i=0,a=new Set;return e.descendants(e=>{r.has(e.type.name)&&i++;for(let t of e.marks)r.has(t.type.name)&&a.add(t.attrs.attributes?.id??t);return!0}),i+a.size},l=e=>{let t=Object.assign(document.createElement(`div`),{className:`astl-frame-head`,...a});t.contentEditable=`false`,e.place!==``&&(t.style.cssText=vZ(e.place)),e.classes.includes(`astl-frame-current`)&&t.classList.add(`astl-frame-head-current`);let n=t.appendChild(Object.assign(document.createElement(`div`),{className:e.classes}));u(n,e);let i=t.appendChild(document.createElement(r===void 0?`span`:`button`));return i.className=`astl-frame-line`,i.textContent=e.line.text,i.setAttribute(`aria-label`,e.line.label),r!==void 0&&(Object.assign(i,{type:`button`,tabIndex:-1}),i.addEventListener(`click`,e=>{e.preventDefault(),r()})),t},u=(e,t)=>{let n=QP.get(t.glyph)??ZP.block,r=Object.assign(document.createElement(`span`),{className:`astl-frame-type`});r.textContent=t.label,e.append(iZ(n),r);for(let n of t.meta){let t=e.appendChild(document.createElement(`span`));t.className=`astl-frame-meta`,t.textContent=n}},d=(e,t,n,r)=>{let o=Object.assign(document.createElement(`div`),{className:`astl-frame-notes astl-frame-${e}${n?` astl-frame-current`:``}`,...a});o.contentEditable=`false`,r!==``&&(o.style.cssText=vZ(r));for(let[e,n]of t){let t=o.appendChild(document.createElement(`div`));t.className=`astl-frame-note`,t.dataset.severity=e;let r=Object.assign(document.createElement(`span`),{className:`astl-vh`});r.textContent=i(`severity.${e}`);let a=Object.assign(document.createElement(`span`),{className:`astl-frame-note-text`});a.textContent=n,t.append(iZ(e),r,a)}return o},f=(e,n,r)=>{let i=new Set;return e.doc.nodesBetween(n.from,n.to,e=>{if(t(e)===null)return!0;let n=e.attrs.attributes?.id;return n!==void 0&&i.add(n),!1}),r.issues.filter(e=>e.at.element!==null&&i.has(e.at.element)).sort((e,t)=>Number(e.severity!==`error`)-Number(t.severity!==`error`))},p=(n,r)=>{let a=[],u=QX(n,o);for(let p of ZX(n.doc,o))p.blocks.forEach((o,m)=>{let h=o.component,g=h===null?null:t(h);if(h===null||g===null)return;let _=f(n,o,r),v=_[0]?.severity??null,y=u!==null&&u.page===p.page&&u.index===m,b=[`astl-frame`];y&&b.push(`astl-frame-current`),v!==null&&b.push(`astl-frame-${v}`);let x=c(h,g),ee=[...x===null?[]:[i(`surface.items`,{n:x})],...g.graded?[i(`surface.points`,{points:rZ(h)})]:[]],te=sZ(h),ne=h.attrs.attributes?.style??``,re={glyph:e.descriptor(g.tag)?.icon??``,label:s(g),meta:ee,classes:b.join(` `).replace(`astl-frame`,`astl-frame-tab`),place:te,line:oZ(i,PN(ne),RN(ne))};if(a.push(uG.widget(o.from,()=>l(re),{key:`tab\n${JSON.stringify(re)}`,side:-2,stopEvent:()=>!0,ignoreSelection:!0})),v!==null){let t=_.map(t=>[t.severity,e.describe(t,r.source,{page:!1})]);a.push(uG.widget(o.from,()=>d(v,t,y,te),{key:`notes\n${JSON.stringify(t)}\n${y}\n${te}`,side:-1,stopEvent:()=>!0,ignoreSelection:!0}))}a.push(uG.node(o.from,o.to,{class:b.join(` `),...te===``?{}:{style:te},...y?{"data-astl-current":``}:{}}))});return pG.create(n.doc,a)},m=new nB(`astlBlocks`),h=t=>{let n=KX(t);return{issues:e.validate(n).issues,source:n}};return Z.create({name:`astlBlocks`,addProseMirrorPlugins:()=>[new J({key:m,state:{init:(e,t)=>{let n=h(t.doc);return{checked:n,decorations:p(t,n)}},apply:(e,t,n,r)=>{let i=e.getMeta(m)??t.checked;return e.docChanged||e.selectionSet||i!==t.checked?{checked:i,decorations:p(r,i)}:t}},props:{decorations:e=>m.getState(e)?.decorations??pG.empty},view:()=>{let e;return{update:(t,n)=>{t.state.doc!==n.doc&&(clearTimeout(e),e=setTimeout(()=>{t.isDestroyed||t.dispatch(t.state.tr.setMeta(m,h(t.state.doc)).setMeta(`addToHistory`,!1))},fZ))},destroy:()=>clearTimeout(e)}}})]})}var lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ=n((()=>{w(),kI(),WX(),_K(),WB(),UB(),EG(),z(),JX(),lZ=`astlPage`,uZ=`astlLayout`,dZ=`astlLayoutColumn`,fZ=300,pZ=e=>t=>e(t)?.display===`block`,mZ=`astlBlockChange`,hZ=(e,t,n)=>ZX(e,n).find(e=>e.page===t)??null,gZ=`http://www.w3.org/2000/svg`,_Z={error:`M10 2.5a7.5 7.5 0 1 1 0 15a7.5 7.5 0 1 1 0-15zM7 7l6 6m0-6l-6 6`,warning:`M10 2.8l7.6 13.4H2.4zM10 8v3.6M10 14.2v.01`},vZ=e=>e.split(`; `).filter(e=>!e.startsWith(`margin-block-end`)&&!e.startsWith(`display`)).join(`; `)}));function bZ(e){let t=e;return wZ.add(t),t}function xZ(e){return Array.isArray(e)&&wZ.has(e)}function SZ(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&TZ.has(e)&&!xZ(e)?SZ(e):[e])}function CZ(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!xZ(n)&&!TZ.has(n)?bZ(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(xZ(n))return bZ([e,r,n]);if(n.length===0)return bZ([e,r]);let t=SZ(n);return t.length===0?bZ([e,r]):bZ([e,r,...t])}return bZ(n==null?[e,r]:[e,r,n])}var wZ,TZ,EZ,DZ=n((()=>{wZ=new WeakSet,TZ=new WeakSet,EZ=(e,t)=>CZ(e,t)})),OZ=n((()=>{DZ()})),kZ,AZ,jZ,MZ=n((()=>{WX(),WB(),UB(),OZ(),kZ=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new W(n,0,0);return e.replace(l,i.after(),r),e.setSelection(K.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},AZ=/^\s*>\s$/,jZ=UX.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return EZ(`blockquote`,{...uq(this.options.HTMLAttributes,e),children:EZ(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
6976
+ `,textSerializers:n={}}=e||{};return xq(this.state.doc,{blockSeparator:t,textSerializers:{...Sq(this.schema),...n}})}get isEmpty(){return Fq(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new VX(t,this,!1,n)}get $doc(){return this.$pos(0)}},WX=class e extends xX{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}}}));function KX(e){let t=JX.createElement(`div`);return t.append(e),t.innerHTML}function qX(e){let t=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`),n=e=>Object.entries(e).map(([e,n])=>` ${e}="${t(n)}"`).join(``),r=e.attrs.rules.map(e=>`<${he}${n(e)}></${he}>`).join(``),i=hR.fromSchema(e.type.schema);return`<astl-doc${n(e.attrs.attributes)}>${r}${KX(i.serializeFragment(e.content,{document:JX}))}</astl-doc>`}var JX,YX=n((()=>{w(),WB(),JX=document.implementation.createHTMLDocument(``)}));function XX(e,t,n){let r=[],i={parent:e,parentStart:t},a=null;return e.forEach((e,o,s)=>{let c=t+o,l=c+e.nodeSize,u=e.type.name===dZ;u||n(e)?(a!==null&&r.push(a),a=null,r.push({from:c,to:l,start:s,end:s+1,component:u?null:e,...i})):a=a===null?{from:c,to:l,start:s,end:s+1,component:null,...i}:{...a,to:l,end:s+1}}),a!==null&&r.push(a),r}function ZX(e,t,n){return XX(e,t,n).flatMap(t=>{let r=e.child(t.start);if(r.type.name!==`astlLayout`)return[t];let i=[];return r.forEach((e,r)=>{i.push(...ZX(e,t.from+r+2,n))}),i})}function QX(e,t){if(e.firstChild?.type.name!==uZ)return[{page:null,node:e,start:0,blocks:ZX(e,0,t)}];let n=[];return e.forEach((e,r)=>{let i=e.attrs.attributes?.id;n.push({page:i===void 0||i===``?null:i,node:e,start:r+1,blocks:ZX(e,r+1,t)})}),n}function $X(e,t){let{doc:n,selection:r}=e,i=n.firstChild?.type.name===uZ,a=+!!i,{$from:o}=r;if(o.depth<a)return null;let s=QX(n,t),c=i?s[o.index(0)]:s[0],l=c?.blocks.at(-1);if(c===void 0||l===void 0)return null;let u=Math.min(o.pos,l.to-1),d=c.blocks.findIndex(e=>u>=e.from&&u<e.to);return d<0?null:{page:c.page,index:d}}function eZ(e,t,n,r){return gZ(e,t,r)?.blocks.findIndex(e=>n>=e.from&&n<e.to)??-1}function tZ(e,t){let n=e.nodeAt(t);return n?.isAtom===!0&&q.isSelectable(n)?q.create(e,t):G.near(e.resolve(t+1))}function nZ(e,t,n,r){let i=gZ(e.doc,t.page,r)?.blocks[t.index];if(i===void 0)return null;let a=XX(i.parent,i.parentStart,r),o=a[a.findIndex(e=>e.from===i.from)+(n===`up`?-1:1)];if(o===void 0)return null;let[s,c]=n===`up`?[o,i]:[i,o],l=[];for(let e=c.start;e<c.end;e++)l.push(i.parent.child(e));let u=U.from(l);e.delete(c.from,c.to),e.insert(s.from,u);let d=n===`up`?s.from:s.from+u.size;e.setSelection(tZ(e.doc,d));let f=eZ(e.doc,t.page,d,r);return tK(e).setMeta(hZ,{key:n===`up`?`surface.blockMovedUp`:`surface.blockMovedDown`,params:{n:f+1}}).scrollIntoView(),f}function rZ(e,t,n){let r=gZ(e.doc,t.page,n)?.blocks[t.index],i=e.doc.type.schema.nodes.paragraph;if(r===void 0||i===void 0)return!1;let a=r.end===r.parent.childCount,o=a&&r.start===0;return o?e.replaceWith(r.from,r.to,i.create()):e.delete(r.from,r.to),e.setSelection(o?K.create(e.doc,r.from+1):a?G.near(e.doc.resolve(r.from),-1):tZ(e.doc,r.from)),tK(e).setMeta(hZ,{key:`surface.blockRemoved`,params:{n:t.index+1}}).scrollIntoView(),!0}function iZ(e){let t=Number(e.attrs.attributes?.points);return Number.isFinite(t)&&t>0?t:1}function aZ(e){let t=document.createElementNS(_Z,`svg`);return t.setAttribute(`viewBox`,`0 0 20 20`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`),t.classList.add(`astl-icon`),typeof e==`string`?t.appendChild(document.createElementNS(_Z,`path`)).setAttribute(`d`,vZ[e]):TC(e,t),t}function oZ(e,t){let n=t.target;if(!(t.ctrlKey||t.metaKey)||t.altKey||n.localName===`input`)return;let r=t.key.toLowerCase(),i=r===`z`?t.shiftKey?hK:mK:r===`y`&&!t.shiftKey?hK:null;i!==null&&(t.preventDefault(),e.focus(),i(e.state,e.dispatch))}function sZ(e,t,n){let r=e(`style.position.${t}`);return n===null?{text:r,label:e(`surface.picture.placeAuto`,{position:r})}:{text:`${r} · ${n}%`,label:e(`surface.picture.place`,{position:r,width:`${n}%`})}}function cZ(e){let t=e.attrs.attributes?.style??``,{placed:n}=LN(t);if(n===``)return``;let r=PN(t),i=r===`start`?`inline-start`:r===`end`?`inline-end`:`none`;return i===`none`?n:`${n}; clear: ${i}`}function lZ(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a={lang:e.locale,dir:Me(e.locale)},o=mZ(t),s=t=>{let n=e.descriptor(t.tag);if(n===null)return t.tag;let r=e.t(n.manifest.messages,n.label);return r===n.label?t.tag:r},c=(e,t)=>{let r=new Set(t.children.filter(e=>e.max!==1).map(e=>n(e.tag)));if(r.size===0)return null;if(e.isAtom)return e.attrs.children.filter(e=>typeof e!=`string`&&r.has(n(e.tag))).length;let i=0,a=new Set;return e.descendants(e=>{r.has(e.type.name)&&i++;for(let t of e.marks)r.has(t.type.name)&&a.add(t.attrs.attributes?.id??t);return!0}),i+a.size},l=e=>{let t=Object.assign(document.createElement(`div`),{className:`astl-frame-head`,...a});t.contentEditable=`false`,e.place!==``&&(t.style.cssText=yZ(e.place)),e.classes.includes(`astl-frame-current`)&&t.classList.add(`astl-frame-head-current`);let n=t.appendChild(Object.assign(document.createElement(`div`),{className:e.classes}));u(n,e);let i=t.appendChild(document.createElement(r===void 0?`span`:`button`));return i.className=`astl-frame-line`,i.textContent=e.line.text,i.setAttribute(`aria-label`,e.line.label),r!==void 0&&(Object.assign(i,{type:`button`,tabIndex:-1}),i.addEventListener(`click`,e=>{e.preventDefault(),r()})),t},u=(e,t)=>{let n=QP.get(t.glyph)??ZP.block,r=Object.assign(document.createElement(`span`),{className:`astl-frame-type`});r.textContent=t.label,e.append(aZ(n),r);for(let n of t.meta){let t=e.appendChild(document.createElement(`span`));t.className=`astl-frame-meta`,t.textContent=n}},d=(e,t,n,r)=>{let o=Object.assign(document.createElement(`div`),{className:`astl-frame-notes astl-frame-${e}${n?` astl-frame-current`:``}`,...a});o.contentEditable=`false`,r!==``&&(o.style.cssText=yZ(r));for(let[e,n]of t){let t=o.appendChild(document.createElement(`div`));t.className=`astl-frame-note`,t.dataset.severity=e;let r=Object.assign(document.createElement(`span`),{className:`astl-vh`});r.textContent=i(`severity.${e}`);let a=Object.assign(document.createElement(`span`),{className:`astl-frame-note-text`});a.textContent=n,t.append(aZ(e),r,a)}return o},f=(e,n,r)=>{let i=new Set;return e.doc.nodesBetween(n.from,n.to,e=>{if(t(e)===null)return!0;let n=e.attrs.attributes?.id;return n!==void 0&&i.add(n),!1}),r.issues.filter(e=>e.at.element!==null&&i.has(e.at.element)).sort((e,t)=>Number(e.severity!==`error`)-Number(t.severity!==`error`))},p=(n,r)=>{let a=[],u=$X(n,o);for(let p of QX(n.doc,o))p.blocks.forEach((o,m)=>{let h=o.component,g=h===null?null:t(h);if(h===null||g===null)return;let _=f(n,o,r),v=_[0]?.severity??null,y=u!==null&&u.page===p.page&&u.index===m,b=[`astl-frame`];y&&b.push(`astl-frame-current`),v!==null&&b.push(`astl-frame-${v}`);let x=c(h,g),ee=[...x===null?[]:[i(`surface.items`,{n:x})],...g.graded?[i(`surface.points`,{points:iZ(h)})]:[]],te=cZ(h),ne=h.attrs.attributes?.style??``,re={glyph:e.descriptor(g.tag)?.icon??``,label:s(g),meta:ee,classes:b.join(` `).replace(`astl-frame`,`astl-frame-tab`),place:te,line:sZ(i,PN(ne),RN(ne))};if(a.push(uG.widget(o.from,()=>l(re),{key:`tab\n${JSON.stringify(re)}`,side:-2,stopEvent:()=>!0,ignoreSelection:!0})),v!==null){let t=_.map(t=>[t.severity,e.describe(t,r.source,{page:!1})]);a.push(uG.widget(o.from,()=>d(v,t,y,te),{key:`notes\n${JSON.stringify(t)}\n${y}\n${te}`,side:-1,stopEvent:()=>!0,ignoreSelection:!0}))}a.push(uG.node(o.from,o.to,{class:b.join(` `),...te===``?{}:{style:te},...y?{"data-astl-current":``}:{}}))});return pG.create(n.doc,a)},m=new nB(`astlBlocks`),h=t=>{let n=qX(t);return{issues:e.validate(n).issues,source:n}};return OX.create({name:`astlBlocks`,addProseMirrorPlugins:()=>[new J({key:m,state:{init:(e,t)=>{let n=h(t.doc);return{checked:n,decorations:p(t,n)}},apply:(e,t,n,r)=>{let i=e.getMeta(m)??t.checked;return e.docChanged||e.selectionSet||i!==t.checked?{checked:i,decorations:p(r,i)}:t}},props:{decorations:e=>m.getState(e)?.decorations??pG.empty},view:()=>{let e;return{update:(t,n)=>{t.state.doc!==n.doc&&(clearTimeout(e),e=setTimeout(()=>{t.isDestroyed||t.dispatch(t.state.tr.setMeta(m,h(t.state.doc)).setMeta(`addToHistory`,!1))},pZ))},destroy:()=>clearTimeout(e)}}})]})}var uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ=n((()=>{w(),kI(),GX(),_K(),WB(),UB(),EG(),z(),YX(),uZ=`astlPage`,dZ=`astlLayout`,fZ=`astlLayoutColumn`,pZ=300,mZ=e=>t=>e(t)?.display===`block`,hZ=`astlBlockChange`,gZ=(e,t,n)=>QX(e,n).find(e=>e.page===t)??null,_Z=`http://www.w3.org/2000/svg`,vZ={error:`M10 2.5a7.5 7.5 0 1 1 0 15a7.5 7.5 0 1 1 0-15zM7 7l6 6m0-6l-6 6`,warning:`M10 2.8l7.6 13.4H2.4zM10 8v3.6M10 14.2v.01`},yZ=e=>e.split(`; `).filter(e=>!e.startsWith(`margin-block-end`)&&!e.startsWith(`display`)).join(`; `)}));function xZ(e){let t=e;return TZ.add(t),t}function SZ(e){return Array.isArray(e)&&TZ.has(e)}function CZ(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&EZ.has(e)&&!SZ(e)?CZ(e):[e])}function wZ(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!SZ(n)&&!EZ.has(n)?xZ(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(SZ(n))return xZ([e,r,n]);if(n.length===0)return xZ([e,r]);let t=CZ(n);return t.length===0?xZ([e,r]):xZ([e,r,...t])}return xZ(n==null?[e,r]:[e,r,n])}var TZ,EZ,DZ,OZ=n((()=>{TZ=new WeakSet,EZ=new WeakSet,DZ=(e,t)=>wZ(e,t)})),kZ=n((()=>{OZ()})),AZ,jZ,MZ,NZ=n((()=>{GX(),WB(),UB(),kZ(),AZ=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new W(n,0,0);return e.replace(l,i.after(),r),e.setSelection(K.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},jZ=/^\s*>\s$/,MZ=WX.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return DZ(`blockquote`,{...uq(this.options.HTMLAttributes,e),children:DZ(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
6973
6977
  `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
6974
6978
  `))}),n.join(`
6975
6979
  >
6976
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>kZ(this.editor,this.type)}},addInputRules(){return[zJ({find:AZ,type:this.type})]}})})),NZ,PZ,FZ,IZ,LZ,RZ=n((()=>{WX(),OZ(),NZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,PZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,FZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,IZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,LZ=SX.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return EZ(`strong`,{...uq(this.options.HTMLAttributes,e),children:EZ(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[IJ({find:NZ,type:this.type}),IJ({find:FZ,type:this.type})]},addPasteRules(){return[BJ({find:PZ,type:this.type}),BJ({find:IZ,type:this.type})]}})}));function zZ(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var BZ,VZ,HZ,UZ=n((()=>{WX(),BZ=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},VZ=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},HZ=SX.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(zZ(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[IJ({find:BZ,type:this.type})]},addPasteRules(){return[BJ({find:VZ,type:this.type})]}})})),WZ,GZ,KZ,qZ,JZ=n((()=>{WX(),UB(),WZ=4,GZ=/^```([a-z]+)?[\s\n]$/,KZ=/^~~~([a-z]+)?[\s\n]$/,qZ=UX.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:WZ,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,uq(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
6977
- `):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??WZ,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
6980
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>AZ(this.editor,this.type)}},addInputRules(){return[zJ({find:jZ,type:this.type})]}})})),PZ,FZ,IZ,LZ,RZ,zZ=n((()=>{GX(),kZ(),PZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,FZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,IZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,LZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,RZ=SX.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return DZ(`strong`,{...uq(this.options.HTMLAttributes,e),children:DZ(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[IJ({find:PZ,type:this.type}),IJ({find:IZ,type:this.type})]},addPasteRules(){return[BJ({find:FZ,type:this.type}),BJ({find:LZ,type:this.type})]}})}));function BZ(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var VZ,HZ,UZ,WZ=n((()=>{GX(),VZ=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},HZ=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},UZ=SX.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(BZ(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[IJ({find:VZ,type:this.type})]},addPasteRules(){return[BJ({find:HZ,type:this.type})]}})})),GZ,KZ,qZ,JZ,YZ=n((()=>{GX(),UB(),GZ=4,KZ=/^```([a-z]+)?[\s\n]$/,qZ=/^~~~([a-z]+)?[\s\n]$/,JZ=WX.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:GZ,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,uq(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
6981
+ `):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??GZ,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
6978
6982
  `,`
6979
6983
  `).split(`
6980
6984
  `).map(e=>o+e).join(`
6981
- `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??WZ,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
6985
+ `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??GZ,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
6982
6986
  `,`
6983
6987
  `).split(`
6984
6988
  `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(K.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
@@ -6987,29 +6991,29 @@ img.ProseMirror-separator {
6987
6991
  `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
6988
6992
  `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
6989
6993
 
6990
- `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(G.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[RJ({find:GZ,type:this.type,getAttributes:e=>({language:e[1]})}),RJ({find:KZ,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new J({key:new nB(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
6991
- `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(K.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}})})),YZ,XZ=n((()=>{WX(),YZ=UX.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
6994
+ `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(G.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[RJ({find:KZ,type:this.type,getAttributes:e=>({language:e[1]})}),RJ({find:qZ,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new J({key:new nB(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
6995
+ `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(K.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}})})),XZ,ZZ=n((()=>{GX(),XZ=WX.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
6992
6996
 
6993
- `):``})})),ZZ,QZ=n((()=>{WX(),ZZ=UX.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,uq(this.options.HTMLAttributes,e)]},renderText(){return`
6997
+ `):``})})),QZ,$Z=n((()=>{GX(),QZ=WX.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,uq(this.options.HTMLAttributes,e)]},renderText(){return`
6994
6998
  `},renderMarkdown:()=>`
6995
- `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})})),$Z,eQ=n((()=>{WX(),$Z=UX.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,uq(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>RJ({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}})})),tQ,nQ=n((()=>{WX(),UB(),tQ=UX.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,uq(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!vJ(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Iq(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(K.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(q.create(t.doc,n.pos)):t.setSelection(K.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(K.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LJ({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})})),rQ,iQ,aQ,oQ,sQ,cQ=n((()=>{WX(),rQ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,iQ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,aQ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,oQ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sQ=SX.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,uq(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[IJ({find:rQ,type:this.type}),IJ({find:aQ,type:this.type})]},addPasteRules(){return[BJ({find:iQ,type:this.type}),BJ({find:oQ,type:this.type})]}})}));function lQ(e,t){return e in t||(t[e]=[]),t[e]}function uQ(e,t,n){t[MQ]&&(t[FQ]=!0,t[IQ]=!0),t[NQ]&&(t[FQ]=!0,t[PQ]=!0),t[FQ]&&(t[IQ]=!0),t[PQ]&&(t[IQ]=!0),t[IQ]&&(t[LQ]=!0),t[RQ]&&(t[LQ]=!0);for(let r in t){let t=lQ(r,n);t.indexOf(e)<0&&t.push(e)}}function dQ(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function fQ(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}function pQ(e=[]){let t={};fQ.groups=t;let n=new fQ;n1??=_Q(AQ),r1??=_Q(jQ),$(n,`'`,y$),$(n,`{`,n$),$(n,`}`,r$),$(n,`[`,i$),$(n,`]`,a$),$(n,`(`,o$),$(n,`)`,s$),$(n,`<`,c$),$(n,`>`,l$),$(n,`(`,u$),$(n,`)`,d$),$(n,`「`,f$),$(n,`」`,p$),$(n,`『`,m$),$(n,`』`,h$),$(n,`<`,g$),$(n,`>`,_$),$(n,`&`,v$),$(n,`*`,b$),$(n,`@`,x$),$(n,"`",C$),$(n,`^`,w$),$(n,`:`,T$),$(n,`,`,E$),$(n,`$`,D$),$(n,`.`,O$),$(n,`=`,k$),$(n,`!`,A$),$(n,`-`,j$),$(n,`%`,M$),$(n,`|`,N$),$(n,`+`,P$),$(n,`#`,F$),$(n,`?`,I$),$(n,`"`,L$),$(n,`/`,B$),$(n,`;`,z$),$(n,`~`,V$),$(n,`_`,H$),$(n,`\\`,S$),$(n,`・`,R$);let r=HQ(n,Y$,$Q,{[MQ]:!0});HQ(r,Y$,r);let i=HQ(r,K$,KQ,{[FQ]:!0}),a=HQ(r,q$,qQ,{[IQ]:!0}),o=HQ(n,K$,WQ,{[NQ]:!0});HQ(o,Y$,i),HQ(o,K$,o),HQ(i,Y$,i),HQ(i,K$,i);let s=HQ(n,q$,GQ,{[PQ]:!0});HQ(s,K$),HQ(s,Y$,a),HQ(s,q$,s),HQ(a,Y$,a),HQ(a,K$),HQ(a,q$,a);let c=$(n,Q$,t$,{[VQ]:!0}),l=$(n,Z$,e$,{[VQ]:!0}),u=HQ(n,X$,e$,{[VQ]:!0});$(n,t1,u),$(l,Q$,c),$(l,t1,u),HQ(l,X$,u),$(u,Z$),$(u,Q$),HQ(u,X$,u),$(u,t1,u);let d=HQ(n,J$,U$,{[RQ]:!0});$(d,`#`),HQ(d,J$,d),$(d,$$,d);let f=$(d,e1);$(f,`#`),HQ(f,J$,d);let p=[[K$,o],[Y$,i]],m=[[K$,null],[q$,s],[Y$,a]];for(let e=0;e<n1.length;e++)gQ(n,n1[e],YQ,WQ,p);for(let e=0;e<r1.length;e++)gQ(n,r1[e],XQ,GQ,m);uQ(YQ,{tld:!0,ascii:!0},t),uQ(XQ,{utld:!0,alpha:!0},t),gQ(n,`file`,ZQ,WQ,p),gQ(n,`mailto`,ZQ,WQ,p),gQ(n,`http`,QQ,WQ,p),gQ(n,`https`,QQ,WQ,p),gQ(n,`ftp`,QQ,WQ,p),gQ(n,`ftps`,QQ,WQ,p),uQ(ZQ,{scheme:!0,ascii:!0},t),uQ(QQ,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[zQ]:!0}:{[BQ]:!0};r.indexOf(`-`)>=0?i[LQ]=!0:K$.test(r)?Y$.test(r)?i[FQ]=!0:i[NQ]=!0:i[MQ]=!0,UQ(n,r,r,i)}return UQ(n,`localhost`,JQ,{ascii:!0}),n.jd=new fQ(W$),{start:n,tokens:Object.assign({groups:t},G$)}}function mQ(e,t){let n=hQ(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function hQ(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function gQ(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new fQ(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new fQ(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function _Q(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}function vQ(e,t=null){let n=Object.assign({},i1);e&&(n=Object.assign(n,e instanceof vQ?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function yQ(e){return e}function bQ(e,t){this.t=`token`,this.v=e,this.tk=t}function xQ(e,t){class n extends bQ{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}function SQ({groups:e}){let t=e.domain.concat([v$,b$,x$,S$,C$,w$,D$,k$,j$,$Q,M$,N$,P$,F$,B$,W$,V$,H$]),n=[y$,T$,E$,O$,A$,M$,I$,L$,z$,c$,l$,n$,r$,a$,i$,o$,s$,u$,d$,f$,p$,m$,h$,g$,_$],r=[v$,y$,b$,S$,C$,w$,D$,k$,j$,n$,r$,M$,N$,P$,F$,I$,B$,W$,V$,H$],i=l1(),a=$(i,V$);Q(a,r,a),Q(a,e.domain,a);let o=l1(),s=l1(),c=l1();Q(i,e.domain,o),Q(i,e.scheme,s),Q(i,e.slashscheme,c),Q(o,r,a),Q(o,e.domain,o);let l=$(o,x$);$(a,x$,l),$(s,x$,l),$(c,x$,l);let u=$(a,O$);Q(u,r,a),Q(u,e.domain,a);let d=l1();Q(l,e.domain,d),Q(d,e.domain,d);let f=$(d,O$);Q(f,e.domain,d);let p=l1(a1);Q(f,e.tld,p),Q(f,e.utld,p),$(l,JQ,p);let m=$(d,j$);$(m,j$,m),Q(m,e.domain,d),Q(p,e.domain,d),$(p,O$,f),$(p,j$,m);let h=$(o,j$),g=$(o,O$);$(h,j$,h),Q(h,e.domain,o),Q(g,r,a),Q(g,e.domain,o);let _=l1(c1);Q(g,e.tld,_),Q(g,e.utld,_),Q(_,e.domain,o),Q(_,r,a),$(_,O$,g),$(_,j$,h),$(_,x$,l);let v=$(_,T$),y=l1(c1);Q(v,e.numeric,y);let b=l1(c1),x=l1();Q(b,t,b),Q(b,n,x),Q(x,t,b),Q(x,n,x),$(_,B$,b),$(y,B$,b);let ee=$(s,T$),te=$(c,T$),ne=$(te,B$),re=$(ne,B$);Q(s,e.domain,o),$(s,O$,g),$(s,j$,h),Q(c,e.domain,o),$(c,O$,g),$(c,j$,h),Q(ee,e.domain,b),$(ee,B$,b),$(ee,I$,b),Q(re,e.domain,b),Q(re,t,b),$(re,B$,b);let ie=[[n$,r$],[i$,a$],[o$,s$],[c$,l$],[u$,d$],[f$,p$],[m$,h$],[g$,_$]];for(let e=0;e<ie.length;e++){let[r,i]=ie[e],a=$(b,r);$(x,r,a);let o=l1(c1);Q(a,t,o);let s=l1();Q(a,n,s),$(a,i,b),Q(o,t,o),Q(o,n,s),Q(s,t,o),Q(s,n,s),$(o,i,b),$(s,i,b)}return $(i,JQ,_),$(i,t$,s1),{start:i,tokens:G$}}function CQ(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(wQ(o1,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(wQ(e,t,r))}}return o.length>0&&a.push(wQ(o1,t,o)),a}function wQ(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}function TQ(){return fQ.groups={},f1.scanner=null,f1.parser=null,f1.tokenQueue=[],f1.pluginQueue=[],f1.customSchemes=[],f1.initialized=!1,f1}function EQ(e,t=!1){if(f1.initialized&&u1(`linkifyjs: already initialized - will not register custom scheme "${e}" ${d1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
6999
+ `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})})),eQ,tQ=n((()=>{GX(),eQ=WX.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,uq(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>RJ({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}})})),nQ,rQ=n((()=>{GX(),UB(),nQ=WX.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,uq(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!vJ(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Iq(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(K.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(q.create(t.doc,n.pos)):t.setSelection(K.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(K.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LJ({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})})),iQ,aQ,oQ,sQ,cQ,lQ=n((()=>{GX(),iQ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,aQ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,oQ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sQ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,cQ=SX.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,uq(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[IJ({find:iQ,type:this.type}),IJ({find:oQ,type:this.type})]},addPasteRules(){return[BJ({find:aQ,type:this.type}),BJ({find:sQ,type:this.type})]}})}));function uQ(e,t){return e in t||(t[e]=[]),t[e]}function dQ(e,t,n){t[NQ]&&(t[IQ]=!0,t[LQ]=!0),t[PQ]&&(t[IQ]=!0,t[FQ]=!0),t[IQ]&&(t[LQ]=!0),t[FQ]&&(t[LQ]=!0),t[LQ]&&(t[RQ]=!0),t[zQ]&&(t[RQ]=!0);for(let r in t){let t=uQ(r,n);t.indexOf(e)<0&&t.push(e)}}function fQ(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function pQ(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}function mQ(e=[]){let t={};pQ.groups=t;let n=new pQ;r1??=vQ(jQ),i1??=vQ(MQ),Q(n,`'`,b$),Q(n,`{`,r$),Q(n,`}`,i$),Q(n,`[`,a$),Q(n,`]`,o$),Q(n,`(`,s$),Q(n,`)`,c$),Q(n,`<`,l$),Q(n,`>`,u$),Q(n,`(`,d$),Q(n,`)`,f$),Q(n,`「`,p$),Q(n,`」`,m$),Q(n,`『`,h$),Q(n,`』`,g$),Q(n,`<`,_$),Q(n,`>`,v$),Q(n,`&`,y$),Q(n,`*`,x$),Q(n,`@`,S$),Q(n,"`",w$),Q(n,`^`,T$),Q(n,`:`,E$),Q(n,`,`,D$),Q(n,`$`,O$),Q(n,`.`,k$),Q(n,`=`,A$),Q(n,`!`,j$),Q(n,`-`,M$),Q(n,`%`,N$),Q(n,`|`,P$),Q(n,`+`,F$),Q(n,`#`,I$),Q(n,`?`,L$),Q(n,`"`,R$),Q(n,`/`,V$),Q(n,`;`,B$),Q(n,`~`,H$),Q(n,`_`,U$),Q(n,`\\`,C$),Q(n,`・`,z$);let r=UQ(n,X$,e$,{[NQ]:!0});UQ(r,X$,r);let i=UQ(r,q$,qQ,{[IQ]:!0}),a=UQ(r,J$,JQ,{[LQ]:!0}),o=UQ(n,q$,GQ,{[PQ]:!0});UQ(o,X$,i),UQ(o,q$,o),UQ(i,X$,i),UQ(i,q$,i);let s=UQ(n,J$,KQ,{[FQ]:!0});UQ(s,q$),UQ(s,X$,a),UQ(s,J$,s),UQ(a,X$,a),UQ(a,q$),UQ(a,J$,a);let c=Q(n,$$,n$,{[HQ]:!0}),l=Q(n,Q$,t$,{[HQ]:!0}),u=UQ(n,Z$,t$,{[HQ]:!0});Q(n,n1,u),Q(l,$$,c),Q(l,n1,u),UQ(l,Z$,u),Q(u,Q$),Q(u,$$),UQ(u,Z$,u),Q(u,n1,u);let d=UQ(n,Y$,W$,{[zQ]:!0});Q(d,`#`),UQ(d,Y$,d),Q(d,e1,d);let f=Q(d,t1);Q(f,`#`),UQ(f,Y$,d);let p=[[q$,o],[X$,i]],m=[[q$,null],[J$,s],[X$,a]];for(let e=0;e<r1.length;e++)_Q(n,r1[e],XQ,GQ,p);for(let e=0;e<i1.length;e++)_Q(n,i1[e],ZQ,KQ,m);dQ(XQ,{tld:!0,ascii:!0},t),dQ(ZQ,{utld:!0,alpha:!0},t),_Q(n,`file`,QQ,GQ,p),_Q(n,`mailto`,QQ,GQ,p),_Q(n,`http`,$Q,GQ,p),_Q(n,`https`,$Q,GQ,p),_Q(n,`ftp`,$Q,GQ,p),_Q(n,`ftps`,$Q,GQ,p),dQ(QQ,{scheme:!0,ascii:!0},t),dQ($Q,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[BQ]:!0}:{[VQ]:!0};r.indexOf(`-`)>=0?i[RQ]=!0:q$.test(r)?X$.test(r)?i[IQ]=!0:i[PQ]=!0:i[NQ]=!0,WQ(n,r,r,i)}return WQ(n,`localhost`,YQ,{ascii:!0}),n.jd=new pQ(G$),{start:n,tokens:Object.assign({groups:t},K$)}}function hQ(e,t){let n=gQ(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function gQ(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function _Q(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new pQ(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new pQ(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function vQ(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}function yQ(e,t=null){let n=Object.assign({},a1);e&&(n=Object.assign(n,e instanceof yQ?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function bQ(e){return e}function xQ(e,t){this.t=`token`,this.v=e,this.tk=t}function SQ(e,t){class n extends xQ{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}function CQ({groups:e}){let t=e.domain.concat([y$,x$,S$,C$,w$,T$,O$,A$,M$,e$,N$,P$,F$,I$,V$,G$,H$,U$]),n=[b$,E$,D$,k$,j$,N$,L$,R$,B$,l$,u$,r$,i$,o$,a$,s$,c$,d$,f$,p$,m$,h$,g$,_$,v$],r=[y$,b$,x$,C$,w$,T$,O$,A$,M$,r$,i$,N$,P$,F$,I$,L$,V$,G$,H$,U$],i=u1(),a=Q(i,H$);Z(a,r,a),Z(a,e.domain,a);let o=u1(),s=u1(),c=u1();Z(i,e.domain,o),Z(i,e.scheme,s),Z(i,e.slashscheme,c),Z(o,r,a),Z(o,e.domain,o);let l=Q(o,S$);Q(a,S$,l),Q(s,S$,l),Q(c,S$,l);let u=Q(a,k$);Z(u,r,a),Z(u,e.domain,a);let d=u1();Z(l,e.domain,d),Z(d,e.domain,d);let f=Q(d,k$);Z(f,e.domain,d);let p=u1(o1);Z(f,e.tld,p),Z(f,e.utld,p),Q(l,YQ,p);let m=Q(d,M$);Q(m,M$,m),Z(m,e.domain,d),Z(p,e.domain,d),Q(p,k$,f),Q(p,M$,m);let h=Q(o,M$),g=Q(o,k$);Q(h,M$,h),Z(h,e.domain,o),Z(g,r,a),Z(g,e.domain,o);let _=u1(l1);Z(g,e.tld,_),Z(g,e.utld,_),Z(_,e.domain,o),Z(_,r,a),Q(_,k$,g),Q(_,M$,h),Q(_,S$,l);let v=Q(_,E$),y=u1(l1);Z(v,e.numeric,y);let b=u1(l1),x=u1();Z(b,t,b),Z(b,n,x),Z(x,t,b),Z(x,n,x),Q(_,V$,b),Q(y,V$,b);let ee=Q(s,E$),te=Q(c,E$),ne=Q(te,V$),re=Q(ne,V$);Z(s,e.domain,o),Q(s,k$,g),Q(s,M$,h),Z(c,e.domain,o),Q(c,k$,g),Q(c,M$,h),Z(ee,e.domain,b),Q(ee,V$,b),Q(ee,L$,b),Z(re,e.domain,b),Z(re,t,b),Q(re,V$,b);let ie=[[r$,i$],[a$,o$],[s$,c$],[l$,u$],[d$,f$],[p$,m$],[h$,g$],[_$,v$]];for(let e=0;e<ie.length;e++){let[r,i]=ie[e],a=Q(b,r);Q(x,r,a);let o=u1(l1);Z(a,t,o);let s=u1();Z(a,n,s),Q(a,i,b),Z(o,t,o),Z(o,n,s),Z(s,t,o),Z(s,n,s),Q(o,i,b),Q(s,i,b)}return Q(i,YQ,_),Q(i,n$,c1),{start:i,tokens:K$}}function wQ(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(TQ(s1,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(TQ(e,t,r))}}return o.length>0&&a.push(TQ(s1,t,o)),a}function TQ(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}function EQ(){return pQ.groups={},p1.scanner=null,p1.parser=null,p1.tokenQueue=[],p1.pluginQueue=[],p1.customSchemes=[],p1.initialized=!1,p1}function DQ(e,t=!1){if(p1.initialized&&d1(`linkifyjs: already initialized - will not register custom scheme "${e}" ${f1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
6996
7000
  1. Must only contain digits, lowercase ASCII letters or "-"
6997
7001
  2. Cannot start or end with "-"
6998
- 3. "-" cannot repeat`);f1.customSchemes.push([e,t])}function DQ(){f1.scanner=pQ(f1.customSchemes);for(let e=0;e<f1.tokenQueue.length;e++)f1.tokenQueue[e][1]({scanner:f1.scanner});f1.parser=SQ(f1.scanner.tokens);for(let e=0;e<f1.pluginQueue.length;e++)f1.pluginQueue[e][1]({scanner:f1.scanner,parser:f1.parser});return f1.initialized=!0,f1}function OQ(e){return f1.initialized||DQ(),CQ(f1.parser.start,e,mQ(f1.scanner.start,e))}function kQ(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new vQ(n),i=OQ(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var AQ,jQ,MQ,NQ,PQ,FQ,IQ,LQ,RQ,zQ,BQ,VQ,Q,HQ,UQ,$,WQ,GQ,KQ,qQ,JQ,YQ,XQ,ZQ,QQ,$Q,e$,t$,n$,r$,i$,a$,o$,s$,c$,l$,u$,d$,f$,p$,m$,h$,g$,_$,v$,y$,b$,x$,S$,C$,w$,T$,E$,D$,O$,k$,A$,j$,M$,N$,P$,F$,I$,L$,R$,z$,B$,V$,H$,U$,W$,G$,K$,q$,J$,Y$,X$,Z$,Q$,$$,e1,t1,n1,r1,i1,a1,o1,s1,c1,l1,u1,d1,f1,p1=n((()=>{AQ=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,jQ=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,MQ=`numeric`,NQ=`ascii`,PQ=`alpha`,FQ=`asciinumeric`,IQ=`alphanumeric`,LQ=`domain`,RQ=`emoji`,zQ=`scheme`,BQ=`slashscheme`,VQ=`whitespace`,fQ.groups={},fQ.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=fQ.groups;let i;return t&&t.j?i=t:(i=new fQ(t),n&&r&&uQ(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=fQ.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new fQ,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new fQ,a&&(r&&(o.t&&typeof o.t==`string`?uQ(a,Object.assign(dQ(o.t,r),n),r):n&&uQ(a,n,r)),o.t=a),i.j[e]=o,o}},Q=(e,t,n,r,i)=>e.ta(t,n,r,i),HQ=(e,t,n,r,i)=>e.tr(t,n,r,i),UQ=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),WQ=`WORD`,GQ=`UWORD`,KQ=`ASCIINUMERICAL`,qQ=`ALPHANUMERICAL`,JQ=`LOCALHOST`,YQ=`TLD`,XQ=`UTLD`,ZQ=`SCHEME`,QQ=`SLASH_SCHEME`,$Q=`NUM`,e$=`WS`,t$=`NL`,n$=`OPENBRACE`,r$=`CLOSEBRACE`,i$=`OPENBRACKET`,a$=`CLOSEBRACKET`,o$=`OPENPAREN`,s$=`CLOSEPAREN`,c$=`OPENANGLEBRACKET`,l$=`CLOSEANGLEBRACKET`,u$=`FULLWIDTHLEFTPAREN`,d$=`FULLWIDTHRIGHTPAREN`,f$=`LEFTCORNERBRACKET`,p$=`RIGHTCORNERBRACKET`,m$=`LEFTWHITECORNERBRACKET`,h$=`RIGHTWHITECORNERBRACKET`,g$=`FULLWIDTHLESSTHAN`,_$=`FULLWIDTHGREATERTHAN`,v$=`AMPERSAND`,y$=`APOSTROPHE`,b$=`ASTERISK`,x$=`AT`,S$=`BACKSLASH`,C$=`BACKTICK`,w$=`CARET`,T$=`COLON`,E$=`COMMA`,D$=`DOLLAR`,O$=`DOT`,k$=`EQUALS`,A$=`EXCLAMATION`,j$=`HYPHEN`,M$=`PERCENT`,N$=`PIPE`,P$=`PLUS`,F$=`POUND`,I$=`QUERY`,L$=`QUOTE`,R$=`FULLWIDTHMIDDLEDOT`,z$=`SEMI`,B$=`SLASH`,V$=`TILDE`,H$=`UNDERSCORE`,U$=`EMOJI`,W$=`SYM`,G$=Object.freeze({__proto__:null,ALPHANUMERICAL:qQ,AMPERSAND:v$,APOSTROPHE:y$,ASCIINUMERICAL:KQ,ASTERISK:b$,AT:x$,BACKSLASH:S$,BACKTICK:C$,CARET:w$,CLOSEANGLEBRACKET:l$,CLOSEBRACE:r$,CLOSEBRACKET:a$,CLOSEPAREN:s$,COLON:T$,COMMA:E$,DOLLAR:D$,DOT:O$,EMOJI:U$,EQUALS:k$,EXCLAMATION:A$,FULLWIDTHGREATERTHAN:_$,FULLWIDTHLEFTPAREN:u$,FULLWIDTHLESSTHAN:g$,FULLWIDTHMIDDLEDOT:R$,FULLWIDTHRIGHTPAREN:d$,HYPHEN:j$,LEFTCORNERBRACKET:f$,LEFTWHITECORNERBRACKET:m$,LOCALHOST:JQ,NL:t$,NUM:$Q,OPENANGLEBRACKET:c$,OPENBRACE:n$,OPENBRACKET:i$,OPENPAREN:o$,PERCENT:M$,PIPE:N$,PLUS:P$,POUND:F$,QUERY:I$,QUOTE:L$,RIGHTCORNERBRACKET:p$,RIGHTWHITECORNERBRACKET:h$,SCHEME:ZQ,SEMI:z$,SLASH:B$,SLASH_SCHEME:QQ,SYM:W$,TILDE:V$,TLD:YQ,UNDERSCORE:H$,UTLD:XQ,UWORD:GQ,WORD:WQ,WS:e$}),K$=/[a-z]/,q$=/\p{L}/u,J$=/\p{Emoji}/u,Y$=/\d/,X$=/\s/,Z$=`\r`,Q$=`
6999
- `,$$=`️`,e1=`‍`,t1=``,n1=null,r1=null,i1={defaultProtocol:`http`,events:null,format:yQ,formatHref:yQ,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null},vQ.prototype={o:i1,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:i1[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}},bQ.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=i1.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}},a1=xQ(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),o1=xQ(`text`),s1=xQ(`nl`),c1=xQ(`url`,{isLink:!0,toHref(e=i1.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==JQ&&e[1].t===T$}}),l1=e=>new fQ(e),u1=typeof console<`u`&&console&&console.warn||(()=>{}),d1=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,f1={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1},OQ.scan=mQ}));function m1(e,t,n){let r=e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i=e.doc.textBetween(t.from,t.to,``,``).match(j1)?.[0];if(!i)return;let a=t.to-i.length,o=Oq(a,t.to,e.doc).filter(e=>e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return;let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty&&e.selection.from===t.to&&e.removeStoredMark(n)}function h1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function g1(e){return new J({key:new nB(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r,s=GK(n.doc,[...t]);if(!t.some(iK)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Tz)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>m1(o,t,e.type))}if(Dq(s).forEach(({newRange:t})=>{let n=KK(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!A1.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(k1).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=OQ(n).map(t=>t.toObject(e.defaultProtocol));if(!h1(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Oq(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function _1(e){return new J({key:new nB(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=wq(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function v1(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function y1(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"||n===0&&v1(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function b1(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||v1(e,t.index??0)||y1(e,t.index??0)?!1:!!r.trim()&&n(i)}function x1(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function S1(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function C1(e){return{href:e.data?.href,title:e.data?.title??null}}function w1(e){let t=IJ({find:t=>{let n=N1.exec(t);return!n||!b1(t,n,e.isAllowedHref)?null:x1(n)},type:e.type,getAttributes:C1});return new yX({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function T1(e){let t=BJ({find:t=>{let n=[];for(let r of t.matchAll(P1))b1(t,r,e.isAllowedHref)&&n.push(x1(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>S1(t,e)));return[...n,...r]},type:e.type,getAttributes:C1});return new CX({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function E1(e){return new J({key:new nB(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=kQ(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function D1(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(M1,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var O1,k1,A1,j1,M1,N1,P1,F1,I1=n((()=>{WX(),p1(),_K(),UB(),Nz(),O1=`[\0- \xA0 ᠎ -\u2029  ]`,k1=new RegExp(O1),A1=RegExp(`${O1}$`),j1=RegExp(`${O1}+$`),M1=new RegExp(O1,`g`),N1=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,P1=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g,F1=SX.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{typeof e==`string`?EQ(e):EQ(e.scheme,e.optionalSlashes)})},onDestroy(){TQ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!D1(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,uq(this.options.HTMLAttributes,e),0]:[`a`,uq(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[w1({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;kQ(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!D1(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[T1({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!D1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[BJ({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(g1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!D1(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(_1({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(E1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}})}));function L1(e){let t=e,n=``;for(let[e,r]of _0)for(;t>=e;)n+=r,t-=e;return n}function R1(e){return L1(e).toUpperCase()}function z1(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of _0)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function B1(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=z1(e);return t<=0?!1:(e===e.toLowerCase()?L1(t):R1(t))===e}function V1(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function H1(e){if(e<=26)return v0[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?v0[n]:v0[t]+v0[n]}function U1(e){if(e&&!/^\d+$/.test(e)){if(B1(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function W1(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=U1(e);if(t===`i`||t===`I`)return z1(e);if(t===`a`||t===`A`){let t=V1(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function G1(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return H1(t);case`A`:return H1(t).toUpperCase();case`i`:return L1(t);case`I`:return R1(t);default:return String(t)}}function K1(e){if(e.length===0)return!1;let t=U1(e[0])??`numeric`,n=W1(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=G1(t,n+r);if(e[r]!==i)return!1}return!0}function q1(e){return{type:U1(e),start:W1(e)}}function J1(e){let{type:t,start:n}=q1(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function Y1(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${H1(r)}${n}`;case`A`:return`${H1(r).toUpperCase()}${n}`;case`i`:return`${L1(r)}${n}`;case`I`:return`${R1(r)}${n}`;default:return`${r}${n}`}}function X1(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function Z1(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}function Q1(e){return A0.test(e.trimStart())}function $1(e){let t=e.trimStart();return M0.bulletItem.test(t)||Q1(t)||M0.heading.test(t)||M0.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||M0.codeFence.test(t)||M0.blockMath.test(t)}function e0(e){return Object.values(M0).some(t=>t.test(e))}function t0(e){let t=[],n=[],r=!1;return e.forEach(e=>{r?n.push(e):e.trim()===``||t.length>0&&$1(e)?(r=!0,n.push(e)):t.push(e)}),{paragraphLines:t,blockLines:n}}function n0(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(A0);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?U1(s):void 0,p=isNaN(d)?W1(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(A0))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(j0)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||e0(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
7002
+ 3. "-" cannot repeat`);p1.customSchemes.push([e,t])}function OQ(){p1.scanner=mQ(p1.customSchemes);for(let e=0;e<p1.tokenQueue.length;e++)p1.tokenQueue[e][1]({scanner:p1.scanner});p1.parser=CQ(p1.scanner.tokens);for(let e=0;e<p1.pluginQueue.length;e++)p1.pluginQueue[e][1]({scanner:p1.scanner,parser:p1.parser});return p1.initialized=!0,p1}function kQ(e){return p1.initialized||OQ(),wQ(p1.parser.start,e,hQ(p1.scanner.start,e))}function AQ(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new yQ(n),i=kQ(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var jQ,MQ,NQ,PQ,FQ,IQ,LQ,RQ,zQ,BQ,VQ,HQ,Z,UQ,WQ,Q,GQ,KQ,qQ,JQ,YQ,XQ,ZQ,QQ,$Q,e$,t$,n$,r$,i$,a$,o$,s$,c$,l$,u$,d$,f$,p$,m$,h$,g$,_$,v$,y$,b$,x$,S$,C$,w$,T$,E$,D$,O$,k$,A$,j$,M$,N$,P$,F$,I$,L$,R$,z$,B$,V$,H$,U$,W$,G$,K$,q$,J$,Y$,X$,Z$,Q$,$$,e1,t1,n1,r1,i1,a1,o1,s1,c1,l1,u1,d1,f1,p1,m1=n((()=>{jQ=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,MQ=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,NQ=`numeric`,PQ=`ascii`,FQ=`alpha`,IQ=`asciinumeric`,LQ=`alphanumeric`,RQ=`domain`,zQ=`emoji`,BQ=`scheme`,VQ=`slashscheme`,HQ=`whitespace`,pQ.groups={},pQ.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=pQ.groups;let i;return t&&t.j?i=t:(i=new pQ(t),n&&r&&dQ(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=pQ.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new pQ,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new pQ,a&&(r&&(o.t&&typeof o.t==`string`?dQ(a,Object.assign(fQ(o.t,r),n),r):n&&dQ(a,n,r)),o.t=a),i.j[e]=o,o}},Z=(e,t,n,r,i)=>e.ta(t,n,r,i),UQ=(e,t,n,r,i)=>e.tr(t,n,r,i),WQ=(e,t,n,r,i)=>e.ts(t,n,r,i),Q=(e,t,n,r,i)=>e.tt(t,n,r,i),GQ=`WORD`,KQ=`UWORD`,qQ=`ASCIINUMERICAL`,JQ=`ALPHANUMERICAL`,YQ=`LOCALHOST`,XQ=`TLD`,ZQ=`UTLD`,QQ=`SCHEME`,$Q=`SLASH_SCHEME`,e$=`NUM`,t$=`WS`,n$=`NL`,r$=`OPENBRACE`,i$=`CLOSEBRACE`,a$=`OPENBRACKET`,o$=`CLOSEBRACKET`,s$=`OPENPAREN`,c$=`CLOSEPAREN`,l$=`OPENANGLEBRACKET`,u$=`CLOSEANGLEBRACKET`,d$=`FULLWIDTHLEFTPAREN`,f$=`FULLWIDTHRIGHTPAREN`,p$=`LEFTCORNERBRACKET`,m$=`RIGHTCORNERBRACKET`,h$=`LEFTWHITECORNERBRACKET`,g$=`RIGHTWHITECORNERBRACKET`,_$=`FULLWIDTHLESSTHAN`,v$=`FULLWIDTHGREATERTHAN`,y$=`AMPERSAND`,b$=`APOSTROPHE`,x$=`ASTERISK`,S$=`AT`,C$=`BACKSLASH`,w$=`BACKTICK`,T$=`CARET`,E$=`COLON`,D$=`COMMA`,O$=`DOLLAR`,k$=`DOT`,A$=`EQUALS`,j$=`EXCLAMATION`,M$=`HYPHEN`,N$=`PERCENT`,P$=`PIPE`,F$=`PLUS`,I$=`POUND`,L$=`QUERY`,R$=`QUOTE`,z$=`FULLWIDTHMIDDLEDOT`,B$=`SEMI`,V$=`SLASH`,H$=`TILDE`,U$=`UNDERSCORE`,W$=`EMOJI`,G$=`SYM`,K$=Object.freeze({__proto__:null,ALPHANUMERICAL:JQ,AMPERSAND:y$,APOSTROPHE:b$,ASCIINUMERICAL:qQ,ASTERISK:x$,AT:S$,BACKSLASH:C$,BACKTICK:w$,CARET:T$,CLOSEANGLEBRACKET:u$,CLOSEBRACE:i$,CLOSEBRACKET:o$,CLOSEPAREN:c$,COLON:E$,COMMA:D$,DOLLAR:O$,DOT:k$,EMOJI:W$,EQUALS:A$,EXCLAMATION:j$,FULLWIDTHGREATERTHAN:v$,FULLWIDTHLEFTPAREN:d$,FULLWIDTHLESSTHAN:_$,FULLWIDTHMIDDLEDOT:z$,FULLWIDTHRIGHTPAREN:f$,HYPHEN:M$,LEFTCORNERBRACKET:p$,LEFTWHITECORNERBRACKET:h$,LOCALHOST:YQ,NL:n$,NUM:e$,OPENANGLEBRACKET:l$,OPENBRACE:r$,OPENBRACKET:a$,OPENPAREN:s$,PERCENT:N$,PIPE:P$,PLUS:F$,POUND:I$,QUERY:L$,QUOTE:R$,RIGHTCORNERBRACKET:m$,RIGHTWHITECORNERBRACKET:g$,SCHEME:QQ,SEMI:B$,SLASH:V$,SLASH_SCHEME:$Q,SYM:G$,TILDE:H$,TLD:XQ,UNDERSCORE:U$,UTLD:ZQ,UWORD:KQ,WORD:GQ,WS:t$}),q$=/[a-z]/,J$=/\p{L}/u,Y$=/\p{Emoji}/u,X$=/\d/,Z$=/\s/,Q$=`\r`,$$=`
7003
+ `,e1=`️`,t1=`‍`,n1=``,r1=null,i1=null,a1={defaultProtocol:`http`,events:null,format:bQ,formatHref:bQ,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null},yQ.prototype={o:a1,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:a1[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}},xQ.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=a1.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}},o1=SQ(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),s1=SQ(`text`),c1=SQ(`nl`),l1=SQ(`url`,{isLink:!0,toHref(e=a1.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==YQ&&e[1].t===E$}}),u1=e=>new pQ(e),d1=typeof console<`u`&&console&&console.warn||(()=>{}),f1=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,p1={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1},kQ.scan=hQ}));function h1(e,t,n){let r=e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i=e.doc.textBetween(t.from,t.to,``,``).match(M1)?.[0];if(!i)return;let a=t.to-i.length,o=Oq(a,t.to,e.doc).filter(e=>e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return;let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty&&e.selection.from===t.to&&e.removeStoredMark(n)}function g1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function _1(e){return new J({key:new nB(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r,s=GK(n.doc,[...t]);if(!t.some(iK)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Tz)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>h1(o,t,e.type))}if(Dq(s).forEach(({newRange:t})=>{let n=KK(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!j1.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(A1).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=kQ(n).map(t=>t.toObject(e.defaultProtocol));if(!g1(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Oq(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function v1(e){return new J({key:new nB(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=wq(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function y1(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function b1(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"||n===0&&y1(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function x1(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||y1(e,t.index??0)||b1(e,t.index??0)?!1:!!r.trim()&&n(i)}function S1(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function C1(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function w1(e){return{href:e.data?.href,title:e.data?.title??null}}function T1(e){let t=IJ({find:t=>{let n=P1.exec(t);return!n||!x1(t,n,e.isAllowedHref)?null:S1(n)},type:e.type,getAttributes:w1});return new yX({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function E1(e){let t=BJ({find:t=>{let n=[];for(let r of t.matchAll(F1))x1(t,r,e.isAllowedHref)&&n.push(S1(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>C1(t,e)));return[...n,...r]},type:e.type,getAttributes:w1});return new CX({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function D1(e){return new J({key:new nB(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=AQ(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function O1(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(N1,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var k1,A1,j1,M1,N1,P1,F1,I1,L1=n((()=>{GX(),m1(),_K(),UB(),Nz(),k1=`[\0- \xA0 ᠎ -\u2029  ]`,A1=new RegExp(k1),j1=RegExp(`${k1}$`),M1=RegExp(`${k1}+$`),N1=new RegExp(k1,`g`),P1=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,F1=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g,I1=SX.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{typeof e==`string`?DQ(e):DQ(e.scheme,e.optionalSlashes)})},onDestroy(){EQ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!O1(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,uq(this.options.HTMLAttributes,e),0]:[`a`,uq(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[T1({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;AQ(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!O1(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[E1({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!O1(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[BJ({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(_1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!O1(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(v1({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(D1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}})}));function R1(e){let t=e,n=``;for(let[e,r]of v0)for(;t>=e;)n+=r,t-=e;return n}function z1(e){return R1(e).toUpperCase()}function B1(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of v0)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function V1(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=B1(e);return t<=0?!1:(e===e.toLowerCase()?R1(t):z1(t))===e}function H1(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function U1(e){if(e<=26)return y0[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?y0[n]:y0[t]+y0[n]}function W1(e){if(e&&!/^\d+$/.test(e)){if(V1(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function G1(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=W1(e);if(t===`i`||t===`I`)return B1(e);if(t===`a`||t===`A`){let t=H1(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function K1(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return U1(t);case`A`:return U1(t).toUpperCase();case`i`:return R1(t);case`I`:return z1(t);default:return String(t)}}function q1(e){if(e.length===0)return!1;let t=W1(e[0])??`numeric`,n=G1(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=K1(t,n+r);if(e[r]!==i)return!1}return!0}function J1(e){return{type:W1(e),start:G1(e)}}function Y1(e){let{type:t,start:n}=J1(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function X1(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${U1(r)}${n}`;case`A`:return`${U1(r).toUpperCase()}${n}`;case`i`:return`${R1(r)}${n}`;case`I`:return`${z1(r)}${n}`;default:return`${r}${n}`}}function Z1(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function Q1(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}function $1(e){return j0.test(e.trimStart())}function e0(e){let t=e.trimStart();return N0.bulletItem.test(t)||$1(t)||N0.heading.test(t)||N0.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||N0.codeFence.test(t)||N0.blockMath.test(t)}function t0(e){return Object.values(N0).some(t=>t.test(e))}function n0(e){let t=[],n=[],r=!1;return e.forEach(e=>{r?n.push(e):e.trim()===``||t.length>0&&e0(e)?(r=!0,n.push(e)):t.push(e)}),{paragraphLines:t,blockLines:n}}function r0(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(j0);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?W1(s):void 0,p=isNaN(d)?G1(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(j0))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(M0)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||t0(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
7000
7004
  `).trim(),contentLines:m,raw:g.join(`
7001
- `)}),r=h,n=h}return[t,r]}function r0(e){let t=e.split(`
7002
- `).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(N0);if(!t)return null;n.push({marker:t[1],content:t[3]})}return K1(n.map(e=>e.marker))?{type:`orderedList`,attrs:J1(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function i0(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=t0(a.contentLines),c=o.join(`
7005
+ `)}),r=h,n=h}return[t,r]}function i0(e){let t=e.split(`
7006
+ `).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(P0);if(!t)return null;n.push({marker:t[1],content:t[3]})}return q1(n.map(e=>e.marker))?{type:`orderedList`,attrs:Y1(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function a0(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=n0(a.contentLines),c=o.join(`
7003
7007
  `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
7004
- `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=i0(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
7005
- `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function a0(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}function o0(e,t){let n=[],r=0;for(;n.length<t;){let t=e.indexOf(`
7006
- `,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function s0(e){let t=e.indexOf(`
7007
- `),n=t===-1?e:e.slice(0,t);if(!A0.test(n))return[[],0,[]];let r=P0,i=o0(e,r),a=n0(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=o0(e,r),a=n0(i);return[a[0],a[1],i]}function c0(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var l0,u0,d0,f0,p0,m0,h0,g0,_0,v0,y0,b0,x0,S0,C0,w0,T0,E0,D0,O0,k0,A0,j0,M0,N0,P0,F0,I0,L0,R0,z0,B0,V0,H0,U0,W0=n((()=>{WX(),WB(),UB(),l0=`listItem`,u0=`textStyle`,d0=/^\s*([-+*])\s$/,f0=UX.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7008
- `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(l0,this.editor.getAttributes(u0)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=zJ({find:d0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=zJ({find:d0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(u0),editor:this.editor})),[e]}}),p0=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},m0=(e,t,n,r)=>{let i=p0(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,U.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},h0=(e,t,n)=>m0(e.state,e.view.dispatch,t,n),g0=(e,t)=>Z.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>h0(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),_0=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],v0=`abcdefghijklmnopqrstuvwxyz`,y0=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`,b0=UX.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(X1(e))return{type:`listItem`,content:[{type:`paragraph`,content:Z1(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>TJ(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return Y1((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[g0(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),x0=(e,t)=>{let{$from:n}=t.selection,r=yK(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},S0=(e,t)=>{let n=x0(e,t);if(!n)return!1;let[,r]=IY(t,e,n.$pos.pos+4);return r},C0=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},w0=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!BK(e.state,t)&&C0(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!BK(e.state,t)||!BY(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},T0=(e,t)=>{let n=S0(e,t),r=x0(e,t);return!r||!n?!1:n>r.depth},E0=(e,t)=>{let n=S0(e,t),r=x0(e,t);return!r||!n?!1:n<r.depth},D0=(e,t)=>{if(!BK(e.state,t)||!zY(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:T0(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():E0(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},O0=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||BK(r,t))return!1;let o=LY(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,U.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,U.from(c)),e.setSelection(K.create(e.doc,d+1)),e.scrollIntoView()),!0))},k0=Z.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&D0(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&D0(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&w0(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&w0(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&O0(e,t,n))return!0;return!1}}}}),A0=RegExp(`^(\\s*)(${y0})([.)])\\s+(.*)$`),j0=/^\s/,M0={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/},N0=RegExp(`^(${y0})([.)])\\s+(.+)$`),P0=64,F0=`listItem`,I0=`textStyle`,L0=/^(\d+)\.\s$/,R0=UX.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=c0(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=c0(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=uq(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?a0(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7009
- `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=s0(e);if(r.length===0)return;let o=i0(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
7010
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(F0,this.editor.getAttributes(I0)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new J({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=r0(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=zJ({find:L0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zJ({find:L0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(I0)}),joinPredicate:e,editor:this.editor})),[t]}}),z0=/^\s*(\[([( |x])?\])\s$/,B0=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,V0=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},H0=UX.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,uq(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>TJ(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[g0(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=B0;let l=e=>{let t=V0(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=dq(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[zJ({find:z0,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),U0=UX.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,uq(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7011
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=CJ(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=CJ(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Z.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(f0.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(b0.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(k0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(R0.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(H0.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(U0.configure(this.options.taskList)),e}})})),G0,K0,q0,J0=n((()=>{WX(),G0=`&nbsp;`,K0=`\xA0`,q0=UX.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,uq(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===G0||n[0].text===G0||n[0].raw===K0||n[0].text===K0)&&r.length===1&&r[0].type===`text`&&(r[0].text===G0||r[0].text===K0)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?G0:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})})),Y0,X0,Z0,Q0=n((()=>{WX(),Y0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,X0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Z0=SX.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[IJ({find:Y0,type:this.type})]},addPasteRules(){return[BJ({find:X0,type:this.type})]}})})),$0,e2=n((()=>{WX(),$0=UX.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``})})),t2,n2=n((()=>{WX(),t2=SX.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,uq(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})}));function r2(e={}){return new J({view(t){return new i2(t,e)}})}var i2,a2=n((()=>{rB(),Mz(),i2=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=qR(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}})),o2=n((()=>{a2()}));function s2(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function c2(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||s2(e.type))return!0;if(e.inlineContent)return!1}}return!0}function l2(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||s2(e.type))return!0;if(e.inlineContent)return!1}}return!0}function u2(){return new J({props:{decorations:m2,createSelectionBetween(e,t,n){return t.pos==n.pos&&h2.valid(n)?new h2(n):null},handleClick:f2,handleKeyDown:_2,handleDOMEvents:{beforeinput:p2}}})}function d2(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=h2.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new h2(c))),!0):!1}}function f2(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!h2.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new h2(r))),!0)}function p2(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof h2))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function m2(e){if(!(e.selection instanceof h2))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,pG.create(e.doc,[uG.widget(e.selection.head,t,{key:`gapcursor`})])}var h2,g2,_2,v2=n((()=>{VG(),rB(),_R(),TG(),h2=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new g2(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!c2(e)||!l2(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}},h2.prototype.visible=!1,h2.findFrom=h2.findGapCursorFrom,G.jsonID(`gapcursor`,h2),g2=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return h2.valid(t)?new h2(t):G.near(t)}},_2=RG({ArrowLeft:d2(`horiz`,-1),ArrowRight:d2(`horiz`,1),ArrowUp:d2(`vert`,-1),ArrowDown:d2(`vert`,1)})})),y2=n((()=>{v2()}));function b2(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),uG.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function x2(e,t){return typeof e==`function`?e(t):e}function S2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&Fq(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(b2({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:x2(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function C2({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Fq(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(b2({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:x2(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...S2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return pG.create(r,o)}function w2(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function T2(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function E2(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function D2(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function O2(e,t){let n=E2(e,t.from,t.to);return n.push(T2(e,w2(e,t.from))),t.to>t.from?n.push(T2(e,w2(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(T2(e,w2(e,Math.min(t.from+1,e.content.size)))),n}function k2(e,t,n){let r=[];if(e.docChanged){let t=Dq(e);for(let e of t)r.push(...O2(n.doc,e.newRange))}return e.selectionSet&&(r.push(T2(n.doc,w2(n.doc,e.mapping.map(t.selection.anchor)))),r.push(T2(n.doc,w2(n.doc,n.selection.anchor)))),D2(r)}function A2(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function j2({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=A2(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=S2({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function M2({editor:e,options:t,dataAttribute:n}){return{init(r,i){return C2({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??pG.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:j2({decorations:i.map(r.mapping,r.doc),ranges:k2(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function N2(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function P2({editor:e,options:t}){let n=t.dataAttribute?`data-${N2(t.dataAttribute)}`:`data-${H2}`,r=t.showOnlyCurrent&&!t.includeChildren;return new J({key:U2,...r?{}:{state:M2({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>C2({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?pG.empty:U2.getState(n)??pG.empty}})}function F2(e,t){return!e.selection.empty&&!Iq(e.selection)&&t.isEditable}function I2(e,t){return F2(e,t)&&!t.isFocused&&!t.view.dragging}function L2(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function R2(e){e.focus()}function z2({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var B2,V2,H2,U2,W2,G2,K2=n((()=>{WX(),UB(),o2(),EG(),y2(),_K(),Z.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new J({key:new nB(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),B2=Z.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[r2(this.options)]}}),Z.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new J({key:new nB(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return pG.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(uG.node(t,t+e.nodeSize,{class:this.options.className}))}),pG.create(e,a)}}})]}}),V2=Z.create({name:`gapCursor`,addProseMirrorPlugins(){return[u2()]},extendNodeSchema(e){return{allowGapCursor:oq(X(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),H2=`placeholder`,U2=new nB(`tiptap__placeholder`),Z.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:H2,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[P2({editor:this.editor,options:this.options})]}}),Z.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new J({key:new nB(`selection`),props:{decorations(n){return I2(n,e)?pG.create(n.doc,[uG.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return F2(t.state,e)&&L2(),!1},focus(t){return F2(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&R2(t)}),!1}}}})]}}),W2=Z.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new nB(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new J({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!z2({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!z2({node:r,types:n})}}})]}}),G2=Z.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>mK(e,t),redo:()=>({state:e,dispatch:t})=>hK(e,t)}},addProseMirrorPlugins(){return[nK(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}})})),q2,J2=n((()=>{WX(),MZ(),RZ(),UZ(),JZ(),XZ(),QZ(),eQ(),nQ(),cQ(),I1(),W0(),J0(),Q0(),e2(),n2(),K2(),q2=Z.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(LZ.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(jZ.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(f0.configure(this.options.bulletList)),this.options.code!==!1&&e.push(HZ.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(qZ.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(YZ.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(B2.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(V2.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(ZZ.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push($Z.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(G2.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(tQ.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(sQ.configure(this.options.italic)),this.options.listItem!==!1&&e.push(b0.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(k0.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(F1.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(R0.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(q0.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Z0.configure(this.options.strike)),this.options.text!==!1&&e.push($0.configure(this.options.text)),this.options.underline!==!1&&e.push(t2.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(W2.configure(this.options?.trailingNode)),e}})}));function Y2(e){let{$from:t}=e.selection;for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.name===`astlLayout`)return{pos:t.before(e),node:n}}return null}function X2(e){let t=e.children.map(a4);return oN.find(e=>{let n=sN[e];return n.length===t.length&&n.every((e,n)=>e===t[n])})??null}function Z2(e,t){let n=t.node.children.flatMap(e=>e.children);return e.replaceWith(t.pos,t.pos+t.node.nodeSize,U.from(n)),c4(e,t.pos),!0}function Q2(e,t,n=!1){let r=t.pos+t.node.nodeSize,i=e.doc.resolve(t.pos).parent,a=e.doc.type.schema.nodes.paragraph;return i.childCount===1&&a!==void 0?e.replaceWith(t.pos,r,a.create()):e.delete(t.pos,r),c4(e,t.pos,n?-1:1),!0}function $2(e,t){let n=Fn(e.style??``).declarations.filter(([e])=>e!==`flex-grow`),r=Pn(t===null?n:[...n,[`flex-grow`,String(t)]]),i=Object.fromEntries(Object.entries(e).filter(([e])=>e!==`style`));return r===``?i:{...i,style:r}}function e4(e,t,n){let{node:r,pos:i}=t;if(X2(r)===n)return!1;let a=sN[n],o=r.children,s=e.doc.type.schema,c=s.nodes[dZ],l=s.nodes.paragraph;if(c===void 0||l===void 0)return!1;let{from:u}=e.selection,d=null;r.forEach((e,t,n)=>{let r=i+1+t+1;u>=r&&u<=r+e.content.size&&(d={column:n,offset:u-r})});let f=a.length-1,p=a.map((e,t)=>{let n=o[t],r=n===void 0?U.from(l.create()):n.content;if(t===f)for(let e of o.slice(t+1))r=r.append(e.content);return c.create({attributes:$2(n?.attrs.attributes??{},e)},r)});e.replaceWith(i,i+r.nodeSize,r.type.create(r.attrs,p));let m=d;if(m!==null){let t=Math.min(m.column,f),n=m.offset;for(let e=t;e<m.column;e++)n+=o[e]?.content.size??0;let r=i+1;for(let e=0;e<t;e++)r+=p[e]?.nodeSize??0;e.setSelection(K.near(e.doc.resolve(r+1+n)))}return!0}function t4(e,t,n){return n===`unwrap`?Z2(e,t):n===`delete`?Q2(e,t):e4(e,t,n)}function n4(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof q)return n.node.type.name===`astlLayout`?{pos:n.from,node:n.node}:r.parent.type.name===`astlLayout`?{pos:r.before(r.depth),node:r.parent}:null;if(!r.parent.isTextblock)return null;for(let e of[r.nodeBefore,r.nodeAfter])if(e!==null&&t(e))return null;for(let e=r.depth;e>0;e--){let n=r.node(e);if(n.type.name===`astlLayout`)return{pos:r.before(e),node:n};if(n.type.name===i4||t(n))return null}return null}function r4(e){return Z.create({name:`astlCurrentLayout`,addProseMirrorPlugins:()=>[new J({props:{decorations(t){let n=n4(t,e);if(n===null)return pG.empty;let r=uG.node(n.pos,n.pos+n.node.nodeSize,{class:`astl-layout-current`,"data-astl-current":``});return pG.create(t.doc,[r])}}})]})}var i4,a4,o4,s4,c4,l4=n((()=>{Or(),kI(),WX(),WB(),UB(),EG(),yZ(),i4=`astlFigure`,a4=e=>{let t=Fn(e.attrs.attributes.style??``).declarations.find(([e])=>e===`flex-grow`)?.[1],n=t===void 0?NaN:Number(t);return Number.isNaN(n)||n===1?null:n},o4=e=>{let t=!0;return e.descendants(e=>t?e.type.name===`astlLayoutColumn`||((e.type.name!==`paragraph`||e.content.size>0)&&(t=!1),!1):!1),t},s4=e=>({shape:X2(e),columns:e.childCount,empty:o4(e)}),c4=(e,t,n=1)=>{let r=e.doc.resolve(Math.min(t,e.doc.content.size));e.setSelection(G.findFrom(r,n,!0)??G.near(r,n))}}));function u4(e,t,n,r){if(t.holder===null){e.setNodeAttribute(t.pos,`style`,n===``?null:n),e.setNodeAttribute(t.pos,`class`,r===``?null:r);return}let i={...t.node.attrs[t.holder]};n===``?delete i.style:i.style=n,r===``?delete i.class:i.class=r,e.setNodeAttribute(t.pos,t.holder,i)}function d4(e,t){let n=Fn(Object.entries(t).flatMap(([e,t])=>t===null?[]:[`${e}: ${t}`]).join(`; `)).declarations,r=new Set(Object.keys(t));return Nn(Fn(e).declarations.filter(([e])=>!r.has(e)),n)}function f4(e,t,n,r){let i=n.attrs.attributes,a={kind:`figure`,tag:oe,pos:t,node:n,holder:`attributes`};if(u4(e,a,Pn(d4(i.style??``,r)),i.class??``),n.type.name!==g4||!Object.hasOwn(r,`width`))return;let o=n.attrs.picture,s=r.width===null?{width:null}:{width:`100%`};u4(e,{...a,kind:`picture`,holder:`picture`},Pn(d4(o.style??``,s)),o.class??``)}function p4(e,t){return Array.isArray(e)?e.map(e=>p4(e,t)):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{if(e!==`class`)return[[e,p4(n,t)]];if(typeof n!=`string`)return[[e,n]];let r=n.split(/\s+/).filter(e=>e!==t&&e!==``).join(` `);return r===``?[[e,null]]:[[e,r]]}))}function m4(e,t,n,r){let i=()=>e.schema.marks[h4],a=t=>{let n=e.state.tr;return tK(n),t(n)?(e.view.dispatch(n),!0):!1},o=(e,t)=>{let r=e.type.name===g4,i=e.type.name===`paragraph`||e.type.name===`heading`;return{kind:`block`,tag:r?se:e.type.name===`paragraph`?`p`:e.type.name===`heading`?`h${e.attrs.level}`:n(e),pos:t,node:e,holder:r?`caption`:i?null:`attributes`}},s=e=>{let{selection:r}=e,{$from:i}=r,a=[],s=(e,t)=>{a.push({kind:`figure`,tag:oe,pos:t,node:e,holder:`attributes`},{kind:`picture`,tag:`img`,pos:t,node:e,holder:`picture`})},c=r instanceof q?r.node:null;if(c!==null&&(c.type.name===_4?a.push({kind:`picture`,tag:`img`,pos:r.from,node:c,holder:`attributes`}):c.type.name===g4?(a.push(o(c,r.from)),s(c,r.from)):t(c)?a.push({kind:`component`,tag:n(c),pos:r.from,node:c,holder:`attributes`}):c.type.name===`astlLayout`&&a.push({kind:`layout`,tag:ge,pos:r.from,node:c,holder:`attributes`})),c===null&&i.parent.isTextblock&&a.push(o(i.parent,i.before(i.depth))),c===null){let e=i.nodeBefore,r=i.nodeAfter;r!==null&&t(r)?a.push({kind:`component`,tag:n(r),pos:i.pos,node:r,holder:`attributes`}):e!==null&&t(e)&&a.push({kind:`component`,tag:n(e),pos:i.pos-e.nodeSize,node:e,holder:`attributes`})}for(let e=i.depth;e>0;e--){let r=i.node(e),o=i.before(e);r.type.name===g4?s(r,o):t(r)?a.push({kind:`component`,tag:n(r),pos:o,node:r,holder:`attributes`}):r.type.name===`astlLayoutColumn`?a.push({kind:`column`,tag:_e,pos:o,node:r,holder:`attributes`}):r.type.name===`astlLayout`&&a.push({kind:`layout`,tag:ge,pos:o,node:r,holder:`attributes`})}return a},c=(e,t)=>{let n=s(e).find(e=>e.kind===t);if(n===void 0)return[];if(t!==`block`)return[n];let{from:r,to:i}=e.selection,a=[];return e.doc.nodesBetween(r,i,(e,t)=>(e.isTextblock&&a.push(o(e,t)),!e.isTextblock)),a.length===0?[n]:a},l=(e,t,n)=>{let r=i(),a=[];return r===void 0||e.nodesBetween(t,n,(e,i,o)=>!e.isInline||o?.type.allowsMarkType(r)!==!0||(a.push({from:Math.max(i,t),to:Math.min(i+e.nodeSize,n),spans:e.marks.filter(e=>e.type===r)}),!1)),a},u=e=>{let t={},n=[],r=[];for(let i of e)for(let[e,a]of Object.entries(i.attrs))e===`style`?n.push(Fn(String(a??``)).declarations):e===`class`?r.push(String(a??``)):a!==null&&(t[e]=String(a));return{attrs:t,style:Pn(Nn(...n)),classes:An(r.join(` `))}},d=(e,t,n)=>t===``&&n===``&&Object.values(e).every(e=>e===null)?null:i()?.create({...e,style:t===``?null:t,class:n===``?null:n})??null,f=(t,n)=>{let{from:r,to:a,empty:o}=t.selection;if(o){let r=t.selection.$from,a=t.storedMarks??e.state.storedMarks??r.marks(),o=a.filter(e=>e.type===i()),{attrs:s,style:c,classes:l}=u(o),f=n(c,l),p=d(s,f.style,f.classes),m=a.filter(e=>e.type!==i());return t.setStoredMarks(p===null?m:p.addToSet(m)),!0}let s=i();if(s===void 0)return!1;let c=t.doc;for(let e of l(t.doc,r,a)){let{attrs:r,style:i,classes:a}=u(e.spans),o=n(i,a),c=d(r,o.style,o.classes);e.spans.length===1&&c!==null&&e.spans[0]?.eq(c)||(t.removeMark(e.from,e.to,s),c!==null&&t.addMark(e.from,e.to,c))}return t.doc!==c},p=e=>{let{selection:t}=e,n=i(),r=t.$from.parent.inlineContent&&n!==void 0,a=!(t instanceof q)&&r&&t.$from.parent.type.allowsMarkType(n),o=(t.empty?[(e.storedMarks??t.$from.marks()).filter(e=>e.type===n)]:l(e.doc,t.from,t.to).map(e=>e.spans)).map(u),s={},c=new Set,d=o.map(({style:e})=>new Map(Fn(e).declarations));for(let e of new Set(d.flatMap(e=>[...e.keys()]))){let t=new Set(d.map(t=>t.get(e)));t.size===1?s[e]=[...t][0]:c.add(e)}let f=new Set(o.map(({classes:e})=>e));return{textEnabled:a,hasSelection:!t.empty&&!(t instanceof q),text:s,mixed:[...c],textClass:f.size===1?b4([...f][0]):null}},m=e=>{let t=y4(e.node,e.holder);return{kind:e.kind,tag:e.tag,style:Fn(t.style??``).style,className:b4(t.class)}},h=e=>e.doc.attrs.rules,g=({name:e,label:t,for:n,style:r})=>({...e===void 0?{}:{name:e},...t===void 0?{}:{label:t},...n===void 0?{}:{for:n},style:Fn(r??``).style}),_=(e,t)=>e.name!==void 0&&e.name===t.name||e.for!==void 0&&e.for===t.for,v=(t,n,r)=>{for(let i of c(e.state,n)){let e=y4(i.node,i.holder),n=Fn(e.style??``).style,a=e.class??``,o=r(n,a);(o.style!==n||o.classes!==a)&&u4(t,i,o.style,o.classes)}return t.docChanged},y=(e,t)=>a(n=>v(n,e,t)),b=(e,t)=>{let n=e.doc.attrs.rules,r=Fn(t.style).style,i=n.findIndex(e=>_(g(e),t)),a=t.for!==void 0&&r===``;if(i<0&&(a||n.length>=100))return!1;let o={...t.name===void 0?{}:{name:t.name},...t.label===void 0?{}:{label:t.label},...t.for===void 0?{}:{for:t.for},...r===``?{}:{style:r}},s=a?n.filter((e,t)=>t!==i):i<0?[...n,o]:n.map((e,t)=>t===i?o:e);return JSON.stringify(s)!==JSON.stringify(n)&&(e.setDocAttribute(`rules`,s),!0)};return{state(){if(e.isDestroyed)return{textEnabled:!1,hasSelection:!1,text:{},mixed:[],textClass:null,targets:[]};let t=e.state;return{...p(t),targets:s(t).map(m)}},setText(e){return a(t=>f(t,(t,n)=>({style:Pn(d4(t,e)),classes:n})))},setTarget(t,n){return t===`figure`?a(t=>{let r=s(e.state).find(e=>e.kind===`figure`);return r!==void 0&&(f4(t,r.pos,r.node,n),t.docChanged)}):y(t,(e,t)=>({style:Pn(d4(e,n)),classes:t}))},replaceTarget(e,t){return y(e,(e,n)=>({style:Fn(t).style,classes:n}))},setClass(t,n,r){if(n!==null&&!kn(n)||r!==void 0&&(r.name!==n||r.for!==void 0))return!1;let i=e=>({style:e,classes:n??``});return a(a=>(t===`text`?f(a,i):v(a,t,i))?r===void 0||h(e.state).some(e=>e.name===n)||b(a,r):!1)},clear(){return a(t=>{let{from:n,to:r,empty:i}=t.selection;if(t.selection instanceof q)return!1;i?t.setStoredMarks([]):(t.doc.nodesBetween(n,r,(e,i)=>{if(!e.isInline)return!0;for(let a of e.marks)v4.has(a.type.name)&&t.removeMark(Math.max(i,n),Math.min(i+e.nodeSize,r),a);return!1}),f(t,()=>({style:``,classes:``})));for(let n of ee(e.state)){let e=y4(n.node,n.holder);(e.style!==void 0||e.class!==void 0)&&u4(t,n,``,``)}return t.docChanged||i})},rules:()=>e.isDestroyed?[]:h(e.state).map(g),setRule(e){return e.name!==void 0&&!kn(e.name)?!1:a(t=>b(t,e))},removeRule(t){return a(n=>{let r=h(e.state),a=r.filter(e=>!_(g(e),t));if(a.length===r.length)return!1;n.setDocAttribute(`rules`,a);let{name:o}=t;if(o===void 0)return!0;let s=x4(p4(n.doc.attrs.attributes,o));return n.setDocAttribute(`attributes`,s),e.state.doc.descendants((e,t)=>{for(let[r,i]of Object.entries(e.attrs)){let e=r===`class`?null:p4(i,o);if(r===`class`&&typeof i==`string`&&i.split(/\s+/).includes(o)){let e=i.split(/\s+/).filter(e=>e!==o&&e!==``);n.setNodeAttribute(t,r,e.length===0?null:e.join(` `))}else r!==`class`&&JSON.stringify(e)!==JSON.stringify(i)&&n.setNodeAttribute(t,r,x4(e))}for(let r of e.marks){let a=String(r.attrs.class??``).split(/\s+/);if(!a.includes(o))continue;let s=a.filter(e=>e!==o&&e!==``).join(` `),c={...r.attrs,class:s===``?null:s},l=t+e.nodeSize;n.removeMark(t,l,r),r.type===i()&&Object.values(c).every(e=>e===null)||n.addMark(t,l,r.type.create(c))}return!0}),!0})},saveRule(t,n){let r=h(e.state),i=s(e.state).find(e=>e.kind===t);if(i===void 0||r.length>=100)return null;let o=y4(i.node,i.holder),c=zN(n,new Set(r.flatMap(e=>e.name??[]))),l=Fn(o.style??``).style;return a(e=>(e.setDocAttribute(`rules`,[...r,{name:c,label:n,...l===``?{}:{style:l}}]),u4(e,i,``,c),!0)),c},insertLayout(t){let n=e.state.doc;if(x(),r(t),e.state.doc===n)return!1;let{$from:i}=e.state.selection,a=null;for(let e=i.depth;a===null&&e>0;e--)i.node(e).type.name===`astlLayout`&&(a=i.before(e));a===null&&(a=i.nodeBefore?.type.name===`astlLayout`?i.pos-i.nodeBefore.nodeSize:null);let o=a===null?null:e.state.doc.nodeAt(a);if(a===null||o===null)return x(),!0;let s=a,c=null;o.descendants((e,t)=>(c===null&&e.isTextblock&&e.content.size===0&&(c=s+1+t+1),c===null));let l=e.state.tr;c!==null&&l.setSelection(K.create(l.doc,c));let u=s+o.nodeSize,d=e.schema.nodes.paragraph;return l.doc.resolve(u).nodeAfter===null&&d!==void 0&&l.insert(u,d.create()),e.view.dispatch(l),x(),!0},layout(){if(e.isDestroyed)return null;let t=Y2(e.state);return t===null?null:s4(t.node)},editLayout(t){let n=Y2(e.state);if(n===null)return!1;let r=a(e=>t4(e,n,t));return r&&e.view.focus(),r}};function x(){e.view.dispatch(tK(e.state.tr))}function ee(e){let{from:t,to:n,empty:r}=e.selection;return c(e,`block`).filter(e=>{if(r)return!0;let i=e.pos+1,a=e.pos+1+e.node.content.size;return t<=i&&n>=a})}}var h4,g4,_4,v4,y4,b4,x4,S4=n((()=>{w(),Or(),kI(),_K(),UB(),yZ(),l4(),h4=`textSpan`,g4=`astlFigure`,_4=`astlPicture`,v4=new Set([`bold`,`italic`,`underline`,`strike`,`code`,`sub`,`sup`,`mark`]),y4=(e,t)=>t===null?Object.fromEntries([`style`,`class`].flatMap(t=>e.attrs[t]?[[t,e.attrs[t]]]:[])):e.attrs[t],b4=e=>(e??``).split(/\s+/).find(e=>e!==``)??null,x4=e=>Array.isArray(e)?e.map(x4):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).filter(([e,t])=>e!==`class`||t!==null).map(([e,t])=>[e,x4(t)]))}));function C4(e,t){e.dataset.astlTag=t;let n=``,r=[];return t=>{let i=t.style??``;i!==n&&(e.style.cssText=i),n=i;let a=(t.class??``).split(` `).filter(Boolean);e.classList.remove(...r),e.classList.add(...a),r=a}}function w4(e){let t=t=>{let n=e.descriptor(t)?.fields??[];return n.flatMap(e=>{if(e.kind!==`picture-regions`&&e.kind!==`picture-points`)return[];let t=n.find(t=>t.kind===`child-flag`&&t.tag===e.tag);return[{kind:e.kind,tag:e.tag,src:e.src,flag:t?.kind===`child-flag`?t.attribute:null}]})},n=(t,n)=>e.t(H,t,n);return{layers:t,create(r){let i=t(r),a=document.createElement(`div`);a.className=`astl-zones`,a.contentEditable=`false`;let o=a.appendChild(document.createElement(`div`));o.className=`astl-zones-frame`;let s=document.createElement(`img`);s.alt=``,s.draggable=!1,s.referrerPolicy=`no-referrer`;let c=a.appendChild(document.createElement(`span`));c.className=`astl-picture-alt`;let l=null,u={attributes:{},children:[]},d=()=>{let{attributes:t,children:a}=u,d=i[0]?.src??`src`,f=t[d]??``,p=f.trim()!==``&&e.urlPolicy(f,{tag:r,attribute:d}),m=pN(t.width),h=pN(t.height),g=l??(m!==void 0&&h!==void 0?m/h:4/3);o.style.setProperty(`aspect-ratio`,String(g)),p&&s.getAttribute(`src`)!==f&&(l=null,s.src=f);let _=document.createElementNS(O3,`svg`);_.setAttribute(`viewBox`,`0 0 100 100`),_.setAttribute(`preserveAspectRatio`,`none`),_.setAttribute(`aria-hidden`,`true`);let v=[],y=(e,t,n,r)=>{let i=document.createElement(`span`);i.className=`astl-zone-badge${r?` astl-zone-pin`:``} c${(e-1)%8+1}`,i.setAttribute(`aria-hidden`,`true`),i.style.setProperty(`--x`,`${t}%`),i.style.setProperty(`--y`,`${n}%`),i.textContent=String(e),v.push(i)};for(let e of i)a.filter(t=>t.tag===e.tag).forEach((t,n)=>{let r=t.attributes;if(e.kind===`picture-points`){y(n+1,k3(r.x),k3(r.y),!0);return}let i=r.shape===`circle`||r.shape===`polygon`?r.shape:`rect`,a,o;if(i===`circle`){let[e,t,n]=[k3(r.x),k3(r.y),k3(r.r)];a=document.createElementNS(O3,`ellipse`);for(let[r,i]of[[`cx`,e],[`cy`,t],[`rx`,n],[`ry`,n*g]])a.setAttribute(r,String(i));o=[e,t]}else if(i===`polygon`){let e=(r.points??``).trim().split(/\s+/).filter(Boolean).map(e=>e.split(`,`).map(e=>k3(e)));a=document.createElementNS(O3,`polygon`),a.setAttribute(`points`,e.map(e=>e.join(`,`)).join(` `));let t={left:100,top:100,right:0,bottom:0};for(let[n,r]of e)t.left=Math.min(t.left,n),t.top=Math.min(t.top,r),t.right=Math.max(t.right,n),t.bottom=Math.max(t.bottom,r);o=[(t.left+t.right)/2,(t.top+t.bottom)/2]}else{let[e,t,n,i]=[k3(r.x),k3(r.y),k3(r.width),k3(r.height)];a=document.createElementNS(O3,`rect`);for(let[r,o]of[[`x`,e],[`y`,t],[`width`,n],[`height`,i]])a.setAttribute(r,String(o));o=[e+n/2,t+i/2]}let s=e.flag!==null&&!Object.hasOwn(r,e.flag);a.setAttribute(`class`,`astl-zone c${n%8+1}${s?` astl-zone-dashed`:``}`),_.append(a),y(n+1,...o,!1)});o.replaceChildren(...p?[s]:[],_,...v),o.classList.toggle(`astl-zones-blank`,!p);let b=t.alt,x=b===void 0||b.trim()===``?n(`surface.picture.noAlt`):n(`surface.picture.alt`,{alt:b});c.textContent=p||f.trim()===``?x:`${x} ${n(`surface.picture.blocked`)}`};return s.addEventListener(`load`,()=>{s.naturalHeight!==0&&(l=s.naturalWidth/s.naturalHeight,d())}),{dom:a,render(e,t){u={attributes:e,children:t},d()}}}}}function T4(e,t){let n=e?.attributes.find(e=>e.type===`string`)?.name;if(n!==void 0)return t.attributes[n]??``;let r=t.children.filter(e=>typeof e==`string`||!Je.has(e.tag)),i=r.filter(e=>typeof e!=`string`);return i.length>0?i.map(e=>T3(e).trim()).join(` | `):r.map(T3).join(``).trim()}function E4(e,t,n,r){let i=t?.fields??[],a=n.children.filter(e=>typeof e!=`string`);if(r!==null)return{answer:r,more:0};let o=i.find(e=>e.kind===`child-flag`);if(o?.kind===`child-flag`){let e=a.filter(e=>e.tag===o.tag&&Object.hasOwn(e.attributes,o.attribute));return{answer:e[0]===void 0?``:T3(e[0]).trim(),more:Math.max(0,e.length-1)}}let s=new Set(i.flatMap(e=>e.kind===`text-list`?[e.tag]:[]));return{answer:T4(e,n).trim(),more:a.filter(e=>s.has(e.tag)&&T3(e).trim()!==``).length}}function D4(e,t){let n=document.createElementNS(O3,`svg`);return n.setAttribute(`viewBox`,`0 0 20 20`),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),n.setAttribute(`class`,t),n.appendChild(document.createElementNS(O3,`path`)).setAttribute(`d`,M3[e]),n}function O4(e,t,n,r,i,a){let o=y3(e),s=r!==`block`,c=a?.descriptor(e)??null,l=(e,t)=>a?.t(`astl.editor`,e,t)??e;return UX.create({name:o,...r===`inline`||r===`block`?{group:r}:{},inline:r===`inline`,atom:!0,selectable:!0,addAttributes:()=>D3,parseHTML:()=>[{tag:e}],renderHTML:({node:t})=>[e,{...t.attrs.attributes},...t.attrs.children.map(w3)],addNodeView:()=>({node:u,decorations:d,getPos:f,editor:p})=>{if(r===`zone`){let e=document.createElement(`div`);return e.hidden=!0,{dom:e,update:e=>e.type.name===o}}if(r===`inline`){let r=document.createElement(`span`);r.className=`astl-chip`;let i=C4(r,e),a=(e,a)=>{i(e.attributes);let{answer:o,more:s}=E4(t,c,e,a);r.replaceChildren(D4(o===``?`warning`:`check`,`astl-chip-icon`));let u=r.appendChild(document.createElement(`span`));if(u.className=`astl-chip-answer`,u.textContent=o===``?l(`surface.chip.empty`):o,s>0){let e=r.appendChild(document.createElement(`span`));e.className=`astl-chip-more`,e.textContent=l(`surface.chip.more`,{n:s})}r.toggleAttribute(`data-empty`,o===``),r.title=l(`label.text`,{label:n,text:u.textContent})};return a(u.attrs,P3(d)),{dom:r,update:(e,t)=>e.type.name===o&&(a(e.attrs,P3(t)),!0)}}if(s){let n=document.createElement(`div`);n.className=`astl-chip`;let r=C4(n,e),i=e=>{r(e.attributes),n.textContent=`[${T4(t,e)||`?`}]`};return i(u.attrs),{dom:n,update:A3(o,i)}}let m=document.createElement(`div`);m.className=`astl-block astl-atom`;let h=i?.layers(e).length?i.create(e):null;h!==null&&m.append(h.dom);let g=m.appendChild(document.createElement(`div`));g.className=`astl-atom-summary`;let _=m.appendChild(document.createElement(`div`));_.className=`astl-help-kept`;let v=R4(g,e),y=a===void 0?null:z4(a,m,p,f),b=e=>{v(e.attributes),y?.(e.attributes.style),h?.render(e.attributes,j3(e.children)),g.textContent=h===null?T4(t,e):``,g.hidden=h!==null,a!==void 0&&_.replaceChildren(...A4(e.children,a))};return b(u.attrs),{dom:m,update:A3(o,b),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!=null,ignoreMutation:()=>!0}}})}function k4(e,t,n){if(e===`astl-hint`){let e=Math.round(Number(t.cost??0)*100);return e>0?`${n(`insert.hint`)}, ${n(`help.cost`,{percent:e})}`:n(`insert.hint`)}return e===`astl-explanation`?n(`insert.explanation`):`${n(`insert.feedback`)}: ${n(`help.when.${t.when??``}`)}`}function A4(e,t){let n=(e,n)=>t.t(H,e,n);return e.flatMap(e=>{if(typeof e==`string`||!Je.has(e.tag))return[];let r=document.createElement(`div`);r.className=`astl-help-box`,r.dataset.help=e.tag;let i=r.appendChild(document.createElement(`div`));return i.className=`astl-help-head`,i.lang=t.locale,i.textContent=k4(e.tag,e.attributes,n),r.appendChild(document.createElement(`div`)).textContent=T3(e).trim(),[r]})}function j4(e,t){let n=y3(e),r=(e,n)=>t?.t(`astl.editor`,e,n)??e;return UX.create({name:n,group:L3,content:I3,defining:!0,isolating:!0,addAttributes:()=>E3,parseHTML:()=>[{tag:e}],renderHTML:({node:t})=>[e,{...t.attrs.attributes},0],addNodeView:()=>({node:i,editor:a,getPos:o})=>{let s=document.createElement(`div`);s.className=`astl-help-box`,s.dataset.help=e;let c=s.appendChild(document.createElement(`div`));c.className=`astl-help-head`,c.contentEditable=`false`,t!==void 0&&(c.lang=t.locale,c.dir=Me(t.locale));let l=c.appendChild(document.createElement(`span`));l.textContent=r(e===`astl-hint`?`insert.hint`:e===`astl-explanation`?`insert.explanation`:`insert.feedback`);let u=e===`astl-explanation`?null:c.appendChild(document.createElement(`select`)),d=e===`astl-hint`?R3:Ye;u?.setAttribute(`aria-label`,r(e===`astl-hint`?`help.costLabel`:`help.whenLabel`)),u?.addEventListener(`change`,()=>{let t=o(),n=typeof t==`number`?a.state.doc.nodeAt(t):null;if(n===null||typeof t!=`number`||u===null)return;let r={...n.attrs.attributes};e===`astl-hint`&&u.value===`0`?delete r.cost:r[e===`astl-hint`?`cost`:`when`]=u.value,a.view.dispatch(a.state.tr.setNodeAttribute(t,`attributes`,r))});let f=s.appendChild(document.createElement(`div`));f.className=`astl-help-content`;let p=t=>{let n=t.attributes;if(u===null)return;let i=(e===`astl-hint`?n.cost:n.when)??(e===`astl-hint`?`0`:``),a=d.includes(i)?d:[...d,i];u.replaceChildren(...a.map(t=>{let n=document.createElement(`option`);return n.value=t,n.textContent=e===`astl-hint`?`${Math.round(Number(t)*100)}%`:r(`help.when.${t}`),n})),u.value=i};return p(i.attrs),{dom:s,contentDOM:f,update:e=>e.type.name===n&&(p(e.attrs),!0),stopEvent:e=>c.contains(e.target),ignoreMutation:e=>c.contains(e.target)}}})}function M4(e){return[Ge,Ke,qe].map(t=>j4(t,e))}function N4(e,t,n){let r=y3(e.tag),i=new Map(e.children.map(e=>[y3(e.tag),e.tag])),a=e=>{let t=[];return e.forEach(e=>{let n=i.get(e.type.name);n!==void 0&&t.push({tag:n,attributes:e.attrs.attributes})}),t},o=n?.descriptor(e.tag)?.fields?.flatMap(e=>e.kind===`child-flag`?[e.tag]:[]),s=e.children.find(e=>e.content===`inline`&&(e.max===null||e.max>1)&&o?.includes(e.tag)===!0);return UX.create({name:r,group:`block`,content:e.content===`flow`?`${e.children.filter(e=>e.place===`lead`).map(e=>`${y3(e.tag)}?`).join(` `)} (${[...F3,L3].join(` | `)})+`.trimStart():`(${[...e.children.map(e=>y3(e.tag)),L3].join(` | `)})+`,defining:!0,isolating:!0,addAttributes:()=>E3,parseHTML:()=>[{tag:e.tag}],renderHTML:({node:t})=>[e.tag,{...t.attrs.attributes},0],addNodeView:()=>({node:i,getPos:o,editor:c})=>{let l=document.createElement(`div`);l.className=`astl-block`;let u=t?.layers(e.tag).length?t.create(e.tag):null,d=document.createElement(`div`),f=R4(d,e.tag);l.append(d,...u===null?[]:[u.dom]);let p=null;if(s!==void 0&&n!==void 0){let e=y3(s.tag),t=l.appendChild(document.createElement(`div`));t.className=`astl-block-add`,t.contentEditable=`false`,Object.assign(t,{lang:n.locale,dir:Me(n.locale)}),p=t.appendChild(Object.assign(document.createElement(`button`),{type:`button`})),p.append(D4(`add`,`astl-icon`),n.t(H,`surface.addOption`)),p.addEventListener(`click`,()=>{let t=o(),n=typeof t==`number`?c.state.doc.nodeAt(t):null,r=c.schema.nodes[e];if(typeof t!=`number`||n===null||r===void 0)return;let i=t+n.nodeSize-1;n.forEach((e,n)=>{e.type===r&&(i=t+1+n+e.nodeSize)});let a=tK(c.state.tr).insert(i,r.create());a.setSelection(K.create(a.doc,i+1)).scrollIntoView(),c.view.dispatch(a),c.view.focus()}),p.addEventListener(`keydown`,e=>aZ(c.view,e))}let m=n===void 0?null:z4(n,l,c,o),h=e=>{if(f(e.attrs.attributes),m?.(e.attrs.attributes.style),u?.render(e.attrs.attributes,a(e)),p!==null&&s!==void 0){let t=0;e.forEach(e=>{e.type.name===y3(s.tag)&&t++}),p.disabled=s.max!==null&&t>=s.max}};h(i);let g=e=>e?.closest?.(`.astl-picture-handle`)!=null,_=e=>(u?.dom.contains(e)??!1)||(p?.parentElement?.contains(e)??!1)||g(e instanceof Element?e:e.parentElement);return{dom:l,contentDOM:d,update:e=>e.type.name===r&&(h(e),!0),stopEvent:e=>(p?.parentElement?.contains(e.target)??!1)||g(e.target),ignoreMutation:e=>_(e.target)||e.target===l&&e.type===`attributes`}}})}function P4(e,t,n){let r=y3(e.tag);return UX.create({name:r,content:`inline*`,addAttributes:()=>E3,parseHTML:()=>[{tag:e.tag}],renderHTML:({node:t})=>[e.tag,{...t.attrs.attributes},0],addNodeView:()=>({node:i,getPos:a,editor:o})=>{let s=document.createElement(`div`);s.className=e.max===1?`astl-child astl-single`:`astl-child`;let c=C4(s,e.tag);if(c(i.attrs.attributes),t===void 0||n===void 0)return{dom:s,contentDOM:s,update:A3(r,e=>c(e.attributes))};s.classList.add(`astl-flaggable`);let l=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-flag`});l.contentEditable=`false`,Object.assign(l,{lang:n.locale,dir:Me(n.locale)}),l.append(D4(`check`,`astl-icon`));let u=document.createElement(`div`);u.className=`astl-child-text`,s.append(l,u);let d=i,f=e=>{d=e,c(e.attrs.attributes);let r=Object.hasOwn(e.attrs.attributes,t.attribute);l.setAttribute(`aria-pressed`,String(r)),s.toggleAttribute(`data-flagged`,r);let i=a(),u=typeof i==`number`?o.state.doc.resolve(i).index()+1:1,f=e.textContent.trim()||n.t(`astl.editor`,`inspector.untitled`,{n:u});l.setAttribute(`aria-label`,n.t(H,`label.text`,{label:t.label,text:f}))};return f(i),l.addEventListener(`click`,()=>{let e=a();if(typeof e!=`number`)return;let n=d.attrs.attributes,{[t.attribute]:r,...i}=n,s=Object.hasOwn(n,t.attribute)?i:{...n,[t.attribute]:``};o.view.dispatch(tK(o.state.tr.setNodeAttribute(e,`attributes`,s)))}),l.addEventListener(`keydown`,e=>aZ(o.view,e)),{dom:s,contentDOM:u,update:e=>e.type.name===r&&(f(e),!0),stopEvent:e=>l.contains(e.target),ignoreMutation:e=>l.contains(e.target)}}})}function F4(e){let t=e.attributes.filter(e=>e.type===`boolean`).map(e=>e.name);return SX.create({name:y3(e.tag),priority:200,inclusive:!1,addAttributes:()=>E3,parseHTML:()=>[{tag:e.tag}],renderHTML:({mark:t})=>[e.tag,{...t.attrs.attributes},0],addMarkView:()=>({mark:n})=>{let r=document.createElement(`span`);return r.className=`astl-mark`,C4(r,e.tag)(n.attrs.attributes),t.some(e=>Object.hasOwn(n.attrs.attributes,e))&&(r.dataset.flagged=``),{dom:r,contentDOM:r}}})}function I4(e,t,n,r){let i=(e,t,n)=>{throw TypeError(`Component manifests ${e} and ${t} declare the child ${n} differently: one editor node cannot hold both`)},a=Pt(e);a!==null&&i(...a.components,a.tag);let o=new Map;return e.flatMap(e=>{let a=e.content===`flow`,s=a||e.children.some(e=>e.content===`inline`);if(e.display===`inline`)return[O4(e.tag,e,t(e.tag),`inline`,void 0,r)];if(!s)return[O4(e.tag,e,t(e.tag),`block`,n,r)];let c=e=>a&&e.place!==`lead`;for(let t of e.children){let n=c(t)?`mark`:t.content,r=o.get(t.tag);r===void 0?o.set(t.tag,{block:e.tag,content:n}):r.content!==n&&i(r.block,e.tag,t.tag)}let l=e.children.filter(t=>o.get(t.tag)?.block===e.tag),u=new Set(n?.layers(e.tag).map(e=>e.tag)),d=r?.descriptor(e.tag)??null,f=e=>{let t=d?.fields?.find(t=>t.kind===`child-flag`&&t.tag===e);if(t?.kind===`child-flag`&&d!==null&&r!==void 0)return{attribute:t.attribute,label:r.t(d.manifest.messages,t.label)}};return[N4(e,n,r),...l.map(e=>c(e)?F4(e):e.content===`inline`?P4(e,f(e.tag),r):O4(e.tag,null,``,u.has(e.tag)?`zone`:`child`))]})}function L4(e,t,n){let r=document.createElement(`span`);return r.className=`astl-picture-handle`,r.setAttribute(`aria-hidden`,`true`),r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`pointerdown`,i=>{if(i.button!==0)return;i.preventDefault(),i.stopPropagation();let a=e.box(),o=a.parentElement;if(o===null)return;let s=getComputedStyle(o),c=o.clientWidth-Number.parseFloat(s.paddingInlineStart)-Number.parseFloat(s.paddingInlineEnd);if(c<=0)return;let l=a.getBoundingClientRect().width,u=i.clientX,d=getComputedStyle(a).direction===`rtl`,f=t(),p=(f===`end`?-1:1)*(f===`center`?2:1)*(d?-1:1),m=a.style.cssText,h=null;r.setPointerCapture(i.pointerId);let g=e=>{let t=l+p*(e.clientX-u);h=Math.round(Math.min(100,Math.max(U3,t/c*100))),a.style.setProperty(`width`,`${h}%`),n(h)},_=t=>{r.removeEventListener(`pointermove`,g),r.removeEventListener(`pointerup`,_),r.removeEventListener(`pointercancel`,_),a.style.cssText=m,n(null),t.type===`pointerup`&&h!==null&&e.commit(h)};r.addEventListener(`pointermove`,g),r.addEventListener(`pointerup`,_),r.addEventListener(`pointercancel`,_)}),r}function R4(e,t){let n=C4(e,t);return e=>n({...e,style:LN(e.style??``).rest})}function z4(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a=`inline`,o=null,s=()=>{let e=t.previousElementSibling;for(let t=0;e!==null&&t<2;t++,e=e.previousElementSibling){let t=e.querySelector(`:scope > .astl-frame-line`);if(t!==null)return t}return null};return t.append(L4({box:()=>t,commit:e=>H4(n,r(),e),open:null},()=>a,e=>{let t=s();if(t===null)return;let n=oZ(i,a,e??o);t.textContent=n.text,t.setAttribute(`aria-label`,n.label)})),e=>{a=PN(e??``),o=RN(e??``),t.dataset.astlPosition=a}}function B4(e,t,n,r=null){let i=document.createElement(t);i.className=`astl-picture`,i.contentEditable=`false`;let a=document.createElement(`img`);a.alt=``,a.draggable=!1,a.referrerPolicy=`no-referrer`;let o=i.appendChild(document.createElement(`span`));o.className=`astl-picture-alt`;let s=(t,n)=>e.t(H,t,n),c=i.appendChild(document.createElement(`span`));if(c.className=`astl-picture-tools`,n!==null){let e=c.appendChild(document.createElement(`button`));e.type=`button`,e.className=`astl-picture-edit`,e.tabIndex=-1,e.textContent=s(`surface.picture.edit`),e.addEventListener(`click`,e=>{e.preventDefault(),n()})}let l=r===null?null:V4(e,r,c,i),u=C4(i,`img`);return{dom:i,render:t=>{u(t);let n=t.src??``,r=n.trim()!==``&&e.urlPolicy(n,{tag:`img`,attribute:`src`});if(r){a.src=n;for(let e of[`width`,`height`]){let n=pN(t[e]);n===void 0?a.removeAttribute(e):a.setAttribute(e,String(n))}i.prepend(a)}else a.remove();let c=t.alt,l=c===void 0?s(`surface.picture.noAlt`):c===``?s(`surface.picture.decorative`):s(`surface.picture.alt`,{alt:c});o.textContent=r?l:`${l} ${s(`surface.picture.blocked`)}`},showPlace:e=>l?.(e)}}function V4(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a=`inline`,o=null,s=t.open,c=n.appendChild(document.createElement(s===null?`span`:`button`));c.className=`astl-picture-place`,s!==null&&(c.tabIndex=-1,c.type=`button`,c.addEventListener(`click`,e=>{e.preventDefault(),s()}));let l=e=>{let t=oZ(i,a,e??o);c.textContent=t.text,c.setAttribute(`aria-label`,t.label)};return r.append(L4(t,()=>a,l)),e=>{a=PN(e??``),o=RN(e??``),r.dataset.astlPosition=a,l(null)}}function H4(e,t,n){if(typeof t!=`number`)return;let r=e.state.doc.nodeAt(t);if(r===null)return;let i=e.state.tr;tK(i),f4(i,t,r,IN(r.attrs.attributes.style??``,n)),i.docChanged&&e.view.dispatch(i)}async function U4(e,t,n,r){let i=e.state.doc.nodeAt(n);if(i===null)return;let a=i.attrs[r],o=e=>{let t=pN(a[e]);return t===void 0?{}:{[e]:t}},s={src:a.src??``,alt:a.alt??``,...o(`width`),...o(`height`)},c=await t.ask({current:s,caption:!1,decorative:a.alt===``});if(c===null||e.isDestroyed||e.state.doc.nodeAt(n)!==i)return;let l={src:c.src,alt:c.alt};c.width!==void 0&&(l.width=String(c.width)),c.height!==void 0&&(l.height=String(c.height));let u={};for(let[e,t]of Object.entries(a))Object.hasOwn(l,e)?u[e]=l[e]:(le.has(e)||e===`class`)&&(u[e]=t);e.view.dispatch(e.state.tr.setNodeAttribute(n,r,{...u,...l}))}function W4(e,t){return UX.create({name:`astlPicture`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!0,addAttributes:()=>({attributes:{default:{},rendered:!1,parseHTML:V3}}),parseHTML:()=>[{tag:`img`}],renderHTML:({node:e})=>[`img`,{...e.attrs.attributes}],addNodeView:()=>({node:n,getPos:r,editor:i})=>{let a=B4(e,`span`,t===void 0?null:()=>{let e=r();t!==void 0&&typeof e==`number`&&U4(i,t,e,`attributes`)},{box:()=>a.dom,commit:e=>H4(i,r(),e),open:t?.style===void 0?null:()=>t.style?.(`picture`)}),o=e=>{a.render(e),a.showPlace(e.style)};return o(n.attrs.attributes),{dom:a.dom,update:A3(`astlPicture`,e=>o(e.attributes)),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!==null}}})}function G4(e,t){let n=e=>e.querySelector(`:scope > ${se}`);return UX.create({name:`astlFigure`,group:`block`,content:`inline*`,defining:!0,isolating:!0,addAttributes:()=>({attributes:{default:{},rendered:!1,parseHTML:H3},picture:{default:{},rendered:!1,parseHTML:e=>V3(e.querySelector(`:scope > img`))},caption:{default:{},rendered:!1,parseHTML:e=>H3(n(e))},captionFirst:{default:!1,rendered:!1,parseHTML:e=>e.firstElementChild?.localName===se}}),parseHTML:()=>[{tag:oe,contentElement:e=>n(e)??e.ownerDocument.createElement(`figcaption`)}],renderHTML:({node:e})=>{let t=[`img`,{...e.attrs.picture}];if(e.content.size===0)return[oe,{...e.attrs.attributes},t];let n=[se,{...e.attrs.caption},0];return[oe,{...e.attrs.attributes},...e.attrs.captionFirst?[n,t]:[t,n]]},addNodeView:()=>({node:n,getPos:r,editor:i})=>{let a=document.createElement(oe);a.className=`astl-figure`;let o=B4(e,`div`,t===void 0?null:()=>{let e=r();t!==void 0&&typeof e==`number`&&U4(i,t,e,`picture`)},{box:()=>a,commit:e=>H4(i,r(),e),open:t?.style===void 0?null:()=>t.style?.(`figure`)}),s=document.createElement(se);a.append(...n.attrs.captionFirst?[s,o.dom]:[o.dom,s]);let[c,l]=[C4(a,oe),C4(s,se)],u=e=>{o.render(e.picture),o.showPlace(e.attributes.style),c(e.attributes),l(e.caption)};return u(n.attrs),{dom:a,contentDOM:s,update:A3(`astlFigure`,u),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!==null,ignoreMutation:e=>o.dom.contains(e.target)||e.target===a&&e.type===`attributes`}}})}function K4(e){let t=(t,n)=>e.t(H,t,n),n={lang:e.locale,dir:Me(e.locale)},r=new WeakMap,i=new J({view(e){let t=()=>{let t=e.state.doc.childCount;e.state.doc.forEach((n,i,a)=>{let o=e.nodeDOM(i);n.type.name===W3&&o instanceof Element&&r.get(o)?.(a+1,t)})};return t(),{update:(e,n)=>{e.state.doc!==n.doc&&t()}}}});return UX.create({name:W3,content:G3,defining:!0,isolating:!0,addAttributes:()=>E3,parseHTML:()=>[{tag:`astl-page`}],renderHTML:({node:e})=>[`astl-page`,{...e.attrs.attributes},0],addProseMirrorPlugins:()=>[i],addNodeView:()=>({node:e,getPos:i,editor:a})=>{let o=document.createElement(`section`);o.className=`astl-page`;let s=document.createElement(`div`);s.className=`astl-page-head`,s.contentEditable=`false`;let c=`astl-page-head-${++q3}`,l=Object.assign(document.createElement(`span`),{className:`astl-page-number`,id:`${c}-number`,...n}),u=(e,t)=>{let r=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-page-${e}`,id:`${c}-${e}`,textContent:t,...n});return r.setAttribute(`aria-labelledby`,`${r.id} ${l.id}`),r},d=u(`add-title`,t(`surface.pageAddTitle`)),f=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-page-join`,hidden:!0,...n}),p=u(`delete`,t(`surface.pageDelete`));p.hidden=!0;let m=Object.assign(document.createElement(`div`),{className:`astl-page-field`,hidden:!0}),h=Object.assign(document.createElement(`input`),{className:`astl-page-label`,placeholder:t(`surface.pageTitle`)}),g=u(`remove-title`,t(`surface.pageRemoveTitle`));m.append(h,g);let _=e.attrs.attributes,v=!1,y=()=>{let e=(_.label??``)!==``;m.hidden=!(e||v),d.hidden=e||v,g.hidden=!e},b=``;r.set(o,(e,n)=>{`${e}/${n}`!==b&&(b=`${e}/${n}`,l.textContent=t(`surface.pageNumber`,{page:e,pages:n}),h.setAttribute(`aria-label`,t(`surface.pageTitleOf`,{page:e})),f.textContent=t(`surface.pageJoin`,{previous:e-1}),f.hidden=e===1,p.hidden=n===1)}),d.addEventListener(`click`,()=>{v=!0,y(),h.focus()}),h.addEventListener(`focus`,()=>{v=!0}),h.addEventListener(`blur`,()=>{v=!1,y()}),g.addEventListener(`click`,()=>{let e=i();if(typeof e!=`number`)return;let{label:t,...n}=_,r=a.state.doc.resolve(e).index(0)+1,o=tK(a.state.tr.setNodeAttribute(e,`attributes`,n)).setMeta(Y3,{key:`surface.pageTitleRemoved`,params:{page:r}});a.view.dispatch(o),v=!1,y(),d.focus()}),f.addEventListener(`click`,()=>{let e=i();if(typeof e!=`number`||a.state.doc.resolve(e).index(0)===0)return;let t=a.state.tr;t3(t,e,!0),a.view.dispatch(t),a.view.focus()}),p.addEventListener(`click`,()=>{let e=i(),t=a.state.tr;typeof e==`number`&&e3(t,e)&&(a.view.dispatch(t),a.view.focus())}),s.append(l,d,f,p,m);let x=document.createElement(`div`),ee=C4(x,`astl-page`);return ee(_),o.append(s,x),h.value=_.label??``,y(),h.addEventListener(`input`,()=>{let e=i();if(typeof e!=`number`)return;let{label:t,...n}=_,r=h.value===``?n:{...n,label:h.value};a.view.dispatch(a.state.tr.setNodeAttribute(e,`attributes`,r))}),{dom:o,contentDOM:x,update:A3(W3,e=>{_=e.attributes,ee(_),h.value!==(_.label??``)&&(h.value=_.label??``),y()}),stopEvent:e=>s.contains(e.target),ignoreMutation:e=>s.contains(e.target)}}})}function q4(e,t){tK(e).setMeta(Y3,t).scrollIntoView()}function J4(e,t){let n=null;return e.forEach((e,r,i)=>{let a=e.attrs.attributes?.id;n===null&&t!==void 0&&e.type.name===W3&&a===t&&(n={pos:r,node:e,index:i})}),n}function Y4(e,t){let{doc:n}=e,r=n.type.schema.nodes[W3];if(r===void 0||n.firstChild?.type===r)return;let i=n.resolve(0).blockRange(n.resolve(n.content.size));i!==null&&e.wrap(i,[{type:r,attrs:{attributes:{id:s3(`page`,t)}}}])}function X4(e){let{doc:t,selection:n}=e,{$from:r}=n,{nodes:i}=t.type.schema,[a,o]=[i[W3],i.paragraph],s=t.firstChild?.type===a,c=+!!s;if(a===void 0||o===void 0||r.depth<c)return null;let l=n instanceof q&&r.depth===c?n.to:r.pos,u=!1;r.depth===c+1&&X3.has(r.parent.type.name)?r.parentOffset===0?l=r.before():r.parentOffset===r.parent.content.size?l=r.after():u=!0:r.depth>c&&(l=r.after(c+1));let d=f3(t),f=Object.fromEntries(Object.entries(s?r.node(1).attrs.attributes:{}).filter(([e])=>le.has(e)||e===`class`));Y4(e,d);let p=s3(`page`,d),m={type:a,attrs:{attributes:{id:p,...f}}},h=s?l:l+1,g;if(u)e.split(h,2,[m]),g=h+2;else{let t=e.doc.resolve(h);t.index()===0?(e.insert(h,o.create()),h+=2):t.index()===t.parent.childCount&&e.insert(h,o.create()),e.split(h,1,[m]),g=h+1}return e.setSelection(G.near(e.doc.resolve(g+1))),q4(e,{key:`surface.pageAdded`,params:{page:e.doc.resolve(g).index(0)+1}}),p}function Z4(e,t){let{nodes:n}=e.doc.type.schema,[r,i]=[n[W3],n.paragraph];if(r===void 0||i===void 0)throw Error(`the schema has no pages`);let a=f3(e.doc);Y4(e,a);let o=J4(e.doc,t),s=o===null?e.doc.content.size:o.pos+o.node.nodeSize,c=s3(`page`,a);return e.insert(s,r.create({attributes:{id:c}},i.create())),e.setSelection(K.create(e.doc,s+2)),q4(e,{key:`surface.pageAdded`,params:{page:e.doc.resolve(s).index(0)+1}}),c}function Q4(e,t){let n=J4(e.doc,t);return n===null||n.index===0?!1:(t3(e,n.pos,!0),!0)}function $4(e,t){let n=J4(e.doc,t);return n!==null&&e3(e,n.pos)}function e3(e,t){let{doc:n}=e,r=n.resolve(t).index(0),i=n.child(r);if(n.childCount===1)return!1;let a=r===0?t:t-n.child(r-1).nodeSize;return e.delete(t,t+i.nodeSize),e.setSelection(G.near(e.doc.resolve(a+1))),q4(e,{key:`surface.pageDeleted`,params:{n:r+1}}),!0}function t3(e,t,n){let r=e.doc.resolve(t).index(0)+1;e.join(t),n&&e.setSelection(G.near(e.doc.resolve(t-1))),q4(e,{key:`surface.pageJoined`,params:{page:r,previous:r-1}})}function n3(e){let{$from:t,empty:n}=e;if(!(e instanceof K)||!n||t.parentOffset!==0||Z3(t)||t.depth<2||t.node(1).type.name!==W3||t.index(0)===0)return null;for(let e=1;e<t.depth;e++)if(t.index(e)!==0)return null;return t.before(1)}function r3(e){let{$to:t,empty:n}=e;if(!(e instanceof K)||!n||t.parentOffset!==t.parent.content.size||Z3(t)||t.depth<2||t.node(1).type.name!==W3||t.index(0)===t.node(0).childCount-1)return null;for(let e=1;e<t.depth;e++)if(t.index(e)!==t.node(e).childCount-1)return null;return t.after(1)}function i3(e,t){let n=t.tr;return t.doc.descendants((t,r)=>{let i=e.get(t.type.name);if(i===void 0)return!0;let a=e=>($3(i,e)?.attributes??[]).filter(e=>e.type===`id`),o=new Set;t.forEach(e=>{for(let{name:t}of a(e))o.add(e.attrs.attributes[t]??``)});let s=new Set;return t.forEach((e,t)=>{let c=$3(i,e),l=e.attrs.attributes,u=null;for(let{name:t,required:n}of a(e)){let e=l[t]??``;if(e!==``&&!s.has(e)){s.add(e);continue}if(e===``&&!n)continue;u??=Object.fromEntries(Object.entries(l).filter(([e])=>c?.attributes.find(t=>t.name===e)?.visibility!==`private`));let r=c?.tag.replace(/^astl-/,``)??`item`,i=1;for(;o.has(`${r}-${i}`);)i++;u[t]=`${r}-${i}`,o.add(u[t]),s.add(u[t])}u!==null&&n.setNodeAttribute(r+1+t,`attributes`,u)}),!1}),n.docChanged?n:null}function a3(e){let t=new Map(e.filter(e=>e.display===`block`&&e.content!==`flow`&&e.children.some(e=>e.content===`inline`)).map(e=>[y3(e.tag),e]));return Z.create({name:`astlChildren`,priority:1e3,addKeyboardShortcuts(){return{Enter:({editor:e})=>{let{state:n}=e,{$from:r}=n.selection;if(r.depth<2||!r.parent.isTextblock)return!1;let i=t.get(r.node(-1).type.name),a=i===void 0?void 0:$3(i,r.parent);if(i===void 0||a===void 0)return!1;let o=a.max===1?i.children.find(e=>e.max!==1&&e.content===`inline`):a,s=o===void 0?void 0:n.schema.nodes[y3(o.tag)];if(s===void 0)return!0;let c=n.tr.deleteSelection();return c.split(c.selection.from,1,[{type:s,attrs:{attributes:{}}}]),e.view.dispatch(c.scrollIntoView()),!0}}},addProseMirrorPlugins:()=>[new J({appendTransaction:(e,n,r)=>e.some(e=>e.docChanged)?i3(t,r):null})]})}function o3(e,t,n){let r=[],i=new Map;return e.descendants((e,a)=>{if(e.type.name===`astlFigure`)return!1;if(!e.isText)return!0;let o=t+1+a;for(let t of e.marks){if(!n.has(t.type.name))continue;let a=i.get(t.type.name);if(a!==void 0&&a.to===o&&a.mark.eq(t))a.to=o+e.nodeSize;else{let n={from:o,to:o+e.nodeSize,mark:t};r.push(n),i.set(t.type.name,n)}}return!1}),r}function s3(e,t){let n=1;for(;t.has(`${e}-${n}`);)n++;return t.add(`${e}-${n}`),`${e}-${n}`}function c3(e,t,n){let r=e.tr,i=(e,t,i,a)=>{for(let o of e.marks){let s=o.type.name;n.has(s)&&(!i.has(s)||a?.type.name===`astlFigure`)&&r.removeMark(t,t+e.nodeSize,o.type)}},a=new Set;return e.doc.descendants((e,n,o)=>{let s=t.get(e.type.name);if(s===void 0)return e.isText&&i(e,n,a,o),!0;let c=new Map(s.children.map(e=>[y3(e.tag),e])),l=new Set(c.keys());e.descendants((e,t,r)=>(e.isText&&i(e,n+1+t,l,r),!0));let u=o3(e,n,l),d=new Set(u.map(e=>e6(e.mark))),f=new Set;for(let e of u){let t=c.get(e.mark.type.name),n=e6(e.mark);if(t===void 0||!t.attributes.some(e=>e.name===`id`))continue;if(n!==``&&!f.has(n)){f.add(n);continue}let i=e.mark.attrs.attributes,a=Object.entries(i).filter(([e])=>e!==`id`&&(n===``||t.attributes.find(t=>t.name===e)?.visibility!==`private`)),o=s3(t.tag.replace(/^astl-/,``),d);f.add(o);let s=e.mark.type.create({attributes:{id:o,...Object.fromEntries(a)}});r.removeMark(e.from,e.to,e.mark).addMark(e.from,e.to,s)}return!1}),r.docChanged?r:null}function l3(e,t,n,r,i,a){let o=e.schema.nodes[y3(n.tag)],s=e.schema.marks[y3(r.child)];if(o===void 0||s===void 0)return!1;let{from:c,to:l,$from:u,$to:d}=e.selection,f=!1;for(let e=u.depth;e>0;e--){let t=u.node(e);if(t.type===o){f=l<=u.end(e);break}if(a.has(t.type.name))return!1}let p=new Set([s.name]),m=[];if(e.doc.nodesBetween(c,l,(e,t)=>{if(!e.isTextblock||e.type.name===`astlFigure`)return!e.isTextblock;let n=o3(e,t,p),r=e.textBetween(0,e.content.size,void 0,``);for(let e of r.matchAll(t6)){let r=t+1+e.index,i=r+e[0].length;if(c===l?r>c||i<c:r>=l||i<=c)continue;let a=n.find(e=>e.from<i&&e.to>r);a===void 0?m.push({from:r,to:i,marked:!1}):m.some(e=>e.from===a.from)||m.push({from:a.from,to:a.to,marked:!0})}return!1}),m.length===0)return!1;if(m.every(e=>e.marked)){for(let e of m)t.removeMark(e.from,e.to,s);return!0}let h=null;if(!f){let n=u.blockRange(d,e=>[`doc`,W3,dZ].includes(e.type.name));if(n===null)return!1;for(let e=n.startIndex;e<n.endIndex;e++)if(!F3.includes(n.parent.child(e).type.name))return!1;t.wrap(n,[{type:o,attrs:{attributes:{id:s3(i,f3(e.doc))}}}]),h=n.start}let g=new Set;e.doc.descendants(e=>{for(let t of e.marks)t.type===s&&g.add(e6(t));return!0});let _=r.child.replace(/^astl-/,``);for(let e of m){if(e.marked)continue;let n={id:s3(_,g),...r.attributes};t.addMark(t.mapping.map(e.from),t.mapping.map(e.to),s.create({attributes:n}))}if(h!==null){let e=h+(t.doc.nodeAt(h)?.nodeSize??0);t.doc.resolve(e).nodeAfter?.type===o&&t.join(e),t.doc.resolve(h).nodeBefore?.type===o&&t.join(h)}return!0}function u3(e,t){let n=new Map(t.filter(e=>e.content===`flow`).map(e=>[y3(e.tag),e])),r=new Set([...n.values()].flatMap(e=>e.children.filter(e=>e.place!==`lead`).map(e=>y3(e.tag)))),i=new Set(t.map(e=>y3(e.tag))),a=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof q)||!n.has(t.node.type.name))return!1;let r=e.state.tr.replaceWith(t.from,t.to,t.node.content);return e.view.dispatch(r.scrollIntoView()),!0};return Z.create({name:`astlRichBlocks`,priority:1e3,addKeyboardShortcuts:()=>({Backspace:a,Delete:a}),addCommands:()=>({astlWrap:t=>({state:r,tr:a})=>{let o=e.descriptor(t),s=n.get(y3(t));return o?.wrap===void 0||s===void 0?!1:l3(r,a,s,o.wrap,o.idPrefix,i)}}),addProseMirrorPlugins:()=>[new J({appendTransaction:(e,t,i)=>r.size>0&&e.some(e=>e.docChanged)?c3(i,n,r):null})]})}function d3(e){let t=[];for(let n of e){t=t.map(([e,t])=>[n.mapping.map(e,1),n.mapping.map(t,-1)]);let e=n.getMeta(`uiEvent`);(e===`paste`||e===`drop`)&&n.steps.forEach((e,r)=>{let i=n.mapping.slice(r+1);e.getMap().forEach((e,n,r,a)=>{t.push([i.map(r,1),i.map(a,-1)])})})}return t}function f3(e){let t=new Set,n=e=>{for(let r of e)typeof r!=`string`&&(r.attributes.id!==void 0&&t.add(r.attributes.id),n(r.children))};return e.descendants(e=>{let r=e.attrs.attributes?.id;return r!==void 0&&t.add(r),Array.isArray(e.attrs.children)&&n(e.attrs.children),!0}),t}function p3(e,t,n){let r=new Map(t.map(e=>[y3(e.tag),e.tag])),i=t=>{let n=r.get(t);if(n===void 0)return`page`;let i=e.descriptor(n)?.idPrefix??n.replace(/^astl-/,``);return Ae(`${i}-1`)?i:`item`},a=(e,t)=>{let n=[];e.doc.descendants((e,i)=>{let a=e.type.name===`astlPage`;if(!a&&!r.has(e.type.name))return!0;let o=t.some(([e,t])=>i>=e&&i<t);return n.push({node:e,pos:i,pasted:o}),a});let a=e=>e.attrs.attributes.id??``,o=new Set(n.filter(e=>!e.pasted).map(e=>a(e.node))),s=f3(e.doc),c=e.tr;for(let{node:e,pos:t,pasted:r}of n){let n=a(e);if(!r||n===``)continue;if(!o.has(n)){o.add(n);continue}let l=i(e.type.name),u=1;for(;s.has(`${l}-${u}`);)u++;let d=`${l}-${u}`;s.add(d),o.add(d),c.setNodeAttribute(t,`attributes`,{...e.attrs.attributes,id:d})}return c.docChanged?c:null},o=(t,r,i)=>{let a=[...r??[]].filter(e=>e.type.startsWith(`image/`));return a.length===0||n===void 0?!1:e.uploadAsset===null?(n.refuse(),!0):((async()=>{let e=i;for(let r of a){let i=await n.ask({file:r});if(i===null||t.isDestroyed)return;let a=Math.min(e??t.state.selection.from,t.state.doc.content.size);t.chain().insertContentAt(a,mN(i)).run(),e=t.state.selection.to}})(),!0)};return Z.create({name:`astlPastedIds`,addKeyboardShortcuts(){return{Enter:({editor:e})=>{if(n===void 0)return!1;let{selection:t}=e.state;return t instanceof q&&t.node.type.name===`astlPicture`?(U4(e,n,t.from,`attributes`),!0):t.$from.parent.type.name===`astlFigure`&&(U4(e,n,t.$from.before(),`picture`),!0)}}},addProseMirrorPlugins(){let e=this.editor;return[new J({appendTransaction:(e,t,n)=>{let r=d3(e);return r.length===0?null:a(n,r)},props:{handlePaste:(t,n)=>(n.clipboardData?.getData(`text/plain`)??``).trim()===``&&o(e,n.clipboardData?.files,null),handleDrop:(t,n)=>o(e,n.dataTransfer?.files,t.posAtCoords({left:n.clientX,top:n.clientY})?.pos??null)}})]}})}function m3(e,t){return Array.isArray(e)?e.map(e=>m3(e,t)):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{if(e!==`class`)return[[e,m3(n,t)]];let r=String(n??``).split(/\s+/).filter(e=>t.has(e)).join(` `);return r===``?[]:[[e,r]]}))}function h3(e,t){let n=[];return e.forEach(e=>{let r=e.marks.map(e=>e.type.create(m3(e.attrs,t)));n.push(e.isText?e.mark(r):e.type.create(m3(e.attrs,t),h3(e.content,t),r))}),U.fromArray(n)}function g3(e,t){let n=`[data-astl-rules='${t}']`.repeat(2),r=e=>`[data-astl-tag='${e}']`,i=({name:e,for:t})=>{if(e!==void 0)return kn(e)?`${n} .${CSS.escape(e)}`:null;if(t===void 0||!s6.test(t))return null;if(t===`astl-doc`)return n;if(t===`img`)return`${n} ${r(t)}`;let i=t===`astl-page`?`, ${n}:not(:has(${r(t)}))`:``;return`${n} :is(${t}, ${r(t)})${i}`};return[...e].sort((e,t)=>Number(e.name!==void 0)-Number(t.name!==void 0)).flatMap(e=>{let t=Fn(e.style??``).style,n=i(e);return t===``||n===null?[]:[`${n} { ${t}; }`]}).join(`
7012
- `)}function _3(e,t){let n=new Map;for(let r of t)for(let t of e.descriptor(r.tag)?.fields??[])t.kind===`attribute`&&t.options!==void 0&&!n.has(y3(r.tag))&&n.set(y3(r.tag),{name:t.name,...t.options});let r=e=>{if(n.size===0)return pG.empty;let t=new Map;e.descendants(e=>{let n=e.attrs.attributes?.id;return n!==void 0&&!t.has(n)&&!e.isText&&t.set(n,e),!0});let r=[];return e.descendants((e,i)=>{let a=n.get(e.type.name);if(a===void 0)return!0;let o=e.attrs.attributes,s=t.get(o[a.from]??``),c=o[a.name]??``,l=null;if(s?.descendants(e=>l===null&&(e.type.name===y3(a.tag)&&e.attrs.attributes.id===c&&(l=e.textContent.trim()),l===null)),s!==void 0&&l===null)for(let e of s.attrs.children??[])typeof e!=`string`&&e.tag===a.tag&&e.attributes.id===c&&(l=T3(e).trim());return r.push(uG.node(i,i+e.nodeSize,{},{[N3]:l??c})),!1}),pG.create(e,r)};return Z.create({name:`astlReferences`,addProseMirrorPlugins:()=>[new J({state:{init:(e,t)=>r(t.doc),apply:(e,t)=>e.docChanged?r(e.doc):t},props:{decorations(e){return this.getState(e)??pG.empty}}})]})}function v3(e,t=e.engine.manifests,n={}){let r=n.pictures,i=new Map(t.map(e=>[y3(e.tag),e])),a=t=>{let n=e.descriptor(t);if(n===null)return t;let r=e.t(n.manifest.messages,n.label);return r===n.label?t:r};return[q2.configure({document:!1,codeBlock:!1,horizontalRule:!1,trailingNode:!1,heading:{levels:[2,3,4]},link:{openOnClick:!1,HTMLAttributes:{target:null,rel:null,class:null}}}),...a6,o6,J3,K4(e),...K3,r4(e=>i.has(e.type.name)),l6,Q3,W4(e,r),G4(e,r),u6,...I4(t,a,w4(e),e),...M4(e),_3(e,t),a3(t),u3(e,t),p3(e,t,r),cZ(e,e=>i.get(e.type.name)??null,y3,r?.style===void 0?void 0:()=>r.style?.(`component`))]}var y3,b3,x3,S3,C3,w3,T3,E3,D3,O3,k3,A3,j3,M3,N3,P3,F3,I3,L3,R3,z3,B3,V3,H3,U3,W3,G3,K3,q3,J3,Y3,X3,Z3,Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6,l6,u6,d6=n((()=>{w(),Or(),kI(),WX(),_K(),WB(),UB(),EG(),J2(),yZ(),l4(),S4(),y3=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),b3=/^[A-Za-z_:][\w.:-]*$/,x3=`data-pm-slice`,S3=e=>Object.fromEntries([...e.attributes].flatMap(({name:e,value:t})=>{if(!b3.test(e)||e===x3)return[];if(e!==`style`&&e!==`data-astl-style`&&e!==`class`)return[[e,t]];let n=e===`class`?An(t):Fn(t).style;return n===``?[]:[[e===`data-astl-style`?`style`:e,n]]})),C3=e=>{if(e.nodeType===globalThis.Node.TEXT_NODE)return[e.textContent??``];if(e.nodeType!==globalThis.Node.ELEMENT_NODE)return[];let t=e;return[{tag:t.localName,attributes:S3(t),children:[...t.childNodes].flatMap(C3)}]},w3=e=>typeof e==`string`?e:[e.tag,{...e.attributes},...e.children.map(w3)],T3=e=>typeof e==`string`?e:e.children.map(T3).join(``),E3={attributes:{default:{},rendered:!1,parseHTML:S3}},D3={...E3,children:{default:[],rendered:!1,parseHTML:e=>[...e.childNodes].flatMap(C3)}},O3=`http://www.w3.org/2000/svg`,k3=e=>{let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0},A3=(e,t)=>n=>n.type.name===e&&(t(n.attrs),!0),j3=e=>e.flatMap(e=>typeof e==`string`?[]:[{tag:e.tag,attributes:e.attributes}]),M3={check:`M4 10.5l4 4 8-9`,warning:`M10 3l8 14H2zM10 8v4M10 14.5v.5`,add:`M10 4v12M4 10h12`},N3=`astlReference`,P3=e=>{for(let t of e){let e=t.spec[N3];if(typeof e==`string`)return e}return null},F3=[`paragraph`,`heading`,`bulletList`,`orderedList`,`blockquote`,`astlFigure`],I3=`(${F3.join(` | `)})+`,L3=`help`,R3=[`0`,`0.1`,`0.25`,`0.5`,`1`],z3=new Set([...be.img??[],...le,ue]),B3=e=>t=>t===null?{}:Object.fromEntries(Object.entries(S3(t)).filter(([t])=>e.has(t))),V3=B3(z3),H3=B3(new Set([...le,ue])),U3=5,W3=`astlPage`,G3=`(block | ${uZ} | ${L3})+`,K3=[UX.create({name:uZ,content:`${dZ}{2,4}`,isolating:!0,addAttributes:()=>E3,addKeyboardShortcuts(){return{Backspace:({editor:e})=>{let{selection:t}=e.state,n=Y2(e.state),{$from:r}=t;if(n===null||!t.empty||r.parentOffset>0||!o4(n.node)||r.pos!==n.pos+3)return!1;let i=tK(e.state.tr);return Q2(i,n,!0),e.view.dispatch(i.scrollIntoView()),!0}}},parseHTML:()=>[{tag:ge}],renderHTML:({node:e})=>[ge,{...e.attrs.attributes},0]}),UX.create({name:dZ,content:`block+`,isolating:!0,selectable:!1,addAttributes:()=>E3,parseHTML:()=>[{tag:_e,context:`${uZ}/`,priority:60},{tag:_e,context:`doc/|${W3}/|${dZ}/`,skip:!0,priority:60}],renderHTML:({node:e})=>[_e,{...e.attrs.attributes},0]})],q3=0,J3=UX.create({name:`doc`,topNode:!0,content:`(${G3} | astlPage+)`,addAttributes:()=>({attributes:{default:{},rendered:!1},rules:{default:[],rendered:!1}})}),Y3=`astlPageChange`,X3=new Set([`paragraph`,`heading`]),Z3=e=>e.depth>1&&e.node(2).type.name===`astlLayout`,Q3=Z.create({name:`astlPages`,priority:1e3,addKeyboardShortcuts:()=>({"Mod-Enter":({editor:e})=>{let t=e.state.tr;return X4(t)!==null&&e.view.dispatch(t),!0},Backspace:({editor:e})=>{let t=n3(e.state.selection);if(t===null)return!1;if(e.commands.undoInputRule())return!0;let n=e.state.tr;return t3(n,t,!1),e.view.dispatch(n),!0},Delete:({editor:e})=>{let t=r3(e.state.selection);if(t===null)return!1;let n=e.state.tr;return t3(n,t,!1),e.view.dispatch(n),!0}})}),$3=(e,t)=>e.children.find(e=>y3(e.tag)===t.type.name),e6=e=>e.attrs.attributes.id??``,t6=/[\p{L}\p{N}\p{M}]+(?:['’-][\p{L}\p{N}\p{M}]+)*/gu,n6=e=>[e,{default:null,parseHTML:t=>S3(t)[e]??null,renderHTML:t=>t[e]?{[e]:t[e]}:{}}],r6=Object.fromEntries([...le].map(n6)),i6=Object.fromEntries([...le,ue].map(n6)),a6=[`sub`,`sup`,`mark`,`span`].map(e=>SX.create({name:e===`span`?`textSpan`:e,...e===`span`?{excludes:``}:{},addAttributes:()=>i6,parseHTML:()=>[{tag:e}],renderHTML:({HTMLAttributes:t})=>[e,t,0]})),o6=Z.create({name:`astlContentAttributes`,addGlobalAttributes:()=>[{types:[`paragraph`,`heading`,`blockquote`,`bulletList`,`orderedList`,`listItem`,`bold`,`italic`,`underline`,`strike`,`code`],attributes:i6},{types:[`link`],attributes:r6}]}),s6=/^[a-z][a-z0-9-]*$/,c6=0,l6=Z.create({name:`astlRules`,addProseMirrorPlugins:()=>{let e=String(++c6);return[new J({props:{attributes:t=>{let{style:n,class:r}=t.doc.attrs.attributes;return{"data-astl-rules":e,...n===void 0?{}:{style:n},...r===void 0?{}:{class:r}}},transformPastedHTML:e=>me(e),transformPasted:(e,t)=>{let n=t.state.doc.attrs.rules,r=new Set(n.flatMap(e=>e.name??[]));return new W(h3(e.content,r),e.openStart,e.openEnd)}},view:t=>{let n=new CSSStyleSheet,r=null,i=[],a=()=>{r?.adoptedStyleSheets!==void 0&&(r.adoptedStyleSheets=r.adoptedStyleSheets.filter(e=>e!==n))},o=()=>{let o=t.state.doc.attrs.rules;o!==i&&n.replaceSync(g3(o,e)),i=o;let s=t.dom.getRootNode();o.length!==0&&s!==r&&s.adoptedStyleSheets!==void 0&&(a(),r=s,s.adoptedStyleSheets=[...s.adoptedStyleSheets,n])};return o(),{update:o,destroy:a}}})]}}),u6=Z.create({name:`astlCurrentFigure`,addProseMirrorPlugins:()=>[new J({props:{decorations:({doc:e,selection:t})=>{let{$from:n}=t;for(let t=n.depth;t>0;t--){if(n.node(t).type.name!==`astlFigure`)continue;let r=uG.node(n.before(t),n.after(t),{class:`astl-figure-current`});return pG.create(e,[r])}return pG.empty}}})]})}));function f6(e,t,n,r){switch(t){case`bold`:return e.toggleBold();case`italic`:return e.toggleItalic();case`underline`:return e.toggleUnderline();case`link`:return r===void 0||r===``?e.extendMarkRange(`link`).unsetLink():e.extendMarkRange(`link`).setLink({href:r});case`paragraph`:return e.setParagraph();case`heading`:return n?e.setParagraph():e.setHeading({level:3});case`subheading`:return n?e.setParagraph():e.setHeading({level:4});case`bulleted`:return e.toggleBulletList();case`numbered`:return e.toggleOrderedList()}}function p6(e,t,n,r){if(n.sameMarkup(r)||e.setNodeMarkup(t,void 0,r.attrs,n.marks),n.isLeaf||n.content.eq(r.content))return;if(!(n.childCount===r.childCount&&n.content.content.every((e,t)=>e.type===r.child(t).type&&(!e.isText||e.eq(r.child(t)))))){e.replaceWith(t+1,t+n.nodeSize-1,r.content);return}let i=[];n.forEach((e,t)=>{i.push(t)});for(let a=n.childCount-1;a>=0;a--)p6(e,t+1+(i[a]??0),n.child(a),r.child(a))}function m6(e,t){let n=new Map(t.map(e=>[y3(e.tag),e.tag])),r=new Map(t.map(e=>[y3(e.tag),e])),i=new Map(t.flatMap(e=>(e.children??[]).map(e=>[y3(e.tag),e.tag]))),a=pZ(e=>r.get(e.type.name)??null),o=hR.fromSchema(e.schema),s=oR.fromSchema(e.schema),c=e=>n.has(e.type.name),l=e=>{let t=e.attrs.attributes.id;return typeof t==`string`&&t!==``?{id:t,tag:n.get(e.type.name)??``}:null},u=t=>{let n=null;return e.state.doc.descendants((e,r)=>n===null&&((c(e)||e.type.name===`astlPage`)&&e.attrs.attributes.id===t&&(n={node:e,pos:r}),n===null)),n},d=()=>{let t=e.state.selection;if(t instanceof q&&c(t.node))return l(t.node);let{$from:n}=t;for(let e=n.depth;e>0;e--)if(c(n.node(e)))return l(n.node(e));let r=[n.nodeAfter,n.nodeBefore].find(e=>e!==null&&c(e));return r?l(r):null},f=t=>{let n=u(t);if(n===null)return null;let{doc:r}=e.state;return n.node.isAtom?q.create(r,n.pos):K.near(r.resolve(n.pos+1))},p=()=>{let{doc:t,selection:n}=e.state;if(!(n instanceof K)||n.empty||!n.$from.sameParent(n.$to))return``;for(let e=n.$from.depth;e>0;e--)if(c(n.$from.node(e)))return``;let r=!0;return t.nodesBetween(n.from,n.to,e=>(e.isInline&&!e.isText&&(r=!1),r)),r?t.textBetween(n.from,n.to).trim():``},m=()=>{let t=e.state.selection;if(t instanceof q&&c(t.node))return[];for(let e=t.$from.depth;e>0;e--){let n=t.$from.node(e);if(c(n))return r.get(n.type.name)?.content===`flow`?g6:h6}return g6},h=()=>{let{selection:t}=e.state,n=[],r=t.$from.parent,i=t instanceof q&&c(t.node);for(let t of[`bold`,`italic`,`underline`,`link`])e.isActive(t)&&n.push(t);!i&&r.type.name===`paragraph`&&n.push(`paragraph`),!i&&r.type.name===`heading`&&n.push(r.attrs.level===4?`subheading`:`heading`),e.isActive(`bulletList`)&&n.push(`bulleted`),e.isActive(`orderedList`)&&n.push(`numbered`);let a=e.can(),o={bold:()=>a.toggleBold(),italic:()=>a.toggleItalic(),underline:()=>a.toggleUnderline(),link:()=>(!t.empty||e.isActive(`link`))&&a.setLink({href:`https://example.org`}),paragraph:()=>a.setParagraph()||n.includes(`paragraph`),heading:()=>a.setHeading({level:3})||n.includes(`heading`),subheading:()=>a.setHeading({level:4})||n.includes(`subheading`),bulleted:()=>a.toggleBulletList(),numbered:()=>a.toggleOrderedList()},s=e.getAttributes(`link`).href;return{active:n,enabled:m().filter(e=>o[e]()),href:typeof s==`string`?s:null,undo:a.undo(),redo:a.redo()}},g=t=>{let n=e.state.doc;return t(e.chain().focus().command(({tr:e})=>(tK(e),!0))).run(),e.state.doc!==n},_={getSource:()=>KX(e.state.doc),setSource(t){let n=new DOMParser().parseFromString(me(t),`text/html`).body,r=n.querySelector(`astl-doc`),i=r===null?[]:[...r.children].filter(e=>e.localName===he);for(let e of i)e.remove();let{content:a}=s.parse(r??n),o=e.state.tr;a.eq(e.state.doc.content)||o.replaceWith(0,e.state.doc.content.size,a);let c=i.map(S3);JSON.stringify(c)!==JSON.stringify(e.state.doc.attrs.rules)&&o.setDocAttribute(`rules`,c),e.view.dispatch(o.setDocAttribute(`attributes`,r===null?{}:S3(r)))},insert(t,n={}){let{doc:r,selection:i}=e.state,a=me(t),o=qX.createElement(`div`);o.innerHTML=a;let l=s.parseSlice(o).content.firstChild,u=l?.isInline??!0,d=l?.type.name===uZ,m=i instanceof q&&c(i.node)?i.node:null,h=m!==null&&(u||!m.isInline)?i.to:null;for(let e=i.$from.depth;h===null&&e>0;e--)c(i.$from.node(e))&&(h=i.$from.after(e));for(let e=i.$from.depth;d&&e>0;e--)i.$from.node(e).type.name===`astlLayout`&&(h=i.$from.after(e));let g=n.replaceSelection===!0&&h===null&&p()!==``;if(h===null&&g){let e=r.textBetween(i.from,i.to);h={from:i.from+(e.length-e.trimStart().length),to:i.to-(e.length-e.trimEnd().length)}}else if(h===null&&!u){let{$from:e}=i,t=+(r.firstChild?.type.name===`astlPage`);for(let n=e.depth;n>t;n--)e.node(n).type.name===`astlLayoutColumn`&&(t=n);if(e.depth>t){let n=e.node(t+1);h=n.type.name===`paragraph`&&n.content.size===0?{from:e.before(t+1),to:e.after(t+1)}:e.after(t+1)}else h=i.to}e.chain().insertContentAt(h??i.to,a).run();let _=$j(t)[0]?.id,v=_?f(_):null;v instanceof q&&g&&v.node.isInline?e.view.dispatch(e.state.tr.setSelection(K.create(e.state.doc,v.to))):v!==null&&e.view.dispatch(e.state.tr.setSelection(v))},getElement(e){let t=u(e);return t!==null&&c(t.node)?GX(o.serializeNode(t.node,{document:qX})):null},replaceElement(t,n){let r=u(t);if(r===null||!c(r.node))return;let i=qX.createElement(`div`);i.innerHTML=me(n);let a=null;if(s.parseSlice(i).content.descendants(e=>(a===null&&e.type===r.node.type&&(a=e),a===null)),a===null)return;let o=e.state.selection instanceof q&&e.state.selection.from===r.pos,l=e.state.tr;p6(l,r.pos,r.node,a),l.docChanged&&(o&&l.setSelection(q.create(l.doc,r.pos)),e.view.dispatch(l))},getSelection:d,select(t){let n=f(t);n!==null&&(e.view.dispatch(e.state.tr.setSelection(n).scrollIntoView()),e.view.focus())},onChange(t){let n=()=>t();return e.on(`update`,n),()=>e.off(`update`,n)},wrap(t){let n=e.commands.astlWrap(t);return e.view.focus(),n},splitPage(){let t=e.state.tr,n=X4(t);return n!==null&&e.view.dispatch(t),n},addPage(t){let n=e.state.tr,r=Z4(n,t);return e.view.dispatch(n),r},mergePage(t){let n=e.state.tr,r=Q4(n,t);return r&&e.view.dispatch(n),r},removePage(t){let n=e.state.tr,r=$4(n,t);return r&&e.view.dispatch(n),r},format(e,t){if(!m().includes(e))return!1;let n=h().active.includes(e);return g(r=>f6(r,e,n,t))},formatState:h,undo(){let t=e.state.doc;return e.chain().focus().undo().run(),e.state.doc!==t},redo(){let t=e.state.doc;return e.chain().focus().redo().run(),e.state.doc!==t},moveBlock(t,n){let r=e.state.tr;return tZ(r,t,n,a)!==null&&(e.view.dispatch(r),!0)},removeBlock(t){let n=e.state.tr;return nZ(n,t,a)?(e.view.dispatch(n),!0):!1},getCursor:()=>QX(e.state,a),onCursorChange(t){let n=({transaction:e})=>{(e.docChanged||e.selectionSet||e.storedMarksSet)&&t()};return e.on(`transaction`,n),()=>e.off(`transaction`,n)},selectedText:p,focus(){e.view.hasFocus()||e.view.focus()},onSelectionChange(t){let n=d(),r=()=>{let e=d();(e?.id!==n?.id||e?.tag!==n?.tag)&&(n=e,t(e))};return e.on(`selectionUpdate`,r),e.on(`update`,r),()=>{e.off(`selectionUpdate`,r),e.off(`update`,r)}},style:m4(e,c,e=>n.get(e.type.name)??i.get(e.type.name)??e.type.name,e=>_.insert(e))};return _}var h6,g6,_6=n((()=>{w(),kI(),_K(),WB(),UB(),yZ(),d6(),JX(),S4(),h6=[`bold`,`italic`,`underline`,`link`],g6=[...h6,`paragraph`,`heading`,`subheading`,`bulleted`,`numbered`]}));function v6(e){let t=e.getRootNode(),n=w6.styleSheet;n!==void 0&&t.adoptedStyleSheets!==void 0&&(t.adoptedStyleSheets.includes(n)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,n]))}var y6,b6,x6,S6,C6,w6,T6=n((()=>{z(),y6=`astl-surface`,b6=F`
7008
+ `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=a0(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
7009
+ `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function o0(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}function s0(e,t){let n=[],r=0;for(;n.length<t;){let t=e.indexOf(`
7010
+ `,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function c0(e){let t=e.indexOf(`
7011
+ `),n=t===-1?e:e.slice(0,t);if(!j0.test(n))return[[],0,[]];let r=F0,i=s0(e,r),a=r0(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=s0(e,r),a=r0(i);return[a[0],a[1],i]}function l0(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var u0,d0,f0,p0,m0,h0,g0,_0,v0,y0,b0,x0,S0,C0,w0,T0,E0,D0,O0,k0,A0,j0,M0,N0,P0,F0,I0,L0,R0,z0,B0,V0,H0,U0,W0,G0=n((()=>{GX(),WB(),UB(),u0=`listItem`,d0=`textStyle`,f0=/^\s*([-+*])\s$/,p0=WX.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7012
+ `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(u0,this.editor.getAttributes(d0)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=zJ({find:f0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=zJ({find:f0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(d0),editor:this.editor})),[e]}}),m0=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},h0=(e,t,n,r)=>{let i=m0(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,U.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},g0=(e,t,n)=>h0(e.state,e.view.dispatch,t,n),_0=(e,t)=>OX.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>g0(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),v0=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],y0=`abcdefghijklmnopqrstuvwxyz`,b0=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`,x0=WX.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Z1(e))return{type:`listItem`,content:[{type:`paragraph`,content:Q1(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>TJ(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return X1((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[_0(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),S0=(e,t)=>{let{$from:n}=t.selection,r=yK(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},C0=(e,t)=>{let n=S0(e,t);if(!n)return!1;let[,r]=IY(t,e,n.$pos.pos+4);return r},w0=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},T0=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!BK(e.state,t)&&w0(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!BK(e.state,t)||!BY(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},E0=(e,t)=>{let n=C0(e,t),r=S0(e,t);return!r||!n?!1:n>r.depth},D0=(e,t)=>{let n=C0(e,t),r=S0(e,t);return!r||!n?!1:n<r.depth},O0=(e,t)=>{if(!BK(e.state,t)||!zY(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:E0(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():D0(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},k0=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||BK(r,t))return!1;let o=LY(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,U.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,U.from(c)),e.setSelection(K.create(e.doc,d+1)),e.scrollIntoView()),!0))},A0=OX.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&O0(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&O0(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&T0(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&T0(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&k0(e,t,n))return!0;return!1}}}}),j0=RegExp(`^(\\s*)(${b0})([.)])\\s+(.*)$`),M0=/^\s/,N0={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/},P0=RegExp(`^(${b0})([.)])\\s+(.+)$`),F0=64,I0=`listItem`,L0=`textStyle`,R0=/^(\d+)\.\s$/,z0=WX.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=l0(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=l0(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=uq(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?o0(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7013
+ `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=c0(e);if(r.length===0)return;let o=a0(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
7014
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(I0,this.editor.getAttributes(L0)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new J({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=i0(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=zJ({find:R0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zJ({find:R0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(L0)}),joinPredicate:e,editor:this.editor})),[t]}}),B0=/^\s*(\[([( |x])?\])\s$/,V0=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,H0=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},U0=WX.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,uq(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>TJ(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[_0(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=V0;let l=e=>{let t=H0(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=dq(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[zJ({find:B0,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),W0=WX.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,uq(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
7015
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=CJ(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=CJ(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),OX.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(p0.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(x0.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(A0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(z0.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(U0.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(W0.configure(this.options.taskList)),e}})})),K0,q0,J0,Y0=n((()=>{GX(),K0=`&nbsp;`,q0=`\xA0`,J0=WX.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,uq(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===K0||n[0].text===K0||n[0].raw===q0||n[0].text===q0)&&r.length===1&&r[0].type===`text`&&(r[0].text===K0||r[0].text===q0)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?K0:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})})),X0,Z0,Q0,$0=n((()=>{GX(),X0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Z0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Q0=SX.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,uq(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[IJ({find:X0,type:this.type})]},addPasteRules(){return[BJ({find:Z0,type:this.type})]}})})),e2,t2=n((()=>{GX(),e2=WX.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``})})),n2,r2=n((()=>{GX(),n2=SX.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,uq(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})}));function i2(e={}){return new J({view(t){return new a2(t,e)}})}var a2,o2=n((()=>{rB(),Mz(),a2=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=qR(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}})),s2=n((()=>{o2()}));function c2(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function l2(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||c2(e.type))return!0;if(e.inlineContent)return!1}}return!0}function u2(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||c2(e.type))return!0;if(e.inlineContent)return!1}}return!0}function d2(){return new J({props:{decorations:h2,createSelectionBetween(e,t,n){return t.pos==n.pos&&g2.valid(n)?new g2(n):null},handleClick:p2,handleKeyDown:v2,handleDOMEvents:{beforeinput:m2}}})}function f2(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=g2.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new g2(c))),!0):!1}}function p2(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!g2.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new g2(r))),!0)}function m2(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof g2))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function h2(e){if(!(e.selection instanceof g2))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,pG.create(e.doc,[uG.widget(e.selection.head,t,{key:`gapcursor`})])}var g2,_2,v2,y2=n((()=>{VG(),rB(),_R(),TG(),g2=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new _2(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!l2(e)||!u2(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}},g2.prototype.visible=!1,g2.findFrom=g2.findGapCursorFrom,G.jsonID(`gapcursor`,g2),_2=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return g2.valid(t)?new g2(t):G.near(t)}},v2=RG({ArrowLeft:f2(`horiz`,-1),ArrowRight:f2(`horiz`,1),ArrowUp:f2(`vert`,-1),ArrowDown:f2(`vert`,1)})})),b2=n((()=>{y2()}));function x2(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),uG.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function S2(e,t){return typeof e==`function`?e(t):e}function C2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&Fq(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(x2({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:S2(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function w2({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Fq(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(x2({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:S2(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...C2({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return pG.create(r,o)}function T2(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function E2(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function D2(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function O2(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function k2(e,t){let n=D2(e,t.from,t.to);return n.push(E2(e,T2(e,t.from))),t.to>t.from?n.push(E2(e,T2(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(E2(e,T2(e,Math.min(t.from+1,e.content.size)))),n}function A2(e,t,n){let r=[];if(e.docChanged){let t=Dq(e);for(let e of t)r.push(...k2(n.doc,e.newRange))}return e.selectionSet&&(r.push(E2(n.doc,T2(n.doc,e.mapping.map(t.selection.anchor)))),r.push(E2(n.doc,T2(n.doc,n.selection.anchor)))),O2(r)}function j2(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function M2({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=j2(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=C2({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function N2({editor:e,options:t,dataAttribute:n}){return{init(r,i){return w2({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??pG.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:M2({decorations:i.map(r.mapping,r.doc),ranges:A2(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function P2(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function F2({editor:e,options:t}){let n=t.dataAttribute?`data-${P2(t.dataAttribute)}`:`data-${U2}`,r=t.showOnlyCurrent&&!t.includeChildren;return new J({key:W2,...r?{}:{state:N2({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>w2({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?pG.empty:W2.getState(n)??pG.empty}})}function I2(e,t){return!e.selection.empty&&!Iq(e.selection)&&t.isEditable}function L2(e,t){return I2(e,t)&&!t.isFocused&&!t.view.dragging}function R2(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function z2(e){e.focus()}function B2({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var V2,H2,U2,W2,G2,K2,q2=n((()=>{GX(),UB(),s2(),EG(),b2(),_K(),OX.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new J({key:new nB(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),V2=OX.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[i2(this.options)]}}),OX.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new J({key:new nB(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return pG.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(uG.node(t,t+e.nodeSize,{class:this.options.className}))}),pG.create(e,a)}}})]}}),H2=OX.create({name:`gapCursor`,addProseMirrorPlugins(){return[d2()]},extendNodeSchema(e){return{allowGapCursor:oq(X(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),U2=`placeholder`,W2=new nB(`tiptap__placeholder`),OX.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:U2,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[F2({editor:this.editor,options:this.options})]}}),OX.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new J({key:new nB(`selection`),props:{decorations(n){return L2(n,e)?pG.create(n.doc,[uG.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return I2(t.state,e)&&R2(),!1},focus(t){return I2(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&z2(t)}),!1}}}})]}}),G2=OX.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new nB(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new J({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!B2({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!B2({node:r,types:n})}}})]}}),K2=OX.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>mK(e,t),redo:()=>({state:e,dispatch:t})=>hK(e,t)}},addProseMirrorPlugins(){return[nK(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}})})),J2,Y2=n((()=>{GX(),NZ(),zZ(),WZ(),YZ(),ZZ(),$Z(),tQ(),rQ(),lQ(),L1(),G0(),Y0(),$0(),t2(),r2(),q2(),J2=OX.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(RZ.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(MZ.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(p0.configure(this.options.bulletList)),this.options.code!==!1&&e.push(UZ.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(JZ.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(XZ.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(V2.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(H2.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(QZ.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(eQ.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(K2.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(nQ.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(cQ.configure(this.options.italic)),this.options.listItem!==!1&&e.push(x0.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(A0.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(I1.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(z0.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(J0.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Q0.configure(this.options.strike)),this.options.text!==!1&&e.push(e2.configure(this.options.text)),this.options.underline!==!1&&e.push(n2.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(G2.configure(this.options?.trailingNode)),e}})}));function X2(e){let{$from:t}=e.selection;for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.name===`astlLayout`)return{pos:t.before(e),node:n}}return null}function Z2(e){let t=e.children.map(o4);return oN.find(e=>{let n=sN[e];return n.length===t.length&&n.every((e,n)=>e===t[n])})??null}function Q2(e,t){let n=t.node.children.flatMap(e=>e.children);return e.replaceWith(t.pos,t.pos+t.node.nodeSize,U.from(n)),l4(e,t.pos),!0}function $2(e,t,n=!1){let r=t.pos+t.node.nodeSize,i=e.doc.resolve(t.pos).parent,a=e.doc.type.schema.nodes.paragraph;return i.childCount===1&&a!==void 0?e.replaceWith(t.pos,r,a.create()):e.delete(t.pos,r),l4(e,t.pos,n?-1:1),!0}function e4(e,t){let n=Fn(e.style??``).declarations.filter(([e])=>e!==`flex-grow`),r=Pn(t===null?n:[...n,[`flex-grow`,String(t)]]),i=Object.fromEntries(Object.entries(e).filter(([e])=>e!==`style`));return r===``?i:{...i,style:r}}function t4(e,t,n){let{node:r,pos:i}=t;if(Z2(r)===n)return!1;let a=sN[n],o=r.children,s=e.doc.type.schema,c=s.nodes[fZ],l=s.nodes.paragraph;if(c===void 0||l===void 0)return!1;let{from:u}=e.selection,d=null;r.forEach((e,t,n)=>{let r=i+1+t+1;u>=r&&u<=r+e.content.size&&(d={column:n,offset:u-r})});let f=a.length-1,p=a.map((e,t)=>{let n=o[t],r=n===void 0?U.from(l.create()):n.content;if(t===f)for(let e of o.slice(t+1))r=r.append(e.content);return c.create({attributes:e4(n?.attrs.attributes??{},e)},r)});e.replaceWith(i,i+r.nodeSize,r.type.create(r.attrs,p));let m=d;if(m!==null){let t=Math.min(m.column,f),n=m.offset;for(let e=t;e<m.column;e++)n+=o[e]?.content.size??0;let r=i+1;for(let e=0;e<t;e++)r+=p[e]?.nodeSize??0;e.setSelection(K.near(e.doc.resolve(r+1+n)))}return!0}function n4(e,t,n){return n===`unwrap`?Q2(e,t):n===`delete`?$2(e,t):t4(e,t,n)}function r4(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof q)return n.node.type.name===`astlLayout`?{pos:n.from,node:n.node}:r.parent.type.name===`astlLayout`?{pos:r.before(r.depth),node:r.parent}:null;if(!r.parent.isTextblock)return null;for(let e of[r.nodeBefore,r.nodeAfter])if(e!==null&&t(e))return null;for(let e=r.depth;e>0;e--){let n=r.node(e);if(n.type.name===`astlLayout`)return{pos:r.before(e),node:n};if(n.type.name===a4||t(n))return null}return null}function i4(e){return OX.create({name:`astlCurrentLayout`,addProseMirrorPlugins:()=>[new J({props:{decorations(t){let n=r4(t,e);if(n===null)return pG.empty;let r=uG.node(n.pos,n.pos+n.node.nodeSize,{class:`astl-layout-current`,"data-astl-current":``});return pG.create(t.doc,[r])}}})]})}var a4,o4,s4,c4,l4,u4=n((()=>{Or(),kI(),GX(),WB(),UB(),EG(),bZ(),a4=`astlFigure`,o4=e=>{let t=Fn(e.attrs.attributes.style??``).declarations.find(([e])=>e===`flex-grow`)?.[1],n=t===void 0?NaN:Number(t);return Number.isNaN(n)||n===1?null:n},s4=e=>{let t=!0;return e.descendants(e=>t?e.type.name===`astlLayoutColumn`||((e.type.name!==`paragraph`||e.content.size>0)&&(t=!1),!1):!1),t},c4=e=>({shape:Z2(e),columns:e.childCount,empty:s4(e)}),l4=(e,t,n=1)=>{let r=e.doc.resolve(Math.min(t,e.doc.content.size));e.setSelection(G.findFrom(r,n,!0)??G.near(r,n))}}));function d4(e,t,n,r){if(t.holder===null){e.setNodeAttribute(t.pos,`style`,n===``?null:n),e.setNodeAttribute(t.pos,`class`,r===``?null:r);return}let i={...t.node.attrs[t.holder]};n===``?delete i.style:i.style=n,r===``?delete i.class:i.class=r,e.setNodeAttribute(t.pos,t.holder,i)}function f4(e,t){let n=Fn(Object.entries(t).flatMap(([e,t])=>t===null?[]:[`${e}: ${t}`]).join(`; `)).declarations,r=new Set(Object.keys(t));return Nn(Fn(e).declarations.filter(([e])=>!r.has(e)),n)}function p4(e,t,n,r){let i=n.attrs.attributes,a={kind:`figure`,tag:oe,pos:t,node:n,holder:`attributes`};if(d4(e,a,Pn(f4(i.style??``,r)),i.class??``),n.type.name!==_4||!Object.hasOwn(r,`width`))return;let o=n.attrs.picture,s=r.width===null?{width:null}:{width:`100%`};d4(e,{...a,kind:`picture`,holder:`picture`},Pn(f4(o.style??``,s)),o.class??``)}function m4(e,t){return Array.isArray(e)?e.map(e=>m4(e,t)):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{if(e!==`class`)return[[e,m4(n,t)]];if(typeof n!=`string`)return[[e,n]];let r=n.split(/\s+/).filter(e=>e!==t&&e!==``).join(` `);return r===``?[[e,null]]:[[e,r]]}))}function h4(e,t,n,r){let i=()=>e.schema.marks[g4],a=t=>{let n=e.state.tr;return tK(n),t(n)?(e.view.dispatch(n),!0):!1},o=(e,t)=>{let r=e.type.name===_4,i=e.type.name===`paragraph`||e.type.name===`heading`;return{kind:`block`,tag:r?se:e.type.name===`paragraph`?`p`:e.type.name===`heading`?`h${e.attrs.level}`:n(e),pos:t,node:e,holder:r?`caption`:i?null:`attributes`}},s=e=>{let{selection:r}=e,{$from:i}=r,a=[],s=(e,t)=>{a.push({kind:`figure`,tag:oe,pos:t,node:e,holder:`attributes`},{kind:`picture`,tag:`img`,pos:t,node:e,holder:`picture`})},c=r instanceof q?r.node:null;if(c!==null&&(c.type.name===v4?a.push({kind:`picture`,tag:`img`,pos:r.from,node:c,holder:`attributes`}):c.type.name===_4?(a.push(o(c,r.from)),s(c,r.from)):t(c)?a.push({kind:`component`,tag:n(c),pos:r.from,node:c,holder:`attributes`}):c.type.name===`astlLayout`&&a.push({kind:`layout`,tag:ge,pos:r.from,node:c,holder:`attributes`})),c===null&&i.parent.isTextblock&&a.push(o(i.parent,i.before(i.depth))),c===null){let e=i.nodeBefore,r=i.nodeAfter;r!==null&&t(r)?a.push({kind:`component`,tag:n(r),pos:i.pos,node:r,holder:`attributes`}):e!==null&&t(e)&&a.push({kind:`component`,tag:n(e),pos:i.pos-e.nodeSize,node:e,holder:`attributes`})}for(let e=i.depth;e>0;e--){let r=i.node(e),o=i.before(e);r.type.name===_4?s(r,o):t(r)?a.push({kind:`component`,tag:n(r),pos:o,node:r,holder:`attributes`}):r.type.name===`astlLayoutColumn`?a.push({kind:`column`,tag:_e,pos:o,node:r,holder:`attributes`}):r.type.name===`astlLayout`&&a.push({kind:`layout`,tag:ge,pos:o,node:r,holder:`attributes`})}return a},c=(e,t)=>{let n=s(e).find(e=>e.kind===t);if(n===void 0)return[];if(t!==`block`)return[n];let{from:r,to:i}=e.selection,a=[];return e.doc.nodesBetween(r,i,(e,t)=>(e.isTextblock&&a.push(o(e,t)),!e.isTextblock)),a.length===0?[n]:a},l=(e,t,n)=>{let r=i(),a=[];return r===void 0||e.nodesBetween(t,n,(e,i,o)=>!e.isInline||o?.type.allowsMarkType(r)!==!0||(a.push({from:Math.max(i,t),to:Math.min(i+e.nodeSize,n),spans:e.marks.filter(e=>e.type===r)}),!1)),a},u=e=>{let t={},n=[],r=[];for(let i of e)for(let[e,a]of Object.entries(i.attrs))e===`style`?n.push(Fn(String(a??``)).declarations):e===`class`?r.push(String(a??``)):a!==null&&(t[e]=String(a));return{attrs:t,style:Pn(Nn(...n)),classes:An(r.join(` `))}},d=(e,t,n)=>t===``&&n===``&&Object.values(e).every(e=>e===null)?null:i()?.create({...e,style:t===``?null:t,class:n===``?null:n})??null,f=(t,n)=>{let{from:r,to:a,empty:o}=t.selection;if(o){let r=t.selection.$from,a=t.storedMarks??e.state.storedMarks??r.marks(),o=a.filter(e=>e.type===i()),{attrs:s,style:c,classes:l}=u(o),f=n(c,l),p=d(s,f.style,f.classes),m=a.filter(e=>e.type!==i());return t.setStoredMarks(p===null?m:p.addToSet(m)),!0}let s=i();if(s===void 0)return!1;let c=t.doc;for(let e of l(t.doc,r,a)){let{attrs:r,style:i,classes:a}=u(e.spans),o=n(i,a),c=d(r,o.style,o.classes);e.spans.length===1&&c!==null&&e.spans[0]?.eq(c)||(t.removeMark(e.from,e.to,s),c!==null&&t.addMark(e.from,e.to,c))}return t.doc!==c},p=e=>{let{selection:t}=e,n=i(),r=t.$from.parent.inlineContent&&n!==void 0,a=!(t instanceof q)&&r&&t.$from.parent.type.allowsMarkType(n),o=(t.empty?[(e.storedMarks??t.$from.marks()).filter(e=>e.type===n)]:l(e.doc,t.from,t.to).map(e=>e.spans)).map(u),s={},c=new Set,d=o.map(({style:e})=>new Map(Fn(e).declarations));for(let e of new Set(d.flatMap(e=>[...e.keys()]))){let t=new Set(d.map(t=>t.get(e)));t.size===1?s[e]=[...t][0]:c.add(e)}let f=new Set(o.map(({classes:e})=>e));return{textEnabled:a,hasSelection:!t.empty&&!(t instanceof q),text:s,mixed:[...c],textClass:f.size===1?x4([...f][0]):null}},m=e=>{let t=b4(e.node,e.holder);return{kind:e.kind,tag:e.tag,style:Fn(t.style??``).style,className:x4(t.class)}},h=e=>e.doc.attrs.rules,g=({name:e,label:t,for:n,style:r})=>({...e===void 0?{}:{name:e},...t===void 0?{}:{label:t},...n===void 0?{}:{for:n},style:Fn(r??``).style}),_=(e,t)=>e.name!==void 0&&e.name===t.name||e.for!==void 0&&e.for===t.for,v=(t,n,r)=>{for(let i of c(e.state,n)){let e=b4(i.node,i.holder),n=Fn(e.style??``).style,a=e.class??``,o=r(n,a);(o.style!==n||o.classes!==a)&&d4(t,i,o.style,o.classes)}return t.docChanged},y=(e,t)=>a(n=>v(n,e,t)),b=(e,t)=>{let n=e.doc.attrs.rules,r=Fn(t.style).style,i=n.findIndex(e=>_(g(e),t)),a=t.for!==void 0&&r===``;if(i<0&&(a||n.length>=100))return!1;let o={...t.name===void 0?{}:{name:t.name},...t.label===void 0?{}:{label:t.label},...t.for===void 0?{}:{for:t.for},...r===``?{}:{style:r}},s=a?n.filter((e,t)=>t!==i):i<0?[...n,o]:n.map((e,t)=>t===i?o:e);return JSON.stringify(s)!==JSON.stringify(n)&&(e.setDocAttribute(`rules`,s),!0)};return{state(){if(e.isDestroyed)return{textEnabled:!1,hasSelection:!1,text:{},mixed:[],textClass:null,targets:[]};let t=e.state;return{...p(t),targets:s(t).map(m)}},setText(e){return a(t=>f(t,(t,n)=>({style:Pn(f4(t,e)),classes:n})))},setTarget(t,n){return t===`figure`?a(t=>{let r=s(e.state).find(e=>e.kind===`figure`);return r!==void 0&&(p4(t,r.pos,r.node,n),t.docChanged)}):y(t,(e,t)=>({style:Pn(f4(e,n)),classes:t}))},replaceTarget(e,t){return y(e,(e,n)=>({style:Fn(t).style,classes:n}))},setClass(t,n,r){if(n!==null&&!kn(n)||r!==void 0&&(r.name!==n||r.for!==void 0))return!1;let i=e=>({style:e,classes:n??``});return a(a=>(t===`text`?f(a,i):v(a,t,i))?r===void 0||h(e.state).some(e=>e.name===n)||b(a,r):!1)},clear(){return a(t=>{let{from:n,to:r,empty:i}=t.selection;if(t.selection instanceof q)return!1;i?t.setStoredMarks([]):(t.doc.nodesBetween(n,r,(e,i)=>{if(!e.isInline)return!0;for(let a of e.marks)y4.has(a.type.name)&&t.removeMark(Math.max(i,n),Math.min(i+e.nodeSize,r),a);return!1}),f(t,()=>({style:``,classes:``})));for(let n of ee(e.state)){let e=b4(n.node,n.holder);(e.style!==void 0||e.class!==void 0)&&d4(t,n,``,``)}return t.docChanged||i})},rules:()=>e.isDestroyed?[]:h(e.state).map(g),setRule(e){return e.name!==void 0&&!kn(e.name)?!1:a(t=>b(t,e))},removeRule(t){return a(n=>{let r=h(e.state),a=r.filter(e=>!_(g(e),t));if(a.length===r.length)return!1;n.setDocAttribute(`rules`,a);let{name:o}=t;if(o===void 0)return!0;let s=S4(m4(n.doc.attrs.attributes,o));return n.setDocAttribute(`attributes`,s),e.state.doc.descendants((e,t)=>{for(let[r,i]of Object.entries(e.attrs)){let e=r===`class`?null:m4(i,o);if(r===`class`&&typeof i==`string`&&i.split(/\s+/).includes(o)){let e=i.split(/\s+/).filter(e=>e!==o&&e!==``);n.setNodeAttribute(t,r,e.length===0?null:e.join(` `))}else r!==`class`&&JSON.stringify(e)!==JSON.stringify(i)&&n.setNodeAttribute(t,r,S4(e))}for(let r of e.marks){let a=String(r.attrs.class??``).split(/\s+/);if(!a.includes(o))continue;let s=a.filter(e=>e!==o&&e!==``).join(` `),c={...r.attrs,class:s===``?null:s},l=t+e.nodeSize;n.removeMark(t,l,r),r.type===i()&&Object.values(c).every(e=>e===null)||n.addMark(t,l,r.type.create(c))}return!0}),!0})},saveRule(t,n){let r=h(e.state),i=s(e.state).find(e=>e.kind===t);if(i===void 0||r.length>=100)return null;let o=b4(i.node,i.holder),c=zN(n,new Set(r.flatMap(e=>e.name??[]))),l=Fn(o.style??``).style;return a(e=>(e.setDocAttribute(`rules`,[...r,{name:c,label:n,...l===``?{}:{style:l}}]),d4(e,i,``,c),!0)),c},insertLayout(t){let n=e.state.doc;if(x(),r(t),e.state.doc===n)return!1;let{$from:i}=e.state.selection,a=null;for(let e=i.depth;a===null&&e>0;e--)i.node(e).type.name===`astlLayout`&&(a=i.before(e));a===null&&(a=i.nodeBefore?.type.name===`astlLayout`?i.pos-i.nodeBefore.nodeSize:null);let o=a===null?null:e.state.doc.nodeAt(a);if(a===null||o===null)return x(),!0;let s=a,c=null;o.descendants((e,t)=>(c===null&&e.isTextblock&&e.content.size===0&&(c=s+1+t+1),c===null));let l=e.state.tr;c!==null&&l.setSelection(K.create(l.doc,c));let u=s+o.nodeSize,d=e.schema.nodes.paragraph;return l.doc.resolve(u).nodeAfter===null&&d!==void 0&&l.insert(u,d.create()),e.view.dispatch(l),x(),!0},layout(){if(e.isDestroyed)return null;let t=X2(e.state);return t===null?null:c4(t.node)},editLayout(t){let n=X2(e.state);if(n===null)return!1;let r=a(e=>n4(e,n,t));return r&&e.view.focus(),r}};function x(){e.view.dispatch(tK(e.state.tr))}function ee(e){let{from:t,to:n,empty:r}=e.selection;return c(e,`block`).filter(e=>{if(r)return!0;let i=e.pos+1,a=e.pos+1+e.node.content.size;return t<=i&&n>=a})}}var g4,_4,v4,y4,b4,x4,S4,C4=n((()=>{w(),Or(),kI(),_K(),UB(),bZ(),u4(),g4=`textSpan`,_4=`astlFigure`,v4=`astlPicture`,y4=new Set([`bold`,`italic`,`underline`,`strike`,`code`,`sub`,`sup`,`mark`]),b4=(e,t)=>t===null?Object.fromEntries([`style`,`class`].flatMap(t=>e.attrs[t]?[[t,e.attrs[t]]]:[])):e.attrs[t],x4=e=>(e??``).split(/\s+/).find(e=>e!==``)??null,S4=e=>Array.isArray(e)?e.map(S4):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).filter(([e,t])=>e!==`class`||t!==null).map(([e,t])=>[e,S4(t)]))}));function w4(e,t){e.dataset.astlTag=t;let n=``,r=[];return t=>{let i=t.style??``;i!==n&&(e.style.cssText=i),n=i;let a=(t.class??``).split(` `).filter(Boolean);e.classList.remove(...r),e.classList.add(...a),r=a}}function T4(e){let t=t=>{let n=e.descriptor(t)?.fields??[];return n.flatMap(e=>{if(e.kind!==`picture-regions`&&e.kind!==`picture-points`)return[];let t=n.find(t=>t.kind===`child-flag`&&t.tag===e.tag);return[{kind:e.kind,tag:e.tag,src:e.src,flag:t?.kind===`child-flag`?t.attribute:null}]})},n=(t,n)=>e.t(H,t,n);return{layers:t,create(r){let i=t(r),a=document.createElement(`div`);a.className=`astl-zones`,a.contentEditable=`false`;let o=a.appendChild(document.createElement(`div`));o.className=`astl-zones-frame`;let s=document.createElement(`img`);s.alt=``,s.draggable=!1,s.referrerPolicy=`no-referrer`;let c=a.appendChild(document.createElement(`span`));c.className=`astl-picture-alt`;let l=null,u={attributes:{},children:[]},d=()=>{let{attributes:t,children:a}=u,d=i[0]?.src??`src`,f=t[d]??``,p=f.trim()!==``&&e.urlPolicy(f,{tag:r,attribute:d}),m=pN(t.width),h=pN(t.height),g=l??(m!==void 0&&h!==void 0?m/h:4/3);o.style.setProperty(`aspect-ratio`,String(g)),p&&s.getAttribute(`src`)!==f&&(l=null,s.src=f);let _=document.createElementNS(k3,`svg`);_.setAttribute(`viewBox`,`0 0 100 100`),_.setAttribute(`preserveAspectRatio`,`none`),_.setAttribute(`aria-hidden`,`true`);let v=[],y=(e,t,n,r)=>{let i=document.createElement(`span`);i.className=`astl-zone-badge${r?` astl-zone-pin`:``} c${(e-1)%8+1}`,i.setAttribute(`aria-hidden`,`true`),i.style.setProperty(`--x`,`${t}%`),i.style.setProperty(`--y`,`${n}%`),i.textContent=String(e),v.push(i)};for(let e of i)a.filter(t=>t.tag===e.tag).forEach((t,n)=>{let r=t.attributes;if(e.kind===`picture-points`){y(n+1,A3(r.x),A3(r.y),!0);return}let i=r.shape===`circle`||r.shape===`polygon`?r.shape:`rect`,a,o;if(i===`circle`){let[e,t,n]=[A3(r.x),A3(r.y),A3(r.r)];a=document.createElementNS(k3,`ellipse`);for(let[r,i]of[[`cx`,e],[`cy`,t],[`rx`,n],[`ry`,n*g]])a.setAttribute(r,String(i));o=[e,t]}else if(i===`polygon`){let e=(r.points??``).trim().split(/\s+/).filter(Boolean).map(e=>e.split(`,`).map(e=>A3(e)));a=document.createElementNS(k3,`polygon`),a.setAttribute(`points`,e.map(e=>e.join(`,`)).join(` `));let t={left:100,top:100,right:0,bottom:0};for(let[n,r]of e)t.left=Math.min(t.left,n),t.top=Math.min(t.top,r),t.right=Math.max(t.right,n),t.bottom=Math.max(t.bottom,r);o=[(t.left+t.right)/2,(t.top+t.bottom)/2]}else{let[e,t,n,i]=[A3(r.x),A3(r.y),A3(r.width),A3(r.height)];a=document.createElementNS(k3,`rect`);for(let[r,o]of[[`x`,e],[`y`,t],[`width`,n],[`height`,i]])a.setAttribute(r,String(o));o=[e+n/2,t+i/2]}let s=e.flag!==null&&!Object.hasOwn(r,e.flag);a.setAttribute(`class`,`astl-zone c${n%8+1}${s?` astl-zone-dashed`:``}`),_.append(a),y(n+1,...o,!1)});o.replaceChildren(...p?[s]:[],_,...v),o.classList.toggle(`astl-zones-blank`,!p);let b=t.alt,x=b===void 0||b.trim()===``?n(`surface.picture.noAlt`):n(`surface.picture.alt`,{alt:b});c.textContent=p||f.trim()===``?x:`${x} ${n(`surface.picture.blocked`)}`};return s.addEventListener(`load`,()=>{s.naturalHeight!==0&&(l=s.naturalWidth/s.naturalHeight,d())}),{dom:a,render(e,t){u={attributes:e,children:t},d()}}}}}function E4(e,t){let n=e?.attributes.find(e=>e.type===`string`)?.name;if(n!==void 0)return t.attributes[n]??``;let r=t.children.filter(e=>typeof e==`string`||!Je.has(e.tag)),i=r.filter(e=>typeof e!=`string`);return i.length>0?i.map(e=>E3(e).trim()).join(` | `):r.map(E3).join(``).trim()}function D4(e,t,n,r){let i=t?.fields??[],a=n.children.filter(e=>typeof e!=`string`);if(r!==null)return{answer:r,more:0};let o=i.find(e=>e.kind===`child-flag`);if(o?.kind===`child-flag`){let e=a.filter(e=>e.tag===o.tag&&Object.hasOwn(e.attributes,o.attribute));return{answer:e[0]===void 0?``:E3(e[0]).trim(),more:Math.max(0,e.length-1)}}let s=new Set(i.flatMap(e=>e.kind===`text-list`?[e.tag]:[]));return{answer:E4(e,n).trim(),more:a.filter(e=>s.has(e.tag)&&E3(e).trim()!==``).length}}function O4(e,t){let n=document.createElementNS(k3,`svg`);return n.setAttribute(`viewBox`,`0 0 20 20`),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),n.setAttribute(`class`,t),n.appendChild(document.createElementNS(k3,`path`)).setAttribute(`d`,N3[e]),n}function k4(e,t,n,r,i,a){let o=$(e),s=r!==`block`,c=a?.descriptor(e)??null,l=(e,t)=>a?.t(`astl.editor`,e,t)??e;return WX.create({name:o,...r===`inline`||r===`block`?{group:r}:{},inline:r===`inline`,atom:!0,selectable:!0,addAttributes:()=>O3,parseHTML:()=>[{tag:e}],renderHTML:({node:t})=>[e,{...t.attrs.attributes},...t.attrs.children.map(T3)],addNodeView:()=>({node:u,decorations:d,getPos:f,editor:p})=>{if(r===`zone`){let e=document.createElement(`div`);return e.hidden=!0,{dom:e,update:e=>e.type.name===o}}if(r===`inline`){let r=document.createElement(`span`);r.className=`astl-chip`;let i=w4(r,e),a=(e,a)=>{i(e.attributes);let{answer:o,more:s}=D4(t,c,e,a);r.replaceChildren(O4(o===``?`warning`:`check`,`astl-chip-icon`));let u=r.appendChild(document.createElement(`span`));if(u.className=`astl-chip-answer`,u.textContent=o===``?l(`surface.chip.empty`):o,s>0){let e=r.appendChild(document.createElement(`span`));e.className=`astl-chip-more`,e.textContent=l(`surface.chip.more`,{n:s})}r.toggleAttribute(`data-empty`,o===``),r.title=l(`label.text`,{label:n,text:u.textContent})};return a(u.attrs,F3(d)),{dom:r,update:(e,t)=>e.type.name===o&&(a(e.attrs,F3(t)),!0)}}if(s){let n=document.createElement(`div`);n.className=`astl-chip`;let r=w4(n,e),i=e=>{r(e.attributes),n.textContent=`[${E4(t,e)||`?`}]`};return i(u.attrs),{dom:n,update:j3(o,i)}}let m=document.createElement(`div`);m.className=`astl-block astl-atom`;let h=i?.layers(e).length?i.create(e):null;h!==null&&m.append(h.dom);let g=m.appendChild(document.createElement(`div`));g.className=`astl-atom-summary`;let _=m.appendChild(document.createElement(`div`));_.className=`astl-help-kept`;let v=B4(g,e),y=a===void 0?null:V4(a,m,p,f),b=e=>{v(e.attributes),y?.(e.attributes.style),h?.render(e.attributes,M3(e.children)),g.textContent=h===null?E4(t,e):``,g.hidden=h!==null,a!==void 0&&_.replaceChildren(...j4(e.children,a))};return b(u.attrs),{dom:m,update:j3(o,b),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!=null,ignoreMutation:()=>!0}}})}function A4(e,t,n){if(e===`astl-hint`){let e=Math.round(Number(t.cost??0)*100);return e>0?`${n(`insert.hint`)}, ${n(`help.cost`,{percent:e})}`:n(`insert.hint`)}return e===`astl-explanation`?n(`insert.explanation`):`${n(`insert.feedback`)}: ${n(`help.when.${t.when??``}`)}`}function j4(e,t){let n=(e,n)=>t.t(H,e,n);return e.flatMap(e=>{if(typeof e==`string`||!Je.has(e.tag))return[];let r=document.createElement(`div`);r.className=`astl-help-box`,r.dataset.help=e.tag;let i=r.appendChild(document.createElement(`div`));return i.className=`astl-help-head`,i.lang=t.locale,i.textContent=A4(e.tag,e.attributes,n),r.appendChild(document.createElement(`div`)).textContent=E3(e).trim(),[r]})}function M4(e,t){let{state:n}=e,r=n.doc.nodeAt(t),i=n.schema.nodes.paragraph;if(r===null||i===void 0)return;let a=tK(n.tr);n.doc.resolve(t).parent.childCount===1?a.replaceWith(t,t+r.nodeSize,i.create()):a.delete(t,t+r.nodeSize),e.view.dispatch(a.scrollIntoView())}function N4(e,t){let n=$(e),r=(e,n)=>t?.t(`astl.editor`,e,n)??e;return WX.create({name:n,group:R3,content:L3,defining:!0,isolating:!0,addAttributes:()=>D3,parseHTML:()=>[{tag:e}],renderHTML:({node:t})=>[e,{...t.attrs.attributes},0],addKeyboardShortcuts(){let e=({editor:e})=>{let{selection:t}=e.state,{$from:r}=t;if(!t.empty||r.depth<2)return!1;let i=r.node(-1),a=i.firstChild;return i.type.name!==n||i.childCount!==1||!a?.isTextblock||a.content.size>0?!1:(M4(e,r.before(-1)),!0)};return{Backspace:e,Delete:e}},addNodeView:()=>({node:i,editor:a,getPos:o})=>{let s=document.createElement(`div`);s.className=`astl-help-box`,s.dataset.help=e;let c=s.appendChild(document.createElement(`div`));c.className=`astl-help-head`,c.contentEditable=`false`,t!==void 0&&(c.lang=t.locale,c.dir=Me(t.locale));let l=c.appendChild(document.createElement(`span`));l.textContent=r(e===`astl-hint`?`insert.hint`:e===`astl-explanation`?`insert.explanation`:`insert.feedback`);let u=e===`astl-explanation`?null:c.appendChild(document.createElement(`select`)),d=e===`astl-hint`?z3:Ye;u?.setAttribute(`aria-label`,r(e===`astl-hint`?`help.costLabel`:`help.whenLabel`)),u?.addEventListener(`change`,()=>{let t=o(),n=typeof t==`number`?a.state.doc.nodeAt(t):null;if(n===null||typeof t!=`number`||u===null)return;let r={...n.attrs.attributes};e===`astl-hint`&&u.value===`0`?delete r.cost:r[e===`astl-hint`?`cost`:`when`]=u.value,a.view.dispatch(a.state.tr.setNodeAttribute(t,`attributes`,r))});let f=c.appendChild(Object.assign(document.createElement(`button`),{type:`button`}));f.className=`astl-help-remove`,f.textContent=r(`inspector.remove`),f.setAttribute(`aria-label`,r(`surface.helpRemove`,{kind:e.replace(/^astl-/,``)})),f.addEventListener(`click`,()=>{let e=o();typeof e==`number`&&(M4(a,e),a.view.focus())}),f.addEventListener(`keydown`,e=>oZ(a.view,e));let p=s.appendChild(document.createElement(`div`));p.className=`astl-help-content`;let m=t=>{let n=t.attributes;if(u===null)return;let i=(e===`astl-hint`?n.cost:n.when)??(e===`astl-hint`?`0`:``),a=d.includes(i)?d:[...d,i];u.replaceChildren(...a.map(t=>{let n=document.createElement(`option`);return n.value=t,n.textContent=e===`astl-hint`?`${Math.round(Number(t)*100)}%`:r(`help.when.${t}`),n})),u.value=i};return m(i.attrs),{dom:s,contentDOM:p,update:e=>e.type.name===n&&(m(e.attrs),!0),stopEvent:e=>c.contains(e.target),ignoreMutation:e=>c.contains(e.target)}}})}function P4(e){return[Ge,Ke,qe].map(t=>N4(t,e))}function F4(e,t,n){let r=$(e.tag),i=new Map(e.children.map(e=>[$(e.tag),e.tag])),a=e=>{let t=[];return e.forEach(e=>{let n=i.get(e.type.name);n!==void 0&&t.push({tag:n,attributes:e.attrs.attributes})}),t},o=n?.descriptor(e.tag)?.fields?.flatMap(e=>e.kind===`child-flag`?[e.tag]:[]),s=e.children.find(e=>e.content===`inline`&&(e.max===null||e.max>1)&&o?.includes(e.tag)===!0),c=e.children.find(e=>e.content===`inline`&&e.max===1);return WX.create({name:r,group:`block`,content:e.content===`flow`?`${e.children.filter(e=>e.place===`lead`).map(e=>`${$(e.tag)}?`).join(` `)} (${[...I3,R3].join(` | `)})+`.trimStart():`(${[...e.children.map(e=>$(e.tag)),R3].join(` | `)})+`,defining:!0,isolating:!0,addAttributes:()=>D3,parseHTML:()=>[{tag:e.tag}],renderHTML:({node:t})=>[e.tag,{...t.attrs.attributes},0],addNodeView:()=>({node:i,getPos:o,editor:l})=>{let u=document.createElement(`div`);u.className=`astl-block`;let d=t?.layers(e.tag).length?t.create(e.tag):null,f=document.createElement(`div`),p=B4(f,e.tag);u.append(f,...d===null?[]:[d.dom]);let m=null,h=null,g=(s!==void 0||c!==void 0)&&n!==void 0?u.appendChild(document.createElement(`div`)):null;if(g!==null&&n!==void 0&&(g.className=`astl-block-add`,g.contentEditable=`false`,Object.assign(g,{lang:n.locale,dir:Me(n.locale)})),g!==null&&c!==void 0&&n!==void 0){let e=$(c.tag);h=Object.assign(document.createElement(`button`),{type:`button`}),h.append(O4(`add`,`astl-icon`),n.t(H,`surface.addPrompt`)),h.addEventListener(`click`,()=>{let t=o(),n=l.schema.nodes[e];if(typeof t!=`number`||n===void 0)return;let r=tK(l.state.tr).insert(t+1,n.create());r.setSelection(K.create(r.doc,t+2)).scrollIntoView(),l.view.dispatch(r),l.view.focus()}),h.addEventListener(`keydown`,e=>oZ(l.view,e))}if(g!==null&&s!==void 0&&n!==void 0){let e=$(s.tag);m=g.appendChild(Object.assign(document.createElement(`button`),{type:`button`})),m.append(O4(`add`,`astl-icon`),n.t(H,`surface.addOption`)),m.addEventListener(`click`,()=>{let t=o(),n=typeof t==`number`?l.state.doc.nodeAt(t):null,r=l.schema.nodes[e];if(typeof t!=`number`||n===null||r===void 0)return;let i=t+n.nodeSize-1;n.forEach((e,n)=>{e.type===r&&(i=t+1+n+e.nodeSize)});let a=tK(l.state.tr).insert(i,r.create());a.setSelection(K.create(a.doc,i+1)).scrollIntoView(),l.view.dispatch(a),l.view.focus()}),m.addEventListener(`keydown`,e=>oZ(l.view,e))}g!==null&&h!==null&&g.append(h);let _=n===void 0?null:V4(n,u,l,o),v=e=>{if(p(e.attrs.attributes),_?.(e.attrs.attributes.style),d?.render(e.attrs.attributes,a(e)),m!==null&&s!==void 0){let t=0;e.forEach(e=>{e.type.name===$(s.tag)&&t++}),m.disabled=s.max!==null&&t>=s.max}if(h!==null&&c!==void 0){let t=!1;e.forEach(e=>{e.type.name===$(c.tag)&&(t=!0)}),h.hidden=t}};v(i);let y=e=>e?.closest?.(`.astl-picture-handle`)!=null,b=e=>(d?.dom.contains(e)??!1)||(g?.contains(e)??!1)||y(e instanceof Element?e:e.parentElement);return{dom:u,contentDOM:f,update:e=>e.type.name===r&&(v(e),!0),stopEvent:e=>(g?.contains(e.target)??!1)||y(e.target),ignoreMutation:e=>b(e.target)||e.target===u&&e.type===`attributes`}}})}function I4(e,t,n){let r=$(e.tag);return WX.create({name:r,content:`inline*`,addAttributes:()=>D3,parseHTML:()=>[{tag:e.tag}],renderHTML:({node:t})=>[e.tag,{...t.attrs.attributes},0],addNodeView:()=>({node:i,getPos:a,editor:o})=>{let s=document.createElement(`div`);s.className=e.max===1?`astl-child astl-single`:`astl-child`;let c=w4(s,e.tag);if(c(i.attrs.attributes),t===void 0||n===void 0)return{dom:s,contentDOM:s,update:j3(r,e=>c(e.attributes))};s.classList.add(`astl-flaggable`);let l=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-flag`});l.contentEditable=`false`,Object.assign(l,{lang:n.locale,dir:Me(n.locale)}),l.append(O4(`check`,`astl-icon`));let u=document.createElement(`div`);u.className=`astl-child-text`,s.append(l,u);let d=i,f=e=>{d=e,c(e.attrs.attributes);let r=Object.hasOwn(e.attrs.attributes,t.attribute);l.setAttribute(`aria-pressed`,String(r)),s.toggleAttribute(`data-flagged`,r);let i=a(),u=typeof i==`number`?o.state.doc.resolve(i).index()+1:1,f=e.textContent.trim()||n.t(`astl.editor`,`inspector.untitled`,{n:u});l.setAttribute(`aria-label`,n.t(H,`label.text`,{label:t.label,text:f}))};return f(i),l.addEventListener(`click`,()=>{let e=a();if(typeof e!=`number`)return;let n=d.attrs.attributes,{[t.attribute]:r,...i}=n,s=Object.hasOwn(n,t.attribute)?i:{...n,[t.attribute]:``};o.view.dispatch(tK(o.state.tr.setNodeAttribute(e,`attributes`,s)))}),l.addEventListener(`keydown`,e=>oZ(o.view,e)),{dom:s,contentDOM:u,update:e=>e.type.name===r&&(f(e),!0),stopEvent:e=>l.contains(e.target),ignoreMutation:e=>l.contains(e.target)}}})}function L4(e){let t=e.attributes.filter(e=>e.type===`boolean`).map(e=>e.name);return SX.create({name:$(e.tag),priority:200,inclusive:!1,addAttributes:()=>D3,parseHTML:()=>[{tag:e.tag}],renderHTML:({mark:t})=>[e.tag,{...t.attrs.attributes},0],addMarkView:()=>({mark:n})=>{let r=document.createElement(`span`);return r.className=`astl-mark`,w4(r,e.tag)(n.attrs.attributes),t.some(e=>Object.hasOwn(n.attrs.attributes,e))&&(r.dataset.flagged=``),{dom:r,contentDOM:r}}})}function R4(e,t,n,r){let i=(e,t,n)=>{throw TypeError(`Component manifests ${e} and ${t} declare the child ${n} differently: one editor node cannot hold both`)},a=Pt(e);a!==null&&i(...a.components,a.tag);let o=new Map;return e.flatMap(e=>{let a=e.content===`flow`,s=a||e.children.some(e=>e.content===`inline`);if(e.display===`inline`)return[k4(e.tag,e,t(e.tag),`inline`,void 0,r)];if(!s)return[k4(e.tag,e,t(e.tag),`block`,n,r)];let c=e=>a&&e.place!==`lead`;for(let t of e.children){let n=c(t)?`mark`:t.content,r=o.get(t.tag);r===void 0?o.set(t.tag,{block:e.tag,content:n}):r.content!==n&&i(r.block,e.tag,t.tag)}let l=e.children.filter(t=>o.get(t.tag)?.block===e.tag),u=new Set(n?.layers(e.tag).map(e=>e.tag)),d=r?.descriptor(e.tag)??null,f=e=>{let t=d?.fields?.find(t=>t.kind===`child-flag`&&t.tag===e);if(t?.kind===`child-flag`&&d!==null&&r!==void 0)return{attribute:t.attribute,label:r.t(d.manifest.messages,t.label)}};return[F4(e,n,r),...l.map(e=>c(e)?L4(e):e.content===`inline`?I4(e,f(e.tag),r):k4(e.tag,null,``,u.has(e.tag)?`zone`:`child`))]})}function z4(e,t,n){let r=document.createElement(`span`);return r.className=`astl-picture-handle`,r.setAttribute(`aria-hidden`,`true`),r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`pointerdown`,i=>{if(i.button!==0)return;i.preventDefault(),i.stopPropagation();let a=e.box(),o=a.parentElement;if(o===null)return;let s=getComputedStyle(o),c=o.clientWidth-Number.parseFloat(s.paddingInlineStart)-Number.parseFloat(s.paddingInlineEnd);if(c<=0)return;let l=a.getBoundingClientRect().width,u=i.clientX,d=getComputedStyle(a).direction===`rtl`,f=t(),p=(f===`end`?-1:1)*(f===`center`?2:1)*(d?-1:1),m=a.style.cssText,h=null;r.setPointerCapture(i.pointerId);let g=e=>{let t=l+p*(e.clientX-u);h=Math.round(Math.min(100,Math.max(W3,t/c*100))),a.style.setProperty(`width`,`${h}%`),n(h)},_=t=>{r.removeEventListener(`pointermove`,g),r.removeEventListener(`pointerup`,_),r.removeEventListener(`pointercancel`,_),a.style.cssText=m,n(null),t.type===`pointerup`&&h!==null&&e.commit(h)};r.addEventListener(`pointermove`,g),r.addEventListener(`pointerup`,_),r.addEventListener(`pointercancel`,_)}),r}function B4(e,t){let n=w4(e,t);return e=>n({...e,style:LN(e.style??``).rest})}function V4(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a=`inline`,o=null,s=()=>{let e=t.previousElementSibling;for(let t=0;e!==null&&t<2;t++,e=e.previousElementSibling){let t=e.querySelector(`:scope > .astl-frame-line`);if(t!==null)return t}return null};return t.append(z4({box:()=>t,commit:e=>W4(n,r(),e),open:null},()=>a,e=>{let t=s();if(t===null)return;let n=sZ(i,a,e??o);t.textContent=n.text,t.setAttribute(`aria-label`,n.label)})),e=>{a=PN(e??``),o=RN(e??``),t.dataset.astlPosition=a}}function H4(e,t,n,r=null){let i=document.createElement(t);i.className=`astl-picture`,i.contentEditable=`false`;let a=document.createElement(`img`);a.alt=``,a.draggable=!1,a.referrerPolicy=`no-referrer`;let o=i.appendChild(document.createElement(`span`));o.className=`astl-picture-alt`;let s=(t,n)=>e.t(H,t,n),c=i.appendChild(document.createElement(`span`));if(c.className=`astl-picture-tools`,n!==null){let e=c.appendChild(document.createElement(`button`));e.type=`button`,e.className=`astl-picture-edit`,e.tabIndex=-1,e.textContent=s(`surface.picture.edit`),e.addEventListener(`click`,e=>{e.preventDefault(),n()})}let l=r===null?null:U4(e,r,c,i),u=w4(i,`img`);return{dom:i,render:t=>{u(t);let n=t.src??``,r=n.trim()!==``&&e.urlPolicy(n,{tag:`img`,attribute:`src`});if(r){a.src=n;for(let e of[`width`,`height`]){let n=pN(t[e]);n===void 0?a.removeAttribute(e):a.setAttribute(e,String(n))}i.prepend(a)}else a.remove();let c=t.alt,l=c===void 0?s(`surface.picture.noAlt`):c===``?s(`surface.picture.decorative`):s(`surface.picture.alt`,{alt:c});o.textContent=r?l:`${l} ${s(`surface.picture.blocked`)}`},showPlace:e=>l?.(e)}}function U4(e,t,n,r){let i=(t,n)=>e.t(H,t,n),a=`inline`,o=null,s=t.open,c=n.appendChild(document.createElement(s===null?`span`:`button`));c.className=`astl-picture-place`,s!==null&&(c.tabIndex=-1,c.type=`button`,c.addEventListener(`click`,e=>{e.preventDefault(),s()}));let l=e=>{let t=sZ(i,a,e??o);c.textContent=t.text,c.setAttribute(`aria-label`,t.label)};return r.append(z4(t,()=>a,l)),e=>{a=PN(e??``),o=RN(e??``),r.dataset.astlPosition=a,l(null)}}function W4(e,t,n){if(typeof t!=`number`)return;let r=e.state.doc.nodeAt(t);if(r===null)return;let i=e.state.tr;tK(i),p4(i,t,r,IN(r.attrs.attributes.style??``,n)),i.docChanged&&e.view.dispatch(i)}async function G4(e,t,n,r){let i=e.state.doc.nodeAt(n);if(i===null)return;let a=i.attrs[r],o=e=>{let t=pN(a[e]);return t===void 0?{}:{[e]:t}},s={src:a.src??``,alt:a.alt??``,...o(`width`),...o(`height`)},c=await t.ask({current:s,caption:!1,decorative:a.alt===``});if(c===null||e.isDestroyed||e.state.doc.nodeAt(n)!==i)return;let l={src:c.src,alt:c.alt};c.width!==void 0&&(l.width=String(c.width)),c.height!==void 0&&(l.height=String(c.height));let u={};for(let[e,t]of Object.entries(a))Object.hasOwn(l,e)?u[e]=l[e]:(le.has(e)||e===`class`)&&(u[e]=t);e.view.dispatch(e.state.tr.setNodeAttribute(n,r,{...u,...l}))}function K4(e,t){return WX.create({name:`astlPicture`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!0,addAttributes:()=>({attributes:{default:{},rendered:!1,parseHTML:H3}}),parseHTML:()=>[{tag:`img`}],renderHTML:({node:e})=>[`img`,{...e.attrs.attributes}],addNodeView:()=>({node:n,getPos:r,editor:i})=>{let a=H4(e,`span`,t===void 0?null:()=>{let e=r();t!==void 0&&typeof e==`number`&&G4(i,t,e,`attributes`)},{box:()=>a.dom,commit:e=>W4(i,r(),e),open:t?.style===void 0?null:()=>t.style?.(`picture`)}),o=e=>{a.render(e),a.showPlace(e.style)};return o(n.attrs.attributes),{dom:a.dom,update:j3(`astlPicture`,e=>o(e.attributes)),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!==null}}})}function q4(e,t){let n=e=>e.querySelector(`:scope > ${se}`);return WX.create({name:`astlFigure`,group:`block`,content:`inline*`,defining:!0,isolating:!0,addAttributes:()=>({attributes:{default:{},rendered:!1,parseHTML:U3},picture:{default:{},rendered:!1,parseHTML:e=>H3(e.querySelector(`:scope > img`))},caption:{default:{},rendered:!1,parseHTML:e=>U3(n(e))},captionFirst:{default:!1,rendered:!1,parseHTML:e=>e.firstElementChild?.localName===se}}),parseHTML:()=>[{tag:oe,contentElement:e=>n(e)??e.ownerDocument.createElement(`figcaption`)}],renderHTML:({node:e})=>{let t=[`img`,{...e.attrs.picture}];if(e.content.size===0)return[oe,{...e.attrs.attributes},t];let n=[se,{...e.attrs.caption},0];return[oe,{...e.attrs.attributes},...e.attrs.captionFirst?[n,t]:[t,n]]},addNodeView:()=>({node:n,getPos:r,editor:i})=>{let a=document.createElement(oe);a.className=`astl-figure`;let o=H4(e,`div`,t===void 0?null:()=>{let e=r();t!==void 0&&typeof e==`number`&&G4(i,t,e,`picture`)},{box:()=>a,commit:e=>W4(i,r(),e),open:t?.style===void 0?null:()=>t.style?.(`figure`)}),s=document.createElement(se);a.append(...n.attrs.captionFirst?[s,o.dom]:[o.dom,s]);let[c,l]=[w4(a,oe),w4(s,se)],u=e=>{o.render(e.picture),o.showPlace(e.attributes.style),c(e.attributes),l(e.caption)};return u(n.attrs),{dom:a,contentDOM:s,update:j3(`astlFigure`,u),stopEvent:e=>e.target.closest?.(`.astl-picture-handle`)!==null,ignoreMutation:e=>o.dom.contains(e.target)||e.target===a&&e.type===`attributes`}}})}function J4(e){let t=(t,n)=>e.t(H,t,n),n={lang:e.locale,dir:Me(e.locale)},r=new WeakMap,i=new J({view(e){let t=()=>{let t=e.state.doc.childCount;e.state.doc.forEach((n,i,a)=>{let o=e.nodeDOM(i);n.type.name===G3&&o instanceof Element&&r.get(o)?.(a+1,t)})};return t(),{update:(e,n)=>{e.state.doc!==n.doc&&t()}}}});return WX.create({name:G3,content:K3,defining:!0,isolating:!0,addAttributes:()=>D3,parseHTML:()=>[{tag:`astl-page`}],renderHTML:({node:e})=>[`astl-page`,{...e.attrs.attributes},0],addProseMirrorPlugins:()=>[i],addNodeView:()=>({node:e,getPos:i,editor:a})=>{let o=document.createElement(`section`);o.className=`astl-page`;let s=document.createElement(`div`);s.className=`astl-page-head`,s.contentEditable=`false`;let c=`astl-page-head-${++J3}`,l=Object.assign(document.createElement(`span`),{className:`astl-page-number`,id:`${c}-number`,...n}),u=(e,t)=>{let r=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-page-${e}`,id:`${c}-${e}`,textContent:t,...n});return r.setAttribute(`aria-labelledby`,`${r.id} ${l.id}`),r},d=u(`add-title`,t(`surface.pageAddTitle`)),f=Object.assign(document.createElement(`button`),{type:`button`,className:`astl-page-join`,hidden:!0,...n}),p=u(`delete`,t(`surface.pageDelete`));p.hidden=!0;let m=Object.assign(document.createElement(`div`),{className:`astl-page-field`,hidden:!0}),h=Object.assign(document.createElement(`input`),{className:`astl-page-label`,placeholder:t(`surface.pageTitle`)}),g=u(`remove-title`,t(`surface.pageRemoveTitle`));m.append(h,g);let _=e.attrs.attributes,v=!1,y=()=>{let e=(_.label??``)!==``;m.hidden=!(e||v),d.hidden=e||v,g.hidden=!e},b=``;r.set(o,(e,n)=>{`${e}/${n}`!==b&&(b=`${e}/${n}`,l.textContent=t(`surface.pageNumber`,{page:e,pages:n}),h.setAttribute(`aria-label`,t(`surface.pageTitleOf`,{page:e})),f.textContent=t(`surface.pageJoin`,{previous:e-1}),f.hidden=e===1,p.hidden=n===1)}),d.addEventListener(`click`,()=>{v=!0,y(),h.focus()}),h.addEventListener(`focus`,()=>{v=!0}),h.addEventListener(`blur`,()=>{v=!1,y()}),g.addEventListener(`click`,()=>{let e=i();if(typeof e!=`number`)return;let{label:t,...n}=_,r=a.state.doc.resolve(e).index(0)+1,o=tK(a.state.tr.setNodeAttribute(e,`attributes`,n)).setMeta(X3,{key:`surface.pageTitleRemoved`,params:{page:r}});a.view.dispatch(o),v=!1,y(),d.focus()}),f.addEventListener(`click`,()=>{let e=i();if(typeof e!=`number`||a.state.doc.resolve(e).index(0)===0)return;let t=a.state.tr;r3(t,e,!0),a.view.dispatch(t),a.view.focus()}),p.addEventListener(`click`,()=>{let e=i(),t=a.state.tr;typeof e==`number`&&n3(t,e)&&(a.view.dispatch(t),a.view.focus())}),s.append(l,d,f,p,m);let x=document.createElement(`div`),ee=w4(x,`astl-page`);return ee(_),o.append(s,x),h.value=_.label??``,y(),h.addEventListener(`input`,()=>{let e=i();if(typeof e!=`number`)return;let{label:t,...n}=_,r=h.value===``?n:{...n,label:h.value};a.view.dispatch(a.state.tr.setNodeAttribute(e,`attributes`,r))}),{dom:o,contentDOM:x,update:j3(G3,e=>{_=e.attributes,ee(_),h.value!==(_.label??``)&&(h.value=_.label??``),y()}),stopEvent:e=>s.contains(e.target),ignoreMutation:e=>s.contains(e.target)}}})}function Y4(e,t){tK(e).setMeta(X3,t).scrollIntoView()}function X4(e,t){let n=null;return e.forEach((e,r,i)=>{let a=e.attrs.attributes?.id;n===null&&t!==void 0&&e.type.name===G3&&a===t&&(n={pos:r,node:e,index:i})}),n}function Z4(e,t){let{doc:n}=e,r=n.type.schema.nodes[G3];if(r===void 0||n.firstChild?.type===r)return;let i=n.resolve(0).blockRange(n.resolve(n.content.size));i!==null&&e.wrap(i,[{type:r,attrs:{attributes:{id:l3(`page`,t)}}}])}function Q4(e){let{doc:t,selection:n}=e,{$from:r}=n,{nodes:i}=t.type.schema,[a,o]=[i[G3],i.paragraph],s=t.firstChild?.type===a,c=+!!s;if(a===void 0||o===void 0||r.depth<c)return null;let l=n instanceof q&&r.depth===c?n.to:r.pos,u=!1;r.depth===c+1&&Z3.has(r.parent.type.name)?r.parentOffset===0?l=r.before():r.parentOffset===r.parent.content.size?l=r.after():u=!0:r.depth>c&&(l=r.after(c+1));let d=m3(t),f=Object.fromEntries(Object.entries(s?r.node(1).attrs.attributes:{}).filter(([e])=>le.has(e)||e===`class`));Z4(e,d);let p=l3(`page`,d),m={type:a,attrs:{attributes:{id:p,...f}}},h=s?l:l+1,g;if(u)e.split(h,2,[m]),g=h+2;else{let t=e.doc.resolve(h);t.index()===0?(e.insert(h,o.create()),h+=2):t.index()===t.parent.childCount&&e.insert(h,o.create()),e.split(h,1,[m]),g=h+1}return e.setSelection(G.near(e.doc.resolve(g+1))),Y4(e,{key:`surface.pageAdded`,params:{page:e.doc.resolve(g).index(0)+1}}),p}function $4(e,t){let{nodes:n}=e.doc.type.schema,[r,i]=[n[G3],n.paragraph];if(r===void 0||i===void 0)throw Error(`the schema has no pages`);let a=m3(e.doc);Z4(e,a);let o=X4(e.doc,t),s=o===null?e.doc.content.size:o.pos+o.node.nodeSize,c=l3(`page`,a);return e.insert(s,r.create({attributes:{id:c}},i.create())),e.setSelection(K.create(e.doc,s+2)),Y4(e,{key:`surface.pageAdded`,params:{page:e.doc.resolve(s).index(0)+1}}),c}function e3(e,t){let n=X4(e.doc,t);return n===null||n.index===0?!1:(r3(e,n.pos,!0),!0)}function t3(e,t){let n=X4(e.doc,t);return n!==null&&n3(e,n.pos)}function n3(e,t){let{doc:n}=e,r=n.resolve(t).index(0),i=n.child(r);if(n.childCount===1)return!1;let a=r===0?t:t-n.child(r-1).nodeSize;return e.delete(t,t+i.nodeSize),e.setSelection(G.near(e.doc.resolve(a+1))),Y4(e,{key:`surface.pageDeleted`,params:{n:r+1}}),!0}function r3(e,t,n){let r=e.doc.resolve(t).index(0)+1;e.join(t),n&&e.setSelection(G.near(e.doc.resolve(t-1))),Y4(e,{key:`surface.pageJoined`,params:{page:r,previous:r-1}})}function i3(e){let{$from:t,empty:n}=e;if(!(e instanceof K)||!n||t.parentOffset!==0||Q3(t)||t.depth<2||t.node(1).type.name!==G3||t.index(0)===0)return null;for(let e=1;e<t.depth;e++)if(t.index(e)!==0)return null;return t.before(1)}function a3(e){let{$to:t,empty:n}=e;if(!(e instanceof K)||!n||t.parentOffset!==t.parent.content.size||Q3(t)||t.depth<2||t.node(1).type.name!==G3||t.index(0)===t.node(0).childCount-1)return null;for(let e=1;e<t.depth;e++)if(t.index(e)!==t.node(e).childCount-1)return null;return t.after(1)}function o3(e,t){let n=t.tr;return t.doc.descendants((t,r)=>{let i=e.get(t.type.name);if(i===void 0)return!0;let a=e=>(e6(i,e)?.attributes??[]).filter(e=>e.type===`id`),o=new Set;t.forEach(e=>{for(let{name:t}of a(e))o.add(e.attrs.attributes[t]??``)});let s=new Set;return t.forEach((e,t)=>{let c=e6(i,e),l=e.attrs.attributes,u=null;for(let{name:t,required:n}of a(e)){let e=l[t]??``;if(e!==``&&!s.has(e)){s.add(e);continue}if(e===``&&!n)continue;u??=e===``?{...l}:Object.fromEntries(Object.entries(l).filter(([e])=>c?.attributes.find(t=>t.name===e)?.visibility!==`private`));let r=c?.tag.replace(/^astl-/,``)??`item`,i=1;for(;o.has(`${r}-${i}`);)i++;u[t]=`${r}-${i}`,o.add(u[t]),s.add(u[t])}u!==null&&n.setNodeAttribute(r+1+t,`attributes`,u)}),!1}),n.docChanged?n:null}function s3(e){let t=new Map(e.filter(e=>e.display===`block`&&e.content!==`flow`&&e.children.some(e=>e.content===`inline`)).map(e=>[$(e.tag),e])),n=e.filter(e=>e.display===`block`).flatMap(e=>e.children.filter(e=>e.content===`inline`)),r=new Set(n.map(e=>$(e.tag))),i=new Set(n.filter(e=>e.max===1).map(e=>$(e.tag)));return OX.create({name:`astlChildren`,priority:1e3,addKeyboardShortcuts(){let e=null;return{"Mod-a":({editor:t})=>{let{selection:n,doc:i}=t.state,{$from:a,$to:o}=n,s=e!==null&&n.eq(e);if(e=null,s||a.depth<2||!a.sameParent(o)||!r.has(a.parent.type.name))return!1;let c=K.create(i,a.start(),a.end());return t.view.dispatch(t.state.tr.setSelection(c)),e=t.state.selection,!0},Backspace:({editor:e})=>{let{selection:t}=e.state,{$from:n}=t;if(!t.empty||n.depth<2||!i.has(n.parent.type.name)||n.parent.content.size>0||n.node(-1).childCount<2)return!1;let r=n.before(),a=e.state.tr.delete(r,n.after());return a.setSelection(G.near(a.doc.resolve(r))),e.view.dispatch(a.scrollIntoView()),!0},Enter:({editor:e})=>{let{state:n}=e,{$from:r}=n.selection;if(r.depth<2||!r.parent.isTextblock)return!1;let i=t.get(r.node(-1).type.name),a=i===void 0?void 0:e6(i,r.parent);if(i===void 0||a===void 0)return!1;let o=a.max===1?i.children.find(e=>e.max!==1&&e.content===`inline`):a,s=o===void 0?void 0:n.schema.nodes[$(o.tag)];if(s===void 0)return!0;let c=n.tr.deleteSelection();return c.split(c.selection.from,1,[{type:s,attrs:{attributes:{}}}]),e.view.dispatch(c.scrollIntoView()),!0}}},addProseMirrorPlugins:()=>[new J({appendTransaction:(e,n,r)=>e.some(e=>e.docChanged)?o3(t,r):null})]})}function c3(e,t,n){let r=[],i=new Map;return e.descendants((e,a)=>{if(e.type.name===`astlFigure`)return!1;if(!e.isText)return!0;let o=t+1+a;for(let t of e.marks){if(!n.has(t.type.name))continue;let a=i.get(t.type.name);if(a!==void 0&&a.to===o&&a.mark.eq(t))a.to=o+e.nodeSize;else{let n={from:o,to:o+e.nodeSize,mark:t};r.push(n),i.set(t.type.name,n)}}return!1}),r}function l3(e,t){let n=1;for(;t.has(`${e}-${n}`);)n++;return t.add(`${e}-${n}`),`${e}-${n}`}function u3(e,t,n){let r=e.tr,i=(e,t,i,a)=>{for(let o of e.marks){let s=o.type.name;n.has(s)&&(!i.has(s)||a?.type.name===`astlFigure`)&&r.removeMark(t,t+e.nodeSize,o.type)}},a=new Set;return e.doc.descendants((e,n,o)=>{let s=t.get(e.type.name);if(s===void 0)return e.isText&&i(e,n,a,o),!0;let c=new Map(s.children.map(e=>[$(e.tag),e])),l=new Set(c.keys());e.descendants((e,t,r)=>(e.isText&&i(e,n+1+t,l,r),!0));let u=c3(e,n,l),d=new Set(u.map(e=>t6(e.mark))),f=new Set;for(let e of u){let t=c.get(e.mark.type.name),n=t6(e.mark);if(t===void 0||!t.attributes.some(e=>e.name===`id`))continue;if(n!==``&&!f.has(n)){f.add(n);continue}let i=e.mark.attrs.attributes,a=Object.entries(i).filter(([e])=>e!==`id`&&(n===``||t.attributes.find(t=>t.name===e)?.visibility!==`private`)),o=l3(t.tag.replace(/^astl-/,``),d);f.add(o);let s=e.mark.type.create({attributes:{id:o,...Object.fromEntries(a)}});r.removeMark(e.from,e.to,e.mark).addMark(e.from,e.to,s)}return!1}),r.docChanged?r:null}function d3(e,t,n,r,i,a){let o=e.schema.nodes[$(n.tag)],s=e.schema.marks[$(r.child)];if(o===void 0||s===void 0)return!1;let{from:c,to:l,$from:u,$to:d}=e.selection,f=!1;for(let e=u.depth;e>0;e--){let t=u.node(e);if(t.type===o){f=l<=u.end(e);break}if(a.has(t.type.name))return!1}let p=new Set([s.name]),m=[];if(e.doc.nodesBetween(c,l,(e,t)=>{if(!e.isTextblock||e.type.name===`astlFigure`)return!e.isTextblock;let n=c3(e,t,p),r=e.textBetween(0,e.content.size,void 0,``);for(let e of r.matchAll(n6)){let r=t+1+e.index,i=r+e[0].length;if(c===l?r>c||i<c:r>=l||i<=c)continue;let a=n.find(e=>e.from<i&&e.to>r);a===void 0?m.push({from:r,to:i,marked:!1}):m.some(e=>e.from===a.from)||m.push({from:a.from,to:a.to,marked:!0})}return!1}),m.length===0)return!1;if(m.every(e=>e.marked)){for(let e of m)t.removeMark(e.from,e.to,s);return!0}let h=null;if(!f){let n=u.blockRange(d,e=>[`doc`,G3,fZ].includes(e.type.name));if(n===null)return!1;for(let e=n.startIndex;e<n.endIndex;e++)if(!I3.includes(n.parent.child(e).type.name))return!1;t.wrap(n,[{type:o,attrs:{attributes:{id:l3(i,m3(e.doc))}}}]),h=n.start}let g=new Set;e.doc.descendants(e=>{for(let t of e.marks)t.type===s&&g.add(t6(t));return!0});let _=r.child.replace(/^astl-/,``);for(let e of m){if(e.marked)continue;let n={id:l3(_,g),...r.attributes};t.addMark(t.mapping.map(e.from),t.mapping.map(e.to),s.create({attributes:n}))}if(h!==null){let e=h+(t.doc.nodeAt(h)?.nodeSize??0);t.doc.resolve(e).nodeAfter?.type===o&&t.join(e),t.doc.resolve(h).nodeBefore?.type===o&&t.join(h)}return!0}function f3(e,t){let n=new Map(t.filter(e=>e.content===`flow`).map(e=>[$(e.tag),e])),r=new Set([...n.values()].flatMap(e=>e.children.filter(e=>e.place!==`lead`).map(e=>$(e.tag)))),i=new Set(t.map(e=>$(e.tag))),a=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof q)||!n.has(t.node.type.name))return!1;let r=e.state.tr.replaceWith(t.from,t.to,t.node.content);return e.view.dispatch(r.scrollIntoView()),!0};return OX.create({name:`astlRichBlocks`,priority:1e3,addKeyboardShortcuts:()=>({Backspace:a,Delete:a}),addCommands:()=>({astlWrap:t=>({state:r,tr:a})=>{let o=e.descriptor(t),s=n.get($(t));return o?.wrap===void 0||s===void 0?!1:d3(r,a,s,o.wrap,o.idPrefix,i)}}),addProseMirrorPlugins:()=>[new J({appendTransaction:(e,t,i)=>r.size>0&&e.some(e=>e.docChanged)?u3(i,n,r):null})]})}function p3(e){let t=[];for(let n of e){t=t.map(([e,t])=>[n.mapping.map(e,1),n.mapping.map(t,-1)]);let e=n.getMeta(`uiEvent`);(e===`paste`||e===`drop`)&&n.steps.forEach((e,r)=>{let i=n.mapping.slice(r+1);e.getMap().forEach((e,n,r,a)=>{t.push([i.map(r,1),i.map(a,-1)])})})}return t}function m3(e){let t=new Set,n=e=>{for(let r of e)typeof r!=`string`&&(r.attributes.id!==void 0&&t.add(r.attributes.id),n(r.children))};return e.descendants(e=>{let r=e.attrs.attributes?.id;return r!==void 0&&t.add(r),Array.isArray(e.attrs.children)&&n(e.attrs.children),!0}),t}function h3(e,t,n){let r=new Map(t.map(e=>[$(e.tag),e.tag])),i=t=>{let n=r.get(t);if(n===void 0)return`page`;let i=e.descriptor(n)?.idPrefix??n.replace(/^astl-/,``);return Ae(`${i}-1`)?i:`item`},a=(e,t)=>{let n=[];e.doc.descendants((e,i)=>{let a=e.type.name===`astlPage`;if(!a&&!r.has(e.type.name))return!0;let o=t.some(([e,t])=>i>=e&&i<t);return n.push({node:e,pos:i,pasted:o}),a});let a=e=>e.attrs.attributes.id??``,o=new Set(n.filter(e=>!e.pasted).map(e=>a(e.node))),s=m3(e.doc),c=e.tr;for(let{node:e,pos:t,pasted:r}of n){let n=a(e);if(!r||n===``)continue;if(!o.has(n)){o.add(n);continue}let l=i(e.type.name),u=1;for(;s.has(`${l}-${u}`);)u++;let d=`${l}-${u}`;s.add(d),o.add(d),c.setNodeAttribute(t,`attributes`,{...e.attrs.attributes,id:d})}return c.docChanged?c:null},o=(t,r,i)=>{let a=[...r??[]].filter(e=>e.type.startsWith(`image/`));return a.length===0||n===void 0?!1:e.uploadAsset===null?(n.refuse(),!0):((async()=>{let e=i;for(let r of a){let i=await n.ask({file:r});if(i===null||t.isDestroyed)return;let a=Math.min(e??t.state.selection.from,t.state.doc.content.size);t.chain().insertContentAt(a,mN(i)).run(),e=t.state.selection.to}})(),!0)};return OX.create({name:`astlPastedIds`,addKeyboardShortcuts(){return{Enter:({editor:e})=>{if(n===void 0)return!1;let{selection:t}=e.state;return t instanceof q&&t.node.type.name===`astlPicture`?(G4(e,n,t.from,`attributes`),!0):t.$from.parent.type.name===`astlFigure`&&(G4(e,n,t.$from.before(),`picture`),!0)}}},addProseMirrorPlugins(){let e=this.editor;return[new J({appendTransaction:(e,t,n)=>{let r=p3(e);return r.length===0?null:a(n,r)},props:{handlePaste:(t,n)=>(n.clipboardData?.getData(`text/plain`)??``).trim()===``&&o(e,n.clipboardData?.files,null),handleDrop:(t,n)=>o(e,n.dataTransfer?.files,t.posAtCoords({left:n.clientX,top:n.clientY})?.pos??null)}})]}})}function g3(e,t){return Array.isArray(e)?e.map(e=>g3(e,t)):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{if(e!==`class`)return[[e,g3(n,t)]];let r=String(n??``).split(/\s+/).filter(e=>t.has(e)).join(` `);return r===``?[]:[[e,r]]}))}function _3(e,t){let n=[];return e.forEach(e=>{let r=e.marks.map(e=>e.type.create(g3(e.attrs,t)));n.push(e.isText?e.mark(r):e.type.create(g3(e.attrs,t),_3(e.content,t),r))}),U.fromArray(n)}function v3(e,t){let n=`[data-astl-rules='${t}']`.repeat(2),r=e=>`[data-astl-tag='${e}']`,i=({name:e,for:t})=>{if(e!==void 0)return kn(e)?`${n} .${CSS.escape(e)}`:null;if(t===void 0||!c6.test(t))return null;if(t===`astl-doc`)return n;if(t===`img`)return`${n} ${r(t)}`;let i=t===`astl-page`?`, ${n}:not(:has(${r(t)}))`:``;return`${n} :is(${t}, ${r(t)})${i}`};return[...e].sort((e,t)=>Number(e.name!==void 0)-Number(t.name!==void 0)).flatMap(e=>{let t=Fn(e.style??``).style,n=i(e);return t===``||n===null?[]:[`${n} { ${t}; }`]}).join(`
7016
+ `)}function y3(e,t){let n=new Map;for(let r of t)for(let t of e.descriptor(r.tag)?.fields??[])t.kind===`attribute`&&t.options!==void 0&&!n.has($(r.tag))&&n.set($(r.tag),{name:t.name,...t.options});let r=e=>{if(n.size===0)return pG.empty;let t=new Map;e.descendants(e=>{let n=e.attrs.attributes?.id;return n!==void 0&&!t.has(n)&&!e.isText&&t.set(n,e),!0});let r=[];return e.descendants((e,i)=>{let a=n.get(e.type.name);if(a===void 0)return!0;let o=e.attrs.attributes,s=t.get(o[a.from]??``),c=o[a.name]??``,l=null;if(s?.descendants(e=>l===null&&(e.type.name===$(a.tag)&&e.attrs.attributes.id===c&&(l=e.textContent.trim()),l===null)),s!==void 0&&l===null)for(let e of s.attrs.children??[])typeof e!=`string`&&e.tag===a.tag&&e.attributes.id===c&&(l=E3(e).trim());return r.push(uG.node(i,i+e.nodeSize,{},{[P3]:l??c})),!1}),pG.create(e,r)};return OX.create({name:`astlReferences`,addProseMirrorPlugins:()=>[new J({state:{init:(e,t)=>r(t.doc),apply:(e,t)=>e.docChanged?r(e.doc):t},props:{decorations(e){return this.getState(e)??pG.empty}}})]})}function b3(e,t=e.engine.manifests,n={}){let r=n.pictures,i=new Map(t.map(e=>[$(e.tag),e])),a=t=>{let n=e.descriptor(t);if(n===null)return t;let r=e.t(n.manifest.messages,n.label);return r===n.label?t:r};return[J2.configure({document:!1,codeBlock:!1,horizontalRule:!1,trailingNode:!1,heading:{levels:[2,3,4]},link:{openOnClick:!1,HTMLAttributes:{target:null,rel:null,class:null}}}),...o6,s6,Y3,J4(e),...q3,i4(e=>i.has(e.type.name)),u6,$3,K4(e,r),q4(e,r),d6,...R4(t,a,T4(e),e),...P4(e),y3(e,t),s3(t),f3(e,t),h3(e,t,r),lZ(e,e=>i.get(e.type.name)??null,$,r?.style===void 0?void 0:()=>r.style?.(`component`))]}var $,x3,S3,C3,w3,T3,E3,D3,O3,k3,A3,j3,M3,N3,P3,F3,I3,L3,R3,z3,B3,V3,H3,U3,W3,G3,K3,q3,J3,Y3,X3,Z3,Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6,l6,u6,d6,f6=n((()=>{w(),Or(),kI(),GX(),_K(),WB(),UB(),EG(),Y2(),bZ(),u4(),C4(),$=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),x3=/^[A-Za-z_:][\w.:-]*$/,S3=`data-pm-slice`,C3=e=>Object.fromEntries([...e.attributes].flatMap(({name:e,value:t})=>{if(!x3.test(e)||e===S3)return[];if(e!==`style`&&e!==`data-astl-style`&&e!==`class`)return[[e,t]];let n=e===`class`?An(t):Fn(t).style;return n===``?[]:[[e===`data-astl-style`?`style`:e,n]]})),w3=e=>{if(e.nodeType===globalThis.Node.TEXT_NODE)return[e.textContent??``];if(e.nodeType!==globalThis.Node.ELEMENT_NODE)return[];let t=e;return[{tag:t.localName,attributes:C3(t),children:[...t.childNodes].flatMap(w3)}]},T3=e=>typeof e==`string`?e:[e.tag,{...e.attributes},...e.children.map(T3)],E3=e=>typeof e==`string`?e:e.children.map(E3).join(``),D3={attributes:{default:{},rendered:!1,parseHTML:C3}},O3={...D3,children:{default:[],rendered:!1,parseHTML:e=>[...e.childNodes].flatMap(w3)}},k3=`http://www.w3.org/2000/svg`,A3=e=>{let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0},j3=(e,t)=>n=>n.type.name===e&&(t(n.attrs),!0),M3=e=>e.flatMap(e=>typeof e==`string`?[]:[{tag:e.tag,attributes:e.attributes}]),N3={check:`M4 10.5l4 4 8-9`,warning:`M10 3l8 14H2zM10 8v4M10 14.5v.5`,add:`M10 4v12M4 10h12`},P3=`astlReference`,F3=e=>{for(let t of e){let e=t.spec[P3];if(typeof e==`string`)return e}return null},I3=[`paragraph`,`heading`,`bulletList`,`orderedList`,`blockquote`,`astlFigure`],L3=`(${I3.join(` | `)})+`,R3=`help`,z3=[`0`,`0.1`,`0.25`,`0.5`,`1`],B3=new Set([...be.img??[],...le,ue]),V3=e=>t=>t===null?{}:Object.fromEntries(Object.entries(C3(t)).filter(([t])=>e.has(t))),H3=V3(B3),U3=V3(new Set([...le,ue])),W3=5,G3=`astlPage`,K3=`(block | ${dZ} | ${R3})+`,q3=[WX.create({name:dZ,content:`${fZ}{2,4}`,isolating:!0,addAttributes:()=>D3,addKeyboardShortcuts(){return{Backspace:({editor:e})=>{let{selection:t}=e.state,n=X2(e.state),{$from:r}=t;if(n===null||!t.empty||r.parentOffset>0||!s4(n.node)||r.pos!==n.pos+3)return!1;let i=tK(e.state.tr);return $2(i,n,!0),e.view.dispatch(i.scrollIntoView()),!0}}},parseHTML:()=>[{tag:ge}],renderHTML:({node:e})=>[ge,{...e.attrs.attributes},0]}),WX.create({name:fZ,content:`block+`,isolating:!0,selectable:!1,addAttributes:()=>D3,parseHTML:()=>[{tag:_e,context:`${dZ}/`,priority:60},{tag:_e,context:`doc/|${G3}/|${fZ}/`,skip:!0,priority:60}],renderHTML:({node:e})=>[_e,{...e.attrs.attributes},0]})],J3=0,Y3=WX.create({name:`doc`,topNode:!0,content:`(${K3} | astlPage+)`,addAttributes:()=>({attributes:{default:{},rendered:!1},rules:{default:[],rendered:!1}})}),X3=`astlPageChange`,Z3=new Set([`paragraph`,`heading`]),Q3=e=>e.depth>1&&e.node(2).type.name===`astlLayout`,$3=OX.create({name:`astlPages`,priority:1e3,addKeyboardShortcuts:()=>({"Mod-Enter":({editor:e})=>{let t=e.state.tr;return Q4(t)!==null&&e.view.dispatch(t),!0},Backspace:({editor:e})=>{let t=i3(e.state.selection);if(t===null)return!1;if(e.commands.undoInputRule())return!0;let n=e.state.tr;return r3(n,t,!1),e.view.dispatch(n),!0},Delete:({editor:e})=>{let t=a3(e.state.selection);if(t===null)return!1;let n=e.state.tr;return r3(n,t,!1),e.view.dispatch(n),!0}})}),e6=(e,t)=>e.children.find(e=>$(e.tag)===t.type.name),t6=e=>e.attrs.attributes.id??``,n6=/[\p{L}\p{N}\p{M}]+(?:['’-][\p{L}\p{N}\p{M}]+)*/gu,r6=e=>[e,{default:null,parseHTML:t=>C3(t)[e]??null,renderHTML:t=>t[e]?{[e]:t[e]}:{}}],i6=Object.fromEntries([...le].map(r6)),a6=Object.fromEntries([...le,ue].map(r6)),o6=[`sub`,`sup`,`mark`,`span`].map(e=>SX.create({name:e===`span`?`textSpan`:e,...e===`span`?{excludes:``}:{},addAttributes:()=>a6,parseHTML:()=>[{tag:e}],renderHTML:({HTMLAttributes:t})=>[e,t,0]})),s6=OX.create({name:`astlContentAttributes`,addGlobalAttributes:()=>[{types:[`paragraph`,`heading`,`blockquote`,`bulletList`,`orderedList`,`listItem`,`bold`,`italic`,`underline`,`strike`,`code`],attributes:a6},{types:[`link`],attributes:i6}]}),c6=/^[a-z][a-z0-9-]*$/,l6=0,u6=OX.create({name:`astlRules`,addProseMirrorPlugins:()=>{let e=String(++l6);return[new J({props:{attributes:t=>{let{style:n,class:r}=t.doc.attrs.attributes;return{"data-astl-rules":e,...n===void 0?{}:{style:n},...r===void 0?{}:{class:r}}},transformPastedHTML:e=>me(e),transformPasted:(e,t)=>{let n=t.state.doc.attrs.rules,r=new Set(n.flatMap(e=>e.name??[]));return new W(_3(e.content,r),e.openStart,e.openEnd)}},view:t=>{let n=new CSSStyleSheet,r=null,i=[],a=()=>{r?.adoptedStyleSheets!==void 0&&(r.adoptedStyleSheets=r.adoptedStyleSheets.filter(e=>e!==n))},o=()=>{let o=t.state.doc.attrs.rules;o!==i&&n.replaceSync(v3(o,e)),i=o;let s=t.dom.getRootNode();o.length!==0&&s!==r&&s.adoptedStyleSheets!==void 0&&(a(),r=s,s.adoptedStyleSheets=[...s.adoptedStyleSheets,n])};return o(),{update:o,destroy:a}}})]}}),d6=OX.create({name:`astlCurrentFigure`,addProseMirrorPlugins:()=>[new J({props:{decorations:({doc:e,selection:t})=>{let{$from:n}=t;for(let t=n.depth;t>0;t--){if(n.node(t).type.name!==`astlFigure`)continue;let r=uG.node(n.before(t),n.after(t),{class:`astl-figure-current`});return pG.create(e,[r])}return pG.empty}}})]})}));function p6(e,t,n,r){switch(t){case`bold`:return e.toggleBold();case`italic`:return e.toggleItalic();case`underline`:return e.toggleUnderline();case`link`:return r===void 0||r===``?e.extendMarkRange(`link`).unsetLink():e.extendMarkRange(`link`).setLink({href:r});case`paragraph`:return e.setParagraph();case`heading`:return n?e.setParagraph():e.setHeading({level:3});case`subheading`:return n?e.setParagraph():e.setHeading({level:4});case`bulleted`:return e.toggleBulletList();case`numbered`:return e.toggleOrderedList()}}function m6(e,t,n,r){if(n.sameMarkup(r)||e.setNodeMarkup(t,void 0,r.attrs,n.marks),n.isLeaf||n.content.eq(r.content))return;if(!(n.childCount===r.childCount&&n.content.content.every((e,t)=>e.type===r.child(t).type&&(!e.isText||e.eq(r.child(t)))))){e.replaceWith(t+1,t+n.nodeSize-1,r.content);return}let i=[];n.forEach((e,t)=>{i.push(t)});for(let a=n.childCount-1;a>=0;a--)m6(e,t+1+(i[a]??0),n.child(a),r.child(a))}function h6(e,t){let n=new Map(t.map(e=>[$(e.tag),e.tag])),r=new Map(t.map(e=>[$(e.tag),e])),i=new Map(t.flatMap(e=>(e.children??[]).map(e=>[$(e.tag),e.tag]))),a=mZ(e=>r.get(e.type.name)??null),o=hR.fromSchema(e.schema),s=oR.fromSchema(e.schema),c=e=>n.has(e.type.name),l=e=>{let t=e.attrs.attributes.id;return typeof t==`string`&&t!==``?{id:t,tag:n.get(e.type.name)??``}:null},u=t=>{let n=null;return e.state.doc.descendants((e,r)=>n===null&&((c(e)||e.type.name===`astlPage`)&&e.attrs.attributes.id===t&&(n={node:e,pos:r}),n===null)),n},d=()=>{let t=e.state.selection;if(t instanceof q&&c(t.node))return l(t.node);let{$from:n}=t;for(let e=n.depth;e>0;e--)if(c(n.node(e)))return l(n.node(e));let r=[n.nodeAfter,n.nodeBefore].find(e=>e!==null&&c(e));return r?l(r):null},f=t=>{let n=u(t);if(n===null)return null;let{doc:r}=e.state;return n.node.isAtom?q.create(r,n.pos):K.near(r.resolve(n.pos+1))},p=()=>{let{doc:t,selection:n}=e.state;if(!(n instanceof K)||n.empty||!n.$from.sameParent(n.$to))return``;for(let e=n.$from.depth;e>0;e--)if(c(n.$from.node(e)))return``;let r=!0;return t.nodesBetween(n.from,n.to,e=>(e.isInline&&!e.isText&&(r=!1),r)),r?t.textBetween(n.from,n.to).trim():``},m=()=>{let t=e.state.selection;if(t instanceof q&&c(t.node))return[];for(let e=t.$from.depth;e>0;e--){let n=t.$from.node(e);if(c(n))return r.get(n.type.name)?.content===`flow`?_6:g6}return _6},h=()=>{let{selection:t}=e.state,n=[],r=t.$from.parent,i=t instanceof q&&c(t.node);for(let t of[`bold`,`italic`,`underline`,`link`])e.isActive(t)&&n.push(t);!i&&r.type.name===`paragraph`&&n.push(`paragraph`),!i&&r.type.name===`heading`&&n.push(r.attrs.level===4?`subheading`:`heading`),e.isActive(`bulletList`)&&n.push(`bulleted`),e.isActive(`orderedList`)&&n.push(`numbered`);let a=e.can(),o={bold:()=>a.toggleBold(),italic:()=>a.toggleItalic(),underline:()=>a.toggleUnderline(),link:()=>(!t.empty||e.isActive(`link`))&&a.setLink({href:`https://example.org`}),paragraph:()=>a.setParagraph()||n.includes(`paragraph`),heading:()=>a.setHeading({level:3})||n.includes(`heading`),subheading:()=>a.setHeading({level:4})||n.includes(`subheading`),bulleted:()=>a.toggleBulletList(),numbered:()=>a.toggleOrderedList()},s=e.getAttributes(`link`).href;return{active:n,enabled:m().filter(e=>o[e]()),href:typeof s==`string`?s:null,undo:a.undo(),redo:a.redo()}},g=t=>{let n=e.state.doc;return t(e.chain().focus().command(({tr:e})=>(tK(e),!0))).run(),e.state.doc!==n},_={getSource:()=>qX(e.state.doc),setSource(t){let n=new DOMParser().parseFromString(me(t),`text/html`).body,r=n.querySelector(`astl-doc`),i=r===null?[]:[...r.children].filter(e=>e.localName===he);for(let e of i)e.remove();let{content:a}=s.parse(r??n),o=e.state.tr;a.eq(e.state.doc.content)||o.replaceWith(0,e.state.doc.content.size,a);let c=i.map(C3);JSON.stringify(c)!==JSON.stringify(e.state.doc.attrs.rules)&&o.setDocAttribute(`rules`,c),e.view.dispatch(o.setDocAttribute(`attributes`,r===null?{}:C3(r)))},insert(t,n={}){let{doc:r,selection:i}=e.state,a=me(t),o=JX.createElement(`div`);o.innerHTML=a;let l=s.parseSlice(o).content.firstChild,u=l?.isInline??!0,d=l?.type.name===dZ,m=i instanceof q&&c(i.node)?i.node:null,h=m!==null&&(u||!m.isInline)?i.to:null;for(let e=i.$from.depth;h===null&&e>0;e--)c(i.$from.node(e))&&(h=i.$from.after(e));for(let e=i.$from.depth;d&&e>0;e--)i.$from.node(e).type.name===`astlLayout`&&(h=i.$from.after(e));let g=n.replaceSelection===!0&&h===null&&p()!==``;if(h===null&&g){let e=r.textBetween(i.from,i.to);h={from:i.from+(e.length-e.trimStart().length),to:i.to-(e.length-e.trimEnd().length)}}else if(h===null&&!u){let{$from:e}=i,t=+(r.firstChild?.type.name===`astlPage`);for(let n=e.depth;n>t;n--)e.node(n).type.name===`astlLayoutColumn`&&(t=n);if(e.depth>t){let n=e.node(t+1);h=n.type.name===`paragraph`&&n.content.size===0?{from:e.before(t+1),to:e.after(t+1)}:e.after(t+1)}else h=i.to}e.chain().insertContentAt(h??i.to,a).run();let _=$j(t)[0]?.id,v=_?f(_):null;v instanceof q&&g&&v.node.isInline?e.view.dispatch(e.state.tr.setSelection(K.create(e.state.doc,v.to))):v!==null&&e.view.dispatch(e.state.tr.setSelection(v))},getElement(e){let t=u(e);return t!==null&&c(t.node)?KX(o.serializeNode(t.node,{document:JX})):null},replaceElement(t,n){let r=u(t);if(r===null||!c(r.node))return;let i=JX.createElement(`div`);i.innerHTML=me(n);let a=null;if(s.parseSlice(i).content.descendants(e=>(a===null&&e.type===r.node.type&&(a=e),a===null)),a===null)return;let o=e.state.selection instanceof q&&e.state.selection.from===r.pos,l=e.state.tr;m6(l,r.pos,r.node,a),l.docChanged&&(o&&l.setSelection(q.create(l.doc,r.pos)),e.view.dispatch(l))},getSelection:d,select(t){let n=f(t);n!==null&&(e.view.dispatch(e.state.tr.setSelection(n).scrollIntoView()),e.view.focus())},onChange(t){let n=()=>t();return e.on(`update`,n),()=>e.off(`update`,n)},wrap(t){let n=e.commands.astlWrap(t);return e.view.focus(),n},splitPage(){let t=e.state.tr,n=Q4(t);return n!==null&&e.view.dispatch(t),n},addPage(t){let n=e.state.tr,r=$4(n,t);return e.view.dispatch(n),r},mergePage(t){let n=e.state.tr,r=e3(n,t);return r&&e.view.dispatch(n),r},removePage(t){let n=e.state.tr,r=t3(n,t);return r&&e.view.dispatch(n),r},format(e,t){if(!m().includes(e))return!1;let n=h().active.includes(e);return g(r=>p6(r,e,n,t))},formatState:h,undo(){let t=e.state.doc;return e.chain().focus().undo().run(),e.state.doc!==t},redo(){let t=e.state.doc;return e.chain().focus().redo().run(),e.state.doc!==t},moveBlock(t,n){let r=e.state.tr;return nZ(r,t,n,a)!==null&&(e.view.dispatch(r),!0)},removeBlock(t){let n=e.state.tr;return rZ(n,t,a)?(e.view.dispatch(n),!0):!1},getCursor:()=>$X(e.state,a),onCursorChange(t){let n=({transaction:e})=>{(e.docChanged||e.selectionSet||e.storedMarksSet)&&t()};return e.on(`transaction`,n),()=>e.off(`transaction`,n)},selectedText:p,focus(){e.view.hasFocus()||e.view.focus()},onSelectionChange(t){let n=d(),r=()=>{let e=d();(e?.id!==n?.id||e?.tag!==n?.tag)&&(n=e,t(e))};return e.on(`selectionUpdate`,r),e.on(`update`,r),()=>{e.off(`selectionUpdate`,r),e.off(`update`,r)}},style:h4(e,c,e=>n.get(e.type.name)??i.get(e.type.name)??e.type.name,e=>_.insert(e))};return _}var g6,_6,v6=n((()=>{w(),kI(),_K(),WB(),UB(),bZ(),f6(),YX(),C4(),g6=[`bold`,`italic`,`underline`,`link`],_6=[...g6,`paragraph`,`heading`,`subheading`,`bulleted`,`numbered`]}));function y6(e){let t=e.getRootNode(),n=T6.styleSheet;n!==void 0&&t.adoptedStyleSheets!==void 0&&(t.adoptedStyleSheets.includes(n)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,n]))}var b6,x6,S6,C6,w6,T6,E6=n((()=>{z(),b6=`astl-surface`,x6=F`
7013
7017
  .astl-surface {
7014
7018
  display: block;
7015
7019
  min-inline-size: 0;
@@ -7169,11 +7173,18 @@ font-weight: var(--astl-editor-page-title-weight, 700);
7169
7173
  }
7170
7174
  .astl-surface .astl-page-label:focus-visible,
7171
7175
  .astl-surface
7172
- :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title):focus-visible {
7176
+ :is(
7177
+ .astl-page-join,
7178
+ .astl-page-delete,
7179
+ .astl-page-add-title,
7180
+ .astl-page-remove-title,
7181
+ .astl-help-remove
7182
+ ):focus-visible {
7173
7183
  outline: var(--astl-focus-width) solid var(--astl-focus);
7174
7184
  outline-offset: var(--astl-focus-offset);
7175
7185
  }
7176
- .astl-surface :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title) {
7186
+ .astl-surface
7187
+ :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title, .astl-help-remove) {
7177
7188
  min-block-size: var(--astl-target-min);
7178
7189
  min-inline-size: var(--astl-target-min);
7179
7190
  padding-inline: var(--astl-space-3);
@@ -7535,6 +7546,11 @@ cursor: pointer;
7535
7546
  outline: var(--astl-focus-width) solid var(--astl-focus);
7536
7547
  outline-offset: var(--astl-focus-offset);
7537
7548
  }
7549
+ /* "Remove" closes the head, a page button's look. */
7550
+ .astl-surface .astl-help-remove {
7551
+ margin-inline-start: auto;
7552
+ font-weight: 400;
7553
+ }
7538
7554
  .astl-surface .astl-help-content > :first-child {
7539
7555
  margin-block-start: var(--astl-space-1);
7540
7556
  }
@@ -7603,9 +7619,18 @@ stroke: var(--astl-on-success);
7603
7619
  .astl-surface .astl-child[data-flagged] {
7604
7620
  background: var(--astl-success-soft);
7605
7621
  }
7622
+ /* "Add option" and "Add prompt" side by side; a hidden one (the block has its prompt) takes no room, nor does a row
7623
+ with nothing to add. */
7606
7624
  .astl-surface .astl-block-add {
7625
+ display: flex;
7626
+ flex-wrap: wrap;
7627
+ gap: var(--astl-space-2);
7607
7628
  padding-block-start: var(--astl-space-1);
7608
7629
  }
7630
+ .astl-surface .astl-block-add button[hidden],
7631
+ .astl-surface .astl-block-add:not(:has(button:not([hidden]))) {
7632
+ display: none;
7633
+ }
7609
7634
  .astl-surface .astl-block-add button {
7610
7635
  padding-inline: var(--astl-space-2) var(--astl-space-3);
7611
7636
  color: var(--astl-accent);
@@ -7796,7 +7821,7 @@ padding-inline-start: var(--astl-space-2);
7796
7821
  border-inline-start: var(--astl-outline-width) solid var(--astl-line);
7797
7822
  font-size: var(--astl-size-small);
7798
7823
  }
7799
- `,x6=F`
7824
+ `,S6=F`
7800
7825
  .astl-surface .astl-zones {
7801
7826
  display: flex;
7802
7827
  flex-direction: column;
@@ -7863,7 +7888,7 @@ stroke: CanvasText;
7863
7888
  border-color: CanvasText;
7864
7889
  }
7865
7890
  }
7866
- `,S6=xS(Array.from({length:8},(e,t)=>`.astl-surface .astl-zones .c${t+1}{--line:var(--astl-palette-${t+1});--soft:var(--astl-palette-${t+1}-soft)}`).join(``)),C6=F`
7891
+ `,C6=xS(Array.from({length:8},(e,t)=>`.astl-surface .astl-zones .c${t+1}{--line:var(--astl-palette-${t+1});--soft:var(--astl-palette-${t+1}-soft)}`).join(``)),w6=F`
7867
7892
  .astl-surface .ProseMirror,
7868
7893
  .astl-surface .astl-page > div {
7869
7894
  display: flow-root;
@@ -7914,8 +7939,8 @@ border-color: var(--astl-accent);
7914
7939
  border-color: Highlight;
7915
7940
  }
7916
7941
  }
7917
- `,w6=F`${b6}${x6}${S6}${C6}`})),E6=r({createSurface:()=>D6});function D6(e,t,n,r,i,a){v6(e);let o=document.createElement(`div`);o.slot=`surface`,o.className=y6,e.append(o);let s=null,c=new ResizeObserver(([e])=>{let t=e?.target;if(!(t instanceof HTMLElement)||s===null||s.isDestroyed)return;let n=getComputedStyle(t),r=Number.parseFloat(n.insetBlockStart),i=n.position===`sticky`&&!Number.isNaN(r)?r+t.offsetHeight:0;s.view.setProps({scrollThreshold:{top:i,right:0,bottom:0,left:0},scrollMargin:{top:i+5,right:5,bottom:5,left:5}})}),l=()=>{c.disconnect(),s?.destroy(),o.remove()};try{s=new HX({element:o,injectCSS:!1,extensions:v3(t,n,i===void 0?{}:{pictures:i}),editorProps:{attributes:e=>({"aria-label":t.t(H,`surface.label`),"aria-multiline":`true`,lang:e.doc.attrs.attributes.lang??``}),handleDOMEvents:{focus:e=>(setTimeout(()=>{let t=document.getSelection()?.anchorNode??null;!e.isDestroyed&&e.hasFocus()&&(t===null||!e.dom.contains(t))&&e.focus()}),!1)}}});let u=m6(s,n);return u.setSource(r),s.on(`transaction`,({transaction:e})=>{let t=e.getMeta(`astlPageChange`)??e.getMeta(`astlBlockChange`);t!==void 0&&a?.(t)}),s.view.updateState(eB.create({doc:s.state.doc,plugins:s.state.plugins})),e.updateComplete.then(()=>{let t=e.renderRoot.querySelector(`[part~="toolbar"]`);t!==null&&s?.isDestroyed===!1&&c.observe(t)}),{adapter:u,authoring:t,destroy:l}}catch(e){throw l(),e}}var O6=n((()=>{kI(),WX(),UB(),_6(),yZ(),d6(),T6()}));w(),kI(),Qp(),Kw(),z();function k6(e){let t=[`color-scheme: inherit;`,...[Tw.scale,Tw.themes.light,Tw.themeScale.light].flatMap(Object.keys).map(e=>`--astl-${e}: inherit;`)];return xS(`${e} {\n${t.join(`
7918
- `)}\n}`)}var A6=[xS(Vw(`:host`)),k6(`astl-toolbar, astl-inspector, astl-issues, astl-preview, astl-picture-dialog`),F`
7942
+ `,T6=F`${x6}${S6}${C6}${w6}`})),D6=r({createSurface:()=>O6});function O6(e,t,n,r,i,a){y6(e);let o=document.createElement(`div`);o.slot=`surface`,o.className=b6,e.append(o);let s=null,c=new ResizeObserver(([e])=>{let t=e?.target;if(!(t instanceof HTMLElement)||s===null||s.isDestroyed)return;let n=getComputedStyle(t),r=Number.parseFloat(n.insetBlockStart),i=n.position===`sticky`&&!Number.isNaN(r)?r+t.offsetHeight:0;s.view.setProps({scrollThreshold:{top:i,right:0,bottom:0,left:0},scrollMargin:{top:i+5,right:5,bottom:5,left:5}})}),l=()=>{c.disconnect(),s?.destroy(),o.remove()};try{s=new UX({element:o,injectCSS:!1,extensions:b3(t,n,i===void 0?{}:{pictures:i}),editorProps:{attributes:e=>({"aria-label":t.t(H,`surface.label`),"aria-multiline":`true`,lang:e.doc.attrs.attributes.lang??``}),handleDOMEvents:{focus:e=>(setTimeout(()=>{let t=document.getSelection()?.anchorNode??null;!e.isDestroyed&&e.hasFocus()&&(t===null||!e.dom.contains(t))&&e.focus()}),!1)}}});let u=h6(s,n);return u.setSource(r),s.on(`transaction`,({transaction:e})=>{let t=e.getMeta(`astlPageChange`)??e.getMeta(`astlBlockChange`);t!==void 0&&a?.(t)}),s.view.updateState(eB.create({doc:s.state.doc,plugins:s.state.plugins})),e.updateComplete.then(()=>{let t=e.renderRoot.querySelector(`[part~="toolbar"]`);t!==null&&s?.isDestroyed===!1&&c.observe(t)}),{adapter:u,authoring:t,destroy:l}}catch(e){throw l(),e}}var k6=n((()=>{kI(),GX(),UB(),v6(),bZ(),f6(),E6()}));w(),kI(),Qp(),Kw(),z();function A6(e){let t=[`color-scheme: inherit;`,...[Tw.scale,Tw.themes.light,Tw.themeScale.light].flatMap(Object.keys).map(e=>`--astl-${e}: inherit;`)];return xS(`${e} {\n${t.join(`
7943
+ `)}\n}`)}var j6=[xS(Vw(`:host`)),A6(`astl-toolbar, astl-inspector, astl-issues, astl-preview, astl-picture-dialog`),F`
7919
7944
  :host {
7920
7945
  display: block;
7921
7946
  container-type: inline-size;
@@ -8031,7 +8056,7 @@ padding: var(--astl-focus-width);
8031
8056
  margin: calc(-1 * var(--astl-focus-width));
8032
8057
  }
8033
8058
  }
8034
- `],j6=e=>`load`in e?e.tag:e.manifest.tag,M6=null;function N6(){return M6??=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),M6}function P6(e,t){return Np({components:t,secret:N6(),slotKinds:[...e.slotKinds.values()],profile:e.profile,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.groundColors===null?{}:{groundColors:e.groundColors}})}var F6={components:new Map,editors:new Map,elements:new Map,styleTemplates:new Map,slotKinds:new Map,catalogs:[],profile:{},urlPolicy:null,groundColors:null,uploadAsset:null,pickPicture:null,fonts:rN,styles:iN,featured:[],views:[],menuMessages:null},I6=null;function L6(){return I6??={...F6,engine:P6(F6,[]),version:0},I6}var R6=new Set;function z6(e,t,n,r){let i=new Map(e);for(let e of t??[]){let t=n(e),a=i.get(t);if(a!==void 0&&a!==e)throw Error(`${r} ${t} is already registered`);i.set(t,e)}return i}function B6(e){let t=I6??{...F6,version:0},n=e=>e.manifest.tag,r={components:z6(t.components,e.components,n,`Component`),editors:z6(t.editors,e.editors,n,`Editor descriptor`),elements:z6(t.elements,e.elements,j6,`Preview element`),styleTemplates:z6(t.styleTemplates,e.styleTemplates,e=>e.name,`Style template`),slotKinds:z6(t.slotKinds,e.slotKinds,e=>e.kind,`Slot kind`),catalogs:[...new Set([...t.catalogs,...e.catalogs??[]])],profile:{...t.profile,...e.profile},urlPolicy:e.urlPolicy??t.urlPolicy,groundColors:e.groundColors??t.groundColors,uploadAsset:e.uploadAsset??t.uploadAsset,pickPicture:e.pickPicture??t.pickPicture,fonts:e.fonts??t.fonts,styles:e.styles??t.styles,featured:e.featured??t.featured,views:e.views??t.views,menuMessages:e.menuMessages??t.menuMessages},i=[`components`,`editors`,`elements`,`styleTemplates`,`slotKinds`],a=e=>JSON.stringify(Object.entries(e).sort());if(I6!==null&&i.every(e=>r[e].size===t[e].size)&&r.catalogs.length===t.catalogs.length&&r.urlPolicy===t.urlPolicy&&JSON.stringify(r.groundColors)===JSON.stringify(t.groundColors)&&r.uploadAsset===t.uploadAsset&&r.pickPicture===t.pickPicture&&r.menuMessages===t.menuMessages&&JSON.stringify(r.fonts)===JSON.stringify(t.fonts)&&JSON.stringify(r.styles)===JSON.stringify(t.styles)&&r.featured.join(` `)===t.featured.join(` `)&&JSON.stringify(r.views)===JSON.stringify(t.views)&&a(r.profile)===a(t.profile))return;let o=P6(r,[...r.components.values()]);bN({engine:o,descriptors:[...r.editors.values()],locale:`en`,fonts:r.fonts,styles:r.styles}),I6={...r,engine:o,version:t.version+1};for(let e of R6)e.requestUpdate()}function V6(e,t,n){let r=e=>[...e.entries()].filter(([e])=>n===null||n.includes(e)).map(([,e])=>e);return bN({engine:n===null?e.engine:P6(e,r(e.components)),descriptors:r(e.editors),elements:r(e.elements),locale:t,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],fonts:e.fonts,styles:e.styles,...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.uploadAsset===null?{}:{uploadAsset:e.uploadAsset},...e.pickPicture===null?{}:{pickPicture:e.pickPicture},...e.menuMessages===null?{}:{menuMessages:e.menuMessages}})}var H6=[`light`,`dark`,`hc`,`auto`],U6=`astl-editor-change`,W6=`astl-editor-ready`,G6=`astl-editor-view`,K6=[`visual`,`source`],q6=300,J6=[`issues`,`inspector`],Y6={fromAttribute:e=>e===null?null:e.split(/\s+/).filter(e=>e!==``)},X6={fromAttribute:e=>{try{return e===null?null:JSON.parse(e)}catch{return null}}},Z6=[`chevron`,`bold`,`italic`,`underline`,`link`,`bulleted`,`numbered`,`undo`,`redo`,`wrap`,`text`,`image`,`files`,`add`,`templates`],Q6=`header: inspector-header, id: inspector-id, actions: inspector-actions, issue: inspector-issue, field: inspector-field, label: inspector-label, style: inspector-style`,$6=null,e8=null,t8=class extends OC{static properties={locale:{},components:{converter:Y6},featured:{converter:Y6},panels:{converter:Y6},view:{},views:{converter:X6},theme:{},previewPolicy:{attribute:!1},adapter:{attribute:!1}};static styles=A6;#e=null;#t=null;#n=null;#r=!1;#i=!1;#a=null;#o=null;#s=0;#c=null;#l=()=>{};#u=new Promise(e=>{this.#l=e});#d={ask:e=>this.renderRoot.querySelector(`astl-picture-dialog`)?.ask(e)??Promise.resolve(null),refuse:()=>{this.#a={key:`picture.pasteRefused`},this.requestUpdate()},style:e=>{this.renderRoot.querySelector(`astl-toolbar`)?.openStyle(e)}};#f=e=>{this.#o=e};#p={start:!1,end:!1};#m=e=>{let t=e.target,n=t.name===`end`?`end`:`start`,r=t.assignedElements().length>0;this.#p[n]!==r&&(this.#p[n]=r,this.requestUpdate())};#h=null;#g=null;#_=[];#v=null;#y;#b=null;#x=null;constructor(){if(super(),this.locale=null,this.components=null,this.featured=null,this.panels=null,this.view=`visual`,this.views=null,this.theme=`auto`,this.previewPolicy=null,this.adapter=null,Object.hasOwn(this,`value`)){let e=this.value;delete this.value,typeof e==`string`&&(this.value=e)}}get value(){return this.adapter?.getSource()??this.#e??`<astl-doc lang="${this.authoring.locale}"></astl-doc>`}set value(e){this.adapter===null?this.#e=e:this.adapter.setSource(e)}get ready(){return this.#u}async preview(){await this.updateComplete,await this.renderRoot.querySelector(`astl-preview`)?.refresh()}get authoring(){let e=L6(),t=this.#A(e),n=this.components,r=typeof n==`string`?n.split(/\s+/).filter(e=>e!==``):n,i=`${e.version}\n${t}\n${r===null?`*`:r.join(` `)}`;return this.#b?.key!==i&&(this.#b={key:i,authoring:V6(e,t,r)}),this.#b.authoring}connectedCallback(){super.connectedCallback(),R6.add(this),this.#t===!0&&this.#O(),this.#k()}disconnectedCallback(){super.disconnectedCallback(),R6.delete(this),clearTimeout(this.#y),this.#c=null,this.#k();let e=this.#n;e!==null&&(this.#e=e.adapter.getSource(),e.destroy(),this.#n=null,this.adapter=null)}#S(){let e=this.views??L6().views;return Array.isArray(e)?e:[]}#C(){return this.adapter?.editsSource===!0?[`visual`]:K6}#w(){return[...this.#C(),...this.#S().map(e=>e.name)].includes(this.view)?this.view:`visual`}#T(){let e=this.#g??this.#h??this.value,t=this.authoring.validate(e).issues.filter(e=>e.severity===`error`);return this.#_=t,t.length>0?(this.#a={key:`view.sourceErrors`,params:{n:t.length}},this.#s++,!1):(this.#g!==null&&e8?.formatHtml(this.#g)!==this.#h&&(this.value=this.#g),this.#g=null,!0)}#E(e){clearTimeout(this.#y),this.#y=setTimeout(()=>{let e=this.adapter;this.#v=e===null?null:this.authoring.outline(e.getSource()),this.requestUpdate()},e)}willUpdate(e){if(e.has(`theme`)&&(this.dataset.theme=this.#j()),e.has(`view`)&&this.adapter?.editsSource!==!0){let t=e.get(`view`);t===`source`&&this.view!==`source`&&!this.#T()?this.view=`source`:this.view===`source`&&t!==`source`&&(this.#h=this.#g=null,this.#_=[],e8===null&&Promise.resolve().then(()=>(HI(),jI)).then(e=>{e8=e,this.requestUpdate()},e=>console.error(e)))}let t=this.#n;if(t!==null&&this.adapter!==t.adapter&&(this.adapter===null&&(this.#e=t.adapter.getSource()),t.destroy(),this.#n=null),this.adapter!==null&&this.#n===null)this.#t=!1,this.#e!==null&&this.adapter.setSource(this.#e),this.#e=null;else if(this.adapter===null&&this.#n===null)this.isConnected&&(this.#t===null||e.has(`adapter`))&&this.#D();else if(this.#n!==null&&$6!==null&&this.#n.authoring!==this.authoring){let e=this.#n.adapter.getSource();this.#n.destroy(),this.#n=$6.createSurface(this,this.authoring,L6().engine.manifests,e,this.#d,this.#f),this.adapter=this.#n.adapter}this.#k()}updated(e){e.has(`theme`)&&this.renderRoot.querySelector(`astl-preview`)?.requestUpdate();let t=this.adapter;t!==null&&t!==this.#c&&this.isConnected&&(this.#c=t,this.#E(0),this.#l(),this.dispatchEvent(new Event(W6,{bubbles:!0,composed:!0})));let n=e.get(`view`);e.has(`view`)&&n!==void 0&&n!==this.view&&this.dispatchEvent(new CustomEvent(G6,{detail:{view:this.view},bubbles:!0,composed:!0}))}#D(){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>this.requestUpdate(`adapter`),{once:!0}):(this.#t=this.querySelector(`:scope > [slot="surface"]`)===null,this.#t&&this.#O())}async#O(){if(!(this.#r||this.#n!==null)){this.#r=!0,this.#i=!1;try{if($6??=await Promise.resolve().then(()=>(O6(),E6)),!this.isConnected||!this.#t||this.adapter!==null||this.#n!==null)return;this.#n=$6.createSurface(this,this.authoring,L6().engine.manifests,this.value,this.#d,this.#f),this.#e=null,this.adapter=this.#n.adapter}catch(e){this.#i=!0,console.error(e)}finally{this.#r=!1,this.requestUpdate()}}}#k(){let e=this.isConnected?this.adapter:null;(this.#x?.adapter??null)!==e&&(this.#x?.off(),this.#x=e===null?null:{adapter:e,off:e.onChange(()=>{let e=this.#o;this.#o=null,(this.#a!==null||e!==null)&&(this.#a=e,e!==null&&this.#s++,this.requestUpdate()),this.#E(q6),this.dispatchEvent(new Event(U6,{bubbles:!0,composed:!0}))})})}#A(e){let t=this.locale?[this.locale]:this.lang?[this.lang]:[...navigator.languages??[],navigator.language].filter(e=>!!e),n=[...$M,...e.catalogs].filter(e=>e.namespace===H).map(e=>e.locale);return gt(t,[...new Set(n)],`en`)}#j(){let e=this.theme;return e!==null&&H6.includes(e)?e:`auto`}render(){let{authoring:e,adapter:t}=this,n=this.#j(),r=this.#i?{key:`surface.failed`}:this.#t&&t===null?{key:`surface.loading`}:this.#a,i=e.locale,a=e=>typeof e==`string`?e.split(/\s+/).filter(e=>e!==``):e,o=a(this.featured)??L6().featured,s=(a(this.panels)??J6).filter(e=>J6.includes(e)),c=new Set([...Z6,...e.descriptors.flatMap(e=>[e.icon,...(e.templates??[]).map(t=>t.icon??e.icon)])]),l=[`toolbar: toolbar-bar`,`button: toolbar-button`,`icon-button: toolbar-icon-button`,`views: toolbar-views`,`view: toolbar-view`,`separator: toolbar-separator`,`icon: toolbar-icon`,`insert`,`menu: insert-menu`,`style-menu`,`style-colors`,`style-panel`].concat([...c].map(e=>`icon-${e}`)).join(`, `),u=r=>r===`issues`?I`<astl-issues part="issues" data-theme=${n} .authoring=${e} .adapter=${t}></astl-issues>`:I`<astl-inspector part="inspector" exportparts=${Q6} data-theme=${n} .authoring=${e} .adapter=${t}></astl-inspector>`,d=(t,n)=>e.t(H,t,n),f=this.#w(),p=[...this.#C().map(e=>{let n=t?.editsSource===!0?`source`:e;return{name:e,label:d(`view.${n}`),description:d(`view.${n}Hint`)}}),...this.#S()],m=f!==`visual`;return I`<div class=${s.length===0||m?`layout solo`:`layout`}>
8059
+ `],M6=e=>`load`in e?e.tag:e.manifest.tag,N6=null;function P6(){return N6??=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),N6}function F6(e,t){return Np({components:t,secret:P6(),slotKinds:[...e.slotKinds.values()],profile:e.profile,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.groundColors===null?{}:{groundColors:e.groundColors}})}var I6={components:new Map,editors:new Map,elements:new Map,styleTemplates:new Map,slotKinds:new Map,catalogs:[],profile:{},urlPolicy:null,groundColors:null,uploadAsset:null,pickPicture:null,fonts:rN,styles:iN,featured:[],views:[],menuMessages:null},L6=null;function R6(){return L6??={...I6,engine:F6(I6,[]),version:0},L6}var z6=new Set;function B6(e,t,n,r){let i=new Map(e);for(let e of t??[]){let t=n(e),a=i.get(t);if(a!==void 0&&a!==e)throw Error(`${r} ${t} is already registered`);i.set(t,e)}return i}function V6(e){let t=L6??{...I6,version:0},n=e=>e.manifest.tag,r={components:B6(t.components,e.components,n,`Component`),editors:B6(t.editors,e.editors,n,`Editor descriptor`),elements:B6(t.elements,e.elements,M6,`Preview element`),styleTemplates:B6(t.styleTemplates,e.styleTemplates,e=>e.name,`Style template`),slotKinds:B6(t.slotKinds,e.slotKinds,e=>e.kind,`Slot kind`),catalogs:[...new Set([...t.catalogs,...e.catalogs??[]])],profile:{...t.profile,...e.profile},urlPolicy:e.urlPolicy??t.urlPolicy,groundColors:e.groundColors??t.groundColors,uploadAsset:e.uploadAsset??t.uploadAsset,pickPicture:e.pickPicture??t.pickPicture,fonts:e.fonts??t.fonts,styles:e.styles??t.styles,featured:e.featured??t.featured,views:e.views??t.views,menuMessages:e.menuMessages??t.menuMessages},i=[`components`,`editors`,`elements`,`styleTemplates`,`slotKinds`],a=e=>JSON.stringify(Object.entries(e).sort());if(L6!==null&&i.every(e=>r[e].size===t[e].size)&&r.catalogs.length===t.catalogs.length&&r.urlPolicy===t.urlPolicy&&JSON.stringify(r.groundColors)===JSON.stringify(t.groundColors)&&r.uploadAsset===t.uploadAsset&&r.pickPicture===t.pickPicture&&r.menuMessages===t.menuMessages&&JSON.stringify(r.fonts)===JSON.stringify(t.fonts)&&JSON.stringify(r.styles)===JSON.stringify(t.styles)&&r.featured.join(` `)===t.featured.join(` `)&&JSON.stringify(r.views)===JSON.stringify(t.views)&&a(r.profile)===a(t.profile))return;let o=F6(r,[...r.components.values()]);bN({engine:o,descriptors:[...r.editors.values()],locale:`en`,fonts:r.fonts,styles:r.styles}),L6={...r,engine:o,version:t.version+1};for(let e of z6)e.requestUpdate()}function H6(e,t,n){let r=e=>[...e.entries()].filter(([e])=>n===null||n.includes(e)).map(([,e])=>e);return bN({engine:n===null?e.engine:F6(e,r(e.components)),descriptors:r(e.editors),elements:r(e.elements),locale:t,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],fonts:e.fonts,styles:e.styles,...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.uploadAsset===null?{}:{uploadAsset:e.uploadAsset},...e.pickPicture===null?{}:{pickPicture:e.pickPicture},...e.menuMessages===null?{}:{menuMessages:e.menuMessages}})}var U6=[`light`,`dark`,`hc`,`auto`],W6=`astl-editor-change`,G6=`astl-editor-ready`,K6=`astl-editor-view`,q6=[`visual`,`source`],J6=300,Y6=[`issues`,`inspector`],X6={fromAttribute:e=>e===null?null:e.split(/\s+/).filter(e=>e!==``)},Z6={fromAttribute:e=>{try{return e===null?null:JSON.parse(e)}catch{return null}}},Q6=[`chevron`,`bold`,`italic`,`underline`,`link`,`bulleted`,`numbered`,`undo`,`redo`,`wrap`,`text`,`image`,`files`,`add`,`templates`],$6=`header: inspector-header, id: inspector-id, actions: inspector-actions, issue: inspector-issue, field: inspector-field, label: inspector-label, style: inspector-style`,e8=null,t8=null,n8=class extends OC{static properties={locale:{},components:{converter:X6},featured:{converter:X6},panels:{converter:X6},view:{},views:{converter:Z6},theme:{},previewPolicy:{attribute:!1},adapter:{attribute:!1}};static styles=j6;#e=null;#t=null;#n=null;#r=!1;#i=!1;#a=null;#o=null;#s=0;#c=null;#l=()=>{};#u=new Promise(e=>{this.#l=e});#d={ask:e=>this.renderRoot.querySelector(`astl-picture-dialog`)?.ask(e)??Promise.resolve(null),refuse:()=>{this.#a={key:`picture.pasteRefused`},this.requestUpdate()},style:e=>{this.renderRoot.querySelector(`astl-toolbar`)?.openStyle(e)}};#f=e=>{this.#o=e};#p={start:!1,end:!1};#m=e=>{let t=e.target,n=t.name===`end`?`end`:`start`,r=t.assignedElements().length>0;this.#p[n]!==r&&(this.#p[n]=r,this.requestUpdate())};#h=null;#g=null;#_=[];#v=null;#y;#b=null;#x=null;constructor(){if(super(),this.locale=null,this.components=null,this.featured=null,this.panels=null,this.view=`visual`,this.views=null,this.theme=`auto`,this.previewPolicy=null,this.adapter=null,Object.hasOwn(this,`value`)){let e=this.value;delete this.value,typeof e==`string`&&(this.value=e)}}get value(){return this.adapter?.getSource()??this.#e??`<astl-doc lang="${this.authoring.locale}"></astl-doc>`}set value(e){this.adapter===null?this.#e=e:this.adapter.setSource(e)}get ready(){return this.#u}async preview(){await this.updateComplete,await this.renderRoot.querySelector(`astl-preview`)?.refresh()}get authoring(){let e=R6(),t=this.#A(e),n=this.components,r=typeof n==`string`?n.split(/\s+/).filter(e=>e!==``):n,i=`${e.version}\n${t}\n${r===null?`*`:r.join(` `)}`;return this.#b?.key!==i&&(this.#b={key:i,authoring:H6(e,t,r)}),this.#b.authoring}connectedCallback(){super.connectedCallback(),z6.add(this),this.#t===!0&&this.#O(),this.#k()}disconnectedCallback(){super.disconnectedCallback(),z6.delete(this),clearTimeout(this.#y),this.#c=null,this.#k();let e=this.#n;e!==null&&(this.#e=e.adapter.getSource(),e.destroy(),this.#n=null,this.adapter=null)}#S(){let e=this.views??R6().views;return Array.isArray(e)?e:[]}#C(){return this.adapter?.editsSource===!0?[`visual`]:q6}#w(){return[...this.#C(),...this.#S().map(e=>e.name)].includes(this.view)?this.view:`visual`}#T(){let e=this.#g??this.#h??this.value,t=this.authoring.validate(e).issues.filter(e=>e.severity===`error`);return this.#_=t,t.length>0?(this.#a={key:`view.sourceErrors`,params:{n:t.length}},this.#s++,!1):(this.#g!==null&&t8?.formatHtml(this.#g)!==this.#h&&(this.value=this.#g),this.#g=null,!0)}#E(e){clearTimeout(this.#y),this.#y=setTimeout(()=>{let e=this.adapter;this.#v=e===null?null:this.authoring.outline(e.getSource()),this.requestUpdate()},e)}willUpdate(e){if(e.has(`theme`)&&(this.dataset.theme=this.#j()),e.has(`view`)&&this.adapter?.editsSource!==!0){let t=e.get(`view`);t===`source`&&this.view!==`source`&&!this.#T()?this.view=`source`:this.view===`source`&&t!==`source`&&(this.#h=this.#g=null,this.#_=[],t8===null&&Promise.resolve().then(()=>(HI(),jI)).then(e=>{t8=e,this.requestUpdate()},e=>console.error(e)))}let t=this.#n;if(t!==null&&this.adapter!==t.adapter&&(this.adapter===null&&(this.#e=t.adapter.getSource()),t.destroy(),this.#n=null),this.adapter!==null&&this.#n===null)this.#t=!1,this.#e!==null&&this.adapter.setSource(this.#e),this.#e=null;else if(this.adapter===null&&this.#n===null)this.isConnected&&(this.#t===null||e.has(`adapter`))&&this.#D();else if(this.#n!==null&&e8!==null&&this.#n.authoring!==this.authoring){let e=this.#n.adapter.getSource();this.#n.destroy(),this.#n=e8.createSurface(this,this.authoring,R6().engine.manifests,e,this.#d,this.#f),this.adapter=this.#n.adapter}this.#k()}updated(e){e.has(`theme`)&&this.renderRoot.querySelector(`astl-preview`)?.requestUpdate();let t=this.adapter;t!==null&&t!==this.#c&&this.isConnected&&(this.#c=t,this.#E(0),this.#l(),this.dispatchEvent(new Event(G6,{bubbles:!0,composed:!0})));let n=e.get(`view`);e.has(`view`)&&n!==void 0&&n!==this.view&&this.dispatchEvent(new CustomEvent(K6,{detail:{view:this.view},bubbles:!0,composed:!0}))}#D(){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>this.requestUpdate(`adapter`),{once:!0}):(this.#t=this.querySelector(`:scope > [slot="surface"]`)===null,this.#t&&this.#O())}async#O(){if(!(this.#r||this.#n!==null)){this.#r=!0,this.#i=!1;try{if(e8??=await Promise.resolve().then(()=>(k6(),D6)),!this.isConnected||!this.#t||this.adapter!==null||this.#n!==null)return;this.#n=e8.createSurface(this,this.authoring,R6().engine.manifests,this.value,this.#d,this.#f),this.#e=null,this.adapter=this.#n.adapter}catch(e){this.#i=!0,console.error(e)}finally{this.#r=!1,this.requestUpdate()}}}#k(){let e=this.isConnected?this.adapter:null;(this.#x?.adapter??null)!==e&&(this.#x?.off(),this.#x=e===null?null:{adapter:e,off:e.onChange(()=>{let e=this.#o;this.#o=null,(this.#a!==null||e!==null)&&(this.#a=e,e!==null&&this.#s++,this.requestUpdate()),this.#E(J6),this.dispatchEvent(new Event(W6,{bubbles:!0,composed:!0}))})})}#A(e){let t=this.locale?[this.locale]:this.lang?[this.lang]:[...navigator.languages??[],navigator.language].filter(e=>!!e),n=[...$M,...e.catalogs].filter(e=>e.namespace===H).map(e=>e.locale);return gt(t,[...new Set(n)],`en`)}#j(){let e=this.theme;return e!==null&&U6.includes(e)?e:`auto`}render(){let{authoring:e,adapter:t}=this,n=this.#j(),r=this.#i?{key:`surface.failed`}:this.#t&&t===null?{key:`surface.loading`}:this.#a,i=e.locale,a=e=>typeof e==`string`?e.split(/\s+/).filter(e=>e!==``):e,o=a(this.featured)??R6().featured,s=(a(this.panels)??Y6).filter(e=>Y6.includes(e)),c=new Set([...Q6,...e.descriptors.flatMap(e=>[e.icon,...(e.templates??[]).map(t=>t.icon??e.icon)])]),l=[`toolbar: toolbar-bar`,`button: toolbar-button`,`icon-button: toolbar-icon-button`,`views: toolbar-views`,`view: toolbar-view`,`separator: toolbar-separator`,`icon: toolbar-icon`,`insert`,`menu: insert-menu`,`style-menu`,`style-colors`,`style-panel`].concat([...c].map(e=>`icon-${e}`)).join(`, `),u=r=>r===`issues`?I`<astl-issues part="issues" data-theme=${n} .authoring=${e} .adapter=${t}></astl-issues>`:I`<astl-inspector part="inspector" exportparts=${$6} data-theme=${n} .authoring=${e} .adapter=${t}></astl-inspector>`,d=(t,n)=>e.t(H,t,n),f=this.#w(),p=[...this.#C().map(e=>{let n=t?.editsSource===!0?`source`:e;return{name:e,label:d(`view.${n}`),description:d(`view.${n}Hint`)}}),...this.#S()],m=f!==`visual`;return I`<div class=${s.length===0||m?`layout solo`:`layout`}>
8035
8060
  <astl-toolbar part="toolbar" exportparts=${l} data-theme=${n} .authoring=${e}
8036
8061
  .adapter=${t} .featured=${o} .views=${p} .view=${f}
8037
8062
  @astl-toolbar-view=${e=>{this.view=e.detail.view}}></astl-toolbar>
@@ -8057,5 +8082,5 @@ margin: calc(-1 * var(--astl-focus-width));
8057
8082
  </div>`}#M(){let e=this.#v;if(e===null)return R;let{authoring:t}=this,n=(e,n)=>t.t(H,e,n),r=e.pages.reduce((e,t)=>e+t.components.length,0),i=e.errors===0,a=t.locale;return I`<p class="status-line" part="status-line" lang=${a} dir=${Me(a)}>
8058
8083
  <span class="counts"><span>${n(`status.elements`,{n:r})}</span>${e.points===null?R:I`<span>${n(`surface.points`,{points:e.points})}</span>`}</span>
8059
8084
  <span class=${i?`ready`:`counts error`}>${i?n(`status.ready`):I`<span>${n(`status.errors`,{n:e.errors})}</span><span>${n(`status.warnings`,{n:e.warnings})}</span>`}</span>
8060
- </p>`}#N(){let e=e8;return e===null?R:(this.#h??=e.formatHtml(this.value),e.renderSource(this.renderRoot,this.authoring,this.#g??this.#h,this.#_,e=>{this.#g=e}))}};kI();var n8=`astl-editor`;function r8(e){let t=e.registry??customElements,n=t.get(n8);if(n!==void 0&&n!==t8)throw Error(`<${n8}> is already defined by another class`);lI(t),B6(e),n===void 0&&t.define(n8,t8)}var i8,a8=n((()=>{i8={"editor.description":`A sound to listen to, with an optional transcript.`}})),o8,s8=n((()=>{o8={"editor.description":`Dźwięk do odsłuchania, z opcjonalną transkrypcją.`}})),c8,l8,u8=n((()=>{a8(),s8(),c8=`astl.audio`,l8=[{namespace:c8,locale:`en`,messages:i8},{namespace:c8,locale:`pl`,messages:o8}]})),d8,f8=n((()=>{d8={"editor.description":`A tip, information or a warning in a box.`}})),p8,m8=n((()=>{p8={"editor.description":`Wskazówka, informacja albo ostrzeżenie w ramce.`}})),h8,g8,_8=n((()=>{f8(),m8(),h8=`astl.callout`,g8=[{namespace:h8,locale:`en`,messages:d8},{namespace:h8,locale:`pl`,messages:p8}]})),v8,y8=n((()=>{v8={"editor.description":`The student sorts cards into groups.`,"template.sort.description":`Two groups and four cards to sort`}})),b8,x8=n((()=>{b8={"editor.description":`Uczeń przyporządkowuje karty do grup.`,"template.sort.description":`Dwie grupy i cztery karty do posortowania`}})),S8,C8,w8=n((()=>{y8(),x8(),S8=`astl.categorise`,C8=[{namespace:S8,locale:`en`,messages:v8},{namespace:S8,locale:`pl`,messages:b8}]})),T8,E8=n((()=>{T8={"editor.description":`The student picks one answer or several.`,"template.choice.description":`A question with three answers, one of them right`}})),D8,O8=n((()=>{D8={"editor.description":`Uczeń wybiera jedną odpowiedź albo kilka.`,"template.choice.description":`Pytanie z trzema odpowiedziami, z których jedna jest poprawna`}})),k8,A8,j8=n((()=>{E8(),O8(),k8=`astl.choice`,A8=[{namespace:k8,locale:`en`,messages:T8},{namespace:k8,locale:`pl`,messages:D8}]})),M8,N8=n((()=>{M8={"editor.description":`Words that cross in a grid of squares, with numbered clues.`,"template.crossword.description":`A 5 by 5 grid, two words crossing at their first letter`}})),P8,F8=n((()=>{P8={"editor.description":`Hasła krzyżujące się w siatce kratek, z ponumerowanymi wskazówkami.`,"template.crossword.description":`Siatka 5 na 5, dwa hasła ze wspólną pierwszą literą`}})),I8,L8,R8=n((()=>{N8(),F8(),I8=`astl.crossword`,L8=[{namespace:I8,locale:`en`,messages:M8},{namespace:I8,locale:`pl`,messages:P8}]})),z8,B8=n((()=>{z8={"editor.description":`The student puts a word from a word bank into the text.`}})),V8,H8=n((()=>{V8={"editor.description":`Uczeń wstawia do tekstu słowo z banku słów.`}})),U8,W8,G8=n((()=>{B8(),H8(),U8=`astl.drop`,W8=[{namespace:U8,locale:`en`,messages:z8},{namespace:U8,locale:`pl`,messages:V8}]})),K8,q8=n((()=>{K8={"editor.description":`Cards to learn from, turned over one by one.`,"editor.template.cards.description":`Four cards to learn from, two with a picture on the front`}})),J8,Y8=n((()=>{J8={"editor.description":`Karty do nauki, odwracane po kolei.`,"editor.template.cards.description":`Cztery karty do nauki, dwie z obrazkiem na przodzie`}})),X8,Z8,Q8=n((()=>{q8(),Y8(),X8=`astl.flash-cards`,Z8=[{namespace:X8,locale:`en`,messages:K8},{namespace:X8,locale:`pl`,messages:J8}]})),$8,e5=n((()=>{$8={"editor.description":`The student types a word or a number.`,"template.fill.description":`A sentence with two words to type in`}})),t5,n5=n((()=>{t5={"editor.description":`Uczeń wpisuje słowo lub liczbę.`,"template.fill.description":`Zdanie z dwoma słowami do wpisania`}})),r5,i5,a5=n((()=>{e5(),n5(),r5=`astl.gap`,i5=[{namespace:r5,locale:`en`,messages:$8},{namespace:r5,locale:`pl`,messages:t5}]})),o5,s5=n((()=>{o5={"editor.description":`The student picks the right places on a picture.`,"template.find.description":`A picture with five places to pick, three of them right`}})),c5,l5=n((()=>{c5={"editor.description":`Uczeń wskazuje właściwe miejsca na obrazku.`,"template.find.description":`Obrazek z pięcioma miejscami do wskazania, z których trzy są właściwe`}})),u5,d5,f5=n((()=>{s5(),l5(),u5=`astl.hotspot`,d5=[{namespace:u5,locale:`en`,messages:o5},{namespace:u5,locale:`pl`,messages:c5}]})),p5,m5=n((()=>{p5={"editor.description":`The student puts labels on the zones of a picture.`,"template.drag.description":`Three zones on a picture and four labels, one of them extra`}})),h5,g5=n((()=>{h5={"editor.description":`Uczeń umieszcza podpisy w strefach obrazka.`,"template.drag.description":`Trzy strefy na obrazku i cztery podpisy, w tym jeden dodatkowy`}})),_5,v5,y5=n((()=>{m5(),g5(),_5=`astl.image-drop`,v5=[{namespace:_5,locale:`en`,messages:p5},{namespace:_5,locale:`pl`,messages:h5}]})),b5,x5=n((()=>{b5={"editor.description":`The student writes a name for each pin on a picture.`,"template.label.description":`Three pins to name, one of them with two accepted spellings`}})),S5,C5=n((()=>{S5={"editor.description":`Uczeń wpisuje nazwę każdej pinezki na obrazku.`,"template.label.description":`Trzy pinezki do podpisania, jedna z dwoma przyjmowanymi zapisami`}})),w5,T5,E5=n((()=>{x5(),C5(),w5=`astl.image-label`,T5=[{namespace:w5,locale:`en`,messages:b5},{namespace:w5,locale:`pl`,messages:S5}]})),D5,O5=n((()=>{D5={"editor.description":`An answer in the student's own words, marked by the teacher.`,"editor.template.write.description":`A question answered in a few sentences, read by the teacher`}})),k5,A5=n((()=>{k5={"editor.description":`Odpowiedź własnymi słowami, oceniana przez nauczyciela.`,"editor.template.write.description":`Pytanie, na które uczeń odpowiada kilkoma zdaniami, a czyta je nauczyciel`}})),j5,M5,N5=n((()=>{O5(),A5(),j5=`astl.long-answer`,M5=[{namespace:j5,locale:`en`,messages:D5},{namespace:j5,locale:`pl`,messages:k5}]})),P5,F5=n((()=>{P5={"editor.description":`The student highlights or crosses out words in a text.`,"template.select.description":`A sentence with three marked words, two of them correct`,"template.odd.description":`Three lines of four words, one odd word in each`}})),I5,L5=n((()=>{I5={"editor.description":`Uczeń podkreśla albo skreśla wyrazy w tekście.`,"template.select.description":`Zdanie z trzema oznaczonymi wyrazami, dwa z nich poprawne`,"template.odd.description":`Trzy wiersze po cztery wyrazy, w każdym jeden niepasujący`}})),R5,z5,B5=n((()=>{F5(),L5(),R5=`astl.mark-words`,z5=[{namespace:R5,locale:`en`,messages:P5},{namespace:R5,locale:`pl`,messages:I5}]})),V5,H5=n((()=>{V5={"editor.description":`The student matches rows with columns or joins lines.`,"template.matching.description":`A grid of three animals and their homes`,"template.lines.description":`Three pairs of opposites to join with lines`}})),U5,W5=n((()=>{U5={"editor.description":`Uczeń dopasowuje wiersze do kolumn albo łączy linie.`,"template.matching.description":`Tabela: trzy zwierzęta i ich domy`,"template.lines.description":`Trzy pary przeciwieństw do połączenia liniami`}})),G5,K5,q5=n((()=>{H5(),W5(),G5=`astl.match`,K5=[{namespace:G5,locale:`en`,messages:V5},{namespace:G5,locale:`pl`,messages:U5}]})),J5,Y5=n((()=>{J5={"editor.description":`The student turns two cards at a time and finds the pairs.`,"template.memory.description":`Three pairs of cards: animals and their young`}})),X5,Z5=n((()=>{X5={"editor.description":`Uczeń odkrywa po dwie karty i szuka par.`,"template.memory.description":`Trzy pary kart: zwierzęta i ich młode`}})),Q5,$5,e7=n((()=>{Y5(),Z5(),Q5=`astl.memory`,$5=[{namespace:Q5,locale:`en`,messages:J5},{namespace:Q5,locale:`pl`,messages:X5}]})),t7,n7=n((()=>{t7={"editor.description":`The student puts items in the right order.`,"template.cycle.description":`Four stages of a life cycle to put in order`}})),r7,i7=n((()=>{r7={"editor.description":`Uczeń układa elementy we właściwej kolejności.`,"template.cycle.description":`Cztery etapy życia do ułożenia po kolei`}})),a7,o7,s7=n((()=>{n7(),i7(),a7=`astl.order`,o7=[{namespace:a7,locale:`en`,messages:t7},{namespace:a7,locale:`pl`,messages:r7}]})),c7,l7=n((()=>{c7={"editor.description":`The student picks one answer inside the text.`,"template.list.description":`A sentence with a drop-down list of three words`,"template.click.description":`Two sentences, each with words to click`}})),u7,d7=n((()=>{u7={"editor.description":`Uczeń wybiera jedną odpowiedź w tekście.`,"template.list.description":`Zdanie z listą rozwijaną trzech słów`,"template.click.description":`Dwa zdania, w każdym słowa do kliknięcia`}})),f7,p7,m7=n((()=>{l7(),d7(),f7=`astl.select`,p7=[{namespace:f7,locale:`en`,messages:c7},{namespace:f7,locale:`pl`,messages:u7}]})),h7,g7=n((()=>{h7={"editor.description":`The student marks each statement true or false.`,"template.tf.description":`Three statements to mark true or false`}})),_7,v7=n((()=>{_7={"editor.description":`Uczeń zaznacza przy każdym zdaniu prawdę albo fałsz.`,"template.tf.description":`Trzy zdania do oceny: prawda czy fałsz`}})),y7,b7,x7=n((()=>{g7(),v7(),y7=`astl.true-false`,b7=[{namespace:y7,locale:`en`,messages:h7},{namespace:y7,locale:`pl`,messages:_7}]})),S7,C7=n((()=>{S7={"editor.description":`A video file, or a YouTube or Vimeo video.`,"editor.template.watch.description":`A video with a tip, then a sentence with a gap`}})),w7,T7=n((()=>{w7={"editor.description":`Plik wideo albo film z YouTube lub Vimeo.`,"editor.template.watch.description":`Film ze wskazówką, a potem zdanie z luką`}})),E7,D7,O7=n((()=>{C7(),T7(),E7=`astl.video`,D7=[{namespace:E7,locale:`en`,messages:S7},{namespace:E7,locale:`pl`,messages:w7}]})),k7,A7=n((()=>{k7={"editor.description":`Words the student puts into the gaps of the text.`,"editor.template.dragWords.description":`A sentence with two gaps and a bank of three words, one of them extra.`}})),j7,M7=n((()=>{j7={"editor.description":`Słowa, które uczeń wstawia do luk w tekście.`,"editor.template.dragWords.description":`Zdanie z dwiema lukami i bankiem trzech słów, z których jedno jest zbędne.`}})),N7,P7,F7=n((()=>{A7(),M7(),N7=`astl.word-bank`,P7=[{namespace:N7,locale:`en`,messages:k7},{namespace:N7,locale:`pl`,messages:j7}]})),I7,L7=n((()=>{I7={"editor.description":`Hidden words in a grid of letters.`,"editor.template.wordSearch.description":`Three animals to find in a grid of letters`}})),R7,z7=n((()=>{R7={"editor.description":`Ukryte słowa w siatce liter.`,"editor.template.wordSearch.description":`Trzy zwierzęta do znalezienia w siatce liter`}})),B7,V7,H7=n((()=>{L7(),z7(),B7=`astl.word-search`,V7=[{namespace:B7,locale:`en`,messages:I7},{namespace:B7,locale:`pl`,messages:R7}]})),U7=r({builtInMenuMessages:()=>W7}),W7,G7=n((()=>{u8(),_8(),w8(),j8(),R8(),G8(),Q8(),a5(),f5(),y5(),E5(),N5(),B5(),q5(),e7(),s7(),m7(),x7(),O7(),F7(),H7(),W7=[...l8,...g8,...C8,...A8,...L8,...W8,...Z8,...i5,...d5,...v5,...T5,...M5,...z5,...K5,...$5,...o7,...p7,...b7,...D7,...P7,...V7]}));kI(),Kw(),w();var K7=[],q7=async()=>(await Promise.resolve().then(()=>(G7(),U7))).builtInMenuMessages;function J7(e={}){let t=e.components??Ix,n=new Set(t.map(e=>e.manifest.tag)),{surface:r,ink:i}=Tw.themes.light;r8({styleTemplates:Fw,groundColors:{surface:r,ink:i},featured:K7,menuMessages:q7,...e,components:t,editors:e.editors??hS.filter(e=>n.has(e.manifest.tag)),elements:e.elements??Bj.filter(e=>n.has(e.tag))})}em(),mm(),Tm(),Wm(),dh(),Lh(),eg(),mg(),Gg(),u_(),A_(),J_(),sv(),xv(),Vv(),ly(),Oy(),Ky(),cb(),Ab(),qb();var Y7=[pg,Um,Dy,Gy,cy,wm,bv,kb,Ih,Kb,Bv,uh,$h,q_,ov,pm,Wg,l_,k_,sb,$p];Qp(),Kw(),w(),Or(),Qp();var X7=`astrolabe-in-browser-key`;function Z7(e={}){let{surface:t,ink:n}=Tw.themes.light;return Np({components:Ix,styleTemplates:Fw,groundColors:{surface:t,ink:n},...e})}function Q7(e=Z7({secret:X7})){return async(t,n)=>{let r=await e.compile(t,{salt:location.pathname});if(!r.ok){let t=r.issues.filter(e=>e.severity===`error`).map(t=>e.describe(t,n.locale)).join(`
8061
- `);throw console.error(t),Error(t)}return{view:r.view,checker:En(e,r.key)}}}YE(),Kw(),w(),YE();function $7(e={}){zE({elements:Bj,styleTemplates:Fw,...e})}f(),b(),te(),ke(),We(),Ze(),dt(),ht(),yt(),St(),kt(),Lt(),zt(),Gt(),Qt(),rn(),on(),ln(),xn(),On(),Or(),dl(),Ql(),Bf(),mp(),Op(),Zp(),UC(),qC(),$C(),dw(),Iw(),Hw(),RE(),JE(),lN(),TN(),JP(),OI();var e9=`data-astl-tokens`;if(document.head.querySelector(`style[${e9}]`)===null){let e=document.createElement(`style`);e.setAttribute(e9,``),e.textContent=Vw(`:root, .astl-theme`),document.head.prepend(e)}return $7({compileSource:Q7()}),J7(),e.AstlEditor=t8,e.AstlElement=KE,e.AstlPlayer=LE,e.AttemptController=KC,e.BLOCK_TAGS=ie,e.BUILT_IN_PREFIX=Ve,e.CAPTION_TAG=se,e.CLASS_ATTRIBUTE=ue,e.COLUMNS_TAG=ge,e.COLUMN_TAG=_e,e.COMMON_ATTRIBUTES=Ft,e.CONTENT_ATTRIBUTES=le,e.CheckerError=y,e.DEFAULT_DOC_KIND=we,e.DEFAULT_FEATURED=K7,e.DEFAULT_FONTS=rN,e.DEFAULT_PROFILE=an,e.DEFAULT_STYLES=iN,e.DOC_ATTRIBUTES=Se,e.DOC_KINDS=Ce,e.DOC_TAG=Fe,e.ELEMENT_TAG_PATTERN=Be,e.ENGINE_NAMESPACE=xt,e.EXPLANATION_TAG=Ke,e.EngineIssue=S,e.FEEDBACK_TAG=qe,e.FEEDBACK_VARIANTS=Ye,e.FIGURE_TAG=oe,e.FLAG_SELECTED=d,e.FORMAT_VERSION=Ne,e.HELP_ATTRIBUTES=Xe,e.HELP_TAGS=Je,e.HINT_TAG=Ge,e.INERT_STYLE=de,e.INLINE_TAGS=ae,e.IN_BROWSER_SECRET=X7,e.JSON_MEDIA_TYPE=Jt,e.KEY_FORMAT_VERSION=ee,e.LANGUAGE_TAG_PATTERN=Ue,e.MAX_ANSWER_COUNT=u,e.MAX_ANSWER_LENGTH=s,e.MAX_ATTRIBUTES_PER_ELEMENT=Ee,e.MAX_COLUMNS=ye,e.MAX_INLINED_STYLES=Vn,e.MAX_NESTING_DEPTH=De,e.MAX_OPEN_ANSWER_LENGTH=l,e.MAX_REQUEST_BYTES=Zt,e.MAX_SOURCE_LENGTH=Le,e.MAX_STYLE_LENGTH=zn,e.MAX_STYLE_RULES=Bn,e.MIN_COLUMNS=ve,e.MessageSyntaxError=at,e.OPAQUE_ID_PATTERN=ze,e.OPEN_SLOT_KIND=c,e.PAGE_ATTRIBUTES=Te,e.PAGE_TAG=Ie,e.PLAYER_NAMESPACE=lw,e.PRACTICE_POLICY=Ht,e.PROBLEM_MEDIA_TYPE=Yt,e.PROTOCOL_VERSION=qt,e.PlayerEvent=Rt,e.ProblemCode=C,e.ProtocolPath=Xt,e.REMOVED_WITH_CONTENT=ce,e.SCORING_ATTRIBUTES=It,e.SCORING_RULES=nn,e.SNAPSHOT_FORMAT=cn,e.SOURCE_ID_PATTERN=Re,e.STYLE_OPEN=WP,e.STYLE_PROPERTIES=Tr,e.STYLE_TAG=he,e.STYLE_TEMPLATE_ATTRIBUTE=wt,e.STYLE_TEMPLATE_NAME=Tt,e.SUPPORTED_FORMATS=Pe,e.SingleSlotElement=qE,e.TAG_ATTRIBUTES=be,e.TEST_POLICY=Ut,e.URL_ATTRIBUTES=xe,e.UploadRefused=xN,e.allAttributes=jt,e.announce=IC,e.builtInDefinitions=Ix,e.builtInEditors=hS,e.builtInElements=Bj,e.builtInManifests=Y7,e.builtInStyleTemplates=Fw,e.checkCatalog=pt,e.childElements=_,e.childTagConflict=Pt,e.choiceSlot=Cp,e.cleanClass=An,e.cleanStyle=Fn,e.compareCatalogs=mt,e.createAuthoring=bN,e.createEngine=Z7,e.createI18n=vt,e.createSourceCompiler=Q7,e.createTextareaAdapter=TI,e.defineEditor=J7,e.definePlayer=$7,e.directionOf=Me,e.element=p,e.engineMessages=zf,e.fitsAnswer=a,e.flagSlot=wp,e.groupMax=tn,e.hasErrors=bt,e.helpPolicy=Bt,e.helpShown=un,e.hintCount=_n,e.httpChecker=ZC,e.icuFormatter=ut,e.inertStyles=me,e.isAnswerKey=x,e.isAnswers=o,e.isAttemptPolicy=Vt,e.isElement=h,e.isGradedElement=pn,e.isOpaqueId=je,e.isProblemDetails=Kt,e.isSafeUrl=ne,e.isSnapshot=sn,e.isSourceId=Ae,e.isStyleName=kn,e.isStyleTemplate=Ct,Object.defineProperty(e,"kit",{enumerable:!0,get:function(){return zp}}),e.leakProbe=Xl,e.letterSlot=Tp,e.loadStyleElements=HP,e.localChecker=En,e.maxAnswerLength=i,e.mergeStyles=Nn,e.messageParams=$e,e.negotiateLocale=gt,e.nextHint=vn,e.normalise=Hf,e.numberSlot=Sp,e.overStyleColor=Ln,e.parseHtml=Rc,e.parseMessage=Qe,e.parseNumber=qf,e.parseStyleColor=Mn,e.playerMessages=uw,e.pluralCategories=it,e.refResolver=Zl,e.renderVerdict=FC,e.resultHelp=gn,e.roundScore=$t,e.sameChildSpec=Nt,e.seededShuffle=GE,e.serializeHtml=Gc,e.strictUrlPolicy=re,e.styleContrast=Rn,e.styleLuminance=In,e.styleText=Pn,e.text=m,e.textContent=g,e.textSlot=xp,e.tokensCss=Vw,e.variantAttribute=At,e.verdictIcon=PC,e.verdictStyles=zC,e.visuallyHidden=RC,e})({});
8085
+ </p>`}#N(){let e=t8;return e===null?R:(this.#h??=e.formatHtml(this.value),e.renderSource(this.renderRoot,this.authoring,this.#g??this.#h,this.#_,e=>{this.#g=e}))}};kI();var r8=`astl-editor`;function i8(e){let t=e.registry??customElements,n=t.get(r8);if(n!==void 0&&n!==n8)throw Error(`<${r8}> is already defined by another class`);lI(t),V6(e),n===void 0&&t.define(r8,n8)}var a8,o8=n((()=>{a8={"editor.description":`A sound to listen to, with an optional transcript.`}})),s8,c8=n((()=>{s8={"editor.description":`Dźwięk do odsłuchania, z opcjonalną transkrypcją.`}})),l8,u8,d8=n((()=>{o8(),c8(),l8=`astl.audio`,u8=[{namespace:l8,locale:`en`,messages:a8},{namespace:l8,locale:`pl`,messages:s8}]})),f8,p8=n((()=>{f8={"editor.description":`A tip, information or a warning in a box.`}})),m8,h8=n((()=>{m8={"editor.description":`Wskazówka, informacja albo ostrzeżenie w ramce.`}})),g8,_8,v8=n((()=>{p8(),h8(),g8=`astl.callout`,_8=[{namespace:g8,locale:`en`,messages:f8},{namespace:g8,locale:`pl`,messages:m8}]})),y8,b8=n((()=>{y8={"editor.description":`The student sorts cards into groups.`,"template.sort.description":`Two groups and four cards to sort`}})),x8,S8=n((()=>{x8={"editor.description":`Uczeń przyporządkowuje karty do grup.`,"template.sort.description":`Dwie grupy i cztery karty do posortowania`}})),C8,w8,T8=n((()=>{b8(),S8(),C8=`astl.categorise`,w8=[{namespace:C8,locale:`en`,messages:y8},{namespace:C8,locale:`pl`,messages:x8}]})),E8,D8=n((()=>{E8={"editor.description":`The student picks one answer or several.`,"template.choice.description":`A question with three answers, one of them right`}})),O8,k8=n((()=>{O8={"editor.description":`Uczeń wybiera jedną odpowiedź albo kilka.`,"template.choice.description":`Pytanie z trzema odpowiedziami, z których jedna jest poprawna`}})),A8,j8,M8=n((()=>{D8(),k8(),A8=`astl.choice`,j8=[{namespace:A8,locale:`en`,messages:E8},{namespace:A8,locale:`pl`,messages:O8}]})),N8,P8=n((()=>{N8={"editor.description":`Words that cross in a grid of squares, with numbered clues.`,"template.crossword.description":`A 5 by 5 grid, two words crossing at their first letter`}})),F8,I8=n((()=>{F8={"editor.description":`Hasła krzyżujące się w siatce kratek, z ponumerowanymi wskazówkami.`,"template.crossword.description":`Siatka 5 na 5, dwa hasła ze wspólną pierwszą literą`}})),L8,R8,z8=n((()=>{P8(),I8(),L8=`astl.crossword`,R8=[{namespace:L8,locale:`en`,messages:N8},{namespace:L8,locale:`pl`,messages:F8}]})),B8,V8=n((()=>{B8={"editor.description":`The student puts a word from a word bank into the text.`}})),H8,U8=n((()=>{H8={"editor.description":`Uczeń wstawia do tekstu słowo z banku słów.`}})),W8,G8,K8=n((()=>{V8(),U8(),W8=`astl.drop`,G8=[{namespace:W8,locale:`en`,messages:B8},{namespace:W8,locale:`pl`,messages:H8}]})),q8,J8=n((()=>{q8={"editor.description":`Cards to learn from, turned over one by one.`,"editor.template.cards.description":`Four cards to learn from, two with a picture on the front`}})),Y8,X8=n((()=>{Y8={"editor.description":`Karty do nauki, odwracane po kolei.`,"editor.template.cards.description":`Cztery karty do nauki, dwie z obrazkiem na przodzie`}})),Z8,Q8,$8=n((()=>{J8(),X8(),Z8=`astl.flash-cards`,Q8=[{namespace:Z8,locale:`en`,messages:q8},{namespace:Z8,locale:`pl`,messages:Y8}]})),e5,t5=n((()=>{e5={"editor.description":`The student types a word or a number.`,"template.fill.description":`A sentence with two words to type in`}})),n5,r5=n((()=>{n5={"editor.description":`Uczeń wpisuje słowo lub liczbę.`,"template.fill.description":`Zdanie z dwoma słowami do wpisania`}})),i5,a5,o5=n((()=>{t5(),r5(),i5=`astl.gap`,a5=[{namespace:i5,locale:`en`,messages:e5},{namespace:i5,locale:`pl`,messages:n5}]})),s5,c5=n((()=>{s5={"editor.description":`The student picks the right places on a picture.`,"template.find.description":`A picture with five places to pick, three of them right`}})),l5,u5=n((()=>{l5={"editor.description":`Uczeń wskazuje właściwe miejsca na obrazku.`,"template.find.description":`Obrazek z pięcioma miejscami do wskazania, z których trzy są właściwe`}})),d5,f5,p5=n((()=>{c5(),u5(),d5=`astl.hotspot`,f5=[{namespace:d5,locale:`en`,messages:s5},{namespace:d5,locale:`pl`,messages:l5}]})),m5,h5=n((()=>{m5={"editor.description":`The student puts labels on the zones of a picture.`,"template.drag.description":`Three zones on a picture and four labels, one of them extra`}})),g5,_5=n((()=>{g5={"editor.description":`Uczeń umieszcza podpisy w strefach obrazka.`,"template.drag.description":`Trzy strefy na obrazku i cztery podpisy, w tym jeden dodatkowy`}})),v5,y5,b5=n((()=>{h5(),_5(),v5=`astl.image-drop`,y5=[{namespace:v5,locale:`en`,messages:m5},{namespace:v5,locale:`pl`,messages:g5}]})),x5,S5=n((()=>{x5={"editor.description":`The student writes a name for each pin on a picture.`,"template.label.description":`Three pins to name, one of them with two accepted spellings`}})),C5,w5=n((()=>{C5={"editor.description":`Uczeń wpisuje nazwę każdej pinezki na obrazku.`,"template.label.description":`Trzy pinezki do podpisania, jedna z dwoma przyjmowanymi zapisami`}})),T5,E5,D5=n((()=>{S5(),w5(),T5=`astl.image-label`,E5=[{namespace:T5,locale:`en`,messages:x5},{namespace:T5,locale:`pl`,messages:C5}]})),O5,k5=n((()=>{O5={"editor.description":`An answer in the student's own words, marked by the teacher.`,"editor.template.write.description":`A question answered in a few sentences, read by the teacher`}})),A5,j5=n((()=>{A5={"editor.description":`Odpowiedź własnymi słowami, oceniana przez nauczyciela.`,"editor.template.write.description":`Pytanie, na które uczeń odpowiada kilkoma zdaniami, a czyta je nauczyciel`}})),M5,N5,P5=n((()=>{k5(),j5(),M5=`astl.long-answer`,N5=[{namespace:M5,locale:`en`,messages:O5},{namespace:M5,locale:`pl`,messages:A5}]})),F5,I5=n((()=>{F5={"editor.description":`The student highlights or crosses out words in a text.`,"template.select.description":`A sentence with three marked words, two of them correct`,"template.odd.description":`Three lines of four words, one odd word in each`}})),L5,R5=n((()=>{L5={"editor.description":`Uczeń podkreśla albo skreśla wyrazy w tekście.`,"template.select.description":`Zdanie z trzema oznaczonymi wyrazami, dwa z nich poprawne`,"template.odd.description":`Trzy wiersze po cztery wyrazy, w każdym jeden niepasujący`}})),z5,B5,V5=n((()=>{I5(),R5(),z5=`astl.mark-words`,B5=[{namespace:z5,locale:`en`,messages:F5},{namespace:z5,locale:`pl`,messages:L5}]})),H5,U5=n((()=>{H5={"editor.description":`The student matches rows with columns or joins lines.`,"template.matching.description":`A grid of three animals and their homes`,"template.lines.description":`Three pairs of opposites to join with lines`}})),W5,G5=n((()=>{W5={"editor.description":`Uczeń dopasowuje wiersze do kolumn albo łączy linie.`,"template.matching.description":`Tabela: trzy zwierzęta i ich domy`,"template.lines.description":`Trzy pary przeciwieństw do połączenia liniami`}})),K5,q5,J5=n((()=>{U5(),G5(),K5=`astl.match`,q5=[{namespace:K5,locale:`en`,messages:H5},{namespace:K5,locale:`pl`,messages:W5}]})),Y5,X5=n((()=>{Y5={"editor.description":`The student turns two cards at a time and finds the pairs.`,"template.memory.description":`Three pairs of cards: animals and their young`}})),Z5,Q5=n((()=>{Z5={"editor.description":`Uczeń odkrywa po dwie karty i szuka par.`,"template.memory.description":`Trzy pary kart: zwierzęta i ich młode`}})),$5,e7,t7=n((()=>{X5(),Q5(),$5=`astl.memory`,e7=[{namespace:$5,locale:`en`,messages:Y5},{namespace:$5,locale:`pl`,messages:Z5}]})),n7,r7=n((()=>{n7={"editor.description":`The student puts items in the right order.`,"template.cycle.description":`Four stages of a life cycle to put in order`}})),i7,a7=n((()=>{i7={"editor.description":`Uczeń układa elementy we właściwej kolejności.`,"template.cycle.description":`Cztery etapy życia do ułożenia po kolei`}})),o7,s7,c7=n((()=>{r7(),a7(),o7=`astl.order`,s7=[{namespace:o7,locale:`en`,messages:n7},{namespace:o7,locale:`pl`,messages:i7}]})),l7,u7=n((()=>{l7={"editor.description":`The student picks one answer inside the text.`,"template.list.description":`A sentence with a drop-down list of three words`,"template.click.description":`Two sentences, each with words to click`}})),d7,f7=n((()=>{d7={"editor.description":`Uczeń wybiera jedną odpowiedź w tekście.`,"template.list.description":`Zdanie z listą rozwijaną trzech słów`,"template.click.description":`Dwa zdania, w każdym słowa do kliknięcia`}})),p7,m7,h7=n((()=>{u7(),f7(),p7=`astl.select`,m7=[{namespace:p7,locale:`en`,messages:l7},{namespace:p7,locale:`pl`,messages:d7}]})),g7,_7=n((()=>{g7={"editor.description":`The student marks each statement true or false.`,"template.tf.description":`Three statements to mark true or false`}})),v7,y7=n((()=>{v7={"editor.description":`Uczeń zaznacza przy każdym zdaniu prawdę albo fałsz.`,"template.tf.description":`Trzy zdania do oceny: prawda czy fałsz`}})),b7,x7,S7=n((()=>{_7(),y7(),b7=`astl.true-false`,x7=[{namespace:b7,locale:`en`,messages:g7},{namespace:b7,locale:`pl`,messages:v7}]})),C7,w7=n((()=>{C7={"editor.description":`A video file, or a YouTube or Vimeo video.`,"editor.template.watch.description":`A video with a tip, then a sentence with a gap`}})),T7,E7=n((()=>{T7={"editor.description":`Plik wideo albo film z YouTube lub Vimeo.`,"editor.template.watch.description":`Film ze wskazówką, a potem zdanie z luką`}})),D7,O7,k7=n((()=>{w7(),E7(),D7=`astl.video`,O7=[{namespace:D7,locale:`en`,messages:C7},{namespace:D7,locale:`pl`,messages:T7}]})),A7,j7=n((()=>{A7={"editor.description":`Words the student puts into the gaps of the text.`,"editor.template.dragWords.description":`A sentence with two gaps and a bank of three words, one of them extra.`}})),M7,N7=n((()=>{M7={"editor.description":`Słowa, które uczeń wstawia do luk w tekście.`,"editor.template.dragWords.description":`Zdanie z dwiema lukami i bankiem trzech słów, z których jedno jest zbędne.`}})),P7,F7,I7=n((()=>{j7(),N7(),P7=`astl.word-bank`,F7=[{namespace:P7,locale:`en`,messages:A7},{namespace:P7,locale:`pl`,messages:M7}]})),L7,R7=n((()=>{L7={"editor.description":`Hidden words in a grid of letters.`,"editor.template.wordSearch.description":`Three animals to find in a grid of letters`}})),z7,B7=n((()=>{z7={"editor.description":`Ukryte słowa w siatce liter.`,"editor.template.wordSearch.description":`Trzy zwierzęta do znalezienia w siatce liter`}})),V7,H7,U7=n((()=>{R7(),B7(),V7=`astl.word-search`,H7=[{namespace:V7,locale:`en`,messages:L7},{namespace:V7,locale:`pl`,messages:z7}]})),W7=r({builtInMenuMessages:()=>G7}),G7,K7=n((()=>{d8(),v8(),T8(),M8(),z8(),K8(),$8(),o5(),p5(),b5(),D5(),P5(),V5(),J5(),t7(),c7(),h7(),S7(),k7(),I7(),U7(),G7=[...u8,..._8,...w8,...j8,...R8,...G8,...Q8,...a5,...f5,...y5,...E5,...N5,...B5,...q5,...e7,...s7,...m7,...x7,...O7,...F7,...H7]}));kI(),Kw(),w();var q7=[],J7=async()=>(await Promise.resolve().then(()=>(K7(),W7))).builtInMenuMessages;function Y7(e={}){let t=e.components??Ix,n=new Set(t.map(e=>e.manifest.tag)),{surface:r,ink:i}=Tw.themes.light;i8({styleTemplates:Fw,groundColors:{surface:r,ink:i},featured:q7,menuMessages:J7,...e,components:t,editors:e.editors??hS.filter(e=>n.has(e.manifest.tag)),elements:e.elements??Bj.filter(e=>n.has(e.tag))})}em(),mm(),Tm(),Wm(),dh(),Lh(),eg(),mg(),Gg(),u_(),A_(),J_(),sv(),xv(),Vv(),ly(),Oy(),Ky(),cb(),Ab(),qb();var X7=[pg,Um,Dy,Gy,cy,wm,bv,kb,Ih,Kb,Bv,uh,$h,q_,ov,pm,Wg,l_,k_,sb,$p];Qp(),Kw(),w(),Or(),Qp();var Z7=`astrolabe-in-browser-key`;function Q7(e={}){let{surface:t,ink:n}=Tw.themes.light;return Np({components:Ix,styleTemplates:Fw,groundColors:{surface:t,ink:n},...e})}function $7(e=Q7({secret:Z7})){return async(t,n)=>{let r=await e.compile(t,{salt:location.pathname});if(!r.ok){let t=r.issues.filter(e=>e.severity===`error`).map(t=>e.describe(t,n.locale)).join(`
8086
+ `);throw console.error(t),Error(t)}return{view:r.view,checker:En(e,r.key)}}}YE(),Kw(),w(),YE();function e9(e={}){zE({elements:Bj,styleTemplates:Fw,...e})}f(),b(),te(),ke(),We(),Ze(),dt(),ht(),yt(),St(),kt(),Lt(),zt(),Gt(),Qt(),rn(),on(),ln(),xn(),On(),Or(),dl(),Ql(),Bf(),mp(),Op(),Zp(),UC(),qC(),$C(),dw(),Iw(),Hw(),RE(),JE(),lN(),TN(),JP(),OI();var t9=`data-astl-tokens`;if(document.head.querySelector(`style[${t9}]`)===null){let e=document.createElement(`style`);e.setAttribute(t9,``),e.textContent=Vw(`:root, .astl-theme`),document.head.prepend(e)}return e9({compileSource:$7()}),Y7(),e.AstlEditor=n8,e.AstlElement=KE,e.AstlPlayer=LE,e.AttemptController=KC,e.BLOCK_TAGS=ie,e.BUILT_IN_PREFIX=Ve,e.CAPTION_TAG=se,e.CLASS_ATTRIBUTE=ue,e.COLUMNS_TAG=ge,e.COLUMN_TAG=_e,e.COMMON_ATTRIBUTES=Ft,e.CONTENT_ATTRIBUTES=le,e.CheckerError=y,e.DEFAULT_DOC_KIND=we,e.DEFAULT_FEATURED=q7,e.DEFAULT_FONTS=rN,e.DEFAULT_PROFILE=an,e.DEFAULT_STYLES=iN,e.DOC_ATTRIBUTES=Se,e.DOC_KINDS=Ce,e.DOC_TAG=Fe,e.ELEMENT_TAG_PATTERN=Be,e.ENGINE_NAMESPACE=xt,e.EXPLANATION_TAG=Ke,e.EngineIssue=S,e.FEEDBACK_TAG=qe,e.FEEDBACK_VARIANTS=Ye,e.FIGURE_TAG=oe,e.FLAG_SELECTED=d,e.FORMAT_VERSION=Ne,e.HELP_ATTRIBUTES=Xe,e.HELP_TAGS=Je,e.HINT_TAG=Ge,e.INERT_STYLE=de,e.INLINE_TAGS=ae,e.IN_BROWSER_SECRET=Z7,e.JSON_MEDIA_TYPE=Jt,e.KEY_FORMAT_VERSION=ee,e.LANGUAGE_TAG_PATTERN=Ue,e.MAX_ANSWER_COUNT=u,e.MAX_ANSWER_LENGTH=s,e.MAX_ATTRIBUTES_PER_ELEMENT=Ee,e.MAX_COLUMNS=ye,e.MAX_INLINED_STYLES=Vn,e.MAX_NESTING_DEPTH=De,e.MAX_OPEN_ANSWER_LENGTH=l,e.MAX_REQUEST_BYTES=Zt,e.MAX_SOURCE_LENGTH=Le,e.MAX_STYLE_LENGTH=zn,e.MAX_STYLE_RULES=Bn,e.MIN_COLUMNS=ve,e.MessageSyntaxError=at,e.OPAQUE_ID_PATTERN=ze,e.OPEN_SLOT_KIND=c,e.PAGE_ATTRIBUTES=Te,e.PAGE_TAG=Ie,e.PLAYER_NAMESPACE=lw,e.PRACTICE_POLICY=Ht,e.PROBLEM_MEDIA_TYPE=Yt,e.PROTOCOL_VERSION=qt,e.PlayerEvent=Rt,e.ProblemCode=C,e.ProtocolPath=Xt,e.REMOVED_WITH_CONTENT=ce,e.SCORING_ATTRIBUTES=It,e.SCORING_RULES=nn,e.SNAPSHOT_FORMAT=cn,e.SOURCE_ID_PATTERN=Re,e.STYLE_OPEN=WP,e.STYLE_PROPERTIES=Tr,e.STYLE_TAG=he,e.STYLE_TEMPLATE_ATTRIBUTE=wt,e.STYLE_TEMPLATE_NAME=Tt,e.SUPPORTED_FORMATS=Pe,e.SingleSlotElement=qE,e.TAG_ATTRIBUTES=be,e.TEST_POLICY=Ut,e.URL_ATTRIBUTES=xe,e.UploadRefused=xN,e.allAttributes=jt,e.announce=IC,e.builtInDefinitions=Ix,e.builtInEditors=hS,e.builtInElements=Bj,e.builtInManifests=X7,e.builtInStyleTemplates=Fw,e.checkCatalog=pt,e.childElements=_,e.childTagConflict=Pt,e.choiceSlot=Cp,e.cleanClass=An,e.cleanStyle=Fn,e.compareCatalogs=mt,e.createAuthoring=bN,e.createEngine=Q7,e.createI18n=vt,e.createSourceCompiler=$7,e.createTextareaAdapter=TI,e.defineEditor=Y7,e.definePlayer=e9,e.directionOf=Me,e.element=p,e.engineMessages=zf,e.fitsAnswer=a,e.flagSlot=wp,e.groupMax=tn,e.hasErrors=bt,e.helpPolicy=Bt,e.helpShown=un,e.hintCount=_n,e.httpChecker=ZC,e.icuFormatter=ut,e.inertStyles=me,e.isAnswerKey=x,e.isAnswers=o,e.isAttemptPolicy=Vt,e.isElement=h,e.isGradedElement=pn,e.isOpaqueId=je,e.isProblemDetails=Kt,e.isSafeUrl=ne,e.isSnapshot=sn,e.isSourceId=Ae,e.isStyleName=kn,e.isStyleTemplate=Ct,Object.defineProperty(e,"kit",{enumerable:!0,get:function(){return zp}}),e.leakProbe=Xl,e.letterSlot=Tp,e.loadStyleElements=HP,e.localChecker=En,e.maxAnswerLength=i,e.mergeStyles=Nn,e.messageParams=$e,e.negotiateLocale=gt,e.nextHint=vn,e.normalise=Hf,e.numberSlot=Sp,e.overStyleColor=Ln,e.parseHtml=Rc,e.parseMessage=Qe,e.parseNumber=qf,e.parseStyleColor=Mn,e.playerMessages=uw,e.pluralCategories=it,e.refResolver=Zl,e.renderVerdict=FC,e.resultHelp=gn,e.roundScore=$t,e.sameChildSpec=Nt,e.seededShuffle=GE,e.serializeHtml=Gc,e.strictUrlPolicy=re,e.styleContrast=Rn,e.styleLuminance=In,e.styleText=Pn,e.text=m,e.textContent=g,e.textSlot=xp,e.tokensCss=Vw,e.variantAttribute=At,e.verdictIcon=PC,e.verdictStyles=zC,e.visuallyHidden=RC,e})({});