/*! * PSPDFKit for Web 2023.5.2 (https://pspdfkit.com/web) * * Copyright (c) 2016-2023 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://pspdfkit.com/acknowledgements/web/ */ "use strict";(self.webpackChunkPSPDFKit=self.webpackChunkPSPDFKit||[]).push([[6377],{16288:(t,e,n)=>{n.r(e),n.d(e,{default:()=>K});var o=n(17375),s=n(84121),a=n(35369),r=n(47347),i=n(34997),c=n(77552),l=n(45513),d=n(93572),u=n(2810),h=n(28028),m=n(23413),p=n(45207),f=n(67628);class g extends(a.WV({authPayload:null,serverUrl:null,hostedBaseUrl:null,documentId:null,backendPermissions:null,documentURL:null,imageToken:null,instantSettings:null,token:null,features:(0,a.aV)(),signatureFeatureAvailability:f.H.NONE,isFormsEnabled:!0,minSearchQueryLength:1,documentHandle:null,isDocumentHandleOutdated:!1,digitalSignatures:null,defaultGroup:void 0,hasCollaborationPermissions:!1,forceLegacySignaturesFeature:!1})){}var w=n(53678),y=n(71231),P=n(92466),S=n(13997);const _="The image can not be rendered because of an unknown error.";class b{constructor(t){let{identifier:e,url:n,token:o,payload:s,doNotRequestWebP:a=!1}=t;this.identifier=e,this.url=n,this.token=o,this.payload=s,this.doNotRequestWebP=a}abort(){var t;null===(t=this.httpRequest)||void 0===t||t.abort()}request(){return new Promise(((t,e)=>{const n=new XMLHttpRequest;this.httpRequest=n,n.open(this.payload?"POST":"GET",this.url,!0),n.setRequestHeader("X-PSPDFKit-Image-Token",this.token),n.setRequestHeader("PSPDFKit-Platform","web"),n.setRequestHeader("PSPDFKit-Version",(0,S.oM)()),y.Zy&&!this.doNotRequestWebP&&n.setRequestHeader("Accept","image/webp,*/*"),n.responseType="blob",n.onreadystatechange=(async()=>{if(4!==n.readyState)return;if(n.response&&n.response.type.startsWith("application/json")){const o=new FileReader;return o.onload=n=>{var o;const s=JSON.parse(null===(o=n.target)||void 0===o?void 0:o.result);s.attachments_not_found?t({attachmentsNotFound:s.attachments_not_found}):s.error?"initialization_error"===s.error?t(null):e(new r.p2(`The server could not render the requested image (${s.error})`)):e(new r.p2(_))},o.onerror=()=>e(new r.p2(_)),void o.readAsText(n.response)}if(!(0,w.vu)(n.status))return void e(new r.p2(_));const o=n.response,s=URL.createObjectURL(o),a=new Image;a.onerror=()=>e(new r.p2(_)),a.src=s,await a.decode(),t(new P.Z(a,(()=>URL.revokeObjectURL(s))))}).bind(this),n.send(this.payload)}))}}var v=n(91859),F=n(4757),E=n(95651),R=n(30578),k=n(29346),$=n(89835);var T=n(70569),x=n(16554),O=n(13071),A=n(96617),D=n(46309),j=n(80488),U=n(4054),C=n(16126),I=n(60132),L=n(19815),N=n(63632),q=n(91039);const B=["color","fillColor","outlineColor"];function H(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function J(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:window;if(super(),e=this,(0,s.Z)(this,"_password",null),(0,s.Z)(this,"type","SERVER"),(0,s.Z)(this,"_requestRenderAnnotation",((t,n,o,s,a,c)=>{const l=`${this._state.documentURL}/render_annotation`,d=`render-annotation-${c?(0,i.SK)():t.id}`,h=JSON.stringify({data:(0,u.Hs)(t),width:s,height:a,detached:c||void 0,formFieldValue:n?(0,u.kr)(n):void 0});let m,p,f=!1,g=[];const w=new Promise(((t,e)=>{m=t,p=e}));return function n(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const c=new FormData;c.append("render",h),i.length>0&&"imageAttachmentId"in t&&t.imageAttachmentId&&o&&c.append(t.imageAttachmentId,o);const u=new b({identifier:d,url:l,token:e._state.imageToken,payload:c,doNotRequestWebP:s>v.pt||a>v.pt}),w=e._requestQueue.enqueue(u,!1);w.promise.then((t=>{f||(null!=t&&t.attachmentsNotFound?n(t.attachmentsNotFound):null!=t&&t.attachmentsNotFound?p(new r.p2("Attachment could not be found.")):m(t))})).catch((t=>{f||p(t)})),g.push(w)}(),{promise:w,cancel:()=>{f=!0,g.forEach((t=>{t.cancel()}))}}})),(0,s.Z)(this,"_requestRenderAnnotations",((t,e,n,o,s)=>{const a=`${this._state.documentURL}/render_annotations`,r=JSON.stringify({annotations:e.map(((e,s)=>({pageIndex:t,pdfObjectId:e,width:n[s],height:o[s]}))),formFieldValues:s});let i,c,l=!1;const d=new Promise(((t,e)=>{i=t,c=e}));return this._fetch(a,{method:"post",body:r,credentials:"include",headers:{"X-PSPDFKit-Image-Token":this._state.imageToken,"Content-Type":"application/json",Accept:"multipart/form-data"}}).then((t=>t.formData())).then((t=>{l||i(Array.from(t.values()))})).catch((t=>{l||c(t)})),{promise:d,cancel:()=>{l=!0}}})),(0,s.Z)(this,"handleDocumentHandleConflict",(()=>{this._state=this._state.set("isDocumentHandleOutdated",!0),this.cancelRequests(),this._destroyProvider()})),"object"!=typeof t.authPayload)throw new r.p2("authPayload must be an object that contains the `jwt`. For example: `authPayload: { jwt: 'xxx.xxx.xxx'}`");const a=null===(n=t.authPayload)||void 0===n?void 0:n.accessToken;let c=null,l=null,d=null;if(a)d=t.hostedBaseUrl||"https://api.pspdfkit.com/",(0,w.sf)(d),(0,h.eU)(a);else{if(c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;const n=t.serverUrl||(0,S.SV)(e.document);if("/"!==n.substr(-1))throw new r.p2("`serverUrl` must have a slash at the end (e.g. `https://pspdfkit.example.com/`).");if(!t.serverUrl){if(n===`${e.location.protocol}//${e.location.host}/`)throw new r.p2('PSPDFKit automatically infers the URL of PSPDFKit Server from the current `