var o=globalThis.__LEPTOS_TIPTAP_BRIDGE__;if(o==null||o.modules==null)throw new Error("leptos-tiptap bridge bindings are unavailable");var t=o.modules["@tiptap/core"];if(t==null)throw new Error('leptos-tiptap bridge module "@tiptap/core" is unavailable');var b=t.CommandManager,h=t.Editor,y=t.Extension,f=t.InputRule,r=t.Mark,R=t.Node,E=t.NodePos,P=t.NodeView,T=t.PasteRule,A=t.Tracker,C=t.callOrReturn,S=t.canInsertNode,N=t.combineTransactionSteps,O=t.createChainableState,B=t.createDocument,w=t.createNodeFromContent,M=t.createStyleTag,v=t.defaultBlockAt,I=t.deleteProps,F=t.elementFromString,D=t.escapeForRegEx,H=t.extensions,j=t.findChildren,L=t.findChildrenInRange,K=t.findDuplicates,q=t.findParentNode,G=t.findParentNodeClosestToPos,z=t.fromString,J=t.generateHTML,U=t.generateJSON,V=t.generateText,Y=t.getAttributes,$=t.getAttributesFromExtensions,Q=t.getChangedRanges,W=t.getDebugJSON,X=t.getExtensionField,Z=t.getHTMLFromFragment,tt=t.getMarkAttributes,et=t.getMarkRange,nt=t.getMarkType,ot=t.getMarksBetween,it=t.getNodeAtPosition,rt=t.getNodeAttributes,st=t.getNodeType,lt=t.getRenderedAttributes,at=t.getSchema,dt=t.getSchemaByResolvedExtensions,pt=t.getSchemaTypeByName,ut=t.getSchemaTypeNameByName,ct=t.getSplittedAttributes,gt=t.getText,_t=t.getTextBetween,xt=t.getTextContentFromNodes,mt=t.getTextSerializersFromSchema,kt=t.injectExtensionAttributesToParseRule,bt=t.inputRulesPlugin,ht=t.isActive,yt=t.isAtEndOfNode,ft=t.isAtStartOfNode,Rt=t.isEmptyObject,Et=t.isExtensionRulesEnabled,Pt=t.isFunction,Tt=t.isList,At=t.isMacOS,Ct=t.isMarkActive,St=t.isNodeActive,Nt=t.isNodeEmpty,Ot=t.isNodeSelection,Bt=t.isNumber,wt=t.isPlainObject,Mt=t.isRegExp,vt=t.isSafari,It=t.isString,Ft=t.isTextSelection,Dt=t.isiOS,s=t.markInputRule,l=t.markPasteRule,a=t.mergeAttributes,Ht=t.mergeDeep,jt=t.minMax,Lt=t.nodeInputRule,Kt=t.nodePasteRule,qt=t.objectIncludes,Gt=t.pasteRulesPlugin,zt=t.posToDOMRect,Jt=t.removeDuplicates,Ut=t.resolveFocusPosition,Vt=t.rewriteUnknownContent,Yt=t.selectionToInsertionEnd,$t=t.splitExtensions,Qt=t.textInputRule,Wt=t.textPasteRule,Xt=t.textblockTypeInputRule,Zt=t.wrappingInputRule;var _=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,x=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,d=r.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",a(this.options.HTMLAttributes,e),0]},addCommands(){return{setHighlight:e=>({commands:n})=>n.setMark(this.name,e),toggleHighlight:e=>({commands:n})=>n.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[s({find:_,type:this.type})]},addPasteRules(){return[l({find:x,type:this.type})]}});var p="__LEPTOS_TIPTAP_BRIDGE__";function m(){let e=globalThis,n=e[p];if(n!=null)return n;let i={modules:{},registerExtension:()=>{throw new Error("leptos-tiptap bridge runtime is not initialized")}};return e[p]=i,i}function u(){return m()}function c(e){u().registerExtension(e)}function g(e){if(e?.color!=null)return{color:e.color}}var k={name:"highlight",create:()=>d.configure({multicolor:!0}),commands:{set_highlight:(e,n)=>n.kind==="set_highlight"?e.chain().focus().setHighlight(g(n.attributes)).run():!1,toggle_highlight:(e,n)=>n.kind==="toggle_highlight"?e.chain().focus().toggleHighlight(g(n.attributes)).run():!1,unset_highlight:e=>e.chain().focus().unsetHighlight().run()},selection_keys:["highlight"],selection_state:e=>({highlight:e.isActive("highlight")})};function ae(){c(k)}export{ae as register_highlight};
