@mondaydotcomorg/agent-toolkit
Version:
monday.com agent toolkit
2 lines • 948 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zod"),a=require("zod-to-json-schema"),t=require("@mondaydotcomorg/api"),i=require("stream"),n=require("http"),o=require("url"),r=require("punycode"),s=require("https"),p=require("zlib"),d=require("buffer"),l=require("util"),c=require("crypto"),m=require("path"),u=require("fs"),h=require("assert"),f=require("tty"),v=require("os"),g=require("events");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=y(i),w=y(n),x=y(o),_=y(r),E=y(s),T=y(p),S=y(d),N=y(l),I=y(c),D=y(m),O=y(u),A=y(h),k=y(f),R=y(v);const P="2025-06-18",C=[P,"2025-03-26","2024-11-05","2024-10-07"],j="2.0",$=e.z.union([e.z.string(),e.z.number().int()]),F=e.z.string(),L=e.z.object({progressToken:e.z.optional($)}).passthrough(),V=e.z.object({_meta:e.z.optional(L)}).passthrough(),z=e.z.object({method:e.z.string(),params:e.z.optional(V)}),U=e.z.object({_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),B=e.z.object({method:e.z.string(),params:e.z.optional(U)}),M=e.z.object({_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),q=e.z.union([e.z.string(),e.z.number().int()]),H=e.z.object({jsonrpc:e.z.literal(j),id:q}).merge(z).strict(),G=e.z.object({jsonrpc:e.z.literal(j)}).merge(B).strict(),K=e.z.object({jsonrpc:e.z.literal(j),id:q,result:M}).strict(),W=e=>K.safeParse(e).success;var Q;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(Q||(Q={}));const J=e.z.object({jsonrpc:e.z.literal(j),id:q,error:e.z.object({code:e.z.number().int(),message:e.z.string(),data:e.z.optional(e.z.unknown())})}).strict();e.z.union([H,G,K,J]);const Y=M.strict(),X=B.extend({method:e.z.literal("notifications/cancelled"),params:U.extend({requestId:q,reason:e.z.string().optional()})}),Z=e.z.object({name:e.z.string(),title:e.z.optional(e.z.string())}).passthrough(),ee=Z.extend({version:e.z.string()}),ae=e.z.object({experimental:e.z.optional(e.z.object({}).passthrough()),sampling:e.z.optional(e.z.object({}).passthrough()),elicitation:e.z.optional(e.z.object({}).passthrough()),roots:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough())}).passthrough(),te=z.extend({method:e.z.literal("initialize"),params:V.extend({protocolVersion:e.z.string(),capabilities:ae,clientInfo:ee})}),ie=e.z.object({experimental:e.z.optional(e.z.object({}).passthrough()),logging:e.z.optional(e.z.object({}).passthrough()),completions:e.z.optional(e.z.object({}).passthrough()),prompts:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough()),resources:e.z.optional(e.z.object({subscribe:e.z.optional(e.z.boolean()),listChanged:e.z.optional(e.z.boolean())}).passthrough()),tools:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough())}).passthrough(),ne=M.extend({protocolVersion:e.z.string(),capabilities:ie,serverInfo:ee,instructions:e.z.optional(e.z.string())}),oe=B.extend({method:e.z.literal("notifications/initialized")}),re=z.extend({method:e.z.literal("ping")}),se=e.z.object({progress:e.z.number(),total:e.z.optional(e.z.number()),message:e.z.optional(e.z.string())}).passthrough(),pe=B.extend({method:e.z.literal("notifications/progress"),params:U.merge(se).extend({progressToken:$})}),de=z.extend({params:V.extend({cursor:e.z.optional(F)}).optional()}),le=M.extend({nextCursor:e.z.optional(F)}),ce=e.z.object({uri:e.z.string(),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),me=ce.extend({text:e.z.string()}),ue=ce.extend({blob:e.z.string().base64()}),he=Z.extend({uri:e.z.string(),description:e.z.optional(e.z.string()),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}),fe=Z.extend({uriTemplate:e.z.string(),description:e.z.optional(e.z.string()),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}),ve=de.extend({method:e.z.literal("resources/list")}),ge=le.extend({resources:e.z.array(he)}),ye=de.extend({method:e.z.literal("resources/templates/list")}),be=le.extend({resourceTemplates:e.z.array(fe)}),we=z.extend({method:e.z.literal("resources/read"),params:V.extend({uri:e.z.string()})}),xe=M.extend({contents:e.z.array(e.z.union([me,ue]))}),_e=B.extend({method:e.z.literal("notifications/resources/list_changed")}),Ee=z.extend({method:e.z.literal("resources/subscribe"),params:V.extend({uri:e.z.string()})}),Te=z.extend({method:e.z.literal("resources/unsubscribe"),params:V.extend({uri:e.z.string()})}),Se=B.extend({method:e.z.literal("notifications/resources/updated"),params:U.extend({uri:e.z.string()})}),Ne=e.z.object({name:e.z.string(),description:e.z.optional(e.z.string()),required:e.z.optional(e.z.boolean())}).passthrough(),Ie=Z.extend({description:e.z.optional(e.z.string()),arguments:e.z.optional(e.z.array(Ne)),_meta:e.z.optional(e.z.object({}).passthrough())}),De=de.extend({method:e.z.literal("prompts/list")}),Oe=le.extend({prompts:e.z.array(Ie)}),Ae=z.extend({method:e.z.literal("prompts/get"),params:V.extend({name:e.z.string(),arguments:e.z.optional(e.z.record(e.z.string()))})}),ke=e.z.object({type:e.z.literal("text"),text:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),Re=e.z.object({type:e.z.literal("image"),data:e.z.string().base64(),mimeType:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),Pe=e.z.object({type:e.z.literal("audio"),data:e.z.string().base64(),mimeType:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),Ce=e.z.object({type:e.z.literal("resource"),resource:e.z.union([me,ue]),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),je=he.extend({type:e.z.literal("resource_link")}),$e=e.z.union([ke,Re,Pe,je,Ce]),Fe=e.z.object({role:e.z.enum(["user","assistant"]),content:$e}).passthrough(),Le=M.extend({description:e.z.optional(e.z.string()),messages:e.z.array(Fe)}),Ve=B.extend({method:e.z.literal("notifications/prompts/list_changed")}),ze=e.z.object({title:e.z.optional(e.z.string()),readOnlyHint:e.z.optional(e.z.boolean()),destructiveHint:e.z.optional(e.z.boolean()),idempotentHint:e.z.optional(e.z.boolean()),openWorldHint:e.z.optional(e.z.boolean())}).passthrough(),Ue=Z.extend({description:e.z.optional(e.z.string()),inputSchema:e.z.object({type:e.z.literal("object"),properties:e.z.optional(e.z.object({}).passthrough()),required:e.z.optional(e.z.array(e.z.string()))}).passthrough(),outputSchema:e.z.optional(e.z.object({type:e.z.literal("object"),properties:e.z.optional(e.z.object({}).passthrough()),required:e.z.optional(e.z.array(e.z.string()))}).passthrough()),annotations:e.z.optional(ze),_meta:e.z.optional(e.z.object({}).passthrough())}),Be=de.extend({method:e.z.literal("tools/list")}),Me=le.extend({tools:e.z.array(Ue)}),qe=M.extend({content:e.z.array($e).default([]),structuredContent:e.z.object({}).passthrough().optional(),isError:e.z.optional(e.z.boolean())});qe.or(M.extend({toolResult:e.z.unknown()}));const He=z.extend({method:e.z.literal("tools/call"),params:V.extend({name:e.z.string(),arguments:e.z.optional(e.z.record(e.z.unknown()))})}),Ge=B.extend({method:e.z.literal("notifications/tools/list_changed")}),Ke=e.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),We=z.extend({method:e.z.literal("logging/setLevel"),params:V.extend({level:Ke})}),Qe=B.extend({method:e.z.literal("notifications/message"),params:U.extend({level:Ke,logger:e.z.optional(e.z.string()),data:e.z.unknown()})}),Je=e.z.object({name:e.z.string().optional()}).passthrough(),Ye=e.z.object({hints:e.z.optional(e.z.array(Je)),costPriority:e.z.optional(e.z.number().min(0).max(1)),speedPriority:e.z.optional(e.z.number().min(0).max(1)),intelligencePriority:e.z.optional(e.z.number().min(0).max(1))}).passthrough(),Xe=e.z.object({role:e.z.enum(["user","assistant"]),content:e.z.union([ke,Re,Pe])}).passthrough(),Ze=z.extend({method:e.z.literal("sampling/createMessage"),params:V.extend({messages:e.z.array(Xe),systemPrompt:e.z.optional(e.z.string()),includeContext:e.z.optional(e.z.enum(["none","thisServer","allServers"])),temperature:e.z.optional(e.z.number()),maxTokens:e.z.number().int(),stopSequences:e.z.optional(e.z.array(e.z.string())),metadata:e.z.optional(e.z.object({}).passthrough()),modelPreferences:e.z.optional(Ye)})}),ea=M.extend({model:e.z.string(),stopReason:e.z.optional(e.z.enum(["endTurn","stopSequence","maxTokens"]).or(e.z.string())),role:e.z.enum(["user","assistant"]),content:e.z.discriminatedUnion("type",[ke,Re,Pe])}),aa=e.z.object({type:e.z.literal("boolean"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),default:e.z.optional(e.z.boolean())}).passthrough(),ta=e.z.object({type:e.z.literal("string"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),minLength:e.z.optional(e.z.number()),maxLength:e.z.optional(e.z.number()),format:e.z.optional(e.z.enum(["email","uri","date","date-time"]))}).passthrough(),ia=e.z.object({type:e.z.enum(["number","integer"]),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),minimum:e.z.optional(e.z.number()),maximum:e.z.optional(e.z.number())}).passthrough(),na=e.z.object({type:e.z.literal("string"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),enum:e.z.array(e.z.string()),enumNames:e.z.optional(e.z.array(e.z.string()))}).passthrough(),oa=e.z.union([aa,ta,ia,na]),ra=z.extend({method:e.z.literal("elicitation/create"),params:V.extend({message:e.z.string(),requestedSchema:e.z.object({type:e.z.literal("object"),properties:e.z.record(e.z.string(),oa),required:e.z.optional(e.z.array(e.z.string()))}).passthrough()})}),sa=M.extend({action:e.z.enum(["accept","reject","cancel"]),content:e.z.optional(e.z.record(e.z.string(),e.z.unknown()))}),pa=e.z.object({type:e.z.literal("ref/resource"),uri:e.z.string()}).passthrough(),da=e.z.object({type:e.z.literal("ref/prompt"),name:e.z.string()}).passthrough(),la=z.extend({method:e.z.literal("completion/complete"),params:V.extend({ref:e.z.union([da,pa]),argument:e.z.object({name:e.z.string(),value:e.z.string()}).passthrough(),context:e.z.optional(e.z.object({arguments:e.z.optional(e.z.record(e.z.string(),e.z.string()))}))})}),ca=M.extend({completion:e.z.object({values:e.z.array(e.z.string()).max(100),total:e.z.optional(e.z.number().int()),hasMore:e.z.optional(e.z.boolean())}).passthrough()}),ma=e.z.object({uri:e.z.string().startsWith("file://"),name:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),ua=z.extend({method:e.z.literal("roots/list")}),ha=M.extend({roots:e.z.array(ma)}),fa=B.extend({method:e.z.literal("notifications/roots/list_changed")});e.z.union([re,te,la,We,Ae,De,ve,ye,we,Ee,Te,He,Be]),e.z.union([X,pe,oe,fa]),e.z.union([Y,ea,sa,ha]),e.z.union([re,Ze,ra,ua]),e.z.union([X,pe,Qe,Se,_e,Ge,Ve]),e.z.union([Y,ne,ca,Le,Oe,ge,be,xe,qe,Me]);class va extends Error{constructor(e,a,t){super(`MCP error ${e}: ${a}`),this.code=e,this.data=t,this.name="McpError"}}class ga{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(X,(e=>{const a=this._requestHandlerAbortControllers.get(e.params.requestId);null==a||a.abort(e.params.reason)})),this.setNotificationHandler(pe,(e=>{this._onprogress(e)})),this.setRequestHandler(re,(e=>({})))}_setupTimeout(e,a,t,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,a),startTime:Date.now(),timeout:a,maxTotalTimeout:t,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){const a=this._timeoutInfo.get(e);if(!a)return!1;const t=Date.now()-a.startTime;if(a.maxTotalTimeout&&t>=a.maxTotalTimeout)throw this._timeoutInfo.delete(e),new va(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:a.maxTotalTimeout,totalElapsed:t});return clearTimeout(a.timeoutId),a.timeoutId=setTimeout(a.onTimeout,a.timeout),!0}_cleanupTimeout(e){const a=this._timeoutInfo.get(e);a&&(clearTimeout(a.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var a,t,i;this._transport=e;const n=null===(a=this.transport)||void 0===a?void 0:a.onclose;this._transport.onclose=()=>{null==n||n(),this._onclose()};const o=null===(t=this.transport)||void 0===t?void 0:t.onerror;this._transport.onerror=e=>{null==o||o(e),this._onerror(e)};const r=null===(i=this._transport)||void 0===i?void 0:i.onmessage;this._transport.onmessage=(e,a)=>{var t;null==r||r(e,a),W(e)||(t=e,J.safeParse(t).success)?this._onresponse(e):(e=>H.safeParse(e).success)(e)?this._onrequest(e,a):(e=>G.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const a=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const t=new va(Q.ConnectionClosed,"Connection closed");for(const e of a.values())e(t)}_onerror(e){var a;null===(a=this.onerror)||void 0===a||a.call(this,e)}_onnotification(e){var a;const t=null!==(a=this._notificationHandlers.get(e.method))&&void 0!==a?a:this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then((()=>t(e))).catch((e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`))))}_onrequest(e,a){var t,i,n,o;const r=null!==(t=this._requestHandlers.get(e.method))&&void 0!==t?t:this.fallbackRequestHandler;if(void 0===r)return void(null===(i=this._transport)||void 0===i||i.send({jsonrpc:"2.0",id:e.id,error:{code:Q.MethodNotFound,message:"Method not found"}}).catch((e=>this._onerror(new Error(`Failed to send an error response: ${e}`)))));const s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);const p={signal:s.signal,sessionId:null===(n=this._transport)||void 0===n?void 0:n.sessionId,_meta:null===(o=e.params)||void 0===o?void 0:o._meta,sendNotification:a=>this.notification(a,{relatedRequestId:e.id}),sendRequest:(a,t,i)=>this.request(a,t,{...i,relatedRequestId:e.id}),authInfo:null==a?void 0:a.authInfo,requestId:e.id,requestInfo:null==a?void 0:a.requestInfo};Promise.resolve().then((()=>r(e,p))).then((a=>{var t;if(!s.signal.aborted)return null===(t=this._transport)||void 0===t?void 0:t.send({result:a,jsonrpc:"2.0",id:e.id})}),(a=>{var t,i;if(!s.signal.aborted)return null===(t=this._transport)||void 0===t?void 0:t.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(a.code)?a.code:Q.InternalError,message:null!==(i=a.message)&&void 0!==i?i:"Internal error"}})})).catch((e=>this._onerror(new Error(`Failed to send response: ${e}`)))).finally((()=>{this._requestHandlerAbortControllers.delete(e.id)}))}_onprogress(e){const{progressToken:a,...t}=e.params,i=Number(a),n=this._progressHandlers.get(i);if(!n)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const o=this._responseHandlers.get(i),r=this._timeoutInfo.get(i);if(r&&o&&r.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(e){return void o(e)}n(t)}_onresponse(e){const a=Number(e.id),t=this._responseHandlers.get(a);if(void 0!==t)if(this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),W(e))t(e);else{t(new va(e.error.code,e.error.message,e.error.data))}else this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,a,t){const{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}=null!=t?t:{};return new Promise(((r,s)=>{var p,d,l,c,m,u;if(!this._transport)return void s(new Error("Not connected"));!0===(null===(p=this._options)||void 0===p?void 0:p.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(d=null==t?void 0:t.signal)||void 0===d||d.throwIfAborted();const h=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:h};(null==t?void 0:t.onprogress)&&(this._progressHandlers.set(h,t.onprogress),f.params={...e.params,_meta:{...(null===(l=e.params)||void 0===l?void 0:l._meta)||{},progressToken:h}});const v=e=>{var a;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),null===(a=this._transport)||void 0===a||a.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(e)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)))),s(e)};this._responseHandlers.set(h,(e=>{var i;if(!(null===(i=null==t?void 0:t.signal)||void 0===i?void 0:i.aborted)){if(e instanceof Error)return s(e);try{const t=a.parse(e.result);r(t)}catch(e){s(e)}}})),null===(c=null==t?void 0:t.signal)||void 0===c||c.addEventListener("abort",(()=>{var e;v(null===(e=null==t?void 0:t.signal)||void 0===e?void 0:e.reason)}));const g=null!==(m=null==t?void 0:t.timeout)&&void 0!==m?m:6e4;this._setupTimeout(h,g,null==t?void 0:t.maxTotalTimeout,(()=>v(new va(Q.RequestTimeout,"Request timed out",{timeout:g}))),null!==(u=null==t?void 0:t.resetTimeoutOnProgress)&&void 0!==u&&u),this._transport.send(f,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((e=>{this._cleanupTimeout(h),s(e)}))}))}async notification(e,a){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const t={...e,jsonrpc:"2.0"};await this._transport.send(t,a)}setRequestHandler(e,a){const t=e.shape.method.value;this.assertRequestHandlerCapability(t),this._requestHandlers.set(t,((t,i)=>Promise.resolve(a(e.parse(t),i))))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,a){this._notificationHandlers.set(e.shape.method.value,(t=>Promise.resolve(a(e.parse(t)))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ya(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ba(e){if(e.__esModule)return e;var a=e.default;if("function"==typeof a){var t=function e(){return this instanceof e?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};t.prototype=a.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})})),t}var wa={exports:{}};
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */!function(e){function a(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];if(a.length>1){a[0]=a[0].slice(0,-1);for(var i=a.length-1,n=1;n<i;++n)a[n]=a[n].slice(1,-1);return a[i]=a[i].slice(1),a.join("")}return a[0]}function t(e){return"(?:"+e+")"}function i(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function n(e){return e.toUpperCase()}function o(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function r(e,a){var t=e;if(a)for(var i in a)t[i]=a[i];return t}function s(e){var i="[A-Za-z]",n="[0-9]",o=a(n,"[A-Fa-f]"),r=t(t("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+t("%[89A-Fa-f]"+o+"%"+o+o)+"|"+t("%"+o+o)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",p=a("[\\:\\/\\?\\#\\[\\]\\@]",s),d=e?"[\\uE000-\\uF8FF]":"[]",l=a(i,n,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");t(i+a(i,n,"[\\+\\-\\.]")+"*"),t(t(r+"|"+a(l,s,"[\\:]"))+"*");var c=t(t("25[0-5]")+"|"+t("2[0-4]"+n)+"|"+t("1"+n+n)+"|"+t("0?[1-9]"+n)+"|0?0?"+n),m=t(c+"\\."+c+"\\."+c+"\\."+c),u=t(o+"{1,4}"),h=t(t(u+"\\:"+u)+"|"+m),f=t(t(u+"\\:")+"{6}"+h),v=t("\\:\\:"+t(u+"\\:")+"{5}"+h),g=t(t(u)+"?\\:\\:"+t(u+"\\:")+"{4}"+h),y=t(t(t(u+"\\:")+"{0,1}"+u)+"?\\:\\:"+t(u+"\\:")+"{3}"+h),b=t(t(t(u+"\\:")+"{0,2}"+u)+"?\\:\\:"+t(u+"\\:")+"{2}"+h),w=t(t(t(u+"\\:")+"{0,3}"+u)+"?\\:\\:"+u+"\\:"+h),x=t(t(t(u+"\\:")+"{0,4}"+u)+"?\\:\\:"+h),_=t(t(t(u+"\\:")+"{0,5}"+u)+"?\\:\\:"+u),E=t(t(t(u+"\\:")+"{0,6}"+u)+"?\\:\\:"),T=t([f,v,g,y,b,w,x,_,E].join("|")),S=t(t(l+"|"+r)+"+");t("[vV]"+o+"+\\."+a(l,s,"[\\:]")+"+"),t(t(r+"|"+a(l,s))+"*");var N=t(r+"|"+a(l,s,"[\\:\\@]"));return t(t(r+"|"+a(l,s,"[\\@]"))+"+"),t(t(N+"|"+a("[\\/\\?]",d))+"*"),{NOT_SCHEME:new RegExp(a("[^]",i,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(a("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(a("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(a("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(a("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(a("[^\\%]",l,s,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(a("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(a("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(a("[^\\%]",l,p),"g"),PCT_ENCODED:new RegExp(r,"g"),IPV4ADDRESS:new RegExp("^("+m+")$"),IPV6ADDRESS:new RegExp("^\\[?("+T+")"+t(t("\\%25|\\%(?!"+o+"{2})")+"("+S+")")+"?\\]?$")}}var p=s(!1),d=s(!0),l=function(){function e(e,a){var t=[],i=!0,n=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(t.push(r.value),!a||t.length!==a);i=!0);}catch(e){n=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(n)throw o}}return t}return function(a,t){if(Array.isArray(a))return a;if(Symbol.iterator in Object(a))return e(a,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e){if(Array.isArray(e)){for(var a=0,t=Array(e.length);a<e.length;a++)t[a]=e[a];return t}return Array.from(e)},m=2147483647,u=36,h=1,f=26,v=38,g=700,y=72,b=128,w="-",x=/^xn--/,_=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=u-h,N=Math.floor,I=String.fromCharCode;function D(e){throw new RangeError(T[e])}function O(e,a){for(var t=[],i=e.length;i--;)t[i]=a(e[i]);return t}function A(e,a){var t=e.split("@"),i="";return t.length>1&&(i=t[0]+"@",e=t[1]),i+O((e=e.replace(E,".")).split("."),a).join(".")}function k(e){for(var a=[],t=0,i=e.length;t<i;){var n=e.charCodeAt(t++);if(n>=55296&&n<=56319&&t<i){var o=e.charCodeAt(t++);56320==(64512&o)?a.push(((1023&n)<<10)+(1023&o)+65536):(a.push(n),t--)}else a.push(n)}return a}var R=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:u},P=function(e,a){return e+22+75*(e<26)-((0!=a)<<5)},C=function(e,a,t){var i=0;for(e=t?N(e/g):e>>1,e+=N(e/a);e>S*f>>1;i+=u)e=N(e/S);return N(i+(S+1)*e/(e+v))},j=function(e){var a=[],t=e.length,i=0,n=b,o=y,r=e.lastIndexOf(w);r<0&&(r=0);for(var s=0;s<r;++s)e.charCodeAt(s)>=128&&D("not-basic"),a.push(e.charCodeAt(s));for(var p=r>0?r+1:0;p<t;){for(var d=i,l=1,c=u;;c+=u){p>=t&&D("invalid-input");var v=R(e.charCodeAt(p++));(v>=u||v>N((m-i)/l))&&D("overflow"),i+=v*l;var g=c<=o?h:c>=o+f?f:c-o;if(v<g)break;var x=u-g;l>N(m/x)&&D("overflow"),l*=x}var _=a.length+1;o=C(i-d,_,0==d),N(i/_)>m-n&&D("overflow"),n+=N(i/_),i%=_,a.splice(i++,0,n)}return String.fromCodePoint.apply(String,a)},$=function(e){var a=[],t=(e=k(e)).length,i=b,n=0,o=y,r=!0,s=!1,p=void 0;try{for(var d,l=e[Symbol.iterator]();!(r=(d=l.next()).done);r=!0){var c=d.value;c<128&&a.push(I(c))}}catch(e){s=!0,p=e}finally{try{!r&&l.return&&l.return()}finally{if(s)throw p}}var v=a.length,g=v;for(v&&a.push(w);g<t;){var x=m,_=!0,E=!1,T=void 0;try{for(var S,O=e[Symbol.iterator]();!(_=(S=O.next()).done);_=!0){var A=S.value;A>=i&&A<x&&(x=A)}}catch(e){E=!0,T=e}finally{try{!_&&O.return&&O.return()}finally{if(E)throw T}}var R=g+1;x-i>N((m-n)/R)&&D("overflow"),n+=(x-i)*R,i=x;var j=!0,$=!1,F=void 0;try{for(var L,V=e[Symbol.iterator]();!(j=(L=V.next()).done);j=!0){var z=L.value;if(z<i&&++n>m&&D("overflow"),z==i){for(var U=n,B=u;;B+=u){var M=B<=o?h:B>=o+f?f:B-o;if(U<M)break;var q=U-M,H=u-M;a.push(I(P(M+q%H,0))),U=N(q/H)}a.push(I(P(U,0))),o=C(n,R,g==v),n=0,++g}}}catch(e){$=!0,F=e}finally{try{!j&&V.return&&V.return()}finally{if($)throw F}}++n,++i}return a.join("")},F=function(e){return A(e,(function(e){return x.test(e)?j(e.slice(4).toLowerCase()):e}))},L=function(e){return A(e,(function(e){return _.test(e)?"xn--"+$(e):e}))},V={version:"2.1.0",ucs2:{decode:k,encode:function(e){return String.fromCodePoint.apply(String,c(e))}},decode:j,encode:$,toASCII:L,toUnicode:F},z={};function U(e){var a=e.charCodeAt(0);return a<16?"%0"+a.toString(16).toUpperCase():a<128?"%"+a.toString(16).toUpperCase():a<2048?"%"+(a>>6|192).toString(16).toUpperCase()+"%"+(63&a|128).toString(16).toUpperCase():"%"+(a>>12|224).toString(16).toUpperCase()+"%"+(a>>6&63|128).toString(16).toUpperCase()+"%"+(63&a|128).toString(16).toUpperCase()}function B(e){for(var a="",t=0,i=e.length;t<i;){var n=parseInt(e.substr(t+1,2),16);if(n<128)a+=String.fromCharCode(n),t+=3;else if(n>=194&&n<224){if(i-t>=6){var o=parseInt(e.substr(t+4,2),16);a+=String.fromCharCode((31&n)<<6|63&o)}else a+=e.substr(t,6);t+=6}else if(n>=224){if(i-t>=9){var r=parseInt(e.substr(t+4,2),16),s=parseInt(e.substr(t+7,2),16);a+=String.fromCharCode((15&n)<<12|(63&r)<<6|63&s)}else a+=e.substr(t,9);t+=9}else a+=e.substr(t,3),t+=3}return a}function M(e,a){function t(e){var t=B(e);return t.match(a.UNRESERVED)?t:e}return e.scheme&&(e.scheme=String(e.scheme).replace(a.PCT_ENCODED,t).toLowerCase().replace(a.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(a.PCT_ENCODED,t).replace(a.NOT_USERINFO,U).replace(a.PCT_ENCODED,n)),void 0!==e.host&&(e.host=String(e.host).replace(a.PCT_ENCODED,t).toLowerCase().replace(a.NOT_HOST,U).replace(a.PCT_ENCODED,n)),void 0!==e.path&&(e.path=String(e.path).replace(a.PCT_ENCODED,t).replace(e.scheme?a.NOT_PATH:a.NOT_PATH_NOSCHEME,U).replace(a.PCT_ENCODED,n)),void 0!==e.query&&(e.query=String(e.query).replace(a.PCT_ENCODED,t).replace(a.NOT_QUERY,U).replace(a.PCT_ENCODED,n)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(a.PCT_ENCODED,t).replace(a.NOT_FRAGMENT,U).replace(a.PCT_ENCODED,n)),e}function q(e){return e.replace(/^0*(.*)/,"$1")||"0"}function H(e,a){var t=e.match(a.IPV4ADDRESS)||[],i=l(t,2)[1];return i?i.split(".").map(q).join("."):e}function G(e,a){var t=e.match(a.IPV6ADDRESS)||[],i=l(t,3),n=i[1],o=i[2];if(n){for(var r=n.toLowerCase().split("::").reverse(),s=l(r,2),p=s[0],d=s[1],c=d?d.split(":").map(q):[],m=p.split(":").map(q),u=a.IPV4ADDRESS.test(m[m.length-1]),h=u?7:8,f=m.length-h,v=Array(h),g=0;g<h;++g)v[g]=c[g]||m[f+g]||"";u&&(v[h-1]=H(v[h-1],a));var y=v.reduce((function(e,a,t){if(!a||"0"===a){var i=e[e.length-1];i&&i.index+i.length===t?i.length++:e.push({index:t,length:1})}return e}),[]).sort((function(e,a){return a.length-e.length}))[0],b=void 0;if(y&&y.length>1){var w=v.slice(0,y.index),x=v.slice(y.index+y.length);b=w.join(":")+"::"+x.join(":")}else b=v.join(":");return o&&(b+="%"+o),b}return e}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,W=void 0==="".match(/(){0}/)[1];function Q(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},i=!1!==a.iri?d:p;"suffix"===a.reference&&(e=(a.scheme?a.scheme+":":"")+"//"+e);var n=e.match(K);if(n){W?(t.scheme=n[1],t.userinfo=n[3],t.host=n[4],t.port=parseInt(n[5],10),t.path=n[6]||"",t.query=n[7],t.fragment=n[8],isNaN(t.port)&&(t.port=n[5])):(t.scheme=n[1]||void 0,t.userinfo=-1!==e.indexOf("@")?n[3]:void 0,t.host=-1!==e.indexOf("//")?n[4]:void 0,t.port=parseInt(n[5],10),t.path=n[6]||"",t.query=-1!==e.indexOf("?")?n[7]:void 0,t.fragment=-1!==e.indexOf("#")?n[8]:void 0,isNaN(t.port)&&(t.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),t.host&&(t.host=G(H(t.host,i),i)),void 0!==t.scheme||void 0!==t.userinfo||void 0!==t.host||void 0!==t.port||t.path||void 0!==t.query?void 0===t.scheme?t.reference="relative":void 0===t.fragment?t.reference="absolute":t.reference="uri":t.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==t.reference&&(t.error=t.error||"URI is not a "+a.reference+" reference.");var o=z[(a.scheme||t.scheme||"").toLowerCase()];if(a.unicodeSupport||o&&o.unicodeSupport)M(t,i);else{if(t.host&&(a.domainHost||o&&o.domainHost))try{t.host=V.toASCII(t.host.replace(i.PCT_ENCODED,B).toLowerCase())}catch(e){t.error=t.error||"Host's domain name can not be converted to ASCII via punycode: "+e}M(t,p)}o&&o.parse&&o.parse(t,a)}else t.error=t.error||"URI can not be parsed.";return t}function J(e,a){var t=!1!==a.iri?d:p,i=[];return void 0!==e.userinfo&&(i.push(e.userinfo),i.push("@")),void 0!==e.host&&i.push(G(H(String(e.host),t),t).replace(t.IPV6ADDRESS,(function(e,a,t){return"["+a+(t?"%25"+t:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(i.push(":"),i.push(String(e.port))),i.length?i.join(""):void 0}var Y=/^\.\.?\//,X=/^\/\.(\/|$)/,Z=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function ae(e){for(var a=[];e.length;)if(e.match(Y))e=e.replace(Y,"");else if(e.match(X))e=e.replace(X,"/");else if(e.match(Z))e=e.replace(Z,"/"),a.pop();else if("."===e||".."===e)e="";else{var t=e.match(ee);if(!t)throw new Error("Unexpected dot segment condition");var i=t[0];e=e.slice(i.length),a.push(i)}return a.join("")}function te(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a.iri?d:p,i=[],n=z[(a.scheme||e.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(e,a),e.host)if(t.IPV6ADDRESS.test(e.host));else if(a.domainHost||n&&n.domainHost)try{e.host=a.iri?V.toUnicode(e.host):V.toASCII(e.host.replace(t.PCT_ENCODED,B).toLowerCase())}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(a.iri?"Unicode":"ASCII")+" via punycode: "+t}M(e,t),"suffix"!==a.reference&&e.scheme&&(i.push(e.scheme),i.push(":"));var o=J(e,a);if(void 0!==o&&("suffix"!==a.reference&&i.push("//"),i.push(o),e.path&&"/"!==e.path.charAt(0)&&i.push("/")),void 0!==e.path){var r=e.path;a.absolutePath||n&&n.absolutePath||(r=ae(r)),void 0===o&&(r=r.replace(/^\/\//,"/%2F")),i.push(r)}return void 0!==e.query&&(i.push("?"),i.push(e.query)),void 0!==e.fragment&&(i.push("#"),i.push(e.fragment)),i.join("")}function ie(e,a){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(e=Q(te(e,t),t),a=Q(te(a,t),t)),!(t=t||{}).tolerant&&a.scheme?(i.scheme=a.scheme,i.userinfo=a.userinfo,i.host=a.host,i.port=a.port,i.path=ae(a.path||""),i.query=a.query):(void 0!==a.userinfo||void 0!==a.host||void 0!==a.port?(i.userinfo=a.userinfo,i.host=a.host,i.port=a.port,i.path=ae(a.path||""),i.query=a.query):(a.path?("/"===a.path.charAt(0)?i.path=ae(a.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+a.path:i.path=a.path:i.path="/"+a.path,i.path=ae(i.path)),i.query=a.query):(i.path=e.path,void 0!==a.query?i.query=a.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=a.fragment,i}function ne(e,a,t){var i=r({scheme:"null"},t);return te(ie(Q(e,i),Q(a,i),i,!0),i)}function oe(e,a){return"string"==typeof e?e=te(Q(e,a),a):"object"===i(e)&&(e=Q(te(e,a),a)),e}function re(e,a,t){return"string"==typeof e?e=te(Q(e,t),t):"object"===i(e)&&(e=te(e,t)),"string"==typeof a?a=te(Q(a,t),t):"object"===i(a)&&(a=te(a,t)),e===a}function se(e,a){return e&&e.toString().replace(a&&a.iri?d.ESCAPE:p.ESCAPE,U)}function pe(e,a){return e&&e.toString().replace(a&&a.iri?d.PCT_ENCODED:p.PCT_ENCODED,B)}var de={scheme:"http",domainHost:!0,parse:function(e,a){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,a){var t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function ce(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var me={scheme:"ws",domainHost:!0,parse:function(e,a){var t=e;return t.secure=ce(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t},serialize:function(e,a){if(e.port!==(ce(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var t=e.resourceName.split("?"),i=l(t,2),n=i[0],o=i[1];e.path=n&&"/"!==n?n:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},ue={scheme:"wss",domainHost:me.domainHost,parse:me.parse,serialize:me.serialize},he={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ve="[0-9A-Fa-f]",ge=t(t("%[EFef]"+ve+"%"+ve+ve+"%"+ve+ve)+"|"+t("%[89A-Fa-f]"+ve+"%"+ve+ve)+"|"+t("%"+ve+ve)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=a("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),we="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",xe=new RegExp(fe,"g"),_e=new RegExp(ge,"g"),Ee=new RegExp(a("[^]",ye,"[\\.]",'[\\"]',be),"g"),Te=new RegExp(a("[^]",fe,we),"g"),Se=Te;function Ne(e){var a=B(e);return a.match(xe)?a:e}var Ie={scheme:"mailto",parse:function(e,a){var t=e,i=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var n=!1,o={},r=t.query.split("&"),s=0,p=r.length;s<p;++s){var d=r[s].split("=");switch(d[0]){case"to":for(var l=d[1].split(","),c=0,m=l.length;c<m;++c)i.push(l[c]);break;case"subject":t.subject=pe(d[1],a);break;case"body":t.body=pe(d[1],a);break;default:n=!0,o[pe(d[0],a)]=pe(d[1],a)}}n&&(t.headers=o)}t.query=void 0;for(var u=0,h=i.length;u<h;++u){var f=i[u].split("@");if(f[0]=pe(f[0]),a.unicodeSupport)f[1]=pe(f[1],a).toLowerCase();else try{f[1]=V.toASCII(pe(f[1],a).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}i[u]=f.join("@")}return t},serialize:function(e,a){var t=e,i=o(e.to);if(i){for(var r=0,s=i.length;r<s;++r){var p=String(i[r]),d=p.lastIndexOf("@"),l=p.slice(0,d).replace(_e,Ne).replace(_e,n).replace(Ee,U),c=p.slice(d+1);try{c=a.iri?V.toUnicode(c):V.toASCII(pe(c,a).toLowerCase())}catch(e){t.error=t.error||"Email address's domain name can not be converted to "+(a.iri?"Unicode":"ASCII")+" via punycode: "+e}i[r]=l+"@"+c}t.path=i.join(",")}var m=e.headers=e.headers||{};e.subject&&(m.subject=e.subject),e.body&&(m.body=e.body);var u=[];for(var h in m)m[h]!==he[h]&&u.push(h.replace(_e,Ne).replace(_e,n).replace(Te,U)+"="+m[h].replace(_e,Ne).replace(_e,n).replace(Se,U));return u.length&&(t.query=u.join("&")),t}},De=/^([^\:]+)\:(.*)/,Oe={scheme:"urn",parse:function(e,a){var t=e.path&&e.path.match(De),i=e;if(t){var n=a.scheme||i.scheme||"urn",o=t[1].toLowerCase(),r=t[2],s=n+":"+(a.nid||o),p=z[s];i.nid=o,i.nss=r,i.path=void 0,p&&(i=p.parse(i,a))}else i.error=i.error||"URN can not be parsed.";return i},serialize:function(e,a){var t=a.scheme||e.scheme||"urn",i=e.nid,n=t+":"+(a.nid||i),o=z[n];o&&(e=o.serialize(e,a));var r=e,s=e.nss;return r.path=(i||a.nid)+":"+s,r}},Ae=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ke={scheme:"urn:uuid",parse:function(e,a){var t=e;return t.uuid=t.nss,t.nss=void 0,a.tolerant||t.uuid&&t.uuid.match(Ae)||(t.error=t.error||"UUID is not valid."),t},serialize:function(e,a){var t=e;return t.nss=(e.uuid||"").toLowerCase(),t}};z[de.scheme]=de,z[le.scheme]=le,z[me.scheme]=me,z[ue.scheme]=ue,z[Ie.scheme]=Ie,z[Oe.scheme]=Oe,z[ke.scheme]=ke,e.SCHEMES=z,e.pctEncChar=U,e.pctDecChars=B,e.parse=Q,e.removeDotSegments=ae,e.serialize=te,e.resolveComponents=ie,e.resolve=ne,e.normalize=oe,e.equal=re,e.escapeComponent=se,e.unescapeComponent=pe,Object.defineProperty(e,"__esModule",{value:!0})}(wa.exports);var xa=wa.exports,_a=function e(a,t){if(a===t)return!0;if(a&&t&&"object"==typeof a&&"object"==typeof t){if(a.constructor!==t.constructor)return!1;var i,n,o;if(Array.isArray(a)){if((i=a.length)!=t.length)return!1;for(n=i;0!=n--;)if(!e(a[n],t[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===t.source&&a.flags===t.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===t.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===t.toString();if((i=(o=Object.keys(a)).length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;for(n=i;0!=n--;){var r=o[n];if(!e(a[r],t[r]))return!1}return!0}return a!=a&&t!=t},Ea={copy:function(e,a){for(var t in a=a||{},e)a[t]=e[t];return a},checkDataType:Ta,checkDataTypes:function(e,a,t){if(1===e.length)return Ta(e[0],a,t,!0);var i="",n=Na(e);for(var o in n.array&&n.object&&(i=n.null?"(":"(!"+a+" || ",i+="typeof "+a+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer,n)i+=(i?" && ":"")+Ta(o,a,t,!0);return i},coerceToTypes:function(e,a){if(Array.isArray(a)){for(var t=[],i=0;i<a.length;i++){var n=a[i];(Sa[n]||"array"===e&&"array"===n)&&(t[t.length]=n)}if(t.length)return t}else{if(Sa[a])return[a];if("array"===e&&"array"===a)return["array"]}},toHash:Na,getProperty:Oa,escapeQuotes:Aa,equal:_a,ucs2length:function(e){for(var a,t=0,i=e.length,n=0;n<i;)t++,(a=e.charCodeAt(n++))>=55296&&a<=56319&&n<i&&56320==(64512&(a=e.charCodeAt(n)))&&n++;return t},varOccurences:function(e,a){a+="[^0-9]";var t=e.match(new RegExp(a,"g"));return t?t.length:0},varReplace:function(e,a,t){return a+="([^0-9])",t=t.replace(/\$/g,"$$$$"),e.replace(new RegExp(a,"g"),t+"$1")},schemaHasRules:function(e,a){if("boolean"==typeof e)return!e;for(var t in e)if(a[t])return!0},schemaHasRulesExcept:function(e,a,t){if("boolean"==typeof e)return!e&&"not"!=t;for(var i in e)if(i!=t&&a[i])return!0},schemaUnknownRules:function(e,a){if("boolean"==typeof e)return;for(var t in e)if(!a[t])return t},toQuotedString:ka,getPathExpr:function(e,a,t,i){var n=t?"'/' + "+a+(i?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):i?"'[' + "+a+" + ']'":"'[\\'' + "+a+" + '\\']'";return Ca(e,n)},getPath:function(e,a,t){var i=ka(t?"/"+ja(a):Oa(a));return Ca(e,i)},getData:function(e,a,t){var i,n,o,r;if(""===e)return"rootData";if("/"==e[0]){if(!Ra.test(e))throw new Error("Invalid JSON-pointer: "+e);n=e,o="rootData"}else{if(!(r=e.match(Pa)))throw new Error("Invalid JSON-pointer: "+e);if(i=+r[1],"#"==(n=r[2])){if(i>=a)throw new Error("Cannot access property/index "+i+" levels up, current level is "+a);return t[a-i]}if(i>a)throw new Error("Cannot access data "+i+" levels up, current level is "+a);if(o="data"+(a-i||""),!n)return o}for(var s=o,p=n.split("/"),d=0;d<p.length;d++){var l=p[d];l&&(s+=" && "+(o+=Oa($a(l))))}return s},unescapeFragment:function(e){return $a(decodeURIComponent(e))},unescapeJsonPointer:$a,escapeFragment:function(e){return encodeURIComponent(ja(e))},escapeJsonPointer:ja};function Ta(e,a,t,i){var n=i?" !== ":" === ",o=i?" || ":" && ",r=i?"!":"",s=i?"":"!";switch(e){case"null":return a+n+"null";case"array":return r+"Array.isArray("+a+")";case"object":return"("+r+a+o+"typeof "+a+n+'"object"'+o+s+"Array.isArray("+a+"))";case"integer":return"(typeof "+a+n+'"number"'+o+s+"("+a+" % 1)"+o+a+n+a+(t?o+r+"isFinite("+a+")":"")+")";case"number":return"(typeof "+a+n+'"'+e+'"'+(t?o+r+"isFinite("+a+")":"")+")";default:return"typeof "+a+n+'"'+e+'"'}}var Sa=Na(["string","number","integer","boolean","null"]);function Na(e){for(var a={},t=0;t<e.length;t++)a[e[t]]=!0;return a}var Ia=/^[a-z$_][a-z$_0-9]*$/i,Da=/'|\\/g;function Oa(e){return"number"==typeof e?"["+e+"]":Ia.test(e)?"."+e:"['"+Aa(e)+"']"}function Aa(e){return e.replace(Da,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function ka(e){return"'"+Aa(e)+"'"}var Ra=/^\/(?:[^~]|~0|~1)*$/,Pa=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ca(e,a){return'""'==e?a:(e+" + "+a).replace(/([^\\])' \+ '/g,"$1")}function ja(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function $a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var Fa=Ea,La=function(e){Fa.copy(e,this)};var Va={exports:{}},za=Va.exports=function(e,a,t){"function"==typeof a&&(t=a,a={}),Ua(a,"function"==typeof(t=a.cb||t)?t:t.pre||function(){},t.post||function(){},e,"",e)};function Ua(e,a,t,i,n,o,r,s,p,d){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var l in a(i,n,o,r,s,p,d),i){var c=i[l];if(Array.isArray(c)){if(l in za.arrayKeywords)for(var m=0;m<c.length;m++)Ua(e,a,t,c[m],n+"/"+l+"/"+m,o,n,l,i,m)}else if(l in za.propsKeywords){if(c&&"object"==typeof c)for(var u in c)Ua(e,a,t,c[u],n+"/"+l+"/"+u.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,l,i,u)}else(l in za.keywords||e.allKeys&&!(l in za.skipKeywords))&&Ua(e,a,t,c,n+"/"+l,o,n,l,i)}t(i,n,o,r,s,p,d)}}za.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},za.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},za.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},za.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};var Ba=Va.exports,Ma=xa,qa=_a,Ha=Ea,Ga=La,Ka=Ba,Wa=Qa;function Qa(e,a,t){var i=this._refs[t];if("string"==typeof i){if(!this._refs[i])return Qa.call(this,e,a,i);i=this._refs[i]}if((i=i||this._schemas[t])instanceof Ga)return at(i.schema,this._opts.inlineRefs)?i.schema:i.validate||this._compile(i);var n,o,r,s=Ja.call(this,a,t);return s&&(n=s.schema,a=s.root,r=s.baseId),n instanceof Ga?o=n.validate||e.call(this,n.schema,a,void 0,r):void 0!==n&&(o=at(n,this._opts.inlineRefs)?n:e.call(this,n,a,void 0,r)),o}function Ja(e,a){var t=Ma.parse(a),i=ot(t),n=nt(this._getId(e.schema));if(0===Object.keys(e.schema).length||i!==n){var o=st(i),r=this._refs[o];if("string"==typeof r)return Ya.call(this,e,r,t);if(r instanceof Ga)r.validate||this._compile(r),e=r;else{if(!((r=this._schemas[o])instanceof Ga))return;if(r.validate||this._compile(r),o==st(a))return{schema:r,root:e,baseId:n};e=r}if(!e.schema)return;n=nt(this._getId(e.schema))}return Za.call(this,t,n,e.schema,e)}function Ya(e,a,t){var i=Ja.call(this,e,a);if(i){var n=i.schema,o=i.baseId;e=i.root;var r=this._getId(n);return r&&(o=pt(o,r)),Za.call(this,t,o,n,e)}}Qa.normalizeId=st,Qa.fullPath=nt,Qa.url=pt,Qa.ids=function(e){var a=st(this._getId(e)),t={"":a},i={"":nt(a,!1)},n={},o=this;return Ka(e,{allKeys:!0},(function(e,a,r,s,p,d,l){if(""!==a){var c=o._getId(e),m=t[s],u=i[s]+"/"+p;if(void 0!==l&&(u+="/"+("number"==typeof l?l:Ha.escapeFragment(l))),"string"==typeof c){c=m=st(m?Ma.resolve(m,c):c);var h=o._refs[c];if("string"==typeof h&&(h=o._refs[h]),h&&h.schema){if(!qa(e,h.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=st(u))if("#"==c[0]){if(n[c]&&!qa(e,n[c]))throw new Error('id "'+c+'" resolves to more than one schema');n[c]=e}else o._refs[c]=u}t[a]=m,i[a]=u}})),n},Qa.inlineRef=at,Qa.schema=Ja;var Xa=Ha.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Za(e,a,t,i){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var n=e.fragment.split("/"),o=1;o<n.length;o++){var r=n[o];if(r){if(void 0===(t=t[r=Ha.unescapeFragment(r)]))break;var s;if(!Xa[r]&&((s=this._getId(t))&&(a=pt(a,s)),t.$ref)){var p=pt(a,t.$ref),d=Ja.call(this,i,p);d&&(t=d.schema,i=d.root,a=d.baseId)}}}return void 0!==t&&t!==i.schema?{schema:t,root:i,baseId:a}:void 0}}var et=Ha.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function at(e,a){return!1!==a&&(void 0===a||!0===a?tt(e):a?it(e)<=a:void 0)}function tt(e){var a;if(Array.isArray(e)){for(var t=0;t<e.length;t++)if("object"==typeof(a=e[t])&&!tt(a))return!1}else for(var i in e){if("$ref"==i)return!1;if("object"==typeof(a=e[i])&&!tt(a))return!1}return!0}function it(e){var a,t=0;if(Array.isArray(e)){for(var i=0;i<e.length;i++)if("object"==typeof(a=e[i])&&(t+=it(a)),t==1/0)return 1/0}else for(var n in e){if("$ref"==n)return 1/0;if(et[n])t++;else if("object"==typeof(a=e[n])&&(t+=it(a)+1),t==1/0)return 1/0}return t}function nt(e,a){return!1!==a&&(e=st(e)),ot(Ma.parse(e))}function ot(e){return Ma.serialize(e).split("#")[0]+"#"}var rt=/#\/?$/;function st(e){return e?e.replace(rt,""):""}function pt(e,a){return a=st(a),Ma.resolve(e,a)}var dt=Wa,lt={Validation:mt((function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0})),MissingRef:mt(ct)};function ct(e,a,t){this.message=t||ct.message(e,a),this.missingRef=dt.url(e,a),this.missingSchema=dt.normalizeId(dt.fullPath(this.missingRef))}function mt(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}ct.message=function(e,a){return"can't resolve reference "+a+" from id "+e};var ut=function(e,a){a||(a={}),"function"==typeof a&&(a={cmp:a});var t,i="boolean"==typeof a.cycles&&a.cycles,n=a.cmp&&(t=a.cmp,function(e){return function(a,i){var n={key:a,value:e[a]},o={key:i,value:e[i]};return t(n,o)}}),o=[];return function e(a){if(a&&a.toJSON&&"function"==typeof a.toJSON&&(a=a.toJSON()),void 0!==a){if("number"==typeof a)return isFinite(a)?""+a:"null";if("object"!=typeof a)return JSON.stringify(a);var t,r;if(Array.isArray(a)){for(r="[",t=0;t<a.length;t++)t&&(r+=","),r+=e(a[t])||"null";return r+"]"}if(null===a)return"null";if(-1!==o.indexOf(a)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=o.push(a)-1,p=Object.keys(a).sort(n&&n(a));for(r="",t=0;t<p.length;t++){var d=p[t],l=e(a[d]);l&&(r&&(r+=","),r+=JSON.stringify(d)+":"+l)}return o.splice(s,1),"{"+r+"}"}}(e)},ht=function(e,a,t){var i="",n=!0===e.schema.$async,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),r=e.self._getId(e.schema);if(e.opts.strictKeywords){var s=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(s){var p="unknown keyword: "+s;if("log"!==e.opts.strictKeywords)throw new Error(p);e.logger.warn(p)}}if(e.isTop&&(i+=" var validate = ",n&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",r&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" /*# sourceURL="+r+" */ ")),"boolean"==typeof e.schema||!o&&!e.schema.$ref){a="false schema";var d=e.level,l=e.dataLevel,c=e.schema[a],m=e.schemaPath+e.util.getProperty(a),u=e.errSchemaPath+"/"+a,h=!e.opts.allErrors,f="data"+(l||""),v="valid"+d;if(!1===e.schema){e.isTop?h=!0:i+=" var "+v+" = false; ",(J=J||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",!1!==e.opts.messages&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;i=J.pop(),!e.compositeRule&&h?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i+=n?" return data; ":" validate.errors = null; return true; ":i+=" var "+v+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var y=e.isTop;d=e.level=0,l=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(b);e.logger.warn(b)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{d=e.level,f="data"+((l=e.dataLevel)||"");if(r&&(e.baseId=e.resolve.url(e.baseId,r)),n&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+d+" = errors;"}v="valid"+d,h=!e.opts.allErrors;var w="",x="",_=e.schema.type,E=Array.isArray(_);if(_&&e.opts.nullable&&!0===e.schema.nullable&&(E?-1==_.indexOf("null")&&(_=_.concat("null")):"null"!=_&&(_=[_,"null"],E=!0)),E&&1==_.length&&(_=_[0],E=!1),e.schema.$ref&&o){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),_){if(e.opts.coerceTypes)var T=e.util.coerceToTypes(e.opts.coerceTypes,_);var S=e.RULES.types[_];if(T||E||!0===S||S&&!Y(S)){m=e.schemaPath+".type",u=e.errSchemaPath+"/type",m=e.schemaPath+".type",u=e.errSchemaPath+"/type";var N=E?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[N](_,f,e.opts.strictNumbers,!0)+") { ",T){var I="dataType"+d,D="coerced"+d;i+=" var "+I+" = typeof "+f+"; var "+D+" = undefined; ","array"==e.opts.coerceTypes&&(i+=" if ("+I+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+I+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+D+" = "+f+"; } "),i+=" if ("+D+" !== undefined) ; ";var O=T;if(O)for(var A,k=-1,R=O.length-1;k<R;)"string"==(A=O[k+=1])?i+=" else if ("+I+" == 'number' || "+I+" == 'boolean') "+D+" = '' + "+f+"; else if ("+f+" === null) "+D+" = ''; ":"number"==A||"integer"==A?(i+=" else if ("+I+" == 'boolean' || "+f+" === null || ("+I+" == 'string' && "+f+" && "+f+" == +"+f+" ","integer"==A&&(i+=" && !("+f+" % 1)"),i+=")) "+D+" = +"+f+"; "):"boolean"==A?i+=" else if ("+f+" === 'false' || "+f+" === 0 || "