@fugood/bricks-cli 2.24.0-beta.10 → 2.24.0-beta.12
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/lib/index.js +3 -3
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -648,13 +648,13 @@ import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as
|
|
|
648
648
|
setupGeminiCLI: $setupGeminiCLI
|
|
649
649
|
)
|
|
650
650
|
}
|
|
651
|
-
`},8323:(e,t,a)=>{const n=a(4876),r=a(3246),i={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},o=Symbol("failure");function s(e){return n.ucs2.decode(e).length}function p(e,t){const a=e[t];return isNaN(a)?void 0:String.fromCodePoint(a)}function l(e){return e>=48&&e<=57}function d(e){return e>=65&&e<=90||e>=97&&e<=122}function u(e){return l(e)||e>=65&&e<=70||e>=97&&e<=102}function c(e){return"."===e||"%2e"===e.toLowerCase()}function m(e){return 2===e.length&&d(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function f(e){return void 0!==i[e]}function _(e){return f(e.scheme)}function h(e){let t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),"%"+t}function E(e){return e<=31||e>126}const y=new Set([32,34,35,60,62,63,96,123,125]);function T(e){return E(e)||y.has(e)}const R=new Set([47,58,59,61,64,91,92,93,94,124]);function g(e){return T(e)||R.has(e)}function v(e,t){const a=String.fromCodePoint(e);return t(e)?function(e){const t=new Buffer(e);let a="";for(let e=0;e<t.length;++e)a+=h(t[e]);return a}(a):a}function O(e){let t=10;if(e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e)return 0;return(10===t?/[^0-9]/:16===t?/[^0-9A-Fa-f]/:/[^0-7]/).test(e)?o:parseInt(e,t)}function N(e,t){if("["===e[0])return"]"!==e[e.length-1]?o:function(e){const t=[0,0,0,0,0,0,0,0];let a=0,r=null,i=0;if(58===(e=n.ucs2.decode(e))[i]){if(58!==e[i+1])return o;i+=2,++a,r=a}for(;i<e.length;){if(8===a)return o;if(58===e[i]){if(null!==r)return o;++i,++a,r=a;continue}let n=0,s=0;for(;s<4&&u(e[i]);)n=16*n+parseInt(p(e,i),16),++i,++s;if(46===e[i]){if(0===s)return o;if(i-=s,a>6)return o;let n=0;for(;void 0!==e[i];){let r=null;if(n>0){if(!(46===e[i]&&n<4))return o;++i}if(!l(e[i]))return o;for(;l(e[i]);){const t=parseInt(p(e,i));if(null===r)r=t;else{if(0===r)return o;r=10*r+t}if(r>255)return o;++i}t[a]=256*t[a]+r,++n,2!==n&&4!==n||++a}if(4!==n)return o;break}if(58===e[i]){if(++i,void 0===e[i])return o}else if(void 0!==e[i])return o;t[a]=n,++a}if(null!==r){let e=a-r;for(a=7;0!==a&&e>0;){const n=t[r+e-1];t[r+e-1]=t[a],t[a]=n,--a,--e}}else if(null===r&&8!==a)return o;return t}(e.substring(1,e.length-1));if(!t)return function(e){if(function(e){return-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/)}(e))return o;let t="";const a=n.ucs2.decode(e);for(let e=0;e<a.length;++e)t+=v(a[e],E);return t}(e);const a=function(e){const t=new Buffer(e),a=[];for(let e=0;e<t.length;++e)37!==t[e]?a.push(t[e]):37===t[e]&&u(t[e+1])&&u(t[e+2])?(a.push(parseInt(t.slice(e+1,e+3).toString(),16)),e+=2):a.push(t[e]);return new Buffer(a).toString()}(e),i=r.toASCII(a,!1,r.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===i)return o;if(function(e){return-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/)}(i))return o;const s=function(e){const t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return e;const a=[];for(const n of t){if(""===n)return e;const t=O(n);if(t===o)return e;a.push(t)}for(let e=0;e<a.length-1;++e)if(a[e]>255)return o;if(a[a.length-1]>=Math.pow(256,5-a.length))return o;let n=a.pop(),r=0;for(const e of a)n+=e*Math.pow(256,3-r),++r;return n}(i);return"number"==typeof s||s===o?s:i}function b(e){return"number"==typeof e?function(e){let t="",a=e;for(let e=1;e<=4;++e)t=String(a%256)+t,4!==e&&(t="."+t),a=Math.floor(a/256);return t}(e):e instanceof Array?"["+function(e){let t="";const a=function(e){let t=null,a=1,n=null,r=0;for(let i=0;i<e.length;++i)0!==e[i]?(r>a&&(t=n,a=r),n=null,r=0):(null===n&&(n=i),++r);return r>a&&(t=n,a=r),{idx:t,len:a}}(e).idx;let n=!1;for(let r=0;r<=7;++r)if(!n||0!==e[r]){if(n&&(n=!1),a===r){t+=0===r?"::":":",n=!0;continue}t+=e[r].toString(16),7!==r&&(t+=":")}return t}(e)+"]":e}function A(e){const t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&function(e){return/^[A-Za-z]:$/.test(e)}(t[0])||t.pop())}function S(e){return""!==e.username||""!==e.password}function I(e,t,a,r,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=a||"utf-8",this.stateOverride=i,this.url=r,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const e=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);e!==this.input&&(this.parseError=!0),this.input=e}const s=function(e){return e.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=n.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const e=this.input[this.pointer],t=isNaN(e)?void 0:String.fromCodePoint(e),a=this["parse "+this.state](e,t);if(!a)break;if(a===o){this.failure=!0;break}}}I.prototype["parse scheme start"]=function(e,t){if(d(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,o;this.state="no scheme",--this.pointer}return!0},I.prototype["parse scheme"]=function(e,t){if(function(e){return d(e)||l(e)}(e)||43===e||45===e||46===e)this.buffer+=t.toLowerCase();else if(58===e){if(this.stateOverride){if(_(this.url)&&!f(this.buffer))return!1;if(!_(this.url)&&f(this.buffer))return!1;if((S(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):_(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":_(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,o;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},I.prototype["parse no scheme"]=function(e){return null===this.base||this.base.cannotBeABaseURL&&35!==e?o:(this.base.cannotBeABaseURL&&35===e?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},I.prototype["parse special relative or authority"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},I.prototype["parse path or authority"]=function(e){return 47===e?this.state="authority":(this.state="path",--this.pointer),!0},I.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===e?this.state="relative slash":63===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):_(this.url)&&92===e?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},I.prototype["parse relative slash"]=function(e){return!_(this.url)||47!==e&&92!==e?47===e?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===e&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},I.prototype["parse special authority slashes"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},I.prototype["parse special authority ignore slashes"]=function(e){return 47!==e&&92!==e?(this.state="authority",--this.pointer):this.parseError=!0,!0},I.prototype["parse authority"]=function(e,t){if(64===e){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const e=s(this.buffer);for(let t=0;t<e;++t){const e=this.buffer.codePointAt(t);if(58===e&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const a=v(e,g);this.passwordTokenSeenFlag?this.url.password+=a:this.url.username+=a}this.buffer=""}else if(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e){if(this.atFlag&&""===this.buffer)return this.parseError=!0,o;this.pointer-=s(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},I.prototype["parse hostname"]=I.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==e||this.arrFlag)if(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e){if(--this.pointer,_(this.url)&&""===this.buffer)return this.parseError=!0,o;if(this.stateOverride&&""===this.buffer&&(S(this.url)||null!==this.url.port))return this.parseError=!0,!1;const e=N(this.buffer,_(this.url));if(e===o)return o;if(this.url.host=e,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===e?this.arrFlag=!0:93===e&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,o;const e=N(this.buffer,_(this.url));if(e===o)return o;if(this.url.host=e,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},I.prototype["parse port"]=function(e,t){if(l(e))this.buffer+=t;else{if(!(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e||this.stateOverride))return this.parseError=!0,o;if(""!==this.buffer){const e=parseInt(this.buffer);if(e>Math.pow(2,16)-1)return this.parseError=!0,o;this.url.port=e===(a=this.url.scheme,i[a])?null:e,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};const w=new Set([47,92,63,35]);I.prototype["parse file"]=function(e){var t,a;return this.url.scheme="file",47===e||92===e?(92===e&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(t=e,a=this.input[this.pointer+1],!d(t)||58!==a&&124!==a)||this.input.length-this.pointer-1>=2&&!w.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),A(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},I.prototype["parse file slash"]=function(e){return 47===e||92===e?(92===e&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(!function(e){return 2===e.length&&d(e.codePointAt(0))&&":"===e[1]}(this.base.path[0])?this.url.host=this.base.host:this.url.path.push(this.base.path[0])),this.state="path",--this.pointer),!0},I.prototype["parse file host"]=function(e,t){if(isNaN(e)||47===e||92===e||63===e||35===e)if(--this.pointer,!this.stateOverride&&m(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let e=N(this.buffer,_(this.url));if(e===o)return o;if("localhost"===e&&(e=""),this.url.host=e,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},I.prototype["parse path start"]=function(e){return _(this.url)?(92===e&&(this.parseError=!0),this.state="path",47!==e&&92!==e&&--this.pointer):this.stateOverride||63!==e?this.stateOverride||35!==e?void 0!==e&&(this.state="path",47!==e&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},I.prototype["parse path"]=function(e){if(isNaN(e)||47===e||_(this.url)&&92===e||!this.stateOverride&&(63===e||35===e)){if(_(this.url)&&92===e&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(A(this.url),47===e||_(this.url)&&92===e||this.url.path.push("")):!c(this.buffer)||47===e||_(this.url)&&92===e?c(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&m(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===e||63===e||35===e))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===e&&(this.url.query="",this.state="query"),35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=v(e,T);var t;return!0},I.prototype["parse cannot-be-a-base-URL path"]=function(e){return 63===e?(this.url.query="",this.state="query"):35===e?(this.url.fragment="",this.state="fragment"):(isNaN(e)||37===e||(this.parseError=!0),37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+v(e,E))),!0},I.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&35===e){_(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const t=new Buffer(this.buffer);for(let e=0;e<t.length;++e)t[e]<33||t[e]>126||34===t[e]||35===t[e]||60===t[e]||62===t[e]?this.url.query+=h(t[e]):this.url.query+=String.fromCodePoint(t[e]);this.buffer="",35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t;return!0},I.prototype["parse fragment"]=function(e){return isNaN(e)||(0===e?this.parseError=!0:(37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=v(e,E))),!0},e.exports.serializeURL=function(e,t){let a=e.scheme+":";if(null!==e.host?(a+="//",""===e.username&&""===e.password||(a+=e.username,""!==e.password&&(a+=":"+e.password),a+="@"),a+=b(e.host),null!==e.port&&(a+=":"+e.port)):null===e.host&&"file"===e.scheme&&(a+="//"),e.cannotBeABaseURL)a+=e.path[0];else for(const t of e.path)a+="/"+t;return null!==e.query&&(a+="?"+e.query),t||null===e.fragment||(a+="#"+e.fragment),a},e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(t.path[0]))}catch(e){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(e){let t=e.scheme+"://";return t+=b(e.host),null!==e.port&&(t+=":"+e.port),t}({scheme:t.scheme,host:t.host,port:t.port});case"file":return"file://";default:return"null"}},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});const a=new I(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return a.failure?"failure":a.url},e.exports.setTheUsername=function(e,t){e.username="";const a=n.ucs2.decode(t);for(let t=0;t<a.length;++t)e.username+=v(a[t],g)},e.exports.setThePassword=function(e,t){e.password="";const a=n.ucs2.decode(t);for(let t=0;t<a.length;++t)e.password+=v(a[t],g)},e.exports.serializeHost=b,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e.cannotBeABaseURL||"file"===e.scheme},e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,a){return void 0===a&&(a={}),e.exports.basicURLParse(t,{baseURL:a.baseURL,encodingOverride:a.encodingOverride})}},8338:(e,t,a)=>{a.d(t,{l:()=>S,m:()=>w});var n=a(5608),r=a(9212),i=a(8907),o=a(6563),s=a(1777),p=a(5207),l=a(3767),d=a(777),u=a(671),c=Object.create(null);function m(e){var t=JSON.stringify(e);return c[t]||(c[t]=Object.create(null))}function f(e){var t=m(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,a){var n=function(e,t){return a.readField(t,e)},i=a.keyObject=h(e,function(e){var i=T(a.storeObject,e,n);return void 0===i&&t!==a.storeObject&&p.$3.call(t,e[0])&&(i=T(t,e,y)),(0,r.invariant)(void 0!==i,5,e.join("."),t),i});return"".concat(a.typename,":").concat(JSON.stringify(i))})}function _(e){var t=m(e);return t.keyArgsFn||(t.keyArgsFn=function(t,a){var n=a.field,r=a.variables,o=a.fieldName,s=h(e,function(e){var a=e[0],o=a.charAt(0);if("@"!==o)if("$"!==o){if(t)return T(t,e)}else{var s=a.slice(1);if(r&&p.$3.call(r,s)){var d=e.slice(0);return d[0]=s,T(r,d)}}else if(n&&(0,l.E)(n.directives)){var u=a.slice(1),c=n.directives.find(function(e){return e.name.value===u}),m=c&&(0,i.MB)(c,r);return m&&T(m,e.slice(1))}}),d=JSON.stringify(s);return(t||"{}"!==d)&&(o+=":"+d),o})}function h(e,t){var a=new u.ZI;return E(e).reduce(function(e,n){var r,i=t(n);if(void 0!==i){for(var o=n.length-1;o>=0;--o)(r={})[n[o]]=i,i=r;e=a.merge(e,i)}return e},Object.create(null))}function E(e){var t=m(e);if(!t.paths){var a=t.paths=[],n=[];e.forEach(function(t,r){(0,l.c)(t)?(E(t).forEach(function(e){return a.push(n.concat(e))}),n.length=0):(n.push(t),(0,l.c)(e[r+1])||(a.push(n.slice(0)),n.length=0))})}return t.paths}function y(e,t){return e[t]}function T(e,t,a){return a=a||y,R(t.reduce(function e(t,n){return(0,l.c)(t)?t.map(function(t){return e(t,n)}):t&&a(t,n)},e))}function R(e){return(0,s.U)(e)?(0,l.c)(e)?e.map(R):h(Object.keys(e).sort(),function(t){return T(e,t)}):e}var g=a(7150);function v(e){return void 0!==e.args?e.args:e.field?(0,i.MB)(e.field,e.variables):null}var O=function(){},N=function(e,t){return t.fieldName},b=function(e,t,a){return(0,a.mergeObjects)(e,t)},A=function(e,t){return t},S=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=(0,n.__assign)({dataIdFromObject:p.or},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var a,r=this,i=t&&(t.typename||(null===(a=t.storeObject)||void 0===a?void 0:a.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var o,s=t&&t.storeObject||e,p=(0,n.__assign)((0,n.__assign)({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=w(arguments,s);return r.readField(e,{store:r.cache.data,variables:e.variables})}}),d=i&&this.getTypePolicy(i),u=d&&d.keyFn||this.config.dataIdFromObject;return g.yV.withValue(!0,function(){for(;u;){var t=u((0,n.__assign)((0,n.__assign)({},e),s),p);if(!(0,l.c)(t)){o=t;break}u=f(t)}}),o=o?String(o):void 0,p.keyObject?[o,p.keyObject]:[o]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(a){var r=e[a],i=r.queryType,o=r.mutationType,s=r.subscriptionType,l=(0,n.__rest)(r,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",a),o&&t.setRootTypename("Mutation",a),s&&t.setRootTypename("Subscription",a),p.$3.call(t.toBeAdded,a)?t.toBeAdded[a].push(l):t.toBeAdded[a]=[l]})},e.prototype.updateTypePolicy=function(e,t){var a=this,n=this.getTypePolicy(e),r=t.keyFields,i=t.fields;function o(e,t){e.merge="function"==typeof t?t:!0===t?b:!1===t?A:e.merge}o(n,t.merge),n.keyFn=!1===r?O:(0,l.c)(r)?f(r):"function"==typeof r?r:n.keyFn,i&&Object.keys(i).forEach(function(t){var n=a.getFieldPolicy(e,t,!0),r=i[t];if("function"==typeof r)n.read=r;else{var s=r.keyArgs,p=r.read,d=r.merge;n.keyFn=!1===s?N:(0,l.c)(s)?_(s):"function"==typeof s?s:n.keyFn,"function"==typeof p&&(n.read=p),o(n,d)}n.read&&n.merge&&(n.keyFn=n.keyFn||N)})},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var a="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[a];t!==n&&((0,r.invariant)(!n||n===e,6,e),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=a,this.rootTypenamesById[a]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(a){t.getSupertypeSet(a,!0),e[a].forEach(function(e){t.getSupertypeSet(e,!0).add(a);var n=e.match(p.gk);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))})})},e.prototype.getTypePolicy=function(e){var t=this;if(!p.$3.call(this.typePolicies,e)){var a=this.typePolicies[e]=Object.create(null);a.fields=Object.create(null);var r=this.supertypeMap.get(e);!r&&this.fuzzySubtypes.size&&(r=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(a,n){if(a.test(e)){var i=t.supertypeMap.get(n);i&&i.forEach(function(e){return r.add(e)})}})),r&&r.size&&r.forEach(function(e){var r=t.getTypePolicy(e),i=r.fields,o=(0,n.__rest)(r,["fields"]);Object.assign(a,o),Object.assign(a.fields,i)})}var i=this.toBeAdded[e];return i&&i.length&&i.splice(0).forEach(function(a){t.updateTypePolicy(e,a)}),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,a){if(e){var n=this.getTypePolicy(e).fields;return n[t]||a&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var a=this.supertypeMap.get(e);return!a&&t&&this.supertypeMap.set(e,a=new Set),a},e.prototype.fragmentMatches=function(e,t,a,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),l=[s],d=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&l.indexOf(t)<0&&l.push(t)},u=!(!a||!this.fuzzySubtypes.size),c=!1,m=0;m<l.length;++m){var f=l[m];if(f.has(o))return s.has(o)||(c&&!1!==globalThis.__DEV__&&r.invariant.warn(7,t,o),s.add(o)),!0;f.forEach(d),u&&m===l.length-1&&(0,p.T9)(e.selectionSet,a,n)&&(u=!1,c=!0,this.fuzzySubtypes.forEach(function(e,a){var n=t.match(e);n&&n[0]===t&&d(a)}))}return!1},e.prototype.hasKeyArgs=function(e,t){var a=this.getFieldPolicy(e,t,!1);return!(!a||!a.keyFn)},e.prototype.getStoreFieldName=function(e){var t,a=e.typename,n=e.fieldName,r=this.getFieldPolicy(a,n,!1),o=r&&r.keyFn;if(o&&a)for(var s={typename:a,fieldName:n,field:e.field||null,variables:e.variables},d=v(e);o;){var u=o(d,s);if(!(0,l.c)(u)){t=u||n;break}o=_(u)}return void 0===t&&(t=e.field?(0,i.Ii)(e.field,e.variables):(0,i.o5)(n,v(e))),!1===t?n:n===(0,p.iJ)(t)?t:n+":"+t},e.prototype.readField=function(e,t){var a=e.from;if(a&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(a,"__typename");n&&(e.typename=n)}var r=this.getStoreFieldName(e),o=(0,p.iJ)(r),s=t.store.getFieldValue(a,r),l=this.getFieldPolicy(e.typename,o,!1),u=l&&l.read;if(u){var c=I(this,a,e,t,t.store.getStorage((0,i.A_)(a)?a.__ref:a,r));return d.bl.withValue(this.cache,u,[s,c])}return s}},e.prototype.getReadFunction=function(e,t){var a=this.getFieldPolicy(e,t,!1);return a&&a.read},e.prototype.getMergeFunction=function(e,t,a){var n=this.getFieldPolicy(e,t,!1),r=n&&n.merge;return!r&&a&&(r=(n=this.getTypePolicy(a))&&n.merge),r},e.prototype.runMergeFunction=function(e,t,a,n,r){var i=a.field,o=a.typename,s=a.merge;return s===b?C(n.store)(e,t):s===A?t:(n.overwrite&&(e=void 0),s(e,t,I(this,void 0,{typename:o,fieldName:i.name.value,field:i,variables:n.variables},n,r||Object.create(null))))},e}();function I(e,t,a,n,r){var o=e.getStoreFieldName(a),s=(0,p.iJ)(o),l=a.variables||n.variables,d=n.store,u=d.toReference,c=d.canRead;return{args:v(a),field:a.field||null,fieldName:s,storeFieldName:o,variables:l,isReference:i.A_,toReference:u,storage:r,cache:e.cache,canRead:c,readField:function(){return e.readField(w(arguments,t,l),n)},mergeObjects:C(n.store)}}function w(e,t,a){var i,s=e[0],l=e[1],d=e.length;return"string"==typeof s?i={fieldName:s,from:d>1?l:t}:(i=(0,n.__assign)({},s),p.$3.call(i,"from")||(i.from=t)),!1!==globalThis.__DEV__&&void 0===i.from&&!1!==globalThis.__DEV__&&r.invariant.warn(8,(0,o.p)(Array.from(e))),void 0===i.variables&&(i.variables=a),i}function C(e){return function(t,a){if((0,l.c)(t)||(0,l.c)(a))throw(0,r.newInvariantError)(9);if((0,s.U)(t)&&(0,s.U)(a)){var o=e.getFieldValue(t,"__typename"),d=e.getFieldValue(a,"__typename");if(o&&d&&o!==d)return a;if((0,i.A_)(t)&&(0,p.d1)(a))return e.merge(t.__ref,a),t;if((0,p.d1)(t)&&(0,i.A_)(a))return e.merge(t,a.__ref),a;if((0,p.d1)(t)&&(0,p.d1)(a))return(0,n.__assign)((0,n.__assign)({},t),a)}return a}}},8354:(e,t,a)=>{a.d(t,{m:()=>p});var n=a(9212),r=a(2904),i=a(3777),o=a(5186),s=a(7150);function p(e,t,a){var p;if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,s.Ki)(),e;var l=(0,i.Vu)(t);return(0,n.invariant)(l,51),null==e?e:(0,o.S)(e,l.selectionSet,{operationType:l.operation,operationName:null===(p=l.name)||void 0===p?void 0:p.value,fragmentMap:(0,r.JG)((0,i.zK)(t)),cache:a,mutableTargets:new s.jq,knownChanged:new s.xm})}},8414:(e,t,a)=>{a.d(t,{A:()=>r});var n=a(3777);function r(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?(0,n.n4)(t.query)||void 0:""),t}},8417:e=>{e.exports=JSON.parse('{"name":"GeneratorMediaFlow","brickDescription":{"default":"","en-us":"Fetch box\'s file list from Media Flow","zh-tw":"從 Media Flow 取得投遞箱檔案列表","ja-jp":"Media Flow から配信ボックスのファイルリストを取得"},"brickDisplayName":"Media Flow","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"photo-film"},"brickMeta":{"scriptMember":true},"propTypes":{"boxId":{"type":"string"},"accessToken":{"type":"string"},"passcode":{"type":"string"},"includeTypes":{"type":"arrayOf","content":{"type":"oneOf","content":["IMAGE","VIDEO","AUDIO","FILE"],"forcePropertyBank":false},"forcePropertyBank":false},"fetchPolicy":{"type":"oneOf","content":["cache-first","network-and-cache","network-only"],"forcePropertyBank":false},"subscribeBoxChange":{"type":"bool"},"saveToStorage":{"type":"bool"},"saveToStorageDownloadMode":{"type":"oneOf","content":["sequence","concurrent"],"forcePropertyBank":false},"loadSizeLimit":{"type":"string"},"allowLoadSizeLimitExceed":{"type":"bool"},"source":{"type":"oneOf","content":["original","auto","converted","video-thumbnail-original","use-source-versions"],"forcePropertyBank":false},"sourceVersionAlternatives":{"type":"arrayOf","content":{"type":"number"},"forcePropertyBank":false},"allowlist":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"blocklist":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false}},"brickPropDescriptions":{"boxId":{"default":"","en-us":"The box id of Media Flow","zh-tw":"Media Flow 的投遞箱 id","ja-jp":"Media Flow の配信ボックス ID"},"accessToken":{"default":"","en-us":"Authorize accessToken, use `passcode` if `accessToken` is empty","zh-tw":"驗證用 Access token, 如果為空則使用 `passcode`","ja-jp":"認証用アクセストークン、 空の場合は `passcode` を使用"},"passcode":{"default":"","en-us":"Authorize passcode","zh-tw":"驗證用 Passcode","ja-jp":"認証用パスコード"},"includeTypes":{"default":"","en-us":"Include File Types","zh-tw":"包含的檔案類型","ja-jp":"含めるファイルタイプ"},"fetchPolicy":{"default":"","en-us":"Determine the cache behavior \\n \\n cache-first: Cache first if existing, then fetch from network \\n network-and-cache: Fetch from network, then save cache \\n network-only: Fetch from network only","zh-tw":"決定 cache 的行為 \\n \\n cache-first: 如果有 cache 則優先使用,然後從網路取得 \\n network-and-cache: 從網路取得,然後儲存 cache \\n network-only: 只從網路取得","ja-jp":"キャッシュの動作を決定 \\n \\n cache-first: 既存のキャッシュを優先し、その後ネットワークから取得 \\n network-and-cache: ネットワークから取得し、その後キャッシュに保存 \\n network-only: ネットワークからのみ取得"},"subscribeBoxChange":{"default":"","en-us":"Subscribe box change to refresh file list (file deleted / new file uploaded)","zh-tw":"訂閱投遞箱變更,以更新檔案列表 (檔案刪除 / 新增檔案)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"saveToStorage":{"default":"","en-us":"Save files into local file storage","zh-tw":"儲存檔案到本地儲存空間","ja-jp":"ファイルをローカルストレージに保存"},"saveToStorageDownloadMode":{"default":"","en-us":"Concurrent download files or sequence for saveToStorage","zh-tw":"平行下載檔案或依序下載檔案,用於 saveToStorage","ja-jp":"並行ダウンロードまたは順次ダウンロード(saveToStorage 用)"},"loadSizeLimit":{"default":"","en-us":"Limit the load size (* GB, * MB, * KB)","zh-tw":"限制讀取大小 (* GB, * MB, * KB)","ja-jp":"読み込みサイズの制限 (* GB, * MB, * KB)"},"allowLoadSizeLimitExceed":{"default":"","en-us":"Allow Load size limit exceed, just call event","zh-tw":"允許超過讀取大小限制,僅呼叫事件","ja-jp":"読み込みサイズ制限の超過を許可し、イベントのみを呼び出す"},"source":{"default":"","en-us":"Select download source","zh-tw":"選擇下載來源","ja-jp":"ダウンロードソースを選択"},"sourceVersionAlternatives":{"default":"","en-us":"Select download source with image version (use width, e.g. [250, 360])","zh-tw":"選擇下載來源,並指定圖片版本 (使用寬度,例如 [250, 360])","ja-jp":"画像バージョンを指定してダウンロードソースを選択(幅を使用、例:[250, 360])"},"allowlist":{"default":"","en-us":"Allowlist patterns to filter media files (supports regex or plain text)","zh-tw":"允許名單過濾模式 (支援正則表達式或純文字)","ja-jp":"メディアファイルをフィルタリングする許可リストパターン(正規表現またはプレーンテキストをサポート)"},"blocklist":{"default":"","en-us":"Blocklist patterns to filter media files (supports regex or plain text)","zh-tw":"拒絕名單過濾模式 (支援正則表達式或純文字)","ja-jp":"メディアファイルをフィルタリングするブロックリストパターン(正規表現またはプレーンテキストをサポート)"}},"propertyControls":{"boxId":{"required":true},"accessToken":{"required":{"unlessSome":["passcode"]}},"passcode":{"required":{"unlessSome":["accessToken"]}},"loadSizeLimit":{"placeholder":"GB / MB / KB"},"saveToStorageDownloadMode":{"displayName":"Download Mode","normalizeDisplayName":false,"oneOfEmptyOption":false},"source":{"displayName":"Source Size"},"fetchPolicy":{"oneOfEmptyOption":false}},"defaultBrickProps":{"includeTypes":["IMAGE","VIDEO","AUDIO","FILE"],"fetchPolicy":"cache-first","subscribeBoxChange":false,"saveToStorageDownloadMode":"sequence","loadSizeLimit":"","allowLoadSizeLimitExceed":true,"source":"original","sourceVersionAlternatives":[]},"eventTypes":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":"GENERATOR_MEDIA_FLOW_FETCH_ERROR","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR","GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED":"GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED","GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED":"GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED"},"brickEventDescriptions":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":{"default":"","en-us":"Event of media box fetch error","zh-tw":"Event of media box fetch error","ja-jp":"メディアボックスの取得エラー"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT":{"default":"","en-us":"Event of subscribe box change connected (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change connected (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":{"default":"","en-us":"Event of subscribe box change error (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change error (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":{"default":"","en-us":"Event of subscribe box change connection error (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change connection error (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED":{"default":"","en-us":"Event of file sync completed for used `saveToStorage`","zh-tw":"當使用 `saveToStorage`,檔案同步完成觸發的事件","ja-jp":"`saveToStorage` を使用した場合、ファイル同期が完了したときに発生するイベント"},"GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED":{"default":"","en-us":"Event when file list size exceed of Load size limit","zh-tw":"Event when file list size exceed of Load size limit","ja-jp":"ファイルリストサイズが読み込みサイズの制限を超えたときに発生するイベント"}},"eventPropertyControls":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"},"GENERATOR_MEDIA_FLOW_ERROR_IS_FROM_CACHE":{"name":"From Cache","type":"boolean"}}},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"}}},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"}}}},"outletTypes":{"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS","type":"string"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS","type":"array"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS","type":"array"},"GENERATOR_MEDIA_FLOW_BOX":{"outlet":"GENERATOR_MEDIA_FLOW_BOX","type":"object"},"GENERATOR_MEDIA_FLOW_RESULT":{"outlet":"GENERATOR_MEDIA_FLOW_RESULT","type":"array","displayName":"File List"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS","type":"array","displayName":"Downloaded File List"}},"brickOutletDescriptions":{"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS":{"default":"","en-us":"File sync status","zh-tw":"檔案同步的狀態","ja-jp":"ファイル同期の状態"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS":{"default":"","en-us":"File sync progress","zh-tw":"檔案下載的進度","ja-jp":"ファイルダウンロードの進捗"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS":{"default":"","en-us":"File sync download errors","zh-tw":"檔案下載的 errors","ja-jp":"ファイルダウンロードのエラー"},"GENERATOR_MEDIA_FLOW_BOX":{"default":"","en-us":"Media box info","zh-tw":"Media box 資訊","ja-jp":"Media ボックスの情報"},"GENERATOR_MEDIA_FLOW_RESULT":{"default":"","en-us":"Save Media Flow fetch result [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\", // enum(\\"jpg\\", \\"png\\", \\"mp4\\") \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]","zh-tw":"存入 Media Flow 獲取結果 [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\" // enum(\\"jpg\\", \\"png\\", \\"mp4\\"), \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]","ja-jp":"Media Flow の取得結果を保存 [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\" // enum(\\"jpg\\", \\"png\\", \\"mp4\\"), \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS":{"default":"","en-us":"File sync result [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]","zh-tw":"檔案同步的結果 [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]","ja-jp":"ファイル同期の結果 [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]"}},"actionTypes":{"GENERATOR_MEDIA_FLOW_FETCH":{"canProvideProperty":false},"GENERATOR_MEDIA_FLOW_RESET_CACHE":{"canProvideProperty":false},"GENERATOR_MEDIA_FLOW_ABORT_FETCH":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MEDIA_FLOW_FETCH":{"default":"","en-us":"Start fetcn Media box file list","zh-tw":"開始獲取 Media box 檔案列表","ja-jp":"Media ボックスのファイルリストを取得する"},"GENERATOR_MEDIA_FLOW_RESET_CACHE":{"default":"","en-us":"Reset cache","zh-tw":"重置 cache","ja-jp":"キャッシュをリセット"},"GENERATOR_MEDIA_FLOW_ABORT_FETCH":{"default":"","en-us":"Abort current fetch request of media list","zh-tw":"終止目前媒體列表的獲取請求","ja-jp":"現在のメディアリストの取得要求を中止"}},"propertyControlGroups":{"storage":{"name":"Storage","type":"group","content":["saveToStorage","saveToStorageDownloadMode","loadSizeLimit","allowLoadSizeLimitExceed","source","sourceVersionAlternatives"]}},"propertyControlGroupDescriptions":{},"scriptMemberFunctionDefs":{"fetch":{"arguments":[],"required":[],"return":{"type":"array"}},"resetCache":{"arguments":[],"required":[],"return":{"type":"void"}},"abortFetch":{"arguments":[],"required":[],"return":{"type":"void"}},"getFileList":{"arguments":[],"required":[],"return":{"type":"array"}},"getBoxInfo":{"arguments":[],"required":[],"return":{"type":"object"}},"getDownloadedFileUrls":{"arguments":[],"required":[],"return":{"type":"array"}}},"scriptMemberFunctionDefDescriptions":{"fetch":{"default":"","en-us":"Fetch media files from Media Flow","zh-tw":"從 Media Flow 取得媒體檔案","ja-jp":"Media Flow からメディアファイルを取得する"},"resetCache":{"default":"","en-us":"Reset Media Flow cache","zh-tw":"重置 Media Flow 快取","ja-jp":"Media Flow キャッシュをリセットする"},"abortFetch":{"default":"","en-us":"Abort current fetch request","zh-tw":"中止目前的取得請求","ja-jp":"現在のフェッチリクエストを中止する"},"getFileList":{"default":"","en-us":"Get current file list","zh-tw":"取得目前的檔案列表","ja-jp":"現在のファイルリストを取得する"},"getBoxInfo":{"default":"","en-us":"Get current box information","zh-tw":"取得目前的投遞箱資訊","ja-jp":"現在のボックス情報を取得する"},"getDownloadedFileUrls":{"default":"","en-us":"Get downloaded file URLs","zh-tw":"取得已下載的檔案網址","ja-jp":"ダウンロードされたファイルのURLを取得する"}}}')},8422:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(4450),r=a(7898),i=a(458),o=a(458),s={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:a,data:s,parentSchema:p,it:l}=e,{opts:d}=l,u=(0,n.allSchemaProperties)(a),c=u.filter(e=>(0,i.alwaysValidSchema)(l,a[e]));if(0===u.length||c.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const m=d.strictSchema&&!d.allowMatchingProperties&&p.properties,f=t.name("valid");!0===l.props||l.props instanceof r.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:_}=l;function h(e){for(const t in m)new RegExp(e).test(t)&&(0,i.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function E(a){t.forIn("key",s,i=>{t.if(r._`${(0,n.usePattern)(e,a)}.test(${i})`,()=>{const n=c.includes(a);n||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:i,dataPropType:o.Type.Str},f),l.opts.unevaluated&&!0!==_?t.assign(r._`${_}[${i}]`,!0):n||l.allErrors||t.if((0,r.not)(f),()=>t.break())})})}!function(){for(const e of u)m&&h(e),l.allErrors?E(e):(t.var(f,!0),E(e),t.if(f))}()}};t.default=s},8472:(e,t,a)=>{a.d(t,{Ey:()=>_,JG:()=>p,MQ:()=>S,Z_:()=>l,qA:()=>f});var n=a(9841),r=a(9762),i=a(7714),o=a(5881),s=a(2039);class p{constructor(e){const t=new r.ou(s.Y.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==s.Y.EOF)do{if(e.next)e=e.next;else{const t=h(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===s.Y.COMMENT);return e}}function l(e){return e===s.Y.BANG||e===s.Y.DOLLAR||e===s.Y.AMP||e===s.Y.PAREN_L||e===s.Y.PAREN_R||e===s.Y.DOT||e===s.Y.SPREAD||e===s.Y.COLON||e===s.Y.EQUALS||e===s.Y.AT||e===s.Y.BRACKET_L||e===s.Y.BRACKET_R||e===s.Y.BRACE_L||e===s.Y.PIPE||e===s.Y.BRACE_R}function d(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function u(e,t){return c(e.charCodeAt(t))&&m(e.charCodeAt(t+1))}function c(e){return e>=55296&&e<=56319}function m(e){return e>=56320&&e<=57343}function f(e,t){const a=e.source.body.codePointAt(t);if(void 0===a)return s.Y.EOF;if(a>=32&&a<=126){const e=String.fromCodePoint(a);return'"'===e?"'\"'":`"${e}"`}return"U+"+a.toString(16).toUpperCase().padStart(4,"0")}function _(e,t,a,n,i){const o=e.line,s=1+a-e.lineStart;return new r.ou(t,a,n,o,s,i)}function h(e,t){const a=e.source.body,r=a.length;let i=t;for(;i<r;){const t=a.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===a.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return E(e,i);case 33:return _(e,s.Y.BANG,i,i+1);case 36:return _(e,s.Y.DOLLAR,i,i+1);case 38:return _(e,s.Y.AMP,i,i+1);case 40:return _(e,s.Y.PAREN_L,i,i+1);case 41:return _(e,s.Y.PAREN_R,i,i+1);case 46:if(46===a.charCodeAt(i+1)&&46===a.charCodeAt(i+2))return _(e,s.Y.SPREAD,i,i+3);break;case 58:return _(e,s.Y.COLON,i,i+1);case 61:return _(e,s.Y.EQUALS,i,i+1);case 64:return _(e,s.Y.AT,i,i+1);case 91:return _(e,s.Y.BRACKET_L,i,i+1);case 93:return _(e,s.Y.BRACKET_R,i,i+1);case 123:return _(e,s.Y.BRACE_L,i,i+1);case 124:return _(e,s.Y.PIPE,i,i+1);case 125:return _(e,s.Y.BRACE_R,i,i+1);case 34:return 34===a.charCodeAt(i+1)&&34===a.charCodeAt(i+2)?A(e,i):R(e,i)}if((0,o.yp)(t)||45===t)return y(e,i,t);if((0,o.un)(t))return S(e,i);throw(0,n.I)(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":d(t)||u(a,i)?`Unexpected character: ${f(e,i)}.`:`Invalid character: ${f(e,i)}.`)}return _(e,s.Y.EOF,r,r)}function E(e,t){const a=e.source.body,n=a.length;let r=t+1;for(;r<n;){const e=a.charCodeAt(r);if(10===e||13===e)break;if(d(e))++r;else{if(!u(a,r))break;r+=2}}return _(e,s.Y.COMMENT,t,r,a.slice(t+1,r))}function y(e,t,a){const r=e.source.body;let i=t,p=a,l=!1;if(45===p&&(p=r.charCodeAt(++i)),48===p){if(p=r.charCodeAt(++i),(0,o.yp)(p))throw(0,n.I)(e.source,i,`Invalid number, unexpected digit after 0: ${f(e,i)}.`)}else i=T(e,i,p),p=r.charCodeAt(i);if(46===p&&(l=!0,p=r.charCodeAt(++i),i=T(e,i,p),p=r.charCodeAt(i)),69!==p&&101!==p||(l=!0,p=r.charCodeAt(++i),43!==p&&45!==p||(p=r.charCodeAt(++i)),i=T(e,i,p),p=r.charCodeAt(i)),46===p||(0,o.un)(p))throw(0,n.I)(e.source,i,`Invalid number, expected digit but got: ${f(e,i)}.`);return _(e,l?s.Y.FLOAT:s.Y.INT,t,i,r.slice(t,i))}function T(e,t,a){if(!(0,o.yp)(a))throw(0,n.I)(e.source,t,`Invalid number, expected digit but got: ${f(e,t)}.`);const r=e.source.body;let i=t+1;for(;(0,o.yp)(r.charCodeAt(i));)++i;return i}function R(e,t){const a=e.source.body,r=a.length;let i=t+1,o=i,p="";for(;i<r;){const r=a.charCodeAt(i);if(34===r)return p+=a.slice(o,i),_(e,s.Y.STRING,t,i+1,p);if(92===r){p+=a.slice(o,i);const t=117===a.charCodeAt(i+1)?123===a.charCodeAt(i+2)?g(e,i):v(e,i):b(e,i);p+=t.value,i+=t.size,o=i;continue}if(10===r||13===r)break;if(d(r))++i;else{if(!u(a,i))throw(0,n.I)(e.source,i,`Invalid character within String: ${f(e,i)}.`);i+=2}}throw(0,n.I)(e.source,i,"Unterminated string.")}function g(e,t){const a=e.source.body;let r=0,i=3;for(;i<12;){const e=a.charCodeAt(t+i++);if(125===e){if(i<5||!d(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|N(e),r<0)break}throw(0,n.I)(e.source,t,`Invalid Unicode escape sequence: "${a.slice(t,t+i)}".`)}function v(e,t){const a=e.source.body,r=O(a,t+2);if(d(r))return{value:String.fromCodePoint(r),size:6};if(c(r)&&92===a.charCodeAt(t+6)&&117===a.charCodeAt(t+7)){const e=O(a,t+8);if(m(e))return{value:String.fromCodePoint(r,e),size:12}}throw(0,n.I)(e.source,t,`Invalid Unicode escape sequence: "${a.slice(t,t+6)}".`)}function O(e,t){return N(e.charCodeAt(t))<<12|N(e.charCodeAt(t+1))<<8|N(e.charCodeAt(t+2))<<4|N(e.charCodeAt(t+3))}function N(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function b(e,t){const a=e.source.body;switch(a.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,n.I)(e.source,t,`Invalid character escape sequence: "${a.slice(t,t+2)}".`)}function A(e,t){const a=e.source.body,r=a.length;let o=e.lineStart,p=t+3,l=p,c="";const m=[];for(;p<r;){const r=a.charCodeAt(p);if(34===r&&34===a.charCodeAt(p+1)&&34===a.charCodeAt(p+2)){c+=a.slice(l,p),m.push(c);const n=_(e,s.Y.BLOCK_STRING,t,p+3,(0,i.OC)(m).join("\n"));return e.line+=m.length-1,e.lineStart=o,n}if(92!==r||34!==a.charCodeAt(p+1)||34!==a.charCodeAt(p+2)||34!==a.charCodeAt(p+3))if(10!==r&&13!==r)if(d(r))++p;else{if(!u(a,p))throw(0,n.I)(e.source,p,`Invalid character within String: ${f(e,p)}.`);p+=2}else c+=a.slice(l,p),m.push(c),13===r&&10===a.charCodeAt(p+1)?p+=2:++p,c="",l=p,o=p;else c+=a.slice(l,p),l=p+1,p+=4}throw(0,n.I)(e.source,p,"Unterminated string.")}function S(e,t){const a=e.source.body,n=a.length;let r=t+1;for(;r<n;){const e=a.charCodeAt(r);if(!(0,o.xr)(e))break;++r}return _(e,s.Y.NAME,t,r,a.slice(t,r))}},8474:e=>{e.exports=t("node:events")},8498:(e,t,a)=>{e.exports=(e=>{var t={};return a.d(t,e),t})({Box:()=>i.Box,Text:()=>i.Text,render:()=>i.render,useApp:()=>i.useApp,useInput:()=>i.useInput})},8525:(e,t,a)=>{var n=a(9893);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},8549:(e,t,a)=>{var n=a(5608),r=a(9891),i=a(7029);t.o=function(e){return new r.ApolloLink(function(t,a){var r=n.__rest(t,[]);return new i.Observable(function(n){var i,o=!1;return Promise.resolve(r).then(function(a){return e(a,t.getContext())}).then(t.setContext).then(function(){o||(i=a(t).subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)}))}).catch(n.error.bind(n)),function(){o=!0,i&&i.unsubscribe()}})})}},8558:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const a="maxItems"===e?"more":"fewer";return n.str`must NOT have ${a} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:a,schemaCode:r}=e,i="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${a}.length ${i} ${r}`)}};t.default=r},8568:(e,t,a)=>{a.d(t,{Ay:()=>L});const n=(e=0)=>t=>`[${t+e}m`,r=(e=0)=>t=>`[${38+e};5;${t}m`,i=(e=0)=>(t,a,n)=>`[${38+e};2;${t};${a};${n}m`,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(o.modifier),Object.keys(o.color),Object.keys(o.bgColor);const s=function(){const e=new Map;for(const[t,a]of Object.entries(o)){for(const[t,n]of Object.entries(a))o[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},a[t]=o[t],e.set(n[0],n[1]);Object.defineProperty(o,t,{value:a,enumerable:!1})}return Object.defineProperty(o,"codes",{value:e,enumerable:!1}),o.color.close="[39m",o.bgColor.close="[49m",o.color.ansi=n(),o.color.ansi256=r(),o.color.ansi16m=i(),o.bgColor.ansi=n(10),o.bgColor.ansi256=r(10),o.bgColor.ansi16m=i(10),Object.defineProperties(o,{rgbToAnsi256:{value:(e,t,a)=>e===t&&t===a?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(a/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[a]=t;3===a.length&&(a=[...a].map(e=>e+e).join(""));const n=Number.parseInt(a,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>o.rgbToAnsi256(...o.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,a,n;if(e>=232)t=(10*(e-232)+8)/255,a=t,n=t;else{const r=(e-=16)%36;t=Math.floor(e/36)/5,a=Math.floor(r/6)/5,n=r%6/5}const r=2*Math.max(t,a,n);if(0===r)return 30;let i=30+(Math.round(n)<<2|Math.round(a)<<1|Math.round(t));return 2===r&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,a)=>o.ansi256ToAnsi(o.rgbToAnsi256(e,t,a)),enumerable:!1},hexToAnsi:{value:e=>o.ansi256ToAnsi(o.hexToAnsi256(e)),enumerable:!1}}),o}(),p=s;var l=a(1708),d=a(8161),u=a(7066);function c(e,t=(globalThis.Deno?globalThis.Deno.args:l.argv)){const a=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(a+e),r=t.indexOf("--");return-1!==n&&(-1===r||n<r)}const{env:m}=l;let f;function _(e,{streamIsTTY:t,sniffFlags:a=!0}={}){const n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(f=n);const r=a?f:n;if(0===r)return 0;if(a){if(c("color=16m")||c("color=full")||c("color=truecolor"))return 3;if(c("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!t&&void 0===r)return 0;const i=r||0;if("dumb"===m.TERM)return i;if("win32"===l.platform){const e=d.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in m)||"codeship"===m.CI_NAME?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("truecolor"===m.COLORTERM)return 3;if("xterm-kitty"===m.TERM)return 3;if("xterm-ghostty"===m.TERM)return 3;if("wezterm"===m.TERM)return 3;if("TERM_PROGRAM"in m){const e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:i}function h(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(_(e,{streamIsTTY:e&&e.isTTY,...t}))}c("no-color")||c("no-colors")||c("color=false")||c("color=never")?f=0:(c("color")||c("colors")||c("color=true")||c("color=always"))&&(f=1);const E={stdout:h({isTTY:u.isatty(1)}),stderr:h({isTTY:u.isatty(2)})};function y(e,t,a){let n=e.indexOf(t);if(-1===n)return e;const r=t.length;let i=0,o="";do{o+=e.slice(i,n)+t+a,i=n+r,n=e.indexOf(t,i)}while(-1!==n);return o+=e.slice(i),o}const{stdout:T,stderr:R}=E,g=Symbol("GENERATOR"),v=Symbol("STYLER"),O=Symbol("IS_EMPTY"),N=["ansi","ansi","ansi256","ansi16m"],b=Object.create(null);const A=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const a=T?T.level:0;e.level=void 0===t.level?a:t.level})(t,e),Object.setPrototypeOf(t,S.prototype),t};function S(e){return A(e)}Object.setPrototypeOf(S.prototype,Function.prototype);for(const[e,t]of Object.entries(p))b[e]={get(){const a=P(this,D(t.open,t.close,this[v]),this[O]);return Object.defineProperty(this,e,{value:a}),a}};b.visible={get(){const e=P(this,this[v],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const I=(e,t,a,...n)=>"rgb"===e?"ansi16m"===t?p[a].ansi16m(...n):"ansi256"===t?p[a].ansi256(p.rgbToAnsi256(...n)):p[a].ansi(p.rgbToAnsi(...n)):"hex"===e?I("rgb",t,a,...p.hexToRgb(...n)):p[a][e](...n),w=["rgb","hex","ansi256"];for(const e of w){b[e]={get(){const{level:t}=this;return function(...a){const n=D(I(e,N[t],"color",...a),p.color.close,this[v]);return P(this,n,this[O])}}};b["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...a){const n=D(I(e,N[t],"bgColor",...a),p.bgColor.close,this[v]);return P(this,n,this[O])}}}}const C=Object.defineProperties(()=>{},{...b,level:{enumerable:!0,get(){return this[g].level},set(e){this[g].level=e}}}),D=(e,t,a)=>{let n,r;return void 0===a?(n=e,r=t):(n=a.openAll+e,r=t+a.closeAll),{open:e,close:t,openAll:n,closeAll:r,parent:a}},P=(e,t,a)=>{const n=(...e)=>j(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,C),n[g]=e,n[v]=t,n[O]=a,n},j=(e,t)=>{if(e.level<=0||!t)return e[O]?"":t;let a=e[v];if(void 0===a)return t;const{openAll:n,closeAll:r}=a;if(t.includes(""))for(;void 0!==a;)t=y(t,a.close,a.open),a=a.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,a,n){let r=0,i="";do{const o="\r"===e[n-1];i+=e.slice(r,o?n-1:n)+t+(o?"\r\n":"\n")+a,r=n+1,n=e.indexOf("\n",r)}while(-1!==n);return i+=e.slice(r),i}(t,r,n,i)),n+t+r};Object.defineProperties(S.prototype,b);const k=S(),L=(S({level:R?R.level:0}),k)},8572:(e,t,a)=>{const n=a(8474).EventEmitter,r=a(1421),i=a(6760),o=a(3024),s=a(1708),{Argument:p,humanReadableArgName:l}=a(1762),{CommanderError:d}=a(3823),{Help:u}=a(9690),{Option:c,DualOptions:m}=a(2088),{suggestSimilar:f}=a(6054);class _ extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>s.stdout.write(e),writeErr:e=>s.stderr.write(e),getOutHelpWidth:()=>s.stdout.isTTY?s.stdout.columns:void 0,getErrHelpWidth:()=>s.stderr.isTTY?s.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,a){let n=t,r=a;"object"==typeof n&&null!==n&&(r=n,n=null),r=r||{};const[,i,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(i);return n&&(s.description(n),s._executableHandler=!0),r.isDefault&&(this._defaultCommandName=s._name),s._hidden=!(!r.noHelp&&!r.hidden),s._executableFile=r.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),n?this:s}createCommand(e){return new _(e)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new p(e,t)}argument(e,t,a,n){const r=this.createArgument(e,t);return"function"==typeof a?r.default(n).argParser(a):r.default(a),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,a,n]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",i=this.createCommand(a);return i.helpOption(!1),n&&i.arguments(n),r&&i.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const a=["preSubcommand","preAction","postAction"];if(!a.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${a.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,a){this._exitCallback&&this._exitCallback(new d(e,t,a)),s.exit(e)}action(e){return this._actionHandler=t=>{const a=this.registeredArguments.length,n=t.slice(0,a);return this._storeOptionsAsProperties?n[a]=this:n[a]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new c(e,t)}_callParseArg(e,t,a,n){try{return e.parseArg(t,a)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const a=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${a}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),a=t(e).find(e=>this._findCommand(e));if(a){const n=t(this._findCommand(a)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),a=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(a,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(a,e.defaultValue,"default");const n=(t,n,r)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(a);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,n):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(a,t,r)};return this.on("option:"+t,t=>{const a=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const a=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,a,"env")}),this}_optionEx(e,t,a,n,r){if("object"==typeof t&&t instanceof c)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,a);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof n)i.default(r).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,a)=>{const n=e.exec(t);return n?n[0]:a},i.default(r).argParser(n)}else i.default(n);return this.addOption(i)}option(e,t,a,n){return this._optionEx({},e,t,a,n)}requiredOption(e,t,a,n){return this._optionEx({mandatory:!0},e,t,a,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,a){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=a,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(a=>{void 0!==a.getOptionValueSource(e)&&(t=a.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){s.versions?.electron&&(t.from="electron");const e=s.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let a;switch(void 0===e&&(e=s.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],a=e.slice(2);break;case"electron":s.defaultApp?(this._scriptPath=e[1],a=e.slice(2)):a=e.slice(1);break;case"user":a=e.slice(0);break;case"eval":a=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",a}parse(e,t){const a=this._prepareUserArgs(e,t);return this._parseCommand([],a),this}async parseAsync(e,t){const a=this._prepareUserArgs(e,t);return await this._parseCommand([],a),this}_executeSubCommand(e,t){t=t.slice();let a=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function p(e,t){const a=i.resolve(e,t);if(o.existsSync(a))return a;if(n.includes(i.extname(t)))return;const r=n.find(e=>o.existsSync(`${a}${e}`));return r?`${a}${r}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let l,u=e._executableFile||`${this._name}-${e._name}`,c=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}c=i.resolve(i.dirname(e),c)}if(c){let t=p(c,u);if(!t&&!e._executableFile&&this._scriptPath){const a=i.basename(this._scriptPath,i.extname(this._scriptPath));a!==this._name&&(t=p(c,`${a}-${e._name}`))}u=t||u}if(a=n.includes(i.extname(u)),"win32"!==s.platform?a?(t.unshift(u),t=h(s.execArgv).concat(t),l=r.spawn(s.argv[0],t,{stdio:"inherit"})):l=r.spawn(u,t,{stdio:"inherit"}):(t.unshift(u),t=h(s.execArgv).concat(t),l=r.spawn(s.execPath,t,{stdio:"inherit"})),!l.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{s.on(e,()=>{!1===l.killed&&null===l.exitCode&&l.kill(e)})})}const m=this._exitCallback;l.on("close",e=>{e=e??1,m?m(new d(e,"commander.executeSubCommandAsync","(close)")):s.exit(e)}),l.on("error",t=>{if("ENOENT"===t.code){const t=c?`searched for local subcommand relative to directory '${c}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",a=`'${u}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(a)}if("EACCES"===t.code)throw new Error(`'${u}' not executable`);if(m){const e=new d(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,m(e)}else s.exit(1)}),this.runningCommand=l}_dispatchSubcommand(e,t,a){const n=this._findCommand(e);let r;return n||this.help({error:!0}),r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!n._executableHandler)return n._parseCommand(t,a);this._executeSubCommand(n,t.concat(a))}),r}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,a)=>{let n=t;if(null!==t&&e.parseArg){const r=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,a,r)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((a,n)=>{let r=a.defaultValue;a.variadic?n<this.args.length?(r=this.args.slice(n),a.parseArg&&(r=r.reduce((t,n)=>e(a,n,t),a.defaultValue))):void 0===r&&(r=[]):n<this.args.length&&(r=this.args[n],a.parseArg&&(r=e(a,r,a.defaultValue))),t[n]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let a=e;const n=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{n.push({hookedCommand:e,callback:t})})}),"postAction"===t&&n.reverse(),n.forEach(e=>{a=this._chainOrCall(a,()=>e.callback(e.hookedCommand,this))}),a}_chainOrCallSubCommandHook(e,t,a){let n=e;return void 0!==this._lifeCycleHooks[a]&&this._lifeCycleHooks[a].forEach(e=>{n=this._chainOrCall(n,()=>e(this,t))}),n}_parseCommand(e,t){const a=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(a.operands),t=a.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(a.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{a.unknown.length>0&&this.unknownOption(a.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let a;return n(),this._processArguments(),a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(r,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{const a=e.find(e=>t.conflictsWith.includes(e.attributeName()));a&&this._conflictingOption(t,a)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],a=[];let n=t;const r=e.slice();function i(e){return e.length>1&&"-"===e[0]}let o=null;for(;r.length;){const e=r.shift();if("--"===e){n===a&&n.push(e),n.push(...r);break}if(!o||i(e)){if(o=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=r.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;r.length>0&&!i(r[0])&&(e=r.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),r.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),a=this._findOption(e.slice(0,t));if(a&&(a.required||a.optional)){this.emit(`option:${a.name()}`,e.slice(t+1));continue}}if(i(e)&&(n=a),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===a.length){if(this._findCommand(e)){t.push(e),r.length>0&&a.push(...r);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),r.length>0&&t.push(...r);break}if(this._defaultCommandName){a.push(e),r.length>0&&a.push(...r);break}}if(this._passThroughOptions){n.push(e),r.length>0&&n.push(...r);break}n.push(e)}else this.emit(`option:${o.name()}`,e)}return{operands:t,unknown:a}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let a=0;a<t;a++){const t=this.options[a].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const a=t||{},n=a.exitCode||1,r=a.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in s.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,s.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new m(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(a=>void 0!==a.implied&&t(a.attributeName())&&e.valueFromOption(this.getOptionValue(a.attributeName()),a)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const a=e=>{const t=e.attributeName(),a=this.getOptionValue(t),n=this.options.find(e=>e.negate&&t===e.attributeName()),r=this.options.find(e=>!e.negate&&t===e.attributeName());return n&&(void 0===n.presetArg&&!1===a||void 0!==n.presetArg&&a===n.presetArg)?n:r||e},n=e=>{const t=a(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let a=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter(e=>e.long).map(e=>e.long);a=a.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=f(e,a)}const a=`error: unknown option '${e}'${t}`;this.error(a,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,a=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${a} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const a=[];this.createHelp().visibleCommands(this).forEach(e=>{a.push(e.name()),e.alias()&&a.push(e.alias())}),t=f(e,a)}const a=`error: unknown command '${e}'${t}`;this.error(a,{code:"commander.unknownCommand"})}version(e,t,a){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",a=a||"output the version number";const n=this.createOption(t,a);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const a=this.parent?._findCommand(e);if(a){const t=[a.name()].concat(a.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>l(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let a;return a=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||a,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const a=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",a)),this.emit("beforeHelp",a);let n=this.helpInformation(a);if(t&&(n=t(n),"string"!=typeof n&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");a.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",a),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",a))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=s.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const a=["beforeAll","before","after","afterAll"];if(!a.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${a.join("', '")}'`);const n=`${e}Help`;return this.on(n,e=>{let a;a="function"==typeof t?t({error:e.error,command:e.command}):t,a&&e.write(`${a}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function h(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,a,n="127.0.0.1",r="9229";return null!==(a=e.match(/^(--inspect(-brk)?)$/))?t=a[1]:null!==(a=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=a[1],/^\d+$/.test(a[3])?r=a[3]:n=a[3]):null!==(a=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=a[1],n=a[3],r=a[4]),t&&"0"!==r?`${t}=${n}:${parseInt(r)+1}`:e})}t.Command=_},8611:e=>{e.exports=t("http")},8662:e=>{e.exports=JSON.parse('{"name":"GeneratorMQTTBroker","brickDescription":{"default":"","en-us":"MQTT Broker server","zh-tw":"MQTT Broker 伺服器","ja-jp":"MQTT Broker サーバー"},"brickDisplayName":"MQTT Broker","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"server"},"propTypes":{"init":{"type":"bool"},"port":{"type":"number","isRequired":true},"retryInterval":{"type":"number"},"keepalive":{"type":"number"},"authenticate":{"type":"bool"},"authTable":{"type":"arrayOf","content":{"type":"shape","content":{"username":{"type":"string"},"password":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false}},"brickPropDescriptions":{"init":{"default":"","en-us":"Start MQTT broker on generator initialized","zh-tw":"Generator 初始化後直接啟動","ja-jp":"ジェネレータの初期化後に MQTT ブローカーを起動"},"port":{"default":"","en-us":"Bind port of MQTT server","zh-tw":"MQTT 伺服器連接埠","ja-jp":"MQTT サーバーのバインドポート"},"retryInterval":{"default":"","en-us":"Retry interval when publish failed","zh-tw":"當發布訊息失敗時的重試間隔","ja-jp":"公開に失敗した場合の再試行間隔"},"keepalive":{"default":"","en-us":"Keep-alive interval","zh-tw":"Keep-alive 間隔","ja-jp":"キープアライブ間隔"},"authenticate":{"default":"","en-us":"Enable authentication","zh-tw":"啟用身份驗證","ja-jp":"認証を有効にする"},"authTable":{"default":"","en-us":"Authentication table","zh-tw":"身份驗證表","ja-jp":"認証テーブル"}},"defaultBrickProps":{"init":false,"port":1883,"retryInterval":5,"keepalive":60,"authenticate":false},"propertyControls":{"port":{"required":true},"retryInterval":{"kind":"unit","min":1,"unit":"s"},"keepalive":{"kind":"unit","min":1,"unit":"s"}},"outletTypes":{"GENERATOR_MQTT_BROKER_STARTED":{"outlet":"GENERATOR_MQTT_BROKER_STARTED","type":"bool"},"GENERATOR_MQTT_BROKER_LAST_MESSAGE":{"outlet":"GENERATOR_MQTT_BROKER_LAST_MESSAGE","type":"object"},"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"outlet":"GENERATOR_MQTT_BROKER_ERROR_MESSAGE","type":"string"}},"brickOutletDescriptions":{"GENERATOR_MQTT_BROKER_STARTED":{"default":"","en-us":"Is server started","zh-tw":"伺服器啟動狀態","ja-jp":"サーバーが起動しているか"},"GENERATOR_MQTT_BROKER_LAST_MESSAGE":{"default":"","en-us":"Last received message","zh-tw":"最後收到的訊息","ja-jp":"最後に受信したメッセージ"},"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"default":"","en-us":"Error message","zh-tw":"錯誤訊息","ja-jp":"エラーメッセージ"}},"eventTypes":{"GENERATOR_MQTT_BROKER_ON_READY":"GENERATOR_MQTT_BROKER_ON_READY","GENERATOR_MQTT_BROKER_ON_ERROR":"GENERATOR_MQTT_BROKER_ON_ERROR","GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED","GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED","GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED","GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED"},"brickEventDescriptions":{"GENERATOR_MQTT_BROKER_ON_READY":{"default":"","en-us":"Event of MQTT server is ready","zh-tw":"當 MQTT 伺服器啟動完成時觸發事件","ja-jp":"MQTT サーバーの準備完了時のイベント"},"GENERATOR_MQTT_BROKER_ON_ERROR":{"default":"","en-us":"Event of server or connection error","zh-tw":"當伺服器或連線發生錯誤時觸發事件","ja-jp":"サーバーまたは接続エラー時のイベント"},"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":{"default":"","en-us":"Event of client connected","zh-tw":"當有客戶端連線時觸發事件","ja-jp":"クライアント接続時のイベント"},"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":{"default":"","en-us":"Event of client disconnected","zh-tw":"當有客戶端斷線時觸發事件","ja-jp":"クライアント切断時のイベント"},"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":{"default":"","en-us":"Event of message received","zh-tw":"當收到訊息時觸發事件","ja-jp":"メッセージ受信時のイベント"},"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":{"default":"","en-us":"Event of message published","zh-tw":"當訊息發佈時觸發事件","ja-jp":"メッセージ公開時のイベント"}},"eventPropertyControls":{"GENERATOR_MQTT_BROKER_ON_ERROR":{"properties":{"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":{"properties":{"GENERATOR_MQTT_BROKER_TOPIC":{"name":"Topic","type":"string"},"GENERATOR_MQTT_BROKER_PAYLOAD":{"name":"Payload","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"},"GENERATOR_MQTT_BROKER_MESSAGE_ID":{"name":"Message ID","type":"number"}}}},"actionTypes":{"GENERATOR_MQTT_BROKER_START":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_MQTT_BROKER_PUBLISH":{"disallowMultiple":false,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MQTT_BROKER_TOPIC":{"name":"Topic","type":"string"},"GENERATOR_MQTT_BROKER_PAYLOAD":{"name":"Payload","type":"string"},"GENERATOR_MQTT_BROKER_MESSAGE_ID":{"name":"Message ID","type":"number"}}},"GENERATOR_MQTT_BROKER_STOP":{"disallowMultiple":true,"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MQTT_BROKER_START":{"default":"","en-us":"Start MQTT broker server","zh-tw":"啟動 MQTT 伺服器","ja-jp":"MQTT ブローカーサーバーを起動"},"GENERATOR_MQTT_BROKER_PUBLISH":{"default":"","en-us":"Publish message to topic","zh-tw":"發佈訊息到指定主題","ja-jp":"指定トピックにメッセージを公開"},"GENERATOR_MQTT_BROKER_STOP":{"default":"","en-us":"Stop MQTT broker server","zh-tw":"停止 MQTT 伺服器","ja-jp":"MQTT ブローカーサーバーを停止"}}}')},8678:(e,t,a)=>{a.d(t,{y:()=>p});var n,r=a(2704),i=a(5078),o=a(555),s=a(4114),p=Object.assign(function(e){var t=n.get(e);return t||(t=(0,r.y)(e),n.set(e,t)),t},{reset:function(){n=new i.A(o.v.print||2e3)}});p.reset(),!1!==globalThis.__DEV__&&(0,s.D_)("print",function(){return n?n.size:0})},8706:(e,t,a)=>{const n=a(8323);t.implementation=class{constructor(e){const t=e[0],a=e[1];let r=null;if(void 0!==a&&(r=n.basicURLParse(a),"failure"===r))throw new TypeError("Invalid base URL");const i=n.basicURLParse(t,{baseURL:r});if("failure"===i)throw new TypeError("Invalid URL");this._url=i}get href(){return n.serializeURL(this._url)}set href(e){const t=n.basicURLParse(e);if("failure"===t)throw new TypeError("Invalid URL");this._url=t}get origin(){return n.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(e){n.basicURLParse(e+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(e){n.cannotHaveAUsernamePasswordPort(this._url)||n.setTheUsername(this._url,e)}get password(){return this._url.password}set password(e){n.cannotHaveAUsernamePasswordPort(this._url)||n.setThePassword(this._url,e)}get host(){const e=this._url;return null===e.host?"":null===e.port?n.serializeHost(e.host):n.serializeHost(e.host)+":"+n.serializeInteger(e.port)}set host(e){this._url.cannotBeABaseURL||n.basicURLParse(e,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":n.serializeHost(this._url.host)}set hostname(e){this._url.cannotBeABaseURL||n.basicURLParse(e,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":n.serializeInteger(this._url.port)}set port(e){n.cannotHaveAUsernamePasswordPort(this._url)||(""===e?this._url.port=null:n.basicURLParse(e,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:0===this._url.path.length?"":"/"+this._url.path.join("/")}set pathname(e){this._url.cannotBeABaseURL||(this._url.path=[],n.basicURLParse(e,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":"?"+this._url.query}set search(e){const t=this._url;if(""===e)return void(t.query=null);const a="?"===e[0]?e.substring(1):e;t.query="",n.basicURLParse(a,{url:t,stateOverride:"query"})}get hash(){return null===this._url.fragment||""===this._url.fragment?"":"#"+this._url.fragment}set hash(e){if(""===e)return void(this._url.fragment=null);const t="#"===e[0]?e.substring(1):e;this._url.fragment="",n.basicURLParse(t,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}},8709:(e,t,a)=>{a.d(t,{U:()=>T,y:()=>g});var n=a(5608),r=a(9212),i=a(5888),o=a(5950),s=a(3673),p=a(3777),l=a(234),d=a(906),u=a(7613),c=a(5892),m=a(492),f=a(3570),_=a(5427),h=a(7634),E=Object.assign,y=Object.hasOwnProperty,T=function(e){function t(a){var r=a.queryManager,i=a.queryInfo,o=a.options,s=this,l=t.inactiveOnCreation.getValue();(s=e.call(this,function(e){l&&(r.queries.set(s.queryId,i),l=!1);try{var t=e._subscription._observer;t&&!t.error&&(t.error=R)}catch(e){}var a=!s.observers.size;s.observers.add(e);var n=s.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(s.maskResult(n.result)),a&&s.reobserve().catch(function(){}),function(){s.observers.delete(e)&&!s.observers.size&&s.tearDownQuery()}})||this).observers=new Set,s.subscriptions=new Set,s.dirty=!1,s.queryInfo=i,s.queryManager=r,s.waitForOwnResult=v(o.fetchPolicy),s.isTornDown=!1,s.subscribeToMore=s.subscribeToMore.bind(s),s.maskResult=s.maskResult.bind(s);var d=r.defaultOptions.watchQuery,u=(void 0===d?{}:d).fetchPolicy,c=void 0===u?"cache-first":u,m=o.fetchPolicy,f=void 0===m?c:m,_=o.initialFetchPolicy,h=void 0===_?"standby"===f?c:f:_;s.options=(0,n.__assign)((0,n.__assign)({},o),{initialFetchPolicy:h,fetchPolicy:f}),s.queryId=i.queryId||r.generateQueryId();var E=(0,p.Vu)(s.query);return s.queryName=E&&E.name&&E.name.value,s}return(0,n.__extends)(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),t.prototype.result=function(){var e=this;return new Promise(function(t,a){var n={next:function(a){t(a),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout(function(){r.unsubscribe()},0)},error:a},r=e.subscribe(n)})},t.prototype.resetDiff=function(){this.queryInfo.resetDiff()},t.prototype.getCurrentFullResult=function(e){void 0===e&&(e=!0);var t=this.getLastResult(!0),a=this.queryInfo.networkStatus||t&&t.networkStatus||o.pT.ready,r=(0,n.__assign)((0,n.__assign)({},t),{loading:(0,o.bi)(a),networkStatus:a}),s=this.options.fetchPolicy,p=void 0===s?"cache-first":s;if(v(p)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers);else if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var l=this.queryInfo.getDiff();(l.complete||this.options.returnPartialData)&&(r.data=l.result),(0,i.equal)(r.data,{})&&(r.data=void 0),l.complete?(delete r.partial,!l.complete||r.networkStatus!==o.pT.loading||"cache-first"!==p&&"cache-only"!==p||(r.networkStatus=o.pT.ready,r.loading=!1)):r.partial=!0,r.networkStatus===o.pT.ready&&(r.error||r.errors)&&(r.networkStatus=o.pT.error),!1===globalThis.__DEV__||l.complete||this.options.partialRefetch||r.loading||r.data||r.error||g(l.missing)}return e&&this.updateLastResult(r),r},t.prototype.getCurrentResult=function(e){return void 0===e&&(e=!0),this.maskResult(this.getCurrentFullResult(e))},t.prototype.isDifferentFromLastResult=function(e,t){if(!this.last)return!0;var a=this.queryManager.getDocumentInfo(this.query),n=this.queryManager.dataMasking,r=n?a.nonReactiveQuery:this.query;return(n||a.hasNonreactiveDirective?!(0,_.a)(r,this.last.result,e,this.variables):!(0,i.equal)(this.last.result,e))||t&&!(0,i.equal)(this.last.variables,t)},t.prototype.getLast=function(e,t){var a=this.last;if(a&&a[e]&&(!t||(0,i.equal)(a.variables,this.variables)))return a[e]},t.prototype.getLastResult=function(e){return this.getLast("result",e)},t.prototype.getLastError=function(e){return this.getLast("error",e)},t.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},t.prototype.refetch=function(e){var t,a={pollInterval:0},s=this.options.fetchPolicy;if(a.fetchPolicy="no-cache"===s?"no-cache":"network-only",!1!==globalThis.__DEV__&&e&&y.call(e,"variables")){var l=(0,p.AT)(this.query),d=l.variableDefinitions;d&&d.some(function(e){return"variables"===e.variable.name.value})||!1!==globalThis.__DEV__&&r.invariant.warn(21,e,(null===(t=l.name)||void 0===t?void 0:t.value)||l)}return e&&!(0,i.equal)(this.options.variables,e)&&(a.variables=this.options.variables=(0,n.__assign)((0,n.__assign)({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(a,o.pT.refetch)},t.prototype.fetchMore=function(e){var t=this,a=(0,n.__assign)((0,n.__assign)({},e.query?e:(0,n.__assign)((0,n.__assign)((0,n.__assign)((0,n.__assign)({},this.options),{query:this.options.query}),e),{variables:(0,n.__assign)((0,n.__assign)({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"});a.query=this.transformDocument(a.query);var i=this.queryManager.generateQueryId();this.lastQuery=e.query?this.transformDocument(this.options.query):a.query;var s=this.queryInfo,p=s.networkStatus;s.networkStatus=o.pT.fetchMore,a.notifyOnNetworkStatusChange&&this.observe();var l=new Set,d=null==e?void 0:e.updateQuery,u="no-cache"!==this.options.fetchPolicy;return u||(0,r.invariant)(d,22),this.queryManager.fetchQuery(i,a,o.pT.fetchMore).then(function(r){if(t.queryManager.removeQuery(i),s.networkStatus===o.pT.fetchMore&&(s.networkStatus=p),u)t.queryManager.cache.batch({update:function(n){var i=e.updateQuery;i?n.updateQuery({query:t.query,variables:t.variables,returnPartialData:!0,optimistic:!1},function(e){return i(e,{fetchMoreResult:r.data,variables:a.variables})}):n.writeQuery({query:a.query,variables:a.variables,data:r.data})},onWatchUpdated:function(e){l.add(e.query)}});else{var c=t.getLast("result"),m=d(c.data,{fetchMoreResult:r.data,variables:a.variables});t.reportResult((0,n.__assign)((0,n.__assign)({},c),{networkStatus:p,loading:(0,o.bi)(p),data:m}),t.variables)}return t.maskResult(r)}).finally(function(){u&&!l.has(t.query)&&t.reobserveCacheFirst()})},t.prototype.subscribeToMore=function(e){var t=this,a=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(a){var r=e.updateQuery;r&&t.updateQuery(function(e,t){return r(e,(0,n.__assign)({subscriptionData:a},t))})},error:function(t){e.onError?e.onError(t):!1!==globalThis.__DEV__&&r.invariant.error(23,t)}});return this.subscriptions.add(a),function(){t.subscriptions.delete(a)&&a.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.silentSetOptions=function(e){var t=(0,m.o)(this.options,e||{});E(this.options,t)},t.prototype.setVariables=function(e){return(0,i.equal)(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},o.pT.setVariables):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,a=t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}),n=a.result,r=a.complete,i=e(n,{variables:this.variables,complete:!!r,previousData:n});i&&(t.cache.writeQuery({query:this.options.query,data:i,variables:this.variables}),t.broadcastQueries())},t.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},t.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},t.prototype.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var a=t.fetchPolicy,n=void 0===a?"cache-first":a,r=t.initialFetchPolicy,i=void 0===r?n:r;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:i}):t.fetchPolicy="variables-changed"===e?i:t.nextFetchPolicy)}return t.fetchPolicy},t.prototype.fetch=function(e,t,a){var n=this.queryManager.getOrCreateQuery(this.queryId);return n.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(n,e,t,a)},t.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var t=this.pollingInfo,a=this.options.pollInterval;if(a&&this.hasObservers()){if(!t||t.interval!==a){(0,r.invariant)(a,24),(t||(this.pollingInfo={})).interval=a;var n=function(){var t,a;e.pollingInfo&&((0,o.bi)(e.queryInfo.networkStatus)||(null===(a=(t=e.options).skipPollAttempt)||void 0===a?void 0:a.call(t))?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},o.pT.poll).then(i,i))},i=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(n,t.interval))};i()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)}},t.prototype.updateLastResult=function(e,t){void 0===t&&(t=this.variables);var a=this.getLastError();return a&&this.last&&!(0,i.equal)(t,this.last.variables)&&(a=void 0),this.last=(0,n.__assign)({result:this.queryManager.assumeImmutableResults?e:(0,d.m)(e),variables:t},a?{error:a}:null)},t.prototype.reobserveAsConcast=function(e,t){var a=this;this.isTornDown=!1;var r=t===o.pT.refetch||t===o.pT.fetchMore||t===o.pT.poll,s=this.options.variables,p=this.options.fetchPolicy,l=(0,m.o)(this.options,e||{}),d=r?l:E(this.options,l),u=this.transformDocument(d.query);this.lastQuery=u,r||(this.updatePolling(),!e||!e.variables||(0,i.equal)(e.variables,s)||"standby"===d.fetchPolicy||d.fetchPolicy!==p&&"function"!=typeof d.nextFetchPolicy||(this.applyNextFetchPolicy("variables-changed",d),void 0===t&&(t=o.pT.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=v(d.fetchPolicy));var c=function(){a.concast===y&&(a.waitForOwnResult=!1)},_=d.variables&&(0,n.__assign)({},d.variables),h=this.fetch(d,t,u),y=h.concast,T=h.fromLink,R={next:function(e){(0,i.equal)(a.variables,_)&&(c(),a.reportResult(e,_))},error:function(e){(0,i.equal)(a.variables,_)&&((0,f.isApolloError)(e)||(e=new f.ApolloError({networkError:e})),c(),a.reportError(e,_))}};return r||!T&&this.concast||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=y,this.observer=R),y.addObserver(R),y},t.prototype.reobserve=function(e,t){return(0,l.X)(this.reobserveAsConcast(e,t).promise.then(this.maskResult))},t.prototype.resubscribeAfterError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=this.last;this.resetLastResults();var n=this.subscribe.apply(this,e);return this.last=a,n},t.prototype.observe=function(){this.reportResult(this.getCurrentFullResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var a=this.getLastError(),n=this.isDifferentFromLastResult(e,t);(a||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),(a||n)&&(0,u.w)(this.observers,"next",this.maskResult(e))},t.prototype.reportError=function(e,t){var a=(0,n.__assign)((0,n.__assign)({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:o.pT.error,loading:!1});this.updateLastResult(a,t),(0,u.w)(this.observers,"error",this.last.error=e)},t.prototype.hasObservers=function(){return this.observers.size>0},t.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(e){return e.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},t.prototype.transformDocument=function(e){return this.queryManager.transform(e)},t.prototype.maskResult=function(e){return e&&"data"in e?(0,n.__assign)((0,n.__assign)({},e),{data:this.queryManager.maskOperation({document:this.query,data:e.data,fetchPolicy:this.options.fetchPolicy,id:this.queryId})}):e},t.prototype.resetNotifications=function(){this.cancelNotifyTimeout(),this.dirty=!1},t.prototype.cancelNotifyTimeout=function(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0)},t.prototype.scheduleNotify=function(){var e=this;this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return e.notify()},0)))},t.prototype.notify=function(){(this.cancelNotifyTimeout(),this.dirty)&&("cache-only"!=this.options.fetchPolicy&&"cache-and-network"!=this.options.fetchPolicy&&(0,o.bi)(this.queryInfo.networkStatus)||(this.queryInfo.getDiff().fromOptimisticTransaction?this.observe():this.reobserveCacheFirst()));this.dirty=!1},t.prototype.reobserveCacheFirst=function(){var e=this.options,t=e.fetchPolicy,a=e.nextFetchPolicy;return"cache-and-network"===t||"network-only"===t?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,n){return this.nextFetchPolicy=a,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,n):t}}):this.reobserve()},t.inactiveOnCreation=new h.Slot,t}(s.c);function R(e){!1!==globalThis.__DEV__&&r.invariant.error(25,e.message,e.stack)}function g(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&r.invariant.debug(26,e)}function v(e){return"network-only"===e||"no-cache"===e||"standby"===e}(0,c.r)(T)},8752:e=>{e.exports=JSON.parse('{"name":"GeneratorTick","brickDescription":{"default":"Execute event in countdown manner","en-us":"Execute event in countdown manner","zh-tw":"以倒數計時的方式執行事件","ja-jp":"カウントダウン方式でイベントを実行"},"brickDisplayName":"Tick","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"clock"},"propTypes":{"init":{"type":"bool"},"interval":{"type":"number"},"countdownStartValue":{"type":"number"},"countdownInterval":{"type":"number"},"repeat":{"type":"bool"},"map":{"type":"object"},"mapFallback":{"type":"any"}},"brickPropDescriptions":{"init":{"default":"","en-us":"Start tick on generator initialized","zh-tw":"Generator 初始化後直接開始執行事件","ja-jp":"ジェネレータの初期化時にティックを開始"},"interval":{"default":"","en-us":"Interval of second for countdown","zh-tw":"每次間隔變動的時間(秒)","ja-jp":"カウントダウンの秒間隔"},"countdownStartValue":{"default":"","en-us":"Initial value of countdown","zh-tw":"倒數的起始值","ja-jp":"カウントダウンの初期値"},"countdownInterval":{"default":"","en-us":"Interval of value for countdown","zh-tw":"每次間隔變動的數值","ja-jp":"カウントダウンの値の間隔"},"repeat":{"default":"","en-us":"Make countdown repeatable","zh-tw":"是否在倒數完畢後重新開始","ja-jp":"カウントダウンを繰り返し可能にする"},"map":{"default":"","en-us":"Map for PROPERTY_BANK_RESULT","zh-tw":"PROPERTY_BANK_RESULT 對應的轉換表","ja-jp":"PROPERTY_BANK_RESULTのマッピング"},"mapFallback":{"default":"","en-us":"Fallback of MAP_OBJECT","zh-tw":"MAP_OBJECT 的預設回傳值","ja-jp":"MAP_OBJECTのフォールバック"}},"propertyControls":{"interval":{"kind":"unit","min":0,"unit":"ms"},"countdownStartValue":{"kind":"unit","min":0,"required":true},"countdownInterval":{"kind":"unit","min":0}},"outletTypes":{"GENERATOR_TICK_COUNTDOWN":{"outlet":"GENERATOR_TICK_COUNTDOWN","oneOfType":["string","number"]},"GENERATOR_TICK_RUNNING":{"outlet":"GENERATOR_TICK_RUNNING","oneOfType":["bool","string","number"]}},"brickOutletDescriptions":{"GENERATOR_TICK_COUNTDOWN":{"default":"","en-us":"Countdown step value","zh-tw":"倒數的變數值","ja-jp":"カウントダウンステップ値"},"GENERATOR_TICK_RUNNING":{"default":"","en-us":"Is tick running?","zh-tw":"Tick 是否運作中","ja-jp":"ティックは実行中か"}},"defaultBrickProps":{},"eventTypes":{"GENERATOR_TICK_TICKING":"GENERATOR_TICK_TICKING","GENERATOR_TICK_COMPLETED":"GENERATOR_TICK_COMPLETED"},"brickEventDescriptions":{"GENERATOR_TICK_TICKING":{"default":"","en-us":"Event for each tick start","zh-tw":"每次倒數觸發的事件","ja-jp":"ティック開始時のイベント"},"GENERATOR_TICK_COMPLETED":{"default":"","en-us":"Event for tick completed","zh-tw":"當 Tick 完成時觸發的事件","ja-jp":"ティック完了時のイベント"}},"eventPropertyControls":{"GENERATOR_TICK_TICKING":{"properties":{"GENERATOR_TICK_COUNTDOWN":{"name":"Countdown","type":"number"},"GENERATOR_TICK_VALUE":{"name":"Value","type":"any"}}},"GENERATOR_TICK_COMPLETED":{"properties":{"GENERATOR_TICK_COUNTDOWN":{"name":"Countdown","type":"number"},"GENERATOR_TICK_VALUE":{"name":"Value","type":"any"}}}},"actionTypes":{"GENERATOR_TICK":{"canProvideProperty":false},"GENERATOR_TICK_CANCEL":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_TICK":{"default":"","en-us":"Start the tick","zh-tw":"開始倒數","ja-jp":"ティックを開始"},"GENERATOR_TICK_CANCEL":{"default":"","en-us":"Cancel the tick","zh-tw":"取消倒數","ja-jp":"ティックをキャンセル"}}}')},8765:(e,a,n)=>{n.d(a,{clearConfig:()=>T,default:()=>R,getBaseUrl:()=>l,getCurrentProfile:()=>h,getToken:()=>c,getTokenInfo:()=>m,getTokens:()=>u,listProfiles:()=>y,removeToken:()=>_,setBaseUrl:()=>d,setCurrentProfile:()=>E,setToken:()=>f}),n.r(a);var r=n(6928);const i=t("os");var s=r.join(i.homedir(),".bricks-cli"),p=new o({projectName:"bricks-cli",cwd:s,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},createdAt:{type:"string"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"}}}),l=()=>p.get("baseUrl"),d=e=>p.set("baseUrl",e),u=()=>p.get("tokens"),c=(e="default")=>{var t=p.get("tokens");return t[e]?.token},m=(e="default")=>p.get("tokens")[e],f=(e,t)=>{var a=p.get("tokens");a[e]={...t,createdAt:(new Date).toISOString()},p.set("tokens",a)},_=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},h=()=>p.get("currentProfile"),E=e=>p.set("currentProfile",e),y=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},T=()=>{p.clear()};const R=p},8768:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r=a(458),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:a,parentSchema:i,it:o}=e;if(!Array.isArray(a))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const s=a,p=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(function(){s.forEach((a,i)=>{let s;(0,r.alwaysValidSchema)(o,a)?t.var(d,!0):s=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},d),i>0&&t.if(n._`${d} && ${p}`).assign(p,!1).assign(l,n._`[${l}, ${i}]`).else(),t.if(d,()=>{t.assign(p,!0),t.assign(l,i),s&&e.mergeEvaluated(s,n.Name)})})}),e.result(p,()=>e.reset(),()=>e.error(!0))}};t.default=i},8792:e=>{e.exports=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var n,r,i;if(Array.isArray(t)){if((n=t.length)!=a.length)return!1;for(r=n;0!==r--;)if(!e(t[r],a[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(r=n;0!==r--;)if(!Object.prototype.hasOwnProperty.call(a,i[r]))return!1;for(r=n;0!==r--;){var o=i[r];if(!e(t[o],a[o]))return!1}return!0}return t!=t&&a!=a}},8802:e=>{e.exports=JSON.parse('{"name":"GeneratorMCPServer","brickDescription":{"default":"Model Context Protocol (MCP) Server","en-us":"Model Context Protocol (MCP) Server (https://docs.anthropic.com/en/docs/agents-and-tools/mcp)","zh-tw":"MCP 伺服器(https://docs.anthropic.com/zh-TW/docs/agents-and-tools/mcp)","ja-jp":"Model Context Protocol (MCP) サーバー(https://docs.anthropic.com/ja/docs/agents-and-tools/mcp)"},"brickDisplayName":"MCP Server","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"server"},"brickMeta":{"canBeGlobalGenerator":true},"propTypes":{"enabled":{"type":"bool"},"globalGeneratorKey":{"type":"string"},"listening":{"type":"bool"},"port":{"type":"number"},"authType":{"type":"oneOf","content":["none","bearer"],"forcePropertyBank":false},"bearerToken":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"},"resources":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"uriOrTemplate":{"type":"string"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false},"tools":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"params":{"type":"object"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false},"prompts":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"arguments":{"type":"object"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false}},"brickPropDescriptions":{"enabled":{"default":"","en-us":"Enable MCP server. If enabled and Listening is false, the generator can still provide application-scoped resources.","zh-tw":"啟用 MCP 伺服器。如果啟用且 Listening 為 false,generator 仍然可以提供應用程式範圍的資源。","ja-jp":"MCP サーバーを有効にします。有効で Listening が false の場合でも、ジェネレーターはアプリケーションスコープのリソースを提供できます。"},"globalGeneratorKey":{"default":"","en-us":"Application-scoped generator key, key cannot be the same with other application-scoped generators","zh-tw":"應用程式範圍的 generator key,key 不能與其他應用程式範圍的 generator 相同","ja-jp":"アプリケーションスコープのジェネレーターキー、キーは他のアプリケーションスコープのジェネレーターと同じにできません"},"listening":{"default":"","en-us":"Start MCP server","zh-tw":"Generator 開始執行 MCP 伺服器","ja-jp":"MCP サーバーを起動する"},"port":{"default":"","en-us":"HTTP server port","zh-tw":"HTTP 伺服器連接埠","ja-jp":"HTTP サーバーポート"},"authType":{"default":"","en-us":"Authorization type of HTTP request","zh-tw":"HTTP 認證方式","ja-jp":"HTTP リクエストの認証タイプ"},"bearerToken":{"default":"","en-us":"Token of bearer auth","zh-tw":"Bearer 認證 token","ja-jp":"Bearer 認証のトークン"},"name":{"default":"","en-us":"Name of the MCP server","zh-tw":"MCP 伺服器名稱","ja-jp":"MCP サーバーの名前"},"version":{"default":"","en-us":"Version of the MCP server","zh-tw":"MCP 伺服器版本","ja-jp":"MCP サーバーのバージョン"},"resources":{"default":"","en-us":"Resources \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"資源 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"リソース \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"},"tools":{"default":"","en-us":"Tools \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id. \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"工具 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同。 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"ツール \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください。 \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"},"prompts":{"default":"","en-us":"Prompts \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"提示 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"プロンプト \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"}},"propertyControls":{"resources":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-resources"},"tools":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-tools"},"prompts":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-prompts"},"authType":{"oneOfEmptyOption":false}},"propertyControlGroups":{"httpServer":{"name":"HTTP Server Config","type":"group","content":["listening","port","authType","bearerToken"]}},"propertyControlGroupDescriptions":{},"defaultBrickProps":{"enabled":true,"listening":true,"authType":"none","name":"bricks-foundation-mcp-server-default","version":"1.0.0","resources":[],"tools":[],"prompts":[]},"eventTypes":{"GENERATOR_MCP_SERVER_ON_LISTENING":"GENERATOR_MCP_SERVER_ON_LISTENING","GENERATOR_MCP_SERVER_ON_ERROR":"GENERATOR_MCP_SERVER_ON_ERROR","GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR","GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE","GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE","GENERATOR_MCP_SERVER_ON_CALL_TOOL":"GENERATOR_MCP_SERVER_ON_CALL_TOOL","GENERATOR_MCP_SERVER_ON_GET_PROMPT":"GENERATOR_MCP_SERVER_ON_GET_PROMPT"},"brickEventDescriptions":{"GENERATOR_MCP_SERVER_ON_LISTENING":{"default":"","en-us":"Listening of HTTP server","zh-tw":"HTTP 伺服器聆聽","ja-jp":"HTTP サーバーのリスニング"},"GENERATOR_MCP_SERVER_ON_ERROR":{"default":"","en-us":"Error of HTTP server","zh-tw":"HTTP 伺服器錯誤","ja-jp":"HTTP サーバーのエラー"},"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":{"default":"","en-us":"Client error of HTTP server","zh-tw":"HTTP 伺服器客戶端錯誤","ja-jp":"HTTP サーバーのクライアントエラー"},"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":{"default":"","en-us":"Client close of HTTP server","zh-tw":"HTTP 伺服器客戶端關閉","ja-jp":"HTTP サーバーのクライアント閉じる"},"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":{"default":"","en-us":"On request resource (Request: { name: string, uri: string, params: object })","zh-tw":"當請求資源 (Request: { name: string, uri: string, params: object })","ja-jp":"リクエストリソース (Request: { name: string, uri: string, params: object })"},"GENERATOR_MCP_SERVER_ON_CALL_TOOL":{"default":"","en-us":"On call tool (Request: { name: string, params: object })","zh-tw":"當呼叫工具 (Request: { name: string, params: object })","ja-jp":"ツールの呼び出し (Request: { name: string, params: object })"},"GENERATOR_MCP_SERVER_ON_GET_PROMPT":{"default":"","en-us":"On get prompt (Request: { name: string, arguments: object })","zh-tw":"當獲取提示 (Request: { name: string, arguments: object })","ja-jp":"プロンプトの取得 (Request: { name: string, arguments: object })"}},"eventPropertyControls":{"GENERATOR_MCP_SERVER_ON_ERROR":{"properties":{"GENERATOR_MCP_SERVER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":{"properties":{"GENERATOR_MCP_SERVER_CLIENT_ADDRESS":{"name":"Client Address","type":"string"},"GENERATOR_MCP_SERVER_SESSION_ID":{"name":"Session ID","type":"string"},"GENERATOR_MCP_SERVER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":{"properties":{"GENERATOR_MCP_SERVER_CLIENT_ADDRESS":{"name":"Client Address","type":"string"},"GENERATOR_MCP_SERVER_SESSION_ID":{"name":"Session ID","type":"string"}}},"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_URI":{"name":"Request URI","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Variables","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}},"GENERATOR_MCP_SERVER_ON_CALL_TOOL":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Params","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}},"GENERATOR_MCP_SERVER_ON_GET_PROMPT":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Variables","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}}},"outletTypes":{"GENERATOR_MCP_SERVER_IS_LISTENING":{"outlet":"GENERATOR_MCP_SERVER_IS_LISTENING","type":"bool"},"GENERATOR_MCP_SERVER_LAST_ERROR":{"outlet":"GENERATOR_MCP_SERVER_LAST_ERROR","type":"string"},"GENERATOR_MCP_SERVER_ENDPOINT":{"outlet":"GENERATOR_MCP_SERVER_ENDPOINT","type":"string"},"GENERATOR_MCP_SERVER_CONNECTED_REMOTES":{"outlet":"GENERATOR_MCP_SERVER_CONNECTED_REMOTES","type":"array"},"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST":{"outlet":"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST","type":"object"},"GENERATOR_MCP_SERVER_LAST_TOOL_CALL":{"outlet":"GENERATOR_MCP_SERVER_LAST_TOOL_CALL","type":"object"},"GENERATOR_MCP_SERVER_LAST_PROMPT_GET":{"outlet":"GENERATOR_MCP_SERVER_LAST_PROMPT_GET","type":"object"}},"brickOutletDescriptions":{"GENERATOR_MCP_SERVER_IS_LISTENING":{"default":"","en-us":"Whether the HTTP server is listening","zh-tw":"HTTP 伺服器是否正在聆聽","ja-jp":"HTTP サーバーがリスニングしているかどうか"},"GENERATOR_MCP_SERVER_LAST_ERROR":{"default":"","en-us":"Last error of HTTP server","zh-tw":"HTTP 伺服器最後的錯誤","ja-jp":"HTTP サーバーの最後のエラー"},"GENERATOR_MCP_SERVER_ENDPOINT":{"default":"","en-us":"MCP server endpoint URL","zh-tw":"MCP 伺服器端點 URL","ja-jp":"MCP サーバーのエンドポイント URL"},"GENERATOR_MCP_SERVER_CONNECTED_REMOTES":{"default":"","en-us":"Connected remotes (Session ID)","zh-tw":"連接的遠端 (Session ID)","ja-jp":"接続されたリモート (セッション ID)"},"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST":{"default":"","en-us":"Last resource request ({ name: string, uri: string, params: object })","zh-tw":"最後的資源請求 ({ name: string, uri: string, params: object })","ja-jp":"最後のリソース要求 ({ name: string, uri: string, params: object })"},"GENERATOR_MCP_SERVER_LAST_TOOL_CALL":{"default":"","en-us":"Last tool call ({ name: string, params: object })","zh-tw":"最後的工具呼叫 ({ name: string, params: object })","ja-jp":"最後のツール呼び出し ({ name: string, params: object })"},"GENERATOR_MCP_SERVER_LAST_PROMPT_GET":{"default":"","en-us":"Last prompt get ({ name: string, arguments: object })","zh-tw":"最後的提示獲取 ({ name: string, arguments: object })","ja-jp":"最後のプロンプトの取得 ({ name: string, arguments: object })"}},"actionTypes":{"GENERATOR_MCP_SERVER_REFRESH_RESOURCES":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MCP_SERVER_REFRESH_RESOURCES":{"default":"","en-us":"Refresh tools and resources, used for case if tools or resources are changed. Note that the current connections will be closed.","zh-tw":"重新整理工具和資源,用於工具或資源變更時。注意,目前連線將會關閉。","ja-jp":"ツールとリソースを更新します。ツールやリソースが変更された場合に使用します。注意、現在の接続は閉じられます。"}}}')},8832:(e,t,a)=>{var n=a(3634),r=a(6525),i=a(8243),o=a(5523);e.exports=function(e,t){return n(e)||r(e,t)||i(e,t)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},8870:(e,t,a)=>{var n=a(5650),r=Object.prototype,i=r.hasOwnProperty,o=r.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),a=e[s];try{e[s]=void 0;var n=!0}catch(e){}var r=o.call(e);return n&&(t?e[s]=a:delete e[s]),r}},8875:function(e){!function(t){const a="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${a}\\.${a}\\.${a}\\.${a}$`,"i"),threeOctet:new RegExp(`^${a}\\.${a}\\.${a}$`,"i"),twoOctet:new RegExp(`^${a}\\.${a}$`,"i"),longValue:new RegExp(`^${a}$`,"i")},r=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${a}\\.${a}\\.${a}\\.${a}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${a}\\.${a}\\.${a}\\.${a}(${o})?$`,"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let a,n,r=0,i=-1,o=(e.match(p.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)r++;if("::"===e.substr(0,2)&&r--,"::"===e.substr(-2,2)&&r--,r>t)return null;for(n=t-r,a=":";n--;)a+="0:";return":"===(e=e.replace("::",a))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),t=function(){const t=e.split(":"),a=[];for(let e=0;e<t.length;e++)a.push(parseInt(t[e],16));return a}(),{parts:t,zoneId:o}}function d(e,t,a,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let r,i=0;for(;n>0;){if(r=a-n,r<0&&(r=0),e[i]>>r!==t[i]>>r)return!1;n-=a,i+=1}return!0}function u(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(r.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function c(e,t){for(;e.length<t;)e=`0${e}`;return e}const m={};m.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,a;for(t=0;t<e.length;t++)if(a=e[t],!(0<=a&&a<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let a;if(void 0===t&&(a=e,e=a[0],t=a[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return d(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const a={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,r,i;for(n=3;n>=0;n-=1){if(r=this.octets[n],!(r in a))return null;if(i=a[r],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return m.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),m.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),a=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[];let i=0;for(;i<4;)r.push(parseInt(a[i],10)|255^parseInt(n[i],10)),i++;return new this(r)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.isIPv4=function(e){return null!==this.parser(e)},m.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},m.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},m.IPv4.isValidFourPartDecimal=function(e){return!(!m.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},m.IPv4.isValidCIDRFourPartDecimal=function(e){const t=e.match(/^(.+)\/(\d+)$/);return!(!m.IPv4.isValidCIDR(e)||!t)&&m.IPv4.isValidFourPartDecimal(t[1])},m.IPv4.networkAddressFromCIDR=function(e){let t,a,n,r,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[],a=0;a<4;)r.push(parseInt(n[a],10)&parseInt(i[a],10)),a++;return new this(r)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},m.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const a=[this.parse(t[1]),e];return Object.defineProperty(a,"toString",{value:function(){return this.join("/")}}),a}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},m.IPv4.parser=function(e){let t,a,r;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t<e.length;t++)a=e[t],n.push(u(a));return n}();if(t=e.match(n.longValue)){if(r=u(t[1]),r>4294967295||r<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(r>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),a=[];if(r=u(e[1]),r>16777215||r<0)throw new Error("ipaddr: address outside defined range");return a.push(u(e[0])),a.push(r>>16&255),a.push(r>>8&255),a.push(255&r),a}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),a=[];if(r=u(e[2]),r>65535||r<0)throw new Error("ipaddr: address outside defined range");return a.push(u(e[0])),a.push(u(e[1])),a.push(r>>8&255),a.push(255&r),a}():null},m.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let a=0;const n=Math.floor(e/8);for(;a<n;)t[a]=255,a++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},m.IPv6=function(){function e(e,t){let a,n;if(16===e.length)for(this.parts=[],a=0;a<=14;a+=2)this.parts.push(e[a]<<8|e[a+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(a=0;a<this.parts.length;a++)if(n=this.parts[a],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let a;if(void 0===t&&(a=e,e=a[0],t=a[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return d(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const a={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,r;for(let i=7;i>=0;i-=1){if(n=this.parts[i],!(n in a))return null;if(r=a[n],t&&0!==r)return null;16!==r&&(t=!0),e+=r}return 128-e},e.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],a=this.parts;for(let n=0;n<a.length;n++)e=a[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(c(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],a=e[1];return new m.IPv4([t>>8,255&t,a>>8,255&a])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let a,n=0,r=-1;for(;a=e.exec(t);)a[0].length>r&&(n=a.index,r=a[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),m.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),a=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[];let i=0;for(;i<16;)r.push(parseInt(a[i],10)|255^parseInt(n[i],10)),i++;return new this(r)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},m.IPv6.isIPv6=function(e){return null!==this.parser(e)},m.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},m.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},m.IPv6.networkAddressFromCIDR=function(e){let t,a,n,r,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[],a=0;a<16;)r.push(parseInt(n[a],10)&parseInt(i[a],10)),a++;return new this(r)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},m.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},m.IPv6.parseCIDR=function(e){let t,a,n;if((a=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(a[2]),t>=0&&t<=128))return n=[this.parse(a[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},m.IPv6.parser=function(e){let t,a,n,r,i,o;if(n=e.match(p.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(p.native.test(e))return l(e,8);if((n=e.match(p.transitional))&&(o=n[6]||"",t=n[1],n[1].endsWith("::")||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(i=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],a=0;a<i.length;a++)if(r=i[a],!(0<=r&&r<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},m.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let a=0;const n=Math.floor(e/8);for(;a<n;)t[a]=255,a++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},m.fromByteArray=function(e){const t=e.length;if(4===t)return new m.IPv4(e);if(16===t)return new m.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},m.isValid=function(e){return m.IPv6.isValid(e)||m.IPv4.isValid(e)},m.isValidCIDR=function(e){return m.IPv6.isValidCIDR(e)||m.IPv4.isValidCIDR(e)},m.parse=function(e){if(m.IPv6.isValid(e))return m.IPv6.parse(e);if(m.IPv4.isValid(e))return m.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},m.parseCIDR=function(e){try{return m.IPv6.parseCIDR(e)}catch(t){try{return m.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},m.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},m.subnetMatch=function(e,t,a){let n,r,i,o;for(r in null==a&&(a="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,r))for(i=t[r],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(o=i[n],e.kind()===o[0].kind()&&e.match.apply(e,o))return r;return a},e.exports?e.exports=m:t.ipaddr=m}(this)},8897:e=>{e.exports=JSON.parse('{"name":"math","description":null,"description_zh_TW":null,"description_ja_JP":null,"commands":{"MATH_ABS":{"name":"Abs","description":"Abs","description_zh_TW":"絕對值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_ADD":{"name":"Add","description":"Add","description_zh_TW":"兩數相加","arg":[{"name":"augend","type":"number","subType":false,"defaultValue":"0"},{"name":"addend","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_CEIL":{"name":"Ceil","description":"Ceil","description_zh_TW":"取得無條件進位值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_DIVIDE":{"name":"Divide","description":"Divide (Return integer if precision is 0)","description_zh_TW":"兩數相除 (如果 precision 為 0 則會回傳整數值)","arg":[{"name":"dividend","type":"number","subType":false,"defaultValue":"0"},{"name":"divisor","type":"number","subType":false,"defaultValue":"1"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_EQUAL":{"name":"Equal","description":"Alias of LOGICTYPE_EQUAL_VALUE","description_zh_TW":"LOGICTYPE_EQUAL_VALUE 別名","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"MATH_EQUATION":{"name":"Run equation","description":"Use string to write math functions, and use object as variables. (You can use OBJECT_DEFAULTS to make object)","description_zh_TW":"使用字串撰寫數學函數,並可使用物件作為傳入參數, 函數計算時會以物件的 Key 作為參數的名稱,帶入對應的參數至公式中計算結果(傳入參數物件可使用 OBJECT_DEFAULTS 製作)","arg":[{"name":"arguments","type":"object","subType":false,"defaultValue":"{}"},{"name":"equation","type":"string","subType":false}],"return":[{"name":"result","type":"number"}]},"MATH_FLOOR":{"name":"Floor","description":"Floor number","description_zh_TW":"無條件捨去","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_GCD":{"name":"GCD","description":"GCD","description_zh_TW":"最大公因數","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_IS_NEGATIVE":{"name":"Is Negative","description":"Is negative","description_zh_TW":"是否為負數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_POSITIVE":{"name":"Is Positive","description":"Is positive","description_zh_TW":"是否為正數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_PRIME":{"name":"Is Prime","description":"Is prime","description_zh_TW":"是否為質數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_ZERO":{"name":"Is zero","description":"Is zero","description_zh_TW":"是否為零","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_LARGER":{"name":"Larger","description":"Larger","description_zh_TW":"大於","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_LARGER_AND_EQUAL":{"name":"Larger and Equal","description":"Larger and Equal","description_zh_TW":"大於等於","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_LCM":{"name":"LCM","description":"LCM","description_zh_TW":"最小公倍數","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_MAX":{"name":"Max","description":"Get max value in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的最大值 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MEAN":{"name":"Mean","description":"Get average value in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的平均值 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MIN":{"name":"Min","description":"Get min in array of number (ignore non-numeric value)","description_zh_TW":"傳入的陣列中若有非數字元素,會被直接忽略","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MOD":{"name":"Mod","description":"Mod","description_zh_TW":"餘數","arg":[{"name":"dividend","type":"number","subType":false,"defaultValue":"0"},{"name":"divisor","type":"number","subType":false,"defaultValue":"1"}],"return":[{"name":"result","type":"number"}]},"MATH_MULTIPLY":{"name":"Multiply","description":"Multiply","description_zh_TW":"兩數相乘","arg":[{"name":"multiplier","type":"number","subType":false,"defaultValue":"1"},{"name":"multiplicand","type":"number","subType":false,"defaultValue":"1"}],"return":[{"name":"result","type":"number"}]},"MATH_NOT_EQUAL":{"name":"Not Equal","description":"Not equal","description_zh_TW":"不等於","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"MATH_NTH_ROOT":{"name":"Root","description":"Root","description_zh_TW":"開方根","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"root","type":"integer","subType":false,"defaultValue":"2"}],"return":[{"name":"result","type":"number"}]},"MATH_POW":{"name":"Pow","description":"Pow","description_zh_TW":"次方","arg":[{"name":"base","type":"number","subType":false,"defaultValue":"0"},{"name":"exponent","type":"integer","subType":false,"defaultValue":"2"}],"return":[{"name":"result","type":"number"}]},"MATH_RANDOM":{"name":"Random","description":"Get a random number","description_zh_TW":"取得亂數值","arg":[{"name":"trigger","type":"any","subType":false,"defaultValue":"undefined"},{"name":"lower","type":"number","subType":false,"defaultValue":"0"},{"name":"upper","type":"number","subType":false,"defaultValue":"1"},{"name":"floating","type":"bool","subType":false,"defaultValue":"true"}],"return":[{"name":"result","type":"number"}]},"MATH_ROUND":{"name":"Round","description":"Round number","description_zh_TW":"取得四捨五入值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SIGN":{"name":"Sign","description":"Sign number","description_zh_TW":"取得正負數","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SMALLER":{"name":"Smaller","description":"Result = x < y","description_zh_TW":"小於 (Result = x < y)","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_SMALLER_AND_EQUAL":{"name":"Smaller And Equal","description":"Result = x <= y","description_zh_TW":"小於等於 (Result = x <= y)","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_SUBTRACT":{"name":"Substract","description":"Substract","description_zh_TW":"兩數相減","arg":[{"name":"minuend","type":"number","subType":false,"defaultValue":"0"},{"name":"subtrahend","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SUM":{"name":"Sum","description":"Get sum in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的總和 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_UNARY_MINUS":{"name":"Unary minus","description":"Unary minus (Result = value * -1)","description_zh_TW":"反向負數 (Result = value * -1)","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_UNARY_PLUS":{"name":"Unary plus","description":"Unary plus","description_zh_TW":"數值化","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]}}}')},8904:e=>{e.exports=JSON.parse('{"name":"BrickWebRTCStream","brickDescription":{"default":"Brick WebRTC stream viewer component","en-us":"WebRTCStream brick","zh-tw":"WebRTC 串流方塊","ja-jp":"WebRTCストリームブリック"},"brickDisplayName":"WebRTC Stream","brickTip":{"default":"@brick-tip-webrtc-stream","en-us":"Add WebRTC Stream Viewer (Control by WebRTC Generator and Event)","zh-tw":"WebRTC 顯示畫面元件,需搭配 WebRTC Generator 及事件做控制","ja-jp":"WebRTC ストリームビューアを追加(WebRTC ジェネレーターとイベントによる制御)"},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"video"},"propTypes":{"mirror":{"type":"bool"},"resizeMode":{"type":"oneOf","content":["contain","cover"],"forcePropertyBank":false},"noStreamViewText":{"type":"string"},"noStreamViewTextSize":{"type":"number"},"noStreamViewTextColor":{"type":"string"}},"brickPropDescriptions":{"mirror":{"default":"","en-us":"Mirror video","zh-tw":"鏡像影像","ja-jp":"ミラービデオ"},"resizeMode":{"default":"","en-us":"The stream resize mode","zh-tw":"串流呈現模式","ja-jp":"ストリームのリサイズモード"},"noStreamViewText":{"default":"","en-us":"Show text content if no stream","zh-tw":"如果沒有串流,則顯示文字","ja-jp":"ストリームがない場合にテキストを表示"},"noStreamViewTextSize":{"default":"","en-us":"The font size of shown text content if no stream","zh-tw":"如果沒有串流,則顯示的文字大小","ja-jp":"ストリームがない場合に表示されるテキストのフォントサイズ"},"noStreamViewTextColor":{"default":"","en-us":"The color of shown text content if no stream","zh-tw":"如果沒有串流,則顯示的文字顏色","ja-jp":"ストリームがない場合に表示されるテキストの色"}},"defaultBrickProps":{"mirror":false,"resizeMode":"contain","noStreamViewText":"no stream","noStreamViewTextSize":44,"noStreamViewTextColor":"#000"},"propertyControls":{"noStreamViewTextSize":{"kind":"unit","min":1},"noStreamViewTextColor":{"kind":"color","placeholder":"#000"}},"propertyControlGroups":{"noStreamView":{"name":"No Stream View Cases","type":"prefix","content":"noStreamView"}},"propertyControlGroupDescriptions":{}}')},8907:(e,t,a)=>{a.d(t,{A_:()=>p,D$:()=>E,Ii:()=>u,J:()=>d,Kc:()=>l,MB:()=>_,WU:()=>s,dt:()=>y,kd:()=>T,o5:()=>f,ue:()=>h});var n=a(9212),r=a(1777),i=a(2904),o=a(4214);function s(e){return{__ref:String(e)}}function p(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function l(e){return(0,r.U)(e)&&"Document"===e.kind&&Array.isArray(e.definitions)}function d(e,t,a,r){if(function(e){return"IntValue"===e.kind}(a)||function(e){return"FloatValue"===e.kind}(a))e[t.value]=Number(a.value);else if(function(e){return"BooleanValue"===e.kind}(a)||function(e){return"StringValue"===e.kind}(a))e[t.value]=a.value;else if(function(e){return"ObjectValue"===e.kind}(a)){var i={};a.fields.map(function(e){return d(i,e.name,e.value,r)}),e[t.value]=i}else if(function(e){return"Variable"===e.kind}(a)){var o=(r||{})[a.name.value];e[t.value]=o}else if(function(e){return"ListValue"===e.kind}(a))e[t.value]=a.values.map(function(e){var a={};return d(a,t,e,r),a[t.value]});else if(function(e){return"EnumValue"===e.kind}(a))e[t.value]=a.value;else{if(!function(e){return"NullValue"===e.kind}(a))throw(0,n.newInvariantError)(96,t.value,a.kind);e[t.value]=null}}function u(e,t){var a=null;e.directives&&(a={},e.directives.forEach(function(e){a[e.name.value]={},e.arguments&&e.arguments.forEach(function(n){var r=n.name,i=n.value;return d(a[e.name.value],r,i,t)})}));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach(function(e){var a=e.name,r=e.value;return d(n,a,r,t)})),f(e.name.value,n,a)}var c=["connection","include","skip","client","rest","export","nonreactive"],m=o.M,f=Object.assign(function(e,t,a){if(t&&a&&a.connection&&a.connection.key){if(a.connection.filter&&a.connection.filter.length>0){var n=a.connection.filter?a.connection.filter:[];n.sort();var r={};return n.forEach(function(e){r[e]=t[e]}),"".concat(a.connection.key,"(").concat(m(r),")")}return a.connection.key}var i=e;if(t){var o=m(t);i+="(".concat(o,")")}return a&&Object.keys(a).forEach(function(e){-1===c.indexOf(e)&&(a[e]&&Object.keys(a[e]).length?i+="@".concat(e,"(").concat(m(a[e]),")"):i+="@".concat(e))}),i},{setStringify:function(e){var t=m;return m=e,t}});function _(e,t){if(e.arguments&&e.arguments.length){var a={};return e.arguments.forEach(function(e){var n=e.name,r=e.value;return d(a,n,r,t)}),a}return null}function h(e){return e.alias?e.alias.value:e.name.value}function E(e,t,a){for(var n,r=0,o=t.selections;r<o.length;r++){if(y(l=o[r])){if("__typename"===l.name.value)return e[h(l)]}else n?n.push(l):n=[l]}if("string"==typeof e.__typename)return e.__typename;if(n)for(var s=0,p=n;s<p.length;s++){var l=p[s],d=E(e,(0,i.HQ)(l,a).selectionSet,a);if("string"==typeof d)return d}}function y(e){return"Field"===e.kind}function T(e){return"InlineFragment"===e.kind}},8925:(e,t)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(a||(t.DiscrError=a={}))},8931:(e,t,a)=>{var n=a(3501);e.exports=function(e,t,a){var r=e.length;return a=void 0===a?r:a,!t&&a>=r?e:n(e,t,a)}},8942:(e,t,a)=>{var n=a(4967),r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")();e.exports=i},9003:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=a(383),r=a(4758),i=a(9409),o=a(7898),s=a(458);var p;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(p||(t.DataType=p={})),t.getSchemaTypes=function(e){const t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=l,t.coerceAndCheckDataType=function(e,t){const{gen:a,data:n,opts:i}=e,s=function(e,t){return t?e.filter(e=>d.has(e)||"array"===t&&"array"===e):[]}(t,i.coerceTypes),l=t.length>0&&!(0===s.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(l){const r=c(t,n,i.strictNumbers,p.Wrong);a.if(r,()=>{s.length?function(e,t,a){const{gen:n,data:r,opts:i}=e,s=n.let("dataType",o._`typeof ${r}`),p=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${s} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>n.assign(r,o._`${r}[0]`).assign(s,o._`typeof ${r}`).if(c(t,r,i.strictNumbers),()=>n.assign(p,r)));n.if(o._`${p} !== undefined`);for(const e of a)(d.has(e)||"array"===e&&"array"===i.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void n.elseIf(o._`${s} == "number" || ${s} == "boolean"`).assign(p,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(p,o._`""`);case"number":return void n.elseIf(o._`${s} == "boolean" || ${r} === null
|
|
651
|
+
`},8323:(e,t,a)=>{const n=a(4876),r=a(3246),i={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},o=Symbol("failure");function s(e){return n.ucs2.decode(e).length}function p(e,t){const a=e[t];return isNaN(a)?void 0:String.fromCodePoint(a)}function l(e){return e>=48&&e<=57}function d(e){return e>=65&&e<=90||e>=97&&e<=122}function u(e){return l(e)||e>=65&&e<=70||e>=97&&e<=102}function c(e){return"."===e||"%2e"===e.toLowerCase()}function m(e){return 2===e.length&&d(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function f(e){return void 0!==i[e]}function _(e){return f(e.scheme)}function h(e){let t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),"%"+t}function E(e){return e<=31||e>126}const y=new Set([32,34,35,60,62,63,96,123,125]);function T(e){return E(e)||y.has(e)}const R=new Set([47,58,59,61,64,91,92,93,94,124]);function g(e){return T(e)||R.has(e)}function v(e,t){const a=String.fromCodePoint(e);return t(e)?function(e){const t=new Buffer(e);let a="";for(let e=0;e<t.length;++e)a+=h(t[e]);return a}(a):a}function O(e){let t=10;if(e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e)return 0;return(10===t?/[^0-9]/:16===t?/[^0-9A-Fa-f]/:/[^0-7]/).test(e)?o:parseInt(e,t)}function N(e,t){if("["===e[0])return"]"!==e[e.length-1]?o:function(e){const t=[0,0,0,0,0,0,0,0];let a=0,r=null,i=0;if(58===(e=n.ucs2.decode(e))[i]){if(58!==e[i+1])return o;i+=2,++a,r=a}for(;i<e.length;){if(8===a)return o;if(58===e[i]){if(null!==r)return o;++i,++a,r=a;continue}let n=0,s=0;for(;s<4&&u(e[i]);)n=16*n+parseInt(p(e,i),16),++i,++s;if(46===e[i]){if(0===s)return o;if(i-=s,a>6)return o;let n=0;for(;void 0!==e[i];){let r=null;if(n>0){if(!(46===e[i]&&n<4))return o;++i}if(!l(e[i]))return o;for(;l(e[i]);){const t=parseInt(p(e,i));if(null===r)r=t;else{if(0===r)return o;r=10*r+t}if(r>255)return o;++i}t[a]=256*t[a]+r,++n,2!==n&&4!==n||++a}if(4!==n)return o;break}if(58===e[i]){if(++i,void 0===e[i])return o}else if(void 0!==e[i])return o;t[a]=n,++a}if(null!==r){let e=a-r;for(a=7;0!==a&&e>0;){const n=t[r+e-1];t[r+e-1]=t[a],t[a]=n,--a,--e}}else if(null===r&&8!==a)return o;return t}(e.substring(1,e.length-1));if(!t)return function(e){if(function(e){return-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/)}(e))return o;let t="";const a=n.ucs2.decode(e);for(let e=0;e<a.length;++e)t+=v(a[e],E);return t}(e);const a=function(e){const t=new Buffer(e),a=[];for(let e=0;e<t.length;++e)37!==t[e]?a.push(t[e]):37===t[e]&&u(t[e+1])&&u(t[e+2])?(a.push(parseInt(t.slice(e+1,e+3).toString(),16)),e+=2):a.push(t[e]);return new Buffer(a).toString()}(e),i=r.toASCII(a,!1,r.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===i)return o;if(function(e){return-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/)}(i))return o;const s=function(e){const t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return e;const a=[];for(const n of t){if(""===n)return e;const t=O(n);if(t===o)return e;a.push(t)}for(let e=0;e<a.length-1;++e)if(a[e]>255)return o;if(a[a.length-1]>=Math.pow(256,5-a.length))return o;let n=a.pop(),r=0;for(const e of a)n+=e*Math.pow(256,3-r),++r;return n}(i);return"number"==typeof s||s===o?s:i}function b(e){return"number"==typeof e?function(e){let t="",a=e;for(let e=1;e<=4;++e)t=String(a%256)+t,4!==e&&(t="."+t),a=Math.floor(a/256);return t}(e):e instanceof Array?"["+function(e){let t="";const a=function(e){let t=null,a=1,n=null,r=0;for(let i=0;i<e.length;++i)0!==e[i]?(r>a&&(t=n,a=r),n=null,r=0):(null===n&&(n=i),++r);return r>a&&(t=n,a=r),{idx:t,len:a}}(e).idx;let n=!1;for(let r=0;r<=7;++r)if(!n||0!==e[r]){if(n&&(n=!1),a===r){t+=0===r?"::":":",n=!0;continue}t+=e[r].toString(16),7!==r&&(t+=":")}return t}(e)+"]":e}function A(e){const t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&function(e){return/^[A-Za-z]:$/.test(e)}(t[0])||t.pop())}function S(e){return""!==e.username||""!==e.password}function I(e,t,a,r,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=a||"utf-8",this.stateOverride=i,this.url=r,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const e=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);e!==this.input&&(this.parseError=!0),this.input=e}const s=function(e){return e.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=n.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const e=this.input[this.pointer],t=isNaN(e)?void 0:String.fromCodePoint(e),a=this["parse "+this.state](e,t);if(!a)break;if(a===o){this.failure=!0;break}}}I.prototype["parse scheme start"]=function(e,t){if(d(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,o;this.state="no scheme",--this.pointer}return!0},I.prototype["parse scheme"]=function(e,t){if(function(e){return d(e)||l(e)}(e)||43===e||45===e||46===e)this.buffer+=t.toLowerCase();else if(58===e){if(this.stateOverride){if(_(this.url)&&!f(this.buffer))return!1;if(!_(this.url)&&f(this.buffer))return!1;if((S(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):_(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":_(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,o;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},I.prototype["parse no scheme"]=function(e){return null===this.base||this.base.cannotBeABaseURL&&35!==e?o:(this.base.cannotBeABaseURL&&35===e?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},I.prototype["parse special relative or authority"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},I.prototype["parse path or authority"]=function(e){return 47===e?this.state="authority":(this.state="path",--this.pointer),!0},I.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===e?this.state="relative slash":63===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):_(this.url)&&92===e?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},I.prototype["parse relative slash"]=function(e){return!_(this.url)||47!==e&&92!==e?47===e?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===e&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},I.prototype["parse special authority slashes"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},I.prototype["parse special authority ignore slashes"]=function(e){return 47!==e&&92!==e?(this.state="authority",--this.pointer):this.parseError=!0,!0},I.prototype["parse authority"]=function(e,t){if(64===e){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const e=s(this.buffer);for(let t=0;t<e;++t){const e=this.buffer.codePointAt(t);if(58===e&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const a=v(e,g);this.passwordTokenSeenFlag?this.url.password+=a:this.url.username+=a}this.buffer=""}else if(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e){if(this.atFlag&&""===this.buffer)return this.parseError=!0,o;this.pointer-=s(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},I.prototype["parse hostname"]=I.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==e||this.arrFlag)if(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e){if(--this.pointer,_(this.url)&&""===this.buffer)return this.parseError=!0,o;if(this.stateOverride&&""===this.buffer&&(S(this.url)||null!==this.url.port))return this.parseError=!0,!1;const e=N(this.buffer,_(this.url));if(e===o)return o;if(this.url.host=e,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===e?this.arrFlag=!0:93===e&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,o;const e=N(this.buffer,_(this.url));if(e===o)return o;if(this.url.host=e,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},I.prototype["parse port"]=function(e,t){if(l(e))this.buffer+=t;else{if(!(isNaN(e)||47===e||63===e||35===e||_(this.url)&&92===e||this.stateOverride))return this.parseError=!0,o;if(""!==this.buffer){const e=parseInt(this.buffer);if(e>Math.pow(2,16)-1)return this.parseError=!0,o;this.url.port=e===(a=this.url.scheme,i[a])?null:e,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};const w=new Set([47,92,63,35]);I.prototype["parse file"]=function(e){var t,a;return this.url.scheme="file",47===e||92===e?(92===e&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(t=e,a=this.input[this.pointer+1],!d(t)||58!==a&&124!==a)||this.input.length-this.pointer-1>=2&&!w.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),A(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},I.prototype["parse file slash"]=function(e){return 47===e||92===e?(92===e&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(!function(e){return 2===e.length&&d(e.codePointAt(0))&&":"===e[1]}(this.base.path[0])?this.url.host=this.base.host:this.url.path.push(this.base.path[0])),this.state="path",--this.pointer),!0},I.prototype["parse file host"]=function(e,t){if(isNaN(e)||47===e||92===e||63===e||35===e)if(--this.pointer,!this.stateOverride&&m(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let e=N(this.buffer,_(this.url));if(e===o)return o;if("localhost"===e&&(e=""),this.url.host=e,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},I.prototype["parse path start"]=function(e){return _(this.url)?(92===e&&(this.parseError=!0),this.state="path",47!==e&&92!==e&&--this.pointer):this.stateOverride||63!==e?this.stateOverride||35!==e?void 0!==e&&(this.state="path",47!==e&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},I.prototype["parse path"]=function(e){if(isNaN(e)||47===e||_(this.url)&&92===e||!this.stateOverride&&(63===e||35===e)){if(_(this.url)&&92===e&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(A(this.url),47===e||_(this.url)&&92===e||this.url.path.push("")):!c(this.buffer)||47===e||_(this.url)&&92===e?c(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&m(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===e||63===e||35===e))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===e&&(this.url.query="",this.state="query"),35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=v(e,T);var t;return!0},I.prototype["parse cannot-be-a-base-URL path"]=function(e){return 63===e?(this.url.query="",this.state="query"):35===e?(this.url.fragment="",this.state="fragment"):(isNaN(e)||37===e||(this.parseError=!0),37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+v(e,E))),!0},I.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&35===e){_(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const t=new Buffer(this.buffer);for(let e=0;e<t.length;++e)t[e]<33||t[e]>126||34===t[e]||35===t[e]||60===t[e]||62===t[e]?this.url.query+=h(t[e]):this.url.query+=String.fromCodePoint(t[e]);this.buffer="",35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t;return!0},I.prototype["parse fragment"]=function(e){return isNaN(e)||(0===e?this.parseError=!0:(37!==e||u(this.input[this.pointer+1])&&u(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=v(e,E))),!0},e.exports.serializeURL=function(e,t){let a=e.scheme+":";if(null!==e.host?(a+="//",""===e.username&&""===e.password||(a+=e.username,""!==e.password&&(a+=":"+e.password),a+="@"),a+=b(e.host),null!==e.port&&(a+=":"+e.port)):null===e.host&&"file"===e.scheme&&(a+="//"),e.cannotBeABaseURL)a+=e.path[0];else for(const t of e.path)a+="/"+t;return null!==e.query&&(a+="?"+e.query),t||null===e.fragment||(a+="#"+e.fragment),a},e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(t.path[0]))}catch(e){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(e){let t=e.scheme+"://";return t+=b(e.host),null!==e.port&&(t+=":"+e.port),t}({scheme:t.scheme,host:t.host,port:t.port});case"file":return"file://";default:return"null"}},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});const a=new I(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return a.failure?"failure":a.url},e.exports.setTheUsername=function(e,t){e.username="";const a=n.ucs2.decode(t);for(let t=0;t<a.length;++t)e.username+=v(a[t],g)},e.exports.setThePassword=function(e,t){e.password="";const a=n.ucs2.decode(t);for(let t=0;t<a.length;++t)e.password+=v(a[t],g)},e.exports.serializeHost=b,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e.cannotBeABaseURL||"file"===e.scheme},e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,a){return void 0===a&&(a={}),e.exports.basicURLParse(t,{baseURL:a.baseURL,encodingOverride:a.encodingOverride})}},8338:(e,t,a)=>{a.d(t,{l:()=>S,m:()=>w});var n=a(5608),r=a(9212),i=a(8907),o=a(6563),s=a(1777),p=a(5207),l=a(3767),d=a(777),u=a(671),c=Object.create(null);function m(e){var t=JSON.stringify(e);return c[t]||(c[t]=Object.create(null))}function f(e){var t=m(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,a){var n=function(e,t){return a.readField(t,e)},i=a.keyObject=h(e,function(e){var i=T(a.storeObject,e,n);return void 0===i&&t!==a.storeObject&&p.$3.call(t,e[0])&&(i=T(t,e,y)),(0,r.invariant)(void 0!==i,5,e.join("."),t),i});return"".concat(a.typename,":").concat(JSON.stringify(i))})}function _(e){var t=m(e);return t.keyArgsFn||(t.keyArgsFn=function(t,a){var n=a.field,r=a.variables,o=a.fieldName,s=h(e,function(e){var a=e[0],o=a.charAt(0);if("@"!==o)if("$"!==o){if(t)return T(t,e)}else{var s=a.slice(1);if(r&&p.$3.call(r,s)){var d=e.slice(0);return d[0]=s,T(r,d)}}else if(n&&(0,l.E)(n.directives)){var u=a.slice(1),c=n.directives.find(function(e){return e.name.value===u}),m=c&&(0,i.MB)(c,r);return m&&T(m,e.slice(1))}}),d=JSON.stringify(s);return(t||"{}"!==d)&&(o+=":"+d),o})}function h(e,t){var a=new u.ZI;return E(e).reduce(function(e,n){var r,i=t(n);if(void 0!==i){for(var o=n.length-1;o>=0;--o)(r={})[n[o]]=i,i=r;e=a.merge(e,i)}return e},Object.create(null))}function E(e){var t=m(e);if(!t.paths){var a=t.paths=[],n=[];e.forEach(function(t,r){(0,l.c)(t)?(E(t).forEach(function(e){return a.push(n.concat(e))}),n.length=0):(n.push(t),(0,l.c)(e[r+1])||(a.push(n.slice(0)),n.length=0))})}return t.paths}function y(e,t){return e[t]}function T(e,t,a){return a=a||y,R(t.reduce(function e(t,n){return(0,l.c)(t)?t.map(function(t){return e(t,n)}):t&&a(t,n)},e))}function R(e){return(0,s.U)(e)?(0,l.c)(e)?e.map(R):h(Object.keys(e).sort(),function(t){return T(e,t)}):e}var g=a(7150);function v(e){return void 0!==e.args?e.args:e.field?(0,i.MB)(e.field,e.variables):null}var O=function(){},N=function(e,t){return t.fieldName},b=function(e,t,a){return(0,a.mergeObjects)(e,t)},A=function(e,t){return t},S=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=(0,n.__assign)({dataIdFromObject:p.or},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var a,r=this,i=t&&(t.typename||(null===(a=t.storeObject)||void 0===a?void 0:a.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var o,s=t&&t.storeObject||e,p=(0,n.__assign)((0,n.__assign)({},t),{typename:i,storeObject:s,readField:t&&t.readField||function(){var e=w(arguments,s);return r.readField(e,{store:r.cache.data,variables:e.variables})}}),d=i&&this.getTypePolicy(i),u=d&&d.keyFn||this.config.dataIdFromObject;return g.yV.withValue(!0,function(){for(;u;){var t=u((0,n.__assign)((0,n.__assign)({},e),s),p);if(!(0,l.c)(t)){o=t;break}u=f(t)}}),o=o?String(o):void 0,p.keyObject?[o,p.keyObject]:[o]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(a){var r=e[a],i=r.queryType,o=r.mutationType,s=r.subscriptionType,l=(0,n.__rest)(r,["queryType","mutationType","subscriptionType"]);i&&t.setRootTypename("Query",a),o&&t.setRootTypename("Mutation",a),s&&t.setRootTypename("Subscription",a),p.$3.call(t.toBeAdded,a)?t.toBeAdded[a].push(l):t.toBeAdded[a]=[l]})},e.prototype.updateTypePolicy=function(e,t){var a=this,n=this.getTypePolicy(e),r=t.keyFields,i=t.fields;function o(e,t){e.merge="function"==typeof t?t:!0===t?b:!1===t?A:e.merge}o(n,t.merge),n.keyFn=!1===r?O:(0,l.c)(r)?f(r):"function"==typeof r?r:n.keyFn,i&&Object.keys(i).forEach(function(t){var n=a.getFieldPolicy(e,t,!0),r=i[t];if("function"==typeof r)n.read=r;else{var s=r.keyArgs,p=r.read,d=r.merge;n.keyFn=!1===s?N:(0,l.c)(s)?_(s):"function"==typeof s?s:n.keyFn,"function"==typeof p&&(n.read=p),o(n,d)}n.read&&n.merge&&(n.keyFn=n.keyFn||N)})},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var a="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[a];t!==n&&((0,r.invariant)(!n||n===e,6,e),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=a,this.rootTypenamesById[a]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(a){t.getSupertypeSet(a,!0),e[a].forEach(function(e){t.getSupertypeSet(e,!0).add(a);var n=e.match(p.gk);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))})})},e.prototype.getTypePolicy=function(e){var t=this;if(!p.$3.call(this.typePolicies,e)){var a=this.typePolicies[e]=Object.create(null);a.fields=Object.create(null);var r=this.supertypeMap.get(e);!r&&this.fuzzySubtypes.size&&(r=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(a,n){if(a.test(e)){var i=t.supertypeMap.get(n);i&&i.forEach(function(e){return r.add(e)})}})),r&&r.size&&r.forEach(function(e){var r=t.getTypePolicy(e),i=r.fields,o=(0,n.__rest)(r,["fields"]);Object.assign(a,o),Object.assign(a.fields,i)})}var i=this.toBeAdded[e];return i&&i.length&&i.splice(0).forEach(function(a){t.updateTypePolicy(e,a)}),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,a){if(e){var n=this.getTypePolicy(e).fields;return n[t]||a&&(n[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var a=this.supertypeMap.get(e);return!a&&t&&this.supertypeMap.set(e,a=new Set),a},e.prototype.fragmentMatches=function(e,t,a,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),l=[s],d=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&l.indexOf(t)<0&&l.push(t)},u=!(!a||!this.fuzzySubtypes.size),c=!1,m=0;m<l.length;++m){var f=l[m];if(f.has(o))return s.has(o)||(c&&!1!==globalThis.__DEV__&&r.invariant.warn(7,t,o),s.add(o)),!0;f.forEach(d),u&&m===l.length-1&&(0,p.T9)(e.selectionSet,a,n)&&(u=!1,c=!0,this.fuzzySubtypes.forEach(function(e,a){var n=t.match(e);n&&n[0]===t&&d(a)}))}return!1},e.prototype.hasKeyArgs=function(e,t){var a=this.getFieldPolicy(e,t,!1);return!(!a||!a.keyFn)},e.prototype.getStoreFieldName=function(e){var t,a=e.typename,n=e.fieldName,r=this.getFieldPolicy(a,n,!1),o=r&&r.keyFn;if(o&&a)for(var s={typename:a,fieldName:n,field:e.field||null,variables:e.variables},d=v(e);o;){var u=o(d,s);if(!(0,l.c)(u)){t=u||n;break}o=_(u)}return void 0===t&&(t=e.field?(0,i.Ii)(e.field,e.variables):(0,i.o5)(n,v(e))),!1===t?n:n===(0,p.iJ)(t)?t:n+":"+t},e.prototype.readField=function(e,t){var a=e.from;if(a&&(e.field||e.fieldName)){if(void 0===e.typename){var n=t.store.getFieldValue(a,"__typename");n&&(e.typename=n)}var r=this.getStoreFieldName(e),o=(0,p.iJ)(r),s=t.store.getFieldValue(a,r),l=this.getFieldPolicy(e.typename,o,!1),u=l&&l.read;if(u){var c=I(this,a,e,t,t.store.getStorage((0,i.A_)(a)?a.__ref:a,r));return d.bl.withValue(this.cache,u,[s,c])}return s}},e.prototype.getReadFunction=function(e,t){var a=this.getFieldPolicy(e,t,!1);return a&&a.read},e.prototype.getMergeFunction=function(e,t,a){var n=this.getFieldPolicy(e,t,!1),r=n&&n.merge;return!r&&a&&(r=(n=this.getTypePolicy(a))&&n.merge),r},e.prototype.runMergeFunction=function(e,t,a,n,r){var i=a.field,o=a.typename,s=a.merge;return s===b?C(n.store)(e,t):s===A?t:(n.overwrite&&(e=void 0),s(e,t,I(this,void 0,{typename:o,fieldName:i.name.value,field:i,variables:n.variables},n,r||Object.create(null))))},e}();function I(e,t,a,n,r){var o=e.getStoreFieldName(a),s=(0,p.iJ)(o),l=a.variables||n.variables,d=n.store,u=d.toReference,c=d.canRead;return{args:v(a),field:a.field||null,fieldName:s,storeFieldName:o,variables:l,isReference:i.A_,toReference:u,storage:r,cache:e.cache,canRead:c,readField:function(){return e.readField(w(arguments,t,l),n)},mergeObjects:C(n.store)}}function w(e,t,a){var i,s=e[0],l=e[1],d=e.length;return"string"==typeof s?i={fieldName:s,from:d>1?l:t}:(i=(0,n.__assign)({},s),p.$3.call(i,"from")||(i.from=t)),!1!==globalThis.__DEV__&&void 0===i.from&&!1!==globalThis.__DEV__&&r.invariant.warn(8,(0,o.p)(Array.from(e))),void 0===i.variables&&(i.variables=a),i}function C(e){return function(t,a){if((0,l.c)(t)||(0,l.c)(a))throw(0,r.newInvariantError)(9);if((0,s.U)(t)&&(0,s.U)(a)){var o=e.getFieldValue(t,"__typename"),d=e.getFieldValue(a,"__typename");if(o&&d&&o!==d)return a;if((0,i.A_)(t)&&(0,p.d1)(a))return e.merge(t.__ref,a),t;if((0,p.d1)(t)&&(0,i.A_)(a))return e.merge(t,a.__ref),a;if((0,p.d1)(t)&&(0,p.d1)(a))return(0,n.__assign)((0,n.__assign)({},t),a)}return a}}},8354:(e,t,a)=>{a.d(t,{m:()=>p});var n=a(9212),r=a(2904),i=a(3777),o=a(5186),s=a(7150);function p(e,t,a){var p;if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,s.Ki)(),e;var l=(0,i.Vu)(t);return(0,n.invariant)(l,51),null==e?e:(0,o.S)(e,l.selectionSet,{operationType:l.operation,operationName:null===(p=l.name)||void 0===p?void 0:p.value,fragmentMap:(0,r.JG)((0,i.zK)(t)),cache:a,mutableTargets:new s.jq,knownChanged:new s.xm})}},8414:(e,t,a)=>{a.d(t,{A:()=>r});var n=a(3777);function r(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?(0,n.n4)(t.query)||void 0:""),t}},8417:e=>{e.exports=JSON.parse('{"name":"GeneratorMediaFlow","brickDescription":{"default":"","en-us":"Fetch box\'s file list from Media Flow","zh-tw":"從 Media Flow 取得投遞箱檔案列表","ja-jp":"Media Flow から配信ボックスのファイルリストを取得"},"brickDisplayName":"Media Flow","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"photo-film"},"brickMeta":{"scriptMember":true},"propTypes":{"boxId":{"type":"string"},"accessToken":{"type":"string"},"passcode":{"type":"string"},"includeTypes":{"type":"arrayOf","content":{"type":"oneOf","content":["IMAGE","VIDEO","AUDIO","FILE"],"forcePropertyBank":false},"forcePropertyBank":false},"fetchPolicy":{"type":"oneOf","content":["cache-first","network-and-cache","network-only"],"forcePropertyBank":false},"subscribeBoxChange":{"type":"bool"},"saveToStorage":{"type":"bool"},"saveToStorageDownloadMode":{"type":"oneOf","content":["sequence","concurrent"],"forcePropertyBank":false},"loadSizeLimit":{"type":"string"},"allowLoadSizeLimitExceed":{"type":"bool"},"source":{"type":"oneOf","content":["original","auto","converted","video-thumbnail-original","use-source-versions"],"forcePropertyBank":false},"sourceVersionAlternatives":{"type":"arrayOf","content":{"type":"number"},"forcePropertyBank":false},"allowlist":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"blocklist":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false}},"brickPropDescriptions":{"boxId":{"default":"","en-us":"The box id of Media Flow","zh-tw":"Media Flow 的投遞箱 id","ja-jp":"Media Flow の配信ボックス ID"},"accessToken":{"default":"","en-us":"Authorize accessToken, use `passcode` if `accessToken` is empty","zh-tw":"驗證用 Access token, 如果為空則使用 `passcode`","ja-jp":"認証用アクセストークン、 空の場合は `passcode` を使用"},"passcode":{"default":"","en-us":"Authorize passcode","zh-tw":"驗證用 Passcode","ja-jp":"認証用パスコード"},"includeTypes":{"default":"","en-us":"Include File Types","zh-tw":"包含的檔案類型","ja-jp":"含めるファイルタイプ"},"fetchPolicy":{"default":"","en-us":"Determine the cache behavior \\n \\n cache-first: Cache first if existing, then fetch from network \\n network-and-cache: Fetch from network, then save cache \\n network-only: Fetch from network only","zh-tw":"決定 cache 的行為 \\n \\n cache-first: 如果有 cache 則優先使用,然後從網路取得 \\n network-and-cache: 從網路取得,然後儲存 cache \\n network-only: 只從網路取得","ja-jp":"キャッシュの動作を決定 \\n \\n cache-first: 既存のキャッシュを優先し、その後ネットワークから取得 \\n network-and-cache: ネットワークから取得し、その後キャッシュに保存 \\n network-only: ネットワークからのみ取得"},"subscribeBoxChange":{"default":"","en-us":"Subscribe box change to refresh file list (file deleted / new file uploaded)","zh-tw":"訂閱投遞箱變更,以更新檔案列表 (檔案刪除 / 新增檔案)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"saveToStorage":{"default":"","en-us":"Save files into local file storage","zh-tw":"儲存檔案到本地儲存空間","ja-jp":"ファイルをローカルストレージに保存"},"saveToStorageDownloadMode":{"default":"","en-us":"Concurrent download files or sequence for saveToStorage","zh-tw":"平行下載檔案或依序下載檔案,用於 saveToStorage","ja-jp":"並行ダウンロードまたは順次ダウンロード(saveToStorage 用)"},"loadSizeLimit":{"default":"","en-us":"Limit the load size (* GB, * MB, * KB)","zh-tw":"限制讀取大小 (* GB, * MB, * KB)","ja-jp":"読み込みサイズの制限 (* GB, * MB, * KB)"},"allowLoadSizeLimitExceed":{"default":"","en-us":"Allow Load size limit exceed, just call event","zh-tw":"允許超過讀取大小限制,僅呼叫事件","ja-jp":"読み込みサイズ制限の超過を許可し、イベントのみを呼び出す"},"source":{"default":"","en-us":"Select download source","zh-tw":"選擇下載來源","ja-jp":"ダウンロードソースを選択"},"sourceVersionAlternatives":{"default":"","en-us":"Select download source with image version (use width, e.g. [250, 360])","zh-tw":"選擇下載來源,並指定圖片版本 (使用寬度,例如 [250, 360])","ja-jp":"画像バージョンを指定してダウンロードソースを選択(幅を使用、例:[250, 360])"},"allowlist":{"default":"","en-us":"Allowlist patterns to filter media files (supports regex or plain text)","zh-tw":"允許名單過濾模式 (支援正則表達式或純文字)","ja-jp":"メディアファイルをフィルタリングする許可リストパターン(正規表現またはプレーンテキストをサポート)"},"blocklist":{"default":"","en-us":"Blocklist patterns to filter media files (supports regex or plain text)","zh-tw":"拒絕名單過濾模式 (支援正則表達式或純文字)","ja-jp":"メディアファイルをフィルタリングするブロックリストパターン(正規表現またはプレーンテキストをサポート)"}},"propertyControls":{"boxId":{"required":true},"accessToken":{"required":{"unlessSome":["passcode"]}},"passcode":{"required":{"unlessSome":["accessToken"]}},"loadSizeLimit":{"placeholder":"GB / MB / KB"},"saveToStorageDownloadMode":{"displayName":"Download Mode","normalizeDisplayName":false,"oneOfEmptyOption":false},"source":{"displayName":"Source Size"},"fetchPolicy":{"oneOfEmptyOption":false}},"defaultBrickProps":{"includeTypes":["IMAGE","VIDEO","AUDIO","FILE"],"fetchPolicy":"cache-first","subscribeBoxChange":false,"saveToStorageDownloadMode":"sequence","loadSizeLimit":"","allowLoadSizeLimitExceed":true,"source":"original","sourceVersionAlternatives":[]},"eventTypes":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":"GENERATOR_MEDIA_FLOW_FETCH_ERROR","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR","GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR","GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED":"GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED","GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED":"GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED"},"brickEventDescriptions":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":{"default":"","en-us":"Event of media box fetch error","zh-tw":"Event of media box fetch error","ja-jp":"メディアボックスの取得エラー"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT":{"default":"","en-us":"Event of subscribe box change connected (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change connected (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":{"default":"","en-us":"Event of subscribe box change error (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change error (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":{"default":"","en-us":"Event of subscribe box change connection error (If set `Subscribe Box Change`)","zh-tw":"Event of subscribe box change connection error (If set `Subscribe Box Change`)","ja-jp":"ボックスの変更を購読してファイルリストを更新(ファイル削除 / 新ファイルアップロード)"},"GENERATOR_MEDIA_FLOW_SAVE_STORAGE_COMPLETED":{"default":"","en-us":"Event of file sync completed for used `saveToStorage`","zh-tw":"當使用 `saveToStorage`,檔案同步完成觸發的事件","ja-jp":"`saveToStorage` を使用した場合、ファイル同期が完了したときに発生するイベント"},"GENERATOR_MEDIA_FLOW_FILE_SIZE_EXCEED":{"default":"","en-us":"Event when file list size exceed of Load size limit","zh-tw":"Event when file list size exceed of Load size limit","ja-jp":"ファイルリストサイズが読み込みサイズの制限を超えたときに発生するイベント"}},"eventPropertyControls":{"GENERATOR_MEDIA_FLOW_FETCH_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"},"GENERATOR_MEDIA_FLOW_ERROR_IS_FROM_CACHE":{"name":"From Cache","type":"boolean"}}},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"}}},"GENERATOR_MEDIA_FLOW_SUBSCRIBE_BOX_CONNECT_ERROR":{"properties":{"GENERATOR_MEDIA_FLOW_ERROR":{"name":"Error","type":"string"}}}},"outletTypes":{"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS","type":"string"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS","type":"array"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS","type":"array"},"GENERATOR_MEDIA_FLOW_BOX":{"outlet":"GENERATOR_MEDIA_FLOW_BOX","type":"object"},"GENERATOR_MEDIA_FLOW_RESULT":{"outlet":"GENERATOR_MEDIA_FLOW_RESULT","type":"array","displayName":"File List"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS":{"outlet":"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS","type":"array","displayName":"Downloaded File List"}},"brickOutletDescriptions":{"GENERATOR_MEDIA_FLOW_DOWNLOAD_STATUS":{"default":"","en-us":"File sync status","zh-tw":"檔案同步的狀態","ja-jp":"ファイル同期の状態"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_PROGRESS":{"default":"","en-us":"File sync progress","zh-tw":"檔案下載的進度","ja-jp":"ファイルダウンロードの進捗"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_ERRORS":{"default":"","en-us":"File sync download errors","zh-tw":"檔案下載的 errors","ja-jp":"ファイルダウンロードのエラー"},"GENERATOR_MEDIA_FLOW_BOX":{"default":"","en-us":"Media box info","zh-tw":"Media box 資訊","ja-jp":"Media ボックスの情報"},"GENERATOR_MEDIA_FLOW_RESULT":{"default":"","en-us":"Save Media Flow fetch result [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\", // enum(\\"jpg\\", \\"png\\", \\"mp4\\") \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]","zh-tw":"存入 Media Flow 獲取結果 [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\" // enum(\\"jpg\\", \\"png\\", \\"mp4\\"), \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]","ja-jp":"Media Flow の取得結果を保存 [ { \\"url\\": \\"https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1\\" \\"extension\\": \\"\\" // enum(\\"jpg\\", \\"png\\", \\"mp4\\"), \\"id\\": \\"5b431e37efd40c01e8b201d1\\", \\"md5\\": \\"6134ab412351651324\\" // md5 came from media resource api } ]"},"GENERATOR_MEDIA_FLOW_DOWNLOAD_FILE_URLS":{"default":"","en-us":"File sync result [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]","zh-tw":"檔案同步的結果 [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]","ja-jp":"ファイル同期の結果 [ { \\"url\\": \\"/storage/emulated/0/Download/SyncFolder/Asset/1.png\\", \\"mediaType\\": \\"photo\\" // enum(\\"photo\\", \\"video\\"), used to distingiush \\"id\\": \\"\\", } ]"}},"actionTypes":{"GENERATOR_MEDIA_FLOW_FETCH":{"canProvideProperty":false},"GENERATOR_MEDIA_FLOW_RESET_CACHE":{"canProvideProperty":false},"GENERATOR_MEDIA_FLOW_ABORT_FETCH":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MEDIA_FLOW_FETCH":{"default":"","en-us":"Start fetcn Media box file list","zh-tw":"開始獲取 Media box 檔案列表","ja-jp":"Media ボックスのファイルリストを取得する"},"GENERATOR_MEDIA_FLOW_RESET_CACHE":{"default":"","en-us":"Reset cache","zh-tw":"重置 cache","ja-jp":"キャッシュをリセット"},"GENERATOR_MEDIA_FLOW_ABORT_FETCH":{"default":"","en-us":"Abort current fetch request of media list","zh-tw":"終止目前媒體列表的獲取請求","ja-jp":"現在のメディアリストの取得要求を中止"}},"propertyControlGroups":{"storage":{"name":"Storage","type":"group","content":["saveToStorage","saveToStorageDownloadMode","loadSizeLimit","allowLoadSizeLimitExceed","source","sourceVersionAlternatives"]}},"propertyControlGroupDescriptions":{},"scriptMemberFunctionDefs":{"fetch":{"arguments":[],"required":[],"return":{"type":"array"}},"resetCache":{"arguments":[],"required":[],"return":{"type":"void"}},"abortFetch":{"arguments":[],"required":[],"return":{"type":"void"}},"getFileList":{"arguments":[],"required":[],"return":{"type":"array"}},"getBoxInfo":{"arguments":[],"required":[],"return":{"type":"object"}},"getDownloadedFileUrls":{"arguments":[],"required":[],"return":{"type":"array"}}},"scriptMemberFunctionDefDescriptions":{"fetch":{"default":"","en-us":"Fetch media files from Media Flow","zh-tw":"從 Media Flow 取得媒體檔案","ja-jp":"Media Flow からメディアファイルを取得する"},"resetCache":{"default":"","en-us":"Reset Media Flow cache","zh-tw":"重置 Media Flow 快取","ja-jp":"Media Flow キャッシュをリセットする"},"abortFetch":{"default":"","en-us":"Abort current fetch request","zh-tw":"中止目前的取得請求","ja-jp":"現在のフェッチリクエストを中止する"},"getFileList":{"default":"","en-us":"Get current file list","zh-tw":"取得目前的檔案列表","ja-jp":"現在のファイルリストを取得する"},"getBoxInfo":{"default":"","en-us":"Get current box information","zh-tw":"取得目前的投遞箱資訊","ja-jp":"現在のボックス情報を取得する"},"getDownloadedFileUrls":{"default":"","en-us":"Get downloaded file URLs","zh-tw":"取得已下載的檔案網址","ja-jp":"ダウンロードされたファイルのURLを取得する"}}}')},8422:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(4450),r=a(7898),i=a(458),o=a(458),s={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:a,data:s,parentSchema:p,it:l}=e,{opts:d}=l,u=(0,n.allSchemaProperties)(a),c=u.filter(e=>(0,i.alwaysValidSchema)(l,a[e]));if(0===u.length||c.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const m=d.strictSchema&&!d.allowMatchingProperties&&p.properties,f=t.name("valid");!0===l.props||l.props instanceof r.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:_}=l;function h(e){for(const t in m)new RegExp(e).test(t)&&(0,i.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function E(a){t.forIn("key",s,i=>{t.if(r._`${(0,n.usePattern)(e,a)}.test(${i})`,()=>{const n=c.includes(a);n||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:i,dataPropType:o.Type.Str},f),l.opts.unevaluated&&!0!==_?t.assign(r._`${_}[${i}]`,!0):n||l.allErrors||t.if((0,r.not)(f),()=>t.break())})})}!function(){for(const e of u)m&&h(e),l.allErrors?E(e):(t.var(f,!0),E(e),t.if(f))}()}};t.default=s},8472:(e,t,a)=>{a.d(t,{Ey:()=>_,JG:()=>p,MQ:()=>S,Z_:()=>l,qA:()=>f});var n=a(9841),r=a(9762),i=a(7714),o=a(5881),s=a(2039);class p{constructor(e){const t=new r.ou(s.Y.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==s.Y.EOF)do{if(e.next)e=e.next;else{const t=h(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===s.Y.COMMENT);return e}}function l(e){return e===s.Y.BANG||e===s.Y.DOLLAR||e===s.Y.AMP||e===s.Y.PAREN_L||e===s.Y.PAREN_R||e===s.Y.DOT||e===s.Y.SPREAD||e===s.Y.COLON||e===s.Y.EQUALS||e===s.Y.AT||e===s.Y.BRACKET_L||e===s.Y.BRACKET_R||e===s.Y.BRACE_L||e===s.Y.PIPE||e===s.Y.BRACE_R}function d(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function u(e,t){return c(e.charCodeAt(t))&&m(e.charCodeAt(t+1))}function c(e){return e>=55296&&e<=56319}function m(e){return e>=56320&&e<=57343}function f(e,t){const a=e.source.body.codePointAt(t);if(void 0===a)return s.Y.EOF;if(a>=32&&a<=126){const e=String.fromCodePoint(a);return'"'===e?"'\"'":`"${e}"`}return"U+"+a.toString(16).toUpperCase().padStart(4,"0")}function _(e,t,a,n,i){const o=e.line,s=1+a-e.lineStart;return new r.ou(t,a,n,o,s,i)}function h(e,t){const a=e.source.body,r=a.length;let i=t;for(;i<r;){const t=a.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===a.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return E(e,i);case 33:return _(e,s.Y.BANG,i,i+1);case 36:return _(e,s.Y.DOLLAR,i,i+1);case 38:return _(e,s.Y.AMP,i,i+1);case 40:return _(e,s.Y.PAREN_L,i,i+1);case 41:return _(e,s.Y.PAREN_R,i,i+1);case 46:if(46===a.charCodeAt(i+1)&&46===a.charCodeAt(i+2))return _(e,s.Y.SPREAD,i,i+3);break;case 58:return _(e,s.Y.COLON,i,i+1);case 61:return _(e,s.Y.EQUALS,i,i+1);case 64:return _(e,s.Y.AT,i,i+1);case 91:return _(e,s.Y.BRACKET_L,i,i+1);case 93:return _(e,s.Y.BRACKET_R,i,i+1);case 123:return _(e,s.Y.BRACE_L,i,i+1);case 124:return _(e,s.Y.PIPE,i,i+1);case 125:return _(e,s.Y.BRACE_R,i,i+1);case 34:return 34===a.charCodeAt(i+1)&&34===a.charCodeAt(i+2)?A(e,i):R(e,i)}if((0,o.yp)(t)||45===t)return y(e,i,t);if((0,o.un)(t))return S(e,i);throw(0,n.I)(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":d(t)||u(a,i)?`Unexpected character: ${f(e,i)}.`:`Invalid character: ${f(e,i)}.`)}return _(e,s.Y.EOF,r,r)}function E(e,t){const a=e.source.body,n=a.length;let r=t+1;for(;r<n;){const e=a.charCodeAt(r);if(10===e||13===e)break;if(d(e))++r;else{if(!u(a,r))break;r+=2}}return _(e,s.Y.COMMENT,t,r,a.slice(t+1,r))}function y(e,t,a){const r=e.source.body;let i=t,p=a,l=!1;if(45===p&&(p=r.charCodeAt(++i)),48===p){if(p=r.charCodeAt(++i),(0,o.yp)(p))throw(0,n.I)(e.source,i,`Invalid number, unexpected digit after 0: ${f(e,i)}.`)}else i=T(e,i,p),p=r.charCodeAt(i);if(46===p&&(l=!0,p=r.charCodeAt(++i),i=T(e,i,p),p=r.charCodeAt(i)),69!==p&&101!==p||(l=!0,p=r.charCodeAt(++i),43!==p&&45!==p||(p=r.charCodeAt(++i)),i=T(e,i,p),p=r.charCodeAt(i)),46===p||(0,o.un)(p))throw(0,n.I)(e.source,i,`Invalid number, expected digit but got: ${f(e,i)}.`);return _(e,l?s.Y.FLOAT:s.Y.INT,t,i,r.slice(t,i))}function T(e,t,a){if(!(0,o.yp)(a))throw(0,n.I)(e.source,t,`Invalid number, expected digit but got: ${f(e,t)}.`);const r=e.source.body;let i=t+1;for(;(0,o.yp)(r.charCodeAt(i));)++i;return i}function R(e,t){const a=e.source.body,r=a.length;let i=t+1,o=i,p="";for(;i<r;){const r=a.charCodeAt(i);if(34===r)return p+=a.slice(o,i),_(e,s.Y.STRING,t,i+1,p);if(92===r){p+=a.slice(o,i);const t=117===a.charCodeAt(i+1)?123===a.charCodeAt(i+2)?g(e,i):v(e,i):b(e,i);p+=t.value,i+=t.size,o=i;continue}if(10===r||13===r)break;if(d(r))++i;else{if(!u(a,i))throw(0,n.I)(e.source,i,`Invalid character within String: ${f(e,i)}.`);i+=2}}throw(0,n.I)(e.source,i,"Unterminated string.")}function g(e,t){const a=e.source.body;let r=0,i=3;for(;i<12;){const e=a.charCodeAt(t+i++);if(125===e){if(i<5||!d(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|N(e),r<0)break}throw(0,n.I)(e.source,t,`Invalid Unicode escape sequence: "${a.slice(t,t+i)}".`)}function v(e,t){const a=e.source.body,r=O(a,t+2);if(d(r))return{value:String.fromCodePoint(r),size:6};if(c(r)&&92===a.charCodeAt(t+6)&&117===a.charCodeAt(t+7)){const e=O(a,t+8);if(m(e))return{value:String.fromCodePoint(r,e),size:12}}throw(0,n.I)(e.source,t,`Invalid Unicode escape sequence: "${a.slice(t,t+6)}".`)}function O(e,t){return N(e.charCodeAt(t))<<12|N(e.charCodeAt(t+1))<<8|N(e.charCodeAt(t+2))<<4|N(e.charCodeAt(t+3))}function N(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function b(e,t){const a=e.source.body;switch(a.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,n.I)(e.source,t,`Invalid character escape sequence: "${a.slice(t,t+2)}".`)}function A(e,t){const a=e.source.body,r=a.length;let o=e.lineStart,p=t+3,l=p,c="";const m=[];for(;p<r;){const r=a.charCodeAt(p);if(34===r&&34===a.charCodeAt(p+1)&&34===a.charCodeAt(p+2)){c+=a.slice(l,p),m.push(c);const n=_(e,s.Y.BLOCK_STRING,t,p+3,(0,i.OC)(m).join("\n"));return e.line+=m.length-1,e.lineStart=o,n}if(92!==r||34!==a.charCodeAt(p+1)||34!==a.charCodeAt(p+2)||34!==a.charCodeAt(p+3))if(10!==r&&13!==r)if(d(r))++p;else{if(!u(a,p))throw(0,n.I)(e.source,p,`Invalid character within String: ${f(e,p)}.`);p+=2}else c+=a.slice(l,p),m.push(c),13===r&&10===a.charCodeAt(p+1)?p+=2:++p,c="",l=p,o=p;else c+=a.slice(l,p),l=p+1,p+=4}throw(0,n.I)(e.source,p,"Unterminated string.")}function S(e,t){const a=e.source.body,n=a.length;let r=t+1;for(;r<n;){const e=a.charCodeAt(r);if(!(0,o.xr)(e))break;++r}return _(e,s.Y.NAME,t,r,a.slice(t,r))}},8474:e=>{e.exports=t("node:events")},8498:(e,t,a)=>{e.exports=(e=>{var t={};return a.d(t,e),t})({Box:()=>i.Box,Text:()=>i.Text,render:()=>i.render,useApp:()=>i.useApp,useInput:()=>i.useInput})},8525:(e,t,a)=>{var n=a(9893);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},8549:(e,t,a)=>{var n=a(5608),r=a(9891),i=a(7029);t.o=function(e){return new r.ApolloLink(function(t,a){var r=n.__rest(t,[]);return new i.Observable(function(n){var i,o=!1;return Promise.resolve(r).then(function(a){return e(a,t.getContext())}).then(t.setContext).then(function(){o||(i=a(t).subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)}))}).catch(n.error.bind(n)),function(){o=!0,i&&i.unsubscribe()}})})}},8558:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const a="maxItems"===e?"more":"fewer";return n.str`must NOT have ${a} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:a,schemaCode:r}=e,i="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${a}.length ${i} ${r}`)}};t.default=r},8568:(e,t,a)=>{a.d(t,{Ay:()=>L});const n=(e=0)=>t=>`[${t+e}m`,r=(e=0)=>t=>`[${38+e};5;${t}m`,i=(e=0)=>(t,a,n)=>`[${38+e};2;${t};${a};${n}m`,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(o.modifier),Object.keys(o.color),Object.keys(o.bgColor);const s=function(){const e=new Map;for(const[t,a]of Object.entries(o)){for(const[t,n]of Object.entries(a))o[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},a[t]=o[t],e.set(n[0],n[1]);Object.defineProperty(o,t,{value:a,enumerable:!1})}return Object.defineProperty(o,"codes",{value:e,enumerable:!1}),o.color.close="[39m",o.bgColor.close="[49m",o.color.ansi=n(),o.color.ansi256=r(),o.color.ansi16m=i(),o.bgColor.ansi=n(10),o.bgColor.ansi256=r(10),o.bgColor.ansi16m=i(10),Object.defineProperties(o,{rgbToAnsi256:{value:(e,t,a)=>e===t&&t===a?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(a/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[a]=t;3===a.length&&(a=[...a].map(e=>e+e).join(""));const n=Number.parseInt(a,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>o.rgbToAnsi256(...o.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,a,n;if(e>=232)t=(10*(e-232)+8)/255,a=t,n=t;else{const r=(e-=16)%36;t=Math.floor(e/36)/5,a=Math.floor(r/6)/5,n=r%6/5}const r=2*Math.max(t,a,n);if(0===r)return 30;let i=30+(Math.round(n)<<2|Math.round(a)<<1|Math.round(t));return 2===r&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,a)=>o.ansi256ToAnsi(o.rgbToAnsi256(e,t,a)),enumerable:!1},hexToAnsi:{value:e=>o.ansi256ToAnsi(o.hexToAnsi256(e)),enumerable:!1}}),o}(),p=s;var l=a(1708),d=a(8161),u=a(7066);function c(e,t=(globalThis.Deno?globalThis.Deno.args:l.argv)){const a=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(a+e),r=t.indexOf("--");return-1!==n&&(-1===r||n<r)}const{env:m}=l;let f;function _(e,{streamIsTTY:t,sniffFlags:a=!0}={}){const n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(f=n);const r=a?f:n;if(0===r)return 0;if(a){if(c("color=16m")||c("color=full")||c("color=truecolor"))return 3;if(c("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!t&&void 0===r)return 0;const i=r||0;if("dumb"===m.TERM)return i;if("win32"===l.platform){const e=d.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in m)||"codeship"===m.CI_NAME?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("truecolor"===m.COLORTERM)return 3;if("xterm-kitty"===m.TERM)return 3;if("xterm-ghostty"===m.TERM)return 3;if("wezterm"===m.TERM)return 3;if("TERM_PROGRAM"in m){const e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:i}function h(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(_(e,{streamIsTTY:e&&e.isTTY,...t}))}c("no-color")||c("no-colors")||c("color=false")||c("color=never")?f=0:(c("color")||c("colors")||c("color=true")||c("color=always"))&&(f=1);const E={stdout:h({isTTY:u.isatty(1)}),stderr:h({isTTY:u.isatty(2)})};function y(e,t,a){let n=e.indexOf(t);if(-1===n)return e;const r=t.length;let i=0,o="";do{o+=e.slice(i,n)+t+a,i=n+r,n=e.indexOf(t,i)}while(-1!==n);return o+=e.slice(i),o}const{stdout:T,stderr:R}=E,g=Symbol("GENERATOR"),v=Symbol("STYLER"),O=Symbol("IS_EMPTY"),N=["ansi","ansi","ansi256","ansi16m"],b=Object.create(null);const A=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const a=T?T.level:0;e.level=void 0===t.level?a:t.level})(t,e),Object.setPrototypeOf(t,S.prototype),t};function S(e){return A(e)}Object.setPrototypeOf(S.prototype,Function.prototype);for(const[e,t]of Object.entries(p))b[e]={get(){const a=P(this,D(t.open,t.close,this[v]),this[O]);return Object.defineProperty(this,e,{value:a}),a}};b.visible={get(){const e=P(this,this[v],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const I=(e,t,a,...n)=>"rgb"===e?"ansi16m"===t?p[a].ansi16m(...n):"ansi256"===t?p[a].ansi256(p.rgbToAnsi256(...n)):p[a].ansi(p.rgbToAnsi(...n)):"hex"===e?I("rgb",t,a,...p.hexToRgb(...n)):p[a][e](...n),w=["rgb","hex","ansi256"];for(const e of w){b[e]={get(){const{level:t}=this;return function(...a){const n=D(I(e,N[t],"color",...a),p.color.close,this[v]);return P(this,n,this[O])}}};b["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...a){const n=D(I(e,N[t],"bgColor",...a),p.bgColor.close,this[v]);return P(this,n,this[O])}}}}const C=Object.defineProperties(()=>{},{...b,level:{enumerable:!0,get(){return this[g].level},set(e){this[g].level=e}}}),D=(e,t,a)=>{let n,r;return void 0===a?(n=e,r=t):(n=a.openAll+e,r=t+a.closeAll),{open:e,close:t,openAll:n,closeAll:r,parent:a}},P=(e,t,a)=>{const n=(...e)=>j(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,C),n[g]=e,n[v]=t,n[O]=a,n},j=(e,t)=>{if(e.level<=0||!t)return e[O]?"":t;let a=e[v];if(void 0===a)return t;const{openAll:n,closeAll:r}=a;if(t.includes(""))for(;void 0!==a;)t=y(t,a.close,a.open),a=a.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,a,n){let r=0,i="";do{const o="\r"===e[n-1];i+=e.slice(r,o?n-1:n)+t+(o?"\r\n":"\n")+a,r=n+1,n=e.indexOf("\n",r)}while(-1!==n);return i+=e.slice(r),i}(t,r,n,i)),n+t+r};Object.defineProperties(S.prototype,b);const k=S(),L=(S({level:R?R.level:0}),k)},8572:(e,t,a)=>{const n=a(8474).EventEmitter,r=a(1421),i=a(6760),o=a(3024),s=a(1708),{Argument:p,humanReadableArgName:l}=a(1762),{CommanderError:d}=a(3823),{Help:u}=a(9690),{Option:c,DualOptions:m}=a(2088),{suggestSimilar:f}=a(6054);class _ extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>s.stdout.write(e),writeErr:e=>s.stderr.write(e),getOutHelpWidth:()=>s.stdout.isTTY?s.stdout.columns:void 0,getErrHelpWidth:()=>s.stderr.isTTY?s.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,a){let n=t,r=a;"object"==typeof n&&null!==n&&(r=n,n=null),r=r||{};const[,i,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(i);return n&&(s.description(n),s._executableHandler=!0),r.isDefault&&(this._defaultCommandName=s._name),s._hidden=!(!r.noHelp&&!r.hidden),s._executableFile=r.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),n?this:s}createCommand(e){return new _(e)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new p(e,t)}argument(e,t,a,n){const r=this.createArgument(e,t);return"function"==typeof a?r.default(n).argParser(a):r.default(a),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,a,n]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",i=this.createCommand(a);return i.helpOption(!1),n&&i.arguments(n),r&&i.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const a=["preSubcommand","preAction","postAction"];if(!a.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${a.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,a){this._exitCallback&&this._exitCallback(new d(e,t,a)),s.exit(e)}action(e){return this._actionHandler=t=>{const a=this.registeredArguments.length,n=t.slice(0,a);return this._storeOptionsAsProperties?n[a]=this:n[a]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new c(e,t)}_callParseArg(e,t,a,n){try{return e.parseArg(t,a)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const a=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${a}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),a=t(e).find(e=>this._findCommand(e));if(a){const n=t(this._findCommand(a)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),a=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(a,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(a,e.defaultValue,"default");const n=(t,n,r)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(a);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,n):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(a,t,r)};return this.on("option:"+t,t=>{const a=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const a=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,a,"env")}),this}_optionEx(e,t,a,n,r){if("object"==typeof t&&t instanceof c)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,a);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof n)i.default(r).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,a)=>{const n=e.exec(t);return n?n[0]:a},i.default(r).argParser(n)}else i.default(n);return this.addOption(i)}option(e,t,a,n){return this._optionEx({},e,t,a,n)}requiredOption(e,t,a,n){return this._optionEx({mandatory:!0},e,t,a,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,a){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=a,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(a=>{void 0!==a.getOptionValueSource(e)&&(t=a.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){s.versions?.electron&&(t.from="electron");const e=s.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let a;switch(void 0===e&&(e=s.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],a=e.slice(2);break;case"electron":s.defaultApp?(this._scriptPath=e[1],a=e.slice(2)):a=e.slice(1);break;case"user":a=e.slice(0);break;case"eval":a=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",a}parse(e,t){const a=this._prepareUserArgs(e,t);return this._parseCommand([],a),this}async parseAsync(e,t){const a=this._prepareUserArgs(e,t);return await this._parseCommand([],a),this}_executeSubCommand(e,t){t=t.slice();let a=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function p(e,t){const a=i.resolve(e,t);if(o.existsSync(a))return a;if(n.includes(i.extname(t)))return;const r=n.find(e=>o.existsSync(`${a}${e}`));return r?`${a}${r}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let l,u=e._executableFile||`${this._name}-${e._name}`,c=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}c=i.resolve(i.dirname(e),c)}if(c){let t=p(c,u);if(!t&&!e._executableFile&&this._scriptPath){const a=i.basename(this._scriptPath,i.extname(this._scriptPath));a!==this._name&&(t=p(c,`${a}-${e._name}`))}u=t||u}if(a=n.includes(i.extname(u)),"win32"!==s.platform?a?(t.unshift(u),t=h(s.execArgv).concat(t),l=r.spawn(s.argv[0],t,{stdio:"inherit"})):l=r.spawn(u,t,{stdio:"inherit"}):(t.unshift(u),t=h(s.execArgv).concat(t),l=r.spawn(s.execPath,t,{stdio:"inherit"})),!l.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{s.on(e,()=>{!1===l.killed&&null===l.exitCode&&l.kill(e)})})}const m=this._exitCallback;l.on("close",e=>{e=e??1,m?m(new d(e,"commander.executeSubCommandAsync","(close)")):s.exit(e)}),l.on("error",t=>{if("ENOENT"===t.code){const t=c?`searched for local subcommand relative to directory '${c}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",a=`'${u}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(a)}if("EACCES"===t.code)throw new Error(`'${u}' not executable`);if(m){const e=new d(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,m(e)}else s.exit(1)}),this.runningCommand=l}_dispatchSubcommand(e,t,a){const n=this._findCommand(e);let r;return n||this.help({error:!0}),r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!n._executableHandler)return n._parseCommand(t,a);this._executeSubCommand(n,t.concat(a))}),r}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,a)=>{let n=t;if(null!==t&&e.parseArg){const r=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,a,r)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((a,n)=>{let r=a.defaultValue;a.variadic?n<this.args.length?(r=this.args.slice(n),a.parseArg&&(r=r.reduce((t,n)=>e(a,n,t),a.defaultValue))):void 0===r&&(r=[]):n<this.args.length&&(r=this.args[n],a.parseArg&&(r=e(a,r,a.defaultValue))),t[n]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let a=e;const n=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{n.push({hookedCommand:e,callback:t})})}),"postAction"===t&&n.reverse(),n.forEach(e=>{a=this._chainOrCall(a,()=>e.callback(e.hookedCommand,this))}),a}_chainOrCallSubCommandHook(e,t,a){let n=e;return void 0!==this._lifeCycleHooks[a]&&this._lifeCycleHooks[a].forEach(e=>{n=this._chainOrCall(n,()=>e(this,t))}),n}_parseCommand(e,t){const a=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(a.operands),t=a.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(a.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{a.unknown.length>0&&this.unknownOption(a.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let a;return n(),this._processArguments(),a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(r,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{const a=e.find(e=>t.conflictsWith.includes(e.attributeName()));a&&this._conflictingOption(t,a)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],a=[];let n=t;const r=e.slice();function i(e){return e.length>1&&"-"===e[0]}let o=null;for(;r.length;){const e=r.shift();if("--"===e){n===a&&n.push(e),n.push(...r);break}if(!o||i(e)){if(o=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=r.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;r.length>0&&!i(r[0])&&(e=r.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),r.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),a=this._findOption(e.slice(0,t));if(a&&(a.required||a.optional)){this.emit(`option:${a.name()}`,e.slice(t+1));continue}}if(i(e)&&(n=a),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===a.length){if(this._findCommand(e)){t.push(e),r.length>0&&a.push(...r);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),r.length>0&&t.push(...r);break}if(this._defaultCommandName){a.push(e),r.length>0&&a.push(...r);break}}if(this._passThroughOptions){n.push(e),r.length>0&&n.push(...r);break}n.push(e)}else this.emit(`option:${o.name()}`,e)}return{operands:t,unknown:a}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let a=0;a<t;a++){const t=this.options[a].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const a=t||{},n=a.exitCode||1,r=a.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in s.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,s.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new m(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(a=>void 0!==a.implied&&t(a.attributeName())&&e.valueFromOption(this.getOptionValue(a.attributeName()),a)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const a=e=>{const t=e.attributeName(),a=this.getOptionValue(t),n=this.options.find(e=>e.negate&&t===e.attributeName()),r=this.options.find(e=>!e.negate&&t===e.attributeName());return n&&(void 0===n.presetArg&&!1===a||void 0!==n.presetArg&&a===n.presetArg)?n:r||e},n=e=>{const t=a(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let a=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter(e=>e.long).map(e=>e.long);a=a.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=f(e,a)}const a=`error: unknown option '${e}'${t}`;this.error(a,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,a=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${a} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const a=[];this.createHelp().visibleCommands(this).forEach(e=>{a.push(e.name()),e.alias()&&a.push(e.alias())}),t=f(e,a)}const a=`error: unknown command '${e}'${t}`;this.error(a,{code:"commander.unknownCommand"})}version(e,t,a){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",a=a||"output the version number";const n=this.createOption(t,a);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const a=this.parent?._findCommand(e);if(a){const t=[a.name()].concat(a.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>l(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let a;return a=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||a,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const a=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",a)),this.emit("beforeHelp",a);let n=this.helpInformation(a);if(t&&(n=t(n),"string"!=typeof n&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");a.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",a),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",a))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=s.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const a=["beforeAll","before","after","afterAll"];if(!a.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${a.join("', '")}'`);const n=`${e}Help`;return this.on(n,e=>{let a;a="function"==typeof t?t({error:e.error,command:e.command}):t,a&&e.write(`${a}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function h(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,a,n="127.0.0.1",r="9229";return null!==(a=e.match(/^(--inspect(-brk)?)$/))?t=a[1]:null!==(a=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=a[1],/^\d+$/.test(a[3])?r=a[3]:n=a[3]):null!==(a=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=a[1],n=a[3],r=a[4]),t&&"0"!==r?`${t}=${n}:${parseInt(r)+1}`:e})}t.Command=_},8611:e=>{e.exports=t("http")},8662:e=>{e.exports=JSON.parse('{"name":"GeneratorMQTTBroker","brickDescription":{"default":"","en-us":"MQTT Broker server","zh-tw":"MQTT Broker 伺服器","ja-jp":"MQTT Broker サーバー"},"brickDisplayName":"MQTT Broker","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"server"},"propTypes":{"init":{"type":"bool"},"port":{"type":"number","isRequired":true},"retryInterval":{"type":"number"},"keepalive":{"type":"number"},"authenticate":{"type":"bool"},"authTable":{"type":"arrayOf","content":{"type":"shape","content":{"username":{"type":"string"},"password":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false}},"brickPropDescriptions":{"init":{"default":"","en-us":"Start MQTT broker on generator initialized","zh-tw":"Generator 初始化後直接啟動","ja-jp":"ジェネレータの初期化後に MQTT ブローカーを起動"},"port":{"default":"","en-us":"Bind port of MQTT server","zh-tw":"MQTT 伺服器連接埠","ja-jp":"MQTT サーバーのバインドポート"},"retryInterval":{"default":"","en-us":"Retry interval when publish failed","zh-tw":"當發布訊息失敗時的重試間隔","ja-jp":"公開に失敗した場合の再試行間隔"},"keepalive":{"default":"","en-us":"Keep-alive interval","zh-tw":"Keep-alive 間隔","ja-jp":"キープアライブ間隔"},"authenticate":{"default":"","en-us":"Enable authentication","zh-tw":"啟用身份驗證","ja-jp":"認証を有効にする"},"authTable":{"default":"","en-us":"Authentication table","zh-tw":"身份驗證表","ja-jp":"認証テーブル"}},"defaultBrickProps":{"init":false,"port":1883,"retryInterval":5,"keepalive":60,"authenticate":false},"propertyControls":{"port":{"required":true},"retryInterval":{"kind":"unit","min":1,"unit":"s"},"keepalive":{"kind":"unit","min":1,"unit":"s"}},"outletTypes":{"GENERATOR_MQTT_BROKER_STARTED":{"outlet":"GENERATOR_MQTT_BROKER_STARTED","type":"bool"},"GENERATOR_MQTT_BROKER_LAST_MESSAGE":{"outlet":"GENERATOR_MQTT_BROKER_LAST_MESSAGE","type":"object"},"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"outlet":"GENERATOR_MQTT_BROKER_ERROR_MESSAGE","type":"string"}},"brickOutletDescriptions":{"GENERATOR_MQTT_BROKER_STARTED":{"default":"","en-us":"Is server started","zh-tw":"伺服器啟動狀態","ja-jp":"サーバーが起動しているか"},"GENERATOR_MQTT_BROKER_LAST_MESSAGE":{"default":"","en-us":"Last received message","zh-tw":"最後收到的訊息","ja-jp":"最後に受信したメッセージ"},"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"default":"","en-us":"Error message","zh-tw":"錯誤訊息","ja-jp":"エラーメッセージ"}},"eventTypes":{"GENERATOR_MQTT_BROKER_ON_READY":"GENERATOR_MQTT_BROKER_ON_READY","GENERATOR_MQTT_BROKER_ON_ERROR":"GENERATOR_MQTT_BROKER_ON_ERROR","GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED","GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED","GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED","GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED"},"brickEventDescriptions":{"GENERATOR_MQTT_BROKER_ON_READY":{"default":"","en-us":"Event of MQTT server is ready","zh-tw":"當 MQTT 伺服器啟動完成時觸發事件","ja-jp":"MQTT サーバーの準備完了時のイベント"},"GENERATOR_MQTT_BROKER_ON_ERROR":{"default":"","en-us":"Event of server or connection error","zh-tw":"當伺服器或連線發生錯誤時觸發事件","ja-jp":"サーバーまたは接続エラー時のイベント"},"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":{"default":"","en-us":"Event of client connected","zh-tw":"當有客戶端連線時觸發事件","ja-jp":"クライアント接続時のイベント"},"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":{"default":"","en-us":"Event of client disconnected","zh-tw":"當有客戶端斷線時觸發事件","ja-jp":"クライアント切断時のイベント"},"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":{"default":"","en-us":"Event of message received","zh-tw":"當收到訊息時觸發事件","ja-jp":"メッセージ受信時のイベント"},"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":{"default":"","en-us":"Event of message published","zh-tw":"當訊息發佈時觸發事件","ja-jp":"メッセージ公開時のイベント"}},"eventPropertyControls":{"GENERATOR_MQTT_BROKER_ON_ERROR":{"properties":{"GENERATOR_MQTT_BROKER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_CLIENT_CONNECTED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_CLIENT_DISCONNECTED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_MESSAGE_RECEIVED":{"properties":{"GENERATOR_MQTT_BROKER_TOPIC":{"name":"Topic","type":"string"},"GENERATOR_MQTT_BROKER_PAYLOAD":{"name":"Payload","type":"string"}}},"GENERATOR_MQTT_BROKER_ON_MESSAGE_PUBLISHED":{"properties":{"GENERATOR_MQTT_BROKER_CLIENT_ID":{"name":"Client ID","type":"string"},"GENERATOR_MQTT_BROKER_MESSAGE_ID":{"name":"Message ID","type":"number"}}}},"actionTypes":{"GENERATOR_MQTT_BROKER_START":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_MQTT_BROKER_PUBLISH":{"disallowMultiple":false,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MQTT_BROKER_TOPIC":{"name":"Topic","type":"string"},"GENERATOR_MQTT_BROKER_PAYLOAD":{"name":"Payload","type":"string"},"GENERATOR_MQTT_BROKER_MESSAGE_ID":{"name":"Message ID","type":"number"}}},"GENERATOR_MQTT_BROKER_STOP":{"disallowMultiple":true,"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MQTT_BROKER_START":{"default":"","en-us":"Start MQTT broker server","zh-tw":"啟動 MQTT 伺服器","ja-jp":"MQTT ブローカーサーバーを起動"},"GENERATOR_MQTT_BROKER_PUBLISH":{"default":"","en-us":"Publish message to topic","zh-tw":"發佈訊息到指定主題","ja-jp":"指定トピックにメッセージを公開"},"GENERATOR_MQTT_BROKER_STOP":{"default":"","en-us":"Stop MQTT broker server","zh-tw":"停止 MQTT 伺服器","ja-jp":"MQTT ブローカーサーバーを停止"}}}')},8678:(e,t,a)=>{a.d(t,{y:()=>p});var n,r=a(2704),i=a(5078),o=a(555),s=a(4114),p=Object.assign(function(e){var t=n.get(e);return t||(t=(0,r.y)(e),n.set(e,t)),t},{reset:function(){n=new i.A(o.v.print||2e3)}});p.reset(),!1!==globalThis.__DEV__&&(0,s.D_)("print",function(){return n?n.size:0})},8706:(e,t,a)=>{const n=a(8323);t.implementation=class{constructor(e){const t=e[0],a=e[1];let r=null;if(void 0!==a&&(r=n.basicURLParse(a),"failure"===r))throw new TypeError("Invalid base URL");const i=n.basicURLParse(t,{baseURL:r});if("failure"===i)throw new TypeError("Invalid URL");this._url=i}get href(){return n.serializeURL(this._url)}set href(e){const t=n.basicURLParse(e);if("failure"===t)throw new TypeError("Invalid URL");this._url=t}get origin(){return n.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(e){n.basicURLParse(e+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(e){n.cannotHaveAUsernamePasswordPort(this._url)||n.setTheUsername(this._url,e)}get password(){return this._url.password}set password(e){n.cannotHaveAUsernamePasswordPort(this._url)||n.setThePassword(this._url,e)}get host(){const e=this._url;return null===e.host?"":null===e.port?n.serializeHost(e.host):n.serializeHost(e.host)+":"+n.serializeInteger(e.port)}set host(e){this._url.cannotBeABaseURL||n.basicURLParse(e,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":n.serializeHost(this._url.host)}set hostname(e){this._url.cannotBeABaseURL||n.basicURLParse(e,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":n.serializeInteger(this._url.port)}set port(e){n.cannotHaveAUsernamePasswordPort(this._url)||(""===e?this._url.port=null:n.basicURLParse(e,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:0===this._url.path.length?"":"/"+this._url.path.join("/")}set pathname(e){this._url.cannotBeABaseURL||(this._url.path=[],n.basicURLParse(e,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":"?"+this._url.query}set search(e){const t=this._url;if(""===e)return void(t.query=null);const a="?"===e[0]?e.substring(1):e;t.query="",n.basicURLParse(a,{url:t,stateOverride:"query"})}get hash(){return null===this._url.fragment||""===this._url.fragment?"":"#"+this._url.fragment}set hash(e){if(""===e)return void(this._url.fragment=null);const t="#"===e[0]?e.substring(1):e;this._url.fragment="",n.basicURLParse(t,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}},8709:(e,t,a)=>{a.d(t,{U:()=>T,y:()=>g});var n=a(5608),r=a(9212),i=a(5888),o=a(5950),s=a(3673),p=a(3777),l=a(234),d=a(906),u=a(7613),c=a(5892),m=a(492),f=a(3570),_=a(5427),h=a(7634),E=Object.assign,y=Object.hasOwnProperty,T=function(e){function t(a){var r=a.queryManager,i=a.queryInfo,o=a.options,s=this,l=t.inactiveOnCreation.getValue();(s=e.call(this,function(e){l&&(r.queries.set(s.queryId,i),l=!1);try{var t=e._subscription._observer;t&&!t.error&&(t.error=R)}catch(e){}var a=!s.observers.size;s.observers.add(e);var n=s.last;return n&&n.error?e.error&&e.error(n.error):n&&n.result&&e.next&&e.next(s.maskResult(n.result)),a&&s.reobserve().catch(function(){}),function(){s.observers.delete(e)&&!s.observers.size&&s.tearDownQuery()}})||this).observers=new Set,s.subscriptions=new Set,s.dirty=!1,s.queryInfo=i,s.queryManager=r,s.waitForOwnResult=v(o.fetchPolicy),s.isTornDown=!1,s.subscribeToMore=s.subscribeToMore.bind(s),s.maskResult=s.maskResult.bind(s);var d=r.defaultOptions.watchQuery,u=(void 0===d?{}:d).fetchPolicy,c=void 0===u?"cache-first":u,m=o.fetchPolicy,f=void 0===m?c:m,_=o.initialFetchPolicy,h=void 0===_?"standby"===f?c:f:_;s.options=(0,n.__assign)((0,n.__assign)({},o),{initialFetchPolicy:h,fetchPolicy:f}),s.queryId=i.queryId||r.generateQueryId();var E=(0,p.Vu)(s.query);return s.queryName=E&&E.name&&E.name.value,s}return(0,n.__extends)(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),t.prototype.result=function(){var e=this;return new Promise(function(t,a){var n={next:function(a){t(a),e.observers.delete(n),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout(function(){r.unsubscribe()},0)},error:a},r=e.subscribe(n)})},t.prototype.resetDiff=function(){this.queryInfo.resetDiff()},t.prototype.getCurrentFullResult=function(e){void 0===e&&(e=!0);var t=this.getLastResult(!0),a=this.queryInfo.networkStatus||t&&t.networkStatus||o.pT.ready,r=(0,n.__assign)((0,n.__assign)({},t),{loading:(0,o.bi)(a),networkStatus:a}),s=this.options.fetchPolicy,p=void 0===s?"cache-first":s;if(v(p)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers);else if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var l=this.queryInfo.getDiff();(l.complete||this.options.returnPartialData)&&(r.data=l.result),(0,i.equal)(r.data,{})&&(r.data=void 0),l.complete?(delete r.partial,!l.complete||r.networkStatus!==o.pT.loading||"cache-first"!==p&&"cache-only"!==p||(r.networkStatus=o.pT.ready,r.loading=!1)):r.partial=!0,r.networkStatus===o.pT.ready&&(r.error||r.errors)&&(r.networkStatus=o.pT.error),!1===globalThis.__DEV__||l.complete||this.options.partialRefetch||r.loading||r.data||r.error||g(l.missing)}return e&&this.updateLastResult(r),r},t.prototype.getCurrentResult=function(e){return void 0===e&&(e=!0),this.maskResult(this.getCurrentFullResult(e))},t.prototype.isDifferentFromLastResult=function(e,t){if(!this.last)return!0;var a=this.queryManager.getDocumentInfo(this.query),n=this.queryManager.dataMasking,r=n?a.nonReactiveQuery:this.query;return(n||a.hasNonreactiveDirective?!(0,_.a)(r,this.last.result,e,this.variables):!(0,i.equal)(this.last.result,e))||t&&!(0,i.equal)(this.last.variables,t)},t.prototype.getLast=function(e,t){var a=this.last;if(a&&a[e]&&(!t||(0,i.equal)(a.variables,this.variables)))return a[e]},t.prototype.getLastResult=function(e){return this.getLast("result",e)},t.prototype.getLastError=function(e){return this.getLast("error",e)},t.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},t.prototype.refetch=function(e){var t,a={pollInterval:0},s=this.options.fetchPolicy;if(a.fetchPolicy="no-cache"===s?"no-cache":"network-only",!1!==globalThis.__DEV__&&e&&y.call(e,"variables")){var l=(0,p.AT)(this.query),d=l.variableDefinitions;d&&d.some(function(e){return"variables"===e.variable.name.value})||!1!==globalThis.__DEV__&&r.invariant.warn(21,e,(null===(t=l.name)||void 0===t?void 0:t.value)||l)}return e&&!(0,i.equal)(this.options.variables,e)&&(a.variables=this.options.variables=(0,n.__assign)((0,n.__assign)({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(a,o.pT.refetch)},t.prototype.fetchMore=function(e){var t=this,a=(0,n.__assign)((0,n.__assign)({},e.query?e:(0,n.__assign)((0,n.__assign)((0,n.__assign)((0,n.__assign)({},this.options),{query:this.options.query}),e),{variables:(0,n.__assign)((0,n.__assign)({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"});a.query=this.transformDocument(a.query);var i=this.queryManager.generateQueryId();this.lastQuery=e.query?this.transformDocument(this.options.query):a.query;var s=this.queryInfo,p=s.networkStatus;s.networkStatus=o.pT.fetchMore,a.notifyOnNetworkStatusChange&&this.observe();var l=new Set,d=null==e?void 0:e.updateQuery,u="no-cache"!==this.options.fetchPolicy;return u||(0,r.invariant)(d,22),this.queryManager.fetchQuery(i,a,o.pT.fetchMore).then(function(r){if(t.queryManager.removeQuery(i),s.networkStatus===o.pT.fetchMore&&(s.networkStatus=p),u)t.queryManager.cache.batch({update:function(n){var i=e.updateQuery;i?n.updateQuery({query:t.query,variables:t.variables,returnPartialData:!0,optimistic:!1},function(e){return i(e,{fetchMoreResult:r.data,variables:a.variables})}):n.writeQuery({query:a.query,variables:a.variables,data:r.data})},onWatchUpdated:function(e){l.add(e.query)}});else{var c=t.getLast("result"),m=d(c.data,{fetchMoreResult:r.data,variables:a.variables});t.reportResult((0,n.__assign)((0,n.__assign)({},c),{networkStatus:p,loading:(0,o.bi)(p),data:m}),t.variables)}return t.maskResult(r)}).finally(function(){u&&!l.has(t.query)&&t.reobserveCacheFirst()})},t.prototype.subscribeToMore=function(e){var t=this,a=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(a){var r=e.updateQuery;r&&t.updateQuery(function(e,t){return r(e,(0,n.__assign)({subscriptionData:a},t))})},error:function(t){e.onError?e.onError(t):!1!==globalThis.__DEV__&&r.invariant.error(23,t)}});return this.subscriptions.add(a),function(){t.subscriptions.delete(a)&&a.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.silentSetOptions=function(e){var t=(0,m.o)(this.options,e||{});E(this.options,t)},t.prototype.setVariables=function(e){return(0,i.equal)(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},o.pT.setVariables):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,a=t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}),n=a.result,r=a.complete,i=e(n,{variables:this.variables,complete:!!r,previousData:n});i&&(t.cache.writeQuery({query:this.options.query,data:i,variables:this.variables}),t.broadcastQueries())},t.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},t.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},t.prototype.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var a=t.fetchPolicy,n=void 0===a?"cache-first":a,r=t.initialFetchPolicy,i=void 0===r?n:r;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(n,{reason:e,options:t,observable:this,initialFetchPolicy:i}):t.fetchPolicy="variables-changed"===e?i:t.nextFetchPolicy)}return t.fetchPolicy},t.prototype.fetch=function(e,t,a){var n=this.queryManager.getOrCreateQuery(this.queryId);return n.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(n,e,t,a)},t.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var t=this.pollingInfo,a=this.options.pollInterval;if(a&&this.hasObservers()){if(!t||t.interval!==a){(0,r.invariant)(a,24),(t||(this.pollingInfo={})).interval=a;var n=function(){var t,a;e.pollingInfo&&((0,o.bi)(e.queryInfo.networkStatus)||(null===(a=(t=e.options).skipPollAttempt)||void 0===a?void 0:a.call(t))?i():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},o.pT.poll).then(i,i))},i=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(n,t.interval))};i()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)}},t.prototype.updateLastResult=function(e,t){void 0===t&&(t=this.variables);var a=this.getLastError();return a&&this.last&&!(0,i.equal)(t,this.last.variables)&&(a=void 0),this.last=(0,n.__assign)({result:this.queryManager.assumeImmutableResults?e:(0,d.m)(e),variables:t},a?{error:a}:null)},t.prototype.reobserveAsConcast=function(e,t){var a=this;this.isTornDown=!1;var r=t===o.pT.refetch||t===o.pT.fetchMore||t===o.pT.poll,s=this.options.variables,p=this.options.fetchPolicy,l=(0,m.o)(this.options,e||{}),d=r?l:E(this.options,l),u=this.transformDocument(d.query);this.lastQuery=u,r||(this.updatePolling(),!e||!e.variables||(0,i.equal)(e.variables,s)||"standby"===d.fetchPolicy||d.fetchPolicy!==p&&"function"!=typeof d.nextFetchPolicy||(this.applyNextFetchPolicy("variables-changed",d),void 0===t&&(t=o.pT.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=v(d.fetchPolicy));var c=function(){a.concast===y&&(a.waitForOwnResult=!1)},_=d.variables&&(0,n.__assign)({},d.variables),h=this.fetch(d,t,u),y=h.concast,T=h.fromLink,R={next:function(e){(0,i.equal)(a.variables,_)&&(c(),a.reportResult(e,_))},error:function(e){(0,i.equal)(a.variables,_)&&((0,f.isApolloError)(e)||(e=new f.ApolloError({networkError:e})),c(),a.reportError(e,_))}};return r||!T&&this.concast||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=y,this.observer=R),y.addObserver(R),y},t.prototype.reobserve=function(e,t){return(0,l.X)(this.reobserveAsConcast(e,t).promise.then(this.maskResult))},t.prototype.resubscribeAfterError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=this.last;this.resetLastResults();var n=this.subscribe.apply(this,e);return this.last=a,n},t.prototype.observe=function(){this.reportResult(this.getCurrentFullResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var a=this.getLastError(),n=this.isDifferentFromLastResult(e,t);(a||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),(a||n)&&(0,u.w)(this.observers,"next",this.maskResult(e))},t.prototype.reportError=function(e,t){var a=(0,n.__assign)((0,n.__assign)({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:o.pT.error,loading:!1});this.updateLastResult(a,t),(0,u.w)(this.observers,"error",this.last.error=e)},t.prototype.hasObservers=function(){return this.observers.size>0},t.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(e){return e.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},t.prototype.transformDocument=function(e){return this.queryManager.transform(e)},t.prototype.maskResult=function(e){return e&&"data"in e?(0,n.__assign)((0,n.__assign)({},e),{data:this.queryManager.maskOperation({document:this.query,data:e.data,fetchPolicy:this.options.fetchPolicy,id:this.queryId})}):e},t.prototype.resetNotifications=function(){this.cancelNotifyTimeout(),this.dirty=!1},t.prototype.cancelNotifyTimeout=function(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0)},t.prototype.scheduleNotify=function(){var e=this;this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return e.notify()},0)))},t.prototype.notify=function(){(this.cancelNotifyTimeout(),this.dirty)&&("cache-only"!=this.options.fetchPolicy&&"cache-and-network"!=this.options.fetchPolicy&&(0,o.bi)(this.queryInfo.networkStatus)||(this.queryInfo.getDiff().fromOptimisticTransaction?this.observe():this.reobserveCacheFirst()));this.dirty=!1},t.prototype.reobserveCacheFirst=function(){var e=this.options,t=e.fetchPolicy,a=e.nextFetchPolicy;return"cache-and-network"===t||"network-only"===t?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,n){return this.nextFetchPolicy=a,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,n):t}}):this.reobserve()},t.inactiveOnCreation=new h.Slot,t}(s.c);function R(e){!1!==globalThis.__DEV__&&r.invariant.error(25,e.message,e.stack)}function g(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&r.invariant.debug(26,e)}function v(e){return"network-only"===e||"no-cache"===e||"standby"===e}(0,c.r)(T)},8752:e=>{e.exports=JSON.parse('{"name":"GeneratorTick","brickDescription":{"default":"Execute event in countdown manner","en-us":"Execute event in countdown manner","zh-tw":"以倒數計時的方式執行事件","ja-jp":"カウントダウン方式でイベントを実行"},"brickDisplayName":"Tick","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"clock"},"propTypes":{"init":{"type":"bool"},"interval":{"type":"number"},"countdownStartValue":{"type":"number"},"countdownInterval":{"type":"number"},"repeat":{"type":"bool"},"map":{"type":"object"},"mapFallback":{"type":"any"}},"brickPropDescriptions":{"init":{"default":"","en-us":"Start tick on generator initialized","zh-tw":"Generator 初始化後直接開始執行事件","ja-jp":"ジェネレータの初期化時にティックを開始"},"interval":{"default":"","en-us":"Interval of second for countdown","zh-tw":"每次間隔變動的時間(秒)","ja-jp":"カウントダウンの秒間隔"},"countdownStartValue":{"default":"","en-us":"Initial value of countdown","zh-tw":"倒數的起始值","ja-jp":"カウントダウンの初期値"},"countdownInterval":{"default":"","en-us":"Interval of value for countdown","zh-tw":"每次間隔變動的數值","ja-jp":"カウントダウンの値の間隔"},"repeat":{"default":"","en-us":"Make countdown repeatable","zh-tw":"是否在倒數完畢後重新開始","ja-jp":"カウントダウンを繰り返し可能にする"},"map":{"default":"","en-us":"Map for PROPERTY_BANK_RESULT","zh-tw":"PROPERTY_BANK_RESULT 對應的轉換表","ja-jp":"PROPERTY_BANK_RESULTのマッピング"},"mapFallback":{"default":"","en-us":"Fallback of MAP_OBJECT","zh-tw":"MAP_OBJECT 的預設回傳值","ja-jp":"MAP_OBJECTのフォールバック"}},"propertyControls":{"interval":{"kind":"unit","min":0,"unit":"ms"},"countdownStartValue":{"kind":"unit","min":0,"required":true},"countdownInterval":{"kind":"unit","min":0}},"outletTypes":{"GENERATOR_TICK_COUNTDOWN":{"outlet":"GENERATOR_TICK_COUNTDOWN","oneOfType":["string","number"]},"GENERATOR_TICK_RUNNING":{"outlet":"GENERATOR_TICK_RUNNING","oneOfType":["bool","string","number"]}},"brickOutletDescriptions":{"GENERATOR_TICK_COUNTDOWN":{"default":"","en-us":"Countdown step value","zh-tw":"倒數的變數值","ja-jp":"カウントダウンステップ値"},"GENERATOR_TICK_RUNNING":{"default":"","en-us":"Is tick running?","zh-tw":"Tick 是否運作中","ja-jp":"ティックは実行中か"}},"defaultBrickProps":{},"eventTypes":{"GENERATOR_TICK_TICKING":"GENERATOR_TICK_TICKING","GENERATOR_TICK_COMPLETED":"GENERATOR_TICK_COMPLETED"},"brickEventDescriptions":{"GENERATOR_TICK_TICKING":{"default":"","en-us":"Event for each tick start","zh-tw":"每次倒數觸發的事件","ja-jp":"ティック開始時のイベント"},"GENERATOR_TICK_COMPLETED":{"default":"","en-us":"Event for tick completed","zh-tw":"當 Tick 完成時觸發的事件","ja-jp":"ティック完了時のイベント"}},"eventPropertyControls":{"GENERATOR_TICK_TICKING":{"properties":{"GENERATOR_TICK_COUNTDOWN":{"name":"Countdown","type":"number"},"GENERATOR_TICK_VALUE":{"name":"Value","type":"any"}}},"GENERATOR_TICK_COMPLETED":{"properties":{"GENERATOR_TICK_COUNTDOWN":{"name":"Countdown","type":"number"},"GENERATOR_TICK_VALUE":{"name":"Value","type":"any"}}}},"actionTypes":{"GENERATOR_TICK":{"canProvideProperty":false},"GENERATOR_TICK_CANCEL":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_TICK":{"default":"","en-us":"Start the tick","zh-tw":"開始倒數","ja-jp":"ティックを開始"},"GENERATOR_TICK_CANCEL":{"default":"","en-us":"Cancel the tick","zh-tw":"取消倒數","ja-jp":"ティックをキャンセル"}}}')},8765:(e,a,n)=>{n.d(a,{clearConfig:()=>g,default:()=>v,getBaseUrl:()=>l,getCurrentProfile:()=>y,getToken:()=>c,getTokenInfo:()=>m,getTokens:()=>u,listProfiles:()=>R,removeToken:()=>_,setBaseUrl:()=>d,setCurrentProfile:()=>T,setProfileOverride:()=>E,setToken:()=>f}),n.r(a);var r=n(6928);const i=t("os");var s=r.join(i.homedir(),".bricks-cli"),p=new o({projectName:"bricks-cli",cwd:s,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},createdAt:{type:"string"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"}}}),l=()=>p.get("baseUrl"),d=e=>p.set("baseUrl",e),u=()=>p.get("tokens"),c=(e="default")=>{var t=p.get("tokens");return t[e]?.token},m=(e="default")=>p.get("tokens")[e],f=(e,t)=>{var a=p.get("tokens");a[e]={...t,createdAt:(new Date).toISOString()},p.set("tokens",a)},_=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},h=null,E=e=>{h=e},y=()=>h||process.env.BRICKS_PROFILE||p.get("currentProfile"),T=e=>p.set("currentProfile",e),R=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},g=()=>{p.clear()};const v=p},8768:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r=a(458),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:a,parentSchema:i,it:o}=e;if(!Array.isArray(a))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const s=a,p=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(function(){s.forEach((a,i)=>{let s;(0,r.alwaysValidSchema)(o,a)?t.var(d,!0):s=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},d),i>0&&t.if(n._`${d} && ${p}`).assign(p,!1).assign(l,n._`[${l}, ${i}]`).else(),t.if(d,()=>{t.assign(p,!0),t.assign(l,i),s&&e.mergeEvaluated(s,n.Name)})})}),e.result(p,()=>e.reset(),()=>e.error(!0))}};t.default=i},8792:e=>{e.exports=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var n,r,i;if(Array.isArray(t)){if((n=t.length)!=a.length)return!1;for(r=n;0!==r--;)if(!e(t[r],a[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(r=n;0!==r--;)if(!Object.prototype.hasOwnProperty.call(a,i[r]))return!1;for(r=n;0!==r--;){var o=i[r];if(!e(t[o],a[o]))return!1}return!0}return t!=t&&a!=a}},8802:e=>{e.exports=JSON.parse('{"name":"GeneratorMCPServer","brickDescription":{"default":"Model Context Protocol (MCP) Server","en-us":"Model Context Protocol (MCP) Server (https://docs.anthropic.com/en/docs/agents-and-tools/mcp)","zh-tw":"MCP 伺服器(https://docs.anthropic.com/zh-TW/docs/agents-and-tools/mcp)","ja-jp":"Model Context Protocol (MCP) サーバー(https://docs.anthropic.com/ja/docs/agents-and-tools/mcp)"},"brickDisplayName":"MCP Server","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"server"},"brickMeta":{"canBeGlobalGenerator":true},"propTypes":{"enabled":{"type":"bool"},"globalGeneratorKey":{"type":"string"},"listening":{"type":"bool"},"port":{"type":"number"},"authType":{"type":"oneOf","content":["none","bearer"],"forcePropertyBank":false},"bearerToken":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"},"resources":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"uriOrTemplate":{"type":"string"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false},"tools":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"params":{"type":"object"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false},"prompts":{"type":"arrayOf","content":{"type":"shape","content":{"enabled":{"type":"bool"},"name":{"type":"string"},"description":{"type":"string"},"arguments":{"type":"object"},"type":{"type":"oneOf","content":["static","detect-data-change","script"],"forcePropertyBank":false},"staticData":{"type":"any"},"dataChangeConfig":{"type":"shape","content":{"target":{"type":"string"},"timeout":{"type":"number"},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"scriptConfig":{"type":"shape","content":{"code":{"type":"string"},"timeout":{"type":"number"},"members":{"type":"arrayOf","content":{"type":"shape","content":{"handler":{"type":"string"},"varName":{"type":"string"}},"forcePropertyBank":false},"forcePropertyBank":false},"additionalParams":{"type":"object"}},"forcePropertyBank":false},"responseType":{"type":"oneOf","content":["text","object"],"forcePropertyBank":false}},"forcePropertyBank":false},"forcePropertyBank":false}},"brickPropDescriptions":{"enabled":{"default":"","en-us":"Enable MCP server. If enabled and Listening is false, the generator can still provide application-scoped resources.","zh-tw":"啟用 MCP 伺服器。如果啟用且 Listening 為 false,generator 仍然可以提供應用程式範圍的資源。","ja-jp":"MCP サーバーを有効にします。有効で Listening が false の場合でも、ジェネレーターはアプリケーションスコープのリソースを提供できます。"},"globalGeneratorKey":{"default":"","en-us":"Application-scoped generator key, key cannot be the same with other application-scoped generators","zh-tw":"應用程式範圍的 generator key,key 不能與其他應用程式範圍的 generator 相同","ja-jp":"アプリケーションスコープのジェネレーターキー、キーは他のアプリケーションスコープのジェネレーターと同じにできません"},"listening":{"default":"","en-us":"Start MCP server","zh-tw":"Generator 開始執行 MCP 伺服器","ja-jp":"MCP サーバーを起動する"},"port":{"default":"","en-us":"HTTP server port","zh-tw":"HTTP 伺服器連接埠","ja-jp":"HTTP サーバーポート"},"authType":{"default":"","en-us":"Authorization type of HTTP request","zh-tw":"HTTP 認證方式","ja-jp":"HTTP リクエストの認証タイプ"},"bearerToken":{"default":"","en-us":"Token of bearer auth","zh-tw":"Bearer 認證 token","ja-jp":"Bearer 認証のトークン"},"name":{"default":"","en-us":"Name of the MCP server","zh-tw":"MCP 伺服器名稱","ja-jp":"MCP サーバーの名前"},"version":{"default":"","en-us":"Version of the MCP server","zh-tw":"MCP 伺服器版本","ja-jp":"MCP サーバーのバージョン"},"resources":{"default":"","en-us":"Resources \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"資源 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"リソース \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"},"tools":{"default":"","en-us":"Tools \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id. \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"工具 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同。 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"ツール \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください。 \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"},"prompts":{"default":"","en-us":"Prompts \\n Type: \\n `static`: Return static data \\n `detect-data-change`: Watch data target change to return data, \\n please update data with ({ id: string, content: string | object }), \\n and ensure the id is same with request id \\n `script`: Run a JavaScript code to return data \\n - Script can define members to call generator functions \\n - Script support async/await","zh-tw":"提示 \\n Type: \\n `static`: 返回靜態資料 \\n `detect-data-change`: 監控資料目標變更以返回資料, \\n 請更新資料為 ({ id: string, content: string | object }), \\n 並請確保 id 與請求 id 相同 \\n `script`: 執行 JavaScript 程式碼以返回資料 \\n - 腳本可以定義成員來調用 Generator 函數 \\n - 腳本支持 async/await","ja-jp":"プロンプト \\n タイプ: \\n `static`: 静的データを返す \\n `detect-data-change`: データターゲットの変更を監視してデータを返す, \\n データを ({ id: string, content: string | object }) で更新し, \\n id がリクエスト id と同じであることを確認してください \\n `script`: JavaScript 程式碼を実行して資料を返す \\n - スクリプトは Generator 関数を呼び出すメンバーを定義できます \\n - スクリプトは async/await をサポートします"}},"propertyControls":{"resources":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-resources"},"tools":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-tools"},"prompts":{"extendSchema":{"properties":{"dataChangeConfig":{"type":"object","properties":{"target":{"type":"string","kind":"id","idType":"property_bank"},"timeout":{"type":"number"},"payload":{"type":"any"}}},"scriptConfig":{"type":"object","properties":{"members":{"type":"array","properties":{"handler":{"type":"string","kind":"id","idType":"generator"}}}}}}},"kind":"mcp-server-prompts"},"authType":{"oneOfEmptyOption":false}},"propertyControlGroups":{"httpServer":{"name":"HTTP Server Config","type":"group","content":["listening","port","authType","bearerToken"]}},"propertyControlGroupDescriptions":{},"defaultBrickProps":{"enabled":true,"listening":true,"authType":"none","name":"bricks-foundation-mcp-server-default","version":"1.0.0","resources":[],"tools":[],"prompts":[]},"eventTypes":{"GENERATOR_MCP_SERVER_ON_LISTENING":"GENERATOR_MCP_SERVER_ON_LISTENING","GENERATOR_MCP_SERVER_ON_ERROR":"GENERATOR_MCP_SERVER_ON_ERROR","GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR","GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE","GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE","GENERATOR_MCP_SERVER_ON_CALL_TOOL":"GENERATOR_MCP_SERVER_ON_CALL_TOOL","GENERATOR_MCP_SERVER_ON_GET_PROMPT":"GENERATOR_MCP_SERVER_ON_GET_PROMPT"},"brickEventDescriptions":{"GENERATOR_MCP_SERVER_ON_LISTENING":{"default":"","en-us":"Listening of HTTP server","zh-tw":"HTTP 伺服器聆聽","ja-jp":"HTTP サーバーのリスニング"},"GENERATOR_MCP_SERVER_ON_ERROR":{"default":"","en-us":"Error of HTTP server","zh-tw":"HTTP 伺服器錯誤","ja-jp":"HTTP サーバーのエラー"},"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":{"default":"","en-us":"Client error of HTTP server","zh-tw":"HTTP 伺服器客戶端錯誤","ja-jp":"HTTP サーバーのクライアントエラー"},"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":{"default":"","en-us":"Client close of HTTP server","zh-tw":"HTTP 伺服器客戶端關閉","ja-jp":"HTTP サーバーのクライアント閉じる"},"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":{"default":"","en-us":"On request resource (Request: { name: string, uri: string, params: object })","zh-tw":"當請求資源 (Request: { name: string, uri: string, params: object })","ja-jp":"リクエストリソース (Request: { name: string, uri: string, params: object })"},"GENERATOR_MCP_SERVER_ON_CALL_TOOL":{"default":"","en-us":"On call tool (Request: { name: string, params: object })","zh-tw":"當呼叫工具 (Request: { name: string, params: object })","ja-jp":"ツールの呼び出し (Request: { name: string, params: object })"},"GENERATOR_MCP_SERVER_ON_GET_PROMPT":{"default":"","en-us":"On get prompt (Request: { name: string, arguments: object })","zh-tw":"當獲取提示 (Request: { name: string, arguments: object })","ja-jp":"プロンプトの取得 (Request: { name: string, arguments: object })"}},"eventPropertyControls":{"GENERATOR_MCP_SERVER_ON_ERROR":{"properties":{"GENERATOR_MCP_SERVER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_SERVER_ON_CLIENT_ERROR":{"properties":{"GENERATOR_MCP_SERVER_CLIENT_ADDRESS":{"name":"Client Address","type":"string"},"GENERATOR_MCP_SERVER_SESSION_ID":{"name":"Session ID","type":"string"},"GENERATOR_MCP_SERVER_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_SERVER_ON_CLIENT_CLOSE":{"properties":{"GENERATOR_MCP_SERVER_CLIENT_ADDRESS":{"name":"Client Address","type":"string"},"GENERATOR_MCP_SERVER_SESSION_ID":{"name":"Session ID","type":"string"}}},"GENERATOR_MCP_SERVER_ON_REQUEST_RESOURCE":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_URI":{"name":"Request URI","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Variables","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}},"GENERATOR_MCP_SERVER_ON_CALL_TOOL":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Params","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}},"GENERATOR_MCP_SERVER_ON_GET_PROMPT":{"properties":{"GENERATOR_MCP_SERVER_REQUEST_TYPE":{"name":"Request Type","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_NAME":{"name":"Request Name","type":"string"},"GENERATOR_MCP_SERVER_REQUEST_VARIABLES":{"name":"Request Variables","type":"object"},"GENERATOR_MCP_SERVER_REQUEST_TIMEOUT":{"name":"Request Timeout","type":"number"},"GENERATOR_MCP_SERVER_REQUEST":{"name":"Request Full Body","type":"object"}}}},"outletTypes":{"GENERATOR_MCP_SERVER_IS_LISTENING":{"outlet":"GENERATOR_MCP_SERVER_IS_LISTENING","type":"bool"},"GENERATOR_MCP_SERVER_LAST_ERROR":{"outlet":"GENERATOR_MCP_SERVER_LAST_ERROR","type":"string"},"GENERATOR_MCP_SERVER_ENDPOINT":{"outlet":"GENERATOR_MCP_SERVER_ENDPOINT","type":"string"},"GENERATOR_MCP_SERVER_CONNECTED_REMOTES":{"outlet":"GENERATOR_MCP_SERVER_CONNECTED_REMOTES","type":"array"},"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST":{"outlet":"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST","type":"object"},"GENERATOR_MCP_SERVER_LAST_TOOL_CALL":{"outlet":"GENERATOR_MCP_SERVER_LAST_TOOL_CALL","type":"object"},"GENERATOR_MCP_SERVER_LAST_PROMPT_GET":{"outlet":"GENERATOR_MCP_SERVER_LAST_PROMPT_GET","type":"object"}},"brickOutletDescriptions":{"GENERATOR_MCP_SERVER_IS_LISTENING":{"default":"","en-us":"Whether the HTTP server is listening","zh-tw":"HTTP 伺服器是否正在聆聽","ja-jp":"HTTP サーバーがリスニングしているかどうか"},"GENERATOR_MCP_SERVER_LAST_ERROR":{"default":"","en-us":"Last error of HTTP server","zh-tw":"HTTP 伺服器最後的錯誤","ja-jp":"HTTP サーバーの最後のエラー"},"GENERATOR_MCP_SERVER_ENDPOINT":{"default":"","en-us":"MCP server endpoint URL","zh-tw":"MCP 伺服器端點 URL","ja-jp":"MCP サーバーのエンドポイント URL"},"GENERATOR_MCP_SERVER_CONNECTED_REMOTES":{"default":"","en-us":"Connected remotes (Session ID)","zh-tw":"連接的遠端 (Session ID)","ja-jp":"接続されたリモート (セッション ID)"},"GENERATOR_MCP_SERVER_LAST_RESOURCE_REQUEST":{"default":"","en-us":"Last resource request ({ name: string, uri: string, params: object })","zh-tw":"最後的資源請求 ({ name: string, uri: string, params: object })","ja-jp":"最後のリソース要求 ({ name: string, uri: string, params: object })"},"GENERATOR_MCP_SERVER_LAST_TOOL_CALL":{"default":"","en-us":"Last tool call ({ name: string, params: object })","zh-tw":"最後的工具呼叫 ({ name: string, params: object })","ja-jp":"最後のツール呼び出し ({ name: string, params: object })"},"GENERATOR_MCP_SERVER_LAST_PROMPT_GET":{"default":"","en-us":"Last prompt get ({ name: string, arguments: object })","zh-tw":"最後的提示獲取 ({ name: string, arguments: object })","ja-jp":"最後のプロンプトの取得 ({ name: string, arguments: object })"}},"actionTypes":{"GENERATOR_MCP_SERVER_REFRESH_RESOURCES":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_MCP_SERVER_REFRESH_RESOURCES":{"default":"","en-us":"Refresh tools and resources, used for case if tools or resources are changed. Note that the current connections will be closed.","zh-tw":"重新整理工具和資源,用於工具或資源變更時。注意,目前連線將會關閉。","ja-jp":"ツールとリソースを更新します。ツールやリソースが変更された場合に使用します。注意、現在の接続は閉じられます。"}}}')},8832:(e,t,a)=>{var n=a(3634),r=a(6525),i=a(8243),o=a(5523);e.exports=function(e,t){return n(e)||r(e,t)||i(e,t)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},8870:(e,t,a)=>{var n=a(5650),r=Object.prototype,i=r.hasOwnProperty,o=r.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),a=e[s];try{e[s]=void 0;var n=!0}catch(e){}var r=o.call(e);return n&&(t?e[s]=a:delete e[s]),r}},8875:function(e){!function(t){const a="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${a}\\.${a}\\.${a}\\.${a}$`,"i"),threeOctet:new RegExp(`^${a}\\.${a}\\.${a}$`,"i"),twoOctet:new RegExp(`^${a}\\.${a}$`,"i"),longValue:new RegExp(`^${a}$`,"i")},r=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${a}\\.${a}\\.${a}\\.${a}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${a}\\.${a}\\.${a}\\.${a}(${o})?$`,"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let a,n,r=0,i=-1,o=(e.match(p.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)r++;if("::"===e.substr(0,2)&&r--,"::"===e.substr(-2,2)&&r--,r>t)return null;for(n=t-r,a=":";n--;)a+="0:";return":"===(e=e.replace("::",a))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),t=function(){const t=e.split(":"),a=[];for(let e=0;e<t.length;e++)a.push(parseInt(t[e],16));return a}(),{parts:t,zoneId:o}}function d(e,t,a,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let r,i=0;for(;n>0;){if(r=a-n,r<0&&(r=0),e[i]>>r!==t[i]>>r)return!1;n-=a,i+=1}return!0}function u(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(r.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function c(e,t){for(;e.length<t;)e=`0${e}`;return e}const m={};m.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,a;for(t=0;t<e.length;t++)if(a=e[t],!(0<=a&&a<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let a;if(void 0===t&&(a=e,e=a[0],t=a[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return d(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const a={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,r,i;for(n=3;n>=0;n-=1){if(r=this.octets[n],!(r in a))return null;if(i=a[r],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return m.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),m.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),a=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[];let i=0;for(;i<4;)r.push(parseInt(a[i],10)|255^parseInt(n[i],10)),i++;return new this(r)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.isIPv4=function(e){return null!==this.parser(e)},m.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},m.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},m.IPv4.isValidFourPartDecimal=function(e){return!(!m.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},m.IPv4.isValidCIDRFourPartDecimal=function(e){const t=e.match(/^(.+)\/(\d+)$/);return!(!m.IPv4.isValidCIDR(e)||!t)&&m.IPv4.isValidFourPartDecimal(t[1])},m.IPv4.networkAddressFromCIDR=function(e){let t,a,n,r,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[],a=0;a<4;)r.push(parseInt(n[a],10)&parseInt(i[a],10)),a++;return new this(r)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},m.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const a=[this.parse(t[1]),e];return Object.defineProperty(a,"toString",{value:function(){return this.join("/")}}),a}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},m.IPv4.parser=function(e){let t,a,r;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t<e.length;t++)a=e[t],n.push(u(a));return n}();if(t=e.match(n.longValue)){if(r=u(t[1]),r>4294967295||r<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(r>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),a=[];if(r=u(e[1]),r>16777215||r<0)throw new Error("ipaddr: address outside defined range");return a.push(u(e[0])),a.push(r>>16&255),a.push(r>>8&255),a.push(255&r),a}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),a=[];if(r=u(e[2]),r>65535||r<0)throw new Error("ipaddr: address outside defined range");return a.push(u(e[0])),a.push(u(e[1])),a.push(r>>8&255),a.push(255&r),a}():null},m.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let a=0;const n=Math.floor(e/8);for(;a<n;)t[a]=255,a++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},m.IPv6=function(){function e(e,t){let a,n;if(16===e.length)for(this.parts=[],a=0;a<=14;a+=2)this.parts.push(e[a]<<8|e[a+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(a=0;a<this.parts.length;a++)if(n=this.parts[a],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let a;if(void 0===t&&(a=e,e=a[0],t=a[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return d(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const a={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,r;for(let i=7;i>=0;i-=1){if(n=this.parts[i],!(n in a))return null;if(r=a[n],t&&0!==r)return null;16!==r&&(t=!0),e+=r}return 128-e},e.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],a=this.parts;for(let n=0;n<a.length;n++)e=a[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(c(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],a=e[1];return new m.IPv4([t>>8,255&t,a>>8,255&a])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let a,n=0,r=-1;for(;a=e.exec(t);)a[0].length>r&&(n=a.index,r=a[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),m.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),a=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[];let i=0;for(;i<16;)r.push(parseInt(a[i],10)|255^parseInt(n[i],10)),i++;return new this(r)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},m.IPv6.isIPv6=function(e){return null!==this.parser(e)},m.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},m.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},m.IPv6.networkAddressFromCIDR=function(e){let t,a,n,r,i;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),r=[],a=0;a<16;)r.push(parseInt(n[a],10)&parseInt(i[a],10)),a++;return new this(r)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},m.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},m.IPv6.parseCIDR=function(e){let t,a,n;if((a=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(a[2]),t>=0&&t<=128))return n=[this.parse(a[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},m.IPv6.parser=function(e){let t,a,n,r,i,o;if(n=e.match(p.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(p.native.test(e))return l(e,8);if((n=e.match(p.transitional))&&(o=n[6]||"",t=n[1],n[1].endsWith("::")||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(i=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],a=0;a<i.length;a++)if(r=i[a],!(0<=r&&r<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},m.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let a=0;const n=Math.floor(e/8);for(;a<n;)t[a]=255,a++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},m.fromByteArray=function(e){const t=e.length;if(4===t)return new m.IPv4(e);if(16===t)return new m.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},m.isValid=function(e){return m.IPv6.isValid(e)||m.IPv4.isValid(e)},m.isValidCIDR=function(e){return m.IPv6.isValidCIDR(e)||m.IPv4.isValidCIDR(e)},m.parse=function(e){if(m.IPv6.isValid(e))return m.IPv6.parse(e);if(m.IPv4.isValid(e))return m.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},m.parseCIDR=function(e){try{return m.IPv6.parseCIDR(e)}catch(t){try{return m.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},m.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},m.subnetMatch=function(e,t,a){let n,r,i,o;for(r in null==a&&(a="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,r))for(i=t[r],!i[0]||i[0]instanceof Array||(i=[i]),n=0;n<i.length;n++)if(o=i[n],e.kind()===o[0].kind()&&e.match.apply(e,o))return r;return a},e.exports?e.exports=m:t.ipaddr=m}(this)},8897:e=>{e.exports=JSON.parse('{"name":"math","description":null,"description_zh_TW":null,"description_ja_JP":null,"commands":{"MATH_ABS":{"name":"Abs","description":"Abs","description_zh_TW":"絕對值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_ADD":{"name":"Add","description":"Add","description_zh_TW":"兩數相加","arg":[{"name":"augend","type":"number","subType":false,"defaultValue":"0"},{"name":"addend","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_CEIL":{"name":"Ceil","description":"Ceil","description_zh_TW":"取得無條件進位值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_DIVIDE":{"name":"Divide","description":"Divide (Return integer if precision is 0)","description_zh_TW":"兩數相除 (如果 precision 為 0 則會回傳整數值)","arg":[{"name":"dividend","type":"number","subType":false,"defaultValue":"0"},{"name":"divisor","type":"number","subType":false,"defaultValue":"1"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_EQUAL":{"name":"Equal","description":"Alias of LOGICTYPE_EQUAL_VALUE","description_zh_TW":"LOGICTYPE_EQUAL_VALUE 別名","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"MATH_EQUATION":{"name":"Run equation","description":"Use string to write math functions, and use object as variables. (You can use OBJECT_DEFAULTS to make object)","description_zh_TW":"使用字串撰寫數學函數,並可使用物件作為傳入參數, 函數計算時會以物件的 Key 作為參數的名稱,帶入對應的參數至公式中計算結果(傳入參數物件可使用 OBJECT_DEFAULTS 製作)","arg":[{"name":"arguments","type":"object","subType":false,"defaultValue":"{}"},{"name":"equation","type":"string","subType":false}],"return":[{"name":"result","type":"number"}]},"MATH_FLOOR":{"name":"Floor","description":"Floor number","description_zh_TW":"無條件捨去","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_GCD":{"name":"GCD","description":"GCD","description_zh_TW":"最大公因數","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_IS_NEGATIVE":{"name":"Is Negative","description":"Is negative","description_zh_TW":"是否為負數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_POSITIVE":{"name":"Is Positive","description":"Is positive","description_zh_TW":"是否為正數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_PRIME":{"name":"Is Prime","description":"Is prime","description_zh_TW":"是否為質數","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_IS_ZERO":{"name":"Is zero","description":"Is zero","description_zh_TW":"是否為零","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"MATH_LARGER":{"name":"Larger","description":"Larger","description_zh_TW":"大於","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_LARGER_AND_EQUAL":{"name":"Larger and Equal","description":"Larger and Equal","description_zh_TW":"大於等於","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_LCM":{"name":"LCM","description":"LCM","description_zh_TW":"最小公倍數","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_MAX":{"name":"Max","description":"Get max value in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的最大值 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MEAN":{"name":"Mean","description":"Get average value in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的平均值 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MIN":{"name":"Min","description":"Get min in array of number (ignore non-numeric value)","description_zh_TW":"傳入的陣列中若有非數字元素,會被直接忽略","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_MOD":{"name":"Mod","description":"Mod","description_zh_TW":"餘數","arg":[{"name":"dividend","type":"number","subType":false,"defaultValue":"0"},{"name":"divisor","type":"number","subType":false,"defaultValue":"1"}],"return":[{"name":"result","type":"number"}]},"MATH_MULTIPLY":{"name":"Multiply","description":"Multiply","description_zh_TW":"兩數相乘","arg":[{"name":"multiplier","type":"number","subType":false,"defaultValue":"1"},{"name":"multiplicand","type":"number","subType":false,"defaultValue":"1"}],"return":[{"name":"result","type":"number"}]},"MATH_NOT_EQUAL":{"name":"Not Equal","description":"Not equal","description_zh_TW":"不等於","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"MATH_NTH_ROOT":{"name":"Root","description":"Root","description_zh_TW":"開方根","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"root","type":"integer","subType":false,"defaultValue":"2"}],"return":[{"name":"result","type":"number"}]},"MATH_POW":{"name":"Pow","description":"Pow","description_zh_TW":"次方","arg":[{"name":"base","type":"number","subType":false,"defaultValue":"0"},{"name":"exponent","type":"integer","subType":false,"defaultValue":"2"}],"return":[{"name":"result","type":"number"}]},"MATH_RANDOM":{"name":"Random","description":"Get a random number","description_zh_TW":"取得亂數值","arg":[{"name":"trigger","type":"any","subType":false,"defaultValue":"undefined"},{"name":"lower","type":"number","subType":false,"defaultValue":"0"},{"name":"upper","type":"number","subType":false,"defaultValue":"1"},{"name":"floating","type":"bool","subType":false,"defaultValue":"true"}],"return":[{"name":"result","type":"number"}]},"MATH_ROUND":{"name":"Round","description":"Round number","description_zh_TW":"取得四捨五入值","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"},{"name":"precision","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SIGN":{"name":"Sign","description":"Sign number","description_zh_TW":"取得正負數","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SMALLER":{"name":"Smaller","description":"Result = x < y","description_zh_TW":"小於 (Result = x < y)","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_SMALLER_AND_EQUAL":{"name":"Smaller And Equal","description":"Result = x <= y","description_zh_TW":"小於等於 (Result = x <= y)","arg":[{"name":"x","type":"number","subType":false,"defaultValue":"0"},{"name":"y","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"bool"}]},"MATH_SUBTRACT":{"name":"Substract","description":"Substract","description_zh_TW":"兩數相減","arg":[{"name":"minuend","type":"number","subType":false,"defaultValue":"0"},{"name":"subtrahend","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_SUM":{"name":"Sum","description":"Get sum in array of number (ignore non-numeric value)","description_zh_TW":"取得數字陣列中的總和 (傳入的陣列中若有非數字元素,會被直接忽略)","arg":[{"name":"number_list","type":"array","subType":"number","defaultValue":"[]"}],"return":[{"name":"result","type":"number"}]},"MATH_UNARY_MINUS":{"name":"Unary minus","description":"Unary minus (Result = value * -1)","description_zh_TW":"反向負數 (Result = value * -1)","arg":[{"name":"value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"MATH_UNARY_PLUS":{"name":"Unary plus","description":"Unary plus","description_zh_TW":"數值化","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]}}}')},8904:e=>{e.exports=JSON.parse('{"name":"BrickWebRTCStream","brickDescription":{"default":"Brick WebRTC stream viewer component","en-us":"WebRTCStream brick","zh-tw":"WebRTC 串流方塊","ja-jp":"WebRTCストリームブリック"},"brickDisplayName":"WebRTC Stream","brickTip":{"default":"@brick-tip-webrtc-stream","en-us":"Add WebRTC Stream Viewer (Control by WebRTC Generator and Event)","zh-tw":"WebRTC 顯示畫面元件,需搭配 WebRTC Generator 及事件做控制","ja-jp":"WebRTC ストリームビューアを追加(WebRTC ジェネレーターとイベントによる制御)"},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"video"},"propTypes":{"mirror":{"type":"bool"},"resizeMode":{"type":"oneOf","content":["contain","cover"],"forcePropertyBank":false},"noStreamViewText":{"type":"string"},"noStreamViewTextSize":{"type":"number"},"noStreamViewTextColor":{"type":"string"}},"brickPropDescriptions":{"mirror":{"default":"","en-us":"Mirror video","zh-tw":"鏡像影像","ja-jp":"ミラービデオ"},"resizeMode":{"default":"","en-us":"The stream resize mode","zh-tw":"串流呈現模式","ja-jp":"ストリームのリサイズモード"},"noStreamViewText":{"default":"","en-us":"Show text content if no stream","zh-tw":"如果沒有串流,則顯示文字","ja-jp":"ストリームがない場合にテキストを表示"},"noStreamViewTextSize":{"default":"","en-us":"The font size of shown text content if no stream","zh-tw":"如果沒有串流,則顯示的文字大小","ja-jp":"ストリームがない場合に表示されるテキストのフォントサイズ"},"noStreamViewTextColor":{"default":"","en-us":"The color of shown text content if no stream","zh-tw":"如果沒有串流,則顯示的文字顏色","ja-jp":"ストリームがない場合に表示されるテキストの色"}},"defaultBrickProps":{"mirror":false,"resizeMode":"contain","noStreamViewText":"no stream","noStreamViewTextSize":44,"noStreamViewTextColor":"#000"},"propertyControls":{"noStreamViewTextSize":{"kind":"unit","min":1},"noStreamViewTextColor":{"kind":"color","placeholder":"#000"}},"propertyControlGroups":{"noStreamView":{"name":"No Stream View Cases","type":"prefix","content":"noStreamView"}},"propertyControlGroupDescriptions":{}}')},8907:(e,t,a)=>{a.d(t,{A_:()=>p,D$:()=>E,Ii:()=>u,J:()=>d,Kc:()=>l,MB:()=>_,WU:()=>s,dt:()=>y,kd:()=>T,o5:()=>f,ue:()=>h});var n=a(9212),r=a(1777),i=a(2904),o=a(4214);function s(e){return{__ref:String(e)}}function p(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function l(e){return(0,r.U)(e)&&"Document"===e.kind&&Array.isArray(e.definitions)}function d(e,t,a,r){if(function(e){return"IntValue"===e.kind}(a)||function(e){return"FloatValue"===e.kind}(a))e[t.value]=Number(a.value);else if(function(e){return"BooleanValue"===e.kind}(a)||function(e){return"StringValue"===e.kind}(a))e[t.value]=a.value;else if(function(e){return"ObjectValue"===e.kind}(a)){var i={};a.fields.map(function(e){return d(i,e.name,e.value,r)}),e[t.value]=i}else if(function(e){return"Variable"===e.kind}(a)){var o=(r||{})[a.name.value];e[t.value]=o}else if(function(e){return"ListValue"===e.kind}(a))e[t.value]=a.values.map(function(e){var a={};return d(a,t,e,r),a[t.value]});else if(function(e){return"EnumValue"===e.kind}(a))e[t.value]=a.value;else{if(!function(e){return"NullValue"===e.kind}(a))throw(0,n.newInvariantError)(96,t.value,a.kind);e[t.value]=null}}function u(e,t){var a=null;e.directives&&(a={},e.directives.forEach(function(e){a[e.name.value]={},e.arguments&&e.arguments.forEach(function(n){var r=n.name,i=n.value;return d(a[e.name.value],r,i,t)})}));var n=null;return e.arguments&&e.arguments.length&&(n={},e.arguments.forEach(function(e){var a=e.name,r=e.value;return d(n,a,r,t)})),f(e.name.value,n,a)}var c=["connection","include","skip","client","rest","export","nonreactive"],m=o.M,f=Object.assign(function(e,t,a){if(t&&a&&a.connection&&a.connection.key){if(a.connection.filter&&a.connection.filter.length>0){var n=a.connection.filter?a.connection.filter:[];n.sort();var r={};return n.forEach(function(e){r[e]=t[e]}),"".concat(a.connection.key,"(").concat(m(r),")")}return a.connection.key}var i=e;if(t){var o=m(t);i+="(".concat(o,")")}return a&&Object.keys(a).forEach(function(e){-1===c.indexOf(e)&&(a[e]&&Object.keys(a[e]).length?i+="@".concat(e,"(").concat(m(a[e]),")"):i+="@".concat(e))}),i},{setStringify:function(e){var t=m;return m=e,t}});function _(e,t){if(e.arguments&&e.arguments.length){var a={};return e.arguments.forEach(function(e){var n=e.name,r=e.value;return d(a,n,r,t)}),a}return null}function h(e){return e.alias?e.alias.value:e.name.value}function E(e,t,a){for(var n,r=0,o=t.selections;r<o.length;r++){if(y(l=o[r])){if("__typename"===l.name.value)return e[h(l)]}else n?n.push(l):n=[l]}if("string"==typeof e.__typename)return e.__typename;if(n)for(var s=0,p=n;s<p.length;s++){var l=p[s],d=E(e,(0,i.HQ)(l,a).selectionSet,a);if("string"==typeof d)return d}}function y(e){return"Field"===e.kind}function T(e){return"InlineFragment"===e.kind}},8925:(e,t)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(a||(t.DiscrError=a={}))},8931:(e,t,a)=>{var n=a(3501);e.exports=function(e,t,a){var r=e.length;return a=void 0===a?r:a,!t&&a>=r?e:n(e,t,a)}},8942:(e,t,a)=>{var n=a(4967),r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")();e.exports=i},9003:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=a(383),r=a(4758),i=a(9409),o=a(7898),s=a(458);var p;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(p||(t.DataType=p={})),t.getSchemaTypes=function(e){const t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=l,t.coerceAndCheckDataType=function(e,t){const{gen:a,data:n,opts:i}=e,s=function(e,t){return t?e.filter(e=>d.has(e)||"array"===t&&"array"===e):[]}(t,i.coerceTypes),l=t.length>0&&!(0===s.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(l){const r=c(t,n,i.strictNumbers,p.Wrong);a.if(r,()=>{s.length?function(e,t,a){const{gen:n,data:r,opts:i}=e,s=n.let("dataType",o._`typeof ${r}`),p=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${s} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>n.assign(r,o._`${r}[0]`).assign(s,o._`typeof ${r}`).if(c(t,r,i.strictNumbers),()=>n.assign(p,r)));n.if(o._`${p} !== undefined`);for(const e of a)(d.has(e)||"array"===e&&"array"===i.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void n.elseIf(o._`${s} == "number" || ${s} == "boolean"`).assign(p,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(p,o._`""`);case"number":return void n.elseIf(o._`${s} == "boolean" || ${r} === null
|
|
652
652
|
|| (${s} == "string" && ${r} && ${r} == +${r})`).assign(p,o._`+${r}`);case"integer":return void n.elseIf(o._`${s} === "boolean" || ${r} === null
|
|
653
653
|
|| (${s} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(p,o._`+${r}`);case"boolean":return void n.elseIf(o._`${r} === "false" || ${r} === 0 || ${r} === null`).assign(p,!1).elseIf(o._`${r} === "true" || ${r} === 1`).assign(p,!0);case"null":return n.elseIf(o._`${r} === "" || ${r} === 0 || ${r} === false`),void n.assign(p,null);case"array":n.elseIf(o._`${s} === "string" || ${s} === "number"
|
|
654
654
|
|| ${s} === "boolean" || ${r} === null`).assign(p,o._`[${r}]`)}}n.else(),f(e),n.endIf(),n.if(o._`${p} !== undefined`,()=>{n.assign(r,p),function({gen:e,parentData:t,parentDataProperty:a},n){e.if(o._`${t} !== undefined`,()=>e.assign(o._`${t}[${a}]`,n))}(e,p)})}(e,t,s):f(e)})}return l};const d=new Set(["string","number","integer","boolean","null"]);function u(e,t,a,n=p.Correct){const r=n===p.Correct?o.operators.EQ:o.operators.NEQ;let i;switch(e){case"null":return o._`${t} ${r} null`;case"array":i=o._`Array.isArray(${t})`;break;case"object":i=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return o._`typeof ${t} ${r} ${e}`}return n===p.Correct?i:(0,o.not)(i);function s(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,a?o._`isFinite(${t})`:o.nil)}}function c(e,t,a,n){if(1===e.length)return u(e[0],t,a,n);let r;const i=(0,s.toHash)(e);if(i.array&&i.object){const e=o._`typeof ${t} != "object"`;r=i.null?e:o._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else r=o.nil;i.number&&delete i.integer;for(const e in i)r=(0,o.and)(r,u(e,t,a,n));return r}t.checkDataType=u,t.checkDataTypes=c;const m={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function f(e){const t=function(e){const{gen:t,data:a,schema:n}=e,r=(0,s.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:a,schema:n.type,schemaCode:r,schemaValue:r,parentSchema:n,params:{},it:e}}(e);(0,i.reportError)(t,m)}t.reportTypeError=f},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9011:(e,t,a)=>{var n=a(8250);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(r.Cache||n),a}r.Cache=n,e.exports=r},9041:e=>{e.exports=JSON.parse('{"name":"GeneratorReranker","brickDescription":{"default":"Reranker (GGML)","en-us":"Local rerank based on GGML and [llama.cpp](https://github.com/ggerganov/llama.cpp) \\n\\n ## Notice \\n - The device RAM must be larger than 8GB \\n - iOS: Recommended use M1+ / A17+ chip device. Supported GPU acceleration by Metal. \\n - macOS: Recommended use M1+ chip device. Supported GPU acceleration by Metal. \\n - Android: Recommended use Android 13+ system. \\n - Supported GPU acceleration by OpenCL, currently only for Qualcomm Adreno 700+ GPUs, other GPUs are not supported. \\n - Supported Hexagon NPU for Qualcomm Snapdragon 8 Gen 2+ GPUs. \\n - Linux / Windows \\n - Supported GPU acceleration, you can choose `vulkan` or `cuda` backend in Accel Variant property \\n - Supported Hexagon NPU for Qualcomm Dragonwing IQ9 series+ (Linux)","zh-tw":"基於 GGML 和 [llama.cpp](https://github.com/ggerganov/llama.cpp) 的本地重排序 \\n\\n ## 注意事項 \\n - 設備 RAM 必須大於 8GB \\n - iOS: 建議使用 M1+ / A17+ 晶片的設備。支援 GPU 加速 by Metal. \\n - macOS: 建議使用 M1+ 晶片的設備。支援 GPU 加速 by Metal. \\n - Android: 建議使用 Android 13+ 系統。 \\n - 支援透過 OpenCL 進行 GPU 加速,目前僅支援 Qualcomm Adreno 700+ 的 GPU,其他 GPU 不支援。 \\n - 支援 Qualcomm Snapdragon 8 Gen 2+ 的 Hexagon NPU。 \\n - Linux / Windows \\n - 支援 GPU 加速,您可以在 Accel Variant 屬性中選擇 `vulkan` 或 `cuda` 後端 \\n - 支援 Qualcomm Dragonwing IQ9 系列+ 的 Hexagon NPU (Linux)","ja-jp":"GGML と [llama.cpp](https://github.com/ggerganov/llama.cpp) をベースにしたローカルリランキング \\n\\n ## 注意事項 \\n - デバイスの RAM は 8GB 以上である必要があります \\n - iOS: M1+ / A17+ チップのデバイスを推奨。Metal による GPU 加速をサポート。 \\n - macOS: M1+ チップのデバイスを推奨。Metal による GPU 加速をサポート。 \\n - Android: Android 13+ システムを推奨。 \\n - OpenCL による GPU 加速をサポート、現在 Qualcomm Adreno 700+ の GPU のみサポート、他の GPU はサポートされていません。 \\n - Qualcomm Snapdragon 8 Gen 2+ の Hexagon NPU をサポート。 \\n - Linux / Windows \\n - GPU 加速をサポート、Accel Variant プロパティで `vulkan` または `cuda` バックエンドを選択できます \\n - Qualcomm Dragonwing IQ9 シリーズ+ の Hexagon NPU をサポート (Linux)"},"brickDisplayName":"Reranker (GGML)","brickTip":{"default":""},"brickMeta":{"preview":true,"scriptMember":true},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"ranking-star"},"propTypes":{"init":{"type":"bool"},"modelUrl":{"type":"string"},"modelHash":{"type":"string"},"modelHashType":{"type":"oneOf","content":["md5","sha256","sha1"],"forcePropertyBank":false},"contextSize":{"type":"number"},"batchSize":{"type":"number"},"uBatchSize":{"type":"number"},"accelVariant":{"type":"oneOf","content":["default","vulkan","cuda","snapdragon"],"forcePropertyBank":false},"devices":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"mainGpu":{"type":"number"},"gpuLayers":{"type":"number"},"maxThreads":{"type":"number"},"useMlock":{"type":"bool"},"useMmap":{"type":"bool"},"query":{"type":"string"},"documents":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"normalize":{"type":"oneOfType","content":[{"type":"number"},{"type":"bool"}],"forcePropertyBank":false},"topK":{"type":"number"}},"brickPropDescriptions":{"init":{"default":"","en-us":"Initialize the Reranker context on generator initialization","zh-tw":"在生成器初始化時初始化重排序上下文","ja-jp":"ジェネレーター初期化時にリランカーコンテキストを初期化する"},"modelUrl":{"default":"Model Configuration","en-us":"The URL or path of reranker model (GGUF format)","zh-tw":"重排序模型的 URL 或路径(GGUF 格式)","ja-jp":"リランカーモデルのURLまたはパス(GGUF形式)"},"modelHash":{"default":"","en-us":"Hash of reranker model","zh-tw":"重排序模型的哈希值","ja-jp":"リランカーモデルのハッシュ"},"modelHashType":{"default":"","en-us":"Hash type of reranker model","zh-tw":"重排序模型的哈希类型","ja-jp":"リランカーモデルのハッシュタイプ"},"contextSize":{"default":"Context Parameters","en-us":"Context size (0 ~ 4096) (Default to 512)","zh-tw":"上下文大小(0 ~ 4096)(默认为 512)","ja-jp":"コンテキストサイズ(0 ~ 4096)(デフォルト:512)"},"batchSize":{"default":"","en-us":"Logical batch size for processing (default: 512)","zh-tw":"处理的逻辑批次大小(默认:512)","ja-jp":"処理のための論理バッチサイズ(デフォルト:512)"},"uBatchSize":{"default":"","en-us":"Physical maximum batch size (default: 512)","zh-tw":"物理最大批次大小(默认:512)","ja-jp":"物理的な最大バッチサイズ(デフォルト:512)"},"accelVariant":{"default":"Hardware Acceleration","en-us":"GGML accelerator variant (Only for desktop) \\n `default` - CPU / Metal (macOS) \\n `vulkan` - Use Vulkan \\n `cuda` - Use CUDA \\n `snapdragon` - Use OpenCL/Hexagon of Qualcomm Snapdragon","zh-tw":"加速器變體 (僅適用於桌面版) \\n `default` - 使用 CPU / Metal (macOS) \\n `vulkan` - 使用 Vulkan \\n `cuda` - 使用 CUDA \\n `snapdragon` - 使用 OpenCL/Hexagon of Qualcomm Snapdragon","ja-jp":"アクセラレータのバリアント(デスクトップのみ) \\n `default` - CPU / Metal (macOS) \\n `vulkan` - Vulkan を使用 \\n `cuda` - CUDA を使用 \\n `snapdragon` - OpenCL/Hexagon of Qualcomm Snapdragon を使用"},"devices":{"default":"","en-us":"Devices. For example: \\n \\n Metal or CPU for iOS/tvOS/MacOS \\n OpenCL or CPU for Android \\n - Add `HTP0`, `HTP1`, `...` for OpenCL/Hexagon devices (Use HTP* for all HTP devices) \\n For Desktop, you may want to include/exclude GPUs","zh-tw":"裝置。例如: \\n \\n iOS/tvOS/MacOS 使用 Metal 或 CPU \\n Android 使用 OpenCL、CPU \\n - 對於 OpenCL/Hexagon 裝置可新增 `HTP0`、`HTP1`、`...`(使用 HTP* 代表所有 HTP 裝置) \\n 對於桌面版,您可能想要包含/排除 GPU","ja-jp":"デバイス。例: \\n \\n iOS/tvOS/MacOS の場合:Metal また CPU \\n Android の場合:OpenCL、CPU \\n - OpenCL/Hexagon デバイスの場合、`HTP0`、`HTP1`、`...` を追加します(すべての HTP デバイスには HTP* を使用) \\n デスクトップの場合、GPU を含める/除外することができます"},"mainGpu":{"default":"","en-us":"Main GPU index (default: 0)","zh-tw":"主 GPU 索引(默认:0)","ja-jp":"メインGPUインデックス(デフォルト:0)"},"gpuLayers":{"default":"","en-us":"Number of layers to store in VRAM (default: 0)","zh-tw":"存储在 VRAM 中的层数(默认:0)","ja-jp":"VRAMに格納するレイヤー数(デフォルト:0)"},"maxThreads":{"default":"","en-us":"Maximum number of threads to use (default: auto)","zh-tw":"使用的最大线程数(默认:自动)","ja-jp":"使用する最大スレッド数(デフォルト:自動)"},"useMlock":{"default":"Memory Settings","en-us":"Use mlock to keep model in memory (default: true)","zh-tw":"使用 mlock 将模型保持在内存中(默认:true)","ja-jp":"モデルをメモリに保持するためにmlockを使用(デフォルト:true)"},"useMmap":{"default":"","en-us":"Use mmap for model loading (default: true)","zh-tw":"使用 mmap 加载模型(默认:true)","ja-jp":"モデル読み込みにmmapを使用(デフォルト:true)"},"query":{"default":"Reranking Parameters","en-us":"Query text for reranking","zh-tw":"重排序的查询文本","ja-jp":"リランキング用のクエリテキスト"},"documents":{"default":"","en-us":"Array of documents to rerank","zh-tw":"要重排序的文档数组","ja-jp":"リランキングする文書の配列"},"normalize":{"default":"","en-us":"Normalize reranking scores (default: from model config)","zh-tw":"标准化重排序分数(默认:来自模型配置)","ja-jp":"リランキングスコアを正規化(デフォルト:モデル設定から)"},"topK":{"default":"","en-us":"Maximum number of documents to return (default: unlimited)","zh-tw":"返回的最大文档数(默认:无限制)","ja-jp":"返す文書の最大数(デフォルト:無制限)"}},"propertyControls":{"modelUrl":{"kind":"gguf-model-asset","displayName":"URL","normalizeDisplayName":false,"validator":{"fn":"uri","protocols":["https?","file"]},"fields":{"hashType":"modelHashType","hash":"modelHash"},"mediaFields":{"metadata":"_modelMediaMetadata"},"resetPropertiesOnChange":["modelHash"]},"modelHash":{"displayName":"Hash","normalizeDisplayName":false},"modelHashType":{"displayName":"Hash Type","normalizeDisplayName":false,"oneOfEmptyOption":false},"accelVariant":{"displayName":"Accelerator Variant","normalizeDisplayName":false},"mainGpu":{"displayName":"Main GPU","normalizeDisplayName":false},"gpuLayers":{"displayName":"GPU Layers","normalizeDisplayName":false},"maxThreads":{"displayName":"Max Threads","normalizeDisplayName":false},"useMlock":{"displayName":"Use mlock","normalizeDisplayName":false},"useMmap":{"displayName":"Use mmap","normalizeDisplayName":false},"query":{"displayName":"Query","normalizeDisplayName":false,"multiline":true},"documents":{"displayName":"Documents","normalizeDisplayName":false,"kind":"arrayOf","itemKind":"string"},"normalize":{"displayName":"Normalize Scores","normalizeDisplayName":false},"topK":{"displayName":"Top K","normalizeDisplayName":false}},"defaultBrickProps":{"init":false,"contextSize":512,"batchSize":512,"uBatchSize":512,"accelVariant":"default","mainGpu":0,"gpuLayers":0,"useMlock":true,"useMmap":true,"normalize":1},"propertyControlGroups":{"model":{"name":"Model Parameters","type":"group","content":["modelUrl","modelHash","modelHashType"]},"context":{"name":"Context Parameters","type":"group","content":["contextSize","batchSize","uBatchSize"]},"hardware":{"name":"Hardware Acceleration","type":"group","content":["accelVariant","mainGpu","gpuLayers","maxThreads"]},"memory":{"name":"Memory Settings","type":"group","content":["useMlock","useMmap"]},"reranking":{"name":"Reranking Parameters","type":"group","content":["query","documents","normalize","topK"]}},"propertyControlGroupDescriptions":{},"eventTypes":{"GENERATOR_RERANKER_ON_CONTEXT_STATE_CHANGE":"GENERATOR_RERANKER_ON_CONTEXT_STATE_CHANGE","GENERATOR_RERANKER_ON_ERROR":"GENERATOR_RERANKER_ON_ERROR"},"brickEventDescriptions":{"GENERATOR_RERANKER_ON_CONTEXT_STATE_CHANGE":{"default":"","en-us":"Event triggered when the reranker context state changes (loading, ready, error, released)","zh-tw":"當重排序上下文狀態變更時觸發的事件(加載中、就緒、錯誤、已釋放)","ja-jp":"リランカーコンテキストの状態が変更されたときにトリガーされるイベント(読み込み中、準備完了、エラー、解放済み)"},"GENERATOR_RERANKER_ON_ERROR":{"default":"","en-us":"Event triggered when an error occurs during reranker operations","zh-tw":"在重排序操作過程中發生錯誤時觸發的事件","ja-jp":"リランカー操作中にエラーが発生したときにトリガーされるイベント"}},"eventPropertyControls":{"GENERATOR_RERANKER_ON_CONTEXT_STATE_CHANGE":{"properties":{"GENERATOR_RERANKER_CONTEXT_STATE":{"name":"Context State","type":"string"},"GENERATOR_RERANKER_CONTEXT_DETAILS":{"name":"Context Details","type":"object"}}},"GENERATOR_RERANKER_ON_ERROR":{"properties":{"GENERATOR_RERANKER_ERROR":{"name":"Error","type":"string"}}}},"outletTypes":{"GENERATOR_RERANKER_CONTEXT_STATE":{"outlet":"GENERATOR_RERANKER_CONTEXT_STATE","type":"string"},"GENERATOR_RERANKER_CONTEXT_LOAD_PROGRESS":{"outlet":"GENERATOR_RERANKER_CONTEXT_LOAD_PROGRESS","type":"number"},"GENERATOR_RERANKER_CONTEXT_DETAILS":{"outlet":"GENERATOR_RERANKER_CONTEXT_DETAILS","type":"object"},"GENERATOR_RERANKER_RERANK_RESULT":{"outlet":"GENERATOR_RERANKER_RERANK_RESULT","type":"array"},"GENERATOR_RERANKER_IS_PROCESSING":{"outlet":"GENERATOR_RERANKER_IS_PROCESSING","type":"bool"}},"brickOutletDescriptions":{"GENERATOR_RERANKER_CONTEXT_STATE":{"default":"","en-us":"Current state of the reranker context (loading, ready, error, released)","zh-tw":"重排序上下文的當前狀態(加載中、就緒、錯誤、已釋放)","ja-jp":"リランカーコンテキストの現在の状態(読み込み中、準備完了、エラー、解放済み)"},"GENERATOR_RERANKER_CONTEXT_LOAD_PROGRESS":{"default":"","en-us":"Loading progress of the reranker model (0-100)","zh-tw":"重排序模型的加載進度(0-100)","ja-jp":"リランカーモデルの読み込み進捗(0-100)"},"GENERATOR_RERANKER_CONTEXT_DETAILS":{"default":"","en-us":"Detailed information about the reranker context including instance ID and processing status","zh-tw":"關於重排序上下文的詳細信息,包括實例ID和處理狀態","ja-jp":"インスタンスIDと処理状況を含むリランカーコンテキストの詳細情報"},"GENERATOR_RERANKER_RERANK_RESULT":{"default":"","en-us":"Result of the reranking operation containing scored and ranked documents","zh-tw":"包含評分和排序文檔的重排序操作結果","ja-jp":"スコア付きおよびランク付きドキュメントを含むリランキング操作の結果"},"GENERATOR_RERANKER_IS_PROCESSING":{"default":"","en-us":"Boolean indicating whether the reranker is currently processing a request","zh-tw":"表示重排序器是否正在處理請求的布爾值","ja-jp":"リランカーが現在リクエストを処理中かどうかを示すブール値"}},"actionTypes":{"GENERATOR_RERANKER_LOAD_MODEL":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_RERANKER_RERANK":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_RERANKER_QUERY":{"name":"Query","type":"string"},"GENERATOR_RERANKER_DOCUMENTS":{"name":"Documents","type":"array"}}},"GENERATOR_RERANKER_RELEASE_CONTEXT":{"disallowMultiple":true,"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_RERANKER_LOAD_MODEL":{"default":"","en-us":"Load the model","zh-tw":"讀取模型","ja-jp":"モデルを読み込む"},"GENERATOR_RERANKER_RERANK":{"default":"","en-us":"Rerank documents based on query relevance","zh-tw":"根據查詢相關性重新排序文件","ja-jp":"クエリの関連性に基づいてドキュメントを再ランキング"},"GENERATOR_RERANKER_RELEASE_CONTEXT":{"default":"","en-us":"Release context","zh-tw":"釋放上下文","ja-jp":"コンテキストを解放する"}},"scriptMemberFunctionDefs":{"load":{"arguments":[],"required":[],"return":{"type":"bool"}},"getModelInfo":{"arguments":[],"required":[],"return":{"type":"object"}},"rerank":{"arguments":[{"type":"object","name":"params","properties":{"query":{"name":"Query","type":"string"},"documents":{"name":"Documents","type":"array"},"normalize":{"name":"Normalize Scores","type":"number"},"topK":{"name":"Top K","type":"number"}}}],"required":["params"],"return":{"type":"array"}},"isProcessing":{"arguments":[],"required":[],"return":{"type":"bool"}},"release":{"arguments":[],"required":[],"return":{"type":"bool"}}},"scriptMemberFunctionDefDescriptions":{"load":{"default":"","en-us":"Load reranker model","zh-tw":"讀取重排序模型","ja-jp":"リランカーモデルを読み込む"},"getModelInfo":{"default":"","en-us":"Get reranker model information","zh-tw":"取得重排序模型資訊","ja-jp":"リランカーモデル情報を取得"},"rerank":{"default":"","en-us":"Rerank documents based on query relevance","zh-tw":"根據查詢相關性重新排序文件","ja-jp":"クエリの関連性に基づいてドキュメントを再ランキング"},"isProcessing":{"default":"","en-us":"Check if the reranker is currently processing a request","zh-tw":"檢查重排序器是否正在處理請求","ja-jp":"リランカーが現在リクエストを処理中かどうかを確認"},"release":{"default":"","en-us":"Release the reranker context","zh-tw":"釋放重排序上下文","ja-jp":"リランカーコンテキストを解放"}}}')},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,a)=>{var n=a(4700);e.exports=function(e,t){var a=n(this,e),r=a.size;return a.set(e,t),this.size+=a.size==r?0:1,this}},9073:e=>{e.exports=JSON.parse('{"name":"GeneratorMCP","brickDescription":{"default":"Model Context Protocol (MCP) Client, support SSE and Generator MCPServer direct link","en-us":"Model Context Protocol (MCP) Client, support SSE and Generator MCPServer direct link","zh-tw":"MCP 客戶端,支援 SSE 和 Generator MCPServer 直接連接","ja-jp":"Model Context Protocol (MCP) クライアント、SSE と Generator MCPServer の直接リンクをサポート"},"brickDisplayName":"MCP","brickTip":{"default":""},"brickPreviewIcon":{"type":"material-community","name":"protocol"},"brickMeta":{"canBeGlobalGenerator":true,"scriptMember":true},"propTypes":{"globalGeneratorKey":{"type":"string"},"init":{"type":"bool"},"type":{"type":"oneOf","content":["streamable-http","sse","direct-link"],"forcePropertyBank":false},"url":{"type":"string"},"autoReconnect":{"type":"bool"},"maxReconnectAttempts":{"type":"number"},"reconnectInterval":{"type":"number"},"sseHeaders":{"type":"object"},"sendHeaders":{"type":"object"},"bearerToken":{"type":"string"},"generatorId":{"type":"string"},"generatorKey":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"},"ignoreResourceInList":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"ignoreToolInList":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"ignorePromptInList":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"requestTimeout":{"type":"number"}},"brickPropDescriptions":{"globalGeneratorKey":{"default":"","en-us":"Application-scoped generator key, key cannot be the same with other application-scoped generators","zh-tw":"應用程式範圍的 generator key,key 不能與其他應用程式範圍的 generator 相同","ja-jp":"アプリケーションスコープのジェネレーターキー、キーは他のアプリケーションスコープのジェネレーターと同じにできません"},"init":{"default":"","en-us":"Initialize the MCP client on start","zh-tw":"在啟動時初始化 MCP 客戶端","ja-jp":"起動時に MCP クライアントを初期化する"},"type":{"default":"","en-us":"Type of the MCP connection, e.g. sse or direct-link (generator)","zh-tw":"MCP 連接類型,例如 sse 或 direct-link (generator)","ja-jp":"MCP 接続のタイプ、例えば sse または direct-link (generator)"},"url":{"default":"","en-us":"URL of the MCP server, e.g. http://localhost:19853/sse","zh-tw":"MCP 伺服器的 URL,例如 http://localhost:19853/sse","ja-jp":"MCP サーバーの URL、例えば http://localhost:19853/sse"},"autoReconnect":{"default":"","en-us":"Whether to automatically reconnect to the MCP server","zh-tw":"是否自動重新連接到 MCP 伺服器","ja-jp":"MCP サーバーへの自動再接続を行うかどうか"},"maxReconnectAttempts":{"default":"","en-us":"Maximum number of reconnection attempts","zh-tw":"最大重連嘗試次數","ja-jp":"再接続の最大試行回数"},"reconnectInterval":{"default":"","en-us":"Reconnection interval in milliseconds","zh-tw":"重連間隔(毫秒)","ja-jp":"再接続間隔(ミリ秒)"},"sseHeaders":{"default":"","en-us":"SSE connection headers","zh-tw":"SSE 連線標頭","ja-jp":"SSE 接続ヘッダー"},"sendHeaders":{"default":"","en-us":"Send request headers","zh-tw":"傳送請求標頭","ja-jp":"リクエストヘッダーを送信"},"bearerToken":{"default":"","en-us":"Bearer token for authentication","zh-tw":"用於身份驗證的 Bearer 令牌","ja-jp":"認証用の Bearer トークン"},"generatorId":{"default":"","en-us":"Generator MCP Server ID for direct link","zh-tw":"Generator MCP Server ID,用於直接連接","ja-jp":"直接リンク用の Generator MCP Server ID"},"generatorKey":{"default":"","en-us":"Application-scoped key of Generator MCP Server for direct link (If ID is not provided)","zh-tw":"應用程式範圍的 Generator MCP Server key,用於直接連接(如果 ID 未提供)","ja-jp":"直接リンク用の Generator MCP Server のアプリケーションスコープキー(ID が提供されていない場合)"},"name":{"default":"","en-us":"Name of the MCP client","zh-tw":"MCP 客戶端的名稱","ja-jp":"MCP クライアントの名前"},"version":{"default":"","en-us":"Version of the MCP client","zh-tw":"MCP 客戶端的版本","ja-jp":"MCP クライアントのバージョン"},"ignoreResourceInList":{"default":"","en-us":"Ignore resources in list response","zh-tw":"忽略資源列表回應","ja-jp":"リスト応答内のリソースを無視する"},"ignoreToolInList":{"default":"","en-us":"Ignore tools in list response","zh-tw":"忽略工具列表回應","ja-jp":"リスト応答内のツールを無視する"},"ignorePromptInList":{"default":"","en-us":"Ignore prompts in list response","zh-tw":"忽略提示列表回應","ja-jp":"リスト応答内のプロンプトを無視する"},"requestTimeout":{"default":"","en-us":"Request timeout in milliseconds","zh-tw":"請求超時時間(毫秒)","ja-jp":"リクエストタイムアウト(ミリ秒)"}},"defaultBrickProps":{"init":false,"type":"streamable-http","url":"","autoReconnect":true,"maxReconnectAttempts":10,"reconnectInterval":1000,"generatorId":"","generatorKey":"","name":"bricks-foundation-mcp-client-default","version":"1.0.0","ignoreResourceInList":[],"ignoreToolInList":[],"ignorePromptInList":[],"requestTimeout":60000},"propertyControls":{"type":{"oneOfEmptyOption":false},"url":{"displayName":"URL","normalizeDisplayName":false},"sseHeaders":{"displayName":"SSE Headers","normalizeDisplayName":false},"generatorId":{"displayName":"Generator ID","normalizeDisplayName":false,"kind":"id","idType":"generator","idTypeFilter":["GENERATOR_MCP_SERVER"]}},"propertyControlGroups":{"sse":{"name":"Streamable-HTTP/SSE Config","type":"group","content":["url","sseHeaders","sendHeaders","bearerToken"]},"directLink":{"name":"Direct Link Config","type":"group","content":["generatorId","generatorKey"]},"client":{"name":"Client Config","type":"group","content":["name","version","ignoreToolInList","ignoreResourceInList","ignorePromptInList","requestTimeout"]}},"propertyControlGroupDescriptions":{"directLink":{"default":"","en-us":"Link to existing Generator MCPServer without network","zh-tw":"連接到現有的 Generator MCPServer 而不需要網路","ja-jp":"ネットワークなしで既存の Generator MCPServer に接続"}},"outletTypes":{"GENERATOR_MCP_CONNECTION_STATE":{"outlet":"GENERATOR_MCP_CONNECTION_STATE","type":"string"},"GENERATOR_MCP_LIST_RESOURCES_RESPONSE":{"outlet":"GENERATOR_MCP_LIST_RESOURCES_RESPONSE","type":"object"},"GENERATOR_MCP_LIST_RESOURCES_ERROR":{"outlet":"GENERATOR_MCP_LIST_RESOURCES_ERROR","type":"object"},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_RESPONSE":{"outlet":"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_RESPONSE","type":"object"},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_ERROR":{"outlet":"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_ERROR","type":"object"},"GENERATOR_MCP_READ_RESOURCE_RESPONSE":{"outlet":"GENERATOR_MCP_READ_RESOURCE_RESPONSE","type":"object"},"GENERATOR_MCP_READ_RESOURCE_ERROR":{"outlet":"GENERATOR_MCP_READ_RESOURCE_ERROR","type":"object"},"GENERATOR_MCP_LIST_TOOLS_RESPONSE":{"outlet":"GENERATOR_MCP_LIST_TOOLS_RESPONSE","type":"object"},"GENERATOR_MCP_LIST_TOOLS_ERROR":{"outlet":"GENERATOR_MCP_LIST_TOOLS_ERROR","type":"object"},"GENERATOR_MCP_CALL_TOOL_RESPONSE":{"outlet":"GENERATOR_MCP_CALL_TOOL_RESPONSE","type":"object"},"GENERATOR_MCP_CALL_TOOL_ERROR":{"outlet":"GENERATOR_MCP_CALL_TOOL_ERROR","type":"object"},"GENERATOR_MCP_LIST_PROMPTS_RESPONSE":{"outlet":"GENERATOR_MCP_LIST_PROMPTS_RESPONSE","type":"object"},"GENERATOR_MCP_LIST_PROMPTS_ERROR":{"outlet":"GENERATOR_MCP_LIST_PROMPTS_ERROR","type":"object"},"GENERATOR_MCP_GET_PROMPT_RESPONSE":{"outlet":"GENERATOR_MCP_GET_PROMPT_RESPONSE","type":"object"},"GENERATOR_MCP_GET_PROMPT_ERROR":{"outlet":"GENERATOR_MCP_GET_PROMPT_ERROR","type":"object"},"GENERATOR_MCP_LAST_ERROR":{"outlet":"GENERATOR_MCP_LAST_ERROR","type":"string"}},"brickOutletDescriptions":{"GENERATOR_MCP_CONNECTION_STATE":{"default":"","en-us":"Connection state","zh-tw":"連線狀態","ja-jp":"接続状態"},"GENERATOR_MCP_LIST_RESOURCES_RESPONSE":{"default":"","en-us":"List resources response","zh-tw":"列出資源回應","ja-jp":"リソースのリスト応答"},"GENERATOR_MCP_LIST_RESOURCES_ERROR":{"default":"","en-us":"List resources error","zh-tw":"列出資源錯誤","ja-jp":"リソースのリストエラー"},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_RESPONSE":{"default":"","en-us":"List resource templates response","zh-tw":"列出資源範本回應","ja-jp":"リソーステンプレートのリスト応答"},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES_ERROR":{"default":"","en-us":"List resource templates error","zh-tw":"列出資源範本錯誤","ja-jp":"リソーステンプレートのリストエラー"},"GENERATOR_MCP_READ_RESOURCE_RESPONSE":{"default":"","en-us":"Read resource response","zh-tw":"讀取資源回應","ja-jp":"リソースの読み取り応答"},"GENERATOR_MCP_READ_RESOURCE_ERROR":{"default":"","en-us":"Read resource error","zh-tw":"讀取資源錯誤","ja-jp":"リソースの読み取りエラー"},"GENERATOR_MCP_LIST_TOOLS_RESPONSE":{"default":"","en-us":"List tools response","zh-tw":"列出工具回應","ja-jp":"ツールのリスト応答"},"GENERATOR_MCP_LIST_TOOLS_ERROR":{"default":"","en-us":"List tools error","zh-tw":"列出工具錯誤","ja-jp":"ツールのリストエラー"},"GENERATOR_MCP_CALL_TOOL_RESPONSE":{"default":"","en-us":"Call tool response","zh-tw":"呼叫工具回應","ja-jp":"ツールの呼び出し応答"},"GENERATOR_MCP_CALL_TOOL_ERROR":{"default":"","en-us":"Call tool error","zh-tw":"呼叫工具錯誤","ja-jp":"ツールの呼び出しエラー"},"GENERATOR_MCP_LIST_PROMPTS_RESPONSE":{"default":"","en-us":"List prompts response","zh-tw":"列出提示回應","ja-jp":"プロンプトのリスト応答"},"GENERATOR_MCP_LIST_PROMPTS_ERROR":{"default":"","en-us":"List prompts error","zh-tw":"列出提示錯誤","ja-jp":"プロンプトのリストエラー"},"GENERATOR_MCP_GET_PROMPT_RESPONSE":{"default":"","en-us":"Get prompt response","zh-tw":"獲取提示回應","ja-jp":"プロンプトの取得応答"},"GENERATOR_MCP_GET_PROMPT_ERROR":{"default":"","en-us":"Request prompt error","zh-tw":"請求提示錯誤","ja-jp":"プロンプトの取得エラー"},"GENERATOR_MCP_LAST_ERROR":{"default":"","en-us":"Last error","zh-tw":"最後的錯誤","ja-jp":"最後のエラー"}},"eventTypes":{"GENERATOR_MCP_ON_CONNECTED":"GENERATOR_MCP_ON_CONNECTED","GENERATOR_MCP_ON_CONNECTION_ERROR":"GENERATOR_MCP_ON_CONNECTION_ERROR","GENERATOR_MCP_ON_DISCONNECTED":"GENERATOR_MCP_ON_DISCONNECTED","GENERATOR_MCP_ON_LIST_RESOURCES":"GENERATOR_MCP_ON_LIST_RESOURCES","GENERATOR_MCP_ON_LIST_RESOURCES_ERROR":"GENERATOR_MCP_ON_LIST_RESOURCES_ERROR","GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES":"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES","GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES_ERROR":"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES_ERROR","GENERATOR_MCP_ON_READ_RESOURCE":"GENERATOR_MCP_ON_READ_RESOURCE","GENERATOR_MCP_ON_READ_RESOURCE_ERROR":"GENERATOR_MCP_ON_READ_RESOURCE_ERROR","GENERATOR_MCP_ON_LIST_TOOLS":"GENERATOR_MCP_ON_LIST_TOOLS","GENERATOR_MCP_ON_LIST_TOOLS_ERROR":"GENERATOR_MCP_ON_LIST_TOOLS_ERROR","GENERATOR_MCP_ON_CALL_TOOL":"GENERATOR_MCP_ON_CALL_TOOL","GENERATOR_MCP_ON_CALL_TOOL_ERROR":"GENERATOR_MCP_ON_CALL_TOOL_ERROR","GENERATOR_MCP_ON_LIST_PROMPTS":"GENERATOR_MCP_ON_LIST_PROMPTS","GENERATOR_MCP_ON_LIST_PROMPTS_ERROR":"GENERATOR_MCP_ON_LIST_PROMPTS_ERROR","GENERATOR_MCP_ON_GET_PROMPT":"GENERATOR_MCP_ON_GET_PROMPT","GENERATOR_MCP_ON_GET_PROMPT_ERROR":"GENERATOR_MCP_ON_GET_PROMPT_ERROR"},"brickEventDescriptions":{"GENERATOR_MCP_ON_CONNECTED":{"default":"","en-us":"On connected","zh-tw":"當連接時","ja-jp":"接続時"},"GENERATOR_MCP_ON_CONNECTION_ERROR":{"default":"","en-us":"On connection error","zh-tw":"當連接錯誤時","ja-jp":"接続エラー時"},"GENERATOR_MCP_ON_DISCONNECTED":{"default":"","en-us":"On disconnected","zh-tw":"當斷開連接時","ja-jp":"断開時"},"GENERATOR_MCP_ON_LIST_RESOURCES":{"default":"","en-us":"On list resources","zh-tw":"當列出資源時","ja-jp":"リソースのリスト時"},"GENERATOR_MCP_ON_LIST_RESOURCES_ERROR":{"default":"","en-us":"On list resources error","zh-tw":"當列出資源錯誤時","ja-jp":"リストエラー時"},"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES":{"default":"","en-us":"On list resource templates","zh-tw":"當列出資源範本時","ja-jp":"リソーステンプレートのリスト時"},"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES_ERROR":{"default":"","en-us":"On list resource templates error","zh-tw":"當列出資源範本錯誤時","ja-jp":"リストエラー時"},"GENERATOR_MCP_ON_READ_RESOURCE":{"default":"","en-us":"On read resource","zh-tw":"當讀取資源時","ja-jp":"リソースの読み取り時"},"GENERATOR_MCP_ON_READ_RESOURCE_ERROR":{"default":"","en-us":"On read resource error","zh-tw":"當讀取資源錯誤時","ja-jp":"リソースの読み取りエラー時"},"GENERATOR_MCP_ON_LIST_TOOLS":{"default":"","en-us":"On list tools","zh-tw":"當列出工具時","ja-jp":"ツールのリスト時"},"GENERATOR_MCP_ON_LIST_TOOLS_ERROR":{"default":"","en-us":"On list tools error","zh-tw":"當列出工具錯誤時","ja-jp":"ツールのリストエラー時"},"GENERATOR_MCP_ON_CALL_TOOL":{"default":"","en-us":"On call tool","zh-tw":"當呼叫工具時","ja-jp":"ツールの呼び出し時"},"GENERATOR_MCP_ON_CALL_TOOL_ERROR":{"default":"","en-us":"On call tool error","zh-tw":"當呼叫工具錯誤時","ja-jp":"ツールの呼び出しエラー時"},"GENERATOR_MCP_ON_LIST_PROMPTS":{"default":"","en-us":"On list prompts","zh-tw":"當列出提示時","ja-jp":"プロンプトのリスト時"},"GENERATOR_MCP_ON_LIST_PROMPTS_ERROR":{"default":"","en-us":"On list prompts error","zh-tw":"當列出提示錯誤時","ja-jp":"プロンプトのリストエラー時"},"GENERATOR_MCP_ON_GET_PROMPT":{"default":"","en-us":"On get prompt","zh-tw":"當獲取提示時","ja-jp":"プロンプトの取得時"},"GENERATOR_MCP_ON_GET_PROMPT_ERROR":{"default":"","en-us":"On get prompt error","zh-tw":"當獲取提示錯誤時","ja-jp":"プロンプトの取得エラー時"}},"eventPropertyControls":{"GENERATOR_MCP_ON_CONNECTION_ERROR":{"properties":{"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_LIST_RESOURCES":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_LIST_RESOURCES_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_LIST_RESOURCE_TEMPLATES_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_READ_RESOURCE":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_READ_RESOURCE_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_LIST_TOOLS":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_LIST_TOOLS_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_CALL_TOOL":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_CALL_TOOL_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_LIST_PROMPTS":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_LIST_PROMPTS_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}},"GENERATOR_MCP_ON_GET_PROMPT":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_RESPONSE":{"name":"Response","type":"object"}}},"GENERATOR_MCP_ON_GET_PROMPT_ERROR":{"properties":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID","type":"string"},"GENERATOR_MCP_ERROR_MESSAGE":{"name":"Error","type":"string"}}}},"actionTypes":{"GENERATOR_MCP_CONNECT":{"canProvideProperty":false},"GENERATOR_MCP_DISCONNECT":{"canProvideProperty":false},"GENERATOR_MCP_LIST_RESOURCES":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"}}},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"}}},"GENERATOR_MCP_READ_RESOURCE":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"},"GENERATOR_MCP_URI":{"name":"Resource URI","type":"string"},"GENERATOR_MCP_VARIABLES":{"name":"Variables","type":"object","popover":true,"schema":{"allowCustomProperty":true,"type":"object","properties":{}}}}},"GENERATOR_MCP_LIST_TOOLS":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"}}},"GENERATOR_MCP_CALL_TOOL":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"},"GENERATOR_MCP_NAME":{"name":"Tool Name","type":"string"},"GENERATOR_MCP_VARIABLES":{"name":"Variables","type":"object","popover":true,"schema":{"allowCustomProperty":true,"type":"object","properties":{}}}}},"GENERATOR_MCP_LIST_PROMPTS":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"}}},"GENERATOR_MCP_GET_PROMPT":{"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_MCP_REQUEST_ID":{"name":"Request ID (Custom)","type":"string"},"GENERATOR_MCP_NAME":{"name":"Prompt Name","type":"string"},"GENERATOR_MCP_VARIABLES":{"name":"Arguments","type":"object","popover":true,"schema":{"allowCustomProperty":true,"type":"object","properties":{}}}}}},"brickActionDescriptions":{"GENERATOR_MCP_CONNECT":{"default":"","en-us":"Connect to MCP server","zh-tw":"連接到 MCP 伺服器","ja-jp":"MCP サーバーに接続"},"GENERATOR_MCP_DISCONNECT":{"default":"","en-us":"Disconnect from MCP server","zh-tw":"從 MCP 伺服器斷開連接","ja-jp":"MCP サーバーから切断"},"GENERATOR_MCP_LIST_RESOURCES":{"default":"","en-us":"List resources","zh-tw":"列出資源","ja-jp":"リソースのリスト"},"GENERATOR_MCP_LIST_RESOURCE_TEMPLATES":{"default":"","en-us":"List resource templates","zh-tw":"列出資源範本","ja-jp":"リソーステンプレートのリスト"},"GENERATOR_MCP_READ_RESOURCE":{"default":"","en-us":"Read resource","zh-tw":"讀取資源","ja-jp":"リソースの読み取り"},"GENERATOR_MCP_LIST_TOOLS":{"default":"","en-us":"List tools","zh-tw":"列出工具","ja-jp":"ツールのリスト"},"GENERATOR_MCP_CALL_TOOL":{"default":"","en-us":"Call tool","zh-tw":"呼叫工具","ja-jp":"ツールの呼び出し"},"GENERATOR_MCP_LIST_PROMPTS":{"default":"","en-us":"List prompts","zh-tw":"列出提示","ja-jp":"プロンプトのリスト"},"GENERATOR_MCP_GET_PROMPT":{"default":"","en-us":"Request prompt","zh-tw":"請求提示","ja-jp":"プロンプトの要求"}},"scriptMemberFunctionDefs":{"connect":{"arguments":[],"required":[],"return":{"type":"bool"}},"disconnect":{"arguments":[],"required":[],"return":{"type":"void"}},"getConnectionState":{"arguments":[],"required":[],"return":{"type":"string"}},"getLastError":{"arguments":[],"required":[],"return":{"type":"string"}},"listResources":{"arguments":[{"type":"object","name":"options","properties":{"requestId":{"name":"Request ID","type":"string"}}}],"required":[],"return":{"type":"object"}},"listResourceTemplates":{"arguments":[{"type":"object","name":"options","properties":{"requestId":{"name":"Request ID","type":"string"}}}],"required":[],"return":{"type":"object"}},"readResource":{"arguments":[{"type":"object","name":"options","properties":{"uri":{"name":"Resource URI","type":"string"},"variables":{"name":"Variables","type":"object"},"requestId":{"name":"Request ID","type":"string"}}}],"required":["uri"],"return":{"type":"object"}},"listTools":{"arguments":[{"type":"object","name":"options","properties":{"requestId":{"name":"Request ID","type":"string"}}}],"required":[],"return":{"type":"object"}},"callTool":{"arguments":[{"type":"object","name":"options","properties":{"name":{"name":"Tool Name","type":"string"},"arguments":{"name":"Arguments","type":"object"},"requestId":{"name":"Request ID","type":"string"}}}],"required":["name"],"return":{"type":"object"}},"listPrompts":{"arguments":[{"type":"object","name":"options","properties":{"requestId":{"name":"Request ID","type":"string"}}}],"required":[],"return":{"type":"object"}},"getPrompt":{"arguments":[{"type":"object","name":"options","properties":{"name":{"name":"Prompt Name","type":"string"},"arguments":{"name":"Arguments","type":"object"},"requestId":{"name":"Request ID","type":"string"}}}],"required":["name"],"return":{"type":"object"}}},"scriptMemberFunctionDefDescriptions":{"connect":{"default":"","en-us":"Connect to MCP server","zh-tw":"連接到 MCP 伺服器","ja-jp":"MCP サーバーに接続する"},"disconnect":{"default":"","en-us":"Disconnect from MCP server","zh-tw":"從 MCP 伺服器斷開連接","ja-jp":"MCP サーバーから切断する"},"getConnectionState":{"default":"","en-us":"Get connection state","zh-tw":"取得連線狀態","ja-jp":"接続状態を取得する"},"getLastError":{"default":"","en-us":"Get last error","zh-tw":"取得最後的錯誤","ja-jp":"最後のエラーを取得する"},"listResources":{"default":"","en-us":"List resources from MCP server","zh-tw":"列出 MCP 伺服器的資源","ja-jp":"MCP サーバーからリソースをリストする"},"listResourceTemplates":{"default":"","en-us":"List resource templates from MCP server","zh-tw":"列出 MCP 伺服器的資源範本","ja-jp":"MCP サーバーからリソーステンプレートをリストする"},"readResource":{"default":"","en-us":"Read a resource from MCP server","zh-tw":"從 MCP 伺服器讀取資源","ja-jp":"MCP サーバーからリソースを読み取る"},"listTools":{"default":"","en-us":"List tools from MCP server","zh-tw":"列出 MCP 伺服器的工具","ja-jp":"MCP サーバーからツールをリストする"},"callTool":{"default":"","en-us":"Call a tool on MCP server","zh-tw":"呼叫 MCP 伺服器上的工具","ja-jp":"MCP サーバー上のツールを呼び出す"},"listPrompts":{"default":"","en-us":"List prompts from MCP server","zh-tw":"列出 MCP 伺服器的提示","ja-jp":"MCP サーバーからプロンプトをリストする"},"getPrompt":{"default":"","en-us":"Get a prompt from MCP server","zh-tw":"從 MCP 伺服器取得提示","ja-jp":"MCP サーバーからプロンプトを取得する"}}}')},9074:(e,t,a)=>{a.d(t,{C:()=>u});var n=a(9212),r=a(3673),i=a(6192),o=a(6878),s=a(8414);function p(e,t){return t?t(e):r.c.of()}function l(e){return"function"==typeof e?new u(e):e}function d(e){return e.request.length<=1}var u=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e(function(){return r.c.of()})},e.from=function(t){return 0===t.length?e.empty():t.map(l).reduce(function(e,t){return e.concat(t)})},e.split=function(t,a,n){var i,o=l(a),s=l(n||new e(p));return i=d(o)&&d(s)?new e(function(e){return t(e)?o.request(e)||r.c.of():s.request(e)||r.c.of()}):new e(function(e,a){return t(e)?o.request(e,a)||r.c.of():s.request(e,a)||r.c.of()}),Object.assign(i,{left:o,right:s})},e.execute=function(e,t){return e.request((0,o.k)(t.context,(0,s.A)((0,i.K)(t))))||r.c.of()},e.concat=function(t,a){var i=l(t);if(d(i))return!1!==globalThis.__DEV__&&n.invariant.warn(38,i),i;var o,s=l(a);return o=d(s)?new e(function(e){return i.request(e,function(e){return s.request(e)||r.c.of()})||r.c.of()}):new e(function(e,t){return i.request(e,function(e){return s.request(e,t)||r.c.of()})||r.c.of()}),Object.assign(o,{left:i,right:s})},e.prototype.split=function(t,a,n){return this.concat(e.split(t,a,n||new e(p)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw(0,n.newInvariantError)(39)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}()},9122:(e,t,a)=>{a.d(t,{A:()=>r});var n=a(1708);function r(){const{env:e}=n,{TERM:t,TERM_PROGRAM:a}=e;return"win32"!==n.platform?"linux"!==t:Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||"{cmd::Cmder}"===e.ConEmuTask||"Terminus-Sublime"===a||"vscode"===a||"xterm-256color"===t||"alacritty"===t||"rxvt-unicode"===t||"rxvt-unicode-256color"===t||"JetBrains-JediTerm"===e.TERMINAL_EMULATOR}},9212:(e,t,a)=>{a.d(t,{DEV:()=>_,InvariantError:()=>n.InvariantError,__DEV__:()=>_,global:()=>o,invariant:()=>l,maybe:()=>i,newInvariantError:()=>d}),a.r(t);var n=a(9371),r=a(3972);function i(e){try{return e()}catch(e){}}const o=i(function(){return globalThis})||i(function(){return window})||i(function(){return self})||i(function(){return global})||i(function(){return i.constructor("return this")()});var s=a(6563);function p(e){return function(t){for(var a=[],n=1;n<arguments.length;n++)a[n-1]=arguments[n];if("number"==typeof t){var r=t;(t=m(r))||(t=f(r,a),a=[])}e.apply(void 0,[t].concat(a))}}var l=Object.assign(function(e,t){for(var a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];e||(0,n.invariant)(e,m(t,a)||f(t,a))},{debug:p(n.invariant.debug),log:p(n.invariant.log),warn:p(n.invariant.warn),error:p(n.invariant.error)});function d(e){for(var t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];return new n.InvariantError(m(e,t)||f(e,t))}var u=Symbol.for("ApolloErrorMessageHandler_"+r.r);function c(e){if("string"==typeof e)return e;try{return(0,s.p)(e,2).slice(0,1e3)}catch(e){return"<non-serializable>"}}function m(e,t){if(void 0===t&&(t=[]),e)return o[u]&&o[u](e,t.map(c))}function f(e,t){if(void 0===t&&(t=[]),e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:r.r,message:e,args:t.map(c)})))}var _=!1!==globalThis.__DEV__},9218:e=>{e.exports=JSON.parse('{"name":"GeneratorUDP","brickDescription":{"default":"","en-us":"TCP Server","zh-tw":"TCP 伺服器","ja-jp":"TCPサーバー"},"brickDisplayName":"UDP","brickTip":{"default":""},"brickMeta":{"scriptMember":true},"brickPreviewIcon":{"type":"material-community","name":"network-outline"},"propTypes":{"init":{"type":"bool"},"type":{"type":"oneOf","content":["udp4","udp6"],"forcePropertyBank":false},"encoding":{"type":"oneOf","content":["base64","utf8","ascii"],"forcePropertyBank":false},"localPort":{"type":"number"},"broadcast":{"type":"bool"},"multicast":{"type":"string"}},"brickPropDescriptions":{"init":{"default":"","en-us":"Bind port on generator initialized","zh-tw":"Generator 初始化後直接啟動","ja-jp":"ジェネレータの初期化時にポートをバインドする"},"type":{"default":"","en-us":"The family of socket","zh-tw":"接口種類","ja-jp":"ソケットファミリー"},"encoding":{"default":"","en-us":"Encoding of data","zh-tw":"資料編碼","ja-jp":"データのエンコーディング"},"localPort":{"default":"","en-us":"Local bind port of UDP (0 or empty is random)","zh-tw":"UDP 本地連接埠(0 或留空為隨機)","ja-jp":"UDPのローカルバインドポート(0または空は任意)"},"broadcast":{"default":"","en-us":"Enable receive broadcast packets","zh-tw":"啟動接收廣播封包","ja-jp":"ブロードキャストパケットの受信を有効にする"},"multicast":{"default":"","en-us":"Join multicast group (Multicast address)","zh-tw":"加入多播群組(多播位置)","ja-jp":"マルチキャストグループに参加する(マルチキャストアドレス)"}},"defaultBrickProps":{"init":false,"type":"udp4","encoding":"base64","broadcast":false,"multicast":""},"propertyControls":{"localPort":{"required":true}},"outletTypes":{"GENERATOR_UDP_PORT":{"outlet":"GENERATOR_UDP_PORT","type":"number"},"GENERATOR_UDP_LAST_RECEIVE":{"outlet":"GENERATOR_UDP_LAST_RECEIVE","type":"object"},"GENERATOR_UDP_ERROR_MESSAGE":{"outlet":"GENERATOR_UDP_ERROR_MESSAGE","type":"string"}},"brickOutletDescriptions":{"GENERATOR_UDP_PORT":{"default":"","en-us":"Local UDP binded port","zh-tw":"本地 UDP 連接埠","ja-jp":"ローカルUDPバインドポート"},"GENERATOR_UDP_LAST_RECEIVE":{"default":"","en-us":"Last received packet","zh-tw":"最後收到的封包","ja-jp":"最後に受信したパケット"},"GENERATOR_UDP_ERROR_MESSAGE":{"default":"","en-us":"Error message","zh-tw":"錯誤訊息","ja-jp":"エラーメッセージ"}},"eventTypes":{"GENERATOR_UDP_ON_READY":"GENERATOR_UDP_ON_READY","GENERATOR_UDP_ON_DATA":"GENERATOR_UDP_ON_DATA","GENERATOR_UDP_ON_CLOSE":"GENERATOR_UDP_ON_CLOSE","GENERATOR_UDP_ON_ERROR":"GENERATOR_UDP_ON_ERROR"},"brickEventDescriptions":{"GENERATOR_UDP_ON_READY":{"default":"","en-us":"Event of UDP port is binded","zh-tw":"當 UDP 伺服器啟動完成時觸發事件","ja-jp":"UDPポートがバインドされた時のイベント"},"GENERATOR_UDP_ON_DATA":{"default":"","en-us":"Event of receive data","zh-tw":"當收到資料時觸發事件","ja-jp":"データを受信した時のイベント"},"GENERATOR_UDP_ON_CLOSE":{"default":"","en-us":"Event of socket closeed","zh-tw":"當接口結束時觸發事件","ja-jp":"ソケットが閉じられた時のイベント"},"GENERATOR_UDP_ON_ERROR":{"default":"","en-us":"Event of socket error","zh-tw":"當接口發生錯誤時觸發事件","ja-jp":"ソケットエラー発生時のイベント"}},"eventPropertyControls":{"GENERATOR_UDP_ON_DATA":{"properties":{"GENERATOR_UDP_REMOTE_ADDRESS":{"name":"Address","type":"string"},"GENERATOR_UDP_REMOTE_PORT":{"name":"Port","type":"number"},"GENERATOR_UDP_DATA":{"name":"Data","type":"string"}}},"GENERATOR_UDP_ON_ERROR":{"properties":{"GENERATOR_UDP_ERROR_MESSAGE":{"name":"Error","type":"string"}}}},"actionTypes":{"GENERATOR_UDP_BIND":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_UDP_SEND":{"disallowMultiple":false,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_UDP_TARGET_HOST":{"name":"Host","type":"string"},"GENERATOR_UDP_TARGET_PORT":{"name":"Port","type":"number"},"GENERATOR_UDP_SEND_DATA":{"name":"Data","type":"string"}}},"GENERATOR_UDP_CLOSE":{"disallowMultiple":true,"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_UDP_BIND":{"default":"","en-us":"Bind UDP port","zh-tw":"綁定 UDP 連接埠","ja-jp":"UDPポートをバインドする"},"GENERATOR_UDP_SEND":{"default":"","en-us":"Send data to target","zh-tw":"傳送資料到目標位置","ja-jp":"ターゲットにデータを送信する"},"GENERATOR_UDP_CLOSE":{"default":"","en-us":"Close UDP","zh-tw":"關閉 UDP","ja-jp":"UDPを閉じる"}},"scriptMemberFunctionDefs":{"getStatus":{"arguments":[],"required":[],"return":{"type":"object"}},"bind":{"arguments":[],"required":[],"return":{"type":"void"}},"send":{"arguments":[{"name":"data","type":"string"}],"required":[],"return":{"type":"void"}},"close":{"arguments":[],"required":[],"return":{"type":"void"}}},"scriptMemberFunctionDefDescriptions":{"getStatus":{"default":"","en-us":"Get the status of the UDP","zh-tw":"取得 UDP 的狀態","ja-jp":"UDPの状態を取得"},"bind":{"default":"","en-us":"Bind the UDP port","zh-tw":"綁定 UDP 連接埠","ja-jp":"UDPポートをバインドする"},"send":{"default":"","en-us":"Send data to the UDP","zh-tw":"傳送資料到 UDP","ja-jp":"UDPにデータを送信する"},"close":{"default":"","en-us":"Close the UDP","zh-tw":"關閉 UDP","ja-jp":"UDPを閉じる"}}}')},9220:e=>{e.exports=JSON.parse('{"name":"BrickVideoStreaming","brickDescription":{"default":"Brick video streaming component, supports RTSP / RTMP streaming."},"brickDisplayName":"Video Streaming","brickTip":{"default":"@brick-tip-video-streaming","en-us":"Add Video Streaming with URI, Cache, Ratio, etc. setting.","zh-tw":"串流影片元件,可透過 URI 設定來源,另可變更快取、比例等多種控制設定","ja-jp":"URI、キャッシュ、比率などの設定でビデオストリーミングを追加します。"},"brickMeta":{"pressable":true},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"tower-broadcast"},"propTypes":{"uri":{"type":"string","isRequired":true},"networkCaching":{"type":"number"},"paused":{"type":"bool"},"volume":{"type":"number"},"muted":{"type":"bool"},"autoAspectRatio":{"type":"bool"},"aspectRatio":{"type":"string"},"repeat":{"type":"bool"},"replayOnError":{"type":"bool"},"replayTimeout":{"type":"number"}},"brickPropDescriptions":{"uri":{"default":"","en-us":"The video path list or single path (File, URL)","zh-tw":"Video 的播放清單或單一檔案 (File, URL)","ja-jp":"ビデオのパスリストまたは単一パス(ファイル、URL)"},"networkCaching":{"default":"","en-us":"Set cache time from streaming (You can adjust according to network conditions), it will delay the playing.","zh-tw":"設置快取時間(你可以視網路情況調整),如此將會延遲播放時間","ja-jp":"ストリーミングからキャッシュ時間を設定します(ネットワーク状況に応じて調整可能)、再生が遅延します。"},"paused":{"default":"","en-us":"Controls whether the video is paused","zh-tw":"控制影片是否暂停","ja-jp":"ビデオが一時停止しているかどうかを制御"},"volume":{"default":"","en-us":"Volume","zh-tw":"音量","ja-jp":"音量"},"muted":{"default":"","en-us":"Muted","zh-tw":"靜音","ja-jp":"ミュート"},"autoAspectRatio":{"default":"","en-us":"Video Auto Aspect Ratio","zh-tw":"自動寬高比","ja-jp":"ビデオの自動アスペクト比"},"aspectRatio":{"default":"","en-us":"Video Aspect Ratio","zh-tw":"影片寬高比","ja-jp":"ビデオのアスペクト比"},"repeat":{"default":"","en-us":"Repeat the video path list","zh-tw":"重播影片清單","ja-jp":"ビデオパスリストを繰り返す"},"replayOnError":{"default":"","en-us":"Replay on playing error","zh-tw":"重播影片清單","ja-jp":"再生エラー時に再生"},"replayTimeout":{"default":"","en-us":"Timeout to replay if repeat or replayOnError is true and video is end or error","zh-tw":"如果影片結束或錯誤且 repeat 或 replayOnError 為 true,需要等待的重播時間","ja-jp":"repeatまたはreplayOnErrorがtrueで、ビデオが終了またはエラーの場合の再生タイムアウト"}},"defaultBrickProps":{"networkCaching":300,"paused":false,"volume":100,"muted":false,"replayTimeout":500},"propertyControls":{"uri":{"displayName":"URI","normalizeDisplayName":false,"resetOnTemplateChange":true,"required":true,"validator":{"fn":"uri","protocols":["https?","rtsp","rtmps?","rtmpt","rtmpe","rtmfp"]}},"replayTimeout":{"kind":"unit","min":0,"unit":"ms"},"resizeMode":{"resetOnTemplateChange":true},"volume":{"kind":"unit","min":0,"max":100,"unit":"%","step":5}},"eventTypes":{"BRICK_VIDEO_STREAMING_ON_PRESS":"BRICK_VIDEO_STREAMING_ON_PRESS","BRICK_VIDEO_STREAMING_ON_PRESS_IN":"BRICK_VIDEO_STREAMING_ON_PRESS_IN","BRICK_VIDEO_STREAMING_ON_PRESS_OUT":"BRICK_VIDEO_STREAMING_ON_PRESS_OUT","BRICK_VIDEO_STREAMING_ON_LONG_PRESS":"BRICK_VIDEO_STREAMING_ON_LONG_PRESS","BRICK_VIDEO_STREAMING_ON_FOCUS":"BRICK_VIDEO_STREAMING_ON_FOCUS","BRICK_VIDEO_STREAMING_ON_BLUR":"BRICK_VIDEO_STREAMING_ON_BLUR","BRICK_VIDEO_STREAMING_ON_END":"BRICK_VIDEO_STREAMING_ON_END","BRICK_VIDEO_STREAMING_ON_LOAD":"BRICK_VIDEO_STREAMING_ON_LOAD","BRICK_VIDEO_STREAMING_ON_ERROR":"BRICK_VIDEO_STREAMING_ON_ERROR"},"brickEventDescriptions":{"BRICK_VIDEO_STREAMING_ON_PRESS":{"default":"","en-us":"Event of the brick press","zh-tw":"當 brick 被點擊時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_VIDEO_STREAMING_ON_PRESS_IN":{"default":"","en-us":"Event of the brick press in","zh-tw":"當 brick 被按下時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_VIDEO_STREAMING_ON_PRESS_OUT":{"default":"","en-us":"Event of the brick press out","zh-tw":"當 brick 按下後被放開時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_VIDEO_STREAMING_ON_LONG_PRESS":{"default":"","en-us":"Event of the brick long press","zh-tw":"當 brick 被長按時觸發","ja-jp":"ブリックが長押しされたときに発生するイベント"},"BRICK_VIDEO_STREAMING_ON_FOCUS":{"default":"","en-us":"Event of the brick focus (Use TV Device with controller)","zh-tw":"當 brick 獲得焦點時觸發 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスを獲得したときに発生するイベント (TV デバイスとコントローラーを使用)"},"BRICK_VIDEO_STREAMING_ON_BLUR":{"default":"","en-us":"Event of the brick blur (Use TV Device with controller)","zh-tw":"當 brick 失去焦點時觸發 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスを失ったときに発生するイベント (TV デバイスとコントローラーを使用)"},"BRICK_VIDEO_STREAMING_ON_END":{"default":"","en-us":"Event on plays of path are end","zh-tw":"當 path 完全播放完畢時觸發事件","ja-jp":"パスの再生が終了した時のイベント"},"BRICK_VIDEO_STREAMING_ON_LOAD":{"default":"","en-us":"Event on plays of path are end","zh-tw":"當影片讀取完成時觸發事件","ja-jp":"ビデオの読み込みが完了した時のイベント"},"BRICK_VIDEO_STREAMING_ON_ERROR":{"default":"","en-us":"Event of the video playing error","zh-tw":"當影片讀取錯誤時觸發事件","ja-jp":"ビデオ再生エラー時のイベント"}},"eventPropertyControls":{},"outletTypes":{"BRICK_PRESSING":{"outlet":"BRICK_PRESSING","type":"bool"},"BRICK_FOCUSING":{"outlet":"BRICK_FOCUSING","type":"bool"}},"brickOutletDescriptions":{"BRICK_PRESSING":{"default":"","en-us":"Brick is pressing","zh-tw":"Brick 被按住中","ja-jp":"ブリックが押されています"},"BRICK_FOCUSING":{"default":"","en-us":"Brick is focusing (Use TV Device with controller)","zh-tw":"Brick 處於焦點狀態中 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスされています (TV デバイスとコントローラーを使用)"}}}')},9222:(e,t,a)=>{a.d(t,{D:()=>U});var n=a(5608),r=a(9212),i=a(7634),o=a(5888),s=a(2495),p=a(5702),l=a(9354),d=a(3925),u=a(555),c=a(4214),m=a(8678),f=a(8907),_=a(2455),h=a(1360),E=a(492),y=a(3777),T=a(671),R=a(2307),g=a(2904),v=a(7236),O=a(1777),N=a(3906),b=a(5207),A=a(3767),S=a(4592);var I=function(){function e(){this.known=new(h.En?WeakSet:Set),this.pool=new S.Trie(h.et),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return(0,O.U)(e)&&this.known.has(e)},e.prototype.pass=function(e){if((0,O.U)(e)){var t=function(e){return(0,O.U)(e)?(0,A.c)(e)?e.slice(0):(0,n.__assign)({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if((0,O.U)(e)){var a=this.passes.get(e);if(a)return a;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(s=this.pool.lookupArray(n)).array||(this.known.add(s.array=n),!1!==globalThis.__DEV__&&Object.freeze(n)),s.array;case null:case Object.prototype:if(this.known.has(e))return e;var r=Object.getPrototypeOf(e),i=[r],o=this.sortedKeys(e);i.push(o.json);var s,p=i.length;if(o.sorted.forEach(function(a){i.push(t.admit(e[a]))}),!(s=this.pool.lookupArray(i)).object){var l=s.object=Object.create(r);this.known.add(l),o.sorted.forEach(function(e,t){l[e]=i[p+t]}),!1!==globalThis.__DEV__&&Object.freeze(l)}return s.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),a=this.pool.lookupArray(t);if(!a.keys){t.sort();var n=JSON.stringify(t);(a.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,a.keys={sorted:t,json:n})}return a.keys},e}();function w(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var C=function(){function e(e){var t=this;this.knownResults=new(h.et?WeakMap:Map),this.config=(0,E.o)(e,{addTypename:!1!==e.addTypename,canonizeResults:(0,b.Xx)(e)}),this.canon=e.canon||new I,this.executeSelectionSet=(0,i.wrap)(function(e){var a,r=e.context.canonizeResults,i=w(e);i[3]=!r;var o=(a=t.executeSelectionSet).peek.apply(a,i);return o?r?(0,n.__assign)((0,n.__assign)({},o),{result:t.canon.admit(o.result)}):o:((0,N.M2)(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:w,makeCacheKey:function(e,t,a,n){if((0,N.$7)(a.store))return a.store.makeCacheKey(e,(0,f.A_)(t)?t.__ref:t,a.varString,n)}}),this.executeSubSelectedArray=(0,i.wrap)(function(e){return(0,N.M2)(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(e){var t=e.field,a=e.array,n=e.context;if((0,N.$7)(n.store))return n.store.makeCacheKey(t,a,n.varString)}})}return e.prototype.resetCanon=function(){this.canon=new I},e.prototype.diffQueryAgainstStore=function(e){var t=e.store,a=e.query,r=e.rootId,i=void 0===r?"ROOT_QUERY":r,o=e.variables,s=e.returnPartialData,l=void 0===s||s,d=e.canonizeResults,u=void 0===d?this.config.canonizeResults:d,m=this.config.cache.policies;o=(0,n.__assign)((0,n.__assign)({},(0,y.wY)((0,y.AT)(a))),o);var _,h=(0,f.WU)(i),E=this.executeSelectionSet({selectionSet:(0,y.Vn)(a).selectionSet,objectOrReference:h,enclosingRef:h,context:(0,n.__assign)({store:t,query:a,policies:m,variables:o,varString:(0,c.M)(o),canonizeResults:u},(0,b.lq)(a,this.config.fragments))});if(E.missing&&(_=[new p.Z(D(E.missing),E.missing,a,o)],!l))throw _[0];return{result:E.result,complete:!_,missing:_}},e.prototype.isFresh=function(e,t,a,n){if((0,N.$7)(n.store)&&this.knownResults.get(e)===a){var r=this.executeSelectionSet.peek(a,t,n,this.canon.isKnown(e));if(r&&e===r.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,a=e.selectionSet,n=e.objectOrReference,i=e.enclosingRef,o=e.context;if((0,f.A_)(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s,p=o.variables,l=o.policies,u=o.store.getFieldValue(n,"__typename"),c=[],m=new T.ZI;function h(e,t){var a;return e.missing&&(s=m.merge(s,((a={})[t]=e.missing,a))),e.result}this.config.addTypename&&"string"==typeof u&&!l.rootIdsByTypename[u]&&c.push({__typename:u});var E=new Set(a.selections);E.forEach(function(e){var a,y;if((0,R.MS)(e,p))if((0,f.dt)(e)){var T=l.readField({fieldName:e.name.value,field:e,variables:o.variables,from:n},o),v=(0,f.ue)(e);void 0===T?d.XY.added(e)||(s=m.merge(s,((a={})[v]="Can't find field '".concat(e.name.value,"' on ").concat((0,f.A_)(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),a))):(0,A.c)(T)?T.length>0&&(T=h(t.executeSubSelectedArray({field:e,array:T,enclosingRef:i,context:o}),v)):e.selectionSet?null!=T&&(T=h(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:T,enclosingRef:(0,f.A_)(T)?T:i,context:o}),v)):o.canonizeResults&&(T=t.canon.pass(T)),void 0!==T&&c.push(((y={})[v]=T,y))}else{var O=(0,g.HQ)(e,o.lookupFragment);if(!O&&e.kind===_.b.FRAGMENT_SPREAD)throw(0,r.newInvariantError)(10,e.name.value);O&&l.fragmentMatches(O,u)&&O.selectionSet.selections.forEach(E.add,E)}});var y={result:(0,T.IM)(c),missing:s},O=o.canonizeResults?this.canon.admit(y):(0,v.G)(y);return O.result&&this.knownResults.set(O.result,a),O},e.prototype.execSubSelectedArrayImpl=function(e){var t,a=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,p=new T.ZI;function l(e,a){var n;return e.missing&&(t=p.merge(t,((n={})[a]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(s.store.canRead)),i=i.map(function(e,t){return null===e?null:(0,A.c)(e)?l(a.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?l(a.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:(0,f.A_)(e)?e:o,context:s}),t):(!1!==globalThis.__DEV__&&function(e,t,a){if(!t.selectionSet){var n=new Set([a]);n.forEach(function(a){(0,O.U)(a)&&((0,r.invariant)(!(0,f.A_)(a),11,(0,b.Ui)(e,a),t.name.value),Object.values(a).forEach(n.add,n))})}}(s.store,n,e),e)}),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},e}();function D(e){try{JSON.stringify(e,function(e,t){if("string"==typeof t)throw t;return t})}catch(e){return e}}var P=a(906),j=a(8338);function k(e,t,a){var r="".concat(t).concat(a),i=e.flavors.get(r);return i||e.flavors.set(r,i=e.clientOnly===t&&e.deferred===a?e:(0,n.__assign)((0,n.__assign)({},e),{clientOnly:t,deferred:a})),i}var L=function(){function e(e,t,a){this.cache=e,this.reader=t,this.fragments=a}return e.prototype.writeToStore=function(e,t){var a=this,i=t.query,s=t.result,p=t.dataId,l=t.variables,d=t.overwrite,u=(0,y.Vu)(i),m=(0,b.mv)();l=(0,n.__assign)((0,n.__assign)({},(0,y.wY)(u)),l);var _=(0,n.__assign)((0,n.__assign)({store:e,written:Object.create(null),merge:function(e,t){return m.merge(e,t)},variables:l,varString:(0,c.M)(l)},(0,b.lq)(i,this.fragments)),{overwrite:!!d,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),h=this.processSelectionSet({result:s||Object.create(null),dataId:p,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:_});if(!(0,f.A_)(h))throw(0,r.newInvariantError)(12,s);return _.incomingById.forEach(function(t,i){var s=t.storeObject,p=t.mergeTree,l=t.fieldNodeSet,d=(0,f.WU)(i);if(p&&p.map.size){var u=a.applyMerges(p,d,s,_);if((0,f.A_)(u))return;s=u}if(!1!==globalThis.__DEV__&&!_.overwrite){var c=Object.create(null);l.forEach(function(e){e.selectionSet&&(c[e.name.value]=!0)});Object.keys(s).forEach(function(e){(function(e){return!0===c[(0,b.iJ)(e)]})(e)&&!function(e){var t=p&&p.map.get(e);return Boolean(t&&t.info&&t.info.merge)}(e)&&function(e,t,a,i){var s=function(e){var t=i.getFieldValue(e,a);return"object"==typeof t&&t},p=s(e);if(!p)return;var l=s(t);if(!l)return;if((0,f.A_)(p))return;if((0,o.equal)(p,l))return;if(Object.keys(p).every(function(e){return void 0!==i.getFieldValue(l,e)}))return;var d=i.getFieldValue(e,"__typename")||i.getFieldValue(t,"__typename"),u=(0,b.iJ)(a),c="".concat(d,".").concat(u);if(z.has(c))return;z.add(c);var m=[];(0,A.c)(p)||(0,A.c)(l)||[p,l].forEach(function(e){var t=i.getFieldValue(e,"__typename");"string"!=typeof t||m.includes(t)||m.push(t)});!1!==globalThis.__DEV__&&r.invariant.warn(15,u,d,m.length?"either ensure all objects of type "+m.join(" and ")+" have an ID or a custom merge function, or ":"",c,(0,n.__assign)({},p),(0,n.__assign)({},l))}(d,s,e,_.store)})}e.merge(i,s)}),e.retain(h.__ref),h},e.prototype.processSelectionSet=function(e){var t=this,a=e.dataId,i=e.result,o=e.selectionSet,s=e.context,p=e.mergeTree,l=this.cache.policies,u=Object.create(null),c=a&&l.rootTypenamesById[a]||(0,f.D$)(i,o,s.fragmentMap)||a&&s.store.get(a,"__typename");"string"==typeof c&&(u.__typename=c);var m=function(){var e=(0,j.m)(arguments,u,s.variables);if((0,f.A_)(e.from)){var t=s.incomingById.get(e.from.__ref);if(t){var a=l.readField((0,n.__assign)((0,n.__assign)({},e),{from:t.storeObject}),s);if(void 0!==a)return a}}return l.readField(e,s)},_=new Set;this.flattenFields(o,i,s,c).forEach(function(e,a){var n,o=(0,f.ue)(a),s=i[o];if(_.add(a),void 0!==s){var h=l.getStoreFieldName({typename:c,fieldName:a.name.value,field:a,variables:e.variables}),E=G(p,h),y=t.processFieldValue(s,a,a.selectionSet?k(e,!1,!1):e,E),T=void 0;a.selectionSet&&((0,f.A_)(y)||(0,b.d1)(y))&&(T=m("__typename",y));var R=l.getMergeFunction(c,a.name.value,T);R?E.info={field:a,typename:c,merge:R}:B(p,h),u=e.merge(u,((n={})[h]=y,n))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||d.XY.added(a)||l.getReadFunction(c,a.name.value)||!1!==globalThis.__DEV__&&r.invariant.error(13,(0,f.ue)(a),i)});try{var h=l.identify(i,{typename:c,selectionSet:o,fragmentMap:s.fragmentMap,storeObject:u,readField:m}),E=h[0],y=h[1];a=a||E,y&&(u=s.merge(u,y))}catch(e){if(!a)throw e}if("string"==typeof a){var T=(0,f.WU)(a),R=s.written[a]||(s.written[a]=[]);if(R.indexOf(o)>=0)return T;if(R.push(o),this.reader&&this.reader.isFresh(i,T,o,s))return T;var g=s.incomingById.get(a);return g?(g.storeObject=s.merge(g.storeObject,u),g.mergeTree=x(g.mergeTree,p),_.forEach(function(e){return g.fieldNodeSet.add(e)})):s.incomingById.set(a,{storeObject:u,mergeTree:F(p)?void 0:p,fieldNodeSet:_}),T}return u},e.prototype.processFieldValue=function(e,t,a,n){var r=this;return t.selectionSet&&null!==e?(0,A.c)(e)?e.map(function(e,i){var o=r.processFieldValue(e,t,a,G(n,i));return B(n,i),o}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:a,mergeTree:n}):!1!==globalThis.__DEV__?(0,P.m)(e):e},e.prototype.flattenFields=function(e,t,a,n){void 0===n&&(n=(0,f.D$)(t,e,a.fragmentMap));var i=new Map,o=this.cache.policies,s=new S.Trie(!1);return function e(p,l){var d=s.lookup(p,l.clientOnly,l.deferred);d.visited||(d.visited=!0,p.selections.forEach(function(s){if((0,R.MS)(s,a.variables)){var p=l.clientOnly,d=l.deferred;if(p&&d||!(0,A.E)(s.directives)||s.directives.forEach(function(e){var t=e.name.value;if("client"===t&&(p=!0),"defer"===t){var n=(0,f.MB)(e,a.variables);n&&!1===n.if||(d=!0)}}),(0,f.dt)(s)){var u=i.get(s);u&&(p=p&&u.clientOnly,d=d&&u.deferred),i.set(s,k(a,p,d))}else{var c=(0,g.HQ)(s,a.lookupFragment);if(!c&&s.kind===_.b.FRAGMENT_SPREAD)throw(0,r.newInvariantError)(14,s.name.value);c&&o.fragmentMatches(c,n,t,a.variables)&&e(c.selectionSet,k(a,p,d))}}}))}(e,a),i},e.prototype.applyMerges=function(e,t,a,i,o){var s,p=this;if(e.map.size&&!(0,f.A_)(a)){var l,d=(0,A.c)(a)||!(0,f.A_)(t)&&!(0,b.d1)(t)?void 0:t,u=a;d&&!o&&(o=[(0,f.A_)(d)?d.__ref:d]);var c=function(e,t){return(0,A.c)(e)?"number"==typeof t?e[t]:void 0:i.store.getFieldValue(e,String(t))};e.map.forEach(function(e,t){var a=c(d,t),n=c(u,t);if(void 0!==n){o&&o.push(t);var s=p.applyMerges(e,a,n,i,o);s!==n&&(l=l||new Map).set(t,s),o&&(0,r.invariant)(o.pop()===t)}}),l&&(a=(0,A.c)(u)?u.slice(0):(0,n.__assign)({},u),l.forEach(function(e,t){a[t]=e}))}return e.info?this.cache.policies.runMergeFunction(t,a,e.info,i,o&&(s=i.store).getStorage.apply(s,o)):a},e}(),M=[];function G(e,t){var a=e.map;return a.has(t)||a.set(t,M.pop()||{map:new Map}),a.get(t)}function x(e,t){if(e===t||!t||F(t))return e;if(!e||F(e))return t;var a=e.info&&t.info?(0,n.__assign)((0,n.__assign)({},e.info),t.info):e.info||t.info,r=e.map.size&&t.map.size,i={info:a,map:r?new Map:e.map.size?e.map:t.map};if(r){var o=new Set(t.map.keys());e.map.forEach(function(e,a){i.map.set(a,x(e,t.map.get(a))),o.delete(a)}),o.forEach(function(a){i.map.set(a,x(t.map.get(a),e.map.get(a)))})}return i}function F(e){return!e||!(e.info||e.map.size)}function B(e,t){var a=e.map,n=a.get(t);n&&F(n)&&(M.push(n),a.delete(t))}var z=new Set;var V=a(777),$=a(4114),U=function(e){function t(t){void 0===t&&(t={});var a=e.call(this)||this;return a.watches=new Set,a.addTypenameTransform=new l.c(d.XY),a.assumeImmutableResults=!0,a.makeVar=V.UT,a.txCount=0,a.config=(0,b.I6)(t),a.addTypename=!!a.config.addTypename,a.policies=new j.l({cache:a,dataIdFromObject:a.config.dataIdFromObject,possibleTypes:a.config.possibleTypes,typePolicies:a.config.typePolicies}),a.init(),a}return(0,n.__extends)(t,e),t.prototype.init=function(){var e=this.data=new N.D_.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,a=this.storeReader,n=this.config.fragments;this.storeWriter=new L(this,this.storeReader=new C({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:(0,b.Xx)(this.config),canon:e?void 0:a&&a.canon,fragments:n}),n),this.maybeBroadcastWatch=(0,i.wrap)(function(e,a){return t.broadcastWatch(e,a)},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(e){var a=e.optimistic?t.optimisticData:t.data;if((0,N.$7)(a)){var n=e.optimistic,r=e.id,i=e.variables;return a.makeCacheKey(e.query,e.callback,(0,c.M)({optimistic:n,id:r,variables:i}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(e){return e.resetCaching()})},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,a=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore((0,n.__assign)((0,n.__assign)({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:a})).result||null}catch(e){if(e instanceof p.Z)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(b.$3.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore((0,n.__assign)((0,n.__assign)({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t=this;return this.watches.size||(0,V.MS)(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&(0,V.WR)(t),t.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){var t;c.M.reset(),m.y.reset(),this.addTypenameTransform.resetCache(),null===(t=this.config.fragments)||void 0===t||t.resetCaches();var a=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),a},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){if((0,f.A_)(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&r.invariant.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(b.$3.call(e,"id"))return!1;e=(0,n.__assign)((0,n.__assign)({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(e){var t=this;return this.init(),c.M.reset(),e&&e.discardWatches?(this.watches.forEach(function(e){return t.maybeBroadcastWatch.forget(e)}),this.watches.clear(),(0,V.WR)(this)):this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t,a=this,r=e.update,i=e.optimistic,o=void 0===i||i,s=e.removeOptimistic,p=e.onWatchUpdated,l=function(e){var n=a,i=n.data,o=n.optimisticData;++a.txCount,e&&(a.data=a.optimisticData=e);try{return t=r(a)}finally{--a.txCount,a.data=i,a.optimisticData=o}},d=new Set;return p&&!this.txCount&&this.broadcastWatches((0,n.__assign)((0,n.__assign)({},e),{onWatchUpdated:function(e){return d.add(e),!1}})),"string"==typeof o?this.optimisticData=this.optimisticData.addLayer(o,l):!1===o?l(this.data):l(),"string"==typeof s&&(this.optimisticData=this.optimisticData.removeLayer(s)),p&&d.size?(this.broadcastWatches((0,n.__assign)((0,n.__assign)({},e),{onWatchUpdated:function(e,t){var a=p.call(this,e,t);return!1!==a&&d.delete(e),a}})),d.size&&d.forEach(function(e){return a.maybeBroadcastWatch.dirty(e)})):this.broadcastWatches(e),t},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},t.prototype.fragmentMatches=function(e,t){return this.policies.fragmentMatches(e,t)},t.prototype.lookupFragment=function(e){var t;return(null===(t=this.config.fragments)||void 0===t?void 0:t.lookup(e))||null},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach(function(a){return t.maybeBroadcastWatch(a,e)})},t.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},t.prototype.broadcastWatch=function(e,t){var a=e.lastDiff,n=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(n.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,n,a))||a&&(0,o.equal)(a.result,n.result)||e.callback(e.lastDiff=n,a)},t}(s.k);!1!==globalThis.__DEV__&&(U.prototype.getMemoryInternals=$.cM)},9283:(e,t,a)=>{a.r(t),a.d(t,{disableWarningsSlot:()=>n.yV,maskFragment:()=>r.z,maskOperation:()=>i.m});var n=a(7150),r=a(2959),i=a(8354)},9348:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=a(7898),r=a(3036),i=a(4450),o=a(9409);function s(e){const{gen:t,data:a,it:r}=e;t.if(r.parentData,()=>t.assign(a,n._`${r.parentData}[${r.parentDataProperty}]`))}function p(e,t,a){if(void 0===a)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,n.stringify)(a)})}t.macroKeywordCode=function(e,t){const{gen:a,keyword:r,schema:i,parentSchema:o,it:s}=e,l=t.macro.call(s.self,i,o,s),d=p(a,r,l);!1!==s.opts.validateSchema&&s.self.validateSchema(l,!0);const u=a.name("valid");e.subschema({schema:l,schemaPath:n.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var a;const{gen:l,keyword:d,schema:u,parentSchema:c,$data:m,it:f}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,t);const _=!m&&t.compile?t.compile.call(f.self,u,c,f):t.validate,h=p(l,d,_),E=l.let("valid");function y(a=(t.async?n._`await `:n.nil)){const o=f.opts.passContext?r.default.this:r.default.self,s=!("compile"in t&&!m||!1===t.schema);l.assign(E,n._`${a}${(0,i.callValidateCode)(e,h,o,s)}`,t.modifying)}function T(e){var a;l.if((0,n.not)(null!==(a=t.valid)&&void 0!==a?a:E),e)}e.block$data(E,function(){if(!1===t.errors)y(),t.modifying&&s(e),T(()=>e.error());else{const a=t.async?function(){const e=l.let("ruleErrs",null);return l.try(()=>y(n._`await `),t=>l.assign(E,!1).if(n._`${t} instanceof ${f.ValidationError}`,()=>l.assign(e,n._`${t}.errors`),()=>l.throw(t))),e}():function(){const e=n._`${h}.errors`;return l.assign(e,null),y(n.nil),e}();t.modifying&&s(e),T(()=>function(e,t){const{gen:a}=e;a.if(n._`Array.isArray(${t})`,()=>{a.assign(r.default.vErrors,n._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,n._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)},()=>e.error())}(e,a))}}),e.ok(null!==(a=t.valid)&&void 0!==a?a:E)},t.validSchemaType=function(e,t,a=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||a&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:a,errSchemaPath:n},r,i){if(Array.isArray(r.keyword)?!r.keyword.includes(i):r.keyword!==i)throw new Error("ajv implementation error");const o=r.dependencies;if(null==o?void 0:o.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(r.validateSchema){if(!r.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+a.errorsText(r.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);a.logger.error(e)}}}},9354:(e,t,a)=>{a.d(t,{c:()=>u});var n=a(4592),r=a(1360),i=a(3777),o=a(9212),s=a(4019),p=a(7634),l=a(555);function d(e){return e}var u=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=r.En?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=!1!==t.cache,this.resetCache()}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(d,{cache:!1})},e.split=function(t,a,n){return void 0===n&&(n=e.identity()),Object.assign(new e(function(e){return(t(e)?a:n).transformDocument(e)},{cache:!1}),{left:a,right:n})},e.prototype.resetCache=function(){var t=this;if(this.cached){var a=new n.Trie(r.et);this.performWork=(0,p.wrap)(e.prototype.performWork.bind(this),{makeCacheKey:function(e){var n=t.getCacheKey(e);if(n)return(0,o.invariant)(Array.isArray(n),77),a.lookupArray(n)},max:l.v["documentTransform.cache"],cache:s.l})}},e.prototype.performWork=function(e){return(0,i.sw)(e),this.transform(e)},e.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},e.prototype.concat=function(t){var a=this;return Object.assign(new e(function(e){return t.transformDocument(a.transformDocument(e))},{cache:!1}),{left:this,right:t})},e}()},9355:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(458),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:a,it:r}=e;if(!Array.isArray(a))throw new Error("ajv implementation error");const i=t.name("valid");a.forEach((t,a)=>{if((0,n.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:a},i);e.ok(i),e.mergeEvaluated(o)})}};t.default=r},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9367:e=>{e.exports=JSON.parse('{"name":"BrickRect","brickDescription":{"default":"Brick rect component","en-us":"Rect brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378573-rect))","zh-tw":"矩形方塊 ([教學](https://intercom.help/bricks-dag-inc/articles/5378573-rect))","ja-jp":"長方形ブリック ([チュートリアル](https://intercom.help/bricks-dag-inc/articles/5378573-rect))"},"brickDisplayName":"Rect","brickTip":{"default":"@brick-tip-rect","en-us":"Add a Rectangle shape with Background, Border and Corner Radius.","zh-tw":"矩形元件,可設置顏色、邊框及外框導角半徑","ja-jp":"背景、境界線、角丸を設定できる長方形シェイプを追加します。"},"brickMeta":{"useBaseStyle":true,"pressable":true},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"rectangle"},"propTypes":{"linearGradientEnabled":{"type":"bool"},"linearGradientColors":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"linearGradientStart":{"type":"shape","content":{"x":{"type":"number"},"y":{"type":"number"}},"forcePropertyBank":false},"linearGradientEnd":{"type":"shape","content":{"x":{"type":"number"},"y":{"type":"number"}},"forcePropertyBank":false},"linearGradientLocations":{"type":"arrayOf","content":{"type":"number"},"forcePropertyBank":false}},"brickPropDescriptions":{"linearGradientEnabled":{"default":"","en-us":"Enables or disables linear gradient","zh-tw":"Enables or disables linear gradient","ja-jp":"リニアグラデーションの有効/無効を切り替え"},"linearGradientColors":{"default":"","en-us":"An array of at least two color values that represent gradient colors","zh-tw":"一個包含至少兩個顏色值的數組,表示漸變顏色","ja-jp":"グラデーションカラーを表す少なくとも2つのカラー値を含む配列"},"linearGradientStart":{"default":"","en-us":"An optional object of the following type: { x: number, y: number }","zh-tw":"一個可選的對象,類型為:{ x: number, y: number }","ja-jp":"オプションのオブジェクト、タイプ: { x: number, y: number }"},"linearGradientEnd":{"default":"","en-us":"Same as start, but for the end of the gradient","zh-tw":"與 start 相同,但用於漸變的結束","ja-jp":"開始と同じですが、グラデーションの終了位置用"},"linearGradientLocations":{"default":"","en-us":"An optional array of numbers defining the location of each gradient color stop","zh-tw":"一個可選的數組,定義每個漸變顏色停止的位置","ja-jp":"各グラデーションカラーストップの位置を定義するオプションの数値配列"}},"propertyControls":{"linearGradientColors":{"popover":true,"popoverExpectIncludedModalOpen":true,"extendSchema":{"type":"string","kind":"color","popover":true}},"linearGradientStart":{"popover":true,"extendSchema":{"unallowRemoveProperty":true,"properties":{"x":{"type":"number","kind":"unit","unallowRemoveProperty":true,"min":0,"step":0.05},"y":{"type":"number","kind":"unit","unallowRemoveProperty":true,"min":0,"step":0.05}}}},"linearGradientEnd":{"popover":true,"extendSchema":{"unallowRemoveProperty":true,"properties":{"x":{"type":"number","kind":"unit","unallowRemoveProperty":true,"min":0,"step":0.05},"y":{"type":"number","kind":"unit","unallowRemoveProperty":true,"min":0,"step":0.05}}}},"linearGradientLocations":{"popover":true}},"propertyControlGroups":{"linearGradient":{"name":"Linear Gradient","type":"prefix","content":"linearGradient","editor":"gradient-editor"}},"propertyControlGroupDescriptions":{},"defaultBrickProps":{"linearGradientEnabled":false,"linearGradientColors":["#000000","#FFFFFF"],"linearGradientStart":{"x":0,"y":0},"linearGradientEnd":{"x":1,"y":1},"linearGradientLocations":[0,1]},"eventTypes":{"BRICK_RECT_ON_PRESS":"BRICK_RECT_ON_PRESS","BRICK_RECT_ON_PRESS_IN":"BRICK_RECT_ON_PRESS_IN","BRICK_RECT_ON_PRESS_OUT":"BRICK_RECT_ON_PRESS_OUT","BRICK_RECT_ON_LONG_PRESS":"BRICK_RECT_ON_LONG_PRESS","BRICK_RECT_ON_FOCUS":"BRICK_RECT_ON_FOCUS","BRICK_RECT_ON_BLUR":"BRICK_RECT_ON_BLUR"},"brickEventDescriptions":{"BRICK_RECT_ON_PRESS":{"default":"","en-us":"Event of the brick press","zh-tw":"當 brick 被點擊時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_RECT_ON_PRESS_IN":{"default":"","en-us":"Event of the brick press in","zh-tw":"當 brick 被按下時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_RECT_ON_PRESS_OUT":{"default":"","en-us":"Event of the brick press out","zh-tw":"當 brick 按下後被放開時觸發","ja-jp":"ブリックが押されたときに発生するイベント"},"BRICK_RECT_ON_LONG_PRESS":{"default":"","en-us":"Event of the brick long press","zh-tw":"當 brick 被長按時觸發","ja-jp":"ブリックが長押しされたときに発生するイベント"},"BRICK_RECT_ON_FOCUS":{"default":"","en-us":"Event of the brick focus (Use TV Device with controller)","zh-tw":"當 brick 獲得焦點時觸發 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスを獲得したときに発生するイベント (TV デバイスとコントローラーを使用)"},"BRICK_RECT_ON_BLUR":{"default":"","en-us":"Event of the brick blur (Use TV Device with controller)","zh-tw":"當 brick 失去焦點時觸發 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスを失ったときに発生するイベント (TV デバイスとコントローラーを使用)"}},"outletTypes":{"BRICK_PRESSING":{"outlet":"BRICK_PRESSING","type":"bool"},"BRICK_FOCUSING":{"outlet":"BRICK_FOCUSING","type":"bool"}},"brickOutletDescriptions":{"BRICK_PRESSING":{"default":"","en-us":"Brick is pressing","zh-tw":"Brick 被按住中","ja-jp":"ブリックが押されています"},"BRICK_FOCUSING":{"default":"","en-us":"Brick is focusing (Use TV Device with controller)","zh-tw":"Brick 處於焦點狀態中 (適用於 TV 裝置)","ja-jp":"ブリックがフォーカスされています (TV デバイスとコントローラーを使用)"}}}')},9371:(e,t,a)=>{a.r(t),a.d(t,{InvariantError:()=>s,default:()=>m,invariant:()=>p,setVerbosity:()=>c});var n=a(5608),r="Invariant Violation",i=Object.setPrototypeOf,o=void 0===i?function(e,t){return e.__proto__=t,e}:i,s=function(e){function t(a){void 0===a&&(a=r);var n=e.call(this,"number"==typeof a?r+": "+a+" (see https://github.com/apollographql/invariant-packages)":a)||this;return n.framesToPop=1,n.name=r,o(n,t.prototype),n}return(0,n.__extends)(t,e),t}(Error);function p(e,t){if(!e)throw new s(t)}var l=["debug","log","warn","error","silent"],d=l.indexOf("log");function u(e){return function(){if(l.indexOf(e)>=d)return(console[e]||console.log).apply(console,arguments)}}function c(e){var t=l[d];return d=Math.max(0,l.indexOf(e)),t}!function(e){e.debug=u("debug"),e.log=u("log"),e.warn=u("warn"),e.error=u("error")}(p||(p={}));const m=p},9392:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=a(7898),r=a(5031),i=a(3036),o=a(4856),s=a(458),p=a(6223);class l{constructor(e){var t;let a;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(a=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==a?void 0:a[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==a?void 0:a.$async,this.refs={}}}function d(e){const t=c.call(this,e);if(t)return t;const a=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:s,lines:l}=this.opts.code,{ownProperties:d}=this.opts,u=new n.CodeGen(this.scope,{es5:s,lines:l,ownProperties:d});let m;e.$async&&(m=u.scopeValue("Error",{ref:r.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const f=u.scopeName("validate");e.validateName=f;const _={gen:u,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:m,schema:e.schema,schemaEnv:e,rootId:a,baseId:e.baseId||a,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let h;try{this._compilations.add(e),(0,p.validateFunctionCode)(_),u.optimize(this.opts.code.optimize);const t=u.toString();h=`${u.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(h=this.opts.code.process(h,e));const a=new Function(`${i.default.self}`,`${i.default.scope}`,h)(this,this.scope.get());if(this.scope.value(f,{ref:a}),a.errors=null,a.schema=e.schema,a.schemaEnv=e,e.$async&&(a.$async=!0),!0===this.opts.code.source&&(a.source={validateName:f,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=_;a.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},a.source&&(a.source.evaluated=(0,n.stringify)(a.evaluated))}return e.validate=a,e}catch(t){throw delete e.validate,delete e.validateName,h&&this.logger.error("Error compiling schema, function code:",h),t}finally{this._compilations.delete(e)}}function u(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function c(e){for(const t of this._compilations)if(m(t,e))return t}function m(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function f(e,t){let a;for(;"string"==typeof(a=this.refs[t]);)t=a;return a||this.schemas[t]||_.call(this,e,t)}function _(e,t){const a=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,a);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===r)return E.call(this,a,e);const i=(0,o.normalizeId)(n),s=this.refs[i]||this.schemas[i];if("string"==typeof s){const t=_.call(this,e,s);if("object"!=typeof(null==t?void 0:t.schema))return;return E.call(this,a,t)}if("object"==typeof(null==s?void 0:s.schema)){if(s.validate||d.call(this,s),i===(0,o.normalizeId)(t)){const{schema:t}=s,{schemaId:a}=this.opts,n=t[a];return n&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,n)),new l({schema:t,schemaId:a,root:e,baseId:r})}return E.call(this,a,s)}}t.SchemaEnv=l,t.compileSchema=d,t.resolveRef=function(e,t,a){var n;a=(0,o.resolveUrl)(this.opts.uriResolver,t,a);const r=e.refs[a];if(r)return r;let i=f.call(this,e,a);if(void 0===i){const r=null===(n=e.localRefs)||void 0===n?void 0:n[a],{schemaId:o}=this.opts;r&&(i=new l({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[a]=u.call(this,i):void 0},t.getCompilingSchema=c,t.resolveSchema=_;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function E(e,{baseId:t,schema:a,root:n}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof a)return;const e=a[(0,s.unescapeFragment)(n)];if(void 0===e)return;const r="object"==typeof(a=e)&&a[this.opts.schemaId];!h.has(n)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}let i;if("boolean"!=typeof a&&a.$ref&&!(0,s.schemaHasRulesButRef)(a,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,a.$ref);i=_.call(this,n,e)}const{schemaId:p}=this.opts;return i=i||new l({schema:a,schemaId:p,root:n,baseId:t}),i.schema!==i.root.schema?i:void 0}},9409:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=a(7898),r=a(458),i=a(3036);function o(e,t){const a=e.const("err",t);e.if(n._`${i.default.vErrors} === null`,()=>e.assign(i.default.vErrors,n._`[${a}]`),n._`${i.default.vErrors}.push(${a})`),e.code(n._`${i.default.errors}++`)}function s(e,t){const{gen:a,validateName:r,schemaEnv:i}=e;i.$async?a.throw(n._`new ${e.ValidationError}(${t})`):(a.assign(n._`${r}.errors`,t),a.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,a=t.keywordError,r,i){const{it:p}=e,{gen:d,compositeRule:u,allErrors:c}=p,m=l(e,a,r);(null!=i?i:u||c)?o(d,m):s(p,n._`[${m}]`)},t.reportExtraError=function(e,a=t.keywordError,n){const{it:r}=e,{gen:p,compositeRule:d,allErrors:u}=r;o(p,l(e,a,n)),d||u||s(r,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if(n._`${i.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(n._`${i.default.vErrors}.length`,t),()=>e.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:a,data:r,errsCount:o,it:s}){if(void 0===o)throw new Error("ajv implementation error");const p=e.name("err");e.forRange("i",o,i.default.errors,o=>{e.const(p,n._`${i.default.vErrors}[${o}]`),e.if(n._`${p}.instancePath === undefined`,()=>e.assign(n._`${p}.instancePath`,(0,n.strConcat)(i.default.instancePath,s.errorPath))),e.assign(n._`${p}.schemaPath`,n.str`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign(n._`${p}.schema`,a),e.assign(n._`${p}.data`,r))})};const p={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function l(e,t,a){const{createErrors:r}=e.it;return!1===r?n._`{}`:function(e,t,a={}){const{gen:r,it:o}=e,s=[d(o,a),u(e,a)];return function(e,{params:t,message:a},r){const{keyword:o,data:s,schemaValue:l,it:d}=e,{opts:u,propertyName:c,topSchemaRef:m,schemaPath:f}=d;r.push([p.keyword,o],[p.params,"function"==typeof t?t(e):t||n._`{}`]),u.messages&&r.push([p.message,"function"==typeof a?a(e):a]);u.verbose&&r.push([p.schema,l],[p.parentSchema,n._`${m}${f}`],[i.default.data,s]);c&&r.push([p.propertyName,c])}(e,t,s),r.object(...s)}(e,t,a)}function d({errorPath:e},{instancePath:t}){const a=t?n.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[i.default.instancePath,(0,n.strConcat)(i.default.instancePath,a)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:a,parentSchema:i}){let o=i?t:n.str`${t}/${e}`;return a&&(o=n.str`${o}${(0,r.getErrorPath)(a,r.Type.Str)}`),[p.schemaPath,o]}},9417:e=>{e.exports=JSON.parse('{"name":"logictype","description":null,"description_zh_TW":null,"description_ja_JP":null,"commands":{"LOGICTYPE_AND":{"name":"And","description":"And","description_zh_TW":"且","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_CLONE":{"name":"Clone","description":"Clone value","description_zh_TW":"Clone value","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"any"}]},"LOGICTYPE_EQUAL_VALUE":{"name":"Equal value","description":"Compare by value (deep)","description_zh_TW":"判斷兩個參數是否相等 (深度比對)","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IF":{"name":"If","description":"Condition for return truthy or falsy","description_zh_TW":"判斷 condition 來決定是傳回 truthy 或是 falsy 的指定值","arg":[{"name":"condition","type":"any","subType":false,"defaultValue":"undefined"},{"name":"truthy","type":"any","subType":false,"defaultValue":"undefined"},{"name":"falsy","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"any"}]},"LOGICTYPE_IS_ARRAY":{"name":"Is array","description":"Is it an array?","description_zh_TW":"判斷是否為陣列","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_BOOLEAN":{"name":"Is boolean","description":"Is it boolean?","description_zh_TW":"判斷是否為布林值","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_DATETIME":{"name":"Is datetime","description":"Is it a datetime?","description_zh_TW":"判斷是否為時間","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_EMPTY":{"name":"Is empty","description":"Is it empty?","description_zh_TW":"判斷是否為空值","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_INTEGER":{"name":"Is integer","description":"Is it integer?","description_zh_TW":"判斷是否為整數","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_NUMBER":{"name":"Is number","description":"Is it a number?","description_zh_TW":"判斷是否為數字","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_OBJECT":{"name":"Is object","description":"Is it a object?","description_zh_TW":"判斷是否為物件","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_IS_STRING":{"name":"Is string","description":"Is it string?","description_zh_TW":"判斷是否為字串","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_NOT":{"name":"Not","description":"Not","description_zh_TW":"反向值","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_NOT_EQUAL_VALUE":{"name":"Not equal value","description":"Compare not equal by value (deep)","description_zh_TW":"判斷兩個參數是否不相等 (深度比對)","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_OR":{"name":"或","description":"","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_TO_ARRAY":{"name":"Convert to array","description":"Convert to array if possible, return fail_value if failed (Supported JSON)","description_zh_TW":"盡可能的轉換為陣列,若轉換失敗則回傳 fail_value (支援 JSON)","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"array","subType":false,"defaultValue":"[]"}],"return":[{"name":"result","type":"array"}]},"LOGICTYPE_TO_BOOLEAN":{"name":"Convert to boolean","description":"Convert to boolean","description_zh_TW":"轉換為布林值","arg":[{"name":"value","type":"any","subType":false}],"return":[{"name":"result","type":"bool"}]},"LOGICTYPE_TO_DATETIME":{"name":"Convert to datetime","description":"Convert to datetime if possible, return fail_value if failed","description_zh_TW":"盡可能的換為日期時間,若轉換失敗則回傳 fail_value","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"datetime","subType":false,"defaultValue":"DATETIME_NOW"}],"return":[{"name":"result","type":"datetime"}]},"LOGICTYPE_TO_INTEGER":{"name":"Convert to integer","description":"Convert to integer if possible, return fail_value if failed","description_zh_TW":"盡可能的換為整數,若轉換失敗則回傳 fail_value","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"integer","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"integer"}]},"LOGICTYPE_TO_NUMBER":{"name":"Convert to number","description":"Convert to number if possible, return fail_value if failed","description_zh_TW":"盡可能的換為數字,若轉換失敗則回傳 fail_value","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"number","subType":false,"defaultValue":"0"}],"return":[{"name":"result","type":"number"}]},"LOGICTYPE_TO_OBJECT":{"name":"Convert to object","description":"Convert to object if possible, return fail_value if failed (Supported JSON)","description_zh_TW":"盡可能的轉換為物件,若轉換失敗則回傳 fail_value (支援 JSON)","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"object","subType":false,"defaultValue":"{}"}],"return":[{"name":"result","type":"object"}]},"LOGICTYPE_TO_STRING":{"name":"Convert to string","description":"Convert to string if possible, return fail_value if failed (Supported JSON and Datetime format)","description_zh_TW":"盡可能的轉換為日期時間,若轉換失敗則回傳 fail_value (支援 JSON 以及 Datetime format)","arg":[{"name":"value","type":"any","subType":false},{"name":"fail_value","type":"string","subType":false,"defaultValue":"\\"\\""}],"return":[{"name":"result","type":"string"}]},"LOGICTYPE_XOR":{"name":"XOR","description":"XOR","description_zh_TW":"互斥或","arg":[{"name":"value","type":"any","subType":false,"defaultValue":"undefined"},{"name":"other","type":"any","subType":false,"defaultValue":"undefined"}],"return":[{"name":"result","type":"bool"}]}}}')},9430:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:a(4450).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},9436:e=>{function t(e,t,a,n,r,i,o){try{var s=e[i](o),p=s.value}catch(e){return void a(e)}s.done?t(p):Promise.resolve(p).then(n,r)}e.exports=function(e){return function(){var a=this,n=arguments;return new Promise(function(r,i){var o=e.apply(a,n);function s(e){t(o,r,i,s,p,"next",e)}function p(e){t(o,r,i,s,p,"throw",e)}s(void 0)})}},e.exports.__esModule=!0,e.exports.default=e.exports},9458:(e,t,a)=>{const{getIDPattern:n}=a(1639),r=n("SUBSPACE"),i=n("TEST");e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://display.bricks.tools/root.schema.json5",title:"Root",description:"A brick root config",type:"object",properties:{title:{type:"string",description:"The root config name."},root_subspace_id:{type:"string",description:"The root subspace id.",pattern:r},subspace_map:{type:"object",patternProperties:{[r]:{$ref:"http://display.bricks.tools/subspace.schema.json5",description:"Root config can have many subspace."}},additionalProperties:!1},test_map:{type:"object",patternProperties:{[i]:{$ref:"http://display.bricks.tw/test.schema.json5",description:"Root config can have many test."}},additionalProperties:!1,deprecated:!0,description:"Deprecated in favor of automation_map.AUTOMATION_MAP_DEFAULT"},automation_map:{$ref:"http://display.bricks.tools/automation_map.schema.json5",description:"Maps of automation tests organized by collection"},show_viewports:{type:"boolean",description:"Show device viewport reference on editor"},enable_unstable_bricks:{type:"boolean",description:"Enable unstable bricks / generators"},hide_short_refs:{type:"boolean",description:"Hide all instances in Short Edit mode"},warnings:{type:"array",description:"Config validation warnings from server"}},required:["title","subspace_map","root_subspace_id"]}},9470:e=>{e.exports=JSON.parse('{"name":"BrickCamera","brickDescription":{"default":"Brick camera component","en-us":"Camera view brick ([Tutorial](https://intercom.help/bricks-dag-inc/articles/5378589-camera))","zh-tw":"攝像頭顯示方塊 ([教學](https://intercom.help/bricks-dag-inc/articles/5378589-camera))","ja-jp":"カメラビューブリック ([チュートリアル](https://intercom.help/bricks-dag-inc/articles/5378589-camera))"},"brickDisplayName":"Camera","brickTip":{"default":"@brick-tip-camera","en-us":"Add a Device Camera Viewer with Type, Ratio, etc. setting.(Control by Camera Generator and Event)","zh-tw":"攝影機顯示元件,可透過 Type 決定鏡頭。需透過 Camera Generator 及事件做控制","ja-jp":"タイプやアスペクト比などの設定を備えたデバイスカメラビューアーを追加します。(カメラジェネレーターとイベントで制御)"},"brickMeta":{"hasActions":true,"scriptMember":true},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"camera"},"propTypes":{"type":{"type":"oneOf","content":["back","front","external"],"forcePropertyBank":false},"isActive":{"type":"bool"},"zoom":{"type":"number"},"flashMode":{"type":"oneOf","content":["off","on","torch","auto"],"forcePropertyBank":false},"ratio":{"type":"string"},"captureAudio":{"type":"bool"},"whiteBalance":{"type":"oneOf","content":["auto","sunny","cloudy","shadow","incandescent","fluorescent"],"forcePropertyBank":false},"faceDetectionEnabled":{"type":"bool"},"faceDetectionEventMode":{"type":"oneOf","content":["when-detected","interval"],"forcePropertyBank":false},"pictureQuality":{"type":"number"},"pictureBase64":{"type":"bool"},"pictureIsMirrorImage":{"type":"bool"},"recordQuality":{"type":"oneOf","content":["4:3","288p","480p","720p","1080p","2160p"],"forcePropertyBank":false},"recordVideoBitrate":{"type":"number"},"recordMirrorVideo":{"type":"bool"},"recordMaxDuration":{"type":"number"},"recordMaxFileSize":{"type":"number"}},"brickPropDescriptions":{"type":{"default":"","en-us":"Camera type","zh-tw":"攝像頭位置","ja-jp":"カメラタイプ"},"isActive":{"default":"","en-us":"Enable or disable camera","zh-tw":"啟用或停用攝像頭","ja-jp":"カメラを有効または無効にする"},"zoom":{"default":"","en-us":"Camera zoom","zh-tw":"放大比例","ja-jp":"カメラズーム"},"flashMode":{"default":"","en-us":"Camera flash mode","zh-tw":"閃光模式","ja-jp":"カメラのフラッシュモード"},"ratio":{"default":"","en-us":"Camera ratio (Unsupported ratio will be ignored)","zh-tw":"相機比例(不支援的比例會被忽略)","ja-jp":"カメラ比率(サポートされていない比率は無視されます)"},"captureAudio":{"default":"","en-us":"Capture audio when start recording","zh-tw":"錄製影片時包含聲音","ja-jp":"録画開始時に音声もキャプチャする"},"whiteBalance":{"default":"","en-us":"Allows you to control the color temperature in your photos by cooling down or warming up the colors.","zh-tw":"白平衡設定","ja-jp":"色温度を調整して写真の色を冷たくしたり暖かくしたりすることができます"},"faceDetectionEnabled":{"default":"","en-us":"Enable face detection (Note: Barcode detection will be disabled when enabled)","zh-tw":"啟用臉部偵測(注意:啟用時條碼偵測將會停用)","ja-jp":"顔検出を有効化(注意:有効にするとバーコード検出は無効になります)"},"faceDetectionEventMode":{"default":"","en-us":"Face detection event mode","zh-tw":"Face detection event mode","ja-jp":"顔検出イベントモード"},"pictureQuality":{"default":"","en-us":"Quality of take picture","zh-tw":"擷取照片品質","ja-jp":"撮影画質"},"pictureBase64":{"default":"","en-us":"Take picture format as base64","zh-tw":"以 base64 格式資料作為擷取照片結果","ja-jp":"撮影画像をbase64形式で出力"},"pictureIsMirrorImage":{"default":"","en-us":"Mirror image of take picture","zh-tw":"擷取照片以鏡像呈現","ja-jp":"撮影画像を鏡像として表示"},"recordQuality":{"default":"","en-us":"Quality of record video","zh-tw":"錄製影片品質","ja-jp":"録画品質"},"recordVideoBitrate":{"default":"","en-us":"Bitrate of record video (bit/s)","zh-tw":"錄製影片位元傳輸率 (bit/s)","ja-jp":"録画ビットレート (bit/s)"},"recordMirrorVideo":{"default":"","en-us":"Mirror video of record video","zh-tw":"擷取照片以鏡像呈現","ja-jp":"録画を鏡像として表示"},"recordMaxDuration":{"default":"","en-us":"Max duration of record video (s)","zh-tw":"限制錄製最大時間 (s)","ja-jp":"録画の最大時間 (s)"},"recordMaxFileSize":{"default":"","en-us":"Max file size of record video (bytes)","zh-tw":"限制錄製最大檔案大小 (bytes)","ja-jp":"録画の最大ファイルサイズ (bytes)"}},"defaultBrickProps":{"type":"back","flashMode":"off","captureAudio":false,"whiteBalance":"auto","faceDetectionEnabled":false,"faceDetectionEventMode":"when-detected"},"propertyControls":{"zoom":{"kind":"unit","step":0.5,"max":16,"min":1},"flashMode":{"oneOfEmptyOption":false},"type":{"oneOfEmptyOption":false},"whiteBalance":{"oneOfEmptyOption":false},"faceDetectionEventMode":{"oneOfEmptyOption":false},"pictureQuality":{"kind":"unit","step":0.1,"max":1,"min":0},"recordVideoBitrate":{"kind":"unit","unit":"bit/s"},"recordMaxDuration":{"kind":"unit","unit":"s"},"recordMaxFileSize":{"kind":"unit","unit":"bytes"}},"propertyControlGroups":{"faceDetection":{"name":"Face Detection","type":"prefix","content":"faceDetection"},"picture":{"name":"Picture","type":"prefix","content":"picture"},"record":{"name":"Record","type":"prefix","content":"record"}},"propertyControlGroupDescriptions":{},"outletTypes":{"BRICK_CAMERA_INFO":{"outlet":"BRICK_CAMERA_INFO","type":"object"},"BRICK_CAMERA_PICTURE_TAKEN":{"outlet":"BRICK_CAMERA_PICTURE_TAKEN","type":"object"},"BRICK_CAMERA_RECORD_VIDEO":{"outlet":"BRICK_CAMERA_RECORD_VIDEO","type":"object"},"BRICK_CAMERA_BARCODE_READ":{"outlet":"BRICK_CAMERA_BARCODE_READ","type":"object"},"BRICK_CAMERA_FACE_DETECTED":{"outlet":"BRICK_CAMERA_FACE_DETECTED","type":"object"}},"brickOutletDescriptions":{"BRICK_CAMERA_INFO":{"default":"","en-us":"Camera device and format information","zh-tw":"攝像頭裝置與格式資訊","ja-jp":"カメラデバイスとフォーマット情報"},"BRICK_CAMERA_PICTURE_TAKEN":{"default":"","en-us":"Picture taken result","zh-tw":"擷取照片結果","ja-jp":"撮影結果"},"BRICK_CAMERA_RECORD_VIDEO":{"default":"","en-us":"Record video result","zh-tw":"錄製影片結果","ja-jp":"録画結果"},"BRICK_CAMERA_BARCODE_READ":{"default":"","en-us":"Barcode read result","zh-tw":"條碼辨識結果","ja-jp":"バーコード読み取り結果"},"BRICK_CAMERA_FACE_DETECTED":{"default":"","en-us":"Faces detected result","zh-tw":"人臉偵測結果","ja-jp":"顔検出結果"}},"actionTypes":{"BRICK_CAMERA_TAKE_PICTURE":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"BRICK_CAMERA_WIDTH":{"type":"number"},"BRICK_CAMERA_QUALITY":{"type":"string"},"BRICK_CAMERA_BASE64":{"type":"bool"},"BRICK_CAMERA_MIRROR_IMAGE":{"type":"bool"}}},"BRICK_CAMERA_RECORD":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"BRICK_CAMERA_QUALITY":{"type":"oneOf","oneOf":["4:3","288p","480p","720p","1080p","2160p"]},"BRICK_CAMERA_MIRROR_VIDEO":{"type":"bool"},"BRICK_CAMERA_VIDEO_BITRATE":{"type":"string"},"BRICK_CAMERA_MAX_DURATION":{"type":"number"},"BRICK_CAMERA_MAX_FILE_SIZE":{"type":"string"}}},"BRICK_CAMERA_STOP_RECORD":{"disallowMultiple":true,"canProvideProperty":false},"BRICK_CAMERA_FOCUS":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"BRICK_CAMERA_FOCUS_X":{"type":"number"},"BRICK_CAMERA_FOCUS_Y":{"type":"number"}}}},"brickActionDescriptions":{"BRICK_CAMERA_TAKE_PICTURE":{"default":"","en-us":"Take picture on the Camera","zh-tw":"擷取照片","ja-jp":"カメラで写真を撮る"},"BRICK_CAMERA_RECORD":{"default":"","en-us":"Record video on the Camera","zh-tw":"錄製影片","ja-jp":"カメラで動画を録画"},"BRICK_CAMERA_STOP_RECORD":{"default":"","en-us":"Record video on the Camera","zh-tw":"結束錄製影片","ja-jp":"カメラでの録画を停止"},"BRICK_CAMERA_FOCUS":{"default":"","en-us":"Focus the Camera at a specific point","zh-tw":"對焦至指定位置","ja-jp":"指定位置にフォーカスを合わせる"}},"eventTypes":{"BRICK_CAMERA_STATE_CHANGE":"BRICK_CAMERA_STATE_CHANGE","BRICK_CAMERA_RECORD_START":"BRICK_CAMERA_RECORD_START","BRICK_CAMERA_RECORD_END":"BRICK_CAMERA_RECORD_END","BRICK_CAMERA_BARCODE_READ":"BRICK_CAMERA_BARCODE_READ","BRICK_CAMERA_PICTURE_TAKEN":"BRICK_CAMERA_PICTURE_TAKEN","BRICK_CAMERA_RECORD_FINISH":"BRICK_CAMERA_RECORD_FINISH","BRICK_CAMERA_MOUNT_ERROR":"BRICK_CAMERA_MOUNT_ERROR"},"brickEventDescriptions":{"BRICK_CAMERA_STATE_CHANGE":{"default":"","en-us":"Event of the Camera state change","zh-tw":"Event of the Camera state change","ja-jp":"カメラの状態変更イベント"},"BRICK_CAMERA_RECORD_START":{"default":"","en-us":"Event of the Camera record start","zh-tw":"當錄製開始時觸發事件","ja-jp":"カメラの録画開始イベント"},"BRICK_CAMERA_RECORD_END":{"default":"","en-us":"Event of the Camera record end","zh-tw":"當錄製結束時觸發事件","ja-jp":"カメラの録画終了イベント"},"BRICK_CAMERA_BARCODE_READ":{"default":"","en-us":"Event of the Camera barcode read","zh-tw":"當讀取到條碼時觸發事件","ja-jp":"カメラのバーコード読み取りイベント"},"BRICK_CAMERA_PICTURE_TAKEN":{"default":"","en-us":"Event of the Camera picture taken","zh-tw":"當擷取照片完畢時觸發事件","ja-jp":"カメラの写真撮影完了イベント"},"BRICK_CAMERA_RECORD_FINISH":{"default":"","en-us":"Event of the Camera record finished","zh-tw":"當錄製影片完畢時觸發事件","ja-jp":"カメラの録画完了イベント"},"BRICK_CAMERA_MOUNT_ERROR":{"default":"","en-us":"Event of the Camera mount error","zh-tw":"當攝像頭掛載失敗時觸發事件","ja-jp":"カメラのマウントエラーイベント"}},"eventPropertyControls":{"BRICK_CAMERA_STATE_CHANGE":{"properties":{"BRICK_CAMERA_STATUS":{"name":"Status","type":"string"},"BRICK_CAMERA_RECORD_AUDIO_PERM_STATUS":{"name":"Record Audio Permission Status","type":"string"}}},"BRICK_CAMERA_BARCODE_READ":{"properties":{"BRICK_CAMERA_BARCODE_TYPE":{"name":"Type","type":"string"},"BRICK_CAMERA_BARCODE_DATA":{"name":"Data","type":"string"},"BRICK_CAMERA_BARCODE_RAW_DATA":{"name":"Raw Data","type":"string"},"BRICK_CAMERA_BARCODE_X":{"name":"X","type":"number"},"BRICK_CAMERA_BARCODE_Y":{"name":"Y","type":"number"},"BRICK_CAMERA_BARCODE_WIDTH":{"name":"Width","type":"number"},"BRICK_CAMERA_BARCODE_HEIGHT":{"name":"Height","type":"number"}}},"BRICK_CAMERA_PICTURE_TAKEN":{"properties":{"BRICK_CAMERA_WIDTH":{"name":"Width","type":"number"},"BRICK_CAMERA_HEIGHT":{"name":"Height","type":"number"},"BRICK_CAMERA_URI":{"name":"URI","type":"string"}}},"BRICK_CAMERA_RECORD_FINISH":{"properties":{"BRICK_CAMERA_URI":{"name":"URI","type":"string"}}},"BRICK_CAMERA_MOUNT_ERROR":{"properties":{"BRICK_CAMERA_MOUNT_ERROR":{"name":"Error","type":"string"}}}},"scriptMemberFunctionDefs":{"takePicture":{"description":"Take a picture with the camera","arguments":[{"type":"object","name":"options","properties":{"quality":{"type":"number","description":"Picture quality (0-1)","default":0.6},"base64":{"type":"boolean","description":"Return base64 encoded image data","default":false},"isImageMirror":{"type":"boolean","description":"Mirror the captured image","default":false}}}],"required":[],"return":{"type":"object","description":"Picture data with width, height, uri, and optional base64"},"timeout":10000},"startRecord":{"description":"Start recording video with the camera","arguments":[{"type":"object","name":"options","properties":{"quality":{"type":"string","description":"Video quality (4:3, 288p, 480p, 720p, 1080p, 2160p)"},"videoBitrate":{"type":"number","description":"Video bitrate in bit/s"},"mirror":{"type":"boolean","description":"Mirror the recorded video","default":false},"maxDuration":{"type":"number","description":"Maximum recording duration in seconds"},"maxFileSize":{"type":"number","description":"Maximum file size in bytes"},"waitEnd":{"type":"boolean","description":"Wait for recording to end before resolving","default":false}}}],"required":[],"return":{"type":"object","description":"Recording result with uri (if waitEnd is true) or recording start confirmation"}},"stopRecord":{"description":"Stop recording video","arguments":[],"required":[],"return":{"type":"boolean"}},"pausePreview":{"description":"Pause camera preview","arguments":[],"required":[],"return":{"type":"boolean"}},"resumePreview":{"description":"Resume camera preview","arguments":[],"required":[],"return":{"type":"boolean"}},"focus":{"description":"Focus the camera at a specific point (tap-to-focus)","arguments":[{"type":"object","name":"point","properties":{"x":{"type":"number","description":"X coordinate (0-1 normalized or pixel value). 0 = left edge, 1 = right edge"},"y":{"type":"number","description":"Y coordinate (0-1 normalized or pixel value). 0 = top edge, 1 = bottom edge"}}}],"required":["point"],"return":{"type":"boolean","description":"True if focus was triggered successfully"}}},"scriptMemberFunctionDefDescriptions":{}}')},9520:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r=a(458),i=a(2725),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:a,$data:o,schemaCode:s,schema:p}=e;o||p&&"object"==typeof p?e.fail$data(n._`!${(0,r.useFunc)(t,i.default)}(${a}, ${s})`):e.fail(n._`${p} !== ${a}`)}};t.default=o},9537:(e,t,a)=>{a.d(t,{_:()=>s,k:()=>o});var n=a(3217),r=a(5198),i=a(792);class o{constructor(e,t="GraphQL request",a={line:1,column:1}){"string"==typeof e||(0,n.U)(!1,`Body must be a string. Received: ${(0,r.N)(e)}.`),this.body=e,this.name=t,this.locationOffset=a,this.locationOffset.line>0||(0,n.U)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,n.U)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function s(e){return(0,i.h)(e,o)}},9546:e=>{var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},9557:(e,t,a)=>{e.exports=(e=>{var t={};return a.d(t,e),t})({TerminalInfoProvider:()=>s.TerminalInfoProvider,default:()=>s.default})},9563:e=>{e.exports=JSON.parse('{"name":"GeneratorIterator","brickDescription":{"default":"","en-us":"Iterate through values (Array, Object, Number, String)","zh-tw":"數值迭代 (Array, Object, Number, String)","ja-jp":"値を反復処理 (配列、オブジェクト、数値、文字列)"},"brickDisplayName":"Iterator","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"rotate"},"propTypes":{"data":{"type":"any"},"start":{"type":"number"},"step":{"type":"number"},"maxQuantity":{"type":"number"},"loop":{"type":"bool"}},"brickPropDescriptions":{"data":{"default":"","en-us":"Data source for iteration. If it\'s an Array, it will iterate through elements. If it\'s an Object, it will use Object.entries() to get key-value pairs. If it\'s a String, it will iterate through characters. If it\'s a Number, it represents count from 1 to N.","zh-tw":"用來取值的資料來源,如果為 Array 則會取得元素,如果為 Object 則使用 Object.entries() 取得鍵值對,如果為 String 則迭代字元,如果為 Number 則代表由 1~N 的計數","ja-jp":"反復処理のためのデータソース。配列の場合は要素を取得し、オブジェクトの場合はObject.entries()でキーと値のペアを取得し、文字列の場合は文字を反復処理し、数値の場合は1〜Nのカウントを表します"},"start":{"default":"","en-us":"Starting element position","zh-tw":"起始元素位置","ja-jp":"開始要素の位置"},"step":{"default":"","en-us":"Step size for each iteration","zh-tw":"單次跳動的位移量","ja-jp":"各反復の増分"},"maxQuantity":{"default":"","en-us":"Maximum number of iterations (can be set to -1 for unlimited). When reached, further iteration actions will be silently ignored.","zh-tw":"總共可迭代個數上限 (可以設置為 -1 作為無上限)。達到上限後,後續的迭代動作將被靜默忽略。","ja-jp":"反復処理の最大数(無制限の場合は-1に設定可能)。上限に達すると、それ以降の反復アクションは静かに無視されます。"},"loop":{"default":"","en-us":"Whether to loop the iteration","zh-tw":"是否循環迭代","ja-jp":"反復処理をループするかどうか"}},"defaultBrickProps":{"data":[],"start":0,"step":1},"propertyControls":{"data":{"setupDefaultAfterNewItemOfSchema":true,"required":true},"step":{"kind":"unit","min":1,"step":1}},"outletTypes":{"GENERATOR_ITERATOR_ITERATED_ARRAY":{"outlet":"GENERATOR_ITERATOR_ITERATED_ARRAY","type":"array"},"GENERATOR_ITERATOR_UPCOMING_ARRAY":{"outlet":"GENERATOR_ITERATOR_UPCOMING_ARRAY","type":"array"},"GENERATOR_ITERATOR_VALUE":{"outlet":"GENERATOR_ITERATOR_VALUE","type":"any"},"GENERATOR_ITERATOR_KEY":{"outlet":"GENERATOR_ITERATOR_KEY","type":"any"},"GENERATOR_ITERATOR_INDEX":{"outlet":"GENERATOR_ITERATOR_INDEX","type":"number"}},"brickOutletDescriptions":{"GENERATOR_ITERATOR_ITERATED_ARRAY":{"default":"","en-us":"Elements that have been iterated (including current one)","zh-tw":"已經迭代過的元素(包含目前的)","ja-jp":"反復処理された要素(現在のものを含む)"},"GENERATOR_ITERATOR_UPCOMING_ARRAY":{"default":"","en-us":"Elements that will be iterated but have not been iterated yet","zh-tw":"會參與迭代但尚未迭代過的元素","ja-jp":"反復処理される予定だがまだ処理されていない要素"},"GENERATOR_ITERATOR_VALUE":{"default":"","en-us":"Current iteration element","zh-tw":"目前的迭代元素","ja-jp":"現在の反復要素"},"GENERATOR_ITERATOR_KEY":{"default":"","en-us":"Key of the current iteration element (for number: same as value, for array/string: index, for object: string key)","zh-tw":"目前迭代元素的 Key(number: 則此值與 value 相同,array, string: 則此值為 index,object: 則此值為字串)","ja-jp":"現在の反復要素のキー(数値の場合:値と同じ、配列・文字列の場合:インデックス、オブジェクトの場合:文字列キー)"},"GENERATOR_ITERATOR_INDEX":{"default":"","en-us":"Current iteration count (if data is 6 and step is 2, this will return: 1,2,3 in sequence)","zh-tw":"目前的迭代次數(如果 data 為 6, step 為 2,則此值會依序回傳:1,2,3)","ja-jp":"現在の反復回数(dataが6でstepが2の場合、この値は順番に1,2,3を返します)"}},"actionTypes":{"GENERATOR_ITERATOR_NEXT":{"canProvideProperty":false},"GENERATOR_ITERATOR_PREVIOUS":{"canProvideProperty":false},"GENERATOR_ITERATOR_FIRST":{"canProvideProperty":false},"GENERATOR_ITERATOR_LAST":{"canProvideProperty":false},"GENERATOR_ITERATOR_RESET":{"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_ITERATOR_NEXT":{"default":"","en-us":"Proceed to next iteration","zh-tw":"進行下一次迭代","ja-jp":"次の反復に進む"},"GENERATOR_ITERATOR_PREVIOUS":{"default":"","en-us":"Go back to previous iteration","zh-tw":"退回至上一次迭代","ja-jp":"前の反復に戻る"},"GENERATOR_ITERATOR_FIRST":{"default":"","en-us":"Jump to the first iteration element","zh-tw":"跳至第一個迭代元素","ja-jp":"最初の反復要素にジャンプする"},"GENERATOR_ITERATOR_LAST":{"default":"","en-us":"Jump to the last iteration element (ignoring the loop setting)","zh-tw":"跳至最後一個迭代元素(忽略 loop 的設定值)","ja-jp":"最後の反復要素にジャンプする(loop設定を無視)"},"GENERATOR_ITERATOR_RESET":{"default":"","en-us":"Reset iteration state","zh-tw":"重置迭代狀態","ja-jp":"反復状態をリセット"}},"eventTypes":{"GENERATOR_ITERATOR_ITERATE":"GENERATOR_ITERATOR_ITERATE","GENERATOR_ITERATOR_FIRST":"GENERATOR_ITERATOR_FIRST","GENERATOR_ITERATOR_END":"GENERATOR_ITERATOR_END","GENERATOR_ITERATOR_ERROR":"GENERATOR_ITERATOR_ERROR"},"brickEventDescriptions":{"GENERATOR_ITERATOR_ITERATE":{"default":"","en-us":"Event triggered on each iteration","zh-tw":"每次發生迭代都會觸發此 Event","ja-jp":"各反復処理で発生するイベント"},"GENERATOR_ITERATOR_FIRST":{"default":"","en-us":"Event triggered on the first iteration of a round","zh-tw":"當單輪首次迭代會觸發此 Event","ja-jp":"1回の反復処理の最初に発生するイベント"},"GENERATOR_ITERATOR_END":{"default":"","en-us":"Event triggered on the last iteration of a round","zh-tw":"當單輪迭代至最後會觸發此 Event","ja-jp":"1回の反復処理の最後に発生するイベント"},"GENERATOR_ITERATOR_ERROR":{"default":"","en-us":"Event triggered when data type is invalid or unexpected","zh-tw":"當資料類型無效或非預期時觸發此 Event","ja-jp":"データ型が無効または予期しない場合に発生するイベント"}},"eventPropertyControls":{"GENERATOR_ITERATOR_ITERATE":{"properties":{"GENERATOR_ITERATOR_ITERATE_VALUE":{"name":"Value","type":"any"},"GENERATOR_ITERATOR_ITERATE_KEY":{"name":"Key","type":"any"},"GENERATOR_ITERATOR_ITERATE_INDEX":{"name":"Index","type":"number"}}},"GENERATOR_ITERATOR_FIRST":{"properties":{"GENERATOR_ITERATOR_ITERATE_VALUE":{"name":"Value","type":"any"},"GENERATOR_ITERATOR_ITERATE_KEY":{"name":"Key","type":"any"},"GENERATOR_ITERATOR_ITERATE_INDEX":{"name":"Index","type":"number"}}},"GENERATOR_ITERATOR_END":{"properties":{"GENERATOR_ITERATOR_ITERATE_VALUE":{"name":"Value","type":"any"},"GENERATOR_ITERATOR_ITERATE_KEY":{"name":"Key","type":"any"},"GENERATOR_ITERATOR_ITERATE_INDEX":{"name":"Index","type":"number"}}},"GENERATOR_ITERATOR_ERROR":{"properties":{"GENERATOR_ITERATOR_ERROR_MESSAGE":{"name":"Error Message","type":"string"},"GENERATOR_ITERATOR_ERROR_DATA":{"name":"Invalid Data","type":"any"}}}}}')},9594:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(4450),r=a(7898),i=a(458),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:a,schemaCode:o,data:s,$data:p,it:l}=e,{opts:d}=l;if(!p&&0===a.length)return;const u=a.length>=d.loopRequired;if(l.allErrors?function(){if(u||p)e.block$data(r.nil,c);else for(const t of a)(0,n.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(u||p){const a=t.let("valid",!0);e.block$data(a,()=>function(a,i){e.setParams({missingProperty:a}),t.forOf(a,o,()=>{t.assign(i,(0,n.propertyInData)(t,s,a,d.ownProperties)),t.if((0,r.not)(i),()=>{e.error(),t.break()})},r.nil)}(i,a)),e.ok(a)}else t.if((0,n.checkMissingProp)(e,a,i)),(0,n.reportMissingProp)(e,i),t.else()}(),d.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of a)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(l,t,l.opts.strictRequired)}}function c(){t.forOf("prop",o,a=>{e.setParams({missingProperty:a}),t.if((0,n.noPropertyInData)(t,s,a,d.ownProperties),()=>e.error())})}}};t.default=o},9611:e=>{e.exports=JSON.parse('{"name":"GeneratorOnnxLLM","brickDescription":{"default":"Local LLM inference","en-us":"Local LLM inference based on [transformers.js](https://huggingface.co/docs/transformers.js) \\n You can use any converted model on HuggingFace.","zh-tw":"基於 [transformers.js](https://huggingface.co/docs/transformers.js) 的本地 LLM 推論 \\n 您可以使用 HuggingFace 上任何轉換過的模型。","ja-jp":"[transformers.js](https://huggingface.co/docs/transformers.js) に基づくローカル LLM 推論 \\n HuggingFace で変換されたどのモデルでも使用できます。"},"brickDisplayName":"LLM (ONNX)","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"microchip-ai"},"brickMeta":{"preview":true,"scriptMember":true},"propTypes":{"init":{"type":"bool"},"model":{"type":"string"},"modelType":{"type":"string"},"quantizeType":{"type":"oneOf","content":["auto","none","fp16","q8","int8","uint8","q4","bnb4","q4f16"],"forcePropertyBank":false},"prompt":{"type":"string"},"messages":{"type":"arrayOf","content":{"type":"shape","content":{},"forcePropertyBank":false},"forcePropertyBank":false},"images":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"audios":{"type":"arrayOf","content":{"type":"string"},"forcePropertyBank":false},"toolCallParser":{"type":"oneOf","content":["llama3_json","mistral","hermes","internlm","phi4"],"forcePropertyBank":false},"tools":{"type":"arrayOf","content":{"type":"object"},"forcePropertyBank":false},"toolChoice":{"type":"oneOf","content":["none","auto"],"forcePropertyBank":false},"maxNewTokens":{"type":"number"},"temperature":{"type":"number"},"topK":{"type":"number"},"topP":{"type":"number"},"repetitionPenalty":{"type":"number"},"noRepeatNgramSize":{"type":"number"},"numBeams":{"type":"number"},"doSample":{"type":"bool"},"executors":{"type":"arrayOf","content":{"type":"oneOf","content":["qnn","dml","nnapi","xnnpack","coreml","cpu","wasm","webgpu"],"forcePropertyBank":false},"forcePropertyBank":false},"executionMode":{"type":"oneOf","content":["sequential","parallel"],"forcePropertyBank":false},"qnnBackend":{"type":"oneOf","content":["HTP","HTA","DSP","GPU","CPU"],"forcePropertyBank":false},"qnnHtpEnableFp16":{"type":"bool"},"qnnEnableDebug":{"type":"bool"}},"brickPropDescriptions":{"init":{"default":"","en-us":"Initialize the TTS context on generator initialization","zh-tw":"在 generator 初始化時是否要初始化","ja-jp":"generator の初期化時に TTS コンテキストを初期化する"},"model":{"default":"","en-us":"LLM model","zh-tw":"LLM 模型","ja-jp":"LLM モデル"},"modelType":{"default":"","en-us":"Model type","zh-tw":"模型類型","ja-jp":"モデルタイプ"},"quantizeType":{"default":"","en-us":"Quantize type","zh-tw":"量化類型","ja-jp":"量子化タイプ"},"prompt":{"default":"","en-us":"Prompt to inference","zh-tw":"要推論的提示","ja-jp":"推論するためのプロンプト"},"messages":{"default":"","en-us":"Messages to inference","zh-tw":"要推論的訊息","ja-jp":"推論するためのメッセージ"},"images":{"default":"","en-us":"Images with message to inference","zh-tw":"訊息附帶的圖片","ja-jp":"メッセージに添付する画像"},"audios":{"default":"","en-us":"Audios with message to inference","zh-tw":"訊息附帶的音檔","ja-jp":"メッセージに添付する音声"},"toolCallParser":{"default":"","en-us":"Tool call parser","zh-tw":"工具調用解析器","ja-jp":"ツールコールパーサー"},"tools":{"default":"","en-us":"Tools for chat mode using OpenAI-compatible function calling format \\n Format: Array of objects with {type, function: {name, description, parameters}} structure \\n See: https://platform.openai.com/docs/guides/function-calling","zh-tw":"聊天模式的工具,使用 OpenAI 相容的函數調用格式 \\n 格式:由 {type, function: {name, description, parameters}} 結構的物件陣列 \\n 參考:https://platform.openai.com/docs/guides/function-calling","ja-jp":"チャットモードで使用するツール。OpenAI 互換の関数呼び出し形式を使用します。 \\n 形式:{type, function: {name, description, parameters}} 構造のオブジェクトの配列 \\n 詳細:https://platform.openai.com/docs/guides/function-calling"},"toolChoice":{"default":"","en-us":"Tool choice for chat mode","zh-tw":"聊天模式的工具選擇"},"maxNewTokens":{"default":"","en-us":"Max new tokens to generate","zh-tw":"最大生成新 tokens","ja-jp":"生成する最大の新しいトークン数"},"temperature":{"default":"","en-us":"Temperature","zh-tw":"溫度","ja-jp":"温度"},"topK":{"default":"","en-us":"Top k","zh-tw":"Top k","ja-jp":"トップ k"},"topP":{"default":"","en-us":"Top p","zh-tw":"Top p","ja-jp":"トップ p"},"repetitionPenalty":{"default":"","en-us":"Repetition penalty","zh-tw":"重複懲罰","ja-jp":"繰り返しペナルティ"},"noRepeatNgramSize":{"default":"","en-us":"No repeat ngram size","zh-tw":"不重複 ngram 大小","ja-jp":"繰り返さない ngram サイズ"},"numBeams":{"default":"","en-us":"Number of beams","zh-tw":"光束數","ja-jp":"ビーム数"},"doSample":{"default":"","en-us":"Do sampling","zh-tw":"是否採樣","ja-jp":"サンプリングを行う"},"executors":{"default":"","en-us":"Executor candidates, descending order of priority \\n Default will be xnnpack, wasm, cpu","zh-tw":"執行器候選,按優先順序降序排列 \\n 預設為 xnnpack、wasm、cpu","ja-jp":"実行候補、優先順位の降順 \\n デフォルトは xnnpack、wasm、cpu"},"executionMode":{"default":"","en-us":"Execution mode \\n Usually when the model has many branches, setting this option to `parallel` will give you better performance.","zh-tw":"執行模式 \\n 通常當模型有許多分支時,將此選項設置為 `parallel` 將為您提供更好的性能。","ja-jp":"実行モード \\n 通常、モデルに多くの分岐がある場合、このオプションを `parallel` に設定するとパフォーマンスが向上します。"},"qnnBackend":{"default":"","en-us":"QNN backend","zh-tw":"QNN 後端","ja-jp":"QNN バックエンド"},"qnnHtpEnableFp16":{"default":"","en-us":"Enable FP16 for QNN HTP","zh-tw":"啟用 QNN HTP 的 FP16","ja-jp":"QNN HTP の FP16 を有効にする"},"qnnEnableDebug":{"default":"","en-us":"Enable QNN debug","zh-tw":"啟用 QNN 調試","ja-jp":"QNN デバッグを有効にする"}},"defaultBrickProps":{"modelType":"auto","toolCallParser":"llama3_json","toolChoice":"auto","maxNewTokens":256,"temperature":0.7,"topK":50,"topP":0.9,"repetitionPenalty":1,"noRepeatNgramSize":0,"numBeams":1,"doSample":true,"executionMode":"sequential"},"propertyControls":{"model":{"kind":"onnx-model-asset","fields":{"modelType":"modelType","quantizeType":"quantizeType"},"required":true},"messages":{"kind":"llm-messages"},"tools":{"kind":"llm-tools"}},"propertyControlGroups":{"inputs":{"name":"Input","type":"group","content":["prompt","messages","images","audios"]},"tools":{"name":"Tools","type":"group","content":["toolCallParser","tools","toolChoice"]},"providerOpts":{"name":"Provider Options","type":"group","content":["executors","executionMode","qnnBackend","qnnHtpEnableFp16","qnnEnableDebug"]}},"propertyControlGroupDescriptions":{},"outletTypes":{"GENERATOR_ONNX_LLM_CONTEXT_STATE":{"outlet":"GENERATOR_ONNX_LLM_CONTEXT_STATE","type":"string"},"GENERATOR_ONNX_LLM_GENERATED":{"outlet":"GENERATOR_ONNX_LLM_GENERATED","type":"string"},"GENERATOR_ONNX_LLM_FULL_RESULT":{"outlet":"GENERATOR_ONNX_LLM_FULL_RESULT","type":"string"},"GENERATOR_ONNX_LLM_LAST_FUNCTION_CALL":{"outlet":"GENERATOR_ONNX_LLM_LAST_FUNCTION_CALL","type":"object"}},"brickOutletDescriptions":{"GENERATOR_ONNX_LLM_CONTEXT_STATE":{"default":"","en-us":"Context state","zh-tw":"Context 狀態","ja-jp":"コンテキスト状態"},"GENERATOR_ONNX_LLM_GENERATED":{"default":"","en-us":"Generated output","zh-tw":"產生的輸出","ja-jp":"生成された出力"},"GENERATOR_ONNX_LLM_FULL_RESULT":{"default":"","en-us":"Full result of generation","zh-tw":"生成的完整結果","ja-jp":"生成の完全な結果"},"GENERATOR_ONNX_LLM_LAST_FUNCTION_CALL":{"default":"","en-us":"Last function call","zh-tw":"最後的函數調用"}},"eventTypes":{"GENERATOR_ONNX_LLM_ON_CONTEXT_STATE_CHANGE":"GENERATOR_ONNX_LLM_ON_CONTEXT_STATE_CHANGE","GENERATOR_ONNX_LLM_ON_FUNCTION_CALL":"GENERATOR_ONNX_LLM_ON_FUNCTION_CALL","GENERATOR_ONNX_LLM_ON_COMPLETION_FINISHED":"GENERATOR_ONNX_LLM_ON_COMPLETION_FINISHED","GENERATOR_ONNX_LLM_ON_ERROR":"GENERATOR_ONNX_LLM_ON_ERROR"},"brickEventDescriptions":{"GENERATOR_ONNX_LLM_ON_CONTEXT_STATE_CHANGE":{"default":"","en-us":"Event triggered when state change","zh-tw":"在狀態變更時觸發事件","ja-jp":"状態が変更されたときに発生するイベント"},"GENERATOR_ONNX_LLM_ON_FUNCTION_CALL":{"default":"","en-us":"Event triggered on get function call request","zh-tw":"在獲取函數調用請求時觸發事件"},"GENERATOR_ONNX_LLM_ON_COMPLETION_FINISHED":{"default":"","en-us":"Event triggered on completion finished","zh-tw":"在完成時觸發事件"},"GENERATOR_ONNX_LLM_ON_ERROR":{"default":"","en-us":"Event triggered when error occurs","zh-tw":"在發生錯誤時觸發事件","ja-jp":"エラーが発生したときに発生するイベント"}},"eventPropertyControls":{"GENERATOR_ONNX_LLM_ON_CONTEXT_STATE_CHANGE":{"properties":{"GENERATOR_ONNX_LLM_CONTEXT_STATE":{"name":"Context State","type":"string"}}},"GENERATOR_ONNX_LLM_ON_FUNCTION_CALL":{"properties":{"GENERATOR_ONNX_LLM_FUNCTION_CALL_NAME":{"name":"Function Call Name","type":"string"},"GENERATOR_ONNX_LLM_FUNCTION_CALL_ARGUMENTS":{"name":"Function Call Arguments","type":"object"},"GENERATOR_ONNX_LLM_FUNCTION_CALL_DETAILS":{"name":"Function Call Details","type":"object"}}},"GENERATOR_ONNX_LLM_ON_COMPLETION_FINISHED":{"properties":{"GENERATOR_ONNX_LLM_COMPLETION_RESULT":{"name":"Result","type":"string"},"GENERATOR_ONNX_LLM_COMPLETION_TOOL_CALLS":{"name":"Tool Calls","type":"array"},"GENERATOR_ONNX_LLM_COMPLETION_FULL_CONTEXT":{"name":"Full Context","type":"string"}}},"GENERATOR_ONNX_LLM_ON_ERROR":{"properties":{"GENERATOR_ONNX_LLM_ERROR":{"name":"Error","type":"string"}}}},"actionTypes":{"GENERATOR_ONNX_LLM_LOAD_MODEL":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_ONNX_LLM_INFER":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_ONNX_LLM_PROMPT":{"name":"Prompt","type":"string"},"GENERATOR_ONNX_LLM_CHAT":{"name":"Chat","type":"array"},"GENERATOR_ONNX_LLM_IMAGES":{"name":"Image URLs","type":"array"},"GENERATOR_ONNX_LLM_AUDIOS":{"name":"Audio URLs","type":"array"},"GENERATOR_ONNX_LLM_TOOLS":{"name":"Tools","type":"array"},"GENERATOR_ONNX_LLM_TOOL_CHOICE":{"name":"Tool Choice","type":"string"}}},"GENERATOR_ONNX_LLM_CLEAN_CACHE":{"disallowMultiple":true,"canProvideProperty":false},"GENERATOR_ONNX_LLM_RELEASE_CONTEXT":{"disallowMultiple":true,"canProvideProperty":false}},"brickActionDescriptions":{"GENERATOR_ONNX_LLM_LOAD_MODEL":{"default":"","en-us":"Load the model","zh-tw":"讀取模型","ja-jp":"モデルを読み込む"},"GENERATOR_ONNX_LLM_INFER":{"default":"","en-us":"Inference","zh-tw":"推論","ja-jp":"推論"},"GENERATOR_ONNX_LLM_CLEAN_CACHE":{"default":"","en-us":"Clean cache","zh-tw":"清除快取","ja-jp":"キャッシュをクリアする"},"GENERATOR_ONNX_LLM_RELEASE_CONTEXT":{"default":"","en-us":"Release context","zh-tw":"釋放 context","ja-jp":"コンテキストを解放する"}},"scriptMemberFunctionDefs":{"load":{"arguments":[],"required":[],"return":{"type":"bool"}},"getState":{"arguments":[],"required":[],"return":{"type":"string"}},"infer":{"arguments":[{"type":"object","name":"params","properties":{"prompt":{"name":"Prompt","type":"string"},"messages":{"name":"Messages","type":"array"},"images":{"name":"Images","type":"array"},"audios":{"name":"Audios","type":"array"},"tools":{"name":"Tools","type":"array"},"toolChoice":{"name":"Tool Choice","type":"string"}}}],"required":["params"],"return":{"type":"object"}},"cleanCache":{"arguments":[],"required":[],"return":{"type":"bool"}},"release":{"arguments":[],"required":[],"return":{"type":"bool"}}},"scriptMemberFunctionDefDescriptions":{"load":{"default":"","en-us":"Load ONNX model","zh-tw":"讀取 ONNX 模型","ja-jp":"ONNX モデルを読み込む"},"getState":{"default":"","en-us":"Get model state","zh-tw":"取得模型狀態","ja-jp":"モデル状態を取得"},"infer":{"default":"","en-us":"Run text inference","zh-tw":"執行文字推論","ja-jp":"テキスト推論を実行"},"cleanCache":{"default":"","en-us":"Clean model cache","zh-tw":"清除模型快取","ja-jp":"モデルキャッシュをクリア"},"release":{"default":"","en-us":"Release the model","zh-tw":"釋放模型","ja-jp":"モデルを解放"}}}')},9624:(e,t,a)=>{var n=a(3655),r=a(4759),i=a(1580),o=a(4066),s=/^\[object .+?Constructor\]$/,p=Function.prototype,l=Object.prototype,d=p.toString,u=l.hasOwnProperty,c=RegExp("^"+d.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||r(e))&&(n(e)?c:s).test(o(e))}},9657:(e,t,a)=>{a.d(t,{Ay:()=>J});var n=a(2203),r=a(8611),i=a(7016),o=a(4044),s=a(5692),p=a(3106);const l=n.Readable,d=Symbol("buffer"),u=Symbol("type");class c{constructor(){this[u]="";const e=arguments[0],t=arguments[1],a=[];let n=0;if(e){const t=e,r=Number(t.length);for(let e=0;e<r;e++){const r=t[e];let i;i=r instanceof Buffer?r:ArrayBuffer.isView(r)?Buffer.from(r.buffer,r.byteOffset,r.byteLength):r instanceof ArrayBuffer?Buffer.from(r):r instanceof c?r[d]:Buffer.from("string"==typeof r?r:String(r)),n+=i.length,a.push(i)}}this[d]=Buffer.concat(a);let r=t&&void 0!==t.type&&String(t.type).toLowerCase();r&&!/[^\u0020-\u007E]/.test(r)&&(this[u]=r)}get size(){return this[d].length}get type(){return this[u]}text(){return Promise.resolve(this[d].toString())}arrayBuffer(){const e=this[d],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new l;return e._read=function(){},e.push(this[d]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],a=arguments[1];let n,r;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),r=void 0===a?e:a<0?Math.max(e+a,0):Math.min(a,e);const i=Math.max(r-n,0),o=this[d].slice(n,n+i),s=new c([],{type:arguments[2]});return s[d]=o,s}}function m(e,t,a){Error.call(this,e),this.message=e,this.type=t,a&&(this.code=this.errno=a.code),Error.captureStackTrace(this,this.constructor)}let f;Object.defineProperties(c.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(c.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,m.prototype.name="FetchError";try{f=require("encoding").convert}catch(e){}const _=Symbol("Body internals"),h=n.PassThrough;function E(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=a.size;let i=void 0===r?0:r;var o=a.timeout;let s=void 0===o?0:o;null==e?e=null:T(e)?e=Buffer.from(e.toString()):R(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n||(e=Buffer.from(String(e)))),this[_]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=s,e instanceof n&&e.on("error",function(e){const a="AbortError"===e.name?e:new m(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[_].error=a})}function y(){var e=this;if(this[_].disturbed)return E.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[_].disturbed=!0,this[_].error)return E.Promise.reject(this[_].error);let t=this.body;if(null===t)return E.Promise.resolve(Buffer.alloc(0));if(R(t)&&(t=t.stream()),Buffer.isBuffer(t))return E.Promise.resolve(t);if(!(t instanceof n))return E.Promise.resolve(Buffer.alloc(0));let a=[],r=0,i=!1;return new E.Promise(function(n,o){let s;e.timeout&&(s=setTimeout(function(){i=!0,o(new m(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),t.on("error",function(t){"AbortError"===t.name?(i=!0,o(t)):o(new m(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))}),t.on("data",function(t){if(!i&&null!==t){if(e.size&&r+t.length>e.size)return i=!0,void o(new m(`content size at ${e.url} over limit: ${e.size}`,"max-size"));r+=t.length,a.push(t)}}),t.on("end",function(){if(!i){clearTimeout(s);try{n(Buffer.concat(a,r))}catch(t){o(new m(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}})})}function T(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function R(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function g(e){let t,a,r=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return r instanceof n&&"function"!=typeof r.getBoundary&&(t=new h,a=new h,r.pipe(t),r.pipe(a),e[_].body=t,r=a),r}function v(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":T(e)?"application/x-www-form-urlencoded;charset=UTF-8":R(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof n?null:"text/plain;charset=UTF-8"}function O(e){const t=e.body;return null===t?0:R(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}E.prototype={get body(){return this[_].body},get bodyUsed(){return this[_].disturbed},arrayBuffer(){return y.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return y.call(this).then(function(t){return Object.assign(new c([],{type:e.toLowerCase()}),{[d]:t})})},json(){var e=this;return y.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(t){return E.Promise.reject(new m(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}})},text(){return y.call(this).then(function(e){return e.toString()})},buffer(){return y.call(this)},textConverted(){var e=this;return y.call(this).then(function(t){return function(e,t){if("function"!=typeof f)throw new Error("The package `encoding` must be installed to use the textConverted() function");const a=t.get("content-type");let n,r,i="utf-8";a&&(n=/charset=([^;]*)/i.exec(a));r=e.slice(0,1024).toString(),!n&&r&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(r));!n&&r&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(r),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(r),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop())));!n&&r&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(r));n&&(i=n.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030"));return f(e,"UTF-8",i).toString()}(t,e.headers)})}},Object.defineProperties(E.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),E.mixIn=function(e){for(const t of Object.getOwnPropertyNames(E.prototype))if(!(t in e)){const a=Object.getOwnPropertyDescriptor(E.prototype,t);Object.defineProperty(e,t,a)}},E.Promise=global.Promise;const N=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,b=/[^\t\x20-\x7e\x80-\xff]/;function A(e){if(e=`${e}`,N.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function S(e){if(e=`${e}`,b.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function I(e,t){t=t.toLowerCase();for(const a in e)if(a.toLowerCase()===t)return a}const w=Symbol("map");class C{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[w]=Object.create(null),e instanceof C){const t=e.raw(),a=Object.keys(t);for(const e of a)for(const a of t[e])this.append(e,a);return}if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const a=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");a.push(Array.from(t))}for(const e of a){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const a=e[t];this.append(t,a)}}}}get(e){A(e=`${e}`);const t=I(this[w],e);return void 0===t?null:this[w][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=D(this),n=0;for(;n<a.length;){var r=a[n];const i=r[0],o=r[1];e.call(t,o,i,this),a=D(this),n++}}set(e,t){t=`${t}`,A(e=`${e}`),S(t);const a=I(this[w],e);this[w][void 0!==a?a:e]=[t]}append(e,t){t=`${t}`,A(e=`${e}`),S(t);const a=I(this[w],e);void 0!==a?this[w][a].push(t):this[w][e]=[t]}has(e){return A(e=`${e}`),void 0!==I(this[w],e)}delete(e){A(e=`${e}`);const t=I(this[w],e);void 0!==t&&delete this[w][t]}raw(){return this[w]}keys(){return j(this,"key")}values(){return j(this,"value")}[Symbol.iterator](){return j(this,"key+value")}}function D(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";return Object.keys(e[w]).sort().map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[w][t].join(", ")}:function(t){return[t.toLowerCase(),e[w][t].join(", ")]})}C.prototype.entries=C.prototype[Symbol.iterator],Object.defineProperty(C.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(C.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const P=Symbol("internal");function j(e,t){const a=Object.create(k);return a[P]={target:e,kind:t,index:0},a}const k=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==k)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[P];const t=e.target,a=e.kind,n=e.index,r=D(t,a);return n>=r.length?{value:void 0,done:!0}:(this[P].index=n+1,{value:r[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function L(e){const t=Object.assign({__proto__:null},e[w]),a=I(e[w],"Host");return void 0!==a&&(t[a]=t[a][0]),t}Object.defineProperty(k,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const M=Symbol("Response internals"),G=r.STATUS_CODES;class x{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};E.call(this,e,t);const a=t.status||200,n=new C(t.headers);if(null!=e&&!n.has("Content-Type")){const t=v(e);t&&n.append("Content-Type",t)}this[M]={url:t.url,status:a,statusText:t.statusText||G[a],headers:n,counter:t.counter}}get url(){return this[M].url||""}get status(){return this[M].status}get ok(){return this[M].status>=200&&this[M].status<300}get redirected(){return this[M].counter>0}get statusText(){return this[M].statusText}get headers(){return this[M].headers}clone(){return new x(g(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}E.mixIn(x.prototype),Object.defineProperties(x.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(x.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const F=Symbol("Request internals"),B=i.URL||o.URL,z=i.parse,V=i.format;function $(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(e)&&(e=new B(e).toString()),z(e)}const U="destroy"in n.Readable.prototype;function H(e){return"object"==typeof e&&"object"==typeof e[F]}class K{constructor(e){let t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};H(e)?t=$(e.url):(t=e&&e.href?$(e.href):$(`${e}`),e={});let n=a.method||e.method||"GET";if(n=n.toUpperCase(),(null!=a.body||H(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let r=null!=a.body?a.body:H(e)&&null!==e.body?g(e):null;E.call(this,r,{timeout:a.timeout||e.timeout||0,size:a.size||e.size||0});const i=new C(a.headers||e.headers||{});if(null!=r&&!i.has("Content-Type")){const e=v(r);e&&i.append("Content-Type",e)}let o=H(e)?e.signal:null;if("signal"in a&&(o=a.signal),null!=o&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(o))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[F]={method:n,redirect:a.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:o},this.follow=void 0!==a.follow?a.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==a.compress?a.compress:void 0===e.compress||e.compress,this.counter=a.counter||e.counter||0,this.agent=a.agent||e.agent}get method(){return this[F].method}get url(){return V(this[F].parsedURL)}get headers(){return this[F].headers}get redirect(){return this[F].redirect}get signal(){return this[F].signal}clone(){return new K(this)}}function q(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}E.mixIn(K.prototype),Object.defineProperty(K.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(K.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),q.prototype=Object.create(Error.prototype),q.prototype.constructor=q,q.prototype.name="AbortError";const W=i.URL||o.URL,Q=n.PassThrough;function Y(e,t){if(!Y.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return E.Promise=Y.Promise,new Y.Promise(function(a,i){const o=new K(e,t),l=function(e){const t=e[F].parsedURL,a=new C(e[F].headers);if(a.has("Accept")||a.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.Readable&&!U)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let r=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(r="0"),null!=e.body){const t=O(e);"number"==typeof t&&(r=String(t))}r&&a.set("Content-Length",r),a.has("User-Agent")||a.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!a.has("Accept-Encoding")&&a.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),Object.assign({},t,{method:e.method,headers:L(a),agent:i})}(o),d=("https:"===l.protocol?s:r).request,u=o.signal;let c=null;const f=function(){let e=new q("The user aborted a request.");i(e),o.body&&o.body instanceof n.Readable&&X(o.body,e),c&&c.body&&c.body.emit("error",e)};if(u&&u.aborted)return void f();const _=function(){f(),y()},h=d(l);let E;function y(){h.abort(),u&&u.removeEventListener("abort",_),clearTimeout(E)}u&&u.addEventListener("abort",_),o.timeout&&h.once("socket",function(e){E=setTimeout(function(){i(new m(`network timeout at: ${o.url}`,"request-timeout")),y()},o.timeout)}),h.on("error",function(e){i(new m(`request to ${o.url} failed, reason: ${e.message}`,"system",e)),c&&c.body&&X(c.body,e),y()}),function(e,t){let a;e.on("socket",function(e){a=e}),e.on("response",function(e){const n=e.headers;"chunked"!==n["transfer-encoding"]||n["content-length"]||e.once("close",function(e){if(a&&a.listenerCount("data")>0&&!e){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",t(e)}})})}(h,function(e){u&&u.aborted||c&&c.body&&X(c.body,e)}),parseInt(process.version.substring(1))<14&&h.on("socket",function(e){e.addListener("close",function(t){const a=e.listenerCount("data")>0;if(c&&a&&!t&&(!u||!u.aborted)){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",c.body.emit("error",e)}})}),h.on("response",function(e){clearTimeout(E);const t=function(e){const t=new C;for(const a of Object.keys(e))if(!N.test(a))if(Array.isArray(e[a]))for(const n of e[a])b.test(n)||(void 0===t[w][a]?t[w][a]=[n]:t[w][a].push(n));else b.test(e[a])||(t[w][a]=[e[a]]);return t}(e.headers);if(Y.isRedirect(e.statusCode)){const r=t.get("Location");let s=null;try{s=null===r?null:new W(r,o.url).toString()}catch(e){if("manual"!==o.redirect)return i(new m(`uri requested responds with an invalid redirect URL: ${r}`,"invalid-redirect")),void y()}switch(o.redirect){case"error":return i(new m(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),void y();case"manual":if(null!==s)try{t.set("Location",s)}catch(e){i(e)}break;case"follow":if(null===s)break;if(o.counter>=o.follow)return i(new m(`maximum redirect reached at: ${o.url}`,"max-redirect")),void y();const r={headers:new C(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:o.body,signal:o.signal,timeout:o.timeout,size:o.size};if(!function(e,t){const a=new W(t).hostname,n=new W(e).hostname;return a===n||"."===a[a.length-n.length-1]&&a.endsWith(n)}(o.url,s)||(n=o.url,new W(s).protocol!==new W(n).protocol))for(const e of["authorization","www-authenticate","cookie","cookie2"])r.headers.delete(e);return 303!==e.statusCode&&o.body&&null===O(o)?(i(new m("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void y()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==o.method)||(r.method="GET",r.body=void 0,r.headers.delete("content-length")),a(Y(new K(s,r))),void y())}}var n;e.once("end",function(){u&&u.removeEventListener("abort",_)});let r=e.pipe(new Q);const s={url:o.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:o.size,timeout:o.timeout,counter:o.counter},l=t.get("Content-Encoding");if(!o.compress||"HEAD"===o.method||null===l||204===e.statusCode||304===e.statusCode)return c=new x(r,s),void a(c);const d={flush:p.Z_SYNC_FLUSH,finishFlush:p.Z_SYNC_FLUSH};if("gzip"==l||"x-gzip"==l)return r=r.pipe(p.createGunzip(d)),c=new x(r,s),void a(c);if("deflate"==l||"x-deflate"==l){const t=e.pipe(new Q);return t.once("data",function(e){r=8==(15&e[0])?r.pipe(p.createInflate()):r.pipe(p.createInflateRaw()),c=new x(r,s),a(c)}),void t.on("end",function(){c||(c=new x(r,s),a(c))})}if("br"==l&&"function"==typeof p.createBrotliDecompress)return r=r.pipe(p.createBrotliDecompress()),c=new x(r,s),void a(c);c=new x(r,s),a(c)}),function(e,t){const a=t.body;null===a?e.end():R(a)?a.stream().pipe(e):Buffer.isBuffer(a)?(e.write(a),e.end()):a.pipe(e)}(h,o)})}function X(e,t){e.destroy?e.destroy(t):(e.emit("error",t),e.end())}Y.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},Y.Promise=global.Promise;const J=Y},9660:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(6223),r=a(4450),i=a(458),o=a(2697),s={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:a,parentSchema:s,data:p,it:l}=e;"all"===l.opts.removeAdditional&&void 0===s.additionalProperties&&o.default.code(new n.KeywordCxt(l,o.default,"additionalProperties"));const d=(0,r.allSchemaProperties)(a);for(const e of d)l.definedProperties.add(e);l.opts.unevaluated&&d.length&&!0!==l.props&&(l.props=i.mergeEvaluated.props(t,(0,i.toHash)(d),l.props));const u=d.filter(e=>!(0,i.alwaysValidSchema)(l,a[e]));if(0===u.length)return;const c=t.name("valid");for(const a of u)m(a)?f(a):(t.if((0,r.propertyInData)(t,p,a,l.opts.ownProperties)),f(a),l.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(a),e.ok(c);function m(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==a[e].default}function f(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};t.default=s},9690:(e,t,a)=>{const{humanReadableArgName:n}=a(1762);t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),a=e._getHelpCommand();return a&&!a._hidden&&t.push(a),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const a=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return a(e).localeCompare(a(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),a=e._getHelpOption();if(a&&!a.hidden){const n=a.short&&e._findOption(a.short),r=a.long&&e._findOption(a.long);n||r?a.long&&!r?t.push(e.createOption(a.long,a.description)):a.short&&!n&&t.push(e.createOption(a.short,a.description)):t.push(a)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let a=e.parent;a;a=a.parent){const e=a.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){const t=e.registeredArguments.map(e=>n(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,a)=>Math.max(e,t.subcommandTerm(a).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,a)=>Math.max(e,t.optionTerm(a).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,a)=>Math.max(e,t.optionTerm(a).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,a)=>Math.max(e,t.argumentTerm(a).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let a="";for(let t=e.parent;t;t=t.parent)a=t.name()+" "+a;return a+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue){(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}return void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const a=`(${t.join(", ")})`;return e.description?`${e.description} ${a}`:a}return e.description}formatHelp(e,t){const a=t.padWidth(e,t),n=t.helpWidth||80;function r(e,r){if(r){const i=`${e.padEnd(a+2)}${r}`;return t.wrap(i,n-2,a+2)}return e}function i(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let o=[`Usage: ${t.commandUsage(e)}`,""];const s=t.commandDescription(e);s.length>0&&(o=o.concat([t.wrap(s,n,0),""]));const p=t.visibleArguments(e).map(e=>r(t.argumentTerm(e),t.argumentDescription(e)));p.length>0&&(o=o.concat(["Arguments:",i(p),""]));const l=t.visibleOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));if(l.length>0&&(o=o.concat(["Options:",i(l),""])),this.showGlobalOptions){const a=t.visibleGlobalOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));a.length>0&&(o=o.concat(["Global Options:",i(a),""]))}const d=t.visibleCommands(e).map(e=>r(t.subcommandTerm(e),t.subcommandDescription(e)));return d.length>0&&(o=o.concat(["Commands:",i(d),""])),o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,a,n=40){const r=new RegExp("[\\n][ \\f\\t\\v - \ufeff]+");if(e.match(r))return e;const i=t-a;if(i<n)return e;const o=e.slice(0,a),s=e.slice(a).replace("\r\n","\n"),p=" ".repeat(a),l="\\s",d=new RegExp(`\n|.{1,${i-1}}([${l}]|$)|[^${l}]+?([${l}]|$)`,"g");return o+(s.match(d)||[]).map((e,t)=>"\n"===e?"":(t>0?p:"")+e.trimEnd()).join("\n")}}},9741:(e,t,a)=>{const n=a(5479),{animationRunTypes:r,autoGeneratedItemIdKind:i}=a(7089);t.systemActionDescriptions={PROPERTY_BANK_EXPRESSION:{default:"","en-us":"Change Data value with script expression. One expression of return value","zh-tw":"使用腳本表達式改變 Data 值。 一個表達式回傳值","ja-jp":"スクリプト式を使用して Data の値を変更する。1つの式で値を返す"},PROPERTY_BANK:{default:"","en-us":"Change Data value","zh-tw":"改變 Data 值","ja-jp":"Data の値を変更する"},PROPERTY_BANK_COMMAND:{default:"","en-us":"Trigger Data calculation flow without value change","zh-tw":"不需改變值,觸發 Data 計算流程","ja-jp":"値を変更せずに Data の計算フローをトリガーする"},DYNAMIC_BRICK:{default:"","en-us":"[Unstable] Dynamically generate bricks","zh-tw":"[Unstable] 動態地産生 Bricks","ja-jp":"動的に生成されたブリック"},DYNAMIC_BRICK_RESET:{default:"","en-us":"[Unstable] Reset Dynamic Bricks","zh-tw":"[Unstable] 重設 Dynamic Bricks","ja-jp":"動的に生成されたブリックをリセットする"},DYNAMIC_ANIMATION:{default:"","en-us":"Run specific Animation on specific Brick","zh-tw":"在指定的 Brick 上運行指定的 Animation","ja-jp":"指定されたブリックで指定されたアニメーションを実行する"},DYNAMIC_ANIMATION_RESET:{default:"","en-us":"Reset Dynamic Animation","zh-tw":"重設 Dynamic Animation","ja-jp":"動的なアニメーションをリセットする"},DYNAMIC_ANIMATION_STOP:{default:"","en-us":"Stop Dynamic Animation","zh-tw":"停止 Dynamic Animation","ja-jp":"動的なアニメーションを停止する"},CHANGE_CANVAS:{default:"","en-us":"Change canvas on the current Subspace","zh-tw":"在當前的 Subspace 中切換 Canvas","ja-jp":"現在の Subspace の Canvas を変更する"},MESSAGE:{default:"","en-us":"Log System message","zh-tw":"Log System message","ja-jp":"システムメッセージをログに記録する"},ALERT:{default:"","en-us":"Show system alert popup with custom message","zh-tw":"顯示自定義訊息的系統警告彈窗","ja-jp":"カスタムメッセージを使用してシステム警告ポップアップを表示する"},POPUP_RESET:{default:"","en-us":"Close current showing popups with type or id.","zh-tw":"關閉目前顯示的 Popup,可以指定 Popup 類型或 id。","ja-jp":"現在表示されているポップアップを閉じる、または ID で指定されたポップアップを閉じる。"},TAKE_SCREENSHOT:{default:"","en-us":"Take screenshot for current subspace","zh-tw":"為當前的 Subspace 截圖","ja-jp":"現在の Subspace のスクリーンショットを撮る"},STORAGE_SET:{default:"","en-us":"Store a value in application-specific storage","zh-tw":"在應用程式特定的儲存空間中儲存值","ja-jp":"アプリケーション固有のストレージに値を保存する"},STORAGE_RETRIEVE:{default:"","en-us":"Retrieve a value from application-specific storage","zh-tw":"從應用程式特定的儲存空間中取得值","ja-jp":"アプリケーション固有のストレージから値を取得する"},STORAGE_DELETE:{default:"","en-us":"Delete a value from application-specific storage or clear all values","zh-tw":"從應用程式特定的儲存空間中刪除值或清除所有值","ja-jp":"アプリケーション固有のストレージから値を削除するか、すべての値をクリアする"},CHANNEL_SUBSCRIBE:{default:"","en-us":"Subscribe to a channel for data update","zh-tw":"訂閱一個 Channel 以接收資料更新","ja-jp":"チャンネルを購読してデータ更新を受け取る"},CHANNEL_UNSUBSCRIBE:{default:"","en-us":"Unsubscribe from a channel","zh-tw":"取消訂閱一個 Channel","ja-jp":"チャンネルから購読を解除する"},CHANNEL_PUBLISH:{default:"","en-us":"Publish data to a channel","zh-tw":"發布資料到一個 Channel","ja-jp":"チャンネルにデータを発行する"},DELAY:{default:"","en-us":"Delay for a certain time between actions","zh-tw":"延遲一段時間,用於兩個動作之間","ja-jp":"一定時間遅延する、2つのアクションの間"},USE_SHARE_APPLICATION:{default:"","en-us":"[Internal] Use a shared application","zh-tw":"[Internal] 切換到分享的應用程式","ja-jp":"[Internal] 共有アプリケーションを使用する"},AUTH_IN_DEVICE:{default:"","en-us":"[Internal] Auth in device","zh-tw":"[Internal] 在裝置上進行帳號登入","ja-jp":"[Internal] デバイスで認証する"},REFRESH_BINDCODE:{default:"","en-us":"[Internal] Refresh passcode for bind device","zh-tw":"[Internal] 更新裝置綁定碼","ja-jp":"[Internal] デバイスのバインドコードを更新する"},OPEN_URL:{default:"","en-us":"Open URL","zh-tw":"開啟 URL","ja-jp":"URL を開く"},OPEN_FILE:{default:"","en-us":"Open File or Directory","zh-tw":"開啟檔案或目錄","ja-jp":"ファイルまたはディレクトリを開く"},THROW_EXCEPTION:{default:"","en-us":"Throw exception","zh-tw":"拋出例外","ja-jp":"例外を投げる"},RESTART_FOUNDATION:{default:"","en-us":"Restart the foundation (React Native bundle)","zh-tw":"重新啟動基礎設施 (React Native bundle)","ja-jp":"基盤を再起動する (React Native bundle)"},DISMISS_KEYBOARD:{default:"","en-us":"Dismiss keyboard","zh-tw":"關閉鍵盤","ja-jp":"キーボードを閉じる"},TRIGGER_APPLICATION_FILTER:{default:"","en-us":"Trigger application AI filter","zh-tw":"觸發應用程式 AI 過濾器","ja-jp":"アプリケーション AI フィルターをトリガーする"},STOP_APPLICATION_FILTER:{default:"","en-us":"Stop running application AI filter","zh-tw":"停止運行中的應用程式 AI 過濾器","ja-jp":"実行中のアプリケーション AI フィルターを停止する"},SAVE_UPDATE_SNAPSHOT:{default:"","en-us":"Save update snapshot (from Application Filter or DevTools MCP Server) to media system","zh-tw":"儲存更新快照 (來自 Application Filter 或 DevTools MCP Server) 到媒體系統","ja-jp":"メディアシステムに更新スナップショット (Application Filter または DevTools MCP サーバーから) を保存する"}},t.systemActions={PROPERTY_BANK_EXPRESSION:{displayName:"CHANGE DATA WITH EXPRESSION",canProvideProperty:!0,filterKind:[i],propertyNameType:"defined_properties",property:{EXPRESSION:{type:"string",displayName:"Expression",normalizeDisplayName:!1},VARIABLES:{type:"nested",schema:{type:"object",properties:{id:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Data ID",normalizeDisplayName:!1},key:{type:"string"}},allowNewItem:!0},popover:!0,defaultValue:[]},RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},RESULT_ASSIGN_PATH:{type:"string"},ERROR_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1}},previewIcon:{type:"font-awesome-6pro",name:"bolt",size:14}},PROPERTY_BANK:{displayName:"CHANGE DATA",canProvideProperty:!0,filterKind:[i],propertyNameType:"property_bank",previewIcon:{type:"font-awesome-6pro",name:"bolt",size:14}},PROPERTY_BANK_COMMAND:{displayName:"TRIGGER DATA COMMAND",disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"property_bank",type:"bool",previewIcon:{type:"font-awesome-6pro",name:"bolt",size:16}},DYNAMIC_BRICK:{hidden:"unstable",disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{DYNAMIC_BRICK_ADD_LIST:{type:"string"},DYNAMIC_BRICK_PREFER_AFTER_ITEM_ID:{type:"string"},DYNAMIC_BRICK_RESET:{type:"bool"},DYNAMIC_BRICK_REMOVE_ITEM_ID:{type:"string"},DYNAMIC_BRICK_REMOVE_ITEMS:{type:"string"}},previewIcon:{type:"font-awesome-6pro",name:"grid-2"}},DYNAMIC_BRICK_RESET:{hidden:"unstable",disallowMultiple:!0,canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"rotate-right"}},DYNAMIC_ANIMATION:{disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{DYNAMIC_ANIMATION_BRICK_ID:{type:"string",kind:"id",idType:"brick"},DYNAMIC_ANIMATION_ANIMATION_ID:{type:"string",kind:"id",idType:"animation"},DYNAMIC_ANIMATION_RUN_TYPE:{type:"oneOf",oneOf:r},DYNAMIC_ANIMATION_RESET_INITIAL_VALUE:{type:"bool"}},previewIcon:{type:"font-awesome-6pro",name:"bars-staggered",size:16}},DYNAMIC_ANIMATION_RESET:{disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{DYNAMIC_ANIMATION_BRICK_ID:{type:"string",kind:"id",idType:"brick"}},previewIcon:{type:"font-awesome-6pro",name:"rotate-right"}},DYNAMIC_ANIMATION_STOP:{disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{DYNAMIC_ANIMATION_BRICK_ID:{type:"string",kind:"id",idType:"brick"}},previewIcon:{type:"font-awesome-6pro",name:"stop"}},CHANGE_CANVAS:{disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{CANVAS_ID:{type:"string",kind:"id",idType:"canvas"},CANVAS_TITLE_LIKE:{type:"string"},CANVAS_KEY_MAP_LIST:{type:"nested",schema:{type:"object",properties:{key:{displayName:"Key",type:"string"},value:{displayName:"Canvas ID",type:"string",kind:"id",idType:"canvas"}},allowNewItem:!0},popover:!0,defaultValue:[]},CANVAS_KEY:{type:"string"}},previewIcon:{type:"font-awesome-6pro",name:"diamond-turn-right",size:16}},MESSAGE:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{SYSTEM_MESSAGE_TYPE:{type:"oneOf",oneOf:["SYSTEM_MESSAGE_TYPE_INFO","SYSTEM_MESSAGE_TYPE_SUCCESS","SYSTEM_MESSAGE_TYPE_WARNING","SYSTEM_MESSAGE_TYPE_ERROR"]},SYSTEM_MESSAGE_TITLE:{type:"string"},SYSTEM_MESSAGE_MESSAGE:{type:"string"}},previewIcon:{type:"font-awesome-6pro",name:"note"}},ALERT:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{ALERT_ID:{type:"string"},ALERT_TYPE:{type:"oneOf",oneOf:["info","success","warning","error"]},ALERT_TITLE:{type:"string"},ALERT_MESSAGE:{type:"string"},ALERT_SELECTIONS:{type:"nested",schema:{type:"object",properties:{label:{type:"string"},color:{type:"string"},value:{type:"string"},disableResult:{type:"bool"}},allowNewItem:!0},popover:!0,defaultValue:[]},ALERT_SELECTION_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},ALERT_TIMEOUT:{type:"number",defaultValue:1e4},ALERT_HIDE_SELECTIONS:{type:"bool"}},previewIcon:{type:"font-awesome-6pro",name:"bell"}},POPUP_RESET:{disallowMultiple:!0,canProvideProperty:!0,propertyNameType:"defined_properties",property:{POPUP_CLEAR_TYPE:{type:"oneOf",oneOf:["all","alert","generator"]},POPUP_ID:{type:"string"}},previewIcon:{type:"font-awesome-6pro",name:"rotate-right"}},TAKE_SCREENSHOT:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{TAKE_SCREENSHOT_CURRENT_SUBSPACE:{type:"bool"},TAKE_SCREENSHOT_BRICK_ID:{type:"string",kind:"id",idType:"brick",displayName:"Brick ID",normalizeDisplayName:!1},TAKE_SCREENSHOT_FORMAT:{type:"oneOf",oneOf:["jpg","png"]},TAKE_SCREENSHOT_QUALITY:{type:"number",max:1,min:0,step:.1},TAKE_SCREENSHOT_WIDTH:{type:"number"},TAKE_SCREENSHOT_HEIGHT:{type:"number"},TAKE_SCREENSHOT_SAVE_PROPERTY:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1}},previewIcon:{type:"font-awesome-6pro",name:"camera",size:16}},STORAGE_SET:{displayName:"STORAGE SET",canProvideProperty:!0,propertyNameType:"defined_properties",property:{STORAGE_TYPE:{type:"oneOf",oneOf:["persist","in-memory"],displayName:"Storage Type",defaultValue:"persist"},STORAGE_SCOPE:{type:"oneOf",oneOf:["global","subspace"],displayName:"Storage Scope",defaultValue:"global"},STORAGE_KEY:{type:"string",displayName:"Key",normalizeDisplayName:!1},STORAGE_VALUE:{type:"any",displayName:"Value",normalizeDisplayName:!1}},previewIcon:{type:"font-awesome-6pro",name:"database",size:14}},STORAGE_RETRIEVE:{displayName:"STORAGE RETRIEVE",canProvideProperty:!0,propertyNameType:"defined_properties",property:{STORAGE_TYPE:{type:"oneOf",oneOf:["persist","in-memory"],displayName:"Storage Type",defaultValue:"persist"},STORAGE_SCOPE:{type:"oneOf",oneOf:["global","subspace"],displayName:"Storage Scope",defaultValue:"global"},STORAGE_KEY:{type:"string",displayName:"Key",normalizeDisplayName:!1},STORAGE_RETRIEVE_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Result Target"},STORAGE_RETRIEVE_DEFAULT_VALUE:{type:"string",displayName:"Default Value",normalizeDisplayName:!1},STORAGE_RETRIEVE_SKIP_IF_NOT_FOUND:{type:"bool",displayName:"Skip if Not Found",defaultValue:!1}},previewIcon:{type:"font-awesome-6pro",name:"database",size:14}},STORAGE_DELETE:{displayName:"STORAGE DELETE",canProvideProperty:!0,propertyNameType:"defined_properties",property:{STORAGE_TYPE:{type:"oneOf",oneOf:["persist","in-memory"],displayName:"Storage Type",defaultValue:"persist"},STORAGE_SCOPE:{type:"oneOf",oneOf:["global","subspace"],displayName:"Storage Scope",defaultValue:"global"},STORAGE_KEY:{type:"string",displayName:"Key",normalizeDisplayName:!1},STORAGE_DELETE_ALL:{type:"bool",displayName:"Delete All Values",defaultValue:!1}},previewIcon:{type:"font-awesome-6pro",name:"trash",size:14}},CHANNEL_SUBSCRIBE:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{CHANNEL_SUBSCRIBE_KEY:{type:"string"},CHANNEL_SUBSCRIBE_TYPE:{type:"oneOf",oneOf:["on","once"]},CHANNEL_SUBSCRIBE_LIVETIME:{type:"number",kind:"unit",unit:"ms"},CHANNEL_SUBSCRIBE_DATA_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Result"},CHANNEL_SUBSCRIBE_DATA_ASSIGN_LIST:{type:"nested",schema:{type:"object",properties:{path:{displayName:"Object Path",type:"string"},type:{type:"oneOf",oneOf:["any","string","number","bool","array","object"],oneOfEmptyOption:!1,defaultValue:"any"},id:{displayName:"Data ID",type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},required:{type:"bool",defaultValue:!1}},allowNewItem:!0},popover:!0,defaultValue:[]},CHANNEL_SUBSCRIBE_PROGRESS_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Progress"},CHANNEL_SUBSCRIBE_PROGRESS_ASSIGN_LIST:{type:"nested",schema:{type:"object",properties:{path:{displayName:"Object Path",type:"string"},type:{type:"oneOf",oneOf:["any","string","number","bool","array","object"],oneOfEmptyOption:!1,defaultValue:"any"},id:{displayName:"Data ID",type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},required:{type:"bool",defaultValue:!1}},allowNewItem:!0},popover:!0,defaultValue:[]},CHANNEL_SUBSCRIBE_ERROR_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Error"}},previewIcon:{type:"font-awesome-6pro",name:"display",size:16}},CHANNEL_UNSUBSCRIBE:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{CHANNEL_UNSUBSCRIBE_KEY_MATCH:{type:"string"}}},CHANNEL_PUBLISH:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{CHANNEL_PUBLISH_KEY_MATCH:{type:"string"},CHANNEL_PUBLISH_PAYLOAD_TYPE:{type:"oneOf",oneOf:["result","progress","error"]},CHANNEL_PUBLISH_PAYLOAD:{type:"string"}}},DELAY:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{DELAY_TIME:{type:"number",kind:"unit",unit:"ms"}}},USE_SHARE_APPLICATION:{hidden:"internal",canProvideProperty:!0,propertyNameType:"defined_properties",property:{APPLICATION_ID:{type:"string"},RELEASE_VERSION:{type:"string"},USE_TYPE:{type:"oneOf",oneOf:["run","use-after-bind","cancel-use"]},VIEWPORT_PRESET_NAME_LIKE:{type:"string"},VIEWPORT_PRESET_DEVICE_TARGET:{type:"string"},ENABLE_LOCAL_SYNC:{type:"bool"}},previewIcon:{type:"font-awesome-6pro",name:"display",size:16}},AUTH_IN_DEVICE:{hidden:"internal",canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"user",size:16}},REFRESH_BINDCODE:{hidden:"internal",canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"arrows-rotate",size:16}},OPEN_URL:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{URL:{type:"string",normalizeDisplayName:!1,displayName:"URL"},BEHAVIOR:{type:"oneOf",oneOf:["in-app","new-window"]},IN_APP_TINT_COLOR:{type:"string",kind:"color",popover:!0}},previewIcon:{type:"font-awesome-6pro",name:"external-link",size:16}},OPEN_FILE:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{PICK_TYPE:{type:"oneOf",oneOf:["file","multiple","directory"],oneOfEmptyOption:!1},FILE_TYPE:{type:"any"},COPY_TO:{type:"oneOf",oneOf:["cache","document"]},MODE:{type:"oneOf",oneOf:["import","open"]},SAVE_PROPERTY:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},SAVE_DETAIL_PROPERTY:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1},ERROR_SAVE_PROPERTY:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1}},previewIcon:{type:"font-awesome-6pro",name:"folder-open",size:16}},THROW_EXCEPTION:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{BEHAVIOR:{type:"oneOf",oneOf:["application","native"]},EXCEPTION_MESSAGE:{type:"string",displayName:"Exception Message"}},previewIcon:{type:"font-awesome-6pro",name:"bomb",size:16}},RESTART_FOUNDATION:{canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"arrows-rotate",size:16}},DISMISS_KEYBOARD:{canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"keyboard-down",size:16}},TRIGGER_APPLICATION_FILTER:{canProvideProperty:!0,propertyNameType:"defined_properties",property:{NAME:{type:"string",displayName:"Filter Name",normalizeDisplayName:!1},VARIABLES:{type:"any",displayName:"Variables",normalizeDisplayName:!1},RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Result Target"},ERROR:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Error Target"}},previewIcon:{type:"font-awesome-6pro",name:"robot",size:16}},STOP_APPLICATION_FILTER:{canProvideProperty:!1,previewIcon:{type:"font-awesome-6pro",name:"stop",size:16}},SAVE_UPDATE_SNAPSHOT:{displayName:"SAVE UPDATE SNAPSHOT",canProvideProperty:!0,propertyNameType:"defined_properties",property:{SNAPSHOT_FILE_INDENTIFIER:{type:"string",displayName:"Filename Identifier",defaultValue:"default",normalizeDisplayName:!1},SNAPSHOT_SAVE_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Result Target"},SNAPSHOT_ERROR_RESULT:{type:"string",kind:"id",idType:"property_bank",showPropertyBankLink:!1,displayName:"Error Target"}},previewIcon:{type:"font-awesome-6pro",name:"camera-retro",size:16}}},t.getSubspaceActionTypes=e=>Object.entries(e.action_map||{}).reduce((e,[t,a])=>(e[`SUBSPACE_ACTION_${t}`]={canProvideProperty:Object.keys(a.event_property_map||{}).length>0,property:Object.entries(a.event_property_map||{}).reduce((e,[t,a])=>(e[`SUBSPACE_${t}`]={type:a.type,name:n(t)},e),{}),propertyNameType:"defined_properties"},e),{})},9753:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=a(7898),r=a(458),i=a(4450),o=a(3426),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:a,it:n}=e,{prefixItems:s}=a;n.items=!0,(0,r.alwaysValidSchema)(n,t)||(s?(0,o.validateAdditionalItems)(e,s):e.ok((0,i.validateArray)(e)))}};t.default=s},9760:(e,t,a)=>{a.d(t,{$:()=>T});var n=a(5608),r=a(9212),i=a(9074),o=a(3673),s=a(2307),p=a(3647),l=a(3068),d=a(4874),u=a(7195),c=a(4559),m=a(1151),f=a(3161),_=a(783),h=a(3777),E=a(3925),y=(0,r.maybe)(function(){return fetch}),T=function(e){void 0===e&&(e={});var t=e.uri,a=void 0===t?"/graphql":t,T=e.fetch,R=e.print,g=void 0===R?c.i1:R,v=e.includeExtensions,O=e.preserveHeaderCase,N=e.useGETForQueries,b=e.includeUnusedVariables,A=void 0!==b&&b,S=(0,n.__rest)(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&(0,u.S)(T||y);var I={http:{includeExtensions:v,preserveHeaderCase:O},options:S.fetchOptions,credentials:S.credentials,headers:S.headers};return new i.C(function(e){var t=(0,l.z)(e,a),i=e.getContext(),u={};if(i.clientAwareness){var R=i.clientAwareness,v=R.name,O=R.version;v&&(u["apollographql-client-name"]=v),O&&(u["apollographql-client-version"]=O)}var b=(0,n.__assign)((0,n.__assign)({},u),i.headers),S={http:i.http,options:i.fetchOptions,credentials:i.credentials,headers:b};if((0,s.d8)(["client"],e.query)){var w=(0,E.er)(e.query);if(!w)return(0,f.N)(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));e.query=w}var C,D=(0,c.HY)(e,g,c.R4,I,S),P=D.options,j=D.body;j.variables&&!A&&(j.variables=(0,_.X)(j.variables,e.query)),P.signal||"undefined"==typeof AbortController||(C=new AbortController,P.signal=C.signal);var k,L="OperationDefinition"===(k=(0,h.Vn)(e.query)).kind&&"subscription"===k.operation,M=(0,s.d8)(["defer"],e.query);if(N&&!e.query.definitions.some(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})&&(P.method="GET"),M||L){P.headers=P.headers||{};var G="multipart/mixed;";L&&M&&!1!==globalThis.__DEV__&&r.invariant.warn(41),L?G+="boundary=graphql;subscriptionSpec=1.0,application/json":M&&(G+="deferSpec=20220824,application/json"),P.headers.accept=G}if("GET"===P.method){var x=(0,m.E)(t,j),F=x.newURI,B=x.parseError;if(B)return(0,f.N)(B);t=F}else try{P.body=(0,p.Y)(j,"Payload")}catch(B){return(0,f.N)(B)}return new o.c(function(a){var n=T||(0,r.maybe)(function(){return fetch})||y,i=a.next.bind(a);return n(t,P).then(function(t){var a;e.setContext({response:t});var n=null===(a=t.headers)||void 0===a?void 0:a.get("content-type");return null!==n&&/^multipart\/mixed/i.test(n)?(0,d.tD)(t,i):(0,d.OQ)(e)(t).then(i)}).then(function(){C=void 0,a.complete()}).catch(function(e){C=void 0,(0,d.H4)(e,a)}),function(){C&&C.abort()}})})}},9762:(e,t,a)=>{a.d(t,{Ll:()=>s,aD:()=>i,aZ:()=>n,cE:()=>p,ou:()=>r});class n{constructor(e,t,a){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=a}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class r{constructor(e,t,a,n,r,i){this.kind=e,this.start=t,this.end=a,this.line=n,this.column=r,this.value=i,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const i={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},o=new Set(Object.keys(i));function s(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&o.has(t)}var p;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(p||(p={}))},9770:(e,t,a)=>{var n=a(4715)(a(8942),"Map");e.exports=n},9787:e=>{e.exports=JSON.parse('{"name":"GeneratorIntent","brickDescription":{"default":"","en-us":"Send intent to app and get result (Android only)","zh-tw":"向應用發送意圖並獲取結果 (僅限 Android)","ja-jp":"アプリにインテントを送信して結果を取得(Androidのみ)"},"brickDisplayName":"Intent","brickTip":{"default":""},"brickPreviewIcon":{"type":"font-awesome-6pro","name":"bullseye-arrow"},"brickMeta":{"preview":true},"propTypes":{"action":{"type":"string"},"data":{"type":"string"},"type":{"type":"string"},"extra":{"type":"object"},"className":{"type":"string"},"packageName":{"type":"string"},"category":{"type":"string"},"foregroundService":{"type":"bool"}},"brickPropDescriptions":{"action":{"default":"","en-us":"Intent action","zh-tw":"意圖動作","ja-jp":"インテントアクション"},"data":{"default":"","en-us":"Intent data","zh-tw":"意圖資料","ja-jp":"インテントデータ"},"type":{"default":"","en-us":"Intent type","zh-tw":"意圖類型","ja-jp":"インテントタイプ"},"extra":{"default":"","en-us":"Extra data","zh-tw":"額外資料","ja-jp":"追加データ"},"className":{"default":"","en-us":"Intent target class name in package","zh-tw":"意圖目標類名","ja-jp":"インテントターゲットのクラス名"},"packageName":{"default":"","en-us":"Intent target package name","zh-tw":"意圖目標包名","ja-jp":"インテントターゲットのパッケージ名"},"category":{"default":"","en-us":"Intent category","zh-tw":"意圖類別","ja-jp":"インテントカテゴリ"},"foregroundService":{"default":"","en-us":"Intent start foreground service","zh-tw":"意圖啟動前景服務","ja-jp":"インテント前景サービス"}},"defaultBrickProps":{},"propertyControls":{},"propertyControlGroups":{},"propertyControlGroupDescriptions":{},"eventTypes":{"GENERATOR_INTENT_ON_RESULT":"GENERATOR_INTENT_ON_RESULT","GENERATOR_INTENT_ON_ERROR":"GENERATOR_INTENT_ON_ERROR"},"brickEventDescriptions":{"GENERATOR_INTENT_ON_RESULT":{"default":"","en-us":"On intent return a result trigger","zh-tw":"在意圖返回結果時觸發","ja-jp":"インテントが結果を返した時に発生するイベント"},"GENERATOR_INTENT_ON_ERROR":{"default":"","en-us":"On intent error trigger","zh-tw":"在意圖錯誤時觸發","ja-jp":"インテントエラー時に発生するイベント"}},"eventPropertyControls":{"GENERATOR_INTENT_ON_RESULT":{"properties":{"GENERATOR_INTENT_RESULT_CODE":{"name":"Result Code","type":"number"},"GENERATOR_INTENT_RESULT_DATA":{"name":"Result Data","type":"string"},"GENERATOR_INTENT_RESULT_EXTRAS":{"name":"Extra Data","type":"object"}}},"GENERATOR_INTENT_ON_ERROR":{"properties":{"GENERATOR_INTENT_ERROR":{"name":"Error Message","type":"string"}}}},"outletTypes":{"GENERATOR_INTENT_RESULT":{"outlet":"GENERATOR_INTENT_RESULT","type":"object"}},"brickOutletDescriptions":{"GENERATOR_INTENT_RESULT":{"default":"","en-us":"Last intent result","zh-tw":"最後意圖結果","ja-jp":"最後のインテント結果"}},"actionTypes":{"GENERATOR_INTENT_SEND_INTENT":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_INTENT_ACTION":{"name":"Action","type":"string"},"GENERATOR_INTENT_DATA":{"name":"Data","type":"string"},"GENERATOR_INTENT_TYPE":{"name":"Type","type":"string"},"GENERATOR_INTENT_EXTRA":{"name":"Extra","type":"object"},"GENERATOR_INTENT_CLASS_NAME":{"name":"Class Name","type":"string"},"GENERATOR_INTENT_PACKAGE_NAME":{"name":"Package Name","type":"string"},"GENERATOR_INTENT_CATEGORY":{"name":"Category","type":"string"}}},"GENERATOR_INTENT_START_SERVICE":{"disallowMultiple":true,"canProvideProperty":true,"propertyNameType":"defined_properties","property":{"GENERATOR_INTENT_ACTION":{"name":"Action","type":"string"},"GENERATOR_INTENT_DATA":{"name":"Data","type":"string"},"GENERATOR_INTENT_TYPE":{"name":"Type","type":"string"},"GENERATOR_INTENT_EXTRA":{"name":"Extra","type":"object"},"GENERATOR_INTENT_CLASS_NAME":{"name":"Class Name","type":"string"},"GENERATOR_INTENT_PACKAGE_NAME":{"name":"Package Name","type":"string"},"GENERATOR_INTENT_CATEGORY":{"name":"Category","type":"string"},"GENERATOR_INTENT_FOREGROUND":{"name":"Foreground Service","type":"boolean"}}}},"brickActionDescriptions":{"GENERATOR_INTENT_SEND_INTENT":{"default":"","en-us":"Read stats","zh-tw":"讀取 stats","ja-jp":"統計情報を読み取る"},"GENERATOR_INTENT_START_SERVICE":{"default":"","en-us":"Start intent service","zh-tw":"啟動意圖服務","ja-jp":"インテントサービスを起動する"}}}')},9790:(e,t,a)=>{a.d(t,{default:()=>Q,oraPromise:()=>Y,spinners:()=>D}),a.r(t);var n=a(1708),r=a(8568);const i=(e,t,a,n)=>{if("length"===a||"prototype"===a)return;if("arguments"===a||"caller"===a)return;const r=Object.getOwnPropertyDescriptor(e,a),i=Object.getOwnPropertyDescriptor(t,a);!o(r,i)&&n||Object.defineProperty(e,a,i)},o=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},s=(e,t)=>`/* Wrapped ${e}*/\n${t}`,p=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),l=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");function d(e,t,{ignoreNonConfigurable:a=!1}={}){const{name:n}=e;for(const n of Reflect.ownKeys(t))i(e,t,n,a);return((e,t)=>{const a=Object.getPrototypeOf(t);a!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,a)})(e,t),((e,t,a)=>{const n=""===a?"":`with ${a.trim()}() `,r=s.bind(null,n,t.toString());Object.defineProperty(r,"name",l);const{writable:i,enumerable:o,configurable:d}=p;Object.defineProperty(e,"toString",{value:r,writable:i,enumerable:o,configurable:d})})(e,t,n),e}const u=new WeakMap,c=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let a,n=0;const r=e.displayName||e.name||"<anonymous>",i=function(...o){if(u.set(i,++n),1===n)a=e.apply(this,o),e=void 0;else if(!0===t.throw)throw new Error(`Function \`${r}\` can only be called once`);return a};return d(i,e),u.set(i,n),i};c.callCount=e=>{if(!u.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return u.get(e)};const m=c,f=[];f.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&f.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&f.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const _=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,h=Symbol.for("signal-exit emitter"),E=globalThis,y=Object.defineProperty.bind(Object);class T{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(E[h])return E[h];y(E,h,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const a=this.listeners[e],n=a.indexOf(t);-1!==n&&(0===n&&1===a.length?a.length=0:a.splice(n,1))}emit(e,t,a){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(const r of this.listeners[e])n=!0===r(t,a)||n;return"exit"===e&&(n=this.emit("afterExit",t,a)||n),n}}class R{}const g=globalThis.process,{onExit:v,load:O,unload:N}=(b=_(g)?new class extends R{#e="win32"===g.platform?"SIGINT":"SIGHUP";#t=new T;#a;#n;#r;#i={};#o=!1;constructor(e){super(),this.#a=e,this.#i={};for(const t of f)this.#i[t]=()=>{const a=this.#a.listeners(t);let{count:n}=this.#t;const r=e;if("object"==typeof r.__signal_exit_emitter__&&"number"==typeof r.__signal_exit_emitter__.count&&(n+=r.__signal_exit_emitter__.count),a.length===n){this.unload();const a=this.#t.emit("exit",null,t),n="SIGHUP"===t?this.#e:t;a||e.kill(e.pid,n)}};this.#r=e.reallyExit,this.#n=e.emit}onExit(e,t){if(!_(this.#a))return()=>{};!1===this.#o&&this.load();const a=t?.alwaysLast?"afterExit":"exit";return this.#t.on(a,e),()=>{this.#t.removeListener(a,e),0===this.#t.listeners.exit.length&&0===this.#t.listeners.afterExit.length&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of f)try{const t=this.#i[e];t&&this.#a.on(e,t)}catch(e){}this.#a.emit=(e,...t)=>this.#s(e,...t),this.#a.reallyExit=e=>this.#p(e)}}unload(){this.#o&&(this.#o=!1,f.forEach(e=>{const t=this.#i[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#a.removeListener(e,t)}catch(e){}}),this.#a.emit=this.#n,this.#a.reallyExit=this.#r,this.#t.count-=1)}#p(e){return _(this.#a)?(this.#a.exitCode=e||0,this.#t.emit("exit",this.#a.exitCode,null),this.#r.call(this.#a,this.#a.exitCode)):0}#s(e,...t){const a=this.#n;if("exit"===e&&_(this.#a)){"number"==typeof t[0]&&(this.#a.exitCode=t[0]);const n=a.call(this.#a,e,...t);return this.#t.emit("exit",this.#a.exitCode,null),n}return a.call(this.#a,e,...t)}}(g):new class extends R{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>b.onExit(e,t),load:()=>b.load(),unload:()=>b.unload()});var b;const A=n.stderr.isTTY?n.stderr:n.stdout.isTTY?n.stdout:void 0,S=A?m(()=>{v(()=>{A.write("[?25h")},{alwaysLast:!0})}):()=>{};let I=!1;const w={show:(e=n.stderr)=>{e.isTTY&&(I=!1,e.write("[?25h"))},hide:(e=n.stderr)=>{e.isTTY&&(S(),I=!0,e.write("[?25l"))},toggle:(e,t)=>{void 0!==e&&(I=e),I?w.show(t):w.hide(t)}},C=w;var D=a(7661);const P={info:r.Ay.blue("ℹ"),success:r.Ay.green("✔"),warning:r.Ay.yellow("⚠"),error:r.Ay.red("✖")},j={info:r.Ay.blue("i"),success:r.Ay.green("√"),warning:r.Ay.yellow("‼"),error:r.Ay.red("×")},k=("win32"!==n.platform?"linux"!==n.env.TERM:Boolean(n.env.CI)||Boolean(n.env.WT_SESSION)||Boolean(n.env.TERMINUS_SUBLIME)||"{cmd::Cmder}"===n.env.ConEmuTask||"Terminus-Sublime"===n.env.TERM_PROGRAM||"vscode"===n.env.TERM_PROGRAM||"xterm-256color"===n.env.TERM||"alacritty"===n.env.TERM||"JetBrains-JediTerm"===n.env.TERMINAL_EMULATOR)?P:j;const L=function({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}();function M(e){if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(L,"")}function G(e){return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function x(e){return 12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510}function F(e){return e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||129736===e||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function B(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function z(e,{ambiguousAsWide:t=!1}={}){return B(e),x(e)||F(e)||t&&G(e)?2:1}const V=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,$=new Intl.Segmenter,U=/^\p{Default_Ignorable_Code_Point}$/u;function H(e,t={}){if("string"!=typeof e||0===e.length)return 0;const{ambiguousIsNarrow:a=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=M(e)),0===e.length)return 0;let r=0;const i={ambiguousAsWide:!a};for(const{segment:t}of $.segment(e)){const e=t.codePointAt(0);e<=31||e>=127&&e<=159||(e>=8203&&e<=8207||65279===e||e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=55296&&e<=57343||e>=65024&&e<=65039||U.test(t)||(V().test(t)?r+=2:r+=z(e,i)))}return r}var K=a(9122);const q=new class{#l=0;start(){this.#l++,1===this.#l&&this.#d()}stop(){if(this.#l<=0)throw new Error("`stop` called more times than `start`");this.#l--,0===this.#l&&this.#u()}#d(){"win32"!==n.platform&&n.stdin.isTTY&&(n.stdin.setRawMode(!0),n.stdin.on("data",this.#c),n.stdin.resume())}#u(){n.stdin.isTTY&&(n.stdin.off("data",this.#c),n.stdin.pause(),n.stdin.setRawMode(!1))}#c(e){3===e[0]&&n.emit("SIGINT")}};class W{#m=0;#f=!1;#_=0;#h=-1;#E=0;#y;#T;#R;#g;#v;#O;#N;#b;#A;#S;#I;color;constructor(e){"string"==typeof e&&(e={text:e}),this.#y={color:"cyan",stream:n.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#y.color,this.spinner=this.#y.spinner,this.#v=this.#y.interval,this.#R=this.#y.stream,this.#O="boolean"==typeof this.#y.isEnabled?this.#y.isEnabled:function({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#R}),this.#N="boolean"==typeof this.#y.isSilent&&this.#y.isSilent,this.text=this.#y.text,this.prefixText=this.#y.prefixText,this.suffixText=this.#y.suffixText,this.indent=this.#y.indent}get indent(){return this.#b}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#b=e,this.#w()}get interval(){return this.#v??this.#T.interval??100}get spinner(){return this.#T}set spinner(e){if(this.#h=-1,this.#v=void 0,"object"==typeof e){if(void 0===e.frames)throw new Error("The given spinner must have a `frames` property");this.#T=e}else if((0,K.A)())if(void 0===e)this.#T=D.dots;else{if("default"===e||!D[e])throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);this.#T=D[e]}else this.#T=D.line}get text(){return this.#A}set text(e=""){this.#A=e,this.#w()}get prefixText(){return this.#S}set prefixText(e=""){this.#S=e,this.#w()}get suffixText(){return this.#I}set suffixText(e=""){this.#I=e,this.#w()}get isSpinning(){return void 0!==this.#g}#C(e=this.#S,t=" "){return"string"==typeof e&&""!==e?e+t:"function"==typeof e?e()+t:""}#D(e=this.#I,t=" "){return"string"==typeof e&&""!==e?t+e:"function"==typeof e?t+e():""}#w(){const e=this.#R.columns??80,t=this.#C(this.#S,"-"),a=this.#D(this.#I,"-"),n=" ".repeat(this.#b)+t+"--"+this.#A+"--"+a;this.#_=0;for(const t of M(n).split("\n"))this.#_+=Math.max(1,Math.ceil(H(t,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#O&&!this.#N}set isEnabled(e){if("boolean"!=typeof e)throw new TypeError("The `isEnabled` option must be a boolean");this.#O=e}get isSilent(){return this.#N}set isSilent(e){if("boolean"!=typeof e)throw new TypeError("The `isSilent` option must be a boolean");this.#N=e}frame(){const e=Date.now();(-1===this.#h||e-this.#E>=this.interval)&&(this.#h=++this.#h%this.#T.frames.length,this.#E=e);const{frames:t}=this.#T;let a=t[this.#h];this.color&&(a=r.Ay[this.color](a));return("string"==typeof this.#S&&""!==this.#S?this.#S+" ":"")+a+("string"==typeof this.text?" "+this.text:"")+("string"==typeof this.#I&&""!==this.#I?" "+this.#I:"")}clear(){if(!this.#O||!this.#R.isTTY)return this;this.#R.cursorTo(0);for(let e=0;e<this.#m;e++)e>0&&this.#R.moveCursor(0,-1),this.#R.clearLine(1);return(this.#b||this.lastIndent!==this.#b)&&this.#R.cursorTo(this.#b),this.lastIndent=this.#b,this.#m=0,this}render(){return this.#N||(this.clear(),this.#R.write(this.frame()),this.#m=this.#_),this}start(e){return e&&(this.text=e),this.#N?this:this.#O?(this.isSpinning||(this.#y.hideCursor&&C.hide(this.#R),this.#y.discardStdin&&n.stdin.isTTY&&(this.#f=!0,q.start()),this.render(),this.#g=setInterval(this.render.bind(this),this.interval)),this):(this.text&&this.#R.write(`- ${this.text}\n`),this)}stop(){return this.#O?(clearInterval(this.#g),this.#g=void 0,this.#h=0,this.clear(),this.#y.hideCursor&&C.show(this.#R),this.#y.discardStdin&&n.stdin.isTTY&&this.#f&&(q.stop(),this.#f=!1),this):this}succeed(e){return this.stopAndPersist({symbol:k.success,text:e})}fail(e){return this.stopAndPersist({symbol:k.error,text:e})}warn(e){return this.stopAndPersist({symbol:k.warning,text:e})}info(e){return this.stopAndPersist({symbol:k.info,text:e})}stopAndPersist(e={}){if(this.#N)return this;const t=e.prefixText??this.#S,a=this.#C(t," "),n=e.symbol??" ",r=e.text??this.text,i="string"==typeof r?(n?" ":"")+r:"",o=e.suffixText??this.#I,s=a+n+i+this.#D(o," ")+"\n";return this.stop(),this.#R.write(s),this}}function Q(e){return new W(e)}async function Y(e,t){const a="function"==typeof e,n="function"==typeof e.then;if(!a&&!n)throw new TypeError("Parameter `action` must be a Function or a Promise");const{successText:r,failText:i}="object"==typeof t?t:{successText:void 0,failText:void 0},o=Q(t).start();try{const t=a?e(o):e,n=await t;return o.succeed(void 0===r?void 0:"string"==typeof r?r:r(n)),n}catch(e){throw o.fail(void 0===i?void 0:"string"==typeof i?i:i(e)),e}}},9841:(e,t,a)=>{a.d(t,{I:()=>r});var n=a(8255);function r(e,t,a){return new n.eO(`Syntax Error: ${a}`,{source:e,positions:[t]})}},9850:(e,t,a)=>{var n=a(9546),r=a(5813),i=a(5243),o=a(482);e.exports=function(e,t,a){return e=i(e),void 0===(t=a?void 0:t)?r(e)?o(e):n(e):e.match(t)||[]}},9868:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=a(7898),r=a(458),i=a(4450);t.error={message:({params:{property:e,depsCount:t,deps:a}})=>{const r=1===t?"property":"properties";return n.str`must have ${r} ${a} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:a,missingProperty:r}})=>n._`{property: ${e},
|
|
655
655
|
missingProperty: ${r},
|
|
656
656
|
depsCount: ${t},
|
|
657
|
-
deps: ${a}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,a]=function({schema:e}){const t={},a={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:a)[n]=e[n]}return[t,a]}(e);s(e,t),p(e,a)}};function s(e,t=e.schema){const{gen:a,data:r,it:o}=e;if(0===Object.keys(t).length)return;const s=a.let("missing");for(const p in t){const l=t[p];if(0===l.length)continue;const d=(0,i.propertyInData)(a,r,p,o.opts.ownProperties);e.setParams({property:p,depsCount:l.length,deps:l.join(", ")}),o.allErrors?a.if(d,()=>{for(const t of l)(0,i.checkReportMissingProp)(e,t)}):(a.if(n._`${d} && (${(0,i.checkMissingProp)(e,l,s)})`),(0,i.reportMissingProp)(e,s),a.else())}}function p(e,t=e.schema){const{gen:a,data:n,keyword:o,it:s}=e,p=a.name("valid");for(const l in t)(0,r.alwaysValidSchema)(s,t[l])||(a.if((0,i.propertyInData)(a,n,l,s.opts.ownProperties),()=>{const t=e.subschema({keyword:o,schemaProp:l},p);e.mergeValidEvaluated(t,p)},()=>a.var(p,!0)),e.ok(p))}t.validatePropertyDeps=s,t.validateSchemaDeps=p,t.default=o},9891:(e,t,a)=>{a.d(t,{ApolloLink:()=>n.C,concat:()=>s,empty:()=>r,execute:()=>p.g,from:()=>i,split:()=>o}),a.r(t);a(9212);var n=a(9074),r=n.C.empty,i=n.C.from,o=n.C.split,s=n.C.concat,p=a(5174)},9893:e=>{function t(a,n){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(a,n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},9896:e=>{e.exports=t("fs")},9952:(e,t,a)=>{a.d(t,{P:()=>o});var n=a(5608),r=a(9074),i=a(9760),o=function(e){function t(t){void 0===t&&(t={});var a=e.call(this,(0,i.$)(t).request)||this;return a.options=t,a}return(0,n.__extends)(t,e),t}(r.C)},9968:(e,t,a)=>{var n=a(1035)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});e.exports=n}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var a=u[e]={id:e,loaded:!1,exports:{}};return d[e].call(a.exports,a,a.exports,c),a.loaded=!0,a.exports}c.m=d,c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var a in t)c.o(t,a)&&!c.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,a)=>(c.f[a](e,t),t),[])),c.u=e=>e+".js",c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),p={57:0},l=e=>{var t,a,{__webpack_esm_ids__:n,__webpack_esm_modules__:r,__webpack_esm_runtime__:i}=e,o=0;for(t in r)c.o(r,t)&&(c.m[t]=r[t]);for(i&&i(c);o<n.length;o++)a=n[o],c.o(p,a)&&p[a]&&p[a][0](),p[n[o]]=0},c.f.j=(e,t)=>{var a=c.o(p,e)?p[e]:void 0;if(0!==a)if(a)t.push(a[1]);else{var n=import("./"+c.u(e)).then(l,t=>{throw 0!==p[e]&&(p[e]=void 0),t});n=Promise.race([n,new Promise(t=>a=p[e]=[t])]),t.push(a[1]=n)}};var m={};c.r(m),c.d(m,{lI:()=>Ec,F3:()=>_c,mJ:()=>hc,AW:()=>gc,$V:()=>Tc,J6:()=>Rc,Wt:()=>vc,qq:()=>yc,gw:()=>Oc,Yi:()=>fc});var f={};c.r(f),c.d(f,{applicationFragment:()=>Ec,applicationShortFragment:()=>Ic,deviceFragment:()=>_c,deviceGroupFragment:()=>hc,deviceShortFragment:()=>wc,instanceVersionFragment:()=>gc,mediaBoxFragment:()=>Dc,mediaFileFragment:()=>Pc,mediaWorkspaceFragment:()=>Cc,moduleFragment:()=>Tc,moduleShortFragment:()=>Rc,operationFragment:()=>vc,publicApplicationBasicInfoFragment:()=>yc,userFavoriteFragment:()=>Oc,workspaceFragment:()=>Ac,workspaceShortFragment:()=>Sc});var _={};c.r(_),c.d(_,{application:()=>sm,applicationByDevice:()=>qc,applicationReleaseVersion:()=>Uc,applicationReleaseVersions:()=>$c,applicationTestsByDevice:()=>Wc,applications:()=>om,checkBindDevicePasscode:()=>Qc,devices:()=>pm,devicesByGroup:()=>Xc,devicesByUniqueId:()=>Yc,me:()=>xc,module:()=>Fc,moduleReleaseVersion:()=>Kc,moduleReleaseVersions:()=>Hc,modules:()=>Bc,publicModules:()=>zc,publicModulesByIdList:()=>Vc,workspace:()=>rm,workspacePricingPlans:()=>Jc,workspaces:()=>im});var h={};c.r(h),c.d(h,{addUserFavorite:()=>Xm,assignGroupPermissions:()=>qm,bindApplication:()=>Im,bindApplicationWithDeviceGroup:()=>Dm,changeWorkspaceAdditionalLimitSpending:()=>ef,changeWorkspaceSubscriptionPlan:()=>Zm,controlDevice:()=>Tm,createApplication:()=>bm,createApplicationWithShareVersion:()=>Am,createConfigChangeOperation:()=>$m,createDevice:()=>mm,createDeviceGroup:()=>Rm,createDeviceGroupWithApp:()=>km,createModule:()=>xm,createVirtualDevice:()=>fm,createWorkspace:()=>dm,createWorkspaceOTP:()=>tf,dispatchDeviceGroupAction:()=>vm,doOperation:()=>Um,duplicateApplication:()=>Mm,duplicateModule:()=>zm,forkApplication:()=>Lm,moveApplication:()=>jm,moveDevice:()=>hm,moveModule:()=>Bm,registerFCMNotification:()=>Wm,registerRemoteDebug:()=>Qm,removeApplication:()=>Gm,removeDevice:()=>ym,removeDeviceGroup:()=>Om,removeModule:()=>Vm,removeOperation:()=>Km,removeUserFavorite:()=>Jm,removeWorkspace:()=>Nm,revokeWorkspaceOTP:()=>af,shareAccessToken:()=>Ym,shareApplication:()=>Pm,toggleShortEditApplication:()=>wm,updateApplication:()=>Sm,updateApplicationViewportPreset:()=>Cm,updateDevice:()=>_m,updateDeviceGroup:()=>gm,updateModule:()=>Fm,updateOperation:()=>Hm,updateVirtualDevice:()=>Em,updateWorkspace:()=>um,updateWorkspaceTokens:()=>cm});var E={};c.r(E),c.d(E,{application:()=>Ef,applicationByDevice:()=>yf,applications:()=>hf,device:()=>vf,devices:()=>gf,devicesByApplication:()=>Of,mediaBox:()=>Af,mediaBoxes:()=>bf,mediaFile:()=>If,mediaFiles:()=>Sf,mediaWorkspace:()=>Nf,module:()=>Rf,modules:()=>Tf,workspace:()=>_f});var y={};c.r(y),c.d(y,{bindApplication:()=>jf,copyMediaFiles:()=>zf,createApplication:()=>Df,createModule:()=>Lf,deleteMediaBoxFiles:()=>$f,deleteMediaFiles:()=>Vf,requestFileUpload:()=>Gf,setMediaFileAsBoxPreview:()=>Bf,unbindApplication:()=>kf,updateApplication:()=>Pf,updateMediaFile:()=>xf,updateMediaFiles:()=>Ff,updateModule:()=>Mf});var T={};c.r(T),c.d(T,{mediaBox:()=>F_,mediaBoxes:()=>G_,mediaFile:()=>z_,mediaFiles:()=>B_,mediaWorkspace:()=>x_,mediaWorkspaces:()=>M_});var R={};c.r(R),c.d(R,{assignGroupPermissions:()=>Z_,copyMediaFiles:()=>X_,createMediaBox:()=>U_,createMediaWorkspace:()=>V_,deleteMediaFiles:()=>Y_,moveMediaBox:()=>H_,requestFileUpload:()=>q_,setMediaFileAsBoxPreview:()=>J_,updateMediaBox:()=>K_,updateMediaFile:()=>W_,updateMediaFiles:()=>Q_,updateMediaWorkspace:()=>$_});var g={};c.r(g),c.d(g,{mediaBox:()=>th,mediaFile:()=>nh,mediaFiles:()=>ah});var v={};c.r(v),c.d(v,{deleteMediaFiles:()=>sh,requestFileUpload:()=>rh,updateMediaFile:()=>ih,updateMediaFiles:()=>oh});var O=c(9436),N=c(5181);const{DM:b,gu:A,er:S,Ww:I,b7:w,Di:C,a2:D,uB:P,ef:j,c$:k,_V:L}=N;var M=c(8568),G=c(9790);const x=t("readline");var F,B,z,V=c(8765),$=c(700),U=new P("auth").description("Authentication and token management");U.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token","default").option("-n, --name <name>","Profile display name").action((F=O(function*(e,t){var a,n,r=t.profile,i=t.name,o=e;o||(console.log(M.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(M.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(M.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(o=yield(a="Enter passcode: ",n=x.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{n.question(a,t=>{n.close(),e(t.trim())})})))||(console.log(M.Ay.red("Passcode is required")),process.exit(1)));var s=(0,G.default)("Validating passcode...").start();try{var p=(0,$.createPublicClient)((0,V.getBaseUrl)()),l=yield p.checkWorkspaceOTP(o);l.valid||(s.fail(`Invalid passcode: ${l.error||"Unknown error"}`),process.exit(1)),s.text=`Exchanging passcode for token (workspace: ${l.workspaceName})...`;var d=yield p.exchangeWorkspaceOTP(o);d.token||(s.fail("Failed to obtain token"),process.exit(1));var u=(0,$.createClient)((0,V.getBaseUrl)(),d.token),c=yield u.workspace();c||(s.fail("Token validation failed"),process.exit(1)),(0,V.setToken)(r,{token:d.token,name:i||c.name,workspaceId:c._id,workspaceName:c.name}),(0,V.setCurrentProfile)(r),s.succeed(`Logged in to workspace: ${M.Ay.green(c.name)}`),console.log(M.Ay.gray(`Profile saved as: ${r}`))}catch(e){s.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return F.apply(this,arguments)})),U.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token","default").option("-n, --name <name>","Profile display name").action((B=O(function*(e){var t=e.token,a=e.profile,n=e.name;t||(console.error(M.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(M.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(M.Ay.gray("Select your workspace and create a new token.\n")),console.log(M.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var r=(0,G.default)("Validating token...").start();try{var i=(0,$.createClient)((0,V.getBaseUrl)(),t),o=yield i.workspace();o||(r.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,V.setToken)(a,{token:t,name:n||o.name,workspaceId:o._id,workspaceName:o.name}),(0,V.setCurrentProfile)(a),r.succeed(`Logged in to workspace: ${M.Ay.green(o.name)}`),console.log(M.Ay.gray(`Profile saved as: ${a}`))}catch(e){r.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return B.apply(this,arguments)})),U.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((z=O(function*(e){var t=e.profile;if(e.all)return(0,V.listProfiles)().forEach(e=>(0,V.removeToken)(e.name)),void console.log(M.Ay.green("All profiles removed"));var a=t||(0,V.getCurrentProfile)();(0,V.getTokenInfo)(a)?((0,V.removeToken)(a),console.log(M.Ay.green(`Logged out from profile: ${a}`))):console.log(M.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return z.apply(this,arguments)})),U.command("status").description("Show current authentication status").action(O(function*(){var e=(0,V.getCurrentProfile)(),t=(0,V.getTokenInfo)(e);if(!t)return console.log(M.Ay.yellow("Not logged in")),void console.log(M.Ay.gray("Use `bricks auth login` to login"));var a=(0,G.default)("Checking connection...").start();try{var n=(0,$.createClient)((0,V.getBaseUrl)(),t.token),r=yield n.workspace();a.stop(),console.log(M.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${M.Ay.cyan(e)}`),console.log(`Workspace: ${M.Ay.green(r.name)}`),console.log(`Workspace ID: ${M.Ay.gray(r._id)}`),console.log(`Base URL: ${M.Ay.gray((0,V.getBaseUrl)())}`),console.log(`Logged in: ${M.Ay.gray(t.createdAt)}`),console.log("─".repeat(40))}catch(e){a.fail(`Connection failed: ${e.message}`)}})),U.command("list").description("List all saved profiles").action(()=>{var e=(0,V.listProfiles)();if(0===e.length)return console.log(M.Ay.yellow("No saved profiles")),void console.log(M.Ay.gray("Use `bricks auth login` to login"));console.log(M.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?M.Ay.green("● "):" ",a=e.current?M.Ay.green(e.name):e.name;console.log(`${t}${a.padEnd(15)} ${M.Ay.gray(e.workspaceName||"Unknown")}`)}),console.log("─".repeat(60))}),U.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,V.getTokenInfo)(e);if(!t)return console.log(M.Ay.red(`Profile not found: ${e}`)),void console.log(M.Ay.gray("Use `bricks auth list` to see available profiles"));(0,V.setCurrentProfile)(e),console.log(M.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(M.Ay.gray(`Workspace: ${t.workspaceName}`))}),U.command("set-url <url>").description("Set the base URL for BRICKS API").action(e=>{(0,V.setBaseUrl)(e),console.log(M.Ay.green(`Base URL set to: ${e}`))});var H,K,q,W,Q,Y=c(7336),X=()=>{var e=(0,V.getCurrentProfile)(),t=(0,V.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,V.getBaseUrl)(),t)},J=e=>{if(!e)return M.Ay.gray("○ Unknown");var t=Date.now()-new Date(e).getTime();if(t<=3e5)return M.Ay.green("● Online");var a=Math.floor(t/6e4);if(a<60)return M.Ay.yellow(`○ Offline (${a}m ago)`);var n=Math.floor(a/60);if(n<24)return M.Ay.red(`○ Offline (${n}h ago)`);var r=Math.floor(n/24);return M.Ay.red(`○ Offline (${r}d ago)`)},Z=new P("device").description("Device management");Z.command("list").description("List all devices").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=X(),a=(0,G.default)("Fetching devices...").start();try{var n=yield t.devices({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No devices found"));console.log(M.Ay.bold("\nDevices")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=J(t),n=e.entry_detail?.application?.name||M.Ay.gray("No app bound");console.log(`${a} ${M.Ay.cyan(e.name||e.device_name)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),console.log(` App: ${n}`),console.log()})}catch(e){a.fail(`Failed to list devices: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),Z.command("get <id>").description("Get device details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=X(),n=(0,G.default)("Fetching device...").start();try{var r=yield a.device({id:e});if(n.stop(),r||(console.log(M.Ay.red("Device not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));var i=r.entry_detail?.watch_dog_timer?.last_alive_time,o=J(i);if(console.log(M.Ay.bold(`\nDevice: ${r.name||r.device_name}`)),console.log("─".repeat(60)),console.log(`Status: ${o}`),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Device Name: ${r.device_name||M.Ay.gray("N/A")}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime||"N/A")}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime||"N/A")}`),r.entry_detail){var s=r.entry_detail;if(console.log(`\n${M.Ay.bold("Entry Details")}`),console.log(`Type: ${s.type||M.Ay.gray("N/A")}`),console.log(`Unique ID: ${M.Ay.gray(s.unique_id||"N/A")}`),console.log(`Version: ${s.operation_version||M.Ay.gray("N/A")}`),console.log(`Mode: ${s.operation_mode||M.Ay.gray("N/A")}`),Array.isArray(s.screen)&&s.screen.length>0)console.log(`\n${M.Ay.bold("Screens")} (${s.screen.length})`),s.screen.forEach((e,t)=>{var a=e.resolution,n=a?`${a.width}x${a.height} @${a.scale}x`:"N/A",r=e.master?M.Ay.green(" (master)"):"",i=e.orientation?` [${e.orientation}]`:"",o=e.touch?.available?M.Ay.cyan(` touch:${e.touch.touch_point}pt`):"";console.log(` ${t+1}. ${e.title||"Screen"}${r}${i} - ${n}${o}`)});else if(s.screen?.resolution){var p=s.screen.resolution;console.log(`Resolution: ${p.width}x${p.height} @${p.scale}x`)}var l=null!=s.memory_usage,d=null!=s.disk_usage;if(l||d){if(console.log(`\n${M.Ay.bold("System Resources")}`),l){var u=Array.isArray(s.memory_usage)?s.memory_usage[0]:s.memory_usage,c=Math.round(100*u),m=M.Ay.green;c>80?m=M.Ay.red:c>60&&(m=M.Ay.yellow),console.log(`Memory: ${m(`${c}%`)}`)}if(d){var f=Array.isArray(s.disk_usage)?s.disk_usage[0]:s.disk_usage,_=Math.round(100*f),h=M.Ay.green;_>90?h=M.Ay.red:_>75&&(h=M.Ay.yellow),console.log(`Disk: ${h(`${_}%`)}`)}}var E=[];if(s.sound?.available&&E.push("Sound"),s.camera?.available&&E.push("Camera"),s.audio_in?.available&&E.push("Audio Input"),E.length>0&&(console.log(`\n${M.Ay.bold("Capabilities")}`),console.log(`Available: ${E.join(", ")}`),s.camera?.channel?.length>0&&s.camera.channel.forEach(e=>{var t=e.resolution?`${e.resolution.width}x${e.resolution.height}`:"";console.log(` Camera: ${e.title||"Camera"} ${t} [${e.orientation||"N/A"}]`)})),s.local_sync){var y=s.local_sync;console.log(`\n${M.Ay.bold("Local Sync")}`),console.log(`Role: ${y.is_main?M.Ay.cyan("Main"):"Secondary"}`),null!=y.peer_count&&console.log(`Peers: ${y.peer_count}`),null!=y.mean_latency&&console.log(`Latency: ${y.mean_latency.toFixed(2)}ms`)}if(s.update){var T=s.update;console.log(`\n${M.Ay.bold("Update Status")}`),console.log(`Needs Update: ${T.need_update?M.Ay.yellow("Yes"):M.Ay.green("No")}`),T.current_version&&console.log(`App Version: ${T.current_version}`),T.running_mode&&console.log(`Running Mode: ${T.running_mode}`),T.last_update_at&&console.log(`Last Update: ${M.Ay.gray(T.last_update_at)}`)}if(s.watch_dog_timer){var R=s.watch_dog_timer;console.log(`\n${M.Ay.bold("Watchdog")}`),console.log(`Alive: ${R.alive?M.Ay.green("Yes"):M.Ay.red("No")}`),R.last_launch_time&&console.log(`Last Launch: ${M.Ay.gray(R.last_launch_time)}`),R.last_alive_time&&console.log(`Last Alive: ${M.Ay.gray(R.last_alive_time)}`)}}r.bound_application&&(console.log(`\n${M.Ay.bold("Bound Application")}`),console.log(`Name: ${r.bound_application.name}`),console.log(`ID: ${M.Ay.gray(r.bound_application._id)}`)),r.env?.variables&&Object.keys(r.env.variables).length>0&&(console.log(`\n${M.Ay.bold("Environment Variables")}`),Object.entries(r.env.variables).forEach(([e,t])=>{console.log(` ${M.Ay.cyan(e)}: ${t}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),Z.command("bind <passcode>").description("Bind a new device using passcode").option("-n, --name <name>","Device name").action(function(){var e=O(function*(e,t){var a=X(),n=(0,G.default)("Checking passcode...").start();try{var r=yield a.checkBindDevicePasscode({passcode:e});r||(n.fail("Invalid passcode or expired"),process.exit(1)),n.text="Binding device...";var i=yield a.createDevice({bindPasscode:e,name:t.name||r.payload?.deviceName||"CLI Device",deviceName:r.payload?.deviceName});n.succeed(`Device bound successfully: ${M.Ay.green(i.name)}`),console.log(M.Ay.gray(`Device ID: ${i._id}`))}catch(e){n.fail(`Failed to bind device: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),Z.command("control <id> <type>").description("Control a device").option("-p, --payload <json>","Event payload as JSON").action((H=O(function*(e,t,a){var n=X(),r=(0,G.default)(`Sending ${t} to device...`).start();try{var i;a.payload&&(i=JSON.parse(a.payload)),yield n.controlDevice({id:e,type:t,eventPayload:i}),r.succeed(`Control event sent: ${M.Ay.green(t)}`)}catch(e){r.fail(`Failed to control device: ${e.message}`),process.exit(1)}}),function(e,t,a){return H.apply(this,arguments)})),Z.command("refresh <id>").description("Refresh device application").action((K=O(function*(e){var t=X(),a=(0,G.default)("Refreshing device...").start();try{yield t.controlDevice({id:e,type:"refresh"}),a.succeed("Device refreshed")}catch(e){a.fail(`Failed to refresh device: ${e.message}`),process.exit(1)}}),function(e){return K.apply(this,arguments)})),Z.command("clear-cache <id>").description("Clear device cache").action((q=O(function*(e){var t=X(),a=(0,G.default)("Clearing cache...").start();try{yield t.controlDevice({id:e,type:"clear-cache"}),a.succeed("Cache cleared")}catch(e){a.fail(`Failed to clear cache: ${e.message}`),process.exit(1)}}),function(e){return q.apply(this,arguments)})),Z.command("screenshot <id>").description("Take device screenshot and save to file").option("-o, --output <path>","Output file path").option("--no-take","Only fetch existing screenshot without taking a new one").action((W=O(function*(e,t){var a=X(),n=(0,G.default)("Fetching workspace info...").start();try{var r=yield a.workspace();r?.media_resource?.enable_media_workspace||(n.fail("Media workspace is not enabled for this workspace"),process.exit(1)),r.media_resource.system_media_box_id||(n.fail("No media box configured for this workspace"),process.exit(1)),!1!==t.take&&(n.text="Sending screenshot request to device...",yield a.controlDevice({id:e,type:"take-screenshot"}),n.text="Waiting for device to capture screenshot...",yield new Promise(e=>setTimeout(e,3e3))),n.text="Fetching screenshot...";var i=yield(0,Y.he)(a,r,e,t.output);if(i.error&&(n.fail(i.error),process.exit(1)),n.succeed("Screenshot saved"),console.log(),console.log(M.Ay.bold("Screenshot saved to:")),console.log(M.Ay.cyan(i.path)),console.log(),i.file?.meta){var o=i.file.meta,s=o.originalWidth,p=o.originalHeight,l=o.originalFileSize;if(s&&p&&console.log(`${M.Ay.gray("Size:")} ${s}x${p}`),l){var d=(l/1024).toFixed(1);console.log(`${M.Ay.gray("File:")} ${d} KB`)}}i.file?.updatedAt&&console.log(`${M.Ay.gray("Updated:")} ${new Date(i.file.updatedAt).toLocaleString()}`)}catch(e){n.fail(`Failed to get screenshot: ${e.message}`),process.exit(1)}}),function(e,t){return W.apply(this,arguments)})),Z.command("monitor").description("Monitor device status (polls every 60s)").option("-g, --group <id>","Monitor devices in a group").option("-i, --interval <seconds>","Polling interval in seconds","60").action((Q=O(function*(e){var t=X(),a=1e3*parseInt(e.interval,10);console.log(M.Ay.bold("\nDevice Monitor")),console.log(M.Ay.gray(`Polling every ${e.interval}s. Press Ctrl+C to stop.\n`));var n,r=(n=O(function*(){try{var a;if(a=e.group?yield t.devicesByGroup({id:e.group}):yield t.devices({}),process.stdout.write("[2J[0f"),console.log(M.Ay.bold("Device Monitor")+M.Ay.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!a||0===a.length)return void console.log(M.Ay.yellow("No devices found"));a.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=J(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");console.log(`${a} ${M.Ay.cyan(n.padEnd(25))} ${r}`)}),console.log(`\n${M.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(M.Ay.red(`Error: ${e.message}`))}}),function(){return n.apply(this,arguments)});yield r(),setInterval(r,a)}),function(e){return Q.apply(this,arguments)}));var ee,te,ae=c(9896),ne=c(5704),re=()=>{var e=(0,V.getCurrentProfile)(),t=(0,V.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,V.getBaseUrl)(),t)},ie=new P("app").description("Application management");ie.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=re(),a=(0,G.default)("Fetching applications...").start();try{var n=yield t.applications({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No applications found"));console.log(M.Ay.bold("\nApplications")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.has_unreleased_changes?M.Ay.yellow("●"):M.Ay.green("●"),a=e.current_version?`v${e.current_version}`:M.Ay.gray("no version");console.log(`${t} ${M.Ay.cyan(e.name)} ${M.Ay.gray(a)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list applications: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ie.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=(0,G.default)("Fetching application...").start();try{var r=yield a.application({id:e,composed:t.composed});if(n.stop(),r||(console.log(M.Ay.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(M.Ay.bold(`\nApplication: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),console.log(`\n${M.Ay.bold("Version")}`),r.current_version){if(console.log(`Current: v${r.current_version}`),r.current_version_details){var i=r.current_version_details;i.name&&console.log(`Release Name: ${i.name}`),i.note&&console.log(`Release Note: ${M.Ay.gray(i.note)}`),i.create_datetime&&console.log(`Released At: ${M.Ay.gray(i.create_datetime)}`)}}else console.log(`Current: ${M.Ay.gray("No version")}`);if(console.log(`Unreleased: ${r.has_unreleased_changes?M.Ay.yellow("Yes"):M.Ay.green("No")}`),console.log(`\n${M.Ay.bold("Features")}`),console.log(`Short Edit: ${r.short_edit?.enabled?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var o=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${o} editable properties`)}console.log(`Automation: ${r.canvas_control?.enable_schedule?M.Ay.green("Scheduled"):M.Ay.gray("No schedule")}`),r.lock?.locked&&console.log(`Locked: ${M.Ay.yellow("Yes")} (at ${r.lock.locked_at||"N/A"})`),r.sync_key&&console.log(`Sync Key: ${M.Ay.gray(r.sync_key)}`),r.devices?.length>0?(console.log(`\n${M.Ay.bold("Bound Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t="active"===e.status?M.Ay.green("●"):M.Ay.gray("○"),a=e.frame?M.Ay.gray(` [${e.frame.x||0},${e.frame.y||0} ${e.frame.width}x${e.frame.height}]`):"";console.log(` ${t} ${e.device_id}${a}`)})):console.log(`\n${M.Ay.bold("Bound Devices")}: ${M.Ay.gray("None")}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("update <id>").description("Update application").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-c, --config <json>","Application config as JSON string").option("-f, --file <path>","Application config from file").option("--validate","Validate configuration").action(function(){var e=O(function*(e,t){var a=re(),n=(0,G.default)("Updating application...").start();try{var r={id:e};t.name&&(r.name=t.name),t.description&&(r.description=t.description),t.validate&&(r.validateConfig=!0),t.config?r.config=t.config:t.file&&(r.config=ae.readFileSync(t.file,"utf-8"));var i=yield a.updateApplication(r);n.succeed(`Application updated: ${M.Ay.green(i.name)}`),i.has_unreleased_changes&&console.log(M.Ay.yellow("Note: Application has unreleased changes"))}catch(e){n.fail(`Failed to update application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action(function(){var e=O(function*(e,t){var a=re(),n=(0,G.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield a.shortEditApplication({id:e,list:r});n.succeed(`Short edit applied to: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("short-refs <id>").description("List short edit references for an application").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=(0,G.default)("Fetching short edit references...").start();try{var r=yield a.application({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(M.Ay.yellow("Short Edit is not enabled for this application"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,ne.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(M.Ay.yellow("No short edit references found"));console.log(M.Ay.bold(`\nShort Edit References: ${r.name}`)),o.forEach(e=>{console.log(M.Ay.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?M.Ay.gray(`- ${t.title}`):"";console.log(` ${M.Ay.green(e)} ${a}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").action(function(){var e=O(function*(e,t){var a=re(),n=(0,G.default)("Updating device bindings...").start();try{var r={id:e};t.bind&&(r.bindDevices=t.bind.split(",").map(e=>e.trim())),t.unbind&&(r.unbindDevices=t.unbind.split(",").map(e=>e.trim())),yield a.bindApplication(r),n.succeed("Device bindings updated")}catch(e){n.fail(`Failed to update bindings: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action(function(){var e=O(function*(e,t,a){var n=re(),r=(0,G.default)("Triggering automation...").start();try{yield n.triggerApplicationCanvasControl({id:e,testId:t,play:!a.stop&&a.play,setupAtLaunch:a.setupAtLaunch,matchGroup:a.matchGroup}),r.succeed(`Automation triggered: ${M.Ay.green(t)}`)}catch(e){r.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}});return function(t,a,n){return e.apply(this,arguments)}}()),ie.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=t.json?null:(0,G.default)("Releasing application...").start();try{var r=t.config;(t.config.endsWith(".json")||t.config.includes("/"))&&(ae.existsSync(t.config)||(n?n.fail(`Config file not found: ${t.config}`):console.error(JSON.stringify({error:`Config file not found: ${t.config}`})),process.exit(1)),r=ae.readFileSync(t.config,"utf-8"));var i=yield a.application({id:e});i||(n?n.fail("Application not found"):console.error(JSON.stringify({error:"Application not found"})),process.exit(1)),i.lock?.enabled&&(n?n.fail("Application is locked"):console.error(JSON.stringify({error:"Application is locked"})),process.exit(1));var o=t.version||i.name||"Untitled",s=t.changelogs?`${t.changelogs}\n\nRelease by BRICKS CLI`:"Release by BRICKS CLI";yield a.releaseApplication({id:e,config:r,releaseCurrentVersion:o,releaseCurrentVersionNote:s}),t.json?console.log(JSON.stringify({success:!0,name:i.name})):n.succeed(`Application released: ${M.Ay.green(i.name)}`)}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to release application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((ee=O(function*(e,t){var a=re(),n=t.json?null:(0,G.default)("Pulling application project...").start();try{var r=yield a.applicationProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Application project fetched: ${M.Ay.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return ee.apply(this,arguments)})),ie.command("project-init <id>").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((te=O(function*(e,t){var a=(yield Promise.all([c.e(356),c.e(465)]).then(c.bind(c,6465))).initProject;yield a("application",e,t)}),function(e,t){return te.apply(this,arguments)}));var oe=()=>{var e=(0,V.getCurrentProfile)(),t=(0,V.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,V.getBaseUrl)(),t)},se=new P("module").description("Module management");se.command("list").description("List all modules").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=oe(),a=(0,G.default)("Fetching modules...").start();try{var n=yield t.modules({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No modules found"));console.log(M.Ay.bold("\nModules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:M.Ay.gray("no version");console.log(`● ${M.Ay.cyan(e.name)} ${M.Ay.gray(t)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list modules: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),se.command("get <id>").description("Get module details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,G.default)("Fetching module...").start();try{var r=yield a.module({id:e});if(n.stop(),r||(console.log(M.Ay.red("Module not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(M.Ay.bold(`\nModule: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),console.log(`\n${M.Ay.bold("Version")}`),console.log(`Current: ${r.current_version?`v${r.current_version}`:M.Ay.gray("No version")}`),console.log(`Unreleased: ${r.has_unreleased_changes?M.Ay.yellow("Yes"):M.Ay.green("No")}`),console.log(`\n${M.Ay.bold("Settings")}`),console.log(`Public: ${r.is_public?M.Ay.green("Yes"):M.Ay.gray("No")}`),console.log(`Allow Modify: ${r.is_allow_modify?M.Ay.green("Yes"):M.Ay.gray("No")}`),console.log(`Short Edit: ${r.short_edit?.enabled?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var i=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${i} editable properties`)}null!=r.use_count?.total_count&&(console.log(`\n${M.Ay.bold("Usage")}`),console.log(`Used In: ${r.use_count.total_count} application(s)`)),r.expose_properties?.length>0&&(console.log(`\n${M.Ay.bold("Exposed Properties")} (${r.expose_properties.length})`),r.expose_properties.forEach(e=>{console.log(` - ${M.Ay.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("update <id>").description("Update module").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,G.default)("Updating module...").start();try{var r={id:e};t.name&&(r.name=t.name),t.description&&(r.description=t.description),t.validate&&(r.validateConfig=!0),t.config?r.config=t.config:t.file&&(r.config=ae.readFileSync(t.file,"utf-8"));var i=yield a.updateModule(r);n.succeed(`Module updated: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to update module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,G.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield a.shortEditModule({id:e,list:r});n.succeed(`Short edit applied to: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,G.default)("Fetching short edit references...").start();try{var r=yield a.module({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(M.Ay.yellow("Short Edit is not enabled for this module"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,ne.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(M.Ay.yellow("No short edit references found"));console.log(M.Ay.bold(`\nShort Edit References: ${r.name}`)),o.forEach(e=>{console.log(M.Ay.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?M.Ay.gray(`- ${t.title}`):"";console.log(` ${M.Ay.green(e)} ${a}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=t.json?null:(0,G.default)("Releasing module...").start();try{var r=t.config;(t.config.endsWith(".json")||t.config.includes("/"))&&(ae.existsSync(t.config)||(n?n.fail(`Config file not found: ${t.config}`):console.error(JSON.stringify({error:`Config file not found: ${t.config}`})),process.exit(1)),r=ae.readFileSync(t.config,"utf-8"));var i=yield a.module({id:e});i||(n?n.fail("Module not found"):console.error(JSON.stringify({error:"Module not found"})),process.exit(1)),i.is_public&&(n?n.fail("Public module deployment is temporarily not recommended"):console.error(JSON.stringify({error:"Public module deployment is temporarily not recommended"})),process.exit(1));var o=t.version||i.name||"Untitled",s=t.changelogs?`${t.changelogs}\n\nRelease by BRICKS CLI`:"Release by BRICKS CLI";yield a.releaseModule({id:e,config:r,releaseCurrentVersion:o,releaseCurrentVersionNote:s}),t.json?console.log(JSON.stringify({success:!0,name:i.name})):n.succeed(`Module released: ${M.Ay.green(i.name)}`)}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to release module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action(function(){var e=O(function*(e,t){var a=oe(),n=t.json?null:(0,G.default)("Pulling module project...").start();try{var r=yield a.moduleProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Module project fetched: ${M.Ay.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("project-init <id>").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action(function(){var e=O(function*(e,t){var a=(yield Promise.all([c.e(356),c.e(465)]).then(c.bind(c,6465))).initProject;yield a("module",e,t)});return function(t,a){return e.apply(this,arguments)}}());var pe=c(8832),le=()=>{var e=(0,V.getCurrentProfile)(),t=(0,V.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,V.getBaseUrl)(),t)},de=3e5,ue=e=>{if(!e)return M.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=de?M.Ay.green("●"):Math.floor(t/6e4)<60?M.Ay.yellow("○"):M.Ay.red("○")},ce=new P("group").description("Device Group management");ce.command("list").description("List all device groups").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=le(),a=(0,G.default)("Fetching device groups...").start();try{var n=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No device groups found"));console.log(M.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${M.Ay.cyan(e.name)} ${M.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ce.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=le(),n=(0,G.default)("Fetching device group...").start();try{var r=yield a.deviceGroup({id:e});if(n.stop(),r||(console.log(M.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nDevice Group: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),r.devices?.length>0&&(console.log(`\n${M.Ay.bold("Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${M.Ay.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get group: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=le(),n=(0,G.default)("Fetching devices...").start();try{var r=yield a.devicesByGroup({id:e});if(n.stop(),t.json)return void console.log(JSON.stringify(r,null,2));if(!r||0===r.length)return void console.log(M.Ay.yellow("No devices in this group"));console.log(M.Ay.bold("\nDevices in Group")),console.log("─".repeat(80)),r.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=ue(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");console.log(`${a} ${M.Ay.cyan(n.padEnd(30))} ${r}`)}),console.log("─".repeat(80))}catch(e){n.fail(`Failed to get devices: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("dispatch <id> <action>").description("Dispatch action to all devices in group").action(function(){var e=O(function*(e,t){var a=le(),n=(0,G.default)(`Dispatching ${t}...`).start(),r=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"];r.includes(t)||(n.fail(`Invalid action. Valid actions: ${r.join(", ")}`),process.exit(1));try{var i=yield a.dispatchDeviceGroupAction({id:e,action:t});n.succeed(`Action dispatched: ${M.Ay.green(t)}`),i&&(console.log(`Success: ${M.Ay.green(i.success||0)}`),console.log(`Failed: ${M.Ay.red(i.failed||0)}`))}catch(e){n.fail(`Failed to dispatch action: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("refresh <id>").description("Refresh all devices in group").action(function(){var e=O(function*(e){var t=le(),a=(0,G.default)("Refreshing devices...").start();try{var n=yield t.dispatchDeviceGroupAction({id:e,action:"refresh"});a.succeed("Devices refreshed"),n&&(console.log(`Success: ${M.Ay.green(n.success||0)}`),console.log(`Failed: ${M.Ay.red(n.failed||0)}`))}catch(e){a.fail(`Failed to refresh: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ce.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action(function(){var e=O(function*(e,t){var a=le(),n=1e3*parseInt(t.interval,10);console.log(M.Ay.bold("\nDevice Group Monitor")),console.log(M.Ay.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.\n`));var r=function(){var t=O(function*(){try{var t=yield Promise.all([a.deviceGroup({id:e}),a.devicesByGroup({id:e})]),n=pe(t,2),r=n[0],i=n[1];if(process.stdout.write("[2J[0f"),console.log(M.Ay.bold(`Device Group: ${r.name}`)+M.Ay.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!i||0===i.length)return void console.log(M.Ay.yellow("No devices in this group"));var o=0,s=0;i.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=ue(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");t&&Date.now()-new Date(t).getTime()<=de?o++:s++,console.log(`${a} ${M.Ay.cyan(n.padEnd(30))} ${r}`)}),console.log("─".repeat(80)),console.log(`Online: ${M.Ay.green(o)} Offline: ${M.Ay.red(s)}`),console.log(`\n${M.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(M.Ay.red(`Error: ${e.message}`))}});return function(){return t.apply(this,arguments)}}();yield r(),setInterval(r,n)});return function(t,a){return e.apply(this,arguments)}}());var me=()=>{var e=(0,V.getCurrentProfile)(),t=(0,V.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,V.getBaseUrl)(),t)},fe=function(){var e=O(function*(e){var t=yield e.workspace();if(!(0,Y.wR)(t))throw new Error("Media workspace not enabled for this workspace")});return function(t){return e.apply(this,arguments)}}(),_e=new P("media").description("Media Flow support");_e.command("boxes").description("List Media Flow boxes").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=me(),a=(0,G.default)("Fetching media boxes...").start();try{yield fe(t);var n=yield t.mediaBoxes();if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No media boxes found"));console.log(M.Ay.bold("\nMedia Boxes")),console.log("─".repeat(80)),n.forEach(e=>{console.log(`${M.Ay.cyan(e.name||"Unnamed")} ${M.Ay.gray(e.id)}`),e.description&&console.log(` ${e.description}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),null!=e.size&&console.log(` Size: ${e.size}`),console.log()})}catch(e){a.fail(`Failed to list media boxes: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),_e.command("box <id>").description("Get Media Flow box details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,G.default)("Fetching media box...").start();try{yield fe(a);var r=yield a.mediaBox({id:e});if(n.stop(),r||(console.log(M.Ay.red("Media box not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nMedia Box: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r.id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),null!=r.size&&console.log(`Size: ${r.size}`),r.passcodes?.length&&(console.log(`\n${M.Ay.bold("Passcodes")}`),r.passcodes.forEach(e=>{console.log(`- ${e.name||"Passcode"}: ${e.code}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get media box: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),_e.command("files <boxId>").description("List Media Flow files in a box").option("-t, --types <types>","Comma-separated file types to include").option("-u, --user-tag <tag>","Filter by user tag (repeatable)",(e,t)=>[...t,e],[]).option("-l, --limit <limit>","Limit results",e=>Number.parseInt(e,10)).option("-o, --offset <offset>","Offset results",e=>Number.parseInt(e,10)).option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,G.default)("Fetching media files...").start();try{yield fe(a);var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):void 0,i=t.userTag?.length?t.userTag:void 0,o=yield a.mediaFiles({boxId:e,includeTypes:r,userTags:i,limit:t.limit,offset:t.offset});if(n.stop(),t.json)return void console.log(JSON.stringify(o,null,2));if(!o||0===o.length)return void console.log(M.Ay.yellow("No media files found"));console.log(M.Ay.bold(`\nMedia Files (${o.length})`)),console.log("─".repeat(100)),o.forEach(e=>{console.log(`${M.Ay.cyan(e.name||"Unnamed")} ${M.Ay.gray(e.id)}`),console.log(` Type: ${e.fileType}`),e.userTags?.length&&console.log(` Tags: ${e.userTags.join(", ")}`),e.updatedAt&&console.log(` Updated: ${new Date(e.updatedAt).toLocaleString()}`),console.log()})}catch(e){n.fail(`Failed to list media files: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),_e.command("file <id>").description("Get Media Flow file details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,G.default)("Fetching media file...").start();try{yield fe(a);var r=yield a.mediaFile({id:e});if(n.stop(),r||(console.log(M.Ay.red("Media file not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nMedia File: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r.id)}`),console.log(`Box ID: ${M.Ay.gray(r.boxId)}`),console.log(`Type: ${r.fileType}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.userTags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.createdAt||"N/A")}`),console.log(`Updated: ${M.Ay.gray(r.updatedAt||"N/A")}`);var i=(0,Y.Gu)(r),o=(0,Y.Gu)(r,{preferThumbnail:!0});r.meta?.originalFileKey&&console.log(`Original Key: ${M.Ay.gray(r.meta.originalFileKey)}`),i&&console.log(`Original URL: ${M.Ay.gray(i)}`),o&&o!==i&&console.log(`Thumbnail URL: ${M.Ay.gray(o)}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get media file: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}());var he,Ee,ye={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},Te=e=>{var t=Object.entries(ye).find(([,t])=>e===t);return t?t[0]:null},Re=new P("config").description("CLI configuration management");Re.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set the API endpoint environment").action(e=>{var t=(0,V.getBaseUrl)(),a=Te(t);if(!e)return console.log(M.Ay.bold("\nAPI Endpoint Configuration")),console.log("─".repeat(50)),console.log(`Current URL: ${M.Ay.cyan(t)}`),a?console.log(`Environment: ${M.Ay.green(a)}`):console.log(`Environment: ${M.Ay.yellow("custom")}`),console.log("─".repeat(50)),console.log(M.Ay.gray("\nAvailable environments:")),Object.entries(ye).forEach(([e,a])=>{var n=t===a?M.Ay.green("● "):" ",r=t===a?M.Ay.green(e):e;console.log(`${n}${r.padEnd(8)} ${M.Ay.gray(a)}`)}),console.log(""),void console.log(M.Ay.gray("Usage: bricks config endpoint <prod|beta|dev>"));var n=Object.keys(ye);n.includes(e)||(console.error(M.Ay.red(`Invalid environment: ${e}`)),console.log(M.Ay.gray(`Valid options: ${n.join(", ")}`)),process.exit(1));var r=ye[e];t!==r?((0,V.setBaseUrl)(r),console.log(M.Ay.green(`✓ Endpoint changed to ${e}: ${r}`)),console.log(M.Ay.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(M.Ay.gray("Use `bricks auth status` to check your connection."))):console.log(M.Ay.yellow(`Already using ${e} environment: ${r}`))}),Re.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,V.getBaseUrl)(),a=Te(t);e.json?console.log(JSON.stringify({endpoint:t,environment:a||"custom"},null,2)):(console.log(M.Ay.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`API Endpoint: ${M.Ay.cyan(t)}`),a?console.log(`Environment: ${M.Ay.green(a)}`):console.log(`Environment: ${M.Ay.yellow("custom")}`),console.log("─".repeat(50)))}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(he||(he={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Ee||(Ee={}));const ge=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ve=e=>{switch(typeof e){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(e)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(e)?ge.array:null===e?ge.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ge.promise:"undefined"!=typeof Map&&e instanceof Map?ge.map:"undefined"!=typeof Set&&e instanceof Set?ge.set:"undefined"!=typeof Date&&e instanceof Date?ge.date:ge.object;default:return ge.unknown}},Oe=he.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ne extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,n=0;for(;n<r.path.length;){const a=r.path[n];n===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(e){if(!(e instanceof Ne))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,he.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}Ne.create=e=>new Ne(e);const be=(e,t)=>{let a;switch(e.code){case Oe.invalid_type:a=e.received===ge.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,he.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:a=`Unrecognized key(s) in object: ${he.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:a="Invalid input";break;case Oe.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${he.joinValues(e.options)}`;break;case Oe.invalid_enum_value:a=`Invalid enum value. Expected ${he.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:a="Invalid function arguments";break;case Oe.invalid_return_type:a="Invalid function return type";break;case Oe.invalid_date:a="Invalid date";break;case Oe.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:he.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Oe.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Oe.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Oe.custom:a="Invalid input";break;case Oe.invalid_intersection_types:a="Intersection results could not be merged";break;case Oe.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:a="Number must be finite";break;default:a=t.defaultError,he.assertNever(e)}return{message:a}};let Ae=be;function Se(){return Ae}var Ie;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Ie||(Ie={}));const we=e=>{const{data:t,path:a,errorMaps:n,issueData:r}=e,i=[...a,...r.path||[]],o={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let s="";const p=n.filter(e=>!!e).slice().reverse();for(const e of p)s=e(o,{data:t,defaultError:s}).message;return{...r,path:i,message:s}};function Ce(e,t){const a=Se(),n=we({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===be?void 0:be].filter(e=>!!e)});e.common.issues.push(n)}class De{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return Pe;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return De.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return Pe;if("aborted"===r.status)return Pe;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const Pe=Object.freeze({status:"aborted"}),je=e=>({status:"dirty",value:e}),ke=e=>({status:"valid",value:e}),Le=e=>"aborted"===e.status,Me=e=>"dirty"===e.status,Ge=e=>"valid"===e.status,xe=e=>"undefined"!=typeof Promise&&e instanceof Promise;class Fe{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Be=(e,t)=>{if(Ge(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ne(e.common.issues);return this._error=t,this._error}}};function ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:r}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??r.defaultError}:void 0===r.data?{message:i??n??r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:i??a??r.defaultError}},description:r}}class Ve{get description(){return this._def.description}_getType(e){return ve(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new De,ctx:{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},n=this._parseSync({data:e,path:a.path,parent:a});return Be(a,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Ge(a)?{value:a.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Ge(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},n=this._parse({data:e,path:a.path,parent:a}),r=await(xe(n)?n:Promise.resolve(n));return Be(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const r=e(t),i=()=>n.addIssue({code:Oe.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(i(),!1)):!!r||(i(),!1)})}refinement(e,t){return this._refinement((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1))}_refinement(e){return new Bt({schema:this,typeName:Qt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return zt.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bt.create(this)}promise(){return Ft.create(this,this._def)}or(e){return It.create([this,e],this._def)}and(e){return Ct.create(this,e,this._def)}transform(e){return new Bt({...ze(this._def),schema:this,typeName:Qt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $t({...ze(this._def),innerType:this,defaultValue:t,typeName:Qt.ZodDefault})}brand(){return new Kt({typeName:Qt.ZodBranded,type:this,...ze(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ut({...ze(this._def),innerType:this,catchValue:t,typeName:Qt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return qt.create(this,e)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $e=/^c[^\s-]{8,}$/i,Ue=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ke=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qe=/^[a-z0-9_-]{21}$/i,We=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ye=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Xe;const Je=/^(?:(?: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])$/,Ze=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,et=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,at=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rt="((\\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])))",it=new RegExp(`^${rt}$`);function ot(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function st(e){return new RegExp(`^${ot(e)}$`)}function pt(e){let t=`${rt}T${ot(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function lt(e,t){return!("v4"!==t&&t||!Je.test(e))||!("v6"!==t&&t||!et.test(e))}function dt(e,t){if(!We.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(n));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===r?.typ)&&(!!r.alg&&(!t||r.alg===t)))}catch{return!1}}function ut(e,t){return!("v4"!==t&&t||!Ze.test(e))||!("v6"!==t&&t||!tt.test(e))}class ct extends Ve{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ge.string){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.string,received:t.parsedType}),Pe}const t=new De;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const r=e.data.length>n.value,i=e.data.length<n.value;(r||i)&&(a=this._getOrReturnCtx(e,a),r?Ce(a,{code:Oe.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&Ce(a,{code:Oe.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)Ye.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"email",code:Oe.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)Xe||(Xe=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"emoji",code:Oe.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)Ke.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"uuid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)qe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"nanoid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)$e.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cuid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)Ue.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cuid2",code:Oe.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)He.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"ulid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),Ce(a,{validation:"url",code:Oe.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"regex",code:Oe.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){pt(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){it.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){st(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?Qe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"duration",code:Oe.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?lt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"ip",code:Oe.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?dt(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"jwt",code:Oe.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ut(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cidr",code:Oe.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?at.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"base64",code:Oe.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?nt.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"base64url",code:Oe.invalid_string,message:n.message}),t.dirty()):he.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:Oe.invalid_string,...Ie.errToObj(a)})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ie.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ie.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ie.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ie.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ie.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...Ie.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ie.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ie.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Ie.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ie.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ie.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ie.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ie.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ie.errToObj(t)})}nonempty(e){return this.min(1,Ie.errToObj(e))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function mt(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ct.create=e=>new ct({checks:[],typeName:Qt.ZodString,coerce:e?.coerce??!1,...ze(e)});class ft extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ge.number){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.number,received:t.parsedType}),Pe}let t;const a=new De;for(const n of this._def.checks)if("int"===n.kind)he.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==mt(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_finite,message:n.message}),a.dirty()):he.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,a,n){return new ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ie.toString(n)}]})}_addCheck(e){return new ft({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&he.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ft.create=e=>new ft({checks:[],typeName:Qt.ZodNumber,coerce:e?.coerce||!1,...ze(e)});class _t extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ge.bigint)return this._getInvalidInput(e);let t;const a=new De;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):he.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.bigint,received:t.parsedType}),Pe}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,a,n){return new _t({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ie.toString(n)}]})}_addCheck(e){return new _t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}_t.create=e=>new _t({checks:[],typeName:Qt.ZodBigInt,coerce:e?.coerce??!1,...ze(e)});class ht extends Ve{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ge.boolean){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.boolean,received:t.parsedType}),Pe}return ke(e.data)}}ht.create=e=>new ht({typeName:Qt.ZodBoolean,coerce:e?.coerce||!1,...ze(e)});class Et extends Ve{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ge.date){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.date,received:t.parsedType}),Pe}if(Number.isNaN(e.data.getTime())){return Ce(this._getOrReturnCtx(e),{code:Oe.invalid_date}),Pe}const t=new De;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):he.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Et({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ie.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ie.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Et.create=e=>new Et({checks:[],coerce:e?.coerce||!1,typeName:Qt.ZodDate,...ze(e)});class yt extends Ve{_parse(e){if(this._getType(e)!==ge.symbol){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.symbol,received:t.parsedType}),Pe}return ke(e.data)}}yt.create=e=>new yt({typeName:Qt.ZodSymbol,...ze(e)});class Tt extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.undefined,received:t.parsedType}),Pe}return ke(e.data)}}Tt.create=e=>new Tt({typeName:Qt.ZodUndefined,...ze(e)});class Rt extends Ve{_parse(e){if(this._getType(e)!==ge.null){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.null,received:t.parsedType}),Pe}return ke(e.data)}}Rt.create=e=>new Rt({typeName:Qt.ZodNull,...ze(e)});class gt extends Ve{constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}}gt.create=e=>new gt({typeName:Qt.ZodAny,...ze(e)});class vt extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}}vt.create=e=>new vt({typeName:Qt.ZodUnknown,...ze(e)});class Ot extends Ve{_parse(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.never,received:t.parsedType}),Pe}}Ot.create=e=>new Ot({typeName:Qt.ZodNever,...ze(e)});class Nt extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.void,received:t.parsedType}),Pe}return ke(e.data)}}Nt.create=e=>new Nt({typeName:Qt.ZodVoid,...ze(e)});class bt extends Ve{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==ge.array)return Ce(t,{code:Oe.invalid_type,expected:ge.array,received:t.parsedType}),Pe;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(Ce(t,{code:e?Oe.too_big:Oe.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Ce(t,{code:Oe.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Ce(t,{code:Oe.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new Fe(t,e,t.path,a)))).then(e=>De.mergeArray(a,e));const r=[...t.data].map((e,a)=>n.type._parseSync(new Fe(t,e,t.path,a)));return De.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new bt({...this._def,minLength:{value:e,message:Ie.toString(t)}})}max(e,t){return new bt({...this._def,maxLength:{value:e,message:Ie.toString(t)}})}length(e,t){return new bt({...this._def,exactLength:{value:e,message:Ie.toString(t)}})}nonempty(e){return this.min(1,e)}}function At(e){if(e instanceof St){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=zt.create(At(n))}return new St({...e._def,shape:()=>t})}return e instanceof bt?new bt({...e._def,type:At(e.element)}):e instanceof zt?zt.create(At(e.unwrap())):e instanceof Vt?Vt.create(At(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(e=>At(e))):e}bt.create=(e,t)=>new bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qt.ZodArray,...ze(t)});class St extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=he.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ge.object){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.object,received:t.parsedType}),Pe}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ot&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||i.push(e);const o=[];for(const e of r){const t=n[e],r=a.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new Fe(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof Ot){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)i.length>0&&(Ce(a,{code:Oe.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=a.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Fe(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>De.mergeObjectSync(t,e)):De.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ie.errToObj,new St({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const n=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:Ie.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new St({...this._def,unknownKeys:"strip"})}passthrough(){return new St({...this._def,unknownKeys:"passthrough"})}extend(e){return new St({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new St({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new St({...this._def,catchall:e})}pick(e){const t={};for(const a of he.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new St({...this._def,shape:()=>t})}omit(e){const t={};for(const a of he.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new St({...this._def,shape:()=>t})}deepPartial(){return At(this)}partial(e){const t={};for(const a of he.objectKeys(this.shape)){const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new St({...this._def,shape:()=>t})}required(e){const t={};for(const a of he.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof zt;)e=e._def.innerType;t[a]=e}return new St({...this._def,shape:()=>t})}keyof(){return Mt(he.objectKeys(this.shape))}}St.create=(e,t)=>new St({shape:()=>e,unknownKeys:"strip",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)}),St.strictCreate=(e,t)=>new St({shape:()=>e,unknownKeys:"strict",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)}),St.lazycreate=(e,t)=>new St({shape:e,unknownKeys:"strip",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)});class It extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new Ne(e.ctx.common.issues));return Ce(t,{code:Oe.invalid_union,unionErrors:a}),Pe});{let e;const n=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map(e=>new Ne(e));return Ce(t,{code:Oe.invalid_union,unionErrors:r}),Pe}}get options(){return this._def.options}}It.create=(e,t)=>new It({options:e,typeName:Qt.ZodUnion,...ze(t)});function wt(e,t){const a=ve(e),n=ve(t);if(e===t)return{valid:!0,data:e};if(a===ge.object&&n===ge.object){const a=he.objectKeys(t),n=he.objectKeys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const a of n){const n=wt(e[a],t[a]);if(!n.valid)return{valid:!1};r[a]=n.data}return{valid:!0,data:r}}if(a===ge.array&&n===ge.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const r=wt(e[n],t[n]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===ge.date&&n===ge.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ct extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(Le(e)||Le(n))return Pe;const r=wt(e.value,n.value);return r.valid?((Me(e)||Me(n))&&t.dirty(),{status:t.value,value:r.data}):(Ce(a,{code:Oe.invalid_intersection_types}),Pe)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}Ct.create=(e,t,a)=>new Ct({left:e,right:t,typeName:Qt.ZodIntersection,...ze(a)});class Dt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.array)return Ce(a,{code:Oe.invalid_type,expected:ge.array,received:a.parsedType}),Pe;if(a.data.length<this._def.items.length)return Ce(a,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&a.data.length>this._def.items.length&&(Ce(a,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Fe(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>De.mergeArray(t,e)):De.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Dt({...this._def,rest:e})}}Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:Qt.ZodTuple,rest:null,...ze(t)})};class Pt extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.map)return Ce(a,{code:Oe.invalid_type,expected:ge.map,received:a.parsedType}),Pe;const n=this._def.keyType,r=this._def.valueType,i=[...a.data.entries()].map(([e,t],i)=>({key:n._parse(new Fe(a,e,a.path,[i,"key"])),value:r._parse(new Fe(a,t,a.path,[i,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of i){const n=await a.key,r=await a.value;if("aborted"===n.status||"aborted"===r.status)return Pe;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of i){const n=a.key,r=a.value;if("aborted"===n.status||"aborted"===r.status)return Pe;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}}Pt.create=(e,t,a)=>new Pt({valueType:t,keyType:e,typeName:Qt.ZodMap,...ze(a)});class jt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.set)return Ce(a,{code:Oe.invalid_type,expected:ge.set,received:a.parsedType}),Pe;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(Ce(a,{code:Oe.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(Ce(a,{code:Oe.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const a=new Set;for(const n of e){if("aborted"===n.status)return Pe;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const o=[...a.data.values()].map((e,t)=>r._parse(new Fe(a,e,a.path,t)));return a.common.async?Promise.all(o).then(e=>i(e)):i(o)}min(e,t){return new jt({...this._def,minSize:{value:e,message:Ie.toString(t)}})}max(e,t){return new jt({...this._def,maxSize:{value:e,message:Ie.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}jt.create=(e,t)=>new jt({valueType:e,minSize:null,maxSize:null,typeName:Qt.ZodSet,...ze(t)});class kt extends Ve{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}kt.create=(e,t)=>new kt({getter:e,typeName:Qt.ZodLazy,...ze(t)});class Lt extends Ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ce(t,{received:t.data,code:Oe.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Mt(e,t){return new Gt({values:e,typeName:Qt.ZodEnum,...ze(t)})}Lt.create=(e,t)=>new Lt({value:e,typeName:Qt.ZodLiteral,...ze(t)});class Gt extends Ve{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return Ce(t,{expected:he.joinValues(a),received:t.parsedType,code:Oe.invalid_type}),Pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return Ce(t,{received:t.data,code:Oe.invalid_enum_value,options:a}),Pe}return ke(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Gt.create(e,{...this._def,...t})}exclude(e,t=this._def){return Gt.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Gt.create=Mt;class xt extends Ve{_parse(e){const t=he.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==ge.string&&a.parsedType!==ge.number){const e=he.objectValues(t);return Ce(a,{expected:he.joinValues(e),received:a.parsedType,code:Oe.invalid_type}),Pe}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=he.objectValues(t);return Ce(a,{received:a.data,code:Oe.invalid_enum_value,options:e}),Pe}return ke(e.data)}get enum(){return this._def.values}}xt.create=(e,t)=>new xt({values:e,typeName:Qt.ZodNativeEnum,...ze(t)});class Ft extends Ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ge.promise&&!1===t.common.async)return Ce(t,{code:Oe.invalid_type,expected:ge.promise,received:t.parsedType}),Pe;const a=t.parsedType===ge.promise?t.data:Promise.resolve(t.data);return ke(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ft.create=(e,t)=>new Ft({type:e,typeName:Qt.ZodPromise,...ze(t)});class Bt extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{Ce(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Pe;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?Pe:"dirty"===n.status||"dirty"===t.value?je(n.value):n});{if("aborted"===t.value)return Pe;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?Pe:"dirty"===n.status||"dirty"===t.value?je(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?Pe:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?Pe:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ge(e))return Pe;const i=n.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Ge(e)?Promise.resolve(n.transform(e.value,r)).then(e=>({status:t.value,value:e})):Pe)}he.assertNever(n)}}Bt.create=(e,t,a)=>new Bt({schema:e,typeName:Qt.ZodEffects,effect:t,...ze(a)}),Bt.createWithPreprocess=(e,t,a)=>new Bt({schema:t,effect:{type:"preprocess",transform:e},typeName:Qt.ZodEffects,...ze(a)});class zt extends Ve{_parse(e){return this._getType(e)===ge.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:Qt.ZodOptional,...ze(t)});class Vt extends Ve{_parse(e){return this._getType(e)===ge.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Vt.create=(e,t)=>new Vt({innerType:e,typeName:Qt.ZodNullable,...ze(t)});class $t extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===ge.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$t.create=(e,t)=>new $t({innerType:e,typeName:Qt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ze(t)});class Ut extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return xe(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ne(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ne(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Ut.create=(e,t)=>new Ut({innerType:e,typeName:Qt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ze(t)});class Ht extends Ve{_parse(e){if(this._getType(e)!==ge.nan){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.nan,received:t.parsedType}),Pe}return{status:"valid",value:e.data}}}Ht.create=e=>new Ht({typeName:Qt.ZodNaN,...ze(e)});Symbol("zod_brand");class Kt extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class qt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?Pe:"dirty"===e.status?(t.dirty(),je(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?Pe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new qt({in:e,out:t,typeName:Qt.ZodPipeline})}}class Wt extends Ve{_parse(e){const t=this._def.innerType._parse(e),a=e=>(Ge(e)&&(e.value=Object.freeze(e.value)),e);return xe(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}Wt.create=(e,t)=>new Wt({innerType:e,typeName:Qt.ZodReadonly,...ze(t)});St.lazycreate;var Qt;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qt||(Qt={}));const Yt=ct.create,Xt=ft.create,Jt=(Ht.create,_t.create,ht.create,Et.create,yt.create,Tt.create,Rt.create,gt.create,vt.create,Ot.create,Nt.create,bt.create),Zt=St.create,ea=(St.strictCreate,It.create,Ct.create,Dt.create,Pt.create,jt.create,kt.create,Lt.create,Gt.create);xt.create,Ft.create,Bt.create,zt.create,Vt.create,Bt.createWithPreprocess,qt.create,Object.freeze({status:"aborted"});function ta(e,t,a){function n(a,n){var r;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(r=a._zod).traits??(r.traits=new Set),a._zod.traits.add(e),t(a,n);for(const e in o.prototype)e in a||Object.defineProperty(a,e,{value:o.prototype[e].bind(a)});a._zod.constr=o,a._zod.def=n}const r=a?.Parent??Object;class i extends r{}function o(e){var t;const r=a?.Parent?new i:this;n(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(a?.Parent&&t instanceof a.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class aa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const na={};function ra(e){return e&&Object.assign(na,e),na}const ia=/^[cC][^\s-]{8,}$/,oa=/^[0-9a-z]+$/,sa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pa=/^[0-9a-vA-V]{20}$/,la=/^[A-Za-z0-9]{27}$/,da=/^[a-zA-Z0-9_-]{21}$/,ua=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ca=/^([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})$/,ma=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)$/,fa=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const _a=/^(?:(?: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])$/,ha=/^(([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})$/,Ea=/^((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])$/,ya=/^(([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])$/,Ta=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ra=/^[A-Za-z0-9_-]*$/,ga=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,va=/^\+(?:[0-9]){6,14}[0-9]$/,Oa="(?:(?:\\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])))",Na=new RegExp(`^${Oa}$`);function ba(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Aa=/^\d+$/,Sa=/^-?\d+(?:\.\d+)?/i,Ia=/true|false/i,wa=/null/i,Ca=/^[^A-Z]*$/,Da=/^[^a-z]*$/;function Pa(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,a])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function ja(e,t){return"bigint"==typeof t?t.toString():t}function ka(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function La(e){return null==e}function Ma(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function Ga(e,t,a){Object.defineProperty(e,t,{get(){{const n=a();return e[t]=n,n}},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function xa(e,t,a){Object.defineProperty(e,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}function Fa(e){return JSON.stringify(e)}const Ba=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function za(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Va=ka(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function $a(e){if(!1===za(e))return!1;const t=e.constructor;if(void 0===t)return!0;const a=t.prototype;return!1!==za(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}const Ua=new Set(["string","number","symbol"]);new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ka(e,t,a){const n=new e._zod.constr(t??e._zod.def);return t&&!a?.parent||(n._zod.parent=e),n}function qa(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Wa={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 Qa(e,t=0){for(let a=t;a<e.issues.length;a++)if(!0!==e.issues[a]?.continue)return!0;return!1}function Ya(e,t){return t.map(t=>{var a;return(a=t).path??(a.path=[]),t.path.unshift(e),t})}function Xa(e){return"string"==typeof e?e:e?.message}function Ja(e,t,a){const n={...e,path:e.path??[]};if(!e.message){const r=Xa(e.inst?._zod.def?.error?.(e))??Xa(t?.error?.(e))??Xa(a.customError?.(e))??Xa(a.localeError?.(e))??"Invalid input";n.message=r}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Za(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function en(...e){const[t,a,n]=e;return"string"==typeof t?{message:t,code:"custom",input:a,inst:n}:{...t}}const tn=ta("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),an={number:"number",bigint:"bigint",object:"date"},nn=ta("$ZodCheckLessThan",(e,t)=>{tn.init(e,t);const a=an[typeof t.value];e._zod.onattach.push(e=>{const a=e._zod.bag,n=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:a,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rn=ta("$ZodCheckGreaterThan",(e,t)=>{tn.init(e,t);const a=an[typeof t.value];e._zod.onattach.push(e=>{const a=e._zod.bag,n=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:a,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),on=ta("$ZodCheckMultipleOf",(e,t)=>{tn.init(e,t),e._zod.onattach.push(e=>{var a;(a=e._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?a.value%t.value===BigInt(0):0===function(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(a.value,t.value))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),sn=ta("$ZodCheckNumberFormat",(e,t)=>{tn.init(e,t),t.format=t.format||"float64";const a=t.format?.includes("int"),n=a?"int":"number",[r,i]=Wa[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=r,n.maximum=i,a&&(n.pattern=Aa)}),e._zod.check=o=>{const s=o.value;if(a){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,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:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}))}s<r&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>i&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:e})}}),pn=ta("$ZodCheckMaxLength",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const n=a.value;if(n.length<=t.maximum)return;const r=Za(n);a.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ln=ta("$ZodCheckMinLength",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const n=a.value;if(n.length>=t.minimum)return;const r=Za(n);a.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dn=ta("$ZodCheckLengthEquals",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=a=>{const n=a.value,r=n.length;if(r===t.length)return;const i=Za(n),o=r>t.length;a.issues.push({origin:i,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),un=ta("$ZodCheckStringFormat",(e,t)=>{var a,n;tn.init(e,t),e._zod.onattach.push(e=>{const a=e._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(a=e._zod).check??(a.check=a=>{t.pattern.lastIndex=0,t.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),cn=ta("$ZodCheckRegex",(e,t)=>{un.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,t.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mn=ta("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ca),un.init(e,t)}),fn=ta("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Da),un.init(e,t)}),_n=ta("$ZodCheckIncludes",(e,t)=>{tn.init(e,t);const a=Ha(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${a}`:a);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),hn=ta("$ZodCheckStartsWith",(e,t)=>{tn.init(e,t);const a=new RegExp(`^${Ha(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),En=ta("$ZodCheckEndsWith",(e,t)=>{tn.init(e,t);const a=new RegExp(`.*${Ha(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}});const yn=ta("$ZodCheckOverwrite",(e,t)=>{tn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Tn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),a=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(a)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Rn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,ja,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gn=ta("$ZodError",Rn),vn=ta("$ZodError",Rn,{Parent:Error});const On=e=>(t,a,n,r)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new aa;if(o.issues.length){const t=new(r?.Err??e)(o.issues.map(e=>Ja(e,i,ra())));throw Ba(t,r?.callee),t}return o.value},Nn=On(vn),bn=e=>async(t,a,n,r)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:a,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(r?.Err??e)(o.issues.map(e=>Ja(e,i,ra())));throw Ba(t,r?.callee),t}return o.value},An=bn(vn),Sn=e=>(t,a,n)=>{const r=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:a,issues:[]},r);if(i instanceof Promise)throw new aa;return i.issues.length?{success:!1,error:new(e??gn)(i.issues.map(e=>Ja(e,r,ra())))}:{success:!0,data:i.value}},In=Sn(vn),wn=e=>async(t,a,n)=>{const r=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:a,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>Ja(e,r,ra())))}:{success:!0,data:i.value}},Cn=wn(vn),Dn={major:4,minor:0,patch:0},Pn=ta("$ZodType",(e,t)=>{var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const a of t._zod.onattach)a(e);if(0===n.length)(a=e._zod).deferred??(a.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,a)=>{let n,r=Qa(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,o=i._zod.check(e);if(o instanceof Promise&&!1===a?.async)throw new aa;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(r||(r=Qa(e,t)))});else{if(e.issues.length===t)continue;r||(r=Qa(e,t))}}return n?n.then(()=>e):e};e._zod.run=(a,r)=>{const i=e._zod.parse(a,r);if(i instanceof Promise){if(!1===r.async)throw new aa;return i.then(e=>t(e,n,r))}return t(i,n,r)}}e["~standard"]={validate:t=>{try{const a=In(e,t);return a.success?{value:a.data}:{issues:a.error?.issues}}catch(a){return Cn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),jn=ta("$ZodString",(e,t)=>{var a;Pn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=e._zod.bag,new RegExp(`^${a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=String(a.value)}catch(n){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),kn=ta("$ZodStringFormat",(e,t)=>{un.init(e,t),jn.init(e,t)}),Ln=ta("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ca),kn.init(e,t)}),Mn=ta("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ma(e))}else t.pattern??(t.pattern=ma());kn.init(e,t)}),Gn=ta("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=fa),kn.init(e,t)}),xn=ta("$ZodURL",(e,t)=>{kn.init(e,t),e._zod.check=a=>{try{const n=a.value,r=new URL(n),i=r.href;return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ga.source,input:a.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort})),void(!n.endsWith("/")&&i.endsWith("/")?a.value=i.slice(0,-1):a.value=i)}catch(n){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),Fn=ta("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kn.init(e,t)}),Bn=ta("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=da),kn.init(e,t)}),zn=ta("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ia),kn.init(e,t)}),Vn=ta("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oa),kn.init(e,t)}),$n=ta("$ZodULID",(e,t)=>{t.pattern??(t.pattern=sa),kn.init(e,t)}),Un=ta("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pa),kn.init(e,t)}),Hn=ta("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=la),kn.init(e,t)}),Kn=ta("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ba({precision:e.precision}),a=["Z"];e.local&&a.push(""),e.offset&&a.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${a.join("|")})`;return new RegExp(`^${Oa}T(?:${n})$`)}(t)),kn.init(e,t)}),qn=ta("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Na),kn.init(e,t)}),Wn=ta("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ba(t)}$`)),kn.init(e,t)}),Qn=ta("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ua),kn.init(e,t)}),Yn=ta("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=_a),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Xn=ta("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ha),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=a=>{try{new URL(`http://[${a.value}]`)}catch{a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}}),Jn=ta("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ea),kn.init(e,t)}),Zn=ta("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ya),kn.init(e,t),e._zod.check=a=>{const[n,r]=a.value.split("/");try{if(!r)throw new Error;const e=Number(r);if(`${e}`!==r)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!t.abort})}}});function er(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const tr=ta("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ta),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=a=>{er(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!t.abort})}});const ar=ta("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ra),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=a=>{(function(e){if(!Ra.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return er(t.padEnd(4*Math.ceil(t.length/4),"="))})(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!t.abort})}}),nr=ta("$ZodE164",(e,t)=>{t.pattern??(t.pattern=va),kn.init(e,t)});const rr=ta("$ZodJWT",(e,t)=>{kn.init(e,t),e._zod.check=a=>{(function(e,t=null){try{const a=e.split(".");if(3!==a.length)return!1;const[n]=a;if(!n)return!1;const r=JSON.parse(atob(n));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(a.value,t.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!t.abort})}}),ir=ta("$ZodNumber",(e,t)=>{Pn.init(e,t),e._zod.pattern=e._zod.bag.pattern??Sa,e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=Number(a.value)}catch(e){}const r=a.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return a;const i="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return a.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),a}}),or=ta("$ZodNumber",(e,t)=>{sn.init(e,t),ir.init(e,t)}),sr=ta("$ZodBoolean",(e,t)=>{Pn.init(e,t),e._zod.pattern=Ia,e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=Boolean(a.value)}catch(e){}const r=a.value;return"boolean"==typeof r||a.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),a}}),pr=ta("$ZodNull",(e,t)=>{Pn.init(e,t),e._zod.pattern=wa,e._zod.values=new Set([null]),e._zod.parse=(t,a)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),lr=ta("$ZodUnknown",(e,t)=>{Pn.init(e,t),e._zod.parse=e=>e}),dr=ta("$ZodNever",(e,t)=>{Pn.init(e,t),e._zod.parse=(t,a)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ur(e,t,a){e.issues.length&&t.issues.push(...Ya(a,e.issues)),t.value[a]=e.value}const cr=ta("$ZodArray",(e,t)=>{Pn.init(e,t),e._zod.parse=(a,n)=>{const r=a.value;if(!Array.isArray(r))return a.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),a;a.value=Array(r.length);const i=[];for(let e=0;e<r.length;e++){const o=r[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?i.push(s.then(t=>ur(t,a,e))):ur(s,a,e)}return i.length?Promise.all(i).then(()=>a):a}});function mr(e,t,a){e.issues.length&&t.issues.push(...Ya(a,e.issues)),t.value[a]=e.value}function fr(e,t,a,n){e.issues.length?void 0===n[a]?t.value[a]=a in n?void 0:e.value:t.issues.push(...Ya(a,e.issues)):void 0===e.value?a in n&&(t.value[a]=void 0):t.value[a]=e.value}const _r=ta("$ZodObject",(e,t)=>{Pn.init(e,t);const a=ka(()=>{const e=Object.keys(t.shape);for(const a of e)if(!(t.shape[a]instanceof Pn))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const a=(n=t.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(a)}});Ga(e._zod,"propValues",()=>{const e=t.shape,a={};for(const t in e){const n=e[t]._zod;if(n.values){a[t]??(a[t]=new Set);for(const e of n.values)a[t].add(e)}}return a});let n;const r=za,i=!na.jitless,o=i&&Va.value,s=t.catchall;let p;e._zod.parse=(l,d)=>{p??(p=a.value);const u=l.value;if(!r(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;const c=[];if(i&&o&&!1===d?.async&&!0!==d.jitless)n||(n=(e=>{const t=new Tn(["shape","payload","ctx"]),n=a.value,r=e=>{const t=Fa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let o=0;for(const e of n.keys)i[e]="key_"+o++;t.write("const newResult = {}");for(const e of n.keys)if(n.optionalKeys.has(e)){const a=i[e];t.write(`const ${a} = ${r(e)};`);const n=Fa(e);t.write(`\n if (${a}.issues.length) {\n if (input[${n}] === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${a}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}],\n }))\n );\n }\n } else if (${a}.value === undefined) {\n if (${n} in input) newResult[${n}] = undefined;\n } else {\n newResult[${n}] = ${a}.value;\n }\n `)}else{const a=i[e];t.write(`const ${a} = ${r(e)};`),t.write(`\n if (${a}.issues.length) payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${Fa(e)}, ...iss.path] : [${Fa(e)}]\n })));`),t.write(`newResult[${Fa(e)}] = ${a}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,a)=>s(e,t,a)})(t.shape)),l=n(l,d);else{l.value={};const e=p.shape;for(const t of p.keys){const a=e[t],n=a._zod.run({value:u[t],issues:[]},d),r="optional"===a._zod.optin&&"optional"===a._zod.optout;n instanceof Promise?c.push(n.then(e=>r?fr(e,l,t,u):mr(e,l,t))):r?fr(n,l,t,u):mr(n,l,t)}}if(!s)return c.length?Promise.all(c).then(()=>l):l;const m=[],f=p.keySet,_=s._zod,h=_.def.type;for(const e of Object.keys(u)){if(f.has(e))continue;if("never"===h){m.push(e);continue}const t=_.run({value:u[e],issues:[]},d);t instanceof Promise?c.push(t.then(t=>mr(t,l,e))):mr(t,l,e)}return m.length&&l.issues.push({code:"unrecognized_keys",keys:m,input:u,inst:e}),c.length?Promise.all(c).then(()=>l):l}});function hr(e,t,a,n){for(const a of e)if(0===a.issues.length)return t.value=a.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(e=>e.issues.map(e=>Ja(e,n,ra())))}),t}const Er=ta("$ZodUnion",(e,t)=>{Pn.init(e,t),Ga(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Ga(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Ga(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ga(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Ma(e.source)).join("|")})$`)}}),e._zod.parse=(a,n)=>{let r=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},n);if(t instanceof Promise)i.push(t),r=!0;else{if(0===t.issues.length)return t;i.push(t)}}return r?Promise.all(i).then(t=>hr(t,a,e,n)):hr(i,a,e,n)}}),yr=ta("$ZodDiscriminatedUnion",(e,t)=>{Er.init(e,t);const a=e._zod.parse;Ga(e._zod,"propValues",()=>{const e={};for(const a of t.options){const n=a._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[t,a]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of a)e[t].add(n)}}return e});const n=ka(()=>{const e=t.options,a=new Map;for(const n of e){const e=n._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(a.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);a.set(t,n)}}return a});e._zod.parse=(r,i)=>{const o=r.value;if(!za(o))return r.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),r;const s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(r,i):t.unionFallback?a(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:o,path:[t.discriminator],inst:e}),r)}}),Tr=ta("$ZodIntersection",(e,t)=>{Pn.init(e,t),e._zod.parse=(e,a)=>{const n=e.value,r=t.left._zod.run({value:n,issues:[]},a),i=t.right._zod.run({value:n,issues:[]},a);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then(([t,a])=>gr(e,t,a)):gr(e,r,i)}});function Rr(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($a(e)&&$a(t)){const a=Object.keys(t),n=Object.keys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const a of n){const n=Rr(e[a],t[a]);if(!n.valid)return{valid:!1,mergeErrorPath:[a,...n.mergeErrorPath]};r[a]=n.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let n=0;n<e.length;n++){const r=Rr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};a.push(r.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function gr(e,t,a){if(t.issues.length&&e.issues.push(...t.issues),a.issues.length&&e.issues.push(...a.issues),Qa(e))return e;const n=Rr(t.value,a.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const vr=ta("$ZodRecord",(e,t)=>{Pn.init(e,t),e._zod.parse=(a,n)=>{const r=a.value;if(!$a(r))return a.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),a;const i=[];if(t.keyType._zod.values){const o=t.keyType._zod.values;a.value={};for(const e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const o=t.valueType._zod.run({value:r[e],issues:[]},n);o instanceof Promise?i.push(o.then(t=>{t.issues.length&&a.issues.push(...Ya(e,t.issues)),a.value[e]=t.value})):(o.issues.length&&a.issues.push(...Ya(e,o.issues)),a.value[e]=o.value)}let s;for(const e in r)o.has(e)||(s=s??[],s.push(e));s&&s.length>0&&a.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s})}else{a.value={};for(const o of Reflect.ownKeys(r)){if("__proto__"===o)continue;const s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){a.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(e=>Ja(e,n,ra())),input:o,path:[o],inst:e}),a.value[s.value]=s.value;continue}const p=t.valueType._zod.run({value:r[o],issues:[]},n);p instanceof Promise?i.push(p.then(e=>{e.issues.length&&a.issues.push(...Ya(o,e.issues)),a.value[s.value]=e.value})):(p.issues.length&&a.issues.push(...Ya(o,p.issues)),a.value[s.value]=p.value)}}return i.length?Promise.all(i).then(()=>a):a}});const Or=ta("$ZodEnum",(e,t)=>{Pn.init(e,t);const a=Pa(t.entries);e._zod.values=new Set(a),e._zod.pattern=new RegExp(`^(${a.filter(e=>Ua.has(typeof e)).map(e=>"string"==typeof e?Ha(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const r=t.value;return e._zod.values.has(r)||t.issues.push({code:"invalid_value",values:a,input:r,inst:e}),t}}),Nr=ta("$ZodLiteral",(e,t)=>{Pn.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Ha(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(a,n)=>{const r=a.value;return e._zod.values.has(r)||a.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),a}}),br=ta("$ZodTransform",(e,t)=>{Pn.init(e,t),e._zod.parse=(e,a)=>{const n=t.transform(e.value,e);if(a.async){return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(e.value=t,e))}if(n instanceof Promise)throw new aa;return e.value=n,e}}),Ar=ta("$ZodOptional",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ga(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ga(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ma(e.source)})?$`):void 0}),e._zod.parse=(e,a)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,a):void 0===e.value?e:t.innerType._zod.run(e,a)}),Sr=ta("$ZodNullable",(e,t)=>{Pn.init(e,t),Ga(e._zod,"optin",()=>t.innerType._zod.optin),Ga(e._zod,"optout",()=>t.innerType._zod.optout),Ga(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ma(e.source)}|null)$`):void 0}),Ga(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,a)=>null===e.value?e:t.innerType._zod.run(e,a)}),Ir=ta("$ZodDefault",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(e=>wr(e,t)):wr(n,t)}});function wr(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Cr=ta("$ZodPrefault",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,a))}),Dr=ta("$ZodNonOptional",(e,t)=>{Pn.init(e,t),Ga(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(a,n)=>{const r=t.innerType._zod.run(a,n);return r instanceof Promise?r.then(t=>Pr(t,e)):Pr(r,e)}});function Pr(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jr=ta("$ZodCatch",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"optout",()=>t.innerType._zod.optout),Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>{const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ja(e,a,ra()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ja(e,a,ra()))},input:e.value}),e.issues=[]),e)}}),kr=ta("$ZodPipe",(e,t)=>{Pn.init(e,t),Ga(e._zod,"values",()=>t.in._zod.values),Ga(e._zod,"optin",()=>t.in._zod.optin),Ga(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,a)=>{const n=t.in._zod.run(e,a);return n instanceof Promise?n.then(e=>Lr(e,t,a)):Lr(n,t,a)}});function Lr(e,t,a){return Qa(e)?e:t.out._zod.run({value:e.value,issues:e.issues},a)}const Mr=ta("$ZodReadonly",(e,t)=>{Pn.init(e,t),Ga(e._zod,"propValues",()=>t.innerType._zod.propValues),Ga(e._zod,"values",()=>t.innerType._zod.values),Ga(e._zod,"optin",()=>t.innerType._zod.optin),Ga(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,a)=>{const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(Gr):Gr(n)}});function Gr(e){return e.value=Object.freeze(e.value),e}const xr=ta("$ZodCustom",(e,t)=>{tn.init(e,t),Pn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=a=>{const n=a.value,r=t.fn(n);if(r instanceof Promise)return r.then(t=>Fr(t,a,n,e));Fr(r,a,n,e)}});function Fr(e,t,a,n){if(!e){const e={code:"custom",input:a,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(en(e))}}const Br=ta("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Pn.init(e,t),e.def=t,e.parse=(t,a)=>Nn(e,t,a,{callee:e.parse}),e.safeParse=(t,a)=>In(e,t,a),e.parseAsync=async(t,a)=>An(e,t,a,{callee:e.parseAsync}),e.safeParseAsync=async(t,a)=>Cn(e,t,a),e.check=(...a)=>e.clone({...t,checks:[...t.checks??[],...a.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,a)=>Ka(e,t,a),e.brand=()=>e,e.register=(t,a)=>(t.add(e,a),e)});const zr=ta("ZodMiniObject",(e,t)=>{_r.init(e,t),Br.init(e,t),Ga(e,"shape",()=>t.shape)});function Vr(e,t){const a={type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},...qa(t)};return new zr(a)}function $r(e){return!!e._zod}function Ur(e){const t=Object.values(e);if(0===t.length)return Vr({});const a=t.every($r),n=t.every(e=>!$r(e));if(a)return Vr(e);if(n)return Zt(e);throw new Error("Mixed Zod versions detected in object shape.")}function Hr(e,t){if($r(e)){return In(e,t)}return e.safeParse(t)}async function Kr(e,t){if($r(e)){return await Cn(e,t)}const a=e;return await a.safeParseAsync(t)}function qr(e){var t,a;if(!e)return;let n;if($r(e)){n=null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.shape}else{n=e.shape}if(n){if("function"==typeof n)try{return n()}catch(e){return}return n}}function Wr(e){var t;if(e){if("object"==typeof e){const t=e;if(!e._def&&!t._zod){const t=Object.values(e);if(t.length>0&&t.every(e=>"object"==typeof e&&null!==e&&(void 0!==e._def||void 0!==e._zod||"function"==typeof e.parse)))return Ur(e)}}if($r(e)){const a=null===(t=e._zod)||void 0===t?void 0:t.def;if(a&&("object"===a.type||void 0!==a.shape))return e}else{if(void 0!==e.shape)return e}}}function Qr(e){if(e&&"object"==typeof e){if("message"in e&&"string"==typeof e.message)return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){const t=e.issues[0];if(t&&"object"==typeof t&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch(t){return String(e)}}return String(e)}function Yr(e){var t;if($r(e)){const a=null===(t=e._zod)||void 0===t?void 0:t.def;if(a){if(void 0!==a.value)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const a=e._def;if(a){if(void 0!==a.value)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}const n=e.value;if(void 0!==n)return n}Symbol("ZodOutput"),Symbol("ZodInput");class Xr{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const a=t[0];if(this._map.set(e,a),a&&"object"==typeof a&&"id"in a){if(this._idmap.has(a.id))throw new Error(`ID ${a.id} already exists in the registry`);this._idmap.set(a.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const a={...this.get(t)??{}};return delete a.id,{...a,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Jr(){return new Xr}const Zr=Jr();function ei(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...qa(t)})}function ti(e,t){return new nn({check:"less_than",...qa(t),value:e,inclusive:!1})}function ai(e,t){return new nn({check:"less_than",...qa(t),value:e,inclusive:!0})}function ni(e,t){return new rn({check:"greater_than",...qa(t),value:e,inclusive:!1})}function ri(e,t){return new rn({check:"greater_than",...qa(t),value:e,inclusive:!0})}function ii(e,t){return new on({check:"multiple_of",...qa(t),value:e})}function oi(e,t){return new pn({check:"max_length",...qa(t),maximum:e})}function si(e,t){return new ln({check:"min_length",...qa(t),minimum:e})}function pi(e,t){return new dn({check:"length_equals",...qa(t),length:e})}function li(e){return new yn({check:"overwrite",tx:e})}const di=ta("ZodISODateTime",(e,t)=>{Kn.init(e,t),Ii.init(e,t)});function ui(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...qa(t)})}(di,e)}const ci=ta("ZodISODate",(e,t)=>{qn.init(e,t),Ii.init(e,t)});function mi(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...qa(t)})}(ci,e)}const fi=ta("ZodISOTime",(e,t)=>{Wn.init(e,t),Ii.init(e,t)});function _i(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...qa(t)})}(fi,e)}const hi=ta("ZodISODuration",(e,t)=>{Qn.init(e,t),Ii.init(e,t)});function Ei(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...qa(t)})}(hi,e)}const yi=(e,t)=>{gn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const a=t||function(e){return e.message},n={_errors:[]},r=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>r({issues:e}));else if("invalid_key"===t.code)r({issues:t.issues});else if("invalid_element"===t.code)r({issues:t.issues});else if(0===t.path.length)n._errors.push(a(t));else{let e=n,r=0;for(;r<t.path.length;){const n=t.path[r];r===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(a(t))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const a={},n=[];for(const r of e.issues)r.path.length>0?(a[r.path[0]]=a[r.path[0]]||[],a[r.path[0]].push(t(r))):n.push(t(r));return{formErrors:n,fieldErrors:a}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},Ti=(ta("ZodError",yi),ta("ZodError",yi,{Parent:Error})),Ri=On(Ti),gi=bn(Ti),vi=Sn(Ti),Oi=wn(Ti),Ni=ta("ZodType",(e,t)=>(Pn.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...a)=>e.clone({...t,checks:[...t.checks??[],...a.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,a)=>Ka(e,t,a),e.brand=()=>e,e.register=(t,a)=>(t.add(e,a),e),e.parse=(t,a)=>Ri(e,t,a,{callee:e.parse}),e.safeParse=(t,a)=>vi(e,t,a),e.parseAsync=async(t,a)=>gi(e,t,a,{callee:e.parseAsync}),e.safeParseAsync=async(t,a)=>Oi(e,t,a),e.spa=e.safeParseAsync,e.refine=(t,a)=>e.check(function(e,t={}){return function(e,t,a){return new e({type:"custom",check:"custom",fn:t,...qa(a)})}(Go,e,t)}(t,a)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new tn({check:"custom"});return t._zod.check=e,t}(a=>(a.addIssue=e=>{if("string"==typeof e)a.issues.push(en(e,a.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=a.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),a.issues.push(en(n))}},e(a.value,a)));return t}(t)),e.overwrite=t=>e.check(li(t)),e.optional=()=>So(e),e.nullable=()=>wo(e),e.nullish=()=>So(wo(e)),e.nonoptional=t=>function(e,t){return new Po({type:"nonoptional",innerType:e,...qa(t)})}(e,t),e.array=()=>so(e),e.or=t=>mo([e,t]),e.and=t=>Eo(e,t),e.transform=t=>Lo(e,bo(t)),e.default=t=>{return a=t,new Co({type:"default",innerType:e,get defaultValue(){return"function"==typeof a?a():a}});var a},e.prefault=t=>{return a=t,new Do({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof a?a():a}});var a},e.catch=t=>{return new jo({type:"catch",innerType:e,catchValue:"function"==typeof(a=t)?a:()=>a});var a},e.pipe=t=>Lo(e,t),e.readonly=()=>new Mo({type:"readonly",innerType:e}),e.describe=t=>{const a=e.clone();return Zr.add(a,{description:t}),a},Object.defineProperty(e,"description",{get:()=>Zr.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Zr.get(e);const a=e.clone();return Zr.add(a,t[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bi=ta("_ZodString",(e,t)=>{jn.init(e,t),Ni.init(e,t);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new cn({check:"string_format",format:"regex",...qa(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new _n({check:"string_format",format:"includes",...qa(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new hn({check:"string_format",format:"starts_with",...qa(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new En({check:"string_format",format:"ends_with",...qa(t),suffix:e})}(...t)),e.min=(...t)=>e.check(si(...t)),e.max=(...t)=>e.check(oi(...t)),e.length=(...t)=>e.check(pi(...t)),e.nonempty=(...t)=>e.check(si(1,...t)),e.lowercase=t=>e.check(function(e){return new mn({check:"string_format",format:"lowercase",...qa(e)})}(t)),e.uppercase=t=>e.check(function(e){return new fn({check:"string_format",format:"uppercase",...qa(e)})}(t)),e.trim=()=>e.check(li(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return li(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(li(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(li(e=>e.toUpperCase()))}),Ai=ta("ZodString",(e,t)=>{jn.init(e,t),bi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...qa(t)})}(wi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...qa(t)})}(Pi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...qa(t)})}(qi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...qa(t)})}(ji,t)),e.guid=t=>e.check(ei(Ci,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...qa(t)})}(Di,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...qa(t)})}(Di,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...qa(t)})}(Di,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...qa(t)})}(Di,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...qa(t)})}(ki,t)),e.guid=t=>e.check(ei(Ci,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...qa(t)})}(Li,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...qa(t)})}(Mi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...qa(t)})}(Gi,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...qa(t)})}(Ui,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...qa(t)})}(Hi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...qa(t)})}(xi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...qa(t)})}(Fi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...qa(t)})}(Bi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...qa(t)})}(zi,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...qa(t)})}(Vi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...qa(t)})}($i,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...qa(t)})}(Ki,t)),e.datetime=t=>e.check(ui(t)),e.date=t=>e.check(mi(t)),e.time=t=>e.check(_i(t)),e.duration=t=>e.check(Ei(t))});function Si(e){return function(e,t){return new e({type:"string",...qa(t)})}(Ai,e)}const Ii=ta("ZodStringFormat",(e,t)=>{kn.init(e,t),bi.init(e,t)}),wi=ta("ZodEmail",(e,t)=>{Gn.init(e,t),Ii.init(e,t)});const Ci=ta("ZodGUID",(e,t)=>{Ln.init(e,t),Ii.init(e,t)});const Di=ta("ZodUUID",(e,t)=>{Mn.init(e,t),Ii.init(e,t)});const Pi=ta("ZodURL",(e,t)=>{xn.init(e,t),Ii.init(e,t)});const ji=ta("ZodEmoji",(e,t)=>{Fn.init(e,t),Ii.init(e,t)});const ki=ta("ZodNanoID",(e,t)=>{Bn.init(e,t),Ii.init(e,t)});const Li=ta("ZodCUID",(e,t)=>{zn.init(e,t),Ii.init(e,t)});const Mi=ta("ZodCUID2",(e,t)=>{Vn.init(e,t),Ii.init(e,t)});const Gi=ta("ZodULID",(e,t)=>{$n.init(e,t),Ii.init(e,t)});const xi=ta("ZodXID",(e,t)=>{Un.init(e,t),Ii.init(e,t)});const Fi=ta("ZodKSUID",(e,t)=>{Hn.init(e,t),Ii.init(e,t)});const Bi=ta("ZodIPv4",(e,t)=>{Yn.init(e,t),Ii.init(e,t)});const zi=ta("ZodIPv6",(e,t)=>{Xn.init(e,t),Ii.init(e,t)});const Vi=ta("ZodCIDRv4",(e,t)=>{Jn.init(e,t),Ii.init(e,t)});const $i=ta("ZodCIDRv6",(e,t)=>{Zn.init(e,t),Ii.init(e,t)});const Ui=ta("ZodBase64",(e,t)=>{tr.init(e,t),Ii.init(e,t)});const Hi=ta("ZodBase64URL",(e,t)=>{ar.init(e,t),Ii.init(e,t)});const Ki=ta("ZodE164",(e,t)=>{nr.init(e,t),Ii.init(e,t)});const qi=ta("ZodJWT",(e,t)=>{rr.init(e,t),Ii.init(e,t)});const Wi=ta("ZodNumber",(e,t)=>{ir.init(e,t),Ni.init(e,t),e.gt=(t,a)=>e.check(ni(t,a)),e.gte=(t,a)=>e.check(ri(t,a)),e.min=(t,a)=>e.check(ri(t,a)),e.lt=(t,a)=>e.check(ti(t,a)),e.lte=(t,a)=>e.check(ai(t,a)),e.max=(t,a)=>e.check(ai(t,a)),e.int=t=>e.check(Xi(t)),e.safe=t=>e.check(Xi(t)),e.positive=t=>e.check(ni(0,t)),e.nonnegative=t=>e.check(ri(0,t)),e.negative=t=>e.check(ti(0,t)),e.nonpositive=t=>e.check(ai(0,t)),e.multipleOf=(t,a)=>e.check(ii(t,a)),e.step=(t,a)=>e.check(ii(t,a)),e.finite=()=>e;const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function Qi(e){return function(e,t){return new e({type:"number",checks:[],...qa(t)})}(Wi,e)}const Yi=ta("ZodNumberFormat",(e,t)=>{or.init(e,t),Wi.init(e,t)});function Xi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...qa(t)})}(Yi,e)}const Ji=ta("ZodBoolean",(e,t)=>{sr.init(e,t),Ni.init(e,t)});function Zi(e){return function(e,t){return new e({type:"boolean",...qa(t)})}(Ji,e)}const eo=ta("ZodNull",(e,t)=>{pr.init(e,t),Ni.init(e,t)});function to(e){return function(e,t){return new e({type:"null",...qa(t)})}(eo,e)}const ao=ta("ZodUnknown",(e,t)=>{lr.init(e,t),Ni.init(e,t)});function no(){return function(e){return new e({type:"unknown"})}(ao)}const ro=ta("ZodNever",(e,t)=>{dr.init(e,t),Ni.init(e,t)});function io(e){return function(e,t){return new e({type:"never",...qa(t)})}(ro,e)}const oo=ta("ZodArray",(e,t)=>{cr.init(e,t),Ni.init(e,t),e.element=t.element,e.min=(t,a)=>e.check(si(t,a)),e.nonempty=t=>e.check(si(1,t)),e.max=(t,a)=>e.check(oi(t,a)),e.length=(t,a)=>e.check(pi(t,a)),e.unwrap=()=>e.element});function so(e,t){return function(e,t,a){return new e({type:"array",element:t,...qa(a)})}(oo,e,t)}const po=ta("ZodObject",(e,t)=>{_r.init(e,t),Ni.init(e,t),Ga(e,"shape",()=>t.shape),e.keyof=()=>go(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:no()}),e.loose=()=>e.clone({...e._zod.def,catchall:no()}),e.strict=()=>e.clone({...e._zod.def,catchall:io()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!$a(t))throw new Error("Invalid input to extend: expected a plain object");const a={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return xa(this,"shape",a),a},checks:[]};return Ka(e,a)}(e,t),e.merge=t=>{return n=t,Ka(a=e,{...a._zod.def,get shape(){const e={...a._zod.def.shape,...n._zod.def.shape};return xa(this,"shape",e),e},catchall:n._zod.def.catchall,checks:[]});var a,n},e.pick=t=>function(e,t){const a={},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(a[e]=n.shape[e])}return Ka(e,{...e._zod.def,shape:a,checks:[]})}(e,t),e.omit=t=>function(e,t){const a={...e._zod.def.shape},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return Ka(e,{...e._zod.def,shape:a,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,a){const n=t._zod.def.shape,r={...n};if(a)for(const t in a){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);a[t]&&(r[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)r[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Ka(t,{...t._zod.def,shape:r,checks:[]})}(Ao,e,t[0]),e.required=(...t)=>function(e,t,a){const n=t._zod.def.shape,r={...n};if(a)for(const t in a){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);a[t]&&(r[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)r[t]=new e({type:"nonoptional",innerType:n[t]});return Ka(t,{...t._zod.def,shape:r,checks:[]})}(Po,e,t[0])});function lo(e,t){const a={type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},...qa(t)};return new po(a)}function uo(e,t){return new po({type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},catchall:no(),...qa(t)})}const co=ta("ZodUnion",(e,t)=>{Er.init(e,t),Ni.init(e,t),e.options=t.options});function mo(e,t){return new co({type:"union",options:e,...qa(t)})}const fo=ta("ZodDiscriminatedUnion",(e,t)=>{co.init(e,t),yr.init(e,t)});function _o(e,t,a){return new fo({type:"union",options:t,discriminator:e,...qa(a)})}const ho=ta("ZodIntersection",(e,t)=>{Tr.init(e,t),Ni.init(e,t)});function Eo(e,t){return new ho({type:"intersection",left:e,right:t})}const yo=ta("ZodRecord",(e,t)=>{vr.init(e,t),Ni.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function To(e,t,a){return new yo({type:"record",keyType:e,valueType:t,...qa(a)})}const Ro=ta("ZodEnum",(e,t)=>{Or.init(e,t),Ni.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const r={};for(const n of e){if(!a.has(n))throw new Error(`Key ${n} not found in enum`);r[n]=t.entries[n]}return new Ro({...t,checks:[],...qa(n),entries:r})},e.exclude=(e,n)=>{const r={...t.entries};for(const t of e){if(!a.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Ro({...t,checks:[],...qa(n),entries:r})}});function go(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ro({type:"enum",entries:a,...qa(t)})}const vo=ta("ZodLiteral",(e,t)=>{Nr.init(e,t),Ni.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 Oo(e,t){return new vo({type:"literal",values:Array.isArray(e)?e:[e],...qa(t)})}const No=ta("ZodTransform",(e,t)=>{br.init(e,t),Ni.init(e,t),e._zod.parse=(a,n)=>{a.addIssue=n=>{if("string"==typeof n)a.issues.push(en(n,a.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=a.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),a.issues.push(en(t))}};const r=t.transform(a.value,a);return r instanceof Promise?r.then(e=>(a.value=e,a)):(a.value=r,a)}});function bo(e){return new No({type:"transform",transform:e})}const Ao=ta("ZodOptional",(e,t)=>{Ar.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function So(e){return new Ao({type:"optional",innerType:e})}const Io=ta("ZodNullable",(e,t)=>{Sr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wo(e){return new Io({type:"nullable",innerType:e})}const Co=ta("ZodDefault",(e,t)=>{Ir.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Do=ta("ZodPrefault",(e,t)=>{Cr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Po=ta("ZodNonOptional",(e,t)=>{Dr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});const jo=ta("ZodCatch",(e,t)=>{jr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const ko=ta("ZodPipe",(e,t)=>{kr.init(e,t),Ni.init(e,t),e.in=t.in,e.out=t.out});function Lo(e,t){return new ko({type:"pipe",in:e,out:t})}const Mo=ta("ZodReadonly",(e,t)=>{Mr.init(e,t),Ni.init(e,t)});const Go=ta("ZodCustom",(e,t)=>{xr.init(e,t),Ni.init(e,t)});function xo(e,t){return Lo(bo(e),t)}const Fo="2025-11-25",Bo=[Fo,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zo="io.modelcontextprotocol/related-task",Vo="2.0",$o=function(e,t,a){const n=qa(a);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}(Go,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),Uo);var Uo;const Ho=mo([Si(),Qi().int()]),Ko=Si(),qo=uo({ttl:mo([Qi(),to()]).optional(),pollInterval:Qi().optional()}),Wo=uo({taskId:Si()}),Qo=uo({progressToken:Ho.optional(),[zo]:Wo.optional()}),Yo=uo({task:qo.optional(),_meta:Qo.optional()}),Xo=lo({method:Si(),params:Yo.optional()}),Jo=uo({_meta:lo({[zo]:So(Wo)}).passthrough().optional()}),Zo=lo({method:Si(),params:Jo.optional()}),es=uo({_meta:uo({[zo]:Wo.optional()}).optional()}),ts=mo([Si(),Qi().int()]),as=lo({jsonrpc:Oo(Vo),id:ts,...Xo.shape}).strict(),ns=e=>as.safeParse(e).success,rs=lo({jsonrpc:Oo(Vo),...Zo.shape}).strict(),is=lo({jsonrpc:Oo(Vo),id:ts,result:es}).strict(),os=e=>is.safeParse(e).success;var ss;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"}(ss||(ss={}));const ps=lo({jsonrpc:Oo(Vo),id:ts,error:lo({code:Qi().int(),message:Si(),data:So(no())})}).strict(),ls=mo([as,rs,is,ps]),ds=es.strict(),us=Jo.extend({requestId:ts,reason:Si().optional()}),cs=Zo.extend({method:Oo("notifications/cancelled"),params:us}),ms=lo({src:Si(),mimeType:Si().optional(),sizes:so(Si()).optional()}),fs=lo({icons:so(ms).optional()}),_s=lo({name:Si(),title:Si().optional()}),hs=_s.extend({..._s.shape,...fs.shape,version:Si(),websiteUrl:Si().optional()}),Es=Eo(lo({applyDefaults:Zi().optional()}),To(Si(),no())),ys=xo(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,Eo(lo({form:Es.optional(),url:$o.optional()}),To(Si(),no()).optional())),Ts=lo({list:So(lo({}).passthrough()),cancel:So(lo({}).passthrough()),requests:So(lo({sampling:So(lo({createMessage:So(lo({}).passthrough())}).passthrough()),elicitation:So(lo({create:So(lo({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Rs=lo({list:So(lo({}).passthrough()),cancel:So(lo({}).passthrough()),requests:So(lo({tools:So(lo({call:So(lo({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),gs=lo({experimental:To(Si(),$o).optional(),sampling:lo({context:$o.optional(),tools:$o.optional()}).optional(),elicitation:ys.optional(),roots:lo({listChanged:Zi().optional()}).optional(),tasks:So(Ts)}),vs=Yo.extend({protocolVersion:Si(),capabilities:gs,clientInfo:hs}),Os=Xo.extend({method:Oo("initialize"),params:vs}),Ns=lo({experimental:To(Si(),$o).optional(),logging:$o.optional(),completions:$o.optional(),prompts:So(lo({listChanged:So(Zi())})),resources:lo({subscribe:Zi().optional(),listChanged:Zi().optional()}).optional(),tools:lo({listChanged:Zi().optional()}).optional(),tasks:So(Rs)}).passthrough(),bs=es.extend({protocolVersion:Si(),capabilities:Ns,serverInfo:hs,instructions:Si().optional()}),As=Zo.extend({method:Oo("notifications/initialized")}),Ss=Xo.extend({method:Oo("ping")}),Is=lo({progress:Qi(),total:So(Qi()),message:So(Si())}),ws=lo({...Jo.shape,...Is.shape,progressToken:Ho}),Cs=Zo.extend({method:Oo("notifications/progress"),params:ws}),Ds=Yo.extend({cursor:Ko.optional()}),Ps=Xo.extend({params:Ds.optional()}),js=es.extend({nextCursor:So(Ko)}),ks=lo({taskId:Si(),status:go(["working","input_required","completed","failed","cancelled"]),ttl:mo([Qi(),to()]),createdAt:Si(),lastUpdatedAt:Si(),pollInterval:So(Qi()),statusMessage:So(Si())}),Ls=es.extend({task:ks}),Ms=Jo.merge(ks),Gs=Zo.extend({method:Oo("notifications/tasks/status"),params:Ms}),xs=Xo.extend({method:Oo("tasks/get"),params:Yo.extend({taskId:Si()})}),Fs=es.merge(ks),Bs=Xo.extend({method:Oo("tasks/result"),params:Yo.extend({taskId:Si()})}),zs=Ps.extend({method:Oo("tasks/list")}),Vs=js.extend({tasks:so(ks)}),$s=Xo.extend({method:Oo("tasks/cancel"),params:Yo.extend({taskId:Si()})}),Us=es.merge(ks),Hs=lo({uri:Si(),mimeType:So(Si()),_meta:To(Si(),no()).optional()}),Ks=Hs.extend({text:Si()}),qs=Si().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),Ws=Hs.extend({blob:qs}),Qs=lo({audience:so(go(["user","assistant"])).optional(),priority:Qi().min(0).max(1).optional(),lastModified:ui({offset:!0}).optional()}),Ys=lo({..._s.shape,...fs.shape,uri:Si(),description:So(Si()),mimeType:So(Si()),annotations:Qs.optional(),_meta:So(uo({}))}),Xs=lo({..._s.shape,...fs.shape,uriTemplate:Si(),description:So(Si()),mimeType:So(Si()),annotations:Qs.optional(),_meta:So(uo({}))}),Js=Ps.extend({method:Oo("resources/list")}),Zs=js.extend({resources:so(Ys)}),ep=Ps.extend({method:Oo("resources/templates/list")}),tp=js.extend({resourceTemplates:so(Xs)}),ap=Yo.extend({uri:Si()}),np=ap,rp=Xo.extend({method:Oo("resources/read"),params:np}),ip=es.extend({contents:so(mo([Ks,Ws]))}),op=Zo.extend({method:Oo("notifications/resources/list_changed")}),sp=ap,pp=Xo.extend({method:Oo("resources/subscribe"),params:sp}),lp=ap,dp=Xo.extend({method:Oo("resources/unsubscribe"),params:lp}),up=Jo.extend({uri:Si()}),cp=Zo.extend({method:Oo("notifications/resources/updated"),params:up}),mp=lo({name:Si(),description:So(Si()),required:So(Zi())}),fp=lo({..._s.shape,...fs.shape,description:So(Si()),arguments:So(so(mp)),_meta:So(uo({}))}),_p=Ps.extend({method:Oo("prompts/list")}),hp=js.extend({prompts:so(fp)}),Ep=Yo.extend({name:Si(),arguments:To(Si(),Si()).optional()}),yp=Xo.extend({method:Oo("prompts/get"),params:Ep}),Tp=lo({type:Oo("text"),text:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),Rp=lo({type:Oo("image"),data:qs,mimeType:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),gp=lo({type:Oo("audio"),data:qs,mimeType:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),vp=lo({type:Oo("tool_use"),name:Si(),id:Si(),input:lo({}).passthrough(),_meta:So(lo({}).passthrough())}).passthrough(),Op=lo({type:Oo("resource"),resource:mo([Ks,Ws]),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),Np=mo([Tp,Rp,gp,Ys.extend({type:Oo("resource_link")}),Op]),bp=lo({role:go(["user","assistant"]),content:Np}),Ap=es.extend({description:So(Si()),messages:so(bp)}),Sp=Zo.extend({method:Oo("notifications/prompts/list_changed")}),Ip=lo({title:Si().optional(),readOnlyHint:Zi().optional(),destructiveHint:Zi().optional(),idempotentHint:Zi().optional(),openWorldHint:Zi().optional()}),wp=lo({taskSupport:go(["required","optional","forbidden"]).optional()}),Cp=lo({..._s.shape,...fs.shape,description:Si().optional(),inputSchema:lo({type:Oo("object"),properties:To(Si(),$o).optional(),required:so(Si()).optional()}).catchall(no()),outputSchema:lo({type:Oo("object"),properties:To(Si(),$o).optional(),required:so(Si()).optional()}).catchall(no()).optional(),annotations:So(Ip),execution:So(wp),_meta:To(Si(),no()).optional()}),Dp=Ps.extend({method:Oo("tools/list")}),Pp=js.extend({tools:so(Cp)}),jp=es.extend({content:so(Np).default([]),structuredContent:To(Si(),no()).optional(),isError:So(Zi())}),kp=(jp.or(es.extend({toolResult:no()})),Yo.extend({name:Si(),arguments:So(To(Si(),no()))})),Lp=Xo.extend({method:Oo("tools/call"),params:kp}),Mp=Zo.extend({method:Oo("notifications/tools/list_changed")}),Gp=go(["debug","info","notice","warning","error","critical","alert","emergency"]),xp=Yo.extend({level:Gp}),Fp=Xo.extend({method:Oo("logging/setLevel"),params:xp}),Bp=Jo.extend({level:Gp,logger:Si().optional(),data:no()}),zp=Zo.extend({method:Oo("notifications/message"),params:Bp}),Vp=lo({name:Si().optional()}),$p=lo({hints:So(so(Vp)),costPriority:So(Qi().min(0).max(1)),speedPriority:So(Qi().min(0).max(1)),intelligencePriority:So(Qi().min(0).max(1))}),Up=lo({mode:So(go(["auto","required","none"]))}),Hp=lo({type:Oo("tool_result"),toolUseId:Si().describe("The unique identifier for the corresponding tool call."),content:so(Np).default([]),structuredContent:lo({}).passthrough().optional(),isError:So(Zi()),_meta:So(lo({}).passthrough())}).passthrough(),Kp=_o("type",[Tp,Rp,gp]),qp=_o("type",[Tp,Rp,gp,vp,Hp]),Wp=lo({role:go(["user","assistant"]),content:mo([qp,so(qp)]),_meta:So(lo({}).passthrough())}).passthrough(),Qp=Yo.extend({messages:so(Wp),modelPreferences:$p.optional(),systemPrompt:Si().optional(),includeContext:go(["none","thisServer","allServers"]).optional(),temperature:Qi().optional(),maxTokens:Qi().int(),stopSequences:so(Si()).optional(),metadata:$o.optional(),tools:So(so(Cp)),toolChoice:So(Up)}),Yp=Xo.extend({method:Oo("sampling/createMessage"),params:Qp}),Xp=es.extend({model:Si(),stopReason:So(go(["endTurn","stopSequence","maxTokens"]).or(Si())),role:go(["user","assistant"]),content:Kp}),Jp=es.extend({model:Si(),stopReason:So(go(["endTurn","stopSequence","maxTokens","toolUse"]).or(Si())),role:go(["user","assistant"]),content:mo([qp,so(qp)])}),Zp=lo({type:Oo("boolean"),title:Si().optional(),description:Si().optional(),default:Zi().optional()}),el=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),minLength:Qi().optional(),maxLength:Qi().optional(),format:go(["email","uri","date","date-time"]).optional(),default:Si().optional()}),tl=lo({type:go(["number","integer"]),title:Si().optional(),description:Si().optional(),minimum:Qi().optional(),maximum:Qi().optional(),default:Qi().optional()}),al=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),enum:so(Si()),default:Si().optional()}),nl=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),oneOf:so(lo({const:Si(),title:Si()})),default:Si().optional()}),rl=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),enum:so(Si()),enumNames:so(Si()).optional(),default:Si().optional()}),il=mo([al,nl]),ol=mo([lo({type:Oo("array"),title:Si().optional(),description:Si().optional(),minItems:Qi().optional(),maxItems:Qi().optional(),items:lo({type:Oo("string"),enum:so(Si())}),default:so(Si()).optional()}),lo({type:Oo("array"),title:Si().optional(),description:Si().optional(),minItems:Qi().optional(),maxItems:Qi().optional(),items:lo({anyOf:so(lo({const:Si(),title:Si()}))}),default:so(Si()).optional()})]),sl=mo([rl,il,ol]),pl=mo([sl,Zp,el,tl]),ll=mo([Yo.extend({mode:Oo("form").optional(),message:Si(),requestedSchema:lo({type:Oo("object"),properties:To(Si(),pl),required:so(Si()).optional()})}),Yo.extend({mode:Oo("url"),message:Si(),elicitationId:Si(),url:Si().url()})]),dl=Xo.extend({method:Oo("elicitation/create"),params:ll}),ul=Jo.extend({elicitationId:Si()}),cl=Zo.extend({method:Oo("notifications/elicitation/complete"),params:ul}),ml=es.extend({action:go(["accept","decline","cancel"]),content:xo(e=>null===e?void 0:e,To(Si(),mo([Si(),Qi(),Zi(),so(Si())])).optional())}),fl=lo({type:Oo("ref/resource"),uri:Si()}),_l=lo({type:Oo("ref/prompt"),name:Si()}),hl=Yo.extend({ref:mo([_l,fl]),argument:lo({name:Si(),value:Si()}),context:lo({arguments:To(Si(),Si()).optional()}).optional()}),El=Xo.extend({method:Oo("completion/complete"),params:hl});const yl=es.extend({completion:uo({values:so(Si()).max(100),total:So(Qi().int()),hasMore:So(Zi())})}),Tl=lo({uri:Si().startsWith("file://"),name:Si().optional(),_meta:To(Si(),no()).optional()}),Rl=Xo.extend({method:Oo("roots/list")}),gl=es.extend({roots:so(Tl)}),vl=Zo.extend({method:Oo("notifications/roots/list_changed")});mo([Ss,Os,El,Fp,yp,_p,Js,ep,rp,pp,dp,Lp,Dp,xs,Bs,zs]),mo([cs,Cs,As,vl,Gs]),mo([ds,Xp,Jp,ml,gl,Fs,Vs,Ls]),mo([Ss,Yp,dl,Rl,xs,Bs,zs]),mo([cs,Cs,zp,cp,op,Mp,Sp,Gs,cl]),mo([ds,bs,yl,Ap,hp,Zs,tp,ip,jp,Pp,Fs,Vs,Ls]);class Ol extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}static fromError(e,t,a){if(e===ss.UrlElicitationRequired&&a){const e=a;if(e.elicitations)return new Nl(e.elicitations,t)}return new Ol(e,t,a)}}class Nl extends Ol{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ss.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){var e,t;return null!==(t=null===(e=this.data)||void 0===e?void 0:e.elicitations)&&void 0!==t?t:[]}}function bl(e){return"completed"===e||"failed"===e||"cancelled"===e}class Al{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Zr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var a;const n=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){i.count++;return t.schemaPath.includes(e)&&(i.cycle=t.path),i.schema}const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const a={...t,schemaPath:[...t.schemaPath,e],path:t.path},i=e._zod.parent;if(i)o.ref=i,this.process(i,a),this.seen.get(i).isParent=!0;else{const t=o.schema;switch(n.type){case"string":{const a=t;a.type="string";const{minimum:n,maximum:i,format:s,patterns:p,contentEncoding:l}=e._zod.bag;if("number"==typeof n&&(a.minLength=n),"number"==typeof i&&(a.maxLength=i),s&&(a.format=r[s]??s,""===a.format&&delete a.format),l&&(a.contentEncoding=l),p&&p.size>0){const e=[...p];1===e.length?a.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{const a=t,{minimum:n,maximum:r,format:i,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:p}=e._zod.bag;"string"==typeof i&&i.includes("int")?a.type="integer":a.type="number","number"==typeof p&&(a.exclusiveMinimum=p),"number"==typeof n&&(a.minimum=n,"number"==typeof p&&(p>=n?delete a.minimum:delete a.exclusiveMinimum)),"number"==typeof s&&(a.exclusiveMaximum=s),"number"==typeof r&&(a.maximum=r,"number"==typeof s&&(s<=r?delete a.maximum:delete a.exclusiveMaximum)),"number"==typeof o&&(a.multipleOf=o);break}case"boolean":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema");break;case"null":t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw new Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw new Error("Date cannot be represented in JSON Schema");break;case"array":{const r=t,{minimum:i,maximum:o}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=this.process(n.element,{...a,path:[...a.path,"items"]});break}case"object":{const e=t;e.type="object",e.properties={};const r=n.shape;for(const t in r)e.properties[t]=this.process(r[t],{...a,path:[...a.path,"properties",t]});const i=new Set(Object.keys(r)),o=new Set([...i].filter(e=>{const t=n.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));o.size>0&&(e.required=Array.from(o)),"never"===n.catchall?._zod.def.type?e.additionalProperties=!1:n.catchall?n.catchall&&(e.additionalProperties=this.process(n.catchall,{...a,path:[...a.path,"additionalProperties"]})):"output"===this.io&&(e.additionalProperties=!1);break}case"union":t.anyOf=n.options.map((e,t)=>this.process(e,{...a,path:[...a.path,"anyOf",t]}));break;case"intersection":{const e=t,r=this.process(n.left,{...a,path:[...a.path,"allOf",0]}),i=this.process(n.right,{...a,path:[...a.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,s=[...o(r)?r.allOf:[r],...o(i)?i.allOf:[i]];e.allOf=s;break}case"tuple":{const r=t;r.type="array";const i=n.items.map((e,t)=>this.process(e,{...a,path:[...a.path,"prefixItems",t]}));if("draft-2020-12"===this.target?r.prefixItems=i:r.items=i,n.rest){const e=this.process(n.rest,{...a,path:[...a.path,"items"]});"draft-2020-12"===this.target?r.items=e:r.additionalItems=e}n.rest&&(r.items=this.process(n.rest,{...a,path:[...a.path,"items"]}));const{minimum:o,maximum:s}=e._zod.bag;"number"==typeof o&&(r.minItems=o),"number"==typeof s&&(r.maxItems=s);break}case"record":{const e=t;e.type="object",e.propertyNames=this.process(n.keyType,{...a,path:[...a.path,"propertyNames"]}),e.additionalProperties=this.process(n.valueType,{...a,path:[...a.path,"additionalProperties"]});break}case"map":if("throw"===this.unrepresentable)throw new Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw new Error("Set cannot be represented in JSON Schema");break;case"enum":{const e=t,a=Pa(n.entries);a.every(e=>"number"==typeof e)&&(e.type="number"),a.every(e=>"string"==typeof e)&&(e.type="string"),e.enum=a;break}case"literal":{const e=t,a=[];for(const e of n.values)if(void 0===e){if("throw"===this.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===this.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(e))}else a.push(e);if(0===a.length);else if(1===a.length){const t=a[0];e.type=null===t?"null":typeof t,e.const=t}else a.every(e=>"number"==typeof e)&&(e.type="number"),a.every(e=>"string"==typeof e)&&(e.type="string"),a.every(e=>"boolean"==typeof e)&&(e.type="string"),a.every(e=>null===e)&&(e.type="null"),e.enum=a;break}case"file":{const a=t,n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:r,maximum:i,mime:o}=e._zod.bag;void 0!==r&&(n.minLength=r),void 0!==i&&(n.maxLength=i),o?1===o.length?(n.contentMediaType=o[0],Object.assign(a,n)):a.anyOf=o.map(e=>({...n,contentMediaType:e})):Object.assign(a,n);break}case"transform":if("throw"===this.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{const e=this.process(n.innerType,a);t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(n.innerType,a),o.ref=n.innerType;break;case"success":t.type="boolean";break;case"default":this.process(n.innerType,a),o.ref=n.innerType,t.default=JSON.parse(JSON.stringify(n.defaultValue));break;case"prefault":this.process(n.innerType,a),o.ref=n.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(n.defaultValue)));break;case"catch":{let e;this.process(n.innerType,a),o.ref=n.innerType;try{e=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{const a=t,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");a.type="string",a.pattern=n.source;break}case"pipe":{const e="input"===this.io?"transform"===n.in._zod.def.type?n.out:n.in:n.out;this.process(e,a),o.ref=e;break}case"readonly":this.process(n.innerType,a),o.ref=n.innerType,t.readOnly=!0;break;case"lazy":{const t=e._zod.innerType;this.process(t,a),o.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")}}}const p=this.metadataRegistry.get(e);p&&Object.assign(o.schema,p),"input"===this.io&&Sl(e)&&(delete o.schema.examples,delete o.schema.default),"input"===this.io&&o.schema._prefault&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault;return this.seen.get(e).schema}emit(e,t){const a={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},n=this.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=e=>{const t="draft-2020-12"===this.target?"$defs":"definitions";if(a.external){const n=a.external.registry.get(e[0])?.id,r=a.external.uri??(e=>e);if(n)return{ref:r(n)};const i=e[1].defId??e[1].schema.id??"schema"+this.counter++;return e[1].defId=i,{defId:i,ref:`${r("__shared")}#/${t}/${i}`}}if(e[1]===n)return{ref:"#"};const r=`#/${t}/`,i=e[1].schema.id??"__schema"+this.counter++;return{defId:i,ref:r+i}},i=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:a,defId:n}=r(e);t.def={...t.schema},n&&(t.defId=n);const i=t.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===a.cycles)for(const e of this.seen.entries()){const t=e[1];if(t.cycle)throw new Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const t of this.seen.entries()){const n=t[1];if(e===t[0]){i(t);continue}if(a.external){const n=a.external.registry.get(t[0])?.id;if(e!==t[0]&&n){i(t);continue}}const r=this.metadataRegistry.get(t[0])?.id;r?i(t):(n.cycle||n.count>1&&"ref"===a.reused)&&i(t)}const o=(e,t)=>{const a=this.seen.get(e),n=a.def??a.schema,r={...n};if(null===a.ref)return;const i=a.ref;if(a.ref=null,i){o(i,t);const e=this.seen.get(i).schema;e.$ref&&"draft-7"===t.target?(n.allOf=n.allOf??[],n.allOf.push(e)):(Object.assign(n,e),Object.assign(n,r))}a.isParent||this.override({zodSchema:e,jsonSchema:n,path:a.path??[]})};for(const e of[...this.seen.entries()].reverse())o(e[0],{target:this.target});const s={};if("draft-2020-12"===this.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?s.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),a.external?.uri){const t=a.external.registry.get(e)?.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=a.external.uri(t)}Object.assign(s,n.def);const p=a.external?.defs??{};for(const e of this.seen.entries()){const t=e[1];t.def&&t.defId&&(p[t.defId]=t.def)}a.external||Object.keys(p).length>0&&("draft-2020-12"===this.target?s.$defs=p:s.definitions=p);try{return JSON.parse(JSON.stringify(s))}catch(e){throw new Error("Error converting schema to JSON.")}}}function Sl(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const n=e._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return Sl(n.element,a);case"object":for(const e in n.shape)if(Sl(n.shape[e],a))return!0;return!1;case"union":for(const e of n.options)if(Sl(e,a))return!0;return!1;case"intersection":return Sl(n.left,a)||Sl(n.right,a);case"tuple":for(const e of n.items)if(Sl(e,a))return!0;return!(!n.rest||!Sl(n.rest,a));case"record":case"map":return Sl(n.keyType,a)||Sl(n.valueType,a);case"set":return Sl(n.valueType,a);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return Sl(n.innerType,a);case"lazy":return Sl(n.getter(),a);case"transform":return!0;case"pipe":return Sl(n.in,a)||Sl(n.out,a)}throw new Error(`Unknown schema type: ${n.type}`)}const Il=Symbol("Let zodToJsonSchema decide on which parser to use"),wl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Cl=e=>{const t=(e=>"string"==typeof e?{...wl,name:e}:{...wl,...e})(e),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Dl=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function Pl(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Dl(t,e.currentPath):t.join("/")}}function jl(e,t,a,n){n?.errorMessages&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function kl(e,t,a,n,r){e[t]=a,jl(e,t,n,r)}function Ll(e,t){return pd(e.type._def,t)}function Ml(e,t,a){const n=a??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,n)=>Ml(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Gl(e,t)}}const Gl=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const n of e.checks)switch(n.kind){case"min":kl(a,"minimum",n.value,n.message,t);break;case"max":kl(a,"maximum",n.value,n.message,t)}return a};let xl;const Fl=/^[cC][^\s-]{8,}$/,Bl=/^[0-9a-z]+$/,zl=/^[0-9A-HJKMNP-TV-Z]{26}$/,Vl=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,$l=()=>(void 0===xl&&(xl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xl),Ul=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Hl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ql=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wl=/^[a-zA-Z0-9_-]{21}$/,Ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function Yl(e,t){const a={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":kl(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t);break;case"max":kl(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Zl(a,"email",n.message,t);break;case"format:idn-email":Zl(a,"idn-email",n.message,t);break;case"pattern:zod":ed(a,Vl,n.message,t)}break;case"url":Zl(a,"uri",n.message,t);break;case"uuid":Zl(a,"uuid",n.message,t);break;case"regex":ed(a,n.regex,n.message,t);break;case"cuid":ed(a,Fl,n.message,t);break;case"cuid2":ed(a,Bl,n.message,t);break;case"startsWith":ed(a,RegExp(`^${Xl(n.value,t)}`),n.message,t);break;case"endsWith":ed(a,RegExp(`${Xl(n.value,t)}$`),n.message,t);break;case"datetime":Zl(a,"date-time",n.message,t);break;case"date":Zl(a,"date",n.message,t);break;case"time":Zl(a,"time",n.message,t);break;case"duration":Zl(a,"duration",n.message,t);break;case"length":kl(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t),kl(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"includes":ed(a,RegExp(Xl(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&Zl(a,"ipv4",n.message,t),"v4"!==n.version&&Zl(a,"ipv6",n.message,t);break;case"base64url":ed(a,ql,n.message,t);break;case"jwt":ed(a,Ql,n.message,t);break;case"cidr":"v6"!==n.version&&ed(a,Ul,n.message,t),"v4"!==n.version&&ed(a,Hl,n.message,t);break;case"emoji":ed(a,$l(),n.message,t);break;case"ulid":ed(a,zl,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Zl(a,"binary",n.message,t);break;case"contentEncoding:base64":kl(a,"contentEncoding","base64",n.message,t);break;case"pattern:zod":ed(a,Kl,n.message,t)}break;case"nanoid":ed(a,Wl,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:(()=>{})()}return a}function Xl(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)Jl.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}const Jl=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Zl(e,t,a,n){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):kl(e,"format",t,a,n)}function ed(e,t,a,n){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:td(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):kl(e,"pattern",td(t,n),a,n)}function td(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),n=e.flags.includes("m"),r=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",s=!1,p=!1,l=!1;for(let e=0;e<i.length;e++)if(s)o+=i[e],s=!1;else{if(a)if(p){if(i[e].match(/[a-z]/)){l?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),l=!1):"-"===i[e+1]&&i[e+2]?.match(/[a-z]/)?(o+=i[e],l=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(n){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}r&&"."===i[e]?o+=p?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?s=!0:p&&"]"===i[e]?p=!1:p||"["!==i[e]||(p=!0))}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ad(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===Qt.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,n)=>({...a,[n]:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Pl(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const a={type:"object",additionalProperties:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return a;if(e.keyType?._def.typeName===Qt.ZodString&&e.keyType._def.checks?.length){const{type:n,...r}=Yl(e.keyType._def,t);return{...a,propertyNames:r}}if(e.keyType?._def.typeName===Qt.ZodEnum)return{...a,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===Qt.ZodBranded&&e.keyType._def.type._def.typeName===Qt.ZodString&&e.keyType._def.type._def.checks?.length){const{type:n,...r}=Ll(e.keyType._def,t);return{...a,propertyNames:r}}return a}const nd={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const rd=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function id(e,t){const a="openAi"===t.target,n={type:"object",properties:{}},r=[],i=e.shape();for(const e in i){let o=i[e];if(void 0===o||void 0===o._def)continue;let s=od(o);s&&a&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);const p=pd(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==p&&(n.properties[e]=p,s||r.push(e))}r.length&&(n.required=r);const o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return pd(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(n.additionalProperties=o),n}function od(e){try{return e.isOptional()}catch{return!0}}const sd=(e,t,a)=>{switch(t){case Qt.ZodString:return Yl(e,a);case Qt.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"int":a.type="integer",jl(a,"type",n.message,t);break;case"min":"jsonSchema7"===t.target?n.inclusive?kl(a,"minimum",n.value,n.message,t):kl(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),kl(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?kl(a,"maximum",n.value,n.message,t):kl(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),kl(a,"maximum",n.value,n.message,t));break;case"multipleOf":kl(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Qt.ZodObject:return id(e,a);case Qt.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"min":"jsonSchema7"===t.target?n.inclusive?kl(a,"minimum",n.value,n.message,t):kl(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),kl(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?kl(a,"maximum",n.value,n.message,t):kl(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),kl(a,"maximum",n.value,n.message,t));break;case"multipleOf":kl(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Qt.ZodBoolean:return{type:"boolean"};case Qt.ZodDate:return Ml(e,a);case Qt.ZodUndefined:return function(e){return{not:Pl(e)}}(a);case Qt.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Qt.ZodArray:return function(e,t){const a={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Qt.ZodAny&&(a.items=pd(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&kl(a,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&kl(a,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(kl(a,"minItems",e.exactLength.value,e.exactLength.message,t),kl(a,"maxItems",e.exactLength.value,e.exactLength.message,t)),a}(e,a);case Qt.ZodUnion:case Qt.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return rd(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in nd&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=nd[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return rd(e,t)}(e,a);case Qt.ZodIntersection:return function(e,t){const a=[pd(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),pd(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let n="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...n}=e;t=n}else n=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(n=void 0);var t}),r.length?{allOf:r,...n}:void 0}(e,a);case Qt.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:pd(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Qt.ZodRecord:return ad(e,a);case Qt.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case Qt.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Qt.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(a.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:a}}(e);case Qt.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:nd[e.innerType._def.typeName],nullable:!0}:{type:[nd[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Qt.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return pd(e.innerType._def,t);const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Pl(t)},a]}:Pl(t)})(e,a);case Qt.ZodMap:return function(e,t){return"record"===t.mapStrategy?ad(e,t):{type:"array",maxItems:125,items:{type:"array",items:[pd(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Pl(t),pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Pl(t)],minItems:2,maxItems:2}}}(e,a);case Qt.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&kl(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&kl(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Qt.ZodLazy:return()=>e.getter()._def;case Qt.ZodPromise:return function(e,t){return pd(e.type._def,t)}(e,a);case Qt.ZodNaN:case Qt.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Pl({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Qt.ZodEffects:return function(e,t){return"input"===t.effectStrategy?pd(e.schema._def,t):Pl(t)}(e,a);case Qt.ZodAny:return Pl(a);case Qt.ZodUnknown:return function(e){return Pl(e)}(a);case Qt.ZodDefault:return function(e,t){return{...pd(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Qt.ZodBranded:return Ll(e,a);case Qt.ZodReadonly:case Qt.ZodCatch:return((e,t)=>pd(e.innerType._def,t))(e,a);case Qt.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return pd(e.in._def,t);if("output"===t.pipeStrategy)return pd(e.out._def,t);const a=pd(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,pd(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Qt.ZodFunction:case Qt.ZodVoid:case Qt.ZodSymbol:default:return}};function pd(e,t,a=!1){const n=t.seen.get(e);if(t.override){const r=t.override?.(e,t,n,a);if(r!==Il)return r}if(n&&!a){const e=ld(n,t);if(void 0!==e)return e}const r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);const i=sd(e,e.typeName,t),o="function"==typeof i?pd(i(),t):i;if(o&&dd(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return r.jsonSchema=o,a}return r.jsonSchema=o,o}const ld=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Dl(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Pl(t)):"seen"===t.$refStrategy?Pl(t):void 0}},dd=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a);function ud(e,t){var a,n,r,i;return $r(e)?function(e,t){if(e instanceof Xr){const a=new Al(t),n={};for(const t of e._idmap.entries()){const[e,n]=t;a.process(n)}const r={},i={registry:e,uri:t?.uri,defs:n};for(const n of e._idmap.entries()){const[e,o]=n;r[e]=a.emit(o,{...t,external:i})}if(Object.keys(n).length>0){const e="draft-2020-12"===a.target?"$defs":"definitions";r.__shared={[e]:n}}return{schemas:r}}const a=new Al(t);return a.process(e),a.emit(e,t)}(e,{target:(i=null==t?void 0:t.target,i?"jsonSchema7"===i||"draft-7"===i?"draft-7":"jsonSchema2019-09"===i||"draft-2020-12"===i?"draft-2020-12":"draft-7":"draft-7"),io:null!==(a=null==t?void 0:t.pipeStrategy)&&void 0!==a?a:"input"}):((e,t)=>{const a=Cl(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>({...e,[t]:pd(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0)??Pl(a)}),{}):void 0;const r="string"==typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,i=pd(e._def,void 0===r?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??Pl(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),a.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[a.openAiAnyTypeName]||(n[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const s=void 0===r?n?{...i,[a.definitionPath]:n}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...n,[r]:i}};return"jsonSchema7"===a.target?s.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(s.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s})(e,{strictUnions:null===(n=null==t?void 0:t.strictUnions)||void 0===n||n,pipeStrategy:null!==(r=null==t?void 0:t.pipeStrategy)&&void 0!==r?r:"input"})}function cd(e){const t=qr(e),a=null==t?void 0:t.method;if(!a)throw new Error("Schema is missing a method literal");const n=Yr(a);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function md(e,t){const a=Hr(e,t);if(!a.success)throw a.error;return a.data}class fd{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(cs,e=>{this._oncancel(e)}),this.setNotificationHandler(Cs,e=>{this._onprogress(e)}),this.setRequestHandler(Ss,e=>({})),this._taskStore=null==e?void 0:e.taskStore,this._taskMessageQueue=null==e?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(xs,async(e,t)=>{const a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new Ol(ss.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(Bs,async(e,t)=>{const a=async()=>{var n;const r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,a=t.id,n=this._requestResolvers.get(a);if(n)if(this._requestResolvers.delete(a),"response"===e.type)n(t);else{const e=t;n(new Ol(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${a}`))}continue}await(null===(n=this._transport)||void 0===n?void 0:n.send(e.message,{relatedRequestId:t.requestId}))}}const i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Ol(ss.InvalidParams,`Task not found: ${r}`);if(!bl(i.status))return await this._waitForTaskUpdate(r,t.signal),await a();if(bl(i.status)){const e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[zo]:{taskId:r}}}}return await a()};return await a()}),this.setRequestHandler(zs,async(e,t)=>{var a;try{const{tasks:n,nextCursor:r}=await this._taskStore.listTasks(null===(a=e.params)||void 0===a?void 0:a.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Ol(ss.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler($s,async(e,t)=>{try{const a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new Ol(ss.InvalidParams,`Task not found: ${e.params.taskId}`);if(bl(a.status))throw new Ol(ss.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Ol(ss.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(e){if(e instanceof Ol)throw e;throw new Ol(ss.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}_setupTimeout(e,t,a,n,r=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:r,onTimeout:n})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Ol.fromError(ss.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,a,n;this._transport=e;const r=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==r||r(),this._onclose()};const i=null===(a=this.transport)||void 0===a?void 0:a.onerror;this._transport.onerror=e=>{null==i||i(e),this._onerror(e)};const o=null===(n=this._transport)||void 0===n?void 0:n.onmessage;this._transport.onmessage=(e,t)=>{var a;null==o||o(e,t),os(e)||(a=e,ps.safeParse(a).success)?this._onresponse(e):ns(e)?this._onrequest(e,t):(e=>rs.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const a=Ol.fromError(ss.ConnectionClosed,"Connection closed");this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);for(const e of t.values())e(a)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const a=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==a&&Promise.resolve().then(()=>a(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var a,n,r,i,o,s;const p=null!==(a=this._requestHandlers.get(e.method))&&void 0!==a?a:this.fallbackRequestHandler,l=this._transport,d=null===(i=null===(r=null===(n=e.params)||void 0===n?void 0:n._meta)||void 0===r?void 0:r[zo])||void 0===i?void 0:i.taskId;if(void 0===p){const t={jsonrpc:"2.0",id:e.id,error:{code:ss.MethodNotFound,message:"Method not found"}};return void(d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:t,timestamp:Date.now()},null==l?void 0:l.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):null==l||l.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const u=new AbortController;this._requestHandlerAbortControllers.set(e.id,u);const c=null===(o=e.params)||void 0===o?void 0:o.task,m=this._taskStore?this.requestTaskStore(e,null==l?void 0:l.sessionId):void 0,f={signal:u.signal,sessionId:null==l?void 0:l.sessionId,_meta:null===(s=e.params)||void 0===s?void 0:s._meta,sendNotification:async t=>{const a={relatedRequestId:e.id};d&&(a.relatedTask={taskId:d}),await this.notification(t,a)},sendRequest:async(t,a,n)=>{var r,i;const o={...n,relatedRequestId:e.id};d&&!o.relatedTask&&(o.relatedTask={taskId:d});const s=null!==(i=null===(r=o.relatedTask)||void 0===r?void 0:r.taskId)&&void 0!==i?i:d;return s&&m&&await m.updateTaskStatus(s,"input_required"),await this.request(t,a,o)},authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:null==c?void 0:c.ttl,closeSSEStream:null==t?void 0:t.closeSSEStream,closeStandaloneSSEStream:null==t?void 0:t.closeStandaloneSSEStream};Promise.resolve().then(()=>{c&&this.assertTaskHandlerCapability(e.method)}).then(()=>p(e,f)).then(async t=>{if(u.signal.aborted)return;const a={result:t,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:a,timestamp:Date.now()},null==l?void 0:l.sessionId):await(null==l?void 0:l.send(a))},async t=>{var a;if(u.signal.aborted)return;const n={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:ss.InternalError,message:null!==(a=t.message)&&void 0!==a?a:"Internal error",...void 0!==t.data&&{data:t.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:n,timestamp:Date.now()},null==l?void 0:l.sessionId):await(null==l?void 0:l.send(n))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...a}=e.params,n=Number(t),r=this._progressHandlers.get(n);if(!r)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const i=this._responseHandlers.get(n),o=this._timeoutInfo.get(n);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(e){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void i(e)}r(a)}_onresponse(e){const t=Number(e.id),a=this._requestResolvers.get(t);if(a){if(this._requestResolvers.delete(t),os(e))a(e);else{a(new Ol(e.error.code,e.error.message,e.error.data))}return}const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let r=!1;if(os(e)&&e.result&&"object"==typeof e.result){const a=e.result;if(a.task&&"object"==typeof a.task){const e=a.task;"string"==typeof e.taskId&&(r=!0,this._taskProgressTokens.set(e.taskId,t))}}if(r||this._progressHandlers.delete(t),os(e))n(e);else{n(Ol.fromError(e.error.code,e.error.message,e.error.data))}}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}async*requestStream(e,t,a){var n,r,i,o;const{task:s}=null!=a?a:{};if(!s){try{const n=await this.request(e,t,a);yield{type:"result",result:n}}catch(e){yield{type:"error",error:e instanceof Ol?e:new Ol(ss.InternalError,String(e))}}return}let p;try{const s=await this.request(e,Ls,a);if(!s.task)throw new Ol(ss.InternalError,"Task creation did not return a task");for(p=s.task.taskId,yield{type:"taskCreated",task:s.task};;){const e=await this.getTask({taskId:p},a);if(yield{type:"taskStatus",task:e},bl(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:p},t,a);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new Ol(ss.InternalError,`Task ${p} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new Ol(ss.InternalError,`Task ${p} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:p},t,a);return void(yield{type:"result",result:e})}const s=null!==(i=null!==(n=e.pollInterval)&&void 0!==n?n:null===(r=this._options)||void 0===r?void 0:r.defaultTaskPollInterval)&&void 0!==i?i:1e3;await new Promise(e=>setTimeout(e,s)),null===(o=null==a?void 0:a.signal)||void 0===o||o.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof Ol?e:new Ol(ss.InternalError,String(e))}}}request(e,t,a){const{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i,task:o,relatedTask:s}=null!=a?a:{};return new Promise((p,l)=>{var d,u,c,m,f,_,h;const E=e=>{l(e)};if(!this._transport)return void E(new Error("Not connected"));if(!0===(null===(d=this._options)||void 0===d?void 0:d.enforceStrictCapabilities))try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){return void E(e)}null===(u=null==a?void 0:a.signal)||void 0===u||u.throwIfAborted();const y=this._requestMessageId++,T={...e,jsonrpc:"2.0",id:y};(null==a?void 0:a.onprogress)&&(this._progressHandlers.set(y,a.onprogress),T.params={...e.params,_meta:{...(null===(c=e.params)||void 0===c?void 0:c._meta)||{},progressToken:y}}),o&&(T.params={...T.params,task:o}),s&&(T.params={...T.params,_meta:{...(null===(m=T.params)||void 0===m?void 0:m._meta)||{},[zo]:s}});const R=e=>{var t;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(e)}},{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const a=e instanceof Ol?e:new Ol(ss.RequestTimeout,String(e));l(a)};this._responseHandlers.set(y,e=>{var n;if(!(null===(n=null==a?void 0:a.signal)||void 0===n?void 0:n.aborted)){if(e instanceof Error)return l(e);try{const a=Hr(t,e.result);a.success?p(a.data):l(a.error)}catch(e){l(e)}}}),null===(f=null==a?void 0:a.signal)||void 0===f||f.addEventListener("abort",()=>{var e;R(null===(e=null==a?void 0:a.signal)||void 0===e?void 0:e.reason)});const g=null!==(_=null==a?void 0:a.timeout)&&void 0!==_?_:6e4;this._setupTimeout(y,g,null==a?void 0:a.maxTotalTimeout,()=>R(Ol.fromError(ss.RequestTimeout,"Request timed out",{timeout:g})),null!==(h=null==a?void 0:a.resetTimeoutOnProgress)&&void 0!==h&&h);const v=null==s?void 0:s.taskId;if(v){const e=e=>{const t=this._responseHandlers.get(y);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${y}`))};this._requestResolvers.set(y,e),this._enqueueTaskMessage(v,{type:"request",message:T,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(y),l(e)})}else this._transport.send(T,{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(y),l(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Fs,t)}async getTaskResult(e,t,a){return this.request({method:"tasks/result",params:e},t,a)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Vs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Us,t)}async notification(e,t){var a,n,r,i,o;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=null===(a=null==t?void 0:t.relatedTask)||void 0===a?void 0:a.taskId;if(s){const a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...(null===(n=e.params)||void 0===n?void 0:n._meta)||{},[zo]:t.relatedTask}}};return void await this._enqueueTaskMessage(s,{type:"notification",message:a,timestamp:Date.now()})}if((null!==(i=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==i?i:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)&&!(null==t?void 0:t.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var a,n;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(r={...r,params:{...r.params,_meta:{...(null===(a=r.params)||void 0===a?void 0:a._meta)||{},[zo]:t.relatedTask}}}),null===(n=this._transport)||void 0===n||n.send(r,t).catch(e=>this._onerror(e))})}let p={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(p={...p,params:{...p.params,_meta:{...(null===(o=p.params)||void 0===o?void 0:o._meta)||{},[zo]:t.relatedTask}}}),await this._transport.send(p,t)}setRequestHandler(e,t){const a=cd(e);this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(a,n)=>{const r=md(e,a);return Promise.resolve(t(r,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const a=cd(e);this._notificationHandlers.set(a,a=>{const n=md(e,a);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,a){var n;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=null===(n=this._options)||void 0===n?void 0:n.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,a,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const a=await this._taskMessageQueue.dequeueAll(e,t);for(const t of a)if("request"===t.type&&ns(t.message)){const a=t.message.id,n=this._requestResolvers.get(a);n?(n(new Ol(ss.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){var a,n,r;let i=null!==(n=null===(a=this._options)||void 0===a?void 0:a.defaultTaskPollInterval)&&void 0!==n?n:1e3;try{const t=await(null===(r=this._taskStore)||void 0===r?void 0:r.getTask(e));(null==t?void 0:t.pollInterval)&&(i=t.pollInterval)}catch(e){}return new Promise((e,a)=>{if(t.aborted)return void a(new Ol(ss.InvalidRequest,"Request cancelled"));const n=setTimeout(e,i);t.addEventListener("abort",()=>{clearTimeout(n),a(new Ol(ss.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const a=this._taskStore;if(!a)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await a.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await a.getTask(e,t);if(!n)throw new Ol(ss.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,r)=>{await a.storeTaskResult(e,n,r,t);const i=await a.getTask(e,t);if(i){const t=Gs.parse({method:"notifications/tasks/status",params:i});await this.notification(t),bl(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>a.getTaskResult(e,t),updateTaskStatus:async(e,n,r)=>{const i=await a.getTask(e,t);if(!i)throw new Ol(ss.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(bl(i.status))throw new Ol(ss.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await a.updateTaskStatus(e,n,r,t);const o=await a.getTask(e,t);if(o){const t=Gs.parse({method:"notifications/tasks/status",params:o});await this.notification(t),bl(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>a.listTasks(e,t)}}}function _d(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var hd=c(1601),Ed=c(4421);class yd{constructor(e){this._ajv=null!=e?e:function(){const e=new hd.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ed(e),e}()}getValidator(e){var t;const a="$id"in e&&"string"==typeof e.$id&&null!==(t=this._ajv.getSchema(e.$id))&&void 0!==t?t:this._ajv.compile(e);return e=>a(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(a.errors)}}}class Td{constructor(e){this._server=e}requestStream(e,t,a){return this._server.requestStream(e,t,a)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,a){return this._server.getTaskResult({taskId:e},t,a)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class Rd extends fd{constructor(e,t){var a,n;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Gp.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const a=this._loggingLevels.get(t);return!!a&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(a)},this._capabilities=null!==(a=null==t?void 0:t.capabilities)&&void 0!==a?a:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!==(n=null==t?void 0:t.jsonSchemaValidator)&&void 0!==n?n:new yd,this.setRequestHandler(Os,e=>this._oninitialize(e)),this.setNotificationHandler(As,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(Fp,async(e,t)=>{var a;const n=t.sessionId||(null===(a=t.requestInfo)||void 0===a?void 0:a.headers["mcp-session-id"])||void 0,{level:r}=e.params,i=Gp.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Td(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const a={...e};for(const e in t){const n=e,r=t[n];if(void 0===r)continue;const i=a[n];_d(i)&&_d(r)?a[n]={...i,...r}:a[n]=r}return a}(this._capabilities,e)}setRequestHandler(e,t){var a,n,r;const i=qr(e),o=null==i?void 0:i.method;if(!o)throw new Error("Schema is missing a method literal");let s;if($r(o)){const e=o,t=null===(a=e._zod)||void 0===a?void 0:a.def;s=null!==(n=null==t?void 0:t.value)&&void 0!==n?n:e.value}else{const e=o,t=e._def;s=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:e.value}if("string"!=typeof s)throw new Error("Schema method literal must be a string");if("tools/call"===s){const a=async(e,a)=>{const n=Hr(Lp,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Ol(ss.InvalidParams,`Invalid tools/call request: ${e}`)}const{params:r}=n.data,i=await Promise.resolve(t(e,a));if(r.task){const e=Hr(Ls,i);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Ol(ss.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const o=Hr(jp,i);if(!o.success){const e=o.error instanceof Error?o.error.message:String(o.error);throw new Ol(ss.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){var t,a,n;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(a=this._clientCapabilities)||void 0===a?void 0:a.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(n=this._clientCapabilities)||void 0===n?void 0:n.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){var t,a;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(null===(a=null===(t=this._clientCapabilities)||void 0===t?void 0:t.elicitation)||void 0===a?void 0:a.url))throw new Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t,a;!function(e,t,a){var n,r;if(!e)throw new Error(`${a} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(null===(n=e.sampling)||void 0===n?void 0:n.createMessage))throw new Error(`${a} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(null===(r=e.elicitation)||void 0===r?void 0:r.create))throw new Error(`${a} does not support task creation for elicitation/create (required for ${t})`)}}(null===(a=null===(t=this._clientCapabilities)||void 0===t?void 0:t.tasks)||void 0===a?void 0:a.requests,e,"Client")}assertTaskHandlerCapability(e){var t;this._capabilities&&function(e,t,a){var n;if(!e)throw new Error(`${a} does not support task creation (required for ${t})`);if("tools/call"===t&&!(null===(n=e.tools)||void 0===n?void 0:n.call))throw new Error(`${a} does not support task creation for tools/call (required for ${t})`)}(null===(t=this._capabilities.tasks)||void 0===t?void 0:t.requests,e,"Server")}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:Bo.includes(t)?t:Fo,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},ds)}async createMessage(e,t){var a,n;if((e.tools||e.toolChoice)&&!(null===(n=null===(a=this._clientCapabilities)||void 0===a?void 0:a.sampling)||void 0===n?void 0:n.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],a=Array.isArray(t.content)?t.content:[t.content],n=a.some(e=>"tool_result"===e.type),r=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=r?Array.isArray(r.content)?r.content:[r.content]:[],o=i.some(e=>"tool_use"===e.type);if(n){if(a.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!o)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(o){const e=new Set(i.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(a.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Jp,t):this.request({method:"sampling/createMessage",params:e},Xp,t)}async elicitInput(e,t){var a,n,r,i,o;switch(null!==(a=e.mode)&&void 0!==a?a:"form"){case"url":{if(!(null===(r=null===(n=this._clientCapabilities)||void 0===n?void 0:n.elicitation)||void 0===r?void 0:r.url))throw new Error("Client does not support url elicitation.");const a=e;return this.request({method:"elicitation/create",params:a},ml,t)}case"form":{if(!(null===(o=null===(i=this._clientCapabilities)||void 0===i?void 0:i.elicitation)||void 0===o?void 0:o.form))throw new Error("Client does not support form elicitation.");const a="form"===e.mode?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:a},ml,t);if("accept"===n.action&&n.content&&a.requestedSchema)try{const e=this._jsonSchemaValidator.getValidator(a.requestedSchema)(n.content);if(!e.valid)throw new Ol(ss.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof Ol)throw e;throw new Ol(ss.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return n}}}createElicitationCompletionNotifier(e,t){var a,n;if(!(null===(n=null===(a=this._clientCapabilities)||void 0===a?void 0:a.elicitation)||void 0===n?void 0:n.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},gl,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const gd=Symbol.for("mcp.completable");var vd;!function(e){e.Completable="McpCompletable"}(vd||(vd={}));const Od=/^[A-Za-z0-9._-]{1,128}$/;function Nd(e){const t=function(e){const t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Od.test(e)){const a=e.split("").filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,a)=>a.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${a.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);return function(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(const e of t)console.warn(` - ${e}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}(e,t.warnings),t.isValid}class bd{constructor(e){this._mcpServer=e}registerToolTask(e,t,a){const n={taskSupport:"required",...t.execution};if("forbidden"===n.taskSupport)throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,a)}}class Ad{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Rd(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new bd(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(Dp)),this.server.assertCanSetRequestHandler(Pd(Lp)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Dp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{const a={name:e,title:t.title,description:t.description,inputSchema:(()=>{const e=Wr(t.inputSchema);return e?ud(e,{strictUnions:!0,pipeStrategy:"input"}):Sd})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){const e=Wr(t.outputSchema);e&&(a.outputSchema=ud(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(Lp,async(e,t)=>{var a;try{const n=this._registeredTools[e.params.name];if(!n)throw new Ol(ss.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Ol(ss.InvalidParams,`Tool ${e.params.name} disabled`);const r=!!e.params.task,i=null===(a=n.execution)||void 0===a?void 0:a.taskSupport,o="createTask"in n.handler;if(("required"===i||"optional"===i)&&!o)throw new Ol(ss.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!r)throw new Ol(ss.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===i&&!r&&o)return await this.handleAutomaticTaskPolling(n,e,t);const s=await this.validateToolInput(n,e.params.arguments,e.params.name),p=await this.executeToolHandler(n,s,t);return r||await this.validateToolOutput(n,p,e.params.name),p}catch(e){if(e instanceof Ol&&e.code===ss.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,a){if(!e.inputSchema)return;const n=Wr(e.inputSchema),r=null!=n?n:e.inputSchema,i=await Kr(r,t);if(!i.success){const e=Qr("error"in i?i.error:"Unknown error");throw new Ol(ss.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${e}`)}return i.data}async validateToolOutput(e,t,a){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new Ol(ss.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);const n=Wr(e.outputSchema),r=await Kr(n,t.structuredContent);if(!r.success){const e=Qr("error"in r?r.error:"Unknown error");throw new Ol(ss.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${e}`)}}async executeToolHandler(e,t,a){const n=e.handler;if("createTask"in n){if(!a.taskStore)throw new Error("No task store provided.");const r={...a,taskStore:a.taskStore};if(e.inputSchema){const e=n;return await Promise.resolve(e.createTask(t,r))}{const e=n;return await Promise.resolve(e.createTask(r))}}if(e.inputSchema){const e=n;return await Promise.resolve(e(t,a))}{const e=n;return await Promise.resolve(e(a))}}async handleAutomaticTaskPolling(e,t,a){var n;if(!a.taskStore)throw new Error("No task store provided for task-capable tool.");const r=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,o={...a,taskStore:a.taskStore},s=r?await Promise.resolve(i.createTask(r,o)):await Promise.resolve(i.createTask(o)),p=s.task.taskId;let l=s.task;const d=null!==(n=l.pollInterval)&&void 0!==n?n:5e3;for(;"completed"!==l.status&&"failed"!==l.status&&"cancelled"!==l.status;){await new Promise(e=>setTimeout(e,d));const e=await a.taskStore.getTask(p);if(!e)throw new Ol(ss.InternalError,`Task ${p} not found during polling`);l=e}return await a.taskStore.getTaskResult(p)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Pd(El)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(El,async e=>{switch(e.params.ref.type){case"ref/prompt":return function(e){if("ref/prompt"!==e.params.ref.type)throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return function(e){if("ref/resource"!==e.params.ref.type)throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Ol(ss.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){const a=this._registeredPrompts[t.name];if(!a)throw new Ol(ss.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new Ol(ss.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return kd;const n=qr(a.argsSchema),r=null==n?void 0:n[e.params.argument.name];if(!function(e){return!!e&&"object"==typeof e&&gd in e}(r))return kd;const i=function(e){const t=e[gd];return null==t?void 0:t.complete}(r);if(!i)return kd;return jd(await i(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){const a=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!a){if(this._registeredResources[t.uri])return kd;throw new Ol(ss.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const n=a.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return kd;return jd(await n(e.params.argument.value,e.params.context))}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(Js)),this.server.assertCanSetRequestHandler(Pd(ep)),this.server.assertCanSetRequestHandler(Pd(rp)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Js,async(e,t)=>{const a=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),n=[];for(const e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;const a=await e.resourceTemplate.listCallback(t);for(const t of a.resources)n.push({...e.metadata,...t})}return{resources:[...a,...n]}}),this.server.setRequestHandler(ep,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(rp,async(e,t)=>{const a=new URL(e.params.uri),n=this._registeredResources[a.toString()];if(n){if(!n.enabled)throw new Ol(ss.InvalidParams,`Resource ${a} disabled`);return n.readCallback(a,t)}for(const e of Object.values(this._registeredResourceTemplates)){const n=e.resourceTemplate.uriTemplate.match(a.toString());if(n)return e.readCallback(a,n,t)}throw new Ol(ss.InvalidParams,`Resource ${a} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(_p)),this.server.assertCanSetRequestHandler(Pd(yp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(_p,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Dd(t.argsSchema):void 0}))})),this.server.setRequestHandler(yp,async(e,t)=>{const a=this._registeredPrompts[e.params.name];if(!a)throw new Ol(ss.InvalidParams,`Prompt ${e.params.name} not found`);if(!a.enabled)throw new Ol(ss.InvalidParams,`Prompt ${e.params.name} disabled`);if(a.argsSchema){const n=Wr(a.argsSchema),r=await Kr(n,e.params.arguments);if(!r.success){const t=Qr("error"in r?r.error:"Unknown error");throw new Ol(ss.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}const i=r.data,o=a.callback;return await Promise.resolve(o(i,t))}{const e=a.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...a){let n;"object"==typeof a[0]&&(n=a.shift());const r=a[0];if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const a=this._createRegisteredResource(e,void 0,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const a=this._createRegisteredResourceTemplate(e,void 0,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(e,t,a,n){if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const r=this._createRegisteredResource(e,a.title,t,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const r=this._createRegisteredResourceTemplate(e,a.title,t,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}_createRegisteredResource(e,t,a,n,r){const i={name:e,title:t,metadata:n,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==a&&(delete this._registeredResources[a],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=i,i}_createRegisteredResourceTemplate(e,t,a,n,r){const i={resourceTemplate:a,title:t,metadata:n,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,a,n,r){const i={title:t,description:a,argsSchema:void 0===n?void 0:Ur(n),callback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=Ur(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,a,n,r,i,o,s,p){Nd(e);const l={title:t,description:a,inputSchema:Cd(n),outputSchema:Cd(r),annotations:i,execution:o,_meta:s,handler:p,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&Nd(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=l)),void 0!==t.title&&(l.title=t.title),void 0!==t.description&&(l.description=t.description),void 0!==t.paramsSchema&&(l.inputSchema=Ur(t.paramsSchema)),void 0!==t.callback&&(l.handler=t.callback),void 0!==t.annotations&&(l.annotations=t.annotations),void 0!==t._meta&&(l._meta=t._meta),void 0!==t.enabled&&(l.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let a,n,r;if("string"==typeof t[0]&&(a=t.shift()),t.length>1){const e=t[0];wd(e)?(n=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!wd(t[0])&&(r=t.shift())):"object"==typeof e&&null!==e&&(r=t.shift())}const i=t[0];return this._createRegisteredTool(e,void 0,a,n,undefined,r,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:n,description:r,inputSchema:i,outputSchema:o,annotations:s,_meta:p}=t;return this._createRegisteredTool(e,n,r,i,o,s,{taskSupport:"forbidden"},p,a)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let a,n;"string"==typeof t[0]&&(a=t.shift()),t.length>1&&(n=t.shift());const r=t[0],i=this._createRegisteredPrompt(e,void 0,a,n,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:n,description:r,argsSchema:i}=t,o=this._createRegisteredPrompt(e,n,r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}const Sd={type:"object",properties:{}};function Id(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function wd(e){return"object"==typeof e&&null!==e&&(!function(e){return"_def"in e||"_zod"in e||Id(e)}(e)&&(0===Object.keys(e).length||Object.values(e).some(Id)))}function Cd(e){if(e)return wd(e)?Ur(e):e}function Dd(e){const t=qr(e);return t?Object.entries(t).map(([e,t])=>{const a=function(e){var t,a,n,r;if($r(e))return null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.description;const i=e;return null!==(n=e.description)&&void 0!==n?n:null===(r=i._def)||void 0===r?void 0:r.description}(t),n=function(e){var t,a,n;if($r(e))return"optional"===(null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.type);const r=e;return"function"==typeof e.isOptional?e.isOptional():"ZodOptional"===(null===(n=r._def)||void 0===n?void 0:n.typeName)}(t);return{name:e,description:a,required:!n}}):[]}function Pd(e){const t=qr(e),a=null==t?void 0:t.method;if(!a)throw new Error("Schema is missing a method literal");const n=Yr(a);if("string"==typeof n)return n;throw new Error("Schema method literal must be a string")}function jd(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const kd={completion:{values:[],hasMore:!1}};var Ld=c(1708);class Md{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf("\n");if(-1===e)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),function(e){return ls.parse(JSON.parse(e))}(t)}clear(){this._buffer=void 0}}class Gd{constructor(e=Ld.stdin,t=Ld.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Md,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{const t=this._readBuffer.readMessage();if(null===t)break;null===(e=this.onmessage)||void 0===e||e.call(this,t)}catch(e){null===(t=this.onerror)||void 0===t||t.call(this,e)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror);0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null===(e=this.onclose)||void 0===e||e.call(this)}send(e){return new Promise(t=>{const a=function(e){return JSON.stringify(e)+"\n"}(e);this._stdout.write(a)?t():this._stdout.once("drain",t)})}}var xd={info:"info",manage_signature:"sign",query_application:"qa",query_device:"qd",query_device_group:"qdg",query_module:"qm",query_activity_log:"qal",create_application:"ca",create_device:"cd",create_device_group:"cdg",create_module:"cm",update_application:"ua",bind_application:"ba",short_edit_application:"uas",canvas_control_application:"uacc",update_device:"ud",update_device_group:"udg",update_module:"um",short_edit_module:"ums",remove_application:"ra",remove_device:"rd",remove_device_group:"rdg",remove_module:"rm",control_device:"ctld",control_application_device:"ctlad",control_device_group:"ctldg",query_media_flow:"qmf",write_media_flow:"wmf",access_unstable_feature:"UNSTABLE"},Fd=Object.entries(xd).reduce((e,[t,a])=>(e[a]=t,e),{}),Bd=["HS256","RS256"],zd=["https://auth0.bricks.tools/","https://mybigday.auth0.com/"];function Vd(e){try{var t=e.queryStringParameters?.token;if(!t){var a=new Headers(e.headers);t=a.get("authorization")?.replace("Bearer ","")}if(!t)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var t=e.split(".");if(t.length<3)return null;var a=JSON.parse(Buffer.from(t[0],"base64url").toString());return Bd.includes(a?.alg)?JSON.parse(Buffer.from(t[1],"base64url").toString()):null}catch{return null}}(t);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var r=zd.includes(n.iss)?"user":"workspace";if("workspace"===r){var i=Array.isArray(n.t)?n.t:[];n.permissions=i.reduce((e,t)=>{var a=Fd[t];return a&&e.push(a),e},[])}else n.permissions=Object.keys(xd);return{success:!0,token:t,tokenInfo:n,tokenType:r}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}const $d='# Getting Started with BRICKS\n\nBRICKS (方塊磚) is a comprehensive platform for creating interactive multimedia display applications specifically designed for digital signage screens. It enables users to design complete applications without programming, using a visual, component-based approach.\n\n**Important**: Users interact through a visual GUI editor, not raw configuration files. Always describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation details\n\n## Core Philosophy\n\nBRICKS operates as a **Launcher system** that reads configuration files from the cloud (or cached locally) and must maintain normal operation even when offline. The system periodically reports health status and supports watchdog timers for automatic restart or maintenance mode activation.\n\n## Fundamental Architecture\n\n### The Three Core Elements\n\n#### 1. Canvas (畫布)\n- **Definition**: The visual container that defines what users see on screen\n- **Behavior**: Screen transitions occur by switching between different canvases\n- **Smart Transitions**: When switching canvases, BRICKS automatically compares shared elements and smoothly animates their position/size changes\n- **Properties**:\n - `Showing Timeout`: Auto-advance to next canvas after specified time\n - `Next Canvas ID`: Target canvas for timeout transitions\n - `Background Color`: Canvas background\n - `Dismiss Keyboard On Press`: Touch behavior for keyboard dismissal\n- **Events**: `CANVAS_FIRST_ENTER`, `CANVAS_ENTER`, `CANVAS_SHOWING_TIMEOUT`, `CANVAS_EXIT`\n\n#### 2. Brick (方塊)\n- **Definition**: Visual components that display content and handle user interactions\n- **Animation System**: All bricks support three animation phases:\n - **Enter Animation**: How the brick appears on screen\n - **Display Animation**: Ongoing animations while visible\n - **Exit Animation**: How the brick disappears\n- **Positioning**: Uses grid-based positioning system for resolution independence\n- **Interaction**: Can respond to touch events and trigger system actions\n\nAvailable template:\n[:BRICK_IDS:]\n\n#### 3. Generator (處理器)\n- **Definition**: Invisible processing units that handle non-visual functionality\n- **Purpose**: Handle hardware interactions (camera, sensors), data processing, network communication\n- **Input**: Receives parameters exclusively through Property Bank\n- **Output**: Returns results exclusively through Property Bank\n- **Triggers**: Activated by Events connected to their Actions\n\nAvailable template:\n[:GENERATOR_IDS:]\n\n### Data (Property Bank, 參數庫)\nThe central data management system that serves as the backbone of BRICKS applications:\n\n#### Key Features\n- **KEY-VALUE Structure**: Simple, accessible data storage\n- **Dual Events**: Each property supports both "Update" and "Value Change" events\n- **Auto-Refresh**: UI elements automatically update when linked data changes\n- **Cross-Subspace Communication**: Properties can be shared between different subspaces\n- **Data Types**: `string`, `number`, `bool`, `object`, `array`, `any`\n- **Special Kinds**: `color`, `datetime`, `id`, `media-resource-*`, `lottie-file-uri`\n- **Units**: `grid`, `px`, `ms` for different measurement types\n\n#### Routing Options\n- **read-only**: Cannot be changed from other subspaces\n- **Default**: Accepts changes from other subspaces\n\nTerminology note: We refer to the central data system as "Data" in docs and UI. Internally, it remains "Property Bank" and uses `PROPERTY_BANK_*` identifiers.\n\n### Event System\nBRICKS uses a comprehensive event-driven architecture:\n\n#### Event Sources\n- **System Events**: Property Bank changes, timer events, canvas transitions\n- **Brick Events**: User interactions (press, focus, value changes)\n- **Generator Events**: Hardware responses, network callbacks, processing completions\n\n#### Event Handling\n- **Sequential Processing**: Events trigger Actions in defined order\n- **Parameter Passing**: All parameters passed through Property Bank\n- **Action Types**: System actions or Generator actions\n\n### Subspace (子空間)\nAdvanced modularity system for complex applications:\n\n#### Concept\n- **Nested Systems**: Complete BRICKS system within a brick\n- **Independent Operation**: Own canvases, bricks, and property banks\n- **Modular Behavior**: Can be positioned, scaled, and animated like regular bricks\n\n#### Communication\n- **Input**: External Property Bank values copied to internal Property Bank\n- **Output**: Internal Property Bank changes trigger external events\n- **Data Flow**: Call-by-value copying maintains isolation while enabling communication\n\n## Grid System\n\n### Resolution Independence\n- **Default Grid**: 96×54 units (optimized for HD displays)\n- **Automatic Scaling**: Grid units convert to pixels based on device resolution\n- **Calculation**: `grid_unit_size_px = device_width_px / app_grid_width`\n\n### Examples\n| Device Resolution | App Grid Size | Grid Unit Size |\n|------------------|---------------|----------------|\n| 1920×1080 | 96×54 | 20px |\n| 3840×2160 | 96×54 | 40px |\n| 1280×720 | 96×54 | 13.33px |\n\n### Positioning Features\n- **Overflow Support**: Elements can extend beyond visible area\n- **Partial Display**: Elements at negative positions show partial content\n- **Performance Optimization**: Completely off-screen elements are automatically ignored\n\n## Configuration Structure\n\n### Hierarchy\n```\nApplication (應用程式)\n├── Root Subspace\n├── Subspace Map\n│ ├── Canvas Map\n│ ├── Brick Map\n│ └── Generator Map\n├── Property Bank\n├── Property Bank Calc\n├── Event Map\n└── Automation Map\n```\n\n### Item property\nProperties can set constant value or link data like this\n\n```js\n{\n "example1": 123,\n "example2": "PROPERTY_BANK#<Data Node ID>", // Link Data\n "example3": {\n "PROPERTY_BANK#<Data Node ID>", // Link Data in object, we recommend direct link without middle object data\n }\n}\n```\n\n### Item outlet\nData output from brick or generator, you can link it to data\n\n```js\n{\n OUTLET_NAME: \'<Data Node ID>\'\n}\n```\n\n### Event actions\nOn handling event can do actions with this schema\n\n```js\n[\n {\n "action": "string",\n "handler": "string",\n "parameter_list": [\n {\n "input_to_receiver": "string", // Argument\n "result_from_sender": "string" // Link data\n }\n ],\n "wait_async": "boolean"\n }\n]\n```\n\n- `handler: SYSTEM`\n[:SYSTEM_ACTIONS:]\n- `handler: GENERATOR_<UUID>`\n- `handler: BRICK_<UUID>`\n\n## Development Workflow\n\n### 1. Design Phase\n- Define grid layout (usually 96×54)\n- Plan canvas flow and transitions\n- Identify required data flows\n\n### 2. Implementation\n- Use `create_item` to constuct config\n- Create subspaces for different app sections\n- Add canvases for each screen/state\n- Place and configure bricks for UI elements\n- Add generators for processing logic\n- Connect events to actions\n\n### 3. Data Management\n- Set up Property Bank structure\n- Configure property types and routing\n- Link UI elements to data sources\n- Implement data processing flows\n\n#### Mental Model\n- Reactive architecture: events trigger actions; actions update Data; UI and generators react to Data changes.\n- Calculations: optional graphs transform Data using Data Calculation (command/data nodes or script).\n- Always read/write via Data. Generators receive input from Data and write outputs back to Data.\n\n#### Common Patterns\n- Event → Action → Data update or Outlet → Data update\n- Data change → Triggers downstream calculations → Updates target Data\n- Cross-subspace routing: respect `read-only` vs `default`\n\n### 4. Testing & Deployment\n- Use automation maps for testing\n- Validate configuration schema\n- Deploy to target devices\n- Monitor system health\n\n## Best Practices\n\n### Performance\n- Use 96×54 grid for standard content\n- Minimize off-screen elements\n- Optimize property bank access patterns\n- Cache media resources appropriately\n\n### User Experience\n- Always use enter/exit animations (avoid sudden appearances)\n- Maintain consistent transition timing\n- Design for offline operation\n- Implement proper error handling\n\n### Architecture\n- Keep subspaces focused and modular\n- Use generators for all non-visual processing\n- Minimize cross-subspace dependencies\n- Design for reusability through modules\n\n## Network & Offline Behavior\n\n### Online Operation\n- Configuration sync from cloud\n- Media resource loading\n- Real-time data updates\n- Health status reporting\n\n### Offline Requirements\n- **Display Continuity**: All display and reading functions must work offline\n- **Data Caching**: Write operations cached locally and synced when online\n- **Resource Management**: Media and assets preloaded during online periods\n- **Graceful Degradation**: Non-essential features disabled, core functionality maintained\n\nThis comprehensive foundation enables the creation of sophisticated, interactive digital signage applications that are both powerful and maintainable.\n\n## Local Sync\n\nLocal Sync enables near real-time intranet communication between devices for seamless multi-screen display splicing.\n\n- Data Sync: Synchronize selected data (Property Bank/Data nodes) across devices so UI updates remain consistent.\n- Canvas Sync: Optionally synchronize active canvas to orchestrate state transitions across screens.\n- Typical Use: Video walls, tiled displays, or clustered players that must behave as one.\n- Transport: LAN/intranet only; optimized for low latency and reliability inside the local network.\n- Resilience: Designed to tolerate temporary disconnections; devices rejoin and resynchronize state.\n\nConfiguration hints (high level):\n- Subspaces can define local sync behavior (e.g., whether to sync canvas changes).\n- Generators may opt into specific local sync run modes.\n- Keep payloads small and data normalized for best performance.';var Ud=c(181),Hd=(e,t={})=>({content:[Ud.Buffer.isBuffer(e)?{...t,blob:e.toString("base64"),type:"blob"}:{...t,text:"string"==typeof e?e:JSON.stringify(e,null,2),type:"text"}],isError:!1});var Kd=c(9657);const qd=t("node:net"),Wd=t("node:http"),Qd=t("node:https");var Yd=c(8875);const Xd=t("node:dns"),Jd={allowPrivateIPAddress:!1,allowMetaIPAddress:!1,allowIPAddressList:[],denyIPAddressList:[]},Zd=({address:e,host:t,family:a},n)=>{if(0!==qd.isIP(e))try{const r=Yd.parse(e).range();if(n.allowIPAddressList.length>0&&n.allowIPAddressList.includes(e))return;if(!n.allowMetaIPAddress&&"unspecified"===r)return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because, It is meta IP address.`);if(!n.allowPrivateIPAddress&&"unicast"!==r)return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because, It is private IP address.`);if(n.denyIPAddressList.length>0&&n.denyIPAddressList.includes(e))return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because It is defined in denyIPAddressList.`)}catch(e){return e}},eu=(e,t)=>(a,n,r)=>{const i=e.lookup||Xd.lookup;let o;o=n.all?(e,n)=>{if(e)r(e);else{for(const{address:e,family:i}of n){const n=Zd({address:e,family:i,host:a},t);if(n)return void r(n)}r(null,n)}}:(e,n,i)=>{if(e)return void r(e);const o=Zd({address:n,family:i,host:a},t);o?r(o):r(null,n,i)},i(a,n,o)};class tu extends Wd.Agent{requestFilterOptions;constructor(e){super(e),this.requestFilterOptions={allowPrivateIPAddress:e&&void 0!==e.allowPrivateIPAddress?e.allowPrivateIPAddress:Jd.allowPrivateIPAddress,allowMetaIPAddress:e&&void 0!==e.allowMetaIPAddress?e.allowMetaIPAddress:Jd.allowMetaIPAddress,allowIPAddressList:e&&e.allowIPAddressList?e.allowIPAddressList:Jd.allowIPAddressList,denyIPAddressList:e&&e.denyIPAddressList?e.denyIPAddressList:Jd.denyIPAddressList}}createConnection(e,t){const{host:a}=e;if(void 0!==a){const e=Zd({address:a},this.requestFilterOptions);if(e)throw e}return super.createConnection({...e,lookup:eu(e,this.requestFilterOptions)},t)}}class au extends Qd.Agent{requestFilterOptions;constructor(e){super(e),this.requestFilterOptions={allowPrivateIPAddress:!(!e||void 0===e.allowPrivateIPAddress)&&e.allowPrivateIPAddress,allowMetaIPAddress:!(!e||void 0===e.allowMetaIPAddress)&&e.allowMetaIPAddress,allowIPAddressList:e&&e.allowIPAddressList?e.allowIPAddressList:[],denyIPAddressList:e&&e.denyIPAddressList?e.denyIPAddressList:[]}}createConnection(e,t){const{host:a}=e;if(void 0!==a){const e=Zd({address:a},this.requestFilterOptions);if(e)throw e}return super.createConnection({...e,lookup:eu(e,this.requestFilterOptions)},t)}}const nu=new tu,ru=new au,iu=(e,t)=>t?e.startsWith("https")?new au(t):new tu(t):e.startsWith("https")?ru:nu;var ou=c(6123),su=c(211),pu=c(5907),lu=c(6502),du=c.n(lu),uu=c(5838);function cu(){return cu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},cu.apply(this,arguments)}var mu={enum:1,type:0},fu=/"/g,_u=/NOT/g,hu=/\//g,Eu=function(e){var t=e.value,a=e.suggestions,n=e.format,r=void 0===n?function(e){return"Did you mean '"+e+"'?"}:n;if(!t)return"";var i=a.reduce(function(e,a){var n=du()(t,a);return e.distance>n?{value:a,distance:n}:e},{distance:1/0,value:""});return i.distance<t.length?r(i.value):""},yu=function(e){return e.split("/").pop()},Tu=function(e){var t=e.object,a=e.pnter,n=e.fallback;try{return uu.get(t,a)}catch(e){return n}},Ru=function(e){var t=e.errors,a=e.data,n=e.schema,r=e.basePath,i=void 0===r?"{base}":r;if(!Array.isArray(t)||0===t.length)return[];var o=function(e){var t=e.reduce(function(e,t){var a,n,r,i,o,s,p=t.instancePath+(null!=(a=null!=(n=null==(r=t.params)?void 0:r.additionalProperty)?n:null==(i=t.params)?void 0:i.missingProperty)?a:""),l=e[p];return l?((null!=(o=mu[t.keyword])?o:0)>(null!=(s=mu[l.keyword])?s:0)&&(e[p]=t),e):(e[p]=t,e)},{});return Object.values(t)}(t);return o.map(function(e){var t,r=(i+e.instancePath).replace(hu,"."),o=yu(e.instancePath),s={errorType:e.keyword},p=(o?"property '"+o+"'":r)+" "+e.message.replace(fu,"'").replace(_u,"not");switch(e.keyword){case"additionalProperties":var l=e.params.additionalProperty,d=e.schemaPath.replace("#","").replace("/additionalProperties",""),u=Tu({object:n,pnter:d,fallback:{properties:{}}}).properties;t={message:"'"+l+"' property is not expected to be here",suggestion:Eu({value:l,suggestions:Object.keys(null!=u?u:{}),format:function(e){return"Did you mean property '"+e+"'?"}}),path:r,context:s};break;case"enum":var c=e.params.allowedValues.map(function(e){return e.toString()}),m=yu(e.instancePath),f=Tu({object:a,pnter:e.instancePath,fallback:""});t={message:"'"+m+"' property must be equal to one of the allowed values",suggestion:Eu({value:f,suggestions:c}),path:r,context:cu({},s,{allowedValues:e.params.allowedValues})};break;case"type":t={message:"'"+yu(e.instancePath)+"' property type must be "+e.params.type,path:r,context:s};break;case"required":t={message:r+" must have required property '"+e.params.missingProperty+"'",path:r,context:s};break;case"const":return{message:"'"+o+"' property must be equal to the allowed value",path:r,context:cu({},s,{allowedValue:e.params.allowedValue})};default:return{message:p,path:r,context:s}}for(var _=0,h=Object.entries(t);_<h.length;_++){var E=h[_],y=E[0],T=E[1];null!=T&&""!==T||delete t[y]}return t})};const gu=(e,t="Internal Logic Error")=>{if(!e)throw new Error("function"==typeof t?t():t)};class vu{constructor(e,t){this.value=e,this.excluded=t,this.isSimpleStarRec="**"===e,this.isRegexStarRec=e.startsWith("**(")&&e.endsWith(")"),this.isStarRec=this.isSimpleStarRec||this.isRegexStarRec}}class Ou{constructor(e,t=null){this.left=null===t,this.link=null===t?new Ou(e,this):t,this.type=e,this.isStarRec="**"===this.type,this.node=null,this.pointer=null}setPointer(e){this.pointer=e,this.link.pointer=e}setNode(e){this.node=e,this.link.node=e}}const Nu=(e,t,a={})=>{throw new Error(Object.entries(a).reduce((e,[t,a])=>`${e}, ${t} ${a}`,`${e}: ${t}`))},bu=e=>1===e.length?e[0]:e,Au=/^[?*+\d]+$/,Su=(e,t,a={})=>{throw new Error(Object.entries(a).reduce((e,[t,a])=>`${e}, ${t} ${a}`,`${e}: ${t}`))},Iu=(e,t)=>{if(""===e)return new vu("",!1);if(Array.isArray(e))return 0===e.length?new vu("",!1):e.map((a,n)=>"number"==typeof a?(t.useArraySelector||Su("Forbidden Array Selector",JSON.stringify(e),{idx:n}),new vu(`[${a}]`,!1)):new vu(a.replaceAll("\\","\\\\"),!1));const a=(e=>{let t=[];t.or=!0;let a=!1,n=!1,r=0;const i=[],o=e=>{!0===t.excluded&&(gu(!1===n),n=!0),i.push(t),t=[],t.or=e},s=()=>{const e=i.pop(),a=bu(t);!0===e.or&&!0===a.or?e.push(...a):e.push(a),t=e};return o(!1),{setInArray:(t,n)=>{a===t&&Nu(a?"Bad Array Start":"Bad Array Terminator",e,{char:n}),a=t},finishElement:(i,o,s,{finReq:p=!1,group:l=!1}={})=>{if(r===i)s.includes(e[i-1]||null)||Nu(o,e,{char:i}),r+=1;else{p&&Nu(o,e,{char:i});const s=e.slice(r,i);l&&!["**","++"].includes(s)&&Nu("Bad Group Start",e,{char:i}),a&&!(Au.test(s)||s.startsWith("(")&&s.endsWith(")"))&&Nu("Bad Array Selector",e,{selector:s}),l?t.push(new Ou(s)):(t.push(new vu(a?`[${s}]`:s,n)),n=!1),r=i+1}},startExclusion:t=>{!1!==n&&Nu("Redundant Exclusion",e,{char:t}),n=!0},startGroup:()=>{o(!0),n&&(t.excluded=!0,n=!1),o(!1)},newGroupElement:()=>{s(),o(!1)},finishGroup:a=>{i.length<2&&Nu("Unexpected Group Terminator",e,{char:a}),s(),s(),gu(Array.isArray(t));const n=t[t.length-2];n instanceof Ou&&!0===n.left&&t.push(n.link)},finalizeResult:()=>(s(),gu(!1===n),0!==i.length&&Nu("Non Terminated Group",e),a&&Nu("Non Terminated Array",e),bu(t))}})(e),n=e.length;let r=!1,i=0;for(let o=0;o<n;o+=1){const n=e[o];if(!1===r){if(0===i)switch(n){case".":a.finishElement(o,"Bad Path Separator",["]","}"]);break;case"[":t.useArraySelector||Su("Forbidden Array Selector",e,{char:o}),a.finishElement(o,"Bad Array Start",[null,"!","{",",","}","]"]),a.setInArray(!0,o);break;case"]":a.finishElement(o,"Bad Array Terminator",["}"]),a.setInArray(!1,o);break;case"{":a.finishElement(o,"Bad Group Start",[null,"!",".","[","{",","],{group:!0}),a.startGroup();break;case",":a.finishElement(o,"Bad Group Separator",["]","}"]),a.newGroupElement();break;case"}":a.finishElement(o,"Bad Group Terminator",["]","}"]),a.finishGroup(o);break;case"!":a.finishElement(o,"Bad Exclusion",[null,".",",","{","["],{finReq:!0}),a.startExclusion(o)}switch(n){case"(":i+=1;break;case")":0===i&&Su("Unexpected Parentheses",e,{char:o}),i-=1}}r="\\"===n&&!r}return!1!==r&&Su("Dangling Escape",e,{char:n-1}),0!==i&&Su("Unterminated Parentheses",e),a.finishElement(n,"Bad Terminator",["]","}"]),a.finalizeResult()},wu=(e,t,a,{onAdd:n,onFin:r})=>{const i=[[[e,null]]];let o=!1;((e,t)=>{const a=[e],n=[null],r=[],i=[];let o=0,s=!0;for(;-1!==o;){const e=a[o];Array.isArray(e)?!0!==e.or?(a.splice(o,1,...e),n.splice(o,1,...new Array(e.length).fill(n[o])),null!==n[o]&&(i[n[o]]+=e.length-1)):(void 0===r[o]?(r[o]=0,i[o]=0):0!==i[o]&&(a.splice(o+1,i[o]),n.splice(o+1,i[o]),i[o]=0),r[o]<e.length?(a.splice(o+1,0,e[r[o]]),n.splice(o+1,0,o),r[o]=(r[o]||0)+1,i[o]+=1,s=!0,o+=1):(r[o]=0,o-=1)):!0===s?(t("ADD",e),o===a.length-1?(t("FIN",e),s=!1):o+=1):(t("RM",e),o-=1)}})(a,(a,s)=>{if("RM"===a)!0===s.excluded&&(o=!1),i.length-=2;else if("ADD"===a){if(!0===s.excluded){if(o)throw new Error(`Redundant Exclusion: "${t}"`);o=!0}const e=[],a=i[i.length-2];i[i.length-1].forEach(([t,r])=>n(t,r,s,a,a=>e.push([a,t]))),i.push(s,e)}else i[i.length-1].filter(([t])=>t!==e).forEach(([e,t])=>r(e,t,s,o))})},Cu=/[?!,.*+[\](){}\\]/g,Du=/^\^?[^-/\\^$*+?.()|[\]{}]*\$?$/g,Pu=e=>{if(Du.test(e)){const t=e.startsWith("^"),a=e.endsWith("$");if(t&&a){const t=e.slice(1,-1);return{test:e=>String(e)===t}}if(t){const t=e.slice(1);return{test:e=>String(e).startsWith(t)}}if(a){const t=e.slice(0,-1);return{test:e=>String(e).endsWith(t)}}return{test:t=>String(t).includes(e)}}try{return new RegExp(e)}catch(t){throw new Error(`Invalid Regex: "${e}"`)}},ju=e=>e.reduce((e,t)=>`${e}${"number"==typeof t?`[${t}]`:`${e?".":""}${(e=>e.replace(Cu,"\\$&"))(t)}`}`,""),ku=e=>Array.isArray(e)?ju(e):e,Lu=["-","/","\\","^","$","*","+","?",".","(",")","|","[","]","{","}"],Mu=e=>{let t="",a=!1,n=!0;for(let r=0;r<e.length;r+=1){const i=e[r];a||"\\"!==i?a||"*"!==i?a||"+"!==i?a||"?"!==i?(Lu.includes(i)&&(n=!1,t+="\\"),t+=i,a=!1):(n=!1,t+="."):(n=!1,t+=".+"):(n=!1,t+=".*"):a=!0}return n?{test:e=>String(e)===t}:".+"===t?{test:e=>""!==e}:new RegExp(`^${t}$`)};class Gu{constructor(e,t){if(t.nodes.push(this),this.value=e,this.ctx=t,this.order=t.counter,this.children=[],this.match=!1,this.matches=!1,this.needles=[],this.leafNeedles=[],this.leafNeedlesExclude=[],this.leafNeedlesMatch=[],this.isArrayTarget=e.startsWith("[")&&e.endsWith("]"),this.isSimpleStarRec="**"===e,this.isSimplePlusRec="++"===e,this.isSimpleRec=this.isSimpleStarRec||this.isSimplePlusRec,this.isRegexStarRec=e.startsWith("**(")&&e.endsWith(")"),this.isRegexPlusRec=e.startsWith("++(")&&e.endsWith(")"),this.isStarRec=this.isSimpleStarRec||this.isRegexStarRec,this.isPlusRec=this.isSimplePlusRec||this.isRegexPlusRec,this.isRec=this.isStarRec||this.isPlusRec,this.isAnyArrayTarget="[*]"===e,this.isAnyObjTarget="*"===e,this.isSimpleRec||this.isAnyObjTarget||this.isAnyArrayTarget)this.regex=null;else{const{regex:a}=t;e in a||(a[e]=(e=>(e.startsWith("**(")||e.startsWith("++("))&&e.endsWith(")")?Pu(e.slice(3,-1)):e.startsWith("[(")&&e.endsWith(")]")?Pu(e.slice(2,-2)):e.startsWith("(")&&e.endsWith(")")?Pu(e.slice(1,-1)):e.startsWith("[")&&e.endsWith("]")?Mu(e.slice(1,-1)):Mu(e))(e)),this.regex=a[e]}}recMatch(e){return!!this.isRec&&(!!this.isSimpleRec||this.regex.test(e))}typeMatch(e,t){return!!this.isSimpleRec||(this.isAnyArrayTarget?t:this.isAnyObjTarget?!t:!(t!==this.isArrayTarget&&!this.isRec)&&this.regex.test(e))}add(e){this.children.push(e)}get(e){return this.children.find(({value:t})=>t===e)}markMatches(){this.matches=!0}addNeedle(e){this.needles.includes(e)||this.needles.push(e)}setRoots(e){this.roots=e}finish(e,t,a){this.addNeedle(e),this.leafNeedles.includes(e)||this.leafNeedles.push(e);const n=t?this.leafNeedlesExclude:this.leafNeedlesMatch;n.includes(e)||n.push(e),this.match=!t,this.matches=this.match,this.index=a}}const xu=(e,t,a,n)=>{wu(e,t,a,{onAdd:(e,a,r,i,o)=>{if(e.addNeedle(t),r instanceof Ou)return void(!0===r.left?(r.isStarRec&&r.setPointer(e),r.setNode(new Gu("*",n)),n.links.push(e,r.node),o(r.node)):(r.target="target"in i?i.target:a.get(i.value),n.links.push(r.target,r.node),null!==r.pointer&&(o(r.pointer),r.setPointer(null)),o(e)));const s=r.isStarRec&&r.value===i?.value;if(s&&n.strict)throw new Error(`Redundant Recursion: "${t}"`);if(s)r.target=e;else{let t=e.get(r.value);void 0===t&&(t=new Gu(r.value,n),e.add(t)),o(t)}r.isStarRec&&o(e)},onFin:(e,a,r,i)=>{if(n.strict&&r.isSimpleStarRec){const e=a.children.filter(({value:e})=>!["","**"].includes(e));if(0!==e.length)throw new Error(`Needle Target Invalidated: "${e[0].needles[0]}" by "${t}"`)}if(n.strict&&0!==e.leafNeedles.length){const a=ku(e.leafNeedles[0]),n=ku(t);throw new Error(`Redundant Needle Target: "${a}" vs "${n}"`)}e.finish(t,i,n.counter),n.counter+=1}})},Fu=(e,t)=>{const a=[];for(let n=0,r=e.length;n<r;n+=1){const r=e[n][t];for(let e=0,t=r.length;e<t;e+=1){const t=r[e];a.includes(t)||a.push(t)}}return a},Bu=e=>{let t=-1,a=!1,n=e.length;for(;n--;){const{index:r,match:i}=e[n];r>t&&(t=r,a=i)}return a},zu=(e,t)=>t?ju(e):[...e],Vu=(e,t,a)=>{const n={haystack:e,context:a.context};if(void 0!==a.beforeFn){const e=a.beforeFn(n);void 0!==e&&(n.haystack=e)}const r=[!1,[t],null,0],i=[],o=[];let s,p,l,d,u=n.haystack;const c={getKey:(e=a.joined)=>zu(i,e),get key(){return c.getKey()},getValue:()=>u,get value(){return c.getValue()},getEntry:(e=a.joined)=>[zu(i,e),u],get entry(){return c.getEntry()},getIsMatch:()=>d,get isMatch(){return c.getIsMatch()},getMatchedBy:()=>(e=>Fu(e,"leafNeedlesMatch"))(l),get matchedBy(){return c.getMatchedBy()},getExcludedBy:()=>(e=>Fu(e,"leafNeedlesExclude"))(l),get excludedBy(){return c.getExcludedBy()},getTraversedBy:()=>(e=>Fu(e,"needles"))(l),get traversedBy(){return c.getTraversedBy()},getGproperty:()=>i[i.length-2],get gproperty(){return c.getGproperty()},getProperty:()=>i[i.length-1],get property(){return c.getProperty()},getGparent:()=>o[o.length-2],get gparent(){return c.getGparent()},getParent:()=>o[o.length-1],get parent(){return c.getParent()},getParents:()=>[...o].reverse(),get parents(){return c.getParents()},getIsCircular:()=>o.includes(u),get isCircular(){return c.getIsCircular()},getIsLeaf:()=>!(u instanceof Object),get isLeaf(){return c.getIsLeaf()},getDepth:()=>i.length,get depth(){return c.getDepth()},get result(){return c.getResult()},context:n.context},m=((e,t)=>{if("context"===t.rtn)return{onMatch:()=>{},get:()=>e.context};if("bool"===t.rtn){let e=!1;return{onMatch:()=>{e=!0},get:()=>e}}if("count"===t.rtn){let e=0;return{onMatch:()=>{e+=1},get:()=>e}}if("sum"===t.rtn){let e=0;return{onMatch:({value:t})=>{e+=t},get:()=>e}}const a=[];return{onMatch:"function"==typeof t.rtn?()=>a.push(t.rtn(e)):Array.isArray(t.rtn)?()=>a.push(t.rtn.map(t=>e[t])):()=>a.push(e[t.rtn]),get:()=>t.abort?a[0]:a}})(c,a);if(c.getResult=()=>m.get(),a.useArraySelector||!Array.isArray(n.haystack)){const e=t.get("");void 0!==e&&r[1].push(e)}do{s=r.pop(),p=r.pop(),l=r.pop(),d=r.pop();const e=i.length-s;for(let t=0;t<e;t+=1)o.pop(),i.pop();if(-1===e?(o.push(u),i.push(p),u=u[p]):null!==p?(i[i.length-1]=p,u=o[o.length-1][p]):u=n.haystack,d){void 0!==a.filterFn&&!1===a.filterFn(c)||(m.onMatch(c),a.abort&&(r.length=0));continue}if(!l.some(({matches:e})=>e))continue;const f=!1===a.useArraySelector&&Array.isArray(u);if(!f&&Bu(l)&&(r.push(!0,l,p,s),d=!0),(void 0===a.breakFn||!0!==a.breakFn(c))&&u instanceof Object){const e=Array.isArray(u),n=e?u.map((e,t)=>t).filter(()=>!0):Object.keys(u);!e&&a.compareFn&&n.sort(a.compareFn(c)),a.reverse||n.reverse();for(let i=0,o=n.length;i<o;i+=1){const o=n[i],p=[];if(f)p.push(...l),0===s&&p.push(...t.roots);else for(let t=0,a=l.length;t!==a;t+=1){const a=l[t];a.recMatch(o)&&p.push(a);const{children:n}=a;let r=n.length;for(;r--;){const t=n[r];t.typeMatch(o,e)&&p.push(t)}}if(a.orderByNeedles){p.index=Buffer.from(p.map(({order:e})=>e).sort());let e=r.length-3;const t=e-4*i;for(;e!==t&&1===Buffer.compare(p.index,r[e].index);)e-=4;r.splice(e+3,0,!1,p,o,s+1)}else r.push(!1,p,o,s+1)}}}while(0!==r.length);if(n.result=m.get(),void 0!==a.afterFn){const e=a.afterFn(n);void 0!==e&&(n.result=e)}return n.result},$u=(e,t,a)=>{gu(a.includes(typeof e[t]),()=>`Option "${t}" not one of [${a.join(", ")}]`)};var Uu=su.ajv.getSchema("http://display.bricks.tools/root.schema.json5"),Hu=((e,t={})=>{if(gu(Array.isArray(e),'Argument "needles" expected to be Array'),gu(t instanceof Object&&!Array.isArray(t),'Argument "opts" expected to be Object'),0===e.length)return(e,t)=>void 0===t?[]:t;const a=(e=>{const t={filterFn:void 0,breakFn:void 0,beforeFn:void 0,afterFn:void 0,compareFn:void 0,reverse:!0,orderByNeedles:!1,abort:!1,rtn:void 0,joined:!1,useArraySelector:!0,strict:!0,...e};return gu(12===Object.keys(t).length,"Unexpected Option provided"),$u(t,"filterFn",["function","undefined"]),$u(t,"breakFn",["function","undefined"]),$u(t,"beforeFn",["function","undefined"]),$u(t,"afterFn",["function","undefined"]),$u(t,"compareFn",["function","undefined"]),$u(t,"reverse",["boolean"]),$u(t,"orderByNeedles",["boolean"]),$u(t,"abort",["boolean"]),gu("function"==typeof t.rtn&&1===t.rtn.length||[void 0,"context","key","value","entry","property","gproperty","parent","gparent","parents","isMatch","matchedBy","excludedBy","traversedBy","isCircular","isLeaf","depth","bool","count","sum"].includes(t.rtn)||Array.isArray(t.rtn)&&t.rtn.every(e=>["key","value","entry","property","gproperty","parent","gparent","parents","isMatch","matchedBy","excludedBy","traversedBy","isCircular","isLeaf","depth"].includes(e)),'Option "rtn" is malformed'),$u(t,"joined",["boolean"]),$u(t,"useArraySelector",["boolean"]),$u(t,"strict",["boolean"]),t})(t),n=((e,t)=>{t.counter=0,t.links=[],t.nodes=[],t.regex=Object.create(null);const a=new Gu("*",t);for(let n=0;n<e.length;n+=1){const r=e[n],i=[Iu(r,t)];xu(a,r,i,t)}return((e,t)=>{const{links:a}=t;for(;0!==a.length;){const e=a.pop(),t=a.pop(),{children:n}=t;t.children=[...e.children.filter(e=>!n.includes(e)),...n]}!1===t.useArraySelector&&e.setRoots(e.children.filter(({isStarRec:e,value:t})=>e||""===t));const{nodes:n}=t;for(;0!==n.length;){const e=n.pop(),{children:t}=e;t.reverse(),t.some(({matches:e})=>e)&&e.markMatches()}})(a,t),a})(e,a);return(e,t)=>Vu(e,n,{context:t,...a,rtn:a.rtn||(void 0===t?"key":"context")})})(["subspace_map.*.property_bank_calc_map.*.script_config"]);function Ku(e){var t=[];try{var a=su(e);t.push(...Ru({errors:a,schema:Uu,data:e}).map(({path:e,message:t})=>`${e}: ${t}`));try{t.push(...pu(e).map(({field:e,message:t})=>`${e}: ${t}`))}catch(e){t.push(`Component reference validation failed: ${e.message}`)}return Hu(e).forEach(a=>{var n=a.slice(0,-1),r=ou(e,n),i=n.join(".");if(0===Object.keys(r.map).length)t.push(`${i}.map is empty`);else{var o=r.script_config,s=o.inputs,p=o.output,l=o.outputs,d=o.error;s&&Object.keys(s).forEach(e=>{r.map[e]||t.push(`${i}.map.${e} is missing`)}),p&&!r.map[p]&&t.push(`${i}.map.${p} is missing`),l&&Object.values(l).forEach(e=>{r.map[e]||t.push(`${i}.map.${e} is missing`)}),d&&!r.map[d]&&t.push(`${i}.map.${d} is missing`)}}),{valid:0===t.length,errors:t}}catch(e){return{valid:!1,errors:[`Validation failed: ${e.message}`]}}}var qu=c(9741),Wu=c(3981),Qu=(e,t="en-us")=>"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,a])=>[e,"object"!=typeof a||Array.isArray(a)?a:a[t]??Qu(a,t)])):e,Yu=Qu(qu.systemActionDescriptions),Xu=Object.entries(qu.systemActions).map(([e,{propertyNameType:t,property:a}])=>` - \`${e}\`: ${Yu[e]}\n${((e,t)=>{switch(e){case"defined_properties":return Object.entries(t).map(([e,t])=>` - \`${e}\`: ${JSON.stringify(t)}`).join("\n");case"property_bank":return" - `PROPERTY_BANK_DATA_NODE_*`: Value";default:return""}})(t,a)}\n`.trim()).join("\n"),Ju=Object.keys(Wu.brickMapping).map(e=>`- \`${e}\``).join("\n"),Zu=Object.keys(Wu.generatorMapping).map(e=>`- \`${e}\``).join("\n");const ec=$d.replace("[:SYSTEM_ACTIONS:]",Xu).replace("[:BRICK_IDS:]",Ju).replace("[:GENERATOR_IDS:]",Zu);var tc=(e,t)=>!t||e.tokenInfo.permissions?.includes(t)||!1,ac=c(4668),nc=c(5018),rc=c(3315),ic=c(409),oc=c(8525),sc=c(9760),pc=c(6078),lc=c(9222),dc=c(5608),uc=c(9074),cc=c(3673);var mc=c(4370);const fc=mc.default`
|
|
657
|
+
deps: ${a}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,a]=function({schema:e}){const t={},a={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:a)[n]=e[n]}return[t,a]}(e);s(e,t),p(e,a)}};function s(e,t=e.schema){const{gen:a,data:r,it:o}=e;if(0===Object.keys(t).length)return;const s=a.let("missing");for(const p in t){const l=t[p];if(0===l.length)continue;const d=(0,i.propertyInData)(a,r,p,o.opts.ownProperties);e.setParams({property:p,depsCount:l.length,deps:l.join(", ")}),o.allErrors?a.if(d,()=>{for(const t of l)(0,i.checkReportMissingProp)(e,t)}):(a.if(n._`${d} && (${(0,i.checkMissingProp)(e,l,s)})`),(0,i.reportMissingProp)(e,s),a.else())}}function p(e,t=e.schema){const{gen:a,data:n,keyword:o,it:s}=e,p=a.name("valid");for(const l in t)(0,r.alwaysValidSchema)(s,t[l])||(a.if((0,i.propertyInData)(a,n,l,s.opts.ownProperties),()=>{const t=e.subschema({keyword:o,schemaProp:l},p);e.mergeValidEvaluated(t,p)},()=>a.var(p,!0)),e.ok(p))}t.validatePropertyDeps=s,t.validateSchemaDeps=p,t.default=o},9891:(e,t,a)=>{a.d(t,{ApolloLink:()=>n.C,concat:()=>s,empty:()=>r,execute:()=>p.g,from:()=>i,split:()=>o}),a.r(t);a(9212);var n=a(9074),r=n.C.empty,i=n.C.from,o=n.C.split,s=n.C.concat,p=a(5174)},9893:e=>{function t(a,n){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(a,n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},9896:e=>{e.exports=t("fs")},9952:(e,t,a)=>{a.d(t,{P:()=>o});var n=a(5608),r=a(9074),i=a(9760),o=function(e){function t(t){void 0===t&&(t={});var a=e.call(this,(0,i.$)(t).request)||this;return a.options=t,a}return(0,n.__extends)(t,e),t}(r.C)},9968:(e,t,a)=>{var n=a(1035)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});e.exports=n}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var a=u[e]={id:e,loaded:!1,exports:{}};return d[e].call(a.exports,a,a.exports,c),a.loaded=!0,a.exports}c.m=d,c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var a in t)c.o(t,a)&&!c.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,a)=>(c.f[a](e,t),t),[])),c.u=e=>e+".js",c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),p={57:0},l=e=>{var t,a,{__webpack_esm_ids__:n,__webpack_esm_modules__:r,__webpack_esm_runtime__:i}=e,o=0;for(t in r)c.o(r,t)&&(c.m[t]=r[t]);for(i&&i(c);o<n.length;o++)a=n[o],c.o(p,a)&&p[a]&&p[a][0](),p[n[o]]=0},c.f.j=(e,t)=>{var a=c.o(p,e)?p[e]:void 0;if(0!==a)if(a)t.push(a[1]);else{var n=import("./"+c.u(e)).then(l,t=>{throw 0!==p[e]&&(p[e]=void 0),t});n=Promise.race([n,new Promise(t=>a=p[e]=[t])]),t.push(a[1]=n)}};var m={};c.r(m),c.d(m,{lI:()=>Ec,F3:()=>_c,mJ:()=>hc,AW:()=>gc,$V:()=>Tc,J6:()=>Rc,Wt:()=>vc,qq:()=>yc,gw:()=>Oc,Yi:()=>fc});var f={};c.r(f),c.d(f,{applicationFragment:()=>Ec,applicationShortFragment:()=>Ic,deviceFragment:()=>_c,deviceGroupFragment:()=>hc,deviceShortFragment:()=>wc,instanceVersionFragment:()=>gc,mediaBoxFragment:()=>Dc,mediaFileFragment:()=>Pc,mediaWorkspaceFragment:()=>Cc,moduleFragment:()=>Tc,moduleShortFragment:()=>Rc,operationFragment:()=>vc,publicApplicationBasicInfoFragment:()=>yc,userFavoriteFragment:()=>Oc,workspaceFragment:()=>Ac,workspaceShortFragment:()=>Sc});var _={};c.r(_),c.d(_,{application:()=>sm,applicationByDevice:()=>qc,applicationReleaseVersion:()=>Uc,applicationReleaseVersions:()=>$c,applicationTestsByDevice:()=>Wc,applications:()=>om,checkBindDevicePasscode:()=>Qc,devices:()=>pm,devicesByGroup:()=>Xc,devicesByUniqueId:()=>Yc,me:()=>xc,module:()=>Fc,moduleReleaseVersion:()=>Kc,moduleReleaseVersions:()=>Hc,modules:()=>Bc,publicModules:()=>zc,publicModulesByIdList:()=>Vc,workspace:()=>rm,workspacePricingPlans:()=>Jc,workspaces:()=>im});var h={};c.r(h),c.d(h,{addUserFavorite:()=>Xm,assignGroupPermissions:()=>qm,bindApplication:()=>Im,bindApplicationWithDeviceGroup:()=>Dm,changeWorkspaceAdditionalLimitSpending:()=>ef,changeWorkspaceSubscriptionPlan:()=>Zm,controlDevice:()=>Tm,createApplication:()=>bm,createApplicationWithShareVersion:()=>Am,createConfigChangeOperation:()=>$m,createDevice:()=>mm,createDeviceGroup:()=>Rm,createDeviceGroupWithApp:()=>km,createModule:()=>xm,createVirtualDevice:()=>fm,createWorkspace:()=>dm,createWorkspaceOTP:()=>tf,dispatchDeviceGroupAction:()=>vm,doOperation:()=>Um,duplicateApplication:()=>Mm,duplicateModule:()=>zm,forkApplication:()=>Lm,moveApplication:()=>jm,moveDevice:()=>hm,moveModule:()=>Bm,registerFCMNotification:()=>Wm,registerRemoteDebug:()=>Qm,removeApplication:()=>Gm,removeDevice:()=>ym,removeDeviceGroup:()=>Om,removeModule:()=>Vm,removeOperation:()=>Km,removeUserFavorite:()=>Jm,removeWorkspace:()=>Nm,revokeWorkspaceOTP:()=>af,shareAccessToken:()=>Ym,shareApplication:()=>Pm,toggleShortEditApplication:()=>wm,updateApplication:()=>Sm,updateApplicationViewportPreset:()=>Cm,updateDevice:()=>_m,updateDeviceGroup:()=>gm,updateModule:()=>Fm,updateOperation:()=>Hm,updateVirtualDevice:()=>Em,updateWorkspace:()=>um,updateWorkspaceTokens:()=>cm});var E={};c.r(E),c.d(E,{application:()=>Ef,applicationByDevice:()=>yf,applications:()=>hf,device:()=>vf,devices:()=>gf,devicesByApplication:()=>Of,mediaBox:()=>Af,mediaBoxes:()=>bf,mediaFile:()=>If,mediaFiles:()=>Sf,mediaWorkspace:()=>Nf,module:()=>Rf,modules:()=>Tf,workspace:()=>_f});var y={};c.r(y),c.d(y,{bindApplication:()=>jf,copyMediaFiles:()=>zf,createApplication:()=>Df,createModule:()=>Lf,deleteMediaBoxFiles:()=>$f,deleteMediaFiles:()=>Vf,requestFileUpload:()=>Gf,setMediaFileAsBoxPreview:()=>Bf,unbindApplication:()=>kf,updateApplication:()=>Pf,updateMediaFile:()=>xf,updateMediaFiles:()=>Ff,updateModule:()=>Mf});var T={};c.r(T),c.d(T,{mediaBox:()=>F_,mediaBoxes:()=>G_,mediaFile:()=>z_,mediaFiles:()=>B_,mediaWorkspace:()=>x_,mediaWorkspaces:()=>M_});var R={};c.r(R),c.d(R,{assignGroupPermissions:()=>Z_,copyMediaFiles:()=>X_,createMediaBox:()=>U_,createMediaWorkspace:()=>V_,deleteMediaFiles:()=>Y_,moveMediaBox:()=>H_,requestFileUpload:()=>q_,setMediaFileAsBoxPreview:()=>J_,updateMediaBox:()=>K_,updateMediaFile:()=>W_,updateMediaFiles:()=>Q_,updateMediaWorkspace:()=>$_});var g={};c.r(g),c.d(g,{mediaBox:()=>th,mediaFile:()=>nh,mediaFiles:()=>ah});var v={};c.r(v),c.d(v,{deleteMediaFiles:()=>sh,requestFileUpload:()=>rh,updateMediaFile:()=>ih,updateMediaFiles:()=>oh});var O=c(9436),N=c(5181);const{DM:b,gu:A,er:S,Ww:I,b7:w,Di:C,a2:D,uB:P,ef:j,c$:k,_V:L}=N;var M=c(8568),G=c(8765),x=c(9790);const F=t("readline");var B,z,V,$=c(700),U=new P("auth").description("Authentication and token management");U.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((B=O(function*(e,t){var a,n,r=t.profile||(0,G.getCurrentProfile)(),i=t.name,o=e;o||(console.log(M.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(M.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(M.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(o=yield(a="Enter passcode: ",n=F.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{n.question(a,t=>{n.close(),e(t.trim())})})))||(console.log(M.Ay.red("Passcode is required")),process.exit(1)));var s=(0,x.default)("Validating passcode...").start();try{var p=(0,$.createPublicClient)((0,G.getBaseUrl)()),l=yield p.checkWorkspaceOTP(o);l.valid||(s.fail(`Invalid passcode: ${l.error||"Unknown error"}`),process.exit(1)),s.text=`Exchanging passcode for token (workspace: ${l.workspaceName})...`;var d=yield p.exchangeWorkspaceOTP(o);d.token||(s.fail("Failed to obtain token"),process.exit(1));var u=(0,$.createClient)((0,G.getBaseUrl)(),d.token),c=yield u.workspace();c||(s.fail("Token validation failed"),process.exit(1)),(0,G.setToken)(r,{token:d.token,name:i||c.name,workspaceId:c._id,workspaceName:c.name}),(0,G.setCurrentProfile)(r),s.succeed(`Logged in to workspace: ${M.Ay.green(c.name)} (profile: ${M.Ay.cyan(r)})`)}catch(e){s.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return B.apply(this,arguments)})),U.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((z=O(function*(e){var t=e.profile||(0,G.getCurrentProfile)(),a=e.token,n=e.name;a||(console.error(M.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(M.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${M.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(M.Ay.gray("Select your workspace and create a new token.\n")),console.log(M.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var r=(0,x.default)("Validating token...").start();try{var i=(0,$.createClient)((0,G.getBaseUrl)(),a),o=yield i.workspace();o||(r.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,G.setToken)(t,{token:a,name:n||o.name,workspaceId:o._id,workspaceName:o.name}),(0,G.setCurrentProfile)(t),r.succeed(`Logged in to workspace: ${M.Ay.green(o.name)} (profile: ${M.Ay.cyan(t)})`)}catch(e){r.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return z.apply(this,arguments)})),U.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((V=O(function*(e){var t=e.profile;if(e.all)return(0,G.listProfiles)().forEach(e=>(0,G.removeToken)(e.name)),void console.log(M.Ay.green("All profiles removed"));var a=t||(0,G.getCurrentProfile)();(0,G.getTokenInfo)(a)?((0,G.removeToken)(a),console.log(M.Ay.green(`Logged out from profile: ${a}`))):console.log(M.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return V.apply(this,arguments)})),U.command("status").description("Show current authentication status").action(O(function*(){var e=(0,G.getCurrentProfile)(),t=(0,G.getTokenInfo)(e);if(!t)return console.log(M.Ay.yellow("Not logged in")),void console.log(M.Ay.gray("Use `bricks auth login` to login"));var a=(0,x.default)("Checking connection...").start();try{var n=(0,$.createClient)((0,G.getBaseUrl)(),t.token),r=yield n.workspace();a.stop(),console.log(M.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${M.Ay.cyan(e)}`),console.log(`Workspace: ${M.Ay.green(r.name)}`),console.log(`Workspace ID: ${M.Ay.gray(r._id)}`),console.log(`Base URL: ${M.Ay.gray((0,G.getBaseUrl)())}`),console.log(`Logged in: ${M.Ay.gray(t.createdAt)}`),console.log("─".repeat(40))}catch(e){a.fail(`Connection failed: ${e.message}`)}})),U.command("list").description("List all saved profiles").action(()=>{var e=(0,G.listProfiles)();if(0===e.length)return console.log(M.Ay.yellow("No saved profiles")),void console.log(M.Ay.gray("Use `bricks auth login` to login"));console.log(M.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?M.Ay.green("● "):" ",a=e.current?M.Ay.green(e.name):e.name;console.log(`${t}${a.padEnd(15)} ${M.Ay.gray(e.workspaceName||"Unknown")}`)}),console.log("─".repeat(60))}),U.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,G.getTokenInfo)(e);if(!t)return console.log(M.Ay.red(`Profile not found: ${e}`)),void console.log(M.Ay.gray("Use `bricks auth list` to see available profiles"));(0,G.setCurrentProfile)(e),console.log(M.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(M.Ay.gray(`Workspace: ${t.workspaceName}`))}),U.command("set-url <url>").description("Set the base URL for BRICKS API").action(e=>{(0,G.setBaseUrl)(e),console.log(M.Ay.green(`Base URL set to: ${e}`))});var H,K,q,W,Q,Y=c(7336),X=()=>{var e=(0,G.getCurrentProfile)(),t=(0,G.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,G.getBaseUrl)(),t)},J=e=>{if(!e)return M.Ay.gray("○ Unknown");var t=Date.now()-new Date(e).getTime();if(t<=3e5)return M.Ay.green("● Online");var a=Math.floor(t/6e4);if(a<60)return M.Ay.yellow(`○ Offline (${a}m ago)`);var n=Math.floor(a/60);if(n<24)return M.Ay.red(`○ Offline (${n}h ago)`);var r=Math.floor(n/24);return M.Ay.red(`○ Offline (${r}d ago)`)},Z=new P("device").description("Device management");Z.command("list").description("List all devices").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=X(),a=(0,x.default)("Fetching devices...").start();try{var n=yield t.devices({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No devices found"));console.log(M.Ay.bold("\nDevices")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=J(t),n=e.entry_detail?.application?.name||M.Ay.gray("No app bound");console.log(`${a} ${M.Ay.cyan(e.name||e.device_name)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),console.log(` App: ${n}`),console.log()})}catch(e){a.fail(`Failed to list devices: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),Z.command("get <id>").description("Get device details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=X(),n=(0,x.default)("Fetching device...").start();try{var r=yield a.device({id:e});if(n.stop(),r||(console.log(M.Ay.red("Device not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));var i=r.entry_detail?.watch_dog_timer?.last_alive_time,o=J(i);if(console.log(M.Ay.bold(`\nDevice: ${r.name||r.device_name}`)),console.log("─".repeat(60)),console.log(`Status: ${o}`),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Device Name: ${r.device_name||M.Ay.gray("N/A")}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime||"N/A")}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime||"N/A")}`),r.entry_detail){var s=r.entry_detail;if(console.log(`\n${M.Ay.bold("Entry Details")}`),console.log(`Type: ${s.type||M.Ay.gray("N/A")}`),console.log(`Unique ID: ${M.Ay.gray(s.unique_id||"N/A")}`),console.log(`Version: ${s.operation_version||M.Ay.gray("N/A")}`),console.log(`Mode: ${s.operation_mode||M.Ay.gray("N/A")}`),Array.isArray(s.screen)&&s.screen.length>0)console.log(`\n${M.Ay.bold("Screens")} (${s.screen.length})`),s.screen.forEach((e,t)=>{var a=e.resolution,n=a?`${a.width}x${a.height} @${a.scale}x`:"N/A",r=e.master?M.Ay.green(" (master)"):"",i=e.orientation?` [${e.orientation}]`:"",o=e.touch?.available?M.Ay.cyan(` touch:${e.touch.touch_point}pt`):"";console.log(` ${t+1}. ${e.title||"Screen"}${r}${i} - ${n}${o}`)});else if(s.screen?.resolution){var p=s.screen.resolution;console.log(`Resolution: ${p.width}x${p.height} @${p.scale}x`)}var l=null!=s.memory_usage,d=null!=s.disk_usage;if(l||d){if(console.log(`\n${M.Ay.bold("System Resources")}`),l){var u=Array.isArray(s.memory_usage)?s.memory_usage[0]:s.memory_usage,c=Math.round(100*u),m=M.Ay.green;c>80?m=M.Ay.red:c>60&&(m=M.Ay.yellow),console.log(`Memory: ${m(`${c}%`)}`)}if(d){var f=Array.isArray(s.disk_usage)?s.disk_usage[0]:s.disk_usage,_=Math.round(100*f),h=M.Ay.green;_>90?h=M.Ay.red:_>75&&(h=M.Ay.yellow),console.log(`Disk: ${h(`${_}%`)}`)}}var E=[];if(s.sound?.available&&E.push("Sound"),s.camera?.available&&E.push("Camera"),s.audio_in?.available&&E.push("Audio Input"),E.length>0&&(console.log(`\n${M.Ay.bold("Capabilities")}`),console.log(`Available: ${E.join(", ")}`),s.camera?.channel?.length>0&&s.camera.channel.forEach(e=>{var t=e.resolution?`${e.resolution.width}x${e.resolution.height}`:"";console.log(` Camera: ${e.title||"Camera"} ${t} [${e.orientation||"N/A"}]`)})),s.local_sync){var y=s.local_sync;console.log(`\n${M.Ay.bold("Local Sync")}`),console.log(`Role: ${y.is_main?M.Ay.cyan("Main"):"Secondary"}`),null!=y.peer_count&&console.log(`Peers: ${y.peer_count}`),null!=y.mean_latency&&console.log(`Latency: ${y.mean_latency.toFixed(2)}ms`)}if(s.update){var T=s.update;console.log(`\n${M.Ay.bold("Update Status")}`),console.log(`Needs Update: ${T.need_update?M.Ay.yellow("Yes"):M.Ay.green("No")}`),T.current_version&&console.log(`App Version: ${T.current_version}`),T.running_mode&&console.log(`Running Mode: ${T.running_mode}`),T.last_update_at&&console.log(`Last Update: ${M.Ay.gray(T.last_update_at)}`)}if(s.watch_dog_timer){var R=s.watch_dog_timer;console.log(`\n${M.Ay.bold("Watchdog")}`),console.log(`Alive: ${R.alive?M.Ay.green("Yes"):M.Ay.red("No")}`),R.last_launch_time&&console.log(`Last Launch: ${M.Ay.gray(R.last_launch_time)}`),R.last_alive_time&&console.log(`Last Alive: ${M.Ay.gray(R.last_alive_time)}`)}}r.bound_application&&(console.log(`\n${M.Ay.bold("Bound Application")}`),console.log(`Name: ${r.bound_application.name}`),console.log(`ID: ${M.Ay.gray(r.bound_application._id)}`)),r.env?.variables&&Object.keys(r.env.variables).length>0&&(console.log(`\n${M.Ay.bold("Environment Variables")}`),Object.entries(r.env.variables).forEach(([e,t])=>{console.log(` ${M.Ay.cyan(e)}: ${t}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),Z.command("bind <passcode>").description("Bind a new device using passcode").option("-n, --name <name>","Device name").action(function(){var e=O(function*(e,t){var a=X(),n=(0,x.default)("Checking passcode...").start();try{var r=yield a.checkBindDevicePasscode({passcode:e});r||(n.fail("Invalid passcode or expired"),process.exit(1)),n.text="Binding device...";var i=yield a.createDevice({bindPasscode:e,name:t.name||r.payload?.deviceName||"CLI Device",deviceName:r.payload?.deviceName});n.succeed(`Device bound successfully: ${M.Ay.green(i.name)}`),console.log(M.Ay.gray(`Device ID: ${i._id}`))}catch(e){n.fail(`Failed to bind device: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),Z.command("control <id> <type>").description("Control a device").option("-p, --payload <json>","Event payload as JSON").action((H=O(function*(e,t,a){var n=X(),r=(0,x.default)(`Sending ${t} to device...`).start();try{var i;a.payload&&(i=JSON.parse(a.payload)),yield n.controlDevice({id:e,type:t,eventPayload:i}),r.succeed(`Control event sent: ${M.Ay.green(t)}`)}catch(e){r.fail(`Failed to control device: ${e.message}`),process.exit(1)}}),function(e,t,a){return H.apply(this,arguments)})),Z.command("refresh <id>").description("Refresh device application").action((K=O(function*(e){var t=X(),a=(0,x.default)("Refreshing device...").start();try{yield t.controlDevice({id:e,type:"refresh"}),a.succeed("Device refreshed")}catch(e){a.fail(`Failed to refresh device: ${e.message}`),process.exit(1)}}),function(e){return K.apply(this,arguments)})),Z.command("clear-cache <id>").description("Clear device cache").action((q=O(function*(e){var t=X(),a=(0,x.default)("Clearing cache...").start();try{yield t.controlDevice({id:e,type:"clear-cache"}),a.succeed("Cache cleared")}catch(e){a.fail(`Failed to clear cache: ${e.message}`),process.exit(1)}}),function(e){return q.apply(this,arguments)})),Z.command("screenshot <id>").description("Take device screenshot and save to file").option("-o, --output <path>","Output file path").option("--no-take","Only fetch existing screenshot without taking a new one").action((W=O(function*(e,t){var a=X(),n=(0,x.default)("Fetching workspace info...").start();try{var r=yield a.workspace();r?.media_resource?.enable_media_workspace||(n.fail("Media workspace is not enabled for this workspace"),process.exit(1)),r.media_resource.system_media_box_id||(n.fail("No media box configured for this workspace"),process.exit(1)),!1!==t.take&&(n.text="Sending screenshot request to device...",yield a.controlDevice({id:e,type:"take-screenshot"}),n.text="Waiting for device to capture screenshot...",yield new Promise(e=>setTimeout(e,3e3))),n.text="Fetching screenshot...";var i=yield(0,Y.he)(a,r,e,t.output);if(i.error&&(n.fail(i.error),process.exit(1)),n.succeed("Screenshot saved"),console.log(),console.log(M.Ay.bold("Screenshot saved to:")),console.log(M.Ay.cyan(i.path)),console.log(),i.file?.meta){var o=i.file.meta,s=o.originalWidth,p=o.originalHeight,l=o.originalFileSize;if(s&&p&&console.log(`${M.Ay.gray("Size:")} ${s}x${p}`),l){var d=(l/1024).toFixed(1);console.log(`${M.Ay.gray("File:")} ${d} KB`)}}i.file?.updatedAt&&console.log(`${M.Ay.gray("Updated:")} ${new Date(i.file.updatedAt).toLocaleString()}`)}catch(e){n.fail(`Failed to get screenshot: ${e.message}`),process.exit(1)}}),function(e,t){return W.apply(this,arguments)})),Z.command("monitor").description("Monitor device status (polls every 60s)").option("-g, --group <id>","Monitor devices in a group").option("-i, --interval <seconds>","Polling interval in seconds","60").action((Q=O(function*(e){var t=X(),a=1e3*parseInt(e.interval,10);console.log(M.Ay.bold("\nDevice Monitor")),console.log(M.Ay.gray(`Polling every ${e.interval}s. Press Ctrl+C to stop.\n`));var n,r=(n=O(function*(){try{var a;if(a=e.group?yield t.devicesByGroup({id:e.group}):yield t.devices({}),process.stdout.write("[2J[0f"),console.log(M.Ay.bold("Device Monitor")+M.Ay.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!a||0===a.length)return void console.log(M.Ay.yellow("No devices found"));a.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=J(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");console.log(`${a} ${M.Ay.cyan(n.padEnd(25))} ${r}`)}),console.log(`\n${M.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(M.Ay.red(`Error: ${e.message}`))}}),function(){return n.apply(this,arguments)});yield r(),setInterval(r,a)}),function(e){return Q.apply(this,arguments)}));var ee,te,ae=c(9896),ne=c(5704),re=()=>{var e=(0,G.getCurrentProfile)(),t=(0,G.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,G.getBaseUrl)(),t)},ie=new P("app").description("Application management");ie.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=re(),a=(0,x.default)("Fetching applications...").start();try{var n=yield t.applications({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No applications found"));console.log(M.Ay.bold("\nApplications")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.has_unreleased_changes?M.Ay.yellow("●"):M.Ay.green("●"),a=e.current_version?`v${e.current_version}`:M.Ay.gray("no version");console.log(`${t} ${M.Ay.cyan(e.name)} ${M.Ay.gray(a)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list applications: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ie.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=(0,x.default)("Fetching application...").start();try{var r=yield a.application({id:e,composed:t.composed});if(n.stop(),r||(console.log(M.Ay.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(M.Ay.bold(`\nApplication: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),console.log(`\n${M.Ay.bold("Version")}`),r.current_version){if(console.log(`Current: v${r.current_version}`),r.current_version_details){var i=r.current_version_details;i.name&&console.log(`Release Name: ${i.name}`),i.note&&console.log(`Release Note: ${M.Ay.gray(i.note)}`),i.create_datetime&&console.log(`Released At: ${M.Ay.gray(i.create_datetime)}`)}}else console.log(`Current: ${M.Ay.gray("No version")}`);if(console.log(`Unreleased: ${r.has_unreleased_changes?M.Ay.yellow("Yes"):M.Ay.green("No")}`),console.log(`\n${M.Ay.bold("Features")}`),console.log(`Short Edit: ${r.short_edit?.enabled?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var o=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${o} editable properties`)}console.log(`Automation: ${r.canvas_control?.enable_schedule?M.Ay.green("Scheduled"):M.Ay.gray("No schedule")}`),r.lock?.locked&&console.log(`Locked: ${M.Ay.yellow("Yes")} (at ${r.lock.locked_at||"N/A"})`),r.sync_key&&console.log(`Sync Key: ${M.Ay.gray(r.sync_key)}`),r.devices?.length>0?(console.log(`\n${M.Ay.bold("Bound Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t="active"===e.status?M.Ay.green("●"):M.Ay.gray("○"),a=e.frame?M.Ay.gray(` [${e.frame.x||0},${e.frame.y||0} ${e.frame.width}x${e.frame.height}]`):"";console.log(` ${t} ${e.device_id}${a}`)})):console.log(`\n${M.Ay.bold("Bound Devices")}: ${M.Ay.gray("None")}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("update <id>").description("Update application").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-c, --config <json>","Application config as JSON string").option("-f, --file <path>","Application config from file").option("--validate","Validate configuration").action(function(){var e=O(function*(e,t){var a=re(),n=(0,x.default)("Updating application...").start();try{var r={id:e};t.name&&(r.name=t.name),t.description&&(r.description=t.description),t.validate&&(r.validateConfig=!0),t.config?r.config=t.config:t.file&&(r.config=ae.readFileSync(t.file,"utf-8"));var i=yield a.updateApplication(r);n.succeed(`Application updated: ${M.Ay.green(i.name)}`),i.has_unreleased_changes&&console.log(M.Ay.yellow("Note: Application has unreleased changes"))}catch(e){n.fail(`Failed to update application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action(function(){var e=O(function*(e,t){var a=re(),n=(0,x.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield a.shortEditApplication({id:e,list:r});n.succeed(`Short edit applied to: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("short-refs <id>").description("List short edit references for an application").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=(0,x.default)("Fetching short edit references...").start();try{var r=yield a.application({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(M.Ay.yellow("Short Edit is not enabled for this application"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,ne.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(M.Ay.yellow("No short edit references found"));console.log(M.Ay.bold(`\nShort Edit References: ${r.name}`)),o.forEach(e=>{console.log(M.Ay.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?M.Ay.gray(`- ${t.title}`):"";console.log(` ${M.Ay.green(e)} ${a}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").action(function(){var e=O(function*(e,t){var a=re(),n=(0,x.default)("Updating device bindings...").start();try{var r={id:e};t.bind&&(r.bindDevices=t.bind.split(",").map(e=>e.trim())),t.unbind&&(r.unbindDevices=t.unbind.split(",").map(e=>e.trim())),yield a.bindApplication(r),n.succeed("Device bindings updated")}catch(e){n.fail(`Failed to update bindings: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action(function(){var e=O(function*(e,t,a){var n=re(),r=(0,x.default)("Triggering automation...").start();try{yield n.triggerApplicationCanvasControl({id:e,testId:t,play:!a.stop&&a.play,setupAtLaunch:a.setupAtLaunch,matchGroup:a.matchGroup}),r.succeed(`Automation triggered: ${M.Ay.green(t)}`)}catch(e){r.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}});return function(t,a,n){return e.apply(this,arguments)}}()),ie.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=re(),n=t.json?null:(0,x.default)("Releasing application...").start();try{var r=t.config;(t.config.endsWith(".json")||t.config.includes("/"))&&(ae.existsSync(t.config)||(n?n.fail(`Config file not found: ${t.config}`):console.error(JSON.stringify({error:`Config file not found: ${t.config}`})),process.exit(1)),r=ae.readFileSync(t.config,"utf-8"));var i=yield a.application({id:e});i||(n?n.fail("Application not found"):console.error(JSON.stringify({error:"Application not found"})),process.exit(1)),i.lock?.enabled&&(n?n.fail("Application is locked"):console.error(JSON.stringify({error:"Application is locked"})),process.exit(1));var o=t.version||i.name||"Untitled",s=t.changelogs?`${t.changelogs}\n\nRelease by BRICKS CLI`:"Release by BRICKS CLI";yield a.releaseApplication({id:e,config:r,releaseCurrentVersion:o,releaseCurrentVersionNote:s}),t.json?console.log(JSON.stringify({success:!0,name:i.name})):n.succeed(`Application released: ${M.Ay.green(i.name)}`)}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to release application: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ie.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((ee=O(function*(e,t){var a=re(),n=t.json?null:(0,x.default)("Pulling application project...").start();try{var r=yield a.applicationProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Application project fetched: ${M.Ay.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return ee.apply(this,arguments)})),ie.command("project-init <id>").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((te=O(function*(e,t){var a=(yield Promise.all([c.e(356),c.e(465)]).then(c.bind(c,6465))).initProject;yield a("application",e,t)}),function(e,t){return te.apply(this,arguments)}));var oe=()=>{var e=(0,G.getCurrentProfile)(),t=(0,G.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,G.getBaseUrl)(),t)},se=new P("module").description("Module management");se.command("list").description("List all modules").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=oe(),a=(0,x.default)("Fetching modules...").start();try{var n=yield t.modules({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No modules found"));console.log(M.Ay.bold("\nModules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:M.Ay.gray("no version");console.log(`● ${M.Ay.cyan(e.name)} ${M.Ay.gray(t)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list modules: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),se.command("get <id>").description("Get module details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,x.default)("Fetching module...").start();try{var r=yield a.module({id:e});if(n.stop(),r||(console.log(M.Ay.red("Module not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(M.Ay.bold(`\nModule: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),console.log(`\n${M.Ay.bold("Version")}`),console.log(`Current: ${r.current_version?`v${r.current_version}`:M.Ay.gray("No version")}`),console.log(`Unreleased: ${r.has_unreleased_changes?M.Ay.yellow("Yes"):M.Ay.green("No")}`),console.log(`\n${M.Ay.bold("Settings")}`),console.log(`Public: ${r.is_public?M.Ay.green("Yes"):M.Ay.gray("No")}`),console.log(`Allow Modify: ${r.is_allow_modify?M.Ay.green("Yes"):M.Ay.gray("No")}`),console.log(`Short Edit: ${r.short_edit?.enabled?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var i=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${i} editable properties`)}null!=r.use_count?.total_count&&(console.log(`\n${M.Ay.bold("Usage")}`),console.log(`Used In: ${r.use_count.total_count} application(s)`)),r.expose_properties?.length>0&&(console.log(`\n${M.Ay.bold("Exposed Properties")} (${r.expose_properties.length})`),r.expose_properties.forEach(e=>{console.log(` - ${M.Ay.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("update <id>").description("Update module").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,x.default)("Updating module...").start();try{var r={id:e};t.name&&(r.name=t.name),t.description&&(r.description=t.description),t.validate&&(r.validateConfig=!0),t.config?r.config=t.config:t.file&&(r.config=ae.readFileSync(t.file,"utf-8"));var i=yield a.updateModule(r);n.succeed(`Module updated: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to update module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,x.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield a.shortEditModule({id:e,list:r});n.succeed(`Short edit applied to: ${M.Ay.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=(0,x.default)("Fetching short edit references...").start();try{var r=yield a.module({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(M.Ay.yellow("Short Edit is not enabled for this module"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,ne.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(M.Ay.yellow("No short edit references found"));console.log(M.Ay.bold(`\nShort Edit References: ${r.name}`)),o.forEach(e=>{console.log(M.Ay.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?M.Ay.gray(`- ${t.title}`):"";console.log(` ${M.Ay.green(e)} ${a}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=oe(),n=t.json?null:(0,x.default)("Releasing module...").start();try{var r=t.config;(t.config.endsWith(".json")||t.config.includes("/"))&&(ae.existsSync(t.config)||(n?n.fail(`Config file not found: ${t.config}`):console.error(JSON.stringify({error:`Config file not found: ${t.config}`})),process.exit(1)),r=ae.readFileSync(t.config,"utf-8"));var i=yield a.module({id:e});i||(n?n.fail("Module not found"):console.error(JSON.stringify({error:"Module not found"})),process.exit(1)),i.is_public&&(n?n.fail("Public module deployment is temporarily not recommended"):console.error(JSON.stringify({error:"Public module deployment is temporarily not recommended"})),process.exit(1));var o=t.version||i.name||"Untitled",s=t.changelogs?`${t.changelogs}\n\nRelease by BRICKS CLI`:"Release by BRICKS CLI";yield a.releaseModule({id:e,config:r,releaseCurrentVersion:o,releaseCurrentVersionNote:s}),t.json?console.log(JSON.stringify({success:!0,name:i.name})):n.succeed(`Module released: ${M.Ay.green(i.name)}`)}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to release module: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action(function(){var e=O(function*(e,t){var a=oe(),n=t.json?null:(0,x.default)("Pulling module project...").start();try{var r=yield a.moduleProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Module project fetched: ${M.Ay.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),se.command("project-init <id>").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action(function(){var e=O(function*(e,t){var a=(yield Promise.all([c.e(356),c.e(465)]).then(c.bind(c,6465))).initProject;yield a("module",e,t)});return function(t,a){return e.apply(this,arguments)}}());var pe=c(8832),le=()=>{var e=(0,G.getCurrentProfile)(),t=(0,G.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,G.getBaseUrl)(),t)},de=3e5,ue=e=>{if(!e)return M.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=de?M.Ay.green("●"):Math.floor(t/6e4)<60?M.Ay.yellow("○"):M.Ay.red("○")},ce=new P("group").description("Device Group management");ce.command("list").description("List all device groups").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=le(),a=(0,x.default)("Fetching device groups...").start();try{var n=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No device groups found"));console.log(M.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${M.Ay.cyan(e.name)} ${M.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${M.Ay.gray(e._id)}`),e.description&&console.log(` ${M.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ce.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=le(),n=(0,x.default)("Fetching device group...").start();try{var r=yield a.deviceGroup({id:e});if(n.stop(),r||(console.log(M.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nDevice Group: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r._id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.create_datetime)}`),console.log(`Modified: ${M.Ay.gray(r.last_modify_datetime)}`),r.devices?.length>0&&(console.log(`\n${M.Ay.bold("Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${M.Ay.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get group: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=le(),n=(0,x.default)("Fetching devices...").start();try{var r=yield a.devicesByGroup({id:e});if(n.stop(),t.json)return void console.log(JSON.stringify(r,null,2));if(!r||0===r.length)return void console.log(M.Ay.yellow("No devices in this group"));console.log(M.Ay.bold("\nDevices in Group")),console.log("─".repeat(80)),r.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=ue(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");console.log(`${a} ${M.Ay.cyan(n.padEnd(30))} ${r}`)}),console.log("─".repeat(80))}catch(e){n.fail(`Failed to get devices: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("dispatch <id> <action>").description("Dispatch action to all devices in group").action(function(){var e=O(function*(e,t){var a=le(),n=(0,x.default)(`Dispatching ${t}...`).start(),r=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"];r.includes(t)||(n.fail(`Invalid action. Valid actions: ${r.join(", ")}`),process.exit(1));try{var i=yield a.dispatchDeviceGroupAction({id:e,action:t});n.succeed(`Action dispatched: ${M.Ay.green(t)}`),i&&(console.log(`Success: ${M.Ay.green(i.success||0)}`),console.log(`Failed: ${M.Ay.red(i.failed||0)}`))}catch(e){n.fail(`Failed to dispatch action: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),ce.command("refresh <id>").description("Refresh all devices in group").action(function(){var e=O(function*(e){var t=le(),a=(0,x.default)("Refreshing devices...").start();try{var n=yield t.dispatchDeviceGroupAction({id:e,action:"refresh"});a.succeed("Devices refreshed"),n&&(console.log(`Success: ${M.Ay.green(n.success||0)}`),console.log(`Failed: ${M.Ay.red(n.failed||0)}`))}catch(e){a.fail(`Failed to refresh: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),ce.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action(function(){var e=O(function*(e,t){var a=le(),n=1e3*parseInt(t.interval,10);console.log(M.Ay.bold("\nDevice Group Monitor")),console.log(M.Ay.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.\n`));var r=function(){var t=O(function*(){try{var t=yield Promise.all([a.deviceGroup({id:e}),a.devicesByGroup({id:e})]),n=pe(t,2),r=n[0],i=n[1];if(process.stdout.write("[2J[0f"),console.log(M.Ay.bold(`Device Group: ${r.name}`)+M.Ay.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!i||0===i.length)return void console.log(M.Ay.yellow("No devices in this group"));var o=0,s=0;i.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=ue(t),n=e.name||e.device_name||e.device_target_name,r=e.entry_detail?.application?.name||M.Ay.gray("No app");t&&Date.now()-new Date(t).getTime()<=de?o++:s++,console.log(`${a} ${M.Ay.cyan(n.padEnd(30))} ${r}`)}),console.log("─".repeat(80)),console.log(`Online: ${M.Ay.green(o)} Offline: ${M.Ay.red(s)}`),console.log(`\n${M.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(M.Ay.red(`Error: ${e.message}`))}});return function(){return t.apply(this,arguments)}}();yield r(),setInterval(r,n)});return function(t,a){return e.apply(this,arguments)}}());var me=()=>{var e=(0,G.getCurrentProfile)(),t=(0,G.getToken)(e);return t||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,$.createClient)((0,G.getBaseUrl)(),t)},fe=function(){var e=O(function*(e){var t=yield e.workspace();if(!(0,Y.wR)(t))throw new Error("Media workspace not enabled for this workspace")});return function(t){return e.apply(this,arguments)}}(),_e=new P("media").description("Media Flow support");_e.command("boxes").description("List Media Flow boxes").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=me(),a=(0,x.default)("Fetching media boxes...").start();try{yield fe(t);var n=yield t.mediaBoxes();if(a.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(M.Ay.yellow("No media boxes found"));console.log(M.Ay.bold("\nMedia Boxes")),console.log("─".repeat(80)),n.forEach(e=>{console.log(`${M.Ay.cyan(e.name||"Unnamed")} ${M.Ay.gray(e.id)}`),e.description&&console.log(` ${e.description}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),null!=e.size&&console.log(` Size: ${e.size}`),console.log()})}catch(e){a.fail(`Failed to list media boxes: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),_e.command("box <id>").description("Get Media Flow box details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,x.default)("Fetching media box...").start();try{yield fe(a);var r=yield a.mediaBox({id:e});if(n.stop(),r||(console.log(M.Ay.red("Media box not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nMedia Box: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r.id)}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||M.Ay.gray("None")}`),null!=r.size&&console.log(`Size: ${r.size}`),r.passcodes?.length&&(console.log(`\n${M.Ay.bold("Passcodes")}`),r.passcodes.forEach(e=>{console.log(`- ${e.name||"Passcode"}: ${e.code}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get media box: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),_e.command("files <boxId>").description("List Media Flow files in a box").option("-t, --types <types>","Comma-separated file types to include").option("-u, --user-tag <tag>","Filter by user tag (repeatable)",(e,t)=>[...t,e],[]).option("-l, --limit <limit>","Limit results",e=>Number.parseInt(e,10)).option("-o, --offset <offset>","Offset results",e=>Number.parseInt(e,10)).option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,x.default)("Fetching media files...").start();try{yield fe(a);var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):void 0,i=t.userTag?.length?t.userTag:void 0,o=yield a.mediaFiles({boxId:e,includeTypes:r,userTags:i,limit:t.limit,offset:t.offset});if(n.stop(),t.json)return void console.log(JSON.stringify(o,null,2));if(!o||0===o.length)return void console.log(M.Ay.yellow("No media files found"));console.log(M.Ay.bold(`\nMedia Files (${o.length})`)),console.log("─".repeat(100)),o.forEach(e=>{console.log(`${M.Ay.cyan(e.name||"Unnamed")} ${M.Ay.gray(e.id)}`),console.log(` Type: ${e.fileType}`),e.userTags?.length&&console.log(` Tags: ${e.userTags.join(", ")}`),e.updatedAt&&console.log(` Updated: ${new Date(e.updatedAt).toLocaleString()}`),console.log()})}catch(e){n.fail(`Failed to list media files: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}()),_e.command("file <id>").description("Get Media Flow file details").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e,t){var a=me(),n=(0,x.default)("Fetching media file...").start();try{yield fe(a);var r=yield a.mediaFile({id:e});if(n.stop(),r||(console.log(M.Ay.red("Media file not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(M.Ay.bold(`\nMedia File: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${M.Ay.gray(r.id)}`),console.log(`Box ID: ${M.Ay.gray(r.boxId)}`),console.log(`Type: ${r.fileType}`),console.log(`Description: ${r.description||M.Ay.gray("N/A")}`),console.log(`Tags: ${r.userTags?.join(", ")||M.Ay.gray("None")}`),console.log(`Created: ${M.Ay.gray(r.createdAt||"N/A")}`),console.log(`Updated: ${M.Ay.gray(r.updatedAt||"N/A")}`);var i=(0,Y.Gu)(r),o=(0,Y.Gu)(r,{preferThumbnail:!0});r.meta?.originalFileKey&&console.log(`Original Key: ${M.Ay.gray(r.meta.originalFileKey)}`),i&&console.log(`Original URL: ${M.Ay.gray(i)}`),o&&o!==i&&console.log(`Thumbnail URL: ${M.Ay.gray(o)}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get media file: ${e.message}`),process.exit(1)}});return function(t,a){return e.apply(this,arguments)}}());var he,Ee,ye={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},Te=e=>{var t=Object.entries(ye).find(([,t])=>e===t);return t?t[0]:null},Re=new P("config").description("CLI configuration management");Re.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set the API endpoint environment").action(e=>{var t=(0,G.getBaseUrl)(),a=Te(t);if(!e)return console.log(M.Ay.bold("\nAPI Endpoint Configuration")),console.log("─".repeat(50)),console.log(`Current URL: ${M.Ay.cyan(t)}`),a?console.log(`Environment: ${M.Ay.green(a)}`):console.log(`Environment: ${M.Ay.yellow("custom")}`),console.log("─".repeat(50)),console.log(M.Ay.gray("\nAvailable environments:")),Object.entries(ye).forEach(([e,a])=>{var n=t===a?M.Ay.green("● "):" ",r=t===a?M.Ay.green(e):e;console.log(`${n}${r.padEnd(8)} ${M.Ay.gray(a)}`)}),console.log(""),void console.log(M.Ay.gray("Usage: bricks config endpoint <prod|beta|dev>"));var n=Object.keys(ye);n.includes(e)||(console.error(M.Ay.red(`Invalid environment: ${e}`)),console.log(M.Ay.gray(`Valid options: ${n.join(", ")}`)),process.exit(1));var r=ye[e];t!==r?((0,G.setBaseUrl)(r),console.log(M.Ay.green(`✓ Endpoint changed to ${e}: ${r}`)),console.log(M.Ay.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(M.Ay.gray("Use `bricks auth status` to check your connection."))):console.log(M.Ay.yellow(`Already using ${e} environment: ${r}`))}),Re.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,G.getBaseUrl)(),a=Te(t);e.json?console.log(JSON.stringify({endpoint:t,environment:a||"custom"},null,2)):(console.log(M.Ay.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`API Endpoint: ${M.Ay.cyan(t)}`),a?console.log(`Environment: ${M.Ay.green(a)}`):console.log(`Environment: ${M.Ay.yellow("custom")}`),console.log("─".repeat(50)))}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(he||(he={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Ee||(Ee={}));const ge=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ve=e=>{switch(typeof e){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(e)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(e)?ge.array:null===e?ge.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ge.promise:"undefined"!=typeof Map&&e instanceof Map?ge.map:"undefined"!=typeof Set&&e instanceof Set?ge.set:"undefined"!=typeof Date&&e instanceof Date?ge.date:ge.object;default:return ge.unknown}},Oe=he.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ne extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,n=0;for(;n<r.path.length;){const a=r.path[n];n===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(e){if(!(e instanceof Ne))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,he.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}Ne.create=e=>new Ne(e);const be=(e,t)=>{let a;switch(e.code){case Oe.invalid_type:a=e.received===ge.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,he.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:a=`Unrecognized key(s) in object: ${he.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:a="Invalid input";break;case Oe.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${he.joinValues(e.options)}`;break;case Oe.invalid_enum_value:a=`Invalid enum value. Expected ${he.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:a="Invalid function arguments";break;case Oe.invalid_return_type:a="Invalid function return type";break;case Oe.invalid_date:a="Invalid date";break;case Oe.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:he.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Oe.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Oe.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Oe.custom:a="Invalid input";break;case Oe.invalid_intersection_types:a="Intersection results could not be merged";break;case Oe.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:a="Number must be finite";break;default:a=t.defaultError,he.assertNever(e)}return{message:a}};let Ae=be;function Se(){return Ae}var Ie;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Ie||(Ie={}));const we=e=>{const{data:t,path:a,errorMaps:n,issueData:r}=e,i=[...a,...r.path||[]],o={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let s="";const p=n.filter(e=>!!e).slice().reverse();for(const e of p)s=e(o,{data:t,defaultError:s}).message;return{...r,path:i,message:s}};function Ce(e,t){const a=Se(),n=we({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===be?void 0:be].filter(e=>!!e)});e.common.issues.push(n)}class De{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return Pe;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return De.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return Pe;if("aborted"===r.status)return Pe;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const Pe=Object.freeze({status:"aborted"}),je=e=>({status:"dirty",value:e}),ke=e=>({status:"valid",value:e}),Le=e=>"aborted"===e.status,Me=e=>"dirty"===e.status,Ge=e=>"valid"===e.status,xe=e=>"undefined"!=typeof Promise&&e instanceof Promise;class Fe{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Be=(e,t)=>{if(Ge(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ne(e.common.issues);return this._error=t,this._error}}};function ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:r}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??r.defaultError}:void 0===r.data?{message:i??n??r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:i??a??r.defaultError}},description:r}}class Ve{get description(){return this._def.description}_getType(e){return ve(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new De,ctx:{common:e.parent.common,data:e.data,parsedType:ve(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},n=this._parseSync({data:e,path:a.path,parent:a});return Be(a,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Ge(a)?{value:a.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Ge(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ve(e)},n=this._parse({data:e,path:a.path,parent:a}),r=await(xe(n)?n:Promise.resolve(n));return Be(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{const r=e(t),i=()=>n.addIssue({code:Oe.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(i(),!1)):!!r||(i(),!1)})}refinement(e,t){return this._refinement((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1))}_refinement(e){return new Bt({schema:this,typeName:Qt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return zt.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bt.create(this)}promise(){return Ft.create(this,this._def)}or(e){return It.create([this,e],this._def)}and(e){return Ct.create(this,e,this._def)}transform(e){return new Bt({...ze(this._def),schema:this,typeName:Qt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $t({...ze(this._def),innerType:this,defaultValue:t,typeName:Qt.ZodDefault})}brand(){return new Kt({typeName:Qt.ZodBranded,type:this,...ze(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ut({...ze(this._def),innerType:this,catchValue:t,typeName:Qt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return qt.create(this,e)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $e=/^c[^\s-]{8,}$/i,Ue=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ke=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qe=/^[a-z0-9_-]{21}$/i,We=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ye=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Xe;const Je=/^(?:(?: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])$/,Ze=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,et=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,at=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rt="((\\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])))",it=new RegExp(`^${rt}$`);function ot(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function st(e){return new RegExp(`^${ot(e)}$`)}function pt(e){let t=`${rt}T${ot(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function lt(e,t){return!("v4"!==t&&t||!Je.test(e))||!("v6"!==t&&t||!et.test(e))}function dt(e,t){if(!We.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(n));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===r?.typ)&&(!!r.alg&&(!t||r.alg===t)))}catch{return!1}}function ut(e,t){return!("v4"!==t&&t||!Ze.test(e))||!("v6"!==t&&t||!tt.test(e))}class ct extends Ve{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ge.string){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.string,received:t.parsedType}),Pe}const t=new De;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const r=e.data.length>n.value,i=e.data.length<n.value;(r||i)&&(a=this._getOrReturnCtx(e,a),r?Ce(a,{code:Oe.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&Ce(a,{code:Oe.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)Ye.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"email",code:Oe.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)Xe||(Xe=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"emoji",code:Oe.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)Ke.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"uuid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)qe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"nanoid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)$e.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cuid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)Ue.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cuid2",code:Oe.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)He.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"ulid",code:Oe.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),Ce(a,{validation:"url",code:Oe.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"regex",code:Oe.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){pt(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){it.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){st(n).test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?Qe.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"duration",code:Oe.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?lt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"ip",code:Oe.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?dt(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"jwt",code:Oe.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ut(e.data,n.version)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"cidr",code:Oe.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?at.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"base64",code:Oe.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?nt.test(e.data)||(a=this._getOrReturnCtx(e,a),Ce(a,{validation:"base64url",code:Oe.invalid_string,message:n.message}),t.dirty()):he.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:Oe.invalid_string,...Ie.errToObj(a)})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ie.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ie.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ie.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ie.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ie.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...Ie.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ie.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ie.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Ie.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ie.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ie.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ie.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ie.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ie.errToObj(t)})}nonempty(e){return this.min(1,Ie.errToObj(e))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function mt(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ct.create=e=>new ct({checks:[],typeName:Qt.ZodString,coerce:e?.coerce??!1,...ze(e)});class ft extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ge.number){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.number,received:t.parsedType}),Pe}let t;const a=new De;for(const n of this._def.checks)if("int"===n.kind)he.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==mt(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_finite,message:n.message}),a.dirty()):he.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,a,n){return new ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ie.toString(n)}]})}_addCheck(e){return new ft({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&he.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ft.create=e=>new ft({checks:[],typeName:Qt.ZodNumber,coerce:e?.coerce||!1,...ze(e)});class _t extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ge.bigint)return this._getInvalidInput(e);let t;const a=new De;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ce(t,{code:Oe.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):he.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.bigint,received:t.parsedType}),Pe}gte(e,t){return this.setLimit("min",e,!0,Ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ie.toString(t))}setLimit(e,t,a,n){return new _t({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ie.toString(n)}]})}_addCheck(e){return new _t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ie.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}_t.create=e=>new _t({checks:[],typeName:Qt.ZodBigInt,coerce:e?.coerce??!1,...ze(e)});class ht extends Ve{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ge.boolean){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.boolean,received:t.parsedType}),Pe}return ke(e.data)}}ht.create=e=>new ht({typeName:Qt.ZodBoolean,coerce:e?.coerce||!1,...ze(e)});class Et extends Ve{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ge.date){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.date,received:t.parsedType}),Pe}if(Number.isNaN(e.data.getTime())){return Ce(this._getOrReturnCtx(e),{code:Oe.invalid_date}),Pe}const t=new De;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),Ce(a,{code:Oe.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):he.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Et({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ie.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ie.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Et.create=e=>new Et({checks:[],coerce:e?.coerce||!1,typeName:Qt.ZodDate,...ze(e)});class yt extends Ve{_parse(e){if(this._getType(e)!==ge.symbol){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.symbol,received:t.parsedType}),Pe}return ke(e.data)}}yt.create=e=>new yt({typeName:Qt.ZodSymbol,...ze(e)});class Tt extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.undefined,received:t.parsedType}),Pe}return ke(e.data)}}Tt.create=e=>new Tt({typeName:Qt.ZodUndefined,...ze(e)});class Rt extends Ve{_parse(e){if(this._getType(e)!==ge.null){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.null,received:t.parsedType}),Pe}return ke(e.data)}}Rt.create=e=>new Rt({typeName:Qt.ZodNull,...ze(e)});class gt extends Ve{constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}}gt.create=e=>new gt({typeName:Qt.ZodAny,...ze(e)});class vt extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}}vt.create=e=>new vt({typeName:Qt.ZodUnknown,...ze(e)});class Ot extends Ve{_parse(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.never,received:t.parsedType}),Pe}}Ot.create=e=>new Ot({typeName:Qt.ZodNever,...ze(e)});class Nt extends Ve{_parse(e){if(this._getType(e)!==ge.undefined){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.void,received:t.parsedType}),Pe}return ke(e.data)}}Nt.create=e=>new Nt({typeName:Qt.ZodVoid,...ze(e)});class bt extends Ve{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==ge.array)return Ce(t,{code:Oe.invalid_type,expected:ge.array,received:t.parsedType}),Pe;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(Ce(t,{code:e?Oe.too_big:Oe.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Ce(t,{code:Oe.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Ce(t,{code:Oe.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new Fe(t,e,t.path,a)))).then(e=>De.mergeArray(a,e));const r=[...t.data].map((e,a)=>n.type._parseSync(new Fe(t,e,t.path,a)));return De.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new bt({...this._def,minLength:{value:e,message:Ie.toString(t)}})}max(e,t){return new bt({...this._def,maxLength:{value:e,message:Ie.toString(t)}})}length(e,t){return new bt({...this._def,exactLength:{value:e,message:Ie.toString(t)}})}nonempty(e){return this.min(1,e)}}function At(e){if(e instanceof St){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=zt.create(At(n))}return new St({...e._def,shape:()=>t})}return e instanceof bt?new bt({...e._def,type:At(e.element)}):e instanceof zt?zt.create(At(e.unwrap())):e instanceof Vt?Vt.create(At(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(e=>At(e))):e}bt.create=(e,t)=>new bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qt.ZodArray,...ze(t)});class St extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=he.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ge.object){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.object,received:t.parsedType}),Pe}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ot&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||i.push(e);const o=[];for(const e of r){const t=n[e],r=a.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new Fe(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof Ot){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)i.length>0&&(Ce(a,{code:Oe.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=a.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Fe(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>De.mergeObjectSync(t,e)):De.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ie.errToObj,new St({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const n=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:Ie.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new St({...this._def,unknownKeys:"strip"})}passthrough(){return new St({...this._def,unknownKeys:"passthrough"})}extend(e){return new St({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new St({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new St({...this._def,catchall:e})}pick(e){const t={};for(const a of he.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new St({...this._def,shape:()=>t})}omit(e){const t={};for(const a of he.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new St({...this._def,shape:()=>t})}deepPartial(){return At(this)}partial(e){const t={};for(const a of he.objectKeys(this.shape)){const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new St({...this._def,shape:()=>t})}required(e){const t={};for(const a of he.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof zt;)e=e._def.innerType;t[a]=e}return new St({...this._def,shape:()=>t})}keyof(){return Mt(he.objectKeys(this.shape))}}St.create=(e,t)=>new St({shape:()=>e,unknownKeys:"strip",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)}),St.strictCreate=(e,t)=>new St({shape:()=>e,unknownKeys:"strict",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)}),St.lazycreate=(e,t)=>new St({shape:e,unknownKeys:"strip",catchall:Ot.create(),typeName:Qt.ZodObject,...ze(t)});class It extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new Ne(e.ctx.common.issues));return Ce(t,{code:Oe.invalid_union,unionErrors:a}),Pe});{let e;const n=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map(e=>new Ne(e));return Ce(t,{code:Oe.invalid_union,unionErrors:r}),Pe}}get options(){return this._def.options}}It.create=(e,t)=>new It({options:e,typeName:Qt.ZodUnion,...ze(t)});function wt(e,t){const a=ve(e),n=ve(t);if(e===t)return{valid:!0,data:e};if(a===ge.object&&n===ge.object){const a=he.objectKeys(t),n=he.objectKeys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const a of n){const n=wt(e[a],t[a]);if(!n.valid)return{valid:!1};r[a]=n.data}return{valid:!0,data:r}}if(a===ge.array&&n===ge.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const r=wt(e[n],t[n]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===ge.date&&n===ge.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ct extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(Le(e)||Le(n))return Pe;const r=wt(e.value,n.value);return r.valid?((Me(e)||Me(n))&&t.dirty(),{status:t.value,value:r.data}):(Ce(a,{code:Oe.invalid_intersection_types}),Pe)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}Ct.create=(e,t,a)=>new Ct({left:e,right:t,typeName:Qt.ZodIntersection,...ze(a)});class Dt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.array)return Ce(a,{code:Oe.invalid_type,expected:ge.array,received:a.parsedType}),Pe;if(a.data.length<this._def.items.length)return Ce(a,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&a.data.length>this._def.items.length&&(Ce(a,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Fe(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>De.mergeArray(t,e)):De.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Dt({...this._def,rest:e})}}Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:Qt.ZodTuple,rest:null,...ze(t)})};class Pt extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.map)return Ce(a,{code:Oe.invalid_type,expected:ge.map,received:a.parsedType}),Pe;const n=this._def.keyType,r=this._def.valueType,i=[...a.data.entries()].map(([e,t],i)=>({key:n._parse(new Fe(a,e,a.path,[i,"key"])),value:r._parse(new Fe(a,t,a.path,[i,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of i){const n=await a.key,r=await a.value;if("aborted"===n.status||"aborted"===r.status)return Pe;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of i){const n=a.key,r=a.value;if("aborted"===n.status||"aborted"===r.status)return Pe;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}}Pt.create=(e,t,a)=>new Pt({valueType:t,keyType:e,typeName:Qt.ZodMap,...ze(a)});class jt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==ge.set)return Ce(a,{code:Oe.invalid_type,expected:ge.set,received:a.parsedType}),Pe;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(Ce(a,{code:Oe.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(Ce(a,{code:Oe.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const a=new Set;for(const n of e){if("aborted"===n.status)return Pe;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const o=[...a.data.values()].map((e,t)=>r._parse(new Fe(a,e,a.path,t)));return a.common.async?Promise.all(o).then(e=>i(e)):i(o)}min(e,t){return new jt({...this._def,minSize:{value:e,message:Ie.toString(t)}})}max(e,t){return new jt({...this._def,maxSize:{value:e,message:Ie.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}jt.create=(e,t)=>new jt({valueType:e,minSize:null,maxSize:null,typeName:Qt.ZodSet,...ze(t)});class kt extends Ve{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}kt.create=(e,t)=>new kt({getter:e,typeName:Qt.ZodLazy,...ze(t)});class Lt extends Ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ce(t,{received:t.data,code:Oe.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Mt(e,t){return new Gt({values:e,typeName:Qt.ZodEnum,...ze(t)})}Lt.create=(e,t)=>new Lt({value:e,typeName:Qt.ZodLiteral,...ze(t)});class Gt extends Ve{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return Ce(t,{expected:he.joinValues(a),received:t.parsedType,code:Oe.invalid_type}),Pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return Ce(t,{received:t.data,code:Oe.invalid_enum_value,options:a}),Pe}return ke(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Gt.create(e,{...this._def,...t})}exclude(e,t=this._def){return Gt.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Gt.create=Mt;class xt extends Ve{_parse(e){const t=he.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==ge.string&&a.parsedType!==ge.number){const e=he.objectValues(t);return Ce(a,{expected:he.joinValues(e),received:a.parsedType,code:Oe.invalid_type}),Pe}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=he.objectValues(t);return Ce(a,{received:a.data,code:Oe.invalid_enum_value,options:e}),Pe}return ke(e.data)}get enum(){return this._def.values}}xt.create=(e,t)=>new xt({values:e,typeName:Qt.ZodNativeEnum,...ze(t)});class Ft extends Ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ge.promise&&!1===t.common.async)return Ce(t,{code:Oe.invalid_type,expected:ge.promise,received:t.parsedType}),Pe;const a=t.parsedType===ge.promise?t.data:Promise.resolve(t.data);return ke(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ft.create=(e,t)=>new Ft({type:e,typeName:Qt.ZodPromise,...ze(t)});class Bt extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{Ce(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Pe;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?Pe:"dirty"===n.status||"dirty"===t.value?je(n.value):n});{if("aborted"===t.value)return Pe;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?Pe:"dirty"===n.status||"dirty"===t.value?je(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?Pe:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?Pe:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ge(e))return Pe;const i=n.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>Ge(e)?Promise.resolve(n.transform(e.value,r)).then(e=>({status:t.value,value:e})):Pe)}he.assertNever(n)}}Bt.create=(e,t,a)=>new Bt({schema:e,typeName:Qt.ZodEffects,effect:t,...ze(a)}),Bt.createWithPreprocess=(e,t,a)=>new Bt({schema:t,effect:{type:"preprocess",transform:e},typeName:Qt.ZodEffects,...ze(a)});class zt extends Ve{_parse(e){return this._getType(e)===ge.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:Qt.ZodOptional,...ze(t)});class Vt extends Ve{_parse(e){return this._getType(e)===ge.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Vt.create=(e,t)=>new Vt({innerType:e,typeName:Qt.ZodNullable,...ze(t)});class $t extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===ge.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$t.create=(e,t)=>new $t({innerType:e,typeName:Qt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ze(t)});class Ut extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return xe(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ne(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ne(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Ut.create=(e,t)=>new Ut({innerType:e,typeName:Qt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ze(t)});class Ht extends Ve{_parse(e){if(this._getType(e)!==ge.nan){const t=this._getOrReturnCtx(e);return Ce(t,{code:Oe.invalid_type,expected:ge.nan,received:t.parsedType}),Pe}return{status:"valid",value:e.data}}}Ht.create=e=>new Ht({typeName:Qt.ZodNaN,...ze(e)});Symbol("zod_brand");class Kt extends Ve{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class qt extends Ve{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?Pe:"dirty"===e.status?(t.dirty(),je(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?Pe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new qt({in:e,out:t,typeName:Qt.ZodPipeline})}}class Wt extends Ve{_parse(e){const t=this._def.innerType._parse(e),a=e=>(Ge(e)&&(e.value=Object.freeze(e.value)),e);return xe(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}Wt.create=(e,t)=>new Wt({innerType:e,typeName:Qt.ZodReadonly,...ze(t)});St.lazycreate;var Qt;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qt||(Qt={}));const Yt=ct.create,Xt=ft.create,Jt=(Ht.create,_t.create,ht.create,Et.create,yt.create,Tt.create,Rt.create,gt.create,vt.create,Ot.create,Nt.create,bt.create),Zt=St.create,ea=(St.strictCreate,It.create,Ct.create,Dt.create,Pt.create,jt.create,kt.create,Lt.create,Gt.create);xt.create,Ft.create,Bt.create,zt.create,Vt.create,Bt.createWithPreprocess,qt.create,Object.freeze({status:"aborted"});function ta(e,t,a){function n(a,n){var r;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(r=a._zod).traits??(r.traits=new Set),a._zod.traits.add(e),t(a,n);for(const e in o.prototype)e in a||Object.defineProperty(a,e,{value:o.prototype[e].bind(a)});a._zod.constr=o,a._zod.def=n}const r=a?.Parent??Object;class i extends r{}function o(e){var t;const r=a?.Parent?new i:this;n(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(a?.Parent&&t instanceof a.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class aa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const na={};function ra(e){return e&&Object.assign(na,e),na}const ia=/^[cC][^\s-]{8,}$/,oa=/^[0-9a-z]+$/,sa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pa=/^[0-9a-vA-V]{20}$/,la=/^[A-Za-z0-9]{27}$/,da=/^[a-zA-Z0-9_-]{21}$/,ua=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ca=/^([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})$/,ma=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)$/,fa=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const _a=/^(?:(?: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])$/,ha=/^(([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})$/,Ea=/^((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])$/,ya=/^(([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])$/,Ta=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ra=/^[A-Za-z0-9_-]*$/,ga=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,va=/^\+(?:[0-9]){6,14}[0-9]$/,Oa="(?:(?:\\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])))",Na=new RegExp(`^${Oa}$`);function ba(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Aa=/^\d+$/,Sa=/^-?\d+(?:\.\d+)?/i,Ia=/true|false/i,wa=/null/i,Ca=/^[^A-Z]*$/,Da=/^[^a-z]*$/;function Pa(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,a])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function ja(e,t){return"bigint"==typeof t?t.toString():t}function ka(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function La(e){return null==e}function Ma(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}function Ga(e,t,a){Object.defineProperty(e,t,{get(){{const n=a();return e[t]=n,n}},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function xa(e,t,a){Object.defineProperty(e,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}function Fa(e){return JSON.stringify(e)}const Ba=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function za(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Va=ka(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function $a(e){if(!1===za(e))return!1;const t=e.constructor;if(void 0===t)return!0;const a=t.prototype;return!1!==za(a)&&!1!==Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")}const Ua=new Set(["string","number","symbol"]);new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ka(e,t,a){const n=new e._zod.constr(t??e._zod.def);return t&&!a?.parent||(n._zod.parent=e),n}function qa(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Wa={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 Qa(e,t=0){for(let a=t;a<e.issues.length;a++)if(!0!==e.issues[a]?.continue)return!0;return!1}function Ya(e,t){return t.map(t=>{var a;return(a=t).path??(a.path=[]),t.path.unshift(e),t})}function Xa(e){return"string"==typeof e?e:e?.message}function Ja(e,t,a){const n={...e,path:e.path??[]};if(!e.message){const r=Xa(e.inst?._zod.def?.error?.(e))??Xa(t?.error?.(e))??Xa(a.customError?.(e))??Xa(a.localeError?.(e))??"Invalid input";n.message=r}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Za(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function en(...e){const[t,a,n]=e;return"string"==typeof t?{message:t,code:"custom",input:a,inst:n}:{...t}}const tn=ta("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),an={number:"number",bigint:"bigint",object:"date"},nn=ta("$ZodCheckLessThan",(e,t)=>{tn.init(e,t);const a=an[typeof t.value];e._zod.onattach.push(e=>{const a=e._zod.bag,n=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:a,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rn=ta("$ZodCheckGreaterThan",(e,t)=>{tn.init(e,t);const a=an[typeof t.value];e._zod.onattach.push(e=>{const a=e._zod.bag,n=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:a,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),on=ta("$ZodCheckMultipleOf",(e,t)=>{tn.init(e,t),e._zod.onattach.push(e=>{var a;(a=e._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=a=>{if(typeof a.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof a.value?a.value%t.value===BigInt(0):0===function(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(a.value,t.value))||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:t.value,input:a.value,inst:e,continue:!t.abort})}}),sn=ta("$ZodCheckNumberFormat",(e,t)=>{tn.init(e,t),t.format=t.format||"float64";const a=t.format?.includes("int"),n=a?"int":"number",[r,i]=Wa[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=r,n.maximum=i,a&&(n.pattern=Aa)}),e._zod.check=o=>{const s=o.value;if(a){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,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:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}))}s<r&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>i&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:e})}}),pn=ta("$ZodCheckMaxLength",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const n=a.value;if(n.length<=t.maximum)return;const r=Za(n);a.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ln=ta("$ZodCheckMinLength",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const n=a.value;if(n.length>=t.minimum)return;const r=Za(n);a.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dn=ta("$ZodCheckLengthEquals",(e,t)=>{var a;tn.init(e,t),(a=e._zod.def).when??(a.when=e=>{const t=e.value;return!La(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const a=e._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=a=>{const n=a.value,r=n.length;if(r===t.length)return;const i=Za(n),o=r>t.length;a.issues.push({origin:i,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),un=ta("$ZodCheckStringFormat",(e,t)=>{var a,n;tn.init(e,t),e._zod.onattach.push(e=>{const a=e._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(a=e._zod).check??(a.check=a=>{t.pattern.lastIndex=0,t.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),cn=ta("$ZodCheckRegex",(e,t)=>{un.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,t.pattern.test(a.value)||a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mn=ta("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ca),un.init(e,t)}),fn=ta("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Da),un.init(e,t)}),_n=ta("$ZodCheckIncludes",(e,t)=>{tn.init(e,t);const a=Ha(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${a}`:a);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),hn=ta("$ZodCheckStartsWith",(e,t)=>{tn.init(e,t);const a=new RegExp(`^${Ha(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),En=ta("$ZodCheckEndsWith",(e,t)=>{tn.init(e,t);const a=new RegExp(`.*${Ha(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}});const yn=ta("$ZodCheckOverwrite",(e,t)=>{tn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Tn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),a=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(a)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Rn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,ja,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gn=ta("$ZodError",Rn),vn=ta("$ZodError",Rn,{Parent:Error});const On=e=>(t,a,n,r)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:a,issues:[]},i);if(o instanceof Promise)throw new aa;if(o.issues.length){const t=new(r?.Err??e)(o.issues.map(e=>Ja(e,i,ra())));throw Ba(t,r?.callee),t}return o.value},Nn=On(vn),bn=e=>async(t,a,n,r)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:a,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(r?.Err??e)(o.issues.map(e=>Ja(e,i,ra())));throw Ba(t,r?.callee),t}return o.value},An=bn(vn),Sn=e=>(t,a,n)=>{const r=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:a,issues:[]},r);if(i instanceof Promise)throw new aa;return i.issues.length?{success:!1,error:new(e??gn)(i.issues.map(e=>Ja(e,r,ra())))}:{success:!0,data:i.value}},In=Sn(vn),wn=e=>async(t,a,n)=>{const r=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:a,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>Ja(e,r,ra())))}:{success:!0,data:i.value}},Cn=wn(vn),Dn={major:4,minor:0,patch:0},Pn=ta("$ZodType",(e,t)=>{var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const a of t._zod.onattach)a(e);if(0===n.length)(a=e._zod).deferred??(a.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,a)=>{let n,r=Qa(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,o=i._zod.check(e);if(o instanceof Promise&&!1===a?.async)throw new aa;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(r||(r=Qa(e,t)))});else{if(e.issues.length===t)continue;r||(r=Qa(e,t))}}return n?n.then(()=>e):e};e._zod.run=(a,r)=>{const i=e._zod.parse(a,r);if(i instanceof Promise){if(!1===r.async)throw new aa;return i.then(e=>t(e,n,r))}return t(i,n,r)}}e["~standard"]={validate:t=>{try{const a=In(e,t);return a.success?{value:a.data}:{issues:a.error?.issues}}catch(a){return Cn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),jn=ta("$ZodString",(e,t)=>{var a;Pn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=e._zod.bag,new RegExp(`^${a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=String(a.value)}catch(n){}return"string"==typeof a.value||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),kn=ta("$ZodStringFormat",(e,t)=>{un.init(e,t),jn.init(e,t)}),Ln=ta("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ca),kn.init(e,t)}),Mn=ta("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ma(e))}else t.pattern??(t.pattern=ma());kn.init(e,t)}),Gn=ta("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=fa),kn.init(e,t)}),xn=ta("$ZodURL",(e,t)=>{kn.init(e,t),e._zod.check=a=>{try{const n=a.value,r=new URL(n),i=r.href;return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ga.source,input:a.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort})),void(!n.endsWith("/")&&i.endsWith("/")?a.value=i.slice(0,-1):a.value=i)}catch(n){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),Fn=ta("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kn.init(e,t)}),Bn=ta("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=da),kn.init(e,t)}),zn=ta("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ia),kn.init(e,t)}),Vn=ta("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oa),kn.init(e,t)}),$n=ta("$ZodULID",(e,t)=>{t.pattern??(t.pattern=sa),kn.init(e,t)}),Un=ta("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pa),kn.init(e,t)}),Hn=ta("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=la),kn.init(e,t)}),Kn=ta("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ba({precision:e.precision}),a=["Z"];e.local&&a.push(""),e.offset&&a.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${a.join("|")})`;return new RegExp(`^${Oa}T(?:${n})$`)}(t)),kn.init(e,t)}),qn=ta("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Na),kn.init(e,t)}),Wn=ta("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ba(t)}$`)),kn.init(e,t)}),Qn=ta("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ua),kn.init(e,t)}),Yn=ta("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=_a),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Xn=ta("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ha),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=a=>{try{new URL(`http://[${a.value}]`)}catch{a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}}),Jn=ta("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ea),kn.init(e,t)}),Zn=ta("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ya),kn.init(e,t),e._zod.check=a=>{const[n,r]=a.value.split("/");try{if(!r)throw new Error;const e=Number(r);if(`${e}`!==r)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!t.abort})}}});function er(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const tr=ta("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ta),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=a=>{er(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!t.abort})}});const ar=ta("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ra),kn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=a=>{(function(e){if(!Ra.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return er(t.padEnd(4*Math.ceil(t.length/4),"="))})(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!t.abort})}}),nr=ta("$ZodE164",(e,t)=>{t.pattern??(t.pattern=va),kn.init(e,t)});const rr=ta("$ZodJWT",(e,t)=>{kn.init(e,t),e._zod.check=a=>{(function(e,t=null){try{const a=e.split(".");if(3!==a.length)return!1;const[n]=a;if(!n)return!1;const r=JSON.parse(atob(n));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(a.value,t.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!t.abort})}}),ir=ta("$ZodNumber",(e,t)=>{Pn.init(e,t),e._zod.pattern=e._zod.bag.pattern??Sa,e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=Number(a.value)}catch(e){}const r=a.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return a;const i="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return a.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),a}}),or=ta("$ZodNumber",(e,t)=>{sn.init(e,t),ir.init(e,t)}),sr=ta("$ZodBoolean",(e,t)=>{Pn.init(e,t),e._zod.pattern=Ia,e._zod.parse=(a,n)=>{if(t.coerce)try{a.value=Boolean(a.value)}catch(e){}const r=a.value;return"boolean"==typeof r||a.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),a}}),pr=ta("$ZodNull",(e,t)=>{Pn.init(e,t),e._zod.pattern=wa,e._zod.values=new Set([null]),e._zod.parse=(t,a)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),lr=ta("$ZodUnknown",(e,t)=>{Pn.init(e,t),e._zod.parse=e=>e}),dr=ta("$ZodNever",(e,t)=>{Pn.init(e,t),e._zod.parse=(t,a)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ur(e,t,a){e.issues.length&&t.issues.push(...Ya(a,e.issues)),t.value[a]=e.value}const cr=ta("$ZodArray",(e,t)=>{Pn.init(e,t),e._zod.parse=(a,n)=>{const r=a.value;if(!Array.isArray(r))return a.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),a;a.value=Array(r.length);const i=[];for(let e=0;e<r.length;e++){const o=r[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?i.push(s.then(t=>ur(t,a,e))):ur(s,a,e)}return i.length?Promise.all(i).then(()=>a):a}});function mr(e,t,a){e.issues.length&&t.issues.push(...Ya(a,e.issues)),t.value[a]=e.value}function fr(e,t,a,n){e.issues.length?void 0===n[a]?t.value[a]=a in n?void 0:e.value:t.issues.push(...Ya(a,e.issues)):void 0===e.value?a in n&&(t.value[a]=void 0):t.value[a]=e.value}const _r=ta("$ZodObject",(e,t)=>{Pn.init(e,t);const a=ka(()=>{const e=Object.keys(t.shape);for(const a of e)if(!(t.shape[a]instanceof Pn))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const a=(n=t.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(a)}});Ga(e._zod,"propValues",()=>{const e=t.shape,a={};for(const t in e){const n=e[t]._zod;if(n.values){a[t]??(a[t]=new Set);for(const e of n.values)a[t].add(e)}}return a});let n;const r=za,i=!na.jitless,o=i&&Va.value,s=t.catchall;let p;e._zod.parse=(l,d)=>{p??(p=a.value);const u=l.value;if(!r(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;const c=[];if(i&&o&&!1===d?.async&&!0!==d.jitless)n||(n=(e=>{const t=new Tn(["shape","payload","ctx"]),n=a.value,r=e=>{const t=Fa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let o=0;for(const e of n.keys)i[e]="key_"+o++;t.write("const newResult = {}");for(const e of n.keys)if(n.optionalKeys.has(e)){const a=i[e];t.write(`const ${a} = ${r(e)};`);const n=Fa(e);t.write(`\n if (${a}.issues.length) {\n if (input[${n}] === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${a}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}],\n }))\n );\n }\n } else if (${a}.value === undefined) {\n if (${n} in input) newResult[${n}] = undefined;\n } else {\n newResult[${n}] = ${a}.value;\n }\n `)}else{const a=i[e];t.write(`const ${a} = ${r(e)};`),t.write(`\n if (${a}.issues.length) payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${Fa(e)}, ...iss.path] : [${Fa(e)}]\n })));`),t.write(`newResult[${Fa(e)}] = ${a}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,a)=>s(e,t,a)})(t.shape)),l=n(l,d);else{l.value={};const e=p.shape;for(const t of p.keys){const a=e[t],n=a._zod.run({value:u[t],issues:[]},d),r="optional"===a._zod.optin&&"optional"===a._zod.optout;n instanceof Promise?c.push(n.then(e=>r?fr(e,l,t,u):mr(e,l,t))):r?fr(n,l,t,u):mr(n,l,t)}}if(!s)return c.length?Promise.all(c).then(()=>l):l;const m=[],f=p.keySet,_=s._zod,h=_.def.type;for(const e of Object.keys(u)){if(f.has(e))continue;if("never"===h){m.push(e);continue}const t=_.run({value:u[e],issues:[]},d);t instanceof Promise?c.push(t.then(t=>mr(t,l,e))):mr(t,l,e)}return m.length&&l.issues.push({code:"unrecognized_keys",keys:m,input:u,inst:e}),c.length?Promise.all(c).then(()=>l):l}});function hr(e,t,a,n){for(const a of e)if(0===a.issues.length)return t.value=a.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(e=>e.issues.map(e=>Ja(e,n,ra())))}),t}const Er=ta("$ZodUnion",(e,t)=>{Pn.init(e,t),Ga(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Ga(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Ga(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ga(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Ma(e.source)).join("|")})$`)}}),e._zod.parse=(a,n)=>{let r=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},n);if(t instanceof Promise)i.push(t),r=!0;else{if(0===t.issues.length)return t;i.push(t)}}return r?Promise.all(i).then(t=>hr(t,a,e,n)):hr(i,a,e,n)}}),yr=ta("$ZodDiscriminatedUnion",(e,t)=>{Er.init(e,t);const a=e._zod.parse;Ga(e._zod,"propValues",()=>{const e={};for(const a of t.options){const n=a._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[t,a]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of a)e[t].add(n)}}return e});const n=ka(()=>{const e=t.options,a=new Map;for(const n of e){const e=n._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(a.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);a.set(t,n)}}return a});e._zod.parse=(r,i)=>{const o=r.value;if(!za(o))return r.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),r;const s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(r,i):t.unionFallback?a(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:o,path:[t.discriminator],inst:e}),r)}}),Tr=ta("$ZodIntersection",(e,t)=>{Pn.init(e,t),e._zod.parse=(e,a)=>{const n=e.value,r=t.left._zod.run({value:n,issues:[]},a),i=t.right._zod.run({value:n,issues:[]},a);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then(([t,a])=>gr(e,t,a)):gr(e,r,i)}});function Rr(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($a(e)&&$a(t)){const a=Object.keys(t),n=Object.keys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const a of n){const n=Rr(e[a],t[a]);if(!n.valid)return{valid:!1,mergeErrorPath:[a,...n.mergeErrorPath]};r[a]=n.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let n=0;n<e.length;n++){const r=Rr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};a.push(r.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function gr(e,t,a){if(t.issues.length&&e.issues.push(...t.issues),a.issues.length&&e.issues.push(...a.issues),Qa(e))return e;const n=Rr(t.value,a.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const vr=ta("$ZodRecord",(e,t)=>{Pn.init(e,t),e._zod.parse=(a,n)=>{const r=a.value;if(!$a(r))return a.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),a;const i=[];if(t.keyType._zod.values){const o=t.keyType._zod.values;a.value={};for(const e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const o=t.valueType._zod.run({value:r[e],issues:[]},n);o instanceof Promise?i.push(o.then(t=>{t.issues.length&&a.issues.push(...Ya(e,t.issues)),a.value[e]=t.value})):(o.issues.length&&a.issues.push(...Ya(e,o.issues)),a.value[e]=o.value)}let s;for(const e in r)o.has(e)||(s=s??[],s.push(e));s&&s.length>0&&a.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s})}else{a.value={};for(const o of Reflect.ownKeys(r)){if("__proto__"===o)continue;const s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){a.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(e=>Ja(e,n,ra())),input:o,path:[o],inst:e}),a.value[s.value]=s.value;continue}const p=t.valueType._zod.run({value:r[o],issues:[]},n);p instanceof Promise?i.push(p.then(e=>{e.issues.length&&a.issues.push(...Ya(o,e.issues)),a.value[s.value]=e.value})):(p.issues.length&&a.issues.push(...Ya(o,p.issues)),a.value[s.value]=p.value)}}return i.length?Promise.all(i).then(()=>a):a}});const Or=ta("$ZodEnum",(e,t)=>{Pn.init(e,t);const a=Pa(t.entries);e._zod.values=new Set(a),e._zod.pattern=new RegExp(`^(${a.filter(e=>Ua.has(typeof e)).map(e=>"string"==typeof e?Ha(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const r=t.value;return e._zod.values.has(r)||t.issues.push({code:"invalid_value",values:a,input:r,inst:e}),t}}),Nr=ta("$ZodLiteral",(e,t)=>{Pn.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Ha(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(a,n)=>{const r=a.value;return e._zod.values.has(r)||a.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),a}}),br=ta("$ZodTransform",(e,t)=>{Pn.init(e,t),e._zod.parse=(e,a)=>{const n=t.transform(e.value,e);if(a.async){return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(e.value=t,e))}if(n instanceof Promise)throw new aa;return e.value=n,e}}),Ar=ta("$ZodOptional",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ga(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ga(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ma(e.source)})?$`):void 0}),e._zod.parse=(e,a)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,a):void 0===e.value?e:t.innerType._zod.run(e,a)}),Sr=ta("$ZodNullable",(e,t)=>{Pn.init(e,t),Ga(e._zod,"optin",()=>t.innerType._zod.optin),Ga(e._zod,"optout",()=>t.innerType._zod.optout),Ga(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ma(e.source)}|null)$`):void 0}),Ga(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,a)=>null===e.value?e:t.innerType._zod.run(e,a)}),Ir=ta("$ZodDefault",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(e=>wr(e,t)):wr(n,t)}});function wr(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Cr=ta("$ZodPrefault",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,a))}),Dr=ta("$ZodNonOptional",(e,t)=>{Pn.init(e,t),Ga(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(a,n)=>{const r=t.innerType._zod.run(a,n);return r instanceof Promise?r.then(t=>Pr(t,e)):Pr(r,e)}});function Pr(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jr=ta("$ZodCatch",(e,t)=>{Pn.init(e,t),e._zod.optin="optional",Ga(e._zod,"optout",()=>t.innerType._zod.optout),Ga(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,a)=>{const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ja(e,a,ra()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ja(e,a,ra()))},input:e.value}),e.issues=[]),e)}}),kr=ta("$ZodPipe",(e,t)=>{Pn.init(e,t),Ga(e._zod,"values",()=>t.in._zod.values),Ga(e._zod,"optin",()=>t.in._zod.optin),Ga(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,a)=>{const n=t.in._zod.run(e,a);return n instanceof Promise?n.then(e=>Lr(e,t,a)):Lr(n,t,a)}});function Lr(e,t,a){return Qa(e)?e:t.out._zod.run({value:e.value,issues:e.issues},a)}const Mr=ta("$ZodReadonly",(e,t)=>{Pn.init(e,t),Ga(e._zod,"propValues",()=>t.innerType._zod.propValues),Ga(e._zod,"values",()=>t.innerType._zod.values),Ga(e._zod,"optin",()=>t.innerType._zod.optin),Ga(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,a)=>{const n=t.innerType._zod.run(e,a);return n instanceof Promise?n.then(Gr):Gr(n)}});function Gr(e){return e.value=Object.freeze(e.value),e}const xr=ta("$ZodCustom",(e,t)=>{tn.init(e,t),Pn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=a=>{const n=a.value,r=t.fn(n);if(r instanceof Promise)return r.then(t=>Fr(t,a,n,e));Fr(r,a,n,e)}});function Fr(e,t,a,n){if(!e){const e={code:"custom",input:a,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(en(e))}}const Br=ta("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Pn.init(e,t),e.def=t,e.parse=(t,a)=>Nn(e,t,a,{callee:e.parse}),e.safeParse=(t,a)=>In(e,t,a),e.parseAsync=async(t,a)=>An(e,t,a,{callee:e.parseAsync}),e.safeParseAsync=async(t,a)=>Cn(e,t,a),e.check=(...a)=>e.clone({...t,checks:[...t.checks??[],...a.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,a)=>Ka(e,t,a),e.brand=()=>e,e.register=(t,a)=>(t.add(e,a),e)});const zr=ta("ZodMiniObject",(e,t)=>{_r.init(e,t),Br.init(e,t),Ga(e,"shape",()=>t.shape)});function Vr(e,t){const a={type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},...qa(t)};return new zr(a)}function $r(e){return!!e._zod}function Ur(e){const t=Object.values(e);if(0===t.length)return Vr({});const a=t.every($r),n=t.every(e=>!$r(e));if(a)return Vr(e);if(n)return Zt(e);throw new Error("Mixed Zod versions detected in object shape.")}function Hr(e,t){if($r(e)){return In(e,t)}return e.safeParse(t)}async function Kr(e,t){if($r(e)){return await Cn(e,t)}const a=e;return await a.safeParseAsync(t)}function qr(e){var t,a;if(!e)return;let n;if($r(e)){n=null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.shape}else{n=e.shape}if(n){if("function"==typeof n)try{return n()}catch(e){return}return n}}function Wr(e){var t;if(e){if("object"==typeof e){const t=e;if(!e._def&&!t._zod){const t=Object.values(e);if(t.length>0&&t.every(e=>"object"==typeof e&&null!==e&&(void 0!==e._def||void 0!==e._zod||"function"==typeof e.parse)))return Ur(e)}}if($r(e)){const a=null===(t=e._zod)||void 0===t?void 0:t.def;if(a&&("object"===a.type||void 0!==a.shape))return e}else{if(void 0!==e.shape)return e}}}function Qr(e){if(e&&"object"==typeof e){if("message"in e&&"string"==typeof e.message)return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){const t=e.issues[0];if(t&&"object"==typeof t&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch(t){return String(e)}}return String(e)}function Yr(e){var t;if($r(e)){const a=null===(t=e._zod)||void 0===t?void 0:t.def;if(a){if(void 0!==a.value)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const a=e._def;if(a){if(void 0!==a.value)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}const n=e.value;if(void 0!==n)return n}Symbol("ZodOutput"),Symbol("ZodInput");class Xr{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const a=t[0];if(this._map.set(e,a),a&&"object"==typeof a&&"id"in a){if(this._idmap.has(a.id))throw new Error(`ID ${a.id} already exists in the registry`);this._idmap.set(a.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const a={...this.get(t)??{}};return delete a.id,{...a,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Jr(){return new Xr}const Zr=Jr();function ei(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...qa(t)})}function ti(e,t){return new nn({check:"less_than",...qa(t),value:e,inclusive:!1})}function ai(e,t){return new nn({check:"less_than",...qa(t),value:e,inclusive:!0})}function ni(e,t){return new rn({check:"greater_than",...qa(t),value:e,inclusive:!1})}function ri(e,t){return new rn({check:"greater_than",...qa(t),value:e,inclusive:!0})}function ii(e,t){return new on({check:"multiple_of",...qa(t),value:e})}function oi(e,t){return new pn({check:"max_length",...qa(t),maximum:e})}function si(e,t){return new ln({check:"min_length",...qa(t),minimum:e})}function pi(e,t){return new dn({check:"length_equals",...qa(t),length:e})}function li(e){return new yn({check:"overwrite",tx:e})}const di=ta("ZodISODateTime",(e,t)=>{Kn.init(e,t),Ii.init(e,t)});function ui(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...qa(t)})}(di,e)}const ci=ta("ZodISODate",(e,t)=>{qn.init(e,t),Ii.init(e,t)});function mi(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...qa(t)})}(ci,e)}const fi=ta("ZodISOTime",(e,t)=>{Wn.init(e,t),Ii.init(e,t)});function _i(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...qa(t)})}(fi,e)}const hi=ta("ZodISODuration",(e,t)=>{Qn.init(e,t),Ii.init(e,t)});function Ei(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...qa(t)})}(hi,e)}const yi=(e,t)=>{gn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const a=t||function(e){return e.message},n={_errors:[]},r=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>r({issues:e}));else if("invalid_key"===t.code)r({issues:t.issues});else if("invalid_element"===t.code)r({issues:t.issues});else if(0===t.path.length)n._errors.push(a(t));else{let e=n,r=0;for(;r<t.path.length;){const n=t.path[r];r===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(a(t))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const a={},n=[];for(const r of e.issues)r.path.length>0?(a[r.path[0]]=a[r.path[0]]||[],a[r.path[0]].push(t(r))):n.push(t(r));return{formErrors:n,fieldErrors:a}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},Ti=(ta("ZodError",yi),ta("ZodError",yi,{Parent:Error})),Ri=On(Ti),gi=bn(Ti),vi=Sn(Ti),Oi=wn(Ti),Ni=ta("ZodType",(e,t)=>(Pn.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...a)=>e.clone({...t,checks:[...t.checks??[],...a.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,a)=>Ka(e,t,a),e.brand=()=>e,e.register=(t,a)=>(t.add(e,a),e),e.parse=(t,a)=>Ri(e,t,a,{callee:e.parse}),e.safeParse=(t,a)=>vi(e,t,a),e.parseAsync=async(t,a)=>gi(e,t,a,{callee:e.parseAsync}),e.safeParseAsync=async(t,a)=>Oi(e,t,a),e.spa=e.safeParseAsync,e.refine=(t,a)=>e.check(function(e,t={}){return function(e,t,a){return new e({type:"custom",check:"custom",fn:t,...qa(a)})}(Go,e,t)}(t,a)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new tn({check:"custom"});return t._zod.check=e,t}(a=>(a.addIssue=e=>{if("string"==typeof e)a.issues.push(en(e,a.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=a.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),a.issues.push(en(n))}},e(a.value,a)));return t}(t)),e.overwrite=t=>e.check(li(t)),e.optional=()=>So(e),e.nullable=()=>wo(e),e.nullish=()=>So(wo(e)),e.nonoptional=t=>function(e,t){return new Po({type:"nonoptional",innerType:e,...qa(t)})}(e,t),e.array=()=>so(e),e.or=t=>mo([e,t]),e.and=t=>Eo(e,t),e.transform=t=>Lo(e,bo(t)),e.default=t=>{return a=t,new Co({type:"default",innerType:e,get defaultValue(){return"function"==typeof a?a():a}});var a},e.prefault=t=>{return a=t,new Do({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof a?a():a}});var a},e.catch=t=>{return new jo({type:"catch",innerType:e,catchValue:"function"==typeof(a=t)?a:()=>a});var a},e.pipe=t=>Lo(e,t),e.readonly=()=>new Mo({type:"readonly",innerType:e}),e.describe=t=>{const a=e.clone();return Zr.add(a,{description:t}),a},Object.defineProperty(e,"description",{get:()=>Zr.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Zr.get(e);const a=e.clone();return Zr.add(a,t[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bi=ta("_ZodString",(e,t)=>{jn.init(e,t),Ni.init(e,t);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new cn({check:"string_format",format:"regex",...qa(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new _n({check:"string_format",format:"includes",...qa(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new hn({check:"string_format",format:"starts_with",...qa(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new En({check:"string_format",format:"ends_with",...qa(t),suffix:e})}(...t)),e.min=(...t)=>e.check(si(...t)),e.max=(...t)=>e.check(oi(...t)),e.length=(...t)=>e.check(pi(...t)),e.nonempty=(...t)=>e.check(si(1,...t)),e.lowercase=t=>e.check(function(e){return new mn({check:"string_format",format:"lowercase",...qa(e)})}(t)),e.uppercase=t=>e.check(function(e){return new fn({check:"string_format",format:"uppercase",...qa(e)})}(t)),e.trim=()=>e.check(li(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return li(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(li(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(li(e=>e.toUpperCase()))}),Ai=ta("ZodString",(e,t)=>{jn.init(e,t),bi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...qa(t)})}(wi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...qa(t)})}(Pi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...qa(t)})}(qi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...qa(t)})}(ji,t)),e.guid=t=>e.check(ei(Ci,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...qa(t)})}(Di,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...qa(t)})}(Di,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...qa(t)})}(Di,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...qa(t)})}(Di,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...qa(t)})}(ki,t)),e.guid=t=>e.check(ei(Ci,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...qa(t)})}(Li,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...qa(t)})}(Mi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...qa(t)})}(Gi,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...qa(t)})}(Ui,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...qa(t)})}(Hi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...qa(t)})}(xi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...qa(t)})}(Fi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...qa(t)})}(Bi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...qa(t)})}(zi,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...qa(t)})}(Vi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...qa(t)})}($i,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...qa(t)})}(Ki,t)),e.datetime=t=>e.check(ui(t)),e.date=t=>e.check(mi(t)),e.time=t=>e.check(_i(t)),e.duration=t=>e.check(Ei(t))});function Si(e){return function(e,t){return new e({type:"string",...qa(t)})}(Ai,e)}const Ii=ta("ZodStringFormat",(e,t)=>{kn.init(e,t),bi.init(e,t)}),wi=ta("ZodEmail",(e,t)=>{Gn.init(e,t),Ii.init(e,t)});const Ci=ta("ZodGUID",(e,t)=>{Ln.init(e,t),Ii.init(e,t)});const Di=ta("ZodUUID",(e,t)=>{Mn.init(e,t),Ii.init(e,t)});const Pi=ta("ZodURL",(e,t)=>{xn.init(e,t),Ii.init(e,t)});const ji=ta("ZodEmoji",(e,t)=>{Fn.init(e,t),Ii.init(e,t)});const ki=ta("ZodNanoID",(e,t)=>{Bn.init(e,t),Ii.init(e,t)});const Li=ta("ZodCUID",(e,t)=>{zn.init(e,t),Ii.init(e,t)});const Mi=ta("ZodCUID2",(e,t)=>{Vn.init(e,t),Ii.init(e,t)});const Gi=ta("ZodULID",(e,t)=>{$n.init(e,t),Ii.init(e,t)});const xi=ta("ZodXID",(e,t)=>{Un.init(e,t),Ii.init(e,t)});const Fi=ta("ZodKSUID",(e,t)=>{Hn.init(e,t),Ii.init(e,t)});const Bi=ta("ZodIPv4",(e,t)=>{Yn.init(e,t),Ii.init(e,t)});const zi=ta("ZodIPv6",(e,t)=>{Xn.init(e,t),Ii.init(e,t)});const Vi=ta("ZodCIDRv4",(e,t)=>{Jn.init(e,t),Ii.init(e,t)});const $i=ta("ZodCIDRv6",(e,t)=>{Zn.init(e,t),Ii.init(e,t)});const Ui=ta("ZodBase64",(e,t)=>{tr.init(e,t),Ii.init(e,t)});const Hi=ta("ZodBase64URL",(e,t)=>{ar.init(e,t),Ii.init(e,t)});const Ki=ta("ZodE164",(e,t)=>{nr.init(e,t),Ii.init(e,t)});const qi=ta("ZodJWT",(e,t)=>{rr.init(e,t),Ii.init(e,t)});const Wi=ta("ZodNumber",(e,t)=>{ir.init(e,t),Ni.init(e,t),e.gt=(t,a)=>e.check(ni(t,a)),e.gte=(t,a)=>e.check(ri(t,a)),e.min=(t,a)=>e.check(ri(t,a)),e.lt=(t,a)=>e.check(ti(t,a)),e.lte=(t,a)=>e.check(ai(t,a)),e.max=(t,a)=>e.check(ai(t,a)),e.int=t=>e.check(Xi(t)),e.safe=t=>e.check(Xi(t)),e.positive=t=>e.check(ni(0,t)),e.nonnegative=t=>e.check(ri(0,t)),e.negative=t=>e.check(ti(0,t)),e.nonpositive=t=>e.check(ai(0,t)),e.multipleOf=(t,a)=>e.check(ii(t,a)),e.step=(t,a)=>e.check(ii(t,a)),e.finite=()=>e;const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function Qi(e){return function(e,t){return new e({type:"number",checks:[],...qa(t)})}(Wi,e)}const Yi=ta("ZodNumberFormat",(e,t)=>{or.init(e,t),Wi.init(e,t)});function Xi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...qa(t)})}(Yi,e)}const Ji=ta("ZodBoolean",(e,t)=>{sr.init(e,t),Ni.init(e,t)});function Zi(e){return function(e,t){return new e({type:"boolean",...qa(t)})}(Ji,e)}const eo=ta("ZodNull",(e,t)=>{pr.init(e,t),Ni.init(e,t)});function to(e){return function(e,t){return new e({type:"null",...qa(t)})}(eo,e)}const ao=ta("ZodUnknown",(e,t)=>{lr.init(e,t),Ni.init(e,t)});function no(){return function(e){return new e({type:"unknown"})}(ao)}const ro=ta("ZodNever",(e,t)=>{dr.init(e,t),Ni.init(e,t)});function io(e){return function(e,t){return new e({type:"never",...qa(t)})}(ro,e)}const oo=ta("ZodArray",(e,t)=>{cr.init(e,t),Ni.init(e,t),e.element=t.element,e.min=(t,a)=>e.check(si(t,a)),e.nonempty=t=>e.check(si(1,t)),e.max=(t,a)=>e.check(oi(t,a)),e.length=(t,a)=>e.check(pi(t,a)),e.unwrap=()=>e.element});function so(e,t){return function(e,t,a){return new e({type:"array",element:t,...qa(a)})}(oo,e,t)}const po=ta("ZodObject",(e,t)=>{_r.init(e,t),Ni.init(e,t),Ga(e,"shape",()=>t.shape),e.keyof=()=>go(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:no()}),e.loose=()=>e.clone({...e._zod.def,catchall:no()}),e.strict=()=>e.clone({...e._zod.def,catchall:io()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!$a(t))throw new Error("Invalid input to extend: expected a plain object");const a={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return xa(this,"shape",a),a},checks:[]};return Ka(e,a)}(e,t),e.merge=t=>{return n=t,Ka(a=e,{...a._zod.def,get shape(){const e={...a._zod.def.shape,...n._zod.def.shape};return xa(this,"shape",e),e},catchall:n._zod.def.catchall,checks:[]});var a,n},e.pick=t=>function(e,t){const a={},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(a[e]=n.shape[e])}return Ka(e,{...e._zod.def,shape:a,checks:[]})}(e,t),e.omit=t=>function(e,t){const a={...e._zod.def.shape},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return Ka(e,{...e._zod.def,shape:a,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,a){const n=t._zod.def.shape,r={...n};if(a)for(const t in a){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);a[t]&&(r[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)r[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Ka(t,{...t._zod.def,shape:r,checks:[]})}(Ao,e,t[0]),e.required=(...t)=>function(e,t,a){const n=t._zod.def.shape,r={...n};if(a)for(const t in a){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);a[t]&&(r[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)r[t]=new e({type:"nonoptional",innerType:n[t]});return Ka(t,{...t._zod.def,shape:r,checks:[]})}(Po,e,t[0])});function lo(e,t){const a={type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},...qa(t)};return new po(a)}function uo(e,t){return new po({type:"object",get shape(){return xa(this,"shape",{...e}),this.shape},catchall:no(),...qa(t)})}const co=ta("ZodUnion",(e,t)=>{Er.init(e,t),Ni.init(e,t),e.options=t.options});function mo(e,t){return new co({type:"union",options:e,...qa(t)})}const fo=ta("ZodDiscriminatedUnion",(e,t)=>{co.init(e,t),yr.init(e,t)});function _o(e,t,a){return new fo({type:"union",options:t,discriminator:e,...qa(a)})}const ho=ta("ZodIntersection",(e,t)=>{Tr.init(e,t),Ni.init(e,t)});function Eo(e,t){return new ho({type:"intersection",left:e,right:t})}const yo=ta("ZodRecord",(e,t)=>{vr.init(e,t),Ni.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function To(e,t,a){return new yo({type:"record",keyType:e,valueType:t,...qa(a)})}const Ro=ta("ZodEnum",(e,t)=>{Or.init(e,t),Ni.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const r={};for(const n of e){if(!a.has(n))throw new Error(`Key ${n} not found in enum`);r[n]=t.entries[n]}return new Ro({...t,checks:[],...qa(n),entries:r})},e.exclude=(e,n)=>{const r={...t.entries};for(const t of e){if(!a.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Ro({...t,checks:[],...qa(n),entries:r})}});function go(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ro({type:"enum",entries:a,...qa(t)})}const vo=ta("ZodLiteral",(e,t)=>{Nr.init(e,t),Ni.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 Oo(e,t){return new vo({type:"literal",values:Array.isArray(e)?e:[e],...qa(t)})}const No=ta("ZodTransform",(e,t)=>{br.init(e,t),Ni.init(e,t),e._zod.parse=(a,n)=>{a.addIssue=n=>{if("string"==typeof n)a.issues.push(en(n,a.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=a.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),a.issues.push(en(t))}};const r=t.transform(a.value,a);return r instanceof Promise?r.then(e=>(a.value=e,a)):(a.value=r,a)}});function bo(e){return new No({type:"transform",transform:e})}const Ao=ta("ZodOptional",(e,t)=>{Ar.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function So(e){return new Ao({type:"optional",innerType:e})}const Io=ta("ZodNullable",(e,t)=>{Sr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wo(e){return new Io({type:"nullable",innerType:e})}const Co=ta("ZodDefault",(e,t)=>{Ir.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Do=ta("ZodPrefault",(e,t)=>{Cr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Po=ta("ZodNonOptional",(e,t)=>{Dr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType});const jo=ta("ZodCatch",(e,t)=>{jr.init(e,t),Ni.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const ko=ta("ZodPipe",(e,t)=>{kr.init(e,t),Ni.init(e,t),e.in=t.in,e.out=t.out});function Lo(e,t){return new ko({type:"pipe",in:e,out:t})}const Mo=ta("ZodReadonly",(e,t)=>{Mr.init(e,t),Ni.init(e,t)});const Go=ta("ZodCustom",(e,t)=>{xr.init(e,t),Ni.init(e,t)});function xo(e,t){return Lo(bo(e),t)}const Fo="2025-11-25",Bo=[Fo,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zo="io.modelcontextprotocol/related-task",Vo="2.0",$o=function(e,t,a){const n=qa(a);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}(Go,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),Uo);var Uo;const Ho=mo([Si(),Qi().int()]),Ko=Si(),qo=uo({ttl:mo([Qi(),to()]).optional(),pollInterval:Qi().optional()}),Wo=uo({taskId:Si()}),Qo=uo({progressToken:Ho.optional(),[zo]:Wo.optional()}),Yo=uo({task:qo.optional(),_meta:Qo.optional()}),Xo=lo({method:Si(),params:Yo.optional()}),Jo=uo({_meta:lo({[zo]:So(Wo)}).passthrough().optional()}),Zo=lo({method:Si(),params:Jo.optional()}),es=uo({_meta:uo({[zo]:Wo.optional()}).optional()}),ts=mo([Si(),Qi().int()]),as=lo({jsonrpc:Oo(Vo),id:ts,...Xo.shape}).strict(),ns=e=>as.safeParse(e).success,rs=lo({jsonrpc:Oo(Vo),...Zo.shape}).strict(),is=lo({jsonrpc:Oo(Vo),id:ts,result:es}).strict(),os=e=>is.safeParse(e).success;var ss;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"}(ss||(ss={}));const ps=lo({jsonrpc:Oo(Vo),id:ts,error:lo({code:Qi().int(),message:Si(),data:So(no())})}).strict(),ls=mo([as,rs,is,ps]),ds=es.strict(),us=Jo.extend({requestId:ts,reason:Si().optional()}),cs=Zo.extend({method:Oo("notifications/cancelled"),params:us}),ms=lo({src:Si(),mimeType:Si().optional(),sizes:so(Si()).optional()}),fs=lo({icons:so(ms).optional()}),_s=lo({name:Si(),title:Si().optional()}),hs=_s.extend({..._s.shape,...fs.shape,version:Si(),websiteUrl:Si().optional()}),Es=Eo(lo({applyDefaults:Zi().optional()}),To(Si(),no())),ys=xo(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,Eo(lo({form:Es.optional(),url:$o.optional()}),To(Si(),no()).optional())),Ts=lo({list:So(lo({}).passthrough()),cancel:So(lo({}).passthrough()),requests:So(lo({sampling:So(lo({createMessage:So(lo({}).passthrough())}).passthrough()),elicitation:So(lo({create:So(lo({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Rs=lo({list:So(lo({}).passthrough()),cancel:So(lo({}).passthrough()),requests:So(lo({tools:So(lo({call:So(lo({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),gs=lo({experimental:To(Si(),$o).optional(),sampling:lo({context:$o.optional(),tools:$o.optional()}).optional(),elicitation:ys.optional(),roots:lo({listChanged:Zi().optional()}).optional(),tasks:So(Ts)}),vs=Yo.extend({protocolVersion:Si(),capabilities:gs,clientInfo:hs}),Os=Xo.extend({method:Oo("initialize"),params:vs}),Ns=lo({experimental:To(Si(),$o).optional(),logging:$o.optional(),completions:$o.optional(),prompts:So(lo({listChanged:So(Zi())})),resources:lo({subscribe:Zi().optional(),listChanged:Zi().optional()}).optional(),tools:lo({listChanged:Zi().optional()}).optional(),tasks:So(Rs)}).passthrough(),bs=es.extend({protocolVersion:Si(),capabilities:Ns,serverInfo:hs,instructions:Si().optional()}),As=Zo.extend({method:Oo("notifications/initialized")}),Ss=Xo.extend({method:Oo("ping")}),Is=lo({progress:Qi(),total:So(Qi()),message:So(Si())}),ws=lo({...Jo.shape,...Is.shape,progressToken:Ho}),Cs=Zo.extend({method:Oo("notifications/progress"),params:ws}),Ds=Yo.extend({cursor:Ko.optional()}),Ps=Xo.extend({params:Ds.optional()}),js=es.extend({nextCursor:So(Ko)}),ks=lo({taskId:Si(),status:go(["working","input_required","completed","failed","cancelled"]),ttl:mo([Qi(),to()]),createdAt:Si(),lastUpdatedAt:Si(),pollInterval:So(Qi()),statusMessage:So(Si())}),Ls=es.extend({task:ks}),Ms=Jo.merge(ks),Gs=Zo.extend({method:Oo("notifications/tasks/status"),params:Ms}),xs=Xo.extend({method:Oo("tasks/get"),params:Yo.extend({taskId:Si()})}),Fs=es.merge(ks),Bs=Xo.extend({method:Oo("tasks/result"),params:Yo.extend({taskId:Si()})}),zs=Ps.extend({method:Oo("tasks/list")}),Vs=js.extend({tasks:so(ks)}),$s=Xo.extend({method:Oo("tasks/cancel"),params:Yo.extend({taskId:Si()})}),Us=es.merge(ks),Hs=lo({uri:Si(),mimeType:So(Si()),_meta:To(Si(),no()).optional()}),Ks=Hs.extend({text:Si()}),qs=Si().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),Ws=Hs.extend({blob:qs}),Qs=lo({audience:so(go(["user","assistant"])).optional(),priority:Qi().min(0).max(1).optional(),lastModified:ui({offset:!0}).optional()}),Ys=lo({..._s.shape,...fs.shape,uri:Si(),description:So(Si()),mimeType:So(Si()),annotations:Qs.optional(),_meta:So(uo({}))}),Xs=lo({..._s.shape,...fs.shape,uriTemplate:Si(),description:So(Si()),mimeType:So(Si()),annotations:Qs.optional(),_meta:So(uo({}))}),Js=Ps.extend({method:Oo("resources/list")}),Zs=js.extend({resources:so(Ys)}),ep=Ps.extend({method:Oo("resources/templates/list")}),tp=js.extend({resourceTemplates:so(Xs)}),ap=Yo.extend({uri:Si()}),np=ap,rp=Xo.extend({method:Oo("resources/read"),params:np}),ip=es.extend({contents:so(mo([Ks,Ws]))}),op=Zo.extend({method:Oo("notifications/resources/list_changed")}),sp=ap,pp=Xo.extend({method:Oo("resources/subscribe"),params:sp}),lp=ap,dp=Xo.extend({method:Oo("resources/unsubscribe"),params:lp}),up=Jo.extend({uri:Si()}),cp=Zo.extend({method:Oo("notifications/resources/updated"),params:up}),mp=lo({name:Si(),description:So(Si()),required:So(Zi())}),fp=lo({..._s.shape,...fs.shape,description:So(Si()),arguments:So(so(mp)),_meta:So(uo({}))}),_p=Ps.extend({method:Oo("prompts/list")}),hp=js.extend({prompts:so(fp)}),Ep=Yo.extend({name:Si(),arguments:To(Si(),Si()).optional()}),yp=Xo.extend({method:Oo("prompts/get"),params:Ep}),Tp=lo({type:Oo("text"),text:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),Rp=lo({type:Oo("image"),data:qs,mimeType:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),gp=lo({type:Oo("audio"),data:qs,mimeType:Si(),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),vp=lo({type:Oo("tool_use"),name:Si(),id:Si(),input:lo({}).passthrough(),_meta:So(lo({}).passthrough())}).passthrough(),Op=lo({type:Oo("resource"),resource:mo([Ks,Ws]),annotations:Qs.optional(),_meta:To(Si(),no()).optional()}),Np=mo([Tp,Rp,gp,Ys.extend({type:Oo("resource_link")}),Op]),bp=lo({role:go(["user","assistant"]),content:Np}),Ap=es.extend({description:So(Si()),messages:so(bp)}),Sp=Zo.extend({method:Oo("notifications/prompts/list_changed")}),Ip=lo({title:Si().optional(),readOnlyHint:Zi().optional(),destructiveHint:Zi().optional(),idempotentHint:Zi().optional(),openWorldHint:Zi().optional()}),wp=lo({taskSupport:go(["required","optional","forbidden"]).optional()}),Cp=lo({..._s.shape,...fs.shape,description:Si().optional(),inputSchema:lo({type:Oo("object"),properties:To(Si(),$o).optional(),required:so(Si()).optional()}).catchall(no()),outputSchema:lo({type:Oo("object"),properties:To(Si(),$o).optional(),required:so(Si()).optional()}).catchall(no()).optional(),annotations:So(Ip),execution:So(wp),_meta:To(Si(),no()).optional()}),Dp=Ps.extend({method:Oo("tools/list")}),Pp=js.extend({tools:so(Cp)}),jp=es.extend({content:so(Np).default([]),structuredContent:To(Si(),no()).optional(),isError:So(Zi())}),kp=(jp.or(es.extend({toolResult:no()})),Yo.extend({name:Si(),arguments:So(To(Si(),no()))})),Lp=Xo.extend({method:Oo("tools/call"),params:kp}),Mp=Zo.extend({method:Oo("notifications/tools/list_changed")}),Gp=go(["debug","info","notice","warning","error","critical","alert","emergency"]),xp=Yo.extend({level:Gp}),Fp=Xo.extend({method:Oo("logging/setLevel"),params:xp}),Bp=Jo.extend({level:Gp,logger:Si().optional(),data:no()}),zp=Zo.extend({method:Oo("notifications/message"),params:Bp}),Vp=lo({name:Si().optional()}),$p=lo({hints:So(so(Vp)),costPriority:So(Qi().min(0).max(1)),speedPriority:So(Qi().min(0).max(1)),intelligencePriority:So(Qi().min(0).max(1))}),Up=lo({mode:So(go(["auto","required","none"]))}),Hp=lo({type:Oo("tool_result"),toolUseId:Si().describe("The unique identifier for the corresponding tool call."),content:so(Np).default([]),structuredContent:lo({}).passthrough().optional(),isError:So(Zi()),_meta:So(lo({}).passthrough())}).passthrough(),Kp=_o("type",[Tp,Rp,gp]),qp=_o("type",[Tp,Rp,gp,vp,Hp]),Wp=lo({role:go(["user","assistant"]),content:mo([qp,so(qp)]),_meta:So(lo({}).passthrough())}).passthrough(),Qp=Yo.extend({messages:so(Wp),modelPreferences:$p.optional(),systemPrompt:Si().optional(),includeContext:go(["none","thisServer","allServers"]).optional(),temperature:Qi().optional(),maxTokens:Qi().int(),stopSequences:so(Si()).optional(),metadata:$o.optional(),tools:So(so(Cp)),toolChoice:So(Up)}),Yp=Xo.extend({method:Oo("sampling/createMessage"),params:Qp}),Xp=es.extend({model:Si(),stopReason:So(go(["endTurn","stopSequence","maxTokens"]).or(Si())),role:go(["user","assistant"]),content:Kp}),Jp=es.extend({model:Si(),stopReason:So(go(["endTurn","stopSequence","maxTokens","toolUse"]).or(Si())),role:go(["user","assistant"]),content:mo([qp,so(qp)])}),Zp=lo({type:Oo("boolean"),title:Si().optional(),description:Si().optional(),default:Zi().optional()}),el=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),minLength:Qi().optional(),maxLength:Qi().optional(),format:go(["email","uri","date","date-time"]).optional(),default:Si().optional()}),tl=lo({type:go(["number","integer"]),title:Si().optional(),description:Si().optional(),minimum:Qi().optional(),maximum:Qi().optional(),default:Qi().optional()}),al=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),enum:so(Si()),default:Si().optional()}),nl=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),oneOf:so(lo({const:Si(),title:Si()})),default:Si().optional()}),rl=lo({type:Oo("string"),title:Si().optional(),description:Si().optional(),enum:so(Si()),enumNames:so(Si()).optional(),default:Si().optional()}),il=mo([al,nl]),ol=mo([lo({type:Oo("array"),title:Si().optional(),description:Si().optional(),minItems:Qi().optional(),maxItems:Qi().optional(),items:lo({type:Oo("string"),enum:so(Si())}),default:so(Si()).optional()}),lo({type:Oo("array"),title:Si().optional(),description:Si().optional(),minItems:Qi().optional(),maxItems:Qi().optional(),items:lo({anyOf:so(lo({const:Si(),title:Si()}))}),default:so(Si()).optional()})]),sl=mo([rl,il,ol]),pl=mo([sl,Zp,el,tl]),ll=mo([Yo.extend({mode:Oo("form").optional(),message:Si(),requestedSchema:lo({type:Oo("object"),properties:To(Si(),pl),required:so(Si()).optional()})}),Yo.extend({mode:Oo("url"),message:Si(),elicitationId:Si(),url:Si().url()})]),dl=Xo.extend({method:Oo("elicitation/create"),params:ll}),ul=Jo.extend({elicitationId:Si()}),cl=Zo.extend({method:Oo("notifications/elicitation/complete"),params:ul}),ml=es.extend({action:go(["accept","decline","cancel"]),content:xo(e=>null===e?void 0:e,To(Si(),mo([Si(),Qi(),Zi(),so(Si())])).optional())}),fl=lo({type:Oo("ref/resource"),uri:Si()}),_l=lo({type:Oo("ref/prompt"),name:Si()}),hl=Yo.extend({ref:mo([_l,fl]),argument:lo({name:Si(),value:Si()}),context:lo({arguments:To(Si(),Si()).optional()}).optional()}),El=Xo.extend({method:Oo("completion/complete"),params:hl});const yl=es.extend({completion:uo({values:so(Si()).max(100),total:So(Qi().int()),hasMore:So(Zi())})}),Tl=lo({uri:Si().startsWith("file://"),name:Si().optional(),_meta:To(Si(),no()).optional()}),Rl=Xo.extend({method:Oo("roots/list")}),gl=es.extend({roots:so(Tl)}),vl=Zo.extend({method:Oo("notifications/roots/list_changed")});mo([Ss,Os,El,Fp,yp,_p,Js,ep,rp,pp,dp,Lp,Dp,xs,Bs,zs]),mo([cs,Cs,As,vl,Gs]),mo([ds,Xp,Jp,ml,gl,Fs,Vs,Ls]),mo([Ss,Yp,dl,Rl,xs,Bs,zs]),mo([cs,Cs,zp,cp,op,Mp,Sp,Gs,cl]),mo([ds,bs,yl,Ap,hp,Zs,tp,ip,jp,Pp,Fs,Vs,Ls]);class Ol extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}static fromError(e,t,a){if(e===ss.UrlElicitationRequired&&a){const e=a;if(e.elicitations)return new Nl(e.elicitations,t)}return new Ol(e,t,a)}}class Nl extends Ol{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ss.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){var e,t;return null!==(t=null===(e=this.data)||void 0===e?void 0:e.elicitations)&&void 0!==t?t:[]}}function bl(e){return"completed"===e||"failed"===e||"cancelled"===e}class Al{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Zr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var a;const n=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){i.count++;return t.schemaPath.includes(e)&&(i.cycle=t.path),i.schema}const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const a={...t,schemaPath:[...t.schemaPath,e],path:t.path},i=e._zod.parent;if(i)o.ref=i,this.process(i,a),this.seen.get(i).isParent=!0;else{const t=o.schema;switch(n.type){case"string":{const a=t;a.type="string";const{minimum:n,maximum:i,format:s,patterns:p,contentEncoding:l}=e._zod.bag;if("number"==typeof n&&(a.minLength=n),"number"==typeof i&&(a.maxLength=i),s&&(a.format=r[s]??s,""===a.format&&delete a.format),l&&(a.contentEncoding=l),p&&p.size>0){const e=[...p];1===e.length?a.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{const a=t,{minimum:n,maximum:r,format:i,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:p}=e._zod.bag;"string"==typeof i&&i.includes("int")?a.type="integer":a.type="number","number"==typeof p&&(a.exclusiveMinimum=p),"number"==typeof n&&(a.minimum=n,"number"==typeof p&&(p>=n?delete a.minimum:delete a.exclusiveMinimum)),"number"==typeof s&&(a.exclusiveMaximum=s),"number"==typeof r&&(a.maximum=r,"number"==typeof s&&(s<=r?delete a.maximum:delete a.exclusiveMaximum)),"number"==typeof o&&(a.multipleOf=o);break}case"boolean":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema");break;case"null":t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw new Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw new Error("Date cannot be represented in JSON Schema");break;case"array":{const r=t,{minimum:i,maximum:o}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=this.process(n.element,{...a,path:[...a.path,"items"]});break}case"object":{const e=t;e.type="object",e.properties={};const r=n.shape;for(const t in r)e.properties[t]=this.process(r[t],{...a,path:[...a.path,"properties",t]});const i=new Set(Object.keys(r)),o=new Set([...i].filter(e=>{const t=n.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));o.size>0&&(e.required=Array.from(o)),"never"===n.catchall?._zod.def.type?e.additionalProperties=!1:n.catchall?n.catchall&&(e.additionalProperties=this.process(n.catchall,{...a,path:[...a.path,"additionalProperties"]})):"output"===this.io&&(e.additionalProperties=!1);break}case"union":t.anyOf=n.options.map((e,t)=>this.process(e,{...a,path:[...a.path,"anyOf",t]}));break;case"intersection":{const e=t,r=this.process(n.left,{...a,path:[...a.path,"allOf",0]}),i=this.process(n.right,{...a,path:[...a.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,s=[...o(r)?r.allOf:[r],...o(i)?i.allOf:[i]];e.allOf=s;break}case"tuple":{const r=t;r.type="array";const i=n.items.map((e,t)=>this.process(e,{...a,path:[...a.path,"prefixItems",t]}));if("draft-2020-12"===this.target?r.prefixItems=i:r.items=i,n.rest){const e=this.process(n.rest,{...a,path:[...a.path,"items"]});"draft-2020-12"===this.target?r.items=e:r.additionalItems=e}n.rest&&(r.items=this.process(n.rest,{...a,path:[...a.path,"items"]}));const{minimum:o,maximum:s}=e._zod.bag;"number"==typeof o&&(r.minItems=o),"number"==typeof s&&(r.maxItems=s);break}case"record":{const e=t;e.type="object",e.propertyNames=this.process(n.keyType,{...a,path:[...a.path,"propertyNames"]}),e.additionalProperties=this.process(n.valueType,{...a,path:[...a.path,"additionalProperties"]});break}case"map":if("throw"===this.unrepresentable)throw new Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw new Error("Set cannot be represented in JSON Schema");break;case"enum":{const e=t,a=Pa(n.entries);a.every(e=>"number"==typeof e)&&(e.type="number"),a.every(e=>"string"==typeof e)&&(e.type="string"),e.enum=a;break}case"literal":{const e=t,a=[];for(const e of n.values)if(void 0===e){if("throw"===this.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===this.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(e))}else a.push(e);if(0===a.length);else if(1===a.length){const t=a[0];e.type=null===t?"null":typeof t,e.const=t}else a.every(e=>"number"==typeof e)&&(e.type="number"),a.every(e=>"string"==typeof e)&&(e.type="string"),a.every(e=>"boolean"==typeof e)&&(e.type="string"),a.every(e=>null===e)&&(e.type="null"),e.enum=a;break}case"file":{const a=t,n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:r,maximum:i,mime:o}=e._zod.bag;void 0!==r&&(n.minLength=r),void 0!==i&&(n.maxLength=i),o?1===o.length?(n.contentMediaType=o[0],Object.assign(a,n)):a.anyOf=o.map(e=>({...n,contentMediaType:e})):Object.assign(a,n);break}case"transform":if("throw"===this.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{const e=this.process(n.innerType,a);t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(n.innerType,a),o.ref=n.innerType;break;case"success":t.type="boolean";break;case"default":this.process(n.innerType,a),o.ref=n.innerType,t.default=JSON.parse(JSON.stringify(n.defaultValue));break;case"prefault":this.process(n.innerType,a),o.ref=n.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(n.defaultValue)));break;case"catch":{let e;this.process(n.innerType,a),o.ref=n.innerType;try{e=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{const a=t,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");a.type="string",a.pattern=n.source;break}case"pipe":{const e="input"===this.io?"transform"===n.in._zod.def.type?n.out:n.in:n.out;this.process(e,a),o.ref=e;break}case"readonly":this.process(n.innerType,a),o.ref=n.innerType,t.readOnly=!0;break;case"lazy":{const t=e._zod.innerType;this.process(t,a),o.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")}}}const p=this.metadataRegistry.get(e);p&&Object.assign(o.schema,p),"input"===this.io&&Sl(e)&&(delete o.schema.examples,delete o.schema.default),"input"===this.io&&o.schema._prefault&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault;return this.seen.get(e).schema}emit(e,t){const a={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},n=this.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=e=>{const t="draft-2020-12"===this.target?"$defs":"definitions";if(a.external){const n=a.external.registry.get(e[0])?.id,r=a.external.uri??(e=>e);if(n)return{ref:r(n)};const i=e[1].defId??e[1].schema.id??"schema"+this.counter++;return e[1].defId=i,{defId:i,ref:`${r("__shared")}#/${t}/${i}`}}if(e[1]===n)return{ref:"#"};const r=`#/${t}/`,i=e[1].schema.id??"__schema"+this.counter++;return{defId:i,ref:r+i}},i=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:a,defId:n}=r(e);t.def={...t.schema},n&&(t.defId=n);const i=t.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===a.cycles)for(const e of this.seen.entries()){const t=e[1];if(t.cycle)throw new Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const t of this.seen.entries()){const n=t[1];if(e===t[0]){i(t);continue}if(a.external){const n=a.external.registry.get(t[0])?.id;if(e!==t[0]&&n){i(t);continue}}const r=this.metadataRegistry.get(t[0])?.id;r?i(t):(n.cycle||n.count>1&&"ref"===a.reused)&&i(t)}const o=(e,t)=>{const a=this.seen.get(e),n=a.def??a.schema,r={...n};if(null===a.ref)return;const i=a.ref;if(a.ref=null,i){o(i,t);const e=this.seen.get(i).schema;e.$ref&&"draft-7"===t.target?(n.allOf=n.allOf??[],n.allOf.push(e)):(Object.assign(n,e),Object.assign(n,r))}a.isParent||this.override({zodSchema:e,jsonSchema:n,path:a.path??[]})};for(const e of[...this.seen.entries()].reverse())o(e[0],{target:this.target});const s={};if("draft-2020-12"===this.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?s.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),a.external?.uri){const t=a.external.registry.get(e)?.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=a.external.uri(t)}Object.assign(s,n.def);const p=a.external?.defs??{};for(const e of this.seen.entries()){const t=e[1];t.def&&t.defId&&(p[t.defId]=t.def)}a.external||Object.keys(p).length>0&&("draft-2020-12"===this.target?s.$defs=p:s.definitions=p);try{return JSON.parse(JSON.stringify(s))}catch(e){throw new Error("Error converting schema to JSON.")}}}function Sl(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const n=e._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return Sl(n.element,a);case"object":for(const e in n.shape)if(Sl(n.shape[e],a))return!0;return!1;case"union":for(const e of n.options)if(Sl(e,a))return!0;return!1;case"intersection":return Sl(n.left,a)||Sl(n.right,a);case"tuple":for(const e of n.items)if(Sl(e,a))return!0;return!(!n.rest||!Sl(n.rest,a));case"record":case"map":return Sl(n.keyType,a)||Sl(n.valueType,a);case"set":return Sl(n.valueType,a);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return Sl(n.innerType,a);case"lazy":return Sl(n.getter(),a);case"transform":return!0;case"pipe":return Sl(n.in,a)||Sl(n.out,a)}throw new Error(`Unknown schema type: ${n.type}`)}const Il=Symbol("Let zodToJsonSchema decide on which parser to use"),wl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Cl=e=>{const t=(e=>"string"==typeof e?{...wl,name:e}:{...wl,...e})(e),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Dl=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function Pl(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Dl(t,e.currentPath):t.join("/")}}function jl(e,t,a,n){n?.errorMessages&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function kl(e,t,a,n,r){e[t]=a,jl(e,t,n,r)}function Ll(e,t){return pd(e.type._def,t)}function Ml(e,t,a){const n=a??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,n)=>Ml(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Gl(e,t)}}const Gl=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const n of e.checks)switch(n.kind){case"min":kl(a,"minimum",n.value,n.message,t);break;case"max":kl(a,"maximum",n.value,n.message,t)}return a};let xl;const Fl=/^[cC][^\s-]{8,}$/,Bl=/^[0-9a-z]+$/,zl=/^[0-9A-HJKMNP-TV-Z]{26}$/,Vl=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,$l=()=>(void 0===xl&&(xl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xl),Ul=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Hl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ql=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wl=/^[a-zA-Z0-9_-]{21}$/,Ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function Yl(e,t){const a={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":kl(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t);break;case"max":kl(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Zl(a,"email",n.message,t);break;case"format:idn-email":Zl(a,"idn-email",n.message,t);break;case"pattern:zod":ed(a,Vl,n.message,t)}break;case"url":Zl(a,"uri",n.message,t);break;case"uuid":Zl(a,"uuid",n.message,t);break;case"regex":ed(a,n.regex,n.message,t);break;case"cuid":ed(a,Fl,n.message,t);break;case"cuid2":ed(a,Bl,n.message,t);break;case"startsWith":ed(a,RegExp(`^${Xl(n.value,t)}`),n.message,t);break;case"endsWith":ed(a,RegExp(`${Xl(n.value,t)}$`),n.message,t);break;case"datetime":Zl(a,"date-time",n.message,t);break;case"date":Zl(a,"date",n.message,t);break;case"time":Zl(a,"time",n.message,t);break;case"duration":Zl(a,"duration",n.message,t);break;case"length":kl(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t),kl(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"includes":ed(a,RegExp(Xl(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&Zl(a,"ipv4",n.message,t),"v4"!==n.version&&Zl(a,"ipv6",n.message,t);break;case"base64url":ed(a,ql,n.message,t);break;case"jwt":ed(a,Ql,n.message,t);break;case"cidr":"v6"!==n.version&&ed(a,Ul,n.message,t),"v4"!==n.version&&ed(a,Hl,n.message,t);break;case"emoji":ed(a,$l(),n.message,t);break;case"ulid":ed(a,zl,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Zl(a,"binary",n.message,t);break;case"contentEncoding:base64":kl(a,"contentEncoding","base64",n.message,t);break;case"pattern:zod":ed(a,Kl,n.message,t)}break;case"nanoid":ed(a,Wl,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:(()=>{})()}return a}function Xl(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)Jl.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}const Jl=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Zl(e,t,a,n){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):kl(e,"format",t,a,n)}function ed(e,t,a,n){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:td(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):kl(e,"pattern",td(t,n),a,n)}function td(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),n=e.flags.includes("m"),r=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",s=!1,p=!1,l=!1;for(let e=0;e<i.length;e++)if(s)o+=i[e],s=!1;else{if(a)if(p){if(i[e].match(/[a-z]/)){l?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),l=!1):"-"===i[e+1]&&i[e+2]?.match(/[a-z]/)?(o+=i[e],l=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(n){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}r&&"."===i[e]?o+=p?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?s=!0:p&&"]"===i[e]?p=!1:p||"["!==i[e]||(p=!0))}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ad(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===Qt.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,n)=>({...a,[n]:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Pl(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const a={type:"object",additionalProperties:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return a;if(e.keyType?._def.typeName===Qt.ZodString&&e.keyType._def.checks?.length){const{type:n,...r}=Yl(e.keyType._def,t);return{...a,propertyNames:r}}if(e.keyType?._def.typeName===Qt.ZodEnum)return{...a,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===Qt.ZodBranded&&e.keyType._def.type._def.typeName===Qt.ZodString&&e.keyType._def.type._def.checks?.length){const{type:n,...r}=Ll(e.keyType._def,t);return{...a,propertyNames:r}}return a}const nd={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const rd=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function id(e,t){const a="openAi"===t.target,n={type:"object",properties:{}},r=[],i=e.shape();for(const e in i){let o=i[e];if(void 0===o||void 0===o._def)continue;let s=od(o);s&&a&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);const p=pd(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==p&&(n.properties[e]=p,s||r.push(e))}r.length&&(n.required=r);const o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return pd(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(n.additionalProperties=o),n}function od(e){try{return e.isOptional()}catch{return!0}}const sd=(e,t,a)=>{switch(t){case Qt.ZodString:return Yl(e,a);case Qt.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"int":a.type="integer",jl(a,"type",n.message,t);break;case"min":"jsonSchema7"===t.target?n.inclusive?kl(a,"minimum",n.value,n.message,t):kl(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),kl(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?kl(a,"maximum",n.value,n.message,t):kl(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),kl(a,"maximum",n.value,n.message,t));break;case"multipleOf":kl(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Qt.ZodObject:return id(e,a);case Qt.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"min":"jsonSchema7"===t.target?n.inclusive?kl(a,"minimum",n.value,n.message,t):kl(a,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),kl(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?n.inclusive?kl(a,"maximum",n.value,n.message,t):kl(a,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),kl(a,"maximum",n.value,n.message,t));break;case"multipleOf":kl(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case Qt.ZodBoolean:return{type:"boolean"};case Qt.ZodDate:return Ml(e,a);case Qt.ZodUndefined:return function(e){return{not:Pl(e)}}(a);case Qt.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Qt.ZodArray:return function(e,t){const a={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Qt.ZodAny&&(a.items=pd(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&kl(a,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&kl(a,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(kl(a,"minItems",e.exactLength.value,e.exactLength.message,t),kl(a,"maxItems",e.exactLength.value,e.exactLength.message,t)),a}(e,a);case Qt.ZodUnion:case Qt.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return rd(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in nd&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=nd[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return rd(e,t)}(e,a);case Qt.ZodIntersection:return function(e,t){const a=[pd(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),pd(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let n="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...n}=e;t=n}else n=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(n=void 0);var t}),r.length?{allOf:r,...n}:void 0}(e,a);case Qt.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:pd(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>pd(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Qt.ZodRecord:return ad(e,a);case Qt.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case Qt.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Qt.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(a.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:a}}(e);case Qt.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:nd[e.innerType._def.typeName],nullable:!0}:{type:[nd[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Qt.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return pd(e.innerType._def,t);const a=pd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Pl(t)},a]}:Pl(t)})(e,a);case Qt.ZodMap:return function(e,t){return"record"===t.mapStrategy?ad(e,t):{type:"array",maxItems:125,items:{type:"array",items:[pd(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Pl(t),pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Pl(t)],minItems:2,maxItems:2}}}(e,a);case Qt.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:pd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&kl(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&kl(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Qt.ZodLazy:return()=>e.getter()._def;case Qt.ZodPromise:return function(e,t){return pd(e.type._def,t)}(e,a);case Qt.ZodNaN:case Qt.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Pl({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Qt.ZodEffects:return function(e,t){return"input"===t.effectStrategy?pd(e.schema._def,t):Pl(t)}(e,a);case Qt.ZodAny:return Pl(a);case Qt.ZodUnknown:return function(e){return Pl(e)}(a);case Qt.ZodDefault:return function(e,t){return{...pd(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Qt.ZodBranded:return Ll(e,a);case Qt.ZodReadonly:case Qt.ZodCatch:return((e,t)=>pd(e.innerType._def,t))(e,a);case Qt.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return pd(e.in._def,t);if("output"===t.pipeStrategy)return pd(e.out._def,t);const a=pd(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,pd(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Qt.ZodFunction:case Qt.ZodVoid:case Qt.ZodSymbol:default:return}};function pd(e,t,a=!1){const n=t.seen.get(e);if(t.override){const r=t.override?.(e,t,n,a);if(r!==Il)return r}if(n&&!a){const e=ld(n,t);if(void 0!==e)return e}const r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);const i=sd(e,e.typeName,t),o="function"==typeof i?pd(i(),t):i;if(o&&dd(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return r.jsonSchema=o,a}return r.jsonSchema=o,o}const ld=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Dl(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Pl(t)):"seen"===t.$refStrategy?Pl(t):void 0}},dd=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a);function ud(e,t){var a,n,r,i;return $r(e)?function(e,t){if(e instanceof Xr){const a=new Al(t),n={};for(const t of e._idmap.entries()){const[e,n]=t;a.process(n)}const r={},i={registry:e,uri:t?.uri,defs:n};for(const n of e._idmap.entries()){const[e,o]=n;r[e]=a.emit(o,{...t,external:i})}if(Object.keys(n).length>0){const e="draft-2020-12"===a.target?"$defs":"definitions";r.__shared={[e]:n}}return{schemas:r}}const a=new Al(t);return a.process(e),a.emit(e,t)}(e,{target:(i=null==t?void 0:t.target,i?"jsonSchema7"===i||"draft-7"===i?"draft-7":"jsonSchema2019-09"===i||"draft-2020-12"===i?"draft-2020-12":"draft-7":"draft-7"),io:null!==(a=null==t?void 0:t.pipeStrategy)&&void 0!==a?a:"input"}):((e,t)=>{const a=Cl(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>({...e,[t]:pd(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0)??Pl(a)}),{}):void 0;const r="string"==typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,i=pd(e._def,void 0===r?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??Pl(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),a.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[a.openAiAnyTypeName]||(n[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const s=void 0===r?n?{...i,[a.definitionPath]:n}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...n,[r]:i}};return"jsonSchema7"===a.target?s.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(s.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s})(e,{strictUnions:null===(n=null==t?void 0:t.strictUnions)||void 0===n||n,pipeStrategy:null!==(r=null==t?void 0:t.pipeStrategy)&&void 0!==r?r:"input"})}function cd(e){const t=qr(e),a=null==t?void 0:t.method;if(!a)throw new Error("Schema is missing a method literal");const n=Yr(a);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function md(e,t){const a=Hr(e,t);if(!a.success)throw a.error;return a.data}class fd{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(cs,e=>{this._oncancel(e)}),this.setNotificationHandler(Cs,e=>{this._onprogress(e)}),this.setRequestHandler(Ss,e=>({})),this._taskStore=null==e?void 0:e.taskStore,this._taskMessageQueue=null==e?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(xs,async(e,t)=>{const a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new Ol(ss.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(Bs,async(e,t)=>{const a=async()=>{var n;const r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,a=t.id,n=this._requestResolvers.get(a);if(n)if(this._requestResolvers.delete(a),"response"===e.type)n(t);else{const e=t;n(new Ol(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${a}`))}continue}await(null===(n=this._transport)||void 0===n?void 0:n.send(e.message,{relatedRequestId:t.requestId}))}}const i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Ol(ss.InvalidParams,`Task not found: ${r}`);if(!bl(i.status))return await this._waitForTaskUpdate(r,t.signal),await a();if(bl(i.status)){const e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[zo]:{taskId:r}}}}return await a()};return await a()}),this.setRequestHandler(zs,async(e,t)=>{var a;try{const{tasks:n,nextCursor:r}=await this._taskStore.listTasks(null===(a=e.params)||void 0===a?void 0:a.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Ol(ss.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler($s,async(e,t)=>{try{const a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new Ol(ss.InvalidParams,`Task not found: ${e.params.taskId}`);if(bl(a.status))throw new Ol(ss.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Ol(ss.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(e){if(e instanceof Ol)throw e;throw new Ol(ss.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}_setupTimeout(e,t,a,n,r=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:r,onTimeout:n})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Ol.fromError(ss.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,a,n;this._transport=e;const r=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==r||r(),this._onclose()};const i=null===(a=this.transport)||void 0===a?void 0:a.onerror;this._transport.onerror=e=>{null==i||i(e),this._onerror(e)};const o=null===(n=this._transport)||void 0===n?void 0:n.onmessage;this._transport.onmessage=(e,t)=>{var a;null==o||o(e,t),os(e)||(a=e,ps.safeParse(a).success)?this._onresponse(e):ns(e)?this._onrequest(e,t):(e=>rs.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const a=Ol.fromError(ss.ConnectionClosed,"Connection closed");this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);for(const e of t.values())e(a)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const a=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==a&&Promise.resolve().then(()=>a(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var a,n,r,i,o,s;const p=null!==(a=this._requestHandlers.get(e.method))&&void 0!==a?a:this.fallbackRequestHandler,l=this._transport,d=null===(i=null===(r=null===(n=e.params)||void 0===n?void 0:n._meta)||void 0===r?void 0:r[zo])||void 0===i?void 0:i.taskId;if(void 0===p){const t={jsonrpc:"2.0",id:e.id,error:{code:ss.MethodNotFound,message:"Method not found"}};return void(d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:t,timestamp:Date.now()},null==l?void 0:l.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):null==l||l.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const u=new AbortController;this._requestHandlerAbortControllers.set(e.id,u);const c=null===(o=e.params)||void 0===o?void 0:o.task,m=this._taskStore?this.requestTaskStore(e,null==l?void 0:l.sessionId):void 0,f={signal:u.signal,sessionId:null==l?void 0:l.sessionId,_meta:null===(s=e.params)||void 0===s?void 0:s._meta,sendNotification:async t=>{const a={relatedRequestId:e.id};d&&(a.relatedTask={taskId:d}),await this.notification(t,a)},sendRequest:async(t,a,n)=>{var r,i;const o={...n,relatedRequestId:e.id};d&&!o.relatedTask&&(o.relatedTask={taskId:d});const s=null!==(i=null===(r=o.relatedTask)||void 0===r?void 0:r.taskId)&&void 0!==i?i:d;return s&&m&&await m.updateTaskStatus(s,"input_required"),await this.request(t,a,o)},authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo,taskId:d,taskStore:m,taskRequestedTtl:null==c?void 0:c.ttl,closeSSEStream:null==t?void 0:t.closeSSEStream,closeStandaloneSSEStream:null==t?void 0:t.closeStandaloneSSEStream};Promise.resolve().then(()=>{c&&this.assertTaskHandlerCapability(e.method)}).then(()=>p(e,f)).then(async t=>{if(u.signal.aborted)return;const a={result:t,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:a,timestamp:Date.now()},null==l?void 0:l.sessionId):await(null==l?void 0:l.send(a))},async t=>{var a;if(u.signal.aborted)return;const n={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:ss.InternalError,message:null!==(a=t.message)&&void 0!==a?a:"Internal error",...void 0!==t.data&&{data:t.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:n,timestamp:Date.now()},null==l?void 0:l.sessionId):await(null==l?void 0:l.send(n))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...a}=e.params,n=Number(t),r=this._progressHandlers.get(n);if(!r)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const i=this._responseHandlers.get(n),o=this._timeoutInfo.get(n);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(e){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void i(e)}r(a)}_onresponse(e){const t=Number(e.id),a=this._requestResolvers.get(t);if(a){if(this._requestResolvers.delete(t),os(e))a(e);else{a(new Ol(e.error.code,e.error.message,e.error.data))}return}const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let r=!1;if(os(e)&&e.result&&"object"==typeof e.result){const a=e.result;if(a.task&&"object"==typeof a.task){const e=a.task;"string"==typeof e.taskId&&(r=!0,this._taskProgressTokens.set(e.taskId,t))}}if(r||this._progressHandlers.delete(t),os(e))n(e);else{n(Ol.fromError(e.error.code,e.error.message,e.error.data))}}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}async*requestStream(e,t,a){var n,r,i,o;const{task:s}=null!=a?a:{};if(!s){try{const n=await this.request(e,t,a);yield{type:"result",result:n}}catch(e){yield{type:"error",error:e instanceof Ol?e:new Ol(ss.InternalError,String(e))}}return}let p;try{const s=await this.request(e,Ls,a);if(!s.task)throw new Ol(ss.InternalError,"Task creation did not return a task");for(p=s.task.taskId,yield{type:"taskCreated",task:s.task};;){const e=await this.getTask({taskId:p},a);if(yield{type:"taskStatus",task:e},bl(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:p},t,a);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new Ol(ss.InternalError,`Task ${p} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new Ol(ss.InternalError,`Task ${p} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:p},t,a);return void(yield{type:"result",result:e})}const s=null!==(i=null!==(n=e.pollInterval)&&void 0!==n?n:null===(r=this._options)||void 0===r?void 0:r.defaultTaskPollInterval)&&void 0!==i?i:1e3;await new Promise(e=>setTimeout(e,s)),null===(o=null==a?void 0:a.signal)||void 0===o||o.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof Ol?e:new Ol(ss.InternalError,String(e))}}}request(e,t,a){const{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i,task:o,relatedTask:s}=null!=a?a:{};return new Promise((p,l)=>{var d,u,c,m,f,_,h;const E=e=>{l(e)};if(!this._transport)return void E(new Error("Not connected"));if(!0===(null===(d=this._options)||void 0===d?void 0:d.enforceStrictCapabilities))try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){return void E(e)}null===(u=null==a?void 0:a.signal)||void 0===u||u.throwIfAborted();const y=this._requestMessageId++,T={...e,jsonrpc:"2.0",id:y};(null==a?void 0:a.onprogress)&&(this._progressHandlers.set(y,a.onprogress),T.params={...e.params,_meta:{...(null===(c=e.params)||void 0===c?void 0:c._meta)||{},progressToken:y}}),o&&(T.params={...T.params,task:o}),s&&(T.params={...T.params,_meta:{...(null===(m=T.params)||void 0===m?void 0:m._meta)||{},[zo]:s}});const R=e=>{var t;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(e)}},{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const a=e instanceof Ol?e:new Ol(ss.RequestTimeout,String(e));l(a)};this._responseHandlers.set(y,e=>{var n;if(!(null===(n=null==a?void 0:a.signal)||void 0===n?void 0:n.aborted)){if(e instanceof Error)return l(e);try{const a=Hr(t,e.result);a.success?p(a.data):l(a.error)}catch(e){l(e)}}}),null===(f=null==a?void 0:a.signal)||void 0===f||f.addEventListener("abort",()=>{var e;R(null===(e=null==a?void 0:a.signal)||void 0===e?void 0:e.reason)});const g=null!==(_=null==a?void 0:a.timeout)&&void 0!==_?_:6e4;this._setupTimeout(y,g,null==a?void 0:a.maxTotalTimeout,()=>R(Ol.fromError(ss.RequestTimeout,"Request timed out",{timeout:g})),null!==(h=null==a?void 0:a.resetTimeoutOnProgress)&&void 0!==h&&h);const v=null==s?void 0:s.taskId;if(v){const e=e=>{const t=this._responseHandlers.get(y);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${y}`))};this._requestResolvers.set(y,e),this._enqueueTaskMessage(v,{type:"request",message:T,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(y),l(e)})}else this._transport.send(T,{relatedRequestId:n,resumptionToken:r,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(y),l(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Fs,t)}async getTaskResult(e,t,a){return this.request({method:"tasks/result",params:e},t,a)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Vs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Us,t)}async notification(e,t){var a,n,r,i,o;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=null===(a=null==t?void 0:t.relatedTask)||void 0===a?void 0:a.taskId;if(s){const a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...(null===(n=e.params)||void 0===n?void 0:n._meta)||{},[zo]:t.relatedTask}}};return void await this._enqueueTaskMessage(s,{type:"notification",message:a,timestamp:Date.now()})}if((null!==(i=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==i?i:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)&&!(null==t?void 0:t.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var a,n;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(r={...r,params:{...r.params,_meta:{...(null===(a=r.params)||void 0===a?void 0:a._meta)||{},[zo]:t.relatedTask}}}),null===(n=this._transport)||void 0===n||n.send(r,t).catch(e=>this._onerror(e))})}let p={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(p={...p,params:{...p.params,_meta:{...(null===(o=p.params)||void 0===o?void 0:o._meta)||{},[zo]:t.relatedTask}}}),await this._transport.send(p,t)}setRequestHandler(e,t){const a=cd(e);this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(a,n)=>{const r=md(e,a);return Promise.resolve(t(r,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const a=cd(e);this._notificationHandlers.set(a,a=>{const n=md(e,a);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,a){var n;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=null===(n=this._options)||void 0===n?void 0:n.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,a,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const a=await this._taskMessageQueue.dequeueAll(e,t);for(const t of a)if("request"===t.type&&ns(t.message)){const a=t.message.id,n=this._requestResolvers.get(a);n?(n(new Ol(ss.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){var a,n,r;let i=null!==(n=null===(a=this._options)||void 0===a?void 0:a.defaultTaskPollInterval)&&void 0!==n?n:1e3;try{const t=await(null===(r=this._taskStore)||void 0===r?void 0:r.getTask(e));(null==t?void 0:t.pollInterval)&&(i=t.pollInterval)}catch(e){}return new Promise((e,a)=>{if(t.aborted)return void a(new Ol(ss.InvalidRequest,"Request cancelled"));const n=setTimeout(e,i);t.addEventListener("abort",()=>{clearTimeout(n),a(new Ol(ss.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const a=this._taskStore;if(!a)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await a.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await a.getTask(e,t);if(!n)throw new Ol(ss.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,r)=>{await a.storeTaskResult(e,n,r,t);const i=await a.getTask(e,t);if(i){const t=Gs.parse({method:"notifications/tasks/status",params:i});await this.notification(t),bl(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>a.getTaskResult(e,t),updateTaskStatus:async(e,n,r)=>{const i=await a.getTask(e,t);if(!i)throw new Ol(ss.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(bl(i.status))throw new Ol(ss.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await a.updateTaskStatus(e,n,r,t);const o=await a.getTask(e,t);if(o){const t=Gs.parse({method:"notifications/tasks/status",params:o});await this.notification(t),bl(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>a.listTasks(e,t)}}}function _d(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var hd=c(1601),Ed=c(4421);class yd{constructor(e){this._ajv=null!=e?e:function(){const e=new hd.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ed(e),e}()}getValidator(e){var t;const a="$id"in e&&"string"==typeof e.$id&&null!==(t=this._ajv.getSchema(e.$id))&&void 0!==t?t:this._ajv.compile(e);return e=>a(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(a.errors)}}}class Td{constructor(e){this._server=e}requestStream(e,t,a){return this._server.requestStream(e,t,a)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,a){return this._server.getTaskResult({taskId:e},t,a)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class Rd extends fd{constructor(e,t){var a,n;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Gp.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const a=this._loggingLevels.get(t);return!!a&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(a)},this._capabilities=null!==(a=null==t?void 0:t.capabilities)&&void 0!==a?a:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!==(n=null==t?void 0:t.jsonSchemaValidator)&&void 0!==n?n:new yd,this.setRequestHandler(Os,e=>this._oninitialize(e)),this.setNotificationHandler(As,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(Fp,async(e,t)=>{var a;const n=t.sessionId||(null===(a=t.requestInfo)||void 0===a?void 0:a.headers["mcp-session-id"])||void 0,{level:r}=e.params,i=Gp.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Td(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const a={...e};for(const e in t){const n=e,r=t[n];if(void 0===r)continue;const i=a[n];_d(i)&&_d(r)?a[n]={...i,...r}:a[n]=r}return a}(this._capabilities,e)}setRequestHandler(e,t){var a,n,r;const i=qr(e),o=null==i?void 0:i.method;if(!o)throw new Error("Schema is missing a method literal");let s;if($r(o)){const e=o,t=null===(a=e._zod)||void 0===a?void 0:a.def;s=null!==(n=null==t?void 0:t.value)&&void 0!==n?n:e.value}else{const e=o,t=e._def;s=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:e.value}if("string"!=typeof s)throw new Error("Schema method literal must be a string");if("tools/call"===s){const a=async(e,a)=>{const n=Hr(Lp,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Ol(ss.InvalidParams,`Invalid tools/call request: ${e}`)}const{params:r}=n.data,i=await Promise.resolve(t(e,a));if(r.task){const e=Hr(Ls,i);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Ol(ss.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const o=Hr(jp,i);if(!o.success){const e=o.error instanceof Error?o.error.message:String(o.error);throw new Ol(ss.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){var t,a,n;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(a=this._clientCapabilities)||void 0===a?void 0:a.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(n=this._clientCapabilities)||void 0===n?void 0:n.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){var t,a;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(null===(a=null===(t=this._clientCapabilities)||void 0===t?void 0:t.elicitation)||void 0===a?void 0:a.url))throw new Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t,a;!function(e,t,a){var n,r;if(!e)throw new Error(`${a} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(null===(n=e.sampling)||void 0===n?void 0:n.createMessage))throw new Error(`${a} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(null===(r=e.elicitation)||void 0===r?void 0:r.create))throw new Error(`${a} does not support task creation for elicitation/create (required for ${t})`)}}(null===(a=null===(t=this._clientCapabilities)||void 0===t?void 0:t.tasks)||void 0===a?void 0:a.requests,e,"Client")}assertTaskHandlerCapability(e){var t;this._capabilities&&function(e,t,a){var n;if(!e)throw new Error(`${a} does not support task creation (required for ${t})`);if("tools/call"===t&&!(null===(n=e.tools)||void 0===n?void 0:n.call))throw new Error(`${a} does not support task creation for tools/call (required for ${t})`)}(null===(t=this._capabilities.tasks)||void 0===t?void 0:t.requests,e,"Server")}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:Bo.includes(t)?t:Fo,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},ds)}async createMessage(e,t){var a,n;if((e.tools||e.toolChoice)&&!(null===(n=null===(a=this._clientCapabilities)||void 0===a?void 0:a.sampling)||void 0===n?void 0:n.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],a=Array.isArray(t.content)?t.content:[t.content],n=a.some(e=>"tool_result"===e.type),r=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=r?Array.isArray(r.content)?r.content:[r.content]:[],o=i.some(e=>"tool_use"===e.type);if(n){if(a.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!o)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(o){const e=new Set(i.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(a.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Jp,t):this.request({method:"sampling/createMessage",params:e},Xp,t)}async elicitInput(e,t){var a,n,r,i,o;switch(null!==(a=e.mode)&&void 0!==a?a:"form"){case"url":{if(!(null===(r=null===(n=this._clientCapabilities)||void 0===n?void 0:n.elicitation)||void 0===r?void 0:r.url))throw new Error("Client does not support url elicitation.");const a=e;return this.request({method:"elicitation/create",params:a},ml,t)}case"form":{if(!(null===(o=null===(i=this._clientCapabilities)||void 0===i?void 0:i.elicitation)||void 0===o?void 0:o.form))throw new Error("Client does not support form elicitation.");const a="form"===e.mode?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:a},ml,t);if("accept"===n.action&&n.content&&a.requestedSchema)try{const e=this._jsonSchemaValidator.getValidator(a.requestedSchema)(n.content);if(!e.valid)throw new Ol(ss.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof Ol)throw e;throw new Ol(ss.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return n}}}createElicitationCompletionNotifier(e,t){var a,n;if(!(null===(n=null===(a=this._clientCapabilities)||void 0===a?void 0:a.elicitation)||void 0===n?void 0:n.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},gl,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const gd=Symbol.for("mcp.completable");var vd;!function(e){e.Completable="McpCompletable"}(vd||(vd={}));const Od=/^[A-Za-z0-9._-]{1,128}$/;function Nd(e){const t=function(e){const t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Od.test(e)){const a=e.split("").filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,a)=>a.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${a.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);return function(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(const e of t)console.warn(` - ${e}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}(e,t.warnings),t.isValid}class bd{constructor(e){this._mcpServer=e}registerToolTask(e,t,a){const n={taskSupport:"required",...t.execution};if("forbidden"===n.taskSupport)throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,a)}}class Ad{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Rd(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new bd(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(Dp)),this.server.assertCanSetRequestHandler(Pd(Lp)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Dp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{const a={name:e,title:t.title,description:t.description,inputSchema:(()=>{const e=Wr(t.inputSchema);return e?ud(e,{strictUnions:!0,pipeStrategy:"input"}):Sd})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){const e=Wr(t.outputSchema);e&&(a.outputSchema=ud(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(Lp,async(e,t)=>{var a;try{const n=this._registeredTools[e.params.name];if(!n)throw new Ol(ss.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Ol(ss.InvalidParams,`Tool ${e.params.name} disabled`);const r=!!e.params.task,i=null===(a=n.execution)||void 0===a?void 0:a.taskSupport,o="createTask"in n.handler;if(("required"===i||"optional"===i)&&!o)throw new Ol(ss.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!r)throw new Ol(ss.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===i&&!r&&o)return await this.handleAutomaticTaskPolling(n,e,t);const s=await this.validateToolInput(n,e.params.arguments,e.params.name),p=await this.executeToolHandler(n,s,t);return r||await this.validateToolOutput(n,p,e.params.name),p}catch(e){if(e instanceof Ol&&e.code===ss.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,a){if(!e.inputSchema)return;const n=Wr(e.inputSchema),r=null!=n?n:e.inputSchema,i=await Kr(r,t);if(!i.success){const e=Qr("error"in i?i.error:"Unknown error");throw new Ol(ss.InvalidParams,`Input validation error: Invalid arguments for tool ${a}: ${e}`)}return i.data}async validateToolOutput(e,t,a){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new Ol(ss.InvalidParams,`Output validation error: Tool ${a} has an output schema but no structured content was provided`);const n=Wr(e.outputSchema),r=await Kr(n,t.structuredContent);if(!r.success){const e=Qr("error"in r?r.error:"Unknown error");throw new Ol(ss.InvalidParams,`Output validation error: Invalid structured content for tool ${a}: ${e}`)}}async executeToolHandler(e,t,a){const n=e.handler;if("createTask"in n){if(!a.taskStore)throw new Error("No task store provided.");const r={...a,taskStore:a.taskStore};if(e.inputSchema){const e=n;return await Promise.resolve(e.createTask(t,r))}{const e=n;return await Promise.resolve(e.createTask(r))}}if(e.inputSchema){const e=n;return await Promise.resolve(e(t,a))}{const e=n;return await Promise.resolve(e(a))}}async handleAutomaticTaskPolling(e,t,a){var n;if(!a.taskStore)throw new Error("No task store provided for task-capable tool.");const r=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,o={...a,taskStore:a.taskStore},s=r?await Promise.resolve(i.createTask(r,o)):await Promise.resolve(i.createTask(o)),p=s.task.taskId;let l=s.task;const d=null!==(n=l.pollInterval)&&void 0!==n?n:5e3;for(;"completed"!==l.status&&"failed"!==l.status&&"cancelled"!==l.status;){await new Promise(e=>setTimeout(e,d));const e=await a.taskStore.getTask(p);if(!e)throw new Ol(ss.InternalError,`Task ${p} not found during polling`);l=e}return await a.taskStore.getTaskResult(p)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Pd(El)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(El,async e=>{switch(e.params.ref.type){case"ref/prompt":return function(e){if("ref/prompt"!==e.params.ref.type)throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return function(e){if("ref/resource"!==e.params.ref.type)throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Ol(ss.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){const a=this._registeredPrompts[t.name];if(!a)throw new Ol(ss.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new Ol(ss.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return kd;const n=qr(a.argsSchema),r=null==n?void 0:n[e.params.argument.name];if(!function(e){return!!e&&"object"==typeof e&&gd in e}(r))return kd;const i=function(e){const t=e[gd];return null==t?void 0:t.complete}(r);if(!i)return kd;return jd(await i(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){const a=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!a){if(this._registeredResources[t.uri])return kd;throw new Ol(ss.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const n=a.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return kd;return jd(await n(e.params.argument.value,e.params.context))}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(Js)),this.server.assertCanSetRequestHandler(Pd(ep)),this.server.assertCanSetRequestHandler(Pd(rp)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Js,async(e,t)=>{const a=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),n=[];for(const e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;const a=await e.resourceTemplate.listCallback(t);for(const t of a.resources)n.push({...e.metadata,...t})}return{resources:[...a,...n]}}),this.server.setRequestHandler(ep,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(rp,async(e,t)=>{const a=new URL(e.params.uri),n=this._registeredResources[a.toString()];if(n){if(!n.enabled)throw new Ol(ss.InvalidParams,`Resource ${a} disabled`);return n.readCallback(a,t)}for(const e of Object.values(this._registeredResourceTemplates)){const n=e.resourceTemplate.uriTemplate.match(a.toString());if(n)return e.readCallback(a,n,t)}throw new Ol(ss.InvalidParams,`Resource ${a} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Pd(_p)),this.server.assertCanSetRequestHandler(Pd(yp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(_p,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Dd(t.argsSchema):void 0}))})),this.server.setRequestHandler(yp,async(e,t)=>{const a=this._registeredPrompts[e.params.name];if(!a)throw new Ol(ss.InvalidParams,`Prompt ${e.params.name} not found`);if(!a.enabled)throw new Ol(ss.InvalidParams,`Prompt ${e.params.name} disabled`);if(a.argsSchema){const n=Wr(a.argsSchema),r=await Kr(n,e.params.arguments);if(!r.success){const t=Qr("error"in r?r.error:"Unknown error");throw new Ol(ss.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}const i=r.data,o=a.callback;return await Promise.resolve(o(i,t))}{const e=a.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...a){let n;"object"==typeof a[0]&&(n=a.shift());const r=a[0];if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const a=this._createRegisteredResource(e,void 0,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const a=this._createRegisteredResourceTemplate(e,void 0,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(e,t,a,n){if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const r=this._createRegisteredResource(e,a.title,t,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const r=this._createRegisteredResourceTemplate(e,a.title,t,a,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}_createRegisteredResource(e,t,a,n,r){const i={name:e,title:t,metadata:n,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==a&&(delete this._registeredResources[a],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[a]=i,i}_createRegisteredResourceTemplate(e,t,a,n,r){const i={resourceTemplate:a,title:t,metadata:n,readCallback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,a,n,r){const i={title:t,description:a,argsSchema:void 0===n?void 0:Ur(n),callback:r,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=Ur(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,a,n,r,i,o,s,p){Nd(e);const l={title:t,description:a,inputSchema:Cd(n),outputSchema:Cd(r),annotations:i,execution:o,_meta:s,handler:p,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&Nd(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=l)),void 0!==t.title&&(l.title=t.title),void 0!==t.description&&(l.description=t.description),void 0!==t.paramsSchema&&(l.inputSchema=Ur(t.paramsSchema)),void 0!==t.callback&&(l.handler=t.callback),void 0!==t.annotations&&(l.annotations=t.annotations),void 0!==t._meta&&(l._meta=t._meta),void 0!==t.enabled&&(l.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let a,n,r;if("string"==typeof t[0]&&(a=t.shift()),t.length>1){const e=t[0];wd(e)?(n=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!wd(t[0])&&(r=t.shift())):"object"==typeof e&&null!==e&&(r=t.shift())}const i=t[0];return this._createRegisteredTool(e,void 0,a,n,undefined,r,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,a){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:n,description:r,inputSchema:i,outputSchema:o,annotations:s,_meta:p}=t;return this._createRegisteredTool(e,n,r,i,o,s,{taskSupport:"forbidden"},p,a)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let a,n;"string"==typeof t[0]&&(a=t.shift()),t.length>1&&(n=t.shift());const r=t[0],i=this._createRegisteredPrompt(e,void 0,a,n,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,a){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:n,description:r,argsSchema:i}=t,o=this._createRegisteredPrompt(e,n,r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}const Sd={type:"object",properties:{}};function Id(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function wd(e){return"object"==typeof e&&null!==e&&(!function(e){return"_def"in e||"_zod"in e||Id(e)}(e)&&(0===Object.keys(e).length||Object.values(e).some(Id)))}function Cd(e){if(e)return wd(e)?Ur(e):e}function Dd(e){const t=qr(e);return t?Object.entries(t).map(([e,t])=>{const a=function(e){var t,a,n,r;if($r(e))return null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.description;const i=e;return null!==(n=e.description)&&void 0!==n?n:null===(r=i._def)||void 0===r?void 0:r.description}(t),n=function(e){var t,a,n;if($r(e))return"optional"===(null===(a=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===a?void 0:a.type);const r=e;return"function"==typeof e.isOptional?e.isOptional():"ZodOptional"===(null===(n=r._def)||void 0===n?void 0:n.typeName)}(t);return{name:e,description:a,required:!n}}):[]}function Pd(e){const t=qr(e),a=null==t?void 0:t.method;if(!a)throw new Error("Schema is missing a method literal");const n=Yr(a);if("string"==typeof n)return n;throw new Error("Schema method literal must be a string")}function jd(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const kd={completion:{values:[],hasMore:!1}};var Ld=c(1708);class Md{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf("\n");if(-1===e)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),function(e){return ls.parse(JSON.parse(e))}(t)}clear(){this._buffer=void 0}}class Gd{constructor(e=Ld.stdin,t=Ld.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Md,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{const t=this._readBuffer.readMessage();if(null===t)break;null===(e=this.onmessage)||void 0===e||e.call(this,t)}catch(e){null===(t=this.onerror)||void 0===t||t.call(this,e)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror);0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null===(e=this.onclose)||void 0===e||e.call(this)}send(e){return new Promise(t=>{const a=function(e){return JSON.stringify(e)+"\n"}(e);this._stdout.write(a)?t():this._stdout.once("drain",t)})}}var xd={info:"info",manage_signature:"sign",query_application:"qa",query_device:"qd",query_device_group:"qdg",query_module:"qm",query_activity_log:"qal",create_application:"ca",create_device:"cd",create_device_group:"cdg",create_module:"cm",update_application:"ua",bind_application:"ba",short_edit_application:"uas",canvas_control_application:"uacc",update_device:"ud",update_device_group:"udg",update_module:"um",short_edit_module:"ums",remove_application:"ra",remove_device:"rd",remove_device_group:"rdg",remove_module:"rm",control_device:"ctld",control_application_device:"ctlad",control_device_group:"ctldg",query_media_flow:"qmf",write_media_flow:"wmf",access_unstable_feature:"UNSTABLE"},Fd=Object.entries(xd).reduce((e,[t,a])=>(e[a]=t,e),{}),Bd=["HS256","RS256"],zd=["https://auth0.bricks.tools/","https://mybigday.auth0.com/"];function Vd(e){try{var t=e.queryStringParameters?.token;if(!t){var a=new Headers(e.headers);t=a.get("authorization")?.replace("Bearer ","")}if(!t)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var t=e.split(".");if(t.length<3)return null;var a=JSON.parse(Buffer.from(t[0],"base64url").toString());return Bd.includes(a?.alg)?JSON.parse(Buffer.from(t[1],"base64url").toString()):null}catch{return null}}(t);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var r=zd.includes(n.iss)?"user":"workspace";if("workspace"===r){var i=Array.isArray(n.t)?n.t:[];n.permissions=i.reduce((e,t)=>{var a=Fd[t];return a&&e.push(a),e},[])}else n.permissions=Object.keys(xd);return{success:!0,token:t,tokenInfo:n,tokenType:r}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}const $d='# Getting Started with BRICKS\n\nBRICKS (方塊磚) is a comprehensive platform for creating interactive multimedia display applications specifically designed for digital signage screens. It enables users to design complete applications without programming, using a visual, component-based approach.\n\n**Important**: Users interact through a visual GUI editor, not raw configuration files. Always describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation details\n\n## Core Philosophy\n\nBRICKS operates as a **Launcher system** that reads configuration files from the cloud (or cached locally) and must maintain normal operation even when offline. The system periodically reports health status and supports watchdog timers for automatic restart or maintenance mode activation.\n\n## Fundamental Architecture\n\n### The Three Core Elements\n\n#### 1. Canvas (畫布)\n- **Definition**: The visual container that defines what users see on screen\n- **Behavior**: Screen transitions occur by switching between different canvases\n- **Smart Transitions**: When switching canvases, BRICKS automatically compares shared elements and smoothly animates their position/size changes\n- **Properties**:\n - `Showing Timeout`: Auto-advance to next canvas after specified time\n - `Next Canvas ID`: Target canvas for timeout transitions\n - `Background Color`: Canvas background\n - `Dismiss Keyboard On Press`: Touch behavior for keyboard dismissal\n- **Events**: `CANVAS_FIRST_ENTER`, `CANVAS_ENTER`, `CANVAS_SHOWING_TIMEOUT`, `CANVAS_EXIT`\n\n#### 2. Brick (方塊)\n- **Definition**: Visual components that display content and handle user interactions\n- **Animation System**: All bricks support three animation phases:\n - **Enter Animation**: How the brick appears on screen\n - **Display Animation**: Ongoing animations while visible\n - **Exit Animation**: How the brick disappears\n- **Positioning**: Uses grid-based positioning system for resolution independence\n- **Interaction**: Can respond to touch events and trigger system actions\n\nAvailable template:\n[:BRICK_IDS:]\n\n#### 3. Generator (處理器)\n- **Definition**: Invisible processing units that handle non-visual functionality\n- **Purpose**: Handle hardware interactions (camera, sensors), data processing, network communication\n- **Input**: Receives parameters exclusively through Property Bank\n- **Output**: Returns results exclusively through Property Bank\n- **Triggers**: Activated by Events connected to their Actions\n\nAvailable template:\n[:GENERATOR_IDS:]\n\n### Data (Property Bank, 參數庫)\nThe central data management system that serves as the backbone of BRICKS applications:\n\n#### Key Features\n- **KEY-VALUE Structure**: Simple, accessible data storage\n- **Dual Events**: Each property supports both "Update" and "Value Change" events\n- **Auto-Refresh**: UI elements automatically update when linked data changes\n- **Cross-Subspace Communication**: Properties can be shared between different subspaces\n- **Data Types**: `string`, `number`, `bool`, `object`, `array`, `any`\n- **Special Kinds**: `color`, `datetime`, `id`, `media-resource-*`, `lottie-file-uri`\n- **Units**: `grid`, `px`, `ms` for different measurement types\n\n#### Routing Options\n- **read-only**: Cannot be changed from other subspaces\n- **Default**: Accepts changes from other subspaces\n\nTerminology note: We refer to the central data system as "Data" in docs and UI. Internally, it remains "Property Bank" and uses `PROPERTY_BANK_*` identifiers.\n\n### Event System\nBRICKS uses a comprehensive event-driven architecture:\n\n#### Event Sources\n- **System Events**: Property Bank changes, timer events, canvas transitions\n- **Brick Events**: User interactions (press, focus, value changes)\n- **Generator Events**: Hardware responses, network callbacks, processing completions\n\n#### Event Handling\n- **Sequential Processing**: Events trigger Actions in defined order\n- **Parameter Passing**: All parameters passed through Property Bank\n- **Action Types**: System actions or Generator actions\n\n### Subspace (子空間)\nAdvanced modularity system for complex applications:\n\n#### Concept\n- **Nested Systems**: Complete BRICKS system within a brick\n- **Independent Operation**: Own canvases, bricks, and property banks\n- **Modular Behavior**: Can be positioned, scaled, and animated like regular bricks\n\n#### Communication\n- **Input**: External Property Bank values copied to internal Property Bank\n- **Output**: Internal Property Bank changes trigger external events\n- **Data Flow**: Call-by-value copying maintains isolation while enabling communication\n\n## Grid System\n\n### Resolution Independence\n- **Default Grid**: 96×54 units (optimized for HD displays)\n- **Automatic Scaling**: Grid units convert to pixels based on device resolution\n- **Calculation**: `grid_unit_size_px = device_width_px / app_grid_width`\n\n### Examples\n| Device Resolution | App Grid Size | Grid Unit Size |\n|------------------|---------------|----------------|\n| 1920×1080 | 96×54 | 20px |\n| 3840×2160 | 96×54 | 40px |\n| 1280×720 | 96×54 | 13.33px |\n\n### Positioning Features\n- **Overflow Support**: Elements can extend beyond visible area\n- **Partial Display**: Elements at negative positions show partial content\n- **Performance Optimization**: Completely off-screen elements are automatically ignored\n\n## Configuration Structure\n\n### Hierarchy\n```\nApplication (應用程式)\n├── Root Subspace\n├── Subspace Map\n│ ├── Canvas Map\n│ ├── Brick Map\n│ └── Generator Map\n├── Property Bank\n├── Property Bank Calc\n├── Event Map\n└── Automation Map\n```\n\n### Item property\nProperties can set constant value or link data like this\n\n```js\n{\n "example1": 123,\n "example2": "PROPERTY_BANK#<Data Node ID>", // Link Data\n "example3": {\n "PROPERTY_BANK#<Data Node ID>", // Link Data in object, we recommend direct link without middle object data\n }\n}\n```\n\n### Item outlet\nData output from brick or generator, you can link it to data\n\n```js\n{\n OUTLET_NAME: \'<Data Node ID>\'\n}\n```\n\n### Event actions\nOn handling event can do actions with this schema\n\n```js\n[\n {\n "action": "string",\n "handler": "string",\n "parameter_list": [\n {\n "input_to_receiver": "string", // Argument\n "result_from_sender": "string" // Link data\n }\n ],\n "wait_async": "boolean"\n }\n]\n```\n\n- `handler: SYSTEM`\n[:SYSTEM_ACTIONS:]\n- `handler: GENERATOR_<UUID>`\n- `handler: BRICK_<UUID>`\n\n## Development Workflow\n\n### 1. Design Phase\n- Define grid layout (usually 96×54)\n- Plan canvas flow and transitions\n- Identify required data flows\n\n### 2. Implementation\n- Use `create_item` to constuct config\n- Create subspaces for different app sections\n- Add canvases for each screen/state\n- Place and configure bricks for UI elements\n- Add generators for processing logic\n- Connect events to actions\n\n### 3. Data Management\n- Set up Property Bank structure\n- Configure property types and routing\n- Link UI elements to data sources\n- Implement data processing flows\n\n#### Mental Model\n- Reactive architecture: events trigger actions; actions update Data; UI and generators react to Data changes.\n- Calculations: optional graphs transform Data using Data Calculation (command/data nodes or script).\n- Always read/write via Data. Generators receive input from Data and write outputs back to Data.\n\n#### Common Patterns\n- Event → Action → Data update or Outlet → Data update\n- Data change → Triggers downstream calculations → Updates target Data\n- Cross-subspace routing: respect `read-only` vs `default`\n\n### 4. Testing & Deployment\n- Use automation maps for testing\n- Validate configuration schema\n- Deploy to target devices\n- Monitor system health\n\n## Best Practices\n\n### Performance\n- Use 96×54 grid for standard content\n- Minimize off-screen elements\n- Optimize property bank access patterns\n- Cache media resources appropriately\n\n### User Experience\n- Always use enter/exit animations (avoid sudden appearances)\n- Maintain consistent transition timing\n- Design for offline operation\n- Implement proper error handling\n\n### Architecture\n- Keep subspaces focused and modular\n- Use generators for all non-visual processing\n- Minimize cross-subspace dependencies\n- Design for reusability through modules\n\n## Network & Offline Behavior\n\n### Online Operation\n- Configuration sync from cloud\n- Media resource loading\n- Real-time data updates\n- Health status reporting\n\n### Offline Requirements\n- **Display Continuity**: All display and reading functions must work offline\n- **Data Caching**: Write operations cached locally and synced when online\n- **Resource Management**: Media and assets preloaded during online periods\n- **Graceful Degradation**: Non-essential features disabled, core functionality maintained\n\nThis comprehensive foundation enables the creation of sophisticated, interactive digital signage applications that are both powerful and maintainable.\n\n## Local Sync\n\nLocal Sync enables near real-time intranet communication between devices for seamless multi-screen display splicing.\n\n- Data Sync: Synchronize selected data (Property Bank/Data nodes) across devices so UI updates remain consistent.\n- Canvas Sync: Optionally synchronize active canvas to orchestrate state transitions across screens.\n- Typical Use: Video walls, tiled displays, or clustered players that must behave as one.\n- Transport: LAN/intranet only; optimized for low latency and reliability inside the local network.\n- Resilience: Designed to tolerate temporary disconnections; devices rejoin and resynchronize state.\n\nConfiguration hints (high level):\n- Subspaces can define local sync behavior (e.g., whether to sync canvas changes).\n- Generators may opt into specific local sync run modes.\n- Keep payloads small and data normalized for best performance.';var Ud=c(181),Hd=(e,t={})=>({content:[Ud.Buffer.isBuffer(e)?{...t,blob:e.toString("base64"),type:"blob"}:{...t,text:"string"==typeof e?e:JSON.stringify(e,null,2),type:"text"}],isError:!1});var Kd=c(9657);const qd=t("node:net"),Wd=t("node:http"),Qd=t("node:https");var Yd=c(8875);const Xd=t("node:dns"),Jd={allowPrivateIPAddress:!1,allowMetaIPAddress:!1,allowIPAddressList:[],denyIPAddressList:[]},Zd=({address:e,host:t,family:a},n)=>{if(0!==qd.isIP(e))try{const r=Yd.parse(e).range();if(n.allowIPAddressList.length>0&&n.allowIPAddressList.includes(e))return;if(!n.allowMetaIPAddress&&"unspecified"===r)return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because, It is meta IP address.`);if(!n.allowPrivateIPAddress&&"unicast"!==r)return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because, It is private IP address.`);if(n.denyIPAddressList.length>0&&n.denyIPAddressList.includes(e))return new Error(`DNS lookup ${e}(family:${a}, host:${t}) is not allowed. Because It is defined in denyIPAddressList.`)}catch(e){return e}},eu=(e,t)=>(a,n,r)=>{const i=e.lookup||Xd.lookup;let o;o=n.all?(e,n)=>{if(e)r(e);else{for(const{address:e,family:i}of n){const n=Zd({address:e,family:i,host:a},t);if(n)return void r(n)}r(null,n)}}:(e,n,i)=>{if(e)return void r(e);const o=Zd({address:n,family:i,host:a},t);o?r(o):r(null,n,i)},i(a,n,o)};class tu extends Wd.Agent{requestFilterOptions;constructor(e){super(e),this.requestFilterOptions={allowPrivateIPAddress:e&&void 0!==e.allowPrivateIPAddress?e.allowPrivateIPAddress:Jd.allowPrivateIPAddress,allowMetaIPAddress:e&&void 0!==e.allowMetaIPAddress?e.allowMetaIPAddress:Jd.allowMetaIPAddress,allowIPAddressList:e&&e.allowIPAddressList?e.allowIPAddressList:Jd.allowIPAddressList,denyIPAddressList:e&&e.denyIPAddressList?e.denyIPAddressList:Jd.denyIPAddressList}}createConnection(e,t){const{host:a}=e;if(void 0!==a){const e=Zd({address:a},this.requestFilterOptions);if(e)throw e}return super.createConnection({...e,lookup:eu(e,this.requestFilterOptions)},t)}}class au extends Qd.Agent{requestFilterOptions;constructor(e){super(e),this.requestFilterOptions={allowPrivateIPAddress:!(!e||void 0===e.allowPrivateIPAddress)&&e.allowPrivateIPAddress,allowMetaIPAddress:!(!e||void 0===e.allowMetaIPAddress)&&e.allowMetaIPAddress,allowIPAddressList:e&&e.allowIPAddressList?e.allowIPAddressList:[],denyIPAddressList:e&&e.denyIPAddressList?e.denyIPAddressList:[]}}createConnection(e,t){const{host:a}=e;if(void 0!==a){const e=Zd({address:a},this.requestFilterOptions);if(e)throw e}return super.createConnection({...e,lookup:eu(e,this.requestFilterOptions)},t)}}const nu=new tu,ru=new au,iu=(e,t)=>t?e.startsWith("https")?new au(t):new tu(t):e.startsWith("https")?ru:nu;var ou=c(6123),su=c(211),pu=c(5907),lu=c(6502),du=c.n(lu),uu=c(5838);function cu(){return cu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},cu.apply(this,arguments)}var mu={enum:1,type:0},fu=/"/g,_u=/NOT/g,hu=/\//g,Eu=function(e){var t=e.value,a=e.suggestions,n=e.format,r=void 0===n?function(e){return"Did you mean '"+e+"'?"}:n;if(!t)return"";var i=a.reduce(function(e,a){var n=du()(t,a);return e.distance>n?{value:a,distance:n}:e},{distance:1/0,value:""});return i.distance<t.length?r(i.value):""},yu=function(e){return e.split("/").pop()},Tu=function(e){var t=e.object,a=e.pnter,n=e.fallback;try{return uu.get(t,a)}catch(e){return n}},Ru=function(e){var t=e.errors,a=e.data,n=e.schema,r=e.basePath,i=void 0===r?"{base}":r;if(!Array.isArray(t)||0===t.length)return[];var o=function(e){var t=e.reduce(function(e,t){var a,n,r,i,o,s,p=t.instancePath+(null!=(a=null!=(n=null==(r=t.params)?void 0:r.additionalProperty)?n:null==(i=t.params)?void 0:i.missingProperty)?a:""),l=e[p];return l?((null!=(o=mu[t.keyword])?o:0)>(null!=(s=mu[l.keyword])?s:0)&&(e[p]=t),e):(e[p]=t,e)},{});return Object.values(t)}(t);return o.map(function(e){var t,r=(i+e.instancePath).replace(hu,"."),o=yu(e.instancePath),s={errorType:e.keyword},p=(o?"property '"+o+"'":r)+" "+e.message.replace(fu,"'").replace(_u,"not");switch(e.keyword){case"additionalProperties":var l=e.params.additionalProperty,d=e.schemaPath.replace("#","").replace("/additionalProperties",""),u=Tu({object:n,pnter:d,fallback:{properties:{}}}).properties;t={message:"'"+l+"' property is not expected to be here",suggestion:Eu({value:l,suggestions:Object.keys(null!=u?u:{}),format:function(e){return"Did you mean property '"+e+"'?"}}),path:r,context:s};break;case"enum":var c=e.params.allowedValues.map(function(e){return e.toString()}),m=yu(e.instancePath),f=Tu({object:a,pnter:e.instancePath,fallback:""});t={message:"'"+m+"' property must be equal to one of the allowed values",suggestion:Eu({value:f,suggestions:c}),path:r,context:cu({},s,{allowedValues:e.params.allowedValues})};break;case"type":t={message:"'"+yu(e.instancePath)+"' property type must be "+e.params.type,path:r,context:s};break;case"required":t={message:r+" must have required property '"+e.params.missingProperty+"'",path:r,context:s};break;case"const":return{message:"'"+o+"' property must be equal to the allowed value",path:r,context:cu({},s,{allowedValue:e.params.allowedValue})};default:return{message:p,path:r,context:s}}for(var _=0,h=Object.entries(t);_<h.length;_++){var E=h[_],y=E[0],T=E[1];null!=T&&""!==T||delete t[y]}return t})};const gu=(e,t="Internal Logic Error")=>{if(!e)throw new Error("function"==typeof t?t():t)};class vu{constructor(e,t){this.value=e,this.excluded=t,this.isSimpleStarRec="**"===e,this.isRegexStarRec=e.startsWith("**(")&&e.endsWith(")"),this.isStarRec=this.isSimpleStarRec||this.isRegexStarRec}}class Ou{constructor(e,t=null){this.left=null===t,this.link=null===t?new Ou(e,this):t,this.type=e,this.isStarRec="**"===this.type,this.node=null,this.pointer=null}setPointer(e){this.pointer=e,this.link.pointer=e}setNode(e){this.node=e,this.link.node=e}}const Nu=(e,t,a={})=>{throw new Error(Object.entries(a).reduce((e,[t,a])=>`${e}, ${t} ${a}`,`${e}: ${t}`))},bu=e=>1===e.length?e[0]:e,Au=/^[?*+\d]+$/,Su=(e,t,a={})=>{throw new Error(Object.entries(a).reduce((e,[t,a])=>`${e}, ${t} ${a}`,`${e}: ${t}`))},Iu=(e,t)=>{if(""===e)return new vu("",!1);if(Array.isArray(e))return 0===e.length?new vu("",!1):e.map((a,n)=>"number"==typeof a?(t.useArraySelector||Su("Forbidden Array Selector",JSON.stringify(e),{idx:n}),new vu(`[${a}]`,!1)):new vu(a.replaceAll("\\","\\\\"),!1));const a=(e=>{let t=[];t.or=!0;let a=!1,n=!1,r=0;const i=[],o=e=>{!0===t.excluded&&(gu(!1===n),n=!0),i.push(t),t=[],t.or=e},s=()=>{const e=i.pop(),a=bu(t);!0===e.or&&!0===a.or?e.push(...a):e.push(a),t=e};return o(!1),{setInArray:(t,n)=>{a===t&&Nu(a?"Bad Array Start":"Bad Array Terminator",e,{char:n}),a=t},finishElement:(i,o,s,{finReq:p=!1,group:l=!1}={})=>{if(r===i)s.includes(e[i-1]||null)||Nu(o,e,{char:i}),r+=1;else{p&&Nu(o,e,{char:i});const s=e.slice(r,i);l&&!["**","++"].includes(s)&&Nu("Bad Group Start",e,{char:i}),a&&!(Au.test(s)||s.startsWith("(")&&s.endsWith(")"))&&Nu("Bad Array Selector",e,{selector:s}),l?t.push(new Ou(s)):(t.push(new vu(a?`[${s}]`:s,n)),n=!1),r=i+1}},startExclusion:t=>{!1!==n&&Nu("Redundant Exclusion",e,{char:t}),n=!0},startGroup:()=>{o(!0),n&&(t.excluded=!0,n=!1),o(!1)},newGroupElement:()=>{s(),o(!1)},finishGroup:a=>{i.length<2&&Nu("Unexpected Group Terminator",e,{char:a}),s(),s(),gu(Array.isArray(t));const n=t[t.length-2];n instanceof Ou&&!0===n.left&&t.push(n.link)},finalizeResult:()=>(s(),gu(!1===n),0!==i.length&&Nu("Non Terminated Group",e),a&&Nu("Non Terminated Array",e),bu(t))}})(e),n=e.length;let r=!1,i=0;for(let o=0;o<n;o+=1){const n=e[o];if(!1===r){if(0===i)switch(n){case".":a.finishElement(o,"Bad Path Separator",["]","}"]);break;case"[":t.useArraySelector||Su("Forbidden Array Selector",e,{char:o}),a.finishElement(o,"Bad Array Start",[null,"!","{",",","}","]"]),a.setInArray(!0,o);break;case"]":a.finishElement(o,"Bad Array Terminator",["}"]),a.setInArray(!1,o);break;case"{":a.finishElement(o,"Bad Group Start",[null,"!",".","[","{",","],{group:!0}),a.startGroup();break;case",":a.finishElement(o,"Bad Group Separator",["]","}"]),a.newGroupElement();break;case"}":a.finishElement(o,"Bad Group Terminator",["]","}"]),a.finishGroup(o);break;case"!":a.finishElement(o,"Bad Exclusion",[null,".",",","{","["],{finReq:!0}),a.startExclusion(o)}switch(n){case"(":i+=1;break;case")":0===i&&Su("Unexpected Parentheses",e,{char:o}),i-=1}}r="\\"===n&&!r}return!1!==r&&Su("Dangling Escape",e,{char:n-1}),0!==i&&Su("Unterminated Parentheses",e),a.finishElement(n,"Bad Terminator",["]","}"]),a.finalizeResult()},wu=(e,t,a,{onAdd:n,onFin:r})=>{const i=[[[e,null]]];let o=!1;((e,t)=>{const a=[e],n=[null],r=[],i=[];let o=0,s=!0;for(;-1!==o;){const e=a[o];Array.isArray(e)?!0!==e.or?(a.splice(o,1,...e),n.splice(o,1,...new Array(e.length).fill(n[o])),null!==n[o]&&(i[n[o]]+=e.length-1)):(void 0===r[o]?(r[o]=0,i[o]=0):0!==i[o]&&(a.splice(o+1,i[o]),n.splice(o+1,i[o]),i[o]=0),r[o]<e.length?(a.splice(o+1,0,e[r[o]]),n.splice(o+1,0,o),r[o]=(r[o]||0)+1,i[o]+=1,s=!0,o+=1):(r[o]=0,o-=1)):!0===s?(t("ADD",e),o===a.length-1?(t("FIN",e),s=!1):o+=1):(t("RM",e),o-=1)}})(a,(a,s)=>{if("RM"===a)!0===s.excluded&&(o=!1),i.length-=2;else if("ADD"===a){if(!0===s.excluded){if(o)throw new Error(`Redundant Exclusion: "${t}"`);o=!0}const e=[],a=i[i.length-2];i[i.length-1].forEach(([t,r])=>n(t,r,s,a,a=>e.push([a,t]))),i.push(s,e)}else i[i.length-1].filter(([t])=>t!==e).forEach(([e,t])=>r(e,t,s,o))})},Cu=/[?!,.*+[\](){}\\]/g,Du=/^\^?[^-/\\^$*+?.()|[\]{}]*\$?$/g,Pu=e=>{if(Du.test(e)){const t=e.startsWith("^"),a=e.endsWith("$");if(t&&a){const t=e.slice(1,-1);return{test:e=>String(e)===t}}if(t){const t=e.slice(1);return{test:e=>String(e).startsWith(t)}}if(a){const t=e.slice(0,-1);return{test:e=>String(e).endsWith(t)}}return{test:t=>String(t).includes(e)}}try{return new RegExp(e)}catch(t){throw new Error(`Invalid Regex: "${e}"`)}},ju=e=>e.reduce((e,t)=>`${e}${"number"==typeof t?`[${t}]`:`${e?".":""}${(e=>e.replace(Cu,"\\$&"))(t)}`}`,""),ku=e=>Array.isArray(e)?ju(e):e,Lu=["-","/","\\","^","$","*","+","?",".","(",")","|","[","]","{","}"],Mu=e=>{let t="",a=!1,n=!0;for(let r=0;r<e.length;r+=1){const i=e[r];a||"\\"!==i?a||"*"!==i?a||"+"!==i?a||"?"!==i?(Lu.includes(i)&&(n=!1,t+="\\"),t+=i,a=!1):(n=!1,t+="."):(n=!1,t+=".+"):(n=!1,t+=".*"):a=!0}return n?{test:e=>String(e)===t}:".+"===t?{test:e=>""!==e}:new RegExp(`^${t}$`)};class Gu{constructor(e,t){if(t.nodes.push(this),this.value=e,this.ctx=t,this.order=t.counter,this.children=[],this.match=!1,this.matches=!1,this.needles=[],this.leafNeedles=[],this.leafNeedlesExclude=[],this.leafNeedlesMatch=[],this.isArrayTarget=e.startsWith("[")&&e.endsWith("]"),this.isSimpleStarRec="**"===e,this.isSimplePlusRec="++"===e,this.isSimpleRec=this.isSimpleStarRec||this.isSimplePlusRec,this.isRegexStarRec=e.startsWith("**(")&&e.endsWith(")"),this.isRegexPlusRec=e.startsWith("++(")&&e.endsWith(")"),this.isStarRec=this.isSimpleStarRec||this.isRegexStarRec,this.isPlusRec=this.isSimplePlusRec||this.isRegexPlusRec,this.isRec=this.isStarRec||this.isPlusRec,this.isAnyArrayTarget="[*]"===e,this.isAnyObjTarget="*"===e,this.isSimpleRec||this.isAnyObjTarget||this.isAnyArrayTarget)this.regex=null;else{const{regex:a}=t;e in a||(a[e]=(e=>(e.startsWith("**(")||e.startsWith("++("))&&e.endsWith(")")?Pu(e.slice(3,-1)):e.startsWith("[(")&&e.endsWith(")]")?Pu(e.slice(2,-2)):e.startsWith("(")&&e.endsWith(")")?Pu(e.slice(1,-1)):e.startsWith("[")&&e.endsWith("]")?Mu(e.slice(1,-1)):Mu(e))(e)),this.regex=a[e]}}recMatch(e){return!!this.isRec&&(!!this.isSimpleRec||this.regex.test(e))}typeMatch(e,t){return!!this.isSimpleRec||(this.isAnyArrayTarget?t:this.isAnyObjTarget?!t:!(t!==this.isArrayTarget&&!this.isRec)&&this.regex.test(e))}add(e){this.children.push(e)}get(e){return this.children.find(({value:t})=>t===e)}markMatches(){this.matches=!0}addNeedle(e){this.needles.includes(e)||this.needles.push(e)}setRoots(e){this.roots=e}finish(e,t,a){this.addNeedle(e),this.leafNeedles.includes(e)||this.leafNeedles.push(e);const n=t?this.leafNeedlesExclude:this.leafNeedlesMatch;n.includes(e)||n.push(e),this.match=!t,this.matches=this.match,this.index=a}}const xu=(e,t,a,n)=>{wu(e,t,a,{onAdd:(e,a,r,i,o)=>{if(e.addNeedle(t),r instanceof Ou)return void(!0===r.left?(r.isStarRec&&r.setPointer(e),r.setNode(new Gu("*",n)),n.links.push(e,r.node),o(r.node)):(r.target="target"in i?i.target:a.get(i.value),n.links.push(r.target,r.node),null!==r.pointer&&(o(r.pointer),r.setPointer(null)),o(e)));const s=r.isStarRec&&r.value===i?.value;if(s&&n.strict)throw new Error(`Redundant Recursion: "${t}"`);if(s)r.target=e;else{let t=e.get(r.value);void 0===t&&(t=new Gu(r.value,n),e.add(t)),o(t)}r.isStarRec&&o(e)},onFin:(e,a,r,i)=>{if(n.strict&&r.isSimpleStarRec){const e=a.children.filter(({value:e})=>!["","**"].includes(e));if(0!==e.length)throw new Error(`Needle Target Invalidated: "${e[0].needles[0]}" by "${t}"`)}if(n.strict&&0!==e.leafNeedles.length){const a=ku(e.leafNeedles[0]),n=ku(t);throw new Error(`Redundant Needle Target: "${a}" vs "${n}"`)}e.finish(t,i,n.counter),n.counter+=1}})},Fu=(e,t)=>{const a=[];for(let n=0,r=e.length;n<r;n+=1){const r=e[n][t];for(let e=0,t=r.length;e<t;e+=1){const t=r[e];a.includes(t)||a.push(t)}}return a},Bu=e=>{let t=-1,a=!1,n=e.length;for(;n--;){const{index:r,match:i}=e[n];r>t&&(t=r,a=i)}return a},zu=(e,t)=>t?ju(e):[...e],Vu=(e,t,a)=>{const n={haystack:e,context:a.context};if(void 0!==a.beforeFn){const e=a.beforeFn(n);void 0!==e&&(n.haystack=e)}const r=[!1,[t],null,0],i=[],o=[];let s,p,l,d,u=n.haystack;const c={getKey:(e=a.joined)=>zu(i,e),get key(){return c.getKey()},getValue:()=>u,get value(){return c.getValue()},getEntry:(e=a.joined)=>[zu(i,e),u],get entry(){return c.getEntry()},getIsMatch:()=>d,get isMatch(){return c.getIsMatch()},getMatchedBy:()=>(e=>Fu(e,"leafNeedlesMatch"))(l),get matchedBy(){return c.getMatchedBy()},getExcludedBy:()=>(e=>Fu(e,"leafNeedlesExclude"))(l),get excludedBy(){return c.getExcludedBy()},getTraversedBy:()=>(e=>Fu(e,"needles"))(l),get traversedBy(){return c.getTraversedBy()},getGproperty:()=>i[i.length-2],get gproperty(){return c.getGproperty()},getProperty:()=>i[i.length-1],get property(){return c.getProperty()},getGparent:()=>o[o.length-2],get gparent(){return c.getGparent()},getParent:()=>o[o.length-1],get parent(){return c.getParent()},getParents:()=>[...o].reverse(),get parents(){return c.getParents()},getIsCircular:()=>o.includes(u),get isCircular(){return c.getIsCircular()},getIsLeaf:()=>!(u instanceof Object),get isLeaf(){return c.getIsLeaf()},getDepth:()=>i.length,get depth(){return c.getDepth()},get result(){return c.getResult()},context:n.context},m=((e,t)=>{if("context"===t.rtn)return{onMatch:()=>{},get:()=>e.context};if("bool"===t.rtn){let e=!1;return{onMatch:()=>{e=!0},get:()=>e}}if("count"===t.rtn){let e=0;return{onMatch:()=>{e+=1},get:()=>e}}if("sum"===t.rtn){let e=0;return{onMatch:({value:t})=>{e+=t},get:()=>e}}const a=[];return{onMatch:"function"==typeof t.rtn?()=>a.push(t.rtn(e)):Array.isArray(t.rtn)?()=>a.push(t.rtn.map(t=>e[t])):()=>a.push(e[t.rtn]),get:()=>t.abort?a[0]:a}})(c,a);if(c.getResult=()=>m.get(),a.useArraySelector||!Array.isArray(n.haystack)){const e=t.get("");void 0!==e&&r[1].push(e)}do{s=r.pop(),p=r.pop(),l=r.pop(),d=r.pop();const e=i.length-s;for(let t=0;t<e;t+=1)o.pop(),i.pop();if(-1===e?(o.push(u),i.push(p),u=u[p]):null!==p?(i[i.length-1]=p,u=o[o.length-1][p]):u=n.haystack,d){void 0!==a.filterFn&&!1===a.filterFn(c)||(m.onMatch(c),a.abort&&(r.length=0));continue}if(!l.some(({matches:e})=>e))continue;const f=!1===a.useArraySelector&&Array.isArray(u);if(!f&&Bu(l)&&(r.push(!0,l,p,s),d=!0),(void 0===a.breakFn||!0!==a.breakFn(c))&&u instanceof Object){const e=Array.isArray(u),n=e?u.map((e,t)=>t).filter(()=>!0):Object.keys(u);!e&&a.compareFn&&n.sort(a.compareFn(c)),a.reverse||n.reverse();for(let i=0,o=n.length;i<o;i+=1){const o=n[i],p=[];if(f)p.push(...l),0===s&&p.push(...t.roots);else for(let t=0,a=l.length;t!==a;t+=1){const a=l[t];a.recMatch(o)&&p.push(a);const{children:n}=a;let r=n.length;for(;r--;){const t=n[r];t.typeMatch(o,e)&&p.push(t)}}if(a.orderByNeedles){p.index=Buffer.from(p.map(({order:e})=>e).sort());let e=r.length-3;const t=e-4*i;for(;e!==t&&1===Buffer.compare(p.index,r[e].index);)e-=4;r.splice(e+3,0,!1,p,o,s+1)}else r.push(!1,p,o,s+1)}}}while(0!==r.length);if(n.result=m.get(),void 0!==a.afterFn){const e=a.afterFn(n);void 0!==e&&(n.result=e)}return n.result},$u=(e,t,a)=>{gu(a.includes(typeof e[t]),()=>`Option "${t}" not one of [${a.join(", ")}]`)};var Uu=su.ajv.getSchema("http://display.bricks.tools/root.schema.json5"),Hu=((e,t={})=>{if(gu(Array.isArray(e),'Argument "needles" expected to be Array'),gu(t instanceof Object&&!Array.isArray(t),'Argument "opts" expected to be Object'),0===e.length)return(e,t)=>void 0===t?[]:t;const a=(e=>{const t={filterFn:void 0,breakFn:void 0,beforeFn:void 0,afterFn:void 0,compareFn:void 0,reverse:!0,orderByNeedles:!1,abort:!1,rtn:void 0,joined:!1,useArraySelector:!0,strict:!0,...e};return gu(12===Object.keys(t).length,"Unexpected Option provided"),$u(t,"filterFn",["function","undefined"]),$u(t,"breakFn",["function","undefined"]),$u(t,"beforeFn",["function","undefined"]),$u(t,"afterFn",["function","undefined"]),$u(t,"compareFn",["function","undefined"]),$u(t,"reverse",["boolean"]),$u(t,"orderByNeedles",["boolean"]),$u(t,"abort",["boolean"]),gu("function"==typeof t.rtn&&1===t.rtn.length||[void 0,"context","key","value","entry","property","gproperty","parent","gparent","parents","isMatch","matchedBy","excludedBy","traversedBy","isCircular","isLeaf","depth","bool","count","sum"].includes(t.rtn)||Array.isArray(t.rtn)&&t.rtn.every(e=>["key","value","entry","property","gproperty","parent","gparent","parents","isMatch","matchedBy","excludedBy","traversedBy","isCircular","isLeaf","depth"].includes(e)),'Option "rtn" is malformed'),$u(t,"joined",["boolean"]),$u(t,"useArraySelector",["boolean"]),$u(t,"strict",["boolean"]),t})(t),n=((e,t)=>{t.counter=0,t.links=[],t.nodes=[],t.regex=Object.create(null);const a=new Gu("*",t);for(let n=0;n<e.length;n+=1){const r=e[n],i=[Iu(r,t)];xu(a,r,i,t)}return((e,t)=>{const{links:a}=t;for(;0!==a.length;){const e=a.pop(),t=a.pop(),{children:n}=t;t.children=[...e.children.filter(e=>!n.includes(e)),...n]}!1===t.useArraySelector&&e.setRoots(e.children.filter(({isStarRec:e,value:t})=>e||""===t));const{nodes:n}=t;for(;0!==n.length;){const e=n.pop(),{children:t}=e;t.reverse(),t.some(({matches:e})=>e)&&e.markMatches()}})(a,t),a})(e,a);return(e,t)=>Vu(e,n,{context:t,...a,rtn:a.rtn||(void 0===t?"key":"context")})})(["subspace_map.*.property_bank_calc_map.*.script_config"]);function Ku(e){var t=[];try{var a=su(e);t.push(...Ru({errors:a,schema:Uu,data:e}).map(({path:e,message:t})=>`${e}: ${t}`));try{t.push(...pu(e).map(({field:e,message:t})=>`${e}: ${t}`))}catch(e){t.push(`Component reference validation failed: ${e.message}`)}return Hu(e).forEach(a=>{var n=a.slice(0,-1),r=ou(e,n),i=n.join(".");if(0===Object.keys(r.map).length)t.push(`${i}.map is empty`);else{var o=r.script_config,s=o.inputs,p=o.output,l=o.outputs,d=o.error;s&&Object.keys(s).forEach(e=>{r.map[e]||t.push(`${i}.map.${e} is missing`)}),p&&!r.map[p]&&t.push(`${i}.map.${p} is missing`),l&&Object.values(l).forEach(e=>{r.map[e]||t.push(`${i}.map.${e} is missing`)}),d&&!r.map[d]&&t.push(`${i}.map.${d} is missing`)}}),{valid:0===t.length,errors:t}}catch(e){return{valid:!1,errors:[`Validation failed: ${e.message}`]}}}var qu=c(9741),Wu=c(3981),Qu=(e,t="en-us")=>"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,a])=>[e,"object"!=typeof a||Array.isArray(a)?a:a[t]??Qu(a,t)])):e,Yu=Qu(qu.systemActionDescriptions),Xu=Object.entries(qu.systemActions).map(([e,{propertyNameType:t,property:a}])=>` - \`${e}\`: ${Yu[e]}\n${((e,t)=>{switch(e){case"defined_properties":return Object.entries(t).map(([e,t])=>` - \`${e}\`: ${JSON.stringify(t)}`).join("\n");case"property_bank":return" - `PROPERTY_BANK_DATA_NODE_*`: Value";default:return""}})(t,a)}\n`.trim()).join("\n"),Ju=Object.keys(Wu.brickMapping).map(e=>`- \`${e}\``).join("\n"),Zu=Object.keys(Wu.generatorMapping).map(e=>`- \`${e}\``).join("\n");const ec=$d.replace("[:SYSTEM_ACTIONS:]",Xu).replace("[:BRICK_IDS:]",Ju).replace("[:GENERATOR_IDS:]",Zu);var tc=(e,t)=>!t||e.tokenInfo.permissions?.includes(t)||!1,ac=c(4668),nc=c(5018),rc=c(3315),ic=c(409),oc=c(8525),sc=c(9760),pc=c(6078),lc=c(9222),dc=c(5608),uc=c(9074),cc=c(3673);var mc=c(4370);const fc=mc.default`
|
|
658
658
|
fragment workspaceArguments on Workspace {
|
|
659
659
|
__typename
|
|
660
660
|
_id
|
|
@@ -3066,4 +3066,4 @@ import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as
|
|
|
3066
3066
|
}
|
|
3067
3067
|
}
|
|
3068
3068
|
${j_}
|
|
3069
|
-
`,lh={query:"query",mutation:"mutate"},dh=(e,t,a)=>([n,r])=>{if(e[n])throw new Error(`Overwriting client.${n}`);e[n]=async(i,o={})=>{let s,p;const l={[t]:r,variables:i,...o};if(a&&(l.variables={...a,...l.variables}),o.readQuery?s=e.readQuery(l):o.writeQuery?e.writeQuery({...l,data:o.writeQuery}):({data:s,errors:p}=await e[lh[t]](l)),p)throw new Error(p.map(e=>e.message).join("\n"));return s?s[n]:null}},uh=e=>{const t=(({endpoint:e="http://localhost:3002",accessToken:t,boxId:a,passcode:n,enableSubscription:r=!0,enableRetry:i=!0,subscriptionOnConnectionOrError:o,onNetworkError:s}={})=>{const p=a&&n;let l=`${e}/api/graphql`;return p&&(l=`${e}/api/graphql_with_passcode`),L_({endpointURL:l,subscriptionEndpointURL:l.replace("http:","ws:"),accessToken:t,enableSubscription:!p&&r,enableRetry:i,subscriptionOnConnectionOrError:o,onNetworkError:s})})(e);if(e.boxId&&e.passcode){t.type="passcode",t.queries=g,t.mutations=v;const a={boxId:e.boxId,passcode:e.passcode};Object.entries(g).forEach(dh(t,"query",a)),Object.entries(v).forEach(dh(t,"mutation",a)),t.listenBoxChanged=(e,n)=>t.subscribe({query:ph,variables:{...a,...e}}).subscribe({next:async({data:e})=>{await n(null,e.mediaBoxChanged)},error(e){n(e)}})}else t.accessToken=e.accessToken,t.type="token",t.queries=T,t.mutations=R,Object.entries(T).forEach(dh(t,"query")),Object.entries(R).forEach(dh(t,"mutation")),t.listenBoxChanged=(e,a)=>t.subscribe({query:eh,variables:e}).subscribe({next:async({data:e})=>{await a(null,e.mediaBoxChanged)},error(e){a(e)}});return t};function ch(e,t,a){switch(a){case"user":return new rf(e,t);case"workspace":return new Hf(e,t);default:throw new Error(`Invalid token type: ${a}.`)}}process.env.STAGE,process.env.URL_BASE;var mh="bricks-mcp",fh={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools"},_h=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,c(1639));const hh=({type:e,title:t,template_key:a})=>{var n,r,i=(0,_h.makeId)(e);switch(e){case"subspace":n={title:t,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},r={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var o=Qu(Wu.canvas);n={title:t,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(o.propTypes).map(([e,t])=>[e,{...t,description:o.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(o.eventTypes).map(([e])=>[e,{description:o.brickEventDescriptions[e]}]))}},r={property_bank_map:{[(0,_h.makeId)("property_bank")]:{title:`Canvas ID: ${t}`,type:"string",value:i,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=Qu(Wu.components.Basic),p=Qu(Wu.brickMapping[a]);if(!p)throw new Error(`Brick ${a} not found`);var l={...p,propTypes:{...s.propTypes,...p.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...p.brickPropDescriptions},eventTypes:{...s.eventTypes,...p.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...p.brickEventDescriptions}};n={title:t,template_key:a,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,t])=>[e,{...t,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},r={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:i,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:t,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var d=Qu(Wu.generatorMapping[a]);if(!d)throw new Error(`Generator ${a} not found`);n={title:t,template_key:a,property:{$definitions:Object.fromEntries(Object.entries(d.propTypes).map(([e,t])=>[e,{...t,description:d.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(d.eventTypes).map(([e])=>[e,{description:d.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(d.outletTypes).map(([e])=>[e,{description:d.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:t,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:t,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(Wu.propertyBank.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var u=(0,_h.makeId)("property_bank_command"),c=(0,_h.makeId)("property_bank_command"),m=(0,_h.makeId)("property_bank_command"),f="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:t,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${u}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${u}`,port:"obj | inputs"}]}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:f,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:c,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:u,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[c]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:u,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:c,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:c,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:t,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:f,$note:"Required, info for GUI editor"}}}return Hd({id:i,example:n,extraInfo:r})};function Eh(e,t){var a,n,r,i,o,s,p,l,d,u,c,m,f,_,h,E="user"===t.tokenType,y=((e,t=null)=>({name:a,description:n,inputSchema:r,permission:i},o)=>{tc(t,i)&&e.tool(a,n,r,o)})(e,t),T=e=>({...e,...E?{workspace_id:Yt().describe("Workspace ID")}:{}}),R=t.client,g=E?function(e){var t=e.endpoint,a=e.accessToken;if(!t)throw new Error("Media API endpoint is required");if(!a)throw new Error("Access token is required");return uh({endpoint:t,accessToken:a,enableSubscription:!1,enableRetry:!0})}({endpoint:fh.media,accessToken:t.token}):R;E&&e.tool("list_workspaces","List all workspaces",{},O(function*(){return Hd(yield R.workspaces())})),y({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:T({}),permission:"info"},function(){var e=O(function*({workspace_id:e}){var t=yield Promise.all([R.workspace({id:e}),R.applications({workspaceId:e,paginate:{limit:50,offset:0}}),R.modules({workspaceId:e,paginate:{limit:50,offset:0}}),R.devices({workspaceId:e,paginate:{limit:50,offset:0}}),E?g.mediaWorkspace({workspaceId:e}).catch(()=>null):g.mediaWorkspace().catch(()=>null),E?g.mediaBoxes({workspaceId:e}).catch(()=>[]):g.mediaBoxes().catch(()=>[])]),a=pe(t,6),n=a[0],r=a[1],i=a[2],o=a[3],s=a[4],p=a[5];if(!n)throw new Error("Authentication failed, please check your token");return Hd({workspace:n,stats:{applications:r?.length??"No permission",modules:i?.length??"No permission",devices:o?.length??"No permission",running_apps:r?.filter(e=>e.status?.running).length??"No permission",media_boxes:p?.length??"No permission",media_enabled:!!s,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:r?.slice(0,5).map(e=>({id:e._id,name:e.name,status:e.status?.running?"running":"stopped",last_update:e.last_modify_datetime}))||[]},media_info:s?{workspace_id:s.id,name:s.name,size_used:s.size,size_limit:s.sizeLimit,boxes:p?.slice(0,5).map(e=>({id:e.id,name:e.name,size:e.size,description:e.description}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})});return function(t){return e.apply(this,arguments)}}()),y({name:"get_applications",description:"List all applications in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of applications to return").optional().default(50),offset:Xt().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.applications({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:T({id:Yt().describe("Application ID")}),permission:"query_application"},function(){var e=O(function*({workspace_id:e,id:t}){return Hd(yield R.application({workspaceId:e,id:t}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_modules",description:"List all modules in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of modules to return").optional().default(50),offset:Xt().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.modules({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:T({id:Yt().describe("Module ID")}),permission:"query_module"},function(){var e=O(function*({workspace_id:e,id:t}){return Hd(yield R.module({workspaceId:e,id:t}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_module_info",description:"Update a specific module info",inputSchema:T({id:Yt().describe("Module ID"),name:Yt().describe("Module name"),description:Yt().describe("Module description")}),permission:"update_module"},function(){var e=O(function*({workspace_id:e,id:t,name:a,description:n}){return Hd(yield R.updateModule({workspaceId:e,id:t,name:a,description:n}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_module_config",description:"Update a specific module configuration",inputSchema:T({id:Yt().describe("Module ID"),config:Zt({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},function(){var e=O(function*({workspace_id:e,id:t,config:a}){var n=yield Ku(a);if(!n.valid)throw new Error(`Config validation failed: ${n.errors.join(", ")}`);return Hd(yield R.updateModule({workspaceId:e,id:t,config:JSON.stringify(a),validateConfig:!0}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_devices",description:"List all devices in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of devices to return").optional().default(50),offset:Xt().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.devices({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:T({name:Yt().describe("Application name"),description:Yt().describe("Application description").optional(),grid_width:Xt().describe("Grid width in units").optional().default(96),grid_height:Xt().describe("Grid height in units").optional().default(54)}),permission:"create_application"},function(){var e=O(function*({workspace_id:e,name:t,description:a,grid_width:n,grid_height:r}){return Hd(yield R.createApplication({workspaceId:e,name:t,description:a,gridWidth:n,gridHeight:r}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_application_info",description:"Update application info",inputSchema:{id:Yt().describe("Application ID"),name:Yt().describe("Application name"),description:Yt().describe("Application description")},permission:"update_application"},(a=O(function*({id:e,name:t,description:a}){return Hd(yield R.updateApplication({id:e,name:t,description:a}))}),function(e){return a.apply(this,arguments)})),y({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:Yt().describe("Application ID"),config:Zt({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(n=O(function*({id:e,config:t}){var a=yield Ku(t);if(!a.valid)throw new Error(`Config validation failed: ${a.errors.join(", ")}`);return Hd(yield R.updateApplication({id:e,config:JSON.stringify(t)}))}),function(e){return n.apply(this,arguments)})),y({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:Yt().describe("Application ID"),viewports:Jt(Zt({device_id:Yt().describe("Device ID"),x:Xt().describe("X coordinate"),y:Xt().describe("Y coordinate"),width:Xt().describe("Width"),height:Xt().describe("Height"),rotate:Xt().describe("Rotation"),rotateType:Yt().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(r=O(function*({app_id:e,viewports:t}){return Hd(yield R.bindApplication({id:e,bind_devices:t.map(e=>e.device_id),device_frames:t.reduce((e,t)=>({...e,[t.device_id]:{x:t.x,y:t.y,width:t.width,height:t.height,rotate:t.rotate,rotateType:t.rotateType}}),{})}))}),function(e){return r.apply(this,arguments)})),y({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:Yt().describe("Application ID"),device_id:Yt().describe("Device ID")},permission:"bind_application"},(i=O(function*({app_id:e,device_id:t}){return Hd(yield R.bindApplication({id:e,unbindDevices:[t]}))}),function(e){return i.apply(this,arguments)})),E&&y({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},O(function*(){return Hd(yield g.mediaWorkspaces())})),y({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:T({}),permission:"query_media_flow"},(o=O(function*({workspace_id:e}){return Hd(yield g.mediaWorkspace({workspaceId:e}))}),function(e){return o.apply(this,arguments)})),y({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:T({}),permission:"query_media_flow"},(s=O(function*({workspace_id:e}){return Hd(yield g.mediaBoxes({workspaceId:e}))}),function(e){return s.apply(this,arguments)})),y({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:Yt().describe("Media box ID")},permission:"query_media_flow"},(p=O(function*({box_id:e}){return Hd(yield g.mediaBox({boxId:e}))}),function(e){return p.apply(this,arguments)})),y({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:Yt().describe("Media box ID"),include_types:Jt(Yt()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:Jt(Yt()).optional().describe("Filter by user tags"),limit:Xt().optional().default(50).describe("Maximum number of files to return"),offset:Xt().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(l=O(function*({box_id:e,include_types:t,user_tags:a,limit:n,offset:r}){return Hd(yield g.mediaFiles({boxId:e,includeTypes:t,userTags:a,limit:n,offset:r}))}),function(e){return l.apply(this,arguments)})),y({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:Yt().describe("Media file ID")},permission:"query_media_flow"},(d=O(function*({file_id:e}){return Hd(yield g.mediaFile({fileId:e}))}),function(e){return d.apply(this,arguments)})),y({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:Yt().describe("Target media box ID"),name:Yt().describe("File name"),description:Yt().optional().default("").describe("File description"),file_type:ea(["image","video","audio","file"]).describe("File type"),source_url:Yt().optional().describe("URL to download the file from"),base64_data:Yt().optional().describe("Base64 encoded file data"),user_tags:Jt(Yt()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(u=O(function*({box_id:e,name:t,description:a,source_url:n,base64_data:r,file_type:i,user_tags:o}){if(!n&&!r)throw new Error("Either source_url or base64_data must be provided");if(n&&r)throw new Error("Provide either source_url OR base64_data, not both");var s=n?null:"application/octet-stream",p=n?yield(0,Kd.Ay)(n,{agent:iu(n)}).then(e=>(s=e.headers.get("content-type"),e.blob())):new Blob([Ud.Buffer.from(r,"base64")],{type:s}),l=yield g.requestFileUpload({name:t,description:a,boxId:e,fileType:E?i.toUpperCase():i,contentType:s,userTags:o,meta:{}}),d=JSON.parse(l?.meta.uploadInfo),u=new FormData;u.append("file",p),u.append("Content-Type",s),u.append("AWSAccessKeyId",d.AWSAccessKeyId),u.append("Signature",d.Signature),u.append("Policy",d.Policy),u.append("acl",d.acl),u.append("key",d.key);var c=yield(0,Kd.Ay)(d.url,{method:"POST",body:u}).then(e=>e.ok).catch(()=>!1);return Hd({file_id:l.id,upload_success:c,upload_info:{content_type:s,file_type:i,source_type:n?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return u.apply(this,arguments)})),y({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:Yt().describe("Media file ID"),name:Yt().optional().describe("New file name"),description:Yt().optional().describe("New file description"),user_tags:Jt(Yt()).optional().describe("New user tags")},permission:"write_media_flow"},(c=O(function*({file_id:e,name:t,description:a,user_tags:n}){return Hd(yield g.updateMediaFile({fileId:e,name:t,description:a,userTags:n,requestUploadAgain:!1}))}),function(e){return c.apply(this,arguments)})),y({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:Yt().describe("Source media box ID"),to_box_id:Yt().describe("Target media box ID"),file_ids:Jt(Yt()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(m=O(function*({from_box_id:e,to_box_id:t,file_ids:a}){return Hd(yield g.copyMediaFiles({fromBoxId:e,toBoxId:t,list:a}))}),function(e){return m.apply(this,arguments)})),y({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:Yt().describe("Media box ID"),file_ids:Jt(Yt()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(f=O(function*({box_id:e,file_ids:t}){return Hd(yield g.deleteMediaFiles({boxId:e,list:t}))}),function(e){return f.apply(this,arguments)})),y({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:Yt().describe("Media box ID"),include_types:Jt(Yt()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(_=O(function*({box_id:e,include_types:t}){if("deleteMediaBoxFiles"in g)return Hd(yield g.deleteMediaBoxFiles({boxId:e,includeTypes:t}));var a=yield g.mediaFiles({boxId:e,includeTypes:t});return Hd(yield g.deleteMediaFiles({boxId:e,list:a.map(e=>e.id)}))}),function(e){return _.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:Xt().describe("Device width in pixels"),device_height:Xt().describe("Device height in pixels"),app_grid_width:Xt().describe("Application grid width").optional().default(96),app_grid_height:Xt().describe("Application grid height").optional().default(54)},(h=O(function*({device_width:e,device_height:t,app_grid_width:a,app_grid_height:n}){var r,i,o={deviceBrickWidth:(r=e)/(i=r/a),deviceBrickHeight:t/i,deviceBrickUnit:i},s=function(e,t,a=96){var n=e/a;return t>e&&(n=t/a),{deviceBrickWidth:Math.round(e/n),deviceBrickHeight:Math.round(t/n),deviceBrickUnit:n}}(e,t,a);return Hd({device_resolution:{width:e,height:t,aspect_ratio:(e/t).toFixed(2)},current_grid:{width:a,height:n,unit_size_px:o.deviceBrickUnit.toFixed(2),total_pixels:{width:o.deviceBrickWidth.toFixed(2),height:o.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:s.deviceBrickWidth,height:s.deviceBrickHeight,unit_size_px:s.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return h.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:ea(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:Yt().describe("Item title"),template_key:Yt().optional().describe("Template key for brick or generator")},hh),e.tool("getting_started","Get documentation content for getting started",{},O(function*(){return Hd(ec)}))}var yh="2.24.0-beta.10";function Th(){return Th=O(function*(e={}){var t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),new Error("API token is required");var a=Vd({queryStringParameters:{token:t}});if(!a.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(a.message),new Error("Invalid BRICKS_API_TOKEN");var n,r=new Ad({name:mh,version:yh}),i={...a,client:ch(fh.bricks,a.token,a.tokenType)};(n=r).prompt("getting-started","Getting started with BRICKS",{},O(function*(){return{messages:[{role:"user",content:{type:"text",text:'Welcome to BRICKS — start here.\n\nBefore doing any complex work (application design, deployments, etc.),\nalways consult the official docs rather than guessing.\n\nIMPORTANT: BRICKS users interact through a GUI editor, not raw config files.\nNever show users JSON config details, schema fields, or technical implementation.\nFocus on user-friendly descriptions of what the app will do and how it will look.\n\nGolden rules for working with BRICKS:\n1) Read before you act\n - Open these resources first, then proceed:\n - `getting-started` — overview & architecture\n - `config-schema` — canonical schema for apps, subspaces, bricks, generators, etc.\n - `components-index` — available bricks/generators\n2) Source of truth\n - Rely on the docs above; do not invent fields not present in the schema\n3) No guessing\n - If names, constraints, or device details are missing, ask to fetch them first\n4) Plan then execute\n - Propose a clear step-by-step plan and wait for approval before writing or mutating data\n5) User-friendly communication\n - Describe features in terms of what users see and do, not technical config\n - Use visual/functional language: "text display", "button", "screen transition"\n - Avoid exposing JSON, IDs, or schema details to end users\n\nBRICKS essentials:\n- Applications: interactive digital signage experiences\n- Devices: deployment targets (screens/players)\n- Modules: Reusable module across applications\n- Grid system: default 96×54; 1 unit = device_width/96 (e.g., 20px at 1920×1080)\n- Key primitives: Subspaces, Canvas, Bricks, Generators, Property Banks (Data)\n\nQuick actions:\n- "Create a new application" → use the `create-application` prompt\n- "Deploy an application to a device" → use the `deploy-to-device` prompt\n\nTry asking:\n- "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"'}}]}})),n.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:Yt().describe("Name for the new application"),description:Yt().describe("Short description for the new application").optional()},function(){var e=O(function*(e){var t=e?.app_name||"New Application",a=e?.description||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${t}".\n\n${a?`Goal: ${a}`:""}\n\nIMPORTANT: Users see a visual GUI editor, not raw config. Describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation\n\nHow we'll proceed (no guessing, schema-first):\n1) Confirm intent\n - Restate objectives and success criteria in 1–3 bullets\n2) Consult docs (as needed)\n - getting-started, config-schema, components-index\n - Ensure proposed fields exist in the schema\n3) Ask missing questions before changes\n - Target device(s) and resolution(s)\n - Layout needs (pages/screens), content types, data sources\n - Localization, scheduling, or interaction needs\n4) Propose a minimal viable design (After confirming intent)\n - App structure: screens → visual elements\n - Initial component selection with rationale\n - Grid usage: default 96×54 (≈20px at 1920×1080)\n5) Produce a schema-valid skeleton (no side effects yet)\n - Include only fields defined by config-schema\n - Use clear placeholders for text/assets/URLs/ids\n\nWhat I'll produce first:\n- Short recap of requirements\n- Clarifying questions (only what's necessary)\n- High-level architecture plan\n- Minimal config skeleton that validates against the schema`}}]}});return function(t){return e.apply(this,arguments)}}()),function(e){e.resource("getting-started-docs","file://docs/getting-started.md",{mimeType:"text/markdown",title:"Getting Started with BRICKS",description:"Comprehensive guide to BRICKS architecture, concepts, and development workflow"},O(function*(){return Hd($d,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(r),Eh(r,i);var o=new Gd;try{yield r.connect(o),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${mh} v${yh}`),console.error(`Token Type: ${a.tokenType}`),console.error(`Permissions: ${a.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}}),Th.apply(this,arguments)}var Rh=new P("mcp").description("MCP server management");Rh.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action(function(){var e=O(function*(e){var t=(0,V.getCurrentProfile)(),a=e.token||(0,V.getToken)(t);a||(console.error(M.Ay.red("Error: No API token found.")),console.error(M.Ay.gray("Please login first with: bricks auth login <passcode>")),console.error(M.Ay.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{yield function(){return Th.apply(this,arguments)}({token:a})}catch(e){console.error(M.Ay.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}());var gh=new P("devtools").description("DevTools server discovery and connection");gh.command("scan").description("Scan LAN for DevTools servers via UDP + HTTP").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-j, --json","Output as JSON").option("--verify","Verify each discovered server via HTTP").option("--udp-only","Skip HTTP subnet probe (UDP only)").option("-p, --port <port>","Port for HTTP probe","19851").action(function(){var e=O(function*(e){var t=(yield Promise.resolve().then(c.bind(c,9790))).default,a=yield c.e(44).then(c.bind(c,2044)),n=a.discoverDevToolsServers,r=a.verifyDevToolsServer,i=a.httpProbeSubnet,o=yield Promise.resolve().then(c.bind(c,8765)),s=o.getCurrentProfile,p=o.getTokenInfo,l=parseInt(e.timeout,10),d=t(`Scanning for DevTools servers (${l}ms)...`).start();try{var u=n({timeout:l}),m=e.udpOnly?Promise.resolve([]):(d.text="Scanning via UDP + HTTP probe...",i({port:parseInt(e.port,10)})),f=yield Promise.all([u,m]),_=pe(f,2),h=_[0],E=_[1],y=[...h,...E],T=new Map;for(var R of y){var g=R.deviceId||`${R.address}:${R.port}`,v=T.get(g);if(v)for(var N of(v.addresses.includes(R.address)||v.addresses.push(R.address),"127.0.0.1"===v.address&&"127.0.0.1"!==R.address&&(v.address=R.address),R.protocols||[]))v.protocols?.includes(N)||v.protocols?.push(N);else T.set(g,{...R,addresses:[R.address]})}var b=[...T.values()];if(0===b.length)return void d.info("No DevTools servers found on the network.");if(e.verify){d.text=`Verifying ${b.length} server(s)...`;var A=yield Promise.all(b.map(function(){var e=O(function*(e){var t=yield r(e.address,e.port);return{...e,verified:!!t}});return function(t){return e.apply(this,arguments)}}()));b.splice(0,b.length,...A)}if(d.stop(),e.json)return void console.log(JSON.stringify(b,null,2));var S=p(s()),I=S?.workspaceId||null;console.log(M.Ay.bold(`\nFound ${b.length} DevTools server(s)`)),console.log("─".repeat(80));var w=function*(e){var t=!1===e.verified?M.Ay.red("unverified"):M.Ay.green("online"),a=e.hasPasscode?M.Ay.yellow("passcode"):M.Ay.gray("open"),n=(e.protocols||[]).map(e=>M.Ay.cyan(e)).join(", "),r=e.workspaceId&&I&&e.workspaceId===I,i=e.addresses||[e.address],o=i.filter(t=>t!==e.address),s=o.length>0?`${e.address}:${e.port} +${o.length} more`:`${e.address}:${e.port}`;console.log(` ${M.Ay.bold(e.name||"Unknown")} ${M.Ay.gray(`(${s})`)} [${t}]`),o.length>0&&console.log(` Addresses: ${i.map(e=>M.Ay.gray(e)).join(", ")}`);var p=` Protocols: ${n||M.Ay.gray("none")} Auth: ${a}`;if(e.deviceId&&(p+=` Device: ${M.Ay.gray(e.deviceId)}`),console.log(p),e.workspaceId){var l=r?M.Ay.green(`${e.workspaceId} (current profile)`):M.Ay.gray(e.workspaceId);console.log(` Workspace: ${l}`)}};for(var C of b)yield*w(C);console.log("─".repeat(80)),console.log(M.Ay.gray(`\nConnect via: devtools://devtools/bundled/js_app.html?ws=<address>:${b[0]?.port||19851}/ws?p=<passcode>`))}catch(e){d.fail(`Scan failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),gh.command("open <address>").description("Show connection URLs for a DevTools server").option("-p, --port <port>","Server port","19851").option("--verify","Verify server is reachable first").action(function(){var e=O(function*(e,t){var a=parseInt(t.port,10),n=`${e}:${a}`;if(t.verify){var r=(yield Promise.resolve().then(c.bind(c,9790))).default,i=(yield c.e(44).then(c.bind(c,2044))).verifyDevToolsServer,o=r(`Verifying ${n}...`).start(),s=yield i(e,a);s||(o.fail(`Could not reach DevTools server at ${n}`),process.exit(1)),o.succeed(`${s.name||"DevTools"} is reachable`),console.log()}console.log(M.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${M.Ay.cyan(`http://${n}`)}`),console.log(` CDP: ${M.Ay.cyan(`devtools://devtools/bundled/js_app.html?ws=${n}/ws?p=<passcode>`)}`),console.log(` MCP: ${M.Ay.cyan(`http://${n}/mcp`)}`),console.log(` MCP SSE: ${M.Ay.cyan(`http://${n}/sse`)}`),console.log(` Info: ${M.Ay.cyan(`http://${n}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(M.Ay.bold("Authorization")),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),console.log(` ${M.Ay.gray("Authorization: Bearer <passcode>")}`)});return function(t,a){return e.apply(this,arguments)}}());var vh=function(){var e=O(function*(){if(b.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.24.0-beta.10").enablePositionalOptions(),b.addCommand(U),b.addCommand(Z),b.addCommand(ie),b.addCommand(se),b.addCommand(ce),b.addCommand(_e),b.addCommand(Re),b.addCommand(Rh),b.addCommand(gh),b.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(O(function*(){try{(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),b.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=yield Promise.resolve().then(c.bind(c,8765)),a=t.getToken,n=t.getBaseUrl,r=t.getCurrentProfile,i=(yield Promise.resolve().then(c.bind(c,700))).createClient,o=(yield Promise.resolve().then(c.bind(c,9790))).default,s=a(r());s||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var p=o("Fetching workspace info...").start();try{var l=i(n(),s),d=yield l.workspace();if(p.stop(),e.json)return void console.log(JSON.stringify(d,null,2));console.log(M.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${M.Ay.green(d.name)}`),console.log(`ID: ${M.Ay.gray(d._id)}`),console.log(`Description: ${d.description||M.Ay.gray("N/A")}`),console.log(`\n${M.Ay.bold("Data")}`),console.log(`Remote Update: ${d.bank?.enable_remote_update?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),console.log(`Spacename: ${d.bank?.spacename||M.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){p.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),b.on("--help",()=>{console.log(""),console.log(M.Ay.bold("Examples:")),console.log(""),console.log(M.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(M.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(M.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(M.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(M.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(M.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(M.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(M.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(M.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(M.Ay.cyan(" https://control.bricks.tools")),console.log(M.Ay.gray(" Go to Workspace Settings > API Token"))}),0===process.argv.slice(2).length)try{return void(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}yield b.parseAsync(process.argv)});return function(){return e.apply(this,arguments)}}();const Oh=vh;export{Oh as default,vh as run};
|
|
3069
|
+
`,lh={query:"query",mutation:"mutate"},dh=(e,t,a)=>([n,r])=>{if(e[n])throw new Error(`Overwriting client.${n}`);e[n]=async(i,o={})=>{let s,p;const l={[t]:r,variables:i,...o};if(a&&(l.variables={...a,...l.variables}),o.readQuery?s=e.readQuery(l):o.writeQuery?e.writeQuery({...l,data:o.writeQuery}):({data:s,errors:p}=await e[lh[t]](l)),p)throw new Error(p.map(e=>e.message).join("\n"));return s?s[n]:null}},uh=e=>{const t=(({endpoint:e="http://localhost:3002",accessToken:t,boxId:a,passcode:n,enableSubscription:r=!0,enableRetry:i=!0,subscriptionOnConnectionOrError:o,onNetworkError:s}={})=>{const p=a&&n;let l=`${e}/api/graphql`;return p&&(l=`${e}/api/graphql_with_passcode`),L_({endpointURL:l,subscriptionEndpointURL:l.replace("http:","ws:"),accessToken:t,enableSubscription:!p&&r,enableRetry:i,subscriptionOnConnectionOrError:o,onNetworkError:s})})(e);if(e.boxId&&e.passcode){t.type="passcode",t.queries=g,t.mutations=v;const a={boxId:e.boxId,passcode:e.passcode};Object.entries(g).forEach(dh(t,"query",a)),Object.entries(v).forEach(dh(t,"mutation",a)),t.listenBoxChanged=(e,n)=>t.subscribe({query:ph,variables:{...a,...e}}).subscribe({next:async({data:e})=>{await n(null,e.mediaBoxChanged)},error(e){n(e)}})}else t.accessToken=e.accessToken,t.type="token",t.queries=T,t.mutations=R,Object.entries(T).forEach(dh(t,"query")),Object.entries(R).forEach(dh(t,"mutation")),t.listenBoxChanged=(e,a)=>t.subscribe({query:eh,variables:e}).subscribe({next:async({data:e})=>{await a(null,e.mediaBoxChanged)},error(e){a(e)}});return t};function ch(e,t,a){switch(a){case"user":return new rf(e,t);case"workspace":return new Hf(e,t);default:throw new Error(`Invalid token type: ${a}.`)}}process.env.STAGE,process.env.URL_BASE;var mh="bricks-mcp",fh={bricks:process.env.BRICKS_API_SERVER||"https://display-beta.bricks.tools",media:process.env.MEDIA_API_SERVER||"https://media-beta.bricks.tools"},_h=(process.env.AUTH0_DOMAIN,process.env.CACHE_URL,c(1639));const hh=({type:e,title:t,template_key:a})=>{var n,r,i=(0,_h.makeId)(e);switch(e){case"subspace":n={title:t,layout:{width:"number",height:"number"},root_canvas_id:"CANVAS_<UUID>",canvas_map:{},brick_map:{},animation_map:{},generator_map:{},property_bank_map:{},property_bank_calc_map:{}},r={"canvas_map.CANVAS_<UUID>.item_list":[{type:"subspace",subspace_id:"SUBSPACE_<UUID>",$note:"If not a root subspace, it can be linked to canvas in other subspace"}]};break;case"canvas":var o=Qu(Wu.canvas);n={title:t,item_list:[],property:{$definitions:Object.fromEntries(Object.entries(o.propTypes).map(([e,t])=>[e,{...t,description:o.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(o.eventTypes).map(([e])=>[e,{description:o.brickEventDescriptions[e]}]))}},r={property_bank_map:{[(0,_h.makeId)("property_bank")]:{title:`Canvas ID: ${t}`,type:"string",value:i,routing:"read-only",kind:"auto-generated-item-id",idType:"canvas"}}};break;case"brick":var s=Qu(Wu.components.Basic),p=Qu(Wu.brickMapping[a]);if(!p)throw new Error(`Brick ${a} not found`);var l={...p,propTypes:{...s.propTypes,...p.propTypes},brickPropDescriptions:{...s.brickPropDescriptions,...p.brickPropDescriptions},eventTypes:{...s.eventTypes,...p.eventTypes},brickEventDescriptions:{...s.brickEventDescriptions,...p.brickEventDescriptions}};n={title:t,template_key:a,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,t])=>[e,{...t,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.brickOutletDescriptions[e]}]))},state_group:{"BRICK_STATE_GROUP_<UUID>":{}}},r={canvas_map:{"CANVAS_<UUID WHICH NEED DISPLAY THIS BRICK>":{item_list:[{type:"brick",brick_id:i,frame:{x:"number",y:"number",width:"number",height:"number",standby_mode:"custom|top|left|right|bottom",standby_delay:"number",standby_easing:{default:{method:"ease",duration:"number"}}}}]}}};break;case"state_group":n={title:t,description:"State Group Description",conds:[{type:"property_bank|inner_state",key:"PROPERTY_BANK#<Data Node ID>|[current_canvas|BRICK_<OUTLET NAME>]|",method:"==|!=|>|>=|<|<=",value:"value_to_compare"}],override:{property:!1,event:!1,outlet:!1},commented:!1,break:!1,property:{},outlet:{},animation:{}};case"generator":var d=Qu(Wu.generatorMapping[a]);if(!d)throw new Error(`Generator ${a} not found`);n={title:t,template_key:a,property:{$definitions:Object.fromEntries(Object.entries(d.propTypes).map(([e,t])=>[e,{...t,description:d.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(d.eventTypes).map(([e])=>[e,{description:d.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(d.outletTypes).map(([e])=>[e,{description:d.brickOutletDescriptions[e]}]))}};break;case"animation":n={title:t,type:"timing|decay|spring",property:"opacity|transform.translateX|transform.scale|etc",config:{$note:"Config for the animation"},compose_type:"parallel|sequence",item_list:[{animation_id:"ANIMATION_<SUB ANIMATION UUID>"}]};break;case"property_bank":n={title:t,description:"Property Bank Description",linkedFrom:"SUBSPACE_<UUID WHICH IS CROSS SUBSPACE>",type:"string|number|bool|object|array|any",kind:"color|datetime|id|media-resource-*|lottie-file-uri",unit:"grid|px|ms",routing:"read-only|default",value:"fit-to-type",event_map:{$note:`Available events: ${Object.keys(Wu.propertyBank.eventTypes).join(", ")}`},local_sync:{update_mode:"all|main-only|minor-only|dont-sync"},$remote_update_additional:{$note:"Configure remote update behavior",enable_remote_update:!0,bank_type:"create|create-device-specific"}};break;case"property_bank_command":break;case"property_bank_calc":var u=(0,_h.makeId)("property_bank_command"),c=(0,_h.makeId)("property_bank_command"),m=(0,_h.makeId)("property_bank_command"),f="const { arg_name } = inputs;\n\nreturn { arg_name };";n={title:t,map:{$note:"Required, actual implementation","PROPERTY_BANK_DATA_NODE_<UUID>":{type:"data-node",properties:{},in:{change:null},out:{value:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID>",port:"value"}]},$note:"Use this to input data to the sandbox"},"PROPERTY_BANK_COMMAND_NODE_<UUID FIRST>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:null,path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${u}`,port:"obj | inputs"}]}},"PROPERTY_BANK_COMMAND_NODE_<UUID SECOND>":{type:"command-node-object",title:"Command: OBJECT_SET",properties:{command:"OBJECT_SET",args:{path:"arg_name"}},in:{obj:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PREVIOUS>",port:"result"}],path:null,value:[{id:"PROPERTY_BANK_DATA_NODE_<UUID SECOND>",port:"value"}]},out:{result:[{id:`PROPERTY_BANK_COMMAND_NODE_<UUID NEXT> | ${u}`,port:"obj | inputs"}]}},[u]:{type:"command-node-sandbox",title:"Command: SANDBOX_RUN_JAVASCRIPT",properties:{command:"SANDBOX_RUN_JAVASCRIPT",args:{code:f,enable_async:!1}},in:{code:null,inputs:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID FINAL>",port:"result"}]},out:{result:[{id:m,port:"result"},{id:c,port:"result"}]}},[m]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_ERROR",properties:{command:"SANDBOX_GET_ERROR"},in:{result:[{id:u,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR>",port:"change"}],$note:"Set `result` as null if there is no error"}},[c]:{type:"command-node-sandbox",title:"Command: SANDBOX_GET_RETURN_VALUE",properties:{command:"SANDBOX_GET_RETURN_VALUE"},in:{result:[{id:u,port:"result"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT> | null",port:"change"}]}},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT>":{type:"data-node",properties:{},in:{change:[{id:c,port:"result"}]},out:{value:null},$note:"Put full result into data node"},"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>":{type:"command-node-object",title:"Command: OBJECT_GET",properties:{command:"OBJECT_GET",args:{path:"obj_key"}},in:{obj:[{id:c,port:"obj"}]},out:{result:[{id:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>",port:"change"}]},$note:"Parse result object into data node"},"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>":{type:"data-node",properties:{},in:{change:[{id:"PROPERTY_BANK_COMMAND_NODE_<UUID PARSE RESULT>",port:"result"}]},out:{value:null},$note:"Put partial result into data node"}},editor_info:{},type:"script",script_config:{title:t,enable_async:!1,inputs:{"PROPERTY_BANK_DATA_NODE_<UUID>":"arg_name"},disabled_triggers:{},error:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE ERROR> | null",output:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE RESULT> | null",outputs:{obj_key:"PROPERTY_BANK_DATA_NODE_<UUID RECEIVE PARTIAL RESULT>"},code:f,$note:"Required, info for GUI editor"}}}return Hd({id:i,example:n,extraInfo:r})};function Eh(e,t){var a,n,r,i,o,s,p,l,d,u,c,m,f,_,h,E="user"===t.tokenType,y=((e,t=null)=>({name:a,description:n,inputSchema:r,permission:i},o)=>{tc(t,i)&&e.tool(a,n,r,o)})(e,t),T=e=>({...e,...E?{workspace_id:Yt().describe("Workspace ID")}:{}}),R=t.client,g=E?function(e){var t=e.endpoint,a=e.accessToken;if(!t)throw new Error("Media API endpoint is required");if(!a)throw new Error("Access token is required");return uh({endpoint:t,accessToken:a,enableSubscription:!1,enableRetry:!0})}({endpoint:fh.media,accessToken:t.token}):R;E&&e.tool("list_workspaces","List all workspaces",{},O(function*(){return Hd(yield R.workspaces())})),y({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:T({}),permission:"info"},function(){var e=O(function*({workspace_id:e}){var t=yield Promise.all([R.workspace({id:e}),R.applications({workspaceId:e,paginate:{limit:50,offset:0}}),R.modules({workspaceId:e,paginate:{limit:50,offset:0}}),R.devices({workspaceId:e,paginate:{limit:50,offset:0}}),E?g.mediaWorkspace({workspaceId:e}).catch(()=>null):g.mediaWorkspace().catch(()=>null),E?g.mediaBoxes({workspaceId:e}).catch(()=>[]):g.mediaBoxes().catch(()=>[])]),a=pe(t,6),n=a[0],r=a[1],i=a[2],o=a[3],s=a[4],p=a[5];if(!n)throw new Error("Authentication failed, please check your token");return Hd({workspace:n,stats:{applications:r?.length??"No permission",modules:i?.length??"No permission",devices:o?.length??"No permission",running_apps:r?.filter(e=>e.status?.running).length??"No permission",media_boxes:p?.length??"No permission",media_enabled:!!s,notes:"Note: The stats are based on the first 50 applications, modules, and devices in the workspace."},recent_activity:{latest_apps:r?.slice(0,5).map(e=>({id:e._id,name:e.name,status:e.status?.running?"running":"stopped",last_update:e.last_modify_datetime}))||[]},media_info:s?{workspace_id:s.id,name:s.name,size_used:s.size,size_limit:s.sizeLimit,boxes:p?.slice(0,5).map(e=>({id:e.id,name:e.name,size:e.size,description:e.description}))||[]}:{enabled:!1,note:"Media workspace is not enabled for this workspace"}})});return function(t){return e.apply(this,arguments)}}()),y({name:"get_applications",description:"List all applications in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of applications to return").optional().default(50),offset:Xt().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.applications({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:T({id:Yt().describe("Application ID")}),permission:"query_application"},function(){var e=O(function*({workspace_id:e,id:t}){return Hd(yield R.application({workspaceId:e,id:t}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_modules",description:"List all modules in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of modules to return").optional().default(50),offset:Xt().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.modules({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:T({id:Yt().describe("Module ID")}),permission:"query_module"},function(){var e=O(function*({workspace_id:e,id:t}){return Hd(yield R.module({workspaceId:e,id:t}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_module_info",description:"Update a specific module info",inputSchema:T({id:Yt().describe("Module ID"),name:Yt().describe("Module name"),description:Yt().describe("Module description")}),permission:"update_module"},function(){var e=O(function*({workspace_id:e,id:t,name:a,description:n}){return Hd(yield R.updateModule({workspaceId:e,id:t,name:a,description:n}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_module_config",description:"Update a specific module configuration",inputSchema:T({id:Yt().describe("Module ID"),config:Zt({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},function(){var e=O(function*({workspace_id:e,id:t,config:a}){var n=yield Ku(a);if(!n.valid)throw new Error(`Config validation failed: ${n.errors.join(", ")}`);return Hd(yield R.updateModule({workspaceId:e,id:t,config:JSON.stringify(a),validateConfig:!0}))});return function(t){return e.apply(this,arguments)}}()),y({name:"get_devices",description:"List all devices in the workspace",inputSchema:T({limit:Xt().describe("Maximum number of devices to return").optional().default(50),offset:Xt().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},function(){var e=O(function*({workspace_id:e,limit:t=50,offset:a=0}){return Hd(yield R.devices({workspaceId:e,paginate:{limit:t,offset:a}}))});return function(t){return e.apply(this,arguments)}}()),y({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:T({name:Yt().describe("Application name"),description:Yt().describe("Application description").optional(),grid_width:Xt().describe("Grid width in units").optional().default(96),grid_height:Xt().describe("Grid height in units").optional().default(54)}),permission:"create_application"},function(){var e=O(function*({workspace_id:e,name:t,description:a,grid_width:n,grid_height:r}){return Hd(yield R.createApplication({workspaceId:e,name:t,description:a,gridWidth:n,gridHeight:r}))});return function(t){return e.apply(this,arguments)}}()),y({name:"update_application_info",description:"Update application info",inputSchema:{id:Yt().describe("Application ID"),name:Yt().describe("Application name"),description:Yt().describe("Application description")},permission:"update_application"},(a=O(function*({id:e,name:t,description:a}){return Hd(yield R.updateApplication({id:e,name:t,description:a}))}),function(e){return a.apply(this,arguments)})),y({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:Yt().describe("Application ID"),config:Zt({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(n=O(function*({id:e,config:t}){var a=yield Ku(t);if(!a.valid)throw new Error(`Config validation failed: ${a.errors.join(", ")}`);return Hd(yield R.updateApplication({id:e,config:JSON.stringify(t)}))}),function(e){return n.apply(this,arguments)})),y({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:Yt().describe("Application ID"),viewports:Jt(Zt({device_id:Yt().describe("Device ID"),x:Xt().describe("X coordinate"),y:Xt().describe("Y coordinate"),width:Xt().describe("Width"),height:Xt().describe("Height"),rotate:Xt().describe("Rotation"),rotateType:Yt().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(r=O(function*({app_id:e,viewports:t}){return Hd(yield R.bindApplication({id:e,bind_devices:t.map(e=>e.device_id),device_frames:t.reduce((e,t)=>({...e,[t.device_id]:{x:t.x,y:t.y,width:t.width,height:t.height,rotate:t.rotate,rotateType:t.rotateType}}),{})}))}),function(e){return r.apply(this,arguments)})),y({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:Yt().describe("Application ID"),device_id:Yt().describe("Device ID")},permission:"bind_application"},(i=O(function*({app_id:e,device_id:t}){return Hd(yield R.bindApplication({id:e,unbindDevices:[t]}))}),function(e){return i.apply(this,arguments)})),E&&y({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},O(function*(){return Hd(yield g.mediaWorkspaces())})),y({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:T({}),permission:"query_media_flow"},(o=O(function*({workspace_id:e}){return Hd(yield g.mediaWorkspace({workspaceId:e}))}),function(e){return o.apply(this,arguments)})),y({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:T({}),permission:"query_media_flow"},(s=O(function*({workspace_id:e}){return Hd(yield g.mediaBoxes({workspaceId:e}))}),function(e){return s.apply(this,arguments)})),y({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:Yt().describe("Media box ID")},permission:"query_media_flow"},(p=O(function*({box_id:e}){return Hd(yield g.mediaBox({boxId:e}))}),function(e){return p.apply(this,arguments)})),y({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:Yt().describe("Media box ID"),include_types:Jt(Yt()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:Jt(Yt()).optional().describe("Filter by user tags"),limit:Xt().optional().default(50).describe("Maximum number of files to return"),offset:Xt().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(l=O(function*({box_id:e,include_types:t,user_tags:a,limit:n,offset:r}){return Hd(yield g.mediaFiles({boxId:e,includeTypes:t,userTags:a,limit:n,offset:r}))}),function(e){return l.apply(this,arguments)})),y({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:Yt().describe("Media file ID")},permission:"query_media_flow"},(d=O(function*({file_id:e}){return Hd(yield g.mediaFile({fileId:e}))}),function(e){return d.apply(this,arguments)})),y({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:Yt().describe("Target media box ID"),name:Yt().describe("File name"),description:Yt().optional().default("").describe("File description"),file_type:ea(["image","video","audio","file"]).describe("File type"),source_url:Yt().optional().describe("URL to download the file from"),base64_data:Yt().optional().describe("Base64 encoded file data"),user_tags:Jt(Yt()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(u=O(function*({box_id:e,name:t,description:a,source_url:n,base64_data:r,file_type:i,user_tags:o}){if(!n&&!r)throw new Error("Either source_url or base64_data must be provided");if(n&&r)throw new Error("Provide either source_url OR base64_data, not both");var s=n?null:"application/octet-stream",p=n?yield(0,Kd.Ay)(n,{agent:iu(n)}).then(e=>(s=e.headers.get("content-type"),e.blob())):new Blob([Ud.Buffer.from(r,"base64")],{type:s}),l=yield g.requestFileUpload({name:t,description:a,boxId:e,fileType:E?i.toUpperCase():i,contentType:s,userTags:o,meta:{}}),d=JSON.parse(l?.meta.uploadInfo),u=new FormData;u.append("file",p),u.append("Content-Type",s),u.append("AWSAccessKeyId",d.AWSAccessKeyId),u.append("Signature",d.Signature),u.append("Policy",d.Policy),u.append("acl",d.acl),u.append("key",d.key);var c=yield(0,Kd.Ay)(d.url,{method:"POST",body:u}).then(e=>e.ok).catch(()=>!1);return Hd({file_id:l.id,upload_success:c,upload_info:{content_type:s,file_type:i,source_type:n?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return u.apply(this,arguments)})),y({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:Yt().describe("Media file ID"),name:Yt().optional().describe("New file name"),description:Yt().optional().describe("New file description"),user_tags:Jt(Yt()).optional().describe("New user tags")},permission:"write_media_flow"},(c=O(function*({file_id:e,name:t,description:a,user_tags:n}){return Hd(yield g.updateMediaFile({fileId:e,name:t,description:a,userTags:n,requestUploadAgain:!1}))}),function(e){return c.apply(this,arguments)})),y({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:Yt().describe("Source media box ID"),to_box_id:Yt().describe("Target media box ID"),file_ids:Jt(Yt()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(m=O(function*({from_box_id:e,to_box_id:t,file_ids:a}){return Hd(yield g.copyMediaFiles({fromBoxId:e,toBoxId:t,list:a}))}),function(e){return m.apply(this,arguments)})),y({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:Yt().describe("Media box ID"),file_ids:Jt(Yt()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(f=O(function*({box_id:e,file_ids:t}){return Hd(yield g.deleteMediaFiles({boxId:e,list:t}))}),function(e){return f.apply(this,arguments)})),y({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:Yt().describe("Media box ID"),include_types:Jt(Yt()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(_=O(function*({box_id:e,include_types:t}){if("deleteMediaBoxFiles"in g)return Hd(yield g.deleteMediaBoxFiles({boxId:e,includeTypes:t}));var a=yield g.mediaFiles({boxId:e,includeTypes:t});return Hd(yield g.deleteMediaFiles({boxId:e,list:a.map(e=>e.id)}))}),function(e){return _.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:Xt().describe("Device width in pixels"),device_height:Xt().describe("Device height in pixels"),app_grid_width:Xt().describe("Application grid width").optional().default(96),app_grid_height:Xt().describe("Application grid height").optional().default(54)},(h=O(function*({device_width:e,device_height:t,app_grid_width:a,app_grid_height:n}){var r,i,o={deviceBrickWidth:(r=e)/(i=r/a),deviceBrickHeight:t/i,deviceBrickUnit:i},s=function(e,t,a=96){var n=e/a;return t>e&&(n=t/a),{deviceBrickWidth:Math.round(e/n),deviceBrickHeight:Math.round(t/n),deviceBrickUnit:n}}(e,t,a);return Hd({device_resolution:{width:e,height:t,aspect_ratio:(e/t).toFixed(2)},current_grid:{width:a,height:n,unit_size_px:o.deviceBrickUnit.toFixed(2),total_pixels:{width:o.deviceBrickWidth.toFixed(2),height:o.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:s.deviceBrickWidth,height:s.deviceBrickHeight,unit_size_px:s.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return h.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:ea(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:Yt().describe("Item title"),template_key:Yt().optional().describe("Template key for brick or generator")},hh),e.tool("getting_started","Get documentation content for getting started",{},O(function*(){return Hd(ec)}))}var yh="2.24.0-beta.12";function Th(){return Th=O(function*(e={}){var t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),new Error("API token is required");var a=Vd({queryStringParameters:{token:t}});if(!a.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(a.message),new Error("Invalid BRICKS_API_TOKEN");var n,r=new Ad({name:mh,version:yh}),i={...a,client:ch(fh.bricks,a.token,a.tokenType)};(n=r).prompt("getting-started","Getting started with BRICKS",{},O(function*(){return{messages:[{role:"user",content:{type:"text",text:'Welcome to BRICKS — start here.\n\nBefore doing any complex work (application design, deployments, etc.),\nalways consult the official docs rather than guessing.\n\nIMPORTANT: BRICKS users interact through a GUI editor, not raw config files.\nNever show users JSON config details, schema fields, or technical implementation.\nFocus on user-friendly descriptions of what the app will do and how it will look.\n\nGolden rules for working with BRICKS:\n1) Read before you act\n - Open these resources first, then proceed:\n - `getting-started` — overview & architecture\n - `config-schema` — canonical schema for apps, subspaces, bricks, generators, etc.\n - `components-index` — available bricks/generators\n2) Source of truth\n - Rely on the docs above; do not invent fields not present in the schema\n3) No guessing\n - If names, constraints, or device details are missing, ask to fetch them first\n4) Plan then execute\n - Propose a clear step-by-step plan and wait for approval before writing or mutating data\n5) User-friendly communication\n - Describe features in terms of what users see and do, not technical config\n - Use visual/functional language: "text display", "button", "screen transition"\n - Avoid exposing JSON, IDs, or schema details to end users\n\nBRICKS essentials:\n- Applications: interactive digital signage experiences\n- Devices: deployment targets (screens/players)\n- Modules: Reusable module across applications\n- Grid system: default 96×54; 1 unit = device_width/96 (e.g., 20px at 1920×1080)\n- Key primitives: Subspaces, Canvas, Bricks, Generators, Property Banks (Data)\n\nQuick actions:\n- "Create a new application" → use the `create-application` prompt\n- "Deploy an application to a device" → use the `deploy-to-device` prompt\n\nTry asking:\n- "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"'}}]}})),n.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:Yt().describe("Name for the new application"),description:Yt().describe("Short description for the new application").optional()},function(){var e=O(function*(e){var t=e?.app_name||"New Application",a=e?.description||"";return{messages:[{role:"user",content:{type:"text",text:`Help me create a new BRICKS application called "${t}".\n\n${a?`Goal: ${a}`:""}\n\nIMPORTANT: Users see a visual GUI editor, not raw config. Describe features in user-friendly terms:\n- "text display" not "BRICK_TEXT"\n- "image" not "BRICK_IMAGE"\n- "canvas name" not "CANVAS_xxx"\n- "data storage" not "PROPERTY_BANK"\n- Focus on what users see and do, not technical implementation\n\nHow we'll proceed (no guessing, schema-first):\n1) Confirm intent\n - Restate objectives and success criteria in 1–3 bullets\n2) Consult docs (as needed)\n - getting-started, config-schema, components-index\n - Ensure proposed fields exist in the schema\n3) Ask missing questions before changes\n - Target device(s) and resolution(s)\n - Layout needs (pages/screens), content types, data sources\n - Localization, scheduling, or interaction needs\n4) Propose a minimal viable design (After confirming intent)\n - App structure: screens → visual elements\n - Initial component selection with rationale\n - Grid usage: default 96×54 (≈20px at 1920×1080)\n5) Produce a schema-valid skeleton (no side effects yet)\n - Include only fields defined by config-schema\n - Use clear placeholders for text/assets/URLs/ids\n\nWhat I'll produce first:\n- Short recap of requirements\n- Clarifying questions (only what's necessary)\n- High-level architecture plan\n- Minimal config skeleton that validates against the schema`}}]}});return function(t){return e.apply(this,arguments)}}()),function(e){e.resource("getting-started-docs","file://docs/getting-started.md",{mimeType:"text/markdown",title:"Getting Started with BRICKS",description:"Comprehensive guide to BRICKS architecture, concepts, and development workflow"},O(function*(){return Hd($d,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})}))}(r),Eh(r,i);var o=new Gd;try{yield r.connect(o),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${mh} v${yh}`),console.error(`Token Type: ${a.tokenType}`),console.error(`Permissions: ${a.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}}),Th.apply(this,arguments)}var Rh=new P("mcp").description("MCP server management");Rh.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action(function(){var e=O(function*(e){var t=(0,G.getCurrentProfile)(),a=e.token||(0,G.getToken)(t);a||(console.error(M.Ay.red("Error: No API token found.")),console.error(M.Ay.gray("Please login first with: bricks auth login <passcode>")),console.error(M.Ay.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{yield function(){return Th.apply(this,arguments)}({token:a})}catch(e){console.error(M.Ay.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}());var gh=new P("devtools").description("DevTools server discovery and connection");gh.command("scan").description("Scan LAN for DevTools servers via UDP + HTTP").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-j, --json","Output as JSON").option("--verify","Verify each discovered server via HTTP").option("--udp-only","Skip HTTP subnet probe (UDP only)").option("-p, --port <port>","Port for HTTP probe","19851").action(function(){var e=O(function*(e){var t=(yield Promise.resolve().then(c.bind(c,9790))).default,a=yield c.e(44).then(c.bind(c,2044)),n=a.discoverDevToolsServers,r=a.verifyDevToolsServer,i=a.httpProbeSubnet,o=yield Promise.resolve().then(c.bind(c,8765)),s=o.getCurrentProfile,p=o.getTokenInfo,l=parseInt(e.timeout,10),d=t(`Scanning for DevTools servers (${l}ms)...`).start();try{var u=n({timeout:l}),m=e.udpOnly?Promise.resolve([]):(d.text="Scanning via UDP + HTTP probe...",i({port:parseInt(e.port,10)})),f=yield Promise.all([u,m]),_=pe(f,2),h=_[0],E=_[1],y=[...h,...E],T=new Map;for(var R of y){var g=R.deviceId||`${R.address}:${R.port}`,v=T.get(g);if(v)for(var N of(v.addresses.includes(R.address)||v.addresses.push(R.address),"127.0.0.1"===v.address&&"127.0.0.1"!==R.address&&(v.address=R.address),R.protocols||[]))v.protocols?.includes(N)||v.protocols?.push(N);else T.set(g,{...R,addresses:[R.address]})}var b=[...T.values()];if(0===b.length)return void d.info("No DevTools servers found on the network.");if(e.verify){d.text=`Verifying ${b.length} server(s)...`;var A=yield Promise.all(b.map(function(){var e=O(function*(e){var t=yield r(e.address,e.port);return{...e,verified:!!t}});return function(t){return e.apply(this,arguments)}}()));b.splice(0,b.length,...A)}if(d.stop(),e.json)return void console.log(JSON.stringify(b,null,2));var S=p(s()),I=S?.workspaceId||null;console.log(M.Ay.bold(`\nFound ${b.length} DevTools server(s)`)),console.log("─".repeat(80));var w=function*(e){var t=!1===e.verified?M.Ay.red("unverified"):M.Ay.green("online"),a=e.hasPasscode?M.Ay.yellow("passcode"):M.Ay.gray("open"),n=(e.protocols||[]).map(e=>M.Ay.cyan(e)).join(", "),r=e.workspaceId&&I&&e.workspaceId===I,i=e.addresses||[e.address],o=i.filter(t=>t!==e.address),s=o.length>0?`${e.address}:${e.port} +${o.length} more`:`${e.address}:${e.port}`;console.log(` ${M.Ay.bold(e.name||"Unknown")} ${M.Ay.gray(`(${s})`)} [${t}]`),o.length>0&&console.log(` Addresses: ${i.map(e=>M.Ay.gray(e)).join(", ")}`);var p=` Protocols: ${n||M.Ay.gray("none")} Auth: ${a}`;if(e.deviceId&&(p+=` Device: ${M.Ay.gray(e.deviceId)}`),console.log(p),e.workspaceId){var l=r?M.Ay.green(`${e.workspaceId} (current profile)`):M.Ay.gray(e.workspaceId);console.log(` Workspace: ${l}`)}};for(var C of b)yield*w(C);console.log("─".repeat(80)),console.log(M.Ay.gray(`\nConnect via: devtools://devtools/bundled/js_app.html?ws=<address>:${b[0]?.port||19851}/ws?p=<passcode>`))}catch(e){d.fail(`Scan failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),gh.command("open <address>").description("Show connection URLs for a DevTools server").option("-p, --port <port>","Server port","19851").option("--verify","Verify server is reachable first").action(function(){var e=O(function*(e,t){var a=parseInt(t.port,10),n=`${e}:${a}`;if(t.verify){var r=(yield Promise.resolve().then(c.bind(c,9790))).default,i=(yield c.e(44).then(c.bind(c,2044))).verifyDevToolsServer,o=r(`Verifying ${n}...`).start(),s=yield i(e,a);s||(o.fail(`Could not reach DevTools server at ${n}`),process.exit(1)),o.succeed(`${s.name||"DevTools"} is reachable`),console.log()}console.log(M.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${M.Ay.cyan(`http://${n}`)}`),console.log(` CDP: ${M.Ay.cyan(`devtools://devtools/bundled/js_app.html?ws=${n}/ws?p=<passcode>`)}`),console.log(` MCP: ${M.Ay.cyan(`http://${n}/mcp`)}`),console.log(` MCP SSE: ${M.Ay.cyan(`http://${n}/sse`)}`),console.log(` Info: ${M.Ay.cyan(`http://${n}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(M.Ay.bold("Authorization")),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),console.log(` ${M.Ay.gray("Authorization: Bearer <passcode>")}`)});return function(t,a){return e.apply(this,arguments)}}());var vh=function(){var e=O(function*(){var e=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);if(-1!==e&&process.argv[e+1]&&((0,G.setProfileOverride)(process.argv[e+1]),process.argv.splice(e,2)),b.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.24.0-beta.12").enablePositionalOptions(),b.addCommand(U),b.addCommand(Z),b.addCommand(ie),b.addCommand(se),b.addCommand(ce),b.addCommand(_e),b.addCommand(Re),b.addCommand(Rh),b.addCommand(gh),b.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(O(function*(){try{(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),b.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action(function(){var e=O(function*(e){var t=yield Promise.resolve().then(c.bind(c,8765)),a=t.getToken,n=t.getBaseUrl,r=t.getCurrentProfile,i=(yield Promise.resolve().then(c.bind(c,700))).createClient,o=(yield Promise.resolve().then(c.bind(c,9790))).default,s=a(r());s||(console.error(M.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var p=o("Fetching workspace info...").start();try{var l=i(n(),s),d=yield l.workspace();if(p.stop(),e.json)return void console.log(JSON.stringify(d,null,2));console.log(M.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${M.Ay.green(d.name)}`),console.log(`ID: ${M.Ay.gray(d._id)}`),console.log(`Description: ${d.description||M.Ay.gray("N/A")}`),console.log(`\n${M.Ay.bold("Data")}`),console.log(`Remote Update: ${d.bank?.enable_remote_update?M.Ay.green("Enabled"):M.Ay.gray("Disabled")}`),console.log(`Spacename: ${d.bank?.spacename||M.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){p.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),b.on("--help",()=>{console.log(""),console.log(M.Ay.bold("Examples:")),console.log(""),console.log(M.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(M.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(M.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(M.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(M.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(M.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(M.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(M.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(M.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(M.Ay.cyan(" https://control.bricks.tools")),console.log(M.Ay.gray(" Go to Workspace Settings > API Token"))}),0===process.argv.slice(2).length)try{return void(0,(yield c.e(612).then(c.bind(c,9612))).runInteractiveMode)()}catch(e){console.error(M.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}yield b.parseAsync(process.argv)});return function(){return e.apply(this,arguments)}}();const Oh=vh;export{Oh as default,vh as run};
|