@nutrient-sdk/viewer
Version:
View and annotate PDF files in your web app. Full support for mobile and desktop. Runs in the browser using WASM.
13 lines • 63.3 kB
JavaScript
/*!
* Nutrient Web SDK 1.20.0 (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([[750],{55660(e,t,r){r.r(t),r.d(t,{default:()=>re});var n=r(34724),s=r(49555),o=r(81806),i=r(53878),a=r(12403),l=r(84008),c=r(93688),u=r(14630),h=r(70274),d=r(40415),p=r(15971),m=r(70179),f=r(72835),E=r(49139),g=r(83121),w=r(44739);class y extends(s.mS({authPayload:null,serverUrl:null,hostedBaseUrl:null,documentId:null,layerName:null,sourcePdfSha256:null,backendPermissions:null,documentURL:null,imageToken:null,instantSettings:null,token:null,features:(0,s.B8)(),signatureFeatureAvailability:w.g.NONE,isFormsEnabled:!0,minSearchQueryLength:1,documentHandle:null,isDocumentHandleOutdated:!1,digitalSignatures:null,defaultGroup:void 0,hasCollaborationPermissions:!1,tileMaxScale:null,forceLegacySignaturesFeature:!1,disableWebAssemblyStreaming:!1,overrideMemoryLimit:null,baseCoreUrl:null,useDeprecatedRestProvider:!1,canvasRendering:!1})){}var R=r(64771),v=r(35538),I=r(2940),$=r(72742),S=r(47718),b=r(23519),A=r(28869);const P="The image can not be rendered because of an unknown error.";class _{constructor(e){let{identifier:t,url:r,authModule:s,payload:o,doNotRequestWebP:i=!1}=e;(0,n.A)(this,"_abortController",null),(0,n.A)(this,"aborted",!1),this.identifier=t,this.url=r,this.authModule=s,this.payload=o,this.doNotRequestWebP=i}abort(){this.aborted=!0,this._abortController?.abort(),this.httpRequest?.abort()}request(){var e=this;this.aborted=!1;const t=async function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const n=await(0,v.k)(e.authModule.getAuthState(),t=>{e._abortController=t});if(e.aborted)throw new DOMException("Aborted","AbortError");const s=n.imageToken;return new Promise((n,i)=>{const a=new XMLHttpRequest;e.httpRequest=a,a.open(e.payload?"POST":"GET",e.url,!0),a.setRequestHeader("X-PSPDFKit-Image-Token",s),a.setRequestHeader("PSPDFKit-Platform","web"),a.setRequestHeader("PSPDFKit-Version",(0,S._q)()),I.xd&&!e.doNotRequestWebP&&a.setRequestHeader("Accept","image/webp,*/*"),a.responseType="blob",a.onreadystatechange=(async()=>{if(4!==a.readyState)return;if(a.response&&a.response.type.startsWith("application/json")){const s=new FileReader;return s.onload=async s=>{const l=s.target?.result,c=JSON.parse(l);if(0!==r||(0,R.Nk)(a.status)||!A.r.isAuthFailure(a.status,l))c.attachments_not_found?n({attachmentsNotFound:c.attachments_not_found}):c.error?"initialization_error"===c.error?n(null):i(new o.uE(`The server could not render the requested image (${c.error})`)):i(new o.uE(P));else try{if(await e.authModule.refresh(),e.aborted)return void i(new DOMException("Aborted","AbortError"));const r=await t(1);n(r)}catch(e){i(e)}},s.onerror=()=>i(new o.uE(P)),void s.readAsText(a.response)}if(!(0,R.Nk)(a.status)){const s=a.response;let l="";if(s)try{l="function"==typeof s.text?await s.text():""}catch{l=""}return void(0===r&&A.r.isAuthFailure(a.status,l)?e.authModule.refresh().then(()=>{if(e.aborted)throw new DOMException("Aborted","AbortError");return t(1)}).then(n).catch(i):i(new o.uE(P)))}const s=a.response,l=URL.createObjectURL(s),c=new Image;c.onerror=()=>i(new o.uE(P)),c.src=l;const u=c.decode();try{await u}catch(e){if(!b.H8)throw new o.uE(`The image could not be decoded: ${e.message}`);await new Promise(e=>setTimeout(e,200))}n(new $.A(c,()=>URL.revokeObjectURL(l)))}).bind(e),a.send(e.payload)})};return t()}}var L=r(8709),N=r(57858),T=r(71769),O=r(48920),F=r(62559),x=r(13988),D=r(75038);var C=r(57939),U=r(16356),M=r(12388),j=r(21927),k=r(96804),G=r(940),V=r(40770),B=r(15858),H=r(25351),X=r(12412),z=r(99554),q=r(94228),W=r(76132),J=r(37083),Q=r(71264),K=r(85927),Y=r(71274),Z=r(61545);const ee=["ERR_HTTP2_PROTOCOL_ERROR","ERR_CONTENT_LENGTH_MISMATCH","NS_ERROR_NET_INTERRUPT","NS_ERROR_NET_RESET","NS_BINDING_ABORTED","Load failed","NetworkError"];function te(e){const t=e instanceof Error?e.message:String(e);return ee.some(e=>t.includes(e))}class re extends V.K{get tileMaxScale(){return this._state.tileMaxScale}constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;super(),t=this,(0,n.A)(this,"_password",null),(0,n.A)(this,"_authModule",null),(0,n.A)(this,"type","SERVER"),(0,n.A)(this,"_requestRenderAnnotation",(e,r,n,s,i,a,c)=>{if(!(0,N.F)(e.boundingBox))return{promise:Promise.resolve(void 0),cancel:()=>{}};const u=`${this._state.documentURL}/render_annotation`,h=`render-annotation-${a?(0,l.Z0)():e.id}`,d=JSON.stringify({data:(0,f.eq)(e),width:s,height:i,detached:a||void 0,formFieldValue:r?(0,f.cA)(r):void 0,render_form_highlight:void 0===c||c});let p=!1,m=[];const E=(0,Y.yl)();let g;if((0,N.cu)(e)){if(g=(0,N.sS)(e),this.isVisuallyIdenticalAnnotationCached({annotation:e,providedVisualAnnotationIndex:g,width:s,height:i}))return this.cachedRenderedAnnotationDiscardablePromise(g,E);this._addCachedRenderedAnnotation(g,{width:s,height:i,noZoom:e.noZoom,APStreamPromise:E.promise})}const w=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const a=new FormData;a.append("render",d),r.length>0&&"imageAttachmentId"in e&&e.imageAttachmentId&&n&&a.append(e.imageAttachmentId,n),r.length>0&&"widgetAttachmentId"in e&&e.widgetAttachmentId&&n&&a.append(e.widgetAttachmentId,n),(0,o.V1)(t._authModule,"AuthModule must be initialized before renderAnnotation");const l=new _({identifier:h,url:u,authModule:t._authModule,payload:a,doNotRequestWebP:s>L.HI||i>L.HI}),c=t._requestQueue.enqueue(l,!1);c.promise.then(r=>{if(p)return;if(r&&"object"==typeof r&&"attachmentsNotFound"in r&&Array.isArray(r.attachmentsNotFound))return void w(r.attachmentsNotFound);const n=r;return(0,N.cu)(e)&&t._makeEnqueuedRelease(n??null,g),E.resolve(n??void 0),n}).catch(e=>{const r=t._cachedRenderedAnnotations.get(g);r?.timeout&&clearTimeout(r.timeout),t._cachedRenderedAnnotations.delete(g),p?E.resolve(void 0):E.reject(e)}),m.push(c)};return w(),{promise:E.promise,cancel:()=>{p=!0,m.forEach(e=>{e.cancel()})}}}),(0,n.A)(this,"_requestRenderAnnotations",(e,t,r,n,s)=>{const o=`${this._state.documentURL}/render_annotations`,i=JSON.stringify({annotations:t.map((t,s)=>({pageIndex:e,pdfObjectId:t,width:r[s],height:n[s]})),formFieldValues:s});let a,l,c=!1;const u=new Promise((e,t)=>{a=e,l=t});return this._fetch(o,{method:"post",body:i,credentials:"include",useImageToken:!0,headers:{"Content-Type":"application/json",Accept:"multipart/form-data"}}).then(e=>e.formData()).then(e=>{c||a(Array.from(e.values()))}).catch(e=>{c||l(e)}),{promise:u,cancel:()=>{c=!0}}}),(0,n.A)(this,"handleDocumentHandleConflict",()=>{this._state=this._state.set("isDocumentHandleOutdated",!0),this.cancelRequests(),this._destroyProvider()});let s=null;if("session"in e){if("string"!=typeof e.session)throw new o.uE("The supplied session token is invalid. Must be a string.");s={jwt:e.session},e.instant=!("instant"in e)||"boolean"!=typeof e.instant&&!(0,o.Qd)(e.instant)||e.instant}else"authPayload"in e&&e.authPayload&&(s=e.authPayload);if("object"!=typeof s)throw new o.uE("authPayload must be an object that contains the `jwt`. For example: `authPayload: { jwt: 'xxx.xxx.xxx'}`");const i=s?.accessToken;let c=null,u=null,h="documentId"in e?e.documentId:null,d=null;if(i)d=e.hostedBaseUrl||"https://api.pspdfkit.com/",(0,R.Me)(d),(0,E.P1)(i);else{if(!s||"object"!=typeof s||!("jwt"in s)||"string"!=typeof s.jwt)throw new o.uE("authPayload must be an object that contains the `jwt`. For example: `authPayload: { jwt: 'xxx.xxx.xxx'}`");const{serverUrl:t,documentId:n}=(0,E.Gm)(s.jwt);if(c=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;const n=e.serverUrl||t||(0,S.$_)(r.document);if("/"!==n.substr(-1))throw new o.uE("`serverUrl` must have a slash at the end (e.g. `https://pspdfkit.example.com/`).");if(!e.serverUrl&&n===(0,R.ln)(r.location.origin))throw new o.uE('NutrientViewer automatically infers the URL of Nutrient Document Engine from the current `<script>` tag.\nIn the current case, this URL is set to the same as the current browser\'s location.\nThis can happen when you bundle nutrient-viewer.js with your custom JavaScript for example.\n\nTo make sure everything works as expected, please set the `serverUrl` to the URL of Nutrient Document Engine:\n\nNutrientViewer.load({\n serverUrl: "https://pspdfkit-server.example.com/",\n ...,\n});');return n}(e,t,r),h=h||n,"string"!=typeof h)throw new o.uE("`documentId` must be of type string.");u=`${c}i/d/${h}`}!function(e){let t="";if("boolean"!=typeof e&&((0,o.Qd)(e)?(e.hasOwnProperty("clientsPresenceEnabled")&&"boolean"!=typeof e.clientsPresenceEnabled&&(t+="`clientsPresenceEnabled` in instance settings is not valid. Must be `true` or `false`.\n"),e.hasOwnProperty("listenToServerChangesEnabled")&&"boolean"!=typeof e.listenToServerChangesEnabled&&(t+="`listenToServerChangesEnabled` in instance settings is not valid. Must be `true` or `false`.\n")):t="`instant` flag must either be set to `true` or `false`\n",t))throw new o.uE(`${t}\nFor more information about Nutrient Instant please visit:\nwww.nutrient.io/guides/web/instant/overview/`)}(e.instant);let p=null;if(e.instant)if((0,o.Qd)(e.instant)){const t=e.instant;p={clientsPresenceEnabled:!1!==t.clientsPresenceEnabled,listenToServerChangesEnabled:!1!==t.listenToServerChangesEnabled}}else p=M.S;this._requestQueue=new a.L(L.LB),this._onAuthFailed=e.onAuthFailed;const m=!!e.electronicSignatures&&Boolean(e.electronicSignatures.forceLegacySignaturesFeature),g=e.baseUrl||(0,S.$_)(window.document),w=e.baseCoreUrl||g;this._state=new y({serverUrl:c,hostedBaseUrl:d,documentId:h,instantSettings:p,documentURL:u,authPayload:s,isFormsEnabled:!e.disableForms,forceLegacySignaturesFeature:m,disableWebAssemblyStreaming:e.disableWebAssemblyStreaming,overrideMemoryLimit:e.overrideMemoryLimit,baseCoreUrl:w,useDeprecatedRestProvider:e.useDeprecatedRestProvider,canvasRendering:e.canvasRendering??!1}),e.useDeprecatedRestProvider&&(0,o.R8)("Token refresh (setSession, onAuthFailed) is not supported when using the deprecated REST provider. Use the default Instant provider for token refresh."),"trustedCAsCallback"in e&&e.trustedCAsCallback&&(0,o.R8)("NutrientViewer.Configuration#trustedCAsCallback is only used on Standalone deployments. On a Server-Backed deployment, please follow the instructions at https://www.nutrient.io/guides/web")}isUsingInstantProvider(){return!this._state.useDeprecatedRestProvider}setSession(e){this._authModule&&this._authModule.setSession(e)}hasClientsPresence(){const e=this._state.instantSettings;return null!=e&&!1!==e.clientsPresenceEnabled}async load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await this.tryAuthenticateHostedViewer();const t=await(0,C.Q)(`${this._state.serverUrl}i/d/${this._state.documentId}`,this._state.authPayload,e.password,e.signal);this._authModule=new A.r({serverUrl:this._state.serverUrl,documentId:this._state.documentId,authPayload:this._state.authPayload,password:e.password,onAuthFailed:this._onAuthFailed,onAuthStateUpdated:e=>{this._state=this._state.set("authPayload",e.authPayload);const t=this._state.documentHandle;e.layerHandle===t?this._state=this._state.set("documentURL",e.documentURL).set("documentHandle",e.layerHandle):this.handleDocumentHandleConflict()}}),this._authModule.initializeWithAuthResponse(t);const{imageToken:r,token:n,permissions:i,features:a,signatureFeatureAvailability:l,hasPassword:p,minSearchQueryLength:m,layerHandle:E,allowedTileScales:g,tileMaxScale:y,digitalSignatures:R,defaultGroup:v,collaborationPermissions:I,creatorName:$,documentEngineVersion:b,layerName:P,sourcePdfSha256:_}=t;this._password=e.password;const L=(0,c.valid)((0,c.coerce)(b));if(this.documentEngineVersion=L,!this.satisfiesDocumentEngineVersion(">=1.5.6"))throw new o.uE(`Document Engine version ${b} does not meet minimum required version requirement >=1.5.6.`);if(this._state.instantSettings&&!a.includes(j.Y.INSTANT))throw new o.uE("Instant feature is not enabled on this server. Please set `instant` to `false`.\n\nFor more information about Nutrient Instant please visit:\nwww.nutrient.io/guides/web/instant/overview/");if(this._state.useDeprecatedRestProvider&&this._state.instantSettings)throw new o.uE("Instant feature can't be enabled together with using deprecated REST provider. Please set either `instant` or `useDeprecatedRestProvider` to `false`.\n\nFor more information about Nutrient Instant please visit:\nwww.nutrient.io/guides/web/instant/overview/");const N=!a.includes(j.Y.INSTANT)&&!this.satisfiesDocumentEngineVersion(">=1.7.0"),T=l===w.g.ELECTRONIC_SIGNATURES&&(0,J.UX)(a)&&this._state.forceLegacySignaturesFeature?w.g.LEGACY_SIGNATURES:l,O=(0,d.Fi)(y)?y:null;null!=y&&null===O&&(0,o.z3)(`Ignoring invalid tileMaxScale from the Document Engine auth response: ${String(y)} (expected a number greater than 1). Server-backed tile sizes will not be clamped.`),this._state=this._state.withMutations(e=>e.set("imageToken",r).set("token",n).set("features",(0,s.B8)(a)).set("signatureFeatureAvailability",T).set("backendPermissions",new D.A({readOnly:-1===i.indexOf("write"),downloadingAllowed:i.indexOf("download")>=0})).set("documentURL",`${this._state.serverUrl}i/d/${this._state.documentId}/h/${E}`).set("documentHandle",E).set("isDocumentHandleOutdated",!1).set("digitalSignatures",(0,f.N5)(R)).set("layerName",P).set("sourcePdfSha256",_).set("tileMaxScale",O).set("useDeprecatedRestProvider",N||e.useDeprecatedRestProvider));(0,o.V1)(this._authModule,"AuthModule must be initialized before CorePDFDocument");const F=this._authModule;if(this.corePDFDocument=new K.N({corePDFAccessGetter:async()=>{const t=z.mG.checkOut().object,r=(0,S.f)(null),n=await(0,C.Q)(`${this._state.serverUrl}i/d/${this._state.documentId}`,this._state.authPayload,e.password);(0,o.V1)(n.wasmToken,"No wasmToken was returned from the server."),(0,o.V1)(this._state.baseCoreUrl),await t.loadNativeModule(this._state.baseCoreUrl,{mainThreadOrigin:r,disableWebAssemblyStreaming:this._state.disableWebAssemblyStreaming,enableAutomaticLinkExtraction:!1,overrideMemoryLimit:this._state.overrideMemoryLimit,workerSpawnerFn:()=>u.pj(!0)}).then(async()=>{t.load("",n.wasmToken,{mainThreadOrigin:r,productId:null})}),(0,o.V1)(t.workerSpawner,"Core workerSpawner is not initialized.");const s=t.workerSpawner.getWorker();return(0,o.V1)(s,"Core worker is not initialized."),h.LV(s)},canvasRendering:this._state.canvasRendering},{type:"serverDocument",documentId:this._state.documentId,authProvider:F,satifiesVersion:e=>this.satisfiesDocumentEngineVersion(e)}),I&&!this._state.instantSettings)throw new o.uE("Collaboration Permissions is not supported when `instant` is disabled. Please make sure `configuration#instant` is set to `true`.");this._state=this._state.withMutations(e=>{e.defaultGroup=v,e.hasCollaborationPermissions=Boolean(I)}),this.provider&&this.provider.destroy(),this.provider=await this._initProvider();const x=this.mapAuthResponseToClientInfo(t);return{features:this._state.features,signatureFeatureAvailability:this._state.signatureFeatureAvailability,hasPassword:p,password:this._password,minSearchQueryLength:m,allowedTileScales:g,creatorName:$,defaultGroup:v,clientInfo:x}}mapAuthResponseToClientInfo(e){const t=(0,q.o)();if(null===t)return null;if(!e.licenseEnvironment&&!e.licenseId&&!e.demoKeyId)return null;if("production"===e.licenseEnvironment&&!e.licenseId)return null;let r,n=W.n.EVALUATION;if(e.licenseEnvironment)switch(e.licenseEnvironment){case"production":n=W.n.PRODUCTION;break;case"development":n=W.n.DEVELOPMENT;break;case"demo":n=W.n.DEMO;break;default:n=W.n.EVALUATION}if(e.demoKeyId){const t=Number.parseInt(e.demoKeyId,10);Number.isNaN(t)||(r=t)}return{environment:n,productId:t,productVersion:"1.20.0",licenseId:e.licenseId,demoKeyId:r}}satisfiesDocumentEngineVersion(e){return!!this.documentEngineVersion&&(0,c.satisfies)(this.documentEngineVersion,e)}renderPagesBatchForPrint(e){const t=`${this._state.documentURL}/pages_render_batch_print`,r=new AbortController,n=new FormData;n.append("data",JSON.stringify(e));const s=this._fetch(t,{method:"POST",useImageToken:!0,body:n,signal:r.signal});s.catch(()=>{});let o=null;const i=[];let a=0,l=0,c=0,u=!1,h=!1;const d=e=>{i.push(e),c+=e.length},p=e=>{const t=new Uint8Array(e);let r=0;for(;r<e;){const n=i[a],s=n.length-l,o=e-r;s<=o?(t.set(n.subarray(l),r),r+=s,a+=1,l=0):(t.set(n.subarray(l,l+o),r),l+=o,r+=o)}return c-=e,a>1024&&(i.splice(0,a),a=0),t},m=()=>{if(c<12)return null;const e=new Uint8Array(12);let t=0,r=a,n=l;for(;t<12;){const s=i[r],o=Math.min(s.length-n,12-t);e.set(s.subarray(n,n+o),t),t+=o,n+=o,n>=s.length&&(r+=1,n=0)}const s=new DataView(e.buffer);return{pageIndex:s.getUint32(0),status:s.getUint32(4),len:s.getUint32(8)}},f=async()=>{for(await(async()=>{if(o)return;const e=await s;if(!e.body)throw new Error("Batch render response has no body");o=e.body.getReader()})();;){const e=m();if(e&&c>=12+e.len){p(12);const t=p(e.len);return{pageIndex:e.pageIndex,status:e.status,body:t}}if(u)return null;const{value:t,done:r}=await o.read();r?u=!0:t&&d(t)}};return{async next(){if(h)return{done:!0};const e=await f();if(!e)return{done:!0};if(0!==e.status)return{done:!1,kind:"error",pageIndex:e.pageIndex,error:(new TextDecoder).decode(e.body)};const t=await createImageBitmap(new Blob([e.body],{type:"image/png"}));return{done:!1,kind:"page",pageIndex:e.pageIndex,bitmap:t}},cancel(){h=!0,r.abort(),o?.cancel().catch(()=>{})}}}async tryAuthenticateHostedViewer(){if("accessToken"in this._state.authPayload){const{hostedBaseUrl:e}=this._state,t=this._state.authPayload.accessToken,{serverUrl:r,serverId:n,jwt:s}=await async function(e,t){const r=await fetch(`${e}i/documents/auth`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","PSPDFKit-Platform":"web","PSPDFKit-Version":"cloud-protocol=1, server-protocol=5, client=1.20.0, client-git=161e442f7a"},body:JSON.stringify({accessToken:t})});if(r.ok)return r.json();throw new Error(`An error occurred while connecting to PSPDFKit API: ${await r.text()}`)}(e,t);this._state=this._state.withMutations(e=>{e.set("serverUrl",r).set("documentId",n).set("documentURL",`${r}i/d/${n}`).set("authPayload",{jwt:s})})}}async _initProvider(){const e=this.satisfiesDocumentEngineVersion(i.PJ);if(this._state.useDeprecatedRestProvider){const t=this._state.isFormsEnabled&&this._state.features.includes(j.Y.FORMS),{RESTProvider:n}=await r.e(269).then(r.bind(r,85808));return new n(this._state.documentURL,{token:this._state.token},{isFormsEnabled:t,features:this._state.features,tabOrderSupported:e})}{const{InstantProvider:t}=await r.e(534).then(r.bind(r,14597));(0,o.V1)(this._authModule,"AuthModule must be initialized before InstantProvider");const n=new t(this._authModule,this._state.instantSettings||M.z,e);return n.setDocumentHandleConflictCallback(this.handleDocumentHandleConflict),n}}destroy(){this.corePDFDocument?.cancelRequests(),this._authModule?.destroy(),this._authModule=null,this._destroyProvider(),this._requestQueue?.destroy()}documentInfo(){return this._fetch(`${this._state.documentURL}/document.json`).then(e=>e.json()).then(e=>e.data)}getFormJSON(){return this._fetch(`${this._state.documentURL}/form.json`).then(e=>403===e.status?{v:1,type:"pspdfkit/form",annotations:[],fields:[]}:e.json().then(e=>e.data))}async evalFormValuesActions(){throw new Error("not implemented")}async evalScript(){throw new Error("not implemented")}async setFormJSONUpdateBatchMode(){throw new Error("not implemented")}compareDocuments(){throw new Error("not implemented")}updateButtonIcon(){throw new Error("not implemented")}permissions(){return Promise.resolve(this._state.backendPermissions)}getDefaultGroup(){return this._state.defaultGroup}isCollaborationPermissionsEnabled(){return this._state.hasCollaborationPermissions}textForPageIndex(e){return this.corePDFDocument.getTextLines(e)}async getSuggestedLineHeightFactor(){return 1}async getAnnotationsByScale(){return[]}getAvailableFontFaces(){throw new o.uE("Custom fonts need to be mounted on the server in Server-Backed deployments.")}getContentTreeForPageIndex(e){return this.corePDFDocument.getContentTree(e)}getTextFromRects(e,t){const r=encodeURIComponent(JSON.stringify(t.map(O.w).toArray()));return this._fetch(`${this._state.documentURL}/page-${e}-highlighted?rects=${r}`).then(e=>e.json()).then(e=>e.text)}_getJSONRequestHandler(){return g.A}renderAnnotation(e,t,r,n,s,o,i){return this._requestRenderAnnotation(e,t,r,n,s,!1,i)}async renderPageAnnotations(e,t,r){const n=this.provider,s=t.some(e=>e instanceof F.s);s&&await n._setReadStateCallbacksPromise;const i=[],a=[],l=new globalThis.Map,c=t.filter(e=>{const t=s?n._readStateCallbacks.getAnnotationWithFormField(e.id):null,r=t?.formField,o=(0,N.lG)(e,r);if(o&&r&&"number"==typeof e.pdfObjectId){i.find(e=>e.name===r.name)||(i.push((0,f.cA)((0,X.Af)(r))),a.push(r),l.set(r.name,n._readStateCallbacks?.getFormFieldRevision?.(r.name)??0))}return o&&"number"==typeof e.pdfObjectId});if(0===c.size&&0===i.length)return Promise.resolve();const u=new Promise((t,n)=>{const s=c.filter(e=>0!==Math.floor(e.boundingBox.width*r)&&0!==Math.floor(e.boundingBox.height*r)),{promise:u,cancel:h}=this._requestRenderAnnotations(e,s.map(e=>e.pdfObjectId).toArray(),s.map(e=>Math.floor(e.boundingBox.width*r)).toArray(),s.map(e=>Math.floor(e.boundingBox.height*r)).toArray(),i);u.then(e=>{const r=e.map((e,t)=>{const r=s.get(t);return(0,o.V1)(r),this.isWidgetPageRenderFresh(r,a,l)?e&&(0,H.BJ)(e)||Promise.resolve(null):Promise.resolve(void 0)});r.forEach(async(e,t)=>{const r=await e,n=s.get(t);if(n){const e=this.annotationAPStreamPromises.get(n.id),t=this.isWidgetPageRenderFresh(n,a,l);!t&&r&&r.release(),e&&(this.annotationAPStreamPromises=this.annotationAPStreamPromises.delete(n.id),e(t?r:void 0)),r&&t&&this.cacheAPStream(r,n)}}),Promise.all(r).then(()=>t())}).catch(e=>{this.resolvePendingAnnotationAPStreams(s.map(e=>e.id).toArray()),h(),n(e)})});return this.pageAPStreamsPromises=this.pageAPStreamsPromises.set(e,u),u}renderDetachedAnnotation(e,t,r,n){return this._requestRenderAnnotation(e,null,t,r,n,!0)}async getAttachment(e){try{const t=await this._fetch(`${this._state.documentURL}/attachments/${e}`);switch(t.status){case 404:throw new o.uE("Attachment not Found.");case 200:return await t.blob();default:throw new o.uE("Bad Request.")}}catch(e){throw new o.uE(`Could not fetch attachment from Nutrient Document Engine. ${e}`)}}async search(e,t,r,n){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:k.n.TEXT;const a=`q=${i===k.n.PRESET?e.replace(/_/g,"-"):encodeURIComponent(e)}&start=${t}&limit=${r}&type=${i}&include_annotations=${s.toString()}&case_sensitive=${n.toString()}`,l=`${this._state.documentURL}/search?${a}`;(0,o.V1)(this._authModule,"AuthModule must be initialized before search");const c=await new g.A(this._authModule,l).request();return(0,m.g)(c.data)}async getMeasurementSnappingPoints(e){}async searchAndRedact(e,t){const{searchType:r,annotationPreset:n,searchInAnnotations:o,caseSensitive:i,startPageIndex:a,pageRange:l}=t,{color:c,fillColor:u,outlineColor:h,...d}=n,p=await this._fetch(`${this._state.documentURL}/redactions`,{method:"post",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({strategy:r,strategyOptions:{[r]:r===k.n.PRESET?e.replace(/_/g,"-"):e,includeAnnotations:o,caseSensitive:i,...void 0!==a&&{start:a},...void 0!==l&&{limit:l}},content:{...d,color:c&&c.toHex(),fillColor:u&&u.toHex(),outlineColor:h&&h.toHex()}})}),{data:m}=await p.json(),f=(0,s.B8)(m.annotations?.filter(e=>!!e.content).map(e=>x.x.fromJSON(e.id,e.content))||[]);if(f.size){const e=this._state.instantSettings;!this.isUsingInstantProvider()||e&&e.listenToServerChangesEnabled||await this.syncChanges()}return f}async exportPDF(){let{flatten:e=!1,includeComments:t=!0,excludeAnnotations:r=!1,outputFormat:n=!1,optimize:s=!1,flattenElectronicSignatures:a=e,permissions:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e&&!1===a)throw new o.uE("Cannot set `flattenElectronicSignatures` to `false` when `flatten` is set to `true`.");(0,o.V1)(this._authModule,"AuthModule must be initialized before exportPDF");const c=`${this._state.documentURL}/pdf`,u=this.satisfiesDocumentEngineVersion(i.Bw),h={comments:String(t),render_ap_streams:String(!e),remove_annotations:String(r)};if(e?h.flatten=String(e):h.keep_signatures=String(!a),l){const e=l.userPassword??"",t=l.ownerPassword??"",r=l.documentPermissions??[];if(""!==e||""!==t||0!==r.length)throw new o.uE("Server-backed exportPDF only supports password stripping via `permissions` by setting `userPassword`, `ownerPassword`, and `documentPermissions` to empty values.");h.remove_password_protection="true"}if(s||n){const e={type:"pdf"};if(s){const t={documentFormat:"pdf",grayscaleText:!1,grayscaleGraphics:!1,grayscaleFormFields:!1,grayscaleAnnotations:!1,grayscaleImages:!1,disableImages:!1,mrcCompression:!1,imageOptimizationQuality:2,linearize:!1},r="boolean"!=typeof s?{...t,...s}:t;e.type=r.documentFormat,e.optimize={grayscaleText:r.grayscaleText,grayscaleGraphics:r.grayscaleGraphics,grayscaleFormFields:r.grayscaleFormFields,grayscaleAnnotations:r.grayscaleAnnotations,grayscaleImages:r.grayscaleImages,disableImages:r.disableImages,mrcCompression:r.mrcCompression,imageOptimizationQuality:r.imageOptimizationQuality,linearize:r.linearize}}if(n){const t={conformance:G.o.PDFA_2B,vectorization:!0,rasterization:!0},r="boolean"!=typeof n?{...t,...n}:t;e.type="pdfa",e.conformance=r.conformance,e.vectorization=r.vectorization,e.rasterization=r.rasterization}return this._fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include",includeAuthTokenInQuery:u},h).then(e=>e.arrayBuffer())}return this._fetch(c,{method:"GET",credentials:"include",includeAuthTokenInQuery:u},h).then(e=>e.arrayBuffer())}exportOffice(e){let{format:t}=e;const r=`${this._state.documentURL}/build`;return this._fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:[{document:{id:"#self"}}],output:{type:t.toLowerCase()}}),credentials:"include"}).then(e=>e.arrayBuffer()).catch(e=>{throw new o.uE(`Exporting to Office failed: ${e.message}`)})}exportXFDF(e){let t={};return null!=e&&(t={ignorePageRotation:e.toString()}),this._fetch(`${this._state.documentURL}/document.xfdf`,{},t).then(e=>e.text())}exportInstantJSON(e){return this._fetch(`${this._state.documentURL}/instant.json${"number"==typeof e?`?version=${e}`:""}`).then(e=>e.json())}getAnchoringPagePrimitives(){return Promise.reject(new o.uE("Anchoring page primitive extraction is only supported in standalone mode."))}getPDFURL(){let{includeComments:e=!0,excludeAnnotations:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,o.V1)(this._authModule,"AuthModule must be initialized before getPDFURL"),{promise:this._authModule.getAuthState().then(r=>`${r.documentURL}/pdf?token=${r.token}&flatten=true&comments=${String(e)}&remove_annotations=${String(t)}`),revoke:()=>{}}}generatePDFObjectURL(){let e,{includeComments:t=!0,excludeAnnotations:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;return{promise:new Promise(s=>{this.exportPDF({flatten:!0,includeComments:t,excludeAnnotations:r}).then(t=>{if(n)return;const r=new Blob([t],{type:"application/pdf"});e=window.URL.createObjectURL(r),s(e)})}),revoke:()=>{e&&window.URL.revokeObjectURL(e),n=!0}}}async getDocumentOutline(){let e;try{e=(await this._fetch(`${this._state.documentURL}/outline.json`).then(e=>e.json())).data}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)throw t;const r=t?.status,n=t?.body;if("number"==typeof r&&"string"==typeof n&&A.r.isAuthFailure(r,n))throw t;if(t instanceof Error&&t.message.startsWith("Auth "))throw t;e={}}const t=Array.isArray(e.outline)?e.outline:[];return(0,s.B8)(t.map(T.r))}async setDocumentOutline(){throw new o.uE("Not implemented in Server backend.")}async getPageGlyphs(){throw new o.uE("Not implemented in Server backend.")}onKeystrokeEvent(){throw new Error("not implemented")}async getMeasurementScales(){let e;try{return e=(await this._fetch(`${this._state.documentURL}/measurement_content_formats`).then(e=>e.json())).data,e}catch(e){throw new o.uE(`Fetching measurement scales failed: ${e}`)}}async getSecondaryMeasurementUnit(){let e;try{return e=(await this._fetch(`${this._state.documentURL}/secondary_measurement_unit`).then(e=>e.json())).data,e}catch(e){throw new o.uE(`Fetching secondary measurement unit failed: ${e}`)}}async setSecondaryMeasurementUnit(e){try{const t=JSON.stringify({unitTo:e?e.unitTo:null,precision:e?e.precision:null});await this._fetch(`${this._state.documentURL}/secondary_measurement_unit`,{method:"post",body:t,credentials:"include",headers:{"Content-Type":"application/json"}})}catch(e){throw new o.uE(`Setting secondary measurement unit failed: ${e}`)}}async addMeasurementScale(e){try{const t=JSON.stringify((0,p.U)(e));await this._fetch(`${this._state.documentURL}/measurement_content_formats`,{method:"post",body:t,credentials:"include",headers:{"Content-Type":"application/json"}})}catch(e){throw new o.uE(`Adding a new measurement scale failed: ${e}`)}}async removeMeasurementScale(e){try{const t=JSON.stringify((0,p.U)(e));await this._fetch(`${this._state.documentURL}/measurement_content_formats/delete`,{method:"post",body:t,credentials:"include",headers:{"Content-Type":"application/json"}})}catch(e){throw new o.uE(`Removing scale failed: ${e}`)}}async applyOperationsAndReload(e){try{const t=await ne(e);this._destroyProvider(),await this._fetch(`${this._state.documentURL}/apply-operations`,{method:"post",body:t,credentials:"include"})}catch(e){throw(0,Z.RG)("Applying operations failed",e)}return this.reloadDocument()}async applyRedactionsAndReload(){try{return this._destroyProvider(),await this._fetch(`${this._state.documentURL}/redact`,{method:"post",credentials:"include"}),this.reloadDocument()}catch(e){throw this.provider.load(),new o.uE(`Applying redactions failed: ${e}`)}}async reloadDocument(){this.clearRenderedAnnotationsCache();try{return await this.load({password:this._password})}catch(e){throw new o.uE(`Reloading the document failed: ${e}`)}}async exportPDFWithOperations(e){try{const t=await ne(e);return await async function(e){let t=1;for(;;){const r=await e();try{return await r.arrayBuffer()}catch(e){if(3===t||!te(e))throw e;(0,o.R8)(`Retrying /pdf-with-operations export after a truncated response from an older Document Engine deployment (${t}/3): ${e}`),t+=1,await new Promise(e=>setTimeout(e,200))}}}(()=>this._fetch(`${this._state.documentURL}/pdf-with-operations`,{method:"post",body:t,credentials:"include"}))}catch(e){throw new o.uE(`Exporting PDF with operations failed: ${e}`)}}async setSignaturesLTV(e){throw new Error("not implemented")}async getSignaturesInfo(){return this._refreshSignaturesInfoPromise&&await this._refreshSignaturesInfoPromise,this._state.digitalSignatures}refreshSignaturesInfo(){return this._refreshSignaturesInfoPromise||(this._refreshSignaturesInfoPromise=new Promise((e,t)=>{this._fetch(`${this._state.documentURL}/signatures`,{method:"get",credentials:"include"}).then(e=>e.json()).then(t=>{let{data:r}=t;this._state=this._state.set("digitalSignatures",(0,f.N5)(r)),this._refreshSignaturesInfoPromise=null,e()}).catch(e=>{this._state=this._state.set("digitalSignatures",null),this._refreshSignaturesInfoPromise=null,t(e)})})),this._refreshSignaturesInfoPromise}async signDocumentAndReload(e,t){(0,o.V1)(void 0===t||"object"==typeof t,"Signing service data must be an object if specified.");try{if(void 0!==t&&"object"!=typeof t)throw new o.uE("Signing service data must be an object if specified.");(0,Q.r6)(e);const r=e?{..."placeholderSize"in e?{estimatedSize:e.placeholderSize}:null,..."flatten"in e?{flatten:e.flatten}:null,...e?.signatureMetadata?{signatureMetadata:(0,f.sZ)(e.signatureMetadata)}:null,..."position"in e?{position:(0,f.qN)(e.position)}:null,..."appearance"in e?{appearance:await(0,f.z8)(e.appearance)}:null,..."formFieldName"in e?{formFieldName:e.formFieldName}:null,...void 0!==e?.signingData&&"signatureContainer"in e.signingData?{signatureContainer:e.signingData.signatureContainer}:null,...void 0!==e?.signingData&&"signatureType"in e.signingData?{signatureType:f.xz[e.signingData.signatureType]}:null}:null,n=e?.appearance?.watermarkImage||null,s=e?.appearance?.graphicImage||null,i={...t?{signingToken:t.signingToken}:null,...r},a=new FormData;if(a.append("data",JSON.stringify(i)),n&&a.append("image",n),s&&a.append("graphicImage",s),this._destroyProvider(),await this._fetch(`${this._state.documentURL}/sign`,{method:"post",body:a,credentials:"include"}),await this.reloadDocument(),e?.formFieldName)return e.formFieldName}catch(e){throw this.provider.load(),new o.uE(`Adding digital signature failed: ${e.message||e}`)}}async setFontSubstitutions(e){try{const t=`${this._state.documentURL}/font-substitutions`;await this._fetch(t,{method:"put",body:JSON.stringify({fontSubstitutions:e}),credentials:"include",headers:{"Content-Type":"application/json"}})}catch(e){throw new o.uE(`Error setting font substitution: ${e.message}`)}}getDocumentHandle(){return this._state.documentHandle}async getEmbeddedFiles(){const e=await this._fetch(`${this._state.documentURL}/embedded-files`,{method:"get",credentials:"include"}),{data:t}=await e.json();return(0,s.B8)(t?.embeddedFiles?.map(e=>{let{id:t,content:r}=e;return(0,B.r)(t,r)})||[])}cancelRequests(){this.corePDFDocument?.cancelRequests(),this._requestQueue.cancelAll()}_destroyProvider(){this.provider&&(this.provider._clients?.disconnect(),this.provider.destroy())}async _fetch(e,t,r){var n=this;const s=t?.includeAuthTokenInQuery??!1,i=t?.useImageToken??!1,{includeAuthTokenInQuery:a,useImageToken:l,...c}=t??{},u=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,o.V1)(n._authModule,"AuthModule must be initialized before _fetch");const a=await function(e,t){if(!t)return e.getAuthState();if(t.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let r=null;const n=new Promise((e,n)=>{r=()=>n(new DOMException("Aborted","AbortError")),t.addEventListener("abort",r,{once:!0})});return Promise.race([e.getAuthState(),n]).finally(()=>{r&&(t.removeEventListener("abort",r),r=null)})}(n._authModule,c.signal),l=i?"X-PSPDFKit-Image-Token":"X-PSPDFKit-Token",h=i?a.imageToken:a.token,d=new URLSearchParams(r||{});s&&!i&&d.set("token",h);const p=d.toString()?`${e}${e.includes("?")?"&":"?"}${d.toString()}`:e,m={};c.headers instanceof Headers?c.headers.forEach((e,t)=>{m[t]=e}):Array.isArray(c.headers)?c.headers.forEach(e=>{let[t,r]=e;m[t]=r}):"object"==typeof c.headers&&null!==c.headers&&Object.assign(m,c.headers),Object.keys(m).forEach(e=>{const t=e.toLowerCase();t!==l.toLowerCase()&&"pspdfkit-platform"!==t&&"pspdfkit-version"!==t||delete m[e]});const f={...m,[l]:h,"PSPDFKit-Platform":"web","PSPDFKit-Version":(0,S._q)()},E=await fetch(p,{...c,headers:f});if(!E.ok){const e=await function(e){const t=()=>"function"==typeof e.text?e.text():Promise.resolve("");return t().then(e=>{try{return JSON.parse(e)}catch{return e}})}(E),r="object"==typeof e&&null!=e?"reason"in e?e.reason:"errors"in e?function(e){if(!Array.isArray(e))return null;const t=e.map(e=>{if("string"==typeof e)return e;if("object"==typeof e&&null!=e){const{reason:t,detail:r,message:n}=e,s=t??r??n;return"string"==typeof s?s:null}return null}).filter(e=>null!=e&&""!==e);return t.length>0?t.join("; "):null}(e.errors):null:"string"==typeof e?e:null,s=(null!=r&&""!==r?String(r):null)||`${E.status??""} ${E.statusText??""}`.trim()||"Unknown error",i="object"==typeof e&&null!=e?JSON.stringify(e):"string"==typeof e?e:"";if(n._authModule&&A.r.isAuthFailure(E.status,i)&&0===t){try{await n._authModule.refresh()}catch(e){const t=e instanceof Error?e.message:String(e);throw new o.uE(`Auth refresh failed: ${t}`)}return u(1)}throw Object.assign(new o.uE(s),{status:E.status,body:i})}return E};return u()}syncChanges(){return this.provider.syncChanges()}async clearAPStreamCache(){}async runPDFFormattingScripts(){return[]}async runPDFFormattingScriptsFromWidgets(){return this.runPDFFormattingScripts()}async lazyLoadPages(){}async contentEditorReload(){return this._destroyProvider(),this.reloadDocument()}getOCGs(){throw new Error("not implemented")}getOCGVisibilityState(){throw new Error("not implemented")}setOCGVisibilityState(){throw new Error("not implemented")}async timestampData(e,t){throw new Error("not implemented")}async waitUntilFullyLoaded(e){throw new Error("not implemented")}}async function ne(e){const t={},r=new WeakMap,n=await Promise.all(e.map(async(e,n)=>{if("importDocument"===e.type){const s=e.document;return(0,o.V1)(s instanceof File||s instanceof Blob,"Wrong `importDocument` operation `document` value: it must be a File or a Blob"),(0,U.g)(r,t,s,e,n,"document")}if("applyInstantJson"===e.type){const s=e.instantJson;(0,o.V1)("object"==typeof s&&null!==s,"Wrong `applyInstantJson` operation `instantJson` value: it must be an object");const i=JSON.stringify(s),a=new Blob([i],{type:"application/json"});return(0,U.g)(r,t,a,e,n,"dataFilePath")}if("applyXfdf"===e.type){const s=e.xfdf;(0,o.V1)("string"==typeof s,"Wrong `applyXfdf` operation `xfdf` value: it must be a string");const i=new Blob([s],{type:"application/vnd.adobe.xfdf"});return(0,U.g)(r,t,i,e,n,"dataFilePath")}return e})),s=new FormData;s.append("operations",JSON.stringify({operations:n}));for(const e in t)s.append(e,t[e]);return s}},12388(e,t,r){r.d(t,{S:()=>n,z:()=>s});const n={clientsPresenceEnabled:!0,listenToServerChangesEnabled:!0},s={clientsPresenceEnabled:!1,listenToServerChangesEnabled:!1}},76595(e,t,r){const n=Symbol("SemVer ANY");class s{static get ANY(){return n}constructor(e,t){if(t=o(t),e instanceof s){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),c("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(e){const t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new u(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(c("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new h(e.value,t).test(this.value):""===e.operator?""===e.value||new h(this.value,t).test(e.semver):(!(t=o(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=s;const o=r(14948),{safeRe:i,t:a}=r(86431),l=r(90870),c=r(76887),u=r(75403),h=r(69854)},69854(e,t,r){const n=/\s+/g;class s{constructor(e,t){if(t=i(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(e.raw,t);if(e instanceof a)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(n," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&w(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&E))+":"+e,r=o.get(t);if(r)return r;const n=this.options.loose,s=n?u[h.HYPHENRANGELOOSE]:u[h.HYPHENRANGE];e=e.replace(s,N(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(u[h.COMPARATORTRIM],d),l("comparator trim",e),e=e.replace(u[h.TILDETRIM],p),l("tilde trim",e),e=e.replace(u[h.CARETTRIM],m),l("caret trim",e);let i=e.split(" ").map(e=>R(e,this.options)).join(" ").split(/\s+/).map(e=>L(e,this.options));n&&(i=i.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(u[h.COMPARATORLOOSE])))),l("range list",i);const c=new Map,w=i.map(e=>new a(e,this.options));for(const e of w){if(g(e))return[e];c.set(e.value,e)}c.size>1&&c.has("")&&c.delete("");const y=[...c.values()];return o.set(t,y),y}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some(r=>y(r,t)&&e.set.some(e=>y(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(T(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const o=new(r(70295)),i=r(14948),a=r(76595),l=r(76887),c=r(75403),{safeRe:u,t:h,comparatorTrimReplace:d,tildeTrimReplace:p,caretTrimReplace:m}=r(86431),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:E}=r(79549),g=e=>"<0.0.0-0"===e.value,w=e=>""===e.value,y=(e,t)=>{let r=!0;const n=e.slice();let s=n.pop();for(;r&&n.length;)r=n.every(e=>s.intersects(e,t)),s=n.pop();return r},R=(e,t)=>(e=e.replace(u[h.BUILD],""),l("comp",e,t),e=S(e,t),l("caret",e),e=I(e,t),l("tildes",e),e=A(e,t),l("xrange",e),e=_(e,t),l("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,I=(e,t)=>e.trim().split(/\s+/).map(e=>$(e,t)).join(" "),$=(e,t)=>{const r=t.loose?u[h.TILDELOOSE]:u[h.TILDE];return e.replace(r,(t,r,n,s,o)=>{let i;return l("tilde",e,t,r,n,s,o),v(r)?i="":v(n)?i=`>=${r}.0.0 <${+r+1}.0.0-0`:v(s)?i=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(l("replaceTilde pr",o),i=`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`):i=`>=${r}.${n}.${s} <${r}.${+n+1}.0-0`,l("tilde return",i),i})},S=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{l("caret",e,t);const r=t.loose?u[h.CARETLOOSE]:u[h.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,s,o,i)=>{let a;return l("caret",e,t,r,s,o,i),v(r)?a="":v(s)?a=`>=${r}.0.0${n} <${+r+1}.0.0-0`:v(o)?a="0"===r?`>=${r}.${s}.0${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${n} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),a="0"===r?"0"===s?`>=${r}.${s}.${o}-${i} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}-${i} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o}-${i} <${+r+1}.0.0-0`):(l("no pr"),a="0"===r?"0"===s?`>=${r}.${s}.${o}${n} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o} <${+r+1}.0.0-0`),l("caret return",a),a})},A=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>P(e,t)).join(" ")),P=(e,t)=>{e=e.trim();const r=t.loose?u[h.XRANGELOOSE]:u[h.XRANGE];return e.replace(r,(r,n,s,o,i,a)=>{l("xRange",e,r,n,s,o,i,a);const c=v(s),u=c||v(o),h=u||v(i),d=h;return"="===n&&d&&(n=""),a=t.includePrerelease?"-0":"",c?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(o=0),i=0,">"===n?(n=">=",u?(s=+s+1,o=0,i=0):(o=+o+1,i=0)):"<="===n&&(n="<",u?s=+s+1:o=+o+1),"<"===n&&(a="-0"),r=`${n+s}.${o}.${i}${a}`):u?r=`>=${s}.0.0${a} <${+s+1}.0.0-0`:h&&(r=`>=${s}.${o}.0${a} <${s}.${+o+1}.0-0`),l("xRange return",r),r})},_=(e,t)=>(l("replaceStars",e,t),e.trim().replace(u[h.STAR],"")),L=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?h.GTE0PRE:h.GTE0],"")),N=e=>(t,r,n,s,o,i,a,l,c,u,h,d)=>`${r=v(n)?"":v(s)?`>=${n}.0.0${e?"-0":""}`:v(o)?`>=${n}.${s}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=v(c)?"":v(u)?`<${+c+1}.0.0-0`:v(h)?`<${c}.${+u+1}.0-0`:d?`<=${c}.${u}.${h}-${d}`:e?`<${c}.${u}.${+h+1}-0`:`<=${l}`}`.trim(),T=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==a.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},75403(e,t,r){const n=r(76887),{MAX_LENGTH:s,MAX_SAFE_INTEGER:o}=r(79549),{safeRe:i,t:a}=r(86431),l=r(14948),{compareIdentifiers:c}=r(28628);class u{constructor(e,t){if(t=l(t),e instanceof u){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>s)throw new TypeError(`version is longer than ${s} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?i[a.LOOSE]:i[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<o)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof u)){if("string"==typeof e&&e===this.version)return 0;e=new u(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof u||(e=new u(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof u||(e=new u(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],s=e.prerelease[t];if(n("prerelease compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return c(r,s)}while(++t)}compareBuild(e){e instanceof u||(e=new u(e,this.options));let t=0;do{const r=this.build[t],s=e.build[t];if(n("build compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return c(r,s)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?i[a.PRERELEASELOOSE]:i[a.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===c(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=u},89719(e,t,r){const n=r(13425);e.exports=(e,t)=>{const r=n(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},90870(e,t,r){const n=r(75162),s=r(26494),o=r(38023),i=r(47332),a=r(67568),l=r(28669);e.exports=(e,t,r,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,c);case"!=":return s(e,r,c);case">":return o(e,r,c);case">=":return i(e,r,c);case"<":return a(e,r,c);case"<=":return l(e,r,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},40681(e,t,r){const n=r(75403),s=r(13425),{safeRe:o,t:i}=r(86431);e.exports=(e,t)=>{if(e instanceof n)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?o[i.COERCERTLFULL]:o[i.COERCERTL];let s;for(;(s=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),n.lastIndex=s.index+s[1].length+s[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?o[i.COERCEFULL]:o[i.COERCE]);if(null===r)return null;const a=r[2],l=r[3]||"0",c=r[4]||"0",u=t.includePrerelease&&r[5]?`-${r[5]}`:"",h=t.includePrerelease&&r[6]?`+${r[6]}`:"";return s(`${a}.${l}.${c}${u}${h}`,t)}},8512(e,t,r){const n=r(75403);e.exports=(e,t,r)=>{const s=new n(e,r),o=new n(t,r);return s.compare(o)||s.compareBuild(o)}},7642(e,t,r){const n=r(87509);e.exports=(e,t)=>n(e,t,!0)},87509(e,t,r){const n=r(75403);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},18823(e,t,r){const n=r(13425);e.exports=(e,t)=>{const r=n(e,null,!0),s=n(t,null,!0),o=r.compare(s);if(0===o)return null;const i=o>0,a=i?r:s,l=i?s:r,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(a))return l.minor&&!l.patch?"minor":"patch"}const u=c?"pre":"";return r.major!==s.major?u+"major":r.minor!==s.minor?u+"minor":r.patch!==s.patch?u+"patch":"prerelease"}},75162(e,t,r){const n=r(87509);e.exports=(e,t,r)=>0===n(e,t,r)},38023(e,t,r){const n=r(87509);e.exports=(e,t,r)=>n(e,t,r)>0},47332(e,t,r){const n=r(87509);e.exports=(e,t,r)=>n(e,t,r)>=0},5234(e,t,r){const n=r(75403);e.exports=(e,t,r,s,o)=>{"string"==typeof r&&(o=s,s=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,s,o).version}catch(e){return null}}},67568(e,t,r){const n=r(87509);e.exports=(e,t,r)=>n(e,t,r)<0},28669(e,t,r){const n=r(87509);e.exports=(e,t,r)=>n(e,t,r)<=0},90703(e,t,r){const n=r(75403);e.exports=(e,t)=>new n(e,t).major},86923(e,t,r){const n=r(75403);e.exports=(e,t)=>new n(e,t).minor},26494(e,t,r){const n=r(87509);e.exports=(e,t,r)=>0!==n(e,t,r)},13425(e,t,r){const n=r(75403);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},45700(e,t,r){const n=r(75403);e.exports=(e,t)=>new n(e,t).patch},69970(e,t,r){const n=r(13425);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},73629(e,t,r){const n=r(87509);e.exports=(e,t,r)=>n(t,e,r)},48392(e,t,r){const n=r(8512);e.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))},61211(e,t,r){const n=r(69854);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},76480(e,t,r){const n=r(8512);e.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))},76140(e,t,r){const n=r(13425);e.exports=(e,t)=>{const r=n(e,t);return r?r.version:null}},93688(e,t,r){const n=r(86431),s=r(79549),o=r(75403),i=r(28628),a=r(13425),l=r(76140),c=r(89719),u=r(5234),h=r(18823),d=r(90703),p=r(86923),m=r(45700),f=r(69970),E=r(87509),g=r(73629),w=r(7642),y=r(8512),R=r(76480),v=r(48392),I=r(38023),$=r(67568),S=r(75162),b=r(26494),A=r(47332),P=r(28669),_=r(90870),L=r(40681),N=r(76595),T=r(69854),O=r(61211),F=r(22670),x=r(11449),D=r(86691),C=r(27402),U=r(85713),M=r(33592),j=r(38180),k=r(68349),G=r(15353),V=r(75132),B=r(30753);e.exports={parse:a,valid:l,clean:c,inc:u,diff:h,major:d,minor:p,patch:m,prerelease:f,compare:E,rcompare:g,compareLoose:w,compareBuild:y,sort:R,rsort:v,gt:I,lt:$,eq:S,neq:b,gte:A,lte:P,cmp:_,coerce:L,Comparator:N,Range:T,satisfies:O,toComparators:F,maxSatisfying:x,minSatisfying:D,minVersion:C,validRange:U,outside:M,gtr:j,ltr:k,intersects:G,simplifyRange:V,subset:B,SemVer:o,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:s.SEMVER_SPEC_VERSION,RELEASE_TYPES:s.RELEASE_TYPES,compareIdentifiers:i.compareIdentifiers,rcompareIdentifiers:i.rcompareIdentifiers}},79549(e){const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},76887(e){const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},28628(e){const t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;const n=t.test(e),s=t.test(r);return n&&s&&(e=+e,r=+r),e===r?0:n&&!s?-1:s&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},70295(e){e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},14948(e){const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},86431(e,t,r){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:o}=r(79549),i=r(76887),a=(t=e.exports={}).re=[],l=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],h=t.t={};let d=0;const p="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",o],[p,s]],f=(e,t,r)=>{const n=(e=>{for(const[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=d++;i(e,s,t),h[e]=s,c[s]=t,u[s]=n,a[s]=new RegExp(t,r?"g":void 0),l[s]=new RegExp(n,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),f("MAINVERSION",`(${c[h.NUMERICIDENTIFIER]})\\.(${c[h.NUMERICIDENTIFIER]})\\.(${c[h.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${c[h.NUMERICIDENTIFIERLOOSE]})\\.(${c[h.NUMERICIDENTIFIERLOOSE]})\\.(${c[h.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${c[h.NONNUMERICIDENTIFIER]}|${c[h.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASE",`(?:-(${c[h.PRERELEASEIDENTIFIER]}(?:\\.${c[h.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${c[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[h.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${p}+`),f("BUILD",`(?:\\+(${c[h.BUILDIDENTIFIER]}(?:\\.${c[h.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${c[h.MAINVERSION]}${c[h.PRERELEASE]}?${c[h.BUILD]}?`),f("FULL",`^${c[h.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${c[h.MAINVERSIONLOOSE]}${c[h.PRERELEASELOOSE]}?${c[h.BUILD]}?`),f("LOOSE",`^${c[h.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${c[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${c[h.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${c[h.XRANGEIDENTIFIER]})(?:\\.(${c[h.XRANGEIDENTIFIER]})(?:\\.(${c[h.XRANGEIDENTIFIER]})(?:${c[h.PRERELEASE]})?${c[h.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[h.XRANGEIDENTIFIERLOOSE]})(?:${c[h.PRERELEASELOOSE]})?${c[h.BUILD]}?)?)?`),f("XRANGE",`^${c[h.GTLT]}\\s*${c[h.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${c[h.GTLT]}\\s*${c[h.XRANGEPLAINLOOSE]}$`),f("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),f("COERCE",`${c[h.COERCEPLAIN]}(?:$|[^\\d])`),f("COERCEFULL",c[h.COERCEPLAIN]+`(?:${c[h.PRERELEASE]})?`+`(?:${c[h.BUILD]})?(?:$|[^\\d])`),f("COERCERTL",c[h.COERCE],!0),f("COERCERTLFULL",c[h.COERCEFULL],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${c[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${c[h.LONETILDE]}${c[h.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${c[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${c[h.LONECARET]}${c[h.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${c[h.LONECARET]}${c[h.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${c[h.GTLT]}\\s*(${c[h.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${c[h.GTLT]}\\s*(${c[h.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${c[h.GTLT]}\\s*(${c[h.LOOSEPLAIN]}|${c[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${c[h.XRANGEPLAIN]})\\s+-\\s+(${c[h.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${c[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[h.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},38180(e,t,r){const n=r(33592);e.exports=(e,t,r)=>n(e,t,">",r)},15353(e,t,r){const n=r(69854);e.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))},68349(e,t,r){const n=r(33592);e.exports=(e,t,r)=>n(e,t,"<",r)},11449(e,t,r){const n=r(75403),s=r(69854);e.exports=(e,t,r)=>{let o=null,i=null,a=null;try{a=new s(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(o&&-1!==i.compare(e)||(o=e,i=new n(o,r)))}),o}},86691(e,t,r){const n=r(75403),s=r(69854);e.exports=(e,t,r)=>{let o=null,i=null,a=null;try{a=new s(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(o&&1!==i.compare(e)||(o=e,i=new n(o,r)))}),o}},27402(e,t,r){const n=r(75403),s=r(69854),o=r(38023);e.exports=(e,t)=>{e=new s(e,t);let r=new n("0.0.0");if(e.test(r))return r;if(r=new n("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const s=e.set[t];let i=null;s.forEach(e=>{const t=new n(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!o(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!i||r&&!o(r,i)||(r=i)}return r&&e.test(r)?r:null}},33592(e,t,r){const n=r(75403),s=r(76595),{ANY:o}=s,i=r(69854),a=r(61211),l=r(38023),c=r(67568),u=r(28669),h=r(47332);e.exports=(e,t,r,d)=>{let p,m,f,E,g;switch(e=new n(e,d),t=new i(t,d),r){case">":p=l,m=u,f=c,E=">",g=">=";break;case"<":p=c,m=h,f=l,E="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,d))return!1;for(let r=0;r<t.set.length;++r){const n=t.set[r];let i=null,a=null;if(n.forEach(e=>{e.semver===o&&(e=new s(">=0.0.0")),i=i||e,a=a||e,p(e.semver,i.semver,d)?i=e:f(e.semver,a.semver,d)&&(a=e)}),i.operator===E||i.operator===g)return!1;if((!a.operator||a.operator===E)&&m(e,a.semver))return!1;if(a.operator===g&&f(e,a.semver))return!1}return!0}},75132(e,t,r){const n=r(61211),s=r(87509);e.exports=(e,t,r)=>{const o=[];let i=null,a=null;const l=e.sort((e,t)=>s(e,t,r));for(const e of l){n(e,t,r)?(a=e,i||(i=e)):(a&&o.push([i,a]),a=null,i=null)}i&&o.push([i,null]);const c=[];for(const[e,t]of o)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push(`<=${t}`):c.push(`${e} - ${t}`):c.push(`>=${e}`):c.push("*");const u=c.join(" || "),h="string"==typeof t.raw?t.raw:String(t);return u.length<h.length?u:t}},30753(e,t,r){const n=r(69854),s=r(76595),{ANY:o}=s,i=r(61211),a=r(87509),l=[new s(">=0.0.0-0")],c=[new s(">=0.0.0")],u=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===o){if(1===t.length&&t[0].semver===o)return!0;e=r.includePrerelease?l:c}if(1===t.length&&t[0].semver===o){if(r.includePrerelease)return!0;t=c}const n=new Set;let s,u,p,m,f,E,g;for(const t of e)">"===t.operator||">="===t.operator?s=h(s,t,r):"<"===t.operator||"<="===t.operator?u=d(u,t,r):n.add(t.semver);if(n.size>1)return null;if(s&&u){if(p=a(s.semver,u.semver,r),p>0)return null;if(0===p&&(">="!==s.operator||"<="!==u.operator))return null}for(const e of n){if(s&&!i(e,String(s),r))return null;if(u&&!i(e,String(u),r))return null;for(const n of t)if(!i(e,String(n),r))return!1;return!0}let w=!(!u||r.includePrerelease||!u.semver.prerelease.length)&&u.semver,y=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver;w&&1===w.prerelease.length&&"<"===u.operator&&0===w.prerelease[0]&&(w=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,E=E||"<"===e.operator||"<="===e.operator,s)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(m=h(s,e,r),m===e&&m!==s)return!1}else if(">="===s.operator&&!i(s.semver,String(e),r))return!1;if(u)if(w&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===w.major&&e.semver.minor===w.minor&&e.semver.patch===w.patch&&(w=!1),"<"===e.operator||"<="===e.operator){if(f=d(u,e,r),f===e&&f!==u)return!1}else if("<="===u.operator&&!i(u.semver,String(e),r))return!1;if(!e.operator&&(u||s)&&0!==p)return!1}return!(s&&E&&!u&&0!==p)&&(!(u&&g&&!s&&0!==p)&&(!y&&!w))},h=(e,t,r)=>{if(!e)return t;const n=a(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,r)=>{if(!e)return t;const n=a(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let s=!1;e:for(const n of e.set){for(const e of t.set){const t=u(n,e,r);if(s=s||null!==t,t)continue e}if(s)return!1}return!0}},22670(e,t,r){const n=r(69854);e.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},85713(e,t,r){const n=r(69854);e.exports=(e,t)=>{try{return new n(e,t).range||"*"}catch(e){return null}}}}]);