@magiclabs.ai/magicbook-client 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { DesignRequestEventDetail } from '../models/design-request';
1
2
  export declare const states: readonly ["new", "ingesting", "submitted", "storyboarding", "deduplication", "image selection", "designing", "layouting", "embellishing", "polishing", "ready", "error"];
2
3
  export declare const occasions: readonly ["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"];
3
4
  export declare const styles: {
@@ -489,3 +490,4 @@ export declare const imageDensities: readonly ["low", "medium", "high"];
489
490
  export declare const imageFilteringLevels: readonly ["best", "most", "all"];
490
491
  export declare const embellishmentLevels: readonly ["none", "few", "lots"];
491
492
  export declare const textStickerLevels: readonly ["none", "few", "lots"];
493
+ export declare const timeoutMessage: DesignRequestEventDetail;
@@ -4394,8 +4394,13 @@ const Hr = [
4394
4394
  6097: { slug: "boho-wedding-sfly" },
4395
4395
  6098: { slug: "black-and-white-rustic-sfly" },
4396
4396
  6099: { slug: "bright-color-pop-sfly" }
4397
- }, ds = ["8x8", "10x10", "12x12", "8x11", "11x8", "11x14"], fs = ["sc", "hc", "pl"], hs = ["sp", "sl", "dl"], ps = ["low", "medium", "high"], ms = ["best", "most", "all"], ys = ["none", "few", "lots"], gs = ["none", "few", "lots"], Jr = "https://api.sfly-sls.magicbook.io", Wr = "wss://socket.sfly-sls.magicbook.io", Kr = parseInt("300000") || 3e5;
4398
- class qr {
4397
+ }, ds = ["8x8", "10x10", "12x12", "8x11", "11x8", "11x14"], fs = ["sc", "hc", "pl"], hs = ["sp", "sl", "dl"], ps = ["low", "medium", "high"], ms = ["best", "most", "all"], ys = ["none", "few", "lots"], gs = ["none", "few", "lots"], Jr = {
4398
+ state: "error",
4399
+ slug: "error",
4400
+ progress: 100,
4401
+ message: "Design failed"
4402
+ }, Wr = "https://api.sfly-sls.magicbook.io", Kr = "wss://socket.sfly-sls.magicbook.io", qr = parseInt("30000") || 3e4;
4403
+ class Gr {
4399
4404
  constructor(e) {
4400
4405
  b(this, "occasion");
4401
4406
  b(this, "style");
@@ -4409,7 +4414,7 @@ class qr {
4409
4414
  this.occasion = e.occasion, this.style = e.style, this.book_size = e.book_size, this.cover_type = e.cover_type, this.page_type = e.page_type, this.image_density = e.image_density, this.image_filtering_level = e.image_filtering_level, this.embellishment_level = e.embellishment_level, this.text_sticker_level = e.text_sticker_level;
4410
4415
  }
4411
4416
  }
4412
- const Gr = d.object({
4417
+ const Xr = d.object({
4413
4418
  occasion: d.enum(cs),
4414
4419
  style: d.string(),
4415
4420
  book_size: d.enum(ds),
@@ -4422,7 +4427,7 @@ const Gr = d.object({
4422
4427
  }), vs = d.object({
4423
4428
  id: d.string(),
4424
4429
  title: d.string(),
4425
- design_request: Gr,
4430
+ design_request: Xr,
4426
4431
  state: d.enum(Hr).optional(),
4427
4432
  guid: d.string().optional()
4428
4433
  });
@@ -4433,7 +4438,7 @@ class yt {
4433
4438
  b(this, "design_request");
4434
4439
  b(this, "state");
4435
4440
  b(this, "guid");
4436
- this.id = e.id, this.title = e.title, this.design_request = new qr(e.design_request), this.state = e.state, this.guid = e.guid;
4441
+ this.id = e.id, this.title = e.title, this.design_request = new Gr(e.design_request), this.state = e.state, this.guid = e.guid;
4437
4442
  }
4438
4443
  }
4439
4444
  function Ct(t) {
@@ -4451,14 +4456,14 @@ const Qe = d.object({
4451
4456
  maxImageCount: d.number(),
4452
4457
  avgImageCount: d.number(),
4453
4458
  minImageCount: d.number()
4454
- }), Xr = d.object({
4459
+ }), Yr = d.object({
4455
4460
  high: Qe,
4456
4461
  medium: Qe,
4457
4462
  low: Qe
4458
- }), Yr = d.object({
4459
- densities: Xr
4463
+ }), Qr = d.object({
4464
+ densities: Yr
4460
4465
  });
4461
- async function Qr({ apiKey: t, apiHost: e }, s, n, r) {
4466
+ async function ei({ apiKey: t, apiHost: e }, s, n, r) {
4462
4467
  return Se(async () => {
4463
4468
  const i = await Qt(
4464
4469
  {
@@ -4467,19 +4472,19 @@ async function Qr({ apiKey: t, apiHost: e }, s, n, r) {
4467
4472
  apiKey: t
4468
4473
  }
4469
4474
  ), a = jt(i.data);
4470
- return Yr.parse(a);
4475
+ return Qr.parse(a);
4471
4476
  });
4472
4477
  }
4473
- const ei = d.object({
4478
+ const ti = d.object({
4474
4479
  photoRefId: d.string(),
4475
4480
  finalCrop: d.array(d.number())
4476
- }), ti = d.object({
4481
+ }), si = d.object({
4477
4482
  x: d.number(),
4478
4483
  y: d.number(),
4479
4484
  width: d.number().optional(),
4480
4485
  height: d.number().optional(),
4481
4486
  rotation: d.number()
4482
- }), si = d.object({
4487
+ }), ni = d.object({
4483
4488
  id: d.string(),
4484
4489
  llx: d.number(),
4485
4490
  lly: d.number(),
@@ -4493,13 +4498,13 @@ const ei = d.object({
4493
4498
  source: d.string(),
4494
4499
  rotation: d.number(),
4495
4500
  uploadTime: d.string()
4496
- }), ni = d.object({
4501
+ }), ri = d.object({
4497
4502
  key: d.string(),
4498
4503
  value: d.any()
4499
- }), ri = d.object({
4504
+ }), ii = d.object({
4500
4505
  type: d.string(),
4501
- imageAssignment: ei.optional(),
4502
- position: ti,
4506
+ imageAssignment: ti.optional(),
4507
+ position: si,
4503
4508
  seqNum: d.number(),
4504
4509
  z: d.number(),
4505
4510
  id: d.string().optional(),
@@ -4510,34 +4515,34 @@ const ei = d.object({
4510
4515
  fontSize: d.number().optional(),
4511
4516
  fontColor: d.string().optional(),
4512
4517
  frame: d.string().optional()
4513
- }), ii = d.object({
4518
+ }), ai = d.object({
4514
4519
  url: d.string(),
4515
4520
  encryptId: d.string(),
4516
4521
  photoRefId: d.string(),
4517
4522
  photoId: d.string(),
4518
- photoMetadata: si
4519
- }), ai = d.object({
4520
- properties: d.array(ni)
4523
+ photoMetadata: ni
4521
4524
  }), oi = d.object({
4522
- backgroundId: d.string().nullable(),
4523
- assets: d.array(ri).optional()
4525
+ properties: d.array(ri)
4524
4526
  }), li = d.object({
4527
+ backgroundId: d.string().nullable(),
4528
+ assets: d.array(ii).optional()
4529
+ }), ci = d.object({
4525
4530
  pageNum: d.number(),
4526
4531
  type: d.string(),
4527
- canvas: oi
4528
- }), ci = d.object({
4529
- pages: d.array(li),
4530
- photoStrip: d.array(ii)
4532
+ canvas: li
4531
4533
  }), ui = d.object({
4534
+ pages: d.array(ci),
4535
+ photoStrip: d.array(ai)
4536
+ }), di = d.object({
4532
4537
  title: d.string(),
4533
4538
  binding: d.string(),
4534
4539
  coverSpecId: d.string(),
4535
4540
  styleId: d.number(),
4536
4541
  userId: d.string(),
4537
- magicShopBook: ci,
4538
- reportingData: ai
4542
+ magicShopBook: ui,
4543
+ reportingData: oi
4539
4544
  });
4540
- async function di({ apiHost: t, apiKey: e }, s) {
4545
+ async function fi({ apiHost: t, apiKey: e }, s) {
4541
4546
  return Se(async () => {
4542
4547
  const n = (await es({ url: `${t}/v1/books`, apiKey: e, payload: s })).data;
4543
4548
  return vs.safeParse(n), new yt(n);
@@ -4549,15 +4554,16 @@ async function At({ apiHost: t, apiKey: e }, s) {
4549
4554
  return vs.safeParse(n), new yt(n);
4550
4555
  });
4551
4556
  }
4552
- async function fi({ apiHost: t, apiKey: e }, s) {
4557
+ async function hi({ apiHost: t, apiKey: e }, s) {
4553
4558
  return Se(async () => {
4554
4559
  const n = (await Qt({ url: `${t}/v1/books/${s}/format/galleon`, apiKey: e })).data;
4555
- return ui.parse(n);
4560
+ return di.parse(n);
4556
4561
  });
4557
4562
  }
4558
- class hi {
4563
+ class pi {
4559
4564
  constructor(e, s, n) {
4560
4565
  b(this, "client");
4566
+ b(this, "webSocket");
4561
4567
  b(this, "parentId");
4562
4568
  b(this, "title");
4563
4569
  b(this, "occasion");
@@ -4571,10 +4577,10 @@ class hi {
4571
4577
  b(this, "textStickerLevel");
4572
4578
  b(this, "images");
4573
4579
  b(this, "guid");
4574
- this.client = s, this.parentId = e, this.title = (n == null ? void 0 : n.title) || "", this.occasion = (n == null ? void 0 : n.occasion) || cs[0], this.style = (n == null ? void 0 : n.style) || parseInt(Object.keys(us)[0]), this.bookSize = (n == null ? void 0 : n.bookSize) || ds[0], this.coverType = (n == null ? void 0 : n.coverType) || fs[0], this.pageType = (n == null ? void 0 : n.pageType) || hs[0], this.imageDensity = (n == null ? void 0 : n.imageDensity) || ps[0], this.imageFilteringLevel = (n == null ? void 0 : n.imageFilteringLevel) || ms[0], this.embellishmentLevel = (n == null ? void 0 : n.embellishmentLevel) || ys[0], this.textStickerLevel = (n == null ? void 0 : n.textStickerLevel) || gs[0], this.images = new $r(this.client, this.parentId);
4580
+ this.parentId = e, this.client = s, this.webSocket = new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`), this.title = (n == null ? void 0 : n.title) || "", this.occasion = (n == null ? void 0 : n.occasion) || cs[0], this.style = (n == null ? void 0 : n.style) || parseInt(Object.keys(us)[0]), this.bookSize = (n == null ? void 0 : n.bookSize) || ds[0], this.coverType = (n == null ? void 0 : n.coverType) || fs[0], this.pageType = (n == null ? void 0 : n.pageType) || hs[0], this.imageDensity = (n == null ? void 0 : n.imageDensity) || ps[0], this.imageFilteringLevel = (n == null ? void 0 : n.imageFilteringLevel) || ms[0], this.embellishmentLevel = (n == null ? void 0 : n.embellishmentLevel) || ys[0], this.textStickerLevel = (n == null ? void 0 : n.textStickerLevel) || gs[0], this.images = new $r(this.client, this.parentId);
4575
4581
  }
4576
4582
  async getOptions(e) {
4577
- return await Qr(
4583
+ return await ei(
4578
4584
  this.client,
4579
4585
  this.bookSize,
4580
4586
  e || this.images.length,
@@ -4588,52 +4594,55 @@ class hi {
4588
4594
  return this.guid = e, await At(this.client, Ct(this)), this.guid;
4589
4595
  }
4590
4596
  async getJSON() {
4591
- return await fi(this.client, this.parentId);
4597
+ return await hi(this.client, this.parentId);
4598
+ }
4599
+ async eventHandler(e, s = "MagicBook.designRequestUpdated") {
4600
+ const n = new CustomEvent(s, { detail: e });
4601
+ window.dispatchEvent(n), ["error", "ready"].includes(e.slug) && this.webSocket.close();
4602
+ }
4603
+ timeoutHandler() {
4604
+ return setTimeout(() => {
4605
+ this.eventHandler(Jr);
4606
+ }, qr);
4592
4607
  }
4593
4608
  async getProgress() {
4594
- let e = "new";
4595
- const s = new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`), n = setTimeout(() => {
4596
- throw s.close(), new Error("Something went wrong. Please try again.");
4597
- }, Kr);
4598
- s.onmessage = (r) => {
4599
- const i = JSON.parse(r.data);
4600
- if (e !== i.state) {
4601
- e = i.state;
4602
- const a = new CustomEvent("MagicBook.designRequestUpdated", { detail: i });
4603
- ["error", "ready"].includes(i.state) && (s.close(), clearTimeout(n)), window.dispatchEvent(a);
4604
- }
4605
- };
4609
+ let e = "new", s;
4610
+ this.webSocket.onmessage = (n) => {
4611
+ const r = JSON.parse(n.data);
4612
+ e !== r.slug && (s && clearTimeout(s), s = this.timeoutHandler(), this.eventHandler(r), e = r.slug);
4613
+ }, this.webSocket.onclose = () => clearTimeout(s);
4606
4614
  }
4607
4615
  }
4608
- class mi {
4609
- constructor(e, s = Jr, n = Wr) {
4616
+ class yi {
4617
+ constructor(e, s = Wr, n = Kr) {
4610
4618
  b(this, "apiKey");
4611
4619
  b(this, "apiHost");
4612
4620
  b(this, "webSocketHost");
4613
4621
  this.apiKey = e, this.apiHost = s, this.webSocketHost = n;
4614
4622
  }
4615
4623
  async createDesignRequest(e) {
4616
- const s = await di(this);
4617
- return new hi(s.id, this, e);
4624
+ const s = await fi(this);
4625
+ return new pi(s.id, this, e);
4618
4626
  }
4619
4627
  }
4620
4628
  export {
4621
- hi as DesignRequest,
4629
+ pi as DesignRequest,
4622
4630
  Fr as ImageServer,
4623
4631
  $r as Images,
4624
- mi as MagicBookClient,
4632
+ yi as MagicBookClient,
4625
4633
  ds as bookSizes,
4626
4634
  fs as coverTypes,
4627
- Yr as designOptionsSchema,
4635
+ Qr as designOptionsSchema,
4628
4636
  ys as embellishmentLevels,
4629
4637
  ps as imageDensities,
4630
4638
  Qe as imageDensityOptionSchema,
4631
- Xr as imageDensityOptionsSchema,
4639
+ Yr as imageDensityOptionsSchema,
4632
4640
  ms as imageFilteringLevels,
4633
4641
  Vr as imageServerSchema,
4634
4642
  cs as occasions,
4635
4643
  hs as pageTypes,
4636
4644
  Hr as states,
4637
4645
  us as styles,
4638
- gs as textStickerLevels
4646
+ gs as textStickerLevels,
4647
+ Jr as timeoutMessage
4639
4648
  };
@@ -1,4 +1,4 @@
1
- (function(O,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(O=typeof globalThis<"u"?globalThis:O||self,Z(O["magicbook-client"]={}))})(this,function(O){"use strict";var ai=Object.defineProperty;var oi=(O,Z,q)=>Z in O?ai(O,Z,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[Z]=q;var b=(O,Z,q)=>(oi(O,typeof Z!="symbol"?Z+"":Z,q),q);function Z(t,e,s){const n=e.pop()||"",r=e.reduce((i,a)=>i[a]=i[a]||{},t);r[n]=s}function q(t,e){return Object.keys(e).map(s=>{typeof t[s]=="object"&&typeof e[s]=="object"?q(t[s],e[s]):t[s]=e[s]}),t}function Ns(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function Ct(t){return Object.keys(t).map(e=>{const s=Ns(e);s.includes("_")&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Ct(t[s]))}),t}function Cs(t){return t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""))}function At(t){return Object.keys(t).map(e=>{const s=Cs(e);s!==e&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=At(t[s]))}),t}function Rt(t,e){return function(){return t.apply(e,arguments)}}const{toString:As}=Object.prototype,{getPrototypeOf:Qe}=Object,Ce=(t=>e=>{const s=As.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),z=t=>(t=t.toLowerCase(),e=>Ce(e)===t),Ae=t=>e=>typeof e===t,{isArray:ie}=Array,fe=Ae("undefined");function Rs(t){return t!==null&&!fe(t)&&t.constructor!==null&&!fe(t.constructor)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const It=z("ArrayBuffer");function Is(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&It(t.buffer),e}const js=Ae("string"),L=Ae("function"),jt=Ae("number"),Re=t=>t!==null&&typeof t=="object",Zs=t=>t===!0||t===!1,Ie=t=>{if(Ce(t)!=="object")return!1;const e=Qe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ls=z("Date"),Ds=z("File"),Ps=z("Blob"),Bs=z("FileList"),Ms=t=>Re(t)&&L(t.pipe),Us=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ce(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},zs=z("URLSearchParams"),$s=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function he(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ie(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let o;for(n=0;n<a;n++)o=i[n],e.call(null,t[o],o,t)}}function Zt(t,e){e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Lt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Dt=t=>!fe(t)&&t!==Lt;function et(){const{caseless:t}=Dt(this)&&this||{},e={},s=(n,r)=>{const i=t&&Zt(e,r)||r;Ie(e[i])&&Ie(n)?e[i]=et(e[i],n):Ie(n)?e[i]=et({},n):ie(n)?e[i]=n.slice():e[i]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&he(arguments[n],s);return e}const Vs=(t,e,s,{allOwnKeys:n}={})=>(he(e,(r,i)=>{s&&L(r)?t[i]=Rt(r,s):t[i]=r},{allOwnKeys:n}),t),Fs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Hs=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Js=(t,e,s,n)=>{let r,i,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)a=r[i],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=s!==!1&&Qe(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},Ws=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},Ks=t=>{if(!t)return null;if(ie(t))return t;let e=t.length;if(!jt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},qs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qe(Uint8Array)),Gs=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Xs=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},Ys=z("HTMLFormElement"),Qs=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),Pt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),en=z("RegExp"),Bt=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};he(s,(r,i)=>{e(r,i,t)!==!1&&(n[i]=r)}),Object.defineProperties(t,n)},tn=t=>{Bt(t,(e,s)=>{if(L(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(L(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},sn=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ie(t)?n(t):n(String(t).split(e)),s},nn=()=>{},rn=(t,e)=>(t=+t,Number.isFinite(t)?t:e),tt="abcdefghijklmnopqrstuvwxyz",Mt="0123456789",Ut={DIGIT:Mt,ALPHA:tt,ALPHA_DIGIT:tt+tt.toUpperCase()+Mt},an=(t=16,e=Ut.ALPHA_DIGIT)=>{let s="";const{length:n}=e;for(;t--;)s+=e[Math.random()*n|0];return s};function on(t){return!!(t&&L(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const ln=t=>{const e=new Array(10),s=(n,r)=>{if(Re(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const i=ie(n)?[]:{};return he(n,(a,o)=>{const u=s(a,r+1);!fe(u)&&(i[o]=u)}),e[r]=void 0,i}}return n};return s(t,0)},cn=z("AsyncFunction"),c={isArray:ie,isArrayBuffer:It,isBuffer:Rs,isFormData:Us,isArrayBufferView:Is,isString:js,isNumber:jt,isBoolean:Zs,isObject:Re,isPlainObject:Ie,isUndefined:fe,isDate:Ls,isFile:Ds,isBlob:Ps,isRegExp:en,isFunction:L,isStream:Ms,isURLSearchParams:zs,isTypedArray:qs,isFileList:Bs,forEach:he,merge:et,extend:Vs,trim:$s,stripBOM:Fs,inherits:Hs,toFlatObject:Js,kindOf:Ce,kindOfTest:z,endsWith:Ws,toArray:Ks,forEachEntry:Gs,matchAll:Xs,isHTMLForm:Ys,hasOwnProperty:Pt,hasOwnProp:Pt,reduceDescriptors:Bt,freezeMethods:tn,toObjectSet:sn,toCamelCase:Qs,noop:nn,toFiniteNumber:rn,findKey:Zt,global:Lt,isContextDefined:Dt,ALPHABET:Ut,generateString:an,isSpecCompliantForm:on,toJSONObject:ln,isAsyncFn:cn,isThenable:t=>t&&(Re(t)||L(t))&&L(t.then)&&L(t.catch)};function T(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r)}c.inherits(T,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const zt=T.prototype,$t={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{$t[t]={value:t}}),Object.defineProperties(T,$t),Object.defineProperty(zt,"isAxiosError",{value:!0}),T.from=(t,e,s,n,r,i)=>{const a=Object.create(zt);return c.toFlatObject(t,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),T.call(a,t.message,e,s,n,r),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const un=null;function st(t){return c.isPlainObject(t)||c.isArray(t)}function Vt(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Ft(t,e,s){return t?t.concat(e).map(function(r,i){return r=Vt(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function dn(t){return c.isArray(t)&&!t.some(st)}const fn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function je(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,K){return!c.isUndefined(K[S])});const n=s.metaTokens,r=s.visitor||f,i=s.dots,a=s.indexes,u=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(c.isDate(g))return g.toISOString();if(!u&&c.isBlob(g))throw new T("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(g)||c.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,S,K){let U=g;if(g&&!K&&typeof g=="object"){if(c.endsWith(S,"{}"))S=n?S:S.slice(0,-2),g=JSON.stringify(g);else if(c.isArray(g)&&dn(g)||(c.isFileList(g)||c.endsWith(S,"[]"))&&(U=c.toArray(g)))return S=Vt(S),U.forEach(function(Ye,ii){!(c.isUndefined(Ye)||Ye===null)&&e.append(a===!0?Ft([S],ii,i):a===null?S:S+"[]",l(Ye))}),!1}return st(g)?!0:(e.append(Ft(K,S,i),l(g)),!1)}const _=[],A=Object.assign(fn,{defaultVisitor:f,convertValue:l,isVisitable:st});function N(g,S){if(!c.isUndefined(g)){if(_.indexOf(g)!==-1)throw Error("Circular reference detected in "+S.join("."));_.push(g),c.forEach(g,function(U,de){(!(c.isUndefined(U)||U===null)&&r.call(e,U,c.isString(de)?de.trim():de,S,A))===!0&&N(U,S?S.concat(de):[de])}),_.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return N(t),e}function Ht(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function nt(t,e){this._pairs=[],t&&je(t,this,e)}const Jt=nt.prototype;Jt.append=function(e,s){this._pairs.push([e,s])},Jt.toString=function(e){const s=e?function(n){return e.call(this,n,Ht)}:Ht;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function hn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wt(t,e,s){if(!e)return t;const n=s&&s.encode||hn,r=s&&s.serialize;let i;if(r?i=r(e,s):i=c.isURLSearchParams(e)?e.toString():new nt(e,s).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class mn{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Kt=mn,qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pn=typeof URLSearchParams<"u"?URLSearchParams:nt,yn=typeof FormData<"u"?FormData:null,gn=typeof Blob<"u"?Blob:null,vn=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),_n=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),$={isBrowser:!0,classes:{URLSearchParams:pn,FormData:yn,Blob:gn},isStandardBrowserEnv:vn,isStandardBrowserWebWorkerEnv:_n,protocols:["http","https","file","blob","url","data"]};function bn(t,e){return je(t,new $.classes.URLSearchParams,Object.assign({visitor:function(s,n,r,i){return $.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function wn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xn(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function Gt(t){function e(s,n,r,i){let a=s[i++];const o=Number.isFinite(+a),u=i>=s.length;return a=!a&&c.isArray(r)?r.length:a,u?(c.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!c.isObject(r[a]))&&(r[a]=[]),e(s,n,r[a],i)&&c.isArray(r[a])&&(r[a]=xn(r[a])),!o)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(wn(n),r,s,0)}),s}return null}const kn={"Content-Type":void 0};function Sn(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Ze={transitional:qt,adapter:["xhr","http"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r&&r?JSON.stringify(Gt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return bn(e,this.formSerializer).toString();if((o=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return je(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||r?(s.setContentType("application/json",!1),Sn(e)):e}],transformResponse:[function(e){const s=this.transitional||Ze.transitional,n=s&&s.forcedJSONParsing,r=this.responseType==="json";if(e&&c.isString(e)&&(n&&!this.responseType||r)){const a=!(s&&s.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?T.from(o,T.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(e){Ze.headers[e]={}}),c.forEach(["post","put","patch"],function(e){Ze.headers[e]=c.merge(kn)});const rt=Ze,Tn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),En=t=>{const e={};let s,n,r;return t&&t.split(`
2
- `).forEach(function(a){r=a.indexOf(":"),s=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!s||e[s]&&Tn[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Xt=Symbol("internals");function me(t){return t&&String(t).trim().toLowerCase()}function Le(t){return t===!1||t==null?t:c.isArray(t)?t.map(Le):String(t)}function On(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const Nn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function it(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function Cn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function An(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,i,a){return this[n].call(this,e,r,i,a)},configurable:!0})})}class De{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(o,u,l){const f=me(u);if(!f)throw new Error("header name must be a non-empty string");const _=c.findKey(r,f);(!_||r[_]===void 0||l===!0||l===void 0&&r[_]!==!1)&&(r[_||u]=Le(o))}const a=(o,u)=>c.forEach(o,(l,f)=>i(l,f,u));return c.isPlainObject(e)||e instanceof this.constructor?a(e,s):c.isString(e)&&(e=e.trim())&&!Nn(e)?a(En(e),s):e!=null&&i(s,e,n),this}get(e,s){if(e=me(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return On(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=me(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||it(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(a){if(a=me(a),a){const o=c.findKey(n,a);o&&(!s||it(n,n[o],o,s))&&(delete n[o],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||it(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const a=c.findKey(n,i);if(a){s[a]=Le(r),delete s[i];return}const o=e?Cn(i):String(i).trim();o!==i&&delete s[i],s[o]=Le(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Xt]=this[Xt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=me(a);n[o]||(An(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(De.prototype),c.freezeMethods(De);const H=De;function at(t,e){const s=this||rt,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Yt(t){return!!(t&&t.__CANCEL__)}function pe(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(pe,T,{__CANCEL__:!0});function Rn(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const In=$.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function jn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Zn(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Qt(t,e){return t&&!jn(e)?Zn(t,e):e}const Ln=$.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Dn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Pn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let _=i,A=0;for(;_!==r;)A+=s[_++],_=_%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function es(t,e){let s=0;const n=Pn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:un,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&($.isStandardBrowserEnv||$.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=Qt(t.baseURL,t.url);l.open(t.method.toUpperCase(),Wt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function _(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};Rn(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=_:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(_)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||qt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},$.isStandardBrowserEnv){const N=(t.withCredentials||Ln(f))&&t.xsrfCookieName&&In.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",es(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",es(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new pe(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Dn(f);if(A&&$.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Bn={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new pe(null,t)}function ts(t){return ot(t),t.headers=H.from(t.headers),t.data=at.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Bn.getAdapter(t.adapter||rt.adapter)(t).then(function(n){return ot(t),n.data=at.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return Yt(n)||(ot(t),n&&n.response&&(n.response.data=at.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const ss=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,_){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:_},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,_){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,_)}else return n(l,f,_)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,_){if(_ in e)return n(l,f);if(_ in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(ss(l),ss(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const _=u[f]||r,A=_(t[f],e[f],f);c.isUndefined(A)&&_!==o||(s[f]=A)}),s}const ns="1.4.0",lt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{lt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const rs={};lt.transitional=function(e,s,n){function r(i,a){return"[Axios v"+ns+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!rs[a]&&(rs[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Mn(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ct={assertOptions:Mn,validators:lt},G=ct.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Kt,response:new Kt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ct.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,_=0,A;if(!u){const g=[ts.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);_<A;)f=f.then(g[_++],g[_++]);return f}A=o.length;let N=s;for(_=0;_<A;){const g=o[_++],S=o[_++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=ts.call(this,N)}catch(g){return Promise.reject(g)}for(_=0,A=l.length;_<A;)f=f.then(l[_++],l[_++]);return f}getUri(e){e=ae(this.defaults,e);const s=Qt(e.baseURL,e.url);return Wt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new pe(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new ut(function(r){e=r}),cancel:e}}}const Un=ut;function zn(t){return function(s){return t.apply(null,s)}}function $n(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});const Vn=dt;function is(t){const e=new Me(t),s=Rt(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return is(ae(t,r))},s}const R=is(rt);R.Axios=Me,R.CanceledError=pe,R.CancelToken=Un,R.isCancel=Yt,R.VERSION=ns,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=zn,R.isAxiosError=$n,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>Gt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=Vn,R.default=R;const ft=R;function ht({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}function mt(t){return t.replaceAll(" ","").trim()}async function as({url:t,apiKey:e,options:s}){return await ft.get(mt(t),ht({apiKey:e,options:s}))}async function os({url:t,apiKey:e,options:s,payload:n={}}){return await ft.post(mt(t),n,ht({apiKey:e,options:s}))}async function Fn({url:t,apiKey:e,options:s,payload:n}){return await ft.put(mt(t),n,ht({apiKey:e,options:s}))}async function ye(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Hn({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=(await os({url:`${e}/v1/images/book/${s}`,apiKey:t,payload:n})).data;return _s.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));const m=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},h=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Jn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}D.create=t=>new D(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let ls=ge;function Wn(t){ls=t}function Ue(){return ls}const ze=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},Kn=[];function p(t,e){const s=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),cs=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),yt=t=>t.status==="aborted",gt=t=>t.status==="dirty",$e=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const us=(t,e)=>{if($e(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new D(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return us(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return us(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return ue.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new fs({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const qn=/^c[^\s-]{8,}$/i,Gn=/^[a-z][a-z0-9]*$/,Xn=/[0-9A-HJKMNP-TV-Z]{26}/,Yn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Qn=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,er=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,tr=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,sr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,nr=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function rr(t,e){return!!((e==="v4"||!e)&&tr.test(t)||(e==="v6"||!e)&&sr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")er.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")qn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Gn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?nr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?rr(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function ir(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ir(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class oe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}oe.create=t=>new oe({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:m.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return p(s,{code:h.invalid_type,expected:m.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(p(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(p(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(p(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function le(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(le(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:le(t.element)}):t instanceof W?W.create(le(t.unwrap())):t instanceof re?re.create(le(t.unwrap())):t instanceof F?F.create(t.items.map(e=>le(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:m.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],_=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,_,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const _=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const _=await f.key;l.push({key:_,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return le(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return ds(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new D(o.ctx.common.issues));return p(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new D(u));return p(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return p(s,{code:h.invalid_type,expected:m.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(p(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function vt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&n===m.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=vt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=vt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(yt(i)||yt(a))return w;const o=vt(i.value,a.value);return o.valid?((gt(i)||gt(a))&&s.dirty(),{status:s.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:h.invalid_type,expected:m.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:h.invalid_type,expected:m.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:h.invalid_type,expected:m.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:h.invalid_type,expected:m.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ce extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return p(s,{code:h.invalid_type,expected:m.function,received:s.parsedType}),w;function n(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof ue?j(async(...o)=>{const u=new D([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new D([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new D([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ce({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ce({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return p(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function ds(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=ds;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=E.objectValues(s);return p(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class ue extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return p(s,{code:h.invalid_type,expected:m.promise,received:s.parsedType}),w;const n=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{p(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$e(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>$e(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const ar=Symbol("zod_brand");class fs extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),cs(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const hs=(t,e={},s)=>t?oe.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):oe.create(),or={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const lr=(t,e={message:`Input not instance of ${t.name}`})=>hs(s=>s instanceof t,e),ms=P.create,ps=Y.create,cr=Ge.create,ur=Q.create,ys=ve.create,dr=te.create,fr=Fe.create,hr=_e.create,mr=be.create,pr=oe.create,yr=se.create,gr=J.create,vr=He.create,_r=B.create,br=C.create,wr=C.strictCreate,xr=we.create,kr=We.create,Sr=xe.create,Tr=F.create,Er=ke.create,Or=Ke.create,Nr=ne.create,Cr=ce.create,Ar=Se.create,Rr=Te.create,Ir=ee.create,jr=Ee.create,Zr=ue.create,gs=M.create,Lr=W.create,Dr=re.create,Pr=M.createWithPreprocess,Br=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:Wn,getErrorMap:Ue,makeIssue:ze,EMPTY_PATH:Kn,addIssueToContext:p,ParseStatus:I,INVALID:w,DIRTY:cs,OK:j,isAborted:yt,isDirty:gt,isValid:$e,isAsync:Ve,get util(){return E},get objectUtil(){return pt},ZodParsedType:m,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:oe,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ce,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:ue,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:ar,ZodBranded:fs,ZodPipeline:Ne,custom:hs,Schema:k,ZodSchema:k,late:or,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:pr,array:_r,bigint:ur,boolean:ys,date:dr,discriminatedUnion:kr,effect:gs,enum:Ir,function:Cr,instanceof:lr,intersection:Sr,lazy:Ar,literal:Rr,map:Or,nan:cr,nativeEnum:jr,never:gr,null:mr,nullable:Dr,number:ps,object:br,oboolean:()=>ys().optional(),onumber:()=>ps().optional(),optional:Lr,ostring:()=>ms().optional(),pipeline:Br,preprocess:Pr,promise:Zr,record:Er,set:Nr,strictObject:wr,string:ms,symbol:fr,transformer:gs,tuple:Tr,undefined:hr,union:xr,unknown:yr,void:vr,NEVER:w,ZodIssueCode:h,quotelessJson:Jn,ZodError:D});class vs{constructor(e,s){b(this,"client");b(this,"parentId");b(this,"images");b(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Hn(this.client,this.parentId,new bs(e)),new Promise(s=>{s(this.length)})}}const _s=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class bs{constructor(e){b(this,"handle");b(this,"url");b(this,"width");b(this,"height");b(this,"orientation");b(this,"taken_at");b(this,"camera_make");b(this,"camera");b(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const ws=["new","ingesting","submitted","storyboarding","deduplication","image selection","designing","layouting","embellishing","polishing","ready","error"],_t=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],bt={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},wt=["8x8","10x10","12x12","8x11","11x8","11x14"],xt=["sc","hc","pl"],kt=["sp","sl","dl"],St=["low","medium","high"],Tt=["best","most","all"],Et=["none","few","lots"],Ot=["none","few","lots"],Mr="https://api.sfly-sls.magicbook.io",Ur="wss://socket.sfly-sls.magicbook.io",zr=parseInt("300000")||3e5;class $r{constructor(e){b(this,"occasion");b(this,"style");b(this,"book_size");b(this,"cover_type");b(this,"page_type");b(this,"image_density");b(this,"image_filtering_level");b(this,"embellishment_level");b(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const Vr=d.object({occasion:d.enum(_t),style:d.string(),book_size:d.enum(wt),cover_type:d.enum(xt),page_type:d.enum(kt),image_density:d.enum(St),image_filtering_level:d.enum(Tt),embellishment_level:d.enum(Et),text_sticker_level:d.enum(Ot)}),xs=d.object({id:d.string(),title:d.string(),design_request:Vr,state:d.enum(ws).optional(),guid:d.string().optional()});class Nt{constructor(e){b(this,"id");b(this,"title");b(this,"design_request");b(this,"state");b(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new $r(e.design_request),this.state=e.state,this.guid=e.guid}}function ks(t){const e=bt[t.style].slug,s=Ct(JSON.parse(JSON.stringify(t)));return s.style=e,new Nt({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Xe=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),Ss=d.object({high:Xe,medium:Xe,low:Xe}),Ts=d.object({densities:Ss});async function Fr({apiKey:t,apiHost:e},s,n,r){return ye(async()=>{const i=await as({url:`${e}/v1/designoptions/booksize/${s}/imagecount/${n}
4
- /imagefilteringlevel/${r}`,apiKey:t}),a=At(i.data);return Ts.parse(a)})}const Hr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Jr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Wr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),Kr=d.object({key:d.string(),value:d.any()}),qr=d.object({type:d.string(),imageAssignment:Hr.optional(),position:Jr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),Gr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Wr}),Xr=d.object({properties:d.array(Kr)}),Yr=d.object({backgroundId:d.string().nullable(),assets:d.array(qr).optional()}),Qr=d.object({pageNum:d.number(),type:d.string(),canvas:Yr}),ei=d.object({pages:d.array(Qr),photoStrip:d.array(Gr)}),ti=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:ei,reportingData:Xr});async function si({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await os({url:`${t}/v1/books`,apiKey:e,payload:s})).data;return xs.safeParse(n),new Nt(n)})}async function Es({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await Fn({url:`${t}/v1/books/${s.id}`,apiKey:e,payload:s})).data;return xs.safeParse(n),new Nt(n)})}async function ni({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await as({url:`${t}/v1/books/${s}/format/galleon`,apiKey:e})).data;return ti.parse(n)})}class Os{constructor(e,s,n){b(this,"client");b(this,"parentId");b(this,"title");b(this,"occasion");b(this,"style");b(this,"bookSize");b(this,"coverType");b(this,"pageType");b(this,"imageDensity");b(this,"imageFilteringLevel");b(this,"embellishmentLevel");b(this,"textStickerLevel");b(this,"images");b(this,"guid");this.client=s,this.parentId=e,this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||_t[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(bt)[0]),this.bookSize=(n==null?void 0:n.bookSize)||wt[0],this.coverType=(n==null?void 0:n.coverType)||xt[0],this.pageType=(n==null?void 0:n.pageType)||kt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||St[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||Tt[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Et[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Ot[0],this.images=new vs(this.client,this.parentId)}async getOptions(e){return await Fr(this.client,this.bookSize,e||this.images.length,this.imageFilteringLevel)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Es(this.client,ks(this)),this}async setGuid(e){return this.guid=e,await Es(this.client,ks(this)),this.guid}async getJSON(){return await ni(this.client,this.parentId)}async getProgress(){let e="new";const s=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),n=setTimeout(()=>{throw s.close(),new Error("Something went wrong. Please try again.")},zr);s.onmessage=r=>{const i=JSON.parse(r.data);if(e!==i.state){e=i.state;const a=new CustomEvent("MagicBook.designRequestUpdated",{detail:i});["error","ready"].includes(i.state)&&(s.close(),clearTimeout(n)),window.dispatchEvent(a)}}}}class ri{constructor(e,s=Mr,n=Ur){b(this,"apiKey");b(this,"apiHost");b(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await si(this);return new Os(s.id,this,e)}}O.DesignRequest=Os,O.ImageServer=bs,O.Images=vs,O.MagicBookClient=ri,O.bookSizes=wt,O.coverTypes=xt,O.designOptionsSchema=Ts,O.embellishmentLevels=Et,O.imageDensities=St,O.imageDensityOptionSchema=Xe,O.imageDensityOptionsSchema=Ss,O.imageFilteringLevels=Tt,O.imageServerSchema=_s,O.occasions=_t,O.pageTypes=kt,O.states=ws,O.styles=bt,O.textStickerLevels=Ot,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
1
+ (function(O,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(O=typeof globalThis<"u"?globalThis:O||self,Z(O["magicbook-client"]={}))})(this,function(O){"use strict";var oi=Object.defineProperty;var li=(O,Z,q)=>Z in O?oi(O,Z,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[Z]=q;var b=(O,Z,q)=>(li(O,typeof Z!="symbol"?Z+"":Z,q),q);function Z(t,e,s){const n=e.pop()||"",r=e.reduce((i,a)=>i[a]=i[a]||{},t);r[n]=s}function q(t,e){return Object.keys(e).map(s=>{typeof t[s]=="object"&&typeof e[s]=="object"?q(t[s],e[s]):t[s]=e[s]}),t}function Cs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function Ct(t){return Object.keys(t).map(e=>{const s=Cs(e);s.includes("_")&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=Ct(t[s]))}),t}function As(t){return t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""))}function At(t){return Object.keys(t).map(e=>{const s=As(e);s!==e&&(t[s]=t[e],delete t[e]),typeof t[s]=="object"&&(t[s]=At(t[s]))}),t}function Rt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Rs}=Object.prototype,{getPrototypeOf:Qe}=Object,Ce=(t=>e=>{const s=Rs.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),z=t=>(t=t.toLowerCase(),e=>Ce(e)===t),Ae=t=>e=>typeof e===t,{isArray:ie}=Array,fe=Ae("undefined");function Is(t){return t!==null&&!fe(t)&&t.constructor!==null&&!fe(t.constructor)&&L(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const It=z("ArrayBuffer");function js(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&It(t.buffer),e}const Zs=Ae("string"),L=Ae("function"),jt=Ae("number"),Re=t=>t!==null&&typeof t=="object",Ls=t=>t===!0||t===!1,Ie=t=>{if(Ce(t)!=="object")return!1;const e=Qe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ds=z("Date"),Ps=z("File"),Bs=z("Blob"),Ms=z("FileList"),Us=t=>Re(t)&&L(t.pipe),zs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||L(t.append)&&((e=Ce(t))==="formdata"||e==="object"&&L(t.toString)&&t.toString()==="[object FormData]"))},$s=z("URLSearchParams"),Vs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function he(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ie(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let o;for(n=0;n<a;n++)o=i[n],e.call(null,t[o],o,t)}}function Zt(t,e){e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Lt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Dt=t=>!fe(t)&&t!==Lt;function et(){const{caseless:t}=Dt(this)&&this||{},e={},s=(n,r)=>{const i=t&&Zt(e,r)||r;Ie(e[i])&&Ie(n)?e[i]=et(e[i],n):Ie(n)?e[i]=et({},n):ie(n)?e[i]=n.slice():e[i]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&he(arguments[n],s);return e}const Fs=(t,e,s,{allOwnKeys:n}={})=>(he(e,(r,i)=>{s&&L(r)?t[i]=Rt(r,s):t[i]=r},{allOwnKeys:n}),t),Hs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Js=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Ws=(t,e,s,n)=>{let r,i,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)a=r[i],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=s!==!1&&Qe(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},Ks=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},qs=t=>{if(!t)return null;if(ie(t))return t;let e=t.length;if(!jt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Gs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Qe(Uint8Array)),Xs=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},Ys=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},Qs=z("HTMLFormElement"),en=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),Pt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),tn=z("RegExp"),Bt=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};he(s,(r,i)=>{e(r,i,t)!==!1&&(n[i]=r)}),Object.defineProperties(t,n)},sn=t=>{Bt(t,(e,s)=>{if(L(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(L(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},nn=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ie(t)?n(t):n(String(t).split(e)),s},rn=()=>{},an=(t,e)=>(t=+t,Number.isFinite(t)?t:e),tt="abcdefghijklmnopqrstuvwxyz",Mt="0123456789",Ut={DIGIT:Mt,ALPHA:tt,ALPHA_DIGIT:tt+tt.toUpperCase()+Mt},on=(t=16,e=Ut.ALPHA_DIGIT)=>{let s="";const{length:n}=e;for(;t--;)s+=e[Math.random()*n|0];return s};function ln(t){return!!(t&&L(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const cn=t=>{const e=new Array(10),s=(n,r)=>{if(Re(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const i=ie(n)?[]:{};return he(n,(a,o)=>{const u=s(a,r+1);!fe(u)&&(i[o]=u)}),e[r]=void 0,i}}return n};return s(t,0)},un=z("AsyncFunction"),c={isArray:ie,isArrayBuffer:It,isBuffer:Is,isFormData:zs,isArrayBufferView:js,isString:Zs,isNumber:jt,isBoolean:Ls,isObject:Re,isPlainObject:Ie,isUndefined:fe,isDate:Ds,isFile:Ps,isBlob:Bs,isRegExp:tn,isFunction:L,isStream:Us,isURLSearchParams:$s,isTypedArray:Gs,isFileList:Ms,forEach:he,merge:et,extend:Fs,trim:Vs,stripBOM:Hs,inherits:Js,toFlatObject:Ws,kindOf:Ce,kindOfTest:z,endsWith:Ks,toArray:qs,forEachEntry:Xs,matchAll:Ys,isHTMLForm:Qs,hasOwnProperty:Pt,hasOwnProp:Pt,reduceDescriptors:Bt,freezeMethods:sn,toObjectSet:nn,toCamelCase:en,noop:rn,toFiniteNumber:an,findKey:Zt,global:Lt,isContextDefined:Dt,ALPHABET:Ut,generateString:on,isSpecCompliantForm:ln,toJSONObject:cn,isAsyncFn:un,isThenable:t=>t&&(Re(t)||L(t))&&L(t.then)&&L(t.catch)};function T(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r)}c.inherits(T,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const zt=T.prototype,$t={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{$t[t]={value:t}}),Object.defineProperties(T,$t),Object.defineProperty(zt,"isAxiosError",{value:!0}),T.from=(t,e,s,n,r,i)=>{const a=Object.create(zt);return c.toFlatObject(t,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),T.call(a,t.message,e,s,n,r),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const dn=null;function st(t){return c.isPlainObject(t)||c.isArray(t)}function Vt(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Ft(t,e,s){return t?t.concat(e).map(function(r,i){return r=Vt(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function fn(t){return c.isArray(t)&&!t.some(st)}const hn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function je(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,K){return!c.isUndefined(K[S])});const n=s.metaTokens,r=s.visitor||f,i=s.dots,a=s.indexes,u=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(c.isDate(g))return g.toISOString();if(!u&&c.isBlob(g))throw new T("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(g)||c.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,S,K){let U=g;if(g&&!K&&typeof g=="object"){if(c.endsWith(S,"{}"))S=n?S:S.slice(0,-2),g=JSON.stringify(g);else if(c.isArray(g)&&fn(g)||(c.isFileList(g)||c.endsWith(S,"[]"))&&(U=c.toArray(g)))return S=Vt(S),U.forEach(function(Ye,ai){!(c.isUndefined(Ye)||Ye===null)&&e.append(a===!0?Ft([S],ai,i):a===null?S:S+"[]",l(Ye))}),!1}return st(g)?!0:(e.append(Ft(K,S,i),l(g)),!1)}const _=[],A=Object.assign(hn,{defaultVisitor:f,convertValue:l,isVisitable:st});function N(g,S){if(!c.isUndefined(g)){if(_.indexOf(g)!==-1)throw Error("Circular reference detected in "+S.join("."));_.push(g),c.forEach(g,function(U,de){(!(c.isUndefined(U)||U===null)&&r.call(e,U,c.isString(de)?de.trim():de,S,A))===!0&&N(U,S?S.concat(de):[de])}),_.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return N(t),e}function Ht(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function nt(t,e){this._pairs=[],t&&je(t,this,e)}const Jt=nt.prototype;Jt.append=function(e,s){this._pairs.push([e,s])},Jt.toString=function(e){const s=e?function(n){return e.call(this,n,Ht)}:Ht;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function mn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wt(t,e,s){if(!e)return t;const n=s&&s.encode||mn,r=s&&s.serialize;let i;if(r?i=r(e,s):i=c.isURLSearchParams(e)?e.toString():new nt(e,s).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class pn{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Kt=pn,qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yn=typeof URLSearchParams<"u"?URLSearchParams:nt,gn=typeof FormData<"u"?FormData:null,vn=typeof Blob<"u"?Blob:null,_n=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),bn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),$={isBrowser:!0,classes:{URLSearchParams:yn,FormData:gn,Blob:vn},isStandardBrowserEnv:_n,isStandardBrowserWebWorkerEnv:bn,protocols:["http","https","file","blob","url","data"]};function wn(t,e){return je(t,new $.classes.URLSearchParams,Object.assign({visitor:function(s,n,r,i){return $.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function xn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kn(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function Gt(t){function e(s,n,r,i){let a=s[i++];const o=Number.isFinite(+a),u=i>=s.length;return a=!a&&c.isArray(r)?r.length:a,u?(c.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!c.isObject(r[a]))&&(r[a]=[]),e(s,n,r[a],i)&&c.isArray(r[a])&&(r[a]=kn(r[a])),!o)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(xn(n),r,s,0)}),s}return null}const Sn={"Content-Type":void 0};function Tn(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Ze={transitional:qt,adapter:["xhr","http"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r&&r?JSON.stringify(Gt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return wn(e,this.formSerializer).toString();if((o=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return je(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||r?(s.setContentType("application/json",!1),Tn(e)):e}],transformResponse:[function(e){const s=this.transitional||Ze.transitional,n=s&&s.forcedJSONParsing,r=this.responseType==="json";if(e&&c.isString(e)&&(n&&!this.responseType||r)){const a=!(s&&s.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?T.from(o,T.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(e){Ze.headers[e]={}}),c.forEach(["post","put","patch"],function(e){Ze.headers[e]=c.merge(Sn)});const rt=Ze,En=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),On=t=>{const e={};let s,n,r;return t&&t.split(`
2
+ `).forEach(function(a){r=a.indexOf(":"),s=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!s||e[s]&&En[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Xt=Symbol("internals");function me(t){return t&&String(t).trim().toLowerCase()}function Le(t){return t===!1||t==null?t:c.isArray(t)?t.map(Le):String(t)}function Nn(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const Cn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function it(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function An(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function Rn(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,i,a){return this[n].call(this,e,r,i,a)},configurable:!0})})}class De{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(o,u,l){const f=me(u);if(!f)throw new Error("header name must be a non-empty string");const _=c.findKey(r,f);(!_||r[_]===void 0||l===!0||l===void 0&&r[_]!==!1)&&(r[_||u]=Le(o))}const a=(o,u)=>c.forEach(o,(l,f)=>i(l,f,u));return c.isPlainObject(e)||e instanceof this.constructor?a(e,s):c.isString(e)&&(e=e.trim())&&!Cn(e)?a(On(e),s):e!=null&&i(s,e,n),this}get(e,s){if(e=me(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return Nn(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=me(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||it(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(a){if(a=me(a),a){const o=c.findKey(n,a);o&&(!s||it(n,n[o],o,s))&&(delete n[o],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||it(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const a=c.findKey(n,i);if(a){s[a]=Le(r),delete s[i];return}const o=e?An(i):String(i).trim();o!==i&&delete s[i],s[o]=Le(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
3
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Xt]=this[Xt]={accessors:{}}).accessors,r=this.prototype;function i(a){const o=me(a);n[o]||(Rn(r,a),n[o]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(De.prototype),c.freezeMethods(De);const H=De;function at(t,e){const s=this||rt,n=e||s,r=H.from(n.headers);let i=n.data;return c.forEach(t,function(o){i=o.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Yt(t){return!!(t&&t.__CANCEL__)}function pe(t,e,s){T.call(this,t??"canceled",T.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(pe,T,{__CANCEL__:!0});function In(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new T("Request failed with status code "+s.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}const jn=$.isStandardBrowserEnv?function(){return{write:function(s,n,r,i,a,o){const u=[];u.push(s+"="+encodeURIComponent(n)),c.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),c.isString(i)&&u.push("path="+i),c.isString(a)&&u.push("domain="+a),o===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(s){const n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Zn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Ln(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Qt(t,e){return t&&!Zn(e)?Ln(t,e):e}const Dn=$.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let n;function r(i){let a=i;return e&&(s.setAttribute("href",a),a=s.href),s.setAttribute("href",a),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=r(window.location.href),function(a){const o=c.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function Pn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Bn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const l=Date.now(),f=n[i];a||(a=l),s[r]=u,n[r]=l;let _=i,A=0;for(;_!==r;)A+=s[_++],_=_%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),l-a<e)return;const N=f&&l-f;return N?Math.round(A*1e3/N):void 0}}function es(t,e){let s=0;const n=Bn(50,250);return r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,o=i-s,u=n(o),l=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:r};f[e?"download":"upload"]=!0,t(f)}}const Pe={http:dn,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,n){let r=t.data;const i=H.from(t.headers).normalize(),a=t.responseType;let o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}c.isFormData(r)&&($.isStandardBrowserEnv||$.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(N+":"+g))}const f=Qt(t.baseURL,t.url);l.open(t.method.toUpperCase(),Wt(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function _(){if(!l)return;const N=H.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:N,config:t,request:l};In(function(U){s(U),u()},function(U){n(U),u()},S),l=null}if("onloadend"in l?l.onloadend=_:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(_)},l.onabort=function(){l&&(n(new T("Request aborted",T.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new T("Network Error",T.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const S=t.transitional||qt;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new T(g,S.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,l)),l=null},$.isStandardBrowserEnv){const N=(t.withCredentials||Dn(f))&&t.xsrfCookieName&&jn.read(t.xsrfCookieName);N&&i.set(t.xsrfHeaderName,N)}r===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(g,S){l.setRequestHeader(S,g)}),c.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&a!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",es(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",es(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=N=>{l&&(n(!N||N.type?new pe(null,t,l):N),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const A=Pn(f);if(A&&$.protocols.indexOf(A)===-1){n(new T("Unsupported protocol "+A+":",T.ERR_BAD_REQUEST,t));return}l.send(r||null)})}};c.forEach(Pe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Mn={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let s,n;for(let r=0;r<e&&(s=t[r],!(n=c.isString(s)?Pe[s.toLowerCase()]:s));r++);if(!n)throw n===!1?new T(`Adapter ${s} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(Pe,s)?`Adapter '${s}' is not available in the build`:`Unknown adapter '${s}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:Pe};function ot(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new pe(null,t)}function ts(t){return ot(t),t.headers=H.from(t.headers),t.data=at.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mn.getAdapter(t.adapter||rt.adapter)(t).then(function(n){return ot(t),n.data=at.call(t,t.transformResponse,n),n.headers=H.from(n.headers),n},function(n){return Yt(n)||(ot(t),n&&n.response&&(n.response.data=at.call(t,t.transformResponse,n.response),n.response.headers=H.from(n.response.headers))),Promise.reject(n)})}const ss=t=>t instanceof H?t.toJSON():t;function ae(t,e){e=e||{};const s={};function n(l,f,_){return c.isPlainObject(l)&&c.isPlainObject(f)?c.merge.call({caseless:_},l,f):c.isPlainObject(f)?c.merge({},f):c.isArray(f)?f.slice():f}function r(l,f,_){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l,_)}else return n(l,f,_)}function i(l,f){if(!c.isUndefined(f))return n(void 0,f)}function a(l,f){if(c.isUndefined(f)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}function o(l,f,_){if(_ in e)return n(l,f);if(_ in t)return n(void 0,l)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,f)=>r(ss(l),ss(f),!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(f){const _=u[f]||r,A=_(t[f],e[f],f);c.isUndefined(A)&&_!==o||(s[f]=A)}),s}const ns="1.4.0",lt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{lt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const rs={};lt.transitional=function(e,s,n){function r(i,a){return"[Axios v"+ns+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(e===!1)throw new T(r(a," has been removed"+(s?" in "+s:"")),T.ERR_DEPRECATED);return s&&!rs[a]&&(rs[a]=!0,console.warn(r(a," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,a,o):!0}};function Un(t,e,s){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new T("option "+i+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new T("Unknown option "+i,T.ERR_BAD_OPTION)}}const ct={assertOptions:Un,validators:lt},G=ct.validators;class Be{constructor(e){this.defaults=e,this.interceptors={request:new Kt,response:new Kt}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ae(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&ct.assertOptions(n,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:G.function,serialize:G.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let a;a=i&&c.merge(i.common,i[s.method]),a&&c.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),s.headers=H.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(s)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let f,_=0,A;if(!u){const g=[ts.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,l),A=g.length,f=Promise.resolve(s);_<A;)f=f.then(g[_++],g[_++]);return f}A=o.length;let N=s;for(_=0;_<A;){const g=o[_++],S=o[_++];try{N=g(N)}catch(K){S.call(this,K);break}}try{f=ts.call(this,N)}catch(g){return Promise.reject(g)}for(_=0,A=l.length;_<A;)f=f.then(l[_++],l[_++]);return f}getUri(e){e=ae(this.defaults,e);const s=Qt(e.baseURL,e.url);return Wt(s,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){Be.prototype[e]=function(s,n){return this.request(ae(n||{},{method:e,url:s,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function s(n){return function(i,a,o){return this.request(ae(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Be.prototype[e]=s(),Be.prototype[e+"Form"]=s(!0)});const Me=Be;class ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(r);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,o){n.reason||(n.reason=new pe(i,a,o),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new ut(function(r){e=r}),cancel:e}}}const zn=ut;function $n(t){return function(s){return t.apply(null,s)}}function Vn(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});const Fn=dt;function is(t){const e=new Me(t),s=Rt(Me.prototype.request,e);return c.extend(s,Me.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return is(ae(t,r))},s}const R=is(rt);R.Axios=Me,R.CanceledError=pe,R.CancelToken=zn,R.isCancel=Yt,R.VERSION=ns,R.toFormData=je,R.AxiosError=T,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=$n,R.isAxiosError=Vn,R.mergeConfig=ae,R.AxiosHeaders=H,R.formToJSON=t=>Gt(c.isHTMLForm(t)?new FormData(t):t),R.HttpStatusCode=Fn,R.default=R;const ft=R;function ht({apiKey:t,options:e}){let s={};return t&&Z(s,["headers","Authorization"],`API-Key ${t}`),e&&(s=q(s,e)),s}function mt(t){return t.replaceAll(" ","").trim()}async function as({url:t,apiKey:e,options:s}){return await ft.get(mt(t),ht({apiKey:e,options:s}))}async function os({url:t,apiKey:e,options:s,payload:n={}}){return await ft.post(mt(t),n,ht({apiKey:e,options:s}))}async function Hn({url:t,apiKey:e,options:s,payload:n}){return await ft.put(mt(t),n,ht({apiKey:e,options:s}))}async function ye(t){try{return await t()}catch(e){return Promise.reject(e)}}async function Jn({apiKey:t,apiHost:e},s,n){return ye(async()=>{const r=(await os({url:`${e}/v1/images/book/${s}`,apiKey:t,payload:n})).data;return _s.parse(r)})}var E;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));const m=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},h=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class D extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(s(a));else{let o=n,u=0;for(;u<a.path.length;){const l=a.path[u];u===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(s(a))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},n=[];for(const r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}D.create=t=>new D(t);const ge=(t,e)=>{let s;switch(t.code){case h.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,E.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:s=`Unrecognized key(s) in object: ${E.joinValues(t.keys,", ")}`;break;case h.invalid_union:s="Invalid input";break;case h.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${E.joinValues(t.options)}`;break;case h.invalid_enum_value:s=`Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:s="Invalid function arguments";break;case h.invalid_return_type:s="Invalid function return type";break;case h.invalid_date:s="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:E.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case h.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case h.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case h.custom:s="Invalid input";break;case h.invalid_intersection_types:s="Intersection results could not be merged";break;case h.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:s="Number must be finite";break;default:s=e.defaultError,E.assertNever(t)}return{message:s}};let ls=ge;function Kn(t){ls=t}function Ue(){return ls}const ze=t=>{const{data:e,path:s,errorMaps:n,issueData:r}=t,i=[...s,...r.path||[]],a={...r,path:i};let o="";const u=n.filter(l=>!!l).slice().reverse();for(const l of u)o=l(a,{data:e,defaultError:o}).message;return{...r,path:i,message:r.message||o}},qn=[];function p(t,e){const s=ze({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),ge].filter(n=>!!n)});t.common.issues.push(s)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const n=[];for(const r of s){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,s){const n=[];for(const r of s)n.push({key:await r.key,value:await r.value});return I.mergeObjectSync(e,n)}static mergeObjectSync(e,s){const n={};for(const r of s){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return w;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),cs=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),yt=t=>t.status==="aborted",gt=t=>t.status==="dirty",$e=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class V{constructor(e,s,n,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const us=(t,e)=>{if($e(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new D(t.common.issues);return this._error=s,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:n,description:r}=t;if(e&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:s??o.defaultError},description:r}}class k{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return X(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:X(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const n=this.safeParse(e,s);if(n.success)return n.data;throw n.error}safeParse(e,s){var n;const r={common:{issues:[],async:(n=s==null?void 0:s.async)!==null&&n!==void 0?n:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},i=this._parseSync({data:e,path:r.path,parent:r});return us(r,i)}async parseAsync(e,s){const n=await this.safeParseAsync(e,s);if(n.success)return n.data;throw n.error}async safeParseAsync(e,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:X(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Ve(r)?r:Promise.resolve(r));return us(n,i)}refine(e,s){const n=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:h.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,s){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof s=="function"?s(n,r):s),!1))}_refinement(e){return new M({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this,this._def)}promise(){return ue.create(this,this._def)}or(e){return we.create([this,e],this._def)}and(e){return xe.create(this,e,this._def)}transform(e){return new M({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Oe({...x(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new fs({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new qe({...x(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ne.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gn=/^c[^\s-]{8,}$/i,Xn=/^[a-z][a-z0-9]*$/,Yn=/[0-9A-HJKMNP-TV-Z]{26}/,Qn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,er=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,tr=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,sr=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,nr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,rr=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ir(t,e){return!!((e==="v4"||!e)&&sr.test(t)||(e==="v6"||!e)&&nr.test(t))}class P extends k{constructor(){super(...arguments),this._regex=(e,s,n)=>this.refinement(r=>e.test(r),{validation:s,code:h.invalid_string,...y.errToObj(n)}),this.nonempty=e=>this.min(1,y.errToObj(e)),this.trim=()=>new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.string,received:i.parsedType}),w}const n=new I;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&p(r,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")er.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")tr.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Qn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Gn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Xn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Yn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:h.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:h.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:h.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?rr(i).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:h.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="ip"?ir(e.data,i.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:h.invalid_string,message:i.message}),n.dirty()):E.assertNever(i);return{status:n.value,value:e.data}}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,...y.errToObj(e==null?void 0:e.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...y.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...y.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...y.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...y.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...y.errToObj(s)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:v.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function ar(t,e){const s=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=s>n?s:n,i=parseInt(t.toFixed(r).replace(".","")),a=parseInt(e.toFixed(r).replace(".",""));return i%a/Math.pow(10,r)}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.number,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="int"?E.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ar(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Y.create=t=>new Y({checks:[],typeName:v.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.bigint,received:i.parsedType}),w}let n;const r=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,y.toString(s))}gt(e,s){return this.setLimit("min",e,!1,y.toString(s))}lte(e,s){return this.setLimit("max",e,!0,y.toString(s))}lt(e,s){return this.setLimit("max",e,!1,y.toString(s))}setLimit(e,s,n,r){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Q.create=t=>{var e;return new Q({checks:[],typeName:v.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...x(t)})};class ve extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.boolean,received:n.parsedType}),w}return j(e.data)}}ve.create=t=>new ve({typeName:v.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...x(t)});class te extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_type,expected:m.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return p(i,{code:h.invalid_date}),w}const n=new I;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:h.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):E.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}te.create=t=>new te({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:v.ZodDate,...x(t)});class Fe extends k{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.symbol,received:n.parsedType}),w}return j(e.data)}}Fe.create=t=>new Fe({typeName:v.ZodSymbol,...x(t)});class _e extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.undefined,received:n.parsedType}),w}return j(e.data)}}_e.create=t=>new _e({typeName:v.ZodUndefined,...x(t)});class be extends k{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.null,received:n.parsedType}),w}return j(e.data)}}be.create=t=>new be({typeName:v.ZodNull,...x(t)});class oe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}oe.create=t=>new oe({typeName:v.ZodAny,...x(t)});class se extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:v.ZodUnknown,...x(t)});class J extends k{_parse(e){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:m.never,received:s.parsedType}),w}}J.create=t=>new J({typeName:v.ZodNever,...x(t)});class He extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.void,received:n.parsedType}),w}return j(e.data)}}He.create=t=>new He({typeName:v.ZodVoid,...x(t)});class B extends k{_parse(e){const{ctx:s,status:n}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return p(s,{code:h.invalid_type,expected:m.array,received:s.parsedType}),w;if(r.exactLength!==null){const a=s.data.length>r.exactLength.value,o=s.data.length<r.exactLength.value;(a||o)&&(p(s,{code:a?h.too_big:h.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(p(s,{code:h.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(p(s,{code:h.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((a,o)=>r.type._parseAsync(new V(s,a,s.path,o)))).then(a=>I.mergeArray(n,a));const i=[...s.data].map((a,o)=>r.type._parseSync(new V(s,a,s.path,o)));return I.mergeArray(n,i)}get element(){return this._def.type}min(e,s){return new B({...this._def,minLength:{value:e,message:y.toString(s)}})}max(e,s){return new B({...this._def,maxLength:{value:e,message:y.toString(s)}})}length(e,s){return new B({...this._def,exactLength:{value:e,message:y.toString(s)}})}nonempty(e){return this.min(1,e)}}B.create=(t,e)=>new B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function le(t){if(t instanceof C){const e={};for(const s in t.shape){const n=t.shape[s];e[s]=W.create(le(n))}return new C({...t._def,shape:()=>e})}else return t instanceof B?new B({...t._def,type:le(t.element)}):t instanceof W?W.create(le(t.unwrap())):t instanceof re?re.create(le(t.unwrap())):t instanceof F?F.create(t.items.map(e=>le(e))):t}class C extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=E.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:m.object,received:l.parsedType}),w}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in r.data)a.includes(l)||o.push(l);const u=[];for(const l of a){const f=i[l],_=r.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new V(r,_,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(l==="strict")o.length>0&&(p(r,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const _=r.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new V(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const _=await f.key;l.push({key:_,value:await f.value,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(n,l)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,n)=>{var r,i,a,o;const u=(a=(i=(r=this._def).errorMap)===null||i===void 0?void 0:i.call(r,s,n).message)!==null&&a!==void 0?a:n.defaultError;return s.code==="unrecognized_keys"?{message:(o=y.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const s={};return E.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}omit(e){const s={};return E.objectKeys(this.shape).forEach(n=>{e[n]||(s[n]=this.shape[n])}),new C({...this._def,shape:()=>s})}deepPartial(){return le(this)}partial(e){const s={};return E.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?s[n]=r:s[n]=r.optional()}),new C({...this._def,shape:()=>s})}required(e){const s={};return E.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])s[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;s[n]=i}}),new C({...this._def,shape:()=>s})}keyof(){return ds(E.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:v.ZodObject,...x(e)}),C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:v.ZodObject,...x(e)});class we extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return s.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new D(o.ctx.common.issues));return p(s,{code:h.invalid_union,unionErrors:a}),w}if(s.common.async)return Promise.all(n.map(async i=>{const a={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const u of n){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(u=>new D(u));return p(s,{code:h.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}we.create=(t,e)=>new we({options:t,typeName:v.ZodUnion,...x(e)});const Je=t=>t instanceof Se?Je(t.schema):t instanceof M?Je(t.innerType()):t instanceof Te?[t.value]:t instanceof ee?t.options:t instanceof Ee?Object.keys(t.enum):t instanceof Oe?Je(t._def.innerType):t instanceof _e?[void 0]:t instanceof be?[null]:null;class We extends k{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return p(s,{code:h.invalid_type,expected:m.object,received:s.parsedType}),w;const n=this.discriminator,r=s.data[n],i=this.optionsMap.get(r);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(p(s,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,n){const r=new Map;for(const i of s){const a=Je(i.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new We({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...x(n)})}}function vt(t,e){const s=X(t),n=X(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&n===m.object){const r=E.objectKeys(e),i=E.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const u=vt(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(s===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],u=vt(a,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return s===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class xe extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=(i,a)=>{if(yt(i)||yt(a))return w;const o=vt(i.value,a.value);return o.valid?((gt(i)||gt(a))&&s.dirty(),{status:s.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xe.create=(t,e,s)=>new xe({left:t,right:e,typeName:v.ZodIntersection,...x(s)});class F extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return p(n,{code:h.invalid_type,expected:m.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return p(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...n.data].map((a,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new V(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>I.mergeArray(s,a)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:t,typeName:v.ZodTuple,rest:null,...x(e)})};class ke extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return p(n,{code:h.invalid_type,expected:m.object,received:n.parsedType}),w;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in n.data)r.push({key:i._parse(new V(n,o,n.path,o)),value:a._parse(new V(n,n.data[o],n.path,o))});return n.common.async?I.mergeObjectAsync(s,r):I.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,n){return s instanceof k?new ke({keyType:e,valueType:s,typeName:v.ZodRecord,...x(n)}):new ke({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...x(s)})}}class Ke extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return p(n,{code:h.invalid_type,expected:m.map,received:n.parsedType}),w;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,u],l)=>({key:r._parse(new V(n,o,n.path,[l,"key"])),value:i._parse(new V(n,u,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of a){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}})}else{const o=new Map;for(const u of a){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return w;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),o.set(l.value,f.value)}return{status:s.value,value:o}}}}Ke.create=(t,e,s)=>new Ke({valueType:e,keyType:t,typeName:v.ZodMap,...x(s)});class ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return p(n,{code:h.invalid_type,expected:m.set,received:n.parsedType}),w;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:h.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:h.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());const i=this._def.valueType;function a(u){const l=new Set;for(const f of u){if(f.status==="aborted")return w;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const o=[...n.data.values()].map((u,l)=>i._parse(new V(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,s){return new ne({...this._def,minSize:{value:e,message:y.toString(s)}})}max(e,s){return new ne({...this._def,maxSize:{value:e,message:y.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ne.create=(t,e)=>new ne({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class ce extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return p(s,{code:h.invalid_type,expected:m.function,received:s.parsedType}),w;function n(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:u}})}function r(o,u){return ze({data:o,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),ge].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},a=s.data;return this._def.returns instanceof ue?j(async(...o)=>{const u=new D([]),l=await this._def.args.parseAsync(o,i).catch(A=>{throw u.addIssue(n(o,A)),u}),f=await a(...l);return await this._def.returns._def.type.parseAsync(f,i).catch(A=>{throw u.addIssue(r(f,A)),u})}):j((...o)=>{const u=this._def.args.safeParse(o,i);if(!u.success)throw new D([n(o,u.error)]);const l=a(...u.data),f=this._def.returns.safeParse(l,i);if(!f.success)throw new D([r(l,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ce({...this._def,args:F.create(e).rest(se.create())})}returns(e){return new ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,n){return new ce({args:e||F.create([]).rest(se.create()),returns:s||se.create(),typeName:v.ZodFunction,...x(n)})}}class Se extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Se.create=(t,e)=>new Se({getter:t,typeName:v.ZodLazy,...x(e)});class Te extends k{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return p(s,{received:s.data,code:h.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Te.create=(t,e)=>new Te({value:t,typeName:v.ZodLiteral,...x(e)});function ds(t,e){return new ee({values:t,typeName:v.ZodEnum,...x(e)})}class ee extends k{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{expected:E.joinValues(n),received:s.parsedType,code:h.invalid_type}),w}if(this._def.values.indexOf(e.data)===-1){const s=this._getOrReturnCtx(e),n=this._def.values;return p(s,{received:s.data,code:h.invalid_enum_value,options:n}),w}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e){return ee.create(e)}exclude(e){return ee.create(this.options.filter(s=>!e.includes(s)))}}ee.create=ds;class Ee extends k{_parse(e){const s=E.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=E.objectValues(s);return p(n,{expected:E.joinValues(r),received:n.parsedType,code:h.invalid_type}),w}if(s.indexOf(e.data)===-1){const r=E.objectValues(s);return p(n,{received:n.data,code:h.invalid_enum_value,options:r}),w}return j(e.data)}get enum(){return this._def.values}}Ee.create=(t,e)=>new Ee({values:t,typeName:v.ZodNativeEnum,...x(e)});class ue extends k{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return p(s,{code:h.invalid_type,expected:m.promise,received:s.parsedType}),w;const n=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(n.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}}ue.create=(t,e)=>new ue({type:t,typeName:v.ZodPromise,...x(e)});class M extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if(r.type==="preprocess"){const a=r.transform(n.data);return n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}const i={addIssue:a=>{p(n,a),a.fatal?s.abort():s.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="refinement"){const a=o=>{const u=r.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value),{status:s.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&s.dirty(),a(o.value).then(()=>({status:s.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$e(a))return a;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>$e(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:s.value,value:o})):a);E.assertNever(r)}}M.create=(t,e,s)=>new M({schema:t,typeName:v.ZodEffects,effect:e,...x(s)}),M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,...x(s)});class W extends k{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:v.ZodOptional,...x(e)});class re extends k{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(t,e)=>new re({innerType:t,typeName:v.ZodNullable,...x(e)});class Oe extends k{_parse(e){const{ctx:s}=this._processInputParams(e);let n=s.data;return s.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Oe.create=(t,e)=>new Oe({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class qe extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ve(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Ge extends k{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:m.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Ge.create=t=>new Ge({typeName:v.ZodNaN,...x(t)});const or=Symbol("zod_brand");class fs extends k{_parse(e){const{ctx:s}=this._processInputParams(e),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class Ne extends k{_parse(e){const{status:s,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(s.dirty(),cs(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?w:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,s){return new Ne({in:e,out:s,typeName:v.ZodPipeline})}}const hs=(t,e={},s)=>t?oe.create().superRefine((n,r)=>{var i,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(i=o.fatal)!==null&&i!==void 0?i:s)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;r.addIssue({code:"custom",...l,fatal:u})}}):oe.create(),lr={object:C.lazycreate};var v;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(v||(v={}));const cr=(t,e={message:`Input not instance of ${t.name}`})=>hs(s=>s instanceof t,e),ms=P.create,ps=Y.create,ur=Ge.create,dr=Q.create,ys=ve.create,fr=te.create,hr=Fe.create,mr=_e.create,pr=be.create,yr=oe.create,gr=se.create,vr=J.create,_r=He.create,br=B.create,wr=C.create,xr=C.strictCreate,kr=we.create,Sr=We.create,Tr=xe.create,Er=F.create,Or=ke.create,Nr=Ke.create,Cr=ne.create,Ar=ce.create,Rr=Se.create,Ir=Te.create,jr=ee.create,Zr=Ee.create,Lr=ue.create,gs=M.create,Dr=W.create,Pr=re.create,Br=M.createWithPreprocess,Mr=Ne.create;var d=Object.freeze({__proto__:null,defaultErrorMap:ge,setErrorMap:Kn,getErrorMap:Ue,makeIssue:ze,EMPTY_PATH:qn,addIssueToContext:p,ParseStatus:I,INVALID:w,DIRTY:cs,OK:j,isAborted:yt,isDirty:gt,isValid:$e,isAsync:Ve,get util(){return E},get objectUtil(){return pt},ZodParsedType:m,getParsedType:X,ZodType:k,ZodString:P,ZodNumber:Y,ZodBigInt:Q,ZodBoolean:ve,ZodDate:te,ZodSymbol:Fe,ZodUndefined:_e,ZodNull:be,ZodAny:oe,ZodUnknown:se,ZodNever:J,ZodVoid:He,ZodArray:B,ZodObject:C,ZodUnion:we,ZodDiscriminatedUnion:We,ZodIntersection:xe,ZodTuple:F,ZodRecord:ke,ZodMap:Ke,ZodSet:ne,ZodFunction:ce,ZodLazy:Se,ZodLiteral:Te,ZodEnum:ee,ZodNativeEnum:Ee,ZodPromise:ue,ZodEffects:M,ZodTransformer:M,ZodOptional:W,ZodNullable:re,ZodDefault:Oe,ZodCatch:qe,ZodNaN:Ge,BRAND:or,ZodBranded:fs,ZodPipeline:Ne,custom:hs,Schema:k,ZodSchema:k,late:lr,get ZodFirstPartyTypeKind(){return v},coerce:{string:t=>P.create({...t,coerce:!0}),number:t=>Y.create({...t,coerce:!0}),boolean:t=>ve.create({...t,coerce:!0}),bigint:t=>Q.create({...t,coerce:!0}),date:t=>te.create({...t,coerce:!0})},any:yr,array:br,bigint:dr,boolean:ys,date:fr,discriminatedUnion:Sr,effect:gs,enum:jr,function:Ar,instanceof:cr,intersection:Tr,lazy:Rr,literal:Ir,map:Nr,nan:ur,nativeEnum:Zr,never:vr,null:pr,nullable:Pr,number:ps,object:wr,oboolean:()=>ys().optional(),onumber:()=>ps().optional(),optional:Dr,ostring:()=>ms().optional(),pipeline:Mr,preprocess:Br,promise:Lr,record:Or,set:Cr,strictObject:xr,string:ms,symbol:hr,transformer:gs,tuple:Er,undefined:mr,union:kr,unknown:gr,void:_r,NEVER:w,ZodIssueCode:h,quotelessJson:Wn,ZodError:D});class vs{constructor(e,s){b(this,"client");b(this,"parentId");b(this,"images");b(this,"length");this.client=e,this.parentId=s,this.images=[],this.length=this.images.length}async add(e){return this.images.push(e),this.length=this.images.length,await Jn(this.client,this.parentId,new bs(e)),new Promise(s=>{s(this.length)})}}const _s=d.object({handle:d.string(),url:d.string(),width:d.number(),height:d.number(),orientation:d.number(),taken_at:d.string(),camera_make:d.string().optional(),camera:d.string().optional(),filename:d.string()});class bs{constructor(e){b(this,"handle");b(this,"url");b(this,"width");b(this,"height");b(this,"orientation");b(this,"taken_at");b(this,"camera_make");b(this,"camera");b(this,"filename");this.handle=e.handle,this.url=e.url,this.width=e.width,this.height=e.height,this.orientation=e.rotation,this.taken_at=e.captureTime,this.camera_make=e.cameraMake,this.camera=e.cameraModel,this.filename=e.filename}}const ws=["new","ingesting","submitted","storyboarding","deduplication","image selection","designing","layouting","embellishing","polishing","ready","error"],_t=["baby","birthday","default","everyday","family","kids","life-stories","portfolio","school-memories","seasonal-holidays","special-celebrations","sports-and-hobbies","travel","wedding","year-in-review"],bt={1005:{slug:"modern-black-sfly"},1101:{slug:"bon-voyage-sfly"},1103:{slug:"fun-in-the-sun-sfly"},1201:{slug:"modern-wedding-sfly"},3001:{slug:"digiscrap-sfly"},4034:{slug:"travel-snapshots-sfly"},4035:{slug:"vintage-travel-sfly"},5017:{slug:"natural-neutrals-sfly"},5033:{slug:"chalkboard-chic-sfly"},5079:{slug:"hello-spring-sfly"},5082:{slug:"familygram-sfly"},5085:{slug:"best-day-ever-sfly"},5091:{slug:"little-love-sfly"},5118:{slug:"a-year-in-color-sfly"},5120:{slug:"milestone-anniversaries-sfly"},5121:{slug:"the-travel-bug-sfly"},5122:{slug:"modern-white-sfly"},5127:{slug:"outdoor-wedding-sfly"},5134:{slug:"classic-wedding-sfly"},5138:{slug:"kraft-pop-sfly"},5142:{slug:"simply-black-sfly"},5144:{slug:"autumn-memories-sfly"},5146:{slug:"everyday-sentiments-sfly"},5149:{slug:"everyday-happiness-sfly"},5150:{slug:"its-a-girl-thing-sfly"},5155:{slug:"made-with-love-sfly"},5157:{slug:"high-school-memories-sfly"},5161:{slug:"rustic-wedding-sfly"},5165:{slug:"life-is-grand-sfly"},5167:{slug:"adventure-awaits-sfly"},5168:{slug:"disney-adventure-sfly"},5171:{slug:"world-travel-sfly"},5174:{slug:"hello-summer-sfly"},5183:{slug:"everything-sports-sfly"},5188:{slug:"everyday-watercolor-sfly"},5189:{slug:"holiday-memories-sfly"},5213:{slug:"love-and-thanks-sfly"},5218:{slug:"babys-first-year-sfly"},5219:{slug:"usa-travel-sfly"},5220:{slug:"vintage-wedding-sfly"},5226:{slug:"love-you-because-sfly"},5228:{slug:"reunion-sfly"},5238:{slug:"whimsy-chalkboard-sfly"},5242:{slug:"modern-indigo-sfly"},5250:{slug:"family-yearbook-sfly"},5255:{slug:"elegant-wedding-sfly"},5258:{slug:"family-vacation-sfly"},5259:{slug:"beach-travel-sfly"},5261:{slug:"sparkle-and-shine-sfly"},5262:{slug:"welcome-baby-sfly"},5265:{slug:"vivid-watercolor-sfly"},5266:{slug:"what-i-love-about-you-sfly"},5272:{slug:"love-grows-sfly"},5274:{slug:"painted-seasons-sfly"},5278:{slug:"vintage-disney-sfly"},5292:{slug:"modern-grey-sfly"},5297:{slug:"modern-love-story-sfly"},5299:{slug:"modern-travel-sfly"},5304:{slug:"beach-wedding-sfly"},5305:{slug:"rustic-farmhouse-sfly"},5308:{slug:"tropical-travel-sfly"},6e3:{slug:"travel-abroad-sfly"},6001:{slug:"everyday-rustic-sfly"},6002:{slug:"simply-modern-sfly"},6003:{slug:"modern-baby-sfly"},6004:{slug:"modern-photo-album-sfly"},6005:{slug:"travel-adventures-sfly"},6006:{slug:"watercolor-year-in-review-sfly"},6007:{slug:"beach-bliss-sfly"},6008:{slug:"simply-gray-sfly"},6009:{slug:"family-favorites-by-lure-design-sfly"},6010:{slug:"travel-gallery-sfly"},6011:{slug:"our-wedding-day-sfly"},6012:{slug:"chic-celebrations-by-float-paperie-sfly"},6013:{slug:"simply-bold-type-sfly"},6014:{slug:"colorful-florals-by-potts-design-sfly"},6015:{slug:"softly-rustic-sfly"},6016:{slug:"ombre-watercolor-sfly"},6017:{slug:"forever-love-by-with-merriment-sfly"},6018:{slug:"colorful-memories-by-britt-bass-sfly"},6019:{slug:"celebrate-family-by-float-paperie-sfly"},6020:{slug:"disney-family-adventures-sfly"},6021:{slug:"everyday-neutrals-sfly"},6022:{slug:"colorful-childhood-sfly"},6023:{slug:"everyday-indigo-sfly"},6024:{slug:"shimmer-and-shine-sfly"},6025:{slug:"summertime-fun-sfly"},6026:{slug:"pet-lover-sfly"},6027:{slug:"modern-wedding-story-sfly"},6028:{slug:"family-blessings-by-potts-design-sfly"},6030:{slug:"outdoor-adventures-by-sarah-hawkins-designs-sfly"},6031:{slug:"travel-memories-sfly"},6032:{slug:"tropical-travels-sfly"},6033:{slug:"everyday-chalkboard-by-potts-design-sfly"},6034:{slug:"classic-disney-sfly"},6035:{slug:"cheerful-color-sfly"},6036:{slug:"colorful-birthday-sfly"},6038:{slug:"classic-baby-sfly"},6039:{slug:"bold-year-in-review-by-float-paperie-sfly"},6040:{slug:"colorfully-fun-sfly"},6041:{slug:"colorful-year-in-review-by-sarah-hawkins-designs-sfly"},6042:{slug:"gilded-wedding-sfly"},6043:{slug:"road-trip-travel-by-sarah-hawkins-designs-sfly"},6044:{slug:"rustic-gilded-wedding-sfly"},6045:{slug:"elegantly-scripted-year-in-review-sfly"},6047:{slug:"2020-what-a-year-sfly"},6057:{slug:"best-mom-ever-sfly"},6052:{slug:"celebration-of-life-by-sarah-hawkins-designs-sfly"},6054:{slug:"colorful-school-days-by-float-paperie-sfly"},6051:{slug:"love-is-all-we-need-sfly"},6058:{slug:"graduation-celebration-sfly"},6056:{slug:"our-wedding-day-guestbook-sfly"},6055:{slug:"muted-everyday-abstract-sfly"},6046:{slug:"winter-memories-by-sarah-hawkins-design-sfly"},6053:{slug:"best-dad-ever-sfly"},6050:{slug:"watercolor-greenery-by-sarah-hawkins-designs-sfly"},6063:{slug:"watercolor-floral-wedding-by-kim-thoa-sfly"},6060:{slug:"watercolor-baby-girl-sfly"},6059:{slug:"watercolor-baby-boy-sfly"},6048:{slug:"simple-elegant-wedding-sfly"},6049:{slug:"gilded-wedding-guestbook-sfly"},6037:{slug:"everyday-fairytale-by-jenny-romanski-sfly"},6061:{slug:"best-grandparents-ever-sfly"},6068:{slug:"winter-getaway-sfly"},6067:{slug:"national-parks-travel-by-eiman-design-co-sfly"},6065:{slug:"go-sports-by-lure-design-sfly"},6066:{slug:"elegant-wedding-greenery-by-kim-thoa-sfly"},6064:{slug:"boho-travel-by-umaiana-studio-sfly"},6071:{slug:"modern-dark-neutrals-sfly"},6072:{slug:"modern-light-neutrals-sfly"},6073:{slug:"modern-celebrations-sfly"},6074:{slug:"bright-and-bold-kids-year-in-review-by-sarah-hawkins-designs-sfly"},6085:{slug:"classic-school-yearbook-sfly"},6084:{slug:"colorful-elementary-school-yearbook-sfly"},5402:{slug:"everyday-recipes-by-slightly-stationery-sfly"},6083:{slug:"school-days-yearbook-sfly"},6082:{slug:"the-story-of-me-sfly"},6086:{slug:"whimsical-recipes-by-slightly-stationery-sfly"},6101:{slug:"babys-first-sfly"},6103:{slug:"classic-recipes-sfly"},6104:{slug:"elevated-rustic-sfly"},6105:{slug:"boho-summer-sfly"},6116:{slug:"boho-baby-sfly"},6117:{slug:"simply-gallery-sfly"},6118:{slug:"this-is-love-sfly"},6120:{slug:"wedding-gallery-sfly"},6121:{slug:"watercolorwashes-sfly"},6124:{slug:"graduation-photo-album-sfly"},6125:{slug:"modern-year-in-review-photo-album-sfly"},6126:{slug:"black-white-photo-album-sfly"},6132:{slug:"travel-journal-sfly"},6133:{slug:"rustic-gallery-sfly"},6137:{slug:"summer-adventures-sfly"},6075:{slug:"together-again-sfly"},6078:{slug:"everyday-boho-by-umaiana-studio-sfly"},6089:{slug:"colorful-gradients-sfly"},6096:{slug:"simply-scrapbook-sfly"},6097:{slug:"boho-wedding-sfly"},6098:{slug:"black-and-white-rustic-sfly"},6099:{slug:"bright-color-pop-sfly"}},wt=["8x8","10x10","12x12","8x11","11x8","11x14"],xt=["sc","hc","pl"],kt=["sp","sl","dl"],St=["low","medium","high"],Tt=["best","most","all"],Et=["none","few","lots"],Ot=["none","few","lots"],xs={state:"error",slug:"error",progress:100,message:"Design failed"},Ur="https://api.sfly-sls.magicbook.io",zr="wss://socket.sfly-sls.magicbook.io",$r=parseInt("30000")||3e4;class Vr{constructor(e){b(this,"occasion");b(this,"style");b(this,"book_size");b(this,"cover_type");b(this,"page_type");b(this,"image_density");b(this,"image_filtering_level");b(this,"embellishment_level");b(this,"text_sticker_level");this.occasion=e.occasion,this.style=e.style,this.book_size=e.book_size,this.cover_type=e.cover_type,this.page_type=e.page_type,this.image_density=e.image_density,this.image_filtering_level=e.image_filtering_level,this.embellishment_level=e.embellishment_level,this.text_sticker_level=e.text_sticker_level}}const Fr=d.object({occasion:d.enum(_t),style:d.string(),book_size:d.enum(wt),cover_type:d.enum(xt),page_type:d.enum(kt),image_density:d.enum(St),image_filtering_level:d.enum(Tt),embellishment_level:d.enum(Et),text_sticker_level:d.enum(Ot)}),ks=d.object({id:d.string(),title:d.string(),design_request:Fr,state:d.enum(ws).optional(),guid:d.string().optional()});class Nt{constructor(e){b(this,"id");b(this,"title");b(this,"design_request");b(this,"state");b(this,"guid");this.id=e.id,this.title=e.title,this.design_request=new Vr(e.design_request),this.state=e.state,this.guid=e.guid}}function Ss(t){const e=bt[t.style].slug,s=Ct(JSON.parse(JSON.stringify(t)));return s.style=e,new Nt({id:t.parentId,guid:t.guid,title:t.title,design_request:s})}const Xe=d.object({maxPageCount:d.number(),minPageCount:d.number(),maxImageCount:d.number(),avgImageCount:d.number(),minImageCount:d.number()}),Ts=d.object({high:Xe,medium:Xe,low:Xe}),Es=d.object({densities:Ts});async function Hr({apiKey:t,apiHost:e},s,n,r){return ye(async()=>{const i=await as({url:`${e}/v1/designoptions/booksize/${s}/imagecount/${n}
4
+ /imagefilteringlevel/${r}`,apiKey:t}),a=At(i.data);return Es.parse(a)})}const Jr=d.object({photoRefId:d.string(),finalCrop:d.array(d.number())}),Wr=d.object({x:d.number(),y:d.number(),width:d.number().optional(),height:d.number().optional(),rotation:d.number()}),Kr=d.object({id:d.string(),llx:d.number(),lly:d.number(),urx:d.number(),ury:d.number(),data:d.string().nullable(),title:d.string(),width:d.number(),effect:d.string(),height:d.number(),source:d.string(),rotation:d.number(),uploadTime:d.string()}),qr=d.object({key:d.string(),value:d.any()}),Gr=d.object({type:d.string(),imageAssignment:Jr.optional(),position:Wr,seqNum:d.number(),z:d.number(),id:d.string().optional(),horizJustification:d.string().optional(),vertJustification:d.string().optional().nullable(),text:d.string().optional(),fontId:d.string().optional(),fontSize:d.number().optional(),fontColor:d.string().optional(),frame:d.string().optional()}),Xr=d.object({url:d.string(),encryptId:d.string(),photoRefId:d.string(),photoId:d.string(),photoMetadata:Kr}),Yr=d.object({properties:d.array(qr)}),Qr=d.object({backgroundId:d.string().nullable(),assets:d.array(Gr).optional()}),ei=d.object({pageNum:d.number(),type:d.string(),canvas:Qr}),ti=d.object({pages:d.array(ei),photoStrip:d.array(Xr)}),si=d.object({title:d.string(),binding:d.string(),coverSpecId:d.string(),styleId:d.number(),userId:d.string(),magicShopBook:ti,reportingData:Yr});async function ni({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await os({url:`${t}/v1/books`,apiKey:e,payload:s})).data;return ks.safeParse(n),new Nt(n)})}async function Os({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await Hn({url:`${t}/v1/books/${s.id}`,apiKey:e,payload:s})).data;return ks.safeParse(n),new Nt(n)})}async function ri({apiHost:t,apiKey:e},s){return ye(async()=>{const n=(await as({url:`${t}/v1/books/${s}/format/galleon`,apiKey:e})).data;return si.parse(n)})}class Ns{constructor(e,s,n){b(this,"client");b(this,"webSocket");b(this,"parentId");b(this,"title");b(this,"occasion");b(this,"style");b(this,"bookSize");b(this,"coverType");b(this,"pageType");b(this,"imageDensity");b(this,"imageFilteringLevel");b(this,"embellishmentLevel");b(this,"textStickerLevel");b(this,"images");b(this,"guid");this.parentId=e,this.client=s,this.webSocket=new WebSocket(`${this.client.webSocketHost}/?book_id=${this.parentId}`),this.title=(n==null?void 0:n.title)||"",this.occasion=(n==null?void 0:n.occasion)||_t[0],this.style=(n==null?void 0:n.style)||parseInt(Object.keys(bt)[0]),this.bookSize=(n==null?void 0:n.bookSize)||wt[0],this.coverType=(n==null?void 0:n.coverType)||xt[0],this.pageType=(n==null?void 0:n.pageType)||kt[0],this.imageDensity=(n==null?void 0:n.imageDensity)||St[0],this.imageFilteringLevel=(n==null?void 0:n.imageFilteringLevel)||Tt[0],this.embellishmentLevel=(n==null?void 0:n.embellishmentLevel)||Et[0],this.textStickerLevel=(n==null?void 0:n.textStickerLevel)||Ot[0],this.images=new vs(this.client,this.parentId)}async getOptions(e){return await Hr(this.client,this.bookSize,e||this.images.length,this.imageFilteringLevel)}async submit(e){return e&&Object.assign(this,e),this.getProgress(),await Os(this.client,Ss(this)),this}async setGuid(e){return this.guid=e,await Os(this.client,Ss(this)),this.guid}async getJSON(){return await ri(this.client,this.parentId)}async eventHandler(e,s="MagicBook.designRequestUpdated"){const n=new CustomEvent(s,{detail:e});window.dispatchEvent(n),["error","ready"].includes(e.slug)&&this.webSocket.close()}timeoutHandler(){return setTimeout(()=>{this.eventHandler(xs)},$r)}async getProgress(){let e="new",s;this.webSocket.onmessage=n=>{const r=JSON.parse(n.data);e!==r.slug&&(s&&clearTimeout(s),s=this.timeoutHandler(),this.eventHandler(r),e=r.slug)},this.webSocket.onclose=()=>clearTimeout(s)}}class ii{constructor(e,s=Ur,n=zr){b(this,"apiKey");b(this,"apiHost");b(this,"webSocketHost");this.apiKey=e,this.apiHost=s,this.webSocketHost=n}async createDesignRequest(e){const s=await ni(this);return new Ns(s.id,this,e)}}O.DesignRequest=Ns,O.ImageServer=bs,O.Images=vs,O.MagicBookClient=ii,O.bookSizes=wt,O.coverTypes=xt,O.designOptionsSchema=Es,O.embellishmentLevels=Et,O.imageDensities=St,O.imageDensityOptionSchema=Xe,O.imageDensityOptionsSchema=Ts,O.imageFilteringLevels=Tt,O.imageServerSchema=_s,O.occasions=_t,O.pageTypes=kt,O.states=ws,O.styles=bt,O.textStickerLevels=Ot,O.timeoutMessage=xs,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
@@ -25,10 +25,14 @@ export type DesignRequestProps = {
25
25
  export type State = typeof states[number];
26
26
  export type DesignRequestEventDetail = {
27
27
  state: State;
28
+ slug: string;
29
+ progress: number;
30
+ message: string;
28
31
  };
29
32
  export type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
30
33
  export declare class DesignRequest {
31
34
  private client;
35
+ private webSocket;
32
36
  parentId: string;
33
37
  title: string;
34
38
  occasion: Occasion;
@@ -137,5 +141,7 @@ export declare class DesignRequest {
137
141
  }[];
138
142
  };
139
143
  }>;
144
+ private eventHandler;
145
+ private timeoutHandler;
140
146
  private getProgress;
141
147
  }
package/package.json CHANGED
@@ -1,29 +1,34 @@
1
1
  {
2
2
  "name": "@magiclabs.ai/magicbook-client",
3
+ "version": "0.6.2",
3
4
  "private": false,
4
- "version": "0.6.1",
5
5
  "description": "TypeScript package to create photo books with the Magicbook API.",
6
- "type": "module",
7
- "main": "./magicbook-client.umd.cjs",
8
- "module": "./magicbook-client.js",
9
- "types": "./src/index.d.ts",
10
6
  "repository": {
11
7
  "type": "git",
12
8
  "url": "https://github.com/magiclabs-ai/mb-client"
13
9
  },
10
+ "type": "module",
14
11
  "exports": {
15
12
  ".": {
16
13
  "import": "./magicbook-client.js",
17
14
  "require": "./magicbook-client.umd.cjs"
18
15
  }
19
16
  },
17
+ "main": "./magicbook-client.umd.cjs",
18
+ "module": "./magicbook-client.js",
19
+ "types": "./src/index.d.ts",
20
20
  "scripts": {
21
- "watch": "./scripts/build.sh -w",
22
21
  "build": "./scripts/build.sh",
22
+ "coverage": "vitest run --coverage",
23
23
  "deploy": "./scripts/deploy-npm.sh",
24
24
  "lint": "eslint . --ext js,jsx,ts,tsx --config .eslintrc.json --no-eslintrc",
25
25
  "test": "vitest --ui",
26
- "coverage": "vitest run --coverage"
26
+ "watch": "./scripts/build.sh -w"
27
+ },
28
+ "dependencies": {
29
+ "@faker-js/faker": "^8.0.1",
30
+ "axios": "^1.4.0",
31
+ "zod": "^3.21.4"
27
32
  },
28
33
  "devDependencies": {
29
34
  "@types/node": "^18.14.0",
@@ -39,10 +44,5 @@
39
44
  "vite": "^4.3.8",
40
45
  "vite-plugin-dts": "^2.3.0",
41
46
  "vitest": "^0.31.1"
42
- },
43
- "dependencies": {
44
- "@faker-js/faker": "^8.0.1",
45
- "axios": "^1.4.0",
46
- "zod": "^3.21.4"
47
47
  }
48
48
  }