/* esm.sh - @embedpdf/plugin-render@2.15.1 */
import{BasePlugin as l}from"../../../core@2.15.1/X-ZHJlYWN0LWRvbUAxOS4zLjEscmVhY3RAMTkuMy4x/es2022/core.mjs";var g=class extends l{constructor(e,n,t){super(e,n),this.config=t}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),renderPageRaw:e=>this.renderPageRaw(e),renderPageRectRaw:e=>this.renderPageRectRaw(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:n=>this.renderPage(n,e),renderPageRect:n=>this.renderPageRect(n,e),renderPageRaw:n=>this.renderPageRaw(n,e),renderPageRectRaw:n=>this.renderPageRectRaw(n,e)}}renderPage({pageIndex:e,options:n},t){let o=t??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!i?.document)throw new Error(`Document ${o} not loaded`);let r=i.document.pages.find(d=>d.index===e);if(!r)throw new Error(`Page ${e} not found in document ${o}`);let a={...n??{},withForms:n?.withForms??this.config.withForms??!1,withAnnotations:n?.withAnnotations??this.config.withAnnotations??!1,imageType:n?.imageType??this.config.defaultImageType??"image/png",imageQuality:n?.imageQuality??this.config.defaultImageQuality??.92};return this.engine.renderPage(i.document,r,a)}renderPageRect({pageIndex:e,rect:n,options:t},o){let i=o??this.getActiveDocumentId(),r=this.coreState.core.documents[i];if(!r?.document)throw new Error(`Document ${i} not loaded`);let a=r.document.pages.find(c=>c.index===e);if(!a)throw new Error(`Page ${e} not found in document ${i}`);let d={...t??{},withForms:t?.withForms??this.config.withForms??!1,withAnnotations:t?.withAnnotations??this.config.withAnnotations??!1,imageType:t?.imageType??this.config.defaultImageType??"image/png",imageQuality:t?.imageQuality??this.config.defaultImageQuality??.92};return this.engine.renderPageRect(r.document,a,n,d)}renderPageRaw({pageIndex:e,options:n},t){let o=t??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!i?.document)throw new Error(`Document ${o} not loaded`);let r=i.document.pages.find(d=>d.index===e);if(!r)throw new Error(`Page ${e} not found in document ${o}`);let a={...n??{},withForms:n?.withForms??this.config.withForms??!1,withAnnotations:n?.withAnnotations??this.config.withAnnotations??!1};return this.engine.renderPageRaw(i.document,r,a)}renderPageRectRaw({pageIndex:e,rect:n,options:t},o){let i=o??this.getActiveDocumentId(),r=this.coreState.core.documents[i];if(!r?.document)throw new Error(`Document ${i} not loaded`);let a=r.document.pages.find(c=>c.index===e);if(!a)throw new Error(`Page ${e} not found in document ${i}`);let d={...t??{},withForms:t?.withForms??this.config.withForms??!1,withAnnotations:t?.withAnnotations??this.config.withAnnotations??!1};return this.engine.renderPageRectRaw(r.document,a,n,d)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};g.id="render";var h=g,u="render",m={id:u,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},P={manifest:m,create:(s,e)=>new h(u,s,e),reducer:()=>{},initialState:{}};export{h as RenderPlugin,P as RenderPluginPackage};
//# sourceMappingURL=plugin-render.mjs.map