/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../core/dist/index.js");var t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,i=e.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",e.mergeAttributes(this.options.HTMLAttributes,t)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,i,n,s,r,o;const l=null!=(i=null==(t=e.attrs)?void 0:t.src)?i:"",d=null!=(s=null==(n=e.attrs)?void 0:n.alt)?s:"",a=null!=(o=null==(r=e.attrs)?void 0:r.title)?o:"";return a?`![${d}](${l} "${a}")`:`![${d}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"undefined"==typeof document)return null;const{directions:t,minWidth:i,minHeight:n,alwaysPreserveAspectRatio:s}=this.options.resize;return({node:r,getPos:o,HTMLAttributes:l,editor:d})=>{const a=document.createElement("img");Object.entries(l).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:a.setAttribute(e,t)}}),a.src=l.src;const u=new e.ResizableNodeView({element:a,editor:d,node:r,getPos:o,onResize:(e,t)=>{a.style.width=`${e}px`,a.style.height=`${t}px`},onCommit:(e,t)=>{const i=o();void 0!==i&&this.editor.chain().setNodeSelection(i).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,i)=>e.type===r.type,options:{directions:t,min:{width:i,height:n},preserveAspectRatio:!0===s}}),c=u.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",a.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[e.nodeInputRule({find:t,type:this.type,getAttributes:e=>{const[,,t,i,n]=e;return{src:i,alt:t,title:n}}})]}}),n=i;exports.Image=i,exports.default=n,exports.inputRegex=t;