/*!
 * Nutrient Web SDK 1.14.0-ecbc0dc (https://www.nutrient.io/sdk/web)
 *
 * Copyright (c) 2016-2026 PSPDFKit GmbH. All rights reserved.
 *
 * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
 * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 * This notice may not be removed from this file.
 *
 * PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
 */
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[860],{62613(e,t,s){s.d(t,{GdPictureWorker:()=>o,getBrowserSpawner:()=>i});var r=s(89339);s(87308);new Set(["original","fixed","fit-width","fit-height","fit-max"]),new Set(["png","jpg","gif","bmp","tif"]);s(51371);"undefined"!=typeof WorkerGlobalScope&&(self,WorkerGlobalScope);var n=s(34724);const o=class{getModuleLoadPromise(){return this.moduleLoadPromise}constructor(e){let{baseUrl:t,aot:s,mainThreadOrigin:o,licenseKey:i,customFonts:a,dynamicFonts:d,fontSubstitutions:l,workerSpawner:u,wasmLoaderPath:c}=e;(0,n.A)(this,"requests",new Map),(0,n.A)(this,"nextRequestId",1),(0,n.A)(this,"handleMessage",e=>{const t=e.data,s=this.requests.get(t.id);(0,r.V1)(s,`No request was made for id ${t.id}.`);const{resolve:n,reject:o}=s;if(this.requests.delete(t.id),t.error){const e=new r.uE(t.error);e.callArgs=t.callArgs,o(e)}else n(t.result)}),this.workerSpawner=u,this.workerSpawner.setMessageHandler(this.handleMessage),this.moduleLoadPromise=this.sendRequest("loadModule",[c?{baseUrl:t,wasmLoaderPath:c}:t,s,o,i,a,d,l])}toOffice(e,t){return this.sendRequest("toOffice",[e,t])}toPdf(e){let t,{document:s,conformance:r,officeConversionSettings:n,contentType:o,extension:i}=e;return r&&(t=r.replace("pdf","pdf_").replaceAll("-","_")),this.sendRequest("toPdf",[s,t,n,o,i])}async populateDocumentTemplate(e,t){return this.sendRequest("populateDocumentTemplate",[e,t])}destroy(){this.workerSpawner?.terminate(),this.workerSpawner=null}async sendRequest(e,t){(0,r.V1)(this.workerSpawner,"GdPictureClient has been destroyed"),this.moduleLoadPromise&&await this.moduleLoadPromise;const s=this.workerSpawner;return new Promise((r,n)=>{const o=this.assignId(),i=[...t].filter(e=>e instanceof ArrayBuffer);s.postMessage({id:o,action:e,args:t},i),this.requests=this.requests.set(o,{resolve:r,reject:n})})}assignId(){const e=this.nextRequestId;return this.nextRequestId=this.nextRequestId+1,e}};const i=async function(){let e;if(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]){const{default:t}=await s.e(11).then(s.bind(s,55324));e=new t}else e=new Worker(s.tu(new URL(s.p+s.u(374),s.b)));return{setMessageHandler(t){(0,r.V1)(e,"Worker is null"),e.onmessage=t},postMessage(t,s){e?.postMessage(t,s)},terminate(){e?.terminate(),e=null}}}}}]);