@telemetryos/sdk 1.14.0 → 1.15.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @telemetryos/sdk
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ### New Features
8
+ - **Theme system** — Templates now ship with 8 built-in themes (`telemetryos`, `neon-pulse`, `solar-flare`, `arctic-aurora`, `emerald-matrix`, `the-matrix`, `plain-light`, `plain-dark`), each with a complete color palette including gradients, text colors, accents, and status indicators.
9
+ - **FlickeringGrid component** — New canvas-based animated background component with configurable square size, grid gap, flicker chance, opacity, and color.
10
+ - **SettingsSection component** — New collapsible accordion component exported from `@telemetryos/sdk` for organizing settings into expandable sections. Includes `aria-expanded`/`aria-controls` and `inert` support.
11
+ - **Settings form styles** — New shared CSS (`@telemetryos/sdk/react/styles.css`) with light/dark theme variables for text inputs, selects, sliders, color pickers, toggles, and checkboxes.
12
+ - **Expanded entrance animations** — Added `flip`, `fade`, `scale`, `slide`, `drop`, `fade-in`, `blur`, `zoom`, `unfold`, `rise`, `glitch`, and `breathe-glow` animations; removed `swing`.
13
+ - **Dark wordmark** — Added `telemetryos-wordmark-dark.svg` to template assets.
14
+ - **Root-SDK bridge re-exports** — `@telemetryos/root-sdk` now re-exports `BridgeMessage`, `ClientMessage`, and their validators/formatters from `@telemetryos/sdk-bridge`, so consumers no longer need a direct `sdk-bridge` import.
15
+
16
+ ### Infrastructure
17
+ - Moved template assets from `assets/` to `public/assets/` for automatic Vite build inclusion (both `vite-react-typescript` and `vite-react-typescript-web` templates).
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+ - @telemetryos/root-sdk@1.15.0
23
+
3
24
  ## 1.14.0
4
25
 
5
26
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const We="1.14.0",Je={version:We};class Ie{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class Ee{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e},{timeout:0})}bind(e,t){if(this._client._messageInterceptors.has(e))throw new Error(`Interceptor already bound for message ${e}`);this._client._messageInterceptors.set(e,t)}}class je{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}async getCapabilities(){const e=await this._client.request("devices.getCapabilities",{});if(!e.success)throw new Error("Failed to get device capabilities");return e.capabilities}}class Pe{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}async subscribeColorScheme(e){return(await this._client.subscribe("environment.subscribeColorScheme",{},e)).success}async unsubscribeColorScheme(e){return(await this._client.unsubscribe("environment.unsubscribeColorScheme",{},e)).success}}class Re{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}async openPicker(e){return(await this._client.request("media.openPicker",{accept:e==null?void 0:e.accept,currentValue:e==null?void 0:e.currentValue})).selection}}class $e{constructor(e){this._client=e}async fetch(e,t){var s;let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let a={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((_,w)=>{a[w]=_}):Array.isArray(t.headers)?t.headers.forEach(([_,w])=>{a[_]=w}):a=t.headers);const r=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:a,body:(s=t==null?void 0:t.body)!==null&&s!==void 0?s:null});if(!r.success)throw new TypeError(r.errorMessage,{cause:r.errorCause?Error(r.errorCause):void 0});const o=new Headers(r.headers),c={status:r.status,statusText:r.statusText,headers:o};let h=null;if(r.body!==null&&r.body!==void 0)if(r.bodyType==="binary"){const _=atob(r.body),w=new Uint8Array(_.length);for(let T=0;T<_.length;T++)w[T]=_.charCodeAt(T);h=w}else r.bodyType==="text"?h=r.body:r.bodyType==="json"&&(h=JSON.stringify(r.body));return new Response(h,c)}}class Fe{constructor(e){this._client=e}get application(){return new U("application",void 0,this._client)}get instance(){return new U("instance",this._client.applicationInstance,this._client)}get device(){return new U("device",this._client.deviceId,this._client)}shared(e){return new U("shared",e,this._client)}}class U{constructor(e,t,s){this._kind=e,this._namespace=t,this._client=s}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class qe{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error(e.error||"Failed to fetch current user");return e.user}}class Me{constructor(e){this._client=e}async getCities(e){const t=await this._client.request("weather.getCities",e);if(!t.success)throw new Error(t.error||"Failed to fetch cities");return t.data||[]}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather conditions");return t}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch daily forecast");return t}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch hourly forecast");return t}async getAlerts(e){const t=await this._client.request("weather.getAlerts",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather alerts");return t}}class Le{constructor(e){this._client=e}async getSymbols(){const e=await this._client.request("currency.getSymbols",{});if(!e.success||!e.symbols)throw new Error("Failed to fetch currency symbols");return e.symbols}async getRates(e){var t,s,n;const a=await this._client.request("currency.getRates",e);if(!a.success||!a.rates)throw((t=a.error)===null||t===void 0?void 0:t.code)===201?new Error(`Invalid base currency '${e.base}'`):((s=a.error)===null||s===void 0?void 0:s.code)===202?new Error(`Invalid target currency symbol '${e.symbols}'`):new Error(((n=a.error)===null||n===void 0?void 0:n.message)||"Failed to fetch currency rates");return a.rates}}class De{constructor(e){this._client=e}async discover(){const e=await this._client.request("mqtt.discover",{});if(!e.success)throw new Error("Failed to discover MQTT brokers");return e.brokers}async connect(e,t){const s=await this._client.request("mqtt.connect",{brokerUrl:e,...t});if(!s.success)throw new Error("Failed to connect to MQTT broker");return s.clientId}async disconnect(e){if(!(await this._client.request("mqtt.disconnect",{clientId:e})).success)throw new Error("Failed to disconnect from MQTT broker")}async publish(e,t,s,n){if(!(await this._client.request("mqtt.publish",{clientId:e,topic:t,payload:s,...n})).success)throw new Error("Failed to publish MQTT message")}async subscribe(e,t,s,n){return(await this._client.subscribe("mqtt.subscribe",{clientId:e,topic:t,...n},s)).success}async unsubscribe(e,t,s){return(await this._client.unsubscribe("mqtt.unsubscribe",{clientId:e,topic:t},s)).success}async getConnectionStatus(e){const t=await this._client.request("mqtt.getConnectionStatus",{clientId:e});if(!t.success)throw new Error("Failed to get MQTT connection status");return t.status}async subscribeConnectionStatus(e,t){return(await this._client.subscribe("mqtt.subscribeConnectionStatus",{clientId:e},t)).success}async unsubscribeConnectionStatus(e,t){return(await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus",{clientId:e},t)).success}}class Ge{constructor(e){this._originalPushState=null,this._originalReplaceState=null,this._popstateHandler=null,this._backHandler=null,this._forwardHandler=null,this._client=e}bind(){typeof window>"u"||this._originalPushState||(this._originalPushState=history.pushState.bind(history),history.pushState=(...e)=>{this._originalPushState(...e),this._sendLocationChanged()},this._originalReplaceState=history.replaceState.bind(history),history.replaceState=(...e)=>{this._originalReplaceState(...e),this._sendLocationChanged()},this._popstateHandler=()=>this._sendLocationChanged(),window.addEventListener("popstate",this._popstateHandler),this._backHandler=()=>history.back(),this._forwardHandler=()=>history.forward(),this._client.on("navigation.back",this._backHandler),this._client.on("navigation.forward",this._forwardHandler),this._sendLocationChanged())}unbind(){typeof window>"u"||(this._originalPushState&&(history.pushState=this._originalPushState,this._originalPushState=null),this._originalReplaceState&&(history.replaceState=this._originalReplaceState,this._originalReplaceState=null),this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null),this._backHandler&&(this._client.off("navigation.back",this._backHandler),this._backHandler=null),this._forwardHandler&&(this._client.off("navigation.forward",this._forwardHandler),this._forwardHandler=null))}_sendLocationChanged(){this._client.send("navigation.locationChanged",{pathname:window.location.pathname})}}var b;(function(i){i.assertEqual=n=>{};function e(n){}i.assertIs=e;function t(n){throw new Error}i.assertNever=t,i.arrayToEnum=n=>{const a={};for(const r of n)a[r]=r;return a},i.getValidEnumValues=n=>{const a=i.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),r={};for(const o of a)r[o]=n[o];return i.objectValues(r)},i.objectValues=n=>i.objectKeys(n).map(function(a){return n[a]}),i.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&a.push(r);return a},i.find=(n,a)=>{for(const r of n)if(a(r))return r},i.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(r=>typeof r=="string"?`'${r}'`:r).join(a)}i.joinValues=s,i.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var _e;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(_e||(_e={}));const l=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=i=>{switch(typeof i){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(i)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(i)?l.array:i===null?l.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?l.promise:typeof Map<"u"&&i instanceof Map?l.map:typeof Set<"u"&&i instanceof Set?l.set:typeof Date<"u"&&i instanceof Date?l.date:l.object;default:return l.unknown}},u=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const r of a.issues)if(r.code==="invalid_union")r.unionErrors.map(n);else if(r.code==="invalid_return_type")n(r.returnTypeError);else if(r.code==="invalid_arguments")n(r.argumentsError);else if(r.path.length===0)s._errors.push(t(r));else{let o=s,c=0;for(;c<r.path.length;){const h=r.path[c];c===r.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(r))):o[h]=o[h]||{_errors:[]},o=o[h],c++}}};return n(this),s}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Z.create=i=>new Z(i);const oe=(i,e)=>{let t;switch(i.code){case u.invalid_type:i.received===l.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(i.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(i.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(i.options)}, received '${i.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:b.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case u.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="bigint"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case u.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(i)}return{message:t}};let Qe=oe;function Ye(){return Qe}const Xe=i=>{const{data:e,path:t,errorMaps:s,issueData:n}=i,a=[...t,...n.path||[]],r={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(h=>!!h).slice().reverse();for(const h of c)o=h(r,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function d(i,e){const t=Ye(),s=Xe({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===oe?void 0:oe].filter(n=>!!n)});i.common.issues.push(s)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return g;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,r=await n.value;s.push({key:a,value:r})}return S.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:r}=n;if(a.status==="aborted"||r.status==="aborted")return g;a.status==="dirty"&&e.dirty(),r.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof r.value<"u"||n.alwaysSet)&&(s[a.value]=r.value)}return{status:e.value,value:s}}}const g=Object.freeze({status:"aborted"}),ce=i=>({status:"dirty",value:i}),C=i=>({status:"valid",value:i}),ye=i=>i.status==="aborted",ve=i=>i.status==="dirty",L=i=>i.status==="valid",ee=i=>typeof Promise<"u"&&i instanceof Promise;var p;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class j{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const be=(i,e)=>{if(L(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Z(i.common.issues);return this._error=t,this._error}}};function y(i){if(!i)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=i;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,r)=>{const{message:o}=i;return a.code==="invalid_enum_value"?{message:o??r.defaultError}:typeof r.data>"u"?{message:o??s??r.defaultError}:a.code!=="invalid_type"?{message:r.defaultError}:{message:o??t??r.defaultError}},description:n}}class v{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ee(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return L(a)?{value:a.value}:{issues:n.common.issues}}catch(a){(s=(t=a==null?void 0:a.message)==null?void 0:t.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>L(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ee(n)?n:Promise.resolve(n));return be(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const r=e(n),o=()=>a.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&r instanceof Promise?r.then(c=>c?!0:(o(),!1)):r?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new H({schema:this,typeName:f.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return ie.create(this,this._def)}or(e){return se.create([this,e],this._def)}and(e){return ne.create(this,e,this._def)}transform(e){return new H({...y(this._def),schema:this,typeName:f.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new he({...y(this._def),innerType:this,defaultValue:t,typeName:f.ZodDefault})}brand(){return new kt({typeName:f.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new pe({...y(this._def),innerType:this,catchValue:t,typeName:f.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fe.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const et=/^c[^\s-]{8,}$/i,tt=/^[0-9a-z]+$/,st=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,it=/^[a-z0-9_-]{21}$/i,rt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,at=/^[-+]?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)?)??$/,ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ct="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ae;const ut=/^(?:(?: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])$/,dt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,lt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ht=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,He="((\\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])))",ft=new RegExp(`^${He}$`);function ze(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);const t=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function gt(i){return new RegExp(`^${ze(i)}$`)}function _t(i){let e=`${He}T${ze(i)}`;const t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function yt(i,e){return!!((e==="v4"||!e)&&ut.test(i)||(e==="v6"||!e)&&lt.test(i))}function vt(i,e){if(!rt.test(i))return!1;try{const[t]=i.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function bt(i,e){return!!((e==="v4"||!e)&&dt.test(i)||(e==="v6"||!e)&&ht.test(i))}class I extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.string,received:n.parsedType}),g}const t=new S;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const a=e.data.length>n.value,r=e.data.length<n.value;(a||r)&&(s=this._getOrReturnCtx(e,s),a?d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")ae||(ae=new RegExp(ct,"u")),ae.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")nt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")it.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")et.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:u.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?_t(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?ft.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?gt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?at.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?yt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?vt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?bt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?pt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?mt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.invalid_string,message:n.message}),t.dirty()):b.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...p.errToObj(s)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}I.create=i=>new I({checks:[],typeName:f.ZodString,coerce:(i==null?void 0:i.coerce)??!1,...y(i)});function wt(i,e){const t=(i.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(i.toFixed(n).replace(".","")),r=Number.parseInt(e.toFixed(n).replace(".",""));return a%r/10**n}class J extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.number,received:n.parsedType}),g}let t;const s=new S;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?wt(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_finite,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}J.create=i=>new J({checks:[],typeName:f.ZodNumber,coerce:(i==null?void 0:i.coerce)||!1,...y(i)});class G extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==l.bigint)return this._getInvalidInput(e);let t;const s=new S;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}G.create=i=>new G({checks:[],typeName:f.ZodBigInt,coerce:(i==null?void 0:i.coerce)??!1,...y(i)});class we extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.boolean,received:t.parsedType}),g}return C(e.data)}}we.create=i=>new we({typeName:f.ZodBoolean,coerce:(i==null?void 0:i.coerce)||!1,...y(i)});class te extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.date,received:n.parsedType}),g}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_date}),g}const t=new S;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):b.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}te.create=i=>new te({checks:[],coerce:(i==null?void 0:i.coerce)||!1,typeName:f.ZodDate,...y(i)});class ke extends v{_parse(e){if(this._getType(e)!==l.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.symbol,received:t.parsedType}),g}return C(e.data)}}ke.create=i=>new ke({typeName:f.ZodSymbol,...y(i)});class xe extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.undefined,received:t.parsedType}),g}return C(e.data)}}xe.create=i=>new xe({typeName:f.ZodUndefined,...y(i)});class Se extends v{_parse(e){if(this._getType(e)!==l.null){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.null,received:t.parsedType}),g}return C(e.data)}}Se.create=i=>new Se({typeName:f.ZodNull,...y(i)});class ue extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}ue.create=i=>new ue({typeName:f.ZodAny,...y(i)});class Ce extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}Ce.create=i=>new Ce({typeName:f.ZodUnknown,...y(i)});class P extends v{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.never,received:t.parsedType}),g}}P.create=i=>new P({typeName:f.ZodNever,...y(i)});class Te extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.void,received:t.parsedType}),g}return C(e.data)}}Te.create=i=>new Te({typeName:f.ZodVoid,...y(i)});class N extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:u.invalid_type,expected:l.array,received:t.parsedType}),g;if(n.exactLength!==null){const r=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(r||o)&&(d(t,{code:r?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:r?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((r,o)=>n.type._parseAsync(new j(t,r,t.path,o)))).then(r=>S.mergeArray(s,r));const a=[...t.data].map((r,o)=>n.type._parseSync(new j(t,r,t.path,o)));return S.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(i,e)=>new N({type:i,minLength:null,maxLength:null,exactLength:null,typeName:f.ZodArray,...y(e)});function M(i){if(i instanceof k){const e={};for(const t in i.shape){const s=i.shape[t];e[t]=E.create(M(s))}return new k({...i._def,shape:()=>e})}else return i instanceof N?new N({...i._def,type:M(i.element)}):i instanceof E?E.create(M(i.unwrap())):i instanceof z?z.create(M(i.unwrap())):i instanceof q?q.create(i.items.map(e=>M(e))):i}class k extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const c=this._getOrReturnCtx(e);return d(c,{code:u.invalid_type,expected:l.object,received:c.parsedType}),g}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const c in s.data)a.includes(c)||r.push(c);const o=[];for(const c of a){const h=n[c],_=s.data[c];o.push({key:{status:"valid",value:c},value:h._parse(new j(s,_,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof P){const c=this._def.unknownKeys;if(c==="passthrough")for(const h of r)o.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(c==="strict")r.length>0&&(d(s,{code:u.unrecognized_keys,keys:r}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const h of r){const _=s.data[h];o.push({key:{status:"valid",value:h},value:c._parse(new j(s,_,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const h of o){const _=await h.key,w=await h.value;c.push({key:_,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>S.mergeObjectSync(t,c)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a;const r=((a=(n=this._def).errorMap)==null?void 0:a.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:f.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};for(const s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new k({...this._def,shape:()=>t})}omit(e){const t={};for(const s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new k({...this._def,shape:()=>t})}deepPartial(){return M(this)}partial(e){const t={};for(const s of b.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new k({...this._def,shape:()=>t})}required(e){const t={};for(const s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof E;)n=n._def.innerType;t[s]=n}return new k({...this._def,shape:()=>t})}keyof(){return Ve(b.objectKeys(this.shape))}}k.create=(i,e)=>new k({shape:()=>i,unknownKeys:"strip",catchall:P.create(),typeName:f.ZodObject,...y(e)});k.strictCreate=(i,e)=>new k({shape:()=>i,unknownKeys:"strict",catchall:P.create(),typeName:f.ZodObject,...y(e)});k.lazycreate=(i,e)=>new k({shape:i,unknownKeys:"strip",catchall:P.create(),typeName:f.ZodObject,...y(e)});class se extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const r=a.map(o=>new Z(o.ctx.common.issues));return d(t,{code:u.invalid_union,unionErrors:r}),g}if(t.common.async)return Promise.all(s.map(async a=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(n);{let a;const r=[];for(const c of s){const h={...t,common:{...t.common,issues:[]},parent:null},_=c._parseSync({data:t.data,path:t.path,parent:h});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:h}),h.common.issues.length&&r.push(h.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=r.map(c=>new Z(c));return d(t,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}se.create=(i,e)=>new se({options:i,typeName:f.ZodUnion,...y(e)});function de(i,e){const t=A(i),s=A(e);if(i===e)return{valid:!0,data:i};if(t===l.object&&s===l.object){const n=b.objectKeys(e),a=b.objectKeys(i).filter(o=>n.indexOf(o)!==-1),r={...i,...e};for(const o of a){const c=de(i[o],e[o]);if(!c.valid)return{valid:!1};r[o]=c.data}return{valid:!0,data:r}}else if(t===l.array&&s===l.array){if(i.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<i.length;a++){const r=i[a],o=e[a],c=de(r,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===l.date&&s===l.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}class ne extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,r)=>{if(ye(a)||ye(r))return g;const o=de(a.value,r.value);return o.valid?((ve(a)||ve(r))&&t.dirty(),{status:t.value,value:o.data}):(d(s,{code:u.invalid_intersection_types}),g)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,r])=>n(a,r)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ne.create=(i,e,t)=>new ne({left:i,right:e,typeName:f.ZodIntersection,...y(t)});class q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.array)return d(s,{code:u.invalid_type,expected:l.array,received:s.parsedType}),g;if(s.data.length<this._def.items.length)return d(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((a,r)=>{const o=this._def.items[r]||this._def.rest;return o?o._parse(new j(s,a,s.path,r)):null}).filter(a=>!!a);return s.common.async?Promise.all(n).then(a=>S.mergeArray(t,a)):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new q({...this._def,rest:e})}}q.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q({items:i,typeName:f.ZodTuple,rest:null,...y(e)})};class Ne extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.map)return d(s,{code:u.invalid_type,expected:l.map,received:s.parsedType}),g;const n=this._def.keyType,a=this._def.valueType,r=[...s.data.entries()].map(([o,c],h)=>({key:n._parse(new j(s,o,s.path,[h,"key"])),value:a._parse(new j(s,c,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of r){const h=await c.key,_=await c.value;if(h.status==="aborted"||_.status==="aborted")return g;(h.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(h.value,_.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of r){const h=c.key,_=c.value;if(h.status==="aborted"||_.status==="aborted")return g;(h.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(h.value,_.value)}return{status:t.value,value:o}}}}Ne.create=(i,e,t)=>new Ne({valueType:e,keyType:i,typeName:f.ZodMap,...y(t)});class Q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.set)return d(s,{code:u.invalid_type,expected:l.set,received:s.parsedType}),g;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function r(c){const h=new Set;for(const _ of c){if(_.status==="aborted")return g;_.status==="dirty"&&t.dirty(),h.add(_.value)}return{status:t.value,value:h}}const o=[...s.data.values()].map((c,h)=>a._parse(new j(s,c,s.path,h)));return s.common.async?Promise.all(o).then(c=>r(c)):r(o)}min(e,t){return new Q({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new Q({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Q.create=(i,e)=>new Q({valueType:i,minSize:null,maxSize:null,typeName:f.ZodSet,...y(e)});class Ze extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ze.create=(i,e)=>new Ze({getter:i,typeName:f.ZodLazy,...y(e)});class le extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(i,e)=>new le({value:i,typeName:f.ZodLiteral,...y(e)});function Ve(i,e){return new D({values:i,typeName:f.ZodEnum,...y(e)})}class D extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:b.joinValues(s),received:t.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:u.invalid_enum_value,options:s}),g}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return D.create(e,{...this._def,...t})}exclude(e,t=this._def){return D.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}D.create=Ve;class Oe extends v{_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==l.string&&s.parsedType!==l.number){const n=b.objectValues(t);return d(s,{expected:b.joinValues(n),received:s.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=b.objectValues(t);return d(s,{received:s.data,code:u.invalid_enum_value,options:n}),g}return C(e.data)}get enum(){return this._def.values}}Oe.create=(i,e)=>new Oe({values:i,typeName:f.ZodNativeEnum,...y(e)});class ie extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:u.invalid_type,expected:l.promise,received:t.parsedType}),g;const s=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return C(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ie.create=(i,e)=>new ie({type:i,typeName:f.ZodPromise,...y(e)});class H extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===f.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:r=>{d(s,r),r.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const r=n.transform(s.data,a);if(s.common.async)return Promise.resolve(r).then(async o=>{if(t.value==="aborted")return g;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:r,path:s.path,parent:s});return o.status==="aborted"?g:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(n.type==="refinement"){const r=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),r(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),r(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!L(r))return g;const o=n.transform(r.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(r=>L(r)?Promise.resolve(n.transform(r.value,a)).then(o=>({status:t.value,value:o})):g);b.assertNever(n)}}H.create=(i,e,t)=>new H({schema:i,typeName:f.ZodEffects,effect:e,...y(t)});H.createWithPreprocess=(i,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:i},typeName:f.ZodEffects,...y(t)});class E extends v{_parse(e){return this._getType(e)===l.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(i,e)=>new E({innerType:i,typeName:f.ZodOptional,...y(e)});class z extends v{_parse(e){return this._getType(e)===l.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(i,e)=>new z({innerType:i,typeName:f.ZodNullable,...y(e)});class he extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===l.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}he.create=(i,e)=>new he({innerType:i,typeName:f.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class pe extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ee(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}pe.create=(i,e)=>new pe({innerType:i,typeName:f.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Ae extends v{_parse(e){if(this._getType(e)!==l.nan){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.nan,received:t.parsedType}),g}return{status:"valid",value:e.data}}}Ae.create=i=>new Ae({typeName:f.ZodNaN,...y(i)});class kt extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class fe extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?g:n.status==="dirty"?(t.dirty(),ce(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?g:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new fe({in:e,out:t,typeName:f.ZodPipeline})}}class me extends v{_parse(e){const t=this._def.innerType._parse(e),s=n=>(L(n)&&(n.value=Object.freeze(n.value)),n);return ee(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}me.create=(i,e)=>new me({innerType:i,typeName:f.ZodReadonly,...y(e)});var f;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(f||(f={}));const O=I.create,Be=ue.create;P.create;N.create;const Ue=k.create;se.create;ne.create;q.create;const Ke=le.create;D.create;ie.create;E.create;z.create;const xt=Ue({type:Ke("bridge"),name:O(),data:Be()});Ue({type:Ke("client"),telemetrySdkVersion:O(),applicationSpecifier:O(),applicationInstance:O(),name:O(),data:Be(),responseName:O().optional(),subscriptionName:O().optional(),unsubscribeName:O().optional()});function Y(i){return{...i,type:"client"}}class St{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){var t;const s=this._store.shared("root-settings-navigation"),n=(t=await s.get("navigation"))!==null&&t!==void 0?t:{},a=this._store._client._applicationSpecifier;n[a]={applicationSpecifier:a,entries:e.entries},s.set("navigation",n)}async getRootSettingsNavigation(){var e;const t=(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{},s=this._store._client._applicationSpecifier;return t[s]}async getAllRootSettingsNavigation(){var e;return(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{}}}const V=1e3*30,ge=typeof window>"u"&&typeof self<"u",K=ge?self:window;function B(i){ge?self.postMessage(i):K.parent.postMessage(i,"*")}class Ct{constructor(){this._applicationInstance="",this._applicationSpecifier="",this._deviceId="",this._navigation=new Ge(this),this._messageInterceptors=new Map,this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new Ie(this)}get users(){return new qe(this)}get store(){return new Fe(this)}get applications(){return new Ee(this)}get media(){return new Re(this)}get proxy(){return new $e(this)}get devices(){return new je(this)}get rootSettingsNavigation(){return new St(this.store)}get weather(){return new Me(this)}get currency(){return new Le(this)}get environment(){return new Pe(this)}get mqtt(){return new De(this)}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}get deviceId(){return this._deviceId}bind(){var e,t;const s=new URL(K.location.href),n=s.searchParams;this._applicationInstance=n.get("applicationInstance")||"single",this._deviceId=n.get("deviceId")||this._applicationInstance;const a=/^[a-z0-9-]{40}$/i;if(this._applicationSpecifier=(e=n.get("applicationSpecifier"))!==null&&e!==void 0?e:"",!this._applicationSpecifier||!a.test(this._applicationSpecifier)){const r=s.hostname.split(".");this._applicationSpecifier=(t=r[0])!==null&&t!==void 0?t:""}if(!this._applicationSpecifier||!a.test(this._applicationSpecifier))throw console.error("TelemetryOS apps require an applicationSpecifier in the URL query parameters or subdomain. Make sure your app is being served correctly through the TelemetryOS platform or development environment."),new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);this._windowMessageHandler=r=>{if(r.source===K||!r.data||typeof r.data!="object"||!("type"in r.data)||r.data.type!=="client"&&r.data.type!=="bridge")return;let o;if(r.data.type==="client"){const c=this._messageInterceptors.get(r.data.name);if(!c){B(r.data);return}o={...c(r.data.data),type:"bridge",...r.data.responseName?{name:r.data.responseName}:{}}}if(!o){const c=xt.safeParse(r.data);if(!c.success){const w=r.data;w&&typeof w=="object"&&w.type==="bridge"&&console.warn("[sdk-client] Received a message that looks like a bridge message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.",c.error.issues);return}o=c.data;const h=this._onHandlers.get(o.name),_=this._onceHandlers.get(o.name);if(h)for(const w of h)w(o.data);if(_){for(const w of _)w(o.data);this._onceHandlers.delete(o.name)}}if(!ge)for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},K.addEventListener("message",this._windowMessageHandler),this._navigation.bind()}unbind(){this._windowMessageHandler&&(this._navigation.unbind(),K.removeEventListener("message",this._windowMessageHandler))}send(e,t){const s=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});B(s)}request(e,t,s){var n;const a=X(),r=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:a});B(r);const o=(n=s==null?void 0:s.timeout)!==null&&n!==void 0?n:V;let c=!1,h;const _=new Promise(T=>{h=R=>{c||T(R)},this.once(a,h)});if(o===0)return _;const w=new Promise((T,R)=>{const $=new Error(`${e} message request with response name of ${a} timed out after ${o}`);setTimeout(()=>{c=!0,this.off(a,h),R($)},o)});return Promise.race([w,_])}async subscribe(e,t,s){let n,a;typeof t=="function"?a=t:(n=t,a=s);const r=X(),o=X();let c=this._subscriptionNamesBySubjectName.get(e);c||(c=[],this._subscriptionNamesBySubjectName.set(e,c)),c.push(r),this._subscriptionNamesByHandler.set(a,r),this.on(r,a);const h=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:r});B(h);let _=!1,w;const T=new Promise(($,F)=>{const re=new Error(`${e} subscribe request with subscription name of ${r} and response name of ${o} timed out after ${V}`);setTimeout(()=>{_=!0,this.off(o,w),F(re)},V)}),R=new Promise($=>{w=F=>{_||$(F)},this.once(o,w)});return Promise.race([T,R])}async unsubscribe(e,t,s){let n,a;typeof t=="function"?a=t:(n=t,a=s);const r=X();let o=[];if(a){const c=this._subscriptionNamesByHandler.get(a);if(!c)return{success:!1};o=[c],this._subscriptionNamesByHandler.delete(a)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const c of o){this.off(c,a);const h=Y({telemetrySdkVersion:W,applicationInstance:this._applicationInstance,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:r,unsubscribeName:c});B(h);let _=!1,w;const T=new Promise(($,F)=>{const re=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${r} timed out after ${V}`);setTimeout(()=>{_=!0,this.off(r,w),F(re)},V)}),R=new Promise($=>{w=F=>{_||$(F)},this.once(r,w)});if(!(await Promise.race([T,R])).success)return{success:!1}}return{success:!0}}on(e,t){var s;const n=(s=this._onHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onHandlers.set(e,n),n.push(t)}once(e,t){var s;const n=(s=this._onceHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onceHandlers.set(e,n),n.push(t)}off(e,t){const s=this._onHandlers.get(e),n=this._onceHandlers.get(e);if(!(!s&&!n)){if(s){for(let a=0;a<s.length;a+=1)t&&s[a]!==t||(s.splice(a,1),a-=1);s.length===0&&this._onHandlers.delete(e)}if(n){for(let a=0;a<n.length;a+=1)t&&n[a]!==t||(n.splice(a,1),a-=1);n.length===0&&this._onceHandlers.delete(e)}}}}function X(){return Math.random().toString(36).slice(2,9)}const W=Je.version;class Tt{constructor(e){this._client=e}async setOverride(e){if(!(await this._client.request("overrides.setOverride",{name:e})).success)throw new Error("Failed to set override");return!0}async clearOverride(e){if(!(await this._client.request("overrides.clearOverride",{name:e})).success)throw new Error("Failed to clear override");return!0}}class Nt{constructor(e){this._client=e}async nextPage(){if(!(await this._client.request("playlist.nextPage",{})).success)throw new Error("Failed to advance to next page");return!0}async previousPage(){if(!(await this._client.request("playlist.previousPage",{})).success)throw new Error("Failed to return to previous page");return!0}async setDuration(e){if(!(await this._client.request("playlist.setDuration",{duration:e})).success)throw new Error("Failed to set page duration");return!0}async getDuration(){const e=await this._client.request("playlist.getDuration",{});if(!e.success)throw new Error("Failed to get page duration");return{success:!0,duration:e.duration}}}class Zt extends Ct{get playlist(){return new Nt(this)}get overrides(){return new Tt(this)}}let m=null;function Ot(){return m}function At(i){m=new Zt,m.bind()}function It(){m==null||m.unbind(),m=null}function Et(...i){return x(m),m.on(...i)}function jt(...i){return x(m),m.once(...i)}function Pt(...i){return x(m),m.off(...i)}function Rt(...i){return x(m),m.send(...i)}function $t(...i){return x(m),m.request(...i)}function Ft(...i){return x(m),m.subscribe(...i)}function qt(...i){return x(m),m.unsubscribe(...i)}function Mt(){return x(m),m.store}function Lt(){return x(m),m.applications}function Dt(){return x(m),m.media}function Ht(){return x(m),m.accounts}function zt(){return x(m),m.users}function Vt(){return x(m),m.devices}function Bt(){return x(m),m.proxy}function Ut(){return x(m),m.weather}function Kt(){return x(m),m.currency}function Wt(){return x(m),m.environment}function Jt(){return x(m),m.playlist}function Gt(){return x(m),m.overrides}function Qt(){return x(m),m.mqtt}function x(i){if(!i)throw new Error("SDK is not configured")}exports.Accounts=Ie;exports.Applications=Ee;exports.Currency=Le;exports.Devices=je;exports.Environment=Pe;exports.Media=Re;exports.Mqtt=De;exports.Proxy=$e;exports.Store=Fe;exports.StoreSlice=U;exports.Users=qe;exports.Weather=Me;exports.accounts=Ht;exports.applications=Lt;exports.configure=At;exports.currency=Kt;exports.destroy=It;exports.devices=Vt;exports.environment=Wt;exports.globalClient=Ot;exports.media=Dt;exports.mqtt=Qt;exports.off=Pt;exports.on=Et;exports.once=jt;exports.overrides=Gt;exports.playlist=Jt;exports.proxy=Bt;exports.request=$t;exports.send=Rt;exports.store=Mt;exports.subscribe=Ft;exports.telemetrySdkVersion=W;exports.unsubscribe=qt;exports.users=zt;exports.weather=Ut;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const We="1.15.0",Je={version:We};class Ie{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class Ee{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e},{timeout:0})}bind(e,t){if(this._client._messageInterceptors.has(e))throw new Error(`Interceptor already bound for message ${e}`);this._client._messageInterceptors.set(e,t)}}class je{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}async getCapabilities(){const e=await this._client.request("devices.getCapabilities",{});if(!e.success)throw new Error("Failed to get device capabilities");return e.capabilities}}class Pe{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}async subscribeColorScheme(e){return(await this._client.subscribe("environment.subscribeColorScheme",{},e)).success}async unsubscribeColorScheme(e){return(await this._client.unsubscribe("environment.unsubscribeColorScheme",{},e)).success}}class Re{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}async openPicker(e){return(await this._client.request("media.openPicker",{accept:e==null?void 0:e.accept,currentValue:e==null?void 0:e.currentValue})).selection}}class $e{constructor(e){this._client=e}async fetch(e,t){var s;let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let a={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((_,w)=>{a[w]=_}):Array.isArray(t.headers)?t.headers.forEach(([_,w])=>{a[_]=w}):a=t.headers);const r=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:a,body:(s=t==null?void 0:t.body)!==null&&s!==void 0?s:null});if(!r.success)throw new TypeError(r.errorMessage,{cause:r.errorCause?Error(r.errorCause):void 0});const o=new Headers(r.headers),c={status:r.status,statusText:r.statusText,headers:o};let h=null;if(r.body!==null&&r.body!==void 0)if(r.bodyType==="binary"){const _=atob(r.body),w=new Uint8Array(_.length);for(let T=0;T<_.length;T++)w[T]=_.charCodeAt(T);h=w}else r.bodyType==="text"?h=r.body:r.bodyType==="json"&&(h=JSON.stringify(r.body));return new Response(h,c)}}class Fe{constructor(e){this._client=e}get application(){return new U("application",void 0,this._client)}get instance(){return new U("instance",this._client.applicationInstance,this._client)}get device(){return new U("device",this._client.deviceId,this._client)}shared(e){return new U("shared",e,this._client)}}class U{constructor(e,t,s){this._kind=e,this._namespace=t,this._client=s}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class qe{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error(e.error||"Failed to fetch current user");return e.user}}class Me{constructor(e){this._client=e}async getCities(e){const t=await this._client.request("weather.getCities",e);if(!t.success)throw new Error(t.error||"Failed to fetch cities");return t.data||[]}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather conditions");return t}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch daily forecast");return t}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success)throw new Error(t.error||"Failed to fetch hourly forecast");return t}async getAlerts(e){const t=await this._client.request("weather.getAlerts",e);if(!t.success)throw new Error(t.error||"Failed to fetch weather alerts");return t}}class Le{constructor(e){this._client=e}async getSymbols(){const e=await this._client.request("currency.getSymbols",{});if(!e.success||!e.symbols)throw new Error("Failed to fetch currency symbols");return e.symbols}async getRates(e){var t,s,n;const a=await this._client.request("currency.getRates",e);if(!a.success||!a.rates)throw((t=a.error)===null||t===void 0?void 0:t.code)===201?new Error(`Invalid base currency '${e.base}'`):((s=a.error)===null||s===void 0?void 0:s.code)===202?new Error(`Invalid target currency symbol '${e.symbols}'`):new Error(((n=a.error)===null||n===void 0?void 0:n.message)||"Failed to fetch currency rates");return a.rates}}class De{constructor(e){this._client=e}async discover(){const e=await this._client.request("mqtt.discover",{});if(!e.success)throw new Error("Failed to discover MQTT brokers");return e.brokers}async connect(e,t){const s=await this._client.request("mqtt.connect",{brokerUrl:e,...t});if(!s.success)throw new Error("Failed to connect to MQTT broker");return s.clientId}async disconnect(e){if(!(await this._client.request("mqtt.disconnect",{clientId:e})).success)throw new Error("Failed to disconnect from MQTT broker")}async publish(e,t,s,n){if(!(await this._client.request("mqtt.publish",{clientId:e,topic:t,payload:s,...n})).success)throw new Error("Failed to publish MQTT message")}async subscribe(e,t,s,n){return(await this._client.subscribe("mqtt.subscribe",{clientId:e,topic:t,...n},s)).success}async unsubscribe(e,t,s){return(await this._client.unsubscribe("mqtt.unsubscribe",{clientId:e,topic:t},s)).success}async getConnectionStatus(e){const t=await this._client.request("mqtt.getConnectionStatus",{clientId:e});if(!t.success)throw new Error("Failed to get MQTT connection status");return t.status}async subscribeConnectionStatus(e,t){return(await this._client.subscribe("mqtt.subscribeConnectionStatus",{clientId:e},t)).success}async unsubscribeConnectionStatus(e,t){return(await this._client.unsubscribe("mqtt.unsubscribeConnectionStatus",{clientId:e},t)).success}}class Ge{constructor(e){this._originalPushState=null,this._originalReplaceState=null,this._popstateHandler=null,this._backHandler=null,this._forwardHandler=null,this._client=e}bind(){typeof window>"u"||this._originalPushState||(this._originalPushState=history.pushState.bind(history),history.pushState=(...e)=>{this._originalPushState(...e),this._sendLocationChanged()},this._originalReplaceState=history.replaceState.bind(history),history.replaceState=(...e)=>{this._originalReplaceState(...e),this._sendLocationChanged()},this._popstateHandler=()=>this._sendLocationChanged(),window.addEventListener("popstate",this._popstateHandler),this._backHandler=()=>history.back(),this._forwardHandler=()=>history.forward(),this._client.on("navigation.back",this._backHandler),this._client.on("navigation.forward",this._forwardHandler),this._sendLocationChanged())}unbind(){typeof window>"u"||(this._originalPushState&&(history.pushState=this._originalPushState,this._originalPushState=null),this._originalReplaceState&&(history.replaceState=this._originalReplaceState,this._originalReplaceState=null),this._popstateHandler&&(window.removeEventListener("popstate",this._popstateHandler),this._popstateHandler=null),this._backHandler&&(this._client.off("navigation.back",this._backHandler),this._backHandler=null),this._forwardHandler&&(this._client.off("navigation.forward",this._forwardHandler),this._forwardHandler=null))}_sendLocationChanged(){this._client.send("navigation.locationChanged",{pathname:window.location.pathname})}}var b;(function(i){i.assertEqual=n=>{};function e(n){}i.assertIs=e;function t(n){throw new Error}i.assertNever=t,i.arrayToEnum=n=>{const a={};for(const r of n)a[r]=r;return a},i.getValidEnumValues=n=>{const a=i.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),r={};for(const o of a)r[o]=n[o];return i.objectValues(r)},i.objectValues=n=>i.objectKeys(n).map(function(a){return n[a]}),i.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&a.push(r);return a},i.find=(n,a)=>{for(const r of n)if(a(r))return r},i.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(r=>typeof r=="string"?`'${r}'`:r).join(a)}i.joinValues=s,i.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var _e;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(_e||(_e={}));const l=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=i=>{switch(typeof i){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(i)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(i)?l.array:i===null?l.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?l.promise:typeof Map<"u"&&i instanceof Map?l.map:typeof Set<"u"&&i instanceof Set?l.set:typeof Date<"u"&&i instanceof Date?l.date:l.object;default:return l.unknown}},u=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const r of a.issues)if(r.code==="invalid_union")r.unionErrors.map(n);else if(r.code==="invalid_return_type")n(r.returnTypeError);else if(r.code==="invalid_arguments")n(r.argumentsError);else if(r.path.length===0)s._errors.push(t(r));else{let o=s,c=0;for(;c<r.path.length;){const h=r.path[c];c===r.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(t(r))):o[h]=o[h]||{_errors:[]},o=o[h],c++}}};return n(this),s}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Z.create=i=>new Z(i);const oe=(i,e)=>{let t;switch(i.code){case u.invalid_type:i.received===l.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,b.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(i.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(i.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(i.options)}, received '${i.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:b.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case u.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="bigint"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case u.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(i)}return{message:t}};let Qe=oe;function Ye(){return Qe}const Xe=i=>{const{data:e,path:t,errorMaps:s,issueData:n}=i,a=[...t,...n.path||[]],r={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(h=>!!h).slice().reverse();for(const h of c)o=h(r,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function d(i,e){const t=Ye(),s=Xe({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===oe?void 0:oe].filter(n=>!!n)});i.common.issues.push(s)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return g;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,r=await n.value;s.push({key:a,value:r})}return S.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:r}=n;if(a.status==="aborted"||r.status==="aborted")return g;a.status==="dirty"&&e.dirty(),r.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof r.value<"u"||n.alwaysSet)&&(s[a.value]=r.value)}return{status:e.value,value:s}}}const g=Object.freeze({status:"aborted"}),ce=i=>({status:"dirty",value:i}),C=i=>({status:"valid",value:i}),ye=i=>i.status==="aborted",ve=i=>i.status==="dirty",L=i=>i.status==="valid",ee=i=>typeof Promise<"u"&&i instanceof Promise;var p;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class j{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const be=(i,e)=>{if(L(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Z(i.common.issues);return this._error=t,this._error}}};function y(i){if(!i)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=i;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,r)=>{const{message:o}=i;return a.code==="invalid_enum_value"?{message:o??r.defaultError}:typeof r.data>"u"?{message:o??s??r.defaultError}:a.code!=="invalid_type"?{message:r.defaultError}:{message:o??t??r.defaultError}},description:n}}class v{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ee(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var t,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return L(a)?{value:a.value}:{issues:n.common.issues}}catch(a){(s=(t=a==null?void 0:a.message)==null?void 0:t.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>L(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ee(n)?n:Promise.resolve(n));return be(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const r=e(n),o=()=>a.addIssue({code:u.custom,...s(n)});return typeof Promise<"u"&&r instanceof Promise?r.then(c=>c?!0:(o(),!1)):r?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new H({schema:this,typeName:f.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return ie.create(this,this._def)}or(e){return se.create([this,e],this._def)}and(e){return ne.create(this,e,this._def)}transform(e){return new H({...y(this._def),schema:this,typeName:f.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new he({...y(this._def),innerType:this,defaultValue:t,typeName:f.ZodDefault})}brand(){return new kt({typeName:f.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new pe({...y(this._def),innerType:this,catchValue:t,typeName:f.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fe.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const et=/^c[^\s-]{8,}$/i,tt=/^[0-9a-z]+$/,st=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,it=/^[a-z0-9_-]{21}$/i,rt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,at=/^[-+]?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)?)??$/,ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ct="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ae;const ut=/^(?:(?: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])$/,dt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,lt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ht=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,He="((\\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])))",ft=new RegExp(`^${He}$`);function ze(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);const t=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function gt(i){return new RegExp(`^${ze(i)}$`)}function _t(i){let e=`${He}T${ze(i)}`;const t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function yt(i,e){return!!((e==="v4"||!e)&&ut.test(i)||(e==="v6"||!e)&&lt.test(i))}function vt(i,e){if(!rt.test(i))return!1;try{const[t]=i.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function bt(i,e){return!!((e==="v4"||!e)&&dt.test(i)||(e==="v6"||!e)&&ht.test(i))}class I extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.string,received:n.parsedType}),g}const t=new S;let s;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const a=e.data.length>n.value,r=e.data.length<n.value;(a||r)&&(s=this._getOrReturnCtx(e,s),a?d(s,{code:u.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&d(s,{code:u.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"email",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")ae||(ae=new RegExp(ct,"u")),ae.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"emoji",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")nt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"uuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="nanoid")it.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"nanoid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")et.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cuid2",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ulid",code:u.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),d(s,{validation:"url",code:u.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"regex",code:u.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?_t(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="date"?ft.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"date",message:n.message}),t.dirty()):n.kind==="time"?gt(n).test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:u.invalid_string,validation:"time",message:n.message}),t.dirty()):n.kind==="duration"?at.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"duration",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="ip"?yt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"ip",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="jwt"?vt(e.data,n.alg)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"jwt",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="cidr"?bt(e.data,n.version)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"cidr",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64"?pt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64",code:u.invalid_string,message:n.message}),t.dirty()):n.kind==="base64url"?mt.test(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{validation:"base64url",code:u.invalid_string,message:n.message}),t.dirty()):b.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...p.errToObj(s)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}I.create=i=>new I({checks:[],typeName:f.ZodString,coerce:(i==null?void 0:i.coerce)??!1,...y(i)});function wt(i,e){const t=(i.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(i.toFixed(n).replace(".","")),r=Number.parseInt(e.toFixed(n).replace(".",""));return a%r/10**n}class J extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.number,received:n.parsedType}),g}let t;const s=new S;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?wt(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_finite,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}J.create=i=>new J({checks:[],typeName:f.ZodNumber,coerce:(i==null?void 0:i.coerce)||!1,...y(i)});class G extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==l.bigint)return this._getInvalidInput(e);let t;const s=new S;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),d(t,{code:u.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):b.assertNever(n);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}G.create=i=>new G({checks:[],typeName:f.ZodBigInt,coerce:(i==null?void 0:i.coerce)??!1,...y(i)});class we extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.boolean,received:t.parsedType}),g}return C(e.data)}}we.create=i=>new we({typeName:f.ZodBoolean,coerce:(i==null?void 0:i.coerce)||!1,...y(i)});class te extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_type,expected:l.date,received:n.parsedType}),g}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return d(n,{code:u.invalid_date}),g}const t=new S;let s;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),d(s,{code:u.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):b.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}te.create=i=>new te({checks:[],coerce:(i==null?void 0:i.coerce)||!1,typeName:f.ZodDate,...y(i)});class ke extends v{_parse(e){if(this._getType(e)!==l.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.symbol,received:t.parsedType}),g}return C(e.data)}}ke.create=i=>new ke({typeName:f.ZodSymbol,...y(i)});class xe extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.undefined,received:t.parsedType}),g}return C(e.data)}}xe.create=i=>new xe({typeName:f.ZodUndefined,...y(i)});class Se extends v{_parse(e){if(this._getType(e)!==l.null){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.null,received:t.parsedType}),g}return C(e.data)}}Se.create=i=>new Se({typeName:f.ZodNull,...y(i)});class ue extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}ue.create=i=>new ue({typeName:f.ZodAny,...y(i)});class Ce extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}Ce.create=i=>new Ce({typeName:f.ZodUnknown,...y(i)});class P extends v{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.never,received:t.parsedType}),g}}P.create=i=>new P({typeName:f.ZodNever,...y(i)});class Te extends v{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.void,received:t.parsedType}),g}return C(e.data)}}Te.create=i=>new Te({typeName:f.ZodVoid,...y(i)});class N extends v{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:u.invalid_type,expected:l.array,received:t.parsedType}),g;if(n.exactLength!==null){const r=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(r||o)&&(d(t,{code:r?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:r?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((r,o)=>n.type._parseAsync(new j(t,r,t.path,o)))).then(r=>S.mergeArray(s,r));const a=[...t.data].map((r,o)=>n.type._parseSync(new j(t,r,t.path,o)));return S.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(i,e)=>new N({type:i,minLength:null,maxLength:null,exactLength:null,typeName:f.ZodArray,...y(e)});function M(i){if(i instanceof k){const e={};for(const t in i.shape){const s=i.shape[t];e[t]=E.create(M(s))}return new k({...i._def,shape:()=>e})}else return i instanceof N?new N({...i._def,type:M(i.element)}):i instanceof E?E.create(M(i.unwrap())):i instanceof z?z.create(M(i.unwrap())):i instanceof q?q.create(i.items.map(e=>M(e))):i}class k extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const c=this._getOrReturnCtx(e);return d(c,{code:u.invalid_type,expected:l.object,received:c.parsedType}),g}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const c in s.data)a.includes(c)||r.push(c);const o=[];for(const c of a){const h=n[c],_=s.data[c];o.push({key:{status:"valid",value:c},value:h._parse(new j(s,_,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof P){const c=this._def.unknownKeys;if(c==="passthrough")for(const h of r)o.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(c==="strict")r.length>0&&(d(s,{code:u.unrecognized_keys,keys:r}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const h of r){const _=s.data[h];o.push({key:{status:"valid",value:h},value:c._parse(new j(s,_,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const h of o){const _=await h.key,w=await h.value;c.push({key:_,value:w,alwaysSet:h.alwaysSet})}return c}).then(c=>S.mergeObjectSync(t,c)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a;const r=((a=(n=this._def).errorMap)==null?void 0:a.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:f.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};for(const s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new k({...this._def,shape:()=>t})}omit(e){const t={};for(const s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new k({...this._def,shape:()=>t})}deepPartial(){return M(this)}partial(e){const t={};for(const s of b.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new k({...this._def,shape:()=>t})}required(e){const t={};for(const s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof E;)n=n._def.innerType;t[s]=n}return new k({...this._def,shape:()=>t})}keyof(){return Ve(b.objectKeys(this.shape))}}k.create=(i,e)=>new k({shape:()=>i,unknownKeys:"strip",catchall:P.create(),typeName:f.ZodObject,...y(e)});k.strictCreate=(i,e)=>new k({shape:()=>i,unknownKeys:"strict",catchall:P.create(),typeName:f.ZodObject,...y(e)});k.lazycreate=(i,e)=>new k({shape:i,unknownKeys:"strip",catchall:P.create(),typeName:f.ZodObject,...y(e)});class se extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const r=a.map(o=>new Z(o.ctx.common.issues));return d(t,{code:u.invalid_union,unionErrors:r}),g}if(t.common.async)return Promise.all(s.map(async a=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(n);{let a;const r=[];for(const c of s){const h={...t,common:{...t.common,issues:[]},parent:null},_=c._parseSync({data:t.data,path:t.path,parent:h});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:h}),h.common.issues.length&&r.push(h.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=r.map(c=>new Z(c));return d(t,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}se.create=(i,e)=>new se({options:i,typeName:f.ZodUnion,...y(e)});function de(i,e){const t=A(i),s=A(e);if(i===e)return{valid:!0,data:i};if(t===l.object&&s===l.object){const n=b.objectKeys(e),a=b.objectKeys(i).filter(o=>n.indexOf(o)!==-1),r={...i,...e};for(const o of a){const c=de(i[o],e[o]);if(!c.valid)return{valid:!1};r[o]=c.data}return{valid:!0,data:r}}else if(t===l.array&&s===l.array){if(i.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<i.length;a++){const r=i[a],o=e[a],c=de(r,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===l.date&&s===l.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}class ne extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,r)=>{if(ye(a)||ye(r))return g;const o=de(a.value,r.value);return o.valid?((ve(a)||ve(r))&&t.dirty(),{status:t.value,value:o.data}):(d(s,{code:u.invalid_intersection_types}),g)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,r])=>n(a,r)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ne.create=(i,e,t)=>new ne({left:i,right:e,typeName:f.ZodIntersection,...y(t)});class q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.array)return d(s,{code:u.invalid_type,expected:l.array,received:s.parsedType}),g;if(s.data.length<this._def.items.length)return d(s,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((a,r)=>{const o=this._def.items[r]||this._def.rest;return o?o._parse(new j(s,a,s.path,r)):null}).filter(a=>!!a);return s.common.async?Promise.all(n).then(a=>S.mergeArray(t,a)):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new q({...this._def,rest:e})}}q.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q({items:i,typeName:f.ZodTuple,rest:null,...y(e)})};class Ne extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.map)return d(s,{code:u.invalid_type,expected:l.map,received:s.parsedType}),g;const n=this._def.keyType,a=this._def.valueType,r=[...s.data.entries()].map(([o,c],h)=>({key:n._parse(new j(s,o,s.path,[h,"key"])),value:a._parse(new j(s,c,s.path,[h,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of r){const h=await c.key,_=await c.value;if(h.status==="aborted"||_.status==="aborted")return g;(h.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(h.value,_.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of r){const h=c.key,_=c.value;if(h.status==="aborted"||_.status==="aborted")return g;(h.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(h.value,_.value)}return{status:t.value,value:o}}}}Ne.create=(i,e,t)=>new Ne({valueType:e,keyType:i,typeName:f.ZodMap,...y(t)});class Q extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.set)return d(s,{code:u.invalid_type,expected:l.set,received:s.parsedType}),g;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function r(c){const h=new Set;for(const _ of c){if(_.status==="aborted")return g;_.status==="dirty"&&t.dirty(),h.add(_.value)}return{status:t.value,value:h}}const o=[...s.data.values()].map((c,h)=>a._parse(new j(s,c,s.path,h)));return s.common.async?Promise.all(o).then(c=>r(c)):r(o)}min(e,t){return new Q({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new Q({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Q.create=(i,e)=>new Q({valueType:i,minSize:null,maxSize:null,typeName:f.ZodSet,...y(e)});class Ze extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ze.create=(i,e)=>new Ze({getter:i,typeName:f.ZodLazy,...y(e)});class le extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}le.create=(i,e)=>new le({value:i,typeName:f.ZodLiteral,...y(e)});function Ve(i,e){return new D({values:i,typeName:f.ZodEnum,...y(e)})}class D extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:b.joinValues(s),received:t.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:u.invalid_enum_value,options:s}),g}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return D.create(e,{...this._def,...t})}exclude(e,t=this._def){return D.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}D.create=Ve;class Oe extends v{_parse(e){const t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==l.string&&s.parsedType!==l.number){const n=b.objectValues(t);return d(s,{expected:b.joinValues(n),received:s.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=b.objectValues(t);return d(s,{received:s.data,code:u.invalid_enum_value,options:n}),g}return C(e.data)}get enum(){return this._def.values}}Oe.create=(i,e)=>new Oe({values:i,typeName:f.ZodNativeEnum,...y(e)});class ie extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:u.invalid_type,expected:l.promise,received:t.parsedType}),g;const s=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return C(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ie.create=(i,e)=>new ie({type:i,typeName:f.ZodPromise,...y(e)});class H extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===f.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:r=>{d(s,r),r.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const r=n.transform(s.data,a);if(s.common.async)return Promise.resolve(r).then(async o=>{if(t.value==="aborted")return g;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:r,path:s.path,parent:s});return o.status==="aborted"?g:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(n.type==="refinement"){const r=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),r(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),r(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!L(r))return g;const o=n.transform(r.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(r=>L(r)?Promise.resolve(n.transform(r.value,a)).then(o=>({status:t.value,value:o})):g);b.assertNever(n)}}H.create=(i,e,t)=>new H({schema:i,typeName:f.ZodEffects,effect:e,...y(t)});H.createWithPreprocess=(i,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:i},typeName:f.ZodEffects,...y(t)});class E extends v{_parse(e){return this._getType(e)===l.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(i,e)=>new E({innerType:i,typeName:f.ZodOptional,...y(e)});class z extends v{_parse(e){return this._getType(e)===l.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(i,e)=>new z({innerType:i,typeName:f.ZodNullable,...y(e)});class he extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===l.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}he.create=(i,e)=>new he({innerType:i,typeName:f.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class pe extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ee(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Z(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}pe.create=(i,e)=>new pe({innerType:i,typeName:f.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Ae extends v{_parse(e){if(this._getType(e)!==l.nan){const t=this._getOrReturnCtx(e);return d(t,{code:u.invalid_type,expected:l.nan,received:t.parsedType}),g}return{status:"valid",value:e.data}}}Ae.create=i=>new Ae({typeName:f.ZodNaN,...y(i)});class kt extends v{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class fe extends v{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?g:n.status==="dirty"?(t.dirty(),ce(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?g:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new fe({in:e,out:t,typeName:f.ZodPipeline})}}class me extends v{_parse(e){const t=this._def.innerType._parse(e),s=n=>(L(n)&&(n.value=Object.freeze(n.value)),n);return ee(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}me.create=(i,e)=>new me({innerType:i,typeName:f.ZodReadonly,...y(e)});var f;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(f||(f={}));const O=I.create,Be=ue.create;P.create;N.create;const Ue=k.create;se.create;ne.create;q.create;const Ke=le.create;D.create;ie.create;E.create;z.create;const xt=Ue({type:Ke("bridge"),name:O(),data:Be()});Ue({type:Ke("client"),telemetrySdkVersion:O(),applicationSpecifier:O(),applicationInstance:O(),name:O(),data:Be(),responseName:O().optional(),subscriptionName:O().optional(),unsubscribeName:O().optional()});function Y(i){return{...i,type:"client"}}class St{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){var t;const s=this._store.shared("root-settings-navigation"),n=(t=await s.get("navigation"))!==null&&t!==void 0?t:{},a=this._store._client._applicationSpecifier;n[a]={applicationSpecifier:a,entries:e.entries},s.set("navigation",n)}async getRootSettingsNavigation(){var e;const t=(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{},s=this._store._client._applicationSpecifier;return t[s]}async getAllRootSettingsNavigation(){var e;return(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{}}}const V=1e3*30,ge=typeof window>"u"&&typeof self<"u",K=ge?self:window;function B(i){ge?self.postMessage(i):K.parent.postMessage(i,"*")}class Ct{constructor(){this._applicationInstance="",this._applicationSpecifier="",this._deviceId="",this._navigation=new Ge(this),this._messageInterceptors=new Map,this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new Ie(this)}get users(){return new qe(this)}get store(){return new Fe(this)}get applications(){return new Ee(this)}get media(){return new Re(this)}get proxy(){return new $e(this)}get devices(){return new je(this)}get rootSettingsNavigation(){return new St(this.store)}get weather(){return new Me(this)}get currency(){return new Le(this)}get environment(){return new Pe(this)}get mqtt(){return new De(this)}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}get deviceId(){return this._deviceId}bind(){var e,t;const s=new URL(K.location.href),n=s.searchParams;this._applicationInstance=n.get("applicationInstance")||"single",this._deviceId=n.get("deviceId")||this._applicationInstance;const a=/^[a-z0-9-]{40}$/i;if(this._applicationSpecifier=(e=n.get("applicationSpecifier"))!==null&&e!==void 0?e:"",!this._applicationSpecifier||!a.test(this._applicationSpecifier)){const r=s.hostname.split(".");this._applicationSpecifier=(t=r[0])!==null&&t!==void 0?t:""}if(!this._applicationSpecifier||!a.test(this._applicationSpecifier))throw console.error("TelemetryOS apps require an applicationSpecifier in the URL query parameters or subdomain. Make sure your app is being served correctly through the TelemetryOS platform or development environment."),new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);this._windowMessageHandler=r=>{if(r.source===K||!r.data||typeof r.data!="object"||!("type"in r.data)||r.data.type!=="client"&&r.data.type!=="bridge")return;let o;if(r.data.type==="client"){const c=this._messageInterceptors.get(r.data.name);if(!c){B(r.data);return}o={...c(r.data.data),type:"bridge",...r.data.responseName?{name:r.data.responseName}:{}}}if(!o){const c=xt.safeParse(r.data);if(!c.success){const w=r.data;w&&typeof w=="object"&&w.type==="bridge"&&console.warn("[sdk-client] Received a message that looks like a bridge message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.",c.error.issues);return}o=c.data;const h=this._onHandlers.get(o.name),_=this._onceHandlers.get(o.name);if(h)for(const w of h)w(o.data);if(_){for(const w of _)w(o.data);this._onceHandlers.delete(o.name)}}if(!ge)for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(o,"*")},K.addEventListener("message",this._windowMessageHandler),this._navigation.bind()}unbind(){this._windowMessageHandler&&(this._navigation.unbind(),K.removeEventListener("message",this._windowMessageHandler))}send(e,t){const s=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});B(s)}request(e,t,s){var n;const a=X(),r=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:a});B(r);const o=(n=s==null?void 0:s.timeout)!==null&&n!==void 0?n:V;let c=!1,h;const _=new Promise(T=>{h=R=>{c||T(R)},this.once(a,h)});if(o===0)return _;const w=new Promise((T,R)=>{const $=new Error(`${e} message request with response name of ${a} timed out after ${o}`);setTimeout(()=>{c=!0,this.off(a,h),R($)},o)});return Promise.race([w,_])}async subscribe(e,t,s){let n,a;typeof t=="function"?a=t:(n=t,a=s);const r=X(),o=X();let c=this._subscriptionNamesBySubjectName.get(e);c||(c=[],this._subscriptionNamesBySubjectName.set(e,c)),c.push(r),this._subscriptionNamesByHandler.set(a,r),this.on(r,a);const h=Y({telemetrySdkVersion:W,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:n,responseName:o,subscriptionName:r});B(h);let _=!1,w;const T=new Promise(($,F)=>{const re=new Error(`${e} subscribe request with subscription name of ${r} and response name of ${o} timed out after ${V}`);setTimeout(()=>{_=!0,this.off(o,w),F(re)},V)}),R=new Promise($=>{w=F=>{_||$(F)},this.once(o,w)});return Promise.race([T,R])}async unsubscribe(e,t,s){let n,a;typeof t=="function"?a=t:(n=t,a=s);const r=X();let o=[];if(a){const c=this._subscriptionNamesByHandler.get(a);if(!c)return{success:!1};o=[c],this._subscriptionNamesByHandler.delete(a)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const c of o){this.off(c,a);const h=Y({telemetrySdkVersion:W,applicationInstance:this._applicationInstance,applicationSpecifier:this._applicationSpecifier,name:e,data:n,responseName:r,unsubscribeName:c});B(h);let _=!1,w;const T=new Promise(($,F)=>{const re=new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${r} timed out after ${V}`);setTimeout(()=>{_=!0,this.off(r,w),F(re)},V)}),R=new Promise($=>{w=F=>{_||$(F)},this.once(r,w)});if(!(await Promise.race([T,R])).success)return{success:!1}}return{success:!0}}on(e,t){var s;const n=(s=this._onHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onHandlers.set(e,n),n.push(t)}once(e,t){var s;const n=(s=this._onceHandlers.get(e))!==null&&s!==void 0?s:[];n.length===0&&this._onceHandlers.set(e,n),n.push(t)}off(e,t){const s=this._onHandlers.get(e),n=this._onceHandlers.get(e);if(!(!s&&!n)){if(s){for(let a=0;a<s.length;a+=1)t&&s[a]!==t||(s.splice(a,1),a-=1);s.length===0&&this._onHandlers.delete(e)}if(n){for(let a=0;a<n.length;a+=1)t&&n[a]!==t||(n.splice(a,1),a-=1);n.length===0&&this._onceHandlers.delete(e)}}}}function X(){return Math.random().toString(36).slice(2,9)}const W=Je.version;class Tt{constructor(e){this._client=e}async setOverride(e){if(!(await this._client.request("overrides.setOverride",{name:e})).success)throw new Error("Failed to set override");return!0}async clearOverride(e){if(!(await this._client.request("overrides.clearOverride",{name:e})).success)throw new Error("Failed to clear override");return!0}}class Nt{constructor(e){this._client=e}async nextPage(){if(!(await this._client.request("playlist.nextPage",{})).success)throw new Error("Failed to advance to next page");return!0}async previousPage(){if(!(await this._client.request("playlist.previousPage",{})).success)throw new Error("Failed to return to previous page");return!0}async setDuration(e){if(!(await this._client.request("playlist.setDuration",{duration:e})).success)throw new Error("Failed to set page duration");return!0}async getDuration(){const e=await this._client.request("playlist.getDuration",{});if(!e.success)throw new Error("Failed to get page duration");return{success:!0,duration:e.duration}}}class Zt extends Ct{get playlist(){return new Nt(this)}get overrides(){return new Tt(this)}}let m=null;function Ot(){return m}function At(i){m=new Zt,m.bind()}function It(){m==null||m.unbind(),m=null}function Et(...i){return x(m),m.on(...i)}function jt(...i){return x(m),m.once(...i)}function Pt(...i){return x(m),m.off(...i)}function Rt(...i){return x(m),m.send(...i)}function $t(...i){return x(m),m.request(...i)}function Ft(...i){return x(m),m.subscribe(...i)}function qt(...i){return x(m),m.unsubscribe(...i)}function Mt(){return x(m),m.store}function Lt(){return x(m),m.applications}function Dt(){return x(m),m.media}function Ht(){return x(m),m.accounts}function zt(){return x(m),m.users}function Vt(){return x(m),m.devices}function Bt(){return x(m),m.proxy}function Ut(){return x(m),m.weather}function Kt(){return x(m),m.currency}function Wt(){return x(m),m.environment}function Jt(){return x(m),m.playlist}function Gt(){return x(m),m.overrides}function Qt(){return x(m),m.mqtt}function x(i){if(!i)throw new Error("SDK is not configured")}exports.Accounts=Ie;exports.Applications=Ee;exports.Currency=Le;exports.Devices=je;exports.Environment=Pe;exports.Media=Re;exports.Mqtt=De;exports.Proxy=$e;exports.Store=Fe;exports.StoreSlice=U;exports.Users=qe;exports.Weather=Me;exports.accounts=Ht;exports.applications=Lt;exports.configure=At;exports.currency=Kt;exports.destroy=It;exports.devices=Vt;exports.environment=Wt;exports.globalClient=Ot;exports.media=Dt;exports.mqtt=Qt;exports.off=Pt;exports.on=Et;exports.once=jt;exports.overrides=Gt;exports.playlist=Jt;exports.proxy=Bt;exports.request=$t;exports.send=Rt;exports.store=Mt;exports.subscribe=Ft;exports.telemetrySdkVersion=W;exports.unsubscribe=qt;exports.users=zt;exports.weather=Ut;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const Fe = "1.14.0", qe = {
1
+ const Fe = "1.15.0", qe = {
2
2
  version: Fe
3
3
  };
4
4
  class Me {
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ interface SettingsSectionProps {
3
+ /** Section heading text. */
4
+ title: string;
5
+ /** Whether the section starts expanded. Defaults to true. */
6
+ defaultOpen?: boolean;
7
+ children: ReactNode;
8
+ }
9
+ /**
10
+ * Collapsible settings section with animated open/close.
11
+ *
12
+ * Manages its own open/closed state internally — the parent only provides
13
+ * a title and optional defaultOpen flag.
14
+ *
15
+ * Use this to group related settings controls under a heading.
16
+ * When adding a new logical group of settings, always wrap them
17
+ * in a SettingsSection so users can collapse sections they don't need.
18
+ */
19
+ export declare function SettingsSection({ title, defaultOpen, children }: SettingsSectionProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -1,4 +1,5 @@
1
1
  export { SettingsBox, SettingsButtonFrame, SettingsCheckboxFrame, SettingsCheckboxLabel, SettingsColorFrame, SettingsContainer, SettingsDivider, SettingsError, SettingsField, SettingsHeading, SettingsHint, SettingsInputFrame, SettingsLabel, SettingsRadioFrame, SettingsRadioLabel, SettingsSelectFrame, SettingsSliderFrame, SettingsSliderRuler, SettingsSwitchFrame, SettingsSwitchLabel, SettingsTextAreaFrame, } from './Settings.js';
2
2
  export { SettingsMediaSelect, type MediaSelection } from './SettingsMediaSelect.js';
3
+ export { SettingsSection } from './SettingsSection.js';
3
4
  export { useStoreState, createUseStoreState, createUseInstanceStoreState, createUseApplicationStoreState, createUseDeviceStoreState, createUseSharedStoreState, createUseDynamicNamespaceStoreState, } from './hooks/store.js';
4
5
  export { useUiScaleToSetRem, useUiAspectRatio, useUiResponsiveFactors } from './hooks/ui-scale.js';
package/dist/react.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),b=require("./index.cjs");var O={exports:{}},R={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),x=require("./index.cjs");var O={exports:{}},j={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var J;function oe(){if(J)return R;J=1;var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(i,a,u){var g=null;if(u!==void 0&&(g=""+u),a.key!==void 0&&(g=""+a.key),"key"in a){u={};for(var p in a)p!=="key"&&(u[p]=a[p])}else u=a;return a=u.ref,{$$typeof:n,type:i,key:g,ref:a!==void 0?a:null,props:u}}return R.Fragment=s,R.jsx=o,R.jsxs=o,R}var j={};/**
9
+ */var q;function oe(){if(q)return j;q=1;var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function i(o,a,c){var p=null;if(c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),"key"in a){c={};for(var f in a)f!=="key"&&(c[f]=a[f])}else c=a;return a=c.ref,{$$typeof:n,type:o,key:p,ref:a!==void 0?a:null,props:c}}return j.Fragment=s,j.jsx=i,j.jsxs=i,j}var R={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,12 +14,12 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var q;function ie(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case N:return"Profiler";case _:return"StrictMode";case Z:return"Suspense";case K:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case P:return"Portal";case X:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case Q:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case F:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function s(e){return""+e}function o(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var c=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),s(e)}}function i(e){if(e===E)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===F)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=L.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function g(e){if(M.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function p(e,r){function c(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function k(){var e=n(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function m(e,r,c,d,A,I){var f=c.ref;return e={$$typeof:T,type:e,key:r,props:c,_owner:d},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:k}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,r,c,d,A,I){var f=r.children;if(f!==void 0)if(d)if(re(f)){for(d=0;d<f.length;d++)h(f[d]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(f);if(M.call(r,"key")){f=n(e);var y=Object.keys(r).filter(function(se){return se!=="key"});d=0<y.length?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}",V[f+d]||(y=0<y.length?"{"+y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var B;function ie(){return B||(B=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case N:return"Profiler";case _:return"StrictMode";case Z:return"Suspense";case K:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case P:return"Portal";case X:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case Q:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case F:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function s(e){return""+e}function i(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var l=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),s(e)}}function o(e){if(e===E)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===F)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=L.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function p(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function f(e,r){function l(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function k(){var e=n(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function m(e,r,l,d,A,U){var g=l.ref;return e={$$typeof:T,type:e,key:r,props:l,_owner:d},(g!==void 0?g:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:k}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,r,l,d,A,U){var g=r.children;if(g!==void 0)if(d)if(re(g)){for(d=0;d<g.length;d++)h(g[d]);Object.freeze&&Object.freeze(g)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(g);if($.call(r,"key")){g=n(e);var y=Object.keys(r).filter(function(se){return se!=="key"});d=0<y.length?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}",J[g+d]||(y=0<y.length?"{"+y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,d,f,y,f),V[f+d]=!0)}if(f=null,c!==void 0&&(o(c),f=""+c),g(r)&&(o(r.key),f=""+r.key),"key"in r){c={};for(var z in r)z!=="key"&&(c[z]=r[z])}else c=r;return f&&p(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,f,c,a(),A,I)}function h(e){v(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===F&&(e._payload.status==="fulfilled"?v(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function v(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var S=l,T=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),X=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),L=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,re=Array.isArray,U=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(e){return e()}};var D,Y={},$=S.react_stack_bottom_frame.bind(S,u)(),W=U(i(u)),V={};j.Fragment=E,j.jsx=function(e,r,c){var d=1e4>L.recentlyCreatedOwnerStacks++;return w(e,r,c,!1,d?Error("react-stack-top-frame"):$,d?U(i(e)):W)},j.jsxs=function(e,r,c){var d=1e4>L.recentlyCreatedOwnerStacks++;return w(e,r,c,!0,d?Error("react-stack-top-frame"):$,d?U(i(e)):W)}})()),j}var B;function ae(){return B||(B=1,process.env.NODE_ENV==="production"?O.exports=oe():O.exports=ie()),O.exports}var t=ae();const ce=`:root {
22
+ <%s key={someKey} {...props} />`,d,g,y,g),J[g+d]=!0)}if(g=null,l!==void 0&&(i(l),g=""+l),p(r)&&(i(r.key),g=""+r.key),"key"in r){l={};for(var z in r)z!=="key"&&(l[z]=r[z])}else l=r;return g&&f(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,g,l,a(),A,U)}function h(e){v(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===F&&(e._payload.status==="fulfilled"?v(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function v(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var S=u,T=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),X=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),L=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,re=Array.isArray,I=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(e){return e()}};var D,Y={},W=S.react_stack_bottom_frame.bind(S,c)(),V=I(o(c)),J={};R.Fragment=E,R.jsx=function(e,r,l){var d=1e4>L.recentlyCreatedOwnerStacks++;return w(e,r,l,!1,d?Error("react-stack-top-frame"):W,d?I(o(e)):V)},R.jsxs=function(e,r,l){var d=1e4>L.recentlyCreatedOwnerStacks++;return w(e,r,l,!0,d?Error("react-stack-top-frame"):W,d?I(o(e)):V)}})()),R}var H;function ae(){return H||(H=1,process.env.NODE_ENV==="production"?O.exports=oe():O.exports=ie()),O.exports}var t=ae();const ce=`:root {
23
23
  --background: 0 0% 100%;
24
24
  --foreground: 222.2 84% 4.9%;
25
25
 
@@ -565,4 +565,74 @@ React keys must be passed directly to JSX without using spread:
565
565
  }
566
566
 
567
567
  /* Note: Modal styles are defined in Studio-UI where the picker modal is rendered */
568
- `;let H=!1;function G(){if(H||typeof document>"u")return;const n=document.createElement("style");n.setAttribute("data-telemetryos-sdk",""),n.textContent=ce,document.head.appendChild(n),H=!0}G();function le({children:n}){const s=()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),i=g=>{let p;g==="system"?p=o.matches:p=g!=="light",p?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},a=b.environment().subscribeColorScheme(i);a.catch(console.error);const u=()=>{b.environment().getColorScheme().then(i).catch(console.error)};return o.addEventListener("change",u),()=>{a.then(()=>b.environment().unsubscribeColorScheme(i)).catch(console.error),o.removeEventListener("change",u)}};return l.useEffect(s,[]),t.jsx("div",{className:"settings__container",children:n})}function ue({children:n}){return t.jsx("div",{className:"settings__box",children:n})}function de({children:n}){return t.jsx("div",{className:"settings__heading",children:n})}function fe(){return t.jsx("hr",{className:"settings__divider"})}function pe({children:n}){return t.jsx("label",{className:"settings__field",children:n})}function ge({children:n}){return t.jsx("div",{className:"settings__label",children:n})}function me({children:n}){return t.jsx("div",{className:"settings__hint",children:n})}function he({children:n}){return t.jsx("div",{className:"settings__error",children:n})}function _e({children:n}){return t.jsx("div",{className:"settings__input-frame",children:n})}function be({children:n}){return t.jsx("div",{className:"settings__textarea-frame",children:n})}function xe({children:n}){return t.jsx("div",{className:"settings__select-frame",children:n})}function ve({children:n}){return t.jsx("div",{className:"settings__slider-frame",children:n})}function Se({children:n}){return t.jsx("div",{className:"settings__slider-ruler",children:n})}function ye({children:n}){return t.jsx("div",{className:"settings__color-frame",children:n})}function ke({children:n}){return t.jsx("label",{className:"settings__switch-frame",children:n})}function we({children:n}){return t.jsx("span",{className:"settings__switch-label",children:n})}function Ee({children:n}){return t.jsx("label",{className:"settings__checkbox-frame",children:n})}function Re({children:n}){return t.jsx("span",{className:"settings__checkbox-label",children:n})}function je({children:n}){return t.jsx("label",{className:"settings__radio-frame",children:n})}function Te({children:n}){return t.jsx("span",{className:"settings__radio-label",children:n})}function Ne({children:n}){return t.jsx("div",{className:"settings__button-frame",children:n})}G();function Ce({value:n,onChange:s,disabled:o=!1,placeholder:i="Select media...",accept:a}){const[u,g]=l.useState(!1),p=async()=>{if(!(o||u)){g(!0);try{const m=await b.media().openPicker({accept:a,currentValue:n??void 0});m&&s(m)}catch(m){console.error("Failed to open media picker:",m)}finally{g(!1)}}},k=m=>{m.stopPropagation(),s(null)};return t.jsxs("div",{className:"settings__media-select",children:[t.jsx("button",{type:"button",className:`settings__media-select-trigger ${n?"settings__media-select-trigger--has-value":""}`,onClick:p,disabled:o||u,title:n?`${n.name} - Click to change`:i,children:n?t.jsx("img",{src:n.thumbnailUrl,alt:n.name,className:"settings__media-select-thumbnail"}):t.jsx("div",{className:"settings__media-select-thumbnail settings__media-select-thumbnail--empty",children:u?t.jsx(Pe,{}):t.jsx(Oe,{})})}),n&&!o&&t.jsx("button",{type:"button",className:"settings__media-select-clear",onClick:k,title:"Remove image",children:t.jsx(Ae,{})})]})}function Ae(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Oe(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}function Pe(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",opacity:"0.25"}),t.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round",children:t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"1s",repeatCount:"indefinite"})})]})}function x(n,s,o,i=0){var a;const[u,g]=l.useState(!0),p=l.useRef(!0),[k]=l.useState(o),[m,w]=l.useState(void 0),[h,v]=l.useState(void 0),S=l.useCallback(_=>{p.current?console.error("Cannot set store value while loading. Destructure and check the first element of the returned tuple."):v(_)},[]),T=()=>{g(!0),p.current=!0,w(void 0),v(void 0);const _=N=>{w(C=>JSON.stringify(C)===JSON.stringify(N)?C:N),g(!1),p.current=!1};return n.subscribe(s,_).catch(console.error),()=>{n.unsubscribe(s,_).catch(console.error)}};l.useEffect(T,[n,s]);const P=()=>{if(!p.current&&typeof h<"u"){const _=setTimeout(()=>{n.set(s,h)},i);return()=>clearTimeout(_)}};l.useEffect(P,[h,n,s,i]);const E=()=>{if(JSON.stringify(h)===JSON.stringify(m)){const _=setTimeout(()=>{v(void 0)},500);return()=>clearTimeout(_)}};return l.useEffect(E,[h,m]),[u,(a=h??m)!==null&&a!==void 0?a:k,S]}function Fe(n,s){return(o,i=0)=>x(o,n,s,i)}function Le(n,s){return(o=0)=>{const i=l.useMemo(()=>b.store().instance,[]);return x(i,n,s,o)}}function Ue(n,s){return(o=0)=>{const i=l.useMemo(()=>b.store().application,[]);return x(i,n,s,o)}}function Ie(n,s){return(o=0)=>{const i=l.useMemo(()=>b.store().device,[]);return x(i,n,s,o)}}function ze(n,s,o){return(i=0)=>{const a=l.useMemo(()=>b.store().shared(o),[o]);return x(a,n,s,i)}}function Me(n,s){return(o,i=0)=>{const a=l.useMemo(()=>b.store().shared(o),[o]);return x(a,n,s,i)}}function De(n){const s=()=>{document.documentElement.style.fontSize=`calc(1vmax * ${n})`};l.useEffect(s,[n])}function Ye(){const[n,s]=l.useState(()=>window.innerWidth/window.innerHeight),o=()=>{const i=()=>{s(window.innerWidth/window.innerHeight)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)};return l.useEffect(o,[]),n}function $e(n,s){return{uiWidthFactor:Math.min(s,1)/n,uiHeightFactor:Math.max(s,1)/n}}exports.SettingsBox=ue;exports.SettingsButtonFrame=Ne;exports.SettingsCheckboxFrame=Ee;exports.SettingsCheckboxLabel=Re;exports.SettingsColorFrame=ye;exports.SettingsContainer=le;exports.SettingsDivider=fe;exports.SettingsError=he;exports.SettingsField=pe;exports.SettingsHeading=de;exports.SettingsHint=me;exports.SettingsInputFrame=_e;exports.SettingsLabel=ge;exports.SettingsMediaSelect=Ce;exports.SettingsRadioFrame=je;exports.SettingsRadioLabel=Te;exports.SettingsSelectFrame=xe;exports.SettingsSliderFrame=ve;exports.SettingsSliderRuler=Se;exports.SettingsSwitchFrame=ke;exports.SettingsSwitchLabel=we;exports.SettingsTextAreaFrame=be;exports.createUseApplicationStoreState=Ue;exports.createUseDeviceStoreState=Ie;exports.createUseDynamicNamespaceStoreState=Me;exports.createUseInstanceStoreState=Le;exports.createUseSharedStoreState=ze;exports.createUseStoreState=Fe;exports.useStoreState=x;exports.useUiAspectRatio=Ye;exports.useUiResponsiveFactors=$e;exports.useUiScaleToSetRem=De;
568
+
569
+ /* =============================================================================
570
+ Sections (collapsible accordion)
571
+ ============================================================================= */
572
+
573
+ .settings__section {
574
+ border: 1px solid hsl(var(--border));
575
+ border-radius: var(--radius);
576
+ overflow: hidden;
577
+ }
578
+
579
+ .settings__section-header {
580
+ display: flex;
581
+ align-items: center;
582
+ width: 100%;
583
+ padding: 12px 16px;
584
+ background: hsl(var(--card));
585
+ border: none;
586
+ color: hsl(var(--foreground));
587
+ font-size: 14px;
588
+ font-weight: 600;
589
+ font-family: inherit;
590
+ cursor: pointer;
591
+ gap: 8px;
592
+ }
593
+
594
+ .settings__section-header:hover {
595
+ background: hsl(var(--accent));
596
+ }
597
+
598
+ .settings__section-arrow {
599
+ display: inline-block;
600
+ font-size: 10px;
601
+ color: hsl(var(--muted-foreground));
602
+ transition: transform 0.2s ease;
603
+ transform: rotate(0deg);
604
+ }
605
+
606
+ .settings__section-arrow--open {
607
+ transform: rotate(90deg);
608
+ }
609
+
610
+ .settings__section-title {
611
+ flex: 1;
612
+ text-align: left;
613
+ }
614
+
615
+ .settings__section-body {
616
+ display: grid;
617
+ grid-template-rows: 0fr;
618
+ transition: grid-template-rows 0.2s ease;
619
+ }
620
+
621
+ .settings__section-body--open {
622
+ grid-template-rows: 1fr;
623
+ }
624
+
625
+ .settings__section-content {
626
+ overflow: hidden;
627
+ min-height: 0;
628
+ display: flex;
629
+ flex-direction: column;
630
+ gap: 16px;
631
+ padding: 0 16px;
632
+ transition: padding 0.2s ease;
633
+ }
634
+
635
+ .settings__section-body--open .settings__section-content {
636
+ padding: 16px;
637
+ }
638
+ `;let G=!1;function M(){if(G||typeof document>"u")return;const n=document.createElement("style");n.setAttribute("data-telemetryos-sdk",""),n.textContent=ce,document.head.appendChild(n),G=!0}M();function le({children:n}){const s=()=>{const i=window.matchMedia("(prefers-color-scheme: dark)"),o=p=>{let f;p==="system"?f=i.matches:f=p!=="light",f?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},a=x.environment().subscribeColorScheme(o);a.catch(console.error);const c=()=>{x.environment().getColorScheme().then(o).catch(console.error)};return i.addEventListener("change",c),()=>{a.then(()=>x.environment().unsubscribeColorScheme(o)).catch(console.error),i.removeEventListener("change",c)}};return u.useEffect(s,[]),t.jsx("div",{className:"settings__container",children:n})}function ue({children:n}){return t.jsx("div",{className:"settings__box",children:n})}function de({children:n}){return t.jsx("div",{className:"settings__heading",children:n})}function ge(){return t.jsx("hr",{className:"settings__divider"})}function fe({children:n}){return t.jsx("label",{className:"settings__field",children:n})}function pe({children:n}){return t.jsx("div",{className:"settings__label",children:n})}function me({children:n}){return t.jsx("div",{className:"settings__hint",children:n})}function he({children:n}){return t.jsx("div",{className:"settings__error",children:n})}function _e({children:n}){return t.jsx("div",{className:"settings__input-frame",children:n})}function xe({children:n}){return t.jsx("div",{className:"settings__textarea-frame",children:n})}function be({children:n}){return t.jsx("div",{className:"settings__select-frame",children:n})}function ve({children:n}){return t.jsx("div",{className:"settings__slider-frame",children:n})}function Se({children:n}){return t.jsx("div",{className:"settings__slider-ruler",children:n})}function ye({children:n}){return t.jsx("div",{className:"settings__color-frame",children:n})}function ke({children:n}){return t.jsx("label",{className:"settings__switch-frame",children:n})}function we({children:n}){return t.jsx("span",{className:"settings__switch-label",children:n})}function Ee({children:n}){return t.jsx("label",{className:"settings__checkbox-frame",children:n})}function je({children:n}){return t.jsx("span",{className:"settings__checkbox-label",children:n})}function Re({children:n}){return t.jsx("label",{className:"settings__radio-frame",children:n})}function Te({children:n}){return t.jsx("span",{className:"settings__radio-label",children:n})}function Ne({children:n}){return t.jsx("div",{className:"settings__button-frame",children:n})}M();function Ce({value:n,onChange:s,disabled:i=!1,placeholder:o="Select media...",accept:a}){const[c,p]=u.useState(!1),f=async()=>{if(!(i||c)){p(!0);try{const m=await x.media().openPicker({accept:a,currentValue:n??void 0});m&&s(m)}catch(m){console.error("Failed to open media picker:",m)}finally{p(!1)}}},k=m=>{m.stopPropagation(),s(null)};return t.jsxs("div",{className:"settings__media-select",children:[t.jsx("button",{type:"button",className:`settings__media-select-trigger ${n?"settings__media-select-trigger--has-value":""}`,onClick:f,disabled:i||c,title:n?`${n.name} - Click to change`:o,children:n?t.jsx("img",{src:n.thumbnailUrl,alt:n.name,className:"settings__media-select-thumbnail"}):t.jsx("div",{className:"settings__media-select-thumbnail settings__media-select-thumbnail--empty",children:c?t.jsx(Pe,{}):t.jsx(Oe,{})})}),n&&!i&&t.jsx("button",{type:"button",className:"settings__media-select-clear",onClick:k,title:"Remove image",children:t.jsx(Ae,{})})]})}function Ae(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Oe(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})}function Pe(){return t.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",opacity:"0.25"}),t.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round",children:t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"1s",repeatCount:"indefinite"})})]})}M();function Fe({title:n,defaultOpen:s=!0,children:i}){const[o,a]=u.useState(s),c=u.useId();return t.jsxs("div",{className:"settings__section",children:[t.jsxs("button",{type:"button",className:"settings__section-header",onClick:()=>a(!o),"aria-expanded":o,"aria-controls":c,children:[t.jsx("span",{className:`settings__section-arrow ${o?"settings__section-arrow--open":""}`,children:"▶"}),t.jsx("span",{className:"settings__section-title",children:n})]}),t.jsx("div",{id:c,className:`settings__section-body ${o?"settings__section-body--open":""}`,...!o&&{inert:!0},children:t.jsx("div",{className:"settings__section-content",children:i})})]})}function b(n,s,i,o=0){var a;const[c,p]=u.useState(!0),f=u.useRef(!0),[k]=u.useState(i),[m,w]=u.useState(void 0),[h,v]=u.useState(void 0),S=u.useCallback(_=>{f.current?console.error("Cannot set store value while loading. Destructure and check the first element of the returned tuple."):v(_)},[]),T=()=>{p(!0),f.current=!0,w(void 0),v(void 0);const _=N=>{w(C=>JSON.stringify(C)===JSON.stringify(N)?C:N),p(!1),f.current=!1};return n.subscribe(s,_).catch(console.error),()=>{n.unsubscribe(s,_).catch(console.error)}};u.useEffect(T,[n,s]);const P=()=>{if(!f.current&&typeof h<"u"){const _=setTimeout(()=>{n.set(s,h)},o);return()=>clearTimeout(_)}};u.useEffect(P,[h,n,s,o]);const E=()=>{if(JSON.stringify(h)===JSON.stringify(m)){const _=setTimeout(()=>{v(void 0)},500);return()=>clearTimeout(_)}};return u.useEffect(E,[h,m]),[c,(a=h??m)!==null&&a!==void 0?a:k,S]}function Le(n,s){return(i,o=0)=>b(i,n,s,o)}function Ie(n,s){return(i=0)=>{const o=u.useMemo(()=>x.store().instance,[]);return b(o,n,s,i)}}function Ue(n,s){return(i=0)=>{const o=u.useMemo(()=>x.store().application,[]);return b(o,n,s,i)}}function ze(n,s){return(i=0)=>{const o=u.useMemo(()=>x.store().device,[]);return b(o,n,s,i)}}function Me(n,s,i){return(o=0)=>{const a=u.useMemo(()=>x.store().shared(i),[i]);return b(a,n,s,o)}}function $e(n,s){return(i,o=0)=>{const a=u.useMemo(()=>x.store().shared(i),[i]);return b(a,n,s,o)}}function De(n){const s=()=>{document.documentElement.style.fontSize=`calc(1vmax * ${n})`};u.useEffect(s,[n])}function Ye(){const[n,s]=u.useState(()=>window.innerWidth/window.innerHeight),i=()=>{const o=()=>{s(window.innerWidth/window.innerHeight)};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)};return u.useEffect(i,[]),n}function We(n,s){return{uiWidthFactor:Math.min(s,1)/n,uiHeightFactor:Math.max(s,1)/n}}exports.SettingsBox=ue;exports.SettingsButtonFrame=Ne;exports.SettingsCheckboxFrame=Ee;exports.SettingsCheckboxLabel=je;exports.SettingsColorFrame=ye;exports.SettingsContainer=le;exports.SettingsDivider=ge;exports.SettingsError=he;exports.SettingsField=fe;exports.SettingsHeading=de;exports.SettingsHint=me;exports.SettingsInputFrame=_e;exports.SettingsLabel=pe;exports.SettingsMediaSelect=Ce;exports.SettingsRadioFrame=Re;exports.SettingsRadioLabel=Te;exports.SettingsSection=Fe;exports.SettingsSelectFrame=be;exports.SettingsSliderFrame=ve;exports.SettingsSliderRuler=Se;exports.SettingsSwitchFrame=ke;exports.SettingsSwitchLabel=we;exports.SettingsTextAreaFrame=xe;exports.createUseApplicationStoreState=Ue;exports.createUseDeviceStoreState=ze;exports.createUseDynamicNamespaceStoreState=$e;exports.createUseInstanceStoreState=Ie;exports.createUseSharedStoreState=Me;exports.createUseStoreState=Le;exports.useStoreState=b;exports.useUiAspectRatio=Ye;exports.useUiResponsiveFactors=We;exports.useUiScaleToSetRem=De;