autoforma 1.0.70 → 1.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -191,4 +191,4 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
191
191
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Yx,this.editor.getAttributes(ou)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Un({find:iu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Un({find:iu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ou)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),qx=/^\s*(\[([( |x])?\])\s$/,Ux=st.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Gl(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p==null?void 0:p.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:a,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[Un({find:qx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Kx=st.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:n}){return["ul",Ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
192
192
  `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=Ji(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=Ji(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(th.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(nh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ah.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(uh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Ux.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Kx.configure(this.options.taskList)),n}});var Jx=st.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Gx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Xx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qx=vt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[wn({find:Gx,type:this.type})]},addPasteRules(){return[Qt({find:Xx,type:this.type})]}}),Zx=st.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),dh=vt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),e1=dh;function t1(n={}){return new Te({view(e){return new n1(e,n)}})}class n1{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):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,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!o){let i=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=fd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class we extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return we.valid(r)?new we(r):le.near(r)}content(){return Y.empty}eq(e){return e instanceof we&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new we(e.resolve(t.pos))}getBookmark(){return new la(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!r1(e)||!s1(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&we.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(t>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(t>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=t;let a=e.doc.resolve(s);if(we.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!ee.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*t),r=!1;continue e}break}o=i,s+=t;let l=e.doc.resolve(s);if(we.valid(l))return l}return null}}}we.prototype.visible=!1;we.findFrom=we.findGapCursorFrom;le.jsonID("gapcursor",we);class la{constructor(e){this.pos=e}map(e){return new la(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return we.valid(t)?new we(t):le.near(t)}}function fh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function r1(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||fh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function s1(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||fh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function o1(){return new Te({props:{decorations:c1,createSelectionBetween(n,e,t){return e.pos==t.pos&&we.valid(t)?new we(t):null},handleClick:l1,handleKeyDown:i1,handleDOMEvents:{beforeinput:a1}}})}const i1=hf({ArrowLeft:es("horiz",-1),ArrowRight:es("horiz",1),ArrowUp:es("vert",-1),ArrowDown:es("vert",1)});function es(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof re){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=we.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new we(c))),!0):!1}}function l1(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!we.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&ee.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new we(r))),!0)}function a1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof we))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=I.empty;for(let i=r.length-1;i>=0;i--)s=I.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new Y(s,0,0));return o.setSelection(re.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function c1(n){if(!(n.selection instanceof we))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[Ue.widget(n.selection.head,e,{key:"gapcursor"})])}var so=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<so&&this.leafAppend(e)||this.length<so&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new u1(this,e)};je.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};je.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},t,r),s};je.from=function(e){return e instanceof je?e:e&&e.length?new hh(e):je.empty};var hh=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=so)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=so)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(je);je.empty=new hh([]);var u1=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(je);const d1=500;class ht{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;t&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new bt(d.map));let h=d.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new bt(p,void 0,void 0,c.length+u.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(o)):d.selection,a=new ht(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new bt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(i++,t=void 0),s||(a=f)}let c=i-r.depth;return c>h1&&(l=f1(l,c),i-=c),new ht(l.append(o),i)}remapping(e,t){let r=new Sr;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,t),r}addMaps(e){return this.eventCount==0?this:new ht(this.items.append(e.map(t=>new bt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new bt(p,g,y))}else r.push(new bt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new bt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new ht(u,l);return d.emptyItemCount()>d1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=i.selection&&i.selection.map(t.slice(r));u&&o++;let d=new bt(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new ht(je.from(s.reverse()),o)}}ht.empty=new ht(je.empty,0);function f1(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class bt{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new bt(t.getMap().invert(),t,this.selection)}}}class zt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const h1=20;function p1(n,e,t,r){let s=t.getMeta(xn),o;if(s)return s.historyState;t.getMeta(y1)&&(n=new zt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(xn))return i.getMeta(xn).redo?new zt(n.done.addTransform(t,void 0,r,ds(e)),n.undone,lu(t.mapping.maps),n.prevTime,n.prevComposition):new zt(n.done,n.undone.addTransform(t,void 0,r,ds(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!m1(t,n.prevRanges)),c=i?Ci(n.prevRanges,t.mapping):lu(t.mapping.maps);return new zt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ds(e)),ht.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new zt(n.done.rebased(t,o),n.undone.rebased(t,o),Ci(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new zt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ci(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function m1(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(t=!0)}),t}function lu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,o,i)=>e.push(o,i));return e}function Ci(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),o=e.map(n[r+1],-1);s<=o&&t.push(s,o)}return t}function g1(n,e,t){let r=ds(e),s=xn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new zt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(xn,{redo:t,historyState:a})}let Mi=!1,au=null;function ds(n){let e=n.plugins;if(au!=e){Mi=!1,au=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Mi=!0;break}}return Mi}const xn=new Pe("history"),y1=new Pe("closeHistory");function b1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Te({key:xn,state:{init(){return new zt(ht.empty,ht.empty,null,0,-1)},apply(e,t,r){return p1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?mh:r=="historyRedo"?gh:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function ph(n,e){return(t,r)=>{let s=xn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=g1(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const mh=ph(!1,!0),gh=ph(!0,!0);Ae.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Te({key:new Pe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var k1=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[t1(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Te({key:new Pe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return Se.create(n,[]);let i=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(Ue.node(c,c+a.nodeSize,{class:this.options.className}))}),Se.create(n,o)}}})]}});var x1=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[o1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ye(Z(n,"allowGapCursor",t)))!=null?e:null}}});Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Te({key:new Pe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&No(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=Ue.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),Se.create(n,s)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Te({key:new Pe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Of(t.selection)||n.view.dragging?null:Se.create(t.doc,[Ue.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function cu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var v1=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Pe(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new Te({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[t];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!cu({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!cu({node:i,types:r})}}})]}}),S1=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>mh(n,e),redo:()=>({state:n,dispatch:e})=>gh(n,e)}},addProseMirrorPlugins(){return[b1(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()}}}),C1=Ae.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(Gk.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Yk.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(th.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Zk.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(nx.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(rx.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(k1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(x1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(sx.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(ox.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(S1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(ix.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(dx.configure(this.options.italic)),this.options.listItem!==!1&&s.push(nh.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(ah.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(eh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(uh.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Jx.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Qx.configure(this.options.strike)),this.options.text!==!1&&s.push(Zx.configure(this.options.text)),this.options.underline!==!1&&s.push(dh.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(v1.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),M1=C1,w1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,T1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,E1=vt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",Ce(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const s=/^(==)([^=]+)(==)/.exec(n);if(s){const o=s[2].trim(),i=t.inlineTokens(o);return{type:"highlight",raw:s[0],text:o,tokens:i}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[wn({find:w1,type:this.type})]},addPasteRules(){return[Qt({find:T1,type:this.type})]}}),A1=E1,O1=Ae.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),D1=O1,N1=vt.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",Ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),R1=N1,L1=vt.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",Ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),I1=L1,An={root:"m_dd3f7539",Typography:"m_f2016866",content:"m_c2204cc2",linkEditorDropdown:"m_8a991b4f",control:"m_c2207da6",controlIcon:"m_9cdfeb3f",controlsGroup:"m_2ab47ef2",linkEditor:"m_b67b711e",linkEditorInput:"m_296cf94c",linkEditorExternalControl:"m_cfef614",linkEditorSave:"m_3b28e7bb",toolbar:"m_4574a3c4",taskList:"m_8b44009a"};const j1={linkControlLabel:"Link",colorPickerControlLabel:"Text color",highlightControlLabel:"Highlight text",colorControlLabel:n=>`Set text color ${n}`,boldControlLabel:"Bold",italicControlLabel:"Italic",underlineControlLabel:"Underline",strikeControlLabel:"Strikethrough",clearFormattingControlLabel:"Clear formatting",unlinkControlLabel:"Remove link",bulletListControlLabel:"Bullet list",orderedListControlLabel:"Ordered list",sourceCodeControlLabel:"Switch between text/source code",h1ControlLabel:"Heading 1",h2ControlLabel:"Heading 2",h3ControlLabel:"Heading 3",h4ControlLabel:"Heading 4",h5ControlLabel:"Heading 5",h6ControlLabel:"Heading 6",blockquoteControlLabel:"Blockquote",alignLeftControlLabel:"Align text: left",alignCenterControlLabel:"Align text: center",alignRightControlLabel:"Align text: right",alignJustifyControlLabel:"Align text: justify",codeControlLabel:"Code",codeBlockControlLabel:"Code block",subscriptControlLabel:"Subscript",superscriptControlLabel:"Superscript",unsetColorControlLabel:"Unset color",hrControlLabel:"Horizontal line",undoControlLabel:"Undo",redoControlLabel:"Redo",tasksControlLabel:"Task list",tasksSinkLabel:"Decrease task level",tasksLiftLabel:"Increase task level",linkEditorInputLabel:"Enter URL",linkEditorInputPlaceholder:"https://example.com/",linkEditorExternalLink:"Open link in a new tab",linkEditorInternalLink:"Open link in the same tab",linkEditorSave:"Save",colorPickerCancel:"Cancel",colorPickerClear:"Clear color",colorPickerColorPicker:"Color picker",colorPickerPalette:"Color palette",colorPickerSave:"Save",colorPickerColorLabel:n=>`Set text color ${n}`},[P1,St]=x.createSafeContext("RichTextEditor component was not found in tree"),aa=x.factory((n,e)=>{const t=x.useProps("RichTextEditorContent",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,...a}=t,c=St();return c.withTypographyStyles?m.jsx(x.Typography,{...c.getStyles("Typography",{className:s,style:o,styles:i,classNames:r}),unstyled:c.unstyled,ref:e,children:m.jsx(x.Box,{component:Uc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i}),...a})}):m.jsx(x.Box,{component:Uc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i,className:s,style:o}),...a})});aa.classes=An;aa.displayName="@mantine/tiptap/RichTextEditorContent";function fe(n){return m.jsx("svg",{...n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}function _1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),m.jsx("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})]})}function B1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 5l6 0"}),m.jsx("path",{d:"M7 19l6 0"}),m.jsx("path",{d:"M14 5l-4 14"})]})}function F1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),m.jsx("path",{d:"M5 19h14"})]})}function z1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l14 0"}),m.jsx("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})]})}function $1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 15l4 4m0 -4l-4 4"}),m.jsx("path",{d:"M7 6v-1h11v1"}),m.jsx("path",{d:"M7 19l4 0"}),m.jsx("path",{d:"M13 5l-4 14"})]})}function V1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 18v-8l-2 2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function H1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function W1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),m.jsx("path",{d:"M17 16a2 2 0 1 0 2 -2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function Y1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 18v-8l-4 6h5"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function q1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function U1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z"}),m.jsx("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function K1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 6l11 0"}),m.jsx("path",{d:"M9 12l11 0"}),m.jsx("path",{d:"M9 18l11 0"}),m.jsx("path",{d:"M5 6l0 .01"}),m.jsx("path",{d:"M5 12l0 .01"}),m.jsx("path",{d:"M5 18l0 .01"})]})}function J1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 6h9"}),m.jsx("path",{d:"M11 12h9"}),m.jsx("path",{d:"M12 18h8"}),m.jsx("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),m.jsx("path",{d:"M6 10v-6l-2 2"})]})}function G1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 22v-2"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),m.jsx("path",{d:"M20 17h2"}),m.jsx("path",{d:"M2 7h2"}),m.jsx("path",{d:"M7 2v2"})]})}function X1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M6 15h15"}),m.jsx("path",{d:"M21 19h-15"}),m.jsx("path",{d:"M15 11h6"}),m.jsx("path",{d:"M21 7h-6"}),m.jsx("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),m.jsx("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})]})}function Q1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l10 0"}),m.jsx("path",{d:"M4 18l14 0"})]})}function Z1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M10 12l10 0"}),m.jsx("path",{d:"M6 18l14 0"})]})}function ev(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M8 12l8 0"}),m.jsx("path",{d:"M6 18l12 0"})]})}function tv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l16 0"}),m.jsx("path",{d:"M4 18l12 0"})]})}function nv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function rv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function yh(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 8l-4 4l4 4"}),m.jsx("path",{d:"M17 8l4 4l-4 4"}),m.jsx("path",{d:"M14 4l-4 16"})]})}function sv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),m.jsx("path",{d:"M12.5 5.5l4 4"}),m.jsx("path",{d:"M4.5 13.5l4 4"}),m.jsx("path",{d:"M21 15v4h-8l4 -4z"})]})}function ov(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12h2"}),m.jsx("path",{d:"M17 12h2"}),m.jsx("path",{d:"M11 12h2"})]})}function bh(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73"}),m.jsx("path",{d:"M3 3l18 18"})]})}function iv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 7l6 6"}),m.jsx("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]})}function lv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M18 6l-12 12"}),m.jsx("path",{d:"M6 6l12 12"})]})}function av(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),m.jsx("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}function cv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function uv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"})]})}function dv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),m.jsx("path",{d:"M11 13l9 -9"}),m.jsx("path",{d:"M15 4h5v5"})]})}function fv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 14l-4 -4l4 -4"}),m.jsx("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"})]})}function hv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M15 14l4 -4l-4 -4"}),m.jsx("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"})]})}function pv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M11 6l9 0"}),m.jsx("path",{d:"M11 12l9 0"}),m.jsx("path",{d:"M11 18l9 0"})]})}function mv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-11 0"}),m.jsx("path",{d:"M20 12l-7 0"}),m.jsx("path",{d:"M20 18l-11 0"}),m.jsx("path",{d:"M4 8l4 4l-4 4"})]})}function gv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-7 0"}),m.jsx("path",{d:"M20 12l-9 0"}),m.jsx("path",{d:"M20 18l-7 0"}),m.jsx("path",{d:"M8 8l-4 4l4 4"})]})}function yv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914
193
193
  a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18
194
- a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const bv={interactive:!0},On=x.factory((n,e)=>{const t=x.useProps("RichTextEditorControl",bv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();return m.jsx(x.UnstyledButton,{...f,...h.getStyles("control",{className:s,style:o,classNames:r,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:a?0:-1,"data-interactive":a||void 0,"data-disabled":d||void 0,"data-active":c||void 0,"aria-pressed":c&&a||void 0,"aria-hidden":!a||void 0,ref:e,unstyled:h.unstyled,variant:h.variant||"default",onMouseDown:p=>{p.preventDefault(),u==null||u(p)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const ca=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});ca.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(ca,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const kv=me({label:"boldControlLabel",icon:n=>m.jsx(_1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),xv=me({label:"italicControlLabel",icon:n=>m.jsx(B1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),vv=me({label:"underlineControlLabel",icon:n=>m.jsx(F1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Sv=me({label:"strikeControlLabel",icon:n=>m.jsx(z1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Cv=me({label:"clearFormattingControlLabel",icon:n=>m.jsx($1,{...n}),operation:{name:"unsetAllMarks"}}),Mv=me({label:"unlinkControlLabel",icon:n=>m.jsx(G1,{...n}),operation:{name:"unsetLink"}}),wv=me({label:"bulletListControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Tv=me({label:"orderedListControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Ev=me({label:"h1ControlLabel",icon:n=>m.jsx(V1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Av=me({label:"h2ControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Ov=me({label:"h3ControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),Dv=me({label:"h4ControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Nv=me({label:"h5ControlLabel",icon:n=>m.jsx(q1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),Rv=me({label:"h6ControlLabel",icon:n=>m.jsx(U1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Lv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Iv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(Q1,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),jv=me({label:"alignRightControlLabel",icon:n=>m.jsx(Z1,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),Pv=me({label:"alignCenterControlLabel",icon:n=>m.jsx(ev,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),_v=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(tv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Bv=me({label:"subscriptControlLabel",icon:n=>m.jsx(nv,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Fv=me({label:"superscriptControlLabel",icon:n=>m.jsx(rv,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),zv=me({label:"codeControlLabel",icon:n=>m.jsx(yh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),$v=me({label:"codeBlockControlLabel",icon:n=>m.jsx(yh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),Vv=me({label:"highlightControlLabel",icon:n=>m.jsx(sv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Hv=me({label:"hrControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setHorizontalRule"}}),Wv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(bh,{...n}),operation:{name:"unsetColor"}}),Yv=me({label:"undoControlLabel",icon:n=>m.jsx(fv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),qv=me({label:"redoControlLabel",icon:n=>m.jsx(hv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Uv=me({label:"tasksControlLabel",icon:n=>m.jsx(pv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Kv=me({label:"tasksSinkLabel",icon:n=>m.jsx(mv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),Jv=me({label:"tasksLiftLabel",icon:n=>m.jsx(gv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),Gv=n=>m.jsx(uv,{...n}),ua=x.factory((n,e)=>{var $;const t=x.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=bp(""),[b,k]=T.useState(d),[M,{open:E,close:v}]=hl(!1),C=()=>{var V;E();const B=(V=h.editor)==null?void 0:V.getAttributes("link");y((B==null?void 0:B.href)||""),k(B!=null&&B.href?(B==null?void 0:B.target)==="_blank":d)},w=()=>{v(),y(""),k(d)},O=()=>{var B,V;w(),g===""?(B=h.editor)==null||B.chain().focus().extendMarkRange("link").unsetLink().run():(V=h.editor)==null||V.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},L=B=>{B.key==="Enter"&&(B.preventDefault(),O())};mp("edit-link",C,!1);const{resolvedClassNames:z,resolvedStyles:P}=x.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(x.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:M,onChange:B=>!B&&w(),offset:-44,zIndex:1e4,...c,children:[m.jsx(x.Popover.Target,{children:m.jsx(ca,{icon:a||Gv,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:C,active:($=h.editor)==null?void 0:$.isActive("link"),ref:e,classNames:z,styles:P,className:s,style:o,variant:h.variant})}),m.jsx(x.Popover.Dropdown,{...h.getStyles("linkEditorDropdown",p),children:m.jsxs("div",{...h.getStyles("linkEditor",p),children:[m.jsx(x.TextInput,{placeholder:h.labels.linkEditorInputPlaceholder,"aria-label":h.labels.linkEditorInputLabel,type:"url",value:g,onChange:y,classNames:{input:h.getStyles("linkEditorInput",p).className},onKeyDown:L,rightSection:m.jsx(x.Tooltip,{label:b?h.labels.linkEditorExternalLink:h.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:u,zIndex:1e4,children:m.jsx(x.UnstyledButton,{onClick:()=>k(B=>!B),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(dv,{style:{width:x.rem(14),height:x.rem(14)}})})})}),m.jsx(x.Button,{variant:"default",onClick:O,...h.getStyles("linkEditorSave",p),children:h.labels.linkEditorSave})]})})]})});ua.classes=An;ua.displayName="@mantine/tiptap/RichTextEditorLinkControl";const kh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=x.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=hl(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(M,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(M).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((M,E)=>m.jsx(x.ColorSwatch,{component:"button",color:M,onClick:()=>y(M),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(M),"aria-label":l.colorPickerColorLabel(M)},E));return m.jsxs(x.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:M=>!M&&f(),...t,children:[m.jsx(x.Popover.Target,{children:m.jsx(On,{...o,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,ref:e,onClick:d,children:m.jsx(x.ColorSwatch,{color:g,size:14})})}),m.jsxs(x.Popover.Dropdown,{...a("linkEditorDropdown"),children:[h==="palette"&&m.jsx(x.SimpleGrid,{cols:7,spacing:2,children:k}),h==="colorPicker"&&m.jsx(x.ColorPicker,{defaultValue:g,onChange:M=>y(M,!1),...s}),m.jsx(x.Tooltip.Group,{closeDelay:200,children:m.jsxs(x.Group,{justify:"flex-end",gap:"xs",mt:"sm",children:[h==="palette"&&m.jsx(x.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:m.jsx(lv,{style:{width:x.rem(16),height:x.rem(16)}})}),m.jsx(x.ActionIcon,{variant:"default",onClick:b,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:m.jsx(bh,{style:{width:x.rem(16),height:x.rem(16)}})}),h==="palette"?m.jsx(x.ActionIcon,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:m.jsx(iv,{style:{width:x.rem(16),height:x.rem(16)}})}):m.jsx(x.ActionIcon,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:m.jsx(av,{style:{width:x.rem(16),height:x.rem(16)}})}),h==="colorPicker"&&m.jsx(x.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:m.jsx(cv,{style:{width:x.rem(16),height:x.rem(16)}})})]})})]})]})});kh.displayName="@mantine/tiptap/ColorPickerControl";const xh=T.forwardRef((n,e)=>{const{color:t,...r}=x.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...r,variant:i,active:l===t,"aria-label":a,title:a,onClick:()=>(s==null?void 0:s.chain()).focus().setColor(t).run(),ref:e,children:m.jsx(x.ColorSwatch,{color:t,size:14})})});xh.displayName="@mantine/tiptap/RichTextEditorColorControl";const Xv={},vh=T.forwardRef((n,e)=>{const{...t}=x.useProps("RichTextEditorSourceCodeControl",Xv,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(yv,{style:{width:x.rem(16),height:x.rem(16)}})})});vh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const da=x.factory((n,e)=>{const t=x.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(x.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});da.classes=An;da.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const fa=x.factory((n,e)=>{const t=x.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();return m.jsx(x.Box,{ref:e,mod:[{sticky:a},u],variant:d||h.variant,...h.getStyles("toolbar",{className:s,style:o,styles:i,classNames:r}),...f,__vars:{"--rte-sticky-offset":x.rem(c)}})});fa.classes=An;fa.displayName="@mantine/tiptap/RichTextEditorToolbar";const Qv={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},W=x.factory((n,e)=>{const t=x.useProps("RichTextEditor",Qv,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=x.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),M=T.useMemo(()=>({...j1,...h}),[h]);return m.jsx(P1,{value:{editor:c,getStyles:k,labels:M,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(x.Box,{...k("root"),...b,ref:e,children:p})})});W.classes=An;W.displayName="@mantine/tiptap/RichTextEditor";W.Content=aa;W.Control=On;W.Toolbar=fa;W.ControlsGroup=da;W.Bold=kv;W.Italic=xv;W.Strikethrough=Sv;W.Underline=vv;W.ClearFormatting=Cv;W.H1=Ev;W.H2=Av;W.H3=Ov;W.H4=Dv;W.H5=Nv;W.H6=Rv;W.BulletList=wv;W.OrderedList=Tv;W.Link=ua;W.Unlink=Mv;W.Blockquote=Lv;W.AlignLeft=Iv;W.AlignRight=jv;W.AlignCenter=Pv;W.AlignJustify=_v;W.Superscript=Fv;W.Subscript=Bv;W.Code=zv;W.CodeBlock=$v;W.ColorPicker=kh;W.Color=xh;W.Highlight=Vv;W.Hr=Hv;W.UnsetColor=Wv;W.Undo=Yv;W.Redo=qv;W.TaskList=Uv;W.TaskListSink=Kv;W.TaskListLift=Jv;W.SourceCode=vh;function Zv({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=zk({editable:!r&&!s,extensions:[M1,e1,Px,R1,I1,A1,D1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs(W,{editor:o,h:400,children:[m.jsxs(W.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Bold,{}),m.jsx(W.Italic,{}),m.jsx(W.Underline,{}),m.jsx(W.Strikethrough,{}),m.jsx(W.ClearFormatting,{}),m.jsx(W.Highlight,{}),m.jsx(W.Code,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.H1,{}),m.jsx(W.H2,{}),m.jsx(W.H3,{}),m.jsx(W.H4,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Blockquote,{}),m.jsx(W.Hr,{}),m.jsx(W.BulletList,{}),m.jsx(W.OrderedList,{}),m.jsx(W.Subscript,{}),m.jsx(W.Superscript,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Link,{}),m.jsx(W.Unlink,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.AlignLeft,{}),m.jsx(W.AlignCenter,{}),m.jsx(W.AlignJustify,{}),m.jsx(W.AlignRight,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Undo,{}),m.jsx(W.Redo,{})]})]}),m.jsx(W.Content,{})]})}function eS({field:n,form:e}){const t=n,r=e.getInputProps(t.name),s=t.readOnly===!0,o=t.disabled===!0;return s||o?m.jsx(x.Select,{data:t.data,value:r.value,disabled:o||s,readOnly:s,placeholder:t.placeholder,required:t.required,variant:s?"filled":"default",error:void 0}):m.jsx(x.Select,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function tS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.Switch,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(x.Switch,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function nS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.TagsInput,{value:t.value||[],readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(x.TagsInput,{value:t.value||[],onChange:o=>t.onChange(o),required:n.required,placeholder:n.placeholder,error:void 0})}function rS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.TextInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(x.TextInput,{...t,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function sS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=typeof t.value=="string"?t.value:"",i=T.useRef(null),l=m.jsx(x.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var a;return(a=i.current)==null?void 0:a.showPicker()},children:"⏰"});return r||s?m.jsx(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}function Sh({field:n,form:e,children:t}){const{error:r}=e.getInputProps(n.name);return m.jsxs(x.Stack,{gap:4,children:[n.label&&m.jsxs(x.Text,{fw:500,size:"sm",mb:2,component:"label",htmlFor:n.name,style:{display:"block"},children:[n.label," ",n.required&&m.jsx(x.Text,{component:"span",c:"red",fz:"sm",children:"*"})]}),m.jsx(x.Box,{children:t}),n.description&&m.jsx(x.Text,{size:"xs",c:"dimmed",mt:2,style:{lineHeight:1.4},children:n.description}),r&&m.jsx(x.Text,{size:"xs",c:"red",mt:2,style:{fontWeight:500},children:r})]})}function oS(n){const{layout:e,field:{required:t,...r},form:s}=n;let o=null;switch(r.type){case"text":o=m.jsx(rS,{field:r,form:n.form});break;case"select":o=m.jsx(eS,{field:r,form:n.form});break;case"object":o=m.jsx(vm,{field:r,form:s,layout:e});break;case"array":o=m.jsx(Qh,{field:r,form:s,layout:e});break;case"checkbox":o=m.jsx(Zh,{field:r,form:s});break;case"number":o=m.jsx(xm,{field:r,form:s});break;case"date":o=m.jsx(bm,{field:r,form:s});break;case"datetime":o=m.jsx(km,{field:r,form:s});break;case"switch":o=m.jsx(tS,{field:r,form:s});break;case"texteditor":o=m.jsx(Zv,{field:r,form:s});break;case"time":o=m.jsx(sS,{field:r,form:s});break;case"tags":o=m.jsx(nS,{field:r,form:s});break;default:o=m.jsxs("div",{children:["Unsupported field type: ",r.type]});break}return m.jsx(Sh,{field:r,form:s,children:o})}class jo{constructor(){ga(this,"next")}setNext(e){return this.next=e,e}handle(e,t){var r;return this.canHandle(e)?this.render(e,t):((r=this.next)==null?void 0:r.handle(e,t))??null}}class iS extends jo{constructor(e){super(),this.layout=e}canHandle(){return!0}render(e,t){return m.jsx(oS,{field:e,form:t,layout:this.layout})}}class lS extends jo{constructor(e){super(),this.customFieldTypes=e}canHandle(e){return!!this.customFieldTypes[e.type]}render(e,t){return this.customFieldTypes[e.type](e,t)}}class aS extends jo{constructor(e){super(),this.fieldRenderers=e}canHandle(e){return!!this.fieldRenderers[e.name]}render(e,t){return this.fieldRenderers[e.name](e,t)}}class cS extends jo{constructor(e){super(),this.typeRenderers=e}canHandle(e){return!!this.typeRenderers[e.type]}render(e,t){return this.typeRenderers[e.type](e,t)}}const Po=n=>{const{field:e,form:t,customFieldRenderers:r,customTypeRenderers:s,customFieldTypes:o,layout:i="grid"}=n,l=new aS(r??{}),a=new cS(s??{}),c=new iS(i),u=new lS(o??{});return l.setNext(a).setNext(u).setNext(c),l.handle(e,t)},uS=T.forwardRef(function({schema:e,currentValues:t,initialValues:r,layout:s="vertical",readOnly:o,validate:i,onSubmit:l,onFieldChange:a,updateFieldSchema:c,preFill:u=M=>M,preSubmit:d=M=>M,postSubmit:f=()=>{},submitButton:h=!0,customFieldRenderers:p,customFieldTypes:g,customTypeRenderers:y,loading:b},k){const[M,E]=T.useState(!1),v=Gh({validate:i,enhanceGetInputProps(P){return{onFieldChange:async $=>{var B;P.inputProps.onChange($),await((B=a==null?void 0:a[P.field.replace(/\.\d+\./g,".")])==null?void 0:B.call(a,P.field,$,v))}}}}),C=cl[s],w=(P,$,B)=>P.map(V=>{if(V.type==="object"||V.type==="array"){const K=B==null?void 0:B[V.name];return{...V,fields:w(V.fields,$||{},K)}}const G=B==null?void 0:B[V.name];return G?G(V,$):V}),O=T.useMemo(()=>{if(!c)return e;const P=v.getValues();return w(e,P,c)},[e,v.values,c]),L=v.onSubmit(async P=>{const $=Di(e,P);if(Object.keys($).length){v.setErrors($);return}const B=await d(P);await l(B),f(B)});T.useImperativeHandle(k,()=>({submit:()=>L(),reset:P=>z(P),validate:()=>{const P=v.validate();return Object.keys(P.errors).length===0},getValues:()=>v.getValues(),setValues:P=>v.setValues(P),getFieldValue:P=>v.getInputProps(P).value,setFieldValue:(P,$)=>v.setFieldValue(P,$),isValid:()=>Object.keys(v.validate().errors).length===0,isDirty:()=>v.isDirty(),isLoading:()=>M}));async function z(P){if(P){E(!0);try{const $=typeof P=="function"?await P():P;console.log("test",$);const B=await u($),V=ul(e,B);v.setValues(V),v.setDirty(V)}finally{E(!1)}}}return T.useEffect(()=>{z(r||{})},[]),T.useEffect(()=>{z(t)},[t]),m.jsx(Xh,{value:{customFieldRenderers:p,customTypeRenderers:y,customFieldTypes:g},children:m.jsxs("form",{onSubmit:L,style:{position:"relative"},children:[m.jsx(x.LoadingOverlay,{visible:M||b}),C(m.jsx(m.Fragment,{children:O.map(P=>{const $={...P,readOnly:P.readOnly||o};return $.visible===!1?null:m.jsx(oo,{field:$,layout:s,children:m.jsx(Po,{field:$,form:v,customFieldRenderers:p,customTypeRenderers:y,customFieldTypes:g,layout:s})},$.name)})})),!M&&m.jsx(m.Fragment,{children:typeof h=="boolean"?h?m.jsx(x.Group,{justify:"flex-end",mt:"md",children:m.jsx(x.Button,{type:"submit",loading:b,children:"Submit"})}):null:h})]})})});exports.AutoForm=uS;exports.DefaultFieldRender=Sh;exports.FieldLayoutWrapper=oo;exports.FieldRendererResolver=Po;exports.useRenderers=al;
194
+ a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const bv={interactive:!0},On=x.factory((n,e)=>{const t=x.useProps("RichTextEditorControl",bv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();return m.jsx(x.UnstyledButton,{...f,...h.getStyles("control",{className:s,style:o,classNames:r,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:a?0:-1,"data-interactive":a||void 0,"data-disabled":d||void 0,"data-active":c||void 0,"aria-pressed":c&&a||void 0,"aria-hidden":!a||void 0,ref:e,unstyled:h.unstyled,variant:h.variant||"default",onMouseDown:p=>{p.preventDefault(),u==null||u(p)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const ca=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});ca.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(ca,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const kv=me({label:"boldControlLabel",icon:n=>m.jsx(_1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),xv=me({label:"italicControlLabel",icon:n=>m.jsx(B1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),vv=me({label:"underlineControlLabel",icon:n=>m.jsx(F1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Sv=me({label:"strikeControlLabel",icon:n=>m.jsx(z1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Cv=me({label:"clearFormattingControlLabel",icon:n=>m.jsx($1,{...n}),operation:{name:"unsetAllMarks"}}),Mv=me({label:"unlinkControlLabel",icon:n=>m.jsx(G1,{...n}),operation:{name:"unsetLink"}}),wv=me({label:"bulletListControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Tv=me({label:"orderedListControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Ev=me({label:"h1ControlLabel",icon:n=>m.jsx(V1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Av=me({label:"h2ControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Ov=me({label:"h3ControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),Dv=me({label:"h4ControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Nv=me({label:"h5ControlLabel",icon:n=>m.jsx(q1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),Rv=me({label:"h6ControlLabel",icon:n=>m.jsx(U1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Lv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Iv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(Q1,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),jv=me({label:"alignRightControlLabel",icon:n=>m.jsx(Z1,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),Pv=me({label:"alignCenterControlLabel",icon:n=>m.jsx(ev,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),_v=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(tv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Bv=me({label:"subscriptControlLabel",icon:n=>m.jsx(nv,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Fv=me({label:"superscriptControlLabel",icon:n=>m.jsx(rv,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),zv=me({label:"codeControlLabel",icon:n=>m.jsx(yh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),$v=me({label:"codeBlockControlLabel",icon:n=>m.jsx(yh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),Vv=me({label:"highlightControlLabel",icon:n=>m.jsx(sv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Hv=me({label:"hrControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setHorizontalRule"}}),Wv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(bh,{...n}),operation:{name:"unsetColor"}}),Yv=me({label:"undoControlLabel",icon:n=>m.jsx(fv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),qv=me({label:"redoControlLabel",icon:n=>m.jsx(hv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Uv=me({label:"tasksControlLabel",icon:n=>m.jsx(pv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Kv=me({label:"tasksSinkLabel",icon:n=>m.jsx(mv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),Jv=me({label:"tasksLiftLabel",icon:n=>m.jsx(gv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),Gv=n=>m.jsx(uv,{...n}),ua=x.factory((n,e)=>{var $;const t=x.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=bp(""),[b,k]=T.useState(d),[M,{open:E,close:v}]=hl(!1),C=()=>{var V;E();const B=(V=h.editor)==null?void 0:V.getAttributes("link");y((B==null?void 0:B.href)||""),k(B!=null&&B.href?(B==null?void 0:B.target)==="_blank":d)},w=()=>{v(),y(""),k(d)},O=()=>{var B,V;w(),g===""?(B=h.editor)==null||B.chain().focus().extendMarkRange("link").unsetLink().run():(V=h.editor)==null||V.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},L=B=>{B.key==="Enter"&&(B.preventDefault(),O())};mp("edit-link",C,!1);const{resolvedClassNames:z,resolvedStyles:P}=x.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(x.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:M,onChange:B=>!B&&w(),offset:-44,zIndex:1e4,...c,children:[m.jsx(x.Popover.Target,{children:m.jsx(ca,{icon:a||Gv,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:C,active:($=h.editor)==null?void 0:$.isActive("link"),ref:e,classNames:z,styles:P,className:s,style:o,variant:h.variant})}),m.jsx(x.Popover.Dropdown,{...h.getStyles("linkEditorDropdown",p),children:m.jsxs("div",{...h.getStyles("linkEditor",p),children:[m.jsx(x.TextInput,{placeholder:h.labels.linkEditorInputPlaceholder,"aria-label":h.labels.linkEditorInputLabel,type:"url",value:g,onChange:y,classNames:{input:h.getStyles("linkEditorInput",p).className},onKeyDown:L,rightSection:m.jsx(x.Tooltip,{label:b?h.labels.linkEditorExternalLink:h.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:u,zIndex:1e4,children:m.jsx(x.UnstyledButton,{onClick:()=>k(B=>!B),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(dv,{style:{width:x.rem(14),height:x.rem(14)}})})})}),m.jsx(x.Button,{variant:"default",onClick:O,...h.getStyles("linkEditorSave",p),children:h.labels.linkEditorSave})]})})]})});ua.classes=An;ua.displayName="@mantine/tiptap/RichTextEditorLinkControl";const kh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=x.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=hl(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(M,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(M).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((M,E)=>m.jsx(x.ColorSwatch,{component:"button",color:M,onClick:()=>y(M),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(M),"aria-label":l.colorPickerColorLabel(M)},E));return m.jsxs(x.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:M=>!M&&f(),...t,children:[m.jsx(x.Popover.Target,{children:m.jsx(On,{...o,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,ref:e,onClick:d,children:m.jsx(x.ColorSwatch,{color:g,size:14})})}),m.jsxs(x.Popover.Dropdown,{...a("linkEditorDropdown"),children:[h==="palette"&&m.jsx(x.SimpleGrid,{cols:7,spacing:2,children:k}),h==="colorPicker"&&m.jsx(x.ColorPicker,{defaultValue:g,onChange:M=>y(M,!1),...s}),m.jsx(x.Tooltip.Group,{closeDelay:200,children:m.jsxs(x.Group,{justify:"flex-end",gap:"xs",mt:"sm",children:[h==="palette"&&m.jsx(x.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:m.jsx(lv,{style:{width:x.rem(16),height:x.rem(16)}})}),m.jsx(x.ActionIcon,{variant:"default",onClick:b,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:m.jsx(bh,{style:{width:x.rem(16),height:x.rem(16)}})}),h==="palette"?m.jsx(x.ActionIcon,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:m.jsx(iv,{style:{width:x.rem(16),height:x.rem(16)}})}):m.jsx(x.ActionIcon,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:m.jsx(av,{style:{width:x.rem(16),height:x.rem(16)}})}),h==="colorPicker"&&m.jsx(x.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:m.jsx(cv,{style:{width:x.rem(16),height:x.rem(16)}})})]})})]})]})});kh.displayName="@mantine/tiptap/ColorPickerControl";const xh=T.forwardRef((n,e)=>{const{color:t,...r}=x.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...r,variant:i,active:l===t,"aria-label":a,title:a,onClick:()=>(s==null?void 0:s.chain()).focus().setColor(t).run(),ref:e,children:m.jsx(x.ColorSwatch,{color:t,size:14})})});xh.displayName="@mantine/tiptap/RichTextEditorColorControl";const Xv={},vh=T.forwardRef((n,e)=>{const{...t}=x.useProps("RichTextEditorSourceCodeControl",Xv,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(yv,{style:{width:x.rem(16),height:x.rem(16)}})})});vh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const da=x.factory((n,e)=>{const t=x.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(x.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});da.classes=An;da.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const fa=x.factory((n,e)=>{const t=x.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();return m.jsx(x.Box,{ref:e,mod:[{sticky:a},u],variant:d||h.variant,...h.getStyles("toolbar",{className:s,style:o,styles:i,classNames:r}),...f,__vars:{"--rte-sticky-offset":x.rem(c)}})});fa.classes=An;fa.displayName="@mantine/tiptap/RichTextEditorToolbar";const Qv={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},W=x.factory((n,e)=>{const t=x.useProps("RichTextEditor",Qv,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=x.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),M=T.useMemo(()=>({...j1,...h}),[h]);return m.jsx(P1,{value:{editor:c,getStyles:k,labels:M,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(x.Box,{...k("root"),...b,ref:e,children:p})})});W.classes=An;W.displayName="@mantine/tiptap/RichTextEditor";W.Content=aa;W.Control=On;W.Toolbar=fa;W.ControlsGroup=da;W.Bold=kv;W.Italic=xv;W.Strikethrough=Sv;W.Underline=vv;W.ClearFormatting=Cv;W.H1=Ev;W.H2=Av;W.H3=Ov;W.H4=Dv;W.H5=Nv;W.H6=Rv;W.BulletList=wv;W.OrderedList=Tv;W.Link=ua;W.Unlink=Mv;W.Blockquote=Lv;W.AlignLeft=Iv;W.AlignRight=jv;W.AlignCenter=Pv;W.AlignJustify=_v;W.Superscript=Fv;W.Subscript=Bv;W.Code=zv;W.CodeBlock=$v;W.ColorPicker=kh;W.Color=xh;W.Highlight=Vv;W.Hr=Hv;W.UnsetColor=Wv;W.Undo=Yv;W.Redo=qv;W.TaskList=Uv;W.TaskListSink=Kv;W.TaskListLift=Jv;W.SourceCode=vh;function Zv({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=zk({editable:!r&&!s,extensions:[M1,e1,Px,R1,I1,A1,D1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs(W,{editor:o,h:400,children:[m.jsxs(W.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Bold,{}),m.jsx(W.Italic,{}),m.jsx(W.Underline,{}),m.jsx(W.Strikethrough,{}),m.jsx(W.ClearFormatting,{}),m.jsx(W.Highlight,{}),m.jsx(W.Code,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.H1,{}),m.jsx(W.H2,{}),m.jsx(W.H3,{}),m.jsx(W.H4,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Blockquote,{}),m.jsx(W.Hr,{}),m.jsx(W.BulletList,{}),m.jsx(W.OrderedList,{}),m.jsx(W.Subscript,{}),m.jsx(W.Superscript,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Link,{}),m.jsx(W.Unlink,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.AlignLeft,{}),m.jsx(W.AlignCenter,{}),m.jsx(W.AlignJustify,{}),m.jsx(W.AlignRight,{})]}),m.jsxs(W.ControlsGroup,{children:[m.jsx(W.Undo,{}),m.jsx(W.Redo,{})]})]}),m.jsx(W.Content,{})]})}function eS({field:n,form:e}){const t=n,r=e.getInputProps(t.name),s=t.readOnly===!0,o=t.disabled===!0;return s||o?m.jsx(x.Select,{data:t.data,value:r.value,disabled:o||s,readOnly:s,placeholder:t.placeholder,required:t.required,variant:s?"filled":"default",error:void 0}):m.jsx(x.Select,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function tS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.Switch,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(x.Switch,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function nS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.TagsInput,{value:t.value||[],readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(x.TagsInput,{value:t.value||[],onChange:o=>t.onChange(o),required:n.required,placeholder:n.placeholder,error:void 0})}function rS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(x.TextInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(x.TextInput,{...t,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function sS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=typeof t.value=="string"?t.value:"",i=T.useRef(null),l=m.jsx(x.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var a;return(a=i.current)==null?void 0:a.showPicker()},children:"⏰"});return r||s?m.jsx(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}function Sh({field:n,form:e,children:t}){const{error:r}=e.getInputProps(n.name);return m.jsxs(x.Stack,{gap:4,children:[n.label&&m.jsxs(x.Text,{fw:500,size:"sm",mb:2,component:"label",htmlFor:n.name,style:{display:"block"},children:[n.label," ",n.required&&m.jsx(x.Text,{component:"span",c:"red",fz:"sm",children:"*"})]}),m.jsx(x.Box,{children:t}),n.description&&m.jsx(x.Text,{size:"xs",c:"dimmed",mt:2,style:{lineHeight:1.4},children:n.description}),r&&m.jsx(x.Text,{size:"xs",c:"red",mt:2,style:{fontWeight:500},children:r})]})}function oS(n){const{layout:e,field:{required:t,...r},form:s}=n;let o=null;switch(r.type){case"text":o=m.jsx(rS,{field:r,form:n.form});break;case"select":o=m.jsx(eS,{field:r,form:n.form});break;case"object":o=m.jsx(vm,{field:r,form:s,layout:e});break;case"array":o=m.jsx(Qh,{field:r,form:s,layout:e});break;case"checkbox":o=m.jsx(Zh,{field:r,form:s});break;case"number":o=m.jsx(xm,{field:r,form:s});break;case"date":o=m.jsx(bm,{field:r,form:s});break;case"datetime":o=m.jsx(km,{field:r,form:s});break;case"switch":o=m.jsx(tS,{field:r,form:s});break;case"texteditor":o=m.jsx(Zv,{field:r,form:s});break;case"time":o=m.jsx(sS,{field:r,form:s});break;case"tags":o=m.jsx(nS,{field:r,form:s});break;default:o=m.jsxs("div",{children:["Unsupported field type: ",r.type]});break}return m.jsx(Sh,{field:r,form:s,children:o})}class jo{constructor(){ga(this,"next")}setNext(e){return this.next=e,e}handle(e,t){var r;return this.canHandle(e)?this.render(e,t):((r=this.next)==null?void 0:r.handle(e,t))??null}}class iS extends jo{constructor(e){super(),this.layout=e}canHandle(){return!0}render(e,t){return m.jsx(oS,{field:e,form:t,layout:this.layout})}}class lS extends jo{constructor(e){super(),this.customFieldTypes=e}canHandle(e){return!!this.customFieldTypes[e.type]}render(e,t){return this.customFieldTypes[e.type](e,t)}}class aS extends jo{constructor(e){super(),this.fieldRenderers=e}canHandle(e){return!!this.fieldRenderers[e.name]}render(e,t){return this.fieldRenderers[e.name](e,t)}}class cS extends jo{constructor(e){super(),this.typeRenderers=e}canHandle(e){return!!this.typeRenderers[e.type]}render(e,t){return this.typeRenderers[e.type](e,t)}}const Po=n=>{const{field:e,form:t,customFieldRenderers:r,customTypeRenderers:s,customFieldTypes:o,layout:i="grid"}=n,l=new aS(r??{}),a=new cS(s??{}),c=new iS(i),u=new lS(o??{});return l.setNext(a).setNext(u).setNext(c),l.handle(e,t)},uS=T.forwardRef(function({schema:e,currentValues:t,initialValues:r,layout:s="vertical",readOnly:o,validate:i,onSubmit:l,onFieldChange:a,updateFieldSchema:c,preFill:u=M=>M,preSubmit:d=M=>M,postSubmit:f=()=>{},submitButton:h=!0,customFieldRenderers:p,customFieldTypes:g,customTypeRenderers:y,loading:b},k){const[M,E]=T.useState(!1),v=Gh({validate:i,enhanceGetInputProps(P){return{onFieldChange:async $=>{var B;P.inputProps.onChange($),await((B=a==null?void 0:a[P.field.replace(/\.\d+\./g,".")])==null?void 0:B.call(a,P.field,$,v))}}}}),C=cl[s],w=(P,$,B)=>P.map(V=>{if(V.type==="object"||V.type==="array"){const K=B==null?void 0:B[V.name];return{...V,fields:w(V.fields,$||{},K)}}const G=B==null?void 0:B[V.name];return G?G(V,$):V}),O=T.useMemo(()=>{if(!c)return e;const P=v.getValues();return w(e,P,c)},[e,v.values,c]),L=v.onSubmit(async P=>{const $=Di(e,P);if(Object.keys($).length){v.setErrors($);return}const B=await d(P);await l(B),f(B)});T.useImperativeHandle(k,()=>({submit:()=>L(),reset:P=>z(P),validate:()=>{const P=v.validate();return Object.keys(P.errors).length===0},getValues:()=>v.getValues(),setValues:P=>v.setValues(P),getFieldValue:P=>v.getInputProps(P).value,setFieldValue:(P,$)=>v.setFieldValue(P,$),isValid:()=>Object.keys(v.validate().errors).length===0,isDirty:()=>v.isDirty(),isLoading:()=>M}));async function z(P){if(P){E(!0);try{const $=typeof P=="function"?await P():P,B=await u($),V=ul(e,B);v.setValues(V),v.setDirty(V)}finally{E(!1)}}}return T.useEffect(()=>{z(r||{})},[]),T.useEffect(()=>{z(t)},[t]),m.jsx(Xh,{value:{customFieldRenderers:p,customTypeRenderers:y,customFieldTypes:g},children:m.jsxs("form",{onSubmit:L,style:{position:"relative"},children:[m.jsx(x.LoadingOverlay,{visible:M||b}),C(m.jsx(m.Fragment,{children:O.map(P=>{const $={...P,readOnly:P.readOnly||o};return $.visible===!1?null:m.jsx(oo,{field:$,layout:s,children:m.jsx(Po,{field:$,form:v,customFieldRenderers:p,customTypeRenderers:y,customFieldTypes:g,layout:s})},$.name)})})),!M&&m.jsx(m.Fragment,{children:typeof h=="boolean"?h?m.jsx(x.Group,{justify:"flex-end",mt:"md",children:m.jsx(x.Button,{type:"submit",loading:b,children:"Submit"})}):null:h})]})})});exports.AutoForm=uS;exports.DefaultFieldRender=Sh;exports.FieldLayoutWrapper=oo;exports.FieldRendererResolver=Po;exports.useRenderers=al;
package/dist/index.es.js CHANGED
@@ -23606,9 +23606,7 @@ const Va = (n) => {
23606
23606
  if (I) {
23607
23607
  w(!0);
23608
23608
  try {
23609
- const z = typeof I == "function" ? await I() : I;
23610
- console.log("test", z);
23611
- const P = await u(z), F = zl(e, P);
23609
+ const z = typeof I == "function" ? await I() : I, P = await u(z), F = zl(e, P);
23612
23610
  k.setValues(F), k.setDirty(F);
23613
23611
  } finally {
23614
23612
  w(!1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoforma",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "description": "AutoForma is a dynamic form builder based on Mantine and React",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",