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