@clockworkdog/cogs-client 3.0.3 → 3.1.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/dist/browser/index.mjs +4605 -1856
- package/dist/browser/index.umd.js +13 -13
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/state-based/MediaClipManager.d.ts +1 -1
- package/dist/state-based/MediaClipManager.js +18 -12
- package/dist/types/CogsPluginManifest.d.ts +56 -0
- package/dist/utils/NetworkHostPattern.d.ts +15 -0
- package/dist/utils/NetworkHostPattern.js +65 -0
- package/dist/utils/getPluginManifestErrors.d.ts +6 -0
- package/dist/utils/getPluginManifestErrors.js +167 -0
- package/package.json +5 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(H,Ce){typeof exports=="object"&&typeof module<"u"?Ce(exports):typeof define=="function"&&define.amd?define(["exports"],Ce):(H=typeof globalThis<"u"?globalThis:H||self,Ce(H.COGS={}))})(this,function(H){"use strict";var Ce=(e=>(e.Setup="setup",e.Preshow="pre-show",e.InProgress="in progress",e.Finished="finished",e))(Ce||{});/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -11,28 +11,28 @@
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var
|
|
14
|
+
***************************************************************************** */var pt=function(e,t){return pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)n.hasOwnProperty(s)&&(r[s]=n[s])},pt(e,t)};function Lr(e,t){pt(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function di(e){var t=typeof Symbol=="function"&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function pi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(u){o={error:u}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function mi(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pi(arguments[t]));return e}var zr=function(){function e(t,r){this.target=r,this.type=t}return e}(),gi=function(e){Lr(t,e);function t(r,n){var s=e.call(this,"error",n)||this;return s.message=r.message,s.error=r,s}return t}(zr),vi=function(e){Lr(t,e);function t(r,n,s){r===void 0&&(r=1e3),n===void 0&&(n="");var i=e.call(this,"close",s)||this;return i.wasClean=!0,i.code=r,i.reason=n,i}return t}(zr);/*!
|
|
15
15
|
* Reconnecting WebSocket
|
|
16
16
|
* by Pedro Ladaria <pedro.ladaria@gmail.com>
|
|
17
17
|
* https://github.com/pladaria/reconnecting-websocket
|
|
18
18
|
* License MIT
|
|
19
|
-
*/var cn=function(){if(typeof WebSocket<"u")return WebSocket},un=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},D={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},an=function(){function e(t,n,r){var o=this;r===void 0&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(s){o._debug("open event");var i=o._options.minUptime,c=i===void 0?D.minUptime:i;clearTimeout(o._connectTimeout),o._uptimeTimeout=setTimeout(function(){return o._acceptOpen()},c),o._ws.binaryType=o._binaryType,o._messageQueue.forEach(function(a){return o._ws.send(a)}),o._messageQueue=[],o.onopen&&o.onopen(s),o._listeners.open.forEach(function(a){return o._callEventListener(s,a)})},this._handleMessage=function(s){o._debug("message event"),o.onmessage&&o.onmessage(s),o._listeners.message.forEach(function(i){return o._callEventListener(s,i)})},this._handleError=function(s){o._debug("error event",s.message),o._disconnect(void 0,s.message==="TIMEOUT"?"timeout":void 0),o.onerror&&o.onerror(s),o._debug("exec error listeners"),o._listeners.error.forEach(function(i){return o._callEventListener(s,i)}),o._connect()},this._handleClose=function(s){o._debug("close event"),o._clearTimeouts(),o._shouldReconnect&&o._connect(),o.onclose&&o.onclose(s),o._listeners.close.forEach(function(i){return o._callEventListener(s,i)})},this._url=t,this._protocols=n,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(n,r){return typeof r=="string"?n+=r.length:r instanceof Blob?n+=r.size:n+=r.byteLength,n},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,n){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,n)},e.prototype.reconnect=function(t,n){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,n),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var n=this._options.maxEnqueuedMessages,r=n===void 0?D.maxEnqueuedMessages:n;this._messageQueue.length<r&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,n){this._listeners[t]&&this._listeners[t].push(n)},e.prototype.dispatchEvent=function(t){var n,r,o=this._listeners[t.type];if(o)try{for(var s=tn(o),i=s.next();!i.done;i=s.next()){var c=i.value;this._callEventListener(t,c)}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0},e.prototype.removeEventListener=function(t,n){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(r){return r!==n}))},e.prototype._debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._options.debug&&console.log.apply(console,rn(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,n=t.reconnectionDelayGrowFactor,r=n===void 0?D.reconnectionDelayGrowFactor:n,o=t.minReconnectionDelay,s=o===void 0?D.minReconnectionDelay:o,i=t.maxReconnectionDelay,c=i===void 0?D.maxReconnectionDelay:i,a=0;return this._retryCount>0&&(a=s*Math.pow(r,this._retryCount-1),a>c&&(a=c)),this._debug("next delay",a),a},e.prototype._wait=function(){var t=this;return new Promise(function(n){setTimeout(n,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var n=t();if(typeof n=="string")return Promise.resolve(n);if(n.then)return n}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var n=this._options,r=n.maxRetries,o=r===void 0?D.maxRetries:r,s=n.connectionTimeout,i=s===void 0?D.connectionTimeout:s,c=n.WebSocket,a=c===void 0?cn():c;if(this._retryCount>=o){this._debug("max retries reached",this._retryCount,">=",o);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!un(a))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new a(l,t._protocols):new a(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},i))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new on(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,n){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new sn(t,n,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,n){"handleEvent"in n?n.handleEvent(t):n(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const xe=12095;function Me(e){const t=typeof window<"u"?window.location:void 0,n=`/assets/${encodeURIComponent(e)}`;return`${t?.protocol}//${t?.hostname}:${xe}${n}`}async function ln(e){const t=await fetch(e);return URL.createObjectURL(new Blob([await t.arrayBuffer()]))}class hn{_items;#e=new EventTarget;constructor(t){this._items={...t}}handleDataStoreItemsMessage(t){this._items={...this._items,...t.items},Object.entries(t.items).forEach(([n,r])=>{this.dispatchEvent(new _e(n,r))}),this.dispatchEvent(new ge(t.items))}get items(){return this._items}getItem(t){return this._items[t]}setItems(t){return this._items={...this._items,...t},Object.entries(t).forEach(([n,r])=>{this.dispatchEvent(new _e(n,r))}),this.dispatchEvent(new ge(t)),this}addEventListener(t,n,r){this.#e.addEventListener(t,n,r)}removeEventListener(t,n,r){this.#e.removeEventListener(t,n,r)}dispatchEvent(t){this.#e.dispatchEvent(t)}}class _e extends Event{constructor(t,n){super("item"),this.key=t,this.value=n}_cogsConnectionEventType="item"}class ge extends Event{constructor(t){super("items"),this.items=t}_cogsConnectionEventType="item"}const q=globalThis.Date;function dn(e){const t=Math.round(e-q.now());function n(...o){return o.length===0?new q(n.now()):new q(...o)}const r=Object.getOwnPropertyDescriptors(q);Object.defineProperties(n,r),n.now=function(){return q.now()+t},globalThis.Date=n}let fn=0;function pn(){return++fn}const mn=5,_n=1e4;function gn({interval:e,send:t,onChange:n=dn,syncSampleSize:r=mn,syncRequestTimeout:o=_n}){const s={};async function i(){const h=[];for(let m=0;m<r;m++){const E=new Promise(P=>{const Q=pn(),De=Date.now(),je=performance.now();t({timesync:{id:Q}});const O=(S,M)=>P({sentAt:je,receivedAt:S,serverNow:M,clientNow:De});s[Q]={complete:O},setTimeout(()=>P(null),o)});h.push(E),await E}const p=(await Promise.all(h)).filter(m=>m!==null),d=vn(p);isNaN(d)||n(Date.now()+d)}const c=h=>{const p=performance.now(),d=s[h.timesync.id];d&&d.complete(p,h.timesync.now)};i();const a=setInterval(i,e);return{receive:c,destroy:()=>{clearInterval(a)}}}function vn(e){return e.map(({sentAt:t,receivedAt:n,clientNow:r,serverNow:o})=>{const s=(n-t)/2;return o-r-s}).reduce((t,n)=>t+n,0)/e.length}class bn{constructor(t,{hostname:n=document.location.hostname,port:r=xe}={},o,s){this.manifest=t,this.currentState={...o},this.store=new hn(s??{});const{useReconnectingWebsocket:i,path:c,pathParams:a}=yn(document.location.href);this.urlParams=new URLSearchParams(a),this.urlParams.set("screenWidth",window.screen.width.toString()),this.urlParams.set("screenHeight",window.screen.height.toString()),this.urlParams.set("screenPixelRatio",window.devicePixelRatio.toString());const l=`ws://${n}:${r}${c}?${this.urlParams}`;this.websocket=i?new an(l):new WebSocket(l);let h;this.websocket.onopen=()=>{this.currentConfig={},this.currentState={},this.dispatchEvent(new Fe),this.setState(this.currentState),h=gn({interval:6e4,send:p=>{this.websocket.send(JSON.stringify(p))}})},this.websocket.addEventListener("message",({data:p})=>{try{const d=JSON.parse(p);if(typeof d=="object"&&d!==null&&"timesync"in d){const m=d;h?.receive(m)}}catch(d){console.error(d)}}),this.websocket.onclose=()=>{h?.destroy(),this.dispatchEvent(new Ke)},this.websocket.addEventListener("message",({data:p})=>{try{const d=JSON.parse(p);try{if(d.config)this.currentConfig=d.config,this.dispatchEvent(new We(this.currentConfig));else if(d.updates)this.currentState={...this.currentState,...d.updates},this.dispatchEvent(new Ge(d.updates));else if(d.event&&d.event.key)this.dispatchEvent(new Be(d.event.key,d.event.value));else if(typeof d.message=="object"){const m=d.message;switch(m.type){case"adjustable_timer_update":this._timerState={startedAt:Date.now(),durationMillis:m.durationMillis,ticking:m.ticking};break;case"show_phase":this._showPhase=m.phase,this.dispatchEvent(new He(m.phase));break;case"media_config_update":this._mediaConfig=m;for(const E of["preferOptimizedAudio","preferOptimizedVideo","preferOptimizedImages"])m[E]?this.urlParams.set(E,"true"):this.urlParams.delete(E);this.dispatchEvent(new Je(m));break;case"data_store_items":this.store.handleDataStoreItemsMessage(m);break;case"audio_play":case"audio_pause":case"audio_stop":case"audio_set_clip_volume":case"video_play":case"video_pause":case"video_stop":case"video_set_volume":case"video_set_fit":case"image_show":case"image_hide":case"image_set_fit":{const{type:E}=m;"media_strategy"in m||console.warn(`Legacy ${E} message received, this is no longer supported. Please upgrade to COGS 5.10 or downgrade to cogs-client@2.11`)}}this.dispatchEvent(new Ve(m))}}catch(m){console.warn("Error handling data",p,m)}}catch(d){console.error("Unable to parse incoming data from server",p,d)}}),this.store.addEventListener("items",p=>{this.sendDataStoreItems(p.items)});{const p=async()=>{if(navigator.mediaDevices){const d=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:m})=>m==="audiooutput");this.sendAudioOutputs(d),this.audioOutputs=d}};this.eventTarget.addEventListener("open",p),navigator.mediaDevices?.addEventListener("devicechange",p),p()}}websocket;eventTarget=new EventTarget;currentConfig={};get config(){return{...this.currentConfig}}currentState={};get state(){return{...this.currentState}}_showPhase=F.Setup;get showPhase(){return this._showPhase}_timerState=null;get timerState(){return this._timerState?{...this._timerState}:null}_mediaConfig=null;get mediaConfig(){return this._mediaConfig?{...this._mediaConfig}:null}getAssetUrl(t){return`${Me(t)}?${this.urlParams?.toString()??""}`}audioOutputs=void 0;_selectedAudioOutput="";get selectedAudioOutput(){return this._selectedAudioOutput}store;urlParams;get isConnected(){return this.websocket.readyState===WebSocket.OPEN}close(){this.websocket.close()}sendEvent(t,...[n]){this.isConnected&&this.websocket.send(JSON.stringify({event:{key:t,value:n}}))}setState(t){this.currentState={...this.currentState,...t},this.isConnected&&this.websocket.send(JSON.stringify({updates:t}))}getAudioSinkId(t){return t?this.audioOutputs?.find(({label:n})=>n===t)?.deviceId:""}sendAudioOutputs(t){this.isConnected&&this.websocket.send(JSON.stringify({audioOutputs:t}))}sendDataStoreItems(t){this.isConnected&&this.websocket.send(JSON.stringify({dataStoreItems:t}))}setPluginWindowVisible(t){this.isConnected&&this.websocket.send(JSON.stringify({window:{visible:t}}))}addEventListener(t,n,r){this.eventTarget.addEventListener(t,n,r)}removeEventListener(t,n,r){this.eventTarget.removeEventListener(t,n,r)}dispatchEvent(t){this.eventTarget.dispatchEvent(t)}}function yn(e){const t=new URL(e),n=new URLSearchParams(t.searchParams),r=n.get("local_id"),o=n.get("simulator")==="true",s=n.get("display")??"",i=t.pathname.startsWith("/plugin/")?decodeURIComponent(t.pathname.split("/")[2]):void 0;if(r){const c=n.get("t")??"";return n.delete("local_id"),{path:`/local/${encodeURIComponent(r)}`,pathParams:new URLSearchParams({t:c}),useReconnectingWebsocket:!0}}else if(o){const c=n.get("name")??"";return n.delete("simulator"),n.delete("name"),{path:`/simulator/${encodeURIComponent(c)}`,pathParams:n,useReconnectingWebsocket:!0}}else if(s){const c=n.get("displayIdIndex")??"";return n.delete("display"),n.delete("displayIdIndex"),{path:`/display/${encodeURIComponent(s)}/${encodeURIComponent(c)}`}}else{if(i)return{path:`/plugin/${encodeURIComponent(i)}`,useReconnectingWebsocket:!0};{const c=n.get("serial")??"";return n.delete("serial"),{path:`/client/${encodeURIComponent(c)}`,pathParams:n}}}}class Fe extends Event{_cogsConnectionEventType="open";constructor(){super("open")}}class Ke extends Event{_cogsConnectionEventType="close";constructor(){super("close")}}class Ve extends Event{constructor(t){super("message"),this.message=t}_cogsConnectionEventType="message"}class We extends Event{constructor(t){super("config"),this.config=t}_cogsConnectionEventType="config"}class Ge extends Event{constructor(t){super("state"),this.state=t}_cogsConnectionEventType="state"}class Be extends Event{constructor(t,n){super("event"),this.name=t,this.value=n}_cogsConnectionEventType="event"}class Je extends Event{constructor(t){super("mediaConfig"),this.mediaConfig=t}_cogsConnectionEventType="mediaConfig"}class He extends Event{constructor(t){super("showPhase"),this.showPhase=t}_cogsConnectionEventType="showPhase"}function u(e,t,n){function r(c,a){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:a,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,a);const l=i.prototype,h=Object.keys(l);for(let p=0;p<h.length;p++){const d=h[p];d in c||(c[d]=l[d].bind(c))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var a;const l=n?.Parent?new s:this;r(l,c),(a=l._zod).deferred??(a.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class K extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ye extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const qe={};function A(e){return qe}function wn(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ve(e,t){return typeof t=="bigint"?t.toString():t}function be(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ye(e){return e==null}function we(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function kn(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const a=r.match(/\d?e-(\d?)/);a?.[1]&&(o=Number.parseInt(a[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),c=Number.parseInt(t.toFixed(s).replace(".",""));return i%c/10**s}const Xe=Symbol("evaluating");function _(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Xe)return r===void 0&&(r=Xe,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function j(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function L(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Qe(e){return JSON.stringify(e)}function En(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const et="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zn=be(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function V(e){if(ee(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ee(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function tt(e){return V(e)?{...e}:Array.isArray(e)?[...e]:e}const $n=new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function f(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Zn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Sn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function On(e,t){const n=e._zod.def,r=L(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=n.shape[s])}return j(this,"shape",o),o},checks:[]});return R(e,r)}function Tn(e,t){const n=e._zod.def,r=L(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return j(this,"shape",o),o},checks:[]});return R(e,r)}function In(e,t){if(!V(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=L(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return j(this,"shape",s),s},checks:[]});return R(e,o)}function Cn(e,t){if(!V(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return j(this,"shape",r),r},checks:e._zod.def.checks};return R(e,n)}function Pn(e,t){const n=L(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return j(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return R(e,n)}function An(e,t,n){const r=L(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return j(this,"shape",s),s},checks:[]});return R(t,r)}function Rn(e,t,n){const r=L(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return j(this,"shape",s),s},checks:[]});return R(t,r)}function G(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function U(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function te(e){return typeof e=="string"?e:e?.message}function N(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=te(e.inst?._zod.def?.error?.(e))??te(t?.error?.(e))??te(n.customError?.(e))??te(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ke(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function X(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const nt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ve,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rt=u("$ZodError",nt),ot=u("$ZodError",nt,{Parent:Error});function Nn(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Dn(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,c=0;for(;c<s.path.length;){const a=s.path[c];c===s.path.length-1?(i[a]=i[a]||{_errors:[]},i[a]._errors.push(t(s))):i[a]=i[a]||{_errors:[]},i=i[a],c++}}};return r(e),n}const Ee=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new K;if(i.issues.length){const c=new(o?.Err??e)(i.issues.map(a=>N(a,s,A())));throw et(c,o?.callee),c}return i.value},ze=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const c=new(o?.Err??e)(i.issues.map(a=>N(a,s,A())));throw et(c,o?.callee),c}return i.value},ne=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new K;return s.issues.length?{success:!1,error:new(e??rt)(s.issues.map(i=>N(i,o,A())))}:{success:!0,data:s.value}},jn=ne(ot),re=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>N(i,o,A())))}:{success:!0,data:s.value}},Ln=re(ot),Un=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ee(e)(t,n,o)},xn=e=>(t,n,r)=>Ee(e)(t,n,r),Mn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ze(e)(t,n,o)},Fn=e=>async(t,n,r)=>ze(e)(t,n,r),Kn=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ne(e)(t,n,o)},Vn=e=>(t,n,r)=>ne(e)(t,n,r),Wn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return re(e)(t,n,o)},Gn=e=>async(t,n,r)=>re(e)(t,n,r),Bn=/^[cC][^\s-]{8,}$/,Jn=/^[0-9a-z]+$/,Hn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yn=/^[0-9a-vA-V]{20}$/,qn=/^[A-Za-z0-9]{27}$/,Xn=/^[a-zA-Z0-9_-]{21}$/,Qn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,er=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,st=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function rr(){return new RegExp(nr,"u")}const or=/^(?:(?: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])$/,sr=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ir=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,cr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ur=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,it=/^[A-Za-z0-9_-]*$/,ar=/^\+(?:[0-9]){6,14}[0-9]$/,ct="(?:(?:\\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])))",lr=new RegExp(`^${ct}$`);function ut(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function hr(e){return new RegExp(`^${ut(e)}$`)}function dr(e){const t=ut({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ct}T(?:${r})$`)}const fr=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},pr=/^-?\d+$/,mr=/^-?\d+(?:\.\d+)?/,_r=/^(?:true|false)$/i,gr=/^null$/i,vr=/^[^A-Z]*$/,br=/^[^a-z]*$/,z=u("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),at={number:"number",bigint:"bigint",object:"date"},lt=u("$ZodCheckLessThan",(e,t)=>{z.init(e,t);const n=at[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ht=u("$ZodCheckGreaterThan",(e,t)=>{z.init(e,t);const n=at[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yr=u("$ZodCheckMultipleOf",(e,t)=>{z.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):kn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),wr=u("$ZodCheckNumberFormat",(e,t)=>{z.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Sn[t.format];e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,c.minimum=o,c.maximum=s,n&&(c.pattern=pr)}),e._zod.check=i=>{const c=i.value;if(n){if(!Number.isInteger(c)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}c<o&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:e})}}),kr=u("$ZodCheckMaxLength",(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ye(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=ke(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Er=u("$ZodCheckMinLength",(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ye(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=ke(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zr=u("$ZodCheckLengthEquals",(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ye(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=ke(o),c=s>t.length;r.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),oe=u("$ZodCheckStringFormat",(e,t)=>{var n,r;z.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$r=u("$ZodCheckRegex",(e,t)=>{oe.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zr=u("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vr),oe.init(e,t)}),Sr=u("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=br),oe.init(e,t)}),Or=u("$ZodCheckIncludes",(e,t)=>{z.init(e,t);const n=W(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Tr=u("$ZodCheckStartsWith",(e,t)=>{z.init(e,t);const n=new RegExp(`^${W(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Ir=u("$ZodCheckEndsWith",(e,t)=>{z.init(e,t);const n=new RegExp(`.*${W(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Cr=u("$ZodCheckOverwrite",(e,t)=>{z.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Pr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
20
|
-
`).filter(
|
|
21
|
-
`))}}const
|
|
22
|
-
if (${
|
|
23
|
-
payload.issues = payload.issues.concat(${
|
|
19
|
+
*/var _i=function(){if(typeof WebSocket<"u")return WebSocket},Ei=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},Ae={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},bi=function(){function e(t,r,n){var s=this;n===void 0&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(i){s._debug("open event");var o=s._options.minUptime,u=o===void 0?Ae.minUptime:o;clearTimeout(s._connectTimeout),s._uptimeTimeout=setTimeout(function(){return s._acceptOpen()},u),s._ws.binaryType=s._binaryType,s._messageQueue.forEach(function(c){return s._ws.send(c)}),s._messageQueue=[],s.onopen&&s.onopen(i),s._listeners.open.forEach(function(c){return s._callEventListener(i,c)})},this._handleMessage=function(i){s._debug("message event"),s.onmessage&&s.onmessage(i),s._listeners.message.forEach(function(o){return s._callEventListener(i,o)})},this._handleError=function(i){s._debug("error event",i.message),s._disconnect(void 0,i.message==="TIMEOUT"?"timeout":void 0),s.onerror&&s.onerror(i),s._debug("exec error listeners"),s._listeners.error.forEach(function(o){return s._callEventListener(i,o)}),s._connect()},this._handleClose=function(i){s._debug("close event"),s._clearTimeouts(),s._shouldReconnect&&s._connect(),s.onclose&&s.onclose(i),s._listeners.close.forEach(function(o){return s._callEventListener(i,o)})},this._url=t,this._protocols=r,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(r,n){return typeof n=="string"?r+=n.length:n instanceof Blob?r+=n.size:r+=n.byteLength,r},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,r){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,r)},e.prototype.reconnect=function(t,r){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,r),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var r=this._options.maxEnqueuedMessages,n=r===void 0?Ae.maxEnqueuedMessages:r;this._messageQueue.length<n&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,r){this._listeners[t]&&this._listeners[t].push(r)},e.prototype.dispatchEvent=function(t){var r,n,s=this._listeners[t.type];if(s)try{for(var i=di(s),o=i.next();!o.done;o=i.next()){var u=o.value;this._callEventListener(t,u)}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.removeEventListener=function(t,r){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(n){return n!==r}))},e.prototype._debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this._options.debug&&console.log.apply(console,mi(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,r=t.reconnectionDelayGrowFactor,n=r===void 0?Ae.reconnectionDelayGrowFactor:r,s=t.minReconnectionDelay,i=s===void 0?Ae.minReconnectionDelay:s,o=t.maxReconnectionDelay,u=o===void 0?Ae.maxReconnectionDelay:o,c=0;return this._retryCount>0&&(c=i*Math.pow(n,this._retryCount-1),c>u&&(c=u)),this._debug("next delay",c),c},e.prototype._wait=function(){var t=this;return new Promise(function(r){setTimeout(r,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var r=t();if(typeof r=="string")return Promise.resolve(r);if(r.then)return r}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var r=this._options,n=r.maxRetries,s=n===void 0?Ae.maxRetries:n,i=r.connectionTimeout,o=i===void 0?Ae.connectionTimeout:i,u=r.WebSocket,c=u===void 0?_i():u;if(this._retryCount>=s){this._debug("max retries reached",this._retryCount,">=",s);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ei(c))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new c(l,t._protocols):new c(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},o))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new gi(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,r){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,r),this._handleClose(new vi(t,r,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,r){"handleEvent"in r?r.handleEvent(t):r(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const Zr=12095;function Dr(e){const t=typeof window<"u"?window.location:void 0,r=`/assets/${encodeURIComponent(e)}`;return`${t?.protocol}//${t?.hostname}:${Zr}${r}`}async function wi(e){const t=await fetch(e);return URL.createObjectURL(new Blob([await t.arrayBuffer()]))}class Si{_items;#e=new EventTarget;constructor(t){this._items={...t}}handleDataStoreItemsMessage(t){this._items={...this._items,...t.items},Object.entries(t.items).forEach(([r,n])=>{this.dispatchEvent(new mt(r,n))}),this.dispatchEvent(new gt(t.items))}get items(){return this._items}getItem(t){return this._items[t]}setItems(t){return this._items={...this._items,...t},Object.entries(t).forEach(([r,n])=>{this.dispatchEvent(new mt(r,n))}),this.dispatchEvent(new gt(t)),this}addEventListener(t,r,n){this.#e.addEventListener(t,r,n)}removeEventListener(t,r,n){this.#e.removeEventListener(t,r,n)}dispatchEvent(t){this.#e.dispatchEvent(t)}}class mt extends Event{constructor(t,r){super("item"),this.key=t,this.value=r}_cogsConnectionEventType="item"}class gt extends Event{constructor(t){super("items"),this.items=t}_cogsConnectionEventType="item"}const Me=globalThis.Date;function yi(e){const t=Math.round(e-Me.now());function r(...s){return s.length===0?new Me(r.now()):new Me(...s)}const n=Object.getOwnPropertyDescriptors(Me);Object.defineProperties(r,n),r.now=function(){return Me.now()+t},globalThis.Date=r}let Ii=0;function $i(){return++Ii}const Ri=5,Ai=1e4;function Ti({interval:e,send:t,onChange:r=yi,syncSampleSize:n=Ri,syncRequestTimeout:s=Ai}){const i={};async function o(){const a=[];for(let p=0;p<n;p++){const I=new Promise(_=>{const m=$i(),y=Date.now(),$=performance.now();t({timesync:{id:m}});const N=(x,C)=>_({sentAt:$,receivedAt:x,serverNow:C,clientNow:y});i[m]={complete:N},setTimeout(()=>_(null),s)});a.push(I),await I}const f=(await Promise.all(a)).filter(p=>p!==null),h=Oi(f);isNaN(h)||r(Date.now()+h)}const u=a=>{const f=performance.now(),h=i[a.timesync.id];h&&h.complete(f,a.timesync.now)};o();const c=setInterval(o,e);return{receive:u,destroy:()=>{clearInterval(c)}}}function Oi(e){return e.map(({sentAt:t,receivedAt:r,clientNow:n,serverNow:s})=>{const i=(r-t)/2;return s-n-i}).reduce((t,r)=>t+r,0)/e.length}class ki{constructor(t,{hostname:r=document.location.hostname,port:n=Zr}={},s,i){this.manifest=t,this.currentState={...s},this.store=new Si(i??{});const{useReconnectingWebsocket:o,path:u,pathParams:c}=Pi(document.location.href);this.urlParams=new URLSearchParams(c),this.urlParams.set("screenWidth",window.screen.width.toString()),this.urlParams.set("screenHeight",window.screen.height.toString()),this.urlParams.set("screenPixelRatio",window.devicePixelRatio.toString());const l=`ws://${r}:${n}${u}?${this.urlParams}`;this.websocket=o?new bi(l):new WebSocket(l);let a;this.websocket.onopen=()=>{this.currentConfig={},this.currentState={},this.dispatchEvent(new jr),this.setState(this.currentState),a=Ti({interval:6e4,send:f=>{this.websocket.send(JSON.stringify(f))}})},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);if(typeof h=="object"&&h!==null&&"timesync"in h){const p=h;a?.receive(p)}}catch(h){console.error(h)}}),this.websocket.onclose=()=>{a?.destroy(),this.dispatchEvent(new xr)},this.websocket.addEventListener("message",({data:f})=>{try{const h=JSON.parse(f);try{if(h.config)this.currentConfig=h.config,this.dispatchEvent(new Ur(this.currentConfig));else if(h.updates)this.currentState={...this.currentState,...h.updates},this.dispatchEvent(new Br(h.updates));else if(h.event&&h.event.key)this.dispatchEvent(new Fr(h.event.key,h.event.value));else if(typeof h.message=="object"){const p=h.message;switch(p.type){case"adjustable_timer_update":this._timerState={startedAt:Date.now(),durationMillis:p.durationMillis,ticking:p.ticking};break;case"show_phase":this._showPhase=p.phase,this.dispatchEvent(new Gr(p.phase));break;case"media_config_update":this._mediaConfig=p;for(const I of["preferOptimizedAudio","preferOptimizedVideo","preferOptimizedImages"])p[I]?this.urlParams.set(I,"true"):this.urlParams.delete(I);this.dispatchEvent(new qr(p));break;case"data_store_items":this.store.handleDataStoreItemsMessage(p);break;case"audio_play":case"audio_pause":case"audio_stop":case"audio_set_clip_volume":case"video_play":case"video_pause":case"video_stop":case"video_set_volume":case"video_set_fit":case"image_show":case"image_hide":case"image_set_fit":{const{type:I}=p;"media_strategy"in p||console.warn(`Legacy ${I} message received, this is no longer supported. Please upgrade to COGS 5.10 or downgrade to cogs-client@2.11`)}}this.dispatchEvent(new Mr(p))}}catch(p){console.warn("Error handling data",f,p)}}catch(h){console.error("Unable to parse incoming data from server",f,h)}}),this.store.addEventListener("items",f=>{this.sendDataStoreItems(f.items)});{const f=async()=>{if(navigator.mediaDevices){const h=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:p})=>p==="audiooutput");this.sendAudioOutputs(h),this.audioOutputs=h}};this.eventTarget.addEventListener("open",f),navigator.mediaDevices?.addEventListener("devicechange",f),f()}}websocket;eventTarget=new EventTarget;currentConfig={};get config(){return{...this.currentConfig}}currentState={};get state(){return{...this.currentState}}_showPhase=Ce.Setup;get showPhase(){return this._showPhase}_timerState=null;get timerState(){return this._timerState?{...this._timerState}:null}_mediaConfig=null;get mediaConfig(){return this._mediaConfig?{...this._mediaConfig}:null}getAssetUrl(t){return`${Dr(t)}?${this.urlParams?.toString()??""}`}audioOutputs=void 0;_selectedAudioOutput="";get selectedAudioOutput(){return this._selectedAudioOutput}store;urlParams;get isConnected(){return this.websocket.readyState===WebSocket.OPEN}close(){this.websocket.close()}sendEvent(t,...[r]){this.isConnected&&this.websocket.send(JSON.stringify({event:{key:t,value:r}}))}setState(t){this.currentState={...this.currentState,...t},this.isConnected&&this.websocket.send(JSON.stringify({updates:t}))}getAudioSinkId(t){return t?this.audioOutputs?.find(({label:r})=>r===t)?.deviceId:""}sendAudioOutputs(t){this.isConnected&&this.websocket.send(JSON.stringify({audioOutputs:t}))}sendDataStoreItems(t){this.isConnected&&this.websocket.send(JSON.stringify({dataStoreItems:t}))}setPluginWindowVisible(t){this.isConnected&&this.websocket.send(JSON.stringify({window:{visible:t}}))}addEventListener(t,r,n){this.eventTarget.addEventListener(t,r,n)}removeEventListener(t,r,n){this.eventTarget.removeEventListener(t,r,n)}dispatchEvent(t){this.eventTarget.dispatchEvent(t)}}function Pi(e){const t=new URL(e),r=new URLSearchParams(t.searchParams),n=r.get("local_id"),s=r.get("simulator")==="true",i=r.get("display")??"",o=t.pathname.startsWith("/plugin/")?decodeURIComponent(t.pathname.split("/")[2]):void 0;if(n){const u=r.get("t")??"";return r.delete("local_id"),{path:`/local/${encodeURIComponent(n)}`,pathParams:new URLSearchParams({t:u}),useReconnectingWebsocket:!0}}else if(s){const u=r.get("name")??"";return r.delete("simulator"),r.delete("name"),{path:`/simulator/${encodeURIComponent(u)}`,pathParams:r,useReconnectingWebsocket:!0}}else if(i){const u=r.get("displayIdIndex")??"";return r.delete("display"),r.delete("displayIdIndex"),{path:`/display/${encodeURIComponent(i)}/${encodeURIComponent(u)}`}}else{if(o)return{path:`/plugin/${encodeURIComponent(o)}`,useReconnectingWebsocket:!0};{const u=r.get("serial")??"";return r.delete("serial"),{path:`/client/${encodeURIComponent(u)}`,pathParams:r}}}}class jr extends Event{_cogsConnectionEventType="open";constructor(){super("open")}}class xr extends Event{_cogsConnectionEventType="close";constructor(){super("close")}}class Mr extends Event{constructor(t){super("message"),this.message=t}_cogsConnectionEventType="message"}class Ur extends Event{constructor(t){super("config"),this.config=t}_cogsConnectionEventType="config"}class Br extends Event{constructor(t){super("state"),this.state=t}_cogsConnectionEventType="state"}class Fr extends Event{constructor(t,r){super("event"),this.name=t,this.value=r}_cogsConnectionEventType="event"}class qr extends Event{constructor(t){super("mediaConfig"),this.mediaConfig=t}_cogsConnectionEventType="mediaConfig"}class Gr extends Event{constructor(t){super("showPhase"),this.showPhase=t}_cogsConnectionEventType="showPhase"}function g(e,t,r){function n(u,c){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,c);const l=o.prototype,a=Object.keys(l);for(let f=0;f<a.length;f++){const h=a[f];h in u||(u[h]=l[h].bind(u))}}const s=r?.Parent??Object;class i extends s{}Object.defineProperty(i,"name",{value:e});function o(u){var c;const l=r?.Parent?new i:this;n(l,u),(c=l._zod).deferred??(c.deferred=[]);for(const a of l._zod.deferred)a();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Le extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Wr={};function be(e){return Wr}function Ni(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function vt(e,t){return typeof t=="bigint"?t.toString():t}function _t(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Et(e){return e==null}function bt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ci(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let s=(n.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const i=r>s?r:s,o=Number.parseInt(e.toFixed(i).replace(".","")),u=Number.parseInt(t.toFixed(i).replace(".",""));return o%u/10**i}const Hr=Symbol("evaluating");function W(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hr)return n===void 0&&(n=Hr,n=r()),n},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Te(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Oe(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Xr(e){return JSON.stringify(e)}function Li(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Kr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zi=_t(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ze(e){if(Ve(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ve(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Yr(e){return ze(e)?{...e}:Array.isArray(e)?[...e]:e}const Zi=new Set(["string","number","symbol"]),Di=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ke(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function we(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function A(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ji(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const xi={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Mi(e,t){const r=e._zod.def,n=Oe(e._zod.def,{get shape(){const s={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=r.shape[i])}return Te(this,"shape",s),s},checks:[]});return we(e,n)}function Ui(e,t){const r=e._zod.def,n=Oe(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete s[i]}return Te(this,"shape",s),s},checks:[]});return we(e,n)}function Bi(e,t){if(!ze(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const s=Oe(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Te(this,"shape",i),i},checks:[]});return we(e,s)}function Fi(e,t){if(!ze(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Te(this,"shape",n),n},checks:e._zod.def.checks};return we(e,r)}function qi(e,t){const r=Oe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Te(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return we(e,r)}function Gi(e,t,r){const n=Oe(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:s[o]}):s[o])}else for(const o in s)i[o]=e?new e({type:"optional",innerType:s[o]}):s[o];return Te(this,"shape",i),i},checks:[]});return we(t,n)}function Vi(e,t,r){const n=Oe(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:s[o]}))}else for(const o in s)i[o]=new e({type:"nonoptional",innerType:s[o]});return Te(this,"shape",i),i},checks:[]});return we(t,n)}function Ze(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Pe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function We(e){return typeof e=="string"?e:e?.message}function Se(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=We(e.inst?._zod.def?.error?.(e))??We(t?.error?.(e))??We(r.customError?.(e))??We(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function wt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ue(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Jr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qr=g("$ZodError",Jr),en=g("$ZodError",Jr,{Parent:Error});function Wi(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function Hi(e,t=r=>r.message){const r={_errors:[]},n=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(e),r}const St=e=>(t,r,n,s)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Le;if(o.issues.length){const u=new(s?.Err??e)(o.issues.map(c=>Se(c,i,be())));throw Kr(u,s?.callee),u}return o.value},yt=e=>async(t,r,n,s)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const u=new(s?.Err??e)(o.issues.map(c=>Se(c,i,be())));throw Kr(u,s?.callee),u}return o.value},He=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Le;return i.issues.length?{success:!1,error:new(e??Qr)(i.issues.map(o=>Se(o,s,be())))}:{success:!0,data:i.value}},Xi=He(en),Xe=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>Se(o,s,be())))}:{success:!0,data:i.value}},Ki=Xe(en),Yi=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return St(e)(t,r,s)},Ji=e=>(t,r,n)=>St(e)(t,r,n),Qi=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return yt(e)(t,r,s)},eo=e=>async(t,r,n)=>yt(e)(t,r,n),to=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,s)},ro=e=>(t,r,n)=>He(e)(t,r,n),no=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xe(e)(t,r,s)},so=e=>async(t,r,n)=>Xe(e)(t,r,n),io=/^[cC][^\s-]{8,}$/,oo=/^[0-9a-z]+$/,ao=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,co=/^[0-9a-vA-V]{20}$/,uo=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,fo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ho=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,po=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function go(){return new RegExp(mo,"u")}const vo=/^(?:(?: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])$/,_o=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Eo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,bo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rn=/^[A-Za-z0-9_-]*$/,So=/^\+(?:[0-9]){6,14}[0-9]$/,nn="(?:(?:\\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])))",yo=new RegExp(`^${nn}$`);function sn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Io(e){return new RegExp(`^${sn(e)}$`)}function $o(e){const t=sn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${nn}T(?:${n})$`)}const Ro=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ao=/^-?\d+$/,To=/^-?\d+(?:\.\d+)?/,Oo=/^(?:true|false)$/i,ko=/^null$/i,Po=/^[^A-Z]*$/,No=/^[^a-z]*$/,oe=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),on={number:"number",bigint:"bigint",object:"date"},an=g("$ZodCheckLessThan",(e,t)=>{oe.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=g("$ZodCheckGreaterThan",(e,t)=>{oe.init(e,t);const r=on[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,i=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Co=g("$ZodCheckMultipleOf",(e,t)=>{oe.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ci(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Lo=g("$ZodCheckNumberFormat",(e,t)=>{oe.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[s,i]=xi[t.format];e._zod.onattach.push(o=>{const u=o._zod.bag;u.format=t.format,u.minimum=s,u.maximum=i,r&&(u.pattern=Ao)}),e._zod.check=o=>{const u=o.value;if(r){if(!Number.isInteger(u)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?o.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):o.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}u<s&&o.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),u>i&&o.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inst:e})}}),zo=g("$ZodCheckMaxLength",(e,t)=>{var r;oe.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const o=wt(s);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Zo=g("$ZodCheckMinLength",(e,t)=>{var r;oe.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const o=wt(s);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Do=g("$ZodCheckLengthEquals",(e,t)=>{var r;oe.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Et(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,i=s.length;if(i===t.length)return;const o=wt(s),u=i>t.length;n.issues.push({origin:o,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ke=g("$ZodCheckStringFormat",(e,t)=>{var r,n;oe.init(e,t),e._zod.onattach.push(s=>{const i=s._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),jo=g("$ZodCheckRegex",(e,t)=>{Ke.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xo=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Po),Ke.init(e,t)}),Mo=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=No),Ke.init(e,t)}),Uo=g("$ZodCheckIncludes",(e,t)=>{oe.init(e,t);const r=ke(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Bo=g("$ZodCheckStartsWith",(e,t)=>{oe.init(e,t);const r=new RegExp(`^${ke(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Fo=g("$ZodCheckEndsWith",(e,t)=>{oe.init(e,t);const r=new RegExp(`.*${ke(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),qo=g("$ZodCheckOverwrite",(e,t)=>{oe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Go{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
20
|
+
`).filter(o=>o),s=Math.min(...n.map(o=>o.length-o.trimStart().length)),i=n.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,r=this?.args,s=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,s.join(`
|
|
21
|
+
`))}}const Vo={major:4,minor:1,patch:13},V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vo;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(o,u,c)=>{let l=Ze(o),a;for(const f of u){if(f._zod.def.when){if(!f._zod.def.when(o))continue}else if(l)continue;const h=o.issues.length,p=f._zod.check(o);if(p instanceof Promise&&c?.async===!1)throw new Le;if(a||p instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await p,o.issues.length!==h&&(l||(l=Ze(o,h)))});else{if(o.issues.length===h)continue;l||(l=Ze(o,h))}}return a?a.then(()=>o):o},i=(o,u,c)=>{if(Ze(o))return o.aborted=!0,o;const l=s(u,n,c);if(l instanceof Promise){if(c.async===!1)throw new Le;return l.then(a=>e._zod.parse(a,c))}return e._zod.parse(l,c)};e._zod.run=(o,u)=>{if(u.skipChecks)return e._zod.parse(o,u);if(u.direction==="backward"){const l=e._zod.parse({value:o.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(a=>i(a,o,u)):i(l,o,u)}const c=e._zod.parse(o,u);if(c instanceof Promise){if(u.async===!1)throw new Le;return c.then(l=>s(l,n,u))}return s(c,n,u)}}e["~standard"]={validate:s=>{try{const i=Xi(e,s);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ki(e,s).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}}),It=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ro(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),K=g("$ZodStringFormat",(e,t)=>{Ke.init(e,t),It.init(e,t)}),Wo=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ho),K.init(e,t)}),Ho=g("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tn(n))}else t.pattern??(t.pattern=tn());K.init(e,t)}),Xo=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=po),K.init(e,t)}),Ko=g("$ZodURL",(e,t)=>{K.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),s=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Yo=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=go()),K.init(e,t)}),Jo=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=lo),K.init(e,t)}),Qo=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=io),K.init(e,t)}),ea=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oo),K.init(e,t)}),ta=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ao),K.init(e,t)}),ra=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=co),K.init(e,t)}),na=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=uo),K.init(e,t)}),sa=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$o(t)),K.init(e,t)}),ia=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yo),K.init(e,t)}),oa=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Io(t)),K.init(e,t)}),aa=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fo),K.init(e,t)}),ca=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vo),K.init(e,t),e._zod.bag.format="ipv4"}),ua=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_o),K.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),la=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Eo),K.init(e,t)}),fa=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bo),K.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,i]=n;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function un(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const ha=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wo),K.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{un(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function da(e){if(!rn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return un(r)}const pa=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rn),K.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{da(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ma=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=So),K.init(e,t)});function ga(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const va=g("$ZodJWT",(e,t)=>{K.init(e,t),e._zod.check=r=>{ga(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ln=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??To,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),r}}),_a=g("$ZodNumberFormat",(e,t)=>{Lo.init(e,t),ln.init(e,t)}),Ea=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=Oo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),ba=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=ko,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),wa=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),Sa=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function fn(e,t,r){e.issues.length&&t.issues.push(...Pe(r,e.issues)),t.value[r]=e.value}const ya=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const i=[];for(let o=0;o<s.length;o++){const u=s[o],c=t.element._zod.run({value:u,issues:[]},n);c instanceof Promise?i.push(c.then(l=>fn(l,r,o))):fn(c,r,o)}return i.length?Promise.all(i).then(()=>r):r}});function Ye(e,t,r,n){e.issues.length&&t.issues.push(...Pe(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function hn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=ji(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function dn(e,t,r,n,s,i){const o=[],u=s.keySet,c=s.catchall._zod,l=c.def.type;for(const a in t){if(u.has(a))continue;if(l==="never"){o.push(a);continue}const f=c.run({value:t[a],issues:[]},n);f instanceof Promise?e.push(f.then(h=>Ye(h,r,a,t))):Ye(f,r,a,t)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const Ia=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...u};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=_t(()=>hn(t));W(e._zod,"propValues",()=>{const u=t.shape,c={};for(const l in u){const a=u[l]._zod;if(a.values){c[l]??(c[l]=new Set);for(const f of a.values)c[l].add(f)}}return c});const s=Ve,i=t.catchall;let o;e._zod.parse=(u,c)=>{o??(o=n.value);const l=u.value;if(!s(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};const a=[],f=o.shape;for(const h of o.keys){const I=f[h]._zod.run({value:l[h],issues:[]},c);I instanceof Promise?a.push(I.then(_=>Ye(_,u,h,l))):Ye(I,u,h,l)}return i?dn(a,l,u,c,n.value,e):a.length?Promise.all(a).then(()=>u):u}}),$a=g("$ZodObjectJIT",(e,t)=>{Ia.init(e,t);const r=e._zod.parse,n=_t(()=>hn(t)),s=h=>{const p=new Go(["shape","payload","ctx"]),I=n.value,_=N=>{const x=Xr(N);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let y=0;for(const N of I.keys)m[N]=`key_${y++}`;p.write("const newResult = {};");for(const N of I.keys){const x=m[N],C=Xr(N);p.write(`const ${x} = ${_(N)};`),p.write(`
|
|
22
|
+
if (${x}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
24
24
|
...iss,
|
|
25
|
-
path: iss.path ? [${
|
|
25
|
+
path: iss.path ? [${C}, ...iss.path] : [${C}]
|
|
26
26
|
})));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
if (${
|
|
31
|
-
if (${
|
|
32
|
-
newResult[${
|
|
30
|
+
if (${x}.value === undefined) {
|
|
31
|
+
if (${C} in input) {
|
|
32
|
+
newResult[${C}] = undefined;
|
|
33
33
|
}
|
|
34
34
|
} else {
|
|
35
|
-
newResult[${
|
|
35
|
+
newResult[${C}] = ${x}.value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
`)}m.write("payload.value = newResult;"),m.write("return payload;");const je=m.compile();return(O,S)=>je(d,O,S)};let s;const i=ee,c=!qe.jitless,l=c&&zn.value,h=t.catchall;let p;e._zod.parse=(d,m)=>{p??(p=r.value);const E=d.value;return i(E)?c&&l&&m?.async===!1&&m.jitless!==!0?(s||(s=o(t.shape)),d=s(d,m),h?_t([],E,d,m,p,e):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),d)}});function gt(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!G(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>N(i,r,A())))}),t)}const po=u("$ZodUnion",(e,t)=>{g.init(e,t),_(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),_(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),_(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),_(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>we(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const c=[];for(const a of t.options){const l=a._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)c.push(l),i=!0;else{if(l.issues.length===0)return l;c.push(l)}}return i?Promise.all(c).then(a=>gt(a,o,e,s)):gt(c,o,e,s)}}),mo=u("$ZodIntersection",(e,t)=>{g.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([a,l])=>vt(n,a,l)):vt(n,s,i)}});function Ze(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(V(e)&&V(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=Ze(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=Ze(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),G(e))return e;const r=Ze(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const _o=u("$ZodTuple",(e,t)=>{g.init(e,t);const n=t.items;e._zod.parse=(r,o)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const i=[],c=[...n].reverse().findIndex(h=>h._zod.optin!=="optional"),a=c===-1?0:n.length-c;if(!t.rest){const h=s.length>n.length,p=s.length<a-1;if(h||p)return r.issues.push({...h?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let l=-1;for(const h of n){if(l++,l>=s.length&&l>=a)continue;const p=h._zod.run({value:s[l],issues:[]},o);p instanceof Promise?i.push(p.then(d=>ie(d,r,l))):ie(p,r,l)}if(t.rest){const h=s.slice(n.length);for(const p of h){l++;const d=t.rest._zod.run({value:p,issues:[]},o);d instanceof Promise?i.push(d.then(m=>ie(m,r,l))):ie(d,r,l)}}return i.length?Promise.all(i).then(()=>r):r}});function ie(e,t,n){e.issues.length&&t.issues.push(...U(n,e.issues)),t.value[n]=e.value}const go=u("$ZodRecord",(e,t)=>{g.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!V(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const c=new Set;for(const l of i)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);const h=t.valueType._zod.run({value:o[l],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&n.issues.push(...U(l,p.issues)),n.value[l]=p.value})):(h.issues.length&&n.issues.push(...U(l,h.issues)),n.value[l]=h.value)}let a;for(const l in o)c.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const c of Reflect.ownKeys(o)){if(c==="__proto__")continue;const a=t.keyType._zod.run({value:c,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(h=>N(h,r,A())),input:c,path:[c],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[c],issues:[]},r);l instanceof Promise?s.push(l.then(h=>{h.issues.length&&n.issues.push(...U(c,h.issues)),n.value[a.value]=h.value})):(l.issues.length&&n.issues.push(...U(c,l.issues)),n.value[a.value]=l.value)}}return s.length?Promise.all(s).then(()=>n):n}}),vo=u("$ZodEnum",(e,t)=>{g.init(e,t);const n=wn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>$n.has(typeof o)).map(o=>typeof o=="string"?W(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),bo=u("$ZodLiteral",(e,t)=>{if(g.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?W(r):r?W(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),yo=u("$ZodTransform",(e,t)=>{g.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ye(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new K;return n.value=o,n}});function bt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const wo=u("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${we(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>bt(s,n.value)):bt(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),ko=u("$ZodNullable",(e,t)=>{g.init(e,t),_(e._zod,"optin",()=>t.innerType._zod.optin),_(e._zod,"optout",()=>t.innerType._zod.optout),_(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${we(n.source)}|null)$`):void 0}),_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Eo=u("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>yt(s,t)):yt(o,t)}});function yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const zo=u("$ZodPrefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),$o=u("$ZodNonOptional",(e,t)=>{g.init(e,t),_(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>wt(s,e)):wt(o,e)}});function wt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Zo=u("$ZodCatch",(e,t)=>{g.init(e,t),_(e._zod,"optin",()=>t.innerType._zod.optin),_(e._zod,"optout",()=>t.innerType._zod.optout),_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>N(i,r,A()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>N(s,r,A()))},input:n.value}),n.issues=[]),n)}}),So=u("$ZodPipe",(e,t)=>{g.init(e,t),_(e._zod,"values",()=>t.in._zod.values),_(e._zod,"optin",()=>t.in._zod.optin),_(e._zod,"optout",()=>t.out._zod.optout),_(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>ce(i,t.in,r)):ce(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>ce(s,t.out,r)):ce(o,t.out,r)}});function ce(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Oo=u("$ZodReadonly",(e,t)=>{g.init(e,t),_(e._zod,"propValues",()=>t.innerType._zod.propValues),_(e._zod,"values",()=>t.innerType._zod.values),_(e._zod,"optin",()=>t.innerType?._zod?.optin),_(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(kt):kt(o)}});function kt(e){return e.value=Object.freeze(e.value),e}const To=u("$ZodCustom",(e,t)=>{z.init(e,t),g.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Et(s,n,r,e));Et(o,n,r,e)}});function Et(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(X(o))}}var zt;class Io{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Co(){return new Io}(zt=globalThis).__zod_globalRegistry??(zt.__zod_globalRegistry=Co());const ue=globalThis.__zod_globalRegistry;function Po(e,t){return new e({type:"string",...f(t)})}function Ao(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function $t(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Ro(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function No(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Do(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function Lo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function Uo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function xo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Mo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Fo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Ko(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function Vo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function Wo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function Go(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function Bo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function Jo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function Ho(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function Yo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function qo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function Xo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function Qo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function es(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function ts(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function ns(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function rs(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function os(e,t){return new e({type:"number",checks:[],...f(t)})}function ss(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function is(e,t){return new e({type:"boolean",...f(t)})}function cs(e,t){return new e({type:"null",...f(t)})}function us(e){return new e({type:"unknown"})}function as(e,t){return new e({type:"never",...f(t)})}function Zt(e,t){return new lt({check:"less_than",...f(t),value:e,inclusive:!1})}function Se(e,t){return new lt({check:"less_than",...f(t),value:e,inclusive:!0})}function St(e,t){return new ht({check:"greater_than",...f(t),value:e,inclusive:!1})}function Oe(e,t){return new ht({check:"greater_than",...f(t),value:e,inclusive:!0})}function Ot(e,t){return new yr({check:"multiple_of",...f(t),value:e})}function Tt(e,t){return new kr({check:"max_length",...f(t),maximum:e})}function ae(e,t){return new Er({check:"min_length",...f(t),minimum:e})}function It(e,t){return new zr({check:"length_equals",...f(t),length:e})}function ls(e,t){return new $r({check:"string_format",format:"regex",...f(t),pattern:e})}function hs(e){return new Zr({check:"string_format",format:"lowercase",...f(e)})}function ds(e){return new Sr({check:"string_format",format:"uppercase",...f(e)})}function fs(e,t){return new Or({check:"string_format",format:"includes",...f(t),includes:e})}function ps(e,t){return new Tr({check:"string_format",format:"starts_with",...f(t),prefix:e})}function ms(e,t){return new Ir({check:"string_format",format:"ends_with",...f(t),suffix:e})}function B(e){return new Cr({check:"overwrite",tx:e})}function _s(e){return B(t=>t.normalize(e))}function gs(){return B(e=>e.trim())}function vs(){return B(e=>e.toLowerCase())}function bs(){return B(e=>e.toUpperCase())}function ys(){return B(e=>En(e))}function ws(e,t,n){return new e({type:"array",element:t,...f(n)})}function ks(e,t,n){return new e({type:"custom",check:"custom",fn:t,...f(n)})}function Es(e){const t=zs(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(X(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(X(o))}},e(n.value,n)));return t}function zs(e,t){const n=new z({check:"custom",...f(t)});return n._zod.check=e,n}const $s=u("ZodISODateTime",(e,t)=>{Wr.init(e,t),k.init(e,t)});function Zs(e){return es($s,e)}const Ss=u("ZodISODate",(e,t)=>{Gr.init(e,t),k.init(e,t)});function Os(e){return ts(Ss,e)}const Ts=u("ZodISOTime",(e,t)=>{Br.init(e,t),k.init(e,t)});function Is(e){return ns(Ts,e)}const Cs=u("ZodISODuration",(e,t)=>{Jr.init(e,t),k.init(e,t)});function Ps(e){return rs(Cs,e)}const $=u("ZodError",(e,t)=>{rt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dn(e,n)},flatten:{value:n=>Nn(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ve,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ve,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),As=Ee($),Rs=ze($),Ns=ne($),Ds=re($),js=Un($),Ls=xn($),Us=Mn($),xs=Fn($),Ms=Kn($),Fs=Vn($),Ks=Wn($),Vs=Gn($),b=u("ZodType",(e,t)=>(g.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(L(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),e.clone=(n,r)=>R(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>As(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Ns(e,n,r),e.parseAsync=async(n,r)=>Rs(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Ds(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>js(e,n,r),e.decode=(n,r)=>Ls(e,n,r),e.encodeAsync=async(n,r)=>Us(e,n,r),e.decodeAsync=async(n,r)=>xs(e,n,r),e.safeEncode=(n,r)=>Ms(e,n,r),e.safeDecode=(n,r)=>Fs(e,n,r),e.safeEncodeAsync=async(n,r)=>Ks(e,n,r),e.safeDecodeAsync=async(n,r)=>Vs(e,n,r),e.refine=(n,r)=>e.check(Mi(n,r)),e.superRefine=n=>e.check(Fi(n)),e.overwrite=n=>e.check(B(n)),e.optional=()=>Lt(e),e.nullable=()=>Ut(e),e.nullish=()=>Lt(Ut(e)),e.nonoptional=n=>Ri(e,n),e.array=()=>gi(e),e.or=n=>x([e,n]),e.and=n=>wi(e,n),e.transform=n=>Mt(e,Oi(n)),e.default=n=>Ci(e,n),e.prefault=n=>Ai(e,n),e.catch=n=>Di(e,n),e.pipe=n=>Mt(e,n),e.readonly=()=>Ui(e),e.describe=n=>{const r=e.clone();return ue.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return ue.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ue.get(e);const r=e.clone();return ue.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ct=u("_ZodString",(e,t)=>{$e.init(e,t),b.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(ls(...r)),e.includes=(...r)=>e.check(fs(...r)),e.startsWith=(...r)=>e.check(ps(...r)),e.endsWith=(...r)=>e.check(ms(...r)),e.min=(...r)=>e.check(ae(...r)),e.max=(...r)=>e.check(Tt(...r)),e.length=(...r)=>e.check(It(...r)),e.nonempty=(...r)=>e.check(ae(1,...r)),e.lowercase=r=>e.check(hs(r)),e.uppercase=r=>e.check(ds(r)),e.trim=()=>e.check(gs()),e.normalize=(...r)=>e.check(_s(...r)),e.toLowerCase=()=>e.check(vs()),e.toUpperCase=()=>e.check(bs()),e.slugify=()=>e.check(ys())}),Ws=u("ZodString",(e,t)=>{$e.init(e,t),Ct.init(e,t),e.email=n=>e.check(Ao(Gs,n)),e.url=n=>e.check(Lo(Bs,n)),e.jwt=n=>e.check(Qo(ui,n)),e.emoji=n=>e.check(Uo(Js,n)),e.guid=n=>e.check($t(Pt,n)),e.uuid=n=>e.check(Ro(le,n)),e.uuidv4=n=>e.check(No(le,n)),e.uuidv6=n=>e.check(Do(le,n)),e.uuidv7=n=>e.check(jo(le,n)),e.nanoid=n=>e.check(xo(Hs,n)),e.guid=n=>e.check($t(Pt,n)),e.cuid=n=>e.check(Mo(Ys,n)),e.cuid2=n=>e.check(Fo(qs,n)),e.ulid=n=>e.check(Ko(Xs,n)),e.base64=n=>e.check(Yo(si,n)),e.base64url=n=>e.check(qo(ii,n)),e.xid=n=>e.check(Vo(Qs,n)),e.ksuid=n=>e.check(Wo(ei,n)),e.ipv4=n=>e.check(Go(ti,n)),e.ipv6=n=>e.check(Bo(ni,n)),e.cidrv4=n=>e.check(Jo(ri,n)),e.cidrv6=n=>e.check(Ho(oi,n)),e.e164=n=>e.check(Xo(ci,n)),e.datetime=n=>e.check(Zs(n)),e.date=n=>e.check(Os(n)),e.time=n=>e.check(Is(n)),e.duration=n=>e.check(Ps(n))});function J(e){return Po(Ws,e)}const k=u("ZodStringFormat",(e,t)=>{v.init(e,t),Ct.init(e,t)}),Gs=u("ZodEmail",(e,t)=>{Dr.init(e,t),k.init(e,t)}),Pt=u("ZodGUID",(e,t)=>{Rr.init(e,t),k.init(e,t)}),le=u("ZodUUID",(e,t)=>{Nr.init(e,t),k.init(e,t)}),Bs=u("ZodURL",(e,t)=>{jr.init(e,t),k.init(e,t)}),Js=u("ZodEmoji",(e,t)=>{Lr.init(e,t),k.init(e,t)}),Hs=u("ZodNanoID",(e,t)=>{Ur.init(e,t),k.init(e,t)}),Ys=u("ZodCUID",(e,t)=>{xr.init(e,t),k.init(e,t)}),qs=u("ZodCUID2",(e,t)=>{Mr.init(e,t),k.init(e,t)}),Xs=u("ZodULID",(e,t)=>{Fr.init(e,t),k.init(e,t)}),Qs=u("ZodXID",(e,t)=>{Kr.init(e,t),k.init(e,t)}),ei=u("ZodKSUID",(e,t)=>{Vr.init(e,t),k.init(e,t)}),ti=u("ZodIPv4",(e,t)=>{Hr.init(e,t),k.init(e,t)}),ni=u("ZodIPv6",(e,t)=>{Yr.init(e,t),k.init(e,t)}),ri=u("ZodCIDRv4",(e,t)=>{qr.init(e,t),k.init(e,t)}),oi=u("ZodCIDRv6",(e,t)=>{Xr.init(e,t),k.init(e,t)}),si=u("ZodBase64",(e,t)=>{Qr.init(e,t),k.init(e,t)}),ii=u("ZodBase64URL",(e,t)=>{to.init(e,t),k.init(e,t)}),ci=u("ZodE164",(e,t)=>{no.init(e,t),k.init(e,t)}),ui=u("ZodJWT",(e,t)=>{oo.init(e,t),k.init(e,t)}),At=u("ZodNumber",(e,t)=>{ft.init(e,t),b.init(e,t),e.gt=(r,o)=>e.check(St(r,o)),e.gte=(r,o)=>e.check(Oe(r,o)),e.min=(r,o)=>e.check(Oe(r,o)),e.lt=(r,o)=>e.check(Zt(r,o)),e.lte=(r,o)=>e.check(Se(r,o)),e.max=(r,o)=>e.check(Se(r,o)),e.int=r=>e.check(Rt(r)),e.safe=r=>e.check(Rt(r)),e.positive=r=>e.check(St(0,r)),e.nonnegative=r=>e.check(Oe(0,r)),e.negative=r=>e.check(Zt(0,r)),e.nonpositive=r=>e.check(Se(0,r)),e.multipleOf=(r,o)=>e.check(Ot(r,o)),e.step=(r,o)=>e.check(Ot(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Z(e){return os(At,e)}const ai=u("ZodNumberFormat",(e,t)=>{so.init(e,t),At.init(e,t)});function Rt(e){return ss(ai,e)}const li=u("ZodBoolean",(e,t)=>{io.init(e,t),b.init(e,t)});function Nt(e){return is(li,e)}const hi=u("ZodNull",(e,t)=>{co.init(e,t),b.init(e,t)});function di(e){return cs(hi,e)}const fi=u("ZodUnknown",(e,t)=>{uo.init(e,t),b.init(e,t)});function Dt(){return us(fi)}const pi=u("ZodNever",(e,t)=>{ao.init(e,t),b.init(e,t)});function mi(e){return as(pi,e)}const _i=u("ZodArray",(e,t)=>{lo.init(e,t),b.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ae(n,r)),e.nonempty=n=>e.check(ae(1,n)),e.max=(n,r)=>e.check(Tt(n,r)),e.length=(n,r)=>e.check(It(n,r)),e.unwrap=()=>e.element});function gi(e,t){return ws(_i,e,t)}const vi=u("ZodObject",(e,t)=>{fo.init(e,t),b.init(e,t),_(e,"shape",()=>t.shape),e.keyof=()=>$i(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Dt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Dt()}),e.strict=()=>e.clone({...e._zod.def,catchall:mi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>In(e,n),e.safeExtend=n=>Cn(e,n),e.merge=n=>Pn(e,n),e.pick=n=>On(e,n),e.omit=n=>Tn(e,n),e.partial=(...n)=>An(jt,e,n[0]),e.required=(...n)=>Rn(xt,e,n[0])});function y(e,t){const n={type:"object",shape:e??{},...f(t)};return new vi(n)}const bi=u("ZodUnion",(e,t)=>{po.init(e,t),b.init(e,t),e.options=t.options});function x(e,t){return new bi({type:"union",options:e,...f(t)})}const yi=u("ZodIntersection",(e,t)=>{mo.init(e,t),b.init(e,t)});function wi(e,t){return new yi({type:"intersection",left:e,right:t})}const ki=u("ZodTuple",(e,t)=>{_o.init(e,t),b.init(e,t),e.rest=n=>e.clone({...e._zod.def,rest:n})});function T(e,t,n){const r=t instanceof g,o=r?n:t,s=r?t:null;return new ki({type:"tuple",items:e,rest:s,...f(o)})}const Ei=u("ZodRecord",(e,t)=>{go.init(e,t),b.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function zi(e,t,n){return new Ei({type:"record",keyType:e,valueType:t,...f(n)})}const Te=u("ZodEnum",(e,t)=>{vo.init(e,t),b.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Te({...t,checks:[],...f(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Te({...t,checks:[],...f(o),entries:s})}});function $i(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Te({type:"enum",entries:n,...f(t)})}const Zi=u("ZodLiteral",(e,t)=>{bo.init(e,t),b.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function C(e,t){return new Zi({type:"literal",values:Array.isArray(e)?e:[e],...f(t)})}const Si=u("ZodTransform",(e,t)=>{yo.init(e,t),b.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ye(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(X(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(X(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Oi(e){return new Si({type:"transform",transform:e})}const jt=u("ZodOptional",(e,t)=>{wo.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Lt(e){return new jt({type:"optional",innerType:e})}const Ti=u("ZodNullable",(e,t)=>{ko.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ut(e){return new Ti({type:"nullable",innerType:e})}const Ii=u("ZodDefault",(e,t)=>{Eo.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ci(e,t){return new Ii({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():tt(t)}})}const Pi=u("ZodPrefault",(e,t)=>{zo.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ai(e,t){return new Pi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():tt(t)}})}const xt=u("ZodNonOptional",(e,t)=>{$o.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ri(e,t){return new xt({type:"nonoptional",innerType:e,...f(t)})}const Ni=u("ZodCatch",(e,t)=>{Zo.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Di(e,t){return new Ni({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ji=u("ZodPipe",(e,t)=>{So.init(e,t),b.init(e,t),e.in=t.in,e.out=t.out});function Mt(e,t){return new ji({type:"pipe",in:e,out:t})}const Li=u("ZodReadonly",(e,t)=>{Oo.init(e,t),b.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ui(e){return new Li({type:"readonly",innerType:e})}const xi=u("ZodCustom",(e,t)=>{To.init(e,t),b.init(e,t)});function Mi(e,t={}){return ks(xi,e,t)}function Fi(e){return Es(e)}const he=y({t:Z().gte(0),rate:Z().gte(0)}),H=y({opacity:Z().gte(0).lte(1),zIndex:Z().default(0)}),Y=y({volume:Z().gte(0).lte(1)}),Ki=y({type:C("image"),file:J(),fit:x([C("contain"),C("cover"),C("none")])}),Vi=y({type:C("audio"),file:J(),audioOutput:J(),enablePlaybackRateAdjustment:Nt()}),Wi=y({type:C("video"),file:J(),audioOutput:J(),enablePlaybackRateAdjustment:Nt(),fit:x([C("contain"),C("cover"),C("none")])}),Ie=T([Z(),di()]),Gi=T([Z(),y({set:y({...H.shape}).partial()}).partial()]),Bi=T([Z(),y({set:y({...H.shape}).partial(),lerp:y({...H.shape}).partial()}).partial()]),Ji=T([Z(),y({set:y({...he.shape,...Y.shape}).partial()}).partial()]),Hi=T([Z(),y({set:y({...he.shape,...Y.shape}).partial(),lerp:y({...Y.shape}).partial()}).partial()]),Yi=T([Z(),y({set:y({...he.shape,...Y.shape,...H.shape}).partial()}).partial()]),qi=T([Z(),y({set:y({...he.shape,...Y.shape,...H.shape}).partial(),lerp:y({...Y.shape,...H.shape}).partial()}).partial()]),Xi=y({...Ki.shape,keyframes:T([Bi],x([Gi,Ie]))}),Qi=y({...Vi.shape,keyframes:T([Hi],x([Ji,Ie]))}),ec=y({...Wi.shape,keyframes:T([qi],x([Yi,Ie]))}),tc=zi(J(),x([Xi,Qi,ec])),Ft={opacity:1,zIndex:0},Ce={t:0,rate:1,volume:1},Kt={t:0,rate:1,volume:1,opacity:1,zIndex:0},nc=Object.freeze(Object.defineProperty({__proto__:null,MediaSurfaceStateSchema:tc,defaultAudioOptions:Ce,defaultImageOptions:Ft,defaultVideoOptions:Kt},Symbol.toStringTag,{value:"Module"}));function de(e,t){if(!e.keyframes.filter(r=>r[1]===null).some(r=>r[0]<=t))switch(e.type){case"image":{if(e.keyframes[0][0]>t)return;const o=e.keyframes.filter(i=>i[1]!==null),s=Pe(o,t);return{...Ft,...s}}case"audio":{const r=e.keyframes.filter(i=>i[1]!==null),o=Vt(r,t);if(!o)return;const s=Pe(r,t);return{...Ce,...s,...o}}case"video":{const r=e.keyframes.filter(i=>i[1]!==null),o=Vt(r,t);if(!o)return;const s=Pe(r,t);return{...Kt,...s,...o}}}}function Pe(e,t){const n={};for(const[o,s]of e)o<=t?(Object.entries(s.lerp??{}).forEach(([i,c])=>{n[i]??={},n[i].before=[o,c]}),Object.entries(s.set??{}).forEach(([i,c])=>{n[i]??={},n[i].before=[o,c]})):Object.entries(s.lerp??{}).forEach(([i,c])=>{n[i]??={},n[i].after===void 0&&(n[i].after=[o,c])});const r={};return Object.entries(n).forEach(([o,{before:s,after:i}])=>{if(i===void 0&&s){r[o]=s[1];return}if(s&&i&&s[0]===i[0]){r[o]=i[1];return}if(s&&typeof s[1]=="number"&&i&&typeof i[1]=="number"){r[o]=s[1]+(t-s[0])*(i[1]-s[1])/(i[0]-s[0]);return}}),r}function Vt(e,t){const n=e[0];if(!n||n[0]>t)return;let r=0,{t:o,rate:s}=Ce;for(const[l,h]of e){if(l>t)break;const{set:p}=h;if(!p)continue;const{t:d,rate:m}=p;if(d!==void 0){r=l,o=d,m!==void 0&&(s=m);continue}if(m!==void 0){const P=(l-r)*s;r=l,o+=P,s=m}}const c=(t-r)*s,a=o+c;return{rate:s,t:a}}const rc=typeof navigator<"u"&&typeof navigator.standalone<"u",oc="GestureEvent"in window;function fe(e,t){return(e%t+t)%t}function sc(e,t,n){return e=fe(e,n),t=fe(t,n),Math.abs(e-t)<n/2?e-t:e<t?e+n-t:e-(t+n)}const Ae=e=>{try{const{pathname:t}=new URL(e,window.location.href);return t}catch{return}};class Re{constructor(t,n,r,o,s,i){this.surfaceElement=t,this.clipElement=n,this.constructAssetURL=o,this.getAudioOutput=s,this.mediaPreloader=i,this._state=r}isConnected(t){return!(!this.surfaceElement||!this.clipElement||!this.surfaceElement.contains(this.clipElement)||t&&!this.clipElement.contains(t))}_state;setState(t){this._state=t}timeout;loop=async()=>{clearTimeout(this.timeout),this.isConnected()?(this.update(),this.timeout=setTimeout(this.loop,Yt)):this.destroy()}}function Ne(e,t,n,r,o){let s;const i=r(n.file),c=Ae(i);switch(n.type){case"image":s=e instanceof HTMLImageElement?e:document.createElement("img"),Ae(s.src)!==c&&(s.src=i);break;case"audio":case"video":{if(e!==void 0){const a=Ae(e.src);e.tagName.toLowerCase()===n.type&&a!==void 0&&a===c&&(s=e)}s||(s=o.getElement(n.file,n.type)),s instanceof HTMLVideoElement&&!s.playsInline&&(s.playsInline=!0);break}}return(t.children.length!==1||t.childNodes[0]!==s)&&t.replaceChildren(s),s.style.position="absolute",s.style.width="100%",s.style.height="100%",s}function Wt(e,t,n){const r=String(t.opacity);e.style.opacity!==r&&(e.style.opacity=r);const o=Math.round(t.zIndex??0);parseInt(e.style.zIndex)!==o&&(e.style.zIndex=String(o)),e.style.objectFit!==n&&(e.style.objectFit=n)}function Gt(e,t,n,r){const o=t.volume*r;if(rc)o===0&&!e.muted?e.muted=!0:o>0&&e.muted&&(e.muted=!1);else if(e.muted&&(e.muted=!1),e.volume!==o&&(e.volume=o),e.sinkId!==n)try{e.setSinkId(n).catch(()=>{})}catch{}}const Bt=2e3,ic=1e3,Jt=100,Ht=50,Yt=5,pe=1e3,cc=10,uc=5,ac=.3,lc=.1;function hc(e){return Math.sign(e)*Math.pow(Math.abs(e)/pe,ac)*lc}function I(e,t){e.playbackRate!==t&&(e.playbackRate=t),e.paused&&e.play().catch(()=>{})}function qt(e,t,n,r,o){const s=o&&!oc;let i=!1;if(e.duration){const h=n.filter(([p,d])=>p>t.t&&(d?.set?.t!==void 0||d?.set?.rate!==void 0))[0];if(h?.[1]?.set?.t===0){const p=(e.duration-t.t)/t.rate,d=h[0]-t.t;i=Math.abs(p-d)<=uc,e.loop!==i&&(e.loop=i)}}const c=e.currentTime*1e3,a=i&&e.duration!==void 0?sc(c,t.t,e.duration*1e3):c-t.t,l=Math.abs(a);switch(!0){case(!s&&r.state==="idle"&&t.rate>0&&l>Bt):{const h=(t.t+t.rate*ic)/1e3;return e.duration!==void 0&&h>e.duration&&!i?{state:"idle"}:(I(e,0),e.currentTime=i?fe(h,e.duration*1e3):h,{state:"seeking-ahead"})}case(r.state==="seeking-ahead"&&e.seeking===!0):return{state:"seeking-ahead"};case(r.state==="seeking-ahead"&&e.seeking===!1):return I(e,0),{state:"seeked-ahead"};case(r.state==="seeked-ahead"&&a<-Jt):return I(e,t.rate),console.warn("Failed to seek ahead in time"),{state:"idle"};case(r.state==="seeked-ahead"&&l<=Jt):return I(e,t.rate),{state:"idle"};case(r.state==="seeked-ahead"&&l>Bt*1.5):return console.warn("Failed to seek ahead"),{state:"idle"};case r.state==="seeked-ahead":return{state:"seeked-ahead"};case(s&&r.state==="idle"&&t.rate>0&&l>Ht&&l<=pe):{const h=hc(a),p=Math.max(0,t.rate-h);return I(e,p),{state:"intercepting"}}case(r.state==="intercepting"&&l<=Yt):return I(e,t.rate),{state:"idle"};case(r.state==="intercepting"&&Math.sign(a)===Math.sign(e.playbackRate-t.rate)):return I(e,t.rate),{state:"idle"};case(r.state==="intercepting"&&l<pe*2):return{state:"intercepting"};case r.state==="intercepting":return I(e,t.rate),{state:"idle"};case(s&&r.state==="idle"&&l>pe):{const h=(t.t+t.rate*cc)/1e3;return e.currentTime=i?fe(h,e.duration*1e3):h,I(e,t.rate),{state:"seeking"}}case(r.state==="seeking"&&e.seeking):return{state:"seeking"};case(r.state==="seeking"&&!e.seeking):return{state:"idle"};case r.state==="idle":return I(e,t.rate),t.rate===0&&l>Ht&&(e.currentTime=t.t/1e3),{state:"idle"};default:return{state:"idle"}}}class dc extends Re{imageElement;update(){const t=de(this._state,Date.now());t?this.imageElement=Ne(this.imageElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.imageElement&&this.destroy(),!(!t||!this.imageElement)&&Wt(this.imageElement,t,this._state.fit)}destroy(){this.imageElement&&(this.imageElement.remove(),this.imageElement.src="",this.imageElement=void 0)}}class Xt extends Re{syncState={state:"idle"};audioElement;volume=1;update(){const t=de(this._state,Date.now());if(t?this.audioElement=Ne(this.audioElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!t||!this.audioElement)return;const n=this.getAudioOutput(this._state.audioOutput);Gt(this.audioElement,t,n,this.volume);const r=qt(this.audioElement,t,this._state.keyframes,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=r}destroy(){this.audioElement&&(this.audioElement.pause(),this.audioElement.remove(),this.audioElement.volume=0,this.audioElement.currentTime=0,this.mediaPreloader.releaseElement(this.audioElement)),this.audioElement=void 0}}class Qt extends Re{syncState={state:"idle"};videoElement;volume=1;update(){const t=de(this._state,Date.now());if(t?this.videoElement=Ne(this.videoElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!t||!this.videoElement)return;const n=this.getAudioOutput(this._state.audioOutput);Wt(this.videoElement,t,this._state.fit),Gt(this.videoElement,t,n,this.volume);const r=qt(this.videoElement,t,this._state.keyframes,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=r}destroy(){this.videoElement&&(this.videoElement.pause(),this.videoElement.remove(),this.videoElement.volume=0,this.videoElement.currentTime=0,this.mediaPreloader.releaseElement(this.videoElement)),this.videoElement=void 0}}class en{_state;_elements={};_constructAssetURL;constructor(t,n={}){this._constructAssetURL=t,this._state=n}get state(){return{...this._state}}setState(t){this._state=t,this.update()}update(){for(const[t,n]of Object.entries(this._elements)){if(!(t in this._state)){if(n.inUse){console.warn(`Failed to clean up element ${n.element.src}`);continue}n.element.src="",n.element.load(),delete this._elements[t]}n.inUse=n.element.isConnected}for(const[t,n]of Object.entries(this._state)){if(t in this._elements)continue;let r;switch(n.preload===!0?r="auto":n.preload===!1?r="none":r=n.preload,n.type){case"audio":{const o=document.createElement("audio");o.src=this._constructAssetURL(t),o.preload=r,this._elements[t]={element:o,inUse:!1,type:"audio"};break}case"video":{const o=document.createElement("video");o.src=this._constructAssetURL(t),o.preload=r,this._elements[t]={element:o,inUse:!1,type:"video"};break}}}}getElement(t,n){const r=this._elements[t];if(r&&r.inUse===!1)return r.inUse=!0,r.element;{const o=document.createElement(n);return o.src=this._constructAssetURL(t),n==="video"&&(this._elements[t]={element:o,type:n,inUse:!0}),o}}releaseElement(t){if(typeof t=="string"){const n=this._elements[t];n&&(n.inUse=!1)}else Object.values(this._elements).forEach(n=>{n.element===t&&(n.inUse=!1)})}}const fc="data-clip-id";class pc{constructor(t,n,r,o=new en(t)){this.constructAssetUrl=t,this.getAudioOutput=n,this.mediaPreloader=o,this._element=document.createElement("div"),this._element.className="surface-manager",this._element.style.width="100%",this._element.style.height="100%",this._state=r||{},this.update()}_state={};setState(t){this._state=t,this.update()}_volume=1;get volume(){return this._volume}set volume(t){this._volume=t,Object.values(this.resources).forEach(({manager:n})=>{(n instanceof Xt||n instanceof Qt)&&(n.volume=t)})}_element;get element(){return this._element}resources={};update(){Object.entries(this.resources).forEach(([n,{element:r,manager:o}])=>{n in this._state||(delete this.resources[n],r.remove(),o?.destroy())});const t=Object.keys(this._state).toSorted().map(n=>{const r=this.resources[n];if(r)return r.element;{const o=document.createElement("div");return o.setAttribute(fc,n),this.resources[n]={element:o},o}});this._element.replaceChildren(...t),Object.keys(this._state).toSorted().forEach(n=>{const r=this._state[n],o=this.resources[n];if(!o)throw new Error("Failed to create resource");if(o.manager)o.manager.setState(r);else switch(r.type){case"image":o.manager=new dc(this._element,o.element,r,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader),o.manager.loop();break;case"audio":{const s=new Xt(this._element,o.element,r,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);o.manager=s,s.volume=this._volume,s.loop();break}case"video":{const s=new Qt(this._element,o.element,r,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);o.manager=s,s.volume=this._volume,s.loop();break}}})}}const mc=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));w.CogsConfigChangedEvent=We,w.CogsConnection=bn,w.CogsConnectionCloseEvent=Ke,w.CogsConnectionOpenEvent=Fe,w.CogsIncomingEvent=Be,w.CogsMediaConfigChangedEvent=Je,w.CogsMessageEvent=Ve,w.CogsShowPhaseChangedEvent=He,w.CogsStateChangedEvent=Ge,w.DataStoreItemEvent=_e,w.DataStoreItemsEvent=ge,w.ManifestTypes=mc,w.MediaPreloader=en,w.MediaSchema=nc,w.SurfaceManager=pc,w.assetUrl=Me,w.getStateAtTime=de,w.preloadUrl=ln,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
38
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const $=p.compile();return(N,x)=>$(h,N,x)};let i;const o=Ve,u=!Wr.jitless,l=u&&zi.value,a=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=n.value);const I=h.value;return o(I)?u&&l&&p?.async===!1&&p.jitless!==!0?(i||(i=s(t.shape)),h=i(h,p),a?dn([],I,h,p,f,e):h):r(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),h)}});function pn(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const s=e.filter(i=>!Ze(i));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(o=>Se(o,n,be())))}),t)}const Ra=g("$ZodUnion",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),W(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),W(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),W(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>bt(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,i)=>{if(r)return n(s,i);let o=!1;const u=[];for(const c of t.options){const l=c._zod.run({value:s.value,issues:[]},i);if(l instanceof Promise)u.push(l),o=!0;else{if(l.issues.length===0)return l;u.push(l)}}return o?Promise.all(u).then(c=>pn(c,s,e,i)):pn(u,s,e,i)}}),Aa=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,i=t.left._zod.run({value:s,issues:[]},n),o=t.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,l])=>mn(r,c,l)):mn(r,i,o)}});function $t(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ze(e)&&ze(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),s={...e,...t};for(const i of n){const o=$t(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};s[i]=o.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],i=t[n],o=$t(s,i);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Ze(e))return e;const n=$t(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Ta=g("$ZodTuple",(e,t)=>{V.init(e,t);const r=t.items;e._zod.parse=(n,s)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];const o=[],u=[...r].reverse().findIndex(a=>a._zod.optin!=="optional"),c=u===-1?0:r.length-u;if(!t.rest){const a=i.length>r.length,f=i.length<c-1;if(a||f)return n.issues.push({...a?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let l=-1;for(const a of r){if(l++,l>=i.length&&l>=c)continue;const f=a._zod.run({value:i[l],issues:[]},s);f instanceof Promise?o.push(f.then(h=>Je(h,n,l))):Je(f,n,l)}if(t.rest){const a=i.slice(r.length);for(const f of a){l++;const h=t.rest._zod.run({value:f,issues:[]},s);h instanceof Promise?o.push(h.then(p=>Je(p,n,l))):Je(h,n,l)}}return o.length?Promise.all(o).then(()=>n):n}});function Je(e,t,r){e.issues.length&&t.issues.push(...Pe(r,e.issues)),t.value[r]=e.value}const Oa=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!ze(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const i=[],o=t.keyType._zod.values;if(o){r.value={};const u=new Set;for(const l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){u.add(typeof l=="number"?l.toString():l);const a=t.valueType._zod.run({value:s[l],issues:[]},n);a instanceof Promise?i.push(a.then(f=>{f.issues.length&&r.issues.push(...Pe(l,f.issues)),r.value[l]=f.value})):(a.issues.length&&r.issues.push(...Pe(l,a.issues)),r.value[l]=a.value)}let c;for(const l in s)u.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c})}else{r.value={};for(const u of Reflect.ownKeys(s)){if(u==="__proto__")continue;const c=t.keyType._zod.run({value:u,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(a=>Se(a,n,be())),input:u,path:[u],inst:e}),r.value[c.value]=c.value;continue}const l=t.valueType._zod.run({value:s[u],issues:[]},n);l instanceof Promise?i.push(l.then(a=>{a.issues.length&&r.issues.push(...Pe(u,a.issues)),r.value[c.value]=a.value})):(l.issues.length&&r.issues.push(...Pe(u,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),ka=g("$ZodEnum",(e,t)=>{V.init(e,t);const r=Ni(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>Zi.has(typeof s)).map(s=>typeof s=="string"?ke(s):s.toString()).join("|")})$`),e._zod.parse=(s,i)=>{const o=s.value;return n.has(o)||s.issues.push({code:"invalid_value",values:r,input:o,inst:e}),s}}),Pa=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ke(n):n?ke(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,s)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Na=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(o=>(r.value=o,r));if(s instanceof Promise)throw new Le;return r.value=s,r}});function gn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ca=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${bt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>gn(i,r.value)):gn(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),La=g("$ZodNullable",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${bt(r.source)}|null)$`):void 0}),W(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),za=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>vn(i,t)):vn(s,t)}});function vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Za=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Da=g("$ZodNonOptional",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>_n(i,e)):_n(s,e)}});function _n(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ja=g("$ZodCatch",(e,t)=>{V.init(e,t),W(e._zod,"optin",()=>t.innerType._zod.optin),W(e._zod,"optout",()=>t.innerType._zod.optout),W(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>Se(o,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Se(i,n,be()))},input:r.value}),r.issues=[]),r)}}),xa=g("$ZodPipe",(e,t)=>{V.init(e,t),W(e._zod,"values",()=>t.in._zod.values),W(e._zod,"optin",()=>t.in._zod.optin),W(e._zod,"optout",()=>t.out._zod.optout),W(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(o=>Qe(o,t.in,n)):Qe(i,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(i=>Qe(i,t.out,n)):Qe(s,t.out,n)}});function Qe(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ma=g("$ZodReadonly",(e,t)=>{V.init(e,t),W(e._zod,"propValues",()=>t.innerType._zod.propValues),W(e._zod,"values",()=>t.innerType._zod.values),W(e._zod,"optin",()=>t.innerType?._zod?.optin),W(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(En):En(s)}});function En(e){return e.value=Object.freeze(e.value),e}const Ua=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);const r=[];for(const n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);const s=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!s)throw new Error(`Invalid template literal part: ${n._zod.traits}`);const i=s.startsWith("^")?1:0,o=s.endsWith("$")?s.length-1:s.length;r.push(s.slice(i,o))}else if(n===null||Di.has(typeof n))r.push(ke(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,s)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"template_literal",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ba=g("$ZodCustom",(e,t)=>{oe.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(i=>bn(i,r,n,e));bn(s,r,n,e)}});function bn(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Ue(s))}}var wn;class Fa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qa(){return new Fa}(wn=globalThis).__zod_globalRegistry??(wn.__zod_globalRegistry=qa());const et=globalThis.__zod_globalRegistry;function Ga(e,t){return new e({type:"string",...A(t)})}function Va(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Sn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Xa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function Ya(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Qa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function ec(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function tc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function rc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function nc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function sc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function ic(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function oc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function ac(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function cc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function uc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function lc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function fc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function hc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function dc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function pc(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function gc(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function vc(e,t){return new e({type:"number",checks:[],...A(t)})}function _c(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function Ec(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...A(t)})}function bc(e,t){return new e({type:"boolean",...A(t)})}function wc(e,t){return new e({type:"null",...A(t)})}function Sc(e){return new e({type:"unknown"})}function yc(e,t){return new e({type:"never",...A(t)})}function yn(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!1})}function Rt(e,t){return new an({check:"less_than",...A(t),value:e,inclusive:!0})}function In(e,t){return new cn({check:"greater_than",...A(t),value:e,inclusive:!1})}function At(e,t){return new cn({check:"greater_than",...A(t),value:e,inclusive:!0})}function $n(e,t){return new Co({check:"multiple_of",...A(t),value:e})}function Rn(e,t){return new zo({check:"max_length",...A(t),maximum:e})}function tt(e,t){return new Zo({check:"min_length",...A(t),minimum:e})}function An(e,t){return new Do({check:"length_equals",...A(t),length:e})}function Ic(e,t){return new jo({check:"string_format",format:"regex",...A(t),pattern:e})}function $c(e){return new xo({check:"string_format",format:"lowercase",...A(e)})}function Rc(e){return new Mo({check:"string_format",format:"uppercase",...A(e)})}function Ac(e,t){return new Uo({check:"string_format",format:"includes",...A(t),includes:e})}function Tc(e,t){return new Bo({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Oc(e,t){return new Fo({check:"string_format",format:"ends_with",...A(t),suffix:e})}function De(e){return new qo({check:"overwrite",tx:e})}function kc(e){return De(t=>t.normalize(e))}function Pc(){return De(e=>e.trim())}function Nc(){return De(e=>e.toLowerCase())}function Cc(){return De(e=>e.toUpperCase())}function Lc(){return De(e=>Li(e))}function zc(e,t,r){return new e({type:"array",element:t,...A(r)})}function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function Dc(e){const t=jc(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ue(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Ue(s))}},e(r.value,r)));return t}function jc(e,t){const r=new oe({check:"custom",...A(t)});return r._zod.check=e,r}const xc=g("ZodISODateTime",(e,t)=>{sa.init(e,t),Y.init(e,t)});function Mc(e){return dc(xc,e)}const Uc=g("ZodISODate",(e,t)=>{ia.init(e,t),Y.init(e,t)});function Bc(e){return pc(Uc,e)}const Fc=g("ZodISOTime",(e,t)=>{oa.init(e,t),Y.init(e,t)});function qc(e){return mc(Fc,e)}const Gc=g("ZodISODuration",(e,t)=>{aa.init(e,t),Y.init(e,t)});function Vc(e){return gc(Gc,e)}const ce=g("ZodError",(e,t)=>{Qr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Hi(e,r)},flatten:{value:r=>Wi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,vt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,vt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wc=St(ce),Hc=yt(ce),Xc=He(ce),Kc=Xe(ce),Yc=Yi(ce),Jc=Ji(ce),Qc=Qi(ce),eu=eo(ce),tu=to(ce),ru=ro(ce),nu=no(ce),su=so(ce),X=g("ZodType",(e,t)=>(V.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Oe(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>we(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>Wc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Xc(e,r,n),e.parseAsync=async(r,n)=>Hc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Kc(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Yc(e,r,n),e.decode=(r,n)=>Jc(e,r,n),e.encodeAsync=async(r,n)=>Qc(e,r,n),e.decodeAsync=async(r,n)=>eu(e,r,n),e.safeEncode=(r,n)=>tu(e,r,n),e.safeDecode=(r,n)=>ru(e,r,n),e.safeEncodeAsync=async(r,n)=>nu(e,r,n),e.safeDecodeAsync=async(r,n)=>su(e,r,n),e.refine=(r,n)=>e.check(Yu(r,n)),e.superRefine=r=>e.check(Ju(r)),e.overwrite=r=>e.check(De(r)),e.optional=()=>jn(e),e.nullable=()=>xn(e),e.nullish=()=>jn(xn(e)),e.nonoptional=r=>Fu(e,r),e.array=()=>Ie(e),e.or=r=>pe([e,r]),e.and=r=>Pu(e,r),e.transform=r=>Un(e,Du(r)),e.default=r=>Mu(e,r),e.prefault=r=>Bu(e,r),e.catch=r=>Gu(e,r),e.pipe=r=>Un(e,r),e.readonly=()=>Hu(e),e.describe=r=>{const n=e.clone();return et.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return et.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return et.get(e);const n=e.clone();return et.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Tn=g("_ZodString",(e,t)=>{It.init(e,t),X.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ic(...n)),e.includes=(...n)=>e.check(Ac(...n)),e.startsWith=(...n)=>e.check(Tc(...n)),e.endsWith=(...n)=>e.check(Oc(...n)),e.min=(...n)=>e.check(tt(...n)),e.max=(...n)=>e.check(Rn(...n)),e.length=(...n)=>e.check(An(...n)),e.nonempty=(...n)=>e.check(tt(1,...n)),e.lowercase=n=>e.check($c(n)),e.uppercase=n=>e.check(Rc(n)),e.trim=()=>e.check(Pc()),e.normalize=(...n)=>e.check(kc(...n)),e.toLowerCase=()=>e.check(Nc()),e.toUpperCase=()=>e.check(Cc()),e.slugify=()=>e.check(Lc())}),iu=g("ZodString",(e,t)=>{It.init(e,t),Tn.init(e,t),e.email=r=>e.check(Va(ou,r)),e.url=r=>e.check(Ya(au,r)),e.jwt=r=>e.check(hc(Su,r)),e.emoji=r=>e.check(Ja(cu,r)),e.guid=r=>e.check(Sn(On,r)),e.uuid=r=>e.check(Wa(rt,r)),e.uuidv4=r=>e.check(Ha(rt,r)),e.uuidv6=r=>e.check(Xa(rt,r)),e.uuidv7=r=>e.check(Ka(rt,r)),e.nanoid=r=>e.check(Qa(uu,r)),e.guid=r=>e.check(Sn(On,r)),e.cuid=r=>e.check(ec(lu,r)),e.cuid2=r=>e.check(tc(fu,r)),e.ulid=r=>e.check(rc(hu,r)),e.base64=r=>e.check(uc(Eu,r)),e.base64url=r=>e.check(lc(bu,r)),e.xid=r=>e.check(nc(du,r)),e.ksuid=r=>e.check(sc(pu,r)),e.ipv4=r=>e.check(ic(mu,r)),e.ipv6=r=>e.check(oc(gu,r)),e.cidrv4=r=>e.check(ac(vu,r)),e.cidrv6=r=>e.check(cc(_u,r)),e.e164=r=>e.check(fc(wu,r)),e.datetime=r=>e.check(Mc(r)),e.date=r=>e.check(Bc(r)),e.time=r=>e.check(qc(r)),e.duration=r=>e.check(Vc(r))});function ee(e){return Ga(iu,e)}const Y=g("ZodStringFormat",(e,t)=>{K.init(e,t),Tn.init(e,t)}),ou=g("ZodEmail",(e,t)=>{Xo.init(e,t),Y.init(e,t)}),On=g("ZodGUID",(e,t)=>{Wo.init(e,t),Y.init(e,t)}),rt=g("ZodUUID",(e,t)=>{Ho.init(e,t),Y.init(e,t)}),au=g("ZodURL",(e,t)=>{Ko.init(e,t),Y.init(e,t)}),cu=g("ZodEmoji",(e,t)=>{Yo.init(e,t),Y.init(e,t)}),uu=g("ZodNanoID",(e,t)=>{Jo.init(e,t),Y.init(e,t)}),lu=g("ZodCUID",(e,t)=>{Qo.init(e,t),Y.init(e,t)}),fu=g("ZodCUID2",(e,t)=>{ea.init(e,t),Y.init(e,t)}),hu=g("ZodULID",(e,t)=>{ta.init(e,t),Y.init(e,t)}),du=g("ZodXID",(e,t)=>{ra.init(e,t),Y.init(e,t)}),pu=g("ZodKSUID",(e,t)=>{na.init(e,t),Y.init(e,t)}),mu=g("ZodIPv4",(e,t)=>{ca.init(e,t),Y.init(e,t)}),gu=g("ZodIPv6",(e,t)=>{ua.init(e,t),Y.init(e,t)}),vu=g("ZodCIDRv4",(e,t)=>{la.init(e,t),Y.init(e,t)}),_u=g("ZodCIDRv6",(e,t)=>{fa.init(e,t),Y.init(e,t)}),Eu=g("ZodBase64",(e,t)=>{ha.init(e,t),Y.init(e,t)}),bu=g("ZodBase64URL",(e,t)=>{pa.init(e,t),Y.init(e,t)}),wu=g("ZodE164",(e,t)=>{ma.init(e,t),Y.init(e,t)}),Su=g("ZodJWT",(e,t)=>{va.init(e,t),Y.init(e,t)}),kn=g("ZodNumber",(e,t)=>{ln.init(e,t),X.init(e,t),e.gt=(n,s)=>e.check(In(n,s)),e.gte=(n,s)=>e.check(At(n,s)),e.min=(n,s)=>e.check(At(n,s)),e.lt=(n,s)=>e.check(yn(n,s)),e.lte=(n,s)=>e.check(Rt(n,s)),e.max=(n,s)=>e.check(Rt(n,s)),e.int=n=>e.check(Nn(n)),e.safe=n=>e.check(Nn(n)),e.positive=n=>e.check(In(0,n)),e.nonnegative=n=>e.check(At(0,n)),e.negative=n=>e.check(yn(0,n)),e.nonpositive=n=>e.check(Rt(0,n)),e.multipleOf=(n,s)=>e.check($n(n,s)),e.step=(n,s)=>e.check($n(n,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Q(e){return vc(kn,e)}const Pn=g("ZodNumberFormat",(e,t)=>{_a.init(e,t),kn.init(e,t)});function Nn(e){return _c(Pn,e)}function ve(e){return Ec(Pn,e)}const yu=g("ZodBoolean",(e,t)=>{Ea.init(e,t),X.init(e,t)});function ye(e){return bc(yu,e)}const Iu=g("ZodNull",(e,t)=>{ba.init(e,t),X.init(e,t)});function $u(e){return wc(Iu,e)}const Ru=g("ZodUnknown",(e,t)=>{wa.init(e,t),X.init(e,t)});function Cn(){return Sc(Ru)}const Au=g("ZodNever",(e,t)=>{Sa.init(e,t),X.init(e,t)});function Ln(e){return yc(Au,e)}const Tu=g("ZodArray",(e,t)=>{ya.init(e,t),X.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(tt(r,n)),e.nonempty=r=>e.check(tt(1,r)),e.max=(r,n)=>e.check(Rn(r,n)),e.length=(r,n)=>e.check(An(r,n)),e.unwrap=()=>e.element});function Ie(e,t){return zc(Tu,e,t)}const zn=g("ZodObject",(e,t)=>{$a.init(e,t),X.init(e,t),W(e,"shape",()=>t.shape),e.keyof=()=>Lu(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Cn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Cn()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ln()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Bi(e,r),e.safeExtend=r=>Fi(e,r),e.merge=r=>qi(e,r),e.pick=r=>Mi(e,r),e.omit=r=>Ui(e,r),e.partial=(...r)=>Gi(Dn,e,r[0]),e.required=(...r)=>Vi(Mn,e,r[0])});function G(e,t){const r={type:"object",shape:e??{},...A(t)};return new zn(r)}function re(e,t){return new zn({type:"object",shape:e,catchall:Ln(),...A(t)})}const Ou=g("ZodUnion",(e,t)=>{Ra.init(e,t),X.init(e,t),e.options=t.options});function pe(e,t){return new Ou({type:"union",options:e,...A(t)})}const ku=g("ZodIntersection",(e,t)=>{Aa.init(e,t),X.init(e,t)});function Pu(e,t){return new ku({type:"intersection",left:e,right:t})}const Nu=g("ZodTuple",(e,t)=>{Ta.init(e,t),X.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function me(e,t,r){const n=t instanceof V,s=n?r:t,i=n?t:null;return new Nu({type:"tuple",items:e,rest:i,...A(s)})}const Cu=g("ZodRecord",(e,t)=>{Oa.init(e,t),X.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Zn(e,t,r){return new Cu({type:"record",keyType:e,valueType:t,...A(r)})}const Tt=g("ZodEnum",(e,t)=>{ka.init(e,t),X.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const i={};for(const o of n)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})},e.exclude=(n,s)=>{const i={...t.entries};for(const o of n)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new Tt({...t,checks:[],...A(s),entries:i})}});function Lu(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Tt({type:"enum",entries:r,...A(t)})}const zu=g("ZodLiteral",(e,t)=>{Pa.init(e,t),X.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new zu({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Zu=g("ZodTransform",(e,t)=>{Na.init(e,t),X.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ue(i,r.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Ue(o))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r)):(r.value=s,r)}});function Du(e){return new Zu({type:"transform",transform:e})}const Dn=g("ZodOptional",(e,t)=>{Ca.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jn(e){return new Dn({type:"optional",innerType:e})}const ju=g("ZodNullable",(e,t)=>{La.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xn(e){return new ju({type:"nullable",innerType:e})}const xu=g("ZodDefault",(e,t)=>{za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mu(e,t){return new xu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Uu=g("ZodPrefault",(e,t)=>{Za.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bu(e,t){return new Uu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Yr(t)}})}const Mn=g("ZodNonOptional",(e,t)=>{Da.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fu(e,t){return new Mn({type:"nonoptional",innerType:e,...A(t)})}const qu=g("ZodCatch",(e,t)=>{ja.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gu(e,t){return new qu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vu=g("ZodPipe",(e,t)=>{xa.init(e,t),X.init(e,t),e.in=t.in,e.out=t.out});function Un(e,t){return new Vu({type:"pipe",in:e,out:t})}const Wu=g("ZodReadonly",(e,t)=>{Ma.init(e,t),X.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hu(e){return new Wu({type:"readonly",innerType:e})}const Xu=g("ZodTemplateLiteral",(e,t)=>{Ua.init(e,t),X.init(e,t)});function nt(e,t){return new Xu({type:"template_literal",parts:e,...A(t)})}const Ku=g("ZodCustom",(e,t)=>{Ba.init(e,t),X.init(e,t)});function Yu(e,t={}){return Zc(Ku,e,t)}function Ju(e){return Dc(e)}const st=G({t:Q().gte(0),rate:Q().gte(0)}),je=G({opacity:Q().gte(0).lte(1),zIndex:Q().default(0)}),xe=G({volume:Q().gte(0).lte(1)}),Qu=G({type:B("image"),file:ee(),fit:pe([B("contain"),B("cover"),B("none")])}),el=G({type:B("audio"),file:ee(),audioOutput:ee(),enablePlaybackRateAdjustment:ye()}),tl=G({type:B("video"),file:ee(),audioOutput:ee(),enablePlaybackRateAdjustment:ye(),fit:pe([B("contain"),B("cover"),B("none")])}),Ot=me([Q(),$u()]),rl=me([Q(),G({set:G({...je.shape}).partial()}).partial()]),nl=me([Q(),G({set:G({...je.shape}).partial(),lerp:G({...je.shape}).partial()}).partial()]),sl=me([Q(),G({set:G({...st.shape,...xe.shape}).partial()}).partial()]),il=me([Q(),G({set:G({...st.shape,...xe.shape}).partial(),lerp:G({...xe.shape}).partial()}).partial()]),ol=me([Q(),G({set:G({...st.shape,...xe.shape,...je.shape}).partial()}).partial()]),al=me([Q(),G({set:G({...st.shape,...xe.shape,...je.shape}).partial(),lerp:G({...xe.shape,...je.shape}).partial()}).partial()]),cl=G({...Qu.shape,keyframes:me([nl],pe([rl,Ot]))}),ul=G({...el.shape,keyframes:me([il],pe([sl,Ot]))}),ll=G({...tl.shape,keyframes:me([al],pe([ol,Ot]))}),fl=Zn(ee(),pe([cl,ul,ll])),Bn={opacity:1,zIndex:0},kt={t:0,rate:1,volume:1},Fn={t:0,rate:1,volume:1,opacity:1,zIndex:0},hl=Object.freeze(Object.defineProperty({__proto__:null,MediaSurfaceStateSchema:fl,defaultAudioOptions:kt,defaultImageOptions:Bn,defaultVideoOptions:Fn},Symbol.toStringTag,{value:"Module"}));function it(e,t){if(!e.keyframes.filter(n=>n[1]===null).some(n=>n[0]<=t))switch(e.type){case"image":{if(e.keyframes[0][0]>t)return;const s=e.keyframes.filter(o=>o[1]!==null),i=Pt(s,t);return{...Bn,...i}}case"audio":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...kt,...i,...s}}case"video":{const n=e.keyframes.filter(o=>o[1]!==null),s=qn(n,t);if(!s)return;const i=Pt(n,t);return{...Fn,...i,...s}}}}function Pt(e,t){const r={};for(const[s,i]of e)s<=t?(Object.entries(i.lerp??{}).forEach(([o,u])=>{r[o]??={},r[o].before=[s,u]}),Object.entries(i.set??{}).forEach(([o,u])=>{r[o]??={},r[o].before=[s,u]})):Object.entries(i.lerp??{}).forEach(([o,u])=>{r[o]??={},r[o].after===void 0&&(r[o].after=[s,u])});const n={};return Object.entries(r).forEach(([s,{before:i,after:o}])=>{if(o===void 0&&i){n[s]=i[1];return}if(i&&o&&i[0]===o[0]){n[s]=o[1];return}if(i&&typeof i[1]=="number"&&o&&typeof o[1]=="number"){n[s]=i[1]+(t-i[0])*(o[1]-i[1])/(o[0]-i[0]);return}}),n}function qn(e,t){const r=e[0];if(!r||r[0]>t)return;let n=0,{t:s,rate:i}=kt;for(const[l,a]of e){if(l>t)break;const{set:f}=a;if(!f)continue;const{t:h,rate:p}=f;if(h!==void 0){n=l,s=h,p!==void 0&&(i=p);continue}if(p!==void 0){const _=(l-n)*i;n=l,s+=_,i=p}}const u=(t-n)*i,c=s+u;return{rate:i,t:c}}const dl=typeof navigator<"u"&&typeof navigator.standalone<"u",pl="GestureEvent"in window;function ot(e,t){return(e%t+t)%t}function ml(e,t,r){return e=ot(e,r),t=ot(t,r),Math.abs(e-t)<r/2?e-t:e<t?e+r-t:e-(t+r)}const Nt=e=>{try{const{pathname:t}=new URL(e,window.location.href);return t}catch{return}};class Ct{constructor(t,r,n,s,i,o){this.surfaceElement=t,this.clipElement=r,this.constructAssetURL=s,this.getAudioOutput=i,this.mediaPreloader=o,this._state=n}isConnected(t){return!(!this.surfaceElement||!this.clipElement||!this.surfaceElement.contains(this.clipElement)||t&&!this.clipElement.contains(t))}_state;setState(t){this._state=t}timeout;loop=async()=>{clearTimeout(this.timeout),this.isConnected()?(this.update(),this.timeout=setTimeout(this.loop,Kn)):this.destroy()}}function Lt(e,t,r,n,s){let i;const o=n(r.file),u=Nt(o);switch(r.type){case"image":i=e instanceof HTMLImageElement?e:document.createElement("img"),Nt(i.src)!==u&&(i.src=o);break;case"audio":case"video":{if(e!==void 0){const c=Nt(e.src);e.tagName.toLowerCase()===r.type&&c!==void 0&&c===u&&(i=e)}i||(i=s.getElement(r.file,r.type)),i instanceof HTMLVideoElement&&!i.playsInline&&(i.playsInline=!0);break}}return(t.children.length!==1||t.childNodes[0]!==i)&&t.replaceChildren(i),i.style.position="absolute",i.style.width="100%",i.style.height="100%",i}function Gn(e,t,r){const n=String(t.opacity);e.style.opacity!==n&&(e.style.opacity=n);const s=Math.round(t.zIndex??0);parseInt(e.style.zIndex)!==s&&(e.style.zIndex=String(s)),e.style.objectFit!==r&&(e.style.objectFit=r)}function Vn(e,t,r,n){const s=t.volume*n;if(dl)s===0&&!e.muted?e.muted=!0:s>0&&e.muted&&(e.muted=!1);else if(e.muted&&(e.muted=!1),e.volume!==s&&(e.volume=s),e.sinkId!==r)try{e.setSinkId(r).catch(()=>{})}catch{}}const Wn=2e3,gl=1e3,Hn=100,Xn=50,Kn=5,at=1e3,vl=10,_l=100,El=.3,bl=.1;function wl(e){return Math.sign(e)*Math.pow(Math.abs(e)/at,El)*bl}function ge(e,t){e.playbackRate!==t&&(e.playbackRate=t),e.paused&&e.play().catch(()=>{})}function Yn(e,t,r,n,s,i){const o=i&&!pl;let u=!1;if(e.duration){const h=r.filter(([p])=>p>r[0][0]&&p>n).filter(([,p])=>p?.set?.t!==void 0||p?.set?.rate!==void 0)[0];if(h?.[1]?.set?.t===0){const p=(e.duration*1e3-t.t)/t.rate,I=h[0]-n;u=Math.abs(p-I)<=_l,e.loop!==u&&(e.loop=u)}}const c=e.currentTime*1e3,l=u&&e.duration!==void 0?ml(c,t.t,e.duration*1e3):c-t.t,a=Math.abs(l);switch(!0){case(!o&&s.state==="idle"&&t.rate>0&&a>Wn):{const f=(t.t+t.rate*gl)/1e3;return e.duration!==void 0&&f>e.duration&&!u?{state:"idle"}:(ge(e,0),e.currentTime=u?ot(f,e.duration*1e3):f,{state:"seeking-ahead"})}case(s.state==="seeking-ahead"&&e.seeking===!0):return{state:"seeking-ahead"};case(s.state==="seeking-ahead"&&e.seeking===!1):return ge(e,0),{state:"seeked-ahead"};case(s.state==="seeked-ahead"&&l<-Hn):return ge(e,t.rate),console.warn("Failed to seek ahead in time"),{state:"idle"};case(s.state==="seeked-ahead"&&a<=Hn):return ge(e,t.rate),{state:"idle"};case(s.state==="seeked-ahead"&&a>Wn*1.5):return console.warn("Failed to seek ahead"),{state:"idle"};case s.state==="seeked-ahead":return{state:"seeked-ahead"};case(o&&s.state==="idle"&&t.rate>0&&a>Xn&&a<=at):{const f=wl(l),h=Math.max(0,t.rate-f);return ge(e,h),{state:"intercepting"}}case(s.state==="intercepting"&&a<=Kn):return ge(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&Math.sign(l)===Math.sign(e.playbackRate-t.rate)):return ge(e,t.rate),{state:"idle"};case(s.state==="intercepting"&&a<at*2):return{state:"intercepting"};case s.state==="intercepting":return ge(e,t.rate),{state:"idle"};case(o&&s.state==="idle"&&a>at):{const f=(t.t+t.rate*vl)/1e3;return e.currentTime=u?ot(f,e.duration*1e3):f,ge(e,t.rate),{state:"seeking"}}case(s.state==="seeking"&&e.seeking):return{state:"seeking"};case(s.state==="seeking"&&!e.seeking):return{state:"idle"};case s.state==="idle":return ge(e,t.rate),t.rate===0&&a>Xn&&(e.currentTime=t.t/1e3),{state:"idle"};default:return{state:"idle"}}}class Sl extends Ct{imageElement;update(){const t=it(this._state,Date.now());t?this.imageElement=Lt(this.imageElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.imageElement&&this.destroy(),!(!t||!this.imageElement)&&Gn(this.imageElement,t,this._state.fit)}destroy(){this.imageElement&&(this.imageElement.remove(),this.imageElement.src="",this.imageElement=void 0)}}class Jn extends Ct{syncState={state:"idle"};audioElement;volume=1;update(){const t=Date.now(),r=it(this._state,t);if(r?this.audioElement=Lt(this.audioElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.audioElement)return;const n=this.getAudioOutput(this._state.audioOutput);Vn(this.audioElement,r,n,this.volume);const s=Yn(this.audioElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.audioElement&&(this.audioElement.pause(),this.audioElement.remove(),this.audioElement.volume=0,this.audioElement.currentTime=0,this.mediaPreloader.releaseElement(this.audioElement)),this.audioElement=void 0}}class Qn extends Ct{syncState={state:"idle"};videoElement;volume=1;update(){const t=Date.now(),r=it(this._state,t);if(r?this.videoElement=Lt(this.videoElement,this.clipElement,this._state,this.constructAssetURL,this.mediaPreloader):this.destroy(),!r||!this.videoElement)return;const n=this.getAudioOutput(this._state.audioOutput);Gn(this.videoElement,r,this._state.fit),Vn(this.videoElement,r,n,this.volume);const s=Yn(this.videoElement,r,this._state.keyframes,t,this.syncState,this._state.enablePlaybackRateAdjustment);this.syncState=s}destroy(){this.videoElement&&(this.videoElement.pause(),this.videoElement.remove(),this.videoElement.volume=0,this.videoElement.currentTime=0,this.mediaPreloader.releaseElement(this.videoElement)),this.videoElement=void 0}}class es{_state;_elements={};_constructAssetURL;constructor(t,r={}){this._constructAssetURL=t,this._state=r}get state(){return{...this._state}}setState(t){this._state=t,this.update()}update(){for(const[t,r]of Object.entries(this._elements)){if(!(t in this._state)){if(r.inUse){console.warn(`Failed to clean up element ${r.element.src}`);continue}r.element.src="",r.element.load(),delete this._elements[t]}r.inUse=r.element.isConnected}for(const[t,r]of Object.entries(this._state)){if(t in this._elements)continue;let n;switch(r.preload===!0?n="auto":r.preload===!1?n="none":n=r.preload,r.type){case"audio":{const s=document.createElement("audio");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"audio"};break}case"video":{const s=document.createElement("video");s.src=this._constructAssetURL(t),s.preload=n,this._elements[t]={element:s,inUse:!1,type:"video"};break}}}}getElement(t,r){const n=this._elements[t];if(n&&n.inUse===!1)return n.inUse=!0,n.element;{const s=document.createElement(r);return s.src=this._constructAssetURL(t),r==="video"&&(this._elements[t]={element:s,type:r,inUse:!0}),s}}releaseElement(t){if(typeof t=="string"){const r=this._elements[t];r&&(r.inUse=!1)}else Object.values(this._elements).forEach(r=>{r.element===t&&(r.inUse=!1)})}}const yl="data-clip-id";class Il{constructor(t,r,n,s=new es(t)){this.constructAssetUrl=t,this.getAudioOutput=r,this.mediaPreloader=s,this._element=document.createElement("div"),this._element.className="surface-manager",this._element.style.width="100%",this._element.style.height="100%",this._state=n||{},this.update()}_state={};setState(t){this._state=t,this.update()}_volume=1;get volume(){return this._volume}set volume(t){this._volume=t,Object.values(this.resources).forEach(({manager:r})=>{(r instanceof Jn||r instanceof Qn)&&(r.volume=t)})}_element;get element(){return this._element}resources={};update(){Object.entries(this.resources).forEach(([r,{element:n,manager:s}])=>{r in this._state||(delete this.resources[r],n.remove(),s?.destroy())});const t=Object.keys(this._state).toSorted().map(r=>{const n=this.resources[r];if(n)return n.element;{const s=document.createElement("div");return s.setAttribute(yl,r),this.resources[r]={element:s},s}});this._element.replaceChildren(...t),Object.keys(this._state).toSorted().forEach(r=>{const n=this._state[r],s=this.resources[r];if(!s)throw new Error("Failed to create resource");if(s.manager)s.manager.setState(n);else switch(n.type){case"image":s.manager=new Sl(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader),s.manager.loop();break;case"audio":{const i=new Jn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}case"video":{const i=new Qn(this._element,s.element,n,this.constructAssetUrl,this.getAudioOutput,this.mediaPreloader);s.manager=i,i.volume=this._volume,i.loop();break}}})}}function $l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _e={},ue={},Ee={},Be={},ts;function ct(){if(ts)return Be;ts=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.AddressError=void 0;class e extends Error{constructor(r,n){super(r),this.name="AddressError",this.parseMessage=n}}return Be.AddressError=e,Be}var rs;function zt(){if(rs)return Ee;rs=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.isInSubnet=t,Ee.isCorrect=r,Ee.prefixLengthFromMask=n,Ee.numberToPaddedHex=s,Ee.stringToPaddedHex=i,Ee.testBit=o;const e=ct();function t(u){return this.subnetMask<u.subnetMask?!1:this.mask(u.subnetMask)===u.mask()}function r(u){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===u&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function n(u,c){const l=u.toString(2).padStart(c,"0");if(l.length>c)throw new e.AddressError("Invalid subnet mask.");const a=l.indexOf("0");if(a===-1)return c;if(l.slice(a).includes("1"))throw new e.AddressError("Invalid subnet mask.");return a}function s(u){return u.toString(16).padStart(2,"0")}function i(u){return s(parseInt(u,10))}function o(u,c){const{length:l}=u;if(c>l)return!1;const a=l-c;return u.substring(a,a+1)==="1"}return Ee}var le={},ns;function ss(){return ns||(ns=1,Object.defineProperty(le,"__esModule",{value:!0}),le.RE_SUBNET_STRING=le.RE_ADDRESS=le.GROUPS=le.BITS=void 0,le.BITS=32,le.GROUPS=4,le.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,le.RE_SUBNET_STRING=/\/\d{1,2}$/),le}var is;function os(){if(is)return ue;is=1;var e=ue&&ue.__createBinding||(Object.create?function(_,m,y,$){$===void 0&&($=y);var N=Object.getOwnPropertyDescriptor(m,y);(!N||("get"in N?!m.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return m[y]}}),Object.defineProperty(_,$,N)}:function(_,m,y,$){$===void 0&&($=y),_[$]=m[y]}),t=ue&&ue.__setModuleDefault||(Object.create?function(_,m){Object.defineProperty(_,"default",{enumerable:!0,value:m})}:function(_,m){_.default=m}),r=ue&&ue.__importStar||function(_){if(_&&_.__esModule)return _;var m={};if(_!=null)for(var y in _)y!=="default"&&Object.prototype.hasOwnProperty.call(_,y)&&e(m,_,y);return t(m,_),m};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Address4=void 0;const n=r(zt()),s=r(ss()),i=ct(),o=n.isCorrect(s.BITS);class u{constructor(m){this.groups=s.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=o,this.isInSubnet=n.isInSubnet,this.address=m;const y=s.RE_SUBNET_STRING.exec(m);if(y){if(this.parsedSubnet=y[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>s.BITS)throw new i.AddressError("Invalid subnet mask.");m=m.replace(s.RE_SUBNET_STRING,"")}this.addressMinusSuffix=m,this.parsedAddress=this.parse(m)}static isValid(m){try{return new u(m),!0}catch{return!1}}parse(m){const y=m.split(".");if(!m.match(s.RE_ADDRESS))throw new i.AddressError("Invalid IPv4 address.");return y}correctForm(){return this.parsedAddress.map(m=>parseInt(m,10)).join(".")}static fromAddressAndMask(m,y){const $=n.prefixLengthFromMask(new u(y).bigInt(),s.BITS);return new u(`${m}/${$}`)}static fromAddressAndWildcardMask(m,y){const $=new u(y).bigInt(),N=(BigInt(1)<<BigInt(s.BITS))-BigInt(1),x=$^N,C=n.prefixLengthFromMask(x,s.BITS);return new u(`${m}/${C}`)}static fromWildcard(m){const y=m.split(".");if(y.length!==s.GROUPS)throw new i.AddressError("Wildcard pattern must have 4 octets");let $=-1;for(let U=0;U<y.length;U++)if(y[U]==="*")$===-1&&($=U);else if($!==-1)throw new i.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");const N=$===-1?0:y.length-$,x=y.map(U=>U==="*"?"0":U),C=s.BITS-N*8;return new u(`${x.join(".")}/${C}`)}static fromHex(m){const y=m.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(y))throw new i.AddressError("IPv4 hex must be exactly 8 hex digits");const $=[];for(let N=0;N<8;N+=2)$.push(parseInt(y.slice(N,N+2),16));return new u($.join("."))}static fromInteger(m){if(!Number.isInteger(m)||m<0||m>4294967295)throw new i.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return u.fromHex(m.toString(16).padStart(8,"0"))}static fromArpa(m){const $=m.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new u($)}toHex(){return this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join(":")}toArray(){return this.parsedAddress.map(m=>parseInt(m,10))}toGroup6(){const m=[];let y;for(y=0;y<s.GROUPS;y+=2)m.push(`${n.stringToPaddedHex(this.parsedAddress[y])}${n.stringToPaddedHex(this.parsedAddress[y+1])}`);return m.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m=>n.stringToPaddedHex(m)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(s.BITS-this.subnetMask)}`)}startAddress(){return u.fromBigInt(this._startAddress())}startAddressExclusive(){const m=BigInt("1");return u.fromBigInt(this._startAddress()+m)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(s.BITS-this.subnetMask)}`)}endAddress(){return u.fromBigInt(this._endAddress())}endAddressExclusive(){const m=BigInt("1");return u.fromBigInt(this._endAddress()-m)}subnetMaskAddress(){return u.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(s.BITS-this.subnetMask)}`))}wildcardMask(){return u.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(s.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(m){if(m<0n||m>0xffffffffn)throw new i.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return u.fromHex(m.toString(16).padStart(8,"0"))}static fromByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");for(let y=0;y<m.length;y++)if(!Number.isInteger(m[y])||m[y]<0||m[y]>255)throw new i.AddressError("All bytes must be integers between 0 and 255");return this.fromUnsignedByteArray(m)}static fromUnsignedByteArray(m){if(m.length!==4)throw new i.AddressError("IPv4 addresses require exactly 4 bytes");const y=m.join(".");return new u(y)}mask(m){return m===void 0&&(m=this.subnetMask),this.getBitsBase2(0,m)}getBitsBase2(m,y){return this.binaryZeroPad().slice(m,y)}reverseForm(m){m||(m={});const y=this.correctForm().split(".").reverse().join(".");return m.omitSuffix?y:`${y}.in-addr.arpa.`}isMulticast(){return this.isInSubnet(c)}isPrivate(){return l.some(m=>this.isInSubnet(m))}isLoopback(){return this.isInSubnet(a)}isLinkLocal(){return this.isInSubnet(f)}isUnspecified(){return this.isInSubnet(h)}isBroadcast(){return this.isInSubnet(p)}isCGNAT(){return this.isInSubnet(I)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(s.BITS,"0")),this._binaryZeroPad}groupForV6(){const m=this.parsedAddress;return this.address.replace(s.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${m.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${m.slice(2,4).join(".")}</span>`)}}ue.Address4=u;const c=new u("224.0.0.0/4"),l=[new u("10.0.0.0/8"),new u("172.16.0.0/12"),new u("192.168.0.0/16")],a=new u("127.0.0.0/8"),f=new u("169.254.0.0/16"),h=new u("0.0.0.0/32"),p=new u("255.255.255.255/32"),I=new u("100.64.0.0/10");return ue}var fe={},J={},as;function cs(){return as||(as=1,Object.defineProperty(J,"__esModule",{value:!0}),J.RE_URL_WITH_PORT=J.RE_URL=J.RE_ZONE_STRING=J.RE_SUBNET_STRING=J.RE_BAD_ADDRESS=J.RE_BAD_CHARACTERS=J.TYPES=J.SCOPES=J.GROUPS=J.BITS=void 0,J.BITS=128,J.GROUPS=8,J.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},J.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast","fc00::/7":"Unique local","2002::/16":"6to4","2001:db8::/32":"Documentation","64:ff9b::/96":"NAT64 (well-known)","64:ff9b:1::/48":"NAT64 (local-use)"},J.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,J.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,J.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,J.RE_ZONE_STRING=/%.*$/,J.RE_URL=/^\[{0,1}([0-9a-f:]+)\]{0,1}/,J.RE_URL_WITH_PORT=/\[([0-9a-f:]+)\]:([0-9]{1,5})/),J}var $e={},us;function ls(){if(us)return $e;us=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.escapeHtml=e,$e.spanAllZeroes=t,$e.spanAll=r,$e.spanLeadingZeroes=s,$e.simpleGroup=i;function e(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function t(o){return e(o).replace(/(0+)/g,'<span class="zero">$1</span>')}function r(o,u=0){return o.split("").map((l,a)=>`<span class="digit value-${e(l)} position-${a+u}">${t(l)}</span>`).join("")}function n(o){return e(o).replace(/^(0+)/,'<span class="zero">$1</span>')}function s(o){return o.split(":").map(c=>n(c)).join(":")}function i(o,u=0){return o.split(":").map((l,a)=>/group-v4/.test(l)?l:`<span class="hover-group group-${a+u}">${n(l)}</span>`)}return $e}var ie={},fs;function Rl(){if(fs)return ie;fs=1;var e=ie&&ie.__createBinding||(Object.create?function(c,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(c,f,h)}:function(c,l,a,f){f===void 0&&(f=a),c[f]=l[a]}),t=ie&&ie.__setModuleDefault||(Object.create?function(c,l){Object.defineProperty(c,"default",{enumerable:!0,value:l})}:function(c,l){c.default=l}),r=ie&&ie.__importStar||function(c){if(c&&c.__esModule)return c;var l={};if(c!=null)for(var a in c)a!=="default"&&Object.prototype.hasOwnProperty.call(c,a)&&e(l,c,a);return t(l,c),l};Object.defineProperty(ie,"__esModule",{value:!0}),ie.ADDRESS_BOUNDARY=void 0,ie.groupPossibilities=s,ie.padGroup=i,ie.simpleRegularExpression=o,ie.possibleElisions=u;const n=r(cs());function s(c){return`(${c.join("|")})`}function i(c){return c.length<4?`0{0,${4-c.length}}${c}`:c}ie.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function o(c){const l=[];c.forEach((f,h)=>{parseInt(f,16)===0&&l.push(h)});const a=l.map(f=>c.map((h,p)=>{if(p===f){const I=p===0||p===n.GROUPS-1?":":"";return s([i(h),I])}return i(h)}).join(":"));return a.push(c.map(i).join(":")),s(a)}function u(c,l,a){const f=l?"":":",h=a?"":":",p=[];!l&&!a&&p.push("::"),l&&a&&p.push(""),(a&&!l||!a&&l)&&p.push(":"),p.push(`${f}(:0{1,4}){1,${c-1}}`),p.push(`(0{1,4}:){1,${c-1}}${h}`),p.push(`(0{1,4}:){${c-1}}0{1,4}`);for(let I=1;I<c-1;I++)for(let _=1;_<c-I;_++)p.push(`(0{1,4}:){${_}}:(0{1,4}:){${c-_-I-1}}0{1,4}`);return s(p)}return ie}var hs;function Al(){if(hs)return fe;hs=1;var e=fe&&fe.__createBinding||(Object.create?function(L,d,v,E){E===void 0&&(E=v);var b=Object.getOwnPropertyDescriptor(d,v);(!b||("get"in b?!d.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return d[v]}}),Object.defineProperty(L,E,b)}:function(L,d,v,E){E===void 0&&(E=v),L[E]=d[v]}),t=fe&&fe.__setModuleDefault||(Object.create?function(L,d){Object.defineProperty(L,"default",{enumerable:!0,value:d})}:function(L,d){L.default=d}),r=fe&&fe.__importStar||function(L){if(L&&L.__esModule)return L;var d={};if(L!=null)for(var v in L)v!=="default"&&Object.prototype.hasOwnProperty.call(L,v)&&e(d,L,v);return t(d,L),d};Object.defineProperty(fe,"__esModule",{value:!0}),fe.Address6=void 0;const n=r(zt()),s=r(ss()),i=r(cs()),o=r(ls()),u=os(),c=Rl(),l=ct(),a=zt(),f=n.isCorrect(i.BITS);function h(L){if(!L)throw new Error("Assertion failed.")}function p(L){const d=/(\d+)(\d{3})/;for(;d.test(L);)L=L.replace(d,"$1,$2");return L}function I(L){return L=L.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),L=L.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),L}function _(L,d){const v=[],E=[];let b;for(b=0;b<L.length;b++)b<d[0]?v.push(L[b]):b>d[1]&&E.push(L[b]);return v.concat(["compact"]).concat(E)}function m(L){return parseInt(L,16).toString(16).padStart(4,"0")}function y(L){return L&255}class ${constructor(d,v){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=n.isInSubnet,this.isCorrect=f,v===void 0?this.groups=i.GROUPS:this.groups=v,this.address=d;const E=i.RE_SUBNET_STRING.exec(d);if(E){if(this.parsedSubnet=E[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>i.BITS)throw new l.AddressError("Invalid subnet mask.");d=d.replace(i.RE_SUBNET_STRING,"")}else if(/\//.test(d))throw new l.AddressError("Invalid subnet mask.");const b=i.RE_ZONE_STRING.exec(d);b&&(this.zone=b[0],d=d.replace(i.RE_ZONE_STRING,"")),this.addressMinusSuffix=d,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(d){try{return new $(d),!0}catch{return!1}}static fromBigInt(d){if(d<0n||d>(1n<<BigInt(i.BITS))-1n)throw new l.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");const v=d.toString(16).padStart(32,"0"),E=[];for(let b=0;b<i.GROUPS;b++)E.push(v.slice(b*4,(b+1)*4));return new $(E.join(":"))}static fromURL(d){let v,E=null,b;if(d.indexOf("[")!==-1&&d.indexOf("]:")!==-1){if(b=i.RE_URL_WITH_PORT.exec(d),b===null)return{error:"failed to parse address with port",address:null,port:null};v=b[1],E=b[2]}else if(d.indexOf("/")!==-1){if(d=d.replace(/^[a-z0-9]+:\/\//,""),b=i.RE_URL.exec(d),b===null)return{error:"failed to parse address from URL",address:null,port:null};v=b[1]}else v=d;return E?(E=parseInt(E,10),(E<0||E>65536)&&(E=null)):E=null,{address:new $(v),port:E}}static fromAddressAndMask(d,v){const E=n.prefixLengthFromMask(new $(v).bigInt(),i.BITS);return new $(`${d}/${E}`)}static fromAddressAndWildcardMask(d,v){const E=new $(v).bigInt(),b=(BigInt(1)<<BigInt(i.BITS))-BigInt(1),k=E^b,D=n.prefixLengthFromMask(k,i.BITS);return new $(`${d}/${D}`)}static fromWildcard(d){if(d.includes("%")||d.includes("/"))throw new l.AddressError("Wildcard pattern must not include a zone or CIDR suffix");const v=d.split("::");if(v.length>2)throw new l.AddressError("Wildcard pattern cannot contain more than one '::'");let E;if(v.length===2){const w=v[0]===""?[]:v[0].split(":"),S=v[1]===""?[]:v[1].split(":"),T=i.GROUPS-w.length-S.length;if(T<1)throw new l.AddressError("Wildcard pattern with '::' has too many groups");E=[...w,...new Array(T).fill("0"),...S]}else E=d.split(":");if(E.length!==i.GROUPS)throw new l.AddressError("Wildcard pattern must have 8 groups");let b=-1;for(let w=0;w<E.length;w++)if(E[w]==="*")b===-1&&(b=w);else if(b!==-1)throw new l.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");const k=b===-1?0:E.length-b,D=E.map(w=>w==="*"?"0":w),j=i.BITS-k*16;return new $(`${D.join(":")}/${j}`)}static fromAddress4(d){const v=new u.Address4(d),E=i.BITS-(s.BITS-v.subnetMask);return new $(`::ffff:${v.correctForm()}/${E}`)}static fromArpa(d){let v=d.replace(/(\.ip6\.arpa)?\.$/,"");const E=7;if(v.length!==63)throw new l.AddressError("Invalid 'ip6.arpa' form.");const b=v.split(".").reverse();for(let k=E;k>0;k--){const D=k*4;b.splice(D,0,":")}return v=b.join(""),new $(v)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(d=this.subnetMask){return this.getBitsBase2(0,d)}possibleSubnets(d=128){const v=i.BITS-this.subnetMask,E=Math.abs(d-i.BITS),b=v-E;return b<0?"0":p((BigInt("2")**BigInt(b)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(i.BITS-this.subnetMask)}`)}startAddress(){return $.fromBigInt(this._startAddress())}startAddressExclusive(){const d=BigInt("1");return $.fromBigInt(this._startAddress()+d)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(i.BITS-this.subnetMask)}`)}endAddress(){return $.fromBigInt(this._endAddress())}endAddressExclusive(){const d=BigInt("1");return $.fromBigInt(this._endAddress()-d)}subnetMaskAddress(){return $.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(i.BITS-this.subnetMask)}`))}wildcardMask(){return $.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(i.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")?i.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":d==="Link-local unicast"||d==="Loopback"?"Link local":d==="Unspecified"?"Unknown":"Global"}getType(){for(let d=0;d<N.length;d++){const v=N[d];if(this.isInSubnet(v[0]))return v[1]}return"Global unicast"}getBits(d,v){return BigInt(`0b${this.getBitsBase2(d,v)}`)}getBitsBase2(d,v){return this.binaryZeroPad().slice(d,v)}getBitsBase16(d,v){const E=v-d;if(E%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(d,v).toString(16).padStart(E/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,i.BITS)}reverseForm(d){d||(d={});const v=Math.floor(this.subnetMask/4),E=this.canonicalForm().replace(/:/g,"").split("").slice(0,v).reverse().join(".");return v>0?d.omitSuffix?E:`${E}.ip6.arpa.`:d.omitSuffix?"":"ip6.arpa."}correctForm(){let d,v=[],E=0;const b=[];for(d=0;d<this.parsedAddress.length;d++){const j=parseInt(this.parsedAddress[d],16);j===0&&E++,j!==0&&E>0&&(E>1&&b.push([d-E,d-1]),E=0)}E>1&&b.push([this.parsedAddress.length-E,this.parsedAddress.length-1]);const k=b.map(j=>j[1]-j[0]+1);if(b.length>0){const j=k.indexOf(Math.max(...k));v=_(this.parsedAddress,b[j])}else v=this.parsedAddress;for(d=0;d<v.length;d++)v[d]!=="compact"&&(v[d]=parseInt(v[d],16).toString(16));let D=v.join(":");return D=D.replace(/^compact$/,"::"),D=D.replace(/(^compact)|(compact$)/,":"),D=D.replace(/compact/,""),D}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(i.BITS,"0")),this._binaryZeroPad}parse4in6(d){if(d.indexOf(".")===-1)return d;const v=d.split(":"),b=v.slice(-1)[0].match(s.RE_ADDRESS);if(b){this.parsedAddress4=b[0],this.address4=new u.Address4(this.parsedAddress4);for(let k=0;k<this.address4.groups;k++)if(/^0[0-9]+/.test(this.address4.parsedAddress[k])){const D=this.address4.parsedAddress.map(I).join("."),j=v.slice(0,-1).map(o.escapeHtml).join(":"),w=v.length>1?":":"";throw new l.AddressError("IPv4 addresses can't have leading zeroes.",`${j}${w}${D}`)}this.v4=!0,v[v.length-1]=this.address4.toGroup6(),d=v.join(":")}return d}parse(d){d=this.parse4in6(d);const v=d.match(i.RE_BAD_CHARACTERS);if(v)throw new l.AddressError(`Bad character${v.length>1?"s":""} detected in address: ${v.join("")}`,d.replace(i.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));const E=d.match(i.RE_BAD_ADDRESS);if(E)throw new l.AddressError(`Address failed regex: ${E.join("")}`,d.replace(i.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let b=[];const k=d.split("::");if(k.length===2){let D=k[0].split(":"),j=k[1].split(":");D.length===1&&D[0]===""&&(D=[]),j.length===1&&j[0]===""&&(j=[]);const w=this.groups-(D.length+j.length);if(!w)throw new l.AddressError("Error parsing groups");this.elidedGroups=w,this.elisionBegin=D.length,this.elisionEnd=D.length+this.elidedGroups,b=b.concat(D);for(let S=0;S<w;S++)b.push("0");b=b.concat(j)}else if(k.length===1)b=d.split(":"),this.elidedGroups=0;else throw new l.AddressError("Too many :: groups found");if(b=b.map(D=>parseInt(D,16).toString(16)),b.length!==this.groups)throw new l.AddressError("Incorrect number of groups found");return b}canonicalForm(){return this.parsedAddress.map(m).join(":")}decimal(){return this.parsedAddress.map(d=>parseInt(d,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(m).join("")}`)}to4(){const d=this.binaryZeroPad().split("");return u.Address4.fromHex(BigInt(`0b${d.slice(96,128).join("")}`).toString(16).padStart(8,"0"))}to4in6(){const d=this.to4(),E=new $(this.parsedAddress.slice(0,6).join(":"),6).correctForm();let b="";return/:$/.test(E)||(b=":"),E+b+d.address}inspectTeredo(){const d=this.getBitsBase16(0,32),E=(this.getBits(80,96)^BigInt("0xffff")).toString(),b=u.Address4.fromHex(this.getBitsBase16(32,64)),k=this.getBits(96,128),D=u.Address4.fromHex((k^BigInt("0xffffffff")).toString(16).padStart(8,"0")),j=this.getBitsBase2(64,80),w=(0,a.testBit)(j,15),S=(0,a.testBit)(j,14),T=(0,a.testBit)(j,8),R=(0,a.testBit)(j,9),Z=BigInt(`0b${j.slice(2,6)+j.slice(8,16)}`).toString(10);return{prefix:`${d.slice(0,4)}:${d.slice(4,8)}`,server4:b.address,client4:D.address,flags:j,coneNat:w,microsoft:{reserved:S,universalLocal:R,groupIndividual:T,nonce:Z},udpPort:E}}inspect6to4(){const d=this.getBitsBase16(0,16),v=u.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:d.slice(0,4),gateway:v.address}}to6to4(){if(!this.is4())return null;const d=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new $(d)}static fromAddress4Nat64(d,v="64:ff9b::/96"){const E=new u.Address4(d),b=new $(v),k=b.subnetMask;if(k!==32&&k!==40&&k!==48&&k!==56&&k!==64&&k!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");const D=b.binaryZeroPad(),j=E.binaryZeroPad();let w;if(k===96)w=D.slice(0,96)+j;else{const R=64-k;w=D.slice(0,k)+j.slice(0,R)+"00000000"+j.slice(R)+"0".repeat(56-(32-R))}const S=BigInt(`0b${w}`).toString(16).padStart(32,"0"),T=[];for(let R=0;R<8;R++)T.push(S.slice(R*4,(R+1)*4));return new $(T.join(":"))}toAddress4Nat64(d="64:ff9b::/96"){const v=new $(d),E=v.subnetMask;if(E!==32&&E!==40&&E!==48&&E!==56&&E!==64&&E!==96)throw new l.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isInSubnet(v))return null;const b=this.binaryZeroPad();let k;if(E===96)k=b.slice(96,128);else{const j=64-E;k=b.slice(E,E+j)+b.slice(72,72+(32-j))}const D=[];for(let j=0;j<4;j++)D.push(parseInt(k.slice(j*8,(j+1)*8),2).toString());return new u.Address4(D.join("."))}toByteArray(){const d=this.bigInt().toString(16),E=`${"0".repeat(d.length%2)}${d}`,b=[];for(let k=0,D=E.length;k<D;k+=2)b.push(parseInt(E.substring(k,k+2),16));return b}toUnsignedByteArray(){return this.toByteArray().map(y)}static fromByteArray(d){return this.fromUnsignedByteArray(d.map(y))}static fromUnsignedByteArray(d){const v=BigInt("256");let E=BigInt("0"),b=BigInt("1");for(let k=d.length-1;k>=0;k--)E+=b*BigInt(d[k].toString(10)),b*=v;return $.fromBigInt(E)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){const d=this.getType();return d==="Multicast"||d.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isInSubnet(z)}isTeredo(){return this.isInSubnet(x)}is6to4(){return this.isInSubnet(C)}isLoopback(){return this.getType()==="Loopback"}isULA(){return this.isInSubnet(U)}isUnspecified(){return this.getType()==="Unspecified"}isDocumentation(){return this.isInSubnet(te)}href(d){return d===void 0?d="":d=`:${d}`,`http://[${this.correctForm()}]${d}/`}link(d){d||(d={}),d.className===void 0&&(d.className=""),d.prefix===void 0&&(d.prefix="/#address="),d.v4===void 0&&(d.v4=!1);let v=this.correctForm;d.v4&&(v=this.to4in6);const E=v.call(this),b=o.escapeHtml(`${d.prefix}${E}`),k=o.escapeHtml(E);if(d.className){const D=o.escapeHtml(d.className);return`<a href="${b}" class="${D}">${k}</a>`}return`<a href="${b}">${k}</a>`}group(){if(this.elidedGroups===0)return o.simpleGroup(this.addressMinusSuffix).join(":");h(typeof this.elidedGroups=="number"),h(typeof this.elisionBegin=="number");const d=[],[v,E]=this.addressMinusSuffix.split("::");v.length?d.push(...o.simpleGroup(v)):d.push("");const b=["hover-group"];for(let k=this.elisionBegin;k<this.elisionBegin+this.elidedGroups;k++)b.push(`group-${k}`);return d.push(`<span class="${b.join(" ")}"></span>`),E.length?d.push(...o.simpleGroup(E,this.elisionEnd)):d.push(""),this.is4()&&(h(this.address4 instanceof u.Address4),d.pop(),d.push(this.address4.groupForV6())),d.join(":")}regularExpressionString(d=!1){let v=[];const E=new $(this.correctForm());if(E.elidedGroups===0)v.push((0,c.simpleRegularExpression)(E.parsedAddress));else if(E.elidedGroups===i.GROUPS)v.push((0,c.possibleElisions)(i.GROUPS));else{const b=E.address.split("::");b[0].length&&v.push((0,c.simpleRegularExpression)(b[0].split(":"))),h(typeof E.elidedGroups=="number"),v.push((0,c.possibleElisions)(E.elidedGroups,b[0].length!==0,b[1].length!==0)),b[1].length&&v.push((0,c.simpleRegularExpression)(b[1].split(":"))),v=[v.join(":")]}return d||(v=["(?=^|",c.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...v,")(?=[^\\w\\:]|",c.ADDRESS_BOUNDARY,"|$)"]),v.join("")}regularExpression(d=!1){return new RegExp(this.regularExpressionString(d),"i")}}fe.Address6=$;const N=Object.keys(i.TYPES).map(L=>[new $(L),i.TYPES[L]]),x=new $("2001::/32"),C=new $("2002::/16"),U=new $("fc00::/7"),te=new $("2001:db8::/32"),z=new $("::ffff:0:0/96");return fe}var ds;function Tl(){return ds||(ds=1,function(e){var t=_e&&_e.__createBinding||(Object.create?function(c,l,a,f){f===void 0&&(f=a);var h=Object.getOwnPropertyDescriptor(l,a);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(c,f,h)}:function(c,l,a,f){f===void 0&&(f=a),c[f]=l[a]}),r=_e&&_e.__setModuleDefault||(Object.create?function(c,l){Object.defineProperty(c,"default",{enumerable:!0,value:l})}:function(c,l){c.default=l}),n=_e&&_e.__importStar||function(c){if(c&&c.__esModule)return c;var l={};if(c!=null)for(var a in c)a!=="default"&&Object.prototype.hasOwnProperty.call(c,a)&&t(l,c,a);return r(l,c),l};Object.defineProperty(e,"__esModule",{value:!0}),e.v6=e.AddressError=e.Address6=e.Address4=void 0;var s=os();Object.defineProperty(e,"Address4",{enumerable:!0,get:function(){return s.Address4}});var i=Al();Object.defineProperty(e,"Address6",{enumerable:!0,get:function(){return i.Address6}});var o=ct();Object.defineProperty(e,"AddressError",{enumerable:!0,get:function(){return o.AddressError}});const u=n(ls());e.v6={helpers:u}}(_e)),_e}var Re=Tl();class ps{host;port;constructor(t){const r=t.lastIndexOf(":"),n=t.slice(0,r),s=t.slice(r+1);if(r===-1||!/^(\d+|\*)$/.test(s))throw new Error(`Invalid host pattern "${t}": a port (or "*") is required`);this.host=n,this.port=s}validate(t,r){return this.matchesHost(t)&&(this.port==="*"||Number(this.port)===r)}matchesHost(t){const r=this.host.toLowerCase();return t=t.toLowerCase(),r==="*"?!0:r==="localhost"?t==="localhost"||kl(t):r==="private"?Ol(t):r.startsWith("*.")?t.endsWith(r.slice(1)):r===t}}function Ol(e){return Re.Address4.isValid(e)&&new Re.Address4(e).isPrivate()}function kl(e){if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1);return Re.Address6.isValid(t)&&new Re.Address6(t).isLoopback()}return Re.Address4.isValid(e)&&new Re.Address4(e).isLoopback()||Re.Address6.isValid(e)&&new Re.Address6(e).isLoopback()}const Pl=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var ut={exports:{}},Zt,ms;function Fe(){if(ms)return Zt;ms=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,s=t-6;return Zt={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Zt}var Dt,gs;function lt(){return gs||(gs=1,Dt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Dt}var vs;function qe(){return vs||(vs=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Fe(),i=lt();t=e.exports={};const o=t.re=[],u=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],a=t.t={};let f=0;const h="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",s],[h,n]],I=m=>{for(const[y,$]of p)m=m.split(`${y}*`).join(`${y}{0,${$}}`).split(`${y}+`).join(`${y}{1,${$}}`);return m},_=(m,y,$)=>{const N=I(y),x=f++;i(m,x,y),a[m]=x,c[x]=y,l[x]=N,o[x]=new RegExp(y,$?"g":void 0),u[x]=new RegExp(N,$?"g":void 0)};_("NUMERICIDENTIFIER","0|[1-9]\\d*"),_("NUMERICIDENTIFIERLOOSE","\\d+"),_("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),_("MAINVERSION",`(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})\\.(${c[a.NUMERICIDENTIFIER]})`),_("MAINVERSIONLOOSE",`(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})\\.(${c[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASEIDENTIFIER",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIER]})`),_("PRERELEASEIDENTIFIERLOOSE",`(?:${c[a.NONNUMERICIDENTIFIER]}|${c[a.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASE",`(?:-(${c[a.PRERELEASEIDENTIFIER]}(?:\\.${c[a.PRERELEASEIDENTIFIER]})*))`),_("PRERELEASELOOSE",`(?:-?(${c[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[a.PRERELEASEIDENTIFIERLOOSE]})*))`),_("BUILDIDENTIFIER",`${h}+`),_("BUILD",`(?:\\+(${c[a.BUILDIDENTIFIER]}(?:\\.${c[a.BUILDIDENTIFIER]})*))`),_("FULLPLAIN",`v?${c[a.MAINVERSION]}${c[a.PRERELEASE]}?${c[a.BUILD]}?`),_("FULL",`^${c[a.FULLPLAIN]}$`),_("LOOSEPLAIN",`[v=\\s]*${c[a.MAINVERSIONLOOSE]}${c[a.PRERELEASELOOSE]}?${c[a.BUILD]}?`),_("LOOSE",`^${c[a.LOOSEPLAIN]}$`),_("GTLT","((?:<|>)?=?)"),_("XRANGEIDENTIFIERLOOSE",`${c[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),_("XRANGEIDENTIFIER",`${c[a.NUMERICIDENTIFIER]}|x|X|\\*`),_("XRANGEPLAIN",`[v=\\s]*(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:\\.(${c[a.XRANGEIDENTIFIER]})(?:${c[a.PRERELEASE]})?${c[a.BUILD]}?)?)?`),_("XRANGEPLAINLOOSE",`[v=\\s]*(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[a.XRANGEIDENTIFIERLOOSE]})(?:${c[a.PRERELEASELOOSE]})?${c[a.BUILD]}?)?)?`),_("XRANGE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAIN]}$`),_("XRANGELOOSE",`^${c[a.GTLT]}\\s*${c[a.XRANGEPLAINLOOSE]}$`),_("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),_("COERCE",`${c[a.COERCEPLAIN]}(?:$|[^\\d])`),_("COERCEFULL",c[a.COERCEPLAIN]+`(?:${c[a.PRERELEASE]})?(?:${c[a.BUILD]})?(?:$|[^\\d])`),_("COERCERTL",c[a.COERCE],!0),_("COERCERTLFULL",c[a.COERCEFULL],!0),_("LONETILDE","(?:~>?)"),_("TILDETRIM",`(\\s*)${c[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",_("TILDE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAIN]}$`),_("TILDELOOSE",`^${c[a.LONETILDE]}${c[a.XRANGEPLAINLOOSE]}$`),_("LONECARET","(?:\\^)"),_("CARETTRIM",`(\\s*)${c[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",_("CARET",`^${c[a.LONECARET]}${c[a.XRANGEPLAIN]}$`),_("CARETLOOSE",`^${c[a.LONECARET]}${c[a.XRANGEPLAINLOOSE]}$`),_("COMPARATORLOOSE",`^${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]})$|^$`),_("COMPARATOR",`^${c[a.GTLT]}\\s*(${c[a.FULLPLAIN]})$|^$`),_("COMPARATORTRIM",`(\\s*)${c[a.GTLT]}\\s*(${c[a.LOOSEPLAIN]}|${c[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",_("HYPHENRANGE",`^\\s*(${c[a.XRANGEPLAIN]})\\s+-\\s+(${c[a.XRANGEPLAIN]})\\s*$`),_("HYPHENRANGELOOSE",`^\\s*(${c[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[a.XRANGEPLAINLOOSE]})\\s*$`),_("STAR","(<|>)?=?\\s*\\*"),_("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),_("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(ut,ut.exports)),ut.exports}var jt,_s;function xt(){if(_s)return jt;_s=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return jt=n=>n?typeof n!="object"?e:n:t,jt}var Mt,Es;function bs(){if(Es)return Mt;Es=1;const e=/^[0-9]+$/,t=(n,s)=>{if(typeof n=="number"&&typeof s=="number")return n===s?0:n<s?-1:1;const i=e.test(n),o=e.test(s);return i&&o&&(n=+n,s=+s),n===s?0:i&&!o?-1:o&&!i?1:n<s?-1:1};return Mt={compareIdentifiers:t,rcompareIdentifiers:(n,s)=>t(s,n)},Mt}var Ut,ws;function se(){if(ws)return Ut;ws=1;const e=lt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Fe(),{safeRe:n,t:s}=qe(),i=xt(),{compareIdentifiers:o}=bs(),u=(l,a)=>{const f=a.split(".");if(f.length>l.length)return!1;for(let h=0;h<f.length;h++)if(o(l[h],f[h])!==0)return!1;return!0};class c{constructor(a,f){if(f=i(f),a instanceof c){if(a.loose===!!f.loose&&a.includePrerelease===!!f.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",a,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const h=a.trim().match(f.loose?n[s.LOOSE]:n[s.FULL]);if(!h)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(p=>{if(/^[0-9]+$/.test(p)){const I=+p;if(I>=0&&I<r)return I}return p}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(a){if(e("SemVer.compare",this.version,this.options,a),!(a instanceof c)){if(typeof a=="string"&&a===this.version)return 0;a=new c(a,this.options)}return a.version===this.version?0:this.compareMain(a)||this.comparePre(a)}compareMain(a){return a instanceof c||(a=new c(a,this.options)),this.major<a.major?-1:this.major>a.major?1:this.minor<a.minor?-1:this.minor>a.minor?1:this.patch<a.patch?-1:this.patch>a.patch?1:0}comparePre(a){if(a instanceof c||(a=new c(a,this.options)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;let f=0;do{const h=this.prerelease[f],p=a.prerelease[f];if(e("prerelease compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}compareBuild(a){a instanceof c||(a=new c(a,this.options));let f=0;do{const h=this.build[f],p=a.build[f];if(e("build compare",f,h,p),h===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(h===void 0)return-1;if(h===p)continue;return o(h,p)}while(++f)}inc(a,f,h){if(a.startsWith("pre")){if(!f&&h===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const p=`-${f}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!p||p[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,h);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,h);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,h),this.inc("pre",f,h);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,h),this.inc("pre",f,h);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const p=Number(h)?1:0;if(this.prerelease.length===0)this.prerelease=[p];else{let I=this.prerelease.length;for(;--I>=0;)typeof this.prerelease[I]=="number"&&(this.prerelease[I]++,I=-2);if(I===-1){if(f===this.prerelease.join(".")&&h===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(f){let I=[f,p];if(h===!1&&(I=[f]),u(this.prerelease,f)){const _=this.prerelease[f.split(".").length];isNaN(_)&&(this.prerelease=I)}else this.prerelease=I}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ut=c,Ut}var Bt,Ss;function Ne(){if(Ss)return Bt;Ss=1;const e=se();return Bt=(r,n,s=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(i){if(!s)return null;throw i}},Bt}var Ft,ys;function Nl(){if(ys)return Ft;ys=1;const e=Ne();return Ft=(r,n)=>{const s=e(r,n);return s?s.version:null},Ft}var qt,Is;function Cl(){if(Is)return qt;Is=1;const e=Ne();return qt=(r,n)=>{const s=e(r.trim().replace(/^[=v]+/,""),n);return s?s.version:null},qt}var Gt,$s;function Ll(){if($s)return Gt;$s=1;const e=se();return Gt=(r,n,s,i,o)=>{typeof s=="string"&&(o=i,i=s,s=void 0);try{return new e(r instanceof e?r.version:r,s).inc(n,i,o).version}catch{return null}},Gt}var Vt,Rs;function zl(){if(Rs)return Vt;Rs=1;const e=Ne();return Vt=(r,n)=>{const s=e(r,null,!0),i=e(n,null,!0),o=s.compare(i);if(o===0)return null;const u=o>0,c=u?s:i,l=u?i:s,a=!!c.prerelease.length;if(!!l.prerelease.length&&!a){if(!l.patch&&!l.minor)return"major";if(l.compareMain(c)===0)return l.minor&&!l.patch?"minor":"patch"}const h=a?"pre":"";return s.major!==i.major?h+"major":s.minor!==i.minor?h+"minor":s.patch!==i.patch?h+"patch":"prerelease"},Vt}var Wt,As;function Zl(){if(As)return Wt;As=1;const e=se();return Wt=(r,n)=>new e(r,n).major,Wt}var Ht,Ts;function Dl(){if(Ts)return Ht;Ts=1;const e=se();return Ht=(r,n)=>new e(r,n).minor,Ht}var Xt,Os;function jl(){if(Os)return Xt;Os=1;const e=se();return Xt=(r,n)=>new e(r,n).patch,Xt}var Kt,ks;function xl(){if(ks)return Kt;ks=1;const e=Ne();return Kt=(r,n)=>{const s=e(r,n);return s&&s.prerelease.length?s.prerelease:null},Kt}var Yt,Ps;function he(){if(Ps)return Yt;Ps=1;const e=se();return Yt=(r,n,s)=>new e(r,s).compare(new e(n,s)),Yt}var Jt,Ns;function Ml(){if(Ns)return Jt;Ns=1;const e=he();return Jt=(r,n,s)=>e(n,r,s),Jt}var Qt,Cs;function Ul(){if(Cs)return Qt;Cs=1;const e=he();return Qt=(r,n)=>e(r,n,!0),Qt}var er,Ls;function tr(){if(Ls)return er;Ls=1;const e=se();return er=(r,n,s)=>{const i=new e(r,s),o=new e(n,s);return i.compare(o)||i.compareBuild(o)},er}var rr,zs;function Bl(){if(zs)return rr;zs=1;const e=tr();return rr=(r,n)=>r.sort((s,i)=>e(s,i,n)),rr}var nr,Zs;function Fl(){if(Zs)return nr;Zs=1;const e=tr();return nr=(r,n)=>r.sort((s,i)=>e(i,s,n)),nr}var sr,Ds;function ft(){if(Ds)return sr;Ds=1;const e=he();return sr=(r,n,s)=>e(r,n,s)>0,sr}var ir,js;function or(){if(js)return ir;js=1;const e=he();return ir=(r,n,s)=>e(r,n,s)<0,ir}var ar,xs;function Ms(){if(xs)return ar;xs=1;const e=he();return ar=(r,n,s)=>e(r,n,s)===0,ar}var cr,Us;function Bs(){if(Us)return cr;Us=1;const e=he();return cr=(r,n,s)=>e(r,n,s)!==0,cr}var ur,Fs;function lr(){if(Fs)return ur;Fs=1;const e=he();return ur=(r,n,s)=>e(r,n,s)>=0,ur}var fr,qs;function hr(){if(qs)return fr;qs=1;const e=he();return fr=(r,n,s)=>e(r,n,s)<=0,fr}var dr,Gs;function Vs(){if(Gs)return dr;Gs=1;const e=Ms(),t=Bs(),r=ft(),n=lr(),s=or(),i=hr();return dr=(u,c,l,a)=>{switch(c){case"===":return typeof u=="object"&&(u=u.version),typeof l=="object"&&(l=l.version),u===l;case"!==":return typeof u=="object"&&(u=u.version),typeof l=="object"&&(l=l.version),u!==l;case"":case"=":case"==":return e(u,l,a);case"!=":return t(u,l,a);case">":return r(u,l,a);case">=":return n(u,l,a);case"<":return s(u,l,a);case"<=":return i(u,l,a);default:throw new TypeError(`Invalid operator: ${c}`)}},dr}var pr,Ws;function ql(){if(Ws)return pr;Ws=1;const e=se(),t=Ne(),{safeRe:r,t:n}=qe();return pr=(i,o)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;o=o||{};let u=null;if(!o.rtl)u=i.match(o.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const p=o.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let I;for(;(I=p.exec(i))&&(!u||u.index+u[0].length!==i.length);)(!u||I.index+I[0].length!==u.index+u[0].length)&&(u=I),p.lastIndex=I.index+I[1].length+I[2].length;p.lastIndex=-1}if(u===null)return null;const c=u[2],l=u[3]||"0",a=u[4]||"0",f=o.includePrerelease&&u[5]?`-${u[5]}`:"",h=o.includePrerelease&&u[6]?`+${u[6]}`:"";return t(`${c}.${l}.${a}${f}${h}`,o)},pr}var mr,Hs;function Gl(){if(Hs)return mr;Hs=1;const e=Ne(),t=Fe(),r=se(),n=(u,c,l)=>{if(!t.RELEASE_TYPES.includes(c))return null;const a=s(u,l);return a&&i(a,c)},s=(u,c)=>{const l=u instanceof r?u.version:u;return e(l,c)},i=(u,c)=>{if(o(c))return u.version;switch(u.prerelease=[],c){case"major":u.minor=0,u.patch=0;break;case"minor":u.patch=0;break}return u.format()},o=u=>u.startsWith("pre");return mr=n,mr}var gr,Xs;function Vl(){if(Xs)return gr;Xs=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return gr=e,gr}var vr,Ks;function de(){if(Ks)return vr;Ks=1;const e=/\s+/g;class t{constructor(S,T){if(T=s(T),S instanceof t)return S.loose===!!T.loose&&S.includePrerelease===!!T.includePrerelease?S:new t(S.raw,T);if(S instanceof i)return this.raw=S.value,this.set=[[S]],this.formatted=void 0,this;if(this.options=T,this.loose=!!T.loose,this.includePrerelease=!!T.includePrerelease,this.raw=S.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(Z=>!y(Z[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const Z of this.set)if(Z.length===1&&$(Z[0])){this.set=[Z];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let S=0;S<this.set.length;S++){S>0&&(this.formatted+="||");const T=this.set[S];for(let R=0;R<T.length;R++)R>0&&(this.formatted+=" "),this.formatted+=T[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(S){S=S.replace(m,"");const R=((this.options.includePrerelease&&I)|(this.options.loose&&_))+":"+S,Z=n.get(R);if(Z)return Z;const O=this.options.loose,P=O?c[a.HYPHENRANGELOOSE]:c[a.HYPHENRANGE];S=S.replace(P,D(this.options.includePrerelease)),o("hyphen replace",S),S=S.replace(c[a.COMPARATORTRIM],f),o("comparator trim",S),S=S.replace(c[a.TILDETRIM],h),o("tilde trim",S),S=S.replace(c[a.CARETTRIM],p),o("caret trim",S);let F=S.split(" ").map(ne=>x(ne,this.options)).join(" ").split(/\s+/).map(ne=>k(ne,this.options));O&&(F=F.filter(ne=>(o("loose invalid filter",ne,this.options),!!ne.match(c[a.COMPARATORLOOSE])))),o("range list",F);const M=new Map,q=F.map(ne=>new i(ne,this.options));for(const ne of q){if(y(ne))return[ne];M.set(ne.value,ne)}M.size>1&&M.has("")&&M.delete("");const ae=[...M.values()];return n.set(R,ae),ae}intersects(S,T){if(!(S instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>N(R,T)&&S.set.some(Z=>N(Z,T)&&R.every(O=>Z.every(P=>O.intersects(P,T)))))}test(S){if(!S)return!1;if(typeof S=="string")try{S=new u(S,this.options)}catch{return!1}for(let T=0;T<this.set.length;T++)if(j(this.set[T],S,this.options))return!0;return!1}}vr=t;const r=Vl(),n=new r,s=xt(),i=ht(),o=lt(),u=se(),{safeRe:c,src:l,t:a,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:p}=qe(),{FLAG_INCLUDE_PRERELEASE:I,FLAG_LOOSE:_}=Fe(),m=new RegExp(l[a.BUILD],"g"),y=w=>w.value==="<0.0.0-0",$=w=>w.value==="",N=(w,S)=>{let T=!0;const R=w.slice();let Z=R.pop();for(;T&&R.length;)T=R.every(O=>Z.intersects(O,S)),Z=R.pop();return T},x=(w,S)=>(w=w.replace(c[a.BUILD],""),o("comp",w,S),w=L(w,S),o("caret",w),w=te(w,S),o("tildes",w),w=v(w,S),o("xrange",w),w=b(w,S),o("stars",w),w),C=w=>!w||w.toLowerCase()==="x"||w==="*",U=(w,S,T)=>C(w)&&!C(S)||C(S)&&T&&!C(T),te=(w,S)=>w.trim().split(/\s+/).map(T=>z(T,S)).join(" "),z=(w,S)=>{const T=S.loose?c[a.TILDELOOSE]:c[a.TILDE],R=S.includePrerelease?"-0":"";return w.replace(T,(Z,O,P,F,M)=>{o("tilde",w,Z,O,P,F,M);let q;return C(O)?q="":C(P)?q=`>=${O}.0.0${R} <${+O+1}.0.0-0`:C(F)?q=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:M?(o("replaceTilde pr",M),q=`>=${O}.${P}.${F}-${M} <${O}.${+P+1}.0-0`):q=`>=${O}.${P}.${F} <${O}.${+P+1}.0-0`,o("tilde return",q),q})},L=(w,S)=>w.trim().split(/\s+/).map(T=>d(T,S)).join(" "),d=(w,S)=>{o("caret",w,S);const T=S.loose?c[a.CARETLOOSE]:c[a.CARET],R=S.includePrerelease?"-0":"";return w.replace(T,(Z,O,P,F,M)=>{o("caret",w,Z,O,P,F,M);let q;return C(O)?q="":C(P)?q=`>=${O}.0.0${R} <${+O+1}.0.0-0`:C(F)?O==="0"?q=`>=${O}.${P}.0${R} <${O}.${+P+1}.0-0`:q=`>=${O}.${P}.0${R} <${+O+1}.0.0-0`:M?(o("replaceCaret pr",M),O==="0"?P==="0"?q=`>=${O}.${P}.${F}-${M} <${O}.${P}.${+F+1}-0`:q=`>=${O}.${P}.${F}-${M} <${O}.${+P+1}.0-0`:q=`>=${O}.${P}.${F}-${M} <${+O+1}.0.0-0`):(o("no pr"),O==="0"?P==="0"?q=`>=${O}.${P}.${F} <${O}.${P}.${+F+1}-0`:q=`>=${O}.${P}.${F} <${O}.${+P+1}.0-0`:q=`>=${O}.${P}.${F} <${+O+1}.0.0-0`),o("caret return",q),q})},v=(w,S)=>(o("replaceXRanges",w,S),w.split(/\s+/).map(T=>E(T,S)).join(" ")),E=(w,S)=>{w=w.trim();const T=S.loose?c[a.XRANGELOOSE]:c[a.XRANGE];return w.replace(T,(R,Z,O,P,F,M)=>{if(o("xRange",w,R,Z,O,P,F,M),U(O,P,F))return w;const q=C(O),ae=q||C(P),ne=ae||C(F),Ge=ne;return Z==="="&&Ge&&(Z=""),M=S.includePrerelease?"-0":"",q?Z===">"||Z==="<"?R="<0.0.0-0":R="*":Z&&Ge?(ae&&(P=0),F=0,Z===">"?(Z=">=",ae?(O=+O+1,P=0,F=0):(P=+P+1,F=0)):Z==="<="&&(Z="<",ae?O=+O+1:P=+P+1),Z==="<"&&(M="-0"),R=`${Z+O}.${P}.${F}${M}`):ae?R=`>=${O}.0.0${M} <${+O+1}.0.0-0`:ne&&(R=`>=${O}.${P}.0${M} <${O}.${+P+1}.0-0`),o("xRange return",R),R})},b=(w,S)=>(o("replaceStars",w,S),w.trim().replace(c[a.STAR],"")),k=(w,S)=>(o("replaceGTE0",w,S),w.trim().replace(c[S.includePrerelease?a.GTE0PRE:a.GTE0],"")),D=w=>(S,T,R,Z,O,P,F,M,q,ae,ne,Ge)=>(C(R)?T="":C(Z)?T=`>=${R}.0.0${w?"-0":""}`:C(O)?T=`>=${R}.${Z}.0${w?"-0":""}`:P?T=`>=${T}`:T=`>=${T}${w?"-0":""}`,C(q)?M="":C(ae)?M=`<${+q+1}.0.0-0`:C(ne)?M=`<${q}.${+ae+1}.0-0`:Ge?M=`<=${q}.${ae}.${ne}-${Ge}`:w?M=`<${q}.${ae}.${+ne+1}-0`:M=`<=${M}`,`${T} ${M}`.trim()),j=(w,S,T)=>{for(let R=0;R<w.length;R++)if(!w[R].test(S))return!1;if(S.prerelease.length&&!T.includePrerelease){for(let R=0;R<w.length;R++)if(o(w[R].semver),w[R].semver!==i.ANY&&w[R].semver.prerelease.length>0){const Z=w[R].semver;if(Z.major===S.major&&Z.minor===S.minor&&Z.patch===S.patch)return!0}return!1}return!0};return vr}var _r,Ys;function ht(){if(Ys)return _r;Ys=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(a,f){if(f=r(f),a instanceof t){if(a.loose===!!f.loose)return a;a=a.value}a=a.trim().split(/\s+/).join(" "),o("comparator",a,f),this.options=f,this.loose=!!f.loose,this.parse(a),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(a){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=a.match(f);if(!h)throw new TypeError(`Invalid comparator: ${a}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new u(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(a){if(o("Comparator.test",a,this.options.loose),this.semver===e||a===e)return!0;if(typeof a=="string")try{a=new u(a,this.options)}catch{return!1}return i(a,this.operator,this.semver,this.options)}intersects(a,f){if(!(a instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(a.value,f).test(this.value):a.operator===""?a.value===""?!0:new c(this.value,f).test(a.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||a.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||a.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&a.operator.startsWith(">")||this.operator.startsWith("<")&&a.operator.startsWith("<")||this.semver.version===a.semver.version&&this.operator.includes("=")&&a.operator.includes("=")||i(this.semver,"<",a.semver,f)&&this.operator.startsWith(">")&&a.operator.startsWith("<")||i(this.semver,">",a.semver,f)&&this.operator.startsWith("<")&&a.operator.startsWith(">")))}}_r=t;const r=xt(),{safeRe:n,t:s}=qe(),i=Vs(),o=lt(),u=se(),c=de();return _r}var Er,Js;function dt(){if(Js)return Er;Js=1;const e=de();return Er=(r,n,s)=>{try{n=new e(n,s)}catch{return!1}return n.test(r)},Er}var br,Qs;function Wl(){if(Qs)return br;Qs=1;const e=de();return br=(r,n)=>new e(r,n).set.map(s=>s.map(i=>i.value).join(" ").trim().split(" ")),br}var wr,ei;function Hl(){if(ei)return wr;ei=1;const e=se(),t=de();return wr=(n,s,i)=>{let o=null,u=null,c=null;try{c=new t(s,i)}catch{return null}return n.forEach(l=>{c.test(l)&&(!o||u.compare(l)===-1)&&(o=l,u=new e(o,i))}),o},wr}var Sr,ti;function Xl(){if(ti)return Sr;ti=1;const e=se(),t=de();return Sr=(n,s,i)=>{let o=null,u=null,c=null;try{c=new t(s,i)}catch{return null}return n.forEach(l=>{c.test(l)&&(!o||u.compare(l)===1)&&(o=l,u=new e(o,i))}),o},Sr}var yr,ri;function Kl(){if(ri)return yr;ri=1;const e=se(),t=de(),r=ft();return yr=(s,i)=>{s=new t(s,i);let o=new e("0.0.0");if(s.test(o)||(o=new e("0.0.0-0"),s.test(o)))return o;o=null;for(let u=0;u<s.set.length;++u){const c=s.set[u];let l=null;c.forEach(a=>{const f=new e(a.semver.version);switch(a.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!l||r(f,l))&&(l=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),l&&(!o||r(o,l))&&(o=l)}return o&&s.test(o)?o:null},yr}var Ir,ni;function Yl(){if(ni)return Ir;ni=1;const e=de();return Ir=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},Ir}var $r,si;function Rr(){if(si)return $r;si=1;const e=se(),t=ht(),{ANY:r}=t,n=de(),s=dt(),i=ft(),o=or(),u=hr(),c=lr();return $r=(a,f,h,p)=>{a=new e(a,p),f=new n(f,p);let I,_,m,y,$;switch(h){case">":I=i,_=u,m=o,y=">",$=">=";break;case"<":I=o,_=c,m=i,y="<",$="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(a,f,p))return!1;for(let N=0;N<f.set.length;++N){const x=f.set[N];let C=null,U=null;if(x.forEach(te=>{te.semver===r&&(te=new t(">=0.0.0")),C=C||te,U=U||te,I(te.semver,C.semver,p)?C=te:m(te.semver,U.semver,p)&&(U=te)}),C.operator===y||C.operator===$||(!U.operator||U.operator===y)&&_(a,U.semver))return!1;if(U.operator===$&&m(a,U.semver))return!1}return!0},$r}var Ar,ii;function Jl(){if(ii)return Ar;ii=1;const e=Rr();return Ar=(r,n,s)=>e(r,n,">",s),Ar}var Tr,oi;function Ql(){if(oi)return Tr;oi=1;const e=Rr();return Tr=(r,n,s)=>e(r,n,"<",s),Tr}var Or,ai;function ef(){if(ai)return Or;ai=1;const e=de();return Or=(r,n,s)=>(r=new e(r,s),n=new e(n,s),r.intersects(n,s)),Or}var kr,ci;function tf(){if(ci)return kr;ci=1;const e=dt(),t=he();return kr=(r,n,s)=>{const i=[];let o=null,u=null;const c=r.sort((h,p)=>t(h,p,s));for(const h of c)e(h,n,s)?(u=h,o||(o=h)):(u&&i.push([o,u]),u=null,o=null);o&&i.push([o,null]);const l=[];for(const[h,p]of i)h===p?l.push(h):!p&&h===c[0]?l.push("*"):p?h===c[0]?l.push(`<=${p}`):l.push(`${h} - ${p}`):l.push(`>=${h}`);const a=l.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return a.length<f.length?a:n},kr}var Pr,ui;function rf(){if(ui)return Pr;ui=1;const e=de(),t=ht(),{ANY:r}=t,n=dt(),s=he(),i=(f,h,p={})=>{if(f===h)return!0;f=new e(f,p),h=new e(h,p);let I=!1;e:for(const _ of f.set){for(const m of h.set){const y=c(_,m,p);if(I=I||y!==null,y)continue e}if(I)return!1}return!0},o=[new t(">=0.0.0-0")],u=[new t(">=0.0.0")],c=(f,h,p)=>{if(f===h)return!0;if(f.length===1&&f[0].semver===r){if(h.length===1&&h[0].semver===r)return!0;p.includePrerelease?f=o:f=u}if(h.length===1&&h[0].semver===r){if(p.includePrerelease)return!0;h=u}const I=new Set;let _,m;for(const z of f)z.operator===">"||z.operator===">="?_=l(_,z,p):z.operator==="<"||z.operator==="<="?m=a(m,z,p):I.add(z.semver);if(I.size>1)return null;let y;if(_&&m){if(y=s(_.semver,m.semver,p),y>0)return null;if(y===0&&(_.operator!==">="||m.operator!=="<="))return null}for(const z of I){if(_&&!n(z,String(_),p)||m&&!n(z,String(m),p))return null;for(const L of h)if(!n(z,String(L),p))return!1;return!0}let $,N,x,C,U=m&&!p.includePrerelease&&m.semver.prerelease.length?m.semver:!1,te=_&&!p.includePrerelease&&_.semver.prerelease.length?_.semver:!1;U&&U.prerelease.length===1&&m.operator==="<"&&U.prerelease[0]===0&&(U=!1);for(const z of h){if(C=C||z.operator===">"||z.operator===">=",x=x||z.operator==="<"||z.operator==="<=",_){if(te&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===te.major&&z.semver.minor===te.minor&&z.semver.patch===te.patch&&(te=!1),z.operator===">"||z.operator===">="){if($=l(_,z,p),$===z&&$!==_)return!1}else if(_.operator===">="&&!z.test(_.semver))return!1}if(m){if(U&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===U.major&&z.semver.minor===U.minor&&z.semver.patch===U.patch&&(U=!1),z.operator==="<"||z.operator==="<="){if(N=a(m,z,p),N===z&&N!==m)return!1}else if(m.operator==="<="&&!z.test(m.semver))return!1}if(!z.operator&&(m||_)&&y!==0)return!1}return!(_&&x&&!m&&y!==0||m&&C&&!_&&y!==0||te||U)},l=(f,h,p)=>{if(!f)return h;const I=s(f.semver,h.semver,p);return I>0?f:I<0||h.operator===">"&&f.operator===">="?h:f},a=(f,h,p)=>{if(!f)return h;const I=s(f.semver,h.semver,p);return I<0?f:I>0||h.operator==="<"&&f.operator==="<="?h:f};return Pr=i,Pr}var Nr,li;function nf(){if(li)return Nr;li=1;const e=qe(),t=Fe(),r=se(),n=bs(),s=Ne(),i=Nl(),o=Cl(),u=Ll(),c=zl(),l=Zl(),a=Dl(),f=jl(),h=xl(),p=he(),I=Ml(),_=Ul(),m=tr(),y=Bl(),$=Fl(),N=ft(),x=or(),C=Ms(),U=Bs(),te=lr(),z=hr(),L=Vs(),d=ql(),v=Gl(),E=ht(),b=de(),k=dt(),D=Wl(),j=Hl(),w=Xl(),S=Kl(),T=Yl(),R=Rr(),Z=Jl(),O=Ql(),P=ef(),F=tf(),M=rf();return Nr={parse:s,valid:i,clean:o,inc:u,diff:c,major:l,minor:a,patch:f,prerelease:h,compare:p,rcompare:I,compareLoose:_,compareBuild:m,sort:y,rsort:$,gt:N,lt:x,eq:C,neq:U,gte:te,lte:z,cmp:L,coerce:d,truncate:v,Comparator:E,Range:b,satisfies:k,toComparators:D,maxSatisfying:j,minSatisfying:w,minVersion:S,validRange:T,outside:R,gtr:Z,ltr:O,intersects:P,simplifyRange:F,subset:M,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},Nr}var sf=nf();const of=$l(sf),Cr=Ie(ee().min(1)).refine(e=>new Set(e).size===e.length,{message:"Array items must be unique"}),af=re({type:B("string")}),cf=re({type:B("number"),integer:B(!0).optional(),min:Q().optional(),max:Q().optional()}),uf=re({type:B("boolean")}),lf=re({type:B("option"),options:Cr}),ff=pe([af,cf,uf,lf]),hf=e=>e.defaultRequired?re({type:B("string"),default:ee()}):re({type:B("string"),default:ee().optional()}),df=e=>e.defaultRequired?re({type:B("number"),integer:ye().optional(),min:Q().optional(),max:Q().optional(),default:Q()}):re({type:B("number"),integer:ye().optional(),min:Q().optional(),max:Q().optional(),default:Q().optional()}),pf=e=>e.defaultRequired?re({type:B("boolean"),default:ye()}):re({type:B("boolean"),default:ye().optional()}),mf=e=>e.defaultRequired?re({type:B("option"),options:Cr.optional(),default:ee().min(1)}):re({type:B("option"),options:Cr.optional(),default:ee().min(1).optional()}),fi=e=>pe([hf(e),df(e),pf(e),mf(e)]),gf=re({name:ee().min(1),value:fi({defaultRequired:!1})}),hi=re({name:ee().min(1),value:ff.optional()}),vf=re({name:ee().min(1),value:fi({defaultRequired:!0}),writableFromCogs:B(!0).optional(),writableFromClient:B(!0).optional()}),_f=e=>{try{return new ps(e),!0}catch{return!1}},Ef=re({version:pe([nt([ve()]),nt([ve(),B("."),ve()]),nt([ve(),B("."),ve(),B("."),ve()])]),name:ee(),minCogsVersion:nt([ve(),B("."),ve(),B("."),ve()]).optional(),description:ee().optional(),icon:ee().optional(),indexPath:ee().optional(),window:G({width:Q().gt(0).int(),height:Q().gt(0).int(),visible:ye().optional()}).optional(),config:Ie(gf).optional(),events:G({fromCogs:Ie(hi).optional(),toCogs:Ie(hi).optional()}).optional(),state:Ie(vf).optional(),media:G({audio:B(!0).optional(),video:B(!0).optional(),images:B(!0).optional()}).optional(),store:G({items:Zn(ee(),re({persistValue:ye().optional()})).optional()}).optional(),permissions:re({network:re({access:Ie(re({hosts:Ie(ee().refine(_f,{error:"Invalid network host pattern"})).min(1),caCertificate:ee().optional()})).optional()}).optional()}).optional()}).refine(e=>!!(!e.permissions?.network?.access||e.minCogsVersion&&of.gte(e.minCogsVersion,"5.11.0")),{path:["permissions","network","access"],message:"minCogsVersion must be at least 5.11.0"});function bf(e){const t=Ef.safeParse(e);return t.success?null:t.error.issues.map(r=>`${r.path.join(".")||"root"}: ${r.message}`)}H.CogsConfigChangedEvent=Ur,H.CogsConnection=ki,H.CogsConnectionCloseEvent=xr,H.CogsConnectionOpenEvent=jr,H.CogsIncomingEvent=Fr,H.CogsMediaConfigChangedEvent=qr,H.CogsMessageEvent=Mr,H.CogsShowPhaseChangedEvent=Gr,H.CogsStateChangedEvent=Br,H.DataStoreItemEvent=mt,H.DataStoreItemsEvent=gt,H.ManifestTypes=Pl,H.MediaPreloader=es,H.MediaSchema=hl,H.NetworkHostPattern=ps,H.SurfaceManager=Il,H.assetUrl=Dr,H.getPluginManifestErrors=bf,H.getStateAtTime=it,H.preloadUrl=wi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
|