var u=globalThis.__LEPTOS_TIPTAP_BRIDGE__;if(u==null||u.modules==null)throw new Error("leptos-tiptap bridge bindings are unavailable");var e=u.modules["@tiptap/core"];if(e==null)throw new Error('leptos-tiptap bridge module "@tiptap/core" is unavailable');var P=e.CommandManager,S=e.Editor,w=e.Extension,O=e.InputRule,N=e.Mark,k=e.Node,v=e.NodePos,B=e.NodeView,I=e.PasteRule,M=e.Tracker,D=e.callOrReturn,F=e.canInsertNode,L=e.combineTransactionSteps,j=e.createChainableState,H=e.createDocument,K=e.createNodeFromContent,q=e.createStyleTag,G=e.defaultBlockAt,z=e.deleteProps,J=e.elementFromString,V=e.escapeForRegEx,Y=e.extensions,$=e.findChildren,U=e.findChildrenInRange,W=e.findDuplicates,Q=e.findParentNode,X=e.findParentNodeClosestToPos,Z=e.fromString,ee=e.generateHTML,te=e.generateJSON,ne=e.generateText,oe=e.getAttributes,ie=e.getAttributesFromExtensions,re=e.getChangedRanges,se=e.getDebugJSON,ae=e.getExtensionField,le=e.getHTMLFromFragment,de=e.getMarkAttributes,ce=e.getMarkRange,pe=e.getMarkType,ue=e.getMarksBetween,ge=e.getNodeAtPosition,_e=e.getNodeAttributes,me=e.getNodeType,ke=e.getRenderedAttributes,xe=e.getSchema,be=e.getSchemaByResolvedExtensions,ye=e.getSchemaTypeByName,he=e.getSchemaTypeNameByName,fe=e.getSplittedAttributes,Ee=e.getText,Re=e.getTextBetween,Te=e.getTextContentFromNodes,Ae=e.getTextSerializersFromSchema,Ce=e.injectExtensionAttributesToParseRule,Pe=e.inputRulesPlugin,Se=e.isActive,we=e.isAtEndOfNode,Oe=e.isAtStartOfNode,Ne=e.isEmptyObject,ve=e.isExtensionRulesEnabled,Be=e.isFunction,Ie=e.isList,Me=e.isMacOS,De=e.isMarkActive,Fe=e.isNodeActive,Le=e.isNodeEmpty,je=e.isNodeSelection,He=e.isNumber,Ke=e.isPlainObject,qe=e.isRegExp,Ge=e.isSafari,ze=e.isString,Je=e.isTextSelection,Ve=e.isiOS,Ye=e.markInputRule,$e=e.markPasteRule,x=e.mergeAttributes,Ue=e.mergeDeep,We=e.minMax,Qe=e.nodeInputRule,Xe=e.nodePasteRule,Ze=e.objectIncludes,et=e.pasteRulesPlugin,tt=e.posToDOMRect,nt=e.removeDuplicates,ot=e.resolveFocusPosition,it=e.rewriteUnknownContent,rt=e.selectionToInsertionEnd,st=e.splitExtensions,at=e.textInputRule,lt=e.textPasteRule,dt=e.textblockTypeInputRule,b=e.wrappingInputRule;var T=/^\s*(\[([( |x])?\])\s$/,y=k.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:t=>{let r=t.getAttribute("data-checked");return r===""||r==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:r}){return["li",x(this.options.HTMLAttributes,r,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:r,getPos:a,editor:l})=>{let s=document.createElement("li"),d=document.createElement("label"),R=document.createElement("span"),o=document.createElement("input"),g=document.createElement("div"),_=()=>{var n,i;o.ariaLabel=((i=(n=this.options.a11y)===null||n===void 0?void 0:n.checkboxLabel)===null||i===void 0?void 0:i.call(n,t,o.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return _(),d.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",n=>n.preventDefault()),o.addEventListener("change",n=>{if(!l.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}let{checked:i}=n.target;l.isEditable&&typeof a=="function"&&l.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{let c=a();if(typeof c!="number")return!1;let p=m.doc.nodeAt(c);return m.setNodeMarkup(c,void 0,{...p?.attrs,checked:i}),!0}).run(),!l.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,i)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([n,i])=>{s.setAttribute(n,i)}),s.dataset.checked=t.attrs.checked,o.checked=t.attrs.checked,d.append(o,R),s.append(d,g),Object.entries(r).forEach(([n,i])=>{s.setAttribute(n,i)}),{dom:s,contentDOM:g,update:n=>n.type!==this.type?!1:(s.dataset.checked=n.attrs.checked,o.checked=n.attrs.checked,_(),!0)}}},addInputRules(){return[b({find:T,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});var h="__LEPTOS_TIPTAP_BRIDGE__";function A(){let t=globalThis,r=t[h];if(r!=null)return r;let a={modules:{},registerExtension:()=>{throw new Error("leptos-tiptap bridge runtime is not initialized")}};return t[h]=a,a}function f(){return A()}function E(t){f().registerExtension(t)}var C={name:"task_item",create:()=>y.configure({nested:!0})};function bt(){E(C)}export{bt as register_task_item};
