var u=globalThis.__LEPTOS_TIPTAP_BRIDGE__;if(u==null||u.modules==null)throw new Error("leptos-tiptap bridge bindings are unavailable");var t=u.modules["@tiptap/core"];if(t==null)throw new Error('leptos-tiptap bridge module "@tiptap/core" is unavailable');var P=t.CommandManager,S=t.Editor,O=t.Extension,N=t.InputRule,v=t.Mark,x=t.Node,w=t.NodePos,B=t.NodeView,I=t.PasteRule,M=t.Tracker,D=t.callOrReturn,F=t.canInsertNode,L=t.combineTransactionSteps,j=t.createChainableState,H=t.createDocument,K=t.createNodeFromContent,q=t.createStyleTag,G=t.defaultBlockAt,z=t.deleteProps,J=t.elementFromString,V=t.escapeForRegEx,Y=t.extensions,$=t.findChildren,U=t.findChildrenInRange,W=t.findDuplicates,Q=t.findParentNode,X=t.findParentNodeClosestToPos,Z=t.fromString,tt=t.generateHTML,et=t.generateJSON,nt=t.generateText,ot=t.getAttributes,it=t.getAttributesFromExtensions,rt=t.getChangedRanges,st=t.getDebugJSON,at=t.getExtensionField,lt=t.getHTMLFromFragment,dt=t.getMarkAttributes,ct=t.getMarkRange,pt=t.getMarkType,ut=t.getMarksBetween,gt=t.getNodeAtPosition,mt=t.getNodeAttributes,_t=t.getNodeType,xt=t.getRenderedAttributes,kt=t.getSchema,bt=t.getSchemaByResolvedExtensions,yt=t.getSchemaTypeByName,ht=t.getSchemaTypeNameByName,ft=t.getSplittedAttributes,Et=t.getText,Rt=t.getTextBetween,Tt=t.getTextContentFromNodes,At=t.getTextSerializersFromSchema,Ct=t.injectExtensionAttributesToParseRule,Pt=t.inputRulesPlugin,St=t.isActive,Ot=t.isAtEndOfNode,Nt=t.isAtStartOfNode,vt=t.isEmptyObject,wt=t.isExtensionRulesEnabled,Bt=t.isFunction,It=t.isList,Mt=t.isMacOS,Dt=t.isMarkActive,Ft=t.isNodeActive,Lt=t.isNodeEmpty,jt=t.isNodeSelection,Ht=t.isNumber,Kt=t.isPlainObject,qt=t.isRegExp,Gt=t.isSafari,zt=t.isString,Jt=t.isTextSelection,Vt=t.isiOS,Yt=t.markInputRule,$t=t.markPasteRule,k=t.mergeAttributes,Ut=t.mergeDeep,Wt=t.minMax,Qt=t.nodeInputRule,Xt=t.nodePasteRule,Zt=t.objectIncludes,te=t.pasteRulesPlugin,ee=t.posToDOMRect,ne=t.removeDuplicates,oe=t.resolveFocusPosition,ie=t.rewriteUnknownContent,re=t.selectionToInsertionEnd,se=t.splitExtensions,ae=t.textInputRule,le=t.textPasteRule,de=t.textblockTypeInputRule,b=t.wrappingInputRule;var T=/^\s*(\[([( |x])?\])\s$/,y=x.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let r=e.getAttribute("data-checked");return r===""||r==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:r}){return["li",k(this.options.HTMLAttributes,r,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes: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"),m=()=>{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,e,o.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return m(),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:_})=>{let c=a();if(typeof c!="number")return!1;let p=_.doc.nodeAt(c);return _.setNodeMarkup(c,void 0,{...p?.attrs,checked:i}),!0}).run(),!l.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([n,i])=>{s.setAttribute(n,i)}),s.dataset.checked=e.attrs.checked,o.checked=e.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,m(),!0)}}},addInputRules(){return[b({find:T,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}});var h="__LEPTOS_TIPTAP_BRIDGE__";function A(){let e=globalThis,r=e[h];if(r!=null)return r;let a={modules:{},registerExtension:()=>{throw new Error("leptos-tiptap bridge runtime is not initialized")}};return e[h]=a,a}function f(){return A()}function E(e){f().registerExtension(e)}var C={name:"task_item",create:()=>y.configure({nested:!0})};function be(){E(C)}export{be as register_task_item};
