@synnaxlabs/client 0.43.1 → 0.44.1

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.
Files changed (245) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/dist/access/payload.d.ts +1 -1
  3. package/dist/access/payload.d.ts.map +1 -1
  4. package/dist/access/policy/client.d.ts +263 -6
  5. package/dist/access/policy/client.d.ts.map +1 -1
  6. package/dist/access/policy/external.d.ts +0 -1
  7. package/dist/access/policy/external.d.ts.map +1 -1
  8. package/dist/access/policy/payload.d.ts +105 -93
  9. package/dist/access/policy/payload.d.ts.map +1 -1
  10. package/dist/auth/auth.d.ts +1 -1
  11. package/dist/auth/auth.d.ts.map +1 -1
  12. package/dist/channel/client.d.ts +12 -13
  13. package/dist/channel/client.d.ts.map +1 -1
  14. package/dist/channel/payload.d.ts +77 -19
  15. package/dist/channel/payload.d.ts.map +1 -1
  16. package/dist/channel/retriever.d.ts +9 -16
  17. package/dist/channel/retriever.d.ts.map +1 -1
  18. package/dist/channel/writer.d.ts +1 -1
  19. package/dist/channel/writer.d.ts.map +1 -1
  20. package/dist/client.cjs +27 -135
  21. package/dist/client.d.ts +3 -3
  22. package/dist/client.d.ts.map +1 -1
  23. package/dist/client.js +8612 -28957
  24. package/dist/connection/checker.d.ts +1 -1
  25. package/dist/connection/checker.d.ts.map +1 -1
  26. package/dist/control/client.d.ts +1 -0
  27. package/dist/control/client.d.ts.map +1 -1
  28. package/dist/control/state.d.ts +6 -6
  29. package/dist/control/state.d.ts.map +1 -1
  30. package/dist/errors.d.ts +18 -5
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/framer/adapter.d.ts +3 -3
  33. package/dist/framer/adapter.d.ts.map +1 -1
  34. package/dist/framer/client.d.ts +4 -13
  35. package/dist/framer/client.d.ts.map +1 -1
  36. package/dist/framer/codec.d.ts +1 -1
  37. package/dist/framer/codec.d.ts.map +1 -1
  38. package/dist/framer/deleter.d.ts +5 -5
  39. package/dist/framer/deleter.d.ts.map +1 -1
  40. package/dist/framer/frame.d.ts +5 -7
  41. package/dist/framer/frame.d.ts.map +1 -1
  42. package/dist/framer/streamProxy.d.ts +1 -1
  43. package/dist/framer/streamProxy.d.ts.map +1 -1
  44. package/dist/framer/streamer.d.ts +139 -20
  45. package/dist/framer/streamer.d.ts.map +1 -1
  46. package/dist/framer/writer.d.ts +222 -33
  47. package/dist/framer/writer.d.ts.map +1 -1
  48. package/dist/hardware/device/client.d.ts +49 -28
  49. package/dist/hardware/device/client.d.ts.map +1 -1
  50. package/dist/hardware/device/payload.d.ts +126 -46
  51. package/dist/hardware/device/payload.d.ts.map +1 -1
  52. package/dist/hardware/rack/client.d.ts +78 -22
  53. package/dist/hardware/rack/client.d.ts.map +1 -1
  54. package/dist/hardware/rack/payload.d.ts +99 -56
  55. package/dist/hardware/rack/payload.d.ts.map +1 -1
  56. package/dist/hardware/task/client.d.ts +100 -41
  57. package/dist/hardware/task/client.d.ts.map +1 -1
  58. package/dist/hardware/task/payload.d.ts +83 -61
  59. package/dist/hardware/task/payload.d.ts.map +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/label/client.d.ts +138 -20
  63. package/dist/label/client.d.ts.map +1 -1
  64. package/dist/label/external.d.ts +0 -2
  65. package/dist/label/external.d.ts.map +1 -1
  66. package/dist/label/payload.d.ts +4 -5
  67. package/dist/label/payload.d.ts.map +1 -1
  68. package/dist/ontology/client.d.ts +45 -135
  69. package/dist/ontology/client.d.ts.map +1 -1
  70. package/dist/ontology/group/group.d.ts +3 -3
  71. package/dist/ontology/group/group.d.ts.map +1 -1
  72. package/dist/ontology/group/payload.d.ts +3 -27
  73. package/dist/ontology/group/payload.d.ts.map +1 -1
  74. package/dist/ontology/payload.d.ts +113 -243
  75. package/dist/ontology/payload.d.ts.map +1 -1
  76. package/dist/ontology/writer.d.ts +4 -4
  77. package/dist/ontology/writer.d.ts.map +1 -1
  78. package/dist/ranger/alias.d.ts +11 -5
  79. package/dist/ranger/alias.d.ts.map +1 -1
  80. package/dist/ranger/client.d.ts +87 -30
  81. package/dist/ranger/client.d.ts.map +1 -1
  82. package/dist/ranger/external.d.ts +1 -1
  83. package/dist/ranger/external.d.ts.map +1 -1
  84. package/dist/ranger/kv.d.ts +10 -12
  85. package/dist/ranger/kv.d.ts.map +1 -1
  86. package/dist/ranger/payload.d.ts +23 -44
  87. package/dist/ranger/payload.d.ts.map +1 -1
  88. package/dist/ranger/writer.d.ts +22 -19
  89. package/dist/ranger/writer.d.ts.map +1 -1
  90. package/dist/testutil/client.d.ts +4 -0
  91. package/dist/testutil/client.d.ts.map +1 -0
  92. package/dist/user/client.d.ts +59 -6
  93. package/dist/user/client.d.ts.map +1 -1
  94. package/dist/user/payload.d.ts +4 -6
  95. package/dist/user/payload.d.ts.map +1 -1
  96. package/dist/user/retriever.d.ts +2 -2
  97. package/dist/user/retriever.d.ts.map +1 -1
  98. package/dist/util/decodeJSONString.d.ts +2 -2
  99. package/dist/util/decodeJSONString.d.ts.map +1 -1
  100. package/dist/util/parseWithoutKeyConversion.d.ts +2 -2
  101. package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -1
  102. package/dist/util/retrieve.d.ts +1 -1
  103. package/dist/util/retrieve.d.ts.map +1 -1
  104. package/dist/util/zod.d.ts +1 -1
  105. package/dist/util/zod.d.ts.map +1 -1
  106. package/dist/workspace/client.d.ts +17 -6
  107. package/dist/workspace/client.d.ts.map +1 -1
  108. package/dist/workspace/lineplot/client.d.ts +2 -2
  109. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  110. package/dist/workspace/lineplot/payload.d.ts +8 -9
  111. package/dist/workspace/lineplot/payload.d.ts.map +1 -1
  112. package/dist/workspace/log/client.d.ts +2 -2
  113. package/dist/workspace/log/client.d.ts.map +1 -1
  114. package/dist/workspace/log/payload.d.ts +8 -9
  115. package/dist/workspace/log/payload.d.ts.map +1 -1
  116. package/dist/workspace/payload.d.ts +10 -11
  117. package/dist/workspace/payload.d.ts.map +1 -1
  118. package/dist/workspace/schematic/client.d.ts +2 -2
  119. package/dist/workspace/schematic/client.d.ts.map +1 -1
  120. package/dist/workspace/schematic/payload.d.ts +10 -11
  121. package/dist/workspace/schematic/payload.d.ts.map +1 -1
  122. package/dist/workspace/table/client.d.ts +2 -2
  123. package/dist/workspace/table/client.d.ts.map +1 -1
  124. package/dist/workspace/table/payload.d.ts +10 -11
  125. package/dist/workspace/table/payload.d.ts.map +1 -1
  126. package/examples/node/package-lock.json +47 -39
  127. package/examples/node/package.json +2 -1
  128. package/examples/node/streamWrite.js +5 -11
  129. package/package.json +14 -13
  130. package/src/access/payload.ts +1 -1
  131. package/src/access/policy/client.ts +87 -32
  132. package/src/access/policy/external.ts +0 -1
  133. package/src/access/policy/payload.ts +4 -4
  134. package/src/access/policy/policy.spec.ts +86 -83
  135. package/src/auth/auth.spec.ts +29 -18
  136. package/src/auth/auth.ts +1 -1
  137. package/src/channel/batchRetriever.spec.ts +4 -9
  138. package/src/channel/channel.spec.ts +24 -6
  139. package/src/channel/client.ts +31 -46
  140. package/src/channel/payload.ts +13 -14
  141. package/src/channel/retriever.ts +26 -41
  142. package/src/channel/writer.ts +3 -3
  143. package/src/client.ts +4 -4
  144. package/src/connection/checker.ts +1 -1
  145. package/src/connection/connection.spec.ts +31 -23
  146. package/src/control/client.ts +2 -2
  147. package/src/control/state.spec.ts +3 -3
  148. package/src/control/state.ts +1 -1
  149. package/src/errors.spec.ts +9 -5
  150. package/src/errors.ts +28 -15
  151. package/src/framer/adapter.spec.ts +118 -9
  152. package/src/framer/adapter.ts +24 -11
  153. package/src/framer/client.spec.ts +125 -2
  154. package/src/framer/client.ts +41 -47
  155. package/src/framer/codec.ts +1 -1
  156. package/src/framer/deleter.spec.ts +2 -2
  157. package/src/framer/deleter.ts +1 -1
  158. package/src/framer/frame.ts +1 -4
  159. package/src/framer/iterator.spec.ts +8 -8
  160. package/src/framer/iterator.ts +1 -1
  161. package/src/framer/streamProxy.ts +1 -1
  162. package/src/framer/streamer.spec.ts +185 -36
  163. package/src/framer/streamer.ts +28 -36
  164. package/src/framer/writer.spec.ts +6 -6
  165. package/src/framer/writer.ts +97 -111
  166. package/src/hardware/device/client.ts +45 -131
  167. package/src/hardware/device/device.spec.ts +163 -52
  168. package/src/hardware/device/payload.ts +10 -21
  169. package/src/hardware/rack/client.ts +87 -105
  170. package/src/hardware/rack/payload.ts +4 -13
  171. package/src/hardware/rack/rack.spec.ts +28 -35
  172. package/src/hardware/task/client.ts +335 -291
  173. package/src/hardware/task/payload.ts +86 -62
  174. package/src/hardware/task/task.spec.ts +208 -32
  175. package/src/index.ts +2 -1
  176. package/src/label/client.ts +100 -95
  177. package/src/label/external.ts +0 -2
  178. package/src/label/label.spec.ts +8 -6
  179. package/src/label/payload.ts +3 -4
  180. package/src/ontology/client.ts +41 -324
  181. package/src/ontology/group/group.spec.ts +2 -2
  182. package/src/ontology/group/group.ts +4 -5
  183. package/src/ontology/group/payload.ts +2 -25
  184. package/src/ontology/group/writer.ts +1 -1
  185. package/src/ontology/ontology.spec.ts +355 -41
  186. package/src/ontology/payload.ts +74 -112
  187. package/src/ontology/writer.ts +8 -17
  188. package/src/ranger/alias.ts +19 -37
  189. package/src/ranger/client.ts +118 -150
  190. package/src/ranger/external.ts +9 -1
  191. package/src/ranger/kv.ts +6 -27
  192. package/src/ranger/payload.ts +21 -37
  193. package/src/ranger/ranger.spec.ts +37 -56
  194. package/src/ranger/writer.ts +1 -1
  195. package/src/{signals/index.ts → testutil/client.ts} +11 -1
  196. package/src/user/client.ts +122 -47
  197. package/src/user/payload.ts +2 -5
  198. package/src/user/retriever.ts +1 -1
  199. package/src/user/user.spec.ts +31 -31
  200. package/src/user/writer.ts +1 -1
  201. package/src/util/decodeJSONString.ts +3 -3
  202. package/src/util/parseWithoutKeyConversion.ts +2 -2
  203. package/src/util/retrieve.ts +1 -1
  204. package/src/util/zod.ts +1 -1
  205. package/src/workspace/client.ts +20 -36
  206. package/src/workspace/lineplot/client.ts +5 -7
  207. package/src/workspace/lineplot/lineplot.spec.ts +2 -2
  208. package/src/workspace/lineplot/payload.ts +4 -7
  209. package/src/workspace/log/client.ts +5 -7
  210. package/src/workspace/log/log.spec.ts +2 -2
  211. package/src/workspace/log/payload.ts +4 -7
  212. package/src/workspace/payload.ts +4 -7
  213. package/src/workspace/schematic/client.ts +5 -7
  214. package/src/workspace/schematic/payload.ts +4 -7
  215. package/src/workspace/schematic/schematic.spec.ts +2 -2
  216. package/src/workspace/table/client.ts +5 -7
  217. package/src/workspace/table/payload.ts +4 -7
  218. package/src/workspace/table/table.spec.ts +2 -2
  219. package/src/workspace/workspace.spec.ts +2 -2
  220. package/dist/access/policy/ontology.d.ts +0 -5
  221. package/dist/access/policy/ontology.d.ts.map +0 -1
  222. package/dist/access/policy/retriever.d.ts +0 -40
  223. package/dist/access/policy/retriever.d.ts.map +0 -1
  224. package/dist/access/policy/writer.d.ts +0 -9
  225. package/dist/access/policy/writer.d.ts.map +0 -1
  226. package/dist/label/retriever.d.ts +0 -14
  227. package/dist/label/retriever.d.ts.map +0 -1
  228. package/dist/label/writer.d.ts +0 -54
  229. package/dist/label/writer.d.ts.map +0 -1
  230. package/dist/setupspecs.d.ts +0 -5
  231. package/dist/setupspecs.d.ts.map +0 -1
  232. package/dist/signals/external.d.ts +0 -2
  233. package/dist/signals/external.d.ts.map +0 -1
  234. package/dist/signals/index.d.ts +0 -2
  235. package/dist/signals/index.d.ts.map +0 -1
  236. package/dist/signals/observable.d.ts +0 -12
  237. package/dist/signals/observable.d.ts.map +0 -1
  238. package/src/access/policy/ontology.ts +0 -17
  239. package/src/access/policy/retriever.ts +0 -44
  240. package/src/access/policy/writer.ts +0 -65
  241. package/src/label/retriever.ts +0 -63
  242. package/src/label/writer.ts +0 -95
  243. package/src/setupspecs.ts +0 -27
  244. package/src/signals/external.ts +0 -10
  245. package/src/signals/observable.ts +0 -42
package/dist/client.cjs CHANGED
@@ -1,152 +1,44 @@
1
- "use strict";var pS=Object.defineProperty;var vS=(t,e,r)=>e in t?pS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var f=(t,e,r)=>vS(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const gS=t=>Array.isArray(t)?t:t==null?[]:[t],C=Object.freeze(Object.defineProperty({__proto__:null,toArray:gS},Symbol.toStringTag,{value:"Module"})),yS=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},Ch=t=>{const e=(r,i=xo)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(a=>e(a,i));if(!ro(r))return r;i=wS(i);const n={},s=r;return"toJSON"in s&&typeof s.toJSON=="function"?e(s.toJSON(),i):(Object.keys(s).forEach(a=>{let o=s[a];const u=t(a);i.recursive&&(ro(o)?Lm(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&Rm(o)&&(o=[...o].map(c=>{let l=c;return ro(c)?Lm(l,i.keepTypesOnRecursion)||(l=e(c,i)):Rm(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},Rh=Ch(yS),$S=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),bS=Ch($S),xo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wS=(t=xo)=>(t.recursive==null?t=xo:t.recursiveInArray??(t.recursiveInArray=!1),t),Rm=t=>t!=null&&Array.isArray(t),ro=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Lm=(t,e)=>(e||[]).some(r=>t instanceof r),Lh=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var _S=Object.defineProperty,kS=(t,e,r)=>e in t?_S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xr=(t,e,r)=>kS(t,typeof e!="symbol"?e+"":e,r);let Mh=class{constructor(){Xr(this,"contentType","application/json"),Xr(this,"decoder"),Xr(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,r){return this.decodeString(this.decoder.decode(e),r)}decodeString(e,r){const i=JSON.parse(e),n=Rh(i);return r!=null?r.parse(n):n}encodeString(e){const r=bS(e);return JSON.stringify(r,(i,n)=>ArrayBuffer.isView(n)?Array.from(n):typeof n=="bigint"?n.toString():n)}},Bh=class{constructor(){Xr(this,"contentType","text/csv")}encode(e){const r=this.encodeString(e);return new TextEncoder().encode(r)}decode(e,r){const i=new TextDecoder().decode(e);return this.decodeString(i,r)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Lh(e[0]))throw new Error("Payload must be an array of objects");const r=Object.keys(e[0]),i=[r.join(",")];return e.forEach(n=>{const s=r.map(a=>JSON.stringify(n[a]??""));i.push(s.join(","))}),i.join(`
2
- `)}decodeString(e,r){const[i,...n]=e.trim().split(`
3
- `).map(o=>o.trim());if(i.length===0)return r!=null?r.parse({}):{};const s=i.split(",").map(o=>o.trim()),a={};return s.forEach(o=>{a[o]=[]}),n.forEach(o=>{const u=o.split(",").map(c=>c.trim());s.forEach((c,l)=>{const d=this.parseValue(u[l]);d!=null&&a[c].push(d)})}),r!=null?r.parse(a):a}parseValue(e){if(e==null||e.length===0)return null;const r=Number(e);return isNaN(r)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:r}},Fh=class{constructor(){Xr(this,"contentType","text/plain")}encode(e){if(typeof e!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(e)}decode(e,r){const i=new TextDecoder().decode(e);return r!=null?r.parse(i):i}};const ii=new Mh,IS=new Bh,OS=new Fh,SS=[ii],Nn=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:Bh,CSV_CODEC:IS,ENCODERS:SS,JSONCodec:Mh,JSON_CODEC:ii,TEXT_CODEC:OS,TextCodec:Fh},Symbol.toStringTag,{value:"Module"})),NS=t=>[...new Set(t)],TS=(t,e,r=!0)=>{const i=new Map;return t.forEach(n=>{const s=e(n);if(i.has(s)){if(r)return;i.delete(s)}i.set(s,n)}),Array.from(i.values())},Mm=Object.freeze(Object.defineProperty({__proto__:null,by:TS,unique:NS},Symbol.toStringTag,{value:"Module"}));var zS=Object.defineProperty,xS=(t,e,r)=>e in t?zS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ES=(t,e,r)=>xS(t,e+"",r);let br=class{constructor(e){ES(this,"value"),this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const US=t=>t!=null&&typeof t=="object"&&"toString"in t,ZS=(t,e=!1)=>{const r=US(t)?"stringer":typeof t;let i;switch(r){case"string":i=(n,s)=>n.localeCompare(s);break;case"stringer":i=(n,s)=>n.toString().localeCompare(s.toString());break;case"number":i=(n,s)=>Number(n)-Number(s);break;case"bigint":i=(n,s)=>BigInt(n)-BigInt(s)>0n?1:-1;break;case"boolean":i=(n,s)=>Number(n)-Number(s);break;case"undefined":i=()=>0;break;default:return console.warn(`sortFunc: unknown type ${r}`),()=>-1}return e?PS(i):i},PS=t=>(e,r)=>t(r,e),Hs=0,io=-1,so=1,jS=t=>t<Hs,AS=t=>t>Hs,DS=t=>t===Hs;function $(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}const qh=Symbol("zod_brand");let sr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};const _s={};function lt(t){return t&&Object.assign(_s,t),_s}function CS(t){return t}function RS(t){return t}function LS(t){}function MS(t){throw new Error}function BS(t){}function Iu(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function P(t,e="|"){return t.map(r=>K(r)).join(e)}function Jh(t,e){return typeof e=="bigint"?e.toString():e}function Qs(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Tn(t){return t==null}function ea(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Vh(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function ie(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function wr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function FS(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function qS(t){const e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{const n={};for(let s=0;s<e.length;s++)n[e[s]]=i[s];return n})}function Ou(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Bn(t){return JSON.stringify(t)}function si(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Wh=Qs(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ks(t){if(si(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(si(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function JS(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const VS=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Is=new Set(["string","number","symbol"]),Gh=new Set(["string","number","bigint","boolean","symbol","undefined"]);function zn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function N(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function WS(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,s){return e??(e=t()),Reflect.set(e,i,n,s)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function K(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Yh(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Kh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Hh(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return jt(t,{...t._zod.def,shape:r,checks:[]})}function Qh(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return jt(t,{...t._zod.def,shape:r,checks:[]})}function ep(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return wr(this,"shape",i),i},checks:[]};return jt(t,r)}function tp(t,e){return jt(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return wr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function np(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return jt(e,{...e._zod.def,shape:n,checks:[]})}function rp(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return jt(e,{...e._zod.def,shape:n,checks:[]})}function Qn(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function gt(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Rr(t){return typeof t=="string"?t:t==null?void 0:t.message}function kt(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=Rr((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??Rr((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Rr((o=r.customError)==null?void 0:o.call(r,t))??Rr((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function ta(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function na(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ar(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function GS(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}let YS=class{constructor(...e){}};const KS=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Xh,Class:YS,NUMBER_FORMAT_RANGES:Kh,aborted:Qn,allowsEval:Wh,assert:BS,assertEqual:CS,assertIs:LS,assertNever:MS,assertNotEqual:RS,assignProp:wr,cached:Qs,cleanEnum:GS,cleanRegex:ea,clone:jt,createTransparentProxy:WS,defineLazy:ie,esc:Bn,escapeRegex:zn,extend:ep,finalizeIssue:kt,floatSafeRemainder:Vh,getElementAtPath:FS,getEnumValues:Iu,getLengthableOrigin:na,getParsedType:VS,getSizableOrigin:ta,isObject:si,isPlainObject:ks,issue:ar,joinValues:P,jsonStringifyReplacer:Jh,merge:tp,normalizeParams:N,nullish:Tn,numKeys:JS,omit:Qh,optionalKeys:Yh,partial:np,pick:Hh,prefixIssues:gt,primitiveTypes:Gh,promiseAllObject:qS,propertyKeyTypes:Is,randomString:Ou,required:rp,stringifyPrimitive:K,unwrapMessage:Rr},Symbol.toStringTag,{value:"Module"})),ip=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Jh,2)},enumerable:!0})},Su=$("$ZodError",ip),Oi=$("$ZodError",ip,{Parent:Error});function Nu(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function Tu(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}function sp(t,e){const r=e||function(s){return s.message},i={errors:[]},n=(s,a=[])=>{var o,u;for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{const l=[...a,...c.path];if(l.length===0){i.errors.push(r(c));continue}let d=i,g=0;for(;g<l.length;){const p=l[g],_=g===l.length-1;typeof p=="string"?(d.properties??(d.properties={}),(o=d.properties)[p]??(o[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),_&&d.errors.push(r(c)),g++}}};return n(t),i}function ap(t){const e=[];for(const r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function op(t){var e;const r=[],i=[...t.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of i)r.push(`✖ ${n.message}`),(e=n.path)!=null&&e.length&&r.push(` → at ${ap(n.path)}`);return r.join(`
4
- `)}const zu=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new sr;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>kt(u,s,lt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Eo=zu(Oi),xu=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>kt(u,s,lt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Uo=xu(Oi),Eu=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new sr;return s.issues.length?{success:!1,error:new(t??Su)(s.issues.map(a=>kt(a,n,lt())))}:{success:!0,data:s.value}},up=Eu(Oi),Uu=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>kt(a,n,lt())))}:{success:!0,data:s.value}},cp=Uu(Oi),lp=/^[cC][^\s-]{8,}$/,dp=/^[0-9a-z]+$/,mp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fp=/^[0-9a-vA-V]{20}$/,hp=/^[A-Za-z0-9]{27}$/,pp=/^[a-zA-Z0-9_-]{21}$/,vp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,XS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,or=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,HS=or(4),QS=or(6),eN=or(7),yp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tN=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,nN=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,rN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,iN=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$p="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function bp(){return new RegExp($p,"u")}const wp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_p=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,kp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ip=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Op=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zu=/^[A-Za-z0-9_-]*$/,Sp=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,sN=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Np=/^\+(?:[0-9]){6,14}[0-9]$/,Tp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",zp=new RegExp(`^${Tp}$`);function xp(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ep(t){return new RegExp(`^${xp(t)}$`)}function Up(t){const e=xp({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${Tp}T(?:${i})$`)}const Zp=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Pp=/^\d+n?$/,jp=/^\d+$/,Ap=/^-?\d+(?:\.\d+)?/i,Dp=/true|false/i,Cp=/null/i,Rp=/undefined/i,Lp=/^[^A-Z]*$/,Mp=/^[^a-z]*$/,Bp=Object.freeze(Object.defineProperty({__proto__:null,_emoji:$p,base64:Op,base64url:Zu,bigint:Pp,boolean:Dp,browserEmail:iN,cidrv4:kp,cidrv6:Ip,cuid:lp,cuid2:dp,date:zp,datetime:Up,domain:sN,duration:vp,e164:Np,email:yp,emoji:bp,extendedDuration:XS,guid:gp,hostname:Sp,html5Email:tN,integer:jp,ipv4:wp,ipv6:_p,ksuid:hp,lowercase:Lp,nanoid:pp,null:Cp,number:Ap,rfc5322Email:nN,string:Zp,time:Ep,ulid:mp,undefined:Rp,unicodeEmail:rN,uppercase:Mp,uuid:or,uuid4:HS,uuid6:QS,uuid7:eN,xid:fp},Symbol.toStringTag,{value:"Module"})),Re=$("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Fp={number:"number",bigint:"bigint",object:"date"},Pu=$("$ZodCheckLessThan",(t,e)=>{Re.init(t,e);const r=Fp[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ju=$("$ZodCheckGreaterThan",(t,e)=>{Re.init(t,e);const r=Fp[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),qp=$("$ZodCheckMultipleOf",(t,e)=>{Re.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Vh(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Jp=$("$ZodCheckNumberFormat",(t,e)=>{var r;Re.init(t,e),e.format=e.format||"float64";const i=(r=e.format)==null?void 0:r.includes("int"),n=i?"int":"number",[s,a]=Kh[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=s,u.maximum=a,i&&(u.pattern=jp)}),t._zod.check=o=>{const u=o.value;if(i){if(!Number.isInteger(u)){o.issues.push({expected:n,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}u<s&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),u>a&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),Vp=$("$ZodCheckBigIntFormat",(t,e)=>{Re.init(t,e);const[r,i]=Xh[e.format];t._zod.onattach.push(n=>{const s=n._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i}),t._zod.check=n=>{const s=n.value;s<r&&n.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>i&&n.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inst:t})}}),Wp=$("$ZodCheckMaxSize",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;i.size<=e.maximum||r.issues.push({origin:ta(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Gp=$("$ZodCheckMinSize",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;i.size>=e.minimum||r.issues.push({origin:ta(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Yp=$("$ZodCheckSizeEquals",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{const i=r.value,n=i.size;if(n===e.size)return;const s=n>e.size;r.issues.push({origin:ta(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Kp=$("$ZodCheckMaxLength",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=na(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Xp=$("$ZodCheckMinLength",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=na(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Hp=$("$ZodCheckLengthEquals",(t,e)=>{Re.init(t,e),t._zod.when=r=>{const i=r.value;return!Tn(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=na(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Si=$("$ZodCheckStringFormat",(t,e)=>{var r;Re.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),Qp=$("$ZodCheckRegex",(t,e)=>{Si.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ev=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Lp),Si.init(t,e)}),tv=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Mp),Si.init(t,e)}),nv=$("$ZodCheckIncludes",(t,e)=>{Re.init(t,e);const r=zn(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),rv=$("$ZodCheckStartsWith",(t,e)=>{Re.init(t,e);const r=new RegExp(`^${zn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),iv=$("$ZodCheckEndsWith",(t,e)=>{Re.init(t,e);const r=new RegExp(`.*${zn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function Bm(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues))}const sv=$("$ZodCheckProperty",(t,e)=>{Re.init(t,e),t._zod.check=r=>{const i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>Bm(n,r,e.property));Bm(i,r,e.property)}}),av=$("$ZodCheckMimeType",(t,e)=>{Re.init(t,e);const r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,path:["type"],inst:t})}}),ov=$("$ZodCheckOverwrite",(t,e)=>{Re.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});let uv=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
5
- `).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
6
- `))}};const cv={major:4,minor:0,patch:0},B=$("$ZodType",(t,e)=>{var r,i;t??(t={}),ie(t._zod,"id",()=>e.type+"_"+Ou(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=cv;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=Qn(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new sr;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=Qn(a,g)))});else{if(a.issues.length===g)continue;c||(c=Qn(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new sr;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=up(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return cp(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Ni=$("$ZodString",(t,e)=>{var r;B.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??Zp(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),$e=$("$ZodStringFormat",(t,e)=>{Si.init(t,e),Ni.init(t,e)}),lv=$("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=gp),$e.init(t,e)}),dv=$("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=or(r))}else e.pattern??(e.pattern=or());$e.init(t,e)}),mv=$("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=yp),$e.init(t,e)}),fv=$("$ZodURL",(t,e)=>{$e.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Sp.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),hv=$("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=bp()),$e.init(t,e)}),pv=$("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=pp),$e.init(t,e)}),vv=$("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=lp),$e.init(t,e)}),gv=$("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=dp),$e.init(t,e)}),yv=$("$ZodULID",(t,e)=>{e.pattern??(e.pattern=mp),$e.init(t,e)}),$v=$("$ZodXID",(t,e)=>{e.pattern??(e.pattern=fp),$e.init(t,e)}),bv=$("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hp),$e.init(t,e)}),wv=$("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Up(e)),$e.init(t,e),t._zod.check}),_v=$("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=zp),$e.init(t,e)}),kv=$("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Ep(e)),$e.init(t,e),t._zod.check}),Iv=$("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=vp),$e.init(t,e)}),Ov=$("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=wp),$e.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),Sv=$("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=_p),$e.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Nv=$("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=kp),$e.init(t,e)}),Tv=$("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Ip),$e.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Au(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const zv=$("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Op),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Au(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function xv(t){if(!Zu.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Au(r)}const Ev=$("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Zu),$e.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{xv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Uv=$("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Np),$e.init(t,e)});function Zv(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const Pv=$("$ZodJWT",(t,e)=>{$e.init(t,e),t._zod.check=r=>{Zv(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Du=$("$ZodNumber",(t,e)=>{B.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ap,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),jv=$("$ZodNumber",(t,e)=>{Jp.init(t,e),Du.init(t,e)}),Cu=$("$ZodBoolean",(t,e)=>{B.init(t,e),t._zod.pattern=Dp,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ru=$("$ZodBigInt",(t,e)=>{B.init(t,e),t._zod.pattern=Pp,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),Av=$("$ZodBigInt",(t,e)=>{Vp.init(t,e),Ru.init(t,e)}),Dv=$("$ZodSymbol",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Cv=$("$ZodUndefined",(t,e)=>{B.init(t,e),t._zod.pattern=Rp,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),Rv=$("$ZodNull",(t,e)=>{B.init(t,e),t._zod.pattern=Cp,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Lv=$("$ZodAny",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Os=$("$ZodUnknown",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Mv=$("$ZodNever",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Bv=$("$ZodVoid",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),Fv=$("$ZodDate",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:t}),r}});function Fm(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}const Lu=$("$ZodArray",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>Fm(c,r,a))):Fm(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function Xi(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}function qm(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...gt(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const qv=$("$ZodObject",(t,e)=>{B.init(t,e);const r=Qs(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof B))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=Yh(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});ie(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new uv(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Bn(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=Ou(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Bn(h);d.write(`
7
- if (${v}.issues.length) {
8
- if (input[${w}] === undefined) {
9
- if (${w} in input) {
10
- newResult[${w}] = undefined;
11
- }
12
- } else {
13
- payload.issues = payload.issues.concat(
14
- ${v}.issues.map((iss) => ({
15
- ...iss,
16
- path: iss.path ? [${w}, ...iss.path] : [${w}],
17
- }))
18
- );
19
- }
20
- } else if (${v}.value === undefined) {
21
- if (${w} in input) newResult[${w}] = undefined;
22
- } else {
23
- newResult[${w}] = ${v}.value;
24
- }
25
- `)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
26
- if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
27
- ...iss,
28
- path: iss.path ? [${Bn(h)}, ...iss.path] : [${Bn(h)}]
29
- })));`),d.write(`newResult[${Bn(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=si,a=!_s.jitless,o=a&&Wh.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?qm(ce,l,w,g):Xi(ce,l,w))):J?qm(A,l,w,g):Xi(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>Xi(I,l,v))):Xi(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function Jm(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>kt(s,i,lt())))}),e}const Mu=$("$ZodUnion",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ie(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ea(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>Jm(a,r,t,i)):Jm(s,r,t,i)}}),Jv=$("$ZodDiscriminatedUnion",(t,e)=>{Mu.init(t,e);const r=t._zod.parse;ie(t._zod,"propValues",()=>{const n={};for(const s of e.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[o,u]of Object.entries(a)){n[o]||(n[o]=new Set);for(const c of u)n[o].add(c)}}return n});const i=Qs(()=>{const n=e.options,s=new Map;for(const a of n){const o=a._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const u of o){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});t._zod.parse=(n,s)=>{const a=n.value;if(!si(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),n;const o=i.value.get(a==null?void 0:a[e.discriminator]);return o?o._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),n)}}),Vv=$("$ZodIntersection",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>Vm(r,o,u)):Vm(r,s,a)}});function Zo(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(ks(t)&&ks(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=Zo(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=Zo(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Vm(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Qn(t))return t;const i=Zo(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const ra=$("$ZodTuple",(t,e)=>{B.init(t,e);const r=e.items,i=r.length-[...r].reverse().findIndex(n=>n._zod.optin!=="optional");t._zod.parse=(n,s)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[];if(!e.rest){const c=a.length>r.length,l=a.length<i-1;if(c||l)return n.issues.push({input:a,inst:t,origin:"array",...c?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let u=-1;for(const c of r){if(u++,u>=a.length&&u>=i)continue;const l=c._zod.run({value:a[u],issues:[]},s);l instanceof Promise?o.push(l.then(d=>Hi(d,n,u))):Hi(l,n,u)}if(e.rest){const c=a.slice(r.length);for(const l of c){u++;const d=e.rest._zod.run({value:l,issues:[]},s);d instanceof Promise?o.push(d.then(g=>Hi(g,n,u))):Hi(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function Hi(t,e,r){t.issues.length&&e.issues.push(...gt(r,t.issues)),e.value[r]=t.value}const Wv=$("$ZodRecord",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!ks(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...gt(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...gt(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>kt(c,i,lt())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...gt(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...gt(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Gv=$("$ZodMap",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;const s=[];r.value=new Map;for(const[a,o]of n){const u=e.keyType._zod.run({value:a,issues:[]},i),c=e.valueType._zod.run({value:o,issues:[]},i);u instanceof Promise||c instanceof Promise?s.push(Promise.all([u,c]).then(([l,d])=>{Wm(l,d,r,a,n,t,i)})):Wm(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function Wm(t,e,r,i,n,s,a){t.issues.length&&(Is.has(typeof i)?r.issues.push(...gt(i,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:s,issues:t.issues.map(o=>kt(o,a,lt()))})),e.issues.length&&(Is.has(typeof i)?r.issues.push(...gt(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:i,issues:e.issues.map(o=>kt(o,a,lt()))})),r.value.set(t.value,e.value)}const Yv=$("$ZodSet",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;const s=[];r.value=new Set;for(const a of n){const o=e.valueType._zod.run({value:a,issues:[]},i);o instanceof Promise?s.push(o.then(u=>Gm(u,r))):Gm(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function Gm(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Kv=$("$ZodEnum",(t,e)=>{B.init(t,e);const r=Iu(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>Is.has(typeof i)).map(i=>typeof i=="string"?zn(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),Xv=$("$ZodLiteral",(t,e)=>{B.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?zn(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),Hv=$("$ZodFile",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),Bu=$("$ZodTransform",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new sr;return r.value=n,r}}),Qv=$("$ZodOptional",(t,e)=>{B.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ea(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),eg=$("$ZodNullable",(t,e)=>{B.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${ea(r.source)}|null)$`):void 0}),ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),tg=$("$ZodDefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Ym(s,e)):Ym(n,e)}});function Ym(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const ng=$("$ZodPrefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),rg=$("$ZodNonOptional",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Km(s,t)):Km(n,t)}});function Km(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const ig=$("$ZodSuccess",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),sg=$("$ZodCatch",(t,e)=>{B.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>kt(a,i,lt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>kt(s,i,lt()))},input:r.value}),r.issues=[]),r)}}),ag=$("$ZodNaN",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Fu=$("$ZodPipe",(t,e)=>{B.init(t,e),ie(t._zod,"values",()=>e.in._zod.values),ie(t._zod,"optin",()=>e.in._zod.optin),ie(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>Xm(s,e,i)):Xm(n,e,i)}});function Xm(t,e,r){return Qn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const og=$("$ZodReadonly",(t,e)=>{B.init(t,e),ie(t._zod,"propValues",()=>e.innerType._zod.propValues),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Hm):Hm(n)}});function Hm(t){return t.value=Object.freeze(t.value),t}const ug=$("$ZodTemplateLiteral",(t,e)=>{B.init(t,e);const r=[];for(const i of e.parts)if(i instanceof B){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const s=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(s,a))}else if(i===null||Gh.has(typeof i))r.push(zn(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),cg=$("$ZodPromise",(t,e)=>{B.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),lg=$("$ZodLazy",(t,e)=>{B.init(t,e),ie(t._zod,"innerType",()=>e.getter()),ie(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),ie(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),ie(t._zod,"optin",()=>t._zod.innerType._zod.optin),ie(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),dg=$("$ZodCustom",(t,e)=>{Re.init(t,e),B.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Qm(s,r,i,t));Qm(n,r,i,t)}});function Qm(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(ar(n))}}const mg=Symbol("ZodOutput"),fg=Symbol("ZodInput");let qu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Ju(){return new qu}const dn=Ju();function hg(t,e){return new t({type:"string",...N(e)})}function pg(t,e){return new t({type:"string",coerce:!0,...N(e)})}function Vu(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...N(e)})}function Ss(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...N(e)})}function Wu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...N(e)})}function Gu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(e)})}function Yu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(e)})}function Ku(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(e)})}function Xu(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...N(e)})}function Hu(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...N(e)})}function Qu(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(e)})}function ec(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...N(e)})}function tc(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(e)})}function nc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...N(e)})}function rc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...N(e)})}function ic(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(e)})}function sc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(e)})}function ac(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(e)})}function oc(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(e)})}function uc(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(e)})}function cc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...N(e)})}function lc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...N(e)})}function dc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...N(e)})}function mc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...N(e)})}const vg={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function gg(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(e)})}function yg(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function $g(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function bg(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function wg(t,e){return new t({type:"number",checks:[],...N(e)})}function _g(t,e){return new t({type:"number",coerce:!0,checks:[],...N(e)})}function kg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...N(e)})}function Ig(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...N(e)})}function Og(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...N(e)})}function Sg(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...N(e)})}function Ng(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...N(e)})}function Tg(t,e){return new t({type:"boolean",...N(e)})}function zg(t,e){return new t({type:"boolean",coerce:!0,...N(e)})}function xg(t,e){return new t({type:"bigint",...N(e)})}function Eg(t,e){return new t({type:"bigint",coerce:!0,...N(e)})}function Ug(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(e)})}function Zg(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(e)})}function Pg(t,e){return new t({type:"symbol",...N(e)})}function jg(t,e){return new t({type:"undefined",...N(e)})}function Ag(t,e){return new t({type:"null",...N(e)})}function Dg(t){return new t({type:"any"})}function Ns(t){return new t({type:"unknown"})}function Cg(t,e){return new t({type:"never",...N(e)})}function Rg(t,e){return new t({type:"void",...N(e)})}function Lg(t,e){return new t({type:"date",...N(e)})}function Mg(t,e){return new t({type:"date",coerce:!0,...N(e)})}function Bg(t,e){return new t({type:"nan",...N(e)})}function pn(t,e){return new Pu({check:"less_than",...N(e),value:t,inclusive:!1})}function wt(t,e){return new Pu({check:"less_than",...N(e),value:t,inclusive:!0})}function vn(t,e){return new ju({check:"greater_than",...N(e),value:t,inclusive:!1})}function ht(t,e){return new ju({check:"greater_than",...N(e),value:t,inclusive:!0})}function Fg(t){return vn(0,t)}function qg(t){return pn(0,t)}function Jg(t){return wt(0,t)}function Vg(t){return ht(0,t)}function ai(t,e){return new qp({check:"multiple_of",...N(e),value:t})}function ia(t,e){return new Wp({check:"max_size",...N(e),maximum:t})}function oi(t,e){return new Gp({check:"min_size",...N(e),minimum:t})}function fc(t,e){return new Yp({check:"size_equals",...N(e),size:t})}function sa(t,e){return new Kp({check:"max_length",...N(e),maximum:t})}function ur(t,e){return new Xp({check:"min_length",...N(e),minimum:t})}function aa(t,e){return new Hp({check:"length_equals",...N(e),length:t})}function hc(t,e){return new Qp({check:"string_format",format:"regex",...N(e),pattern:t})}function pc(t){return new ev({check:"string_format",format:"lowercase",...N(t)})}function vc(t){return new tv({check:"string_format",format:"uppercase",...N(t)})}function gc(t,e){return new nv({check:"string_format",format:"includes",...N(e),includes:t})}function yc(t,e){return new rv({check:"string_format",format:"starts_with",...N(e),prefix:t})}function $c(t,e){return new iv({check:"string_format",format:"ends_with",...N(e),suffix:t})}function Wg(t,e,r){return new sv({check:"property",property:t,schema:e,...N(r)})}function bc(t,e){return new av({check:"mime_type",mime:t,...N(e)})}function xn(t){return new ov({check:"overwrite",tx:t})}function wc(t){return xn(e=>e.normalize(t))}function _c(){return xn(t=>t.trim())}function kc(){return xn(t=>t.toLowerCase())}function Ic(){return xn(t=>t.toUpperCase())}function Oc(t,e,r){return new t({type:"array",element:e,...N(r)})}function aN(t,e,r){return new t({type:"union",options:e,...N(r)})}function oN(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...N(i)})}function uN(t,e,r){return new t({type:"intersection",left:e,right:r})}function Gg(t,e,r,i){const n=r instanceof B,s=n?i:r,a=n?r:null;return new t({type:"tuple",items:e,rest:a,...N(s)})}function cN(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...N(i)})}function lN(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...N(i)})}function dN(t,e,r){return new t({type:"set",valueType:e,...N(r)})}function mN(t,e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...N(r)})}function fN(t,e,r){return new t({type:"enum",entries:e,...N(r)})}function hN(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...N(r)})}function Yg(t,e){return new t({type:"file",...N(e)})}function pN(t,e){return new t({type:"transform",transform:e})}function vN(t,e){return new t({type:"optional",innerType:e})}function gN(t,e){return new t({type:"nullable",innerType:e})}function yN(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function $N(t,e,r){return new t({type:"nonoptional",innerType:e,...N(r)})}function bN(t,e){return new t({type:"success",innerType:e})}function wN(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function _N(t,e,r){return new t({type:"pipe",in:e,out:r})}function kN(t,e){return new t({type:"readonly",innerType:e})}function IN(t,e,r){return new t({type:"template_literal",parts:e,...N(r)})}function ON(t,e){return new t({type:"lazy",getter:e})}function SN(t,e){return new t({type:"promise",innerType:e})}function Kg(t,e,r){const i=N(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function Xg(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}function Hg(t,e){const{case:r,error:i,truthy:n,falsy:s}=N(e);let a=n??["true","1","yes","on","y","enabled"],o=s??["false","0","no","off","n","disabled"];r!=="sensitive"&&(a=a.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));const u=new Set(a),c=new Set(o),l=t.Pipe??Fu,d=t.Boolean??Cu,g=t.String??Ni,p=t.Transform??Bu,_=new p({type:"transform",transform:(m,h)=>{let v=m;return r!=="sensitive"&&(v=v.toLowerCase()),u.has(v)?!0:c.has(v)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...u,...c],input:h.value,inst:_}),{})},error:i}),k=new l({type:"pipe",in:new g({type:"string",error:i}),out:_,error:i});return new l({type:"pipe",in:k,out:new d({type:"boolean",error:i}),error:i})}const Sc=$("ZodISODateTime",(t,e)=>{wv.init(t,e),_e.init(t,e)});function Qg(t){return gg(Sc,t)}const Nc=$("ZodISODate",(t,e)=>{_v.init(t,e),_e.init(t,e)});function ey(t){return yg(Nc,t)}const Tc=$("ZodISOTime",(t,e)=>{kv.init(t,e),_e.init(t,e)});function ty(t){return $g(Tc,t)}const zc=$("ZodISODuration",(t,e)=>{Iv.init(t,e),_e.init(t,e)});function ny(t){return bg(zc,t)}const NN=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,date:ey,datetime:Qg,duration:ny,time:ty},Symbol.toStringTag,{value:"Module"})),ry=(t,e)=>{Su.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Tu(t,r)},flatten:{value:r=>Nu(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},TN=$("ZodError",ry),Ti=$("ZodError",ry,{Parent:Error}),iy=zu(Ti),sy=xu(Ti),ay=Eu(Ti),oy=Uu(Ti),ee=$("ZodType",(t,e)=>(B.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>jt(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>iy(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>ay(t,r,i),t.parseAsync=async(r,i)=>sy(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>oy(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(qy(r,i)),t.superRefine=r=>t.check(Jy(r)),t.overwrite=r=>t.check(xn(r)),t.optional=()=>zs(t),t.nullable=()=>xs(t),t.nullish=()=>zs(xs(t)),t.nonoptional=r=>Uy(t,r),t.array=()=>xi(t),t.or=r=>ze([t,r]),t.and=r=>by(t,r),t.transform=r=>Es(t,el(r)),t.default=r=>zy(t,r),t.prefault=r=>Ey(t,r),t.catch=r=>jy(t,r),t.pipe=r=>Es(t,r),t.readonly=()=>Cy(t),t.describe=r=>{const i=t.clone();return dn.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=dn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return dn.get(t);const i=t.clone();return dn.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),xc=$("_ZodString",(t,e)=>{Ni.init(t,e),ee.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(hc(...i)),t.includes=(...i)=>t.check(gc(...i)),t.startsWith=(...i)=>t.check(yc(...i)),t.endsWith=(...i)=>t.check($c(...i)),t.min=(...i)=>t.check(ur(...i)),t.max=(...i)=>t.check(sa(...i)),t.length=(...i)=>t.check(aa(...i)),t.nonempty=(...i)=>t.check(ur(1,...i)),t.lowercase=i=>t.check(pc(i)),t.uppercase=i=>t.check(vc(i)),t.trim=()=>t.check(_c()),t.normalize=(...i)=>t.check(wc(...i)),t.toLowerCase=()=>t.check(kc()),t.toUpperCase=()=>t.check(Ic())}),oa=$("ZodString",(t,e)=>{Ni.init(t,e),xc.init(t,e),t.email=r=>t.check(Vu(Ec,r)),t.url=r=>t.check(Xu(Uc,r)),t.jwt=r=>t.check(mc(Wc,r)),t.emoji=r=>t.check(Hu(Zc,r)),t.guid=r=>t.check(Ss(Ts,r)),t.uuid=r=>t.check(Wu(Mt,r)),t.uuidv4=r=>t.check(Gu(Mt,r)),t.uuidv6=r=>t.check(Yu(Mt,r)),t.uuidv7=r=>t.check(Ku(Mt,r)),t.nanoid=r=>t.check(Qu(Pc,r)),t.guid=r=>t.check(Ss(Ts,r)),t.cuid=r=>t.check(ec(jc,r)),t.cuid2=r=>t.check(tc(Ac,r)),t.ulid=r=>t.check(nc(Dc,r)),t.base64=r=>t.check(cc(qc,r)),t.base64url=r=>t.check(lc(Jc,r)),t.xid=r=>t.check(rc(Cc,r)),t.ksuid=r=>t.check(ic(Rc,r)),t.ipv4=r=>t.check(sc(Lc,r)),t.ipv6=r=>t.check(ac(Mc,r)),t.cidrv4=r=>t.check(oc(Bc,r)),t.cidrv6=r=>t.check(uc(Fc,r)),t.e164=r=>t.check(dc(Vc,r)),t.datetime=r=>t.check(Qg(r)),t.date=r=>t.check(ey(r)),t.time=r=>t.check(ty(r)),t.duration=r=>t.check(ny(r))});function Ne(t){return hg(oa,t)}const _e=$("ZodStringFormat",(t,e)=>{$e.init(t,e),xc.init(t,e)}),Ec=$("ZodEmail",(t,e)=>{mv.init(t,e),_e.init(t,e)});function zN(t){return Vu(Ec,t)}const Ts=$("ZodGUID",(t,e)=>{lv.init(t,e),_e.init(t,e)});function xN(t){return Ss(Ts,t)}const Mt=$("ZodUUID",(t,e)=>{dv.init(t,e),_e.init(t,e)});function EN(t){return Wu(Mt,t)}function UN(t){return Gu(Mt,t)}function ZN(t){return Yu(Mt,t)}function PN(t){return Ku(Mt,t)}const Uc=$("ZodURL",(t,e)=>{fv.init(t,e),_e.init(t,e)});function jN(t){return Xu(Uc,t)}const Zc=$("ZodEmoji",(t,e)=>{hv.init(t,e),_e.init(t,e)});function AN(t){return Hu(Zc,t)}const Pc=$("ZodNanoID",(t,e)=>{pv.init(t,e),_e.init(t,e)});function DN(t){return Qu(Pc,t)}const jc=$("ZodCUID",(t,e)=>{vv.init(t,e),_e.init(t,e)});function CN(t){return ec(jc,t)}const Ac=$("ZodCUID2",(t,e)=>{gv.init(t,e),_e.init(t,e)});function RN(t){return tc(Ac,t)}const Dc=$("ZodULID",(t,e)=>{yv.init(t,e),_e.init(t,e)});function LN(t){return nc(Dc,t)}const Cc=$("ZodXID",(t,e)=>{$v.init(t,e),_e.init(t,e)});function MN(t){return rc(Cc,t)}const Rc=$("ZodKSUID",(t,e)=>{bv.init(t,e),_e.init(t,e)});function BN(t){return ic(Rc,t)}const Lc=$("ZodIPv4",(t,e)=>{Ov.init(t,e),_e.init(t,e)});function FN(t){return sc(Lc,t)}const Mc=$("ZodIPv6",(t,e)=>{Sv.init(t,e),_e.init(t,e)});function qN(t){return ac(Mc,t)}const Bc=$("ZodCIDRv4",(t,e)=>{Nv.init(t,e),_e.init(t,e)});function JN(t){return oc(Bc,t)}const Fc=$("ZodCIDRv6",(t,e)=>{Tv.init(t,e),_e.init(t,e)});function VN(t){return uc(Fc,t)}const qc=$("ZodBase64",(t,e)=>{zv.init(t,e),_e.init(t,e)});function WN(t){return cc(qc,t)}const Jc=$("ZodBase64URL",(t,e)=>{Ev.init(t,e),_e.init(t,e)});function GN(t){return lc(Jc,t)}const Vc=$("ZodE164",(t,e)=>{Uv.init(t,e),_e.init(t,e)});function YN(t){return dc(Vc,t)}const Wc=$("ZodJWT",(t,e)=>{Pv.init(t,e),_e.init(t,e)});function KN(t){return mc(Wc,t)}const ua=$("ZodNumber",(t,e)=>{Du.init(t,e),ee.init(t,e),t.gt=(i,n)=>t.check(vn(i,n)),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.lt=(i,n)=>t.check(pn(i,n)),t.lte=(i,n)=>t.check(wt(i,n)),t.max=(i,n)=>t.check(wt(i,n)),t.int=i=>t.check(Po(i)),t.safe=i=>t.check(Po(i)),t.positive=i=>t.check(vn(0,i)),t.nonnegative=i=>t.check(ht(0,i)),t.negative=i=>t.check(pn(0,i)),t.nonpositive=i=>t.check(wt(0,i)),t.multipleOf=(i,n)=>t.check(ai(i,n)),t.step=(i,n)=>t.check(ai(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function H(t){return wg(ua,t)}const _r=$("ZodNumberFormat",(t,e)=>{jv.init(t,e),ua.init(t,e)});function Po(t){return kg(_r,t)}function XN(t){return Ig(_r,t)}function HN(t){return Og(_r,t)}function QN(t){return Sg(_r,t)}function eT(t){return Ng(_r,t)}const ca=$("ZodBoolean",(t,e)=>{Cu.init(t,e),ee.init(t,e)});function Gc(t){return Tg(ca,t)}const la=$("ZodBigInt",(t,e)=>{Ru.init(t,e),ee.init(t,e),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.gt=(i,n)=>t.check(vn(i,n)),t.gte=(i,n)=>t.check(ht(i,n)),t.min=(i,n)=>t.check(ht(i,n)),t.lt=(i,n)=>t.check(pn(i,n)),t.lte=(i,n)=>t.check(wt(i,n)),t.max=(i,n)=>t.check(wt(i,n)),t.positive=i=>t.check(vn(BigInt(0),i)),t.negative=i=>t.check(pn(BigInt(0),i)),t.nonpositive=i=>t.check(wt(BigInt(0),i)),t.nonnegative=i=>t.check(ht(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(ai(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function gn(t){return xg(la,t)}const Yc=$("ZodBigIntFormat",(t,e)=>{Av.init(t,e),la.init(t,e)});function tT(t){return Ug(Yc,t)}function nT(t){return Zg(Yc,t)}const uy=$("ZodSymbol",(t,e)=>{Dv.init(t,e),ee.init(t,e)});function cy(t){return Pg(uy,t)}const ly=$("ZodUndefined",(t,e)=>{Cv.init(t,e),ee.init(t,e)});function dy(t){return jg(ly,t)}const my=$("ZodNull",(t,e)=>{Rv.init(t,e),ee.init(t,e)});function zi(t){return Ag(my,t)}const fy=$("ZodAny",(t,e)=>{Lv.init(t,e),ee.init(t,e)});function rT(){return Dg(fy)}const hy=$("ZodUnknown",(t,e)=>{Os.init(t,e),ee.init(t,e)});function cr(){return Ns(hy)}const py=$("ZodNever",(t,e)=>{Mv.init(t,e),ee.init(t,e)});function da(t){return Cg(py,t)}const vy=$("ZodVoid",(t,e)=>{Bv.init(t,e),ee.init(t,e)});function iT(t){return Rg(vy,t)}const Kc=$("ZodDate",(t,e)=>{Fv.init(t,e),ee.init(t,e),t.min=(i,n)=>t.check(ht(i,n)),t.max=(i,n)=>t.check(wt(i,n));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function sT(t){return Lg(Kc,t)}const gy=$("ZodArray",(t,e)=>{Lu.init(t,e),ee.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(ur(r,i)),t.nonempty=r=>t.check(ur(1,r)),t.max=(r,i)=>t.check(sa(r,i)),t.length=(r,i)=>t.check(aa(r,i)),t.unwrap=()=>t.element});function xi(t,e){return Oc(gy,t,e)}function aT(t){const e=t._zod.def.shape;return Oy(Object.keys(e))}const ma=$("ZodObject",(t,e)=>{qv.init(t,e),ee.init(t,e),ie(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Ye(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:cr()}),t.loose=()=>t.clone({...t._zod.def,catchall:cr()}),t.strict=()=>t.clone({...t._zod.def,catchall:da()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ep(t,r),t.merge=r=>tp(t,r),t.pick=r=>Hh(t,r),t.omit=r=>Qh(t,r),t.partial=(...r)=>np(tl,t,r[0]),t.required=(...r)=>rp(nl,t,r[0])});function re(t,e){const r={type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},...N(e)};return new ma(r)}function oT(t,e){return new ma({type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},catchall:da(),...N(e)})}function uT(t,e){return new ma({type:"object",get shape(){return wr(this,"shape",{...t}),this.shape},catchall:cr(),...N(e)})}const Xc=$("ZodUnion",(t,e)=>{Mu.init(t,e),ee.init(t,e),t.options=e.options});function ze(t,e){return new Xc({type:"union",options:t,...N(e)})}const yy=$("ZodDiscriminatedUnion",(t,e)=>{Xc.init(t,e),Jv.init(t,e)});function cT(t,e,r){return new yy({type:"union",options:e,discriminator:t,...N(r)})}const $y=$("ZodIntersection",(t,e)=>{Vv.init(t,e),ee.init(t,e)});function by(t,e){return new $y({type:"intersection",left:t,right:e})}const wy=$("ZodTuple",(t,e)=>{ra.init(t,e),ee.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function kr(t,e,r){const i=e instanceof B,n=i?r:e,s=i?e:null;return new wy({type:"tuple",items:t,rest:s,...N(n)})}const Hc=$("ZodRecord",(t,e)=>{Wv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function fa(t,e,r){return new Hc({type:"record",keyType:t,valueType:e,...N(r)})}function lT(t,e,r){return new Hc({type:"record",keyType:ze([t,da()]),valueType:e,...N(r)})}const _y=$("ZodMap",(t,e)=>{Gv.init(t,e),ee.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function dT(t,e,r){return new _y({type:"map",keyType:t,valueType:e,...N(r)})}const ky=$("ZodSet",(t,e)=>{Yv.init(t,e),ee.init(t,e),t.min=(...r)=>t.check(oi(...r)),t.nonempty=r=>t.check(oi(1,r)),t.max=(...r)=>t.check(ia(...r)),t.size=(...r)=>t.check(fc(...r))});function mT(t,e){return new ky({type:"set",valueType:t,...N(e)})}const ui=$("ZodEnum",(t,e)=>{Kv.init(t,e),ee.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...e,checks:[],...N(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...e,checks:[],...N(n),entries:s})}});function Ye(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new ui({type:"enum",entries:r,...N(e)})}function fT(t,e){return new ui({type:"enum",entries:t,...N(e)})}const Iy=$("ZodLiteral",(t,e)=>{Xv.init(t,e),ee.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Oy(t,e){return new Iy({type:"literal",values:Array.isArray(t)?t:[t],...N(e)})}const Sy=$("ZodFile",(t,e)=>{Hv.init(t,e),ee.init(t,e),t.min=(r,i)=>t.check(oi(r,i)),t.max=(r,i)=>t.check(ia(r,i)),t.mime=(r,i)=>t.check(bc(Array.isArray(r)?r:[r],i))});function hT(t){return Yg(Sy,t)}const Qc=$("ZodTransform",(t,e)=>{Bu.init(t,e),ee.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(ar(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(ar(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function el(t){return new Qc({type:"transform",transform:t})}const tl=$("ZodOptional",(t,e)=>{Qv.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function zs(t){return new tl({type:"optional",innerType:t})}const Ny=$("ZodNullable",(t,e)=>{eg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function xs(t){return new Ny({type:"nullable",innerType:t})}function pT(t){return zs(xs(t))}const Ty=$("ZodDefault",(t,e)=>{tg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function zy(t,e){return new Ty({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const xy=$("ZodPrefault",(t,e)=>{ng.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ey(t,e){return new xy({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const nl=$("ZodNonOptional",(t,e)=>{rg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Uy(t,e){return new nl({type:"nonoptional",innerType:t,...N(e)})}const Zy=$("ZodSuccess",(t,e)=>{ig.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vT(t){return new Zy({type:"success",innerType:t})}const Py=$("ZodCatch",(t,e)=>{sg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function jy(t,e){return new Py({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ay=$("ZodNaN",(t,e)=>{ag.init(t,e),ee.init(t,e)});function gT(t){return Bg(Ay,t)}const rl=$("ZodPipe",(t,e)=>{Fu.init(t,e),ee.init(t,e),t.in=e.in,t.out=e.out});function Es(t,e){return new rl({type:"pipe",in:t,out:e})}const Dy=$("ZodReadonly",(t,e)=>{og.init(t,e),ee.init(t,e)});function Cy(t){return new Dy({type:"readonly",innerType:t})}const Ry=$("ZodTemplateLiteral",(t,e)=>{ug.init(t,e),ee.init(t,e)});function yT(t,e){return new Ry({type:"template_literal",parts:t,...N(e)})}const Ly=$("ZodLazy",(t,e)=>{lg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.getter()});function My(t){return new Ly({type:"lazy",getter:t})}const By=$("ZodPromise",(t,e)=>{cg.init(t,e),ee.init(t,e),t.unwrap=()=>t._zod.def.innerType});function $T(t){return new By({type:"promise",innerType:t})}const ha=$("ZodCustom",(t,e)=>{dg.init(t,e),ee.init(t,e)});function Fy(t,e){const r=new Re({check:"custom",...N(e)});return r._zod.check=t,r}function bT(t,e){return Kg(ha,t??(()=>!0),e)}function qy(t,e={}){return Xg(ha,t,e)}function Jy(t,e){const r=Fy(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(ar(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(ar(s))}},t(i.value,i)),e);return r}function ge(t,e={error:`Input not instance of ${t.name}`}){const r=new ha({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...N(e)});return r._zod.bag.Class=t,r}const wT=(...t)=>Hg({Pipe:rl,Boolean:ca,String:oa,Transform:Qc},...t);function _T(t){const e=My(()=>ze([Ne(t),H(),Gc(),zi(),xi(e),fa(Ne(),e)]));return e}function kT(t,e){return Es(el(t),e)}const pa=kr([H(),H()]);kr([gn(),gn()]);const Vy=re({width:H(),height:H()}),IT=re({signedWidth:H(),signedHeight:H()}),OT=["width","height"];Ye(OT);const ST=["start","center","end"],NT=["signedWidth","signedHeight"];Ye(NT);const Us=re({x:H(),y:H()}),TT=re({clientX:H(),clientY:H()}),zT=["x","y"],Wy=Ye(zT),Gy=["top","right","bottom","left"];Ye(Gy);const xT=["left","right"],Yy=Ye(xT),ET=["top","bottom"],Ky=Ye(ET),Xy=["center"],ef=Ye(Xy),UT=[...Gy,...Xy],Hy=Ye(UT);Ye(ST);const ZT=["first","last"];Ye(ZT);const PT=re({lower:H(),upper:H()}),jT=re({lower:gn(),upper:gn()});ze([PT,pa]);ze([jT,pa]);Ye([...Wy.options,...Hy.options]);ze([Wy,Hy,ge(String)]);const Ir=t=>typeof t=="bigint"||t instanceof BigInt,ao=(t,e)=>Ir(t)?t.valueOf()-BigInt(e.valueOf().valueOf()):t.valueOf()-Number(e.valueOf()),AT=(t,e)=>Ir(t)?t.valueOf()+BigInt(e.valueOf().valueOf()):t+Number(e.valueOf()),tf=(t,e)=>Ir(t)?t===BigInt(e.valueOf().valueOf()):t===Number(e.valueOf()),DT=(t,e)=>Ir(t)?t.valueOf()<BigInt(e.valueOf())?t:BigInt(e.valueOf()):t.valueOf()<Number(e.valueOf())?t:Number(e.valueOf()),CT=t=>Ir(t)||t instanceof BigInt?t.valueOf()<0n?-t:t:t.valueOf()<0?-t:t,Ln=(t,e)=>Ir(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),nt=(t,e,r)=>{const i={};if(typeof e=="object"&&(r=e,e=void 0),r={makeValid:!0,...r},typeof t=="number"||typeof t=="bigint")e!=null?(i.lower=t,i.upper=e):(i.lower=typeof t=="bigint"?0n:0,i.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[i.lower,i.upper]=t}else i.lower=t.lower,i.upper=t.upper;return r!=null&&r.makeValid?RT(i):i},RT=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,nf=(t,e)=>{const r=nt(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},Qi=(t,e)=>{const r=nt(t);if(typeof e=="number"||typeof e=="bigint")return e>=r.lower&&e<r.upper;const i=nt(e);return i.lower>=r.lower&&i.upper<=r.upper},LT=t=>({lower:Math.min(...t.map(e=>nt(e).lower)),upper:Math.max(...t.map(e=>nt(e).upper))}),MT=(t,e,r)=>{const i=t.map(o=>nt(o)),n=r>0?1:r<0?-1:0;if(n===0)return e;let s=r,a=e;for(;tf(s,0)===!1;){const o=i.findIndex(u=>n>0?a>=u.lower&&a<u.upper:a>u.lower&&a<=u.upper);if(o!==-1){const u=i[o];let c;if(n>0?c=ao(u.upper,a):c=ao(a,u.lower),c>0){const l=DT(CT(s),c);if(a=AT(a,n>0?l:-l),s=ao(s,n>0?l:-l),tf(s,0))return a;continue}}if(n>0){const u=i.filter(c=>c.lower>a);if(u.length>0)a=u[0].lower;else return a}else{const u=i.filter(c=>c.upper<a);if(u.length>0)a=u[u.length-1].upper;else return a}}return a},BT=(t,e,r)=>{const i=t.map(a=>nt(a));if(e===r)return typeof e=="bigint"?0n:0;const n=e<r?nt([e,r]):nt([r,e]);let s=typeof e=="bigint"?0n:0;for(const a of i){const o=a.lower>n.lower?a.lower:n.lower,u=a.upper<n.upper?a.upper:n.upper;if(o<u){const c=u-o;s=s+c}}return s};re({x:Yy.or(ef),y:Ky.or(ef)});const FT=re({x:Yy,y:Ky}),qT=Object.freeze({x:"left",y:"top"}),JT=(t,e)=>t.x===e.x&&t.y===e.y,rf=ze([H(),Us,pa,Vy,IT,TT]),VT=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},sf=Object.freeze({x:0,y:0}),es=ze([H(),Ne()]);re({top:es,left:es,width:es,height:es});re({left:H(),top:H(),right:H(),bottom:H()});re({one:Us,two:Us,root:FT});const il=(t,e,r=0,i=0,n)=>{const s={one:{...sf},two:{...sf},root:n??qT};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+i},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:n??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+i}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},oo=t=>{const e=il(t);return{lower:e.one.x,upper:e.two.x}},uo=t=>{const e=il(t);return{lower:e.one.y,upper:e.two.y}},WT=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,GT=re({signedWidth:H(),signedHeight:H()});ze([Vy,GT,Us,pa]);var YT=Object.defineProperty,KT=(t,e,r)=>e in t?YT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bt=(t,e,r)=>KT(t,typeof e!="symbol"?e+"":e,r);const XT=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;re({offset:rf,scale:rf});re({offset:H(),scale:H()});const HT=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],QT=t=>(e,r,i,n)=>[e,n?i/t:i*t],ez=t=>(e,r,i)=>{if(e===null)return[t,i];const{lower:n,upper:s}=e,{lower:a,upper:o}=t,u=s-n,c=o-a;if(r==="dimension")return[t,i*(c/u)];const l=(i-n)*(c/u)+a;return[t,l]},tz=t=>(e,r,i)=>[t,i],nz=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:i,upper:n}=t;return[t,n-(r-i)]},rz=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=XT(i,n,s),[e,i]},jo=class Lr{constructor(){Bt(this,"ops",[]),Bt(this,"currBounds",null),Bt(this,"currType",null),Bt(this,"reversed",!1),this.ops=[]}static translate(e){return new Lr().translate(e)}static magnify(e){return new Lr().magnify(e)}static scale(e,r){return new Lr().scale(e,r)}translate(e){const r=this.new(),i=HT(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=QT(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=nt(e,r),n=this.new(),s=ez(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=nt(e,r),n=this.new(),s=rz(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=nt(e,r),n=this.new(),s=tz(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=nz();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Lr;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([i,n],s)=>s(i,e,n,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((i,n)=>{if(i.type==="scale"||r.some(([a,o])=>n>=a&&n<=o))return;const s=e.ops.findIndex((a,o)=>a.type==="scale"&&o>n);s!==-1&&r.push([n,s])}),r.forEach(([i,n])=>{const s=e.ops.slice(i,n);s.unshift(e.ops[n]),e.ops.splice(i,n-i+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};Bt(jo,"IDENTITY",new jo);let af=jo;const of=class Rt{constructor(e=new af,r=new af,i=null){Bt(this,"x"),Bt(this,"y"),Bt(this,"currRoot"),this.x=e,this.y=r,this.currRoot=i}static translate(e,r){return new Rt().translate(e,r)}static translateX(e){return new Rt().translateX(e)}static translateY(e){return new Rt().translateY(e)}static clamp(e){return new Rt().clamp(e)}static magnify(e){return new Rt().magnify(e)}static scale(e){return new Rt().scale(e)}static reBound(e){return new Rt().reBound(e)}translate(e,r){const i=VT(e,r),n=this.copy();return n.x=this.x.translate(i.x),n.y=this.y.translate(i.y),n}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(WT(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!JT(i,e.root)&&(i.x!==e.root.x&&(r.x=r.x.invert()),i.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(oo(e)),r.y=r.y.scale(uo(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(oo(e)),r.y=this.y.reBound(uo(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(oo(e)),r.y=this.y.clamp(uo(e)),r}copy(){const e=new Rt;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return il(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};Bt(of,"IDENTITY",new of);var iz=Object.defineProperty,sz=(t,e,r)=>e in t?iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z=(t,e,r)=>sz(t,typeof e!="symbol"?e+"":e,r);function az(t){return pg(oa,t)}function oz(t){return _g(ua,t)}function uz(t){return zg(ca,t)}function Qy(t){return Eg(la,t)}function cz(t){return Mg(Kc,t)}const lz=Object.freeze(Object.defineProperty({__proto__:null,bigint:Qy,boolean:uz,date:cz,number:oz,string:az},Symbol.toStringTag,{value:"Module"}));let dz=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const mz="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",fz=dz(mz,11),e$=()=>fz(),hz=Object.freeze(Object.defineProperty({__proto__:null,create:e$},Symbol.toStringTag,{value:"Module"})),pz=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,vz=Ye(["static","dynamic"]),t$=(t,e)=>{const r=new W(e);if(![M.DAY,M.HOUR,M.MINUTE,M.SECOND,M.MILLISECOND,M.MICROSECOND,M.NANOSECOND].some(n=>n.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const i=t.valueOf()%r.valueOf();return t instanceof W?new W(i):new M(i)},le=class R extends br{constructor(e,r="UTC"){if(e==null)super(R.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*R.MILLISECOND.valueOf());else if(typeof e=="string")super(R.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(R.parseDate(e));else{let i=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(i=R.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=R.MAX:e=R.MIN)),super(BigInt(e.valueOf())+i)}}static parseDate([e=1970,r=1,i=1]){const n=new Date(e,r-1,i,0,0,0,0);return new R(BigInt(n.getTime())*R.MILLISECOND.valueOf()).truncate(R.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[i,n,s]=e.split(":");let a="00",o="00";s!=null&&([a,o]=s.split("."));let u=R.hours(parseInt(i??"00")).add(R.minutes(parseInt(n??"00"))).add(R.seconds(parseInt(a??"00"))).add(R.milliseconds(parseInt(o??"00")));return r==="local"&&(u=u.add(R.utcOffset)),u.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return R.parseTimeString(e,r);const i=new Date(e);return e.includes(":")||i.setUTCHours(0,0,0,0),new R(BigInt(i.getTime())*R.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(R.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const i=this.toISOString(r);return e?i.slice(11,23):i.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),i=e.toLocaleString("default",{day:"numeric"});return`${r} ${i}`}static get utcOffset(){return new M(BigInt(new Date().getTimezoneOffset())*R.MINUTE.valueOf())}static since(e){return new R().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new R(e).valueOf()}span(e){return this.range(e).span}range(e){return new Ee(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new R(e).valueOf()}afterEq(e){return this.valueOf()>=new R(e).valueOf()}before(e){return this.valueOf()<new R(e).valueOf()}beforeEq(e){return this.valueOf()<=new R(e).valueOf()}add(e){return new R(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new R(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(M.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(M.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(M.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(M.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(R.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(R.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const r=this.date();return r.setUTCFullYear(e),new R(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new R(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new R(r)}get hour(){return this.date().getUTCHours()}setHour(e){const r=this.date();return r.setUTCHours(e),new R(r,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new R(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new R(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new R(r)}toString(){return this.date().toISOString()}remainder(e){return t$(this,e)}get isToday(){return this.truncate(M.DAY).equals(R.now().truncate(M.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new R(new Date)}static max(...e){let r=R.MIN;for(const i of e){const n=new R(i);n.after(r)&&(r=n)}return r}static min(...e){let r=R.MAX;for(const i of e){const n=new R(i);n.before(r)&&(r=n)}return r}static nanoseconds(e,r="UTC"){return new R(e,r)}static microseconds(e,r="UTC"){return R.nanoseconds(e*1e3,r)}static milliseconds(e,r="UTC"){return R.microseconds(e*1e3,r)}static seconds(e,r="UTC"){return R.milliseconds(e*1e3,r)}static minutes(e,r="UTC"){return R.seconds(e*60,r)}static hours(e,r="UTC"){return R.minutes(e*60,r)}static days(e,r="UTC"){return R.hours(e*24,r)}};z(le,"NANOSECOND",le.nanoseconds(1)),z(le,"MICROSECOND",le.microseconds(1)),z(le,"MILLISECOND",le.milliseconds(1)),z(le,"SECOND",le.seconds(1)),z(le,"MINUTE",le.minutes(1)),z(le,"HOUR",le.hours(1)),z(le,"DAY",le.days(1)),z(le,"MAX",new le((1n<<63n)-1n)),z(le,"MIN",new le(0)),z(le,"ZERO",new le(0)),z(le,"z",ze([re({value:gn()}).transform(t=>new le(t.value)),Ne().transform(t=>new le(BigInt(t))),ge(Number).transform(t=>new le(t)),H().transform(t=>new le(t)),ge(le)]));let W=le;const de=class G extends br{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof G?e:e instanceof Ao?e.period:e instanceof W?new G(e):["number","bigint"].includes(typeof e)?G.seconds(e):new G(e)}static fromMilliseconds(e){return e instanceof G?e:e instanceof Ao?e.period:e instanceof W?new G(e):["number","bigint"].includes(typeof e)?G.milliseconds(e):new G(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new G(e).valueOf()}greaterThan(e){return this.valueOf()>new G(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new G(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new G(e).valueOf()}remainder(e){return t$(this,e)}truncate(e){return new G(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(G.DAY),r=this.truncate(G.HOUR),i=this.truncate(G.MINUTE),n=this.truncate(G.SECOND),s=this.truncate(G.MILLISECOND),a=this.truncate(G.MICROSECOND),o=this.truncate(G.NANOSECOND),u=e,c=r.sub(e),l=i.sub(r),d=n.sub(i),g=s.sub(n),p=a.sub(s),_=o.sub(a);let k="";return u.isZero||(k+=`${u.days}d `),c.isZero||(k+=`${c.hours}h `),l.isZero||(k+=`${l.minutes}m `),d.isZero||(k+=`${d.seconds}s `),g.isZero||(k+=`${g.milliseconds}ms `),p.isZero||(k+=`${p.microseconds}µs `),_.isZero||(k+=`${_.nanoseconds}ns`),k.trim()}mult(e){return new G(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(G.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(G.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(G.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(G.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(G.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(G.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new G(e).valueOf()}add(e){return new G(this.valueOf()+new G(e).valueOf())}sub(e){return new G(this.valueOf()-new G(e).valueOf())}static nanoseconds(e=1){return new G(e)}static microseconds(e=1){return G.nanoseconds(Ln(e,1e3))}static milliseconds(e=1){return G.microseconds(Ln(e,1e3))}static seconds(e=1){return G.milliseconds(Ln(e,1e3))}static minutes(e=1){return G.seconds(Ln(e,60))}static hours(e){return G.minutes(Ln(e,60))}static days(e){return G.hours(Ln(e,24))}};z(de,"NANOSECOND",de.nanoseconds(1)),z(de,"MICROSECOND",de.microseconds(1)),z(de,"MILLISECOND",de.milliseconds(1)),z(de,"SECOND",de.seconds(1)),z(de,"MINUTE",de.minutes(1)),z(de,"HOUR",de.hours(1)),z(de,"DAY",de.days(1)),z(de,"MAX",new de((1n<<63n)-1n)),z(de,"MIN",new de(0)),z(de,"ZERO",new de(0)),z(de,"z",ze([re({value:gn()}).transform(t=>new de(t.value)),Ne().transform(t=>new de(BigInt(t))),ge(Number).transform(t=>new de(t)),H().transform(t=>new de(t)),ge(de)]));let M=de;const Mr=class vs extends br{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new vs(e).valueOf()}get period(){return M.seconds(1/this.valueOf())}sampleCount(e){return new M(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new ot(r).valueOf()}span(e){return M.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new vs(e)}static khz(e){return vs.hz(e*1e3)}};z(Mr,"z",ze([H().transform(t=>new Mr(t)),ge(Number).transform(t=>new Mr(t)),ge(Mr)]));let Ao=Mr;const He=class extends br{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new lr(e*this.valueOf())}};z(He,"UNKNOWN",new He(0)),z(He,"BIT128",new He(16)),z(He,"BIT64",new He(8)),z(He,"BIT32",new He(4)),z(He,"BIT16",new He(2)),z(He,"BIT8",new He(1)),z(He,"z",ze([H().transform(t=>new He(t)),ge(Number).transform(t=>new He(t)),ge(He)]));let ot=He;const Nt=class Br{constructor(e,r){z(this,"start"),z(this,"end"),typeof e=="object"&&"start"in e?(this.start=new W(e.start),this.end=new W(e.end)):(this.start=new W(e),this.end=new W(r))}get span(){return new M(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new Br(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,r=M.ZERO){if(r.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let i=this.start.sub(e.start).valueOf(),n=this.end.sub(e.end).valueOf();return i<0&&(i=-i),n<0&&(n=-n),i<=r.valueOf()&&n<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=M.ZERO){e=e.makeValid();const i=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(i.start)||i.end.equals(e.start))return!1;const n=W.max(i.start,e.start),s=W.min(i.end,e.end);return s.before(n)?!1:new M(s.sub(n)).greaterThanOrEqual(r)}contains(e){return e instanceof Br?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new Br(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}static max(...e){return new Br(W.min(...e.map(r=>r.start)),W.max(...e.map(r=>r.end)))}};z(Nt,"MAX",new Nt(W.MIN,W.MAX)),z(Nt,"MIN",new Nt(W.MAX,W.MIN)),z(Nt,"ZERO",new Nt(W.ZERO,W.ZERO)),z(Nt,"z",ze([re({start:W.z,end:W.z}).transform(t=>new Nt(t.start,t.end)),ge(Nt)]));let Ee=Nt;const gz=(t,e)=>t.start.before(e.start)?-1:t.start.after(e.start)?1:t.end.before(e.end)?-1:t.end.after(e.end)?1:0,x=class Ze extends br{constructor(e){if(e instanceof Ze||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const r=Ze.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r==null)throw new Error(`unable to find data type for ${e.toString()}`);super(r.valueOf())}}get Array(){const e=Ze.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(r=>this.equals(r))}toString(){return this.valueOf()}get isVariable(){return this.equals(Ze.JSON)||this.equals(Ze.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Ze.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Ze.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(Ze.UINT8)||this.equals(Ze.UINT16)||this.equals(Ze.UINT32)||this.equals(Ze.UINT64)}get isSignedInteger(){return this.equals(Ze.INT8)||this.equals(Ze.INT16)||this.equals(Ze.INT32)||this.equals(Ze.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(Ze.INT32)&&e.equals(Ze.FLOAT64)||this.equals(Ze.INT8)&&e.equals(Ze.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return Ze.BIG_INT_TYPES.some(e=>e.equals(this))}};z(x,"UNKNOWN",new x("unknown")),z(x,"FLOAT64",new x("float64")),z(x,"FLOAT32",new x("float32")),z(x,"INT64",new x("int64")),z(x,"INT32",new x("int32")),z(x,"INT16",new x("int16")),z(x,"INT8",new x("int8")),z(x,"UINT64",new x("uint64")),z(x,"UINT32",new x("uint32")),z(x,"UINT16",new x("uint16")),z(x,"UINT8",new x("uint8")),z(x,"BOOLEAN",x.UINT8),z(x,"TIMESTAMP",new x("timestamp")),z(x,"UUID",new x("uuid")),z(x,"STRING",new x("string")),z(x,"JSON",new x("json")),z(x,"ARRAY_CONSTRUCTORS",new Map([[x.UINT8.toString(),Uint8Array],[x.UINT16.toString(),Uint16Array],[x.UINT32.toString(),Uint32Array],[x.UINT64.toString(),BigUint64Array],[x.FLOAT32.toString(),Float32Array],[x.FLOAT64.toString(),Float64Array],[x.INT8.toString(),Int8Array],[x.INT16.toString(),Int16Array],[x.INT32.toString(),Int32Array],[x.INT64.toString(),BigInt64Array],[x.TIMESTAMP.toString(),BigInt64Array],[x.STRING.toString(),Uint8Array],[x.JSON.toString(),Uint8Array],[x.UUID.toString(),Uint8Array]])),z(x,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,x.UINT8],[Uint16Array.name,x.UINT16],[Uint32Array.name,x.UINT32],[BigUint64Array.name,x.UINT64],[Float32Array.name,x.FLOAT32],[Float64Array.name,x.FLOAT64],[Int8Array.name,x.INT8],[Int16Array.name,x.INT16],[Int32Array.name,x.INT32],[BigInt64Array.name,x.INT64]])),z(x,"DENSITIES",new Map([[x.UINT8.toString(),ot.BIT8],[x.UINT16.toString(),ot.BIT16],[x.UINT32.toString(),ot.BIT32],[x.UINT64.toString(),ot.BIT64],[x.FLOAT32.toString(),ot.BIT32],[x.FLOAT64.toString(),ot.BIT64],[x.INT8.toString(),ot.BIT8],[x.INT16.toString(),ot.BIT16],[x.INT32.toString(),ot.BIT32],[x.INT64.toString(),ot.BIT64],[x.TIMESTAMP.toString(),ot.BIT64],[x.STRING.toString(),ot.UNKNOWN],[x.JSON.toString(),ot.UNKNOWN],[x.UUID.toString(),ot.BIT128]])),z(x,"ALL",[x.UNKNOWN,x.FLOAT64,x.FLOAT32,x.INT64,x.INT32,x.INT16,x.INT8,x.UINT64,x.UINT32,x.UINT16,x.UINT8,x.TIMESTAMP,x.UUID,x.STRING,x.JSON]),z(x,"BIG_INT_TYPES",[x.INT64,x.UINT64,x.TIMESTAMP]),z(x,"z",ze([Ne().transform(t=>new x(t)),ge(x)]));let ae=x;const st=class Me extends br{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Me.bytes(this.valueOf()+e.valueOf())}sub(e){return Me.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Me(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Me.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Me.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Me.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Me.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Me.TERABYTE.valueOf()}toString(){const e=this.truncate(Me.TERABYTE),r=this.truncate(Me.GIGABYTE),i=this.truncate(Me.MEGABYTE),n=this.truncate(Me.KILOBYTE),s=this.truncate(Me.BYTE),a=e,o=r.sub(e),u=i.sub(r),c=n.sub(i),l=s.sub(n);let d="";return a.isZero||(d+=`${a.terabytes}TB `),o.isZero||(d+=`${o.gigabytes}GB `),u.isZero||(d+=`${u.megabytes}MB `),c.isZero||(d+=`${c.kilobytes}KB `),(!l.isZero||d==="")&&(d+=`${l.valueOf()}B`),d.trim()}static bytes(e=1){return new Me(e)}static kilobytes(e=1){return Me.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Me.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Me.megabytes(e.valueOf()*1e3)}static terabytes(e){return Me.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};z(st,"BYTE",new st(1)),z(st,"KILOBYTE",st.kilobytes(1)),z(st,"MEGABYTE",st.megabytes(1)),z(st,"GIGABYTE",st.gigabytes(1)),z(st,"TERABYTE",st.terabytes(1)),z(st,"ZERO",new st(0)),z(st,"z",ze([H().transform(t=>new st(t)),ge(st)]));let lr=st;ze([ge(Uint8Array),ge(Uint16Array),ge(Uint32Array),ge(BigUint64Array),ge(Float32Array),ge(Float64Array),ge(Int8Array),ge(Int16Array),ge(Int32Array),ge(BigInt64Array)]);const n$=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof W||t instanceof M||t instanceof Date},yz=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):gs(r,-i).valueOf(),gs=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),$z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function bz(t){return typeof t=="string"&&$z.test(t)}const Qe=[];for(let t=0;t<256;++t)Qe.push((t+256).toString(16).slice(1));function wz(t,e=0){return(Qe[t[e+0]]+Qe[t[e+1]]+Qe[t[e+2]]+Qe[t[e+3]]+"-"+Qe[t[e+4]]+Qe[t[e+5]]+"-"+Qe[t[e+6]]+Qe[t[e+7]]+"-"+Qe[t[e+8]]+Qe[t[e+9]]+"-"+Qe[t[e+10]]+Qe[t[e+11]]+Qe[t[e+12]]+Qe[t[e+13]]+Qe[t[e+14]]+Qe[t[e+15]]).toLowerCase()}function _z(t,e=0){const r=wz(t,e);if(!bz(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const kz=(t,e)=>_z(t,e),Yt=-1,Do={[Symbol.iterator]:()=>Do,next:()=>({done:!0,value:void 0})},Iz=Ne().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),Oz=ze([zi(),dy()]).transform(()=>new Uint8Array().buffer),Co=10,r$=(t,e)=>{if(t==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},i$="sy_x_telem_series",Fr=class Fn{constructor(e){z(this,"key"),z(this,"discriminator",i$),z(this,"dataType"),z(this,"sampleOffset"),z(this,"gl"),z(this,"_data"),z(this,"timeRange",Ee.ZERO),z(this,"alignment",0n),z(this,"cachedMin"),z(this,"cachedMax"),z(this,"writePos",Yt),z(this,"_refCount",0),z(this,"cachedLength"),z(this,"_cachedIndexes"),Sz(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=e$(),data:u}=e;if(s$(u)){const d=u;this.key=d.key,this.dataType=d.dataType,this.sampleOffset=d.sampleOffset,this.gl=d.gl,this._data=d._data,this.timeRange=d.timeRange,this.alignment=d.alignment,this.cachedMin=d.cachedMin,this.cachedMax=d.cachedMax,this.writePos=d.writePos,this._refCount=d._refCount,this.cachedLength=d.cachedLength;return}const c=n$(u),l=Array.isArray(u);if(r!=null)this.dataType=new ae(r);else{if(u instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(l||c){let d=u;if(!c){if(u.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");d=u[0]}if(typeof d=="string")this.dataType=ae.STRING;else if(typeof d=="number")this.dataType=ae.FLOAT64;else if(typeof d=="bigint")this.dataType=ae.INT64;else if(typeof d=="boolean")this.dataType=ae.BOOLEAN;else if(d instanceof W||d instanceof Date||d instanceof W)this.dataType=ae.TIMESTAMP;else if(typeof d=="object")this.dataType=ae.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new ae(u)}if(!l&&!c)this._data=u;else{let d=c?[u]:u;const g=d[0];(g instanceof W||g instanceof Date||g instanceof M)&&(d=d.map(p=>new W(p).valueOf())),this.dataType.equals(ae.STRING)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("zod"),Qi=r=>{const e=r.replace(/_[a-z]/g,t=>t[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},ys=r=>{const e=(t,n=Nr)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!or(t))return t;n=no(n);const a={},i=t;return"toJSON"in i&&typeof i.toJSON=="function"?e(i.toJSON(),n):(Object.keys(i).forEach(o=>{let c=i[o];const l=r(o);n.recursive&&(or(c)?Sn(c)||(c=e(c,n)):n.recursiveInArray&&zn(c)&&(c=[...c].map(h=>{let d=h;return or(h)?Sn(d)||(d=e(h,n)):zn(h)&&(d=e({key:h},n).key),d}))),a[l]=c}),a)};return e},gs=ys(Qi),eo=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),to=ys(eo),ro=[Number,String,Uint8Array],Nr={recursive:!0,recursiveInArray:!0},no=(r=Nr)=>(r.recursive==null?r=Nr:r.recursiveInArray??=!1,r),zn=r=>r!=null&&Array.isArray(r),or=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Sn=r=>ro.some(e=>r instanceof e);let so=class{contentType="application/json";decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(r){return this.encoder.encode(this.encodeString(r))}decode(r,e){return this.decodeString(this.decoder.decode(r),e)}decodeString(r,e){const t=JSON.parse(r),n=gs(t);return e!=null?e.parse(n):n}encodeString(r){const e=to(r);return JSON.stringify(e,(t,n)=>ArrayBuffer.isView(n)?Array.from(n):typeof n=="bigint"?n.toString():n)}};const zr=new so;let _e=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const ao=r=>r!=null&&typeof r=="object"&&"toString"in r,io=(r,e=!1)=>{const t=ao(r)?"stringer":typeof r;let n;switch(t){case"string":n=(a,i)=>a.localeCompare(i);break;case"stringer":n=(a,i)=>a.toString().localeCompare(i.toString());break;case"number":n=(a,i)=>Number(a)-Number(i);break;case"bigint":n=(a,i)=>BigInt(a)-BigInt(i)>0n?1:-1;break;case"boolean":n=(a,i)=>Number(a)-Number(i);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?oo(n):n},oo=r=>(e,t)=>r(t,e),Vt=s.z.tuple([s.z.number(),s.z.number()]);s.z.tuple([s.z.bigint(),s.z.bigint()]);const ps=s.z.object({width:s.z.number(),height:s.z.number()}),co=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()}),lo=["width","height"];s.z.enum(lo);const uo=["start","center","end"],ho=["signedWidth","signedHeight"];s.z.enum(ho);const Bt=s.z.object({x:s.z.number(),y:s.z.number()}),fo=s.z.object({clientX:s.z.number(),clientY:s.z.number()}),yo=["x","y"],ms=s.z.enum(yo),ws=["top","right","bottom","left"];s.z.enum(ws);const go=["left","right"],bs=s.z.enum(go),po=["top","bottom"],Ts=s.z.enum(po),vs=["center"],In=s.z.enum(vs),mo=[...ws,...vs],Es=s.z.enum(mo);s.z.enum(uo);const wo=["first","last"];s.z.enum(wo);const bo=s.z.object({lower:s.z.number(),upper:s.z.number()}),To=s.z.object({lower:s.z.bigint(),upper:s.z.bigint()});s.z.union([bo,Vt]);s.z.union([To,Vt]);s.z.enum([...ms.options,...Es.options]);s.z.union([ms,Es,s.z.instanceof(String)]);const xe=(r,e)=>typeof r=="bigint"?r*BigInt(e):r*Number(e),Ie=(r,e,t)=>{const n={};if(typeof e=="object"&&(t=e,e=void 0),t={makeValid:!0,...t},typeof r=="number"||typeof r=="bigint")e!=null?(n.lower=r,n.upper=e):(n.lower=typeof r=="bigint"?0n:0,n.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=r}else n.lower=r.lower,n.upper=r.upper;return t?.makeValid?vo(n):n},vo=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,An=(r,e)=>{const t=Ie(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e};s.z.object({x:bs.or(In),y:Ts.or(In)});const Eo=s.z.object({x:bs,y:Ts}),Oo=Object.freeze({x:"left",y:"top"}),No=(r,e)=>r.x===e.x&&r.y===e.y,$n=s.z.union([s.z.number(),Bt,Vt,ps,co,fo]),zo=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y}},kn=Object.freeze({x:0,y:0}),kt=s.z.union([s.z.number(),s.z.string()]);s.z.object({top:kt,left:kt,width:kt,height:kt});s.z.object({left:s.z.number(),top:s.z.number(),right:s.z.number(),bottom:s.z.number()});s.z.object({one:Bt,two:Bt,root:Eo});const _r=(r,e,t=0,n=0,a)=>{const i={one:{...kn},two:{...kn},root:a??Oo};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:r,y:e},i.two={x:i.one.x+t,y:i.one.y+n},i}return"one"in r&&"two"in r&&"root"in r?{...r,root:a??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(i.one={x:r.left,y:r.top},i.two={x:r.right,y:r.bottom},i):(i.one=r,e==null?i.two={x:i.one.x+t,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},cr=r=>{const e=_r(r);return{lower:e.one.x,upper:e.two.x}},lr=r=>{const e=_r(r);return{lower:e.one.y,upper:e.two.y}},So=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Io=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()});s.z.union([ps,Io,Bt,Vt]);const Ao=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;s.z.object({offset:$n,scale:$n});s.z.object({offset:s.z.number(),scale:s.z.number()});const $o=r=>(e,t,n,a)=>t==="dimension"?[e,n]:[e,a?n-r:n+r],ko=r=>(e,t,n,a)=>[e,a?n/r:n*r],Co=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:a,upper:i}=e,{lower:o,upper:c}=r,l=i-a,h=c-o;if(t==="dimension")return[r,n*(h/l)];const d=(n-a)*(h/l)+o;return[r,d]},xo=r=>(e,t,n)=>[r,n],Ro=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:a}=r;return[r,a-(t-n)]},jo=r=>(e,t,n)=>{const{lower:a,upper:i}=r;return n=Ao(n,a,i),[e,n]};let Cn=class je{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new je().translate(e)}static magnify(e){return new je().magnify(e)}static scale(e,t){return new je().scale(e,t)}translate(e){const t=this.new(),n=$o(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=ko(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=Ie(e,t),a=this.new(),i=Co(n);return i.type="scale",a.ops.push(i),a}clamp(e,t){const n=Ie(e,t),a=this.new(),i=jo(n);return i.type="clamp",a.ops.push(i),a}reBound(e,t){const n=Ie(e,t),a=this.new(),i=xo(n);return i.type="re-bound",a.ops.push(i),a}invert(){const e=Ro();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new je;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,a],i)=>i(n,e,a,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,a)=>{if(n.type==="scale"||t.some(([o,c])=>a>=o&&a<=c))return;const i=e.ops.findIndex((o,c)=>o.type==="scale"&&c>a);i!==-1&&t.push([a,i])}),t.forEach(([n,a])=>{const i=e.ops.slice(n,a);i.unshift(e.ops[a]),e.ops.splice(n,a-n+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new je};(class Q{x;y;currRoot;constructor(e=new Cn,t=new Cn,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Q().translate(e,t)}static translateX(e){return new Q().translateX(e)}static translateY(e){return new Q().translateY(e)}static clamp(e){return new Q().clamp(e)}static magnify(e){return new Q().magnify(e)}static scale(e){return new Q().scale(e)}static reBound(e){return new Q().reBound(e)}translate(e,t){const n=zo(e,t),a=this.copy();return a.x=this.x.translate(n.x),a.y=this.y.translate(n.y),a}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(So(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!No(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(cr(e)),t.y=t.y.scale(lr(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(cr(e)),t.y=this.y.reBound(lr(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(cr(e)),t.y=this.y.clamp(lr(e)),t}copy(){const e=new Q;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return _r(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new Q});let Uo=(r,e=21)=>(t=e)=>{let n="",a=t|0;for(;a--;)n+=r[Math.random()*r.length|0];return n};const Do="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Mo=11,Zo=Uo(Do,Mo),Po=()=>Zo(),Lo=(r,e)=>t=>t instanceof e||typeof t=="object"&&t!==null&&"discriminator"in t&&t.discriminator===r,Bo=s.z.enum(["static","dynamic"]),qo=s.z.union([s.z.tuple([s.z.int()]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12)]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12),s.z.int().min(1).max(31)])]),Os=(r,e)=>{const t=new $(e);if(![A.DAY,A.HOUR,A.MINUTE,A.SECOND,A.MILLISECOND,A.MICROSECOND,A.NANOSECOND].some(a=>a.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof $?new $(n):new A(n)};let $=class p extends _e{constructor(e,t="UTC"){if(e==null)super(p.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*p.MILLISECOND.valueOf());else if(typeof e=="string")super(p.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(p.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=p.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=p.MAX:e=p.MIN)),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,t=1,n=1]){const a=new Date(e,t-1,n,0,0,0,0);return new p(BigInt(a.getTime())*p.MILLISECOND.valueOf()).truncate(p.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,a,i]=e.split(":");let o="00",c="00";i!=null&&([o,c]=i.split("."));let l=p.hours(parseInt(n??"00")).add(p.minutes(parseInt(a??"00"))).add(p.seconds(parseInt(o??"00"))).add(p.milliseconds(parseInt(c??"00")));return t==="local"&&(l=l.add(p.utcOffset)),l.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return p.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new p(BigInt(n.getTime())*p.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(p.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new A(BigInt(new Date().getTimezoneOffset())*p.MINUTE.valueOf())}static since(e){return new p().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new p(e).valueOf()}span(e){return this.range(e).span}range(e){return new st(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new p(e).valueOf()}afterEq(e){return this.valueOf()>=new p(e).valueOf()}before(e){return this.valueOf()<new p(e).valueOf()}beforeEq(e){return this.valueOf()<=new p(e).valueOf()}add(e){return new p(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new p(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(A.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(A.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(A.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(A.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(p.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(p.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const t=this.date();return t.setUTCFullYear(e),new p(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new p(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new p(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new p(t,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new p(t)}get second(){return this.date().getUTCSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new p(t)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const t=this.date();return t.setUTCMilliseconds(e),new p(t)}toString(){return this.date().toISOString()}remainder(e){return Os(this,e)}get isToday(){return this.truncate(A.DAY).equals(p.now().truncate(A.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new p(new Date)}static max(...e){let t=p.MIN;for(const n of e){const a=new p(n);a.after(t)&&(t=a)}return t}static min(...e){let t=p.MAX;for(const n of e){const a=new p(n);a.before(t)&&(t=a)}return t}static nanoseconds(e,t="UTC"){return new p(e,t)}static NANOSECOND=p.nanoseconds(1);static microseconds(e,t="UTC"){return p.nanoseconds(e*1e3,t)}static MICROSECOND=p.microseconds(1);static milliseconds(e,t="UTC"){return p.microseconds(e*1e3,t)}static MILLISECOND=p.milliseconds(1);static seconds(e,t="UTC"){return p.milliseconds(e*1e3,t)}static SECOND=p.seconds(1);static minutes(e,t="UTC"){return p.seconds(e*60,t)}static MINUTE=p.minutes(1);static hours(e,t="UTC"){return p.minutes(e*60,t)}static HOUR=p.hours(1);static days(e,t="UTC"){return p.hours(e*24,t)}static DAY=p.days(1);static MAX=new p((1n<<63n)-1n);static MIN=new p(0);static ZERO=new p(0);static z=s.z.union([s.z.instanceof(p),s.z.object({value:s.z.bigint()}).transform(e=>new p(e.value)),s.z.string().transform(e=>new p(BigInt(e))),s.z.number().transform(e=>new p(e)),s.z.bigint().transform(e=>new p(e)),s.z.date().transform(e=>new p(e)),s.z.custom(e=>e instanceof A).transform(e=>new p(e)),qo.transform(e=>new p(e))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},A=class w extends _e{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof w?e:e instanceof xn?e.period:e instanceof $?new w(e):["number","bigint"].includes(typeof e)?w.seconds(e):new w(e)}static fromMilliseconds(e){return e instanceof w?e:e instanceof xn?e.period:e instanceof $?new w(e):["number","bigint"].includes(typeof e)?w.milliseconds(e):new w(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new w(e).valueOf()}greaterThan(e){return this.valueOf()>new w(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new w(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new w(e).valueOf()}remainder(e){return Os(this,e)}truncate(e){return new w(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(w.DAY),t=this.truncate(w.HOUR),n=this.truncate(w.MINUTE),a=this.truncate(w.SECOND),i=this.truncate(w.MILLISECOND),o=this.truncate(w.MICROSECOND),c=this.truncate(w.NANOSECOND),l=e,h=t.sub(e),d=n.sub(t),u=a.sub(n),N=i.sub(a),E=o.sub(i),P=c.sub(o);let k="";return l.isZero||(k+=`${l.days}d `),h.isZero||(k+=`${h.hours}h `),d.isZero||(k+=`${d.minutes}m `),u.isZero||(k+=`${u.seconds}s `),N.isZero||(k+=`${N.milliseconds}ms `),E.isZero||(k+=`${E.microseconds}µs `),P.isZero||(k+=`${P.nanoseconds}ns`),k.trim()}mult(e){return new w(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(w.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(w.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(w.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(w.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(w.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(w.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(e){return this.valueOf()===new w(e).valueOf()}add(e){return new w(this.valueOf()+new w(e).valueOf())}sub(e){return new w(this.valueOf()-new w(e).valueOf())}static nanoseconds(e=1){return new w(e)}static NANOSECOND=w.nanoseconds(1);static microseconds(e=1){return w.nanoseconds(xe(e,1e3))}static MICROSECOND=w.microseconds(1);static milliseconds(e=1){return w.microseconds(xe(e,1e3))}static MILLISECOND=w.milliseconds(1);static seconds(e=1){return w.milliseconds(xe(e,1e3))}static SECOND=w.seconds(1);static minutes(e=1){return w.seconds(xe(e,60))}static MINUTE=w.minutes(1);static hours(e){return w.minutes(xe(e,60))}static HOUR=w.hours(1);static days(e){return w.hours(xe(e,24))}static DAY=w.days(1);static MAX=new w((1n<<63n)-1n);static MIN=new w(0);static ZERO=new w(0);static z=s.z.union([s.z.object({value:s.z.bigint()}).transform(e=>new w(e.value)),s.z.string().transform(e=>new w(BigInt(e))),s.z.number().transform(e=>new w(e)),s.z.instanceof(w)])},xn=class Ue extends _e{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ue(e).valueOf()}get period(){return A.seconds(1/this.valueOf())}sampleCount(e){return new A(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new H(t).valueOf()}span(e){return A.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ue(e)}static khz(e){return Ue.hz(e*1e3)}static z=s.z.union([s.z.number().transform(e=>new Ue(e)),s.z.instanceof(Ue)])},H=class ie extends _e{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new Sr(e*this.valueOf())}static UNKNOWN=new ie(0);static BIT128=new ie(16);static BIT64=new ie(8);static BIT32=new ie(4);static BIT16=new ie(2);static BIT8=new ie(1);static z=s.z.union([s.z.number().transform(e=>new ie(e)),s.z.instanceof(ie)])},st=class ee{start;end;constructor(e,t){typeof e=="object"&&"start"in e?(this.start=new $(e.start),this.end=new $(e.end)):(this.start=new $(e),this.end=new $(t))}get span(){return new A(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new ee(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=A.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),a=this.end.sub(e.end).valueOf();return n<0&&(n=-n),a<0&&(a=-a),n<=t.valueOf()&&a<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=A.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const a=$.max(n.start,e.start),i=$.min(n.end,e.end);return i.before(a)?!1:new A(i.sub(a)).greaterThanOrEqual(t)}contains(e){return e instanceof ee?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new ee(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}static max(...e){return new ee($.min(...e.map(t=>t.start)),$.max(...e.map(t=>t.end)))}static MAX=new ee($.MIN,$.MAX);static MIN=new ee($.MAX,$.MIN);static ZERO=new ee($.ZERO,$.ZERO);static z=s.z.union([s.z.object({start:$.z,end:$.z}).transform(e=>new ee(e.start,e.end)),s.z.instanceof(ee)]);static sort(e,t){return $.sort(e.start,t.start)||$.sort(e.end,t.end)}},j=class f extends _e{constructor(e){if(e instanceof f||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const t=f.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t==null)throw new Error(`unable to find data type for ${e.toString()}`);super(t.valueOf())}}get Array(){const e=f.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(f.JSON)||this.equals(f.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(f.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=f.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(f.UINT8)||this.equals(f.UINT16)||this.equals(f.UINT32)||this.equals(f.UINT64)}get isSignedInteger(){return this.equals(f.INT8)||this.equals(f.INT16)||this.equals(f.INT32)||this.equals(f.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(f.INT32)&&e.equals(f.FLOAT64)||this.equals(f.INT8)&&e.equals(f.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return f.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new f("unknown");static FLOAT64=new f("float64");static FLOAT32=new f("float32");static INT64=new f("int64");static INT32=new f("int32");static INT16=new f("int16");static INT8=new f("int8");static UINT64=new f("uint64");static UINT32=new f("uint32");static UINT16=new f("uint16");static UINT8=new f("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new f("timestamp");static UUID=new f("uuid");static STRING=new f("string");static JSON=new f("json");static ARRAY_CONSTRUCTORS=new Map([[f.UINT8.toString(),Uint8Array],[f.UINT16.toString(),Uint16Array],[f.UINT32.toString(),Uint32Array],[f.UINT64.toString(),BigUint64Array],[f.FLOAT32.toString(),Float32Array],[f.FLOAT64.toString(),Float64Array],[f.INT8.toString(),Int8Array],[f.INT16.toString(),Int16Array],[f.INT32.toString(),Int32Array],[f.INT64.toString(),BigInt64Array],[f.TIMESTAMP.toString(),BigInt64Array],[f.STRING.toString(),Uint8Array],[f.JSON.toString(),Uint8Array],[f.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,f.UINT8],[Uint16Array.name,f.UINT16],[Uint32Array.name,f.UINT32],[BigUint64Array.name,f.UINT64],[Float32Array.name,f.FLOAT32],[Float64Array.name,f.FLOAT64],[Int8Array.name,f.INT8],[Int16Array.name,f.INT16],[Int32Array.name,f.INT32],[BigInt64Array.name,f.INT64]]);static DENSITIES=new Map([[f.UINT8.toString(),H.BIT8],[f.UINT16.toString(),H.BIT16],[f.UINT32.toString(),H.BIT32],[f.UINT64.toString(),H.BIT64],[f.FLOAT32.toString(),H.BIT32],[f.FLOAT64.toString(),H.BIT64],[f.INT8.toString(),H.BIT8],[f.INT16.toString(),H.BIT16],[f.INT32.toString(),H.BIT32],[f.INT64.toString(),H.BIT64],[f.TIMESTAMP.toString(),H.BIT64],[f.STRING.toString(),H.UNKNOWN],[f.JSON.toString(),H.UNKNOWN],[f.UUID.toString(),H.BIT128]]);static ALL=[f.UNKNOWN,f.FLOAT64,f.FLOAT32,f.INT64,f.INT32,f.INT16,f.INT8,f.UINT64,f.UINT32,f.UINT16,f.UINT8,f.TIMESTAMP,f.UUID,f.STRING,f.JSON];static BIG_INT_TYPES=[f.INT64,f.UINT64,f.TIMESTAMP];static z=s.z.union([s.z.string().transform(e=>new f(e)),s.z.instanceof(f)])},Sr=class x extends _e{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return x.bytes(this.valueOf()+e.valueOf())}sub(e){return x.bytes(this.valueOf()-e.valueOf())}truncate(e){return new x(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return x.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/x.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/x.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/x.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/x.TERABYTE.valueOf()}toString(){const e=this.truncate(x.TERABYTE),t=this.truncate(x.GIGABYTE),n=this.truncate(x.MEGABYTE),a=this.truncate(x.KILOBYTE),i=this.truncate(x.BYTE),o=e,c=t.sub(e),l=n.sub(t),h=a.sub(n),d=i.sub(a);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),l.isZero||(u+=`${l.megabytes}MB `),h.isZero||(u+=`${h.kilobytes}KB `),(!d.isZero||u==="")&&(u+=`${d.valueOf()}B`),u.trim()}static bytes(e=1){return new x(e)}static BYTE=new x(1);static kilobytes(e=1){return x.bytes(e.valueOf()*1e3)}static KILOBYTE=x.kilobytes(1);static megabytes(e=1){return x.kilobytes(e.valueOf()*1e3)}static MEGABYTE=x.megabytes(1);static gigabytes(e=1){return x.megabytes(e.valueOf()*1e3)}static GIGABYTE=x.gigabytes(1);static terabytes(e){return x.gigabytes(e.valueOf()*1e3)}static TERABYTE=x.terabytes(1);static ZERO=new x(0);static z=s.z.union([s.z.number().transform(e=>new x(e)),s.z.instanceof(x)]);get isZero(){return this.valueOf()===0}};s.z.union([s.z.instanceof(Uint8Array),s.z.instanceof(Uint16Array),s.z.instanceof(Uint32Array),s.z.instanceof(BigUint64Array),s.z.instanceof(Float32Array),s.z.instanceof(Float64Array),s.z.instanceof(Int8Array),s.z.instanceof(Int16Array),s.z.instanceof(Int32Array),s.z.instanceof(BigInt64Array)]);const Ns=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof $||r instanceof A||r instanceof Date},Fo=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):Ut(t,-n),Ut=(r,e)=>e==0?r:r==0?e:typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),Yo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Vo(r){return typeof r=="string"&&Yo.test(r)}const q=[];for(let r=0;r<256;++r)q.push((r+256).toString(16).slice(1));function Wo(r,e=0){return(q[r[e+0]]+q[r[e+1]]+q[r[e+2]]+q[r[e+3]]+"-"+q[r[e+4]]+q[r[e+5]]+"-"+q[r[e+6]]+q[r[e+7]]+"-"+q[r[e+8]]+q[r[e+9]]+"-"+q[r[e+10]]+q[r[e+11]]+q[r[e+12]]+q[r[e+13]]+q[r[e+14]]+q[r[e+15]]).toLowerCase()}function _o(r,e=0){const t=Wo(r,e);if(!Vo(t))throw TypeError("Stringified UUID is invalid");return t}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const zs=(r,e)=>_o(r,e),ye=-1,Ho=s.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),Go=s.z.union([s.z.null(),s.z.undefined()]).transform(()=>new Uint8Array().buffer),Ir=10,Jo=(r,e)=>{if(r==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(r==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},Ss="sy_x_telem_series";let Is=class we{key;discriminator=Ss;dataType;sampleOffset;gl;_data;timeRange=st.ZERO;alignment=0n;cachedMin;cachedMax;writePos=ye;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=s.z.object({timeRange:st.z.optional(),dataType:j.z,alignment:s.z.coerce.bigint().optional(),data:s.z.union([Ho,Go,s.z.instanceof(ArrayBuffer),s.z.instanceof(Uint8Array)]),glBufferUsage:Bo.optional().default("static").optional()});static z=we.crudeZ.transform(e=>new we(e));constructor(e){Ko(e)&&(e={data:e}),e.data??=[];const{dataType:t,timeRange:n,sampleOffset:a=0,glBufferUsage:i="static",alignment:o=0n,key:c=Po(),data:l}=e;if(Xo(l)){const u=l;this.key=u.key,this.dataType=u.dataType,this.sampleOffset=u.sampleOffset,this.gl=u.gl,this._data=u._data,this.timeRange=u.timeRange,this.alignment=u.alignment,this.cachedMin=u.cachedMin,this.cachedMax=u.cachedMax,this.writePos=u.writePos,this._refCount=u._refCount,this.cachedLength=u.cachedLength;return}const h=Ns(l),d=Array.isArray(l);if(t!=null)this.dataType=new j(t);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(d||h){let u=l;if(!h){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");u=l[0]}if(typeof u=="string")this.dataType=j.STRING;else if(typeof u=="number")this.dataType=j.FLOAT64;else if(typeof u=="bigint")this.dataType=j.INT64;else if(typeof u=="boolean")this.dataType=j.BOOLEAN;else if(u instanceof $||u instanceof Date||u instanceof $)this.dataType=j.TIMESTAMP;else if(typeof u=="object")this.dataType=j.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new j(l)}if(!d&&!h)this._data=l;else if(d&&l.length===0)this._data=new this.dataType.Array([]).buffer;else{let u=h?[l]:l;const N=u[0];(N instanceof $||N instanceof Date||N instanceof A)&&(u=u.map(E=>new $(E).valueOf())),this.dataType.equals(j.STRING)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
30
2
  `)}
31
- `).buffer):this.dataType.equals(ae.JSON)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(p=>ii.encodeString(p)).join(`
3
+ `).buffer):this.dataType.equals(j.JSON)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(E=>zr.encodeString(E)).join(`
32
4
  `)}
33
- `).buffer):this.dataType.usesBigInt&&typeof g=="number"?this._data=new this.dataType.Array(d.map(p=>BigInt(Math.round(p)))).buffer:!this.dataType.usesBigInt&&typeof g=="bigint"?this._data=new this.dataType.Array(d.map(p=>Number(p))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=o,this.alignment=a,this.sampleOffset=n??0,this.timeRange=i??Ee.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:r,...i}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const n=new new ae(r).Array(e),s=new Fn({data:n.buffer,dataType:r,...i});return s.writePos=0,s}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===Yt)return 0;const r=this.byteCapacity.valueOf()-this.writePos,i=e.subBytes(0,r);return this.writeToUnderlyingData(i),this.writePos+=i.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=i.length,this.calculateCachedLength()),i.length}writeFixed(e){if(this.writePos===Yt)return 0;const r=this.capacity-this.writePos,i=e.sub(0,r);return this.writeToUnderlyingData(i),this.cachedLength=void 0,this.maybeRecomputeMinMax(i),this.writePos+=i.length,i.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Yt?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
34
- `).slice(0,-1):Array.from(this).map(e=>e.toString())}toUUIDs(){if(!this.dataType.equals(ae.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=ae.UUID.density.valueOf(),r=new Uint8Array(this.underlyingData.buffer);return Array.from({length:this.length},(i,n)=>kz(r,n*e))}parseJSON(e){if(!this.dataType.equals(ae.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(r=>e.parse(ii.decodeString(r)))}get byteCapacity(){return new lr(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Yt?this.byteCapacity:this.dataType.isVariable?new lr(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Yt?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const r=[0];return this.data.forEach((i,n)=>{i===Co&&(e++,r.push(n+1))}),this._cachedIndexes=r,this.cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const i=new e.Array(this.length);for(let n=0;n<this.length;n++)i[n]=yz(this.dataType,e,this.data[n],r);return new Fn({data:i.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(ae.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}else{const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??(this.cachedMax=this.calcRawMax()),gs(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(ae.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}else{const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??(this.cachedMin=this.calcRawMin()),gs(this.cachedMin,this.sampleOffset))}get bounds(){return nt(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const r=e.cachedMin??e.calcRawMin();r<this.cachedMin&&(this.cachedMin=r)}if(this.cachedMax!=null){const r=e.cachedMax??e.calcRawMax();r>this.cachedMax&&(this.cachedMax=r)}}atAlignment(e,r){const i=Number(e-this.alignment);if(i<0||i>=this.length){if(r===!0)throw new Error(`[series] - no value at index ${i}`);return}return this.at(i,r)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const i=this.data[e];if(i==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return gs(i,this.sampleOffset)}atVariable(e,r){let i=0,n=0;if(this._cachedIndexes!=null)i=this._cachedIndexes[e],n=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Co){if(e===0){n=a;break}i=a+1,e--}if(n===0&&(n=this.data.length),i>=n||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(i,n);return this.dataType.equals(ae.STRING)?new TextDecoder().decode(s):Rh(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=ZS(e);for(;r<=i;){const s=Math.floor((r+i)/2),a=n(this.at(s,!0),e);if(a===0)return s;a<0?r=s+1:i=s-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(ae.FLOAT32)&&!this.dataType.equals(ae.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:r,bufferUsage:i,prevBuffer:n}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==n)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Yt){n===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(n).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,i==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Yt}as(e){return r$(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:cf(this.alignmentBounds.lower),upper:cf(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return nt(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new Nz(this);return this.dataType.equals(ae.JSON)?new Tz(e):e}return new zz(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new uf(this,e,r??this.length)}subAlignmentIterator(e,r){return new uf(this,Number(e-this.alignment),Number(r-this.alignment))}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const i=this.data.subarray(e,r);return new Fn({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,i){if(r<=0&&(i==null||i>=this.length))return this;let n;return e?n=this.data.subarray(r,i):n=this.data.slice(r,i),new Fn({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new Fn({data:this.buffer,dataType:this.dataType,timeRange:Ee.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,r;let i=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)i+=Array.from(this).map(n=>n.toString());else{for(let n=0;n<5;n++)i+=`${(e=this.at(n))==null?void 0:e.toString()}`,i+=",";i+="...,";for(let n=-5;n<0;n++)i+=(r=this.at(n))==null?void 0:r.toString(),n<-1&&(i+=",")}return i+="])",i}};z(Fr,"crudeZ",re({timeRange:Ee.z.optional(),dataType:ae.z,alignment:Qy().optional(),data:ze([Iz,Oz,ge(ArrayBuffer),ge(Uint8Array)]),glBufferUsage:vz.optional().default("static").optional()})),z(Fr,"z",Fr.crudeZ.transform(t=>new Fr(t)));let Ft=Fr;const Sz=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Ft?!0:n$(t),s$=pz(i$,Ft);let uf=class{constructor(e,r,i){z(this,"series"),z(this,"end"),z(this,"index"),this.series=e;const n=nt(0,e.length);this.end=nf(n,i),this.index=nf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Nz=class{constructor(e){if(z(this,"series"),z(this,"index"),z(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==Co;)this.index++;const i=this.index;return e===i?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,i))})}};const a$=class o${constructor(e){z(this,"wrapped"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:ii.decodeString(e.value,o$.schema)}}};z(a$,"schema",fa(Ne(),cr()));let Tz=a$,zz=class{constructor(e){z(this,"series"),z(this,"index"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}};class u${constructor(e=[]){if(z(this,"series"),e.length!==0){const r=e[0].dataType;for(let i=1;i<e.length;i++)if(!e[i].dataType.equals(r))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){return r$(e,this.dataType),this}get dataType(){return this.series.length===0?ae.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?Ee.ZERO:new Ee(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?nt(0n,0n):nt(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){const r=()=>new Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),i=e.dataType.equals(this.dataType);if(s$(e)){if(this.series.length!==0&&!i)throw r();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!i)throw r();this.series.push(...e.series)}}get length(){return this.series.reduce((e,r)=>e+r.length,0)}atAlignment(e,r){for(const i of this.series)if(Qi(i.alignmentBounds,e))return i.atAlignment(e,r);if(r)throw new Error(`[series] - no value at alignment ${e}`)}at(e,r=!1){e<0&&(e=this.length+e);for(const i of this.series){if(e<i.length)return i.at(e,r);e-=i.length}if(r)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,r){return new co(this,e,r??this.length)}subAlignmentIterator(e,r){if(e>=this.alignmentBounds.upper||r<=this.alignmentBounds.lower)return Do;let i=0;for(let s=0;s<this.series.length;s++){const a=this.series[s];if(e<a.alignment)break;if(e>=a.alignmentBounds.upper)i+=a.length;else if(Qi(a.alignmentBounds,e)){i+=Number(e-a.alignment);break}}let n=0;for(let s=0;s<this.series.length;s++){const a=this.series[s];if(r<a.alignment)break;if(r>=a.alignmentBounds.upper)n+=a.length;else if(Qi(a.alignmentBounds,r)){n+=Number(r-a.alignment);break}}return new co(this,i,n)}subAlignmentSpanIterator(e,r){if(e>=this.alignmentBounds.upper)return Do;r=Math.min(r,Number(this.distance(e,this.alignmentBounds.upper)));let i=0;for(let n=0;n<this.series.length;n++){const s=this.series[n];if(e<s.alignment)break;if(e>=s.alignmentBounds.upper)i+=s.length;else if(Qi(s.alignmentBounds,e)){i+=Number(e-s.alignment);break}}return new co(this,i,i+r)}updateGLBuffer(e){this.series.forEach(r=>r.updateGLBuffer(e))}get bounds(){return LT(this.series.map(e=>e.bounds))}get byteLength(){return new lr(this.series.reduce((e,r)=>e+r.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let r=0;for(const i of this.series)e.set(i.data,r),r+=i.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,r){const i=this.series.map(n=>n.alignmentBounds);return MT(i,e,r)}acquire(e){this.series.forEach(r=>r.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,r){const i=this.series.map(n=>n.alignmentBounds);return BT(i,e,r)}parseJSON(e){if(!this.dataType.equals(ae.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(r=>r.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new xz(this.series)}}let xz=class{constructor(e){z(this,"series"),z(this,"seriesIndex"),z(this,"internal"),this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}},co=class{constructor(e,r,i){z(this,"series"),z(this,"index"),z(this,"end"),this.series=e,this.end=i,this.index=r}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};const cf=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}},Ez=(t,e)=>{let r=null;return e===0?t:(...i)=>{r!==null&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...i),e)}},Uz=(t,e,r=".")=>{const i=t.split(r);return i.map((n,s)=>{const a=e(n,s,i);return a==null?null:typeof a=="string"?a:a.join(r)}).filter(n=>n!=null).join(r)},Zz=(t,e,r={optional:!1,separator:"."})=>{r.separator??(r.separator=".");const{optional:i,getter:n=(o,u)=>o[u]}=r,s=e.split(r.separator);if(s.length===1&&s[0]==="")return t;let a=t;for(const o of s){const u=n(a,o);if(u==null){if(i)return null;throw new Error(`Path ${e} does not exist. ${o} is null`)}a=u}return a};re({key:Ne(),value:Ne()});var Pz=Object.defineProperty,jz=(t,e,r)=>e in t?Pz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ys=(t,e,r)=>jz(t,typeof e!="symbol"?e+"":e,r);let Az=class{constructor(e,r){ys(this,"handlers"),ys(this,"transform"),ys(this,"closer"),this.transform=e,this.handlers=r??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let r=e;if(this.transform!=null){const[i,n]=this.transform(e);if(!n)return;r=i}this.handlers.forEach((i,n)=>n(r))}setCloser(e){this.closer=e}async close(){var e;return await((e=this.closer)==null?void 0:e.call(this))}},Dz=class{constructor(e){ys(this,"handlers"),this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((r,i)=>i(e))}};const yn=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:Dz,Observer:Az},Symbol.toStringTag,{value:"Module"})),$t=fa(ze([H(),Ne(),cy()]),cr()),Cz=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Cz();const Rz=["macOS","Windows","Linux"],Lz=["macos","windows","linux"],Mz={macos:"macOS",windows:"Windows",linux:"Linux"};Ye(Rz).or(Ye(Lz).transform(t=>Mz[t]));var Bz=Object.defineProperty,Fz=(t,e,r)=>e in t?Bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e,r)=>Fz(t,typeof e!="symbol"?e+"":e,r);const qz=(...t)=>t.map(c$).join(""),c$=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),Jz=t=>t.endsWith("/")?t.slice(0,-1):t,Ro=class Lo{constructor({host:e,port:r,protocol:i="",pathPrefix:n=""}){qr(this,"protocol"),qr(this,"host"),qr(this,"port"),qr(this,"path"),this.protocol=i,this.host=e,this.port=r,this.path=c$(n)}replace(e){return new Lo({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Lo({...this,pathPrefix:qz(this.path,e)})}toString(){return Jz(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};qr(Ro,"UNKNOWN",new Ro({host:"unknown",port:0}));let Vz=Ro;const Wz=t=>t.nullable().transform(e=>e===null?void 0:e).optional(),l$=t=>Uz(t,(e,r,i)=>{const n=r===i.length-1,s=!isNaN(parseInt(e)),a=!isNaN(parseInt(i[r+1]));return s&&(e="element"),n||a?e:[e,"shape"]}),lf=(t,e)=>{if(t==null)return null;const r=t[e];return r==null&&typeof t=="object"&&"sourceType"in t?t.sourceType()[e]:r},Gz=(t,e,r)=>Zz(lf(t,"shape"),l$(e),{...r,getter:lf}),d$=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:Gz,getFieldSchemaPath:l$,nullToUndefined:Wz},Symbol.toStringTag,{value:"Module"}));var Yz=Object.defineProperty,Kz=(t,e,r)=>e in t?Yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xt=(t,e,r)=>Kz(t,typeof e!="symbol"?e+"":e,r);const Xz=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${K(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:s.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${s.suffix}"`:s.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${s.includes}"`:s.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${s.pattern}`:`${i[s.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${P(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function Hz(){return{localeError:Xz()}}const Qz=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${K(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Yanlış mətn: "${s.prefix}" ilə başlamalıdır`:s.format==="ends_with"?`Yanlış mətn: "${s.suffix}" ilə bitməlidir`:s.format==="includes"?`Yanlış mətn: "${s.includes}" daxil olmalıdır`:s.format==="regex"?`Yanlış mətn: ${s.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[s.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function ex(){return{localeError:Qz()}}function df(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const tx=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${K(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=df(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${s}${n.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=df(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${s}${n.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${s.prefix}"`:s.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${s.suffix}"`:s.format==="includes"?`Няправільны радок: павінен змяшчаць "${s.includes}"`:s.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${s.pattern}`:`Няправільны ${i[s.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${P(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function nx(){return{localeError:tx()}}const rx=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${K(n.values[0])}`:`Opció invàlida: s'esperava una de ${P(n.values," o ")}`;case"too_big":{const s=n.inclusive?"com a màxim":"menys de",a=e(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${s} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"com a mínim":"més de",a=e(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${s} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Format invàlid: ha de començar amb "${s.prefix}"`:s.format==="ends_with"?`Format invàlid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format invàlid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${s.pattern}`:`Format invàlid per a ${i[s.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function ix(){return{localeError:rx()}}const sx=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${K(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${s}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${s}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neplatný řetězec: musí začínat na "${s.prefix}"`:s.format==="ends_with"?`Neplatný řetězec: musí končit na "${s.suffix}"`:s.format==="includes"?`Neplatný řetězec: musí obsahovat "${s.includes}"`:s.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${s.pattern}`:`Neplatný formát ${i[s.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${P(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function ax(){return{localeError:sx()}}const ox=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${K(n.values[0])}`:`Ungültige Option: erwartet eine von ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ist`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ist`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ungültiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ungültiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ungültiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ungültiger String: muss dem Muster ${s.pattern} entsprechen`:`Ungültig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function ux(){return{localeError:ox()}}const cx=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},lx=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${cx(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${K(i.values[0])}`:`Invalid option: expected one of ${P(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${n}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Too small: expected ${i.origin} to have ${n}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${P(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function m$(){return{localeError:lx()}}const dx=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: se esperaba ${K(n.values[0])}`:`Opción inválida: se esperaba una de ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${s}${n.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${n.origin} fuera ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function mx(){return{localeError:dx()}}const fx=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: می‌بایست ${K(n.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${P(n.values,"|")} می‌بود`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} باشد`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} باشد`}case"invalid_format":{const s=n;return s.format==="starts_with"?`رشته نامعتبر: باید با "${s.prefix}" شروع شود`:s.format==="ends_with"?`رشته نامعتبر: باید با "${s.suffix}" تمام شود`:s.format==="includes"?`رشته نامعتبر: باید شامل "${s.includes}" باشد`:s.format==="regex"?`رشته نامعتبر: باید با الگوی ${s.pattern} مطابقت داشته باشد`:`${i[s.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${P(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function hx(){return{localeError:fx()}}const px=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${K(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${s}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${s}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen syöte: täytyy sisältää "${s.includes}"`:s.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${s.pattern}`:`Virheellinen ${i[s.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${P(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function vx(){return{localeError:px()}}const gx=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${K(n.values[0])} attendu`:`Option invalide : une valeur parmi ${P(n.values,"|")} attendue`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function yx(){return{localeError:gx()}}const $x=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${K(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"≤":"<",a=e(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${s}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"≥":">",a=e(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au motif ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function bx(){return{localeError:$x()}}const wx=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return n=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":return n.values.length===1?`קלט לא תקין: צריך ${K(n.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()} ${a.unit}`:`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${s.prefix}"`:s.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${s.suffix}"`:s.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${s.includes}"`:s.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${s.pattern}`:`${i[s.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${P(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function _x(){return{localeError:wx()}}const kx=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${K(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${s}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${s}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Érvénytelen string: "${s.prefix}" értékkel kell kezdődnie`:s.format==="ends_with"?`Érvénytelen string: "${s.suffix}" értékkel kell végződnie`:s.format==="includes"?`Érvénytelen string: "${s.includes}" értéket kell tartalmaznia`:s.format==="regex"?`Érvénytelen string: ${s.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[s.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function Ix(){return{localeError:kx()}}const Ox=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${K(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${i[s.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function Sx(){return{localeError:Ox()}}const Nx=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${K(n.values[0])}`:`Opzione non valida: atteso uno tra ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${s}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${s}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${P(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function Tx(){return{localeError:Nx()}}const zx=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${K(n.values[0])}が期待されました`:`無効な選択: ${P(n.values,"、")}のいずれかである必要があります`;case"too_big":{const s=n.inclusive?"以下である":"より小さい",a=e(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${s}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s}必要があります`}case"too_small":{const s=n.inclusive?"以上である":"より大きい",a=e(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${s}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s}必要があります`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無効な文字列: "${s.prefix}"で始まる必要があります`:s.format==="ends_with"?`無効な文字列: "${s.suffix}"で終わる必要があります`:s.format==="includes"?`無効な文字列: "${s.includes}"を含む必要があります`:s.format==="regex"?`無効な文字列: パターン${s.pattern}に一致する必要があります`:`無効な${i[s.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${P(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function xx(){return{localeError:zx()}}const Ex=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${K(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${s.prefix}"`:s.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${s.suffix}"`:s.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${s.includes}"`:s.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${s.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[s.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${P(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Ux(){return{localeError:Ex()}}const Zx=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${K(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${P(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const s=n.inclusive?"이하":"미만",a=s==="미만"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${s}${a}`}case"too_small":{const s=n.inclusive?"이상":"초과",a=s==="이상"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${s}${a}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`잘못된 문자열: "${s.prefix}"(으)로 시작해야 합니다`:s.format==="ends_with"?`잘못된 문자열: "${s.suffix}"(으)로 끝나야 합니다`:s.format==="includes"?`잘못된 문자열: "${s.includes}"을(를) 포함해야 합니다`:s.format==="regex"?`잘못된 문자열: 정규식 ${s.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[s.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${P(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function Px(){return{localeError:Zx()}}const jx=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${K(n.values[0])}`:`Грешана опција: се очекува една ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${s}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${s}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неважечка низа: мора да започнува со "${s.prefix}"`:s.format==="ends_with"?`Неважечка низа: мора да завршува со "${s.suffix}"`:s.format==="includes"?`Неважечка низа: мора да вклучува "${s.includes}"`:s.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${P(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function Ax(){return{localeError:jx()}}const Dx=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${K(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${i[s.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Cx(){return{localeError:Dx()}}const Rx=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${K(n.values[0])}`:`Ongeldige optie: verwacht één van ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} is`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} is`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Lx(){return{localeError:Rx()}}const Mx=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${K(n.values[0])}`:`Ugyldig valg: forventet en av ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ugyldig streng: må starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: må ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: må inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: må matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Bx(){return{localeError:Mx()}}const Fx=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${K(n.values[0])}`:`Fâsit tercih: mûteberler ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} olmalıydı.`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Fâsit metin: "${s.prefix}" ile başlamalı.`:s.format==="ends_with"?`Fâsit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`Fâsit metin: "${s.includes}" ihtivâ etmeli.`:s.format==="regex"?`Fâsit metin: ${s.pattern} nakşına uymalı.`:`Fâsit ${i[s.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function qx(){return{localeError:Fx()}}const Jx=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${K(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${P(n.values,"|")} څخه وای`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} وي`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} وي`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ناسم متن: باید د "${s.prefix}" سره پیل شي`:s.format==="ends_with"?`ناسم متن: باید د "${s.suffix}" سره پای ته ورسيږي`:s.format==="includes"?`ناسم متن: باید "${s.includes}" ولري`:s.format==="regex"?`ناسم متن: باید د ${s.pattern} سره مطابقت ولري`:`${i[s.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${P(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function Vx(){return{localeError:Jx()}}const Wx=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${K(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${s.prefix}"`:s.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${s.suffix}"`:s.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${s.includes}"`:s.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${s.pattern}`:`Nieprawidłow(y/a/e) ${i[s.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Gx(){return{localeError:Wx()}}const Yx=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${K(n.values[0])}`:`Opção inválida: esperada uma das ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${s}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Texto inválido: deve começar com "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`${i[s.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function Kx(){return{localeError:Yx()}}function mf(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const Xx=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${K(n.values[0])}`:`Неверный вариант: ожидалось одно из ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=mf(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${s}${n.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=mf(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${s}${n.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неверная строка: должна начинаться с "${s.prefix}"`:s.format==="ends_with"?`Неверная строка: должна заканчиваться на "${s.suffix}"`:s.format==="includes"?`Неверная строка: должна содержать "${s.includes}"`:s.format==="regex"?`Неверная строка: должна соответствовать шаблону ${s.pattern}`:`Неверный ${i[s.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function Hx(){return{localeError:Xx()}}const Qx=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${K(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${s}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${s}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neveljaven niz: mora se začeti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se končati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${i[s.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${P(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function e0(){return{localeError:Qx()}}const t0=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${K(n.values[0])}`:`Ogiltigt val: förväntade en av ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ogiltig sträng: måste börja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig sträng: måste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig sträng: måste innehålla "${s.includes}"`:s.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${s.pattern}"`:`Ogiltig(t) ${i[s.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function n0(){return{localeError:t0()}}const r0=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${K(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${P(n.values,"|")} இல் ஒன்று`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const s=n;return s.format==="starts_with"?`தவறான சரம்: "${s.prefix}" இல் தொடங்க வேண்டும்`:s.format==="ends_with"?`தவறான சரம்: "${s.suffix}" இல் முடிவடைய வேண்டும்`:s.format==="includes"?`தவறான சரம்: "${s.includes}" ஐ உள்ளடக்க வேண்டும்`:s.format==="regex"?`தவறான சரம்: ${s.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[s.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function i0(){return{localeError:r0()}}const s0=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${K(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=e(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"อย่างน้อย":"มากกว่า",a=e(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${s.prefix}"`:s.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${s.suffix}"`:s.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${s.includes}" อยู่ในข้อความ`:s.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${s.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[s.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${P(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function a0(){return{localeError:s0()}}const o0=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},u0=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(i){return t[i]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${o0(i.input)}`;case"invalid_value":return i.values.length===1?`Geçersiz değer: beklenen ${K(i.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${P(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()} ${s.unit??"öğe"}`:`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()} ${s.unit}`:`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${P(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function c0(){return{localeError:u0()}}const l0=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${K(n.values[0])}`:`Неправильна опція: очікується одне з ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неправильний рядок: повинен починатися з "${s.prefix}"`:s.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${s.suffix}"`:s.format==="includes"?`Неправильний рядок: повинен містити "${s.includes}"`:s.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${s.pattern}`:`Неправильний ${i[s.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function d0(){return{localeError:l0()}}const m0=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${K(n.values[0])} متوقع تھا`:`غلط آپشن: ${P(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${s}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${s}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${s}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${s}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const s=n;return s.format==="starts_with"?`غلط سٹرنگ: "${s.prefix}" سے شروع ہونا چاہیے`:s.format==="ends_with"?`غلط سٹرنگ: "${s.suffix}" پر ختم ہونا چاہیے`:s.format==="includes"?`غلط سٹرنگ: "${s.includes}" شامل ہونا چاہیے`:s.format==="regex"?`غلط سٹرنگ: پیٹرن ${s.pattern} سے میچ ہونا چاہیے`:`غلط ${i[s.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${P(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function f0(){return{localeError:m0()}}const h0=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${K(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${s.prefix}"`:s.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${s.suffix}"`:s.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${s.includes}"`:s.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${s.pattern}`:`${i[s.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${P(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function p0(){return{localeError:h0()}}const v0=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${K(n.values[0])}`:`无效选项:期望以下之一 ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`无效字符串:必须以 "${s.prefix}" 开头`:s.format==="ends_with"?`无效字符串:必须以 "${s.suffix}" 结尾`:s.format==="includes"?`无效字符串:必须包含 "${s.includes}"`:s.format==="regex"?`无效字符串:必须满足正则表达式 ${s.pattern}`:`无效${i[s.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function g0(){return{localeError:v0()}}const y0=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${K(n.values[0])}`:`無效的選項:預期為以下其中之一 ${P(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無效的字串:必須以 "${s.prefix}" 開頭`:s.format==="ends_with"?`無效的字串:必須以 "${s.suffix}" 結尾`:s.format==="includes"?`無效的字串:必須包含 "${s.includes}"`:s.format==="regex"?`無效的字串:必須符合格式 ${s.pattern}`:`無效的 ${i[s.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${P(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function $0(){return{localeError:y0()}}const f$=Object.freeze(Object.defineProperty({__proto__:null,ar:Hz,az:ex,be:nx,ca:ix,cs:ax,de:ux,en:m$,es:mx,fa:hx,fi:vx,fr:yx,frCA:bx,he:_x,hu:Ix,id:Sx,it:Tx,ja:xx,kh:Ux,ko:Px,mk:Ax,ms:Cx,nl:Lx,no:Bx,ota:qx,pl:Gx,ps:Vx,pt:Kx,ru:Hx,sl:e0,sv:n0,ta:i0,th:a0,tr:c0,ua:d0,ur:f0,vi:p0,zhCN:g0,zhTW:$0},Symbol.toStringTag,{value:"Module"}));let h$=class{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=(...i)=>{const n=this._def.input?Eo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=e(...n);return this._def.output?Eo(this._def.output,s,void 0,{callee:r}):s};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=async(...i)=>{const n=this._def.input?await Uo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=await e(...n);return this._def.output?Uo(this._def.output,s,void 0,{callee:r}):s};return r}input(...e){const r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new ra({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){const r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}};function p$(t){return new h$({type:"function",input:Array.isArray(t==null?void 0:t.input)?Gg(ra,t==null?void 0:t.input):(t==null?void 0:t.input)??Oc(Lu,Ns(Os)),output:(t==null?void 0:t.output)??Ns(Os)})}let Mo=class{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??dn,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var i,n,s,a;const o=e._zod.def,u={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(e);if(c)return c.count++,r.schemaPath.includes(e)&&(c.cycle=r.path),c.schema;const l={schema:{},count:1,cycle:void 0};this.seen.set(e,l);const d=(n=(i=e._zod).toJSONSchema)==null?void 0:n.call(i);if(d)l.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path},_=e._zod.parent;if(_)l.ref=_,this.process(_,p),this.seen.get(_).isParent=!0;else{const k=l.schema;switch(o.type){case"string":{const m=k;m.type="string";const{minimum:h,maximum:v,format:w,patterns:I,contentEncoding:A}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof v=="number"&&(m.maxLength=v),w&&(m.format=u[w]??w,m.format===""&&delete m.format),A&&(m.contentEncoding=A),I&&I.size>0){const J=[...I];J.length===1?m.pattern=J[0].source:J.length>1&&(l.schema.allOf=[...J.map(ce=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ce.source}))])}break}case"number":{const m=k,{minimum:h,maximum:v,format:w,multipleOf:I,exclusiveMaximum:A,exclusiveMinimum:J}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof J=="number"&&(m.exclusiveMinimum=J),typeof h=="number"&&(m.minimum=h,typeof J=="number"&&(J>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof A=="number"&&(m.exclusiveMaximum=A),typeof v=="number"&&(m.maximum=v,typeof A=="number"&&(A<=v?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{const m=k;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const m=k;m.type="null";break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"never":{k.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=k,{minimum:h,maximum:v}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof v=="number"&&(m.maxItems=v),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{const m=k;m.type="object",m.properties={};const h=o.shape;for(const I in h)m.properties[I]=this.process(h[I],{...p,path:[...p.path,"properties",I]});const v=new Set(Object.keys(h)),w=new Set([...v].filter(I=>{const A=o.shape[I]._zod;return this.io==="input"?A.optin===void 0:A.optout===void 0}));w.size>0&&(m.required=Array.from(w)),((s=o.catchall)==null?void 0:s._zod.def.type)==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=k;m.anyOf=o.options.map((h,v)=>this.process(h,{...p,path:[...p.path,"anyOf",v]}));break}case"intersection":{const m=k,h=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),v=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=A=>"allOf"in A&&Object.keys(A).length===1,I=[...w(h)?h.allOf:[h],...w(v)?v.allOf:[v]];m.allOf=I;break}case"tuple":{const m=k;m.type="array";const h=o.items.map((I,A)=>this.process(I,{...p,path:[...p.path,"prefixItems",A]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){const I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));const{minimum:v,maximum:w}=e._zod.bag;typeof v=="number"&&(m.minItems=v),typeof w=="number"&&(m.maxItems=w);break}case"record":{const m=k;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=k,h=Iu(o.entries);h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),m.enum=h;break}case"literal":{const m=k,h=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(v))}else h.push(v);if(h.length!==0)if(h.length===1){const v=h[0];m.type=v===null?"null":typeof v,m.const=v}else h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),h.every(v=>typeof v=="boolean")&&(m.type="string"),h.every(v=>v===null)&&(m.type="null"),m.enum=h;break}case"file":{const m=k,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:w,mime:I}=e._zod.bag;v!==void 0&&(h.minLength=v),w!==void 0&&(h.maxLength=w),I?I.length===1?(h.contentMediaType=I[0],Object.assign(m,h)):m.anyOf=I.map(A=>({...h,contentMediaType:A})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(o.innerType,p);k.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"success":{const m=k;m.type="boolean";break}case"default":{this.process(o.innerType,p),l.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),l.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),l.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=k,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{const m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),l.ref=m;break}case"readonly":{this.process(o.innerType,p),l.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,p),l.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,p),l.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const g=this.metadataRegistry.get(e);return g&&Object.assign(l.schema,g),this.io==="input"&&Be(e)&&(delete l.schema.examples,delete l.schema.default),this.io==="input"&&l.schema._prefault&&((a=l.schema).default??(a.default=l.schema._prefault)),delete l.schema._prefault,this.seen.get(e).schema}emit(e,r){var i,n,s,a;const o={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},u=this.seen.get(e);if(!u)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=_=>{var k;const m=this.target==="draft-2020-12"?"$defs":"definitions";if(o.external){const w=(k=o.external.registry.get(_[0]))==null?void 0:k.id;if(w)return{ref:o.external.uri(w)};const I=_[1].defId??_[1].schema.id??`schema${this.counter++}`;return _[1].defId=I,{defId:I,ref:`${o.external.uri("__shared")}#/${m}/${I}`}}if(_[1]===u)return{ref:"#"};const h=`#/${m}/`,v=_[1].schema.id??`__schema${this.counter++}`;return{defId:v,ref:h+v}},l=_=>{if(_[1].schema.$ref)return;const k=_[1],{ref:m,defId:h}=c(_);k.def={...k.schema},h&&(k.defId=h);const v=k.schema;for(const w in v)delete v[w];v.$ref=m};for(const _ of this.seen.entries()){const k=_[1];if(e===_[0]){l(_);continue}if(o.external){const m=(i=o.external.registry.get(_[0]))==null?void 0:i.id;if(e!==_[0]&&m){l(_);continue}}if((n=this.metadataRegistry.get(_[0]))!=null&&n.id){l(_);continue}if(k.cycle){if(o.cycles==="throw")throw new Error(`Cycle detected: #/${(s=k.cycle)==null?void 0:s.join("/")}/<root>
35
-
36
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);o.cycles==="ref"&&l(_);continue}if(k.count>1&&o.reused==="ref"){l(_);continue}}const d=(_,k)=>{const m=this.seen.get(_),h=m.def??m.schema,v={...h};if(m.ref===null)return;const w=m.ref;if(m.ref=null,w){d(w,k);const I=this.seen.get(w).schema;I.$ref&&k.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(I)):(Object.assign(h,I),Object.assign(h,v))}m.isParent||this.override({zodSchema:_,jsonSchema:h})};for(const _ of[...this.seen.entries()].reverse())d(_[0],{target:this.target});const g={};this.target==="draft-2020-12"?g.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?g.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(g,u.def);const p=((a=o.external)==null?void 0:a.defs)??{};for(const _ of this.seen.entries()){const k=_[1];k.def&&k.defId&&(p[k.defId]=k.def)}!o.external&&Object.keys(p).length>0&&(this.target==="draft-2020-12"?g.$defs=p:g.definitions=p);try{return JSON.parse(JSON.stringify(g))}catch{throw new Error("Error converting schema to JSON.")}}};function v$(t,e){if(t instanceof qu){const i=new Mo(e),n={};for(const o of t._idmap.entries()){const[u,c]=o;i.process(c)}const s={},a={registry:t,uri:(e==null?void 0:e.uri)||(o=>o),defs:n};for(const o of t._idmap.entries()){const[u,c]=o;s[u]=i.emit(c,{...e,external:a})}if(Object.keys(n).length>0){const o=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[o]:n}}return{schemas:s}}const r=new Mo(e);return r.process(t),r.emit(t,e)}function Be(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Be(i.element,r);case"object":{for(const n in i.shape)if(Be(i.shape[n],r))return!0;return!1}case"union":{for(const n of i.options)if(Be(n,r))return!0;return!1}case"intersection":return Be(i.left,r)||Be(i.right,r);case"tuple":{for(const n of i.items)if(Be(n,r))return!0;return!!(i.rest&&Be(i.rest,r))}case"record":return Be(i.keyType,r)||Be(i.valueType,r);case"map":return Be(i.keyType,r)||Be(i.valueType,r);case"set":return Be(i.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Be(i.innerType,r);case"lazy":return Be(i.getter(),r);case"default":return Be(i.innerType,r);case"prefault":return Be(i.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Be(i.in,r)||Be(i.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const b0=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),w0=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Lv,$ZodArray:Lu,$ZodAsyncError:sr,$ZodBase64:zv,$ZodBase64URL:Ev,$ZodBigInt:Ru,$ZodBigIntFormat:Av,$ZodBoolean:Cu,$ZodCIDRv4:Nv,$ZodCIDRv6:Tv,$ZodCUID:vv,$ZodCUID2:gv,$ZodCatch:sg,$ZodCheck:Re,$ZodCheckBigIntFormat:Vp,$ZodCheckEndsWith:iv,$ZodCheckGreaterThan:ju,$ZodCheckIncludes:nv,$ZodCheckLengthEquals:Hp,$ZodCheckLessThan:Pu,$ZodCheckLowerCase:ev,$ZodCheckMaxLength:Kp,$ZodCheckMaxSize:Wp,$ZodCheckMimeType:av,$ZodCheckMinLength:Xp,$ZodCheckMinSize:Gp,$ZodCheckMultipleOf:qp,$ZodCheckNumberFormat:Jp,$ZodCheckOverwrite:ov,$ZodCheckProperty:sv,$ZodCheckRegex:Qp,$ZodCheckSizeEquals:Yp,$ZodCheckStartsWith:rv,$ZodCheckStringFormat:Si,$ZodCheckUpperCase:tv,$ZodCustom:dg,$ZodDate:Fv,$ZodDefault:tg,$ZodDiscriminatedUnion:Jv,$ZodE164:Uv,$ZodEmail:mv,$ZodEmoji:hv,$ZodEnum:Kv,$ZodError:Su,$ZodFile:Hv,$ZodFunction:h$,$ZodGUID:lv,$ZodIPv4:Ov,$ZodIPv6:Sv,$ZodISODate:_v,$ZodISODateTime:wv,$ZodISODuration:Iv,$ZodISOTime:kv,$ZodIntersection:Vv,$ZodJWT:Pv,$ZodKSUID:bv,$ZodLazy:lg,$ZodLiteral:Xv,$ZodMap:Gv,$ZodNaN:ag,$ZodNanoID:pv,$ZodNever:Mv,$ZodNonOptional:rg,$ZodNull:Rv,$ZodNullable:eg,$ZodNumber:Du,$ZodNumberFormat:jv,$ZodObject:qv,$ZodOptional:Qv,$ZodPipe:Fu,$ZodPrefault:ng,$ZodPromise:cg,$ZodReadonly:og,$ZodRealError:Oi,$ZodRecord:Wv,$ZodRegistry:qu,$ZodSet:Yv,$ZodString:Ni,$ZodStringFormat:$e,$ZodSuccess:ig,$ZodSymbol:Dv,$ZodTemplateLiteral:ug,$ZodTransform:Bu,$ZodTuple:ra,$ZodType:B,$ZodULID:yv,$ZodURL:fv,$ZodUUID:dv,$ZodUndefined:Cv,$ZodUnion:Mu,$ZodUnknown:Os,$ZodVoid:Bv,$ZodXID:$v,$brand:qh,$constructor:$,$input:fg,$output:mg,Doc:uv,JSONSchema:b0,JSONSchemaGenerator:Mo,TimePrecision:vg,_any:Dg,_array:Oc,_base64:cc,_base64url:lc,_bigint:xg,_boolean:Tg,_catch:wN,_cidrv4:oc,_cidrv6:uc,_coercedBigint:Eg,_coercedBoolean:zg,_coercedDate:Mg,_coercedNumber:_g,_coercedString:pg,_cuid:ec,_cuid2:tc,_custom:Kg,_date:Lg,_default:yN,_discriminatedUnion:oN,_e164:dc,_email:Vu,_emoji:Hu,_endsWith:$c,_enum:mN,_file:Yg,_float32:Ig,_float64:Og,_gt:vn,_gte:ht,_guid:Ss,_includes:gc,_int:kg,_int32:Sg,_int64:Ug,_intersection:uN,_ipv4:sc,_ipv6:ac,_isoDate:yg,_isoDateTime:gg,_isoDuration:bg,_isoTime:$g,_jwt:mc,_ksuid:ic,_lazy:ON,_length:aa,_literal:hN,_lowercase:pc,_lt:pn,_lte:wt,_map:lN,_max:wt,_maxLength:sa,_maxSize:ia,_mime:bc,_min:ht,_minLength:ur,_minSize:oi,_multipleOf:ai,_nan:Bg,_nanoid:Qu,_nativeEnum:fN,_negative:qg,_never:Cg,_nonnegative:Vg,_nonoptional:$N,_nonpositive:Jg,_normalize:wc,_null:Ag,_nullable:gN,_number:wg,_optional:vN,_overwrite:xn,_parse:zu,_parseAsync:xu,_pipe:_N,_positive:Fg,_promise:SN,_property:Wg,_readonly:kN,_record:cN,_refine:Xg,_regex:hc,_safeParse:Eu,_safeParseAsync:Uu,_set:dN,_size:fc,_startsWith:yc,_string:hg,_stringbool:Hg,_success:bN,_symbol:Pg,_templateLiteral:IN,_toLowerCase:kc,_toUpperCase:Ic,_transform:pN,_trim:_c,_tuple:Gg,_uint32:Ng,_uint64:Zg,_ulid:nc,_undefined:jg,_union:aN,_unknown:Ns,_uppercase:vc,_url:Xu,_uuid:Wu,_uuidv4:Gu,_uuidv6:Yu,_uuidv7:Ku,_void:Rg,_xid:rc,clone:jt,config:lt,flattenError:Nu,formatError:Tu,function:p$,globalConfig:_s,globalRegistry:dn,isValidBase64:Au,isValidBase64URL:xv,isValidJWT:Zv,locales:f$,parse:Eo,parseAsync:Uo,prettifyError:op,regexes:Bp,registry:Ju,safeParse:up,safeParseAsync:cp,toDotPath:ap,toJSONSchema:v$,treeifyError:sp,util:KS,version:cv},Symbol.toStringTag,{value:"Module"})),_0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},k0=Object.freeze({status:"aborted"}),I0=k0;function O0(t){lt({customError:t})}function S0(){return lt().customError}lt(m$());const Ae=Object.freeze(Object.defineProperty({__proto__:null,$brand:qh,$input:fg,$output:mg,NEVER:I0,TimePrecision:vg,ZodAny:fy,ZodArray:gy,ZodBase64:qc,ZodBase64URL:Jc,ZodBigInt:la,ZodBigIntFormat:Yc,ZodBoolean:ca,ZodCIDRv4:Bc,ZodCIDRv6:Fc,ZodCUID:jc,ZodCUID2:Ac,ZodCatch:Py,ZodCustom:ha,ZodDate:Kc,ZodDefault:Ty,ZodDiscriminatedUnion:yy,ZodE164:Vc,ZodEmail:Ec,ZodEmoji:Zc,ZodEnum:ui,ZodError:TN,ZodFile:Sy,ZodGUID:Ts,ZodIPv4:Lc,ZodIPv6:Mc,ZodISODate:Nc,ZodISODateTime:Sc,ZodISODuration:zc,ZodISOTime:Tc,ZodIntersection:$y,ZodIssueCode:_0,ZodJWT:Wc,ZodKSUID:Rc,ZodLazy:Ly,ZodLiteral:Iy,ZodMap:_y,ZodNaN:Ay,ZodNanoID:Pc,ZodNever:py,ZodNonOptional:nl,ZodNull:my,ZodNullable:Ny,ZodNumber:ua,ZodNumberFormat:_r,ZodObject:ma,ZodOptional:tl,ZodPipe:rl,ZodPrefault:xy,ZodPromise:By,ZodReadonly:Dy,ZodRealError:Ti,ZodRecord:Hc,ZodSet:ky,ZodString:oa,ZodStringFormat:_e,ZodSuccess:Zy,ZodSymbol:uy,ZodTemplateLiteral:Ry,ZodTransform:Qc,ZodTuple:wy,ZodType:ee,ZodULID:Dc,ZodURL:Uc,ZodUUID:Mt,ZodUndefined:ly,ZodUnion:Xc,ZodUnknown:hy,ZodVoid:vy,ZodXID:Cc,_ZodString:xc,_default:zy,any:rT,array:xi,base64:WN,base64url:GN,bigint:gn,boolean:Gc,catch:jy,check:Fy,cidrv4:JN,cidrv6:VN,clone:jt,coerce:lz,config:lt,core:w0,cuid:CN,cuid2:RN,custom:bT,date:sT,discriminatedUnion:cT,e164:YN,email:zN,emoji:AN,endsWith:$c,enum:Ye,file:hT,flattenError:Nu,float32:XN,float64:HN,formatError:Tu,function:p$,getErrorMap:S0,globalRegistry:dn,gt:vn,gte:ht,guid:xN,includes:gc,instanceof:ge,int:Po,int32:QN,int64:tT,intersection:by,ipv4:FN,ipv6:qN,iso:NN,json:_T,jwt:KN,keyof:aT,ksuid:BN,lazy:My,length:aa,literal:Oy,locales:f$,looseObject:uT,lowercase:pc,lt:pn,lte:wt,map:dT,maxLength:sa,maxSize:ia,mime:bc,minLength:ur,minSize:oi,multipleOf:ai,nan:gT,nanoid:DN,nativeEnum:fT,negative:qg,never:da,nonnegative:Vg,nonoptional:Uy,nonpositive:Jg,normalize:wc,null:zi,nullable:xs,nullish:pT,number:H,object:re,optional:zs,overwrite:xn,parse:iy,parseAsync:sy,partialRecord:lT,pipe:Es,positive:Fg,prefault:Ey,preprocess:kT,prettifyError:op,promise:$T,property:Wg,readonly:Cy,record:fa,refine:qy,regex:hc,regexes:Bp,registry:Ju,safeParse:ay,safeParseAsync:oy,set:mT,setErrorMap:O0,size:fc,startsWith:yc,strictObject:oT,string:Ne,stringbool:wT,success:vT,superRefine:Jy,symbol:cy,templateLiteral:yT,toJSONSchema:v$,toLowerCase:kc,toUpperCase:Ic,transform:el,treeifyError:sp,trim:_c,tuple:kr,uint32:eT,uint64:nT,ulid:LN,undefined:dy,union:ze,unknown:cr,uppercase:vc,url:jN,uuid:EN,uuidv4:UN,uuidv6:ZN,uuidv7:PN,void:iT,xid:MN},Symbol.toStringTag,{value:"Module"})),N0=async t=>await new Promise(e=>setTimeout(e,M.fromMilliseconds(t).milliseconds));let T0=class{constructor(e){xt(this,"config"),xt(this,"retries"),xt(this,"interval"),this.config={baseInterval:new M((e==null?void 0:e.baseInterval)??M.seconds(1)),maxRetries:(e==null?void 0:e.maxRetries)??5,scale:(e==null?void 0:e.scale)??1,sleepFn:(e==null?void 0:e.sleepFn)??N0},this.retries=0,this.interval=new M(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:r,sleepFn:i}=this.config;return this.retries>=e?!1:(await i(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}};const z0=re({baseInterval:M.z.optional(),maxRetries:H().optional(),scale:H().optional()}),g$=Object.freeze(Object.defineProperty({__proto__:null,Breaker:T0,breakerConfigZ:z0},Symbol.toStringTag,{value:"Module"})),x0=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,y$=Ne().regex(x0),er=H().min(0).max(255),$$=H().min(0).max(1),b$=kr([er,er,er,$$]),E0=kr([er,er,er]),U0=re({rgba255:b$}),Z0=H().min(0).max(360),P0=H().min(0).max(100),j0=H().min(0).max(100),A0=kr([Z0,P0,j0,$$]),sl=ze([y$,E0,b$,A0,U0]),D0=sl.transform(t=>al(t)),al=(t,e=1)=>{if(t=sl.parse(t),typeof t=="string")return C0(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}return t.rgba255},C0=(t,e=1)=>(t=y$.parse(t),t=R0(t),[ts(t,0),ts(t,2),ts(t,4),t.length===8?ts(t,6)/255:e]),ts=(t,e)=>parseInt(t.slice(e,e+2),16),R0=t=>t.startsWith("#")?t.slice(1):t;al("#000000");al("#ffffff");const L0=re({key:Ne(),color:sl,position:H(),switched:Gc().optional()});xi(L0);const M0=re({key:Ne(),name:Ne(),color:D0});re({key:Ne(),name:Ne(),swatches:xi(M0)});const w$=H().int().min(0).max(255),_$=255,k$=0,B0={lower:k$,upper:_$+1},I$=re({name:Ne(),key:Ne()}),ci=t=>re({subject:I$,resource:t,authority:w$}),F0=(...t)=>e=>e.filter(r=>{let i=!1;return r.to!=null&&(i=t.includes(r.to.resource)),r.from!=null&&!i&&(i=t.includes(r.from.resource)),i}),O$=t=>re({from:ci(t),to:zi()}),S$=t=>re({from:zi(),to:ci(t)}),q0=t=>ze([O$(t),S$(t),re({from:ci(t),to:ci(t)})]),$n=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:_$,AUTHORITY_BOUNDS:B0,ZERO_AUTHORITY:k$,acquireZ:S$,authorityZ:w$,filterTransfersByChannelKey:F0,releaseZ:O$,stateZ:ci,subjectZ:I$,transferZ:q0},Symbol.toStringTag,{value:"Module"})),J0=t=>Object.getOwnPropertySymbols(globalThis).includes(t),V0=(t,e)=>{const r=Symbol.for(t);if(!J0(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},N$="sy_x_error",W0=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),va=t=>{var e;return e=class extends Error{constructor(r,i){super(r,i),xt(this,"discriminator",e.discriminator),xt(this,"type",e.TYPE),xt(this,"matches",e.matches),this.name=e.TYPE}static sub(r){return va(`${t}.${r}`)}},xt(e,"discriminator",N$),xt(e,"TYPE",t),xt(e,"matches",W0(t)),e},T$=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==N$)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},qn="unknown",Bo="nil";let G0=class{constructor(){xt(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Bo,data:""};if(T$(e))for(const r of this.providers){const i=r.encode(e);if(i!=null)return i}if(e instanceof Error)return{type:qn,data:e.message};if(typeof e=="string")return{type:qn,data:e};try{return{type:qn,data:JSON.stringify(e)}}catch{return{type:qn,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Bo)return null;if(e.type===qn)return new Fo(e.data);for(const r of this.providers){const i=r.decode(e);if(i!=null)return i}return new Fo(e.data)}};const ol=V0("synnax-error-registry",()=>new G0),Y0=({encode:t,decode:e})=>ol().register({encode:t,decode:e}),K0=t=>ol().encode(t),X0=t=>t==null?null:ol().decode(t);let Fo=class extends va("unknown"){};const H0=re({type:Ne(),data:Ne()});let Q0=class extends va("canceled"){};const dr=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Q0,NONE:Bo,UNKNOWN:qn,Unknown:Fo,createTyped:va,decode:X0,encode:K0,isTyped:T$,payloadZ:H0,register:Y0},Symbol.toStringTag,{value:"Module"})),eE=Ae.object({jsonrpc:Ae.literal("2.0"),method:Ae.string(),params:Ae.any().optional(),id:Ae.union([Ae.string(),Ae.number(),Ae.null()]).optional()}),z$=Ae.object({jsonrpc:Ae.literal("2.0"),id:Ae.union([Ae.string(),Ae.number(),Ae.null()])}),tE=z$.extend({result:Ae.json()}),nE=z$.extend({error:Ae.object({code:Ae.number().int(),message:Ae.string().optional(),data:Ae.json().optional()})}),rE=Ae.union([tE,nE]);Ae.union([eE,rE]);const qo=Ne().regex(/^\d+\.\d+\.\d+$/),Ei=(t,e,r={})=>{r.checkMajor??(r.checkMajor=!0),r.checkMinor??(r.checkMinor=!0),r.checkPatch??(r.checkPatch=!0);const i=qo.parse(t),n=qo.parse(e),[s,a,o]=i.split(".").map(Number),[u,c,l]=n.split(".").map(Number);if(r.checkMajor){if(s<u)return io;if(s>u)return so}if(r.checkMinor){if(a<c)return io;if(a>c)return so}if(r.checkPatch){if(o<l)return io;if(o>l)return so}return Hs},iE=(t,e,r={})=>DS(Ei(t,e,r)),x$=(t,e,r={})=>AS(Ei(t,e,r)),sE=(t,e,r={})=>jS(Ei(t,e,r)),aE=({name:t,migrate:e})=>r=>{try{const i=e(r);return console.log(`${t} migrated: ${r.version} -> ${i.version}`),i}catch(i){throw console.log(`${t} failed to migrate from ${r.version}`),console.error(i),i}},oE=({name:t,migrations:e,targetSchema:r,defaultVersion:i,def:n})=>{const s=Object.keys(e).sort(Ei).pop();if(s==null)return c=>{if(c.version??(c.version=i),c.version!==n.version)return console.log(`${t} version ${c.version} is newer than latest version of ${n.version}.
37
- Returning default instead.
38
- `),n;try{return r!=null?r.parse(c):c}catch(l){return console.log(`${t} failed to parse default. Exiting with default`),console.error(l),n}};const a=Object.keys(e).length;let o=!1;const u=c=>{try{if(a===0||x$(c.version,s))return console.log(o?`${t} ${c.version} now up to date`:`${t} version ${c.version} is up to date with target version ${n.version}`),c;const l=c.version,d=e[l],g=d(c);return o=!0,u(g)}catch(l){return console.log(`${t} failed to migrate from ${c.version} to ${s}`),console.error(l),n}};return c=>{try{if(c.version==null)if(i!=null)console.log(`${t} version is null. Setting version to default of ${i}`),c.version=i;else return console.log(`${t} version is null and no default version set. Exiting with default`),n;return u(c)}catch(l){return console.log(`${t} failed to parse final result. Exiting with default`),console.error(l),n}}},ff=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Ei,createMigration:aE,migrator:oE,semVerNewer:x$,semVerOlder:sE,semVerZ:qo,versionsEqual:iE},Symbol.toStringTag,{value:"Module"})),uE=["standard","scientific","engineering"];Ye(uE);const cE=Ye(["success","info","warning","error","loading","disabled"]),ga=Object.freeze(Object.defineProperty({__proto__:null,variantZ:cE},Symbol.toStringTag,{value:"Module"})),lE=(t,e="")=>{const r=t.length;return r===0?e:r===1?t[0]:r===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[r-1]}`},dE=t=>{const e=t.split(" "),r=new Set,i=e.map(a=>a.charAt(0).toLowerCase()).join("");r.add(i.replace(/-/g,"_")),r.add(i.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"));const n=/\d+/g;t.match(n)&&e.forEach((a,o)=>{if(n.test(a)){const u=e.map((c,l)=>l!==o?c.charAt(0).toLowerCase():c).join("");r.add(u.replace(/-/g,"_")),r.add(u.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const s=e.map(a=>(a.length>3?a.substring(0,3):a).toLowerCase());return r.add(s.join("").replace(/-/g,"_")),r.add(s.join("_").replace(/-/g,"_")),Array.from(r).filter(a=>a.length>=2&&a.length<=12&&!/^\d/.test(a))},mE=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:dE,naturalLanguageJoin:lE},Symbol.toStringTag,{value:"Module"})),ul="policy",cl="allow_all";var fE=Object.defineProperty,hE=(t,e,r)=>e in t?fE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ge=(t,e,r)=>hE(t,typeof e!="symbol"?e+"":e,r);const pE=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},E$=t=>{const e=(r,i=Jo)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(a=>e(a,i));if(!lo(r))return r;i=yE(i);const n={},s=r;return"toJSON"in s&&typeof s.toJSON=="function"?e(s.toJSON(),i):(Object.keys(s).forEach(a=>{let o=s[a];const u=t(a);i.recursive&&(lo(o)?pf(o,i.keepTypesOnRecursion)||(o=e(o,i)):i.recursiveInArray&&hf(o)&&(o=[...o].map(c=>{let l=c;return lo(c)?pf(l,i.keepTypesOnRecursion)||(l=e(c,i)):hf(c)&&(l=e({key:c},i).key),l}))),n[u]=o}),n)};return e},U$=E$(pE),vE=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,i)=>`${r}_${i.toLowerCase()}`),gE=E$(vE),Jo={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},yE=(t=Jo)=>(t.recursive==null?t=Jo:t.recursiveInArray??(t.recursiveInArray=!1),t),hf=t=>t!=null&&Array.isArray(t),lo=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),pf=(t,e)=>(e||[]).some(r=>t instanceof r),$E=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var bE=Object.defineProperty,wE=(t,e,r)=>e in t?bE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e,r)=>wE(t,typeof e!="symbol"?e+"":e,r);let _E=class{constructor(){Hr(this,"contentType","application/json"),Hr(this,"decoder"),Hr(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(t){return this.encoder.encode(this.encodeString(t))}decode(t,e){return this.decodeString(this.decoder.decode(t),e)}decodeString(t,e){const r=JSON.parse(t),i=U$(r);return e!=null?e.parse(i):i}encodeString(t){const e=gE(t);return JSON.stringify(e,(r,i)=>ArrayBuffer.isView(i)?Array.from(i):typeof i=="bigint"?i.toString():i)}},kE=class{constructor(){Hr(this,"contentType","text/csv")}encode(t){const e=this.encodeString(t);return new TextEncoder().encode(e)}decode(t,e){const r=new TextDecoder().decode(t);return this.decodeString(r,e)}encodeString(t){if(!Array.isArray(t)||t.length===0||!$E(t[0]))throw new Error("Payload must be an array of objects");const e=Object.keys(t[0]),r=[e.join(",")];return t.forEach(i=>{const n=e.map(s=>JSON.stringify(i[s]??""));r.push(n.join(","))}),r.join(`
39
- `)}decodeString(t,e){const[r,...i]=t.trim().split(`
40
- `).map(a=>a.trim());if(r.length===0)return e!=null?e.parse({}):{};const n=r.split(",").map(a=>a.trim()),s={};return n.forEach(a=>{s[a]=[]}),i.forEach(a=>{const o=a.split(",").map(u=>u.trim());n.forEach((u,c)=>{const l=this.parseValue(o[c]);l!=null&&s[u].push(l)})}),e!=null?e.parse(s):s}parseValue(t){if(t==null||t.length===0)return null;const e=Number(t);return isNaN(e)?t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t:e}},IE=class{constructor(){Hr(this,"contentType","text/plain")}encode(t){if(typeof t!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(t)}decode(t,e){const r=new TextDecoder().decode(t);return e!=null?e.parse(r):r}};const Vo=new _E;new kE;new IE;var OE=Object.defineProperty,SE=(t,e,r)=>e in t?OE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,NE=(t,e,r)=>SE(t,e+"",r);let Or=class{constructor(t){NE(this,"value"),this.value=t}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const TE=t=>t!=null&&typeof t=="object"&&"toString"in t,zE=(t,e=!1)=>{const r=TE(t)?"stringer":typeof t;let i;switch(r){case"string":i=(n,s)=>n.localeCompare(s);break;case"stringer":i=(n,s)=>n.toString().localeCompare(s.toString());break;case"number":i=(n,s)=>Number(n)-Number(s);break;case"bigint":i=(n,s)=>BigInt(n)-BigInt(s)>0n?1:-1;break;case"boolean":i=(n,s)=>Number(n)-Number(s);break;case"undefined":i=()=>0;break;default:return console.warn(`sortFunc: unknown type ${r}`),()=>-1}return e?xE(i):i},xE=t=>(e,r)=>t(r,e);function b(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}const Z$=Symbol("zod_brand");class mr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Zs={};function dt(t){return t&&Object.assign(Zs,t),Zs}function EE(t){return t}function UE(t){return t}function ZE(t){}function PE(t){throw new Error}function jE(t){}function ll(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function j(t,e="|"){return t.map(r=>X(r)).join(e)}function P$(t,e){return typeof e=="bigint"?e.toString():e}function ya(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function En(t){return t==null}function $a(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function j$(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function se(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Sr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function AE(t,e){return e?e.reduce((r,i)=>r==null?void 0:r[i],t):t}function DE(t){const e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{const n={};for(let s=0;s<e.length;s++)n[e[s]]=i[s];return n})}function dl(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Jn(t){return JSON.stringify(t)}function li(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const A$=ya(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ps(t){if(li(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(li(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function CE(t){let e=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}const RE=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},js=new Set(["string","number","symbol"]),D$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Un(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function At(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function T(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function LE(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,s){return e??(e=t()),Reflect.set(e,i,n,s)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function X(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function C$(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const R$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},L$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function M$(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return At(t,{...t._zod.def,shape:r,checks:[]})}function B$(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return At(t,{...t._zod.def,shape:r,checks:[]})}function F$(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return Sr(this,"shape",i),i},checks:[]};return At(t,r)}function q$(t,e){return At(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Sr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function J$(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return At(e,{...e._zod.def,shape:n,checks:[]})}function V$(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return At(e,{...e._zod.def,shape:n,checks:[]})}function tr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function yt(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Jr(t){return typeof t=="string"?t:t==null?void 0:t.message}function It(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=Jr((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??Jr((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??Jr((o=r.customError)==null?void 0:o.call(r,t))??Jr((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function ba(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function wa(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function fr(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function ME(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}class BE{constructor(...e){}}const FE=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:L$,Class:BE,NUMBER_FORMAT_RANGES:R$,aborted:tr,allowsEval:A$,assert:jE,assertEqual:EE,assertIs:ZE,assertNever:PE,assertNotEqual:UE,assignProp:Sr,cached:ya,cleanEnum:ME,cleanRegex:$a,clone:At,createTransparentProxy:LE,defineLazy:se,esc:Jn,escapeRegex:Un,extend:F$,finalizeIssue:It,floatSafeRemainder:j$,getElementAtPath:AE,getEnumValues:ll,getLengthableOrigin:wa,getParsedType:RE,getSizableOrigin:ba,isObject:li,isPlainObject:Ps,issue:fr,joinValues:j,jsonStringifyReplacer:P$,merge:q$,normalizeParams:T,nullish:En,numKeys:CE,omit:B$,optionalKeys:C$,partial:J$,pick:M$,prefixIssues:yt,primitiveTypes:D$,promiseAllObject:DE,propertyKeyTypes:js,randomString:dl,required:V$,stringifyPrimitive:X,unwrapMessage:Jr},Symbol.toStringTag,{value:"Module"})),W$=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,P$,2)},enumerable:!0})},ml=b("$ZodError",W$),Ui=b("$ZodError",W$,{Parent:Error});function fl(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function hl(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}function G$(t,e){const r=e||function(s){return s.message},i={errors:[]},n=(s,a=[])=>{var o,u;for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{const l=[...a,...c.path];if(l.length===0){i.errors.push(r(c));continue}let d=i,g=0;for(;g<l.length;){const p=l[g],_=g===l.length-1;typeof p=="string"?(d.properties??(d.properties={}),(o=d.properties)[p]??(o[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),_&&d.errors.push(r(c)),g++}}};return n(t),i}function Y$(t){const e=[];for(const r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function K$(t){var e;const r=[],i=[...t.issues].sort((n,s)=>n.path.length-s.path.length);for(const n of i)r.push(`✖ ${n.message}`),(e=n.path)!=null&&e.length&&r.push(` → at ${Y$(n.path)}`);return r.join(`
41
- `)}const pl=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new mr;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>It(u,s,dt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Wo=pl(Ui),vl=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>It(u,s,dt())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Go=vl(Ui),gl=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new mr;return s.issues.length?{success:!1,error:new(t??ml)(s.issues.map(a=>It(a,n,dt())))}:{success:!0,data:s.value}},X$=gl(Ui),yl=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>It(a,n,dt())))}:{success:!0,data:s.value}},H$=yl(Ui),Q$=/^[cC][^\s-]{8,}$/,eb=/^[0-9a-z]+$/,tb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nb=/^[0-9a-vA-V]{20}$/,rb=/^[A-Za-z0-9]{27}$/,ib=/^[a-zA-Z0-9_-]{21}$/,sb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ab=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,JE=hr(4),VE=hr(6),WE=hr(7),ob=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,GE=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,YE=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,KE=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,XE=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ub="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cb(){return new RegExp(ub,"u")}const lb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,db=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,mb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,fb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$l=/^[A-Za-z0-9_-]*$/,pb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,HE=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vb=/^\+(?:[0-9]){6,14}[0-9]$/,gb="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",yb=new RegExp(`^${gb}$`);function $b(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function bb(t){return new RegExp(`^${$b(t)}$`)}function wb(t){const e=$b({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${gb}T(?:${i})$`)}const _b=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},kb=/^\d+n?$/,Ib=/^\d+$/,Ob=/^-?\d+(?:\.\d+)?/i,Sb=/true|false/i,Nb=/null/i,Tb=/undefined/i,zb=/^[^A-Z]*$/,xb=/^[^a-z]*$/,Eb=Object.freeze(Object.defineProperty({__proto__:null,_emoji:ub,base64:hb,base64url:$l,bigint:kb,boolean:Sb,browserEmail:XE,cidrv4:mb,cidrv6:fb,cuid:Q$,cuid2:eb,date:yb,datetime:wb,domain:HE,duration:sb,e164:vb,email:ob,emoji:cb,extendedDuration:qE,guid:ab,hostname:pb,html5Email:GE,integer:Ib,ipv4:lb,ipv6:db,ksuid:rb,lowercase:zb,nanoid:ib,null:Nb,number:Ob,rfc5322Email:YE,string:_b,time:bb,ulid:tb,undefined:Tb,unicodeEmail:KE,uppercase:xb,uuid:hr,uuid4:JE,uuid6:VE,uuid7:WE,xid:nb},Symbol.toStringTag,{value:"Module"})),Le=b("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Ub={number:"number",bigint:"bigint",object:"date"},bl=b("$ZodCheckLessThan",(t,e)=>{Le.init(t,e);const r=Ub[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),wl=b("$ZodCheckGreaterThan",(t,e)=>{Le.init(t,e);const r=Ub[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Zb=b("$ZodCheckMultipleOf",(t,e)=>{Le.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):j$(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Pb=b("$ZodCheckNumberFormat",(t,e)=>{var r;Le.init(t,e),e.format=e.format||"float64";const i=(r=e.format)==null?void 0:r.includes("int"),n=i?"int":"number",[s,a]=R$[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=s,u.maximum=a,i&&(u.pattern=Ib)}),t._zod.check=o=>{const u=o.value;if(i){if(!Number.isInteger(u)){o.issues.push({expected:n,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}u<s&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),u>a&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inst:t})}}),jb=b("$ZodCheckBigIntFormat",(t,e)=>{Le.init(t,e);const[r,i]=L$[e.format];t._zod.onattach.push(n=>{const s=n._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i}),t._zod.check=n=>{const s=n.value;s<r&&n.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>i&&n.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inst:t})}}),Ab=b("$ZodCheckMaxSize",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;i.size<=e.maximum||r.issues.push({origin:ba(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),Db=b("$ZodCheckMinSize",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;i.size>=e.minimum||r.issues.push({origin:ba(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),Cb=b("$ZodCheckSizeEquals",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.size!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{const i=r.value,n=i.size;if(n===e.size)return;const s=n>e.size;r.issues.push({origin:ba(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:r.value,inst:t,continue:!e.abort})}}),Rb=b("$ZodCheckMaxLength",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=wa(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Lb=b("$ZodCheckMinLength",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=wa(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Mb=b("$ZodCheckLengthEquals",(t,e)=>{Le.init(t,e),t._zod.when=r=>{const i=r.value;return!En(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=wa(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Zi=b("$ZodCheckStringFormat",(t,e)=>{var r;Le.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),Bb=b("$ZodCheckRegex",(t,e)=>{Zi.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Fb=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=zb),Zi.init(t,e)}),qb=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=xb),Zi.init(t,e)}),Jb=b("$ZodCheckIncludes",(t,e)=>{Le.init(t,e);const r=Un(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),Vb=b("$ZodCheckStartsWith",(t,e)=>{Le.init(t,e);const r=new RegExp(`^${Un(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),Wb=b("$ZodCheckEndsWith",(t,e)=>{Le.init(t,e);const r=new RegExp(`.*${Un(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});function vf(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues))}const Gb=b("$ZodCheckProperty",(t,e)=>{Le.init(t,e),t._zod.check=r=>{const i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>vf(n,r,e.property));vf(i,r,e.property)}}),Yb=b("$ZodCheckMimeType",(t,e)=>{Le.init(t,e);const r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,path:["type"],inst:t})}}),Kb=b("$ZodCheckOverwrite",(t,e)=>{Le.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Xb{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
42
- `).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
43
- `))}}const Hb={major:4,minor:0,patch:0},F=b("$ZodType",(t,e)=>{var r,i;t??(t={}),se(t._zod,"id",()=>e.type+"_"+dl(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Hb;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=tr(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new mr;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=tr(a,g)))});else{if(a.issues.length===g)continue;c||(c=tr(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new mr;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=X$(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return H$(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Pi=b("$ZodString",(t,e)=>{var r;F.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??_b(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),be=b("$ZodStringFormat",(t,e)=>{Zi.init(t,e),Pi.init(t,e)}),Qb=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=ab),be.init(t,e)}),ew=b("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=hr(r))}else e.pattern??(e.pattern=hr());be.init(t,e)}),tw=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=ob),be.init(t,e)}),nw=b("$ZodURL",(t,e)=>{be.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:pb.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),rw=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=cb()),be.init(t,e)}),iw=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=ib),be.init(t,e)}),sw=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Q$),be.init(t,e)}),aw=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=eb),be.init(t,e)}),ow=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=tb),be.init(t,e)}),uw=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=nb),be.init(t,e)}),cw=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=rb),be.init(t,e)}),lw=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=wb(e)),be.init(t,e),t._zod.check}),dw=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yb),be.init(t,e)}),mw=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=bb(e)),be.init(t,e),t._zod.check}),fw=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=sb),be.init(t,e)}),hw=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=lb),be.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),pw=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=db),be.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),vw=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=mb),be.init(t,e)}),gw=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=fb),be.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function _l(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const yw=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=hb),be.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{_l(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function $w(t){if(!$l.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return _l(r)}const bw=b("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$l),be.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{$w(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),ww=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=vb),be.init(t,e)});function _w(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const kw=b("$ZodJWT",(t,e)=>{be.init(t,e),t._zod.check=r=>{_w(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),kl=b("$ZodNumber",(t,e)=>{F.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ob,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),Iw=b("$ZodNumber",(t,e)=>{Pb.init(t,e),kl.init(t,e)}),Il=b("$ZodBoolean",(t,e)=>{F.init(t,e),t._zod.pattern=Sb,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ol=b("$ZodBigInt",(t,e)=>{F.init(t,e),t._zod.pattern=kb,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),Ow=b("$ZodBigInt",(t,e)=>{jb.init(t,e),Ol.init(t,e)}),Sw=b("$ZodSymbol",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Nw=b("$ZodUndefined",(t,e)=>{F.init(t,e),t._zod.pattern=Tb,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),Tw=b("$ZodNull",(t,e)=>{F.init(t,e),t._zod.pattern=Nb,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),zw=b("$ZodAny",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),As=b("$ZodUnknown",(t,e)=>{F.init(t,e),t._zod.parse=r=>r}),xw=b("$ZodNever",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Ew=b("$ZodVoid",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),Uw=b("$ZodDate",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:t}),r}});function gf(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}const Sl=b("$ZodArray",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>gf(c,r,a))):gf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function ns(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}function yf(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...yt(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const Zw=b("$ZodObject",(t,e)=>{F.init(t,e);const r=ya(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof F))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=C$(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});se(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new Xb(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Jn(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=dl(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Jn(h);d.write(`
44
- if (${v}.issues.length) {
45
- if (input[${w}] === undefined) {
46
- if (${w} in input) {
47
- newResult[${w}] = undefined;
48
- }
49
- } else {
50
- payload.issues = payload.issues.concat(
51
- ${v}.issues.map((iss) => ({
52
- ...iss,
53
- path: iss.path ? [${w}, ...iss.path] : [${w}],
54
- }))
55
- );
56
- }
57
- } else if (${v}.value === undefined) {
58
- if (${w} in input) newResult[${w}] = undefined;
59
- } else {
60
- newResult[${w}] = ${v}.value;
61
- }
62
- `)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
63
- if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
64
- ...iss,
65
- path: iss.path ? [${Jn(h)}, ...iss.path] : [${Jn(h)}]
66
- })));`),d.write(`newResult[${Jn(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=li,a=!Zs.jitless,o=a&&A$.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?yf(ce,l,w,g):ns(ce,l,w))):J?yf(A,l,w,g):ns(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>ns(I,l,v))):ns(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function $f(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>It(s,i,dt())))}),e}const Nl=b("$ZodUnion",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),se(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>$a(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>$f(a,r,t,i)):$f(s,r,t,i)}}),Pw=b("$ZodDiscriminatedUnion",(t,e)=>{Nl.init(t,e);const r=t._zod.parse;se(t._zod,"propValues",()=>{const n={};for(const s of e.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[o,u]of Object.entries(a)){n[o]||(n[o]=new Set);for(const c of u)n[o].add(c)}}return n});const i=ya(()=>{const n=e.options,s=new Map;for(const a of n){const o=a._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const u of o){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});t._zod.parse=(n,s)=>{const a=n.value;if(!li(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),n;const o=i.value.get(a==null?void 0:a[e.discriminator]);return o?o._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),n)}}),jw=b("$ZodIntersection",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>bf(r,o,u)):bf(r,s,a)}});function Yo(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ps(t)&&Ps(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=Yo(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=Yo(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bf(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),tr(t))return t;const i=Yo(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const _a=b("$ZodTuple",(t,e)=>{F.init(t,e);const r=e.items,i=r.length-[...r].reverse().findIndex(n=>n._zod.optin!=="optional");t._zod.parse=(n,s)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[];if(!e.rest){const c=a.length>r.length,l=a.length<i-1;if(c||l)return n.issues.push({input:a,inst:t,origin:"array",...c?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let u=-1;for(const c of r){if(u++,u>=a.length&&u>=i)continue;const l=c._zod.run({value:a[u],issues:[]},s);l instanceof Promise?o.push(l.then(d=>rs(d,n,u))):rs(l,n,u)}if(e.rest){const c=a.slice(r.length);for(const l of c){u++;const d=e.rest._zod.run({value:l,issues:[]},s);d instanceof Promise?o.push(d.then(g=>rs(g,n,u))):rs(d,n,u)}}return o.length?Promise.all(o).then(()=>n):n}});function rs(t,e,r){t.issues.length&&e.issues.push(...yt(r,t.issues)),e.value[r]=t.value}const Aw=b("$ZodRecord",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Ps(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...yt(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...yt(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>It(c,i,dt())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...yt(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...yt(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Dw=b("$ZodMap",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;const s=[];r.value=new Map;for(const[a,o]of n){const u=e.keyType._zod.run({value:a,issues:[]},i),c=e.valueType._zod.run({value:o,issues:[]},i);u instanceof Promise||c instanceof Promise?s.push(Promise.all([u,c]).then(([l,d])=>{wf(l,d,r,a,n,t,i)})):wf(u,c,r,a,n,t,i)}return s.length?Promise.all(s).then(()=>r):r}});function wf(t,e,r,i,n,s,a){t.issues.length&&(js.has(typeof i)?r.issues.push(...yt(i,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:s,issues:t.issues.map(o=>It(o,a,dt()))})),e.issues.length&&(js.has(typeof i)?r.issues.push(...yt(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:i,issues:e.issues.map(o=>It(o,a,dt()))})),r.value.set(t.value,e.value)}const Cw=b("$ZodSet",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;const s=[];r.value=new Set;for(const a of n){const o=e.valueType._zod.run({value:a,issues:[]},i);o instanceof Promise?s.push(o.then(u=>_f(u,r))):_f(o,r)}return s.length?Promise.all(s).then(()=>r):r}});function _f(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}const Rw=b("$ZodEnum",(t,e)=>{F.init(t,e);const r=ll(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>js.has(typeof i)).map(i=>typeof i=="string"?Un(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),Lw=b("$ZodLiteral",(t,e)=>{F.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Un(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),Mw=b("$ZodFile",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),Tl=b("$ZodTransform",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new mr;return r.value=n,r}}),Bw=b("$ZodOptional",(t,e)=>{F.init(t,e),t._zod.optin="optional",t._zod.optout="optional",se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${$a(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),Fw=b("$ZodNullable",(t,e)=>{F.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${$a(r.source)}|null)$`):void 0}),se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),qw=b("$ZodDefault",(t,e)=>{F.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>kf(s,e)):kf(n,e)}});function kf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Jw=b("$ZodPrefault",(t,e)=>{F.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),Vw=b("$ZodNonOptional",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>If(s,t)):If(n,t)}});function If(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Ww=b("$ZodSuccess",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Gw=b("$ZodCatch",(t,e)=>{F.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>It(a,i,dt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>It(s,i,dt()))},input:r.value}),r.issues=[]),r)}}),Yw=b("$ZodNaN",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),zl=b("$ZodPipe",(t,e)=>{F.init(t,e),se(t._zod,"values",()=>e.in._zod.values),se(t._zod,"optin",()=>e.in._zod.optin),se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>Of(s,e,i)):Of(n,e,i)}});function Of(t,e,r){return tr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const Kw=b("$ZodReadonly",(t,e)=>{F.init(t,e),se(t._zod,"propValues",()=>e.innerType._zod.propValues),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Sf):Sf(n)}});function Sf(t){return t.value=Object.freeze(t.value),t}const Xw=b("$ZodTemplateLiteral",(t,e)=>{F.init(t,e);const r=[];for(const i of e.parts)if(i instanceof F){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const s=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(s,a))}else if(i===null||D$.has(typeof i))r.push(Un(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),Hw=b("$ZodPromise",(t,e)=>{F.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),Qw=b("$ZodLazy",(t,e)=>{F.init(t,e),se(t._zod,"innerType",()=>e.getter()),se(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),se(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),se(t._zod,"optin",()=>t._zod.innerType._zod.optin),se(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),e_=b("$ZodCustom",(t,e)=>{Le.init(t,e),F.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Nf(s,r,i,t));Nf(n,r,i,t)}});function Nf(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(fr(n))}}const t_=Symbol("ZodOutput"),n_=Symbol("ZodInput");class xl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function El(){return new xl}const mn=El();function r_(t,e){return new t({type:"string",...T(e)})}function i_(t,e){return new t({type:"string",coerce:!0,...T(e)})}function Ul(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function Ds(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function Zl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function Pl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function jl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function Al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function Dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function Cl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function Rl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function Ll(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function Ml(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function Bl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function Fl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function ql(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function Jl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function Vl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function Wl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function Gl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function Yl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function Kl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function Xl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function Hl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}const s_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function a_(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function o_(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function u_(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function c_(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function l_(t,e){return new t({type:"number",checks:[],...T(e)})}function d_(t,e){return new t({type:"number",coerce:!0,checks:[],...T(e)})}function m_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function f_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...T(e)})}function h_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...T(e)})}function p_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...T(e)})}function v_(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...T(e)})}function g_(t,e){return new t({type:"boolean",...T(e)})}function y_(t,e){return new t({type:"boolean",coerce:!0,...T(e)})}function $_(t,e){return new t({type:"bigint",...T(e)})}function b_(t,e){return new t({type:"bigint",coerce:!0,...T(e)})}function w_(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(e)})}function __(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(e)})}function k_(t,e){return new t({type:"symbol",...T(e)})}function I_(t,e){return new t({type:"undefined",...T(e)})}function O_(t,e){return new t({type:"null",...T(e)})}function S_(t){return new t({type:"any"})}function Cs(t){return new t({type:"unknown"})}function N_(t,e){return new t({type:"never",...T(e)})}function T_(t,e){return new t({type:"void",...T(e)})}function z_(t,e){return new t({type:"date",...T(e)})}function x_(t,e){return new t({type:"date",coerce:!0,...T(e)})}function E_(t,e){return new t({type:"nan",...T(e)})}function bn(t,e){return new bl({check:"less_than",...T(e),value:t,inclusive:!1})}function _t(t,e){return new bl({check:"less_than",...T(e),value:t,inclusive:!0})}function wn(t,e){return new wl({check:"greater_than",...T(e),value:t,inclusive:!1})}function pt(t,e){return new wl({check:"greater_than",...T(e),value:t,inclusive:!0})}function U_(t){return wn(0,t)}function Z_(t){return bn(0,t)}function P_(t){return _t(0,t)}function j_(t){return pt(0,t)}function di(t,e){return new Zb({check:"multiple_of",...T(e),value:t})}function ka(t,e){return new Ab({check:"max_size",...T(e),maximum:t})}function mi(t,e){return new Db({check:"min_size",...T(e),minimum:t})}function Ql(t,e){return new Cb({check:"size_equals",...T(e),size:t})}function Ia(t,e){return new Rb({check:"max_length",...T(e),maximum:t})}function pr(t,e){return new Lb({check:"min_length",...T(e),minimum:t})}function Oa(t,e){return new Mb({check:"length_equals",...T(e),length:t})}function ed(t,e){return new Bb({check:"string_format",format:"regex",...T(e),pattern:t})}function td(t){return new Fb({check:"string_format",format:"lowercase",...T(t)})}function nd(t){return new qb({check:"string_format",format:"uppercase",...T(t)})}function rd(t,e){return new Jb({check:"string_format",format:"includes",...T(e),includes:t})}function id(t,e){return new Vb({check:"string_format",format:"starts_with",...T(e),prefix:t})}function sd(t,e){return new Wb({check:"string_format",format:"ends_with",...T(e),suffix:t})}function A_(t,e,r){return new Gb({check:"property",property:t,schema:e,...T(r)})}function ad(t,e){return new Yb({check:"mime_type",mime:t,...T(e)})}function Zn(t){return new Kb({check:"overwrite",tx:t})}function od(t){return Zn(e=>e.normalize(t))}function ud(){return Zn(t=>t.trim())}function cd(){return Zn(t=>t.toLowerCase())}function ld(){return Zn(t=>t.toUpperCase())}function dd(t,e,r){return new t({type:"array",element:e,...T(r)})}function QE(t,e,r){return new t({type:"union",options:e,...T(r)})}function e1(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...T(i)})}function t1(t,e,r){return new t({type:"intersection",left:e,right:r})}function D_(t,e,r,i){const n=r instanceof F,s=n?i:r,a=n?r:null;return new t({type:"tuple",items:e,rest:a,...T(s)})}function n1(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...T(i)})}function r1(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...T(i)})}function i1(t,e,r){return new t({type:"set",valueType:e,...T(r)})}function s1(t,e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...T(r)})}function a1(t,e,r){return new t({type:"enum",entries:e,...T(r)})}function o1(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...T(r)})}function C_(t,e){return new t({type:"file",...T(e)})}function u1(t,e){return new t({type:"transform",transform:e})}function c1(t,e){return new t({type:"optional",innerType:e})}function l1(t,e){return new t({type:"nullable",innerType:e})}function d1(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function m1(t,e,r){return new t({type:"nonoptional",innerType:e,...T(r)})}function f1(t,e){return new t({type:"success",innerType:e})}function h1(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function p1(t,e,r){return new t({type:"pipe",in:e,out:r})}function v1(t,e){return new t({type:"readonly",innerType:e})}function g1(t,e,r){return new t({type:"template_literal",parts:e,...T(r)})}function y1(t,e){return new t({type:"lazy",getter:e})}function $1(t,e){return new t({type:"promise",innerType:e})}function R_(t,e,r){const i=T(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function L_(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function M_(t,e){const{case:r,error:i,truthy:n,falsy:s}=T(e);let a=n??["true","1","yes","on","y","enabled"],o=s??["false","0","no","off","n","disabled"];r!=="sensitive"&&(a=a.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));const u=new Set(a),c=new Set(o),l=t.Pipe??zl,d=t.Boolean??Il,g=t.String??Pi,p=t.Transform??Tl,_=new p({type:"transform",transform:(m,h)=>{let v=m;return r!=="sensitive"&&(v=v.toLowerCase()),u.has(v)?!0:c.has(v)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...u,...c],input:h.value,inst:_}),{})},error:i}),k=new l({type:"pipe",in:new g({type:"string",error:i}),out:_,error:i});return new l({type:"pipe",in:k,out:new d({type:"boolean",error:i}),error:i})}const md=b("ZodISODateTime",(t,e)=>{lw.init(t,e),ke.init(t,e)});function B_(t){return a_(md,t)}const fd=b("ZodISODate",(t,e)=>{dw.init(t,e),ke.init(t,e)});function F_(t){return o_(fd,t)}const hd=b("ZodISOTime",(t,e)=>{mw.init(t,e),ke.init(t,e)});function q_(t){return u_(hd,t)}const pd=b("ZodISODuration",(t,e)=>{fw.init(t,e),ke.init(t,e)});function J_(t){return c_(pd,t)}const b1=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,date:F_,datetime:B_,duration:J_,time:q_},Symbol.toStringTag,{value:"Module"})),V_=(t,e)=>{ml.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>hl(t,r)},flatten:{value:r=>fl(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},w1=b("ZodError",V_),ji=b("ZodError",V_,{Parent:Error}),W_=pl(ji),G_=vl(ji),Y_=gl(ji),K_=yl(ji),te=b("ZodType",(t,e)=>(F.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>At(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>W_(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>Y_(t,r,i),t.parseAsync=async(r,i)=>G_(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>K_(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(Zk(r,i)),t.superRefine=r=>t.check(Pk(r)),t.overwrite=r=>t.check(Zn(r)),t.optional=()=>Ls(t),t.nullable=()=>Ms(t),t.nullish=()=>Ls(Ms(t)),t.nonoptional=r=>wk(t,r),t.array=()=>Ai(t),t.or=r=>Ue([t,r]),t.and=r=>ck(t,r),t.transform=r=>Bs(t,Md(r)),t.default=r=>yk(t,r),t.prefault=r=>bk(t,r),t.catch=r=>Ik(t,r),t.pipe=r=>Bs(t,r),t.readonly=()=>Nk(t),t.describe=r=>{const i=t.clone();return mn.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=mn.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return mn.get(t);const i=t.clone();return mn.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),vd=b("_ZodString",(t,e)=>{Pi.init(t,e),te.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(ed(...i)),t.includes=(...i)=>t.check(rd(...i)),t.startsWith=(...i)=>t.check(id(...i)),t.endsWith=(...i)=>t.check(sd(...i)),t.min=(...i)=>t.check(pr(...i)),t.max=(...i)=>t.check(Ia(...i)),t.length=(...i)=>t.check(Oa(...i)),t.nonempty=(...i)=>t.check(pr(1,...i)),t.lowercase=i=>t.check(td(i)),t.uppercase=i=>t.check(nd(i)),t.trim=()=>t.check(ud()),t.normalize=(...i)=>t.check(od(...i)),t.toLowerCase=()=>t.check(cd()),t.toUpperCase=()=>t.check(ld())}),Sa=b("ZodString",(t,e)=>{Pi.init(t,e),vd.init(t,e),t.email=r=>t.check(Ul(gd,r)),t.url=r=>t.check(Dl(yd,r)),t.jwt=r=>t.check(Hl(Zd,r)),t.emoji=r=>t.check(Cl($d,r)),t.guid=r=>t.check(Ds(Rs,r)),t.uuid=r=>t.check(Zl(qt,r)),t.uuidv4=r=>t.check(Pl(qt,r)),t.uuidv6=r=>t.check(jl(qt,r)),t.uuidv7=r=>t.check(Al(qt,r)),t.nanoid=r=>t.check(Rl(bd,r)),t.guid=r=>t.check(Ds(Rs,r)),t.cuid=r=>t.check(Ll(wd,r)),t.cuid2=r=>t.check(Ml(_d,r)),t.ulid=r=>t.check(Bl(kd,r)),t.base64=r=>t.check(Yl(xd,r)),t.base64url=r=>t.check(Kl(Ed,r)),t.xid=r=>t.check(Fl(Id,r)),t.ksuid=r=>t.check(ql(Od,r)),t.ipv4=r=>t.check(Jl(Sd,r)),t.ipv6=r=>t.check(Vl(Nd,r)),t.cidrv4=r=>t.check(Wl(Td,r)),t.cidrv6=r=>t.check(Gl(zd,r)),t.e164=r=>t.check(Xl(Ud,r)),t.datetime=r=>t.check(B_(r)),t.date=r=>t.check(F_(r)),t.time=r=>t.check(q_(r)),t.duration=r=>t.check(J_(r))});function Te(t){return r_(Sa,t)}const ke=b("ZodStringFormat",(t,e)=>{be.init(t,e),vd.init(t,e)}),gd=b("ZodEmail",(t,e)=>{tw.init(t,e),ke.init(t,e)});function _1(t){return Ul(gd,t)}const Rs=b("ZodGUID",(t,e)=>{Qb.init(t,e),ke.init(t,e)});function k1(t){return Ds(Rs,t)}const qt=b("ZodUUID",(t,e)=>{ew.init(t,e),ke.init(t,e)});function I1(t){return Zl(qt,t)}function O1(t){return Pl(qt,t)}function S1(t){return jl(qt,t)}function N1(t){return Al(qt,t)}const yd=b("ZodURL",(t,e)=>{nw.init(t,e),ke.init(t,e)});function T1(t){return Dl(yd,t)}const $d=b("ZodEmoji",(t,e)=>{rw.init(t,e),ke.init(t,e)});function z1(t){return Cl($d,t)}const bd=b("ZodNanoID",(t,e)=>{iw.init(t,e),ke.init(t,e)});function x1(t){return Rl(bd,t)}const wd=b("ZodCUID",(t,e)=>{sw.init(t,e),ke.init(t,e)});function E1(t){return Ll(wd,t)}const _d=b("ZodCUID2",(t,e)=>{aw.init(t,e),ke.init(t,e)});function U1(t){return Ml(_d,t)}const kd=b("ZodULID",(t,e)=>{ow.init(t,e),ke.init(t,e)});function Z1(t){return Bl(kd,t)}const Id=b("ZodXID",(t,e)=>{uw.init(t,e),ke.init(t,e)});function P1(t){return Fl(Id,t)}const Od=b("ZodKSUID",(t,e)=>{cw.init(t,e),ke.init(t,e)});function j1(t){return ql(Od,t)}const Sd=b("ZodIPv4",(t,e)=>{hw.init(t,e),ke.init(t,e)});function A1(t){return Jl(Sd,t)}const Nd=b("ZodIPv6",(t,e)=>{pw.init(t,e),ke.init(t,e)});function D1(t){return Vl(Nd,t)}const Td=b("ZodCIDRv4",(t,e)=>{vw.init(t,e),ke.init(t,e)});function C1(t){return Wl(Td,t)}const zd=b("ZodCIDRv6",(t,e)=>{gw.init(t,e),ke.init(t,e)});function R1(t){return Gl(zd,t)}const xd=b("ZodBase64",(t,e)=>{yw.init(t,e),ke.init(t,e)});function L1(t){return Yl(xd,t)}const Ed=b("ZodBase64URL",(t,e)=>{bw.init(t,e),ke.init(t,e)});function M1(t){return Kl(Ed,t)}const Ud=b("ZodE164",(t,e)=>{ww.init(t,e),ke.init(t,e)});function B1(t){return Xl(Ud,t)}const Zd=b("ZodJWT",(t,e)=>{kw.init(t,e),ke.init(t,e)});function F1(t){return Hl(Zd,t)}const Na=b("ZodNumber",(t,e)=>{kl.init(t,e),te.init(t,e),t.gt=(i,n)=>t.check(wn(i,n)),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.lt=(i,n)=>t.check(bn(i,n)),t.lte=(i,n)=>t.check(_t(i,n)),t.max=(i,n)=>t.check(_t(i,n)),t.int=i=>t.check(Ko(i)),t.safe=i=>t.check(Ko(i)),t.positive=i=>t.check(wn(0,i)),t.nonnegative=i=>t.check(pt(0,i)),t.negative=i=>t.check(bn(0,i)),t.nonpositive=i=>t.check(_t(0,i)),t.multipleOf=(i,n)=>t.check(di(i,n)),t.step=(i,n)=>t.check(di(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Q(t){return l_(Na,t)}const Nr=b("ZodNumberFormat",(t,e)=>{Iw.init(t,e),Na.init(t,e)});function Ko(t){return m_(Nr,t)}function q1(t){return f_(Nr,t)}function J1(t){return h_(Nr,t)}function V1(t){return p_(Nr,t)}function W1(t){return v_(Nr,t)}const Ta=b("ZodBoolean",(t,e)=>{Il.init(t,e),te.init(t,e)});function Pd(t){return g_(Ta,t)}const za=b("ZodBigInt",(t,e)=>{Ol.init(t,e),te.init(t,e),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.gt=(i,n)=>t.check(wn(i,n)),t.gte=(i,n)=>t.check(pt(i,n)),t.min=(i,n)=>t.check(pt(i,n)),t.lt=(i,n)=>t.check(bn(i,n)),t.lte=(i,n)=>t.check(_t(i,n)),t.max=(i,n)=>t.check(_t(i,n)),t.positive=i=>t.check(wn(BigInt(0),i)),t.negative=i=>t.check(bn(BigInt(0),i)),t.nonpositive=i=>t.check(_t(BigInt(0),i)),t.nonnegative=i=>t.check(pt(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(di(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function _n(t){return $_(za,t)}const jd=b("ZodBigIntFormat",(t,e)=>{Ow.init(t,e),za.init(t,e)});function G1(t){return w_(jd,t)}function Y1(t){return __(jd,t)}const X_=b("ZodSymbol",(t,e)=>{Sw.init(t,e),te.init(t,e)});function H_(t){return k_(X_,t)}const Q_=b("ZodUndefined",(t,e)=>{Nw.init(t,e),te.init(t,e)});function ek(t){return I_(Q_,t)}const tk=b("ZodNull",(t,e)=>{Tw.init(t,e),te.init(t,e)});function Ad(t){return O_(tk,t)}const nk=b("ZodAny",(t,e)=>{zw.init(t,e),te.init(t,e)});function K1(){return S_(nk)}const rk=b("ZodUnknown",(t,e)=>{As.init(t,e),te.init(t,e)});function vr(){return Cs(rk)}const ik=b("ZodNever",(t,e)=>{xw.init(t,e),te.init(t,e)});function xa(t){return N_(ik,t)}const sk=b("ZodVoid",(t,e)=>{Ew.init(t,e),te.init(t,e)});function X1(t){return T_(sk,t)}const Dd=b("ZodDate",(t,e)=>{Uw.init(t,e),te.init(t,e),t.min=(i,n)=>t.check(pt(i,n)),t.max=(i,n)=>t.check(_t(i,n));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function H1(t){return z_(Dd,t)}const ak=b("ZodArray",(t,e)=>{Sl.init(t,e),te.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(pr(r,i)),t.nonempty=r=>t.check(pr(1,r)),t.max=(r,i)=>t.check(Ia(r,i)),t.length=(r,i)=>t.check(Oa(r,i)),t.unwrap=()=>t.element});function Ai(t,e){return dd(ak,t,e)}function Q1(t){const e=t._zod.def.shape;return hk(Object.keys(e))}const Ea=b("ZodObject",(t,e)=>{Zw.init(t,e),te.init(t,e),se(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Ke(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:vr()}),t.loose=()=>t.clone({...t._zod.def,catchall:vr()}),t.strict=()=>t.clone({...t._zod.def,catchall:xa()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>F$(t,r),t.merge=r=>q$(t,r),t.pick=r=>M$(t,r),t.omit=r=>B$(t,r),t.partial=(...r)=>J$(Bd,t,r[0]),t.required=(...r)=>V$(Fd,t,r[0])});function pe(t,e){const r={type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},...T(e)};return new Ea(r)}function eU(t,e){return new Ea({type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},catchall:xa(),...T(e)})}function tU(t,e){return new Ea({type:"object",get shape(){return Sr(this,"shape",{...t}),this.shape},catchall:vr(),...T(e)})}const Cd=b("ZodUnion",(t,e)=>{Nl.init(t,e),te.init(t,e),t.options=e.options});function Ue(t,e){return new Cd({type:"union",options:t,...T(e)})}const ok=b("ZodDiscriminatedUnion",(t,e)=>{Cd.init(t,e),Pw.init(t,e)});function nU(t,e,r){return new ok({type:"union",options:e,discriminator:t,...T(r)})}const uk=b("ZodIntersection",(t,e)=>{jw.init(t,e),te.init(t,e)});function ck(t,e){return new uk({type:"intersection",left:t,right:e})}const lk=b("ZodTuple",(t,e)=>{_a.init(t,e),te.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Tr(t,e,r){const i=e instanceof F,n=i?r:e,s=i?e:null;return new lk({type:"tuple",items:t,rest:s,...T(n)})}const Rd=b("ZodRecord",(t,e)=>{Aw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ua(t,e,r){return new Rd({type:"record",keyType:t,valueType:e,...T(r)})}function rU(t,e,r){return new Rd({type:"record",keyType:Ue([t,xa()]),valueType:e,...T(r)})}const dk=b("ZodMap",(t,e)=>{Dw.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function iU(t,e,r){return new dk({type:"map",keyType:t,valueType:e,...T(r)})}const mk=b("ZodSet",(t,e)=>{Cw.init(t,e),te.init(t,e),t.min=(...r)=>t.check(mi(...r)),t.nonempty=r=>t.check(mi(1,r)),t.max=(...r)=>t.check(ka(...r)),t.size=(...r)=>t.check(Ql(...r))});function sU(t,e){return new mk({type:"set",valueType:t,...T(e)})}const fi=b("ZodEnum",(t,e)=>{Rw.init(t,e),te.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...e,checks:[],...T(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...e,checks:[],...T(n),entries:s})}});function Ke(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new fi({type:"enum",entries:r,...T(e)})}function aU(t,e){return new fi({type:"enum",entries:t,...T(e)})}const fk=b("ZodLiteral",(t,e)=>{Lw.init(t,e),te.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function hk(t,e){return new fk({type:"literal",values:Array.isArray(t)?t:[t],...T(e)})}const pk=b("ZodFile",(t,e)=>{Mw.init(t,e),te.init(t,e),t.min=(r,i)=>t.check(mi(r,i)),t.max=(r,i)=>t.check(ka(r,i)),t.mime=(r,i)=>t.check(ad(Array.isArray(r)?r:[r],i))});function oU(t){return C_(pk,t)}const Ld=b("ZodTransform",(t,e)=>{Tl.init(t,e),te.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(fr(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(fr(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Md(t){return new Ld({type:"transform",transform:t})}const Bd=b("ZodOptional",(t,e)=>{Bw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ls(t){return new Bd({type:"optional",innerType:t})}const vk=b("ZodNullable",(t,e)=>{Fw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ms(t){return new vk({type:"nullable",innerType:t})}function uU(t){return Ls(Ms(t))}const gk=b("ZodDefault",(t,e)=>{qw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yk(t,e){return new gk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const $k=b("ZodPrefault",(t,e)=>{Jw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function bk(t,e){return new $k({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Fd=b("ZodNonOptional",(t,e)=>{Vw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function wk(t,e){return new Fd({type:"nonoptional",innerType:t,...T(e)})}const _k=b("ZodSuccess",(t,e)=>{Ww.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cU(t){return new _k({type:"success",innerType:t})}const kk=b("ZodCatch",(t,e)=>{Gw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ik(t,e){return new kk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Ok=b("ZodNaN",(t,e)=>{Yw.init(t,e),te.init(t,e)});function lU(t){return E_(Ok,t)}const qd=b("ZodPipe",(t,e)=>{zl.init(t,e),te.init(t,e),t.in=e.in,t.out=e.out});function Bs(t,e){return new qd({type:"pipe",in:t,out:e})}const Sk=b("ZodReadonly",(t,e)=>{Kw.init(t,e),te.init(t,e)});function Nk(t){return new Sk({type:"readonly",innerType:t})}const Tk=b("ZodTemplateLiteral",(t,e)=>{Xw.init(t,e),te.init(t,e)});function dU(t,e){return new Tk({type:"template_literal",parts:t,...T(e)})}const zk=b("ZodLazy",(t,e)=>{Qw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.getter()});function xk(t){return new zk({type:"lazy",getter:t})}const Ek=b("ZodPromise",(t,e)=>{Hw.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mU(t){return new Ek({type:"promise",innerType:t})}const Za=b("ZodCustom",(t,e)=>{e_.init(t,e),te.init(t,e)});function Uk(t,e){const r=new Le({check:"custom",...T(e)});return r._zod.check=t,r}function fU(t,e){return R_(Za,t??(()=>!0),e)}function Zk(t,e={}){return L_(Za,t,e)}function Pk(t,e){const r=Uk(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(fr(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(fr(s))}},t(i.value,i)),e);return r}function ye(t,e={error:`Input not instance of ${t.name}`}){const r=new Za({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...T(e)});return r._zod.bag.Class=t,r}const hU=(...t)=>M_({Pipe:qd,Boolean:Ta,String:Sa,Transform:Ld},...t);function pU(t){const e=xk(()=>Ue([Te(t),Q(),Pd(),Ad(),Ai(e),Ua(Te(),e)]));return e}function vU(t,e){return Bs(Md(t),e)}const Pa=Tr([Q(),Q()]);Tr([_n(),_n()]);const jk=pe({width:Q(),height:Q()}),gU=pe({signedWidth:Q(),signedHeight:Q()}),yU=["width","height"];Ke(yU);const $U=["start","center","end"],bU=["signedWidth","signedHeight"];Ke(bU);const Fs=pe({x:Q(),y:Q()}),wU=pe({clientX:Q(),clientY:Q()}),_U=["x","y"],Ak=Ke(_U),Dk=["top","right","bottom","left"];Ke(Dk);const kU=["left","right"],Ck=Ke(kU),IU=["top","bottom"],Rk=Ke(IU),Lk=["center"],Tf=Ke(Lk),OU=[...Dk,...Lk],Mk=Ke(OU);Ke($U);const SU=["first","last"];Ke(SU);const NU=pe({lower:Q(),upper:Q()}),TU=pe({lower:_n(),upper:_n()});Ue([NU,Pa]);Ue([TU,Pa]);Ke([...Ak.options,...Mk.options]);Ue([Ak,Mk,ye(String)]);const zU=t=>typeof t=="bigint"||t instanceof BigInt,Mn=(t,e)=>zU(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),hn=(t,e,r)=>{const i={};if(typeof e=="object"&&(r=e,e=void 0),r={makeValid:!0,...r},typeof t=="number"||typeof t=="bigint")e!=null?(i.lower=t,i.upper=e):(i.lower=typeof t=="bigint"?0n:0,i.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[i.lower,i.upper]=t}else i.lower=t.lower,i.upper=t.upper;return r!=null&&r.makeValid?xU(i):i},xU=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,zf=(t,e)=>{const r=hn(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e};pe({x:Ck.or(Tf),y:Rk.or(Tf)});const EU=pe({x:Ck,y:Rk}),UU=Object.freeze({x:"left",y:"top"}),ZU=(t,e)=>t.x===e.x&&t.y===e.y,xf=Ue([Q(),Fs,Pa,jk,gU,wU]),PU=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},Ef=Object.freeze({x:0,y:0}),is=Ue([Q(),Te()]);pe({top:is,left:is,width:is,height:is});pe({left:Q(),top:Q(),right:Q(),bottom:Q()});pe({one:Fs,two:Fs,root:EU});const Jd=(t,e,r=0,i=0,n)=>{const s={one:{...Ef},two:{...Ef},root:n??UU};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+i},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:n??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+i}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},mo=t=>{const e=Jd(t);return{lower:e.one.x,upper:e.two.x}},fo=t=>{const e=Jd(t);return{lower:e.one.y,upper:e.two.y}},jU=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,AU=pe({signedWidth:Q(),signedHeight:Q()});Ue([jk,AU,Fs,Pa]);var DU=Object.defineProperty,CU=(t,e,r)=>e in t?DU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jt=(t,e,r)=>CU(t,typeof e!="symbol"?e+"":e,r);const RU=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t;pe({offset:xf,scale:xf});pe({offset:Q(),scale:Q()});const LU=t=>(e,r,i,n)=>r==="dimension"?[e,i]:[e,n?i-t:i+t],MU=t=>(e,r,i,n)=>[e,n?i/t:i*t],BU=t=>(e,r,i)=>{if(e===null)return[t,i];const{lower:n,upper:s}=e,{lower:a,upper:o}=t,u=s-n,c=o-a;if(r==="dimension")return[t,i*(c/u)];const l=(i-n)*(c/u)+a;return[t,l]},FU=t=>(e,r,i)=>[t,i],qU=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:i,upper:n}=t;return[t,n-(r-i)]},JU=t=>(e,r,i)=>{const{lower:n,upper:s}=t;return i=RU(i,n,s),[e,i]},Xo=class Vr{constructor(){Jt(this,"ops",[]),Jt(this,"currBounds",null),Jt(this,"currType",null),Jt(this,"reversed",!1),this.ops=[]}static translate(e){return new Vr().translate(e)}static magnify(e){return new Vr().magnify(e)}static scale(e,r){return new Vr().scale(e,r)}translate(e){const r=this.new(),i=LU(e);return i.type="translate",r.ops.push(i),r}magnify(e){const r=this.new(),i=MU(e);return i.type="magnify",r.ops.push(i),r}scale(e,r){const i=hn(e,r),n=this.new(),s=BU(i);return s.type="scale",n.ops.push(s),n}clamp(e,r){const i=hn(e,r),n=this.new(),s=JU(i);return s.type="clamp",n.ops.push(s),n}reBound(e,r){const i=hn(e,r),n=this.new(),s=FU(i);return s.type="re-bound",n.ops.push(s),n}invert(){const e=qU();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Vr;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([i,n],s)=>s(i,e,n,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((i,n)=>{if(i.type==="scale"||r.some(([a,o])=>n>=a&&n<=o))return;const s=e.ops.findIndex((a,o)=>a.type==="scale"&&o>n);s!==-1&&r.push([n,s])}),r.forEach(([i,n])=>{const s=e.ops.slice(i,n);s.unshift(e.ops[n]),e.ops.splice(i,n-i+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};Jt(Xo,"IDENTITY",new Xo);let Uf=Xo;const Zf=class Lt{constructor(e=new Uf,r=new Uf,i=null){Jt(this,"x"),Jt(this,"y"),Jt(this,"currRoot"),this.x=e,this.y=r,this.currRoot=i}static translate(e,r){return new Lt().translate(e,r)}static translateX(e){return new Lt().translateX(e)}static translateY(e){return new Lt().translateY(e)}static clamp(e){return new Lt().clamp(e)}static magnify(e){return new Lt().magnify(e)}static scale(e){return new Lt().scale(e)}static reBound(e){return new Lt().reBound(e)}translate(e,r){const i=PU(e,r),n=this.copy();return n.x=this.x.translate(i.x),n.y=this.y.translate(i.y),n}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(jU(e)){const i=this.currRoot;return r.currRoot=e.root,i!=null&&!ZU(i,e.root)&&(i.x!==e.root.x&&(r.x=r.x.invert()),i.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(mo(e)),r.y=r.y.scale(fo(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(mo(e)),r.y=this.y.reBound(fo(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(mo(e)),r.y=this.y.clamp(fo(e)),r}copy(){const e=new Lt;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return Jd(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};Jt(Zf,"IDENTITY",new Zf);var VU=Object.defineProperty,WU=(t,e,r)=>e in t?VU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e,r)=>WU(t,typeof e!="symbol"?e+"":e,r);function GU(t){return i_(Sa,t)}function YU(t){return d_(Na,t)}function KU(t){return y_(Ta,t)}function Bk(t){return b_(za,t)}function XU(t){return x_(Dd,t)}const HU=Object.freeze(Object.defineProperty({__proto__:null,bigint:Bk,boolean:KU,date:XU,number:YU,string:GU},Symbol.toStringTag,{value:"Module"}));let QU=(t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i};const eZ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",tZ=QU(eZ,11),nZ=()=>tZ(),rZ=(t,e)=>r=>r instanceof e||typeof r=="object"&&r!==null&&"discriminator"in r&&r.discriminator===t,iZ=Ke(["static","dynamic"]),Fk=(t,e)=>{const r=new ve(e);if(![oe.DAY,oe.HOUR,oe.MINUTE,oe.SECOND,oe.MILLISECOND,oe.MICROSECOND,oe.NANOSECOND].some(n=>n.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const i=t.valueOf()%r.valueOf();return t instanceof ve?new ve(i):new oe(i)},me=class L extends Or{constructor(e,r="UTC"){if(e==null)super(L.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*L.MILLISECOND.valueOf());else if(typeof e=="string")super(L.parseDateTimeString(e,r).valueOf());else if(Array.isArray(e))super(L.parseDate(e));else{let i=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(i=L.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=L.MAX:e=L.MIN)),super(BigInt(e.valueOf())+i)}}static parseDate([e=1970,r=1,i=1]){const n=new Date(e,r-1,i,0,0,0,0);return new L(BigInt(n.getTime())*L.MILLISECOND.valueOf()).truncate(L.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[i,n,s]=e.split(":");let a="00",o="00";s!=null&&([a,o]=s.split("."));let u=L.hours(parseInt(i??"00")).add(L.minutes(parseInt(n??"00"))).add(L.seconds(parseInt(a??"00"))).add(L.milliseconds(parseInt(o??"00")));return r==="local"&&(u=u.add(L.utcOffset)),u.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return L.parseTimeString(e,r);const i=new Date(e);return e.includes(":")||i.setUTCHours(0,0,0,0),new L(BigInt(i.getTime())*L.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(L.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const i=this.toISOString(r);return e?i.slice(11,23):i.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),i=e.toLocaleString("default",{day:"numeric"});return`${r} ${i}`}static get utcOffset(){return new oe(BigInt(new Date().getTimezoneOffset())*L.MINUTE.valueOf())}static since(e){return new L().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new L(e).valueOf()}span(e){return this.range(e).span}range(e){return new Qr(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new L(e).valueOf()}afterEq(e){return this.valueOf()>=new L(e).valueOf()}before(e){return this.valueOf()<new L(e).valueOf()}beforeEq(e){return this.valueOf()<=new L(e).valueOf()}add(e){return new L(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new L(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(oe.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(oe.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(oe.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(oe.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(L.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(L.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const r=this.date();return r.setUTCFullYear(e),new L(r)}get month(){return this.date().getUTCMonth()}setMonth(e){const r=this.date();return r.setUTCMonth(e),new L(r)}get day(){return this.date().getUTCDate()}setDay(e){const r=this.date();return r.setUTCDate(e),new L(r)}get hour(){return this.date().getUTCHours()}setHour(e){const r=this.date();return r.setUTCHours(e),new L(r,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const r=this.date();return r.setUTCMinutes(e),new L(r)}get second(){return this.date().getUTCSeconds()}setSecond(e){const r=this.date();return r.setUTCSeconds(e),new L(r)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const r=this.date();return r.setUTCMilliseconds(e),new L(r)}toString(){return this.date().toISOString()}remainder(e){return Fk(this,e)}get isToday(){return this.truncate(oe.DAY).equals(L.now().truncate(oe.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new L(new Date)}static max(...e){let r=L.MIN;for(const i of e){const n=new L(i);n.after(r)&&(r=n)}return r}static min(...e){let r=L.MAX;for(const i of e){const n=new L(i);n.before(r)&&(r=n)}return r}static nanoseconds(e,r="UTC"){return new L(e,r)}static microseconds(e,r="UTC"){return L.nanoseconds(e*1e3,r)}static milliseconds(e,r="UTC"){return L.microseconds(e*1e3,r)}static seconds(e,r="UTC"){return L.milliseconds(e*1e3,r)}static minutes(e,r="UTC"){return L.seconds(e*60,r)}static hours(e,r="UTC"){return L.minutes(e*60,r)}static days(e,r="UTC"){return L.hours(e*24,r)}};U(me,"NANOSECOND",me.nanoseconds(1)),U(me,"MICROSECOND",me.microseconds(1)),U(me,"MILLISECOND",me.milliseconds(1)),U(me,"SECOND",me.seconds(1)),U(me,"MINUTE",me.minutes(1)),U(me,"HOUR",me.hours(1)),U(me,"DAY",me.days(1)),U(me,"MAX",new me((1n<<63n)-1n)),U(me,"MIN",new me(0)),U(me,"ZERO",new me(0)),U(me,"z",Ue([pe({value:_n()}).transform(t=>new me(t.value)),Te().transform(t=>new me(BigInt(t))),ye(Number).transform(t=>new me(t)),Q().transform(t=>new me(t)),ye(me)]));let ve=me;const fe=class Y extends Or{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof Y?e:e instanceof Pf?e.period:e instanceof ve?new Y(e):["number","bigint"].includes(typeof e)?Y.seconds(e):new Y(e)}static fromMilliseconds(e){return e instanceof Y?e:e instanceof Pf?e.period:e instanceof ve?new Y(e):["number","bigint"].includes(typeof e)?Y.milliseconds(e):new Y(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new Y(e).valueOf()}greaterThan(e){return this.valueOf()>new Y(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new Y(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new Y(e).valueOf()}remainder(e){return Fk(this,e)}truncate(e){return new Y(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(Y.DAY),r=this.truncate(Y.HOUR),i=this.truncate(Y.MINUTE),n=this.truncate(Y.SECOND),s=this.truncate(Y.MILLISECOND),a=this.truncate(Y.MICROSECOND),o=this.truncate(Y.NANOSECOND),u=e,c=r.sub(e),l=i.sub(r),d=n.sub(i),g=s.sub(n),p=a.sub(s),_=o.sub(a);let k="";return u.isZero||(k+=`${u.days}d `),c.isZero||(k+=`${c.hours}h `),l.isZero||(k+=`${l.minutes}m `),d.isZero||(k+=`${d.seconds}s `),g.isZero||(k+=`${g.milliseconds}ms `),p.isZero||(k+=`${p.microseconds}µs `),_.isZero||(k+=`${_.nanoseconds}ns`),k.trim()}mult(e){return new Y(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(Y.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(Y.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(Y.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(Y.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(Y.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(Y.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new Y(e).valueOf()}add(e){return new Y(this.valueOf()+new Y(e).valueOf())}sub(e){return new Y(this.valueOf()-new Y(e).valueOf())}static nanoseconds(e=1){return new Y(e)}static microseconds(e=1){return Y.nanoseconds(Mn(e,1e3))}static milliseconds(e=1){return Y.microseconds(Mn(e,1e3))}static seconds(e=1){return Y.milliseconds(Mn(e,1e3))}static minutes(e=1){return Y.seconds(Mn(e,60))}static hours(e){return Y.minutes(Mn(e,60))}static days(e){return Y.hours(Mn(e,24))}};U(fe,"NANOSECOND",fe.nanoseconds(1)),U(fe,"MICROSECOND",fe.microseconds(1)),U(fe,"MILLISECOND",fe.milliseconds(1)),U(fe,"SECOND",fe.seconds(1)),U(fe,"MINUTE",fe.minutes(1)),U(fe,"HOUR",fe.hours(1)),U(fe,"DAY",fe.days(1)),U(fe,"MAX",new fe((1n<<63n)-1n)),U(fe,"MIN",new fe(0)),U(fe,"ZERO",new fe(0)),U(fe,"z",Ue([pe({value:_n()}).transform(t=>new fe(t.value)),Te().transform(t=>new fe(BigInt(t))),ye(Number).transform(t=>new fe(t)),Q().transform(t=>new fe(t)),ye(fe)]));let oe=fe;const Wr=class $s extends Or{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new $s(e).valueOf()}get period(){return oe.seconds(1/this.valueOf())}sampleCount(e){return new oe(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new ut(r).valueOf()}span(e){return oe.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new $s(e)}static khz(e){return $s.hz(e*1e3)}};U(Wr,"z",Ue([Q().transform(t=>new Wr(t)),ye(Number).transform(t=>new Wr(t)),ye(Wr)]));let Pf=Wr;const et=class extends Or{constructor(t){super(t.valueOf())}length(t){return t.valueOf()/this.valueOf()}size(t){return new Ho(t*this.valueOf())}};U(et,"UNKNOWN",new et(0)),U(et,"BIT128",new et(16)),U(et,"BIT64",new et(8)),U(et,"BIT32",new et(4)),U(et,"BIT16",new et(2)),U(et,"BIT8",new et(1)),U(et,"z",Ue([Q().transform(t=>new et(t)),ye(Number).transform(t=>new et(t)),ye(et)]));let ut=et;const Tt=class Gr{constructor(e,r){U(this,"start"),U(this,"end"),typeof e=="object"&&"start"in e?(this.start=new ve(e.start),this.end=new ve(e.end)):(this.start=new ve(e),this.end=new ve(r))}get span(){return new oe(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new Gr(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,r=oe.ZERO){if(r.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let i=this.start.sub(e.start).valueOf(),n=this.end.sub(e.end).valueOf();return i<0&&(i=-i),n<0&&(n=-n),i<=r.valueOf()&&n<=r.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=oe.ZERO){e=e.makeValid();const i=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(i.start)||i.end.equals(e.start))return!1;const n=ve.max(i.start,e.start),s=ve.min(i.end,e.end);return s.before(n)?!1:new oe(s.sub(n)).greaterThanOrEqual(r)}contains(e){return e instanceof Gr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new Gr(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}static max(...e){return new Gr(ve.min(...e.map(r=>r.start)),ve.max(...e.map(r=>r.end)))}};U(Tt,"MAX",new Tt(ve.MIN,ve.MAX)),U(Tt,"MIN",new Tt(ve.MAX,ve.MIN)),U(Tt,"ZERO",new Tt(ve.ZERO,ve.ZERO)),U(Tt,"z",Ue([pe({start:ve.z,end:ve.z}).transform(t=>new Tt(t.start,t.end)),ye(Tt)]));let Qr=Tt;const E=class Pe extends Or{constructor(e){if(e instanceof Pe||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const r=Pe.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r==null)throw new Error(`unable to find data type for ${e.toString()}`);super(r.valueOf())}}get Array(){const e=Pe.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(r=>this.equals(r))}toString(){return this.valueOf()}get isVariable(){return this.equals(Pe.JSON)||this.equals(Pe.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Pe.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Pe.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(Pe.UINT8)||this.equals(Pe.UINT16)||this.equals(Pe.UINT32)||this.equals(Pe.UINT64)}get isSignedInteger(){return this.equals(Pe.INT8)||this.equals(Pe.INT16)||this.equals(Pe.INT32)||this.equals(Pe.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(Pe.INT32)&&e.equals(Pe.FLOAT64)||this.equals(Pe.INT8)&&e.equals(Pe.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return Pe.BIG_INT_TYPES.some(e=>e.equals(this))}};U(E,"UNKNOWN",new E("unknown")),U(E,"FLOAT64",new E("float64")),U(E,"FLOAT32",new E("float32")),U(E,"INT64",new E("int64")),U(E,"INT32",new E("int32")),U(E,"INT16",new E("int16")),U(E,"INT8",new E("int8")),U(E,"UINT64",new E("uint64")),U(E,"UINT32",new E("uint32")),U(E,"UINT16",new E("uint16")),U(E,"UINT8",new E("uint8")),U(E,"BOOLEAN",E.UINT8),U(E,"TIMESTAMP",new E("timestamp")),U(E,"UUID",new E("uuid")),U(E,"STRING",new E("string")),U(E,"JSON",new E("json")),U(E,"ARRAY_CONSTRUCTORS",new Map([[E.UINT8.toString(),Uint8Array],[E.UINT16.toString(),Uint16Array],[E.UINT32.toString(),Uint32Array],[E.UINT64.toString(),BigUint64Array],[E.FLOAT32.toString(),Float32Array],[E.FLOAT64.toString(),Float64Array],[E.INT8.toString(),Int8Array],[E.INT16.toString(),Int16Array],[E.INT32.toString(),Int32Array],[E.INT64.toString(),BigInt64Array],[E.TIMESTAMP.toString(),BigInt64Array],[E.STRING.toString(),Uint8Array],[E.JSON.toString(),Uint8Array],[E.UUID.toString(),Uint8Array]])),U(E,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,E.UINT8],[Uint16Array.name,E.UINT16],[Uint32Array.name,E.UINT32],[BigUint64Array.name,E.UINT64],[Float32Array.name,E.FLOAT32],[Float64Array.name,E.FLOAT64],[Int8Array.name,E.INT8],[Int16Array.name,E.INT16],[Int32Array.name,E.INT32],[BigInt64Array.name,E.INT64]])),U(E,"DENSITIES",new Map([[E.UINT8.toString(),ut.BIT8],[E.UINT16.toString(),ut.BIT16],[E.UINT32.toString(),ut.BIT32],[E.UINT64.toString(),ut.BIT64],[E.FLOAT32.toString(),ut.BIT32],[E.FLOAT64.toString(),ut.BIT64],[E.INT8.toString(),ut.BIT8],[E.INT16.toString(),ut.BIT16],[E.INT32.toString(),ut.BIT32],[E.INT64.toString(),ut.BIT64],[E.TIMESTAMP.toString(),ut.BIT64],[E.STRING.toString(),ut.UNKNOWN],[E.JSON.toString(),ut.UNKNOWN],[E.UUID.toString(),ut.BIT128]])),U(E,"ALL",[E.UNKNOWN,E.FLOAT64,E.FLOAT32,E.INT64,E.INT32,E.INT16,E.INT8,E.UINT64,E.UINT32,E.UINT16,E.UINT8,E.TIMESTAMP,E.UUID,E.STRING,E.JSON]),U(E,"BIG_INT_TYPES",[E.INT64,E.UINT64,E.TIMESTAMP]),U(E,"z",Ue([Te().transform(t=>new E(t)),ye(E)]));let je=E;const at=class Fe extends Or{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Fe.bytes(this.valueOf()+e.valueOf())}sub(e){return Fe.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Fe(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Fe.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Fe.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Fe.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Fe.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Fe.TERABYTE.valueOf()}toString(){const e=this.truncate(Fe.TERABYTE),r=this.truncate(Fe.GIGABYTE),i=this.truncate(Fe.MEGABYTE),n=this.truncate(Fe.KILOBYTE),s=this.truncate(Fe.BYTE),a=e,o=r.sub(e),u=i.sub(r),c=n.sub(i),l=s.sub(n);let d="";return a.isZero||(d+=`${a.terabytes}TB `),o.isZero||(d+=`${o.gigabytes}GB `),u.isZero||(d+=`${u.megabytes}MB `),c.isZero||(d+=`${c.kilobytes}KB `),(!l.isZero||d==="")&&(d+=`${l.valueOf()}B`),d.trim()}static bytes(e=1){return new Fe(e)}static kilobytes(e=1){return Fe.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Fe.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Fe.megabytes(e.valueOf()*1e3)}static terabytes(e){return Fe.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};U(at,"BYTE",new at(1)),U(at,"KILOBYTE",at.kilobytes(1)),U(at,"MEGABYTE",at.megabytes(1)),U(at,"GIGABYTE",at.gigabytes(1)),U(at,"TERABYTE",at.terabytes(1)),U(at,"ZERO",new at(0)),U(at,"z",Ue([Q().transform(t=>new at(t)),ye(at)]));let Ho=at;Ue([ye(Uint8Array),ye(Uint16Array),ye(Uint32Array),ye(BigUint64Array),ye(Float32Array),ye(Float64Array),ye(Int8Array),ye(Int16Array),ye(Int32Array),ye(BigInt64Array)]);const qk=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof ve||t instanceof oe||t instanceof Date},sZ=(t,e,r,i=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(i):!t.usesBigInt&&e.usesBigInt?BigInt(r.valueOf())-BigInt(i.valueOf()):bs(r,-i).valueOf(),bs=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),aZ=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function oZ(t){return typeof t=="string"&&aZ.test(t)}const tt=[];for(let t=0;t<256;++t)tt.push((t+256).toString(16).slice(1));function uZ(t,e=0){return(tt[t[e+0]]+tt[t[e+1]]+tt[t[e+2]]+tt[t[e+3]]+"-"+tt[t[e+4]]+tt[t[e+5]]+"-"+tt[t[e+6]]+tt[t[e+7]]+"-"+tt[t[e+8]]+tt[t[e+9]]+"-"+tt[t[e+10]]+tt[t[e+11]]+tt[t[e+12]]+tt[t[e+13]]+tt[t[e+14]]+tt[t[e+15]]).toLowerCase()}function cZ(t,e=0){const r=uZ(t,e);if(!oZ(r))throw TypeError("Stringified UUID is invalid");return r}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const lZ=(t,e)=>cZ(t,e),Kt=-1,dZ=Te().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),mZ=Ue([Ad(),ek()]).transform(()=>new Uint8Array().buffer),Qo=10,fZ=(t,e)=>{if(t==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},Jk="sy_x_telem_series",Yr=class Vn{constructor(e){U(this,"key"),U(this,"discriminator",Jk),U(this,"dataType"),U(this,"sampleOffset"),U(this,"gl"),U(this,"_data"),U(this,"timeRange",Qr.ZERO),U(this,"alignment",0n),U(this,"cachedMin"),U(this,"cachedMax"),U(this,"writePos",Kt),U(this,"_refCount",0),U(this,"cachedLength"),U(this,"_cachedIndexes"),hZ(e)&&(e={data:e}),e.data??(e.data=[]);const{dataType:r,timeRange:i,sampleOffset:n=0,glBufferUsage:s="static",alignment:a=0n,key:o=nZ(),data:u}=e;if(pZ(u)){const d=u;this.key=d.key,this.dataType=d.dataType,this.sampleOffset=d.sampleOffset,this.gl=d.gl,this._data=d._data,this.timeRange=d.timeRange,this.alignment=d.alignment,this.cachedMin=d.cachedMin,this.cachedMax=d.cachedMax,this.writePos=d.writePos,this._refCount=d._refCount,this.cachedLength=d.cachedLength;return}const c=qk(u),l=Array.isArray(u);if(r!=null)this.dataType=new je(r);else{if(u instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(l||c){let d=u;if(!c){if(u.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");d=u[0]}if(typeof d=="string")this.dataType=je.STRING;else if(typeof d=="number")this.dataType=je.FLOAT64;else if(typeof d=="bigint")this.dataType=je.INT64;else if(typeof d=="boolean")this.dataType=je.BOOLEAN;else if(d instanceof ve||d instanceof Date||d instanceof ve)this.dataType=je.TIMESTAMP;else if(typeof d=="object")this.dataType=je.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new je(u)}if(!l&&!c)this._data=u;else{let d=c?[u]:u;const g=d[0];(g instanceof ve||g instanceof Date||g instanceof oe)&&(d=d.map(p=>new ve(p).valueOf())),this.dataType.equals(je.STRING)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
5
+ `).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(E=>BigInt(Math.round(E)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(Number)).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=a??0,this.timeRange=n??st.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const a=new new j(t).Array(e),i=new we({data:a.buffer,dataType:t,...n});return i.writePos=0,i}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ye)return 0;const t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===ye)return 0;const t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ye?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
6
+ `).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(j.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(t=>e.parse(zr.decodeString(t)))}get byteCapacity(){return new Sr(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ye?this.byteCapacity:this.dataType.isVariable?new Sr(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ye?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((n,a)=>{n===Ir&&(e++,t.push(a+1))}),this._cachedIndexes=t,this.cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let a=0;a<this.length;a++)n[a]=Fo(this.dataType,e,this.data[a],t);return new we({data:n.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(j.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),Ut(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(j.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),Ut(this.cachedMin,this.sampleOffset))}get bounds(){return Ie(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){const t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(j.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return Ut(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);const n=zs(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw new Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,a=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],a=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let o=0;o<this.data.length;o++)if(this.data[o]===Ir){if(e===0){a=o;break}n=o+1,e--}if(a===0&&(a=this.data.length),n>=a||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(n,a);return this.dataType.equals(j.STRING)?new TextDecoder().decode(i):gs(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,n=this.length-1;const a=io(e);for(;t<=n;){const i=Math.floor((t+n)/2),o=a(this.at(i,!0),e);if(o===0)return i;o<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(j.FLOAT32)&&!this.dataType.equals(j.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:a}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==a)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==ye){a===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(a).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ye}as(e){return Jo(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:jn(this.alignmentBounds.lower),upper:jn(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return Ie(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new Qo(this);return this.dataType.equals(j.JSON)?new ec(e):e}return this.dataType.equals(j.UUID)?new tc(this):new rc(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Rn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Rn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,t);return new we({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,n){if(t<=0&&(n==null||n>=this.length))return this;let a;return e?a=this.data.subarray(t,n):a=this.data.slice(t,n),new we({data:a,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new we({data:this.buffer,dataType:this.dataType,timeRange:st.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(t=>t.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=",";e+="...,";for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=",")}return e+="])",e}};const Ko=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Is?!0:Ns(r),Xo=Lo(Ss,Is);let Rn=class{series;end;index;constructor(r,e,t){this.series=r;const n=Ie(0,r.length);this.end=An(n,t),this.index=An(n,e)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},Qo=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ir;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}},ec=class As{wrapped;static schema=s.z.record(s.z.string(),s.z.unknown());constructor(e){this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:zr.decodeString(e.value,As.schema)}}};class tc{series;index;data;density;constructor(e){if(!e.dataType.equals(j.UUID))throw new Error("cannot create a UUID series iterator for a non-UUID series");this.series=e,this.index=0,this.data=new Uint8Array(e.buffer),this.density=j.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};const e=zs(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}}let rc=class{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}};const jn=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}};s.z.object({key:s.z.string(),value:s.z.string()});s.z.record(s.z.union([s.z.number(),s.z.string(),s.z.symbol()]),s.z.unknown());const nc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";nc();const sc=["macOS","Windows","Linux"],ac=["macos","windows","linux"],ic={macos:"macOS",windows:"Windows",linux:"Linux"};s.z.enum(sc).or(s.z.enum(ac).transform(r=>ic[r]));const oc=(...r)=>r.map($s).join(""),$s=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),cc=r=>r.endsWith("/")?r.slice(0,-1):r,lc=(r,e="")=>r===null?"":`?${Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&")}`;let uc=class Dt{protocol;host;port;path;constructor({host:e,port:t,protocol:n="",pathPrefix:a=""}){this.protocol=n,this.host=e,this.port=t,this.path=$s(a)}replace(e){return new Dt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Dt({...this,pathPrefix:oc(this.path,e)})}toString(){return cc(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new Dt({host:"unknown",port:0})};const hc=async r=>await new Promise(e=>setTimeout(e,A.fromMilliseconds(r).milliseconds));class dc{config;retries;interval;constructor(e){this.config={baseInterval:new A(e?.baseInterval??A.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??hc},this.retries=0,this.interval=new A(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const fc=s.z.object({baseInterval:A.z.optional(),maxRetries:s.z.number().optional(),scale:s.z.number().optional()}),yc=Object.freeze(Object.defineProperty({__proto__:null,Breaker:dc,breakerConfigZ:fc},Symbol.toStringTag,{value:"Module"})),gc=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,ks=s.z.string().regex(gc),qe=s.z.number().min(0).max(255),Cs=s.z.number().min(0).max(1),xs=s.z.tuple([qe,qe,qe,Cs]),pc=s.z.tuple([qe,qe,qe]),mc=s.z.object({rgba255:xs}),wc=s.z.number().min(0).max(360),bc=s.z.number().min(0).max(100),Tc=s.z.number().min(0).max(100),vc=s.z.tuple([wc,bc,Tc,Cs]),Hr=s.z.union([ks,pc,xs,vc,mc]),Ec=Hr.transform(r=>Gr(r)),Gr=(r,e=1)=>{if(r=Hr.parse(r),typeof r=="string")return Oc(r,e);if(Array.isArray(r)){if(r.length<3||r.length>4)throw new Error(`Invalid color: [${r.join(", ")}]`);return r.length===3?[...r,e]:r}return r.rgba255},Oc=(r,e=1)=>(r=ks.parse(r),r=Nc(r),[Ct(r,0),Ct(r,2),Ct(r,4),r.length===8?Ct(r,6)/255:e]),Ct=(r,e)=>parseInt(r.slice(e,e+2),16),Nc=r=>r.startsWith("#")?r.slice(1):r;Gr("#000000");Gr("#ffffff");const zc=s.z.object({key:s.z.string(),color:Hr,position:s.z.number(),switched:s.z.boolean().optional()});s.z.array(zc);const Sc=s.z.object({key:s.z.string(),name:s.z.string(),color:Ec});s.z.object({key:s.z.string(),name:s.z.string(),swatches:s.z.array(Sc)});s.z.int().min(0).max(255);s.z.object({name:s.z.string(),key:s.z.string()});const Ic=r=>Object.getOwnPropertySymbols(globalThis).includes(r),Ac=(r,e)=>{const t=Symbol.for(r);if(!Ic(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},Rs="sy_x_error",$c=r=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(r):e instanceof Error?e.message.startsWith(r):typeof e!="string"?!1:e.startsWith(r),bt=r=>class at extends Error{static discriminator=Rs;discriminator=at.discriminator;static TYPE=r;type=at.TYPE;static matches=$c(r);matches=at.matches;constructor(t,n){super(t,n),this.name=at.TYPE}static sub(t){return bt(`${r}.${t}`)}},js=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!==Rs)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},De="unknown",Ar="nil";class kc{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Ar,data:""};if(js(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:De,data:e.message};if(typeof e=="string")return{type:De,data:e};try{return{type:De,data:JSON.stringify(e)}}catch{return{type:De,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Ar)return null;if(e.type===De)return new $r(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new $r(e.data)}}const Jr=Ac("synnax-error-registry",()=>new kc),Cc=({encode:r,decode:e})=>Jr().register({encode:r,decode:e}),xc=r=>Jr().encode(r),Rc=r=>r==null?null:Jr().decode(r);let $r=class extends bt("unknown"){};const jc=s.z.object({type:s.z.string(),data:s.z.string()});class Uc extends bt("canceled"){}class Dc extends bt("not_implemented"){}const be=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Uc,NONE:Ar,NotImplemented:Dc,UNKNOWN:De,Unknown:$r,createTyped:bt,decode:Rc,encode:xc,isTyped:js,payloadZ:jc,register:Cc},Symbol.toStringTag,{value:"Module"})),Mc=s.object({jsonrpc:s.literal("2.0"),method:s.string(),params:s.any().optional(),id:s.union([s.string(),s.number(),s.null()]).optional()}),Us=s.object({jsonrpc:s.literal("2.0"),id:s.union([s.string(),s.number(),s.null()])}),Zc=Us.extend({result:s.json()}),Pc=Us.extend({error:s.object({code:s.number().int(),message:s.string().optional(),data:s.json().optional()})}),Lc=s.union([Zc,Pc]);s.union([Mc,Lc]);s.z.string().regex(/^\d+\.\d+\.\d+$/);const Bc=["standard","scientific","engineering"];s.z.enum(Bc);s.z.enum(["success","info","warning","error","loading","disabled"]);let Tt=class extends be.createTyped("freighter"){},K=class extends Tt.sub("eof"){constructor(){super("EOF")}},Ve=class extends Tt.sub("stream_closed"){constructor(){super("StreamClosed")}},Te=class extends Tt.sub("unreachable"){url;constructor(e={}){const{message:t="Unreachable",url:n=uc.UNKNOWN}=e;super(t),this.url=n}};const qc=r=>{if(!r.type.startsWith(Tt.TYPE))return null;if(K.matches(r))return{type:K.TYPE,data:"EOF"};if(Ve.matches(r))return{type:Ve.TYPE,data:"StreamClosed"};if(Te.matches(r))return{type:Te.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Fc=r=>{if(!r.type.startsWith(Tt.TYPE))return null;switch(r.type){case K.TYPE:return new K;case Ve.TYPE:return new Ve;case Te.TYPE:return new Te;default:throw new be.Unknown(`Unknown error type: ${r.data}`)}};be.register({encode:qc,decode:Fc});class Ds{middleware=[];use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const a=async i=>{if(n===this.middleware.length)return await t(i);const o=this.middleware[n];return n++,await o(i,a)};return await a(e)}}const Ms="Content-Type",Yc=r=>typeof r.cause=="object"&&r.cause!==null&&"code"in r.cause&&r.cause.code==="ECONNREFUSED",Vc=400;class Wc extends Ds{endpoint;encoder;constructor(e,t,n=!1){return super(),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Ms]:this.encoder.contentType}}async send(e,t,n,a){t=n?.parse(t);let i=null;const o=this.endpoint.child(e),c={};c.method="POST",c.body=this.encoder.encode(t??{});const[,l]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async h=>{const d={...h,params:{}};c.headers={...this.headers,...h.params};let u;try{u=await fetch(h.target,c)}catch(E){if(!(E instanceof Error))throw E;return[d,Yc(E)?new Te({url:o}):E]}const N=await u.arrayBuffer();if(u?.ok)return a!=null&&(i=this.encoder.decode(N,a)),[d,null];try{if(u.status!==Vc)return[d,new Error(u.statusText)];const E=this.encoder.decode(N,be.payloadZ),P=be.decode(E);return[d,P]}catch(E){return[d,new Error(`[freighter] - failed to decode error: ${u.statusText}: ${E.message}`)]}});if(l!=null)return[null,l];if(i==null)throw new Error("Response must be defined");return[i,null]}}const _c=(r,e)=>{class t{wrapped;constructor(a){this.wrapped=a}use(...a){this.wrapped.use(...a)}async send(a,i,o,c){const l=new yc.Breaker(e);do{const[h,d]=await this.wrapped.send(a,i,o,c);if(d==null)return[h,null];if(!Te.matches(d))return[null,d];if(!await l.wait())return[h,d]}while(!0)}}return new t(r)},g=async(r,e,t,n,a)=>{const[i,o]=await r.send(e,t,n,a);if(o!=null)throw o;return i},Hc=s.z.object({type:s.z.enum(["data","close","open"]),payload:s.z.unknown(),error:s.z.optional(be.payloadZ)});class Gc{codec;reqSchema;resSchema;ws;serverClosed;sendClosed;receiveDataQueue=[];receiveCallbacksQueue=[];constructor(e,t,n,a){this.codec=t,this.reqSchema=n,this.resSchema=a,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}async receiveOpenAck(){const e=await this.receiveMsg();if(e.type!=="open"){if(e.error==null)throw new Error("Message error must be defined");return be.decode(e.error)}return null}send(e){if(this.serverClosed!=null)return new K;if(this.sendClosed)throw new Ve;return this.ws.send(this.codec.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");if(this.serverClosed=be.decode(e.error),this.serverClosed==null)throw new Error("Message error must be defined");return[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.codec.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}addMessage(e){const t=this.receiveCallbacksQueue.shift();t!=null?t.resolve(e):this.receiveDataQueue.push(e)}listenForMessages(){this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this)}onMessage(e){this.addMessage(this.codec.decode(e.data,Hc))}onClose(e){this.addMessage({type:"close",error:{type:e.code===Kc?K.TYPE:Ve.TYPE,data:""}})}}const Jc="freighterctx",Kc=1e3;let Xc=class kr extends Ds{baseUrl;encoder;secure;static MESSAGE_TYPE="arraybuffer";constructor(e,t,n=!1){super(),this.secure=n,this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}withCodec(e){const t=new kr(this.baseUrl,e,this.secure);return t.use(...this.middleware),t}async stream(e,t,n){let a;const[,i]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const c=new WebSocket(this.buildURL(e,o)),l={...o,params:{}};c.binaryType=kr.MESSAGE_TYPE;const h=await this.wrapSocket(c,t,n);return h instanceof Error?[l,h]:(a=h,[l,null])});if(i!=null)throw i;return a}buildURL(e,t){const n=lc({[Ms]:this.encoder.contentType,...t.params},Jc);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(a=>{e.onopen=()=>{const i=new Gc(e,this.encoder,t,n);i.receiveOpenAck().then(o=>{o!=null?a(o):a(i)}).catch(o=>a(o))},e.onerror=i=>{const o=i;a(new Error(o.message))}})}};const Qc=r=>Array.isArray(r)?r:r==null?[]:[r],T=Object.freeze(Object.defineProperty({__proto__:null,toArray:Qc},Symbol.toStringTag,{value:"Module"})),el=r=>{const e=r.replace(/_[a-z]/g,t=>t[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},Kr=r=>{const e=(t,n=Cr)=>{if(typeof t=="string")return r(t);if(Array.isArray(t))return t.map(o=>e(o,n));if(!ur(t))return t;n=sl(n);const a={},i=t;return"toJSON"in i&&typeof i.toJSON=="function"?e(i.toJSON(),n):(Object.keys(i).forEach(o=>{let c=i[o];const l=r(o);n.recursive&&(ur(c)?Dn(c)||(c=e(c,n)):n.recursiveInArray&&Un(c)&&(c=[...c].map(h=>{let d=h;return ur(h)?Dn(d)||(d=e(h,n)):Un(h)&&(d=e({key:h},n).key),d}))),a[l]=c}),a)};return e},Xr=Kr(el),tl=r=>r.replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}_${n.toLowerCase()}`),Zs=Kr(tl),rl=r=>r.length===0?r:r[0].toUpperCase()+r.slice(1),nl=[Number,String,Uint8Array],Cr={recursive:!0,recursiveInArray:!0},sl=(r=Cr)=>(r.recursive==null?r=Cr:r.recursiveInArray??=!1,r),Un=r=>r!=null&&Array.isArray(r),ur=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Dn=r=>nl.some(e=>r instanceof e),al=r=>r.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,t,n)=>`${t}-${n.toLowerCase()}`).toLowerCase(),il=Kr(al),ol=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:Zs,capitalize:rl,snakeToCamel:Xr,toKebab:il},Symbol.toStringTag,{value:"Module"})),Ps=r=>r!=null&&typeof r=="object"&&!Array.isArray(r);let Ls=class{contentType="application/json";decoder;encoder;constructor(){this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,t){return this.decodeString(this.decoder.decode(e),t)}decodeString(e,t){const n=JSON.parse(e),a=Xr(n);return t!=null?t.parse(a):a}encodeString(e){const t=Zs(e);return JSON.stringify(t,(n,a)=>ArrayBuffer.isView(a)?Array.from(a):typeof a=="bigint"?a.toString():a)}},Bs=class{contentType="text/csv";encode(e){const t=this.encodeString(e);return new TextEncoder().encode(t)}decode(e,t){const n=new TextDecoder().decode(e);return this.decodeString(n,t)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Ps(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),n=[t.join(",")];return e.forEach(a=>{const i=t.map(o=>JSON.stringify(a[o]??""));n.push(i.join(","))}),n.join(`
7
+ `)}decodeString(e,t){const[n,...a]=e.trim().split(`
8
+ `).map(c=>c.trim());if(n.length===0)return t!=null?t.parse({}):{};const i=n.split(",").map(c=>c.trim()),o={};return i.forEach(c=>{o[c]=[]}),a.forEach(c=>{const l=c.split(",").map(h=>h.trim());i.forEach((h,d)=>{const u=this.parseValue(l[d]);u!=null&&o[h].push(u)})}),t!=null?t.parse(o):o}parseValue(e){if(e==null||e.length===0)return null;const t=Number(e);return isNaN(t)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:t}},qs=class{contentType="text/plain";encode(e){if(typeof e!="string")throw new Error("TextCodec.encode payload must be a string");return new TextEncoder().encode(e)}decode(e,t){const n=new TextDecoder().decode(e);return t!=null?t.parse(n):n}};const lt=new Ls,cl=new Bs,ll=new qs,ul=[lt],$e=Object.freeze(Object.defineProperty({__proto__:null,CSVCodec:Bs,CSV_CODEC:cl,ENCODERS:ul,JSONCodec:Ls,JSON_CODEC:lt,TEXT_CODEC:ll,TextCodec:qs},Symbol.toStringTag,{value:"Module"})),xr=r=>[...new Set(r)],hl=(r,e,t=!0)=>{const n=new Map;return r.forEach(a=>{const i=e(a);if(n.has(i)){if(t)return;n.delete(i)}n.set(i,a)}),Array.from(n.values())},Mn=Object.freeze(Object.defineProperty({__proto__:null,by:hl,unique:xr},Symbol.toStringTag,{value:"Module"}));let He=class{value;constructor(e){this.value=e}valueOf(){return this.value}toJSON(){return this.value}toString(){return this.value.toString()}};const dl=r=>r!=null&&typeof r=="object"&&"toString"in r,Wt=(r,e=!1)=>{const t=dl(r)?"stringer":typeof r;let n;switch(t){case"string":n=(a,i)=>a.localeCompare(i);break;case"stringer":n=(a,i)=>a.toString().localeCompare(i.toString());break;case"number":n=(a,i)=>Number(a)-Number(i);break;case"bigint":n=(a,i)=>BigInt(a)-BigInt(i)>0n?1:-1;break;case"boolean":n=(a,i)=>Number(a)-Number(i);break;case"undefined":n=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Ys(n):n},fl=(r,e,t)=>{const n=Wt(e[r],t);return(a,i)=>n(a[r],i[r])},yl=(r,e)=>r.length!==e.length?r.length-e.length:r.every((t,n)=>t===e[n])?0:-1,Fs=(r,e)=>{if(r.length!==e.length)return r.length-e.length;if(r.length===0)return 0;const t=Wt(r[0]),n=[...r].sort(t),a=[...e].sort(t);return n.every((i,o)=>i===a[o])?0:-1},gl=(r,e)=>{const t=xr(r),n=xr(e);return Fs(t,n)},pl=(r,e)=>r===e?0:r==="first"&&e==="last"?1:-1,Ys=r=>(e,t)=>r(t,e),Ge=0,Mt=-1,Zt=1,Vs=r=>r<Ge,Ws=r=>r>Ge,ml=r=>r>=Ge,_s=r=>r===Ge,wl=(r,e)=>{const t=/([a-zA-Z]+)|(\d+)/g,n=r.replace(/[\s_.-]+/g,"").match(t),a=e.replace(/[\s_.-]+/g,"").match(t);if(!n||!a)return 0;for(let i=0;i<Math.min(n.length,a.length);i++){const o=n[i],c=a[i];if(isNaN(Number(o))&&isNaN(Number(c))){const l=o.localeCompare(c);if(l!==0)return l}else if(!isNaN(Number(o))&&!isNaN(Number(c))){const l=Number(o)-Number(c);if(l!==0)return l}else return isNaN(Number(o))?-1:1}return n.length-a.length},Zn=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:Ge,GREATER_THAN:Zt,LESS_THAN:Mt,isEqualTo:_s,isGreaterThan:Ws,isGreaterThanEqual:ml,isLessThan:Vs,newF:Wt,newFieldF:fl,order:pl,primitiveArrays:yl,reverseF:Ys,stringsWithNumbers:wl,uniqueUnorderedPrimitiveArrays:gl,unorderedPrimitiveArrays:Fs},Symbol.toStringTag,{value:"Module"})),_t=s.z.tuple([s.z.number(),s.z.number()]);s.z.tuple([s.z.bigint(),s.z.bigint()]);const Hs=s.z.object({width:s.z.number(),height:s.z.number()}),bl=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()}),Tl=["width","height"];s.z.enum(Tl);const vl=["start","center","end"],El=["signedWidth","signedHeight"];s.z.enum(El);const qt=s.z.object({x:s.z.number(),y:s.z.number()}),Ol=s.z.object({clientX:s.z.number(),clientY:s.z.number()}),Nl=["x","y"],Gs=s.z.enum(Nl),Js=["top","right","bottom","left"];s.z.enum(Js);const zl=["left","right"],Ks=s.z.enum(zl),Sl=["top","bottom"],Xs=s.z.enum(Sl),Qs=["center"],Pn=s.z.enum(Qs),Il=[...Js,...Qs],ea=s.z.enum(Il);s.z.enum(vl);const Al=["first","last"];s.z.enum(Al);const $l=s.z.object({lower:s.z.number(),upper:s.z.number()}),kl=s.z.object({lower:s.z.bigint(),upper:s.z.bigint()});s.z.union([$l,_t]);s.z.union([kl,_t]);s.z.enum([...Gs.options,...ea.options]);s.z.union([Gs,ea,s.z.instanceof(String)]);const hr=(r,e)=>typeof r=="bigint"?r-BigInt(e):r-Number(e),Cl=(r,e)=>typeof r=="bigint"?r+BigInt(e):r+Number(e),Ln=(r,e)=>typeof r=="bigint"?r===BigInt(e):r===Number(e),xl=(r,e)=>r<=e?r:typeof r=="bigint"?r<=e?r:BigInt(e):r<=e?r:Number(e),Rl=r=>r<0?-r:r,Re=(r,e)=>typeof r=="bigint"?r*BigInt(e):r*Number(e),V=(r,e,t)=>{const n={};if(typeof e=="object"&&(t=e,e=void 0),t={makeValid:!0,...t},typeof r=="number"||typeof r=="bigint")e!=null?(n.lower=r,n.upper=e):(n.lower=typeof r=="bigint"?0n:0,n.upper=r);else if(Array.isArray(r)){if(r.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=r}else n.lower=r.lower,n.upper=r.upper;return t?.makeValid?jl(n):n},jl=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r,Bn=(r,e)=>{const t=V(r);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},xt=(r,e)=>{const t=V(r);if(typeof e=="number"||typeof e=="bigint")return e>=t.lower&&e<t.upper;const n=V(e);return n.lower>=t.lower&&n.upper<=t.upper},Ul=r=>({lower:Math.min(...r.map(e=>V(e).lower)),upper:Math.max(...r.map(e=>V(e).upper))}),Dl=(r,e,t)=>{const n=r.map(c=>V(c)),a=t>0?1:t<0?-1:0;if(a===0)return e;let i=t,o=e;for(;Ln(i,0)===!1;){const c=n.findIndex(l=>a>0?o>=l.lower&&o<l.upper:o>l.lower&&o<=l.upper);if(c!==-1){const l=n[c];let h;if(a>0?h=hr(l.upper,o):h=hr(o,l.lower),h>0){const d=xl(Rl(i),h);if(o=Cl(o,a>0?d:-d),i=hr(i,a>0?d:-d),Ln(i,0))return o;continue}}if(a>0){const l=n.filter(h=>h.lower>o);if(l.length>0)o=l[0].lower;else return o}else{const l=n.filter(h=>h.upper<o);if(l.length>0)o=l[l.length-1].upper;else return o}}return o},Ml=(r,e,t)=>{const n=r.map(o=>V(o));if(e===t)return typeof e=="bigint"?0n:0;const a=e<t?V([e,t]):V([t,e]);let i=typeof e=="bigint"?0n:0;for(const o of n){const c=o.lower>a.lower?o.lower:a.lower,l=o.upper<a.upper?o.upper:a.upper;if(c<l){const h=l-c;i=i+h}}return i};s.z.object({x:Ks.or(Pn),y:Xs.or(Pn)});const Zl=s.z.object({x:Ks,y:Xs}),Pl=Object.freeze({x:"left",y:"top"}),Ll=(r,e)=>r.x===e.x&&r.y===e.y,qn=s.z.union([s.z.number(),qt,_t,Hs,bl,Ol]),Bl=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y}},Fn=Object.freeze({x:0,y:0}),Rt=s.z.union([s.z.number(),s.z.string()]);s.z.object({top:Rt,left:Rt,width:Rt,height:Rt});s.z.object({left:s.z.number(),top:s.z.number(),right:s.z.number(),bottom:s.z.number()});s.z.object({one:qt,two:qt,root:Zl});const Qr=(r,e,t=0,n=0,a)=>{const i={one:{...Fn},two:{...Fn},root:a??Pl};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:r,y:e},i.two={x:i.one.x+t,y:i.one.y+n},i}return"one"in r&&"two"in r&&"root"in r?{...r,root:a??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(i.one={x:r.left,y:r.top},i.two={x:r.right,y:r.bottom},i):(i.one=r,e==null?i.two={x:i.one.x+t,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},dr=r=>{const e=Qr(r);return{lower:e.one.x,upper:e.two.x}},fr=r=>{const e=Qr(r);return{lower:e.one.y,upper:e.two.y}},ql=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Fl=s.z.object({signedWidth:s.z.number(),signedHeight:s.z.number()});s.z.union([Hs,Fl,qt,_t]);const Yl=(r,e,t)=>e!==void 0&&r<e?e:t!==void 0&&r>t?t:r;s.z.object({offset:qn,scale:qn});s.z.object({offset:s.z.number(),scale:s.z.number()});const Vl=r=>(e,t,n,a)=>t==="dimension"?[e,n]:[e,a?n-r:n+r],Wl=r=>(e,t,n,a)=>[e,a?n/r:n*r],_l=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:a,upper:i}=e,{lower:o,upper:c}=r,l=i-a,h=c-o;if(t==="dimension")return[r,n*(h/l)];const d=(n-a)*(h/l)+o;return[r,d]},Hl=r=>(e,t,n)=>[r,n],Gl=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:a}=r;return[r,a-(t-n)]},Jl=r=>(e,t,n)=>{const{lower:a,upper:i}=r;return n=Yl(n,a,i),[e,n]};let Yn=class Me{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(e){return new Me().translate(e)}static magnify(e){return new Me().magnify(e)}static scale(e,t){return new Me().scale(e,t)}translate(e){const t=this.new(),n=Vl(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Wl(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=V(e,t),a=this.new(),i=_l(n);return i.type="scale",a.ops.push(i),a}clamp(e,t){const n=V(e,t),a=this.new(),i=Jl(n);return i.type="clamp",a.ops.push(i),a}reBound(e,t){const n=V(e,t),a=this.new(),i=Hl(n);return i.type="re-bound",a.ops.push(i),a}invert(){const e=Gl();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Me;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,a],i)=>i(n,e,a,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,a)=>{if(n.type==="scale"||t.some(([o,c])=>a>=o&&a<=c))return;const i=e.ops.findIndex((o,c)=>o.type==="scale"&&c>a);i!==-1&&t.push([a,i])}),t.forEach(([n,a])=>{const i=e.ops.slice(n,a);i.unshift(e.ops[a]),e.ops.splice(n,a-n+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new Me},Um=class te{x;y;currRoot;constructor(e=new Yn,t=new Yn,n=null){this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new te().translate(e,t)}static translateX(e){return new te().translateX(e)}static translateY(e){return new te().translateY(e)}static clamp(e){return new te().clamp(e)}static magnify(e){return new te().magnify(e)}static scale(e){return new te().scale(e)}static reBound(e){return new te().reBound(e)}translate(e,t){const n=Bl(e,t),a=this.copy();return a.x=this.x.translate(n.x),a.y=this.y.translate(n.y),a}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(ql(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Ll(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(dr(e)),t.y=t.y.scale(fr(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(dr(e)),t.y=this.y.reBound(fr(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(dr(e)),t.y=this.y.clamp(fr(e)),t}copy(){const e=new te;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return Qr(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new te},Kl=(r,e=21)=>(t=e)=>{let n="",a=t|0;for(;a--;)n+=r[Math.random()*r.length|0];return n};const Xl="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ta=11,Ql=Kl(Xl,ta),en=()=>Ql(),eu=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:ta,create:en},Symbol.toStringTag,{value:"Module"})),tu=(r,e)=>t=>t instanceof e||typeof t=="object"&&t!==null&&"discriminator"in t&&t.discriminator===r,ru=s.z.enum(["static","dynamic"]),nu=s.z.union([s.z.tuple([s.z.int()]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12)]),s.z.tuple([s.z.int(),s.z.int().min(1).max(12),s.z.int().min(1).max(31)])]),ra=(r,e)=>{const t=new O(e);if(![v.DAY,v.HOUR,v.MINUTE,v.SECOND,v.MILLISECOND,v.MICROSECOND,v.NANOSECOND].some(a=>a.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof O?new O(n):new v(n)};let O=class m extends He{constructor(e,t="UTC"){if(e==null)super(m.now().valueOf());else if(e instanceof Date)super(BigInt(e.getTime())*m.MILLISECOND.valueOf());else if(typeof e=="string")super(m.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(m.parseDate(e));else{let n=0n;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=m.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=m.MAX:e=m.MIN)),super(BigInt(e.valueOf())+n)}}static parseDate([e=1970,t=1,n=1]){const a=new Date(e,t-1,n,0,0,0,0);return new m(BigInt(a.getTime())*m.MILLISECOND.valueOf()).truncate(m.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,a,i]=e.split(":");let o="00",c="00";i!=null&&([o,c]=i.split("."));let l=m.hours(parseInt(n??"00")).add(m.minutes(parseInt(a??"00"))).add(m.seconds(parseInt(o??"00"))).add(m.milliseconds(parseInt(c??"00")));return t==="local"&&(l=l.add(m.utcOffset)),l.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return m.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new m(BigInt(n.getTime())*m.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(m.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${t} ${n}`}static get utcOffset(){return new v(BigInt(new Date().getTimezoneOffset())*m.MINUTE.valueOf())}static since(e){return new m().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new m(e).valueOf()}span(e){return this.range(e).span}range(e){return new z(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0n}after(e){return this.valueOf()>new m(e).valueOf()}afterEq(e){return this.valueOf()>=new m(e).valueOf()}before(e){return this.valueOf()<new m(e).valueOf()}beforeEq(e){return this.valueOf()<=new m(e).valueOf()}add(e){return new m(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new m(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(v.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(v.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(v.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(v.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(m.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(m.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(e){const t=this.date();return t.setUTCFullYear(e),new m(t)}get month(){return this.date().getUTCMonth()}setMonth(e){const t=this.date();return t.setUTCMonth(e),new m(t)}get day(){return this.date().getUTCDate()}setDay(e){const t=this.date();return t.setUTCDate(e),new m(t)}get hour(){return this.date().getUTCHours()}setHour(e){const t=this.date();return t.setUTCHours(e),new m(t,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(e){const t=this.date();return t.setUTCMinutes(e),new m(t)}get second(){return this.date().getUTCSeconds()}setSecond(e){const t=this.date();return t.setUTCSeconds(e),new m(t)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(e){const t=this.date();return t.setUTCMilliseconds(e),new m(t)}toString(){return this.date().toISOString()}remainder(e){return ra(this,e)}get isToday(){return this.truncate(v.DAY).equals(m.now().truncate(v.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new m(new Date)}static max(...e){let t=m.MIN;for(const n of e){const a=new m(n);a.after(t)&&(t=a)}return t}static min(...e){let t=m.MAX;for(const n of e){const a=new m(n);a.before(t)&&(t=a)}return t}static nanoseconds(e,t="UTC"){return new m(e,t)}static NANOSECOND=m.nanoseconds(1);static microseconds(e,t="UTC"){return m.nanoseconds(e*1e3,t)}static MICROSECOND=m.microseconds(1);static milliseconds(e,t="UTC"){return m.microseconds(e*1e3,t)}static MILLISECOND=m.milliseconds(1);static seconds(e,t="UTC"){return m.milliseconds(e*1e3,t)}static SECOND=m.seconds(1);static minutes(e,t="UTC"){return m.seconds(e*60,t)}static MINUTE=m.minutes(1);static hours(e,t="UTC"){return m.minutes(e*60,t)}static HOUR=m.hours(1);static days(e,t="UTC"){return m.hours(e*24,t)}static DAY=m.days(1);static MAX=new m((1n<<63n)-1n);static MIN=new m(0);static ZERO=new m(0);static z=s.z.union([s.z.instanceof(m),s.z.object({value:s.z.bigint()}).transform(e=>new m(e.value)),s.z.string().transform(e=>new m(BigInt(e))),s.z.number().transform(e=>new m(e)),s.z.bigint().transform(e=>new m(e)),s.z.date().transform(e=>new m(e)),s.z.custom(e=>e instanceof v).transform(e=>new m(e)),nu.transform(e=>new m(e))]);static sort(e,t){return Number(e.valueOf()-t.valueOf())}},v=class b extends He{constructor(e){typeof e=="number"&&(e=Math.trunc(e.valueOf())),super(BigInt(e.valueOf()))}static fromSeconds(e){return e instanceof b?e:e instanceof Rr?e.period:e instanceof O?new b(e):["number","bigint"].includes(typeof e)?b.seconds(e):new b(e)}static fromMilliseconds(e){return e instanceof b?e:e instanceof Rr?e.period:e instanceof O?new b(e):["number","bigint"].includes(typeof e)?b.milliseconds(e):new b(e)}valueOf(){return this.value}lessThan(e){return this.valueOf()<new b(e).valueOf()}greaterThan(e){return this.valueOf()>new b(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new b(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new b(e).valueOf()}remainder(e){return ra(this,e)}truncate(e){return new b(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(b.DAY),t=this.truncate(b.HOUR),n=this.truncate(b.MINUTE),a=this.truncate(b.SECOND),i=this.truncate(b.MILLISECOND),o=this.truncate(b.MICROSECOND),c=this.truncate(b.NANOSECOND),l=e,h=t.sub(e),d=n.sub(t),u=a.sub(n),N=i.sub(a),E=o.sub(i),P=c.sub(o);let k="";return l.isZero||(k+=`${l.days}d `),h.isZero||(k+=`${h.hours}h `),d.isZero||(k+=`${d.minutes}m `),u.isZero||(k+=`${u.seconds}s `),N.isZero||(k+=`${N.milliseconds}ms `),E.isZero||(k+=`${E.microseconds}µs `),P.isZero||(k+=`${P.nanoseconds}ns`),k.trim()}mult(e){return new b(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(b.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(b.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(b.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(b.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(b.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(b.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(e){return this.valueOf()===new b(e).valueOf()}add(e){return new b(this.valueOf()+new b(e).valueOf())}sub(e){return new b(this.valueOf()-new b(e).valueOf())}static nanoseconds(e=1){return new b(e)}static NANOSECOND=b.nanoseconds(1);static microseconds(e=1){return b.nanoseconds(Re(e,1e3))}static MICROSECOND=b.microseconds(1);static milliseconds(e=1){return b.microseconds(Re(e,1e3))}static MILLISECOND=b.milliseconds(1);static seconds(e=1){return b.milliseconds(Re(e,1e3))}static SECOND=b.seconds(1);static minutes(e=1){return b.seconds(Re(e,60))}static MINUTE=b.minutes(1);static hours(e){return b.minutes(Re(e,60))}static HOUR=b.hours(1);static days(e){return b.hours(Re(e,24))}static DAY=b.days(1);static MAX=new b((1n<<63n)-1n);static MIN=new b(0);static ZERO=new b(0);static z=s.z.union([s.z.object({value:s.z.bigint()}).transform(e=>new b(e.value)),s.z.string().transform(e=>new b(BigInt(e))),s.z.number().transform(e=>new b(e)),s.z.instanceof(b)])},Rr=class Ze extends He{constructor(e){super(e.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ze(e).valueOf()}get period(){return v.seconds(1/this.valueOf())}sampleCount(e){return new v(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new W(t).valueOf()}span(e){return v.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ze(e)}static khz(e){return Ze.hz(e*1e3)}static z=s.z.union([s.z.number().transform(e=>new Ze(e)),s.z.instanceof(Ze)])},W=class oe extends He{constructor(e){super(e.valueOf())}length(e){return e.valueOf()/this.valueOf()}size(e){return new S(e*this.valueOf())}static UNKNOWN=new oe(0);static BIT128=new oe(16);static BIT64=new oe(8);static BIT32=new oe(4);static BIT16=new oe(2);static BIT8=new oe(1);static z=s.z.union([s.z.number().transform(e=>new oe(e)),s.z.instanceof(oe)])};class z{start;end;constructor(e,t){typeof e=="object"&&"start"in e?(this.start=new O(e.start),this.end=new O(e.end)):(this.start=new O(e),this.end=new O(t))}get span(){return new v(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new z(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,t=v.ZERO){if(t.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let n=this.start.sub(e.start).valueOf(),a=this.end.sub(e.end).valueOf();return n<0&&(n=-n),a<0&&(a=-a),n<=t.valueOf()&&a<=t.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,t=v.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const a=O.max(n.start,e.start),i=O.min(n.end,e.end);return i.before(a)?!1:new v(i.sub(a)).greaterThanOrEqual(t)}contains(e){return e instanceof z?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new z(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}static max(...e){return new z(O.min(...e.map(t=>t.start)),O.max(...e.map(t=>t.end)))}static MAX=new z(O.MIN,O.MAX);static MIN=new z(O.MAX,O.MIN);static ZERO=new z(O.ZERO,O.ZERO);static z=s.z.union([s.z.object({start:O.z,end:O.z}).transform(e=>new z(e.start,e.end)),s.z.instanceof(z)]);static sort(e,t){return O.sort(e.start,t.start)||O.sort(e.end,t.end)}}let I=class y extends He{constructor(e){if(e instanceof y||typeof e=="string"||typeof e.valueOf()=="string")super(e.valueOf());else{const t=y.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t==null)throw new Error(`unable to find data type for ${e.toString()}`);super(t.valueOf())}}get Array(){const e=y.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(y.JSON)||this.equals(y.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(y.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=y.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsignedInteger(){return this.equals(y.UINT8)||this.equals(y.UINT16)||this.equals(y.UINT32)||this.equals(y.UINT64)}get isSignedInteger(){return this.equals(y.INT8)||this.equals(y.INT16)||this.equals(y.INT32)||this.equals(y.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsignedInteger&&e.isSignedInteger?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(y.INT32)&&e.equals(y.FLOAT64)||this.equals(y.INT8)&&e.equals(y.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsignedInteger===e.isUnsignedInteger:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}get usesBigInt(){return y.BIG_INT_TYPES.some(e=>e.equals(this))}static UNKNOWN=new y("unknown");static FLOAT64=new y("float64");static FLOAT32=new y("float32");static INT64=new y("int64");static INT32=new y("int32");static INT16=new y("int16");static INT8=new y("int8");static UINT64=new y("uint64");static UINT32=new y("uint32");static UINT16=new y("uint16");static UINT8=new y("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new y("timestamp");static UUID=new y("uuid");static STRING=new y("string");static JSON=new y("json");static ARRAY_CONSTRUCTORS=new Map([[y.UINT8.toString(),Uint8Array],[y.UINT16.toString(),Uint16Array],[y.UINT32.toString(),Uint32Array],[y.UINT64.toString(),BigUint64Array],[y.FLOAT32.toString(),Float32Array],[y.FLOAT64.toString(),Float64Array],[y.INT8.toString(),Int8Array],[y.INT16.toString(),Int16Array],[y.INT32.toString(),Int32Array],[y.INT64.toString(),BigInt64Array],[y.TIMESTAMP.toString(),BigInt64Array],[y.STRING.toString(),Uint8Array],[y.JSON.toString(),Uint8Array],[y.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,y.UINT8],[Uint16Array.name,y.UINT16],[Uint32Array.name,y.UINT32],[BigUint64Array.name,y.UINT64],[Float32Array.name,y.FLOAT32],[Float64Array.name,y.FLOAT64],[Int8Array.name,y.INT8],[Int16Array.name,y.INT16],[Int32Array.name,y.INT32],[BigInt64Array.name,y.INT64]]);static DENSITIES=new Map([[y.UINT8.toString(),W.BIT8],[y.UINT16.toString(),W.BIT16],[y.UINT32.toString(),W.BIT32],[y.UINT64.toString(),W.BIT64],[y.FLOAT32.toString(),W.BIT32],[y.FLOAT64.toString(),W.BIT64],[y.INT8.toString(),W.BIT8],[y.INT16.toString(),W.BIT16],[y.INT32.toString(),W.BIT32],[y.INT64.toString(),W.BIT64],[y.TIMESTAMP.toString(),W.BIT64],[y.STRING.toString(),W.UNKNOWN],[y.JSON.toString(),W.UNKNOWN],[y.UUID.toString(),W.BIT128]]);static ALL=[y.UNKNOWN,y.FLOAT64,y.FLOAT32,y.INT64,y.INT32,y.INT16,y.INT8,y.UINT64,y.UINT32,y.UINT16,y.UINT8,y.TIMESTAMP,y.UUID,y.STRING,y.JSON];static BIG_INT_TYPES=[y.INT64,y.UINT64,y.TIMESTAMP];static z=s.z.union([s.z.string().transform(e=>new y(e)),s.z.instanceof(y)])};class S extends He{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return S.bytes(this.valueOf()+e.valueOf())}sub(e){return S.bytes(this.valueOf()-e.valueOf())}truncate(e){return new S(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return S.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/S.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/S.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/S.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/S.TERABYTE.valueOf()}toString(){const e=this.truncate(S.TERABYTE),t=this.truncate(S.GIGABYTE),n=this.truncate(S.MEGABYTE),a=this.truncate(S.KILOBYTE),i=this.truncate(S.BYTE),o=e,c=t.sub(e),l=n.sub(t),h=a.sub(n),d=i.sub(a);let u="";return o.isZero||(u+=`${o.terabytes}TB `),c.isZero||(u+=`${c.gigabytes}GB `),l.isZero||(u+=`${l.megabytes}MB `),h.isZero||(u+=`${h.kilobytes}KB `),(!d.isZero||u==="")&&(u+=`${d.valueOf()}B`),u.trim()}static bytes(e=1){return new S(e)}static BYTE=new S(1);static kilobytes(e=1){return S.bytes(e.valueOf()*1e3)}static KILOBYTE=S.kilobytes(1);static megabytes(e=1){return S.kilobytes(e.valueOf()*1e3)}static MEGABYTE=S.megabytes(1);static gigabytes(e=1){return S.megabytes(e.valueOf()*1e3)}static GIGABYTE=S.gigabytes(1);static terabytes(e){return S.gigabytes(e.valueOf()*1e3)}static TERABYTE=S.terabytes(1);static ZERO=new S(0);static z=s.z.union([s.z.number().transform(e=>new S(e)),s.z.instanceof(S)]);get isZero(){return this.valueOf()===0}}s.z.union([s.z.instanceof(Uint8Array),s.z.instanceof(Uint16Array),s.z.instanceof(Uint32Array),s.z.instanceof(BigUint64Array),s.z.instanceof(Float32Array),s.z.instanceof(Float64Array),s.z.instanceof(Int8Array),s.z.instanceof(Int16Array),s.z.instanceof(Int32Array),s.z.instanceof(BigInt64Array)]);const na=r=>{const e=typeof r;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||r instanceof O||r instanceof v||r instanceof Date},su=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(n.valueOf()):Pt(t,-n),Pt=(r,e)=>e==0?r:r==0?e:typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),au=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function iu(r){return typeof r=="string"&&au.test(r)}const F=[];for(let r=0;r<256;++r)F.push((r+256).toString(16).slice(1));function ou(r,e=0){return(F[r[e+0]]+F[r[e+1]]+F[r[e+2]]+F[r[e+3]]+"-"+F[r[e+4]]+F[r[e+5]]+"-"+F[r[e+6]]+F[r[e+7]]+"-"+F[r[e+8]]+F[r[e+9]]+"-"+F[r[e+10]]+F[r[e+11]]+F[r[e+12]]+F[r[e+13]]+F[r[e+14]]+F[r[e+15]]).toLowerCase()}function cu(r,e=0){const t=ou(r,e);if(!iu(t))throw TypeError("Stringified UUID is invalid");return t}typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const sa=(r,e)=>cu(r,e),ge=-1,jr={[Symbol.iterator]:()=>jr,next:()=>({done:!0,value:void 0})},lu=s.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer),uu=s.z.union([s.z.null(),s.z.undefined()]).transform(()=>new Uint8Array().buffer),Ur=10,aa=(r,e)=>{if(r==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(r==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},ia="sy_x_telem_series";class Y{key;discriminator=ia;dataType;sampleOffset;gl;_data;timeRange=z.ZERO;alignment=0n;cachedMin;cachedMax;writePos=ge;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=s.z.object({timeRange:z.z.optional(),dataType:I.z,alignment:s.z.coerce.bigint().optional(),data:s.z.union([lu,uu,s.z.instanceof(ArrayBuffer),s.z.instanceof(Uint8Array)]),glBufferUsage:ru.optional().default("static").optional()});static z=Y.crudeZ.transform(e=>new Y(e));constructor(e){hu(e)&&(e={data:e}),e.data??=[];const{dataType:t,timeRange:n,sampleOffset:a=0,glBufferUsage:i="static",alignment:o=0n,key:c=en(),data:l}=e;if(oa(l)){const u=l;this.key=u.key,this.dataType=u.dataType,this.sampleOffset=u.sampleOffset,this.gl=u.gl,this._data=u._data,this.timeRange=u.timeRange,this.alignment=u.alignment,this.cachedMin=u.cachedMin,this.cachedMax=u.cachedMax,this.writePos=u.writePos,this._refCount=u._refCount,this.cachedLength=u.cachedLength;return}const h=na(l),d=Array.isArray(l);if(t!=null)this.dataType=new I(t);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(d||h){let u=l;if(!h){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");u=l[0]}if(typeof u=="string")this.dataType=I.STRING;else if(typeof u=="number")this.dataType=I.FLOAT64;else if(typeof u=="bigint")this.dataType=I.INT64;else if(typeof u=="boolean")this.dataType=I.BOOLEAN;else if(u instanceof O||u instanceof Date||u instanceof O)this.dataType=I.TIMESTAMP;else if(typeof u=="object")this.dataType=I.JSON;else throw new Error(`cannot infer data type of ${typeof u} when constructing a Series from a JS array`)}else this.dataType=new I(l)}if(!d&&!h)this._data=l;else if(d&&l.length===0)this._data=new this.dataType.Array([]).buffer;else{let u=h?[l]:l;const N=u[0];(N instanceof O||N instanceof Date||N instanceof v)&&(u=u.map(E=>new O(E).valueOf())),this.dataType.equals(I.STRING)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.join(`
67
9
  `)}
68
- `).buffer):this.dataType.equals(je.JSON)?(this.cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(p=>Vo.encodeString(p)).join(`
10
+ `).buffer):this.dataType.equals(I.JSON)?(this.cachedLength=u.length,this._data=new TextEncoder().encode(`${u.map(E=>lt.encodeString(E)).join(`
69
11
  `)}
70
- `).buffer):this.dataType.usesBigInt&&typeof g=="number"?this._data=new this.dataType.Array(d.map(p=>BigInt(Math.round(p)))).buffer:!this.dataType.usesBigInt&&typeof g=="bigint"?this._data=new this.dataType.Array(d.map(p=>Number(p))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=o,this.alignment=a,this.sampleOffset=n??0,this.timeRange=i??Qr.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:s}}static alloc({capacity:e,dataType:r,...i}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const n=new new je(r).Array(e),s=new Vn({data:n.buffer,dataType:r,...i});return s.writePos=0,s}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===Kt)return 0;const r=this.byteCapacity.valueOf()-this.writePos,i=e.subBytes(0,r);return this.writeToUnderlyingData(i),this.writePos+=i.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=i.length,this.calculateCachedLength()),i.length}writeFixed(e){if(this.writePos===Kt)return 0;const r=this.capacity-this.writePos,i=e.sub(0,r);return this.writeToUnderlyingData(i),this.cachedLength=void 0,this.maybeRecomputeMinMax(i),this.writePos+=i.length,i.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Kt?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
71
- `).slice(0,-1):Array.from(this).map(e=>e.toString())}toUUIDs(){if(!this.dataType.equals(je.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=je.UUID.density.valueOf(),r=new Uint8Array(this.underlyingData.buffer);return Array.from({length:this.length},(i,n)=>lZ(r,n*e))}parseJSON(e){if(!this.dataType.equals(je.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(r=>e.parse(Vo.decodeString(r)))}get byteCapacity(){return new Ho(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Kt?this.byteCapacity:this.dataType.isVariable?new Ho(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Kt?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const r=[0];return this.data.forEach((i,n)=>{i===Qo&&(e++,r.push(n+1))}),this._cachedIndexes=r,this.cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const i=new e.Array(this.length);for(let n=0;n<this.length;n++)i[n]=sZ(this.dataType,e,this.data[n],r);return new Vn({data:i.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(je.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}else{const e=this.data;this.cachedMax=e.reduce((r,i)=>r>i?r:i)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??(this.cachedMax=this.calcRawMax()),bs(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(je.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}else{const e=this.data;this.cachedMin=e.reduce((r,i)=>r<i?r:i)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??(this.cachedMin=this.calcRawMin()),bs(this.cachedMin,this.sampleOffset))}get bounds(){return hn(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const r=e.cachedMin??e.calcRawMin();r<this.cachedMin&&(this.cachedMin=r)}if(this.cachedMax!=null){const r=e.cachedMax??e.calcRawMax();r>this.cachedMax&&(this.cachedMax=r)}}atAlignment(e,r){const i=Number(e-this.alignment);if(i<0||i>=this.length){if(r===!0)throw new Error(`[series] - no value at index ${i}`);return}return this.at(i,r)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const i=this.data[e];if(i==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return bs(i,this.sampleOffset)}atVariable(e,r){let i=0,n=0;if(this._cachedIndexes!=null)i=this._cachedIndexes[e],n=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Qo){if(e===0){n=a;break}i=a+1,e--}if(n===0&&(n=this.data.length),i>=n||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}}const s=this.data.slice(i,n);return this.dataType.equals(je.STRING)?new TextDecoder().decode(s):U$(JSON.parse(new TextDecoder().decode(s)))}binarySearch(e){let r=0,i=this.length-1;const n=zE(e);for(;r<=i;){const s=Math.floor((r+i)/2),a=n(this.at(s,!0),e);if(a===0)return s;a<0?r=s+1:i=s-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(je.FLOAT32)&&!this.dataType.equals(je.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:r,bufferUsage:i,prevBuffer:n}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==n)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Kt){n===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const s=this.dataType.density.size(n).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,s,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,i==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Kt}as(e){return fZ(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Af(this.alignmentBounds.lower),upper:Af(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return hn(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new vZ(this);return this.dataType.equals(je.JSON)?new gZ(e):e}return new yZ(this)}slice(e,r){return this.sliceSub(!1,e,r)}sub(e,r){return this.sliceSub(!0,e,r)}subIterator(e,r){return new jf(this,e,r??this.length)}subAlignmentIterator(e,r){return new jf(this,Number(e-this.alignment),Number(r-this.alignment))}subBytes(e,r){if(e>=0&&(r==null||r>=this.byteLength.valueOf()))return this;const i=this.data.subarray(e,r);return new Vn({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,r,i){if(r<=0&&(i==null||i>=this.length))return this;let n;return e?n=this.data.subarray(r,i):n=this.data.slice(r,i),new Vn({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(r)})}reAlign(e){return new Vn({data:this.buffer,dataType:this.dataType,timeRange:Qr.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,r;let i=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)i+=Array.from(this).map(n=>n.toString());else{for(let n=0;n<5;n++)i+=`${(e=this.at(n))==null?void 0:e.toString()}`,i+=",";i+="...,";for(let n=-5;n<0;n++)i+=(r=this.at(n))==null?void 0:r.toString(),n<-1&&(i+=",")}return i+="])",i}};U(Yr,"crudeZ",pe({timeRange:Qr.z.optional(),dataType:je.z,alignment:Bk().optional(),data:Ue([dZ,mZ,ye(ArrayBuffer),ye(Uint8Array)]),glBufferUsage:iZ.optional().default("static").optional()})),U(Yr,"z",Yr.crudeZ.transform(t=>new Yr(t)));let Vk=Yr;const hZ=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Vk?!0:qk(t),pZ=rZ(Jk,Vk);class jf{constructor(e,r,i){U(this,"series"),U(this,"end"),U(this,"index"),this.series=e;const n=hn(0,e.length);this.end=zf(n,i),this.index=zf(n,r)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class vZ{constructor(e){if(U(this,"series"),U(this,"index"),U(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==Qo;)this.index++;const i=this.index;return e===i?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,i))})}}const Wk=class Gk{constructor(e){U(this,"wrapped"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Vo.decodeString(e.value,Gk.schema)}}};U(Wk,"schema",Ua(Te(),vr()));let gZ=Wk;class yZ{constructor(e){U(this,"series"),U(this,"index"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}const Af=t=>{const e=t>>32n,r=t&0xffffffffn;return{domain:e,sample:r}};pe({key:Te(),value:Te()});Ua(Ue([Q(),Te(),H_()]),vr());const Yk=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",$Z=Yk(),Kk=["macOS","Windows","Linux"],bZ=["macos","windows","linux"],wZ={macos:"macOS",windows:"Windows",linux:"Linux"},_Z=Ke(Kk).or(Ke(bZ).transform(t=>wZ[t])),kZ=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"macOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"};let ho;const IZ=(t={})=>{const{force:e,default:r}=t;return e??ho??(ho=kZ(),ho??r)},Xk=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Kk,RUNTIME:$Z,detect:Yk,getOS:IZ,osZ:_Z},Symbol.toStringTag,{value:"Module"}));var OZ=Object.defineProperty,SZ=(t,e,r)=>e in t?OZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kr=(t,e,r)=>SZ(t,typeof e!="symbol"?e+"":e,r);const NZ=(...t)=>t.map(Hk).join(""),Hk=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),TZ=t=>t.endsWith("/")?t.slice(0,-1):t,zZ=(t,e="")=>t===null?"":`?${Object.entries(t).filter(([,r])=>r==null?!1:Array.isArray(r)?r.length>0:!0).map(([r,i])=>`${e}${r}=${i}`).join("&")}`,eu=class tu{constructor({host:e,port:r,protocol:i="",pathPrefix:n=""}){Kr(this,"protocol"),Kr(this,"host"),Kr(this,"port"),Kr(this,"path"),this.protocol=i,this.host=e,this.port=r,this.path=Hk(n)}replace(e){return new tu({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new tu({...this,pathPrefix:NZ(this.path,e)})}toString(){return TZ(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Kr(eu,"UNKNOWN",new eu({host:"unknown",port:0}));let xZ=eu;var EZ=Object.defineProperty,UZ=(t,e,r)=>e in t?EZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Et=(t,e,r)=>UZ(t,typeof e!="symbol"?e+"":e,r);const ZZ=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${X(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:s.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${s.suffix}"`:s.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${s.includes}"`:s.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${s.pattern}`:`${i[s.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${j(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function PZ(){return{localeError:ZZ()}}const jZ=()=>{const t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${X(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Yanlış mətn: "${s.prefix}" ilə başlamalıdır`:s.format==="ends_with"?`Yanlış mətn: "${s.suffix}" ilə bitməlidir`:s.format==="includes"?`Yanlış mətn: "${s.includes}" daxil olmalıdır`:s.format==="regex"?`Yanlış mətn: ${s.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[s.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function AZ(){return{localeError:jZ()}}function Df(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const DZ=()=>{const t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${X(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=Df(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${s}${n.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=Df(o,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${s}${n.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${s.prefix}"`:s.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${s.suffix}"`:s.format==="includes"?`Няправільны радок: павінен змяшчаць "${s.includes}"`:s.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${s.pattern}`:`Няправільны ${i[s.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${j(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function CZ(){return{localeError:DZ()}}const RZ=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${X(n.values[0])}`:`Opció invàlida: s'esperava una de ${j(n.values," o ")}`;case"too_big":{const s=n.inclusive?"com a màxim":"menys de",a=e(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${s} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"com a mínim":"més de",a=e(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${s} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Format invàlid: ha de començar amb "${s.prefix}"`:s.format==="ends_with"?`Format invàlid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format invàlid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${s.pattern}`:`Format invàlid per a ${i[s.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function LZ(){return{localeError:RZ()}}const MZ=()=>{const t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${X(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${s}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${s}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neplatný řetězec: musí začínat na "${s.prefix}"`:s.format==="ends_with"?`Neplatný řetězec: musí končit na "${s.suffix}"`:s.format==="includes"?`Neplatný řetězec: musí obsahovat "${s.includes}"`:s.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${s.pattern}`:`Neplatný formát ${i[s.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${j(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function BZ(){return{localeError:MZ()}}const FZ=()=>{const t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${X(n.values[0])}`:`Ungültige Option: erwartet eine von ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${s}${n.maximum.toString()} ist`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${s}${n.minimum.toString()} ist`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ungültiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ungültiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ungültiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ungültiger String: muss dem Muster ${s.pattern} entsprechen`:`Ungültig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function qZ(){return{localeError:FZ()}}const JZ=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},VZ=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${JZ(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${X(i.values[0])}`:`Invalid option: expected one of ${j(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${n}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Too small: expected ${i.origin} to have ${n}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${j(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Qk(){return{localeError:VZ()}}const WZ=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: se esperaba ${X(n.values[0])}`:`Opción inválida: se esperaba una de ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${s}${n.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${n.origin} fuera ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function GZ(){return{localeError:WZ()}}const YZ=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: می‌بایست ${X(n.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${j(n.values,"|")} می‌بود`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${s}${n.maximum.toString()} باشد`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${s}${n.minimum.toString()} باشد`}case"invalid_format":{const s=n;return s.format==="starts_with"?`رشته نامعتبر: باید با "${s.prefix}" شروع شود`:s.format==="ends_with"?`رشته نامعتبر: باید با "${s.suffix}" تمام شود`:s.format==="includes"?`رشته نامعتبر: باید شامل "${s.includes}" باشد`:s.format==="regex"?`رشته نامعتبر: باید با الگوی ${s.pattern} مطابقت داشته باشد`:`${i[s.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${j(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function KZ(){return{localeError:YZ()}}const XZ=()=>{const t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${X(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${s}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${s}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen syöte: täytyy sisältää "${s.includes}"`:s.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${s.pattern}`:`Virheellinen ${i[s.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${j(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function HZ(){return{localeError:XZ()}}const QZ=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${X(n.values[0])} attendu`:`Option invalide : une valeur parmi ${j(n.values,"|")} attendue`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${j(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function e4(){return{localeError:QZ()}}const t4=()=>{const t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${X(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"≤":"<",a=e(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${s}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"≥":">",a=e(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${s}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chaîne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Chaîne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Chaîne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Chaîne invalide : doit correspondre au motif ${s.pattern}`:`${i[s.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${j(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function n4(){return{localeError:t4()}}const r4=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return n=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":return n.values.length===1?`קלט לא תקין: צריך ${X(n.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${n.origin??"value"} צריך להיות ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()} ${a.unit}`:`קטן מדי: ${n.origin} צריך להיות ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${s.prefix}"`:s.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${s.suffix}"`:s.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${s.includes}"`:s.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${s.pattern}`:`${i[s.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${j(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function i4(){return{localeError:r4()}}const s4=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${X(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${s}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${s}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Érvénytelen string: "${s.prefix}" értékkel kell kezdődnie`:s.format==="ends_with"?`Érvénytelen string: "${s.suffix}" értékkel kell végződnie`:s.format==="includes"?`Érvénytelen string: "${s.includes}" értéket kell tartalmaznia`:s.format==="regex"?`Érvénytelen string: ${s.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[s.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function a4(){return{localeError:s4()}}const o4=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${X(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${i[s.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function u4(){return{localeError:o4()}}const c4=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${X(n.values[0])}`:`Opzione non valida: atteso uno tra ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${s}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${s}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${j(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function l4(){return{localeError:c4()}}const d4=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${X(n.values[0])}が期待されました`:`無効な選択: ${j(n.values,"、")}のいずれかである必要があります`;case"too_big":{const s=n.inclusive?"以下である":"より小さい",a=e(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${s}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s}必要があります`}case"too_small":{const s=n.inclusive?"以上である":"より大きい",a=e(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${s}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s}必要があります`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無効な文字列: "${s.prefix}"で始まる必要があります`:s.format==="ends_with"?`無効な文字列: "${s.suffix}"で終わる必要があります`:s.format==="includes"?`無効な文字列: "${s.includes}"を含む必要があります`:s.format==="regex"?`無効な文字列: パターン${s.pattern}に一致する必要があります`:`無効な${i[s.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${j(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function m4(){return{localeError:d4()}}const f4=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${X(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${s.prefix}"`:s.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${s.suffix}"`:s.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${s.includes}"`:s.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${s.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[s.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${j(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function h4(){return{localeError:f4()}}const p4=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${X(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${j(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const s=n.inclusive?"이하":"미만",a=s==="미만"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${s}${a}`}case"too_small":{const s=n.inclusive?"이상":"초과",a=s==="이상"?"이어야 합니다":"여야 합니다",o=e(n.origin),u=(o==null?void 0:o.unit)??"요소";return o?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${u} ${s}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${s}${a}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`잘못된 문자열: "${s.prefix}"(으)로 시작해야 합니다`:s.format==="ends_with"?`잘못된 문자열: "${s.suffix}"(으)로 끝나야 합니다`:s.format==="includes"?`잘못된 문자열: "${s.includes}"을(를) 포함해야 합니다`:s.format==="regex"?`잘못된 문자열: 정규식 ${s.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[s.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${j(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function v4(){return{localeError:p4()}}const g4=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${X(n.values[0])}`:`Грешана опција: се очекува една ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${s}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${s}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неважечка низа: мора да започнува со "${s.prefix}"`:s.format==="ends_with"?`Неважечка низа: мора да завршува со "${s.suffix}"`:s.format==="includes"?`Неважечка низа: мора да вклучува "${s.includes}"`:s.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${s.pattern}`:`Invalid ${i[s.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${j(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function y4(){return{localeError:g4()}}const $4=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${X(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${i[s.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${j(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function b4(){return{localeError:$4()}}const w4=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${X(n.values[0])}`:`Ongeldige optie: verwacht één van ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${n.origin??"waarde"} ${s}${n.maximum.toString()} is`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${n.origin} ${s}${n.minimum.toString()} is`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${i[s.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function _4(){return{localeError:w4()}}const k4=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${X(n.values[0])}`:`Ugyldig valg: forventet en av ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ugyldig streng: må starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: må ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: må inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: må matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function I4(){return{localeError:k4()}}const O4=()=>{const t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${X(n.values[0])}`:`Fâsit tercih: mûteberler ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${s}${n.maximum.toString()} olmalıydı.`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${s}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Fâsit metin: "${s.prefix}" ile başlamalı.`:s.format==="ends_with"?`Fâsit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`Fâsit metin: "${s.includes}" ihtivâ etmeli.`:s.format==="regex"?`Fâsit metin: ${s.pattern} nakşına uymalı.`:`Fâsit ${i[s.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function S4(){return{localeError:O4()}}const N4=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${X(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${j(n.values,"|")} څخه وای`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${s}${n.maximum.toString()} وي`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${s}${n.minimum.toString()} وي`}case"invalid_format":{const s=n;return s.format==="starts_with"?`ناسم متن: باید د "${s.prefix}" سره پیل شي`:s.format==="ends_with"?`ناسم متن: باید د "${s.suffix}" سره پای ته ورسيږي`:s.format==="includes"?`ناسم متن: باید "${s.includes}" ولري`:s.format==="regex"?`ناسم متن: باید د ${s.pattern} سره مطابقت ولري`:`${i[s.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${j(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function T4(){return{localeError:N4()}}const z4=()=>{const t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${X(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${s}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${s.prefix}"`:s.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${s.suffix}"`:s.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${s.includes}"`:s.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${s.pattern}`:`Nieprawidłow(y/a/e) ${i[s.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function x4(){return{localeError:z4()}}const E4=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${X(n.values[0])}`:`Opção inválida: esperada uma das ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${s}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${s}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Texto inválido: deve começar com "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`${i[s.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function U4(){return{localeError:E4()}}function Cf(t,e,r,i){const n=Math.abs(t),s=n%10,a=n%100;return a>=11&&a<=19?i:s===1?e:s>=2&&s<=4?r:i}const Z4=()=>{const t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${X(n.values[0])}`:`Неверный вариант: ожидалось одно из ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);if(a){const o=Number(n.maximum),u=Cf(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${s}${n.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);if(a){const o=Number(n.minimum),u=Cf(o,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${s}${n.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неверная строка: должна начинаться с "${s.prefix}"`:s.format==="ends_with"?`Неверная строка: должна заканчиваться на "${s.suffix}"`:s.format==="includes"?`Неверная строка: должна содержать "${s.includes}"`:s.format==="regex"?`Неверная строка: должна соответствовать шаблону ${s.pattern}`:`Неверный ${i[s.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function P4(){return{localeError:Z4()}}const j4=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${X(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${s}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${s}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Neveljaven niz: mora se začeti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se končati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${i[s.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${j(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function A4(){return{localeError:j4()}}const D4=()=>{const t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${X(n.values[0])}`:`Ogiltigt val: förväntade en av ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Ogiltig sträng: måste börja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig sträng: måste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig sträng: måste innehålla "${s.includes}"`:s.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${s.pattern}"`:`Ogiltig(t) ${i[s.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${j(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function C4(){return{localeError:D4()}}const R4=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${X(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${j(n.values,"|")} இல் ஒன்று`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${s}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${s}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const s=n;return s.format==="starts_with"?`தவறான சரம்: "${s.prefix}" இல் தொடங்க வேண்டும்`:s.format==="ends_with"?`தவறான சரம்: "${s.suffix}" இல் முடிவடைய வேண்டும்`:s.format==="includes"?`தவறான சரம்: "${s.includes}" ஐ உள்ளடக்க வேண்டும்`:s.format==="regex"?`தவறான சரம்: ${s.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[s.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function L4(){return{localeError:R4()}}const M4=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${X(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=e(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${s} ${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?"อย่างน้อย":"มากกว่า",a=e(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${s} ${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${s.prefix}"`:s.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${s.suffix}"`:s.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${s.includes}" อยู่ในข้อความ`:s.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${s.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[s.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${j(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function B4(){return{localeError:M4()}}const F4=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},q4=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(i){return t[i]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Geçersiz değer: beklenen ${i.expected}, alınan ${F4(i.input)}`;case"invalid_value":return i.values.length===1?`Geçersiz değer: beklenen ${X(i.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${j(i.values,"|")}`;case"too_big":{const n=i.inclusive?"<=":"<",s=e(i.origin);return s?`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()} ${s.unit??"öğe"}`:`Çok büyük: beklenen ${i.origin??"değer"} ${n}${i.maximum.toString()}`}case"too_small":{const n=i.inclusive?">=":">",s=e(i.origin);return s?`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()} ${s.unit}`:`Çok küçük: beklenen ${i.origin} ${n}${i.minimum.toString()}`}case"invalid_format":{const n=i;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??i.format}`}case"not_multiple_of":return`Geçersiz sayı: ${i.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${i.keys.length>1?"lar":""}: ${j(i.keys,", ")}`;case"invalid_key":return`${i.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${i.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function J4(){return{localeError:q4()}}const V4=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${X(n.values[0])}`:`Неправильна опція: очікується одне з ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Неправильний рядок: повинен починатися з "${s.prefix}"`:s.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${s.suffix}"`:s.format==="includes"?`Неправильний рядок: повинен містити "${s.includes}"`:s.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${s.pattern}`:`Неправильний ${i[s.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${j(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function W4(){return{localeError:V4()}}const G4=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${X(n.values[0])} متوقع تھا`:`غلط آپشن: ${j(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${s}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${s}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${s}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${s}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const s=n;return s.format==="starts_with"?`غلط سٹرنگ: "${s.prefix}" سے شروع ہونا چاہیے`:s.format==="ends_with"?`غلط سٹرنگ: "${s.suffix}" پر ختم ہونا چاہیے`:s.format==="includes"?`غلط سٹرنگ: "${s.includes}" شامل ہونا چاہیے`:s.format==="regex"?`غلط سٹرنگ: پیٹرن ${s.pattern} سے میچ ہونا چاہیے`:`غلط ${i[s.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${j(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Y4(){return{localeError:G4()}}const K4=()=>{const t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${X(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${s}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${s}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${s.prefix}"`:s.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${s.suffix}"`:s.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${s.includes}"`:s.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${s.pattern}`:`${i[s.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${j(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function X4(){return{localeError:K4()}}const H4=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${X(n.values[0])}`:`无效选项:期望以下之一 ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`无效字符串:必须以 "${s.prefix}" 开头`:s.format==="ends_with"?`无效字符串:必须以 "${s.suffix}" 结尾`:s.format==="includes"?`无效字符串:必须包含 "${s.includes}"`:s.format==="regex"?`无效字符串:必须满足正则表达式 ${s.pattern}`:`无效${i[s.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${j(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Q4(){return{localeError:H4()}}const e6=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(n){return t[n]??null}const r=n=>{const s=typeof n;switch(s){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return s},i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${X(n.values[0])}`:`無效的選項:預期為以下其中之一 ${j(n.values,"|")}`;case"too_big":{const s=n.inclusive?"<=":"<",a=e(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${s}${n.maximum.toString()}`}case"too_small":{const s=n.inclusive?">=":">",a=e(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${s}${n.minimum.toString()}`}case"invalid_format":{const s=n;return s.format==="starts_with"?`無效的字串:必須以 "${s.prefix}" 開頭`:s.format==="ends_with"?`無效的字串:必須以 "${s.suffix}" 結尾`:s.format==="includes"?`無效的字串:必須包含 "${s.includes}"`:s.format==="regex"?`無效的字串:必須符合格式 ${s.pattern}`:`無效的 ${i[s.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${j(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function t6(){return{localeError:e6()}}const eI=Object.freeze(Object.defineProperty({__proto__:null,ar:PZ,az:AZ,be:CZ,ca:LZ,cs:BZ,de:qZ,en:Qk,es:GZ,fa:KZ,fi:HZ,fr:e4,frCA:n4,he:i4,hu:a4,id:u4,it:l4,ja:m4,kh:h4,ko:v4,mk:y4,ms:b4,nl:_4,no:I4,ota:S4,pl:x4,ps:T4,pt:U4,ru:P4,sl:A4,sv:C4,ta:L4,th:B4,tr:J4,ua:W4,ur:Y4,vi:X4,zhCN:Q4,zhTW:t6},Symbol.toStringTag,{value:"Module"}));class tI{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=(...i)=>{const n=this._def.input?Wo(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=e(...n);return this._def.output?Wo(this._def.output,s,void 0,{callee:r}):s};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");const r=async(...i)=>{const n=this._def.input?await Go(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw new Error("Invalid arguments schema: not an array or tuple schema.");const s=await e(...n);return this._def.output?Go(this._def.output,s,void 0,{callee:r}):s};return r}input(...e){const r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new _a({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){const r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}}function nI(t){return new tI({type:"function",input:Array.isArray(t==null?void 0:t.input)?D_(_a,t==null?void 0:t.input):(t==null?void 0:t.input)??dd(Sl,Cs(As)),output:(t==null?void 0:t.output)??Cs(As)})}class nu{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??mn,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var i,n,s,a;const o=e._zod.def,u={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(e);if(c)return c.count++,r.schemaPath.includes(e)&&(c.cycle=r.path),c.schema;const l={schema:{},count:1,cycle:void 0};this.seen.set(e,l);const d=(n=(i=e._zod).toJSONSchema)==null?void 0:n.call(i);if(d)l.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path},_=e._zod.parent;if(_)l.ref=_,this.process(_,p),this.seen.get(_).isParent=!0;else{const k=l.schema;switch(o.type){case"string":{const m=k;m.type="string";const{minimum:h,maximum:v,format:w,patterns:I,contentEncoding:A}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof v=="number"&&(m.maxLength=v),w&&(m.format=u[w]??w,m.format===""&&delete m.format),A&&(m.contentEncoding=A),I&&I.size>0){const J=[...I];J.length===1?m.pattern=J[0].source:J.length>1&&(l.schema.allOf=[...J.map(ce=>({...this.target==="draft-7"?{type:"string"}:{},pattern:ce.source}))])}break}case"number":{const m=k,{minimum:h,maximum:v,format:w,multipleOf:I,exclusiveMaximum:A,exclusiveMinimum:J}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof J=="number"&&(m.exclusiveMinimum=J),typeof h=="number"&&(m.minimum=h,typeof J=="number"&&(J>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof A=="number"&&(m.exclusiveMaximum=A),typeof v=="number"&&(m.maximum=v,typeof A=="number"&&(A<=v?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{const m=k;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const m=k;m.type="null";break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"never":{k.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const m=k,{minimum:h,maximum:v}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof v=="number"&&(m.maxItems=v),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{const m=k;m.type="object",m.properties={};const h=o.shape;for(const I in h)m.properties[I]=this.process(h[I],{...p,path:[...p.path,"properties",I]});const v=new Set(Object.keys(h)),w=new Set([...v].filter(I=>{const A=o.shape[I]._zod;return this.io==="input"?A.optin===void 0:A.optout===void 0}));w.size>0&&(m.required=Array.from(w)),((s=o.catchall)==null?void 0:s._zod.def.type)==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=k;m.anyOf=o.options.map((h,v)=>this.process(h,{...p,path:[...p.path,"anyOf",v]}));break}case"intersection":{const m=k,h=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),v=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=A=>"allOf"in A&&Object.keys(A).length===1,I=[...w(h)?h.allOf:[h],...w(v)?v.allOf:[v]];m.allOf=I;break}case"tuple":{const m=k;m.type="array";const h=o.items.map((I,A)=>this.process(I,{...p,path:[...p.path,"prefixItems",A]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){const I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));const{minimum:v,maximum:w}=e._zod.bag;typeof v=="number"&&(m.minItems=v),typeof w=="number"&&(m.maxItems=w);break}case"record":{const m=k;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const m=k,h=ll(o.entries);h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),m.enum=h;break}case"literal":{const m=k,h=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(v))}else h.push(v);if(h.length!==0)if(h.length===1){const v=h[0];m.type=v===null?"null":typeof v,m.const=v}else h.every(v=>typeof v=="number")&&(m.type="number"),h.every(v=>typeof v=="string")&&(m.type="string"),h.every(v=>typeof v=="boolean")&&(m.type="string"),h.every(v=>v===null)&&(m.type="null"),m.enum=h;break}case"file":{const m=k,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:w,mime:I}=e._zod.bag;v!==void 0&&(h.minLength=v),w!==void 0&&(h.maxLength=w),I?I.length===1?(h.contentMediaType=I[0],Object.assign(m,h)):m.anyOf=I.map(A=>({...h,contentMediaType:A})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(o.innerType,p);k.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"success":{const m=k;m.type="boolean";break}case"default":{this.process(o.innerType,p),l.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),l.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),l.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=k,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{const m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),l.ref=m;break}case"readonly":{this.process(o.innerType,p),l.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,p),l.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),l.ref=o.innerType;break}case"lazy":{const m=e._zod.innerType;this.process(m,p),l.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const g=this.metadataRegistry.get(e);return g&&Object.assign(l.schema,g),this.io==="input"&&qe(e)&&(delete l.schema.examples,delete l.schema.default),this.io==="input"&&l.schema._prefault&&((a=l.schema).default??(a.default=l.schema._prefault)),delete l.schema._prefault,this.seen.get(e).schema}emit(e,r){var i,n,s,a;const o={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},u=this.seen.get(e);if(!u)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=_=>{var k;const m=this.target==="draft-2020-12"?"$defs":"definitions";if(o.external){const w=(k=o.external.registry.get(_[0]))==null?void 0:k.id;if(w)return{ref:o.external.uri(w)};const I=_[1].defId??_[1].schema.id??`schema${this.counter++}`;return _[1].defId=I,{defId:I,ref:`${o.external.uri("__shared")}#/${m}/${I}`}}if(_[1]===u)return{ref:"#"};const h=`#/${m}/`,v=_[1].schema.id??`__schema${this.counter++}`;return{defId:v,ref:h+v}},l=_=>{if(_[1].schema.$ref)return;const k=_[1],{ref:m,defId:h}=c(_);k.def={...k.schema},h&&(k.defId=h);const v=k.schema;for(const w in v)delete v[w];v.$ref=m};for(const _ of this.seen.entries()){const k=_[1];if(e===_[0]){l(_);continue}if(o.external){const m=(i=o.external.registry.get(_[0]))==null?void 0:i.id;if(e!==_[0]&&m){l(_);continue}}if((n=this.metadataRegistry.get(_[0]))!=null&&n.id){l(_);continue}if(k.cycle){if(o.cycles==="throw")throw new Error(`Cycle detected: #/${(s=k.cycle)==null?void 0:s.join("/")}/<root>
72
-
73
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);o.cycles==="ref"&&l(_);continue}if(k.count>1&&o.reused==="ref"){l(_);continue}}const d=(_,k)=>{const m=this.seen.get(_),h=m.def??m.schema,v={...h};if(m.ref===null)return;const w=m.ref;if(m.ref=null,w){d(w,k);const I=this.seen.get(w).schema;I.$ref&&k.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(I)):(Object.assign(h,I),Object.assign(h,v))}m.isParent||this.override({zodSchema:_,jsonSchema:h})};for(const _ of[...this.seen.entries()].reverse())d(_[0],{target:this.target});const g={};this.target==="draft-2020-12"?g.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?g.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(g,u.def);const p=((a=o.external)==null?void 0:a.defs)??{};for(const _ of this.seen.entries()){const k=_[1];k.def&&k.defId&&(p[k.defId]=k.def)}!o.external&&Object.keys(p).length>0&&(this.target==="draft-2020-12"?g.$defs=p:g.definitions=p);try{return JSON.parse(JSON.stringify(g))}catch{throw new Error("Error converting schema to JSON.")}}}function rI(t,e){if(t instanceof xl){const i=new nu(e),n={};for(const o of t._idmap.entries()){const[u,c]=o;i.process(c)}const s={},a={registry:t,uri:(e==null?void 0:e.uri)||(o=>o),defs:n};for(const o of t._idmap.entries()){const[u,c]=o;s[u]=i.emit(c,{...e,external:a})}if(Object.keys(n).length>0){const o=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[o]:n}}return{schemas:s}}const r=new nu(e);return r.process(t),r.emit(t,e)}function qe(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return qe(i.element,r);case"object":{for(const n in i.shape)if(qe(i.shape[n],r))return!0;return!1}case"union":{for(const n of i.options)if(qe(n,r))return!0;return!1}case"intersection":return qe(i.left,r)||qe(i.right,r);case"tuple":{for(const n of i.items)if(qe(n,r))return!0;return!!(i.rest&&qe(i.rest,r))}case"record":return qe(i.keyType,r)||qe(i.valueType,r);case"map":return qe(i.keyType,r)||qe(i.valueType,r);case"set":return qe(i.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return qe(i.innerType,r);case"lazy":return qe(i.getter(),r);case"default":return qe(i.innerType,r);case"prefault":return qe(i.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return qe(i.in,r)||qe(i.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const n6=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),r6=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:zw,$ZodArray:Sl,$ZodAsyncError:mr,$ZodBase64:yw,$ZodBase64URL:bw,$ZodBigInt:Ol,$ZodBigIntFormat:Ow,$ZodBoolean:Il,$ZodCIDRv4:vw,$ZodCIDRv6:gw,$ZodCUID:sw,$ZodCUID2:aw,$ZodCatch:Gw,$ZodCheck:Le,$ZodCheckBigIntFormat:jb,$ZodCheckEndsWith:Wb,$ZodCheckGreaterThan:wl,$ZodCheckIncludes:Jb,$ZodCheckLengthEquals:Mb,$ZodCheckLessThan:bl,$ZodCheckLowerCase:Fb,$ZodCheckMaxLength:Rb,$ZodCheckMaxSize:Ab,$ZodCheckMimeType:Yb,$ZodCheckMinLength:Lb,$ZodCheckMinSize:Db,$ZodCheckMultipleOf:Zb,$ZodCheckNumberFormat:Pb,$ZodCheckOverwrite:Kb,$ZodCheckProperty:Gb,$ZodCheckRegex:Bb,$ZodCheckSizeEquals:Cb,$ZodCheckStartsWith:Vb,$ZodCheckStringFormat:Zi,$ZodCheckUpperCase:qb,$ZodCustom:e_,$ZodDate:Uw,$ZodDefault:qw,$ZodDiscriminatedUnion:Pw,$ZodE164:ww,$ZodEmail:tw,$ZodEmoji:rw,$ZodEnum:Rw,$ZodError:ml,$ZodFile:Mw,$ZodFunction:tI,$ZodGUID:Qb,$ZodIPv4:hw,$ZodIPv6:pw,$ZodISODate:dw,$ZodISODateTime:lw,$ZodISODuration:fw,$ZodISOTime:mw,$ZodIntersection:jw,$ZodJWT:kw,$ZodKSUID:cw,$ZodLazy:Qw,$ZodLiteral:Lw,$ZodMap:Dw,$ZodNaN:Yw,$ZodNanoID:iw,$ZodNever:xw,$ZodNonOptional:Vw,$ZodNull:Tw,$ZodNullable:Fw,$ZodNumber:kl,$ZodNumberFormat:Iw,$ZodObject:Zw,$ZodOptional:Bw,$ZodPipe:zl,$ZodPrefault:Jw,$ZodPromise:Hw,$ZodReadonly:Kw,$ZodRealError:Ui,$ZodRecord:Aw,$ZodRegistry:xl,$ZodSet:Cw,$ZodString:Pi,$ZodStringFormat:be,$ZodSuccess:Ww,$ZodSymbol:Sw,$ZodTemplateLiteral:Xw,$ZodTransform:Tl,$ZodTuple:_a,$ZodType:F,$ZodULID:ow,$ZodURL:nw,$ZodUUID:ew,$ZodUndefined:Nw,$ZodUnion:Nl,$ZodUnknown:As,$ZodVoid:Ew,$ZodXID:uw,$brand:Z$,$constructor:b,$input:n_,$output:t_,Doc:Xb,JSONSchema:n6,JSONSchemaGenerator:nu,TimePrecision:s_,_any:S_,_array:dd,_base64:Yl,_base64url:Kl,_bigint:$_,_boolean:g_,_catch:h1,_cidrv4:Wl,_cidrv6:Gl,_coercedBigint:b_,_coercedBoolean:y_,_coercedDate:x_,_coercedNumber:d_,_coercedString:i_,_cuid:Ll,_cuid2:Ml,_custom:R_,_date:z_,_default:d1,_discriminatedUnion:e1,_e164:Xl,_email:Ul,_emoji:Cl,_endsWith:sd,_enum:s1,_file:C_,_float32:f_,_float64:h_,_gt:wn,_gte:pt,_guid:Ds,_includes:rd,_int:m_,_int32:p_,_int64:w_,_intersection:t1,_ipv4:Jl,_ipv6:Vl,_isoDate:o_,_isoDateTime:a_,_isoDuration:c_,_isoTime:u_,_jwt:Hl,_ksuid:ql,_lazy:y1,_length:Oa,_literal:o1,_lowercase:td,_lt:bn,_lte:_t,_map:r1,_max:_t,_maxLength:Ia,_maxSize:ka,_mime:ad,_min:pt,_minLength:pr,_minSize:mi,_multipleOf:di,_nan:E_,_nanoid:Rl,_nativeEnum:a1,_negative:Z_,_never:N_,_nonnegative:j_,_nonoptional:m1,_nonpositive:P_,_normalize:od,_null:O_,_nullable:l1,_number:l_,_optional:c1,_overwrite:Zn,_parse:pl,_parseAsync:vl,_pipe:p1,_positive:U_,_promise:$1,_property:A_,_readonly:v1,_record:n1,_refine:L_,_regex:ed,_safeParse:gl,_safeParseAsync:yl,_set:i1,_size:Ql,_startsWith:id,_string:r_,_stringbool:M_,_success:f1,_symbol:k_,_templateLiteral:g1,_toLowerCase:cd,_toUpperCase:ld,_transform:u1,_trim:ud,_tuple:D_,_uint32:v_,_uint64:__,_ulid:Bl,_undefined:I_,_union:QE,_unknown:Cs,_uppercase:nd,_url:Dl,_uuid:Zl,_uuidv4:Pl,_uuidv6:jl,_uuidv7:Al,_void:T_,_xid:Fl,clone:At,config:dt,flattenError:fl,formatError:hl,function:nI,globalConfig:Zs,globalRegistry:mn,isValidBase64:_l,isValidBase64URL:$w,isValidJWT:_w,locales:eI,parse:Wo,parseAsync:Go,prettifyError:K$,regexes:Eb,registry:El,safeParse:X$,safeParseAsync:H$,toDotPath:Y$,toJSONSchema:rI,treeifyError:G$,util:FE,version:Hb},Symbol.toStringTag,{value:"Module"})),i6={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},s6=Object.freeze({status:"aborted"}),a6=s6;function o6(t){dt({customError:t})}function u6(){return dt().customError}dt(Qk());const De=Object.freeze(Object.defineProperty({__proto__:null,$brand:Z$,$input:n_,$output:t_,NEVER:a6,TimePrecision:s_,ZodAny:nk,ZodArray:ak,ZodBase64:xd,ZodBase64URL:Ed,ZodBigInt:za,ZodBigIntFormat:jd,ZodBoolean:Ta,ZodCIDRv4:Td,ZodCIDRv6:zd,ZodCUID:wd,ZodCUID2:_d,ZodCatch:kk,ZodCustom:Za,ZodDate:Dd,ZodDefault:gk,ZodDiscriminatedUnion:ok,ZodE164:Ud,ZodEmail:gd,ZodEmoji:$d,ZodEnum:fi,ZodError:w1,ZodFile:pk,ZodGUID:Rs,ZodIPv4:Sd,ZodIPv6:Nd,ZodISODate:fd,ZodISODateTime:md,ZodISODuration:pd,ZodISOTime:hd,ZodIntersection:uk,ZodIssueCode:i6,ZodJWT:Zd,ZodKSUID:Od,ZodLazy:zk,ZodLiteral:fk,ZodMap:dk,ZodNaN:Ok,ZodNanoID:bd,ZodNever:ik,ZodNonOptional:Fd,ZodNull:tk,ZodNullable:vk,ZodNumber:Na,ZodNumberFormat:Nr,ZodObject:Ea,ZodOptional:Bd,ZodPipe:qd,ZodPrefault:$k,ZodPromise:Ek,ZodReadonly:Sk,ZodRealError:ji,ZodRecord:Rd,ZodSet:mk,ZodString:Sa,ZodStringFormat:ke,ZodSuccess:_k,ZodSymbol:X_,ZodTemplateLiteral:Tk,ZodTransform:Ld,ZodTuple:lk,ZodType:te,ZodULID:kd,ZodURL:yd,ZodUUID:qt,ZodUndefined:Q_,ZodUnion:Cd,ZodUnknown:rk,ZodVoid:sk,ZodXID:Id,_ZodString:vd,_default:yk,any:K1,array:Ai,base64:L1,base64url:M1,bigint:_n,boolean:Pd,catch:Ik,check:Uk,cidrv4:C1,cidrv6:R1,clone:At,coerce:HU,config:dt,core:r6,cuid:E1,cuid2:U1,custom:fU,date:H1,discriminatedUnion:nU,e164:B1,email:_1,emoji:z1,endsWith:sd,enum:Ke,file:oU,flattenError:fl,float32:q1,float64:J1,formatError:hl,function:nI,getErrorMap:u6,globalRegistry:mn,gt:wn,gte:pt,guid:k1,includes:rd,instanceof:ye,int:Ko,int32:V1,int64:G1,intersection:ck,ipv4:A1,ipv6:D1,iso:b1,json:pU,jwt:F1,keyof:Q1,ksuid:j1,lazy:xk,length:Oa,literal:hk,locales:eI,looseObject:tU,lowercase:td,lt:bn,lte:_t,map:iU,maxLength:Ia,maxSize:ka,mime:ad,minLength:pr,minSize:mi,multipleOf:di,nan:lU,nanoid:x1,nativeEnum:aU,negative:Z_,never:xa,nonnegative:j_,nonoptional:wk,nonpositive:P_,normalize:od,null:Ad,nullable:Ms,nullish:uU,number:Q,object:pe,optional:Ls,overwrite:Zn,parse:W_,parseAsync:G_,partialRecord:rU,pipe:Bs,positive:U_,prefault:bk,preprocess:vU,prettifyError:K$,promise:mU,property:A_,readonly:Nk,record:Ua,refine:Zk,regex:ed,regexes:Eb,registry:El,safeParse:Y_,safeParseAsync:K_,set:sU,setErrorMap:o6,size:Ql,startsWith:id,strictObject:eU,string:Te,stringbool:hU,success:cU,superRefine:Pk,symbol:H_,templateLiteral:dU,toJSONSchema:rI,toLowerCase:cd,toUpperCase:ld,transform:Md,treeifyError:G$,trim:ud,tuple:Tr,uint32:W1,uint64:Y1,ulid:Z1,undefined:ek,union:Ue,unknown:vr,uppercase:nd,url:T1,uuid:I1,uuidv4:O1,uuidv6:S1,uuidv7:N1,void:X1,xid:P1},Symbol.toStringTag,{value:"Module"})),c6=async t=>await new Promise(e=>setTimeout(e,oe.fromMilliseconds(t).milliseconds));class l6{constructor(e){Et(this,"config"),Et(this,"retries"),Et(this,"interval"),this.config={baseInterval:new oe((e==null?void 0:e.baseInterval)??oe.seconds(1)),maxRetries:(e==null?void 0:e.maxRetries)??5,scale:(e==null?void 0:e.scale)??1,sleepFn:(e==null?void 0:e.sleepFn)??c6},this.retries=0,this.interval=new oe(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:r,sleepFn:i}=this.config;return this.retries>=e?!1:(await i(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const d6=pe({baseInterval:oe.z.optional(),maxRetries:Q().optional(),scale:Q().optional()}),m6=Object.freeze(Object.defineProperty({__proto__:null,Breaker:l6,breakerConfigZ:d6},Symbol.toStringTag,{value:"Module"})),f6=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,iI=Te().regex(f6),nr=Q().min(0).max(255),sI=Q().min(0).max(1),aI=Tr([nr,nr,nr,sI]),h6=Tr([nr,nr,nr]),p6=pe({rgba255:aI}),v6=Q().min(0).max(360),g6=Q().min(0).max(100),y6=Q().min(0).max(100),$6=Tr([v6,g6,y6,sI]),Vd=Ue([iI,h6,aI,$6,p6]),b6=Vd.transform(t=>Wd(t)),Wd=(t,e=1)=>{if(t=Vd.parse(t),typeof t=="string")return w6(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}return t.rgba255},w6=(t,e=1)=>(t=iI.parse(t),t=_6(t),[ss(t,0),ss(t,2),ss(t,4),t.length===8?ss(t,6)/255:e]),ss=(t,e)=>parseInt(t.slice(e,e+2),16),_6=t=>t.startsWith("#")?t.slice(1):t;Wd("#000000");Wd("#ffffff");const k6=pe({key:Te(),color:Vd,position:Q(),switched:Pd().optional()});Ai(k6);const I6=pe({key:Te(),name:Te(),color:b6});pe({key:Te(),name:Te(),swatches:Ai(I6)});Q().int().min(0).max(255);pe({name:Te(),key:Te()});const O6=t=>Object.getOwnPropertySymbols(globalThis).includes(t),S6=(t,e)=>{const r=Symbol.for(t);if(!O6(r)){const i=e();Object.defineProperty(globalThis,r,{value:i})}return()=>globalThis[r]},oI="sy_x_error",N6=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),ja=t=>{var e;return e=class extends Error{constructor(r,i){super(r,i),Et(this,"discriminator",e.discriminator),Et(this,"type",e.TYPE),Et(this,"matches",e.matches),this.name=e.TYPE}static sub(r){return ja(`${t}.${r}`)}},Et(e,"discriminator",oI),Et(e,"TYPE",t),Et(e,"matches",N6(t)),e},uI=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!==oI)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},Wn="unknown",ru="nil";class T6{constructor(){Et(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:ru,data:""};if(uI(e))for(const r of this.providers){const i=r.encode(e);if(i!=null)return i}if(e instanceof Error)return{type:Wn,data:e.message};if(typeof e=="string")return{type:Wn,data:e};try{return{type:Wn,data:JSON.stringify(e)}}catch{return{type:Wn,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===ru)return null;if(e.type===Wn)return new iu(e.data);for(const r of this.providers){const i=r.decode(e);if(i!=null)return i}return new iu(e.data)}}const Gd=S6("synnax-error-registry",()=>new T6),z6=({encode:t,decode:e})=>Gd().register({encode:t,decode:e}),x6=t=>Gd().encode(t),E6=t=>t==null?null:Gd().decode(t);class iu extends ja("unknown"){}const U6=pe({type:Te(),data:Te()});class Z6 extends ja("canceled"){}const rn=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Z6,NONE:ru,UNKNOWN:Wn,Unknown:iu,createTyped:ja,decode:E6,encode:x6,isTyped:uI,payloadZ:U6,register:z6},Symbol.toStringTag,{value:"Module"})),P6=De.object({jsonrpc:De.literal("2.0"),method:De.string(),params:De.any().optional(),id:De.union([De.string(),De.number(),De.null()]).optional()}),cI=De.object({jsonrpc:De.literal("2.0"),id:De.union([De.string(),De.number(),De.null()])}),j6=cI.extend({result:De.json()}),A6=cI.extend({error:De.object({code:De.number().int(),message:De.string().optional(),data:De.json().optional()})}),D6=De.union([j6,A6]);De.union([P6,D6]);Te().regex(/^\d+\.\d+\.\d+$/);const C6=["standard","scientific","engineering"];Ke(C6);Ke(["success","info","warning","error","loading","disabled"]);class Di extends rn.createTyped("freighter"){}class Ot extends Di.sub("eof"){constructor(){super("EOF")}}class gr extends Di.sub("stream_closed"){constructor(){super("StreamClosed")}}class sn extends Di.sub("unreachable"){constructor(e={}){const{message:r="Unreachable",url:i=xZ.UNKNOWN}=e;super(r),Ge(this,"url"),this.url=i}}const R6=t=>{if(!t.type.startsWith(Di.TYPE))return null;if(Ot.matches(t))return{type:Ot.TYPE,data:"EOF"};if(gr.matches(t))return{type:gr.TYPE,data:"StreamClosed"};if(sn.matches(t))return{type:sn.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${t.type}: ${t.message}`)},L6=t=>{if(!t.type.startsWith(Di.TYPE))return null;switch(t.type){case Ot.TYPE:return new Ot;case gr.TYPE:return new gr;case sn.TYPE:return new sn;default:throw new rn.Unknown(`Unknown error type: ${t.data}`)}};rn.register({encode:R6,decode:L6});class lI{constructor(){Ge(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,r){let i=0;const n=async s=>{if(i===this.middleware.length)return await r(s);const a=this.middleware[i];return i++,await a(s,n)};return await n(e)}}const dI="Content-Type",Rf=t=>{if(Xk.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(t==="http")return e;const r=require("https"),i=new r.Agent({rejectUnauthorized:!1});return async(n,s)=>await e(n,{...s,agent:i})},M6=t=>"code"in t&&t.code==="ECONNREFUSED"||t.message.toLowerCase().includes("load failed"),B6=400;class F6 extends lI{constructor(e,r,i=!1){return super(),Ge(this,"endpoint"),Ge(this,"encoder"),Ge(this,"fetch"),this.endpoint=e.replace({protocol:i?"https":"http"}),this.encoder=r,this.fetch=Rf(this.endpoint.protocol),new Proxy(this,{get:(n,s,a)=>s==="endpoint"?this.endpoint:Reflect.get(n,s,a)})}get headers(){return{[dI]:this.encoder.contentType}}async send(e,r,i,n){r=i==null?void 0:i.parse(r);let s=null;const a=this.endpoint.child(e),o={};o.method="POST",o.body=this.encoder.encode(r??{});const[,u]=await this.executeMiddleware({target:a.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async c=>{const l={...c,params:{}};o.headers={...this.headers,...c.params};let d;try{d=await Rf(c.protocol)(c.target,o)}catch(p){let _=p;return M6(_)&&(_=new sn({url:a})),[l,_]}const g=await d.arrayBuffer();if(d!=null&&d.ok)return n!=null&&(s=this.encoder.decode(g,n)),[l,null];try{if(d.status!==B6)return[l,new Error(d.statusText)];const p=this.encoder.decode(g,rn.payloadZ),_=rn.decode(p);return[l,_]}catch(p){return[l,new Error(`[freighter] - failed to decode error: ${d.statusText}: ${p.message}`)]}});if(u!=null)return[null,u];if(s==null)throw new Error("Response must be defined");return[s,null]}}const q6=(t,e)=>{class r{constructor(n){Ge(this,"wrapped"),this.wrapped=n}use(...n){this.wrapped.use(...n)}async send(n,s,a,o){const u=new m6.Breaker(e);do{const[c,l]=await this.wrapped.send(n,s,a,o);if(l==null)return[c,null];if(!sn.matches(l))return[null,l];if(!await u.wait())return[c,l]}while(!0)}}return new r(t)},Z=async(t,e,r,i,n)=>{const[s,a]=await t.send(e,r,i,n);if(a!=null)throw a;return s};function q(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}class hi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const mI={};function kn(t){return mI}function J6(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function V6(t,e){return typeof e=="bigint"?e.toString():e}function fI(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Yd(t){return t==null}function Kd(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Oe(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Xd(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function hI(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Dr(t){return JSON.stringify(t)}function su(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const W6=fI(()=>{if(typeof navigator<"u"&&navigator!=null&&navigator.userAgent.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Lf(t){if(su(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(su(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const G6=new Set(["string","number","symbol"]);function Y6(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pn(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function vt(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function K6(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function X6(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return Pn(t,{...t._zod.def,shape:r,checks:[]})}function H6(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return Pn(t,{...t._zod.def,shape:r,checks:[]})}function Q6(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return Xd(this,"shape",i),i},checks:[]};return Pn(t,r)}function eP(t,e){return Pn(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Xd(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function tP(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return Pn(e,{...e._zod.def,shape:n,checks:[]})}function nP(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return Pn(e,{...e._zod.def,shape:n,checks:[]})}function ei(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function Hd(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function as(t){return typeof t=="string"?t:t==null?void 0:t.message}function In(t,e,r){var i,n,s,a,o,u;const c={...t,path:t.path??[]};if(!t.message){const l=as((s=(n=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,t))??as((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??as((o=r.customError)==null?void 0:o.call(r,t))??as((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";c.message=l}return delete c.inst,delete c.continue,e!=null&&e.reportInput||delete c.input,c}function Qd(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function pi(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}const pI=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,V6,2)},enumerable:!0})},vI=q("$ZodError",pI),gI=q("$ZodError",pI,{Parent:Error});function rP(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function iP(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}const sP=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new hi;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>In(u,s,kn())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},aP=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>In(u,s,kn())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},yI=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new hi;return s.issues.length?{success:!1,error:new(t??vI)(s.issues.map(a=>In(a,n,kn())))}:{success:!0,data:s.value}},oP=yI(gI),$I=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>In(a,n,kn())))}:{success:!0,data:s.value}},uP=$I(gI),zr=q("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),cP=q("$ZodCheckMaxLength",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const n=Qd(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),lP=q("$ZodCheckMinLength",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const n=Qd(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),dP=q("$ZodCheckLengthEquals",(t,e)=>{zr.init(t,e),t._zod.when=r=>{const i=r.value;return!Yd(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=Qd(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),mP=q("$ZodCheckOverwrite",(t,e)=>{zr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class fP{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
74
- `).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),n=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of n)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
75
- `))}}const hP={major:4,minor:0,patch:0},We=q("$ZodType",(t,e)=>{var r,i;t??(t={}),Oe(t._zod,"id",()=>e.type+"_"+hI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=hP;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const a of s._zod.onattach)a(t);if(n.length===0)(i=t._zod).deferred??(i.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=ei(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new hi;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=ei(a,g)))});else{if(a.issues.length===g)continue;c||(c=ei(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new hi;return u.then(c=>s(c,n,o))}return s(u,n,o)}}t["~standard"]={validate:s=>{var a;try{const o=oP(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return uP(t,s).then(o=>{var u;return o.success?{value:o.data}:{issues:(u=o.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),pP=q("$ZodUnknown",(t,e)=>{We.init(t,e),t._zod.parse=r=>r}),vP=q("$ZodNever",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Mf(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}const gP=q("$ZodArray",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>Mf(c,r,a))):Mf(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function os(t,e,r){t.issues.length&&e.issues.push(...Hd(r,t.issues)),e.value[r]=t.value}function Bf(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Hd(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const yP=q("$ZodObject",(t,e)=>{We.init(t,e);const r=fI(()=>{const l=Object.keys(e.shape);for(const g of l)if(!(e.shape[g]instanceof We))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const d=K6(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(d)}});Oe(t._zod,"propValues",()=>{const l=e.shape,d={};for(const g in l){const p=l[g]._zod;if(p.values){d[g]??(d[g]=new Set);for(const _ of p.values)d[g].add(_)}}return d});const i=l=>{const d=new fP(["shape","payload","ctx"]),{keys:g,optionalKeys:p}=r.value,_=h=>{const v=Dr(h);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);for(const h of g)k[h]=hI(15);d.write("const newResult = {}");for(const h of g)if(p.has(h)){const v=k[h];d.write(`const ${v} = ${_(h)};`);const w=Dr(h);d.write(`
76
- if (${v}.issues.length) {
77
- if (input[${w}] === undefined) {
78
- if (${w} in input) {
79
- newResult[${w}] = undefined;
80
- }
81
- } else {
82
- payload.issues = payload.issues.concat(
83
- ${v}.issues.map((iss) => ({
84
- ...iss,
85
- path: iss.path ? [${w}, ...iss.path] : [${w}],
86
- }))
87
- );
88
- }
89
- } else if (${v}.value === undefined) {
90
- if (${w} in input) newResult[${w}] = undefined;
91
- } else {
92
- newResult[${w}] = ${v}.value;
93
- }
94
- `)}else{const v=k[h];d.write(`const ${v} = ${_(h)};`),d.write(`
95
- if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
96
- ...iss,
97
- path: iss.path ? [${Dr(h)}, ...iss.path] : [${Dr(h)}]
98
- })));`),d.write(`newResult[${Dr(h)}] = ${v}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(h,v)=>m(l,h,v)};let n;const s=su,a=!mI.jitless,o=a&&W6.value,{catchall:u}=e;let c;t._zod.parse=(l,d)=>{c??(c=r.value);const g=l.value;if(!s(g))return l.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),l;const p=[];if(a&&o&&(d==null?void 0:d.async)===!1&&d.jitless!==!0)n||(n=i(e.shape)),l=n(l,d);else{l.value={};const v=c.shape;for(const w of c.keys){const I=v[w],A=I._zod.run({value:g[w],issues:[]},d),J=I._zod.optin==="optional"&&I._zod.optout==="optional";A instanceof Promise?p.push(A.then(ce=>J?Bf(ce,l,w,g):os(ce,l,w))):J?Bf(A,l,w,g):os(A,l,w)}}if(!u)return p.length?Promise.all(p).then(()=>l):l;const _=[],k=c.keySet,m=u._zod,h=m.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(h==="never"){_.push(v);continue}const w=m.run({value:g[v],issues:[]},d);w instanceof Promise?p.push(w.then(I=>os(I,l,v))):os(w,l,v)}return _.length&&l.issues.push({code:"unrecognized_keys",keys:_,input:g,inst:t}),p.length?Promise.all(p).then(()=>l):l}});function Ff(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>In(s,i,kn())))}),e}const $P=q("$ZodUnion",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Oe(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Kd(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>Ff(a,r,t,i)):Ff(s,r,t,i)}}),bP=q("$ZodIntersection",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([o,u])=>qf(r,o,u)):qf(r,s,a)}});function au(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Lf(t)&&Lf(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=au(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=au(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qf(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),ei(t))return t;const i=au(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const wP=q("$ZodEnum",(t,e)=>{We.init(t,e);const r=J6(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>G6.has(typeof i)).map(i=>typeof i=="string"?Y6(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),_P=q("$ZodTransform",(t,e)=>{We.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new hi;return r.value=n,r}}),kP=q("$ZodOptional",(t,e)=>{We.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Oe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Kd(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),IP=q("$ZodNullable",(t,e)=>{We.init(t,e),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),Oe(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Kd(r.source)}|null)$`):void 0}),Oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),OP=q("$ZodDefault",(t,e)=>{We.init(t,e),t._zod.optin="optional",Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Jf(s,e)):Jf(n,e)}});function Jf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const SP=q("$ZodPrefault",(t,e)=>{We.init(t,e),t._zod.optin="optional",Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),NP=q("$ZodNonOptional",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>Vf(s,t)):Vf(n,t)}});function Vf(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const TP=q("$ZodCatch",(t,e)=>{We.init(t,e),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),Oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>In(a,i,kn()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>In(s,i,kn()))},input:r.value}),r.issues=[]),r)}}),zP=q("$ZodPipe",(t,e)=>{We.init(t,e),Oe(t._zod,"values",()=>e.in._zod.values),Oe(t._zod,"optin",()=>e.in._zod.optin),Oe(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>Wf(s,e,i)):Wf(n,e,i)}});function Wf(t,e,r){return ei(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const xP=q("$ZodReadonly",(t,e)=>{We.init(t,e),Oe(t._zod,"propValues",()=>e.innerType._zod.propValues),Oe(t._zod,"optin",()=>e.innerType._zod.optin),Oe(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(Gf):Gf(n)}});function Gf(t){return t.value=Object.freeze(t.value),t}const EP=q("$ZodCustom",(t,e)=>{zr.init(t,e),We.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>Yf(s,r,i,t));Yf(n,r,i,t)}});function Yf(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(pi(n))}}class UP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ZP(){return new UP}const us=ZP();function PP(t){return new t({type:"unknown"})}function jP(t,e){return new t({type:"never",...vt(e)})}function AP(t,e){return new cP({check:"max_length",...vt(e),maximum:t})}function Kf(t,e){return new lP({check:"min_length",...vt(e),minimum:t})}function DP(t,e){return new dP({check:"length_equals",...vt(e),length:t})}function CP(t){return new mP({check:"overwrite",tx:t})}function RP(t,e,r){return new t({type:"array",element:e,...vt(r)})}function LP(t,e,r){return new t({type:"custom",check:"custom",fn:e,...vt(r)})}const MP=(t,e)=>{vI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>iP(t,r)},flatten:{value:r=>rP(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Aa=q("ZodError",MP,{Parent:Error}),BP=sP(Aa),FP=aP(Aa),qP=yI(Aa),JP=$I(Aa),it=q("ZodType",(t,e)=>(We.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>Pn(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>BP(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>qP(t,r,i),t.parseAsync=async(r,i)=>FP(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>JP(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(yj(r,i)),t.superRefine=r=>t.check($j(r)),t.overwrite=r=>t.check(CP(r)),t.optional=()=>cu(t),t.nullable=()=>Xf(t),t.nullish=()=>cu(Xf(t)),t.nonoptional=r=>lj(t,r),t.array=()=>KP(t),t.or=r=>ej([t,r]),t.and=r=>nj(t,r),t.transform=r=>Hf(t,ij(r)),t.default=r=>oj(t,r),t.prefault=r=>cj(t,r),t.catch=r=>mj(t,r),t.pipe=r=>Hf(t,r),t.readonly=()=>pj(t),t.describe=r=>{const i=t.clone();return us.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=us.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return us.get(t);const i=t.clone();return us.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),VP=q("ZodUnknown",(t,e)=>{pP.init(t,e),it.init(t,e)});function ou(){return PP(VP)}const WP=q("ZodNever",(t,e)=>{vP.init(t,e),it.init(t,e)});function GP(t){return jP(WP,t)}const YP=q("ZodArray",(t,e)=>{gP.init(t,e),it.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Kf(r,i)),t.nonempty=r=>t.check(Kf(1,r)),t.max=(r,i)=>t.check(AP(r,i)),t.length=(r,i)=>t.check(DP(r,i)),t.unwrap=()=>t.element});function KP(t,e){return RP(YP,t,e)}const XP=q("ZodObject",(t,e)=>{yP.init(t,e),it.init(t,e),Oe(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>bI(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ou()}),t.loose=()=>t.clone({...t._zod.def,catchall:ou()}),t.strict=()=>t.clone({...t._zod.def,catchall:GP()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Q6(t,r),t.merge=r=>eP(t,r),t.pick=r=>X6(t,r),t.omit=r=>H6(t,r),t.partial=(...r)=>tP(wI,t,r[0]),t.required=(...r)=>nP(_I,t,r[0])});function HP(t,e){const r={type:"object",get shape(){return Xd(this,"shape",{...t}),this.shape},...vt(e)};return new XP(r)}const QP=q("ZodUnion",(t,e)=>{$P.init(t,e),it.init(t,e),t.options=e.options});function ej(t,e){return new QP({type:"union",options:t,...vt(e)})}const tj=q("ZodIntersection",(t,e)=>{bP.init(t,e),it.init(t,e)});function nj(t,e){return new tj({type:"intersection",left:t,right:e})}const uu=q("ZodEnum",(t,e)=>{wP.init(t,e),it.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new uu({...e,checks:[],...vt(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new uu({...e,checks:[],...vt(n),entries:s})}});function bI(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new uu({type:"enum",entries:r,...vt(e)})}const rj=q("ZodTransform",(t,e)=>{_P.init(t,e),it.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(pi(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(pi(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function ij(t){return new rj({type:"transform",transform:t})}const wI=q("ZodOptional",(t,e)=>{kP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cu(t){return new wI({type:"optional",innerType:t})}const sj=q("ZodNullable",(t,e)=>{IP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Xf(t){return new sj({type:"nullable",innerType:t})}const aj=q("ZodDefault",(t,e)=>{OP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function oj(t,e){return new aj({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const uj=q("ZodPrefault",(t,e)=>{SP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cj(t,e){return new uj({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const _I=q("ZodNonOptional",(t,e)=>{NP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType});function lj(t,e){return new _I({type:"nonoptional",innerType:t,...vt(e)})}const dj=q("ZodCatch",(t,e)=>{TP.init(t,e),it.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function mj(t,e){return new dj({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const fj=q("ZodPipe",(t,e)=>{zP.init(t,e),it.init(t,e),t.in=e.in,t.out=e.out});function Hf(t,e){return new fj({type:"pipe",in:t,out:e})}const hj=q("ZodReadonly",(t,e)=>{xP.init(t,e),it.init(t,e)});function pj(t){return new hj({type:"readonly",innerType:t})}const vj=q("ZodCustom",(t,e)=>{EP.init(t,e),it.init(t,e)});function gj(t,e){const r=new zr({check:"custom",...vt(e)});return r._zod.check=t,r}function yj(t,e={}){return LP(vj,t,e)}function $j(t,e){const r=gj(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(pi(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(pi(s))}},t(i.value,i)),e);return r}const bj=()=>Xk.RUNTIME!=="node"?t=>new WebSocket(t):t=>new(require("ws")).WebSocket(t,{rejectUnauthorized:!1}),wj=HP({type:bI(["data","close","open"]),payload:ou(),error:cu(rn.payloadZ)});class _j{constructor(e,r,i,n){Ge(this,"codec"),Ge(this,"reqSchema"),Ge(this,"resSchema"),Ge(this,"ws"),Ge(this,"serverClosed"),Ge(this,"sendClosed"),Ge(this,"receiveDataQueue",[]),Ge(this,"receiveCallbacksQueue",[]),this.codec=r,this.reqSchema=i,this.resSchema=n,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}async receiveOpenAck(){const e=await this.receiveMsg();if(e.type!=="open"){if(e.error==null)throw new Error("Message error must be defined");return rn.decode(e.error)}return null}send(e){if(this.serverClosed!=null)return new Ot;if(this.sendClosed)throw new gr;return this.ws.send(this.codec.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");if(this.serverClosed=rn.decode(e.error),this.serverClosed==null)throw new Error("Message error must be defined");return[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.codec.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((r,i)=>this.receiveCallbacksQueue.push({resolve:r,reject:i}))}addMessage(e){const r=this.receiveCallbacksQueue.shift();r!=null?r.resolve(e):this.receiveDataQueue.push(e)}listenForMessages(){this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this)}onMessage(e){this.addMessage(this.codec.decode(e.data,wj))}onClose(e){this.addMessage({type:"close",error:{type:e.code===Ij?Ot.TYPE:gr.TYPE,data:""}})}}const kj="freighterctx",Ij=1e3,kI=class lu extends lI{constructor(e,r,i=!1){super(),Ge(this,"baseUrl"),Ge(this,"encoder"),Ge(this,"secure"),this.secure=i,this.baseUrl=e.replace({protocol:i?"wss":"ws"}),this.encoder=r}withCodec(e){const r=new lu(this.baseUrl,e,this.secure);return r.use(...this.middleware),r}async stream(e,r,i){const n=bj();let s;const[,a]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const u=n(this.buildURL(e,o)),c={...o,params:{}};u.binaryType=lu.MESSAGE_TYPE;const l=await this.wrapSocket(u,r,i);return l instanceof Error?[c,l]:(s=l,[c,null])});if(a!=null)throw a;return s}buildURL(e,r){const i=zZ({[dI]:this.encoder.contentType,...r.params},kj);return this.baseUrl.child(e).toString()+i}async wrapSocket(e,r,i){return await new Promise(n=>{e.onopen=()=>{const s=new _j(e,this.encoder,r,i);s.receiveOpenAck().then(a=>{a!=null?n(a):n(s)}).catch(a=>n(a))},e.onerror=s=>{const a=s;n(new Error(a.message))}})}};Ge(kI,"MESSAGE_TYPE","arraybuffer");let Oj=kI;function O(t,e,r){function i(o,u){var c;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(c=o._zod).traits??(c.traits=new Set),o._zod.traits.add(t),e(o,u);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=u}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function a(o){var u;const c=r!=null&&r.Parent?new s:this;i(c,o),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var u,c;return r!=null&&r.Parent&&o instanceof r.Parent?!0:(c=(u=o==null?void 0:o._zod)==null?void 0:u.traits)==null?void 0:c.has(t)}}),Object.defineProperty(a,"name",{value:t}),a}class vi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const II={};function an(t){return II}function Sj(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function Nj(t,e){return typeof e=="bigint"?e.toString():e}function OI(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function em(t){return t==null}function tm(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Tj(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,s=Number.parseInt(t.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return s%a/10**n}function Se(t,e,r){Object.defineProperty(t,e,{get(){{const i=r();return t[e]=i,i}},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function nm(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function SI(t=10){const e="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function Cr(t){return JSON.stringify(t)}function du(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const zj=OI(()=>{if(typeof navigator<"u"&&(navigator!=null&&navigator.userAgent.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function mu(t){if(du(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(du(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const xj=new Set(["string","number","symbol"]);function Ci(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jn(t,e,r){const i=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(i._zod.parent=t),i}function D(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ej(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Uj={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zj(t,e){const r={},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return jn(t,{...t._zod.def,shape:r,checks:[]})}function Pj(t,e){const r={...t._zod.def.shape},i=t._zod.def;for(const n in e){if(!(n in i.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return jn(t,{...t._zod.def,shape:r,checks:[]})}function jj(t,e){const r={...t._zod.def,get shape(){const i={...t._zod.def.shape,...e};return nm(this,"shape",i),i},checks:[]};return jn(t,r)}function Aj(t,e){return jn(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return nm(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Dj(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)n[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return jn(e,{...e._zod.def,shape:n,checks:[]})}function Cj(t,e,r){const i=e._zod.def.shape,n={...i};if(r)for(const s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)n[s]=new t({type:"nonoptional",innerType:i[s]});return jn(e,{...e._zod.def,shape:n,checks:[]})}function ti(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r].continue!==!0)return!0;return!1}function fn(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function cs(t){return typeof t=="string"?t:t==null?void 0:t.message}function on(t,e,r){var n,s,a,o,u,c;const i={...t,path:t.path??[]};if(!t.message){const l=cs((a=(s=(n=t.inst)==null?void 0:n._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,t))??cs((o=e==null?void 0:e.error)==null?void 0:o.call(e,t))??cs((u=r.customError)==null?void 0:u.call(r,t))??cs((c=r.localeError)==null?void 0:c.call(r,t))??"Invalid input";i.message=l}return delete i.inst,delete i.continue,e!=null&&e.reportInput||delete i.input,i}function rm(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function gi(...t){const[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}const NI=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Nj,2)},enumerable:!0})},TI=O("$ZodError",NI),zI=O("$ZodError",NI,{Parent:Error});function Rj(t,e=r=>r.message){const r={},i=[];for(const n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function Lj(t,e){const r=e||function(s){return s.message},i={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>n({issues:o}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)i._errors.push(r(a));else{let o=i,u=0;for(;u<a.path.length;){const c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(t),i}const Mj=t=>(e,r,i,n)=>{const s=i?Object.assign(i,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new vi;if(a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>on(u,s,an())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},Bj=t=>async(e,r,i,n)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new((n==null?void 0:n.Err)??t)(a.issues.map(u=>on(u,s,an())));throw Error.captureStackTrace(o,n==null?void 0:n.callee),o}return a.value},xI=t=>(e,r,i)=>{const n=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new vi;return s.issues.length?{success:!1,error:new(t??TI)(s.issues.map(a=>on(a,n,an())))}:{success:!0,data:s.value}},Fj=xI(zI),EI=t=>async(e,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>on(a,n,an())))}:{success:!0,data:s.value}},qj=EI(zI),Jj=/^[cC][^\s-]{8,}$/,Vj=/^[0-9a-z]+$/,Wj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gj=/^[0-9a-vA-V]{20}$/,Yj=/^[A-Za-z0-9]{27}$/,Kj=/^[a-zA-Z0-9_-]{21}$/,Xj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hj=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qf=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Qj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function tA(){return new RegExp(eA,"u")}const nA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,iA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,sA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,UI=/^[A-Za-z0-9_-]*$/,oA=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,uA=/^\+(?:[0-9]){6,14}[0-9]$/,ZI="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",cA=new RegExp(`^${ZI}$`);function PI(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lA(t){return new RegExp(`^${PI(t)}$`)}function dA(t){const e=PI({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const i=`${e}(?:${r.join("|")})`;return new RegExp(`^${ZI}T(?:${i})$`)}const mA=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},fA=/^\d+n?$/,hA=/^\d+$/,pA=/^-?\d+(?:\.\d+)?/i,vA=/true|false/i,gA=/null/i,yA=/undefined/i,$A=/^[^A-Z]*$/,bA=/^[^a-z]*$/,ft=O("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),jI={number:"number",bigint:"bigint",object:"date"},AI=O("$ZodCheckLessThan",(t,e)=>{ft.init(t,e);const r=jI[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),DI=O("$ZodCheckGreaterThan",(t,e)=>{ft.init(t,e);const r=jI[typeof e.value];t._zod.onattach.push(i=>{const n=i._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),wA=O("$ZodCheckMultipleOf",(t,e)=>{ft.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Tj(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),_A=O("$ZodCheckNumberFormat",(t,e)=>{var a;ft.init(t,e),e.format=e.format||"float64";const r=(a=e.format)==null?void 0:a.includes("int"),i=r?"int":"number",[n,s]=Uj[e.format];t._zod.onattach.push(o=>{const u=o._zod.bag;u.format=e.format,u.minimum=n,u.maximum=s,r&&(u.pattern=hA)}),t._zod.check=o=>{const u=o.value;if(r){if(!Number.isInteger(u)){o.issues.push({expected:i,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort});return}}u<n&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),u>s&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inst:t})}}),kA=O("$ZodCheckMaxLength",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const s=rm(i);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),IA=O("$ZodCheckMinLength",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const s=rm(i);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),OA=O("$ZodCheckLengthEquals",(t,e)=>{ft.init(t,e),t._zod.when=r=>{const i=r.value;return!em(i)&&i.length!==void 0},t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,n=i.length;if(n===e.length)return;const s=rm(i),a=n>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:r.value,inst:t,continue:!e.abort})}}),Da=O("$ZodCheckStringFormat",(t,e)=>{var r;ft.init(t,e),t._zod.onattach.push(i=>{const n=i._zod.bag;n.format=e.format,e.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern))}),(r=t._zod).check??(r.check=i=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),SA=O("$ZodCheckRegex",(t,e)=>{Da.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),NA=O("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=$A),Da.init(t,e)}),TA=O("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=bA),Da.init(t,e)}),zA=O("$ZodCheckIncludes",(t,e)=>{ft.init(t,e);const r=Ci(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),xA=O("$ZodCheckStartsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`^${Ci(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),EA=O("$ZodCheckEndsWith",(t,e)=>{ft.init(t,e);const r=new RegExp(`.*${Ci(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}),UA=O("$ZodCheckOverwrite",(t,e)=>{ft.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class ZA{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(`
99
- `).filter(a=>a),n=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const e=Function,r=this==null?void 0:this.args,n=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...r,n.join(`
100
- `))}}const PA={major:4,minor:0,patch:0},he=O("$ZodType",(t,e)=>{var n;var r;t??(t={}),Se(t._zod,"id",()=>e.type+"_"+SI(10)),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=PA;const i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(const s of i)for(const a of s._zod.onattach)a(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),(n=t._zod.deferred)==null||n.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,o,u)=>{let c=ti(a),l;for(const d of o){if(d._zod.when){if(!d._zod.when(a))continue}else if(c)continue;const g=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new vi;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==g&&(c||(c=ti(a,g)))});else{if(a.issues.length===g)continue;c||(c=ti(a,g))}}return l?l.then(()=>a):a};t._zod.run=(a,o)=>{const u=t._zod.parse(a,o);if(u instanceof Promise){if(o.async===!1)throw new vi;return u.then(c=>s(c,i,o))}return s(u,i,o)}}t["~standard"]={validate:s=>{var a;try{const o=Fj(t,s);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return qj(t,s).then(u=>{var c;return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),im=O("$ZodString",(t,e)=>{var r;he.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??mA(t._zod.bag),t._zod.parse=(i,n)=>{if(e.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),Ie=O("$ZodStringFormat",(t,e)=>{Da.init(t,e),im.init(t,e)}),jA=O("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Hj),Ie.init(t,e)}),AA=O("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Qf(i))}else e.pattern??(e.pattern=Qf());Ie.init(t,e)}),DA=O("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Qj),Ie.init(t,e)}),CA=O("$ZodURL",(t,e)=>{Ie.init(t,e),t._zod.check=r=>{try{const i=new URL(r.value);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:oA.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}));return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),RA=O("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=tA()),Ie.init(t,e)}),LA=O("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Kj),Ie.init(t,e)}),MA=O("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Jj),Ie.init(t,e)}),BA=O("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Vj),Ie.init(t,e)}),FA=O("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Wj),Ie.init(t,e)}),qA=O("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Gj),Ie.init(t,e)}),JA=O("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Yj),Ie.init(t,e)}),VA=O("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=dA(e)),Ie.init(t,e),t._zod.check}),WA=O("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=cA),Ie.init(t,e)}),GA=O("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=lA(e)),Ie.init(t,e),t._zod.check}),YA=O("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Xj),Ie.init(t,e)}),KA=O("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=nA),Ie.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),XA=O("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=rA),Ie.init(t,e),t._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),HA=O("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=iA),Ie.init(t,e)}),QA=O("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=sA),Ie.init(t,e),t._zod.check=r=>{const[i,n]=r.value.split("/");try{if(!n)throw new Error;const s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function CI(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const eD=O("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=aA),Ie.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{CI(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function tD(t){if(!UI.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return CI(r)}const nD=O("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=UI),Ie.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{tD(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),rD=O("$ZodE164",(t,e)=>{e.pattern??(e.pattern=uA),Ie.init(t,e)});function iD(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[i]=r,n=JSON.parse(atob(i));return!("typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}const sD=O("$ZodJWT",(t,e)=>{Ie.init(t,e),t._zod.check=r=>{iD(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),RI=O("$ZodNumber",(t,e)=>{he.init(t,e),t._zod.pattern=t._zod.bag.pattern??pA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),aD=O("$ZodNumber",(t,e)=>{_A.init(t,e),RI.init(t,e)}),oD=O("$ZodBoolean",(t,e)=>{he.init(t,e),t._zod.pattern=vA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),uD=O("$ZodBigInt",(t,e)=>{he.init(t,e),t._zod.pattern=fA,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}const{value:n}=r;return typeof n=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:n,inst:t}),r}}),cD=O("$ZodUndefined",(t,e)=>{he.init(t,e),t._zod.pattern=yA,t._zod.values=new Set([void 0]),t._zod.parse=(r,i)=>{const{value:n}=r;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),lD=O("$ZodNull",(t,e)=>{he.init(t,e),t._zod.pattern=gA,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{const{value:n}=r;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),dD=O("$ZodUnknown",(t,e)=>{he.init(t,e),t._zod.parse=r=>r}),mD=O("$ZodNever",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function eh(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}const fD=O("$ZodArray",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);const s=[];for(let a=0;a<n.length;a++){const o=n[a],u=e.element._zod.run({value:o,issues:[]},i);u instanceof Promise?s.push(u.then(c=>eh(c,r,a))):eh(u,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function ls(t,e,r){t.issues.length&&e.issues.push(...fn(r,t.issues)),e.value[r]=t.value}function th(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...fn(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}const hD=O("$ZodObject",(t,e)=>{he.init(t,e);const r=OI(()=>{const d=Object.keys(e.shape);for(const p of d)if(!(e.shape[p]instanceof he))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);const g=Ej(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(g)}});Se(t._zod,"propValues",()=>{const d=e.shape,g={};for(const p in d){const _=d[p]._zod;if(_.values){g[p]??(g[p]=new Set);for(const k of _.values)g[p].add(k)}}return g});const i=d=>{const g=new ZA(["shape","payload","ctx"]),{keys:p,optionalKeys:_}=r.value,k=v=>{const w=Cr(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};g.write("const input = payload.value;");const m=Object.create(null);for(const v of p)m[v]=SI(15);g.write("const newResult = {}");for(const v of p)if(_.has(v)){const w=m[v];g.write(`const ${w} = ${k(v)};`);const I=Cr(v);g.write(`
101
- if (${w}.issues.length) {
102
- if (input[${I}] === undefined) {
103
- if (${I} in input) {
104
- newResult[${I}] = undefined;
105
- }
106
- } else {
107
- payload.issues = payload.issues.concat(
108
- ${w}.issues.map((iss) => ({
109
- ...iss,
110
- path: iss.path ? [${I}, ...iss.path] : [${I}],
111
- }))
112
- );
113
- }
114
- } else if (${w}.value === undefined) {
115
- if (${I} in input) newResult[${I}] = undefined;
116
- } else {
117
- newResult[${I}] = ${w}.value;
118
- }
119
- `)}else{const w=m[v];g.write(`const ${w} = ${k(v)};`),g.write(`
120
- if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
121
- ...iss,
122
- path: iss.path ? [${Cr(v)}, ...iss.path] : [${Cr(v)}]
123
- })));`),g.write(`newResult[${Cr(v)}] = ${w}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");const h=g.compile();return(v,w)=>h(d,v,w)};let n;const s=du,a=!II.jitless,u=a&&zj.value,{catchall:c}=e;let l;t._zod.parse=(d,g)=>{l??(l=r.value);const p=d.value;if(!s(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d;const _=[];if(a&&u&&(g==null?void 0:g.async)===!1&&g.jitless!==!0)n||(n=i(e.shape)),d=n(d,g);else{d.value={};const w=l.shape;for(const I of l.keys){const A=w[I],J=A._zod.run({value:p[I],issues:[]},g),ce=A._zod.optin==="optional"&&A._zod.optout==="optional";J instanceof Promise?_.push(J.then(Xe=>ce?th(Xe,d,I,p):ls(Xe,d,I))):ce?th(J,d,I,p):ls(J,d,I)}}if(!c)return _.length?Promise.all(_).then(()=>d):d;const k=[],m=l.keySet,h=c._zod,v=h.def.type;for(const w of Object.keys(p)){if(m.has(w))continue;if(v==="never"){k.push(w);continue}const I=h.run({value:p[w],issues:[]},g);I instanceof Promise?_.push(I.then(A=>ls(A,d,w))):ls(I,d,w)}return k.length&&d.issues.push({code:"unrecognized_keys",keys:k,input:p,inst:t}),_.length?Promise.all(_).then(()=>d):d}});function nh(t,e,r,i){for(const n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>on(s,i,an())))}),e}const pD=O("$ZodUnion",(t,e)=>{he.init(t,e),Se(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Se(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>tm(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1;const s=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},i);if(o instanceof Promise)s.push(o),n=!0;else{if(o.issues.length===0)return o;s.push(o)}}return n?Promise.all(s).then(a=>nh(a,r,t,i)):nh(s,r,t,i)}}),vD=O("$ZodIntersection",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>{const{value:n}=r,s=e.left._zod.run({value:n,issues:[]},i),a=e.right._zod.run({value:n,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([u,c])=>rh(r,u,c)):rh(r,s,a)}});function fu(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(mu(t)&&mu(e)){const r=Object.keys(e),i=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(const s of i){const a=fu(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=a.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<t.length;i++){const n=t[i],s=e[i],a=fu(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function rh(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),ti(t))return t;const i=fu(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const gD=O("$ZodRecord",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>{const n=r.value;if(!mu(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;const s=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=e.valueType._zod.run({value:n[u],issues:[]},i);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...fn(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...fn(u,c.issues)),r.value[u]=c.value)}let o;for(const u in n)a.has(u)||(o=o??[],o.push(u));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(n)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(c=>on(c,i,an())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const u=e.valueType._zod.run({value:n[a],issues:[]},i);u instanceof Promise?s.push(u.then(c=>{c.issues.length&&r.issues.push(...fn(a,c.issues)),r.value[o.value]=c.value})):(u.issues.length&&r.issues.push(...fn(a,u.issues)),r.value[o.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),yD=O("$ZodEnum",(t,e)=>{he.init(t,e);const r=Sj(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>xj.has(typeof i)).map(i=>typeof i=="string"?Ci(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{const s=i.value;return t._zod.values.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),$D=O("$ZodLiteral",(t,e)=>{he.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ci(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),bD=O("$ZodTransform",(t,e)=>{he.init(t,e),t._zod.parse=(r,i)=>{const n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r));if(n instanceof Promise)throw new vi;return r.value=n,r}}),wD=O("$ZodOptional",(t,e)=>{he.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${tm(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),_D=O("$ZodNullable",(t,e)=>{he.init(t,e),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),Se(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${tm(r.source)}|null)$`):void 0}),Se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),kD=O("$ZodDefault",(t,e)=>{he.init(t,e),t._zod.optin="optional",Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>ih(s,e)):ih(n,e)}});function ih(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const ID=O("$ZodPrefault",(t,e)=>{he.init(t,e),t._zod.optin="optional",Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),OD=O("$ZodNonOptional",(t,e)=>{he.init(t,e),Se(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>sh(s,t)):sh(n,t)}});function sh(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const SD=O("$ZodCatch",(t,e)=>{he.init(t,e),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),Se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(a=>on(a,i,an()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>on(s,i,an()))},input:r.value}),r.issues=[]),r)}}),ND=O("$ZodPipe",(t,e)=>{he.init(t,e),Se(t._zod,"values",()=>e.in._zod.values),Se(t._zod,"optin",()=>e.in._zod.optin),Se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{const n=e.in._zod.run(r,i);return n instanceof Promise?n.then(s=>ah(s,e,i)):ah(n,e,i)}});function ah(t,e,r){return ti(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const TD=O("$ZodReadonly",(t,e)=>{he.init(t,e),Se(t._zod,"propValues",()=>e.innerType._zod.propValues),Se(t._zod,"optin",()=>e.innerType._zod.optin),Se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{const n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(oh):oh(n)}});function oh(t){return t.value=Object.freeze(t.value),t}const zD=O("$ZodCustom",(t,e)=>{ft.init(t,e),he.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{const i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(s=>uh(s,r,i,t));uh(n,r,i,t)}});function uh(t,e,r,i){if(!t){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(gi(n))}}class xD{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ED(){return new xD}const ds=ED();function UD(t,e){return new t({type:"string",...D(e)})}function ZD(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...D(e)})}function ch(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...D(e)})}function PD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...D(e)})}function jD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(e)})}function AD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(e)})}function DD(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(e)})}function CD(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...D(e)})}function RD(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...D(e)})}function LD(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(e)})}function MD(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...D(e)})}function BD(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(e)})}function FD(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...D(e)})}function qD(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...D(e)})}function JD(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(e)})}function VD(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(e)})}function WD(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(e)})}function GD(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(e)})}function YD(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(e)})}function KD(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...D(e)})}function XD(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...D(e)})}function HD(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...D(e)})}function QD(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...D(e)})}function eC(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(e)})}function tC(t,e){return new t({type:"string",format:"date",check:"string_format",...D(e)})}function nC(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...D(e)})}function rC(t,e){return new t({type:"string",format:"duration",check:"string_format",...D(e)})}function iC(t,e){return new t({type:"number",checks:[],...D(e)})}function sC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...D(e)})}function aC(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...D(e)})}function oC(t,e){return new t({type:"boolean",...D(e)})}function uC(t,e){return new t({type:"bigint",...D(e)})}function cC(t,e){return new t({type:"undefined",...D(e)})}function lC(t,e){return new t({type:"null",...D(e)})}function dC(t){return new t({type:"unknown"})}function mC(t,e){return new t({type:"never",...D(e)})}function qs(t,e){return new AI({check:"less_than",...D(e),value:t,inclusive:!1})}function rr(t,e){return new AI({check:"less_than",...D(e),value:t,inclusive:!0})}function Js(t,e){return new DI({check:"greater_than",...D(e),value:t,inclusive:!1})}function tn(t,e){return new DI({check:"greater_than",...D(e),value:t,inclusive:!0})}function hu(t,e){return new wA({check:"multiple_of",...D(e),value:t})}function LI(t,e){return new kA({check:"max_length",...D(e),maximum:t})}function Vs(t,e){return new IA({check:"min_length",...D(e),minimum:t})}function MI(t,e){return new OA({check:"length_equals",...D(e),length:t})}function fC(t,e){return new SA({check:"string_format",format:"regex",...D(e),pattern:t})}function hC(t){return new NA({check:"string_format",format:"lowercase",...D(t)})}function pC(t){return new TA({check:"string_format",format:"uppercase",...D(t)})}function vC(t,e){return new zA({check:"string_format",format:"includes",...D(e),includes:t})}function gC(t,e){return new xA({check:"string_format",format:"starts_with",...D(e),prefix:t})}function yC(t,e){return new EA({check:"string_format",format:"ends_with",...D(e),suffix:t})}function Ri(t){return new UA({check:"overwrite",tx:t})}function $C(t){return Ri(e=>e.normalize(t))}function bC(){return Ri(t=>t.trim())}function wC(){return Ri(t=>t.toLowerCase())}function _C(){return Ri(t=>t.toUpperCase())}function kC(t,e,r){return new t({type:"array",element:e,...D(r)})}function IC(t,e,r){return new t({type:"custom",check:"custom",fn:e,...D(r)})}const OC=O("ZodISODateTime",(t,e)=>{VA.init(t,e),xe.init(t,e)});function SC(t){return eC(OC,t)}const NC=O("ZodISODate",(t,e)=>{WA.init(t,e),xe.init(t,e)});function TC(t){return tC(NC,t)}const zC=O("ZodISOTime",(t,e)=>{GA.init(t,e),xe.init(t,e)});function xC(t){return nC(zC,t)}const EC=O("ZodISODuration",(t,e)=>{YA.init(t,e),xe.init(t,e)});function UC(t){return rC(EC,t)}const ZC=(t,e)=>{TI.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Lj(t,r)},flatten:{value:r=>Rj(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Ca=O("ZodError",ZC,{Parent:Error}),PC=Mj(Ca),jC=Bj(Ca),AC=xI(Ca),DC=EI(Ca),we=O("ZodType",(t,e)=>(he.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>jn(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>PC(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>AC(t,r,i),t.parseAsync=async(r,i)=>jC(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>DC(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(ZR(r,i)),t.superRefine=r=>t.check(PR(r)),t.overwrite=r=>t.check(Ri(r)),t.optional=()=>mh(t),t.nullable=()=>fh(t),t.nullish=()=>mh(fh(t)),t.nonoptional=r=>SR(t,r),t.array=()=>xr(t),t.or=r=>un([t,r]),t.and=r=>vR(t,r),t.transform=r=>hh(t,bR(r)),t.default=r=>kR(t,r),t.prefault=r=>OR(t,r),t.catch=r=>TR(t,r),t.pipe=r=>hh(t,r),t.readonly=()=>ER(t),t.describe=r=>{const i=t.clone();return ds.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){var r;return(r=ds.get(t))==null?void 0:r.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ds.get(t);const i=t.clone();return ds.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),BI=O("_ZodString",(t,e)=>{im.init(t,e),we.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(fC(...i)),t.includes=(...i)=>t.check(vC(...i)),t.startsWith=(...i)=>t.check(gC(...i)),t.endsWith=(...i)=>t.check(yC(...i)),t.min=(...i)=>t.check(Vs(...i)),t.max=(...i)=>t.check(LI(...i)),t.length=(...i)=>t.check(MI(...i)),t.nonempty=(...i)=>t.check(Vs(1,...i)),t.lowercase=i=>t.check(hC(i)),t.uppercase=i=>t.check(pC(i)),t.trim=()=>t.check(bC()),t.normalize=(...i)=>t.check($C(...i)),t.toLowerCase=()=>t.check(wC()),t.toUpperCase=()=>t.check(_C())}),CC=O("ZodString",(t,e)=>{im.init(t,e),BI.init(t,e),t.email=r=>t.check(ZD(RC,r)),t.url=r=>t.check(CD(LC,r)),t.jwt=r=>t.check(QD(tR,r)),t.emoji=r=>t.check(RD(MC,r)),t.guid=r=>t.check(ch(lh,r)),t.uuid=r=>t.check(PD(ms,r)),t.uuidv4=r=>t.check(jD(ms,r)),t.uuidv6=r=>t.check(AD(ms,r)),t.uuidv7=r=>t.check(DD(ms,r)),t.nanoid=r=>t.check(LD(BC,r)),t.guid=r=>t.check(ch(lh,r)),t.cuid=r=>t.check(MD(FC,r)),t.cuid2=r=>t.check(BD(qC,r)),t.ulid=r=>t.check(FD(JC,r)),t.base64=r=>t.check(KD(HC,r)),t.base64url=r=>t.check(XD(QC,r)),t.xid=r=>t.check(qD(VC,r)),t.ksuid=r=>t.check(JD(WC,r)),t.ipv4=r=>t.check(VD(GC,r)),t.ipv6=r=>t.check(WD(YC,r)),t.cidrv4=r=>t.check(GD(KC,r)),t.cidrv6=r=>t.check(YD(XC,r)),t.e164=r=>t.check(HD(eR,r)),t.datetime=r=>t.check(SC(r)),t.date=r=>t.check(TC(r)),t.time=r=>t.check(xC(r)),t.duration=r=>t.check(UC(r))});function S(t){return UD(CC,t)}const xe=O("ZodStringFormat",(t,e)=>{Ie.init(t,e),BI.init(t,e)}),RC=O("ZodEmail",(t,e)=>{DA.init(t,e),xe.init(t,e)}),lh=O("ZodGUID",(t,e)=>{jA.init(t,e),xe.init(t,e)}),ms=O("ZodUUID",(t,e)=>{AA.init(t,e),xe.init(t,e)}),LC=O("ZodURL",(t,e)=>{CA.init(t,e),xe.init(t,e)}),MC=O("ZodEmoji",(t,e)=>{RA.init(t,e),xe.init(t,e)}),BC=O("ZodNanoID",(t,e)=>{LA.init(t,e),xe.init(t,e)}),FC=O("ZodCUID",(t,e)=>{MA.init(t,e),xe.init(t,e)}),qC=O("ZodCUID2",(t,e)=>{BA.init(t,e),xe.init(t,e)}),JC=O("ZodULID",(t,e)=>{FA.init(t,e),xe.init(t,e)}),VC=O("ZodXID",(t,e)=>{qA.init(t,e),xe.init(t,e)}),WC=O("ZodKSUID",(t,e)=>{JA.init(t,e),xe.init(t,e)}),GC=O("ZodIPv4",(t,e)=>{KA.init(t,e),xe.init(t,e)}),YC=O("ZodIPv6",(t,e)=>{XA.init(t,e),xe.init(t,e)}),KC=O("ZodCIDRv4",(t,e)=>{HA.init(t,e),xe.init(t,e)}),XC=O("ZodCIDRv6",(t,e)=>{QA.init(t,e),xe.init(t,e)}),HC=O("ZodBase64",(t,e)=>{eD.init(t,e),xe.init(t,e)}),QC=O("ZodBase64URL",(t,e)=>{nD.init(t,e),xe.init(t,e)}),eR=O("ZodE164",(t,e)=>{rD.init(t,e),xe.init(t,e)}),tR=O("ZodJWT",(t,e)=>{sD.init(t,e),xe.init(t,e)}),FI=O("ZodNumber",(t,e)=>{RI.init(t,e),we.init(t,e),t.gt=(i,n)=>t.check(Js(i,n)),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.lt=(i,n)=>t.check(qs(i,n)),t.lte=(i,n)=>t.check(rr(i,n)),t.max=(i,n)=>t.check(rr(i,n)),t.int=i=>t.check(dh(i)),t.safe=i=>t.check(dh(i)),t.positive=i=>t.check(Js(0,i)),t.nonnegative=i=>t.check(tn(0,i)),t.negative=i=>t.check(qs(0,i)),t.nonpositive=i=>t.check(rr(0,i)),t.multipleOf=(i,n)=>t.check(hu(i,n)),t.step=(i,n)=>t.check(hu(i,n)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function ue(t){return iC(FI,t)}const qI=O("ZodNumberFormat",(t,e)=>{aD.init(t,e),FI.init(t,e)});function dh(t){return sC(qI,t)}function nR(t){return aC(qI,t)}const rR=O("ZodBoolean",(t,e)=>{oD.init(t,e),we.init(t,e)});function ne(t){return oC(rR,t)}const iR=O("ZodBigInt",(t,e)=>{uD.init(t,e),we.init(t,e),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.gt=(i,n)=>t.check(Js(i,n)),t.gte=(i,n)=>t.check(tn(i,n)),t.min=(i,n)=>t.check(tn(i,n)),t.lt=(i,n)=>t.check(qs(i,n)),t.lte=(i,n)=>t.check(rr(i,n)),t.max=(i,n)=>t.check(rr(i,n)),t.positive=i=>t.check(Js(BigInt(0),i)),t.negative=i=>t.check(qs(BigInt(0),i)),t.nonpositive=i=>t.check(rr(BigInt(0),i)),t.nonnegative=i=>t.check(tn(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(hu(i,n));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function sR(t){return uC(iR,t)}const aR=O("ZodUndefined",(t,e)=>{cD.init(t,e),we.init(t,e)});function oR(t){return cC(aR,t)}const uR=O("ZodNull",(t,e)=>{lD.init(t,e),we.init(t,e)});function yi(t){return lC(uR,t)}const cR=O("ZodUnknown",(t,e)=>{dD.init(t,e),we.init(t,e)});function Ut(){return dC(cR)}const lR=O("ZodNever",(t,e)=>{mD.init(t,e),we.init(t,e)});function dR(t){return mC(lR,t)}const mR=O("ZodArray",(t,e)=>{fD.init(t,e),we.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Vs(r,i)),t.nonempty=r=>t.check(Vs(1,r)),t.max=(r,i)=>t.check(LI(r,i)),t.length=(r,i)=>t.check(MI(r,i)),t.unwrap=()=>t.element});function xr(t,e){return kC(mR,t,e)}const fR=O("ZodObject",(t,e)=>{hD.init(t,e),we.init(t,e),Se(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Zt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ut()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ut()}),t.strict=()=>t.clone({...t._zod.def,catchall:dR()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>jj(t,r),t.merge=r=>Aj(t,r),t.pick=r=>Zj(t,r),t.omit=r=>Pj(t,r),t.partial=(...r)=>Dj(JI,t,r[0]),t.required=(...r)=>Cj(VI,t,r[0])});function y(t,e){const r={type:"object",get shape(){return nm(this,"shape",{...t}),this.shape},...D(e)};return new fR(r)}const hR=O("ZodUnion",(t,e)=>{pD.init(t,e),we.init(t,e),t.options=e.options});function un(t,e){return new hR({type:"union",options:t,...D(e)})}const pR=O("ZodIntersection",(t,e)=>{vD.init(t,e),we.init(t,e)});function vR(t,e){return new pR({type:"intersection",left:t,right:e})}const gR=O("ZodRecord",(t,e)=>{gD.init(t,e),we.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ra(t,e,r){return new gR({type:"record",keyType:t,valueType:e,...D(r)})}const pu=O("ZodEnum",(t,e)=>{yD.init(t,e),we.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{const s={};for(const a of i)if(r.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new pu({...e,checks:[],...D(n),entries:s})},t.exclude=(i,n)=>{const s={...e.entries};for(const a of i)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new pu({...e,checks:[],...D(n),entries:s})}});function Zt(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new pu({type:"enum",entries:r,...D(e)})}const yR=O("ZodLiteral",(t,e)=>{$D.init(t,e),we.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function sm(t,e){return new yR({type:"literal",values:Array.isArray(t)?t:[t],...D(e)})}const $R=O("ZodTransform",(t,e)=>{bD.init(t,e),we.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(gi(s,r.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(gi(a))}};const n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function bR(t){return new $R({type:"transform",transform:t})}const JI=O("ZodOptional",(t,e)=>{wD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function mh(t){return new JI({type:"optional",innerType:t})}const wR=O("ZodNullable",(t,e)=>{_D.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function fh(t){return new wR({type:"nullable",innerType:t})}const _R=O("ZodDefault",(t,e)=>{kD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function kR(t,e){return new _R({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const IR=O("ZodPrefault",(t,e)=>{ID.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function OR(t,e){return new IR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const VI=O("ZodNonOptional",(t,e)=>{OD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType});function SR(t,e){return new VI({type:"nonoptional",innerType:t,...D(e)})}const NR=O("ZodCatch",(t,e)=>{SD.init(t,e),we.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TR(t,e){return new NR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const zR=O("ZodPipe",(t,e)=>{ND.init(t,e),we.init(t,e),t.in=e.in,t.out=e.out});function hh(t,e){return new zR({type:"pipe",in:t,out:e})}const xR=O("ZodReadonly",(t,e)=>{TD.init(t,e),we.init(t,e)});function ER(t){return new xR({type:"readonly",innerType:t})}const WI=O("ZodCustom",(t,e)=>{zD.init(t,e),we.init(t,e)});function UR(t,e){const r=new ft({check:"custom",...D(e)});return r._zod.check=t,r}function ZR(t,e={}){return IC(WI,t,e)}function PR(t,e){const r=UR(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(gi(n,i.value,r._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),i.issues.push(gi(s))}},t(i.value,i)),e);return r}function am(t,e={error:`Input not instance of ${t.name}`}){const r=new WI({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...D(e)});return r._zod.bag.Class=t,r}const GI="all",YI="create",KI="delete",XI="retrieve",HI="update",Ws=Zt([GI,YI,KI,XI,HI]);class Gt extends dr.createTyped("sy"){}class Ce extends Gt.sub("validation"){}class ph extends Ce.sub("field"){constructor(r,i){super(`${r}: ${i}`);f(this,"field");f(this,"message");this.field=r,this.message=i}}class $i extends Gt.sub("auth"){}class vu extends $i.sub("invalid_token"){}class gu extends $i.sub("expired_token"){}class ir extends Gt.sub("unexpected"){constructor(e){super(`
12
+ `).buffer):this.dataType.usesBigInt&&typeof N=="number"?this._data=new this.dataType.Array(u.map(E=>BigInt(Math.round(E)))).buffer:!this.dataType.usesBigInt&&typeof N=="bigint"?this._data=new this.dataType.Array(u.map(Number)).buffer:this._data=new this.dataType.Array(u).buffer}this.key=c,this.alignment=o,this.sampleOffset=a??0,this.timeRange=n??z.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const a=new new I(t).Array(e),i=new Y({data:a.buffer,dataType:t,...n});return i.writePos=0,i}get refCount(){return this._refCount}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){this._refCount--,this.refCount===0&&this.gl.control!=null?this.maybeGarbageCollectGLBuffer(this.gl.control):this.refCount<0&&console.warn("cannot release a series with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ge)return 0;const t=this.byteCapacity.valueOf()-this.writePos,n=e.subBytes(0,t);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this.cachedLength!=null&&(this.cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(e){if(this.writePos===ge)return 0;const t=this.capacity-this.writePos,n=e.sub(0,t);return this.writeToUnderlyingData(n),this.cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ge?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){return this.dataType.isVariable?new TextDecoder().decode(this.underlyingData).split(`
13
+ `).slice(0,-1):Array.from(this).map(e=>e.toString())}parseJSON(e){if(!this.dataType.equals(I.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.toStrings().map(t=>e.parse(lt.decodeString(t)))}get byteCapacity(){return new S(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ge?this.byteCapacity:this.dataType.isVariable?new S(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this.cachedLength!=null?this.cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ge?this.byteCapacity.valueOf()/this.dataType.density.valueOf():this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((n,a)=>{n===Ur&&(e++,t.push(a+1))}),this._cachedIndexes=t,this.cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let a=0;a<this.length;a++)n[a]=su(this.dataType,e,this.data[a],t);return new Y({data:n.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(I.TIMESTAMP))this.cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this.cachedMax=e.reduce((t,n)=>t>n?t:n)}return this.cachedMax}get max(){return this.calcMax()}calcMax(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this.cachedMax??=this.calcRawMax(),Pt(this.cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(I.TIMESTAMP))this.cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this.cachedMin=e.reduce((t,n)=>t<n?t:n)}return this.cachedMin}get min(){return this.calcMin()}calcMin(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this.cachedMin??=this.calcRawMin(),Pt(this.cachedMin,this.sampleOffset))}get bounds(){return V(Number(this.min),Number(this.max),{makeValid:!1})}maybeRecomputeMinMax(e){if(this.cachedMin!=null){const t=e.cachedMin??e.calcRawMin();t<this.cachedMin&&(this.cachedMin=t)}if(this.cachedMax!=null){const t=e.cachedMax??e.calcRawMax();t>this.cachedMax&&(this.cachedMax=t)}}atAlignment(e,t){const n=Number(e-this.alignment);if(n<0||n>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,t)}at(e,t=!1){if(this.dataType.isVariable)return this.atVariable(e,t??!1);if(this.dataType.equals(I.UUID))return this.atUUID(e,t);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return Pt(n,this.sampleOffset)}atUUID(e,t){e<0&&(e=this.length+e);const n=sa(new Uint8Array(this.buffer,e*this.dataType.density.valueOf()));if(n==null){if(t)throw new Error(`[series] - no value at index ${e}`);return}return n}atVariable(e,t){let n=0,a=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[e],a=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let o=0;o<this.data.length;o++)if(this.data[o]===Ur){if(e===0){a=o;break}n=o+1,e--}if(a===0&&(a=this.data.length),n>=a||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(n,a);return this.dataType.equals(I.STRING)?new TextDecoder().decode(i):Xr(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,n=this.length-1;const a=Wt(e);for(;t<=n;){const i=Math.floor((t+n)/2),o=a(this.at(i,!0),e);if(o===0)return i;o<0?t=i+1:n=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(I.FLOAT32)&&!this.dataType.equals(I.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:a}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==a)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==ge){a===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(a).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ge}as(e){return aa(e,this.dataType),this}get digest(){return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:Wn(this.alignmentBounds.lower),upper:Wn(this.alignmentBounds.upper)},timeRange:this.timeRange.toString(),length:this.length,capacity:this.capacity}}get alignmentBounds(){return V(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new du(this);return this.dataType.equals(I.JSON)?new tn(e):e}return this.dataType.equals(I.UUID)?new fu(this):new yu(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Vn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Vn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const n=this.data.subarray(e,t);return new Y({data:n,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,n){if(t<=0&&(n==null||n>=this.length))return this;let a;return e?a=this.data.subarray(t,n):a=this.data.slice(t,n),new Y({data:a,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new Y({data:this.buffer,dataType:this.dataType,timeRange:z.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){let e=`Series(${this.dataType.toString()} ${this.length} [`;if(this.length<=10)e+=Array.from(this).map(t=>t.toString());else{for(let t=0;t<5;t++)e+=`${this.at(t)?.toString()}`,e+=",";e+="...,";for(let t=-5;t<0;t++)e+=this.at(t)?.toString(),t<-1&&(e+=",")}return e+="])",e}}const hu=r=>r==null?!1:Array.isArray(r)||r instanceof ArrayBuffer||ArrayBuffer.isView(r)&&!(r instanceof DataView)||r instanceof Y?!0:na(r),oa=tu(ia,Y);let Vn=class{series;end;index;constructor(e,t,n){this.series=e;const a=V(0,e.length);this.end=Bn(a,n),this.index=Bn(a,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}},du=class{series;index;decoder;constructor(e){if(!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ur;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}};class tn{wrapped;static schema=s.z.record(s.z.string(),s.z.unknown());constructor(e){this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:lt.decodeString(e.value,tn.schema)}}}class fu{series;index;data;density;constructor(e){if(!e.dataType.equals(I.UUID))throw new Error("cannot create a UUID series iterator for a non-UUID series");this.series=e,this.index=0,this.data=new Uint8Array(e.buffer),this.density=I.UUID.density.valueOf()}next(){if(this.index>=this.series.length)return{done:!0,value:void 0};const e=sa(this.data,this.index*this.density);return this.index++,{done:!1,value:e}}}class yu{series;index;constructor(e){this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}}class ca{series;constructor(e=[]){if(e.length!==0){const t=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(t))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){return aa(e,this.dataType),this}get dataType(){return this.series.length===0?I.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?z.ZERO:new z(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?V(0n,0n):V(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(e){const t=()=>new Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`),n=e.dataType.equals(this.dataType);if(oa(e)){if(this.series.length!==0&&!n)throw t();this.series.push(e)}else{if(this.series.length!==0&&e.series.length!==0&&!n)throw t();this.series.push(...e.series)}}get length(){return this.series.reduce((e,t)=>e+t.length,0)}atAlignment(e,t){for(const n of this.series)if(xt(n.alignmentBounds,e))return n.atAlignment(e,t);if(t)throw new Error(`[series] - no value at alignment ${e}`)}at(e,t=!1){e<0&&(e=this.length+e);for(const n of this.series){if(e<n.length)return n.at(e,t);e-=n.length}if(t)throw new Error(`[series] - no value at index ${e}`)}subIterator(e,t){return new yr(this,e,t??this.length)}subAlignmentIterator(e,t){if(e>=this.alignmentBounds.upper||t<=this.alignmentBounds.lower)return jr;let n=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(e<o.alignment)break;if(e>=o.alignmentBounds.upper)n+=o.length;else if(xt(o.alignmentBounds,e)){n+=Number(e-o.alignment);break}}let a=0;for(let i=0;i<this.series.length;i++){const o=this.series[i];if(t<o.alignment)break;if(t>=o.alignmentBounds.upper)a+=o.length;else if(xt(o.alignmentBounds,t)){a+=Number(t-o.alignment);break}}return new yr(this,n,a)}subAlignmentSpanIterator(e,t){if(e>=this.alignmentBounds.upper)return jr;t=Math.min(t,Number(this.distance(e,this.alignmentBounds.upper)));let n=0;for(let a=0;a<this.series.length;a++){const i=this.series[a];if(e<i.alignment)break;if(e>=i.alignmentBounds.upper)n+=i.length;else if(xt(i.alignmentBounds,e)){n+=Number(e-i.alignment);break}}return new yr(this,n,n+t)}updateGLBuffer(e){this.series.forEach(t=>t.updateGLBuffer(e))}get bounds(){return Ul(this.series.map(e=>e.bounds))}get byteLength(){return new S(this.series.reduce((e,t)=>e+t.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let t=0;for(const n of this.series)e.set(n.data,t),t+=n.length;return new this.dataType.Array(e.buffer)}traverseAlignment(e,t){const n=this.series.map(a=>a.alignmentBounds);return Dl(n,e,t)}acquire(e){this.series.forEach(t=>t.acquire(e))}release(){this.series.forEach(e=>e.release())}distance(e,t){const n=this.series.map(a=>a.alignmentBounds);return Ml(n,e,t)}parseJSON(e){if(!this.dataType.equals(I.JSON))throw new Error("cannot parse non-JSON series as JSON");return this.series.flatMap(t=>t.parseJSON(e))}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new gu(this.series)}toStrings(){return this.series.flatMap(e=>e.toStrings())}}let gu=class{series;seriesIndex;internal;constructor(e){this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[Symbol.iterator](){return this}};class yr{series;index;end;constructor(e,t,n){this.series=e,this.end=n,this.index=t}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}const Wn=r=>{const e=r>>32n,t=r&0xffffffffn;return{domain:e,sample:t}},pu=(r,e)=>{let t=null;return e===0?r:(...n)=>{t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>r(...n),e)}},mu=(r,e,t=".")=>{const n=r.split(t);return n.map((a,i)=>{const o=e(a,i,n);return o==null?null:typeof o=="string"?o:o.join(t)}).filter(a=>a!=null).join(t)},wu=(r,e)=>{if(!Array.isArray(r))return r[e];const t=r[e];if(t!=null||r.length==0)return t;const n=r[0];if(typeof n=="object"&&"key"in n)return r.find(a=>a.key===e)},bu=(r,e,t={optional:!1,separator:"."})=>{t.separator??=".";const{optional:n,getter:a=wu}=t,i=e.split(t.separator);if(i.length===1&&i[0]==="")return r;let o=r;for(const c of i){const l=a(o,c);if(l==null){if(n)return null;throw new Error(`Path ${e} does not exist. ${c} is null`)}o=l}return o};s.z.object({key:s.z.string(),value:s.z.string()});class Tu{handlers;transform;closer;constructor(e,t){this.transform=e,this.handlers=t??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let t=e;if(this.transform!=null){const[n,a]=this.transform(e);if(!a)return;t=n}this.handlers.forEach((n,a)=>a(t))}setCloser(e){this.closer=e}async close(){return await this.closer?.()}}let vu=class{handlers;constructor(e){this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}};const Eu=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:vu,Observer:Tu},Symbol.toStringTag,{value:"Module"})),Ou=s.z.record(s.z.union([s.z.number(),s.z.string(),s.z.symbol()]),s.z.unknown()),rn=r=>Object.entries(r),Nu=(r,e)=>Object.fromEntries(rn(r).map(([t,n])=>[t,e(n,t)])),zu=r=>Object.fromEntries(rn(r).filter(([e,t])=>t!==void 0)),ue=Object.freeze(Object.defineProperty({__proto__:null,entries:rn,map:Nu,purgeUndefined:zu,unknownZ:Ou},Symbol.toStringTag,{value:"Module"})),Su=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Su();const Iu=["macOS","Windows","Linux"],Au=["macos","windows","linux"],$u={macos:"macOS",windows:"Windows",linux:"Linux"};s.z.enum(Iu).or(s.z.enum(Au).transform(r=>$u[r]));const ku=(...r)=>r.map(la).join(""),la=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),Cu=r=>r.endsWith("/")?r.slice(0,-1):r;class ot{protocol;host;port;path;constructor({host:e,port:t,protocol:n="",pathPrefix:a=""}){this.protocol=n,this.host=e,this.port=t,this.path=la(a)}replace(e){return new ot({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new ot({...this,pathPrefix:ku(this.path,e)})}toString(){return Cu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}static UNKNOWN=new ot({host:"unknown",port:0})}const xu=r=>r.nullable().transform(e=>e===null?void 0:e).optional(),Ru=r=>s.array(r).or(r.transform(e=>[e])),ua=r=>mu(r,(e,t,n)=>{const a=t===n.length-1,i=!isNaN(parseInt(e)),o=!isNaN(parseInt(n[t+1]));return i&&(e="element"),a||o?e:[e,"shape"]}),_n=(r,e)=>{if(r==null)return null;const t=r[e];return t==null&&typeof r=="object"&&"sourceType"in r?r.sourceType()[e]:t},ju=(r,e,t)=>bu(_n(r,"shape"),ua(e),{...t,getter:_n}),ct=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:ju,getFieldSchemaPath:ua,nullToUndefined:xu,toArray:Ru},Symbol.toStringTag,{value:"Module"})),Uu=async r=>await new Promise(e=>setTimeout(e,v.fromMilliseconds(r).milliseconds));class Du{config;retries;interval;constructor(e){this.config={baseInterval:new v(e?.baseInterval??v.seconds(1)),maxRetries:e?.maxRetries??5,scale:e?.scale??1,sleepFn:e?.sleepFn??Uu},this.retries=0,this.interval=new v(this.config.baseInterval)}async wait(){const{maxRetries:e,scale:t,sleepFn:n}=this.config;return this.retries>=e?!1:(await n(this.interval),this.interval=this.interval.mult(t),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const Mu=s.z.object({baseInterval:v.z.optional(),maxRetries:s.z.number().optional(),scale:s.z.number().optional()}),ha=Object.freeze(Object.defineProperty({__proto__:null,Breaker:Du,breakerConfigZ:Mu},Symbol.toStringTag,{value:"Module"})),Zu=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,da=s.z.string().regex(Zu),Fe=s.z.number().min(0).max(255),fa=s.z.number().min(0).max(1),ya=s.z.tuple([Fe,Fe,Fe,fa]),Pu=s.z.tuple([Fe,Fe,Fe]),Lu=s.z.object({rgba255:ya}),Bu=s.z.number().min(0).max(360),qu=s.z.number().min(0).max(100),Fu=s.z.number().min(0).max(100),Yu=s.z.tuple([Bu,qu,Fu,fa]),nn=s.z.union([da,Pu,ya,Yu,Lu]),Vu=nn.transform(r=>sn(r)),sn=(r,e=1)=>{if(r=nn.parse(r),typeof r=="string")return Wu(r,e);if(Array.isArray(r)){if(r.length<3||r.length>4)throw new Error(`Invalid color: [${r.join(", ")}]`);return r.length===3?[...r,e]:r}return r.rgba255},Wu=(r,e=1)=>(r=da.parse(r),r=_u(r),[jt(r,0),jt(r,2),jt(r,4),r.length===8?jt(r,6)/255:e]),jt=(r,e)=>parseInt(r.slice(e,e+2),16),_u=r=>r.startsWith("#")?r.slice(1):r;sn("#000000");sn("#ffffff");const Hu=s.z.object({key:s.z.string(),color:nn,position:s.z.number(),switched:s.z.boolean().optional()});s.z.array(Hu);const Gu=s.z.object({key:s.z.string(),name:s.z.string(),color:Vu});s.z.object({key:s.z.string(),name:s.z.string(),swatches:s.z.array(Gu)});const ga=s.z.int().min(0).max(255),pa=255,ma=0,Ju={lower:ma,upper:pa+1},wa=s.z.object({name:s.z.string(),key:s.z.string()}),ut=r=>s.z.object({subject:wa,resource:r,authority:ga}),Ku=(...r)=>e=>e.filter(t=>{let n=!1;return t.to!=null&&(n=r.includes(t.to.resource)),t.from!=null&&!n&&(n=r.includes(t.from.resource)),n}),ba=r=>s.z.object({from:ut(r),to:s.z.null()}),Ta=r=>s.z.object({from:s.z.null(),to:ut(r)}),Xu=r=>s.z.union([ba(r),Ta(r),s.z.object({from:ut(r),to:ut(r)})]),G=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:pa,AUTHORITY_BOUNDS:Ju,ZERO_AUTHORITY:ma,acquireZ:Ta,authorityZ:ga,filterTransfersByChannelKey:Ku,releaseZ:ba,stateZ:ut,subjectZ:wa,transferZ:Xu},Symbol.toStringTag,{value:"Module"})),Qu=r=>Object.getOwnPropertySymbols(globalThis).includes(r),eh=(r,e)=>{const t=Symbol.for(r);if(!Qu(t)){const n=e();Object.defineProperty(globalThis,t,{value:n})}return()=>globalThis[t]},va="sy_x_error",th=r=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(r):e instanceof Error?e.message.startsWith(r):typeof e!="string"?!1:e.startsWith(r),vt=r=>class it extends Error{static discriminator=va;discriminator=it.discriminator;static TYPE=r;type=it.TYPE;static matches=th(r);matches=it.matches;constructor(t,n){super(t,n),this.name=it.TYPE}static sub(t){return vt(`${r}.${t}`)}},Ea=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!==va)return!1;if(!("type"in e))throw new Error(`X Error is missing its type property: ${JSON.stringify(e)}`);return!0},Pe="unknown",Dr="nil";class rh{providers=[];register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Dr,data:""};if(Ea(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}if(e instanceof Error)return{type:Pe,data:e.message};if(typeof e=="string")return{type:Pe,data:e};try{return{type:Pe,data:JSON.stringify(e)}}catch{return{type:Pe,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===Dr)return null;if(e.type===Pe)return new Mr(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Mr(e.data)}}const an=eh("synnax-error-registry",()=>new rh),nh=({encode:r,decode:e})=>an().register({encode:r,decode:e}),sh=r=>an().encode(r),ah=r=>r==null?null:an().decode(r);class Mr extends vt("unknown"){}const ih=s.z.object({type:s.z.string(),data:s.z.string()});class oh extends vt("canceled"){}class ch extends vt("not_implemented"){}const le=Object.freeze(Object.defineProperty({__proto__:null,Canceled:oh,NONE:Dr,NotImplemented:ch,UNKNOWN:Pe,Unknown:Mr,createTyped:vt,decode:ah,encode:sh,isTyped:Ea,payloadZ:ih,register:nh},Symbol.toStringTag,{value:"Module"})),lh=s.object({jsonrpc:s.literal("2.0"),method:s.string(),params:s.any().optional(),id:s.union([s.string(),s.number(),s.null()]).optional()}),Oa=s.object({jsonrpc:s.literal("2.0"),id:s.union([s.string(),s.number(),s.null()])}),uh=Oa.extend({result:s.json()}),hh=Oa.extend({error:s.object({code:s.number().int(),message:s.string().optional(),data:s.json().optional()})}),dh=s.union([uh,hh]);s.union([lh,dh]);const Zr=s.z.string().regex(/^\d+\.\d+\.\d+$/),Et=(r,e,t={})=>{t.checkMajor??=!0,t.checkMinor??=!0,t.checkPatch??=!0;const n=Zr.parse(r),a=Zr.parse(e),[i,o,c]=n.split(".").map(Number),[l,h,d]=a.split(".").map(Number);if(t.checkMajor){if(i<l)return Mt;if(i>l)return Zt}if(t.checkMinor){if(o<h)return Mt;if(o>h)return Zt}if(t.checkPatch){if(c<d)return Mt;if(c>d)return Zt}return Ge},fh=(r,e,t={})=>_s(Et(r,e,t)),Na=(r,e,t={})=>Ws(Et(r,e,t)),yh=(r,e,t={})=>Vs(Et(r,e,t)),gh=({name:r,migrate:e})=>t=>{try{const n=e(t);return console.log(`${r} migrated: ${t.version} -> ${n.version}`),n}catch(n){throw console.log(`${r} failed to migrate from ${t.version}`),console.error(n),n}},ph=({name:r,migrations:e,targetSchema:t,defaultVersion:n,def:a})=>{const i=Object.keys(e).sort(Et).pop();if(i==null)return h=>{if(h.version??=n,h.version!==a.version)return console.log(`${r} version ${h.version} is newer than latest version of ${a.version}.
14
+ Returning default instead.
15
+ `),a;try{return t!=null?t.parse(h):h}catch(d){return console.log(`${r} failed to parse default. Exiting with default`),console.error(d),a}};const o=Object.keys(e).length;let c=!1;const l=h=>{try{if(o===0||Na(h.version,i))return console.log(c?`${r} ${h.version} now up to date`:`${r} version ${h.version} is up to date with target version ${a.version}`),h;const d=h.version,u=e[d],N=u(h);return c=!0,l(N)}catch(d){return console.log(`${r} failed to migrate from ${h.version} to ${i}`),console.error(d),a}};return h=>{try{if(h.version==null)if(n!=null)console.log(`${r} version is null. Setting version to default of ${n}`),h.version=n;else return console.log(`${r} version is null and no default version set. Exiting with default`),a;return l(h)}catch(d){return console.log(`${r} failed to parse final result. Exiting with default`),console.error(d),a}}},Hn=Object.freeze(Object.defineProperty({__proto__:null,compareSemVer:Et,createMigration:gh,migrator:ph,semVerNewer:Na,semVerOlder:yh,semVerZ:Zr,versionsEqual:fh},Symbol.toStringTag,{value:"Module"})),mh=["standard","scientific","engineering"];s.z.enum(mh);const za=s.z.enum(["success","info","warning","error","loading","disabled"]),wh=r=>s.z.object({key:s.z.string(),variant:za,message:s.z.string(),description:s.z.string().optional(),time:O.z,details:r??s.z.unknown().optional()}),bh=(r,e)=>{if(!(r instanceof Error))throw r;return Sa({variant:"error",message:e??r.message,description:e!=null?r.message:void 0,details:{stack:r.stack??""}})},Sa=r=>({key:en(),time:O.now(),...r}),Ht=Object.freeze(Object.defineProperty({__proto__:null,create:Sa,fromException:bh,statusZ:wh,variantZ:za},Symbol.toStringTag,{value:"Module"})),Th=(r,e="")=>{const t=r.length;return t===0?e:t===1?r[0]:t===2?`${r[0]} and ${r[1]}`:`${r.slice(0,-1).join(", ")}, and ${r[t-1]}`},vh=r=>{const e=r.split(" "),t=new Set,n=e.map(o=>o.charAt(0).toLowerCase()).join("");t.add(n.replace(/-/g,"_")),t.add(n.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"));const a=/\d+/g;r.match(a)&&e.forEach((o,c)=>{if(a.test(o)){const l=e.map((h,d)=>d!==c?h.charAt(0).toLowerCase():h).join("");t.add(l.replace(/-/g,"_")),t.add(l.replace(/(.)(.)/g,"$1_$2").replace(/-/g,"_"))}});const i=e.map(o=>(o.length>3?o.substring(0,3):o).toLowerCase());return t.add(i.join("").replace(/-/g,"_")),t.add(i.join("_").replace(/-/g,"_")),Array.from(t).filter(o=>o.length>=2&&o.length<=12&&!/^\d/.test(o))},Eh=(r,e)=>r.startsWith(e)?r.slice(e.length):r,Oh=Object.freeze(Object.defineProperty({__proto__:null,createShortIdentifiers:vh,naturalLanguageJoin:Th,trimPrefix:Eh},Symbol.toStringTag,{value:"Module"})),Ia="all",Aa="create",$a="delete",ka="retrieve",Ca="update",Ft=s.z.enum([Ia,Aa,$a,ka,Ca]);class re extends le.createTyped("sy"){}class M extends re.sub("validation"){}class ht extends M.sub("path"){path;error;static encodedSchema=s.z.object({path:s.z.string().array(),error:le.payloadZ});constructor(e,t){const n=T.toArray(e);super(`${n.join(".")}: ${t.message}`),this.path=n.flatMap(a=>a.split(".")),this.error=t}static decode(e){const t=ht.encodedSchema.parse(JSON.parse(e.data));return new ht(t.path,le.decode(t.error))}}class dt extends re.sub("auth"){}class Pr extends dt.sub("invalid_token"){}class Lr extends dt.sub("expired_token"){}class Ye extends re.sub("unexpected"){constructor(e){super(`
124
16
  Unexpected error encountered:
125
17
 
126
18
  ${e}
127
19
 
128
20
  Please report this to the Synnax team.
129
- `)}}class Vt extends Gt.sub("query"){}class On extends Vt.sub("not_found"){}class Sn extends Vt.sub("multiple_results"){}class yu extends Gt.sub("route"){constructor(r,i){super(r);f(this,"path");this.path=i}}class $u extends Gt.sub("control"){}class vh extends $u.sub("unauthorized"){}class jR extends Gt.sub("contiguity"){}const AR=t=>{if(!t.type.startsWith(Gt.TYPE))return null;if(t.type.startsWith(Ce.TYPE)){if(t.type===ph.TYPE){const e=t.data.split(": ");return e.length<2?new Ce(t.data):new ph(e[0],e[1])}return new Ce(t.data)}return t.type.startsWith($i.TYPE)?t.type.startsWith(vu.TYPE)?new vu(t.data):t.type.startsWith(gu.TYPE)?new gu(t.data):new $i(t.data):t.type.startsWith(ir.TYPE)?new ir(t.data):t.type.startsWith(Vt.TYPE)?t.type.startsWith(On.TYPE)?new On(t.data):t.type.startsWith(Sn.TYPE)?new Sn(t.data):new Vt(t.data):t.type.startsWith($u.TYPE)?t.type.startsWith(vh.TYPE)?new vh(t.data):new $u(t.data):t.type.startsWith(yu.TYPE)?new yu(t.data,t.data):new ir(t.data)},DR=()=>{throw new Error("Not implemented")};dr.register({encode:DR,decode:AR});const CR=async(t,e)=>{const[r,i]=await e(t);return i==null?[r,i]:i instanceof sn?[r,new sn({message:`Cannot reach cluster at ${i.url.host}:${i.url.port}`,url:i.url})]:[r,i]},Er=S().uuid(),La=S(),om=y({key:Er,name:La}),RR=t=>{const e=C.toArray(t);if(e.length===0)throw new Error("No groups specified");const r=Er.safeParse(e[0]).success;return{single:!Array.isArray(t),variant:r?"keys":"names",normalized:e,actual:t}},um="group",rt=t=>un([un([yi(),oR()]).transform(()=>[]),t.array()]),Ve=ue(),Li=S(),Mi=y({name:Li,key:Ve,dataType:ae.z,leaseholder:ue(),index:Ve,isIndex:ne(),internal:ne(),virtual:ne(),alias:S().optional(),expression:S().default(""),requires:rt(Ve)}),QI=Mi.extend({key:Ve.optional(),leaseholder:ue().optional(),index:Ve.optional(),isIndex:ne().optional(),internal:ne().optional().default(!1),virtual:ne().optional().default(!1),expression:S().optional().default(""),requires:rt(Ve).optional().default([])}),Ma="channel",LR=y({key:Ve,variant:ga.variantZ,message:S()}),cm="framer",gh=t=>{const e=C.toArray(t);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},yh=(t,e)=>{const r=C.toArray(t);if(r.length===e.length)return;const i=gh(t);throw gh===null?new Ce("[Frame] - channel keys or names must be provided when constructing a frame."):new Ce(`[Frame] - ${i}s and series must be the same length.
130
- Got ${r.length} ${i}s and ${e.length} series.`)};class Je{constructor(e=[],r=[]){f(this,"columns",[]);f(this,"series",[]);if(e instanceof Je){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((n,s)=>this.push(s,...C.toArray(n)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const n=e;n.series??(n.series=[]),n.keys??(n.keys=[]);const s=n.series.map(a=>eO(a));yh(n.keys,s),n.keys.forEach((a,o)=>this.push(a,s[o]))}else Object.entries(e).forEach(([n,s])=>{const a=parseInt(n);if(!isNaN(a))return this.push(a,...C.toArray(s));this.push(n,...C.toArray(s))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const n=C.toArray(r),s=C.toArray(e);yh(s,n),n.forEach((a,o)=>this.push(s[o],a));return}throw new Ce(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
21
+ `)}}class ve extends re.sub("query"){}class ft extends ve.sub("not_found"){}class yt extends ve.sub("multiple_results"){}class Br extends re.sub("route"){path;constructor(e,t){super(e),this.path=t}}class qr extends re.sub("control"){}class Gn extends qr.sub("unauthorized"){}class Nh extends re.sub("disconnected"){constructor(e="Operation failed because no cluster is connected."){super(e)}}class zh extends re.sub("contiguity"){}const Sh=r=>r.type.startsWith(re.TYPE)?r.type.startsWith(M.TYPE)?r.type===ht.TYPE?ht.decode(r):new M(r.data):r.type.startsWith(dt.TYPE)?r.type.startsWith(Pr.TYPE)?new Pr(r.data):r.type.startsWith(Lr.TYPE)?new Lr(r.data):new dt(r.data):r.type.startsWith(Ye.TYPE)?new Ye(r.data):r.type.startsWith(ve.TYPE)?r.type.startsWith(ft.TYPE)?new ft(r.data):r.type.startsWith(yt.TYPE)?new yt(r.data):new ve(r.data):r.type.startsWith(qr.TYPE)?r.type.startsWith(Gn.TYPE)?new Gn(r.data):new qr(r.data):r.type.startsWith(Br.TYPE)?new Br(r.data,r.data):new Ye(r.data):null,Ih=()=>{throw new le.NotImplemented};le.register({encode:Ih,decode:Sh});const Ah=async(r,e)=>{const[t,n]=await e(r);return n==null?[t,n]:n instanceof Te?[t,new Te({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[t,n]};class on{key;name;constructor(e,t){this.key=t,this.name=e}get ontologyID(){return xa(this.key)}}const xa=r=>({type:"group",key:r}),Ot=s.z.uuid(),Gt=s.z.string(),cn=s.z.object({key:Ot,name:Gt}),Ra="builtin",$h="cluster",kh="node",Jt=s.z.enum(["label","log","allow_all","builtin","cluster","channel","node","group","range","framer","range-alias","user","workspace","schematic","lineplot","rack","device","task","policy","table"]),Ch=s.z.string().transform(r=>{const[e,t]=r.split(":");return{type:Jt.parse(e),key:t??""}}),R=s.z.object({type:Jt,key:s.z.string()}).or(Ch),xh={type:Ra,key:"root"},ln=r=>`${r.type}:${r.key}`,Rh=(r,e)=>r.type===e.type&&r.key===e.key,ja=r=>{const e=T.toArray(r);return e.length===0?[]:typeof e[0]=="object"&&"id"in e[0]?e.map(({id:t})=>t):e.map(t=>R.parse(t))},Ua=s.z.object({id:R,name:s.z.string(),data:ue.unknownZ.optional().nullable()}).transform(r=>({key:ln(r.id),...r})),jh=r=>r==="to"?"from":"to",Uh=s.z.object({from:R,type:s.z.string(),to:R}).or(s.z.string().transform(r=>{const[e,t,n]=r.split("->");return{from:R.parse(e),type:t,to:R.parse(n)}})),Dh="parent",Mh=(r,e)=>!(e.type!=null&&e.type!==r.type||e.from?.type!=null&&e.from.type!==r.from.type||e.to?.type!=null&&e.to.type!==r.to.type||e.from?.key!=null&&e.from.key!==r.from.key||e.to?.key!=null&&e.to.key!==r.to.key),Zh=s.z.object({group:cn}),Ph=s.z.object({parent:R,key:Ot.optional(),name:Gt}),Lh=s.z.object({key:Ot,name:Gt}),Bh=s.z.object({keys:s.z.array(Ot)});let qh=class Lt{static CREATE_ENDPOINT="/ontology/create-group";static RENAME_ENDPOINT="/ontology/rename-group";static DELETE_ENDPOINT="/ontology/delete-group";client;constructor(e){this.client=e}async create(e,t,n){return(await g(this.client,Lt.CREATE_ENDPOINT,{parent:e,name:t,key:n},Ph,Zh)).group}async rename(e,t){await g(this.client,Lt.RENAME_ENDPOINT,{key:e,name:t},Lh,s.z.object({}))}async delete(e){await g(this.client,Lt.DELETE_ENDPOINT,{keys:e},Bh,s.z.object({}))}},Da=class{creator;constructor(e){this.creator=new qh(e)}async create(e,t,n){return this.sugar(await this.creator.create(e,t,n))}async rename(e,t){return await this.creator.rename(e,t)}async delete(...e){return await this.creator.delete(e)}sugar(e){return new on(e.name,e.key)}};const Fh=Object.freeze(Object.defineProperty({__proto__:null,Client:Da,Group:on,groupZ:cn,keyZ:Ot,nameZ:Gt,ontologyID:xa},Symbol.toStringTag,{value:"Module"})),Yh="/ontology/add-children",Vh="/ontology/remove-children",Wh="/ontology/move-children",Jn=s.z.object({id:R,children:R.array()}),_h=s.z.object({from:R,to:R,children:R.array()}),gr=s.z.object({});let Hh=class{client;constructor(e){this.client=e}async addChildren(e,...t){await g(this.client,Yh,{id:e,children:t},Jn,gr)}async removeChildren(e,...t){await g(this.client,Vh,{id:e,children:t},Jn,gr)}async moveChildren(e,t,...n){await g(this.client,Wh,{from:e,to:t,children:n},_h,gr)}};const Gh="/ontology/retrieve",Jh=s.z.object({ids:R.array().optional(),children:s.z.boolean().optional(),parents:s.z.boolean().optional(),excludeFieldData:s.z.boolean().optional(),searchTerm:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),types:Jt.array().optional()}),Kh=s.z.object({resources:Ua.array()});let Ma=class{type="ontology";groups;client;writer;framer;constructor(e,t){this.client=e,this.writer=new Hh(e),this.groups=new Da(e),this.framer=t}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object"&&!("key"in e))return this.execRetrieve(e);const n=ja(e),a=await this.execRetrieve({ids:n,...t});if(Array.isArray(e))return a;if(a.length===0)throw new ve(`No resource found with ID ${Oh.naturalLanguageJoin(n.map(i=>ln(i)))}`);return a[0]}async retrieveChildren(e,t){return await this.execRetrieve({ids:T.toArray(e),children:!0,...t})}async retrieveParents(e,t){return await this.execRetrieve({ids:T.toArray(e),parents:!0,...t})}async addChildren(e,...t){return await this.writer.addChildren(e,...t)}async removeChildren(e,...t){return await this.writer.removeChildren(e,...t)}async moveChildren(e,t,...n){return await this.writer.moveChildren(e,t,...n)}async execRetrieve(e){const{resources:t}=await g(this.client,Gh,e,Jh,Kh);return t}};const Xh="sy_ontology_resource_set",Qh="sy_ontology_resource_delete",ed="sy_ontology_relationship_set",td="sy_ontology_relationship_delete",rd=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:Ra,CLUSTER_TYPE:$h,Client:Ma,NODE_TYPE:kh,PARENT_OF_RELATIONSHIP_TYPE:Dh,RELATIONSHIP_DELETE_CHANNEL_NAME:td,RELATIONSHIP_SET_CHANNEL_NAME:ed,RESOURCE_DELETE_CHANNEL_NAME:Qh,RESOURCE_SET_CHANNEL_NAME:Xh,ROOT_ID:xh,idToString:ln,idZ:R,idsEqual:Rh,matchRelationship:Mh,oppositeRelationshipDirection:jh,parseIDs:ja,relationshipZ:Uh,resourceTypeZ:Jt,resourceZ:Ua},Symbol.toStringTag,{value:"Module"})),L=r=>s.z.union([s.z.union([s.z.null(),s.z.undefined()]).transform(()=>[]),r.array()]),Je=s.z.uuid(),Kt=s.z.object({key:Je,subjects:L(R),objects:L(R),actions:L(Ft)}),Za=s.z.object({key:Je.optional(),subjects:R.array().or(R),objects:R.array().or(R),actions:Ft.array().or(Ft)}),nd=s.z.object({keys:Je.array().optional(),subjects:R.array().optional()}),sd=s.z.object({key:Je}).transform(({key:r})=>({keys:[r]})),ad=s.z.union([s.z.object({for:R}).transform(({for:r})=>({subjects:[r]})),s.z.object({for:R.array()}).transform(({for:r})=>({subjects:r})),nd]),id=s.z.union([sd,ad]),od=s.z.object({policies:L(Kt)}),cd=s.z.object({policies:Kt.partial({key:!0}).array()}),ld=s.z.object({policies:Kt.array()}),ud=s.z.object({keys:Je.array()}),hd=s.z.object({}),dd="/access/policy/retrieve",fd="/access/policy/create",yd="/access/policy/delete";let Pa=class{client;constructor(e){this.client=e}async create(e){const t=Array.isArray(e),a=Za.array().parse(T.toArray(e)).map(o=>({objects:T.toArray(o.objects),actions:T.toArray(o.actions),subjects:T.toArray(o.subjects)})),i=await g(this.client,fd,{policies:a},cd,ld);return t?i.policies:i.policies[0]}async retrieve(e){const t="key"in e,n=await g(this.client,dd,e,id,od);return t?n.policies[0]:n.policies}async delete(e){await g(this.client,yd,{keys:T.toArray(e)},ud,hd)}};const gd=r=>({type:"policy",key:r}),pd={type:"allow_all",key:""},md=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:pd,Client:Pa,keyZ:Je,newZ:Za,ontologyID:gd,policyZ:Kt},Symbol.toStringTag,{value:"Module"}));let La=class{policy;constructor(e){this.policy=new Pa(e)}};const wd=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:Ia,CREATE_ACTION:Aa,Client:La,DELETE_ACTION:$a,RETRIEVE_ACTION:ka,UPDATE_ACTION:Ca,actionZ:Ft},Symbol.toStringTag,{value:"Module"})),U=s.z.number(),ce=s.z.string(),Ke=s.z.object({name:ce,key:U,dataType:I.z,leaseholder:s.z.number(),index:U,isIndex:s.z.boolean(),internal:s.z.boolean(),virtual:s.z.boolean(),alias:s.z.string().optional(),expression:s.z.string().default(""),requires:L(U)}),Ba=Ke.extend({key:U.optional(),leaseholder:s.z.number().optional(),index:U.optional(),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional().default(!1),virtual:s.z.boolean().optional().default(!1),expression:s.z.string().optional().default(""),requires:L(U).optional().default([])}),bd=Ht.statusZ(),ke=s.z.union([ct.toArray(U),ct.toArray(ce),ct.toArray(Ke).transform(r=>r.map(e=>e.key))]),Td=new Error("request for lock canceled");var vd=function(r,e,t,n){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(d){try{h(n.next(d))}catch(u){o(u)}}function l(d){try{h(n.throw(d))}catch(u){o(u)}}function h(d){d.done?i(d.value):a(d.value).then(c,l)}h((n=n.apply(r,e||[])).next())})};class Ed{constructor(e,t=Td){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,a)=>{const i={resolve:n,reject:a,weight:e,priority:t},o=qa(this._queue,c=>t<=c.priority);o===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return vd(this,arguments,void 0,function*(t,n=1,a=0){const[i,o]=yield this.acquire(n,a);try{return yield t(i)}finally{o()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Od(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const a=n.findIndex(i=>i.priority<=e);(a===-1?n:n.splice(0,a)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}}function Od(r,e){const t=qa(r,n=>e.priority<=n.priority);r.splice(t+1,0,e)}function qa(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var Nd=function(r,e,t,n){function a(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(d){try{h(n.next(d))}catch(u){o(u)}}function l(d){try{h(n.throw(d))}catch(u){o(u)}}function h(d){d.done?i(d.value):a(d.value).then(c,l)}h((n=n.apply(r,e||[])).next())})};class zd{constructor(e){this._semaphore=new Ed(1,e)}acquire(){return Nd(this,arguments,void 0,function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Sd=(r,e,{convertNumericStrings:t=!0}={})=>{const n=!Array.isArray(r);let a=T.toArray(r);const i=a[0],o=typeof i;let c;return o==="string"&&t&&!isNaN(parseInt(i))&&"number"in e?(c=e.number,a=a.map(l=>parseInt(l))):c=e[o],{single:n,variant:c,normalized:a,actual:r}},Xe=(r,e,t,n)=>{if(n){if(t.length===0)throw new ft(`${r} not found matching ${JSON.stringify(e)}`);if(t.length>1)throw new yt(`Expected one ${r} matching ${JSON.stringify(e)}, but found ${t.length}`)}},Id=s.z.object({leaseholder:s.z.number().optional(),keys:U.array().optional(),names:s.z.string().array().optional(),searchTerm:s.z.string().optional(),rangeKey:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),dataTypes:I.z.array().optional(),notDataTypes:I.z.array().optional(),virtual:s.z.boolean().optional(),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional(),calculated:s.z.boolean().optional()}),Ad=s.z.object({channels:L(Ke)}),J=r=>(Array.isArray(r)&&r.length>0&&typeof r[0]=="object"?r=r.map(e=>e.key):typeof r=="object"&&"key"in r&&(r=[r.key]),Sd(r,{number:"keys",string:"names"}));class Nt{static ENDPOINT="/channel/retrieve";client;constructor(e){this.client=e}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object")return await this.execute(e);const n=J(e),{variant:a}=n;let{normalized:i}=n;return a==="keys"&&i.indexOf(0)!==-1&&(i=i.filter(o=>o!==0)),i.length===0?[]:await this.execute({[a]:i,...t})}async execute(e){const[t,n]=await this.client.send(Nt.ENDPOINT,e,Id,Ad);if(n!=null)throw n;return t.channels}}class un{cache;namesToKeys;wrapped;constructor(e){this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async retrieve(e,t){if(!Array.isArray(e)&&typeof e=="object")return await this.wrapped.retrieve(e);const{normalized:n}=J(e),a=[],i=[];if(n.forEach(c=>{const l=this.get(c);l!=null?a.push(...l):i.push(c)}),i.length===0)return a;const o=await this.wrapped.retrieve(i,t);return this.set(o),a.concat(o)}delete(e){const{variant:t,normalized:n}=J(e);t==="names"?n.forEach(a=>{const i=this.namesToKeys.get(a);i!=null&&(i.forEach(o=>this.cache.delete(o)),this.namesToKeys.delete(a))}):n.forEach(a=>{const i=this.cache.get(a);i!=null&&(this.cache.delete(a),this.namesToKeys.delete(i.name))})}rename(e,t){e.forEach((n,a)=>{const i=t[a],o=this.cache.get(n);if(o==null)return;this.cache.delete(n);const c=this.namesToKeys.get(o.name);c!=null&&(c.delete(n),c.size===0&&this.namesToKeys.delete(o.name)),o.name=i,this.cache.set(n,o);const l=this.namesToKeys.get(i);l==null?this.namesToKeys.set(i,new Set([n])):l.add(n)})}set(e){e.forEach(t=>{this.cache.set(t.key,t);const n=this.namesToKeys.get(t.name);n==null?this.namesToKeys.set(t.name,new Set([t.key])):n.add(t.key)})}get(e){if(typeof e=="number"){const a=this.cache.get(e);return a==null?void 0:[a]}const t=this.namesToKeys.get(e);if(t==null)return;const n=[];if(t.forEach(a=>{const i=this.cache.get(a);i!=null&&n.push(i)}),n.length!==0)return n}}class Fa{mu=new zd;requests=new Map;wrapped;debouncedRun;constructor(e,t){this.wrapped=e,this.debouncedRun=pu(()=>{this.run()},t)}async retrieve(e){if(!Array.isArray(e)&&typeof e=="object")return await this.wrapped.retrieve(e);const{normalized:t,variant:n}=J(e);return n==="names"?await this.wrapped.retrieve(t):await new Promise((i,o)=>{this.mu.runExclusive(()=>{this.requests.set(t,{resolve:i,reject:o}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((t,n)=>n.forEach(a=>e.add(a)));try{const t=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((n,a)=>n.resolve(t.filter(i=>a.includes(i.key))))}catch(t){this.requests.forEach(n=>n.reject(t))}finally{this.requests.clear()}})}}const Ya=async(r,e)=>{const{normalized:t}=J(e),n=await r.retrieve(t),a=[];if(t.forEach(i=>{n.find(o=>o.name===i||o.key===i)==null&&a.push(i)}),a.length>0)throw new ve(`Could not find channels: ${JSON.stringify(a)}`);return n},$d="sy_channel_set",kd="sy_channel_delete";class hn{_frameClient;key;name;dataType;leaseholder;index;isIndex;internal;alias;virtual;expression;requires;constructor({dataType:e,name:t,leaseholder:n=0,key:a=0,isIndex:i=!1,index:o=0,internal:c=!1,virtual:l=!1,frameClient:h,alias:d,expression:u="",requires:N=[]}){this.key=a,this.name=t,this.dataType=new I(e),this.leaseholder=n,this.index=o,this.isIndex=i,this.internal=c,this.alias=d,this.virtual=l,this.expression=u,this.requires=N??[],this._frameClient=h??null}get framer(){if(this._frameClient==null)throw new M("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Ke.parse({key:this.key,name:this.name,dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal,virtual:this.virtual,expression:this.expression,requires:this.requires})}get isCalculated(){return gt(this.payload)}get ontologyID(){return _a(this.key)}async read(e){return await this.framer.read(e,this.key)}async write(e,t){return await this.framer.write(e,this.key,t)}}const Cd="sy_calculation_status",xd="/channel/retrieve-group",Rd=s.z.object({}),jd=s.z.object({group:cn});let Va=class{type="channel";frameClient;client;retriever;writer;constructor(e,t,n,a){this.frameClient=e,this.retriever=t,this.client=n,this.writer=a}async create(e,t={}){const{retrieveIfNameExists:n=!1}=t,a=!Array.isArray(e);let i=T.toArray(e),o=[];if(n){const c=await this.retriever.retrieve(i.map(h=>h.name)),l=new Set(c.map(h=>h.name));i=i.filter(h=>!l.has(h.name)),o=this.sugar(c)}return o=o.concat(this.sugar(await this.writer.create(i))),a?o[0]:o}async retrieve(e,t){if(typeof e=="object"&&!Array.isArray(e))return this.sugar(await this.retriever.retrieve(e));const n=!Array.isArray(e),a=this.sugar(await this.retriever.retrieve(e,t));return Xe("channel",e,a,n),n?a[0]:a}async delete(e){const{normalized:t,variant:n}=J(e);return n==="keys"?await this.writer.delete({keys:t}):await this.writer.delete({names:t})}async rename(e,t){return await this.writer.rename(T.toArray(e),T.toArray(t))}createDebouncedBatchRetriever(e=10){return new un(new Fa(new Nt(this.client),e))}sugar(e){const{frameClient:t}=this;return e.map(n=>new hn({...n,frameClient:t}))}async retrieveGroup(){const e=await g(this.client,xd,{},Rd,jd);return new on(e.group.name,e.group.key)}};const gt=({virtual:r,expression:e})=>r&&e!=="",Wa=async(r,e)=>{if(!gt(e))return e.index;for(const t of e.requires){const n=await r(t);if(n==null)return null;if(!n.virtual)return n.index}for(const t of e.requires){const n=await r(t);if(n==null)return null;if(gt(n)){const a=await Wa(r,n);if(a!=null)return a}}return null},_a=r=>({type:"channel",key:r.toString()}),Ud=s.z.object({channels:Ba.array()}),Dd=s.z.object({channels:Ke.array()}),Md=s.z.object({keys:U.array().optional(),names:ce.array().optional()}),Zd=s.z.object({}),Pd=s.z.object({keys:U.array(),names:ce.array()}),Ld=s.z.object({}),Bd="/channel/create",qd="/channel/delete",Fd="/channel/rename";let Ha=class{client;cache;constructor(e,t){this.client=e,this.cache=t}async create(e){const{channels:t}=await g(this.client,Bd,{channels:e.map(n=>({...n,dataType:n.dataType}))},Ud,Dd);return this.cache.set(t),t}async delete(e){await g(this.client,qd,e,Md,Zd),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,t){await g(this.client,Fd,{keys:e,names:t},Pd,Ld),this.cache.rename(e,t)}};const Yd=Object.freeze(Object.defineProperty({__proto__:null,CALCULATION_STATUS_CHANNEL_NAME:Cd,CacheRetriever:un,Channel:hn,Client:Va,ClusterRetriever:Nt,DELETE_CHANNEL_NAME:kd,DebouncedBatchRetriever:Fa,SET_CHANNEL_NAME:$d,Writer:Ha,analyzeParams:J,calculationStatusZ:bd,isCalculated:gt,keyZ:U,nameZ:ce,newZ:Ba,ontologyID:_a,paramsZ:ke,payloadZ:Ke,resolveCalculatedIndex:Wa,retrieveRequired:Ya},Symbol.toStringTag,{value:"Module"})),Ee=s.z.uuid(),zt=s.z.object({key:Ee,username:s.z.string().min(1),firstName:s.z.string().default(""),lastName:s.z.string().default(""),rootUser:s.z.boolean().default(!0)}),Ga=zt.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:s.z.string().min(1)}),Vd=s.z.object({keys:Ee.array().optional(),usernames:s.z.string().array().optional()}),Wd=s.z.object({key:Ee}).transform(({key:r})=>({keys:[r]})),_d=s.z.object({username:s.z.string()}).transform(({username:r})=>({usernames:[r]})),Hd=s.z.object({usernames:s.z.string().array()}).transform(({usernames:r})=>({usernames:r})),Gd=s.z.union([Wd,_d,Hd,Vd]),Jd=s.z.object({users:L(zt)}),Kd=s.z.object({users:Ga.array()}),Xd=s.z.object({users:zt.array()}),Qd=s.z.object({key:Ee,username:s.z.string().min(1)}),ef=s.z.object({}),tf=s.z.object({key:Ee,firstName:s.z.string().optional(),lastName:s.z.string().optional()}),rf=s.z.object({}),nf=s.z.object({keys:Ee.array()}),sf=s.z.object({}),af="/user/retrieve",of="/user/create",cf="/user/change-username",lf="/user/rename",uf="/user/delete";let Ja=class{client;constructor(e){this.client=e}async create(e){const t=Array.isArray(e),n=await g(this.client,of,{users:T.toArray(e)},Kd,Xd);return t?n.users:n.users[0]}async changeUsername(e,t){await g(this.client,cf,{key:e,username:t},Qd,ef)}async retrieve(e){const t="key"in e||"username"in e,n=await g(this.client,af,e,Gd,Jd);if(!t)return n.users;if(n.users.length===0){const a="key"in e?`key ${e.key}`:`username ${e.username}`;throw new ft(`No user with ${a} found`)}if(n.users.length>1){const a="key"in e?`key ${e.key}`:`username ${e.username}`;throw new yt(`Multiple users found with ${a}`)}return n.users[0]}async rename(e,t,n){await g(this.client,lf,{key:e,firstName:t,lastName:n},tf,rf)}async delete(e){await g(this.client,uf,{keys:T.toArray(e)},nf,sf)}};const hf=r=>({type:"user",key:r}),df=Object.freeze(Object.defineProperty({__proto__:null,Client:Ja,keyZ:Ee,newZ:Ga,ontologyID:hf,userZ:zt},Symbol.toStringTag,{value:"Module"})),ff=s.z.object({username:s.z.string(),password:s.z.string()}),yf=s.z.object({token:s.z.string(),user:zt}),Kn="/auth/login",gf=3,pf="/auth/change-password",mf=s.z.object({username:s.z.string(),password:s.z.string(),newPassword:s.z.string().min(1)}),wf=s.z.object({}),bf=[Pr,Lr];let Tf=class{token;client;credentials;authenticating;authenticated;user;retryCount;constructor(e,t){this.client=e,this.authenticated=!1,this.credentials=t,this.retryCount=0}async changePassword(e){if(!this.authenticated)throw new Error("Not authenticated");await g(this.client,pf,{username:this.credentials.username,password:this.credentials.password,newPassword:e},mf,wf),this.credentials.password=e}middleware(){const e=async(t,n)=>{if(!this.authenticated&&!t.target.endsWith(Kn)){this.authenticating??=new Promise((c,l)=>{this.client.send(Kn,this.credentials,ff,yf).then(([h,d])=>{if(d!=null)return c(d);this.token=h?.token,this.user=h?.user,this.authenticated=!0,c(null)}).catch(l)});const o=await this.authenticating;if(o!=null)return[t,o]}t.params.Authorization=`Bearer ${this.token}`;const[a,i]=await n(t);return bf.some(o=>o.matches(i))&&this.retryCount<gf?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(t,n)):(this.retryCount=0,[a,i])};return e}};const Ka=s.z.enum(["disconnected","connecting","connected","failed"]),Xa=s.z.object({status:Ka,error:s.z.instanceof(Error).optional(),message:s.z.string().optional(),clusterKey:s.z.string(),clientVersion:s.z.string(),clientServerCompatible:s.z.boolean(),nodeVersion:s.z.string().optional()}),vf=s.z.object({clusterKey:s.z.string(),nodeVersion:s.z.string().optional()}),Xn={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.44.1"},Qn=(r,e,t)=>{const n=t?"cluster":"client";return`Synnax cluster node version ${r!=null?`${r} `:""}is too ${t?"old":"new"} for client version ${e}.
22
+ This may cause compatibility issues. We recommend updating the ${n}. For more information, see
23
+ https://docs.synnaxlabs.com/reference/typescript-client/troubleshooting#old-${n}-version`};class pt{static ENDPOINT="/connectivity/check";static DEFAULT=Xn;_state;pollFrequency=v.seconds(30);client;name;interval;clientVersion;onChangeHandlers=[];static connectionStateZ=Xa;versionWarned=!1;constructor(e,t=v.seconds(30),n,a){this._state={...Xn},this.client=e,this.pollFrequency=t,this.clientVersion=n,this.name=a,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){const e=this._state.status;try{const[t,n]=await this.client.send(pt.ENDPOINT,{},s.z.object({}),vf);if(n!=null)throw n;const a=t.nodeVersion,i=this.clientVersion,o=this.versionWarned;a==null?(this._state.clientServerCompatible=!1,o||(console.warn(Qn(null,i,!0)),this.versionWarned=!0)):Hn.versionsEqual(i,a,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,o||(console.warn(Qn(a,i,Hn.semVerNewer(i,a))),this.versionWarned=!0)),this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=t.clusterKey,this._state.nodeVersion=t.nodeVersion,this._state.clientVersion=this.clientVersion}catch(t){this._state.status="failed",this._state.error=t,this._state.message=this.state.error?.message}return this.onChangeHandlers.length>0&&e!==this._state.status&&this.onChangeHandlers.forEach(t=>t(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}}const Ef=Object.freeze(Object.defineProperty({__proto__:null,Checker:pt,stateZ:Xa,statusZ:Ka},Symbol.toStringTag,{value:"Module"})),Of=s.z.object({keys:U.array().optional(),bounds:z.z,names:ce.array().optional()}),Nf=s.z.object({}),zf="/frame/delete";class Sf{client;constructor(e){this.client=e}async delete(e){await g(this.client,zf,e,Of,Nf)}}const es=r=>{const e=T.toArray(r);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},ts=(r,e)=>{const t=T.toArray(r);if(t.length===e.length)return;const n=es(r);throw es===null?new M("[Frame] - channel keys or names must be provided when constructing a frame."):new M(`[Frame] - ${n}s and series must be the same length.
24
+ Got ${t.length} ${n}s and ${e.length} series.`)};class Z{columns=[];series=[];constructor(e=[],t=[]){if(e instanceof Z){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((a,i)=>this.push(i,...T.toArray(a)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const a=e;a.series??=[],a.keys??=[];const i=a.series.map(o=>Qa(o));ts(a.keys,i),a.keys.forEach((o,c)=>this.push(o,i[c]))}else Object.entries(e).forEach(([a,i])=>{const o=parseInt(a);if(!isNaN(o))return this.push(o,...T.toArray(i));this.push(a,...T.toArray(i))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const a=T.toArray(t),i=T.toArray(e);ts(i,a),a.forEach((o,c)=>this.push(i[c],o));return}throw new M(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
131
25
  payload, a list of lazy series, a lazy array, a map, or a record keyed by channel
132
- name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new ir("colType is not key");return this.columns??[]}get uniqueKeys(){return Mm.unique(this.keys)}get names(){if(this.colType==="key")throw new ir("colType is not name");return this.columns??[]}get uniqueNames(){return Mm.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>tO(e)),keys:[...this.keys]}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(r=>r.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return Ee.ZERO;const i=W.min(...this.series.map(s=>s.timeRange.start)),n=W.max(...this.series.map(s=>s.timeRange.end));return new Ee(i,n)}const r=this.get(e);return r==null?Ee.ZERO:r.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(r=>e.includes(r)):new u$(this.series.filter((r,i)=>this.columns[i]===e))}push(e,...r){if(e instanceof Je){if(this.colType!==null&&e.colType!==this.colType)throw new Ce("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...r),typeof e=="string"&&this.colType==="key")throw new Ce("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new Ce("keyVariant must match");this.columns.push(...Array.from({length:r.length},()=>e))}}concat(e){return new Je([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const r=new Je;return this.forEach((i,n,s)=>r.push(...e(i,n,s))),r}forEach(e){this.columns.forEach((r,i)=>{const n=this.series[i];e(r,n,i)})}at(e,r=!1){const i={};return this.uniqueColumns.forEach(n=>{i[n]=this.get(n).at(e,r)}),i}filter(e){const r=new Je;return this.columns.forEach((i,n)=>{const s=this.series[n];e(i,s,n)&&r.push(i,s)}),r}get byteLength(){return new lr(this.series.reduce((e,r)=>e.add(r.byteLength),lr.ZERO))}get digest(){const e={};return this.keys.forEach((r,i)=>{const n=this.series[i].digest;r in e?e[r].push(n):e[r]=[n]}),e}get length(){return this.series.reduce((e,r)=>e+r.length,0)}toString(){let e=`Frame{
133
- `;return this.uniqueColumns.forEach(r=>{e+=` ${r}: ${this.get(r).series.map(i=>i.toString()).join(",")}
134
- `}),e+="}",e}}const Ba=y({keys:un([yi().transform(()=>[]),ue().array().optional().default([])]),series:un([yi().transform(()=>[]),Ft.crudeZ.array().optional().default([])])}),eO=t=>{const{dataType:e,data:r,timeRange:i,alignment:n}=t;return new Ft({data:r,dataType:e,timeRange:i,glBufferUsage:"static",alignment:n})},tO=t=>({timeRange:t.timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment}),cn=nR(),lm=y({key:cn,variant:ga.variantZ.or(sm("").transform(()=>"info")),message:S(),lastReceived:W.z}),Fa=y({key:cn,name:S(),state:d$.nullToUndefined(lm)}),nO=Fa.partial({key:!0}),qa="rack",dm=t=>t?Nn.JSON_CODEC.decodeString(t,$t):{},Bi=S(),mm=y({key:Bi,variant:ga.variantZ.or(sm("").transform(()=>"info")),details:$t.or(S().transform(dm))}),Fi=y({key:Bi,rack:cn,name:S(),make:S(),model:S(),location:S(),configured:ne().optional(),properties:$t.or(S().transform(dm)),state:d$.nullToUndefined(mm)}),rO=Fi.extend({properties:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),Ja="device",Dt=t=>t?JSON.parse(t):{},ln=un([S(),sR().transform(t=>t.toString()),ue().transform(t=>t.toString())]),bi=y({task:ln,variant:ga.variantZ.or(sm("").transform(()=>"info")),key:S().optional(),details:$t.or(S().transform(Dt)).or(xr(Ut())).or(yi())}),qi=y({key:ln,name:S(),type:S(),internal:ne().optional(),config:$t.or(S().transform(dm)),state:bi.optional().nullable(),snapshot:ne().optional()}),iO=qi.omit({key:!0}).extend({key:ln.transform(t=>t.toString()).optional(),config:Ut().transform(t=>Nn.JSON_CODEC.encodeString(t))}),fm=y({task:ln,type:S(),key:S(),args:$t.or(S().transform(Dt)).or(xr(Ut())).or(yi()).optional()}),Va="task",MR=t=>Number(BigInt(t)>>32n),An=S().uuid(),Ji=y({key:An,name:S().min(1),color:S()}),hm="label",mt=S().uuid(),pm=S().min(1),Ur=y({key:mt,name:pm,timeRange:Ee.z,color:S().optional()}),sO=Ur.partial({key:!0}),aO=t=>{const e=C.toArray(t),r=e.length===0;let i=!1;return r||(i=mt.safeParse(e[0]).success),{single:!Array.isArray(t),variant:i?"keys":"names",normalized:e,actual:t,empty:r}},vm="range",gm="range-alias",Dn=S().uuid(),Vi=y({key:Dn,username:S().min(1),firstName:S().default(""),lastName:S().default(""),rootUser:ne().default(!0)}),oO=Vi.partial({key:!0,firstName:!0,lastName:!0}).omit({rootUser:!0}).extend({password:S().min(1)}),ym="user",Zr=S().uuid(),Wa=y({key:Zr,name:S(),data:$t.or(S().transform(Dt))}),uO=Wa.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),$m="lineplot",Pr=S().uuid(),Ga=y({key:Pr,name:S(),data:$t.or(S().transform(Dt))}),cO=Ga.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),bm="log",Ct=S().uuid(),Ya=y({key:Ct,name:S(),layout:$t.or(S().transform(Dt))}),Ka="workspace",lO=Ya.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),dO=Ya.omit({layout:!0}).extend({layout:S().transform(Dt)}),Cn=S().uuid(),Xa=y({key:Cn,name:S(),data:$t.or(S().transform(Dt)),snapshot:ne()}),mO=Xa.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),wm=Xa.extend({data:S().transform(Dt)}),_m="schematic",jr=S().uuid(),km=y({key:jr,name:S(),data:$t.or(S().transform(Dt))}),fO=km.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),Im=km.extend({data:S().transform(Dt)}),Om="table",Sm="builtin",hO="cluster",pO="node",Wi=Zt([hm,bm,cl,Sm,hO,Ma,pO,um,vm,cm,gm,ym,Ka,_m,$m,qa,Ja,Va,ul,Om]),ct=y({type:Wi,key:S()}),vO=S().transform(t=>{const[e,r]=t.split(":");return{type:Wi.parse(e),key:r??""}}),Yn=un([vO,ct]),Xn=class Xn{constructor(e){f(this,"type");f(this,"key");if(e instanceof Xn){this.type=e.type,this.key=e.key;return}if(typeof e=="string"){const[r,i]=e.split(":");this.type=r,this.key=i??"";return}this.type=e.type,this.key=e.key}toString(){return`${this.type}:${this.key}`}isType(){return this.key===""}matchesType(e){return this.type===e&&this.isType()}get payload(){return{type:this.type,key:this.key}}};f(Xn,"z",un([am(Xn),Yn.transform(e=>new Xn(e))]));let V=Xn;const BR=new V({type:Sm,key:"root"}),gO=y({type:ue()}),yO=y({type:Wi,fields:Ra(S(),gO)}),$O=y({id:V.z,name:S(),schema:yO.optional().nullable(),data:$t.optional().nullable()}).transform(t=>({key:t.id.toString(),...t})),FR="to",qR="from",JR=y({from:V.z,type:S(),to:V.z}),bu=t=>{const[e,r,i]=t.split("->");return{from:new V(e),type:r,to:new V(i)}};class Nm{constructor(e,r){f(this,"key");f(this,"name");this.key=r,this.name=e}get ontologyID(){return bO(this.key)}}const bO=t=>new V({type:um,key:t}),VR=y({group:om}),WR=y({parent:ct,key:Er.optional(),name:La}),GR=y({key:Er,name:La}),YR=y({keys:xr(Er)});var bt;let KR=(bt=class{constructor(e){f(this,"client");this.client=e}async create(e,r,i){return(await Z(this.client,bt.CREATE_ENDPOINT,{parent:e,name:r,key:i},WR,VR)).group}async rename(e,r){await Z(this.client,bt.RENAME_ENDPOINT,{key:e,name:r},GR,y({}))}async delete(e){await Z(this.client,bt.DELETE_ENDPOINT,{keys:e},YR,y({}))}},f(bt,"CREATE_ENDPOINT","/ontology/create-group"),f(bt,"RENAME_ENDPOINT","/ontology/rename-group"),f(bt,"DELETE_ENDPOINT","/ontology/delete-group"),bt),wO=class{constructor(e){f(this,"creator");this.creator=new KR(e)}async create(e,r,i){return this.sugar(await this.creator.create(e,r,i))}async rename(e,r){return await this.creator.rename(e,r)}async delete(...e){return await this.creator.delete(e)}sugar(e){return new Nm(e.name,e.key)}};const XR=Object.freeze(Object.defineProperty({__proto__:null,Client:wO,Group:Nm,ONTOLOGY_TYPE:um,analyzeParams:RR,groupZ:om,keyZ:Er,nameZ:La,ontologyID:bO},Symbol.toStringTag,{value:"Module"})),HR="/ontology/add-children",QR="/ontology/remove-children",e2="/ontology/move-children",$h=y({id:ct,children:ct.array()}),t2=y({from:ct,to:ct,children:ct.array()}),po=y({});let n2=class{constructor(e){f(this,"client");this.client=e}async addChildren(e,...r){await Z(this.client,HR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},$h,po)}async removeChildren(e,...r){await Z(this.client,QR,{id:new V(e).payload,children:r.map(i=>new V(i).payload)},$h,po)}async moveChildren(e,r,...i){const n={from:new V(e).payload,to:new V(r).payload,children:i.map(s=>new V(s).payload)};await Z(this.client,e2,n,t2,po)}};const r2="/ontology/retrieve",i2=y({ids:ct.array().optional(),children:ne().optional(),parents:ne().optional(),includeSchema:ne().optional(),excludeFieldData:ne().optional(),term:S().optional(),limit:ue().optional(),offset:ue().optional(),types:Wi.array().optional()}),s2=y({resources:$O.array()}),ws=t=>C.toArray(t).map(e=>new V(e).payload);let _O=class{constructor(e,r){f(this,"type","ontology");f(this,"groups");f(this,"client");f(this,"writer");f(this,"framer");this.client=e,this.writer=new n2(e),this.groups=new wO(e),this.framer=r}async search(e,r){return await this.execRetrieve({term:e,...r})}async retrieve(e,r){const i=await this.execRetrieve({ids:ws(e),...r});if(Array.isArray(e))return i;if(i.length===0)throw new Vt(`No resource found with ID ${mE.naturalLanguageJoin(C.toArray(e).map(n=>new V(n).toString()))}`);return i[0]}async page(e,r,i){return await this.execRetrieve({offset:e,limit:r,...i})}async retrieveChildren(e,r){return await this.execRetrieve({ids:ws(e),children:!0,...r})}async retrieveParents(e,r){return await this.execRetrieve({ids:ws(e),parents:!0,...r})}async addChildren(e,...r){return await this.writer.addChildren(e,...r)}async removeChildren(e,...r){return await this.writer.removeChildren(e,...r)}async moveChildren(e,r,...i){return await this.writer.moveChildren(e,r,...i)}async openChangeTracker(){return await Gi.open(this.framer,this)}async openDependentTracker(e){return await Ha.open(e,this.framer,this)}newSearcherWithOptions(e){return{type:this.type,search:r=>this.search(r,e),retrieve:r=>this.retrieve(r,e),page:(r,i)=>this.page(r,i,e)}}async execRetrieve(e){const{resources:r}=await Z(this.client,r2,e,i2,s2);return r}};const bh="sy_ontology_resource_set",wh="sy_ontology_resource_delete",_h="sy_ontology_relationship_set",kh="sy_ontology_relationship_delete";class Gi{constructor(e,r){f(this,"relationships");f(this,"resources");f(this,"resourceObs");f(this,"relationshipObs");f(this,"streamer");f(this,"client");f(this,"closePromise");this.relationshipObs=new yn.Observer,this.relationships=this.relationshipObs,this.resourceObs=new yn.Observer,this.resources=this.resourceObs,this.client=r,this.streamer=e,this.closePromise=this.start()}async close(){this.streamer.close(),await this.closePromise}async start(){for await(const e of this.streamer)await this.update(e)}async update(e){const r=await this.parseResourceSets(e),i=this.parseResourceDeletes(e);r.concat(i).length>0&&this.resourceObs.notify(r.concat(i));const s=this.parseRelationshipSets(e),a=this.parseRelationshipDeletes(e);s.concat(a).length>0&&this.relationshipObs.notify(s.concat(a))}parseRelationshipSets(e){const r=e.get(_h);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"set",key:bu(i),value:void 0}))}parseRelationshipDeletes(e){const r=e.get(kh);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"delete",key:bu(i)}))}async parseResourceSets(e){const r=e.get(bh);if(r.length===0)return[];const i=Array.from(r.as("string")).map(n=>new V(n));try{return(await this.client.retrieve(i)).map(s=>({variant:"set",key:s.id,value:s}))}catch(n){if(n instanceof Vt)return[];throw n}}parseResourceDeletes(e){const r=e.get(wh);return r.length===0?[]:Array.from(r.as("string")).map(i=>({variant:"delete",key:new V(i)}))}static async open(e,r){const i=await e.openStreamer([bh,wh,_h,kh]);return new Gi(i,r)}}const Ih=t=>t==="from"?"to":"from";class Ha extends yn.Observer{constructor({target:r,dependents:i,relationshipType:n="parent",relationshipDirection:s="from",resourceType:a},o,u){super();f(this,"internal");f(this,"target");f(this,"relDir");f(this,"resourceType");f(this,"dependents");f(this,"client");f(this,"relType");f(this,"handleResourceChange",r=>{this.dependents=this.dependents.map(i=>{const n=r.find(s=>s.key.toString()==i.id.toString());return n==null||n.variant==="delete"?i:n.value}),this.notify(this.dependents)});f(this,"handleRelationshipChange",r=>{const i=r.filter(s=>s.variant==="delete"&&s.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||s.key[Ih(this.relDir)].type===this.resourceType));this.dependents=this.dependents.filter(s=>!i.some(a=>a.key.to.toString()===s.id.toString()&&a.key.type===this.relType));const n=r.filter(s=>s.variant==="set"&&s.key.type===this.relType&&s.key[this.relDir].toString()===this.target.toString()&&(this.resourceType==null||s.key[Ih(this.relDir)].type===this.resourceType));if(n.length===0)return this.notify(this.dependents);this.client.retrieve(n.map(s=>s.key.to)).then(s=>{this.dependents=this.dependents.concat(s),this.notify(this.dependents)}).catch(console.error)});this.resourceType=a,this.internal=o,this.target=r,this.dependents=i,this.resourceType!=null&&(this.dependents=this.dependents.filter(c=>c.id.type===this.resourceType)),this.client=u,this.relType=n,this.relDir=s,this.internal.resources.onChange(this.handleResourceChange),this.internal.relationships.onChange(this.handleRelationshipChange)}static async open(r,i,n){const s=await Gi.open(i,n);return new Ha(r,s,n)}async close(){await this.internal.close()}}const a2=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_TYPE:Sm,CLUSTER_TYPE:hO,ChangeTracker:Gi,Client:_O,DependentTracker:Ha,FROM_RELATIONSHIP_DIRECTION:qR,ID:V,NODE_TYPE:pO,ROOT_ID:BR,TO_RELATIONSHIP_DIRECTION:FR,crudeIDZ:Yn,idZ:ct,parseIDs:ws,parseRelationship:bu,relationshipSchemaZ:JR,resourceTypeZ:Wi,resourceZ:$O,schemaFieldZ:gO,schemaZ:yO,stringIDZ:vO},Symbol.toStringTag,{value:"Module"})),Yi=S().uuid(),Qa=y({key:Yi,subjects:rt(ct),objects:rt(ct),actions:rt(Ws)}),kO=y({key:Yi.optional(),subjects:Yn.array().or(Yn),objects:Yn.array().or(Yn),actions:Ws.array().or(Ws)}),o2=y({keys:Yi.array().optional(),subjects:ct.array().optional()}),u2=y({policies:rt(Qa)}),c2="/access/policy/retrieve";let l2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,c2,e,o2,u2)).policies}};const d2=y({policies:Qa.partial({key:!0}).array()}),m2=y({policies:Qa.array()}),f2=y({keys:Yi.array()}),h2=y({}),p2="/access/policy/create",v2="/access/policy/delete";let g2=class{constructor(e){f(this,"client");this.client=e}async create(e){const i=kO.array().parse(C.toArray(e)).map(s=>({objects:C.toArray(s.objects),actions:C.toArray(s.actions),subjects:C.toArray(s.subjects)}));return(await Z(this.client,p2,{policies:i},d2,m2)).policies}async delete(e){await Z(this.client,v2,{keys:C.toArray(e)},f2,h2)}},IO=class{constructor(e){f(this,"retriever");f(this,"writer");this.retriever=new l2(e),this.writer=new g2(e)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async retrieve(e){const r=Array.isArray(e),i=await this.retriever.retrieve({keys:C.toArray(e)});return r?i:i[0]}async retrieveFor(e){const r=C.toArray(e).map(i=>new V(i).payload);return await this.retriever.retrieve({subjects:r})}async delete(e){await this.writer.delete(e)}};const y2=t=>new V({type:ul,key:t}),$2=new V({type:cl,key:""}),b2=Object.freeze(Object.defineProperty({__proto__:null,ALLOW_ALL_ONTOLOGY_ID:$2,ALLOW_ALL_ONTOLOGY_TYPE:cl,Client:IO,ONTOLOGY_TYPE:ul,keyZ:Yi,newZ:kO,ontologyID:y2,policyZ:Qa},Symbol.toStringTag,{value:"Module"}));let OO=class{constructor(e){f(this,"policy");this.policy=new IO(e)}};const w2=Object.freeze(Object.defineProperty({__proto__:null,ALL_ACTION:GI,CREATE_ACTION:YI,Client:OO,DELETE_ACTION:KI,RETRIEVE_ACTION:XI,UPDATE_ACTION:HI,actionZ:Ws},Symbol.toStringTag,{value:"Module"})),_2=new Error("request for lock canceled");var k2=function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(l){try{c(i.next(l))}catch(d){a(d)}}function u(l){try{c(i.throw(l))}catch(d){a(d)}}function c(l){l.done?s(l.value):n(l.value).then(o,u)}c((i=i.apply(t,e||[])).next())})};class I2{constructor(e,r=_2){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((i,n)=>{const s={resolve:i,reject:n,weight:e,priority:r},a=SO(this._queue,o=>r<=o.priority);a===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(a+1,0,s)})}runExclusive(e){return k2(this,arguments,void 0,function*(r,i=1,n=0){const[s,a]=yield this.acquire(i,n);try{return yield r(s)}finally{a()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(i=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),O2(this._weightedWaiters[e-1],{resolve:i,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(i=>i.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const i=this._weightedWaiters[r-1];if(!i)continue;const n=i.findIndex(s=>s.priority<=e);(n===-1?i:i.splice(0,n)).forEach(s=>s.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function O2(t,e){const r=SO(t,i=>e.priority<=i.priority);t.splice(r+1,0,e)}function SO(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var S2=function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(l){try{c(i.next(l))}catch(d){a(d)}}function u(l){try{c(i.throw(l))}catch(d){a(d)}}function c(l){l.done?s(l.value):n(l.value).then(o,u)}c((i=i.apply(t,e||[])).next())})};class N2{constructor(e){this._semaphore=new I2(1,e)}acquire(){return S2(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Tm=(t,e,{convertNumericStrings:r=!0}={})=>{const i=!Array.isArray(t);let n=C.toArray(t);const s=n[0],a=typeof s;let o;return a==="string"&&r&&!isNaN(parseInt(s))&&"number"in e?(o=e.number,n=n.map(u=>parseInt(u))):o=e[a],{single:i,variant:o,normalized:n,actual:t}},eo=(t,e,r,i)=>{if(i){if(r.length===0)throw new On(`${t} not found matching ${JSON.stringify(e)}`);if(r.length>1)throw new Sn(`Expected one ${t} matching ${JSON.stringify(e)}, but found ${r.length}`)}},T2=y({leaseholder:ue().optional(),keys:Ve.array().optional(),names:S().array().optional(),search:S().optional(),rangeKey:S().optional(),limit:ue().optional(),offset:ue().optional(),dataTypes:ae.z.array().optional(),notDataTypes:ae.z.array().optional(),virtual:ne().optional(),isIndex:ne().optional(),internal:ne().optional()}),z2=y({channels:rt(Mi)}),Pt=t=>(Array.isArray(t)&&t.length>0&&typeof t[0]=="object"?t=t.map(e=>e.key):typeof t=="object"&&"key"in t&&(t=[t.key]),Tm(t,{number:"keys",string:"names"})),Ks=class Ks{constructor(e){f(this,"client");this.client=e}async search(e,r){return await this.execute({search:e,...r})}async retrieve(e,r){const i=Pt(e),{variant:n}=i;let{normalized:s}=i;return n==="keys"&&s.indexOf(0)!==-1&&(s=s.filter(a=>a!==0)),s.length===0?[]:await this.execute({[n]:s,...r})}async page(e,r,i){return await this.execute({offset:e,limit:r,...i})}async execute(e){const[r,i]=await this.client.send(Ks.ENDPOINT,e,T2,z2);if(i!=null)throw i;return r.channels}};f(Ks,"ENDPOINT","/channel/retrieve");let wi=Ks;class zm{constructor(e){f(this,"cache");f(this,"namesToKeys");f(this,"wrapped");this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,i){return await this.wrapped.page(e,r,i)}async retrieve(e,r){const{normalized:i}=Pt(e),n=[],s=[];if(i.forEach(o=>{const u=this.get(o);u!=null?n.push(...u):s.push(o)}),s.length===0)return n;const a=await this.wrapped.retrieve(s,r);return this.set(a),n.concat(a)}delete(e){const{variant:r,normalized:i}=Pt(e);r==="names"?i.forEach(n=>{const s=this.namesToKeys.get(n);s!=null&&(s.forEach(a=>this.cache.delete(a)),this.namesToKeys.delete(n))}):i.forEach(n=>{const s=this.cache.get(n);s!=null&&(this.cache.delete(n),this.namesToKeys.delete(s.name))})}rename(e,r){e.forEach((i,n)=>{const s=r[n],a=this.cache.get(i);if(a==null)return;this.cache.delete(i);const o=this.namesToKeys.get(a.name);o!=null&&(o.delete(i),o.size===0&&this.namesToKeys.delete(a.name)),a.name=s,this.cache.set(i,a);const u=this.namesToKeys.get(s);u==null?this.namesToKeys.set(s,new Set([i])):u.add(i)})}set(e){e.forEach(r=>{this.cache.set(r.key,r);const i=this.namesToKeys.get(r.name);i==null?this.namesToKeys.set(r.name,new Set([r.key])):i.add(r.key)})}get(e){if(typeof e=="number"){const n=this.cache.get(e);return n==null?void 0:[n]}const r=this.namesToKeys.get(e);if(r==null)return;const i=[];if(r.forEach(n=>{const s=this.cache.get(n);s!=null&&i.push(s)}),i.length!==0)return i}}class NO{constructor(e,r){f(this,"mu",new N2);f(this,"requests",new Map);f(this,"wrapped");f(this,"debouncedRun");this.wrapped=e,this.debouncedRun=Ez(()=>{this.run()},r)}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,i){return await this.wrapped.page(e,r,i)}async retrieve(e){const{normalized:r,variant:i}=Pt(e);return i==="names"?await this.wrapped.retrieve(r):await new Promise((s,a)=>{this.mu.runExclusive(()=>{this.requests.set(r,{resolve:s,reject:a}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((r,i)=>i.forEach(n=>e.add(n)));try{const r=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((i,n)=>i.resolve(r.filter(s=>n.includes(s.key))))}catch(r){this.requests.forEach(i=>i.reject(r))}finally{this.requests.clear()}})}}const TO=async(t,e)=>{const{normalized:r}=Pt(e),i=await t.retrieve(r),n=[];if(r.forEach(s=>{i.find(a=>a.name===s||a.key===s)==null&&n.push(s)}),n.length>0)throw new Vt(`Could not find channels: ${JSON.stringify(n)}`);return i};class xm{constructor({dataType:e,name:r,leaseholder:i=0,key:n=0,isIndex:s=!1,index:a=0,internal:o=!1,virtual:u=!1,frameClient:c,alias:l,expression:d="",requires:g=[]}){f(this,"_frameClient");f(this,"key");f(this,"name");f(this,"dataType");f(this,"leaseholder");f(this,"index");f(this,"isIndex");f(this,"internal");f(this,"alias");f(this,"virtual");f(this,"expression");f(this,"requires");this.key=n,this.name=r,this.dataType=new ae(e),this.leaseholder=i,this.index=a,this.isIndex=s,this.internal=o,this.alias=l,this.virtual=u,this.expression=d,this.requires=g??[],this._frameClient=c??null}get framer(){if(this._frameClient==null)throw new Ce("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Mi.parse({key:this.key,name:this.name,dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal,virtual:this.virtual,expression:this.expression,requires:this.requires})}get isCalculated(){return _i(this.payload)}get ontologyID(){return EO(this.key)}async read(e){return await this.framer.read(e,this.key)}async write(e,r){return await this.framer.write(e,this.key,r)}}const x2="sy_calculation_state",E2="/channel/retrieve-group",U2=y({}),Z2=y({group:om});let zO=class{constructor(e,r,i,n){f(this,"type",Ma);f(this,"frameClient");f(this,"client");f(this,"retriever");f(this,"writer");this.frameClient=e,this.retriever=r,this.client=i,this.writer=n}async create(e,r={}){const{retrieveIfNameExists:i=!1}=r,n=!Array.isArray(e);let s=C.toArray(e),a=[];if(i){const o=await this.retriever.retrieve(s.map(c=>c.name)),u=new Set(o.map(c=>c.name));s=s.filter(c=>!u.has(c.name)),a=this.sugar(o)}return a=a.concat(this.sugar(await this.writer.create(s))),n?a[0]:a}async retrieve(e,r){const i=!Array.isArray(e),n=this.sugar(await this.retriever.retrieve(e,r));return eo("channel",e,n,i),i?n[0]:n}async search(e,r){return this.sugar(await this.retriever.search(e,r))}async delete(e){const{normalized:r,variant:i}=Pt(e);return i==="keys"?await this.writer.delete({keys:r}):await this.writer.delete({names:r})}async rename(e,r){return await this.writer.rename(C.toArray(e),C.toArray(r))}newSearcherWithOptions(e){return{type:this.type,search:async r=>await this.search(r,e),retrieve:async r=>await this.retrieve(r,e),page:async(r,i)=>await this.page(r,i,e)}}async page(e,r,i){return this.sugar(await this.retriever.page(e,r,i))}createDebouncedBatchRetriever(e=10){return new zm(new NO(new wi(this.client),e))}sugar(e){const{frameClient:r}=this;return e.map(i=>new xm({...i,frameClient:r}))}async retrieveGroup(){const e=await Z(this.client,E2,{},U2,Z2);return new Nm(e.group.name,e.group.key)}};const _i=({virtual:t,expression:e})=>t&&e!=="",xO=async(t,e)=>{if(!_i(e))return e.index;for(const r of e.requires){const i=await t(r);if(i==null)return null;if(!i.virtual)return i.index}for(const r of e.requires){const i=await t(r);if(i==null)return null;if(_i(i)){const n=await xO(t,i);if(n!=null)return n}}return null},EO=t=>new V({type:Ma,key:t.toString()}),P2=y({channels:QI.array()}),j2=y({channels:Mi.array()}),A2=y({keys:Ve.array().optional(),names:Li.array().optional()}),D2=y({}),C2=y({keys:Ve.array(),names:Li.array()}),R2=y({}),L2="/channel/create",M2="/channel/delete",B2="/channel/rename";let UO=class{constructor(e,r){f(this,"client");f(this,"cache");this.client=e,this.cache=r}async create(e){const{channels:r}=await Z(this.client,L2,{channels:e.map(i=>({...i,dataType:i.dataType}))},P2,j2);return this.cache.set(r),r}async delete(e){await Z(this.client,M2,e,A2,D2),e.keys!=null&&this.cache.delete(e.keys),e.names!=null&&this.cache.delete(e.names)}async rename(e,r){await Z(this.client,B2,{keys:e,names:r},C2,R2),this.cache.rename(e,r)}};const F2=Object.freeze(Object.defineProperty({__proto__:null,CALCULATION_STATE_CHANNEL_NAME:x2,CacheRetriever:zm,Channel:xm,Client:zO,ClusterRetriever:wi,DebouncedBatchRetriever:NO,ONTOLOGY_TYPE:Ma,Writer:UO,analyzeParams:Pt,calculationStateZ:LR,channelZ:Mi,isCalculated:_i,keyZ:Ve,nameZ:Li,newZ:QI,ontologyID:EO,resolveCalculatedIndex:xO,retrieveRequired:TO},Symbol.toStringTag,{value:"Module"})),q2=y({keys:Dn.array().optional(),usernames:S().array().optional()}),J2=y({users:rt(Vi)}),V2="/user/retrieve";let W2=class{constructor(e){f(this,"client");this.client=e}async retrieve(e){return(await Z(this.client,V2,e,q2,J2)).users}};const G2=y({users:oO.array()}),Y2=y({users:Vi.array()}),K2=y({key:Dn,username:S().min(1)}),X2=y({}),H2=y({key:Dn,firstName:S().optional(),lastName:S().optional()}),Q2=y({}),eL=y({keys:Dn.array()}),tL=y({}),nL="/user/create",rL="/user/change-username",iL="/user/rename",sL="/user/delete";let aL=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,nL,{users:C.toArray(e)},G2,Y2)).users}async changeUsername(e,r){await Z(this.client,rL,{key:e,username:r},K2,X2)}async rename(e,r,i){await Z(this.client,iL,{key:e,firstName:r,lastName:i},H2,Q2)}async delete(e){await Z(this.client,sL,{keys:C.toArray(e)},eL,tL)}},ZO=class{constructor(e){f(this,"reader");f(this,"writer");this.writer=new aL(e),this.reader=new W2(e)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async changeUsername(e,r){await this.writer.changeUsername(e,r)}async retrieve(e){const r=Array.isArray(e),i=await this.reader.retrieve({keys:C.toArray(e)});if(r)return i;if(i.length===0)throw new On(`No user with key ${e} found`);if(i.length>1)throw new Sn(`Multiple users found with key ${e}`);return i[0]}async retrieveByName(e){const r=Array.isArray(e),i=await this.reader.retrieve({usernames:C.toArray(e)});if(r)return i;if(i.length===0)throw new On(`No user with username ${e} found`);if(i.length>1)throw new Sn(`Multiple users found with username ${e}`);return i[0]}async rename(e,r,i){await this.writer.rename(e,r,i)}async delete(e){await this.writer.delete(e)}};const oL=t=>new V({type:ym,key:t}),uL=Object.freeze(Object.defineProperty({__proto__:null,Client:ZO,ONTOLOGY_TYPE:ym,keyZ:Dn,newZ:oO,ontologyID:oL,userZ:Vi},Symbol.toStringTag,{value:"Module"})),cL=y({username:S(),password:S()}),lL=y({token:S(),user:Vi}),Oh="/auth/login",dL=3,mL="/auth/change-password",fL=y({username:S(),password:S(),newPassword:S().min(1)}),hL=y({}),pL=[vu,gu];let vL=class{constructor(e,r){f(this,"token");f(this,"client");f(this,"credentials");f(this,"authenticating");f(this,"authenticated");f(this,"user");f(this,"retryCount");this.client=e,this.authenticated=!1,this.credentials=r,this.retryCount=0}async changePassword(e){if(!this.authenticated)throw new Error("Not authenticated");await Z(this.client,mL,{username:this.credentials.username,password:this.credentials.password,newPassword:e},fL,hL),this.credentials.password=e}middleware(){const e=async(r,i)=>{if(!this.authenticated&&!r.target.endsWith(Oh)){this.authenticating??(this.authenticating=new Promise((o,u)=>{this.client.send(Oh,this.credentials,cL,lL).then(([c,l])=>{if(l!=null)return o(l);this.token=c==null?void 0:c.token,this.user=c==null?void 0:c.user,this.authenticated=!0,o(null)}).catch(u)}));const a=await this.authenticating;if(a!=null)return[r,a]}r.params.Authorization=`Bearer ${this.token}`;const[n,s]=await i(r);return pL.some(a=>a.matches(s))&&this.retryCount<dL?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,e(r,i)):(this.retryCount=0,[n,s])};return e}};const PO=Zt(["disconnected","connecting","connected","failed"]),jO=y({status:PO,error:am(Error).optional(),message:S().optional(),clusterKey:S(),clientVersion:S(),clientServerCompatible:ne(),nodeVersion:S().optional()}),gL=y({clusterKey:S(),nodeVersion:S().optional()}),Sh={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected",clientServerCompatible:!1,clientVersion:"0.43.1"},Nh=(t,e,r)=>{const i=r?"cluster":"client";return`Synnax cluster node version ${t!=null?`${t} `:""}is too ${r?"old":"new"} for client version ${e}.
135
- This may cause compatibility issues. We recommend updating the ${i}. For more information, see
136
- https://docs.synnaxlabs.com/reference/typescript-client/troubleshooting#old-${i}-version`},Hn=class Hn{constructor(e,r=M.seconds(30),i,n){f(this,"_state");f(this,"pollFrequency",M.seconds(30));f(this,"client");f(this,"name");f(this,"interval");f(this,"clientVersion");f(this,"onChangeHandlers",[]);f(this,"versionWarned",!1);this._state={...Sh},this.client=e,this.pollFrequency=r,this.clientVersion=i,this.name=n,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var r;const e=this._state.status;try{const[i,n]=await this.client.send(Hn.ENDPOINT,{},y({}),gL);if(n!=null)throw n;const s=i.nodeVersion,a=this.clientVersion,o=this.versionWarned;s==null?(this._state.clientServerCompatible=!1,o||(console.warn(Nh(null,a,!0)),this.versionWarned=!0)):ff.versionsEqual(a,s,{checkMajor:!0,checkMinor:!0,checkPatch:!1})?this._state.clientServerCompatible=!0:(this._state.clientServerCompatible=!1,o||(console.warn(Nh(s,a,ff.semVerNewer(a,s))),this.versionWarned=!0)),this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=i.clusterKey,this._state.nodeVersion=i.nodeVersion,this._state.clientVersion=this.clientVersion}catch(i){this._state.status="failed",this._state.error=i,this._state.message=(r=this.state.error)==null?void 0:r.message}return this.onChangeHandlers.length>0&&e!==this._state.status&&this.onChangeHandlers.forEach(i=>i(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};f(Hn,"ENDPOINT","/connectivity/check"),f(Hn,"DEFAULT",Sh),f(Hn,"connectionStateZ",jO);let ki=Hn;const yL=Object.freeze(Object.defineProperty({__proto__:null,Checker:ki,stateZ:jO,statusZ:PO},Symbol.toStringTag,{value:"Module"})),$L=y({keys:Ve.array().optional(),bounds:Ee.z,names:Li.array().optional()}),bL=y({}),wL="/frame/delete";class _L{constructor(e){f(this,"client");this.client=e}async delete(e){await Z(this.client,wL,e,$L,bL)}}var yr=(t=>(t[t.Open=0]="Open",t[t.Write=1]="Write",t[t.Commit=2]="Commit",t[t.SetAuthority=3]="SetAuthority",t))(yr||{}),$r=(t=>(t[t.PersistStream=1]="PersistStream",t[t.Persist=2]="Persist",t[t.Stream=3]="Stream",t))($r||{});const kL=t=>{switch(t){case"persist":return 2;case"stream":return 3;case"persistStream":return 1;default:if(typeof t=="number"&&t in $r)return t;throw new Error(`invalid writer mode: ${t}`)}},IL=new M(-1);class wu extends Gt.sub("writer_closed"){constructor(){super("WriterClosed")}}const OL=y({start:W.z.optional(),controlSubject:$n.subjectZ.optional(),keys:Ve.array().optional(),authorities:$n.authorityZ.array().optional(),mode:Zt($r).optional(),errOnUnauthorized:ne().optional(),enableAutoCommit:ne().optional(),autoIndexPersistInterval:M.z.optional()}),SL=y({command:Zt(yr),config:OL.optional(),frame:Ba.optional(),buffer:am(Uint8Array).optional()}),NL=y({command:Zt(yr),end:W.z,err:dr.payloadZ.optional()});var nn;let AO=(nn=class{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"closeErr",null);this.stream=e,this.adapter=r}static async _open(e,r,{channels:i,start:n=W.now(),authorities:s=$n.ABSOLUTE_AUTHORITY,controlSubject:a,mode:o=1,errOnUnauthorized:u=!1,enableAutoCommit:c=!1,autoIndexPersistInterval:l=M.SECOND,useExperimentalCodec:d=!0}){const g=await Um.open(e,i);d&&(r=r.withCodec(new ZL(g.codec)));const p=await r.stream(nn.ENDPOINT,SL,NL),_=new nn(p,g);return await _.execute({command:0,config:{start:new W(n),keys:g.keys,controlSubject:a,authorities:C.toArray(s),mode:kL(o),errOnUnauthorized:u,enableAutoCommit:c,autoIndexPersistInterval:l}}),_}async write(e,r){if(this.closeErr!=null)throw this.closeErr;if(this.stream.received())return await this.close();const i=await this.adapter.adapt(e,r);this.stream.send({command:1,frame:i.toPayload()})}async setAuthority(e,r){if(this.closeErr!=null)throw this.closeErr;let i;if(typeof e=="number"&&r==null)i={keys:[],authorities:[e]};else{let n;typeof e=="string"||typeof e=="number"?n={[e]:r}:n=e,n=await this.adapter.adaptObjectKeys(n),i={keys:Object.keys(n).map(s=>Number(s)),authorities:Object.values(n)}}await this.execute({command:3,config:i})}async commit(){if(this.closeErr!=null)throw this.closeErr;return this.stream.received()?(await this.closeInternal(null),W.ZERO):(await this.execute({command:2})).end}async close(){await this.closeInternal(null)}async closeInternal(e){if(this.closeErr!=null)throw this.closeErr;for(this.closeErr=e,this.stream.closeSend();;){if(this.closeErr!=null){if(wu.matches(this.closeErr))return null;throw this.closeErr}const[r,i]=await this.stream.receive();i!=null?this.closeErr=Ot.matches(i)?new wu:i:this.closeErr=dr.decode(r==null?void 0:r.err)}}async execute(e){const r=this.stream.send(e);for(r!=null&&await this.closeInternal(r);;){const[i,n]=await this.stream.receive();n!=null&&await this.closeInternal(n);const s=dr.decode(i==null?void 0:i.err);if(s!=null&&await this.closeInternal(s),(i==null?void 0:i.command)==e.command)return i}}},f(nn,"ENDPOINT","/frame/write"),nn);const Th=t=>t.data.byteLength/t.dataType.density.valueOf(),TL=t=>{const{keys:e,series:r}=t;e.forEach((i,n)=>{r[n].key=i}),r.sort((i,n)=>i.key-n.key),e.sort((i,n)=>i-n),r.forEach(i=>delete i.key)},zh=5,xh=4,Eh=3,Uh=2,Zh=1,Ph=0,St=ae.TIMESTAMP.density.valueOf(),Xt=8,Ht=4,vo=4,go=4,zL=1;class DO{constructor(e=[],r=[]){f(this,"contentType","application/sy-framer");f(this,"states",new Map);f(this,"currState");f(this,"seqNum",0);(e.length>0||r.length>0)&&this.update(e,r)}update(e,r){this.seqNum++;const i={keys:e,keyDataTypes:new Map,hasVariableDataTypes:!1};e.forEach((n,s)=>{const a=r[s];i.keyDataTypes.set(n,a),a.isVariable&&(i.hasVariableDataTypes=!0)}),i.keys.sort(),this.states.set(this.seqNum,i),this.currState=i}throwIfNotUpdated(e){if(this.seqNum<1)throw new Ce(`
26
+ name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new Ye("colType is not key");return this.columns??[]}get uniqueKeys(){return Mn.unique(this.keys)}get names(){if(this.colType==="key")throw new Ye("colType is not name");return this.columns??[]}get uniqueNames(){return Mn.unique(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>ei(e)),keys:[...this.keys]}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(t=>t.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return z.ZERO;const n=O.min(...this.series.map(i=>i.timeRange.start)),a=O.max(...this.series.map(i=>i.timeRange.end));return new z(n,a)}const t=this.get(e);return t==null?z.ZERO:t.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(t=>e.includes(t)):new ca(this.series.filter((t,n)=>this.columns[n]===e))}push(e,...t){if(e instanceof Z){if(this.colType!==null&&e.colType!==this.colType)throw new M("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...t),typeof e=="string"&&this.colType==="key")throw new M("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new M("keyVariant must match");this.columns.push(...Array.from({length:t.length},()=>e))}}concat(e){return new Z([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const t=new Z;return this.forEach((n,a,i)=>t.push(...e(n,a,i))),t}forEach(e){this.columns.forEach((t,n)=>{const a=this.series[n];e(t,a,n)})}at(e,t=!1){const n={};return this.uniqueColumns.forEach(a=>{n[a]=this.get(a).at(e,t)}),n}filter(e){const t=new Z;return this.columns.forEach((n,a)=>{const i=this.series[a];e(n,i,a)&&t.push(n,i)}),t}get byteLength(){return new S(this.series.reduce((e,t)=>e.add(t.byteLength),S.ZERO))}get digest(){const e={};return this.keys.forEach((t,n)=>{const a=this.series[n].digest;t in e?e[t].push(a):e[t]=[a]}),e}get length(){return this.series.reduce((e,t)=>e+t.length,0)}toString(){let e=`Frame{
27
+ `;return this.uniqueColumns.forEach(t=>{e+=` ${t}: ${this.get(t).series.map(n=>n.toString()).join(",")}
28
+ `}),e+="}",e}}const Xt=s.z.object({keys:s.z.union([s.z.null().transform(()=>[]),s.z.number().array().optional().default([])]),series:s.z.union([s.z.null().transform(()=>[]),Y.crudeZ.array().optional().default([])])}),Qa=r=>{const{dataType:e,data:t,timeRange:n,alignment:a}=r;return new Y({data:t,dataType:e,timeRange:n,glBufferUsage:"static",alignment:a})},ei=r=>({timeRange:r.timeRange,dataType:r.dataType,data:new Uint8Array(r.data.buffer),alignment:r.alignment});var We=(r=>(r[r.Open=0]="Open",r[r.Write=1]="Write",r[r.Commit=2]="Commit",r[r.SetAuthority=3]="SetAuthority",r))(We||{}),mt=(r=>(r[r.PersistStream=1]="PersistStream",r[r.Persist=2]="Persist",r[r.Stream=3]="Stream",r))(mt||{});const If=new v(-1);class Fr extends re.sub("writer_closed"){constructor(){super("WriterClosed")}}const Af=s.z.enum(mt).or(s.z.enum(["persist","stream","persistStream"]).transform(r=>{switch(r){case"persist":return 2;case"stream":return 3;case"persistStream":return 1}})),ti=s.z.object({start:O.z.optional(),controlSubject:G.subjectZ.optional(),authorities:s.z.union([G.authorityZ.transform(r=>[r]),G.authorityZ.array()]).default([G.ABSOLUTE_AUTHORITY]),mode:Af.default(1),errOnUnauthorized:s.z.boolean().default(!1),enableAutoCommit:s.z.boolean().default(!1),autoIndexPersistInterval:v.z.default(v.SECOND),useExperimentalCodec:s.z.boolean().default(!1)}),$f=ti.extend({keys:U.array().optional()}),rs=ti.extend({channels:ke}),ri=rs.or(ke.transform(r=>rs.parse({channels:r,start:O.now()}))),kf=s.z.object({command:s.z.enum(We),config:$f.optional(),frame:Xt.optional(),buffer:s.z.instanceof(Uint8Array).optional()}),Cf=s.z.object({command:s.z.enum(We),end:O.z,err:le.payloadZ.optional()}),xf=s.z.tuple([s.z.union([s.z.record(U.or(ce),G.authorityZ),U.or(ce),G.authorityZ]),G.authorityZ.optional()]).transform(([r,e])=>{if(G.authorityZ.safeParse(r).success)return{keys:[],authorities:[r]};if(U.or(ce).safeParse(r).success){if(e==null)throw new Error("authority is required when setting authority for a single channel");return{keys:[r],authorities:[e]}}const t=r;return{keys:Object.keys(t),authorities:Object.values(t)}});let ni=class Yr{static ENDPOINT="/frame/write";stream;adapter;closeErr=null;constructor(e,t){this.stream=e,this.adapter=t}static async _open(e,t,n){const a=ri.parse(n),i=await fn.open(e,a.channels);a.useExperimentalCodec&&(t=t.withCodec(new Zf(i.codec)));const o=await t.stream(Yr.ENDPOINT,kf,Cf),c=new Yr(o,i);return await c.execute({command:0,config:{...a,keys:i.keys}}),c}async write(e,t){if(this.closeErr!=null)throw this.closeErr;if(this.stream.received())return await this.close();const n=await this.adapter.adapt(e,t);this.stream.send({command:1,frame:n.toPayload()})}async setAuthority(e,t){if(this.closeErr!=null)throw this.closeErr;const n=xf.parse([e,t]),a={keys:await this.adapter.adaptParams(n.keys),authorities:n.authorities};await this.execute({command:3,config:a})}async commit(){if(this.closeErr!=null)throw this.closeErr;return this.stream.received()?(await this.closeInternal(null),O.ZERO):(await this.execute({command:2})).end}async close(){await this.closeInternal(null)}async closeInternal(e){if(this.closeErr!=null)throw this.closeErr;for(this.closeErr=e,this.stream.closeSend();;){if(this.closeErr!=null){if(Fr.matches(this.closeErr))return null;throw this.closeErr}const[t,n]=await this.stream.receive();n!=null?this.closeErr=K.matches(n)?new Fr:n:this.closeErr=le.decode(t?.err)}}async execute(e){const t=this.stream.send(e);for(t!=null&&await this.closeInternal(t);;){const[n,a]=await this.stream.receive();a!=null&&await this.closeInternal(a);const i=le.decode(n?.err);if(i!=null&&await this.closeInternal(i),n?.command==e.command)return n}}};const ns=r=>r.data.byteLength/r.dataType.density.valueOf(),Rf=r=>{const{keys:e,series:t}=r;e.forEach((n,a)=>{t[a].key=n}),t.sort((n,a)=>n.key-a.key),e.sort((n,a)=>n-a),t.forEach(n=>delete n.key)},ss=5,as=4,is=3,os=2,cs=1,ls=0,X=I.TIMESTAMP.density.valueOf(),pe=8,me=4,pr=4,mr=4,jf=1;class si{contentType="application/sy-framer";states=new Map;currState;seqNum=0;constructor(e=[],t=[]){(e.length>0||t.length>0)&&this.update(e,t)}update(e,t){this.seqNum++;const n={keys:e,keyDataTypes:new Map,hasVariableDataTypes:!1};e.forEach((a,i)=>{const o=t[i];n.keyDataTypes.set(a,o),o.isVariable&&(n.hasVariableDataTypes=!0)}),n.keys.sort(),this.states.set(this.seqNum,n),this.currState=n}throwIfNotUpdated(e){if(this.seqNum<1)throw new M(`
137
29
  The codec has not been updated with a list of channels and data types.
138
30
  Please call the update method before calling ${e}.
139
- `)}encode(e,r=0){var v,w;this.throwIfNotUpdated("encode");let i=e;e!=null&&typeof e=="object"&&"toPayload"in e&&(i=e.toPayload()),TL(i);let n=-1,s,a,o,u=r+zL+go,c=!((v=this.currState)!=null&&v.hasVariableDataTypes),l=!0,d=!0,g=!0,p=!0,_=!0;i.keys.length!==((w=this.currState)==null?void 0:w.keys.length)&&(g=!1,u+=i.keys.length*vo),i.series.forEach((I,A)=>{var Ar,Ki,Am,Dm,Cm;const J=Th(I),ce=i.keys[A],Xe=(Ar=this.currState)==null?void 0:Ar.keyDataTypes.get(ce);if(Xe==null)throw new Ce(`Channel ${ce} was not provided in the list of channels when opening the writer`);if(!Xe.equals(I.dataType))throw new Ce(`Series data type of ${I.dataType.toString()} does not match the data type of ${Xe.toString()} for channel ${ce}`);if(u+=I.data.byteLength,n===-1){n=J,s=(Ki=I.timeRange)==null?void 0:Ki.start,a=(Am=I.timeRange)==null?void 0:Am.end,o=BigInt(I.alignment??0n);return}n!==J&&(c=!1),((s==null?void 0:s.valueOf())!==((Dm=I.timeRange)==null?void 0:Dm.start.valueOf())||(a==null?void 0:a.valueOf())!==((Cm=I.timeRange)==null?void 0:Cm.end.valueOf()))&&(l=!1),o!==BigInt(I.alignment??0)&&(p=!1)}),d=l&&s==null&&a==null,_=p&&(o===void 0||o===0n),c?u+=Ht:u+=i.keys.length*Ht,d||(l?u+=St*2:u+=i.keys.length*St*2),_||(p?u+=Xt:u+=i.keys.length*Xt);const k=new Uint8Array(u),m=new DataView(k.buffer);let h=r;return k[h]=Number(_)<<zh|Number(p)<<xh|Number(c)<<Eh|Number(l)<<Uh|Number(d)<<Zh|Number(g)<<Ph,h++,m.setUint32(h,this.seqNum,!0),h+=go,c&&(m.setUint32(h,n,!0),h+=Ht),l&&!d&&(m.setBigUint64(h,(s==null?void 0:s.valueOf())??0n,!0),m.setBigUint64(h,(a==null?void 0:a.valueOf())??0n,!0),h+=St*2),p&&!_&&(m.setBigUint64(h,o??0n,!0),h+=Xt),i.series.forEach((I,A)=>{var J,ce;if(g||(m.setUint32(h,i.keys[A],!0),h+=vo),!c){let Xe=I.data.byteLength;I.dataType.isVariable||(Xe=Th(I)),m.setUint32(h,Xe,!0),h+=Ht}k.set(new Uint8Array(I.data),h),h+=I.data.byteLength,!l&&!d&&(m.setBigUint64(h,((J=I.timeRange)==null?void 0:J.start.valueOf())??0n,!0),m.setBigUint64(h,((ce=I.timeRange)==null?void 0:ce.end.valueOf())??0n,!0),h+=St*2),!p&&!_&&(m.setBigUint64(h,I.alignment??0n,!0),h+=Xt)}),k}decode(e,r=0){this.throwIfNotUpdated("decode");const i=e instanceof Uint8Array?e:new Uint8Array(e),n={keys:[],series:[]};let s=r,a=0,o=0,u,c,l;const d=new DataView(i.buffer,i.byteOffset,i.byteLength),g=!!(i[s]>>zh&1),p=!!(i[s]>>xh&1),_=!!(i[s]>>Eh&1),k=!!(i[s]>>Uh&1),m=!!(i[s]>>Zh&1),h=!!(i[s]>>Ph&1);s++;const v=d.getUint32(s,!0);s+=go;const w=this.states.get(v);if(w==null)return n;if(_){if(s+Ht>d.byteLength)return n;a=d.getUint32(s,!0),s+=Ht}if(k&&!m){if(s+St>d.byteLength)return n;u=new W(d.getBigUint64(s,!0)),s+=St,c=new W(d.getBigUint64(s,!0)),s+=St}if(p&&!g){if(s+Xt>d.byteLength)return n;l=d.getBigUint64(s,!0),s+=Xt}return h&&(n.keys=[...w.keys]),w.keys.forEach((I,A)=>{if(!h){if(s>=d.byteLength||d.getUint32(s,!0)!==I)return;s+=vo,n.keys.push(I)}const J=w.keyDataTypes.get(I);if(o=0,_)o=a;else{if(s+Ht>d.byteLength)return;o=d.getUint32(s,!0),s+=Ht}let ce=o;if(J.isVariable||(ce*=J.density.valueOf()),s+ce>d.byteLength){n.keys.splice(A,1);return}const Xe={dataType:J,data:i.slice(s,s+ce).buffer};if(s+=ce,!k&&!m){if(s+St*2>d.byteLength)return;const Ar=d.getBigUint64(s,!0);s+=St;const Ki=d.getBigUint64(s,!0);s+=St,Xe.timeRange=new Ee({start:Ar,end:Ki})}else m?Xe.timeRange=new Ee({start:0n,end:0n}):Xe.timeRange=new Ee({start:(u==null?void 0:u.valueOf())??0n,end:(c==null?void 0:c.valueOf())??0n});if(!p&&!g){if(s+Xt>d.byteLength)return;l=d.getBigUint64(s,!0),s+=Xt,Xe.alignment=l}else g?Xe.alignment=0n:Xe.alignment=l;n.series.push(Xe)}),n}}const Em=254,xL=new Uint8Array([Em]),EL=255,UL=new Uint8Array([EL]),CO="application/sy-framer";class ZL{constructor(e){f(this,"contentType",CO);f(this,"base");f(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Nn.JSON_CODEC}encode(e){var n,s;const r=e;if(r.type=="close"||((n=r.payload)==null?void 0:n.command)!=yr.Write){const a=this.lowPerfCodec.encode(r),o=new Uint8Array({length:a.byteLength+1});return o.set(xL,0),o.set(new Uint8Array(a),1),o}const i=this.base.encode((s=r.payload)==null?void 0:s.frame,1);return i.set(UL,0),i}decode(e,r){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===Em)return this.lowPerfCodec.decode(e.slice(1),r);const s={type:"data"},a=this.base.decode(e,1);return s.payload={command:yr.Write,frame:a},s}}class PL{constructor(e){f(this,"contentType",CO);f(this,"base");f(this,"lowPerfCodec");this.base=e,this.lowPerfCodec=Nn.JSON_CODEC}encode(e){return this.lowPerfCodec.encode(e)}decode(e,r){return new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===Em?this.lowPerfCodec.decode(e.slice(1),r):{type:"data",payload:{frame:this.base.decode(e,1)}}}}class to{constructor(e){f(this,"adapter");f(this,"retriever");f(this,"keys");f(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new DO}static async open(e,r){const i=new to(e);return await i.update(r),i}async update(e){const{variant:r,normalized:i}=Pt(e),n=await this.retriever.retrieve(i);if(this.codec.update(n.map(a=>a.key),n.map(a=>a.dataType)),r==="keys"){this.adapter=null,this.keys=i;return}const s=new Map;this.adapter=s,i.forEach(a=>{const o=n.find(u=>u.name===a);if(o==null)throw new Error(`Channel ${a} not found`);s.set(o.key,o.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const r=this.adapter;return e.map((i,n)=>{if(typeof i=="number"){const s=r.get(i);if(s==null)throw new Error(`Channel ${i} not found`);return[s,n]}return[i,n]})}}class Um{constructor(e){f(this,"adapter");f(this,"retriever");f(this,"keys");f(this,"codec");this.retriever=e,this.adapter=null,this.keys=[],this.codec=new DO}static async open(e,r){const i=new Um(e);return await i.update(r),i}async adaptObjectKeys(e){const r={};for(const[i,n]of Object.entries(e))r[await this.adaptToKey(i)]=n;return r}async update(e){const r=await TO(this.retriever,e);this.adapter=new Map(r.map(i=>[i.name,i.key])),this.keys=r.map(i=>i.key),this.codec.update(this.keys,r.map(i=>i.dataType))}async fetchChannel(e){const r=await this.retriever.retrieve(e);if(r.length===0)throw new Error(`Channel ${JSON.stringify(e)} not found`);return r[0]}async adaptToKey(e){return typeof e=="number"?e:(await this.fetchChannel(e)).key}encode(e){return this.codec.encode(e.toPayload())}async adapt(e,r){if(typeof e=="string"||typeof e=="number"){if(r==null)throw new Ce(`
31
+ `)}encode(e,t=0){this.throwIfNotUpdated("encode");let n=e;e!=null&&typeof e=="object"&&"toPayload"in e&&(n=e.toPayload()),Rf(n);let a=-1,i,o,c,l=t+jf+mr,h=!this.currState?.hasVariableDataTypes,d=!0,u=!0,N=!0,E=!0,P=!0;n.keys.length!==this.currState?.keys.length&&(N=!1,l+=n.keys.length*pr),n.series.forEach((D,fe)=>{const ae=ns(D),nt=n.keys[fe],Ne=this.currState?.keyDataTypes.get(nt);if(Ne==null)throw new M(`Channel ${nt} was not provided in the list of channels when opening the writer`);if(!Ne.equals(D.dataType))throw new M(`Series data type of ${D.dataType.toString()} does not match the data type of ${Ne.toString()} for channel ${nt}`);if(l+=D.data.byteLength,a===-1){a=ae,i=D.timeRange?.start,o=D.timeRange?.end,c=BigInt(D.alignment??0n);return}a!==ae&&(h=!1),(i?.valueOf()!==D.timeRange?.start.valueOf()||o?.valueOf()!==D.timeRange?.end.valueOf())&&(d=!1),c!==BigInt(D.alignment??0)&&(E=!1)}),u=d&&i==null&&o==null,P=E&&(c===void 0||c===0n),h?l+=me:l+=n.keys.length*me,u||(d?l+=X*2:l+=n.keys.length*X*2),P||(E?l+=pe:l+=n.keys.length*pe);const k=new Uint8Array(l),B=new DataView(k.buffer);let C=t;return k[C]=Number(P)<<ss|Number(E)<<as|Number(h)<<is|Number(d)<<os|Number(u)<<cs|Number(N)<<ls,C++,B.setUint32(C,this.seqNum,!0),C+=mr,h&&(B.setUint32(C,a,!0),C+=me),d&&!u&&(B.setBigUint64(C,i?.valueOf()??0n,!0),B.setBigUint64(C,o?.valueOf()??0n,!0),C+=X*2),E&&!P&&(B.setBigUint64(C,c??0n,!0),C+=pe),n.series.forEach((D,fe)=>{if(N||(B.setUint32(C,n.keys[fe],!0),C+=pr),!h){let ae=D.data.byteLength;D.dataType.isVariable||(ae=ns(D)),B.setUint32(C,ae,!0),C+=me}k.set(new Uint8Array(D.data),C),C+=D.data.byteLength,!d&&!u&&(B.setBigUint64(C,D.timeRange?.start.valueOf()??0n,!0),B.setBigUint64(C,D.timeRange?.end.valueOf()??0n,!0),C+=X*2),!E&&!P&&(B.setBigUint64(C,D.alignment??0n,!0),C+=pe)}),k}decode(e,t=0){this.throwIfNotUpdated("decode");const n=e instanceof Uint8Array?e:new Uint8Array(e),a={keys:[],series:[]};let i=t,o=0,c=0,l,h,d;const u=new DataView(n.buffer,n.byteOffset,n.byteLength),N=!!(n[i]>>ss&1),E=!!(n[i]>>as&1),P=!!(n[i]>>is&1),k=!!(n[i]>>os&1),B=!!(n[i]>>cs&1),C=!!(n[i]>>ls&1);i++;const D=u.getUint32(i,!0);i+=mr;const fe=this.states.get(D);if(fe==null)return a;if(P){if(i+me>u.byteLength)return a;o=u.getUint32(i,!0),i+=me}if(k&&!B){if(i+X>u.byteLength)return a;l=new O(u.getBigUint64(i,!0)),i+=X,h=new O(u.getBigUint64(i,!0)),i+=X}if(E&&!N){if(i+pe>u.byteLength)return a;d=u.getBigUint64(i,!0),i+=pe}return C&&(a.keys=[...fe.keys]),fe.keys.forEach((ae,nt)=>{if(!C){if(i>=u.byteLength||u.getUint32(i,!0)!==ae)return;i+=pr,a.keys.push(ae)}const Ne=fe.keyDataTypes.get(ae);if(c=0,P)c=o;else{if(i+me>u.byteLength)return;c=u.getUint32(i,!0),i+=me}let $t=c;if(Ne.isVariable||($t*=Ne.density.valueOf()),i+$t>u.byteLength){a.keys.splice(nt,1);return}const ze={dataType:Ne,data:n.slice(i,i+$t).buffer};if(i+=$t,!k&&!B){if(i+X*2>u.byteLength)return;const Nn=u.getBigUint64(i,!0);i+=X;const Xi=u.getBigUint64(i,!0);i+=X,ze.timeRange=new z({start:Nn,end:Xi})}else B?ze.timeRange=new z({start:0n,end:0n}):ze.timeRange=new z({start:l?.valueOf()??0n,end:h?.valueOf()??0n});if(!E&&!N){if(i+pe>u.byteLength)return;d=u.getBigUint64(i,!0),i+=pe,ze.alignment=d}else N?ze.alignment=0n:ze.alignment=d;a.series.push(ze)}),a}}const dn=254,Uf=new Uint8Array([dn]),Df=255,Mf=new Uint8Array([Df]),ai="application/sy-framer";class Zf{contentType=ai;base;lowPerfCodec;constructor(e){this.base=e,this.lowPerfCodec=$e.JSON_CODEC}encode(e){const t=e;if(t.type=="close"||t.payload?.command!=We.Write){const a=this.lowPerfCodec.encode(t),i=new Uint8Array({length:a.byteLength+1});return i.set(Uf,0),i.set(new Uint8Array(a),1),i}const n=this.base.encode(t.payload?.frame,1);return n.set(Mf,0),n}decode(e,t){if(new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===dn)return this.lowPerfCodec.decode(e.slice(1),t);const i={type:"data"},o=this.base.decode(e,1);return i.payload={command:We.Write,frame:o},i}}class Pf{contentType=ai;base;lowPerfCodec;constructor(e){this.base=e,this.lowPerfCodec=$e.JSON_CODEC}encode(e){return this.lowPerfCodec.encode(e)}decode(e,t){return new DataView(e instanceof Uint8Array?e.buffer:e).getUint8(0)===dn?this.lowPerfCodec.decode(e.slice(1),t):{type:"data",payload:{frame:this.base.decode(e,1)}}}}class Qt{adapter;retriever;keys;codec;constructor(e){this.retriever=e,this.adapter=null,this.keys=[],this.codec=new si}static async open(e,t){const n=new Qt(e);return await n.update(t),n}async update(e){const{variant:t,normalized:n}=J(e),a=await this.retriever.retrieve(n),i=a.map(c=>c.key);if(Zn.uniqueUnorderedPrimitiveArrays(this.keys,i)===Zn.EQUAL)return!1;if(this.codec.update(i,a.map(c=>c.dataType)),t==="keys")return this.adapter=null,this.keys=n,!0;const o=new Map;return this.adapter=o,n.forEach(c=>{const l=a.find(h=>h.name===c);if(l==null)throw new Error(`Channel ${c} not found`);o.set(l.key,l.name)}),this.keys=Array.from(this.adapter.keys()),!0}adapt(e){if(this.adapter==null)return e;const t=this.adapter;return e.map((n,a)=>{if(typeof n=="number"){const i=t.get(n);if(i==null)throw new Error(`Channel ${n} not found`);return[i,a]}return[n,a]})}}class fn{adapter;retriever;keys;codec;constructor(e){this.retriever=e,this.adapter=null,this.keys=[],this.codec=new si}static async open(e,t){const n=new fn(e);return await n.update(t),n}async adaptParams(e){const t=ke.parse(e);return await Promise.all(t.map(async a=>await this.adaptToKey(a)))}async update(e){const t=await Ya(this.retriever,e),n=t.map(h=>h.key),a=new Set(this.keys),i=new Set(n),o=!i.isSubsetOf(a),c=!a.isSubsetOf(i);return o||c?(this.adapter=new Map(t.map(h=>[h.name,h.key])),this.keys=n,this.codec.update(this.keys,t.map(h=>h.dataType)),!0):!1}async fetchChannel(e){const t=await this.retriever.retrieve(e);if(t.length===0)throw new Error(`Channel ${JSON.stringify(e)} not found`);return t[0]}async adaptToKey(e){return typeof e=="number"?e:(await this.fetchChannel(e)).key}encode(e){return this.codec.encode(e.toPayload())}async adapt(e,t){if(typeof e=="string"||typeof e=="number"){if(t==null)throw new M(`
140
32
  Received a single channel name or key but no series.
141
- `);if(Array.isArray(r)){if(r.some(u=>u instanceof Ft||Array.isArray(u)))throw new Ce(`
33
+ `);if(Array.isArray(t)){if(t.some(l=>l instanceof Y||Array.isArray(l)))throw new M(`
142
34
  Received a single channel name or key but multiple series.
143
- `);r=r}const a=await this.fetchChannel(e),o=new Ft({data:r,dataType:a.dataType});return new Je(a.key,o)}if(Array.isArray(e)){if(r==null)throw new Ce(`
35
+ `);t=t}const o=await this.fetchChannel(e),c=new Y({data:t,dataType:o.dataType});return new Z(o.key,c)}if(Array.isArray(e)){if(t==null)throw new M(`
144
36
  Received an array of channel names or keys but no series.
145
- `);if(!Array.isArray(r))throw new Ce(`
37
+ `);if(!Array.isArray(t))throw new M(`
146
38
  Received an array of channel names or keys but no array of series.
147
- `);const a=[],o=[];for(let u=0;u<e.length;u++){const c=await this.fetchChannel(e[u]);if(u>=r.length)throw new Ce(`
39
+ `);const o=[],c=[];for(let l=0;l<e.length;l++){const h=await this.fetchChannel(e[l]);if(l>=t.length)throw new M(`
148
40
  Received an array of channel names or keys but not enough series.
149
- `);const l=new Ft({data:r[u],dataType:c.dataType});a.push(c.key),o.push(l)}return new Je(a,o)}if(e instanceof Je||e instanceof Map){const a=new Je(e);if(this.adapter==null)return a;const o=a.columns.map(u=>{var l;const c=typeof u=="string"?(l=this.adapter)==null?void 0:l.get(u):u;if(c==null)throw new Ce(`
150
- Channel ${u} was not provided in the list of channels when opening the writer
151
- `);return c});return new Je(o,a.series)}const i=[],n=[],s=Object.entries(e);for(let a=0;a<s.length;a++){const[o,u]=s[a],c=await this.fetchChannel(o),l=new Ft({data:u,dataType:c.dataType});i.push(c.key),n.push(l)}return new Je(i,n)}}class RO{constructor(e,r){f(this,"name");f(this,"stream");this.stream=r,this.name=e}async receive(){const[e,r]=await this.stream.receive();if(r!=null)throw r;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,r]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on ${JSON.stringify(e)} closure.
152
- Please report this error to the Synnax team.`),r!=null){if(Ot.matches(r))return;throw r}}}closeSend(){this.stream.closeSend()}send(e){const r=this.stream.send(e);if(r!=null)throw r}}const _u=new M(-1);var Zm=(t=>(t[t.Open=0]="Open",t[t.Next=1]="Next",t[t.Prev=2]="Prev",t[t.SeekFirst=3]="SeekFirst",t[t.SeekLast=4]="SeekLast",t[t.SeekLE=5]="SeekLE",t[t.SeekGE=6]="SeekGE",t[t.Valid=7]="Valid",t[t.Error=8]="Error",t))(Zm||{}),LO=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(LO||{});const jL=y({command:Zt(Zm),span:M.z.optional(),bounds:Ee.z.optional(),stamp:W.z.optional(),keys:Ve.array().optional(),chunkSize:ue().optional()}),AL=y({variant:Zt(LO),ack:ne(),command:Zt(Zm),error:dr.payloadZ.optional().nullable(),frame:Ba.optional()}),ri=class ri{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"value");this.stream=new RO("Iterator",e),this.value=new Je,this.adapter=r}static async _open(e,r,i,n,s={}){const a=await to.open(i,r),o=await n.stream(ri.ENDPOINT,jL,AL),u=new ri(o,a);return await u.execute({command:0,keys:a.keys,bounds:new Ee(e),chunkSize:s.chunkSize??1e5}),u}async next(e=_u){return await this.execute({command:1,span:new M(e)})}async prev(e=_u){return await this.execute({command:2,span:new M(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new W(e)})}async seekGE(e){return await this.execute({command:6,stamp:new W(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new DL(this)}async execute(e){for(this.stream.send(e),this.value=new Je;;){const r=await this.stream.receive();if(r.variant===1)return r.ack;this.value.push(this.adapter.adapt(new Je(r.frame)))}}};f(ri,"ENDPOINT","/frame/iterate");let Gs=ri;class DL{constructor(e){f(this,"iter");f(this,"open",!1);this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const CL=y({keys:ue().array(),downsampleFactor:ue()}),RL=y({frame:Ba}),LL="/frame/stream",Pm=t=>{if(Array.isArray(t))return typeof t[0]=="object"?{channels:t.map(r=>r.key),downsampleFactor:1}:{channels:t,downsampleFactor:1};const e=Ur.safeParse(t);return e.success?{channels:[e.data.key],downsampleFactor:1}:t},MO=(t,e)=>async r=>{const i=Pm(r),n=await to.open(t,i.channels);i.useExperimentalCodec&&(e=e.withCodec(new PL(n.codec)));const s=await e.stream(LL,CL,RL),a=new ML(s,n);s.send({keys:n.keys,downsampleFactor:i.downsampleFactor??1});const[,o]=await s.receive();if(o!=null)throw o;return a},BO=async(t,e,r)=>await MO(t,e)(r);class ML{constructor(e,r){f(this,"stream");f(this,"adapter");f(this,"downsampleFactor");this.stream=new RO("Streamer",e),this.adapter=r,this.downsampleFactor=1}get keys(){return this.adapter.keys}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(Ot.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new Je((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys,downsampleFactor:this.downsampleFactor})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class no{constructor(e,r,i={}){f(this,"wrapped_",null);f(this,"breaker");f(this,"opener");f(this,"config");this.opener=e,this.config=Pm(r);const{maxRetries:n=5e3,baseInterval:s=M.seconds(1),scale:a=1}=i??{};this.breaker=new g$.Breaker({maxRetries:n,baseInterval:s,scale:a})}static async open(e,r,i){const n=new no(e,r,i);return await n.runStreamer(),n}async runStreamer(){for(;;)try{this.wrapped_!=null&&this.wrapped_.close(),this.wrapped_=await this.opener(this.config),this.breaker.reset();return}catch(e){if(this.wrapped_=null,!await this.breaker.wait())throw e;console.error("failed to open streamer",e);continue}}get wrapped(){if(this.wrapped_==null)throw new Error("stream closed");return this.wrapped_}async update(e){this.config.channels=e;try{await this.wrapped.update(e)}catch{return await this.runStreamer(),await this.update(e)}}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(Ot.matches(e))return{done:!0,value:void 0};throw e}}async read(){try{const e=await this.wrapped.read();return this.breaker.reset(),e}catch(e){if(Ot.matches(e))throw e;return await this.runStreamer(),await this.read()}}close(){this.wrapped.close()}get keys(){return this.wrapped.keys}[Symbol.asyncIterator](){return this}}class Wt extends yn.Observer{constructor(r,i){super(i);f(this,"streamer");f(this,"closePromise");this.streamer=r,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const r of this.streamer)this.notify(r)}}const BL=t=>new V({type:cm,key:t.toString()}),jh=t=>Array.isArray(t)||typeof t!="object"||typeof t=="object"&&"key"in t?{channels:t}:t;let FO=class{constructor(e,r,i){f(this,"streamClient");f(this,"retriever");f(this,"deleter");this.streamClient=e,this.retriever=i,this.deleter=new _L(r)}async openIterator(e,r,i){return await Gs._open(e,r,this.retriever,this.streamClient,i)}async openWriter(e){return await AO._open(this.retriever,this.streamClient,jh(e))}async openStreamer(e){return await BO(this.retriever,this.streamClient,jh(e))}async write(e,r,i){if(i==null){const s=r,a=await this.openWriter({start:e,channels:Object.keys(s),mode:$r.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:M.MAX});return await a.write(s),await a.close()}const n=await this.openWriter({start:e,channels:r,mode:$r.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:M.MAX});await n.write(r,i),await n.close()}async read(e,r){const{single:i}=Pt(r),n=await this.readFrame(e,r);return i?n.get(r):n}async readFrame(e,r){const i=await this.openIterator(e,r),n=new Je;try{for await(const s of i)n.push(s)}finally{await i.close()}return n}async delete(e,r){const{normalized:i,variant:n}=Pt(e);return n==="keys"?await this.deleter.delete({keys:i,bounds:r}):await this.deleter.delete({names:i,bounds:r})}};const FL=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:IL,AUTO_SPAN:_u,Client:FO,Frame:Je,HardenedStreamer:no,Iterator:Gs,ONTOLOGY_TYPE:cm,ObservableStreamer:Wt,Writer:AO,WriterClosedError:wu,WriterCommand:yr,WriterMode:$r,createStreamOpener:MO,frameZ:Ba,ontologyID:BL,openStreamer:BO,parseStreamerConfig:Pm,seriesFromPayload:eO,seriesToPayload:tO},Symbol.toStringTag,{value:"Module"})),qL=$n.ABSOLUTE_AUTHORITY,JL=$n.ZERO_AUTHORITY,VL=$n.stateZ(ue()),WL=t=>{var e,r;return t.to==null?`${(e=t.from)==null?void 0:e.resource} - ${(r=t.from)==null?void 0:r.subject.name} -> released`:t.from==null?`${t.to.resource} - released -> ${t.to.subject.name} (${t.to.authority.toString()})`:`${t.to.resource} - ${t.from.subject.name} -> ${t.to.subject.name} (${t.to.authority.toString()})`},GL=y({transfers:xr($n.transferZ(Ve))});class qO extends Wt{constructor(r){super(r,i=>{const n=this.codec.decode(i.series[0].buffer,GL);return this.merge(n),[n.transfers,!0]});f(this,"states");f(this,"codec");this.states=new Map,this.codec=new Nn.JSONCodec}subjects(){const r=new Map;return this.states.forEach(i=>r.set(i.subject.key,i.subject)),Array.from(r.values())}merge(r){r.transfers.forEach(i=>{i.from==null&&i.to==null&&console.warn("Invalid transfer: ",i),i.to==null?this.states.delete(i.from.resource):this.states.set(i.to.resource,i.to)})}}const YL="sy_node_1_control";let JO=class{constructor(e){f(this,"framer");this.framer=e}async openStateTracker(){const e=await no.open(async r=>await this.framer.openStreamer(r),YL);return new qO(e)}};const KL=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:qL,Client:JO,StateTracker:qO,ZERO_AUTHORITY:JL,stateZ:VL,transferString:WL},Symbol.toStringTag,{value:"Module"}));let VO=class{constructor(e,r,i){f(this,"tasks");f(this,"racks");f(this,"devices");this.tasks=e,this.racks=r,this.devices=i}};const XL=Object.freeze(Object.defineProperty({__proto__:null,Client:VO},Symbol.toStringTag,{value:"Module"})),Rn=async(t,e,r,i)=>{const n=await t.openStreamer([e,r]),s=a=>{const o=[];return r!=null&&o.push(...a.get(r).series.flatMap(u=>i("delete",u))),e!=null&&o.push(...a.get(e).series.flatMap(u=>i("set",u))),[o,o.length>0]};return new Wt(n,s)},HL=Object.freeze(Object.defineProperty({__proto__:null,openObservable:Rn},Symbol.toStringTag,{value:"Module"})),QL="sy_device_set",eM="sy_device_delete",Ah="sy_device_state",yo="/hardware/device/retrieve",tM="/hardware/device/create",nM="/hardware/device/delete",rM=y({devices:rO.array()}),iM=y({devices:Fi.array()}),sM=y({keys:Bi.array()}),aM=y({}),$o=y({keys:Bi.array().optional(),names:S().array().optional(),makes:S().array().optional(),models:S().array().optional(),locations:S().array().optional(),racks:cn.array().optional(),search:S().optional(),limit:ue().optional(),offset:ue().optional(),ignoreNotFound:ne().optional(),includeState:ne().optional()}),bo=y({devices:rt(Fi)});let WO=class{constructor(e,r){f(this,"type",Ja);f(this,"client");f(this,"frameClient");this.client=e,this.frameClient=r}async retrieve(e,r){const i=!Array.isArray(e),n=await Z(this.client,yo,{keys:C.toArray(e),...r},$o,bo);return eo("Device",e,n.devices,i),i?n.devices[0]:n.devices}async search(e,r){return(await Z(this.client,yo,{search:e,...r},$o,bo)).devices}async page(e,r,i){return(await Z(this.client,yo,{offset:e,limit:r,...i},$o,bo)).devices}async create(e){const r=!Array.isArray(e),i=await Z(this.client,tM,{devices:C.toArray(e)},rM,iM);return r?i.devices[0]:i.devices}async delete(e){await Z(this.client,nM,{keys:C.toArray(e)},sM,aM)}async openDeviceTracker(){return await Rn(this.frameClient,QL,eM,oM)}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(Ah),e=>{const r=e.get(Ah);return r.length===0?[null,!1]:[r.parseJSON(mm),!0]})}newSearcherWithOptions(e){return{type:this.type,search:async r=>await this.search(r,e),retrieve:async r=>await this.retrieve(r,e),page:async(r,i)=>await this.page(r,i,e)}}};const oM=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(Fi).map(r=>({variant:t,key:r.key,value:r})),uM=t=>new V({type:Ja,key:t}),cM=Object.freeze(Object.defineProperty({__proto__:null,Client:WO,ONTOLOGY_TYPE:Ja,deviceZ:Fi,keyZ:Bi,newZ:rO,ontologyID:uM,stateZ:mm},Symbol.toStringTag,{value:"Module"})),wo="/hardware/rack/retrieve",lM="/hardware/rack/create",dM="/hardware/rack/delete",Dh="sy_rack_state",_o=y({keys:cn.array().optional(),names:S().array().optional(),search:S().optional(),embedded:ne().optional(),hostIsNode:ne().optional(),limit:ue().optional(),offset:ue().optional(),includeState:ne().optional()}),ko=y({racks:rt(Fa)}),mM=y({racks:nO.array()}),fM=y({racks:Fa.array()}),hM=y({keys:cn.array()}),pM=y({});let GO=class{constructor(e,r,i){f(this,"type",qa);f(this,"client");f(this,"tasks");f(this,"frameClient");this.client=e,this.tasks=r,this.frameClient=i}async delete(e){await Z(this.client,dM,{keys:C.toArray(e)},hM,pM)}async create(e){const r=!Array.isArray(e),i=await Z(this.client,lM,{racks:C.toArray(e)},mM,fM),n=this.sugar(i.racks);return r?n[0]:n}async search(e){const r=await Z(this.client,wo,{search:e},_o,ko);return this.sugar(r.racks)}async page(e,r){const i=await Z(this.client,wo,{offset:e,limit:r},_o,ko);return this.sugar(i.racks)}async retrieve(e,r){const{variant:i,normalized:n,single:s}=Tm(e,{string:"names",number:"keys"}),a=await Z(this.client,wo,{[i]:n,includeState:r==null?void 0:r.includeState},_o,ko),o=this.sugar(a.racks);return eo("Rack",e,o,s),s?o[0]:o}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(Dh),e=>{const r=e.get(Dh);return r.length===0?[[],!1]:[r.parseJSON(lm),!0]})}sugar(e){return e.map(({key:r,name:i,state:n})=>new YO(r,i,this.tasks,n))}};class YO{constructor(e,r,i,n){f(this,"key");f(this,"name");f(this,"state");f(this,"tasks");this.key=e,this.name=r,this.tasks=i,this.state=n}async listTasks(){return await this.tasks.retrieve(this.key)}async retrieveTaskByName(e){return await this.tasks.retrieveByName(e,this.key)}async retrieveTaskByType(e){return await this.tasks.retrieveByType(e,this.key)}async createTask(e){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e)}async deleteTask(e){await this.tasks.delete([e])}}const vM=t=>new V({type:qa,key:t.toString()}),gM=Object.freeze(Object.defineProperty({__proto__:null,Client:GO,ONTOLOGY_TYPE:qa,Rack:YO,keyZ:cn,newZ:nO,ontologyID:vM,rackZ:Fa,stateZ:lm},Symbol.toStringTag,{value:"Module"})),ni="sy_task_state",Kn="sy_task_cmd",yM="sy_task_set",$M="sy_task_delete",Gn=new Error("Task not created"),KO=async(t,e)=>{const r=await e.retrieveParents(t);return r.length===0?null:r[0]};class XO{constructor(e,r,i,n,s=!1,a=!1,o,u=null,c=null,l=null){f(this,"key");f(this,"name");f(this,"internal");f(this,"type");f(this,"config");f(this,"snapshot");f(this,"state");f(this,"frameClient");f(this,"ontologyClient");f(this,"rangeClient");this.key=e,this.name=r,this.type=i,this.config=n,this.internal=s,this.snapshot=a,o!==null&&(this.state=o),this.frameClient=u,this.ontologyClient=c,this.rangeClient=l}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state,internal:this.internal}}get ontologyID(){return QO(this.key)}async executeCommand(e,r){if(this.frameClient==null)throw Gn;const i=await this.frameClient.openWriter(Kn),n=hz.create();return await i.write(Kn,[{task:this.key,type:e,key:n,args:r}]),await i.close(),n}async executeCommandSync(e,r,i){if(this.frameClient==null)throw Gn;const n=await this.frameClient.openStreamer(ni),s=await this.executeCommand(e,r);let a;const o=new Promise(u=>setTimeout(()=>u(!1),new M(i).milliseconds));for(;;){const u=await Promise.any([n.read(),o]);if(u===!1)throw new Error("Command timed out");const c=bi.safeParse(u.at(-1).sy_task_state);if(c.success){if(a=c.data,a.key===s)break}else throw c.error}return n.close(),a}async openStateObserver(){if(this.frameClient==null)throw Gn;return new Wt(await this.frameClient.openStreamer(ni),e=>{const r=e.get(ni);if(r.length===0)return[null,!1];const i=bi.safeParse(r.at(-1));if(!i.success)return console.error(i.error),[null,!1];const n=i.data;return n.task!==this.key?[null,!1]:[n,!0]})}async openCommandObserver(){if(this.frameClient==null)throw Gn;return new Wt(await this.frameClient.openStreamer(Kn),e=>{const r=e.get(Kn);if(r.length===0)return[null,!1];const i=fm.safeParse(r.at(-1));if(!i.success)return console.error(i.error),[null,!1];const n=i.data;return n.task!==this.key?[null,!1]:[n,!0]})}async snapshottedTo(){if(this.ontologyClient==null||this.rangeClient==null)throw Gn;return this.snapshot?await KO(this.key,this.ontologyClient):null}}const bM=y({rack:cn.optional(),keys:ln.array().optional(),names:S().array().optional(),types:S().array().optional(),includeState:ne().optional(),offset:ue().optional(),limit:ue().optional()}),wM=y({tasks:rt(qi)}),_M="/hardware/task/retrieve",kM="/hardware/task/create",IM="/hardware/task/delete",OM="/hardware/task/copy",SM=y({tasks:iO.array()}),NM=y({tasks:qi.array()}),TM=y({keys:ln.array()}),zM=y({}),xM=y({key:ln,name:S(),snapshot:ne()}),EM=y({task:qi});let HO=class{constructor(e,r,i,n){f(this,"type",Va);f(this,"client");f(this,"frameClient");f(this,"ontologyClient");f(this,"rangeClient");this.client=e,this.frameClient=r,this.ontologyClient=i,this.rangeClient=n}async create(e){const r=!Array.isArray(e),i=await Z(this.client,kM,{tasks:C.toArray(e)},SM,NM),n=this.sugar(i.tasks);return r?n[0]:n}async delete(e){await Z(this.client,IM,{keys:C.toArray(e)},TM,zM)}async search(e){return await this.execRetrieve({keys:[e]})}async page(e,r){return await this.execRetrieve({offset:e,limit:r})}async list(e={}){return this.sugar(await this.execRetrieve(e))}async retrieve(e,r){const{single:i,normalized:n,variant:s}=Tm(e,{number:"rack",string:"keys"},{convertNumericStrings:!1}),a={...r};s==="rack"?a.rack=e:a.keys=n;const o=await this.execRetrieve(a),u=this.sugar(o);return i&&s!=="rack"?u[0]:u}async copy(e,r,i){const n=await Z(this.client,OM,{key:e,name:r,snapshot:i},xM,EM);return this.sugar([n.task])[0]}async retrieveByName(e,r){const i=await this.execRetrieve({names:[e],rack:r});return eo("Task",e,i,!0),this.sugar(i)[0]}async retrieveByType(e,r){const i=await this.execRetrieve({types:[e],rack:r});return this.sugar(i)}async retrieveSnapshottedTo(e){if(this.ontologyClient==null)throw Gn;return await KO(e,this.ontologyClient)}async execRetrieve(e){return(await Z(this.client,_M,e,bM,wM)).tasks}sugar(e){const r=!Array.isArray(e),i=C.toArray(e).map(({key:n,name:s,type:a,config:o,state:u,internal:c,snapshot:l})=>new XO(n,s,a,o,c,l,u,this.frameClient,this.ontologyClient,this.rangeClient));return r?i[0]:i}async openTracker(){return await Rn(this.frameClient,yM,$M,(e,r)=>Array.from(r).map(i=>({variant:e,key:i.toString(),value:i.toString()})))}async openStateObserver(){return new Wt(await this.frameClient.openStreamer(ni),e=>{const r=e.get(ni);if(r.length===0)return[null,!1];const i=bi.safeParse(r.at(-1));return i.success?[i.data,!0]:(console.error(i.error),[null,!1])})}async openCommandObserver(){return new Wt(await this.frameClient.openStreamer(Kn),e=>{const r=e.get(Kn);if(r.length===0)return[null,!1];const i=fm.safeParse(r.at(-1));return i.success?[i.data,!0]:(console.error(i.error),[null,!1])})}};const QO=t=>new V({type:Va,key:t}),UM=Object.freeze(Object.defineProperty({__proto__:null,Client:HO,ONTOLOGY_TYPE:Va,Task:XO,commandZ:fm,getRackKey:MR,keyZ:ln,newZ:iO,ontologyID:QO,stateZ:bi,taskZ:qi},Symbol.toStringTag,{value:"Module"})),ZM=y({keys:An.array().optional(),for:ct.optional(),search:S().optional(),offset:ue().optional(),limit:ue().optional()}),PM=y({labels:rt(Ji)}),Xs=class Xs{constructor(e){f(this,"client");this.client=e}async retrieve(e){return await this.execute({keys:C.toArray(e)})}async retrieveFor(e){return await this.execute({for:e})}async search(e){return await this.execute({search:e})}async page(e,r){return await this.execute({offset:e,limit:r})}async execute(e){const[r,i]=await this.client.send(Xs.ENDPOINT,e,ZM,PM);if(i!=null)throw i;return r.labels}};f(Xs,"ENDPOINT","/label/retrieve");let Ys=Xs;const eS=Ji.extend({key:An.optional()}),jM=y({labels:eS.array()}),AM=y({labels:Ji.array()}),DM=y({keys:An.array()}),tS=y({id:ct,labels:An.array(),replace:ne().optional()}),CM=tS.omit({replace:!0}),Io=y({}),RM="/label/create",LM="/label/delete",MM="/label/set",BM="/label/remove";let nS=class{constructor(e){f(this,"client");this.client=e}async create(e){return(await Z(this.client,RM,{labels:C.toArray(e)},jM,AM)).labels}async delete(e){await Z(this.client,LM,{keys:C.toArray(e)},DM,Io)}async set(e,r,{replace:i}={}){await Z(this.client,MM,{id:e,labels:r,replace:i},tS,Io)}async remove(e,r){await Z(this.client,BM,{id:e,labels:r},CM,Io)}};const FM="sy_label_set",qM="sy_label_delete";let rS=class{constructor(e,r,i){f(this,"type","label");f(this,"retriever");f(this,"writer");f(this,"frameClient");f(this,"ontology");this.writer=new nS(e),this.retriever=new Ys(e),this.frameClient=r,this.ontology=i}async search(e){return await this.retriever.search(e)}async retrieve(e){const r=Array.isArray(e),i=await this.retriever.retrieve(e);return r?i:i[0]}async retrieveFor(e){return await this.retriever.retrieveFor(new V(e))}async label(e,r,i={}){await this.writer.set(new V(e),r,i)}async removeLabels(e,r){await this.writer.remove(new V(e),r)}async page(e,r){return await this.retriever.page(e,r)}async create(e){const r=Array.isArray(e),i=await this.writer.create(e);return r?i:i[0]}async delete(e){await this.writer.delete(e)}async openChangeTracker(){return await Rn(this.frameClient,FM,qM,JM)}async trackLabelsOf(e){const r=new yn.Observer,i=(await this.retrieveFor(e)).map(s=>({id:iS(s.key),key:s.key,name:s.name,data:s}));return(await this.ontology.openDependentTracker({target:new V(e),dependents:i,relationshipType:"labeled_by"})).onChange(s=>r.notify(s.map(a=>{var o,u;return{key:a.id.key,color:(o=a.data)==null?void 0:o.color,name:(u=a.data)==null?void 0:u.name}}))),r}};const JM=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(Ji).map(r=>({variant:t,key:r.key,value:r})),iS=t=>new V({type:hm,key:t}),VM=Object.freeze(Object.defineProperty({__proto__:null,Client:rS,ONTOLOGY_TYPE:hm,Retriever:Ys,Writer:nS,keyZ:An,labelZ:Ji,newZ:eS,ontologyID:iS},Symbol.toStringTag,{value:"Module"})),WM="sy_range_alias_set",GM="sy_range_alias_delete",YM=y({range:mt,aliases:S().array()}),KM=y({aliases:Ra(S(),Ve)}),XM=y({range:mt,aliases:Ra(Ve.or(S()),S())}),HM=Ut(),QM=y({range:mt,channels:Ve.array()}),eB=Ut(),tB=y({range:mt}),nB=y({aliases:Ra(S(),S())}),zt=class zt{constructor(e,r,i){f(this,"frameClient");f(this,"cache",new Map);f(this,"client");f(this,"rangeKey");this.rangeKey=e,this.cache=new Map,this.client=i,this.frameClient=r}async resolve(e){const r=[],i=typeof e=="string",n={};if(i){const a=this.cache.get(e);if(a!=null)return a;r.push(e)}else e.forEach(a=>{const o=this.cache.get(a);o!=null?n[a]=o:r.push(a)});if(r.length===0)return n;const s=await Z(this.client,zt.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:r},YM,KM);return Object.entries(s.aliases).forEach(([a,o])=>this.cache.set(a,o)),i?s.aliases[r[0]]:{...n,...s.aliases}}async set(e){await Z(this.client,zt.SET_ENDPOINT,{range:this.rangeKey,aliases:e},XM,HM)}async list(){return(await Z(this.client,zt.LIST_ENDPOINT,{range:this.rangeKey},tB,nB)).aliases}async delete(e){await Z(this.client,zt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},QM,eB)}async openChangeTracker(){return await Rn(this.frameClient,WM,GM,sB(this.rangeKey))}};f(zt,"SET_ENDPOINT","/range/alias/set"),f(zt,"RESOLVE_ENDPOINT","/range/alias/resolve"),f(zt,"LIST_ENDPOINT","/range/alias/list"),f(zt,"DELETE_ENDPOINT","/range/alias/delete");let ku=zt;const rB=y({range:mt,channel:Ve,alias:S()}),iB="---",sB=t=>(e,r)=>e==="delete"?r.toStrings().filter(i=>i.split(iB)[0]===t).map(i=>({variant:e,key:i,value:void 0})):r.parseJSON(rB).map(i=>({variant:e,key:i.alias,value:i})),jm=y({range:mt,key:S(),value:S()}),aB=y({range:mt,keys:S().array()}),oB=y({pairs:rt(jm)}),uB=y({range:mt,pairs:jm.array()}),cB=y({range:mt,keys:S().array()}),en=class en{constructor(e,r,i){f(this,"rangeKey");f(this,"client");f(this,"frameClient");this.rangeKey=e,this.client=r,this.frameClient=i}async get(e){const r=await Z(this.client,en.GET_ENDPOINT,{range:this.rangeKey,keys:C.toArray(e)},aB,oB);return typeof e=="string"?r.pairs[0].value:Object.fromEntries(r.pairs.map(i=>[i.key,i.value]))}async list(){return this.get([])}async set(e,r=""){let i;Lh(e)?i=Object.entries(e).map(([n,s])=>({range:this.rangeKey,key:n,value:s})):i=[{range:this.rangeKey,key:e,value:r}],await Z(this.client,en.SET_ENDPOINT,{range:this.rangeKey,pairs:i},uB,Ut())}async delete(e){await Z(this.client,en.DELETE_ENDPOINT,{range:this.rangeKey,keys:C.toArray(e)},cB,Ut())}async openTracker(){return await Rn(this.frameClient,"sy_range_kv_set","sy_range_kv_delete",(e,r)=>e==="delete"?r.toStrings().map(i=>{const[n,s]=i.split("<--->",2);return{variant:e,key:i,value:{range:n,key:s,value:""}}}):r.parseJSON(jm).map(i=>({variant:e,key:`${i.range}${i.key}`,value:i})))}};f(en,"GET_ENDPOINT","/range/kv/get"),f(en,"SET_ENDPOINT","/range/kv/set"),f(en,"DELETE_ENDPOINT","/range/kv/delete");let Ii=en;class sS{constructor(e,r=Ee.ZERO,i,n,s,a,o,u,c,l,d){f(this,"key");f(this,"name");f(this,"kv");f(this,"timeRange");f(this,"color");f(this,"channels");f(this,"aliaser");f(this,"frameClient");f(this,"labelClient");f(this,"ontologyClient");f(this,"rangeClient");this.key=i,this.name=e,this.timeRange=r,this.frameClient=s,this.color=n,this.kv=a,this.aliaser=o,this.channels=u,this.labelClient=c,this.ontologyClient=l,this.rangeClient=d}get ontologyID(){return Qt(this.key)}get payload(){return{key:this.key,name:this.name,timeRange:this.timeRange,color:this.color}}async setAlias(e,r){const i=await this.channels.retrieve(e);if(i.length===0)throw new Vt(`Channel ${e} does not exist`);await this.aliaser.set({[i[0].key]:r})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async resolveAlias(e){return await this.aliaser.resolve(e)}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async retrieveParent(){return this.rangeClient.retrieveParent(this.key)}async retrieveChildren(){const e=(await this.ontologyClient.retrieveChildren(this.ontologyID,{excludeFieldData:!0,types:["range"]})).map(r=>r.id.key);return await this.rangeClient.retrieve(e)}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(Qt(this.key))}async addLabel(...e){await this.labelClient.label(Qt(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(Qt(this.key),e)}async openChildRangeTracker(){const e=new yn.Observer,r=(await this.retrieveChildren()).map(n=>{const s=Qt(n.key);return{id:s,key:s.toString(),name:n.name,data:n.payload}}),i=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:r,resourceType:"range"});return i.onChange(n=>e.notify(this.rangeClient.resourcesToRanges(n))),e.setCloser(async()=>await i.close()),e}async openParentRangeTracker(){const e=new yn.Observer,r=await this.retrieveParent();if(r==null)return null;const i=Qt(r.key),n={id:i,key:i.toString(),name:r.name,data:r.payload},s=await this.ontologyClient.openDependentTracker({target:this.ontologyID,dependents:[n],relationshipDirection:"to"});return s.onChange(a=>{const o=this.rangeClient.resourcesToRanges(a);if(o.length===0)return;const u=o[0];e.notify(u)}),e.setCloser(async()=>await s.close()),e}}const lB=(t,e)=>gz(t.timeRange,e.timeRange),dB=y({keys:mt.array().optional(),names:xr(S()).optional(),term:S().optional(),overlapsWith:Ee.z.optional(),limit:ue().int().optional(),offset:ue().int().optional(),hasLabels:An.array().optional()}),mB="/range/retrieve",fB=y({ranges:rt(Ur)});let aS=class{constructor(e,r,i,n,s,a){f(this,"type","range");f(this,"frameClient");f(this,"writer");f(this,"unaryClient");f(this,"channels");f(this,"labelClient");f(this,"ontologyClient");this.frameClient=e,this.writer=r,this.unaryClient=i,this.channels=n,this.labelClient=s,this.ontologyClient=a}async create(e,r){const i=!Array.isArray(e),n=this.sugarMany(await this.writer.create(C.toArray(e),r));return i?n[0]:n}async rename(e,r){await this.writer.rename(e,r)}async delete(e){await this.writer.delete(C.toArray(e))}async search(e){return this.sugarMany(await this.execRetrieve({term:e}))}async page(e,r){return this.sugarMany(await this.execRetrieve({offset:e,limit:r}))}async retrieve(e){if(typeof e=="object"&&"start"in e)return await this.execRetrieve({overlapsWith:new Ee(e)});const{single:r,actual:i,variant:n,normalized:s,empty:a}=aO(e);if(a)return[];const o=await this.execRetrieve({[n]:s});if(!r)return o;if(o.length===0)throw new On(`range matching ${i} not found`);if(o.length>1)throw new Sn(`multiple ranges matching ${i} found`);return o[0]}getKV(e){return new Ii(e,this.unaryClient,this.frameClient)}async execRetrieve(e){const{ranges:r}=await Z(this.unaryClient,mB,e,dB,fB);return this.sugarMany(r)}async retrieveParent(e){const r=await this.ontologyClient.retrieveParents(Qt(e));if(r.length===0)return null;const i=r[0];return i.id.type!=="range"?null:await this.retrieve(i.id.key)}sugarOne(e){return new sS(e.name,e.timeRange,e.key,e.color,this.frameClient,new Ii(e.key,this.unaryClient,this.frameClient),new ku(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient,this.ontologyClient,this)}sugarMany(e){return e.map(r=>this.sugarOne(r))}async openTracker(){return await Rn(this.frameClient,"sy_range_set","sy_range_delete",(e,r)=>e==="delete"?r.toUUIDs().map(n=>({variant:e,key:n,value:void 0})):this.sugarMany(r.parseJSON(Ur)).map(n=>({variant:e,key:n.key,value:n})))}resourcesToRanges(e){return e.map(r=>this.resourceToRange(r))}resourceToRange(e){var r,i,n;return this.sugarOne({key:e.id.key,name:(r=e.data)==null?void 0:r.name,timeRange:new Ee((i=e.data)==null?void 0:i.timeRange),color:(n=e.data)==null?void 0:n.color})}};const Qt=t=>new V({type:vm,key:t}),hB=t=>new V({type:gm,key:t}),pB=y({ranges:Ur.array()}),vB=y({parent:ct.optional(),ranges:sO.array()}),gB=y({keys:mt.array()}),yB=y({}),$B=y({key:mt,name:pm}),bB=y({}),wB="/range/create",_B="/range/delete",kB="/range/rename";class oS{constructor(e){f(this,"client");this.client=e}async rename(e,r){await Z(this.client,kB,{key:e,name:r},$B,bB)}async create(e,r){return(await Z(this.client,wB,{ranges:e,...r},vB,pB)).ranges}async delete(e){await Z(this.client,_B,{keys:e},gB,yB)}}const IB=Object.freeze(Object.defineProperty({__proto__:null,ALIAS_ONTOLOGY_TYPE:gm,Client:aS,KV:Ii,ONTOLOGY_TYPE:vm,Range:sS,Writer:oS,aliasOntologyID:hB,analyzeParams:aO,keyZ:mt,nameZ:pm,newZ:sO,ontologyID:Qt,payloadZ:Ur,sort:lB},Symbol.toStringTag,{value:"Module"})),OB="/api/v1/";class SB{constructor(e,r={},i=!1){f(this,"url");f(this,"unary");f(this,"stream");f(this,"secure");this.secure=i,this.url=e.child(OB);const n=new Nn.JSONCodec;this.unary=q6(new F6(this.url,n,this.secure),r),this.stream=new Oj(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const NB="/workspace/lineplot/retrieve",TB="/workspace/lineplot/create",zB="/workspace/lineplot/rename",xB="/workspace/lineplot/set-data",EB="/workspace/lineplot/delete",UB=y({keys:Zr.array()}),ZB=y({workspace:Ct,linePlots:uO.array()}),PB=y({key:Zr,name:S()}),jB=y({key:Zr,data:S()}),AB=y({keys:Zr.array()}),DB=y({linePlots:rt(Wa)}),CB=y({linePlots:Wa.array()}),Oo=y({});let uS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,TB,{workspace:e,linePlots:C.toArray(r)},ZB,CB);return i?n.linePlots:n.linePlots[0]}async rename(e,r){await Z(this.client,zB,{key:e,name:r},PB,Oo)}async setData(e,r){await Z(this.client,xB,{key:e,data:JSON.stringify(r)},jB,Oo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,NB,{keys:C.toArray(e)},UB,DB);return r?i.linePlots:i.linePlots[0]}async delete(e){await Z(this.client,EB,{keys:C.toArray(e)},AB,Oo)}};const RB=t=>new V({type:$m,key:t}),LB=Object.freeze(Object.defineProperty({__proto__:null,Client:uS,ONTOLOGY_TYPE:$m,keyZ:Zr,linePlotZ:Wa,newZ:uO,ontologyID:RB},Symbol.toStringTag,{value:"Module"})),MB="/workspace/log/retrieve",BB="/workspace/log/create",FB="/workspace/log/rename",qB="/workspace/log/set-data",JB="/workspace/log/delete",VB=y({keys:Pr.array()}),WB=y({workspace:Ct,logs:cO.array()}),GB=y({key:Pr,name:S()}),YB=y({key:Pr,data:S()}),KB=y({keys:Pr.array()}),XB=y({logs:Ga.array()}),HB=y({logs:Ga.array()}),So=y({});let cS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,BB,{workspace:e,logs:C.toArray(r)},WB,HB);return i?n.logs:n.logs[0]}async rename(e,r){await Z(this.client,FB,{key:e,name:r},GB,So)}async setData(e,r){await Z(this.client,qB,{key:e,data:JSON.stringify(r)},YB,So)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,MB,{keys:C.toArray(e)},VB,XB);return r?i.logs:i.logs[0]}async delete(e){await Z(this.client,JB,{keys:C.toArray(e)},KB,So)}};const QB=t=>new V({type:bm,key:t}),eF=Object.freeze(Object.defineProperty({__proto__:null,Client:cS,ONTOLOGY_TYPE:bm,keyZ:Pr,logZ:Ga,newZ:cO,ontologyID:QB},Symbol.toStringTag,{value:"Module"})),tF="/workspace/schematic/retrieve",nF="/workspace/schematic/create",rF="/workspace/schematic/rename",iF="/workspace/schematic/set-data",sF="/workspace/schematic/delete",aF="/workspace/schematic/copy",oF=y({keys:Cn.array()}),uF=y({workspace:Ct,schematics:mO.array()}),cF=y({key:Cn,name:S()}),lF=y({key:Cn,data:S()}),dF=y({keys:Cn.array()}),mF=y({key:Cn,name:S(),snapshot:ne()}),fF=y({schematics:rt(wm)}),hF=y({schematics:wm.array()}),pF=y({schematic:Xa}),No=y({});let lS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,nF,{workspace:e,schematics:C.toArray(r)},uF,hF);return i?n.schematics:n.schematics[0]}async rename(e,r){await Z(this.client,rF,{key:e,name:r},cF,No)}async setData(e,r){await Z(this.client,iF,{key:e,data:JSON.stringify(r)},lF,No)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,tF,{keys:C.toArray(e)},oF,fF);return r?i.schematics:i.schematics[0]}async delete(e){await Z(this.client,sF,{keys:C.toArray(e)},dF,No)}async copy(e,r,i){return(await Z(this.client,aF,{key:e,name:r,snapshot:i},mF,pF)).schematic}};const vF=t=>new V({type:_m,key:t}),gF=Object.freeze(Object.defineProperty({__proto__:null,Client:lS,ONTOLOGY_TYPE:_m,keyZ:Cn,newZ:mO,ontologyID:vF,remoteZ:wm,schematicZ:Xa},Symbol.toStringTag,{value:"Module"})),yF="/workspace/table/retrieve",$F="/workspace/table/create",bF="/workspace/table/rename",wF="/workspace/table/set-data",_F="/workspace/table/delete",kF=y({keys:jr.array()}),IF=y({workspace:Ct,tables:fO.array()}),OF=y({key:jr,name:S()}),SF=y({key:jr,data:S()}),NF=y({keys:jr.array()}),TF=y({tables:Im.array()}),zF=y({tables:Im.array()}),To=y({});let dS=class{constructor(e){f(this,"client");this.client=e}async create(e,r){const i=Array.isArray(r),n=await Z(this.client,$F,{workspace:e,tables:C.toArray(r)},IF,zF);return i?n.tables:n.tables[0]}async rename(e,r){await Z(this.client,bF,{key:e,name:r},OF,To)}async setData(e,r){await Z(this.client,wF,{key:e,data:JSON.stringify(r)},SF,To)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,yF,{keys:C.toArray(e)},kF,TF);return r?i.tables:i.tables[0]}async delete(e){await Z(this.client,_F,{keys:C.toArray(e)},NF,To)}};const xF=t=>new V({type:Om,key:t}),EF=Object.freeze(Object.defineProperty({__proto__:null,Client:dS,ONTOLOGY_TYPE:Om,keyZ:jr,newZ:fO,ontologyID:xF,remoteZ:Im,tableZ:km},Symbol.toStringTag,{value:"Module"})),fs="/workspace/retrieve",UF="/workspace/create",ZF="/workspace/rename",PF="/workspace/set-layout",jF="/workspace/delete",hs=y({keys:Ct.array().optional(),search:S().optional(),author:Dn.optional(),offset:ue().optional(),limit:ue().optional()}),AF=y({workspaces:lO.array()}),DF=y({key:Ct,name:S()}),CF=y({key:Ct,layout:S()}),RF=y({keys:Ct.array()}),ps=y({workspaces:rt(Ya)}),LF=y({workspaces:dO.array()}),zo=y({});class mS{constructor(e){f(this,"type",Ka);f(this,"schematic");f(this,"linePlot");f(this,"log");f(this,"table");f(this,"client");this.client=e,this.schematic=new lS(e),this.linePlot=new uS(e),this.log=new cS(e),this.table=new dS(e)}async create(e){const r=Array.isArray(e),i=await Z(this.client,UF,{workspaces:C.toArray(e)},AF,LF);return r?i.workspaces:i.workspaces[0]}async rename(e,r){await Z(this.client,ZF,{key:e,name:r},DF,zo)}async setLayout(e,r){await Z(this.client,PF,{key:e,layout:JSON.stringify(r)},CF,zo)}async retrieve(e){const r=Array.isArray(e),i=await Z(this.client,fs,{keys:C.toArray(e)},hs,ps);return r?i.workspaces:i.workspaces[0]}async retrieveByAuthor(e){return(await Z(this.client,fs,{author:e},hs,ps)).workspaces}async search(e){return(await Z(this.client,fs,{search:e},hs,ps)).workspaces}async page(e,r){return(await Z(this.client,fs,{offset:e,limit:r},hs,ps)).workspaces}async delete(e){await Z(this.client,jF,{keys:C.toArray(e)},RF,zo)}}const MF=t=>new V({type:Ka,key:t}),BF=Object.freeze(Object.defineProperty({__proto__:null,Client:mS,ONTOLOGY_TYPE:Ka,keyZ:Ct,newZ:lO,ontologyID:MF,remoteZ:dO,workspaceZ:Ya},Symbol.toStringTag,{value:"Module"})),fS=y({host:S({error:"Host is required"}).min(1,"Host is required"),port:ue({error:"Port is required"}).or(S({error:"Port is required"})),username:S().min(1,"Username is required"),password:S().min(1,"Password is required"),connectivityPollFrequency:M.z.default(M.seconds(30)),secure:ne().optional().default(!1),name:S().optional(),retry:g$.breakerConfigZ.optional()});class hS extends FO{constructor(r){const i=fS.parse(r),{host:n,port:s,username:a,password:o,connectivityPollFrequency:u,secure:c,retry:l}=i,d=new SB(new Vz({host:n,port:Number(s)}),l,c);d.use(CR);let g;a!=null&&o!=null&&(g=new vL(d.unary,{username:a,password:o}),d.use(g.middleware()));const p=new zm(new wi(d.unary)),_=new UO(d.unary,p);super(d.stream,d.unary,p);f(this,"createdAt");f(this,"props");f(this,"ranges");f(this,"channels");f(this,"auth");f(this,"user");f(this,"access");f(this,"connectivity");f(this,"ontology");f(this,"workspaces");f(this,"labels");f(this,"hardware");f(this,"control");f(this,"transport");f(this,"clientVersion","0.43.1");this.createdAt=W.now(),this.props=i,this.auth=g,this.transport=d,this.channels=new zO(this,p,d.unary,_),this.connectivity=new ki(d.unary,u,this.clientVersion,i.name),this.control=new JO(this),this.ontology=new _O(d.unary,this);const k=new oS(this.transport.unary);this.labels=new rS(this.transport.unary,this,this.ontology),this.ranges=new aS(this,k,this.transport.unary,p,this.labels,this.ontology),this.access=new OO(this.transport.unary),this.user=new ZO(this.transport.unary),this.workspaces=new mS(this.transport.unary);const m=new WO(this.transport.unary,this),h=new HO(this.transport.unary,this,this.ontology,this.ranges),v=new GO(this.transport.unary,h,this);this.hardware=new VO(h,v,m)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}f(hS,"connectivity",ki);exports.AuthError=$i;exports.Channel=xm;exports.ContiguityError=jR;exports.DataType=ae;exports.Density=ot;exports.Frame=Je;exports.MultiSeries=u$;exports.MultipleFoundError=Sn;exports.NotFoundError=On;exports.QueryError=Vt;exports.Rate=Ao;exports.RouteError=yu;exports.Series=Ft;exports.Synnax=hS;exports.TimeRange=Ee;exports.TimeSpan=M;exports.TimeStamp=W;exports.UnexpectedError=ir;exports.ValidationError=Ce;exports.access=w2;exports.channel=F2;exports.connection=yL;exports.control=KL;exports.device=cM;exports.framer=FL;exports.group=XR;exports.hardware=XL;exports.isCalculated=_i;exports.label=VM;exports.linePlot=LB;exports.log=eF;exports.ontology=a2;exports.policy=b2;exports.rack=gM;exports.ranger=IB;exports.schematic=gF;exports.signals=HL;exports.synnaxPropsZ=fS;exports.table=EF;exports.task=UM;exports.user=uL;exports.workspace=BF;
41
+ `);const d=new Y({data:t[l],dataType:h.dataType});o.push(h.key),c.push(d)}return new Z(o,c)}if(e instanceof Z||e instanceof Map){const o=new Z(e);if(this.adapter==null)return o;const c=o.columns.map(l=>{const h=typeof l=="string"?this.adapter?.get(l):l;if(h==null)throw new M(`
42
+ Channel ${l} was not provided in the list of channels when opening the writer
43
+ `);return h});return new Z(c,o.series)}const n=[],a=[],i=Object.entries(e);for(let o=0;o<i.length;o++){const[c,l]=i[o],h=await this.fetchChannel(c),d=new Y({data:l,dataType:h.dataType});n.push(h.key),a.push(d)}return new Z(n,a)}}class ii{name;stream;constructor(e,t){this.stream=t,this.name=e}async receive(){const[e,t]=await this.stream.receive();if(t!=null)throw t;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,t]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on ${JSON.stringify(e)} closure.
44
+ Please report this error to the Synnax team.`),t!=null){if(K.matches(t))return;throw t}}}closeSend(){this.stream.closeSend()}send(e){const t=this.stream.send(e);if(t!=null)throw t}}const Yt=new v(-1);var yn=(r=>(r[r.Open=0]="Open",r[r.Next=1]="Next",r[r.Prev=2]="Prev",r[r.SeekFirst=3]="SeekFirst",r[r.SeekLast=4]="SeekLast",r[r.SeekLE=5]="SeekLE",r[r.SeekGE=6]="SeekGE",r[r.Valid=7]="Valid",r[r.Error=8]="Error",r))(yn||{}),oi=(r=>(r[r.None=0]="None",r[r.Ack=1]="Ack",r[r.Data=2]="Data",r))(oi||{});const Lf=s.z.object({command:s.z.enum(yn),span:v.z.optional(),bounds:z.z.optional(),stamp:O.z.optional(),keys:U.array().optional(),chunkSize:s.z.number().optional()}),Bf=s.z.object({variant:s.z.enum(oi),ack:s.z.boolean(),command:s.z.enum(yn),error:le.payloadZ.optional().nullable(),frame:Xt.optional()});class wt{static ENDPOINT="/frame/iterate";stream;adapter;value;constructor(e,t){this.stream=new ii("Iterator",e),this.value=new Z,this.adapter=t}static async _open(e,t,n,a,i={}){const o=await Qt.open(n,t),c=await a.stream(wt.ENDPOINT,Lf,Bf),l=new wt(c,o);return await l.execute({command:0,keys:o.keys,bounds:new z(e),chunkSize:i.chunkSize??1e5}),l}async next(e=Yt){return await this.execute({command:1,span:new v(e)})}async prev(e=Yt){return await this.execute({command:2,span:new v(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new O(e)})}async seekGE(e){return await this.execute({command:6,stamp:new O(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new qf(this)}async execute(e){for(this.stream.send(e),this.value=new Z;;){const t=await this.stream.receive();if(t.variant===1)return t.ack;this.value.push(this.adapter.adapt(new Z(t.frame)))}}}class qf{iter;open=!1;constructor(e){this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const Ff=s.z.object({keys:s.z.number().array(),downsampleFactor:s.z.number()}),Yf=s.z.object({frame:Xt}),Vf="/frame/stream",us=s.z.object({channels:ke,downsampleFactor:s.z.number().optional().default(1),useExperimentalCodec:s.z.boolean().optional().default(!1)}),gn=us.or(ke.transform(r=>us.parse({channels:r}))),ci=(r,e)=>async t=>{const n=gn.parse(t),a=await Qt.open(r,n.channels);n.useExperimentalCodec&&(e=e.withCodec(new Pf(a.codec)));const i=await e.stream(Vf,Ff,Yf),o=new Wf(i,a);i.send({keys:a.keys,downsampleFactor:n.downsampleFactor??1});const[,c]=await i.receive();if(c!=null)throw c;return o},li=async(r,e,t)=>await ci(r,e)(t);class Wf{stream;adapter;downsampleFactor;constructor(e,t){this.stream=new ii("Streamer",e),this.adapter=t,this.downsampleFactor=1}get keys(){return this.adapter.keys}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(K.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new Z((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e)&&this.stream.send({keys:this.adapter.keys,downsampleFactor:this.downsampleFactor})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class er{wrapped_=null;breaker;opener;config;constructor(e,t,n={}){this.opener=e,this.config=gn.parse(t);const{maxRetries:a=5e3,baseInterval:i=v.seconds(1),scale:o=1}=n??{};this.breaker=new ha.Breaker({maxRetries:a,baseInterval:i,scale:o})}static async open(e,t,n){const a=new er(e,t,n);return await a.runStreamer(),a}async runStreamer(){for(;;)try{this.wrapped_!=null&&this.wrapped_.close(),this.wrapped_=await this.opener(this.config),this.breaker.reset();return}catch(e){if(this.wrapped_=null,!await this.breaker.wait())throw e;console.error("failed to open streamer",e);continue}}get wrapped(){if(this.wrapped_==null)throw new Error("stream closed");return this.wrapped_}async update(e){this.config.channels=ke.parse(e);try{await this.wrapped.update(e)}catch{return await this.runStreamer(),await this.update(e)}}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(K.matches(e))return{done:!0,value:void 0};throw e}}async read(){try{const e=await this.wrapped.read();return this.breaker.reset(),e}catch(e){if(K.matches(e))throw e;return await this.runStreamer(),await this.read()}}close(){this.wrapped.close()}get keys(){return this.wrapped.keys}[Symbol.asyncIterator](){return this}}class ui extends Eu.Observer{streamer;closePromise;constructor(e,t){super(t),this.streamer=e,this.closePromise=this.stream()}async update(e){await this.streamer.update(e)}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer)this.notify(e)}}const _f=r=>({type:"framer",key:r.toString()});let hi=class{streamClient;retriever;deleter;constructor(e,t,n){this.streamClient=e,this.retriever=n,this.deleter=new Sf(t)}async openIterator(e,t,n){return await wt._open(e,t,this.retriever,this.streamClient,n)}async openWriter(e){return await ni._open(this.retriever,this.streamClient,e)}async openStreamer(e){return await li(this.retriever,this.streamClient,e)}async write(e,t,n){if(n==null){const i=t,o=await this.openWriter({start:e,channels:Object.keys(i),mode:mt.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:v.MAX});return await o.write(i),await o.close()}const a=await this.openWriter({start:e,channels:t,mode:mt.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:v.MAX});await a.write(t,n),await a.close()}async read(e,t){const{single:n}=J(t),a=await this.readFrame(e,t);return n?a.get(t):a}async readFrame(e,t){const n=await this.openIterator(e,t),a=new Z;try{for await(const i of n)a.push(i)}finally{await n.close()}return a}async readLatest(e,t=1){const{single:n}=J(e),a=await this.readLatestNFrame(e,t);return n?a.get(e):a}async readLatestNFrame(e,t){const n=await this.openIterator(z.MAX,e,{chunkSize:t}),a=new Z;if(t>0)try{await n.seekLast(),await n.prev(Yt),a.push(n.value)}finally{await n.close()}return a}async delete(e,t){const{normalized:n,variant:a}=J(e);return a==="keys"?await this.deleter.delete({keys:n,bounds:t}):await this.deleter.delete({names:n,bounds:t})}};const Hf=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:If,AUTO_SPAN:Yt,Client:hi,Frame:Z,HardenedStreamer:er,Iterator:wt,ObservableStreamer:ui,Writer:ni,WriterClosedError:Fr,WriterCommand:We,WriterMode:mt,createStreamOpener:ci,frameZ:Xt,ontologyID:_f,openStreamer:li,seriesFromPayload:Qa,seriesToPayload:ei,streamerConfigZ:gn,writerConfigZ:ri},Symbol.toStringTag,{value:"Module"})),Gf=G.ABSOLUTE_AUTHORITY,Jf=G.ZERO_AUTHORITY,Kf=G.stateZ(s.z.number()),Xf=r=>r.to==null?`${r.from?.resource} - ${r.from?.subject.name} -> released`:r.from==null?`${r.to.resource} - released -> ${r.to.subject.name} (${r.to.authority.toString()})`:`${r.to.resource} - ${r.from.subject.name} -> ${r.to.subject.name} (${r.to.authority.toString()})`,Qf=s.z.object({transfers:s.z.array(G.transferZ(U))});class di extends ui{states;codec;constructor(e){super(e,t=>{const n=this.codec.decode(t.series[0].buffer,Qf);return this.merge(n),[n.transfers,!0]}),this.states=new Map,this.codec=new $e.JSONCodec}subjects(){const e=new Map;return this.states.forEach(t=>e.set(t.subject.key,t.subject)),Array.from(e.values())}merge(e){e.transfers.forEach(t=>{t.from==null&&t.to==null&&console.warn("Invalid transfer: ",t),t.to==null?this.states.delete(t.from.resource):this.states.set(t.to.resource,t.to)})}}const fi="sy_node_1_control";let yi=class{framer;constructor(e){this.framer=e}async openStateTracker(){const e=await er.open(async t=>await this.framer.openStreamer(t),fi);return new di(e)}};const ey=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:Gf,CONTROL_STATE_CHANNEL_NAME:fi,Client:yi,StateTracker:di,ZERO_AUTHORITY:Jf,stateZ:Kf,transferString:Xf},Symbol.toStringTag,{value:"Module"}));let gi=class{tasks;racks;devices;constructor(e,t,n){this.tasks=e,this.racks=t,this.devices=n}};const ty=Object.freeze(Object.defineProperty({__proto__:null,Client:gi},Symbol.toStringTag,{value:"Module"})),ne=s.z.uint32(),pi=Ht.statusZ(s.z.object({rack:ne})),tr=s.z.object({key:ne,name:s.z.string(),status:ct.nullToUndefined(pi)}),mi=tr.partial({key:!0}),wi=r=>r?$e.JSON_CODEC.decodeString(r,ue.unknownZ):{},Qe=s.z.string(),bi=Ht.statusZ(s.z.object({rack:ne,device:Qe})),rr=s.z.object({key:Qe,rack:ne,name:s.z.string(),make:s.z.string(),model:s.z.string(),location:s.z.string(),configured:s.z.boolean().optional(),properties:ue.unknownZ.or(s.z.string().transform(wi)),status:ct.nullToUndefined(bi)}),Ti=rr.extend({properties:s.z.unknown().transform(r=>$e.JSON_CODEC.encodeString(r))}),ry="sy_device_set",ny="sy_device_delete",sy="sy_device_status",ay="/hardware/device/retrieve",iy="/hardware/device/create",oy="/hardware/device/delete",cy=s.z.object({devices:Ti.array()}),ly=s.z.object({devices:rr.array()}),uy=s.z.object({keys:Qe.array()}),hy=s.z.object({}),dy=s.z.object({keys:Qe.array().optional(),names:s.z.string().array().optional(),makes:s.z.string().array().optional(),models:s.z.string().array().optional(),locations:s.z.string().array().optional(),racks:ne.array().optional(),searchTerm:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),includeStatus:s.z.boolean().optional()}),fy=s.z.object({devices:L(rr)}),yy=s.z.object({key:Qe,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),gy=s.z.union([yy,dy]);let vi=class{type="device";client;constructor(e){this.client=e}async retrieve(e){const t=typeof e=="object"&&"key"in e,n=await g(this.client,ay,e,gy,fy);Xe("Device",e,n.devices,t);const a=n.devices;return t?a[0]:a}async create(e){const t=!Array.isArray(e),a=(await g(this.client,iy,{devices:T.toArray(e)},cy,ly)).devices;return t?a[0]:a}async delete(e){await g(this.client,oy,{keys:T.toArray(e)},uy,hy)}};const py=r=>({type:"device",key:r}),my=Object.freeze(Object.defineProperty({__proto__:null,Client:vi,DELETE_CHANNEL_NAME:ny,SET_CHANNEL_NAME:ry,STATUS_CHANNEL_NAME:sy,deviceZ:rr,keyZ:Qe,newZ:Ti,ontologyID:py,statusZ:bi},Symbol.toStringTag,{value:"Module"})),wy="/hardware/rack/retrieve",by="/hardware/rack/create",Ty="/hardware/rack/delete",vy="sy_rack_status",Ey="sy_rack_set",Oy="sy_rack_delete",Ny=s.z.object({keys:ne.array().optional(),names:s.z.string().array().optional(),searchTerm:s.z.string().optional(),embedded:s.z.boolean().optional(),hostIsNode:s.z.boolean().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),includeStatus:s.z.boolean().optional()}),zy=s.z.object({racks:L(tr)}),Sy=s.z.union([s.z.object({key:ne,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),s.z.object({name:s.z.string(),includeStatus:s.z.boolean().optional()}).transform(({name:r,includeStatus:e})=>({names:[r],includeStatus:e}))]),Iy=Ny,Ay=s.z.union([Sy,Iy]),$y=s.z.object({racks:mi.array()}),ky=s.z.object({racks:tr.array()}),Cy=s.z.object({keys:ne.array()}),xy=s.z.object({});let Ei=class{type="rack";client;tasks;constructor(e,t){this.client=e,this.tasks=t}async delete(e){await g(this.client,Ty,{keys:T.toArray(e)},Cy,xy)}async create(e){const t=!Array.isArray(e),n=await g(this.client,by,{racks:T.toArray(e)},$y,ky),a=this.sugar(n.racks);return t?a[0]:a}async retrieve(e){const t="key"in e||"name"in e,n=await g(this.client,wy,e,Ay,zy),a=this.sugar(n.racks);return Xe("Rack",e,a,t),t?a[0]:a}sugar(e){const t=!Array.isArray(e),n=T.toArray(e).map(({key:a,name:i,status:o})=>new Oi(a,i,this.tasks,o));return t?n[0]:n}};class Oi{key;name;status;tasks;constructor(e,t,n,a){this.key=e,this.name=t,this.tasks=n,this.status=a}async listTasks(){return await this.tasks.retrieve({rack:this.key})}async createTask(e,t){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e,t)}async deleteTask(e){await this.tasks.delete([e])}get payload(){return{key:this.key,name:this.name,status:this.status}}}const Ry=r=>({type:"rack",key:r.toString()}),jy=Object.freeze(Object.defineProperty({__proto__:null,Client:Ei,DELETE_CHANNEL_NAME:Oy,Rack:Oi,SET_CHANNEL_NAME:Ey,STATUS_CHANNEL_NAME:vy,keyZ:ne,newZ:mi,ontologyID:Ry,rackZ:tr,statusZ:pi},Symbol.toStringTag,{value:"Module"})),he=r=>r?JSON.parse(r):{},de=s.z.union([s.z.string(),s.z.bigint().transform(r=>r.toString()),s.z.number().transform(r=>r.toString())]),Ni=r=>s.z.object({task:de,running:s.z.boolean(),data:r}),pn=r=>Ht.statusZ(Ni(r)),St=(r={typeSchema:s.z.string(),configSchema:s.z.unknown(),statusDataSchema:s.z.unknown()})=>s.z.object({key:de,name:s.z.string(),type:r.typeSchema,internal:s.z.boolean().optional(),config:s.z.string().transform(wi).or(r.configSchema),status:pn(r.statusDataSchema).optional().nullable(),snapshot:s.z.boolean().optional()}),zi=r=>St(r).omit({key:!0}).extend({key:de.transform(e=>e.toString()).optional(),config:s.z.unknown().transform(e=>$e.JSON_CODEC.encodeString(e))}),Uy=s.z.object({task:de,type:s.z.string(),key:s.z.string(),args:ue.unknownZ.or(s.z.string().transform(he)).or(s.z.array(s.z.unknown())).or(s.z.null()).optional()}),Dy=r=>Number(BigInt(r)>>32n),Vr="sy_task_status",Wr="sy_task_cmd",My="sy_task_set",Zy="sy_task_delete",Se=new Error("Task not created"),Si=async(r,e)=>{const t=await e.retrieveParents(mn(r));return t.length===0?null:t[0]};class Ii{key;name;internal;type;snapshot;config;status;schemas;frameClient_;ontologyClient_;rangeClient_;get frameClient(){if(this.frameClient_==null)throw Se;return this.frameClient_}get ontologyClient(){if(this.ontologyClient_==null)throw Se;return this.ontologyClient_}get rangeClient(){if(this.rangeClient_==null)throw Se;return this.rangeClient_}constructor({key:e,type:t,name:n,config:a,internal:i=!1,snapshot:o=!1,status:c},l,h,d,u){this.key=e,this.name=n,this.type=t,this.config=a,this.schemas=l??{typeSchema:s.z.string(),configSchema:s.z.unknown(),statusDataSchema:s.z.unknown()},this.internal=i,this.snapshot=o,this.status=c,this.frameClient_=h,this.ontologyClient_=d,this.rangeClient_=u}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,status:this.status,internal:this.internal}}get ontologyID(){return mn(this.key)}async executeCommand(e,t){return await wn(this.frameClient,this.key,e,t)}async executeCommandSync(e,t,n){return await $i(this.frameClient,this.key,e,t,this.name,this.schemas?.statusDataSchema,n)}async snapshottedTo(){if(this.ontologyClient==null||this.rangeClient==null)throw Se;return this.snapshot?await Si(this.key,this.ontologyClient):null}}const Py=s.z.object({rack:ne.optional(),keys:de.array().optional(),names:s.z.string().array().optional(),types:s.z.string().array().optional(),includeStatus:s.z.boolean().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),Ly=s.z.union([s.z.object({key:de,includeStatus:s.z.boolean().optional()}).transform(({key:r,includeStatus:e})=>({keys:[r],includeStatus:e})),s.z.object({name:s.z.string(),includeStatus:s.z.boolean().optional()}).transform(({name:r,includeStatus:e})=>({names:[r],includeStatus:e}))]),By=Py,qy=s.z.union([Ly,By]),Fy=r=>s.z.object({tasks:L(St(r))}),Yy="/hardware/task/retrieve",Vy="/hardware/task/create",Wy="/hardware/task/delete",_y="/hardware/task/copy",Hy=r=>s.z.object({tasks:zi(r).array()}),Gy=r=>s.z.object({tasks:St(r).array()}),Jy=s.z.object({keys:de.array()}),Ky=s.z.object({}),Xy=s.z.object({key:de,name:s.z.string(),snapshot:s.z.boolean()}),Qy=r=>s.z.object({task:St(r)});let Ai=class{type="task";client;frameClient;ontologyClient;rangeClient;constructor(e,t,n,a){this.client=e,this.frameClient=t,this.ontologyClient=n,this.rangeClient=a}async create(e,t){const n=!Array.isArray(e),a=Hy(t),i=Gy(t),o=await g(this.client,Vy,{tasks:T.toArray(e)},a,i),c=this.sugar(o.tasks,t);return n?c[0]:c}async delete(e){await g(this.client,Wy,{keys:T.toArray(e)},Jy,Ky)}async retrieve({schemas:e,...t}){const n="key"in t||"name"in t,i=(await g(this.client,Yy,t,qy,Fy(e))).tasks,o=this.sugar(i,e);return Xe("Task",t,o,n),n?o[0]:o}async copy(e,t,n){const a=Qy(),i=await g(this.client,_y,{key:e,name:t,snapshot:n},Xy,a);return this.sugar(i.task)}async retrieveSnapshottedTo(e){if(this.ontologyClient==null)throw Se;return await Si(e,this.ontologyClient)}sugar(e,t){const n=!Array.isArray(e),a=T.toArray(e).map(({key:i,name:o,type:c,config:l,status:h,internal:d,snapshot:u})=>new Ii({key:i,name:o,type:c,config:l,internal:d,snapshot:u,status:h},t,this.frameClient,this.ontologyClient,this.rangeClient));return n?a[0]:a}async executeCommand(e,t,n){return await wn(this.frameClient,e,t,n)}async executeCommandSync(e,t,n,a,i,o=s.z.unknown()){const c=async()=>(await this.retrieve({key:e})).name;return await $i(this.frameClient,e,t,n,i??c,o,a)}};const mn=r=>({type:"task",key:r}),wn=async(r,e,t,n)=>{if(r==null)throw Se;const a=eu.create(),i=await r.openWriter(Wr);return await i.write(Wr,[{args:n,key:a,task:e,type:t}]),await i.close(),a},$i=async(r,e,t,n,a,i,o)=>{if(r==null)throw Se;const c=await r.openStreamer(Vr),l=await wn(r,e,t,o),h=new v(n);let d;const u=new Promise((N,E)=>{d=setTimeout(()=>{(async()=>E(await eg(t,a,h,e)))()},h.milliseconds)});try{for(;;){const N=await Promise.race([c.read(),u]),E=pn(i).parse(N.at(-1)[Vr]);if(E.key===l)return E}}finally{clearTimeout(d),c.close()}},eg=async(r,e,t,n)=>{const a=ol.capitalize(r),i=t.toString();try{const o=typeof e=="string"?e:await e();return new Error(`${a} command to ${o} timed out after ${i}`)}catch(o){return console.error("Failed to retrieve task name for timeout error:",o),new Error(`${a} command to task with key ${n} timed out after ${i}`)}},tg=Object.freeze(Object.defineProperty({__proto__:null,COMMAND_CHANNEL_NAME:Wr,Client:Ai,DELETE_CHANNEL_NAME:Zy,SET_CHANNEL_NAME:My,STATUS_CHANNEL_NAME:Vr,Task:Ii,commandZ:Uy,keyZ:de,newZ:zi,ontologyID:mn,rackKey:Dy,statusDetailsZ:Ni,statusZ:pn,taskZ:St},Symbol.toStringTag,{value:"Module"})),Oe=s.z.uuid(),It=s.z.object({key:Oe,name:s.z.string().min(1),color:s.z.string()}),rg="labeled_by",ng="sy_label_set",sg="sy_label_delete",ki=It.extend({key:Oe.optional()}),ag=s.object({labels:ki.array()}),ig=s.object({labels:It.array()}),og=s.object({keys:Oe.array()}),Ci=s.object({id:R,labels:Oe.array(),replace:s.boolean().optional()}),cg=Ci.omit({replace:!0}),wr=s.object({}),lg="/label/create",ug="/label/delete",hg="/label/set",dg="/label/remove",fg="/label/retrieve",yg=s.object({keys:Oe.array().optional(),for:R.optional(),searchTerm:s.string().optional(),offset:s.number().optional(),limit:s.number().optional()}),gg=s.object({key:Oe}).transform(({key:r})=>({keys:[r]})),pg=s.union([gg,yg]),mg=s.object({labels:L(It)});let xi=class{type="label";client;constructor(e){this.client=e}async retrieve(e){const t="key"in e,n=await g(this.client,fg,e,pg,mg);return Xe("Label",e,n.labels,t),t?n.labels[0]:n.labels}async label(e,t,n={}){await g(this.client,hg,{id:e,labels:t,replace:n.replace},Ci,wr)}async remove(e,t){await g(this.client,dg,{id:e,labels:t},cg,wr)}async create(e){const t=Array.isArray(e),n=await g(this.client,lg,{labels:T.toArray(e)},ag,ig);return t?n.labels:n.labels[0]}async delete(e){await g(this.client,ug,{keys:T.toArray(e)},og,wr)}};const wg=r=>({type:"label",key:r}),bg=Object.freeze(Object.defineProperty({__proto__:null,Client:xi,DELETE_CHANNEL_NAME:sg,LABELED_BY_ONTOLOGY_RELATIONSHIP_TYPE:rg,SET_CHANNEL_NAME:ng,keyZ:Oe,labelZ:It,newZ:ki,ontologyID:wg},Symbol.toStringTag,{value:"Module"})),_=s.z.uuid(),bn=s.z.string().min(1),At=s.z.object({key:_,name:bn,timeRange:z.z,color:s.z.string().optional(),labels:L(It),get parent(){return At.optional().nullable().transform(r=>r===void 0?null:r)}}),Ri=At.omit({parent:!0,labels:!0}).partial({key:!0}),Tg="sy_range_alias_set",vg="sy_range_alias_delete",Eg=s.z.object({range:_,aliases:s.z.string().array()}),Og=s.z.object({aliases:s.z.record(s.z.string(),U)}),Ng=s.z.object({range:_,aliases:s.z.record(U.or(s.z.string()),s.z.string())}),zg=s.z.unknown(),Sg=s.z.object({range:_,channels:U.array()}),Ig=s.z.unknown(),Ag=s.z.object({range:_}),$g=s.z.object({aliases:s.z.record(s.z.string(),s.z.string())});class Le{static SET_ENDPOINT="/range/alias/set";static RESOLVE_ENDPOINT="/range/alias/resolve";static LIST_ENDPOINT="/range/alias/list";static DELETE_ENDPOINT="/range/alias/delete";frameClient;cache=new Map;client;rangeKey;constructor(e,t,n){this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=t}async resolve(e){const t=[],n=typeof e=="string",a={};if(n){const o=this.cache.get(e);if(o!=null)return o;t.push(e)}else e.forEach(o=>{const c=this.cache.get(o);c!=null?a[o]=c:t.push(o)});if(t.length===0)return a;const i=await g(this.client,Le.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:t},Eg,Og);return Object.entries(i.aliases).forEach(([o,c])=>this.cache.set(o,c)),n?i.aliases[t[0]]:{...a,...i.aliases}}async set(e){await g(this.client,Le.SET_ENDPOINT,{range:this.rangeKey,aliases:e},Ng,zg)}async list(){return(await g(this.client,Le.LIST_ENDPOINT,{range:this.rangeKey},Ag,$g)).aliases}async delete(e){await g(this.client,Le.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Sg,Ig)}}const kg=s.z.object({alias:s.z.string(),channel:U,range:_}),Cg="---",xg=r=>{const[e,t]=r.split(Cg);return{range:e,channel:Number(t)}},Rg="sy_range_kv_set",jg="sy_range_kv_delete",Tn=s.z.object({range:_,key:s.z.string(),value:s.z.string()}),Ug=s.z.object({range:_,keys:s.z.string().array()}),Dg=s.z.object({pairs:L(Tn)}),Mg=s.z.object({range:_,pairs:Tn.array()}),Zg=s.z.object({range:_,keys:s.z.string().array()});class Ae{static GET_ENDPOINT="/range/kv/get";static SET_ENDPOINT="/range/kv/set";static DELETE_ENDPOINT="/range/kv/delete";rangeKey;client;constructor(e,t){this.rangeKey=e,this.client=t}async get(e){const t=await g(this.client,Ae.GET_ENDPOINT,{range:this.rangeKey,keys:T.toArray(e)},Ug,Dg);return typeof e=="string"?t.pairs[0].value:Object.fromEntries(t.pairs.map(n=>[n.key,n.value]))}async list(){return this.get([])}async set(e,t=""){let n;Ps(e)?n=Object.entries(e).map(([a,i])=>({range:this.rangeKey,key:a,value:i})):n=[{range:this.rangeKey,key:e,value:t}],await g(this.client,Ae.SET_ENDPOINT,{range:this.rangeKey,pairs:n},Mg,s.z.unknown())}async delete(e){await g(this.client,Ae.DELETE_ENDPOINT,{range:this.rangeKey,keys:T.toArray(e)},Zg,s.z.unknown())}}const Pg="sy_range_set",Lg="sy_range_delete";class ji{key;name;kv;timeRange;color;parent;labels;channels;aliaser;frameClient;labelClient;ontologyClient;rangeClient;constructor({name:e,timeRange:t=z.ZERO,key:n,color:a,parent:i,labels:o=[]},{frameClient:c,kv:l,aliaser:h,channels:d,labelClient:u,ontologyClient:N,rangeClient:E}){this.key=n,this.name=e,this.timeRange=t,this.parent=i,this.labels=o,this.frameClient=c,this.color=a,this.kv=l,this.aliaser=h,this.channels=d,this.labelClient=u,this.ontologyClient=N,this.rangeClient=E}get ontologyID(){return Be(this.key)}get payload(){return{key:this.key,name:this.name,timeRange:this.timeRange,color:this.color,labels:this.labels,parent:this.parent}}async setAlias(e,t){const n=await this.channels.retrieve(e);if(n.length===0)throw new ve(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:t})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async resolveAlias(e){return await this.aliaser.resolve(e)}async retrieveParent(){return this.rangeClient.retrieveParent(this.key)}async retrieveChildren(){const e=(await this.ontologyClient.retrieveChildren(this.ontologyID,{excludeFieldData:!0,types:["range"]})).map(t=>t.id.key);return await this.rangeClient.retrieve(e)}async read(e){return await this.frameClient.read(this.timeRange,e)}async retrieveLabels(){return await this.labelClient.retrieve({for:Be(this.key)})}async addLabel(...e){await this.labelClient.label(Be(this.key),e)}async removeLabel(...e){await this.labelClient.remove(Be(this.key),e)}static sort(e,t){return z.sort(e.timeRange,t.timeRange)}}const Bg=s.z.object({keys:_.array().optional(),names:s.z.array(s.z.string()).optional(),searchTerm:s.z.string().optional(),overlapsWith:z.z.optional(),limit:s.z.number().int().optional(),offset:s.z.number().int().optional(),hasLabels:Oe.array().optional(),includeLabels:s.z.boolean().optional(),includeParent:s.z.boolean().optional()}),qg=Bg.or(_.array().transform(r=>({keys:r}))).or(_.transform(r=>({keys:[r]}))).or(s.z.string().transform(r=>({names:[r]}))).or(s.z.string().array().transform(r=>({names:r}))).or(z.z.transform(r=>({overlapsWith:r}))),Fg="/range/retrieve",Yg=s.z.object({ranges:L(At)});let Ui=class{type="range";frameClient;writer;unaryClient;channels;labelClient;ontologyClient;constructor(e,t,n,a,i,o){this.frameClient=e,this.writer=t,this.unaryClient=n,this.channels=a,this.labelClient=i,this.ontologyClient=o}async create(e,t){const n=!Array.isArray(e),a=this.sugarMany(await this.writer.create(T.toArray(e),t));return n?a[0]:a}async rename(e,t){await this.writer.rename(e,t)}async delete(e){await this.writer.delete(T.toArray(e))}async retrieve(e){const t=typeof e=="string",{ranges:n}=await g(this.unaryClient,Fg,e,qg,Yg);return Xe("Range",e,n,t),t?this.sugarMany(n)[0]:this.sugarMany(n)}getKV(e){return new Ae(e,this.unaryClient)}async retrieveParent(e){const t=await this.ontologyClient.retrieveParents(Be(e));if(t.length===0)return null;const n=t[0];return n.id.type!=="range"?null:await this.retrieve(n.id.key)}sugarOntologyResource(e){return this.sugarOne(Di(e))}sugarOne(e){return new ji(e,{frameClient:this.frameClient,kv:new Ae(e.key,this.unaryClient),aliaser:new Le(e.key,this.frameClient,this.unaryClient),channels:this.channels,labelClient:this.labelClient,ontologyClient:this.ontologyClient,rangeClient:this})}sugarMany(e){return e.map(t=>this.sugarOne(t))}resourceToRange(e){return this.sugarOne({key:e.id.key,name:e.data?.name,timeRange:new z(e.data?.timeRange),color:e.data?.color,labels:[],parent:null})}};const Be=r=>({type:"range",key:r}),Vg=r=>({type:"range-alias",key:r}),Di=({data:r,id:{key:e},name:t})=>{const n=z.z.parse(r?.timeRange);return{key:e,name:t,timeRange:n,color:typeof r?.color=="string"?r.color:void 0,labels:[],parent:null}},Wg=s.z.object({ranges:At.array()}),_g=s.z.object({parent:R.optional(),ranges:Ri.array()}),Hg=s.z.object({keys:_.array()}),Gg=s.z.object({}),Jg=s.z.object({key:_,name:bn}),Kg=s.z.object({}),Xg="/range/create",Qg="/range/delete",ep="/range/rename";class Mi{client;constructor(e){this.client=e}async rename(e,t){await g(this.client,ep,{key:e,name:t},Jg,Kg)}async create(e,t){return(await g(this.client,Xg,{ranges:e,...t},_g,Wg)).ranges}async delete(e){await g(this.client,Qg,{keys:e},Hg,Gg)}}const tp=Object.freeze(Object.defineProperty({__proto__:null,Client:Ui,DELETE_ALIAS_CHANNEL_NAME:vg,DELETE_CHANNEL_NAME:Lg,KV:Ae,KV_DELETE_CHANNEL:jg,KV_SET_CHANNEL:Rg,Range:ji,SET_ALIAS_CHANNEL_NAME:Tg,SET_CHANNEL_NAME:Pg,Writer:Mi,aliasOntologyID:Vg,aliasZ:kg,convertOntologyResourceToPayload:Di,decodeDeleteAliasChange:xg,keyZ:_,kvPairZ:Tn,nameZ:bn,newZ:Ri,ontologyID:Be,payloadZ:At},Symbol.toStringTag,{value:"Module"})),rp="/api/v1/";class np{url;unary;stream;secure;constructor(e,t={},n=!1){this.secure=n,this.url=e.child(rp);const a=new $e.JSONCodec;this.unary=_c(new Wc(this.url,a,this.secure),t),this.stream=new Xc(this.url,a,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const et=s.z.uuid(),nr=s.z.object({key:et,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),Zi=nr.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),se=s.z.uuid(),sr=s.z.object({key:se,name:s.z.string(),layout:ue.unknownZ.or(s.z.string().transform(he))}),Pi=sr.partial({key:!0}).transform(r=>({...r,layout:JSON.stringify(r.layout)})),Li=sr.omit({layout:!0}).extend({layout:s.z.string().transform(he)}),sp="/workspace/lineplot/retrieve",ap="/workspace/lineplot/create",ip="/workspace/lineplot/rename",op="/workspace/lineplot/set-data",cp="/workspace/lineplot/delete",lp=s.z.object({keys:et.array()}),up=s.z.object({workspace:se,linePlots:Zi.array()}),hp=s.z.object({key:et,name:s.z.string()}),dp=s.z.object({key:et,data:s.z.string()}),fp=s.z.object({keys:et.array()}),yp=s.z.object({linePlots:L(nr)}),gp=s.z.object({linePlots:nr.array()}),br=s.z.object({});let Bi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,ap,{workspace:e,linePlots:T.toArray(t)},up,gp);return n?a.linePlots:a.linePlots[0]}async rename(e,t){await g(this.client,ip,{key:e,name:t},hp,br)}async setData(e,t){await g(this.client,op,{key:e,data:JSON.stringify(t)},dp,br)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,sp,{keys:T.toArray(e)},lp,yp);return t?n.linePlots:n.linePlots[0]}async delete(e){await g(this.client,cp,{keys:T.toArray(e)},fp,br)}};const pp=r=>({type:"lineplot",key:r}),mp=Object.freeze(Object.defineProperty({__proto__:null,Client:Bi,keyZ:et,linePlotZ:nr,newZ:Zi,ontologyID:pp},Symbol.toStringTag,{value:"Module"})),tt=s.z.uuid(),ar=s.z.object({key:tt,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),qi=ar.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),wp="/workspace/log/retrieve",bp="/workspace/log/create",Tp="/workspace/log/rename",vp="/workspace/log/set-data",Ep="/workspace/log/delete",Op=s.z.object({keys:tt.array()}),Np=s.z.object({workspace:se,logs:qi.array()}),zp=s.z.object({key:tt,name:s.z.string()}),Sp=s.z.object({key:tt,data:s.z.string()}),Ip=s.z.object({keys:tt.array()}),Ap=s.z.object({logs:ar.array()}),$p=s.z.object({logs:ar.array()}),Tr=s.z.object({});let Fi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,bp,{workspace:e,logs:T.toArray(t)},Np,$p);return n?a.logs:a.logs[0]}async rename(e,t){await g(this.client,Tp,{key:e,name:t},zp,Tr)}async setData(e,t){await g(this.client,vp,{key:e,data:JSON.stringify(t)},Sp,Tr)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,wp,{keys:T.toArray(e)},Op,Ap);return t?n.logs:n.logs[0]}async delete(e){await g(this.client,Ep,{keys:T.toArray(e)},Ip,Tr)}};const kp=r=>({type:"log",key:r}),Cp=Object.freeze(Object.defineProperty({__proto__:null,Client:Fi,keyZ:tt,logZ:ar,newZ:qi,ontologyID:kp},Symbol.toStringTag,{value:"Module"})),Ce=s.z.uuid(),ir=s.z.object({key:Ce,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he)),snapshot:s.z.boolean()}),Yi=ir.partial({key:!0,snapshot:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),vn=ir.extend({data:s.z.string().transform(he)}),xp="/workspace/schematic/retrieve",Rp="/workspace/schematic/create",jp="/workspace/schematic/rename",Up="/workspace/schematic/set-data",Dp="/workspace/schematic/delete",Mp="/workspace/schematic/copy",Zp=s.z.object({keys:Ce.array()}),Pp=s.z.object({workspace:se,schematics:Yi.array()}),Lp=s.z.object({key:Ce,name:s.z.string()}),Bp=s.z.object({key:Ce,data:s.z.string()}),qp=s.z.object({keys:Ce.array()}),Fp=s.z.object({key:Ce,name:s.z.string(),snapshot:s.z.boolean()}),Yp=s.z.object({schematics:L(vn)}),Vp=s.z.object({schematics:vn.array()}),Wp=s.z.object({schematic:ir}),vr=s.z.object({});let Vi=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,Rp,{workspace:e,schematics:T.toArray(t)},Pp,Vp);return n?a.schematics:a.schematics[0]}async rename(e,t){await g(this.client,jp,{key:e,name:t},Lp,vr)}async setData(e,t){await g(this.client,Up,{key:e,data:JSON.stringify(t)},Bp,vr)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,xp,{keys:T.toArray(e)},Zp,Yp);return t?n.schematics:n.schematics[0]}async delete(e){await g(this.client,Dp,{keys:T.toArray(e)},qp,vr)}async copy(e,t,n){return(await g(this.client,Mp,{key:e,name:t,snapshot:n},Fp,Wp)).schematic}};const _p=r=>({type:"schematic",key:r}),Hp=Object.freeze(Object.defineProperty({__proto__:null,Client:Vi,keyZ:Ce,newZ:Yi,ontologyID:_p,remoteZ:vn,schematicZ:ir},Symbol.toStringTag,{value:"Module"})),rt=s.z.uuid(),En=s.z.object({key:rt,name:s.z.string(),data:ue.unknownZ.or(s.z.string().transform(he))}),Wi=En.partial({key:!0}).transform(r=>({...r,data:JSON.stringify(r.data)})),On=En.extend({data:s.z.string().transform(he)}),Gp="/workspace/table/retrieve",Jp="/workspace/table/create",Kp="/workspace/table/rename",Xp="/workspace/table/set-data",Qp="/workspace/table/delete",em=s.z.object({keys:rt.array()}),tm=s.z.object({workspace:se,tables:Wi.array()}),rm=s.z.object({key:rt,name:s.z.string()}),nm=s.z.object({key:rt,data:s.z.string()}),sm=s.z.object({keys:rt.array()}),am=s.z.object({tables:On.array()}),im=s.z.object({tables:On.array()}),Er=s.z.object({});let _i=class{client;constructor(e){this.client=e}async create(e,t){const n=Array.isArray(t),a=await g(this.client,Jp,{workspace:e,tables:T.toArray(t)},tm,im);return n?a.tables:a.tables[0]}async rename(e,t){await g(this.client,Kp,{key:e,name:t},rm,Er)}async setData(e,t){await g(this.client,Xp,{key:e,data:JSON.stringify(t)},nm,Er)}async retrieve(e){const t=Array.isArray(e),n=await g(this.client,Gp,{keys:T.toArray(e)},em,am);return t?n.tables:n.tables[0]}async delete(e){await g(this.client,Qp,{keys:T.toArray(e)},sm,Er)}};const om=r=>({type:"table",key:r}),cm=Object.freeze(Object.defineProperty({__proto__:null,Client:_i,keyZ:rt,newZ:Wi,ontologyID:om,remoteZ:On,tableZ:En},Symbol.toStringTag,{value:"Module"})),hs="/workspace/retrieve",lm="/workspace/create",um="/workspace/rename",hm="/workspace/set-layout",dm="/workspace/delete",ds=s.z.object({keys:se.array().optional(),searchTerm:s.z.string().optional(),author:Ee.optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),fm=s.z.object({workspaces:Pi.array()}),ym=s.z.object({key:se,name:s.z.string()}),gm=s.z.object({key:se,layout:s.z.string()}),pm=s.z.object({keys:se.array()}),fs=s.z.object({workspaces:L(sr)}),mm=s.z.object({workspaces:Li.array()}),Or=s.z.object({}),wm="sy_workspace_set",bm="sy_workspace_delete";class Hi{type="workspace";schematic;linePlot;log;table;client;constructor(e){this.client=e,this.schematic=new Vi(e),this.linePlot=new Bi(e),this.log=new Fi(e),this.table=new _i(e)}async create(e){const t=Array.isArray(e),n=await g(this.client,lm,{workspaces:T.toArray(e)},fm,mm);return t?n.workspaces:n.workspaces[0]}async rename(e,t){await g(this.client,um,{key:e,name:t},ym,Or)}async setLayout(e,t){await g(this.client,hm,{key:e,layout:JSON.stringify(t)},gm,Or)}async retrieve(e){let t;const n=typeof e!="string";typeof e=="string"||Array.isArray(e)?t={keys:T.toArray(e)}:t=e;const a=await g(this.client,hs,t,ds,fs);return n?a.workspaces:a.workspaces[0]}async retrieveByAuthor(e){return(await g(this.client,hs,{author:e},ds,fs)).workspaces}async delete(e){await g(this.client,dm,{keys:T.toArray(e)},pm,Or)}}const Tm=r=>({type:"workspace",key:r}),vm=Object.freeze(Object.defineProperty({__proto__:null,Client:Hi,DELETE_CHANNEL_NAME:bm,SET_CHANNEL_NAME:wm,keyZ:se,newZ:Pi,ontologyID:Tm,remoteZ:Li,workspaceZ:sr},Symbol.toStringTag,{value:"Module"})),Gi=s.z.object({host:s.z.string({error:"Host is required"}).min(1,"Host is required"),port:s.z.number({error:"Port is required"}).or(s.z.string({error:"Port is required"})),username:s.z.string().min(1,"Username is required"),password:s.z.string().min(1,"Password is required"),connectivityPollFrequency:v.z.default(v.seconds(30)),secure:s.z.boolean().optional().default(!1),name:s.z.string().optional(),retry:ha.breakerConfigZ.optional()});class Ji extends hi{createdAt;props;ranges;channels;auth;user;access;connectivity;ontology;workspaces;labels;hardware;control;static connectivity=pt;transport;clientVersion="0.44.1";constructor(e){const t=Gi.parse(e),{host:n,port:a,username:i,password:o,connectivityPollFrequency:c,secure:l,retry:h}=t,d=new np(new ot({host:n,port:Number(a)}),h,l);d.use(Ah);let u;i!=null&&o!=null&&(u=new Tf(d.unary,{username:i,password:o}),d.use(u.middleware()));const N=new un(new Nt(d.unary)),E=new Ha(d.unary,N);super(d.stream,d.unary,N),this.createdAt=O.now(),this.props=t,this.auth=u,this.transport=d,this.channels=new Va(this,N,d.unary,E),this.connectivity=new pt(d.unary,c,this.clientVersion,t.name),this.control=new yi(this),this.ontology=new Ma(d.unary,this);const P=new Mi(this.transport.unary);this.labels=new xi(this.transport.unary),this.ranges=new Ui(this,P,this.transport.unary,N,this.labels,this.ontology),this.access=new La(this.transport.unary),this.user=new Ja(this.transport.unary),this.workspaces=new Hi(this.transport.unary);const k=new vi(this.transport.unary),B=new Ai(this.transport.unary,this,this.ontology,this.ranges),C=new Ei(this.transport.unary,B);this.hardware=new gi(B,C,k)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}const Ki={host:"localhost",port:9090,username:"synnax",password:"seldon"},Em=r=>new Ji({...Ki,...r});exports.AuthError=dt;exports.Channel=hn;exports.ContiguityError=zh;exports.DataType=I;exports.Density=W;exports.DisconnectedError=Nh;exports.Frame=Z;exports.MultiSeries=ca;exports.MultipleFoundError=yt;exports.NotFoundError=ft;exports.QueryError=ve;exports.Rate=Rr;exports.RouteError=Br;exports.Series=Y;exports.Synnax=Ji;exports.TEST_CLIENT_PROPS=Ki;exports.TimeRange=z;exports.TimeSpan=v;exports.TimeStamp=O;exports.UnexpectedError=Ye;exports.ValidationError=M;exports.access=wd;exports.channel=Yd;exports.connection=Ef;exports.control=ey;exports.device=my;exports.framer=Hf;exports.group=Fh;exports.hardware=ty;exports.isCalculated=gt;exports.label=bg;exports.linePlot=mp;exports.log=Cp;exports.newTestClient=Em;exports.ontology=rd;exports.policy=md;exports.rack=jy;exports.ranger=tp;exports.schematic=Hp;exports.synnaxPropsZ=Gi;exports.table=cm;exports.task=tg;exports.user=df;exports.workspace=vm;