@fugood/bricks-cli 2.25.0-beta.14 → 2.25.0-beta.16
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/117.js +1 -1
- package/lib/index.js +91 -42
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -18,21 +18,24 @@ Expecting one of '${a.join("', '")}'`);let i=`${e}Help`;return this.on(i,e=>{let
|
|
|
18
18
|
(Did you mean ${i[0]}?)`:""}},57504(e,t,a){let i=a(7066),n=i?.WriteStream?.prototype?.hasColors?.()??!1,r=(e,t)=>{if(!n)return e=>e;let a=`\u001B[${e}m`,i=`\u001B[${t}m`;return e=>{let n=e+"",r=n.indexOf(i);if(-1===r)return a+n+i;let o=a,s=0,p=(22===t?i:"")+a;for(;-1!==r;)o+=n.slice(s,r)+p,s=r+i.length,r=n.indexOf(i,s);return o+(n.slice(s)+i)}},o={};o.reset=r(0,0),o.bold=r(1,22),o.dim=r(2,22),o.italic=r(3,23),o.underline=r(4,24),o.overline=r(53,55),o.inverse=r(7,27),o.hidden=r(8,28),o.strikethrough=r(9,29),o.black=r(30,39),o.red=r(31,39),o.green=r(32,39),o.yellow=r(33,39),o.blue=r(34,39),o.magenta=r(35,39),o.cyan=r(36,39),o.white=r(37,39),o.gray=r(90,39),o.bgBlack=r(40,49),o.bgRed=r(41,49),o.bgGreen=r(42,49),o.bgYellow=r(43,49),o.bgBlue=r(44,49),o.bgMagenta=r(45,49),o.bgCyan=r(46,49),o.bgWhite=r(47,49),o.bgGray=r(100,49),o.redBright=r(91,39),o.greenBright=r(92,39),o.yellowBright=r(93,39),o.blueBright=r(94,39),o.magentaBright=r(95,39),o.cyanBright=r(96,39),o.whiteBright=r(97,39),o.bgRedBright=r(101,49),o.bgGreenBright=r(102,49),o.bgYellowBright=r(103,49),o.bgBlueBright=r(104,49),o.bgMagentaBright=r(105,49),o.bgCyanBright=r(106,49),o.bgWhiteBright=r(107,49),e.exports=o},42495(e,t,a){a.d(t,{k:()=>h});var i=a(85608),n=a(60837),r=a(2904),o=a(555),s=a(3777),p=a(36054),l=a(30671),d=a(54019),u=a(44114),c=a(55427),m=a(70916),f=a(62959),h=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=(0,n.wrap)(r.ct,{max:o.v["cache.fragmentQueryDocuments"]||1e3,cache:d.l})}return e.prototype.lookupFragment=function(e){return null},e.prototype.batch=function(e){var t,a=this,i="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction(function(){return t=e.update(a)},i),t},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read((0,i.__assign)((0,i.__assign)({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.watchFragment=function(e){var t,a=this,n=e.fragment,r=e.fragmentName,o=e.from,d=e.optimistic,u=(0,i.__rest)(e,["fragment","fragmentName","from","optimistic"]),h=this.getFragmentDoc(n,r),v=void 0===o||"string"==typeof o?o:this.identify(o),g=!!e[Symbol.for("apollo.dataMasking")];if(!1!==globalThis.__DEV__){var y=r||(0,s.E4)(n).name.value;v||!1===globalThis.__DEV__||m.invariant.warn(1,y)}var D=(0,i.__assign)((0,i.__assign)({},u),{returnPartialData:!0,id:v,query:h,optimistic:void 0===d||d});return new p.c(function(o){return a.watch((0,i.__assign)((0,i.__assign)({},D),{immediate:!0,callback:function(s){var p=g?(0,f.z)(s.result,n,a,r):s.result;if(!(t&&(0,c.a)(h,{data:t.result},{data:p},e.variables))){var d={data:p,complete:!!s.complete};s.missing&&(d.missing=(0,l.IM)(s.missing.map(function(e){return e.missing}))),t=(0,i.__assign)((0,i.__assign)({},s),{result:p}),o.next(d)}}}))})},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read((0,i.__assign)((0,i.__assign)({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,a=e.data,n=(0,i.__rest)(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:a}))},e.prototype.writeFragment=function(e){var t=e.id,a=e.data,n=e.fragment,r=e.fragmentName,o=(0,i.__rest)(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,r),dataId:t,result:a}))},e.prototype.updateQuery=function(e,t){return this.batch({update:function(a){var n=a.readQuery(e),r=t(n);return null==r?n:(a.writeQuery((0,i.__assign)((0,i.__assign)({},e),{data:r})),r)}})},e.prototype.updateFragment=function(e,t){return this.batch({update:function(a){var n=a.readFragment(e),r=t(n);return null==r?n:(a.writeFragment((0,i.__assign)((0,i.__assign)({},e),{data:r})),r)}})},e}();!1!==globalThis.__DEV__&&(h.prototype.getMemoryInternals=u.tQ)},84673(e,t,a){var i;a.d(t,{l:()=>i}),i||(i={})},65702(e,t,a){a.d(t,{Z:()=>n});var i=a(85608),n=function(e){function t(a,i,n,r){var o,s=e.call(this,a)||this;if(s.message=a,s.path=i,s.query=n,s.variables=r,Array.isArray(s.path)){s.missing=s.message;for(var p=s.path.length-1;p>=0;--p)(o={})[s.path[p]]=s.missing,s.missing=o}else s.missing=s.path;return s.__proto__=t.prototype,s}return(0,i.__extends)(t,e),t}(Error)},94037(e,t,a){a.r(t),a.d(t,{fieldNameFromStoreName:()=>l.iJ,makeVar:()=>u.UT,canonicalStringify:()=>s.M,cacheSlot:()=>u.bl,isReference:()=>o.A_,MissingFieldError:()=>r.Z,EntityStore:()=>p.D_,Cache:()=>n.l,Policies:()=>c.l,InMemoryCache:()=>d.D,ApolloCache:()=>i.k,defaultDataIdFromObject:()=>l.or,makeReference:()=>o.WU,createFragmentRegistry:()=>D}),a(70916);var i=a(42495),n=a(84673),r=a(65702),o=a(28907),s=a(44214),p=a(83906),l=a(35207),d=a(7068),u=a(777),c=a(92610),m=a(85608),f=a(90424),h=a(60837),v=a(3777),g=a(555),y=a(54019);function D(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new(b.bind.apply(b,(0,m.__spreadArray)([void 0],e,!1)))}var b=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.registry=Object.create(null),this.resetCaches(),e.length&&this.register.apply(this,e)}return e.prototype.register=function(){for(var e=this,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];var i=new Map;return t.forEach(function(e){(0,v.zK)(e).forEach(function(e){i.set(e.name.value,e)})}),i.forEach(function(t,a){t!==e.registry[a]&&(e.registry[a]=t,e.invalidate(a))}),this},e.prototype.invalidate=function(e){},e.prototype.resetCaches=function(){var t=e.prototype;this.invalidate=(this.lookup=(0,h.wrap)(t.lookup.bind(this),{makeCacheKey:function(e){return e},max:g.v["fragmentRegistry.lookup"]||1e3})).dirty,this.transform=(0,h.wrap)(t.transform.bind(this),{cache:y.l,max:g.v["fragmentRegistry.transform"]||2e3}),this.findFragmentSpreads=(0,h.wrap)(t.findFragmentSpreads.bind(this),{cache:y.l,max:g.v["fragmentRegistry.findFragmentSpreads"]||4e3})},e.prototype.lookup=function(e){return this.registry[e]||null},e.prototype.transform=function(e){var t=this,a=new Map;(0,v.zK)(e).forEach(function(e){a.set(e.name.value,e)});var i=new Set,n=function(e){a.has(e)||i.add(e)},r=function(e){return Object.keys(t.findFragmentSpreads(e)).forEach(n)};r(e);var o=[],s=Object.create(null);if(i.forEach(function(e){var i=a.get(e);if(i)r(s[e]=i);else{o.push(e);var n=t.lookup(e);n&&r(s[e]=n)}}),o.length){var p=[];o.forEach(function(e){var t=s[e];t&&p.push(t)}),p.length&&(e=(0,m.__assign)((0,m.__assign)({},e),{definitions:e.definitions.concat(p)}))}return e},e.prototype.findFragmentSpreads=function(e){var t=Object.create(null);return(0,f.YR)(e,{FragmentSpread:function(e){t[e.name.value]=e}}),t},e}()},83906(e,t,a){a.d(t,{$7:()=>F,D_:()=>D,M2:()=>x});var i,n,r=a(85608),o=a(70916),s=a(60837),p=a(55888),l=a(44592),d=a(57236),u=a(28907),c=a(30671),m=a(21777),f=a(51360),h=a(35207),v=Object.create(null),g=function(){return v},y=Object.create(null),D=function(){function e(e,t){var a=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return(0,d.G)((0,u.A_)(e)?a.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return(0,u.A_)(e)?a.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return(0,u.WU)(e);if((0,u.A_)(e))return e;var i=a.policies.identify(e)[0];if(i){var n=(0,u.WU)(i);return t&&a.merge(i,e),n}}}return e.prototype.toObject=function(){return(0,r.__assign)({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),h.$3.call(this.data,e)){var a=this.data[e];if(a&&h.$3.call(a,t))return a[t]}return"__typename"===t&&h.$3.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof _?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return(t&&this.group.depend(e,"__exists"),h.$3.call(this.data,e))?this.data[e]:this instanceof _?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var a,i=this;(0,u.A_)(e)&&(e=e.__ref),(0,u.A_)(t)&&(t=t.__ref);var n="string"==typeof e?this.lookup(a=e):e,r="string"==typeof t?this.lookup(a=t):t;if(r){(0,o.invariant)("string"==typeof a,2);var s=new c.ZI(E).merge(n,r);if(this.data[a]=s,s!==n&&(delete this.refs[a],this.group.caching)){var p=Object.create(null);n||(p.__exists=1),Object.keys(r).forEach(function(e){if(!n||n[e]!==s[e]){p[e]=1;var t=(0,h.iJ)(e);t===e||i.policies.hasKeyArgs(s.__typename,t)||(p[t]=1),void 0!==s[e]||i instanceof _||delete s[e]}}),p.__typename&&!(n&&n.__typename)&&this.policies.rootTypenamesById[a]===s.__typename&&delete p.__typename,Object.keys(p).forEach(function(e){return i.group.dirty(a,e)})}}},e.prototype.modify=function(e,t){var a=this,i=this.lookup(e);if(i){var n=Object.create(null),s=!1,p=!0,l={DELETE:v,INVALIDATE:y,isReference:u.A_,toReference:this.toReference,canRead:this.canRead,readField:function(t,i){return a.policies.readField("string"==typeof t?{fieldName:t,from:i||(0,u.WU)(e)}:t,{store:a})}};if(Object.keys(i).forEach(function(c){var m=(0,h.iJ)(c),f=i[c];if(void 0!==f){var D="function"==typeof t?t:t[c]||t[m];if(D){var b=D===g?v:D((0,d.G)(f),(0,r.__assign)((0,r.__assign)({},l),{fieldName:m,storeFieldName:c,storage:a.getStorage(e,c)}));if(b===y)a.group.dirty(e,c);else if(b===v&&(b=void 0),b!==f&&(n[c]=b,s=!0,f=b,!1!==globalThis.__DEV__)){var x=function(e){if(void 0===a.lookup(e.__ref))return!1!==globalThis.__DEV__&&o.invariant.warn(3,e),!0};if((0,u.A_)(b))x(b);else if(Array.isArray(b))for(var _=!1,w=void 0,E=0,F=b;E<F.length;E++){var C=F[E];if((0,u.A_)(C)){if(_=!0,x(C))break}else"object"==typeof C&&C&&a.policies.identify(C)[0]&&(w=C);if(_&&void 0!==w){!1!==globalThis.__DEV__&&o.invariant.warn(4,w);break}}}}void 0!==f&&(p=!1)}}),s)return this.merge(e,n),p&&(this instanceof _?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,a){var i,n=this.lookup(e);if(n){var r=this.getFieldValue(n,"__typename"),o=t&&a?this.policies.getStoreFieldName({typename:r,fieldName:t,args:a}):t;return this.modify(e,o?((i={})[o]=g,i):g)}return!1},e.prototype.evict=function(e,t){var a=!1;return e.id&&(h.$3.call(this.data,e.id)&&(a=this.delete(e.id,e.fieldName,e.args)),this instanceof _&&this!==t&&(a=this.parent.evict(e,t)||a),(e.fieldName||a)&&this.group.dirty(e.id,e.fieldName||"__exists")),a},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),a=[];return this.getRootIdSet().forEach(function(t){h.$3.call(e.policies.rootTypenamesById,t)||a.push(t)}),a.length&&(t.__META={extraRootIds:a.sort()}),t},e.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&h.$3.call(e,a)||t.delete(a)}),e){var a=e.__META,i=(0,r.__rest)(e,["__META"]);Object.keys(i).forEach(function(e){t.merge(e,i[e])}),a&&a.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof _?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),a=this.toObject();t.forEach(function(i){h.$3.call(a,i)&&(Object.keys(e.findChildRefIds(i)).forEach(t.add,t),delete a[i])});var i=Object.keys(a);if(i.length){for(var n=this;n instanceof _;)n=n.parent;i.forEach(function(e){return n.delete(e)})}return i},e.prototype.findChildRefIds=function(e){if(!h.$3.call(this.refs,e)){var t=this.refs[e]=Object.create(null),a=this.data[e];if(!a)return t;var i=new Set([a]);i.forEach(function(e){(0,u.A_)(e)&&(t[e.__ref]=!0),(0,m.U)(e)&&Object.keys(e).forEach(function(t){var a=e[t];(0,m.U)(a)&&i.add(a)})})}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),b=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?(0,s.dep)():null,this.keyMaker=new l.Trie(f.et)},e.prototype.depend=function(e,t){if(this.d){this.d(t+"#"+e);var a=(0,h.iJ)(t);a!==t&&this.d(a+"#"+e),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(t+"#"+e,"__exists"===t?"forget":"setDirty")},e}();function x(e,t){F(e)&&e.group.depend(t,"__exists")}n=function(e){function t(t){var a=t.policies,i=t.resultCaching,n=t.seed,r=e.call(this,a,new b(void 0===i||i))||this;return r.stump=new w(r),r.storageTrie=new l.Trie(f.et),n&&r.replace(n),r}return(0,r.__extends)(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(i=D||(D={})),i.Root=n;var _=function(e){function t(t,a,i,n){var r=e.call(this,a.policies,n)||this;return r.id=t,r.parent=a,r.replay=i,r.group=n,i(r),r}return(0,r.__extends)(t,e),t.prototype.addLayer=function(e,a){return new t(e,this,a,this.group)},t.prototype.removeLayer=function(e){var t=this,a=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(e){var i=t.data[e],n=a.lookup(e);n?i?i!==n&&Object.keys(i).forEach(function(a){(0,p.equal)(i[a],n[a])||t.group.dirty(e,a)}):(t.group.dirty(e,"__exists"),Object.keys(n).forEach(function(a){t.group.dirty(e,a)})):t.delete(e)}),a):a===this.parent?this:a.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return(0,r.__assign)((0,r.__assign)({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var a=this.parent.findChildRefIds(t);return h.$3.call(this.data,t)?(0,r.__assign)((0,r.__assign)({},a),e.prototype.findChildRefIds.call(this,t)):a},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(D),w=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,function(){},new b(t.group.caching,t.group))||this}return(0,r.__extends)(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(_);function E(e,t,a){var i=e[a],n=t[a];return(0,p.equal)(i,n)?i:n}function F(e){return!!(e instanceof D&&e.group.caching)}},35207(e,t,a){a.d(t,{$3:()=>u,I6:()=>h,T9:()=>function e(t,a,i){return!!(0,r.U)(a)&&((0,o.c)(a)?a.every(function(a){return e(t,a,i)}):t.selections.every(function(t){if((0,n.dt)(t)&&(0,s.MS)(t,i)){var r=(0,n.ue)(t);return u.call(a,r)&&(!t.selectionSet||e(t.selectionSet,a[r],i))}return!0}))},Ui:()=>g,Xx:()=>v,d1:()=>b,gk:()=>y,iJ:()=>D,lq:()=>_,mv:()=>x,or:()=>m});var i=a(50492),n=a(28907),r=a(21777),o=a(73767),s=a(82307),p=a(30671),l=a(2904),d=a(3777),u=Object.prototype.hasOwnProperty;function c(e){return null==e}function m(e,t){var a=e.__typename,i=e.id,n=e._id;if("string"==typeof a&&(t&&(t.keyObject=c(i)?c(n)?void 0:{_id:n}:{id:i}),c(i)&&!c(n)&&(i=n),!c(i)))return"".concat(a,":").concat("number"==typeof i||"string"==typeof i?i:JSON.stringify(i))}var f={dataIdFromObject:m,addTypename:!0,resultCaching:!0,canonizeResults:!1};function h(e){return(0,i.o)(f,e)}function v(e){var t=e.canonizeResults;return void 0===t?f.canonizeResults:t}function g(e,t){return(0,n.A_)(t)?e.get(t.__ref,"__typename"):t&&t.__typename}var y=/^[_a-z][_0-9a-z]*/i;function D(e){var t=e.match(y);return t?t[0]:e}function b(e){return(0,r.U)(e)&&!(0,n.A_)(e)&&!(0,o.c)(e)}function x(){return new p.ZI}function _(e,t){var a=(0,l.JG)((0,d.zK)(e));return{fragmentMap:a,lookupFragment:function(e){var i=a[e];return!i&&t&&(i=t.lookup(e)),i||null}}}},7068(e,t,a){a.d(t,{D:()=>U});var i=a(85608),n=a(70916),r=a(60837),o=a(55888),s=a(42495),p=a(65702),l=a(9354),d=a(53925),u=a(555),c=a(44214),m=a(38678),f=a(28907),h=a(42455),v=a(51360),g=a(50492),y=a(3777),D=a(30671),b=a(82307),x=a(2904),_=a(57236),w=a(21777),E=a(83906),F=a(35207),C=a(73767),T=a(44592),A=function(){function e(){this.known=new(v.En?WeakSet:Set),this.pool=new T.Trie(v.et),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return(0,w.U)(e)&&this.known.has(e)},e.prototype.pass=function(e){if((0,w.U)(e)){var t=(0,w.U)(e)?(0,C.c)(e)?e.slice(0):(0,i.__assign)({__proto__:Object.getPrototypeOf(e)},e):e;return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if((0,w.U)(e)){var a=this.passes.get(e);if(a)return a;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))break;var i=e.map(this.admit,this),n=this.pool.lookupArray(i);return n.array||(this.known.add(n.array=i),!1!==globalThis.__DEV__&&Object.freeze(i)),n.array;case null:case Object.prototype:if(this.known.has(e))break;var r=Object.getPrototypeOf(e),o=[r],s=this.sortedKeys(e);o.push(s.json);var p=o.length;s.sorted.forEach(function(a){o.push(t.admit(e[a]))});var n=this.pool.lookupArray(o);if(!n.object){var l=n.object=Object.create(r);this.known.add(l),s.sorted.forEach(function(e,t){l[e]=o[p+t]}),!1!==globalThis.__DEV__&&Object.freeze(l)}return n.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),a=this.pool.lookupArray(t);if(!a.keys){t.sort();var i=JSON.stringify(t);(a.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,a.keys={sorted:t,json:i})}return a.keys},e}();function S(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var O=function(){function e(e){var t=this;this.knownResults=new(v.et?WeakMap:Map),this.config=(0,g.o)(e,{addTypename:!1!==e.addTypename,canonizeResults:(0,F.Xx)(e)}),this.canon=e.canon||new A,this.executeSelectionSet=(0,r.wrap)(function(e){var a,n=e.context.canonizeResults,r=S(e);r[3]=!n;var o=(a=t.executeSelectionSet).peek.apply(a,r);return o?n?(0,i.__assign)((0,i.__assign)({},o),{result:t.canon.admit(o.result)}):o:((0,E.M2)(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))},{max:this.config.resultCacheMaxSize||u.v["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:S,makeCacheKey:function(e,t,a,i){if((0,E.$7)(a.store))return a.store.makeCacheKey(e,(0,f.A_)(t)?t.__ref:t,a.varString,i)}}),this.executeSubSelectedArray=(0,r.wrap)(function(e){return(0,E.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,i=e.context;if((0,E.$7)(i.store))return i.store.makeCacheKey(t,a,i.varString)}})}return e.prototype.resetCanon=function(){this.canon=new A},e.prototype.diffQueryAgainstStore=function(e){var t,a=e.store,n=e.query,r=e.rootId,o=e.variables,s=e.returnPartialData,l=e.canonizeResults,d=void 0===l?this.config.canonizeResults:l,u=this.config.cache.policies;o=(0,i.__assign)((0,i.__assign)({},(0,y.wY)((0,y.AT)(n))),o);var m=(0,f.WU)(void 0===r?"ROOT_QUERY":r),h=this.executeSelectionSet({selectionSet:(0,y.Vn)(n).selectionSet,objectOrReference:m,enclosingRef:m,context:(0,i.__assign)({store:a,query:n,policies:u,variables:o,varString:(0,c.M)(o),canonizeResults:d},(0,F.lq)(n,this.config.fragments))});if(h.missing&&(t=[new p.Z(function(e){try{JSON.stringify(e,function(e,t){if("string"==typeof t)throw t;return t})}catch(e){return e}}(h.missing),h.missing,n,o)],!(void 0===s||s)))throw t[0];return{result:h.result,complete:!t,missing:t}},e.prototype.isFresh=function(e,t,a,i){if((0,E.$7)(i.store)&&this.knownResults.get(e)===a){var n=this.executeSelectionSet.peek(a,t,i,this.canon.isKnown(e));if(n&&e===n.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t,a=this,i=e.selectionSet,r=e.objectOrReference,o=e.enclosingRef,s=e.context;if((0,f.A_)(r)&&!s.policies.rootTypenamesById[r.__ref]&&!s.store.has(r.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(r.__ref," object")};var p=s.variables,l=s.policies,u=s.store.getFieldValue(r,"__typename"),c=[],m=new D.ZI;function v(e,a){var i;return e.missing&&(t=m.merge(t,((i={})[a]=e.missing,i))),e.result}this.config.addTypename&&"string"==typeof u&&!l.rootIdsByTypename[u]&&c.push({__typename:u});var g=new Set(i.selections);g.forEach(function(e){var i,y;if((0,b.MS)(e,p))if((0,f.dt)(e)){var D=l.readField({fieldName:e.name.value,field:e,variables:s.variables,from:r},s),_=(0,f.ue)(e);void 0===D?d.XY.added(e)||(t=m.merge(t,((i={})[_]="Can't find field '".concat(e.name.value,"' on ").concat((0,f.A_)(r)?r.__ref+" object":"object "+JSON.stringify(r,null,2)),i))):(0,C.c)(D)?D.length>0&&(D=v(a.executeSubSelectedArray({field:e,array:D,enclosingRef:o,context:s}),_)):e.selectionSet?null!=D&&(D=v(a.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:D,enclosingRef:(0,f.A_)(D)?D:o,context:s}),_)):s.canonizeResults&&(D=a.canon.pass(D)),void 0!==D&&c.push(((y={})[_]=D,y))}else{var w=(0,x.HQ)(e,s.lookupFragment);if(!w&&e.kind===h.b.FRAGMENT_SPREAD)throw(0,n.newInvariantError)(10,e.name.value);w&&l.fragmentMatches(w,u)&&w.selectionSet.selections.forEach(g.add,g)}});var y={result:(0,D.IM)(c),missing:t},w=s.canonizeResults?this.canon.admit(y):(0,_.G)(y);return w.result&&this.knownResults.set(w.result,i),w},e.prototype.execSubSelectedArrayImpl=function(e){var t,a=this,i=e.field,r=e.array,o=e.enclosingRef,s=e.context,p=new D.ZI;function l(e,a){var i;return e.missing&&(t=p.merge(t,((i={})[a]=e.missing,i))),e.result}return i.selectionSet&&(r=r.filter(s.store.canRead)),r=r.map(function(e,t){return null===e?null:(0,C.c)(e)?l(a.executeSubSelectedArray({field:i,array:e,enclosingRef:o,context:s}),t):i.selectionSet?l(a.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:e,enclosingRef:(0,f.A_)(e)?e:o,context:s}),t):(!1!==globalThis.__DEV__&&function(e,t,a){if(!t.selectionSet){var i=new Set([a]);i.forEach(function(a){(0,w.U)(a)&&((0,n.invariant)(!(0,f.A_)(a),11,(0,F.Ui)(e,a),t.name.value),Object.values(a).forEach(i.add,i))})}}(s.store,i,e),e)}),{result:s.canonizeResults?this.canon.admit(r):r,missing:t}},e}(),N=a(20906),k=a(92610);function I(e,t,a){var n="".concat(t).concat(a),r=e.flavors.get(n);return r||e.flavors.set(n,r=e.clientOnly===t&&e.deferred===a?e:(0,i.__assign)((0,i.__assign)({},e),{clientOnly:t,deferred:a})),r}var $=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,r=t.query,s=t.result,p=t.dataId,l=t.variables,d=t.overwrite,u=(0,y.Vu)(r),m=(0,F.mv)();l=(0,i.__assign)((0,i.__assign)({},(0,y.wY)(u)),l);var h=(0,i.__assign)((0,i.__assign)({store:e,written:Object.create(null),merge:function(e,t){return m.merge(e,t)},variables:l,varString:(0,c.M)(l)},(0,F.lq)(r,this.fragments)),{overwrite:!!d,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),v=this.processSelectionSet({result:s||Object.create(null),dataId:p,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:h});if(!(0,f.A_)(v))throw(0,n.newInvariantError)(12,s);return h.incomingById.forEach(function(t,r){var s=t.storeObject,p=t.mergeTree,l=t.fieldNodeSet,d=(0,f.WU)(r);if(p&&p.map.size){var u=a.applyMerges(p,d,s,h);if((0,f.A_)(u))return;s=u}if(!1!==globalThis.__DEV__&&!h.overwrite){var c=Object.create(null);l.forEach(function(e){e.selectionSet&&(c[e.name.value]=!0)});var m=function(e){var t=p&&p.map.get(e);return!!(t&&t.info&&t.info.merge)};Object.keys(s).forEach(function(e){!0!==c[(0,F.iJ)(e)]||m(e)||function(e,t,a,r){var s=function(e){var t=r.getFieldValue(e,a);return"object"==typeof t&&t},p=s(e);if(p){var l=s(t);if(!(!l||(0,f.A_)(p)||(0,o.equal)(p,l)||Object.keys(p).every(function(e){return void 0!==r.getFieldValue(l,e)}))){var d=r.getFieldValue(e,"__typename")||r.getFieldValue(t,"__typename"),u=(0,F.iJ)(a),c="".concat(d,".").concat(u);if(!P.has(c)){P.add(c);var m=[];(0,C.c)(p)||(0,C.c)(l)||[p,l].forEach(function(e){var t=r.getFieldValue(e,"__typename");"string"!=typeof t||m.includes(t)||m.push(t)}),!1!==globalThis.__DEV__&&n.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,i.__assign)({},p),(0,i.__assign)({},l))}}}}(d,s,e,h.store)})}e.merge(r,s)}),e.retain(v.__ref),v},e.prototype.processSelectionSet=function(e){var t=this,a=e.dataId,r=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$)(r,o,s.fragmentMap)||a&&s.store.get(a,"__typename");"string"==typeof c&&(u.__typename=c);var m=function(){var e=(0,k.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,i.__assign)((0,i.__assign)({},e),{from:t.storeObject}),s);if(void 0!==a)return a}}return l.readField(e,s)},h=new Set;this.flattenFields(o,r,s,c).forEach(function(e,a){var i,o=r[(0,f.ue)(a)];if(h.add(a),void 0!==o){var s=l.getStoreFieldName({typename:c,fieldName:a.name.value,field:a,variables:e.variables}),v=B(p,s),g=t.processFieldValue(o,a,a.selectionSet?I(e,!1,!1):e,v),y=void 0;a.selectionSet&&((0,f.A_)(g)||(0,F.d1)(g))&&(y=m("__typename",g));var D=l.getMergeFunction(c,a.name.value,y);D?v.info={field:a,typename:c,merge:D}:V(p,s),u=e.merge(u,((i={})[s]=g,i))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||d.XY.added(a)||l.getReadFunction(c,a.name.value)||!1===globalThis.__DEV__||n.invariant.error(13,(0,f.ue)(a),r)});try{var v=l.identify(r,{typename:c,selectionSet:o,fragmentMap:s.fragmentMap,storeObject:u,readField:m}),g=v[0],y=v[1];a=a||g,y&&(u=s.merge(u,y))}catch(e){if(!a)throw e}if("string"==typeof a){var D=(0,f.WU)(a),b=s.written[a]||(s.written[a]=[]);if(b.indexOf(o)>=0||(b.push(o),this.reader&&this.reader.isFresh(r,D,o,s)))return D;var x=s.incomingById.get(a);return x?(x.storeObject=s.merge(x.storeObject,u),x.mergeTree=function e(t,a){if(t===a||!a||R(a))return t;if(!t||R(t))return a;var n=t.info&&a.info?(0,i.__assign)((0,i.__assign)({},t.info),a.info):t.info||a.info,r=t.map.size&&a.map.size,o={info:n,map:r?new Map:t.map.size?t.map:a.map};if(r){var s=new Set(a.map.keys());t.map.forEach(function(t,i){o.map.set(i,e(t,a.map.get(i))),s.delete(i)}),s.forEach(function(i){o.map.set(i,e(a.map.get(i),t.map.get(i)))})}return o}(x.mergeTree,p),h.forEach(function(e){return x.fieldNodeSet.add(e)})):s.incomingById.set(a,{storeObject:u,mergeTree:R(p)?void 0:p,fieldNodeSet:h}),D}return u},e.prototype.processFieldValue=function(e,t,a,i){var n=this;return t.selectionSet&&null!==e?(0,C.c)(e)?e.map(function(e,r){var o=n.processFieldValue(e,t,a,B(i,r));return V(i,r),o}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:a,mergeTree:i}):!1!==globalThis.__DEV__?(0,N.m)(e):e},e.prototype.flattenFields=function(e,t,a,i){void 0===i&&(i=(0,f.D$)(t,e,a.fragmentMap));var r=new Map,o=this.cache.policies,s=new T.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,b.MS)(s,a.variables)){var p=l.clientOnly,d=l.deferred;if(!(p&&d)&&(0,C.E)(s.directives)&&s.directives.forEach(function(e){var t=e.name.value;if("client"===t&&(p=!0),"defer"===t){var i=(0,f.MB)(e,a.variables);i&&!1===i.if||(d=!0)}}),(0,f.dt)(s)){var u=r.get(s);u&&(p=p&&u.clientOnly,d=d&&u.deferred),r.set(s,I(a,p,d))}else{var c=(0,x.HQ)(s,a.lookupFragment);if(!c&&s.kind===h.b.FRAGMENT_SPREAD)throw(0,n.newInvariantError)(14,s.name.value);c&&o.fragmentMatches(c,i,t,a.variables)&&e(c.selectionSet,I(a,p,d))}}}))}(e,a),r},e.prototype.applyMerges=function(e,t,a,r,o){var s=this;if(e.map.size&&!(0,f.A_)(a)){var p,l,d=!(0,C.c)(a)&&((0,f.A_)(t)||(0,F.d1)(t))?t:void 0,u=a;d&&!o&&(o=[(0,f.A_)(d)?d.__ref:d]);var c=function(e,t){return(0,C.c)(e)?"number"==typeof t?e[t]:void 0:r.store.getFieldValue(e,String(t))};e.map.forEach(function(e,t){var a=c(d,t),i=c(u,t);if(void 0!==i){o&&o.push(t);var p=s.applyMerges(e,a,i,r,o);p!==i&&(l=l||new Map).set(t,p),o&&(0,n.invariant)(o.pop()===t)}}),l&&(a=(0,C.c)(u)?u.slice(0):(0,i.__assign)({},u),l.forEach(function(e,t){a[t]=e}))}return e.info?this.cache.policies.runMergeFunction(t,a,e.info,r,o&&(p=r.store).getStorage.apply(p,o)):a},e}(),j=[];function B(e,t){var a=e.map;return a.has(t)||a.set(t,j.pop()||{map:new Map}),a.get(t)}function R(e){return!e||!(e.info||e.map.size)}function V(e,t){var a=e.map,i=a.get(t);i&&R(i)&&(j.push(i),a.delete(t))}var P=new Set,L=a(777),M=a(44114),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=L.UT,a.txCount=0,a.config=(0,F.I6)(t),a.addTypename=!!a.config.addTypename,a.policies=new k.l({cache:a,dataIdFromObject:a.config.dataIdFromObject,possibleTypes:a.config.possibleTypes,typePolicies:a.config.typePolicies}),a.init(),a}return(0,i.__extends)(t,e),t.prototype.init=function(){var e=this.data=new E.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,i=this.config.fragments;this.storeWriter=new $(this,this.storeReader=new O({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:(0,F.Xx)(this.config),canon:e?void 0:a&&a.canon,fragments:i}),i),this.maybeBroadcastWatch=(0,r.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,E.$7)(a)){var i=e.optimistic,n=e.id,r=e.variables;return a.makeCacheKey(e.query,e.callback,(0,c.M)({optimistic:i,id:n,variables:r}))}}}),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;try{return this.storeReader.diffQueryAgainstStore((0,i.__assign)((0,i.__assign)({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:void 0!==t&&t})).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(F.$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,i.__assign)((0,i.__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,L.MS)(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&(0,L.WR)(t),t.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){c.M.reset(),m.y.reset(),this.addTypenameTransform.resetCache(),null==(t=this.config.fragments)||t.resetCaches();var t,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__&&n.invariant.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(F.$3.call(e,"id"))return!1;e=(0,i.__assign)((0,i.__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,L.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,n=e.update,r=e.optimistic,o=void 0===r||r,s=e.removeOptimistic,p=e.onWatchUpdated,l=function(e){var i=a.data,r=a.optimisticData;++a.txCount,e&&(a.data=a.optimisticData=e);try{return t=n(a)}finally{--a.txCount,a.data=i,a.optimisticData=r}},d=new Set;return p&&!this.txCount&&this.broadcastWatches((0,i.__assign)((0,i.__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,i.__assign)((0,i.__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.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,i=this.diff(e);(!t||(e.optimistic&&"string"==typeof t.optimistic&&(i.fromOptimisticTransaction=!0),!t.onWatchUpdated||!1!==t.onWatchUpdated.call(this,e,i,a)))&&(a&&(0,o.equal)(a.result,i.result)||e.callback(e.lastDiff=i,a))},t}(s.k);!1!==globalThis.__DEV__&&(U.prototype.getMemoryInternals=M.cM)},92610(e,t,a){a.d(t,{l:()=>F,m:()=>T});var i=a(85608),n=a(70916),r=a(28907),o=a(86563),s=a(21777),p=a(35207),l=a(73767),d=a(777),u=a(30671),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 i=function(e,t){return a.readField(t,e)},r=a.keyObject=v(e,function(e){var r=y(a.storeObject,e,i);return void 0===r&&t!==a.storeObject&&p.$3.call(t,e[0])&&(r=y(t,e,g)),(0,n.invariant)(void 0!==r,5,e.join("."),t),r});return"".concat(a.typename,":").concat(JSON.stringify(r))})}function h(e){var t=m(e);return t.keyArgsFn||(t.keyArgsFn=function(t,a){var i=a.field,n=a.variables,o=a.fieldName,s=JSON.stringify(v(e,function(e){var a=e[0],o=a.charAt(0);if("@"===o){if(i&&(0,l.E)(i.directives)){var s=a.slice(1),d=i.directives.find(function(e){return e.name.value===s}),u=d&&(0,r.MB)(d,n);return u&&y(u,e.slice(1))}return}if("$"===o){var c=a.slice(1);if(n&&p.$3.call(n,c)){var m=e.slice(0);return m[0]=c,y(n,m)}return}if(t)return y(t,e)}));return(t||"{}"!==s)&&(o+=":"+s),o})}function v(e,t){var a=new u.ZI;return(function e(t){var a=m(t);if(!a.paths){var i=a.paths=[],n=[];t.forEach(function(a,r){(0,l.c)(a)?(e(a).forEach(function(e){return i.push(n.concat(e))}),n.length=0):(n.push(a),(0,l.c)(t[r+1])||(i.push(n.slice(0)),n.length=0))})}return a.paths})(e).reduce(function(e,i){var n,r=t(i);if(void 0!==r){for(var o=i.length-1;o>=0;--o)(n={})[i[o]]=r,r=n;e=a.merge(e,r)}return e},Object.create(null))}function g(e,t){return e[t]}function y(e,t,a){return a=a||g,function e(t){return(0,s.U)(t)?(0,l.c)(t)?t.map(e):v(Object.keys(t).sort(),function(e){return y(t,e)}):t}(t.reduce(function e(t,i){return(0,l.c)(t)?t.map(function(t){return e(t,i)}):t&&a(t,i)},e))}var D=a(47150);function b(e){return void 0!==e.args?e.args:e.field?(0,r.MB)(e.field,e.variables):null}var x=function(){},_=function(e,t){return t.fieldName},w=function(e,t,a){return(0,a.mergeObjects)(e,t)},E=function(e,t){return t},F=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,i.__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,n,r=this,o=t&&(t.typename||(null==(a=t.storeObject)?void 0:a.__typename))||e.__typename;if(o===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var s=t&&t.storeObject||e,p=(0,i.__assign)((0,i.__assign)({},t),{typename:o,storeObject:s,readField:t&&t.readField||function(){var e=T(arguments,s);return r.readField(e,{store:r.cache.data,variables:e.variables})}}),d=o&&this.getTypePolicy(o),u=d&&d.keyFn||this.config.dataIdFromObject;return D.yV.withValue(!0,function(){for(;u;){var t=u((0,i.__assign)((0,i.__assign)({},e),s),p);if((0,l.c)(t))u=f(t);else{n=t;break}}}),n=n?String(n):void 0,p.keyObject?[n,p.keyObject]:[n]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(a){var n=e[a],r=n.queryType,o=n.mutationType,s=n.subscriptionType,l=(0,i.__rest)(n,["queryType","mutationType","subscriptionType"]);r&&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,i=this.getTypePolicy(e),n=t.keyFields,r=t.fields;function o(e,t){e.merge="function"==typeof t?t:!0===t?w:!1===t?E:e.merge}o(i,t.merge),i.keyFn=!1===n?x:(0,l.c)(n)?f(n):"function"==typeof n?n:i.keyFn,r&&Object.keys(r).forEach(function(t){var i=a.getFieldPolicy(e,t,!0),n=r[t];if("function"==typeof n)i.read=n;else{var s=n.keyArgs,p=n.read,d=n.merge;i.keyFn=!1===s?_:(0,l.c)(s)?h(s):"function"==typeof s?s:i.keyFn,"function"==typeof p&&(i.read=p),o(i,d)}i.read&&i.merge&&(i.keyFn=i.keyFn||_)})},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var a="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[a];t!==i&&((0,n.invariant)(!i||i===e,6,e),i&&delete this.rootIdsByTypename[i],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 i=e.match(p.gk);i&&i[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 n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(a,i){if(a.test(e)){var r=t.supertypeMap.get(i);r&&r.forEach(function(e){return n.add(e)})}})),n&&n.size&&n.forEach(function(e){var n=t.getTypePolicy(e),r=n.fields;Object.assign(a,(0,i.__rest)(n,["fields"])),Object.assign(a.fields,r)})}var r=this.toBeAdded[e];return r&&r.length&&r.splice(0).forEach(function(a){t.updateTypePolicy(e,a)}),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,a){if(e){var i=this.getTypePolicy(e).fields;return i[t]||a&&(i[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,i){var r=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=r.getSupertypeSet(e,!1);t&&t.size&&0>l.indexOf(t)&&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__&&n.invariant.warn(7,t,o),s.add(o)),!0;f.forEach(d),u&&m===l.length-1&&(0,p.T9)(e.selectionSet,a,i)&&(u=!1,c=!0,this.fuzzySubtypes.forEach(function(e,a){var i=t.match(e);i&&i[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,i=e.fieldName,n=this.getFieldPolicy(a,i,!1),o=n&&n.keyFn;if(o&&a)for(var s={typename:a,fieldName:i,field:e.field||null,variables:e.variables},d=b(e);o;){var u=o(d,s);if((0,l.c)(u))o=h(u);else{t=u||i;break}}return(void 0===t&&(t=e.field?(0,r.Ii)(e.field,e.variables):(0,r.o5)(i,b(e))),!1===t)?i:i===(0,p.iJ)(t)?t:i+":"+t},e.prototype.readField=function(e,t){var a=e.from;if(a&&(e.field||e.fieldName)){if(void 0===e.typename){var i=t.store.getFieldValue(a,"__typename");i&&(e.typename=i)}var n=this.getStoreFieldName(e),o=(0,p.iJ)(n),s=t.store.getFieldValue(a,n),l=this.getFieldPolicy(e.typename,o,!1),u=l&&l.read;if(u){var c=C(this,a,e,t,t.store.getStorage((0,r.A_)(a)?a.__ref:a,n));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 i=this.getFieldPolicy(e,t,!1),n=i&&i.merge;return!n&&a&&(n=(i=this.getTypePolicy(a))&&i.merge),n},e.prototype.runMergeFunction=function(e,t,a,i,n){var r=a.field,o=a.typename,s=a.merge;return s===w?A(i.store)(e,t):s===E?t:(i.overwrite&&(e=void 0),s(e,t,C(this,void 0,{typename:o,fieldName:r.name.value,field:r,variables:i.variables},i,n||Object.create(null))))},e}();function C(e,t,a,i,n){var o=e.getStoreFieldName(a),s=(0,p.iJ)(o),l=a.variables||i.variables,d=i.store,u=d.toReference,c=d.canRead;return{args:b(a),field:a.field||null,fieldName:s,storeFieldName:o,variables:l,isReference:r.A_,toReference:u,storage:n,cache:e.cache,canRead:c,readField:function(){return e.readField(T(arguments,t,l),i)},mergeObjects:A(i.store)}}function T(e,t,a){var r,s=e[0],l=e[1],d=e.length;return"string"==typeof s?r={fieldName:s,from:d>1?l:t}:(r=(0,i.__assign)({},s),p.$3.call(r,"from")||(r.from=t)),!1!==globalThis.__DEV__&&void 0===r.from&&!1!==globalThis.__DEV__&&n.invariant.warn(8,(0,o.p)(Array.from(e))),void 0===r.variables&&(r.variables=a),r}function A(e){return function(t,a){if((0,l.c)(t)||(0,l.c)(a))throw(0,n.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,r.A_)(t)&&(0,p.d1)(a))return e.merge(t.__ref,a),t;if((0,p.d1)(t)&&(0,r.A_)(a))return e.merge(t,a.__ref),a;if((0,p.d1)(t)&&(0,p.d1)(a))return(0,i.__assign)((0,i.__assign)({},t),a)}return a}}},777(e,t,a){a.d(t,{MS:()=>p,UT:()=>l,WR:()=>s,bl:()=>n});var i=a(60837),n=new i.Slot,r=new WeakMap;function o(e){var t=r.get(e);return t||r.set(e,t={vars:new Set,dep:(0,i.dep)()}),t}function s(e){o(e).vars.forEach(function(t){return t.forgetCache(e)})}function p(e){o(e).vars.forEach(function(t){return t.attachCache(e)})}function l(e){var t=new Set,a=new Set,i=function(s){if(arguments.length>0){if(e!==s){e=s,t.forEach(function(e){var t;o(e).dep.dirty(i),(t=e).broadcastWatches&&t.broadcastWatches()});var p=Array.from(a);a.clear(),p.forEach(function(t){return t(e)})}}else{var l=n.getValue();l&&(r(l),o(l).dep(i))}return e};i.onNextChange=function(e){return a.add(e),function(){a.delete(e)}};var r=i.attachCache=function(e){return t.add(e),o(e).vars.add(i),i};return i.forgetCache=function(e){return t.delete(e)},i}},55427(e,t,a){a.d(t,{a:()=>l});var i=a(85608),n=a(55888),r=a(3777),o=a(2904),s=a(82307),p=a(28907);function l(e,t,a,l){var u=t.data,c=(0,i.__rest)(t,["data"]),m=a.data,f=(0,i.__rest)(a,["data"]);return(0,n.default)(c,f)&&function e(t,a,i,r){if(a===i)return!0;var l=new Set;return t.selections.every(function(t){if(l.has(t)||(l.add(t),!(0,s.MS)(t,r.variables)||d(t)))return!0;if((0,p.dt)(t)){var u=(0,p.ue)(t),c=a&&a[u],m=i&&i[u],f=t.selectionSet;if(!f)return(0,n.default)(c,m);var h=Array.isArray(c),v=Array.isArray(m);if(h!==v)return!1;if(h&&v){var g=c.length;if(m.length!==g)return!1;for(var y=0;y<g;++y)if(!e(f,c[y],m[y],r))return!1;return!0}return e(f,c,m,r)}var D=(0,o.HQ)(t,r.fragmentMap);if(D)return!!d(D)||e(D.selectionSet,a,i,r)})}((0,r.Vn)(e).selectionSet,u,m,{fragmentMap:(0,o.JG)((0,r.zK)(e)),variables:l})}function d(e){return!!e.directives&&e.directives.some(u)}function u(e){return"nonreactive"===e.name.value}},53570(e,t,a){a.r(t),a.d(t,{ApolloError:()=>l,PROTOCOL_ERRORS_SYMBOL:()=>r,graphQLResultHasProtocolErrors:()=>o,isApolloError:()=>s});var i=a(85608);a(70916);var n=a(21777),r=Symbol();function o(e){return!!e.extensions&&Array.isArray(e.extensions[r])}function s(e){return e.hasOwnProperty("graphQLErrors")}var p=function(e){var t=(0,i.__spreadArray)((0,i.__spreadArray)((0,i.__spreadArray)([],e.graphQLErrors,!0),e.clientErrors,!0),e.protocolErrors,!0);return e.networkError&&t.push(e.networkError),t.map(function(e){return(0,n.U)(e)&&e.message||"Error message not found."}).join("\n")},l=function(e){function t(a){var n=a.graphQLErrors,r=a.protocolErrors,o=a.clientErrors,s=a.networkError,l=a.errorMessage,d=a.extraInfo,u=e.call(this,l)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.protocolErrors=r||[],u.clientErrors=o||[],u.networkError=s||null,u.message=l||p(u),u.extraInfo=d,u.cause=(0,i.__spreadArray)((0,i.__spreadArray)((0,i.__spreadArray)([s],n||[],!0),r||[],!0),o||[],!0).find(function(e){return!!e})||null,u.__proto__=t.prototype,u}return(0,i.__extends)(t,e),t}(Error)},19074(e,t,a){a.d(t,{C:()=>u});var i=a(70916),n=a(36054),r=a(16878),o=a(38414),s=a(46192);function p(e,t){return t?t(e):n.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 n.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,i){var r=l(a),o=l(i||new e(p));return Object.assign(new e(d(r)&&d(o)?function(e){return t(e)?r.request(e)||n.c.of():o.request(e)||n.c.of()}:function(e,a){return t(e)?r.request(e,a)||n.c.of():o.request(e,a)||n.c.of()}),{left:r,right:o})},e.execute=function(e,t){return e.request((0,r.k)(t.context,(0,o.A)((0,s.K)(t))))||n.c.of()},e.concat=function(t,a){var r=l(t);if(d(r))return!1!==globalThis.__DEV__&&i.invariant.warn(38,r),r;var o=l(a);return Object.assign(new e(d(o)?function(e){return r.request(e,function(e){return o.request(e)||n.c.of()})||n.c.of()}:function(e,t){return r.request(e,function(e){return o.request(e,t)||n.c.of()})||n.c.of()}),{left:r,right:o})},e.prototype.split=function(t,a,i){return this.concat(e.split(t,a,i||new e(p)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw(0,i.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}()},25174(e,t,a){a.d(t,{g:()=>i});var i=a(19074).C.execute},4232(e,t,a){a.r(t),a.d(t,{ApolloLink:()=>i.C,concat:()=>s,empty:()=>n,execute:()=>p.g,from:()=>r,split:()=>o}),a(70916);var i=a(19074),n=i.C.empty,r=i.C.from,o=i.C.split,s=i.C.concat,p=a(25174)},49952(e,t,a){a.d(t,{P:()=>o});var i=a(85608),n=a(19074),r=a(79760),o=function(e){function t(t){void 0===t&&(t={});var a=e.call(this,(0,r.$)(t).request)||this;return a.options=t,a}return(0,i.__extends)(t,e),t}(n.C)},67195(e,t,a){a.d(t,{S:()=>n});var i=a(70916),n=function(e){if(!e&&"u"<typeof fetch)throw(0,i.newInvariantError)(40)}},79760(e,t,a){a.d(t,{$:()=>D});var i=a(85608),n=a(70916),r=a(19074),o=a(82307),s=a(36054),p=a(63647),l=a(33068),d=a(90117),u=a(67195),c=a(74559),m=a(11151),f=a(93161),h=a(70783),v=a(53925),g=a(3777),y=(0,n.maybe)(function(){return fetch}),D=function(e){void 0===e&&(e={});var t=e.uri,a=void 0===t?"/graphql":t,D=e.fetch,b=e.print,x=void 0===b?c.i1:b,_=e.includeExtensions,w=e.preserveHeaderCase,E=e.useGETForQueries,F=e.includeUnusedVariables,C=void 0!==F&&F,T=(0,i.__rest)(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&(0,u.S)(D||y);var A={http:{includeExtensions:_,preserveHeaderCase:w},options:T.fetchOptions,credentials:T.credentials,headers:T.headers};return new r.C(function(e){var t,r,u=(0,l.z)(e,a),b=e.getContext(),_={};if(b.clientAwareness){var w=b.clientAwareness,F=w.name,T=w.version;F&&(_["apollographql-client-name"]=F),T&&(_["apollographql-client-version"]=T)}var S=(0,i.__assign)((0,i.__assign)({},_),b.headers),O={http:b.http,options:b.fetchOptions,credentials:b.credentials,headers:S};if((0,o.d8)(["client"],e.query)){var N=(0,v.er)(e.query);if(!N)return(0,f.N)(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=N}var k=(0,c.HY)(e,x,c.R4,A,O),I=k.options,$=k.body;$.variables&&!C&&($.variables=(0,h.X)($.variables,e.query)),!I.signal&&"u">typeof AbortController&&(I.signal=(r=new AbortController).signal);var j="OperationDefinition"===(t=(0,g.Vn)(e.query)).kind&&"subscription"===t.operation,B=(0,o.d8)(["defer"],e.query);if(E&&!e.query.definitions.some(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})&&(I.method="GET"),B||j){I.headers=I.headers||{};var R="multipart/mixed;";j&&B&&!1!==globalThis.__DEV__&&n.invariant.warn(41),j?R+="boundary=graphql;subscriptionSpec=1.0,application/json":B&&(R+="deferSpec=20220824,application/json"),I.headers.accept=R}if("GET"===I.method){var V=(0,m.E)(u,$),P=V.newURI,L=V.parseError;if(L)return(0,f.N)(L);u=P}else try{I.body=(0,p.Y)($,"Payload")}catch(e){return(0,f.N)(e)}return new s.c(function(t){var a=D||(0,n.maybe)(function(){return fetch})||y,i=t.next.bind(t);return a(u,I).then(function(t){e.setContext({response:t});var a,n=null==(a=t.headers)?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(){r=void 0,t.complete()}).catch(function(e){r=void 0,(0,d.H4)(e,t)}),function(){r&&r.abort()}})})}},28876(e,t,a){a.r(t),a.d(t,{HttpLink:()=>d.P,parseAndCheckHttpResponse:()=>i.OQ,checkFetcher:()=>o.S,rewriteURIForGET:()=>u.E,serializeFetchParameter:()=>n.Y,createSignalIfSupported:()=>s,selectHttpOptionsAndBodyInternal:()=>r.HY,selectHttpOptionsAndBody:()=>r.Wz,selectURI:()=>p.z,fallbackHttpConfig:()=>r.R4,createHttpLink:()=>l.$,defaultPrinter:()=>r.i1}),a(70916);var i=a(90117),n=a(63647),r=a(74559),o=a(67195),s=function(){if("u"<typeof AbortController)return{controller:!1,signal:!1};var e=new AbortController,t=e.signal;return{controller:e,signal:t}},p=a(33068),l=a(79760),d=a(49952),u=a(11151)},90117(e,t,a){a.d(t,{H4:()=>c,OQ:()=>m,tD:()=>d});var i=a(85608),n=a(51360);function r(e){var t={next:function(){return e.read()}};return n.uJ&&(t[Symbol.asyncIterator]=function(){return this}),t}var o=a(3848),s=a(53570),p=a(37396),l=Object.prototype.hasOwnProperty;function d(e,t){return(0,i.__awaiter)(this,void 0,void 0,function(){var a,o,l,d,c,m,f,h,v,g,y,D,b,x,_,w,E,F,C,T,A,S,O;return(0,i.__generator)(this,function(N){switch(N.label){case 0:if(void 0===TextDecoder)throw Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=null==(O=e.headers)?void 0:O.get("content-type"),l="boundary=",d=(null==o?void 0:o.includes(l))?null==o?void 0:o.substring((null==o?void 0:o.indexOf(l))+l.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="\r\n--".concat(d),m="",f=function(e){var t,a,i,o,s,p,l=e;if(e.body&&(l=e.body),t=l,n.uJ&&t[Symbol.asyncIterator])return i=l[Symbol.asyncIterator](),(a={next:function(){return i.next()}})[Symbol.asyncIterator]=function(){return this},a;if(l.getReader)return r(l.getReader());if(l.stream)return r(l.stream().getReader());if(l.arrayBuffer)return o=l.arrayBuffer(),s=!1,p={next:function(){return s?Promise.resolve({value:void 0,done:!0}):(s=!0,new Promise(function(e,t){o.then(function(t){e({value:t,done:!1})}).catch(t)}))}},n.uJ&&(p[Symbol.asyncIterator]=function(){return this}),p;if(l.pipe)return function(e){var t=null,a=null,i=!1,r=[],o=[];function s(e){if(!a){if(o.length){var t=o.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}r.push(e)}}function p(e){a=e,o.slice().forEach(function(t){t[1](e)}),t&&t()}function l(){i=!0,o.slice().forEach(function(e){e[0]({value:void 0,done:!0})}),t&&t()}t=function(){t=null,e.removeListener("data",s),e.removeListener("error",p),e.removeListener("end",l),e.removeListener("finish",l),e.removeListener("close",l)},e.on("data",s),e.on("error",p),e.on("end",l),e.on("finish",l),e.on("close",l);var d={next:function(){return new Promise(function(e,t){return a?t(a):r.length?e({value:r.shift(),done:!1}):i?e({value:void 0,done:!0}):void o.push([e,t])})}};return n.uJ&&(d[Symbol.asyncIterator]=function(){return this}),d}(l);throw Error("Unknown body type for responseIterator. Please pass a streamable response.")}(e),h=!0,N.label=1;case 1:if(!h)return[3,3];return[4,f.next()];case 2:for(g=(v=N.sent()).value,y=v.done,D="string"==typeof g?g:a.decode(g),b=m.length-c.length+1,h=!y,m+=D,x=m.indexOf(c,b);x>-1;){if(_=void 0,_=(A=[m.slice(0,x),m.slice(x+c.length)])[0],m=A[1],w=_.indexOf("\r\n\r\n"),(E=function(e){var t={};return e.split("\n").forEach(function(e){var a=e.indexOf(":");if(a>-1){var i=e.slice(0,a).trim().toLowerCase(),n=e.slice(a+1).trim();t[i]=n}}),t}(_.slice(0,w))["content-type"])&&-1===E.toLowerCase().indexOf("application/json"))throw Error("Unsupported patch content type: application/json is required.");if(F=_.slice(w)){if(Object.keys(C=u(e,F)).length>1||"data"in C||"incremental"in C||"errors"in C||"payload"in C)if((0,p.Nw)(C)){if(T={},"payload"in C){if(1===Object.keys(C).length&&null===C.payload)return[2];T=(0,i.__assign)({},C.payload)}"errors"in C&&(T=(0,i.__assign)((0,i.__assign)({},T),{extensions:(0,i.__assign)((0,i.__assign)({},"extensions"in T?T.extensions:null),((S={})[s.PROTOCOL_ERRORS_SYMBOL]=C.errors,S))})),t(T)}else t(C);else if(1===Object.keys(C).length&&"hasNext"in C&&!C.hasNext)return[2]}x=m.indexOf(c)}return[3,1];case 3:return[2]}})})}function u(e,t){e.status>=300&&(0,o.A)(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status));try{return JSON.parse(t)}catch(a){throw a.name="ServerParseError",a.response=e,a.statusCode=e.status,a.bodyText=t,a}}function c(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}function m(e){return function(t){return t.text().then(function(e){return u(t,e)}).then(function(a){return Array.isArray(a)||l.call(a,"data")||l.call(a,"errors")||(0,o.A)(t,a,"Server response was missing for query '".concat(Array.isArray(e)?e.map(function(e){return e.operationName}):e.operationName,"'.")),a})}}},11151(e,t,a){a.d(t,{E:()=>n});var i=a(63647);function n(e,t){var a=[],n=function(e,t){a.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&n("query",t.query),t.operationName&&n("operationName",t.operationName),t.variables){var r=void 0;try{r=(0,i.Y)(t.variables,"Variables map")}catch(e){return{parseError:e}}n("variables",r)}if(t.extensions){var o=void 0;try{o=(0,i.Y)(t.extensions,"Extensions map")}catch(e){return{parseError:e}}n("extensions",o)}var s="",p=e,l=e.indexOf("#");-1!==l&&(s=e.substr(l),p=e.substr(0,l));var d=-1===p.indexOf("?")?"?":"&";return{newURI:p+d+a.join("&")+s}}},74559(e,t,a){a.d(t,{HY:()=>p,R4:()=>r,Wz:()=>s,i1:()=>o});var i=a(85608),n=a(38678),r={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},o=function(e,t){return t(e)};function s(e,t){for(var a=[],n=2;n<arguments.length;n++)a[n-2]=arguments[n];return a.unshift(t),p.apply(void 0,(0,i.__spreadArray)([e,o],a,!1))}function p(e,t){for(var a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];var o={},s={};a.forEach(function(e){o=(0,i.__assign)((0,i.__assign)((0,i.__assign)({},o),e.options),{headers:(0,i.__assign)((0,i.__assign)({},o.headers),e.headers)}),e.credentials&&(o.credentials=e.credentials),s=(0,i.__assign)((0,i.__assign)({},s),e.http)}),o.headers&&(o.headers=function(e,t){if(!t){var a={};return Object.keys(Object(e)).forEach(function(t){a[t.toLowerCase()]=e[t]}),a}var i={};Object.keys(Object(e)).forEach(function(t){i[t.toLowerCase()]={originalName:t,value:e[t]}});var n={};return Object.keys(i).forEach(function(e){n[i[e].originalName]=i[e].value}),n}(o.headers,s.preserveHeaderCase));var p=e.operationName,l=e.extensions,d=e.variables,u=e.query,c={operationName:p,variables:d};return s.includeExtensions&&(c.extensions=l),s.includeQuery&&(c.query=t(u,n.y)),{options:o,body:c}}},33068(e,t,a){a.d(t,{z:()=>i});var i=function(e,t){var a=e.getContext().uri;return a||("function"==typeof t?t(e):t||"/graphql")}},63647(e,t,a){a.d(t,{Y:()=>n});var i=a(70916),n=function(e,t){var a;try{a=JSON.stringify(e)}catch(e){var n=(0,i.newInvariantError)(42,t,e.message);throw n.parseError=e,n}return a}},16878(e,t,a){a.d(t,{k:()=>n});var i=a(85608);function n(e,t){var a=(0,i.__assign)({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){a="function"==typeof e?(0,i.__assign)((0,i.__assign)({},a),e(a)):(0,i.__assign)((0,i.__assign)({},a),e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return(0,i.__assign)({},a)}}),t}},70783(e,t,a){a.d(t,{X:()=>r});var i=a(85608),n=a(90424);function r(e,t){var a=(0,i.__assign)({},e),r=new Set(Object.keys(e));return(0,n.YR)(t,{Variable:function(e,t,a){a&&"VariableDefinition"!==a.kind&&r.delete(e.name.value)}}),r.forEach(function(e){delete a[e]}),a}},93161(e,t,a){a.d(t,{N:()=>n});var i=a(36054);function n(e){return new i.c(function(t){t.error(e)})}},22594(e,t,a){a.d(t,{S:()=>n});var i=a(36054);function n(e){return new i.c(function(t){e.then(function(e){t.next(e),t.complete()}).catch(t.error.bind(t))})}},25979(e,t,a){a.r(t),a.d(t,{createOperation:()=>p.k,filterOperationVariables:()=>d.X,fromError:()=>i.N,fromPromise:()=>r.S,throwServerError:()=>o.A,toPromise:()=>n.h,transformOperation:()=>l.A,validateOperation:()=>s.K}),a(70916);var i=a(93161),n=a(60441),r=a(22594),o=a(3848),s=a(46192),p=a(16878),l=a(38414),d=a(70783)},3848(e,t,a){a.d(t,{A:()=>i});var i=function(e,t,a){var i=Error(a);throw i.name="ServerError",i.response=e,i.statusCode=e.status,i.result=t,i}},60441(e,t,a){a.d(t,{h:()=>n});var i=a(70916);function n(e){var t=!1;return new Promise(function(a,n){e.subscribe({next:function(e){t?!1!==globalThis.__DEV__&&i.invariant.warn(45):(t=!0,a(e))},error:n})})}},38414(e,t,a){a.d(t,{A:()=>n});var i=a(3777);function n(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,i.n4)(t.query)||void 0:""),t}},46192(e,t,a){a.d(t,{K:()=>n});var i=a(70916);function n(e){for(var t=["query","operationName","variables","extensions","context"],a=0,n=Object.keys(e);a<n.length;a++){var r=n[a];if(0>t.indexOf(r))throw(0,i.newInvariantError)(46,r)}return e}},39283(e,t,a){a.r(t),a.d(t,{disableWarningsSlot:()=>i.yV,maskFragment:()=>n.z,maskOperation:()=>r.m});var i=a(47150),n=a(62959),r=a(28354)},25186(e,t,a){a.d(t,{S:()=>l});var i=a(42455),n=a(57236),r=a(28907),o=a(82307),s=a(47150),p=a(70916);function l(e,t,a){return s.yV.withValue(!0,function(){var l=function e(t,a,n,l,d){var u,c=n.knownChanged,m=function(e,t){if(t.has(e))return t.get(e);var a=Array.isArray(e)?[]:Object.create(null);return t.set(e,a),a}(t,n.mutableTargets);if(Array.isArray(t)){for(var f=0,h=Array.from(t.entries());f<h.length;f++){var v=h[f],g=v[0],y=v[1];if(null===y){m[g]=null;continue}var D=e(y,a,n,l,!1!==globalThis.__DEV__?"".concat(d||"","[").concat(g,"]"):void 0);c.has(D)&&c.add(m),m[g]=D}return c.has(m)?m:t}for(var b=0,x=a.selections;b<x.length;b++){var _=x[b],w=void 0;if(l&&c.add(m),_.kind===i.b.FIELD){var E=(0,r.ue)(_),F=_.selectionSet;if(void 0===(w=m[E]||t[E]))continue;if(F&&null!==w){var D=e(t[E],F,n,l,!1!==globalThis.__DEV__?"".concat(d||"",".").concat(E):void 0);c.has(D)&&(w=D)}!1===globalThis.__DEV__&&(m[E]=w),!1!==globalThis.__DEV__&&(!l||"__typename"===E||(null==(u=Object.getOwnPropertyDescriptor(m,E))?void 0:u.value)?(delete m[E],m[E]=w):Object.defineProperty(m,E,function(e,t,a,i,n){var r=function(){return s.yV.getValue()||(!1!==globalThis.__DEV__&&p.invariant.warn(48,i?"".concat(n," '").concat(i,"'"):"anonymous ".concat(n),"".concat(a,".").concat(e).replace(/^\./,"")),r=function(){return t}),t};return{get:function(){return r()},set:function(e){r=function(){return e}},enumerable:!0,configurable:!0}}(E,w,d||"",n.operationName,n.operationType)))}if(_.kind===i.b.INLINE_FRAGMENT&&(!_.typeCondition||n.cache.fragmentMatches(_,t.__typename))&&(w=e(t,_.selectionSet,n,l,d)),_.kind===i.b.FRAGMENT_SPREAD){var C=_.name.value,T=n.fragmentMap[C]||(n.fragmentMap[C]=n.cache.lookupFragment(C));(0,p.invariant)(T,47,C);var A=(0,o.s7)(_);"mask"!==A&&(w=e(t,T.selectionSet,n,"migrate"===A,d))}c.has(w)&&c.add(m)}return"__typename"in t&&!("__typename"in m)&&(m.__typename=t.__typename),Object.keys(m).length!==Object.keys(t).length&&c.add(m),c.has(m)?m:t}(e,t,a,!1);return Object.isFrozen(e)&&(0,n.G)(l),l})}},62959(e,t,a){a.d(t,{z:()=>d});var i=a(42455),n=a(47150),r=a(70916),o=a(55888),s=a(25186),p=a(2904),l=a(3777);function d(e,t,a,d){if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,n.Ki)(),e;var u=t.definitions.filter(function(e){return e.kind===i.b.FRAGMENT_DEFINITION});void 0===d&&((0,r.invariant)(1===u.length,49,u.length),d=u[0].name.value);var c=u.find(function(e){return e.name.value===d});return((0,r.invariant)(!!c,50,d),null==e||(0,o.default)(e,{}))?e:(0,s.S)(e,c.selectionSet,{operationType:"fragment",operationName:c.name.value,fragmentMap:(0,p.JG)((0,l.zK)(t)),cache:a,mutableTargets:new n.jq,knownChanged:new n.xm})}},28354(e,t,a){a.d(t,{m:()=>p});var i=a(70916),n=a(3777),r=a(2904),o=a(25186),s=a(47150);function p(e,t,a){if(!a.fragmentMatches)return!1!==globalThis.__DEV__&&(0,s.Ki)(),e;var p,l=(0,n.Vu)(t);return((0,i.invariant)(l,51),null==e)?e:(0,o.S)(e,l.selectionSet,{operationType:l.operation,operationName:null==(p=l.name)?void 0:p.value,fragmentMap:(0,r.JG)((0,n.zK)(t)),cache:a,mutableTargets:new s.jq,knownChanged:new s.xm})}},47150(e,t,a){a.d(t,{Ki:()=>d,jq:()=>o,xm:()=>s,yV:()=>p});var i=a(60837),n=a(70916),r=a(51360),o=r.et?WeakMap:Map,s=r.En?WeakSet:Set,p=new i.Slot,l=!1;function d(){l||(l=!0,!1!==globalThis.__DEV__&&n.invariant.warn(52))}},45078(e,t,a){a.d(t,{A:()=>s,V:()=>p});var i=a(54019),n=a(31088),r=new WeakSet;function o(e){!(e.size<=(e.max||-1))&&(r.has(e)||(r.add(e),setTimeout(function(){e.clean(),r.delete(e)},100)))}var s=function(e,t){var a=new i.l(e,t);return a.set=function(e,t){var a=i.l.prototype.set.call(this,e,t);return o(this),a},a},p=function(e,t){var a=new n.C(e,t);return a.set=function(e,t){var a=n.C.prototype.set.call(this,e,t);return o(this),a},a}},44114(e,t,a){a.d(t,{D_:()=>o,cM:()=>p,ep:()=>s,tQ:()=>l});var i=a(85608),n=a(555),r={};function o(e,t){r[e]=t}var s=!1!==globalThis.__DEV__?function(){var e,t,a,o,s;if(!1===globalThis.__DEV__)throw Error("only supported in development mode");return{limits:Object.fromEntries(Object.entries({parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4}).map(function(e){var t=e[0],a=e[1];return[t,n.v[t]||a]})),sizes:(0,i.__assign)({print:null==(e=r.print)?void 0:e.call(r),parser:null==(t=r.parser)?void 0:t.call(r),canonicalStringify:null==(a=r.canonicalStringify)?void 0:a.call(r),links:function e(t){var a;return t?(0,i.__spreadArray)((0,i.__spreadArray)([null==(a=null==t?void 0:t.getMemoryInternals)?void 0:a.call(t)],e(null==t?void 0:t.left),!0),e(null==t?void 0:t.right),!0).filter(c):[]}(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:m(this.queryManager.documentTransform)}},null==(s=(o=this.cache).getMemoryInternals)?void 0:s.call(o))}}:void 0,p=!1!==globalThis.__DEV__?function(){var e=this.config.fragments;return(0,i.__assign)((0,i.__assign)({},d.apply(this)),{addTypenameDocumentTransform:m(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:u(this.storeReader.executeSelectionSet),executeSubSelectedArray:u(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:u(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:u(null==e?void 0:e.findFragmentSpreads),lookup:u(null==e?void 0:e.lookup),transform:u(null==e?void 0:e.transform)}})}:void 0,l=!1!==globalThis.__DEV__?d:void 0;function d(){return{cache:{fragmentQueryDocuments:u(this.getFragmentDoc)}}}function u(e){return e&&"dirtyKey"in e?e.size:void 0}function c(e){return null!=e}function m(e){return(function e(t){return t?(0,i.__spreadArray)((0,i.__spreadArray)([u(null==t?void 0:t.performWork)],e(null==t?void 0:t.left),!0),e(null==t?void 0:t.right),!0).filter(c):[]})(e).map(function(e){return{cache:e}})}},555(e,t,a){a.d(t,{v:()=>o});var i=a(85608),n=a(70916),r=Symbol.for("apollo.cacheSize"),o=(0,i.__assign)({},n.global[r])},73767(e,t,a){a.d(t,{E:()=>n,c:()=>i});var i=Array.isArray;function n(e){return Array.isArray(e)&&e.length>0}},51360(e,t,a){a.d(t,{En:()=>o,JR:()=>u,Sw:()=>l,et:()=>r,ol:()=>s,uJ:()=>p});var i=a(70916),n="ReactNative"==(0,i.maybe)(function(){return navigator.product}),r="function"==typeof WeakMap&&!(n&&!global.HermesInternal),o="function"==typeof WeakSet,s="function"==typeof Symbol&&"function"==typeof Symbol.for,p=s&&Symbol.asyncIterator,l="function"==typeof(0,i.maybe)(function(){return window.document.createElement}),d=(0,i.maybe)(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,u=(l||n)&&!d},44214(e,t,a){a.d(t,{M:()=>s});var i,n=a(45078),r=a(555),o=a(44114),s=Object.assign(function(e){return JSON.stringify(e,p)},{reset:function(){i=new n.V(r.v.canonicalStringify||1e3)}});function p(e,t){if(t&&"object"==typeof t){var a=Object.getPrototypeOf(t);if(a===Object.prototype||null===a){var n=Object.keys(t);if(n.every(l))return t;var r=JSON.stringify(n),o=i.get(r);if(!o){n.sort();var s=JSON.stringify(n);o=i.get(s)||n,i.set(r,o),i.set(s,o)}var p=Object.create(a);return o.forEach(function(e){p[e]=t[e]}),p}}return t}function l(e,t,a){return 0===t||a[t-1]<=e}!1!==globalThis.__DEV__&&(0,o.D_)("canonicalStringify",function(){return i.size}),s.reset()},20906(e,t,a){a.d(t,{m:()=>n});var i=Object.prototype.toString;function n(e){return function e(t,a){switch(i.call(t)){case"[object Array]":if((a=a||new Map).has(t))return a.get(t);var n=t.slice(0);return a.set(t,n),n.forEach(function(t,i){n[i]=e(t,a)}),n;case"[object Object]":if((a=a||new Map).has(t))return a.get(t);var r=Object.create(Object.getPrototypeOf(t));return a.set(t,r),Object.keys(t).forEach(function(i){r[i]=e(t[i],a)}),r;default:return t}}(e)}},50492(e,t,a){a.d(t,{o:()=>i});function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var a=Object.create(null);return e.forEach(function(e){e&&Object.keys(e).forEach(function(t){var i=e[t];void 0!==i&&(a[t]=i)})}),a}},32710(e,t,a){a.d(t,{M:()=>o,t:()=>r});var i=a(73767),n=a(37396);function r(e){var t=o(e);return(0,i.E)(t)}function o(e){var t=(0,i.E)(e.errors)?e.errors.slice(0):[];return(0,n.ST)(e)&&(0,i.E)(e.incremental)&&e.incremental.forEach(function(e){e.errors&&t.push.apply(t,e.errors)}),t}},37396(e,t,a){a.d(t,{EQ:()=>s,Nw:()=>l,ST:()=>o,YX:()=>p,bd:()=>d});var i=a(21777),n=a(73767),r=a(30671);function o(e){return"incremental"in e}function s(e){return"hasNext"in e&&"data"in e}function p(e){return o(e)||s(e)}function l(e){return(0,i.U)(e)&&"payload"in e}function d(e,t){var a=e,i=new r.ZI;return o(t)&&(0,n.E)(t.incremental)&&t.incremental.forEach(function(e){for(var t=e.data,n=e.path,r=n.length-1;r>=0;--r){var o=n[r],s=isNaN(+o)?{}:[];s[o]=t,t=s}a=i.merge(a,t)}),a}},21461(e,t,a){a.d(t,{v:()=>n});var i=new Map;function n(e){var t=i.get(e)||1;return i.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}},57236(e,t,a){a.d(t,{G:()=>n});var i=a(21777);function n(e){var t;return!1!==globalThis.__DEV__&&(t=new Set([e])).forEach(function(e){(0,i.U)(e)&&function(e){if(!1!==globalThis.__DEV__&&!Object.isFrozen(e))try{Object.freeze(e)}catch(e){if(e instanceof TypeError)return null;throw e}return e}(e)===e&&Object.getOwnPropertyNames(e).forEach(function(a){(0,i.U)(e[a])&&t.add(e[a])})}),e}},30671(e,t,a){a.d(t,{D9:()=>o,IM:()=>s,ZI:()=>l});var i=a(85608),n=a(21777),r=Object.prototype.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(e)}function s(e){var t=e[0]||{},a=e.length;if(a>1)for(var i=new l,n=1;n<a;++n)t=i.merge(t,e[n]);return t}var p=function(e,t,a){return this.merge(e[a],t[a])},l=function(){function e(e){void 0===e&&(e=p),this.reconciler=e,this.isObject=n.U,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var a=this,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];return(0,n.U)(t)&&(0,n.U)(e)?(Object.keys(t).forEach(function(n){if(r.call(e,n)){var s=e[n];if(t[n]!==s){var p=a.reconciler.apply(a,(0,i.__spreadArray)([e,t,n],o,!1));p!==s&&((e=a.shallowCopyForMerge(e))[n]=p)}}else(e=a.shallowCopyForMerge(e))[n]=t[n]}),e):t},e.prototype.shallowCopyForMerge=function(e){return(0,n.U)(e)&&!this.pastCopies.has(e)&&(e=Array.isArray(e)?e.slice(0):(0,i.__assign)({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e)),e},e}()},31507(e,t,a){a.d(t,{l:()=>r});var i=a(85608),n=a(50492);function r(e,t){return(0,n.o)(e,t,t.variables&&{variables:(0,n.o)((0,i.__assign)((0,i.__assign)({},e&&e.variables),t.variables))})}},21777(e,t,a){function i(e){return null!==e&&"object"==typeof e}function n(e){return null!==e&&"object"==typeof e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}a.d(t,{Q:()=>n,U:()=>i})},86563(e,t,a){a.d(t,{p:()=>n});var i=a(21461);function n(e,t){void 0===t&&(t=0);var a=(0,i.v)("stringifyForDisplay");return JSON.stringify(e,function(e,t){return void 0===t?a:t},t).split(JSON.stringify(a)).join("<undefined>")}},70916(e,t,a){a.r(t),a.d(t,{invariant:()=>l,__DEV__:()=>h,DEV:()=>h,global:()=>o,InvariantError:()=>i.InvariantError,newInvariantError:()=>d,maybe:()=>r});var i=a(19371),n=a(73972);function r(e){try{return e()}catch(e){}}let o=r(function(){return globalThis})||r(function(){return window})||r(function(){return self})||r(function(){return global})||r(function(){return r.constructor("return this")()});var s=a(86563);function p(e){return function(t){for(var a=[],i=1;i<arguments.length;i++)a[i-1]=arguments[i];if("number"==typeof t){var n=t;(t=m(n))||(t=f(n,a),a=[])}e.apply(void 0,[t].concat(a))}}var l=Object.assign(function(e,t){for(var a=[],n=2;n<arguments.length;n++)a[n-2]=arguments[n];e||(0,i.invariant)(e,m(t,a)||f(t,a))},{debug:p(i.invariant.debug),log:p(i.invariant.log),warn:p(i.invariant.warn),error:p(i.invariant.error)});function d(e){for(var t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];return new i.InvariantError(m(e,t)||f(e,t))}var u=Symbol.for("ApolloErrorMessageHandler_"+n.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:n.r,message:e,args:t.map(c)})))}var h=!1!==globalThis.__DEV__},9354(e,t,a){a.d(t,{c:()=>u});var i=a(44592),n=a(51360),r=a(3777),o=a(70916),s=a(54019),p=a(60837),l=a(555);function d(e){return e}var u=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=n.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,i){return void 0===i&&(i=e.identity()),Object.assign(new e(function(e){return(t(e)?a:i).transformDocument(e)},{cache:!1}),{left:a,right:i})},e.prototype.resetCache=function(){var t=this;if(this.cached){var a=new i.Trie(n.et);this.performWork=(0,p.wrap)(e.prototype.performWork.bind(this),{makeCacheKey:function(e){var i=t.getCacheKey(e);if(i)return(0,o.invariant)(Array.isArray(i),77),a.lookupArray(i)},max:l.v["documentTransform.cache"],cache:s.l})}},e.prototype.performWork=function(e){return(0,r.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}()},82307(e,t,a){a.d(t,{I5:()=>l,MS:()=>o,d8:()=>d,f2:()=>u,hE:()=>p,s7:()=>m,sx:()=>s,tY:()=>c});var i=a(70916),n=a(90424),r=a(42455);function o(e,t){var a=e.directives;return!a||!a.length||c(a).every(function(e){var a=e.directive,n=e.ifArgument,r=!1;return"Variable"===n.value.kind?(r=t&&t[n.value.name.value],(0,i.invariant)(void 0!==r,78,a.name.value)):r=n.value.value,"skip"===a.name.value?!r:r})}function s(e){var t=[];return(0,n.YR)(e,{Directive:function(e){t.push(e.name.value)}}),t}var p=function(e,t){return d(e,t,!1)},l=function(e,t){return d(e,t,!0)};function d(e,t,a){var i=new Set(e),r=i.size;return(0,n.YR)(t,{Directive:function(e){if(i.delete(e.name.value)&&(!a||!i.size))return n.sP}}),a?!i.size:i.size<r}function u(e){return e&&d(["client","export"],e,!0)}function c(e){var t=[];return e&&e.length&&e.forEach(function(e){if("skip"===(a=e.name.value)||"include"===a){var a,n=e.arguments,r=e.name.value;(0,i.invariant)(n&&1===n.length,79,r);var o=n[0];(0,i.invariant)(o.name&&"if"===o.name.value,80,r);var s=o.value;(0,i.invariant)(s&&("Variable"===s.kind||"BooleanValue"===s.kind),81,r),t.push({directive:e,ifArgument:o})}}),t}function m(e){var t,a,n=null==(t=e.directives)?void 0:t.find(function(e){return"unmask"===e.name.value});if(!n)return"mask";var o=null==(a=n.arguments)?void 0:a.find(function(e){return"mode"===e.name.value});return(!1!==globalThis.__DEV__&&o&&(o.value.kind===r.b.VARIABLE?!1!==globalThis.__DEV__&&i.invariant.warn(82):o.value.kind!==r.b.STRING?!1!==globalThis.__DEV__&&i.invariant.warn(83):"migrate"!==o.value.value&&!1!==globalThis.__DEV__&&i.invariant.warn(84,o.value.value)),o&&"value"in o.value&&"migrate"===o.value.value)?"migrate":"unmask"}},2904(e,t,a){a.d(t,{HQ:()=>p,JG:()=>s,ct:()=>o,s6:()=>l});var i=a(85608),n=a(70916),r=a(90424);function o(e,t){var a=t,r=[];return e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw(0,n.newInvariantError)(85,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&r.push(e)}),void 0===a&&((0,n.invariant)(1===r.length,86,r.length),a=r[0].name.value),(0,i.__assign)((0,i.__assign)({},e),{definitions:(0,i.__spreadArray)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:a}}]}}],e.definitions,!0)})}function s(e){void 0===e&&(e=[]);var t={};return e.forEach(function(e){t[e.name.value]=e}),t}function p(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var a=e.name.value;if("function"==typeof t)return t(a);var i=t&&t[a];return(0,n.invariant)(i,87,a),i||null;default:return null}}function l(e){var t=!0;return(0,r.YR)(e,{FragmentSpread:function(e){if(!(t=!!e.directives&&e.directives.some(function(e){return"unmask"===e.name.value})))return r.sP}}),t}},3777(e,t,a){a.d(t,{AT:()=>l,E4:()=>d,Vn:()=>u,Vu:()=>o,n4:()=>s,sw:()=>r,wY:()=>c,zK:()=>p});var i=a(70916),n=a(28907);function r(e){(0,i.invariant)(e&&"Document"===e.kind,88);var t=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw(0,i.newInvariantError)(89,e.kind);return e});return(0,i.invariant)(t.length<=1,90,t.length),e}function o(e){return r(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function s(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&!!e.name}).map(function(e){return e.name.value})[0]||null}function p(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function l(e){var t=o(e);return(0,i.invariant)(t&&"query"===t.operation,91),t}function d(e){(0,i.invariant)("Document"===e.kind,92),(0,i.invariant)(e.definitions.length<=1,93);var t=e.definitions[0];return(0,i.invariant)("FragmentDefinition"===t.kind,94),t}function u(e){r(e);for(var t,a=0,n=e.definitions;a<n.length;a++){var o=n[a];if("OperationDefinition"===o.kind){var s=o.operation;if("query"===s||"mutation"===s||"subscription"===s)return o}"FragmentDefinition"!==o.kind||t||(t=o)}if(t)return t;throw(0,i.newInvariantError)(95)}function c(e){var t=Object.create(null),a=e&&e.variableDefinitions;return a&&a.length&&a.forEach(function(e){e.defaultValue&&(0,n.J)(t,e.variable.name,e.defaultValue)}),t}},38678(e,t,a){a.d(t,{y:()=>p});var i,n=a(95818),r=a(45078),o=a(555),s=a(44114),p=Object.assign(function(e){var t=i.get(e);return t||(t=(0,n.y)(e),i.set(e,t)),t},{reset:function(){i=new r.A(o.v.print||2e3)}});p.reset(),!1!==globalThis.__DEV__&&(0,s.D_)("print",function(){return i?i.size:0})},28907(e,t,a){a.d(t,{A_:()=>p,D$:()=>function e(t,a,i){for(var n,o=0,s=a.selections;o<s.length;o++){var p=s[o];if(g(p)){if("__typename"===p.name.value)return t[v(p)]}else n?n.push(p):n=[p]}if("string"==typeof t.__typename)return t.__typename;if(n)for(var l=0,d=n;l<d.length;l++){var p=d[l],u=e(t,(0,r.HQ)(p,i).selectionSet,i);if("string"==typeof u)return u}},Ii:()=>u,J:()=>d,Kc:()=>l,MB:()=>h,WU:()=>s,dt:()=>g,kd:()=>y,o5:()=>f,ue:()=>v});var i=a(70916),n=a(21777),r=a(2904),o=a(44214);function s(e){return{__ref:String(e)}}function p(e){return!!(e&&"object"==typeof e&&"string"==typeof e.__ref)}function l(e){return(0,n.U)(e)&&"Document"===e.kind&&Array.isArray(e.definitions)}function d(e,t,a,n){if("IntValue"===a.kind||"FloatValue"===a.kind)e[t.value]=Number(a.value);else if("BooleanValue"===a.kind||"StringValue"===a.kind)e[t.value]=a.value;else if("ObjectValue"===a.kind){var r={};a.fields.map(function(e){return d(r,e.name,e.value,n)}),e[t.value]=r}else if("Variable"===a.kind){var o=(n||{})[a.name.value];e[t.value]=o}else if("ListValue"===a.kind)e[t.value]=a.values.map(function(e){var a={};return d(a,t,e,n),a[t.value]});else if("EnumValue"===a.kind)e[t.value]=a.value;else if("NullValue"===a.kind)e[t.value]=null;else throw(0,i.newInvariantError)(96,t.value,a.kind)}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(i){var n=i.name,r=i.value;return d(a[e.name.value],n,r,t)})}));var i=null;return e.arguments&&e.arguments.length&&(i={},e.arguments.forEach(function(e){var a=e.name,n=e.value;return d(i,a,n,t)})),f(e.name.value,i,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))return a.connection.key;else{var i=a.connection.filter?a.connection.filter:[];i.sort();var n={};return i.forEach(function(e){n[e]=t[e]}),"".concat(a.connection.key,"(").concat(m(n),")")}var r=e;if(t){var o=m(t);r+="(".concat(o,")")}return a&&Object.keys(a).forEach(function(e){-1===c.indexOf(e)&&(a[e]&&Object.keys(a[e]).length?r+="@".concat(e,"(").concat(m(a[e]),")"):r+="@".concat(e))}),r},{setStringify:function(e){var t=m;return m=e,t}});function h(e,t){if(e.arguments&&e.arguments.length){var a={};return e.arguments.forEach(function(e){return d(a,e.name,e.value,t)}),a}return null}function v(e){return e.alias?e.alias.value:e.name.value}function g(e){return"Field"===e.kind}function y(e){return"InlineFragment"===e.kind}},53925(e,t,a){a.d(t,{TC:()=>D,XY:()=>h,er:()=>x,hX:()=>g,it:()=>y,iz:()=>f,x3:()=>_,zc:()=>b});var i=a(85608),n=a(70916),r=a(42455),o=a(90424),s=a(3777),p=a(28907),l=a(2904),d=a(73767),u={kind:r.b.FIELD,name:{kind:r.b.NAME,value:"__typename"}};function c(e){return!function e(t,a){return!t||t.selectionSet.selections.every(function(t){return t.kind===r.b.FRAGMENT_SPREAD&&e(a[t.name.value],a)})}((0,s.Vu)(e)||(0,s.E4)(e),(0,l.JG)((0,s.zK)(e)))?e:null}function m(e){var t=new Map;return function(a){void 0===a&&(a=e);var i=t.get(a);return i||t.set(a,i={variables:new Set,fragmentSpreads:new Set}),i}}function f(e,t){(0,s.sw)(t);for(var a,p,l=m(""),u=m(""),f=function(e){for(var t=0,a=void 0;t<e.length&&(a=e[t]);++t)if(!(0,d.c)(a)){if(a.kind===r.b.OPERATION_DEFINITION)return l(a.name&&a.name.value);if(a.kind===r.b.FRAGMENT_DEFINITION)return u(a.name.value)}return!1!==globalThis.__DEV__&&n.invariant.error(97),null},h=0,v=t.definitions.length-1;v>=0;--v)t.definitions[v].kind===r.b.OPERATION_DEFINITION&&++h;var g=(a=new Map,p=new Map,e.forEach(function(e){e&&(e.name?a.set(e.name,e):e.test&&p.set(e.test,e))}),function(e){var t=a.get(e.name.value);return!t&&p.size&&p.forEach(function(a,i){i(e)&&(t=a)}),t}),y=function(e){return(0,d.E)(e)&&e.map(g).some(function(e){return e&&e.remove})},D=new Map,b=!1,x={enter:function(e){if(y(e.directives))return b=!0,null}},_=(0,o.YR)(t,{Field:x,InlineFragment:x,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,a,i,n){var r=f(n);r&&r.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,a,i,n){if(y(e.directives))return b=!0,null;var r=f(n);r&&r.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,a,i){D.set(JSON.stringify(i),e)},leave:function(e,t,a,i){return e===D.get(JSON.stringify(i))?e:h>0&&e.selectionSet.selections.every(function(e){return e.kind===r.b.FIELD&&"__typename"===e.name.value})?(u(e.name.value).removed=!0,b=!0,null):void 0}},Directive:{leave:function(e){if(g(e))return b=!0,null}}});if(!b)return t;var w=function(e){return!e.transitiveVars&&(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach(function(t){w(u(t)).transitiveVars.forEach(function(t){e.transitiveVars.add(t)})})),e},E=new Set;_.definitions.forEach(function(e){e.kind===r.b.OPERATION_DEFINITION?w(l(e.name&&e.name.value)).fragmentSpreads.forEach(function(e){E.add(e)}):e.kind!==r.b.FRAGMENT_DEFINITION||0!==h||u(e.name.value).removed||E.add(e.name.value)}),E.forEach(function(e){w(u(e)).fragmentSpreads.forEach(function(e){E.add(e)})});var F={enter:function(e){var t;if(t=e.name.value,!E.has(t)||u(t).removed)return null}};return c((0,o.YR)(_,{FragmentSpread:F,FragmentDefinition:F,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=w(l(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return(0,i.__assign)((0,i.__assign)({},e),{variableDefinitions:e.variableDefinitions.filter(function(e){return t.has(e.variable.name.value)})})}}}}))}var h=Object.assign(function(e){return(0,o.YR)(e,{SelectionSet:{enter:function(e,t,a){if(!a||a.kind!==r.b.OPERATION_DEFINITION){var n=e.selections;if(!(!n||n.some(function(e){return(0,p.dt)(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))&&!((0,p.dt)(a)&&a.directives&&a.directives.some(function(e){return"export"===e.name.value})))return(0,i.__assign)((0,i.__assign)({},e),{selections:(0,i.__spreadArray)((0,i.__spreadArray)([],n,!0),[u],!1)})}}}})},{added:function(e){return e===u}}),v={test:function(e){var t="connection"===e.name.value;return!t||e.arguments&&e.arguments.some(function(e){return"key"===e.name.value})||!1===globalThis.__DEV__||n.invariant.warn(98),t}};function g(e){return f([v],(0,s.sw)(e))}function y(e,t){var a=function(t){return e.some(function(e){return t.value&&t.value.kind===r.b.VARIABLE&&t.value.name&&(e.name===t.value.name.value||e.test&&e.test(t))})};return c((0,o.YR)(t,{OperationDefinition:{enter:function(t){return(0,i.__assign)((0,i.__assign)({},t),{variableDefinitions:t.variableDefinitions?t.variableDefinitions.filter(function(t){return!e.some(function(e){return e.name===t.variable.name.value})}):[]})}},Field:{enter:function(t){if(e.some(function(e){return e.remove})){var i=0;if(t.arguments&&t.arguments.forEach(function(e){a(e)&&(i+=1)}),1===i)return null}}},Argument:{enter:function(e){if(a(e))return null}}}))}function D(e,t){function a(t){if(e.some(function(e){return e.name===t.name.value}))return null}return c((0,o.YR)(t,{FragmentSpread:{enter:a},FragmentDefinition:{enter:a}}))}function b(e){return"query"===(0,s.Vn)(e).operation?e:(0,o.YR)(e,{OperationDefinition:{enter:function(e){return(0,i.__assign)((0,i.__assign)({},e),{operation:"query"})}}})}function x(e){return(0,s.sw)(e),f([{test:function(e){return"client"===e.name.value},remove:!0}],e)}function _(e){return(0,s.sw)(e),(0,o.YR)(e,{FragmentSpread:function(e){var t;if(null==(t=e.directives)||!t.some(function(e){return"unmask"===e.name.value}))return(0,i.__assign)((0,i.__assign)({},e),{directives:(0,i.__spreadArray)((0,i.__spreadArray)([],e.directives||[],!0),[{kind:r.b.DIRECTIVE,name:{kind:r.b.NAME,value:"nonreactive"}}],!1)})}})}},5437(e,t,a){a.r(t),a.d(t,{DEV:()=>i.DEV,concatPagination:()=>g,getInclusionDirectives:()=>n.tY,makeReference:()=>l.WU,shouldInclude:()=>n.MS,createFragmentMap:()=>o.JG,AutoCleanedStrongCache:()=>Q.V,hasAllDirectives:()=>n.I5,AutoCleanedWeakCache:()=>Q.A,canUseWeakMap:()=>R.et,getFragmentFromSelection:()=>o.HQ,storeKeyNameFromField:()=>l.Ii,getOperationDefinition:()=>s.Vu,isArray:()=>$.c,checkDocument:()=>s.sw,getFragmentMaskMode:()=>n.s7,maybe:()=>i.maybe,valueToObjectRepresentation:()=>l.J,mergeDeepArray:()=>v.IM,getDirectiveNames:()=>n.sx,isExecutionPatchInitialResult:()=>U.EQ,graphQLResultHasError:()=>B.t,resultKeyNameFromField:()=>l.ue,hasDirectives:()=>n.d8,isPlainObject:()=>j.Q,isNonNullObject:()=>j.U,mergeOptions:()=>M.l,canUseAsyncIteratorSymbol:()=>R.uJ,isReference:()=>l.A_,DeepMerger:()=>v.ZI,maybeDeepFreeze:()=>S.G,getFragmentDefinition:()=>s.E4,getTypenameFromResult:()=>l.D$,iterateObserversSafely:()=>O.w,getOperationName:()=>s.n4,removeDirectivesFromDocument:()=>d.iz,isStatefulPromise:()=>F,isInlineFragment:()=>l.kd,canUseWeakSet:()=>R.En,mergeDeep:()=>v.D9,omitDeep:()=>G,isQueryOperation:()=>m,print:()=>p.y,createRejectedPromise:()=>E,getStoreKeyName:()=>l.o5,removeFragmentSpreadFromDocument:()=>d.TC,removeArgumentsFromDocument:()=>d.it,fixObservableSubclass:()=>I.r,createFulfilledPromise:()=>w,canUseSymbol:()=>R.ol,getFragmentQueryDocument:()=>o.ct,removeConnectionDirectiveFromDocument:()=>d.hX,stringifyForDisplay:()=>L.p,wrapPromiseWithState:()=>C,relayStylePagination:()=>D,isNonEmptyArray:()=>$.E,getFragmentDefinitions:()=>s.zK,isExecutionPatchIncrementalResult:()=>U.ST,buildQueryFromSelectionSet:()=>d.zc,preventUnhandledRejection:()=>T.X,stripTypename:()=>Y,canUseDOM:()=>R.Sw,canUseLayoutEffect:()=>R.JR,isApolloPayloadResult:()=>U.Nw,DocumentTransform:()=>r.c,addTypenameToDocument:()=>d.XY,canonicalStringify:()=>q.M,Concast:()=>k.E,Observable:()=>_.c,argumentsObjectFromField:()=>l.MB,getDefaultValues:()=>s.wY,isField:()=>l.dt,hasClientExports:()=>n.f2,offsetLimitPagination:()=>y,removeClientSetsFromDocument:()=>d.er,isDocumentNode:()=>l.Kc,compact:()=>V.o,getGraphQLErrorsFromResult:()=>B.M,addNonReactiveToNamedFragments:()=>d.x3,getQueryDefinition:()=>s.AT,isExecutionPatchResult:()=>U.YX,asyncMap:()=>N.x,isFullyUnmaskedOperation:()=>o.s6,hasAnyDirectives:()=>n.hE,getMainDefinition:()=>s.Vn,isMutationOperation:()=>c,cloneDeep:()=>A.m,isSubscriptionOperation:()=>f,cacheSizes:()=>J.v,makeUniqueId:()=>P.v,mergeIncrementalData:()=>U.bd});var i=a(70916),n=a(82307),r=a(9354),o=a(2904),s=a(3777),p=a(38678),l=a(28907),d=a(53925);function u(e,t){var a;return(null==(a=(0,s.Vu)(e))?void 0:a.operation)===t}function c(e){return u(e,"mutation")}function m(e){return u(e,"query")}function f(e){return u(e,"subscription")}var h=a(85608),v=a(30671);function g(e){return void 0===e&&(e=!1),{keyArgs:e,merge:function(e,t){return e?(0,h.__spreadArray)((0,h.__spreadArray)([],e,!0),t,!0):t}}}function y(e){return void 0===e&&(e=!1),{keyArgs:e,merge:function(e,t,a){var i=a.args,n=e?e.slice(0):[];if(t)if(i)for(var r=i.offset,o=void 0===r?0:r,s=0;s<t.length;++s)n[o+s]=t[s];else n.push.apply(n,t);return n}}}function D(e){return void 0===e&&(e=!1),{keyArgs:e,read:function(e,t){var a=t.canRead,i=t.readField;if(!e)return e;var n=[],r="",o="";e.edges.forEach(function(e){a(i("node",e))&&(n.push(e),e.cursor&&(r=r||e.cursor||"",o=e.cursor||o))}),n.length>1&&r===o&&(r="");var s=e.pageInfo||{},p=s.startCursor,l=s.endCursor;return(0,h.__assign)((0,h.__assign)({},b(e)),{edges:n,pageInfo:(0,h.__assign)((0,h.__assign)({},e.pageInfo),{startCursor:p||r,endCursor:l||o})})},merge:function(e,t,a){var i=a.args,n=a.isReference,r=a.readField;if(e||(e={edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}),!t)return e;var o=t.edges?t.edges.map(function(e){return n(e=(0,h.__assign)({},e))&&(e.cursor=r("cursor",e)),e}):[];if(t.pageInfo){var s=t.pageInfo,p=s.startCursor,l=s.endCursor,d=o[0],u=o[o.length-1];d&&p&&(d.cursor=p),u&&l&&(u.cursor=l);var c=d&&d.cursor;c&&!p&&(t=(0,v.D9)(t,{pageInfo:{startCursor:c}}));var m=u&&u.cursor;m&&!l&&(t=(0,v.D9)(t,{pageInfo:{endCursor:m}}))}var f=e.edges,g=[];if(i&&i.after){var y=f.findIndex(function(e){return e.cursor===i.after});y>=0&&(f=f.slice(0,y+1))}else if(i&&i.before){var y=f.findIndex(function(e){return e.cursor===i.before});g=y<0?f:f.slice(y),f=[]}else t.edges&&(f=[]);var D=(0,h.__spreadArray)((0,h.__spreadArray)((0,h.__spreadArray)([],f,!0),o,!0),g,!0),x=(0,h.__assign)((0,h.__assign)({},t.pageInfo),e.pageInfo);if(t.pageInfo){var _=t.pageInfo,w=_.hasPreviousPage,E=_.hasNextPage,p=_.startCursor,l=_.endCursor;Object.assign(x,(0,h.__rest)(_,["hasPreviousPage","hasNextPage","startCursor","endCursor"])),f.length||(void 0!==w&&(x.hasPreviousPage=w),void 0!==p&&(x.startCursor=p)),g.length||(void 0!==E&&(x.hasNextPage=E),void 0!==l&&(x.endCursor=l))}return(0,h.__assign)((0,h.__assign)((0,h.__assign)({},b(e)),b(t)),{edges:D,pageInfo:x})}}}var b=function(e){return(0,h.__rest)(e,x)},x=["edges","pageInfo"],_=a(36054);function w(e){var t=Promise.resolve(e);return t.status="fulfilled",t.value=e,t}function E(e){var t=Promise.reject(e);return t.catch(function(){}),t.status="rejected",t.reason=e,t}function F(e){return"status"in e}function C(e){return F(e)||(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e}var T=a(30234),A=a(20906),S=a(57236),O=a(87613),N=a(5762),k=a(45637),I=a(35892),$=a(73767),j=a(21777),B=a(32710),R=a(51360),V=a(50492),P=a(21461),L=a(86563),M=a(31507),U=a(37396),q=a(44214);function G(e,t){return z(e,t)}function z(e,t,a){if(void 0===a&&(a=new Map),a.has(e))return a.get(e);var i=!1;if(Array.isArray(e)){var n=[];if(a.set(e,n),e.forEach(function(e,r){var o=z(e,t,a);i||(i=o!==e),n[r]=o}),i)return n}else if((0,j.Q)(e)){var r=Object.create(Object.getPrototypeOf(e));if(a.set(e,r),Object.keys(e).forEach(function(n){if(n===t){i=!0;return}var o=z(e[n],t,a);i||(i=o!==e[n]),r[n]=o}),i)return r}return e}function Y(e){return z(e,"__typename")}var Q=a(45078),J=a(555)},45637(e,t,a){a.d(t,{E:()=>p});var i=a(85608),n=a(36054),r=a(87613),o=a(35892);function s(e){return e&&"function"==typeof e.then}var p=function(e){function t(t){var a=e.call(this,function(e){return a.addObserver(e),function(){return a.removeObserver(e)}})||this;return a.observers=new Set,a.promise=new Promise(function(e,t){a.resolve=e,a.reject=t}),a.handlers={next:function(e){null!==a.sub&&(a.latest=["next",e],a.notify("next",e),(0,r.w)(a.observers,"next",e))},error:function(e){var t=a.sub;null!==t&&(t&&setTimeout(function(){return t.unsubscribe()}),a.sub=null,a.latest=["error",e],a.reject(e),a.notify("error",e),(0,r.w)(a.observers,"error",e))},complete:function(){var e=a.sub,t=a.sources;if(null!==e){var i=(void 0===t?[]:t).shift();i?s(i)?i.then(function(e){return a.sub=e.subscribe(a.handlers)},a.handlers.error):a.sub=i.subscribe(a.handlers):(e&&setTimeout(function(){return e.unsubscribe()}),a.sub=null,a.latest&&"next"===a.latest[0]?a.resolve(a.latest[1]):a.resolve(),a.notify("complete"),(0,r.w)(a.observers,"complete"))}}},a.nextResultListeners=new Set,a.cancel=function(e){a.reject(e),a.sources=[],a.handlers.error(e)},a.promise.catch(function(e){}),"function"==typeof t&&(t=[new n.c(t)]),s(t)?t.then(function(e){return a.start(e)},a.handlers.error):a.start(t),a}return(0,i.__extends)(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],a=e[t];a&&a.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e))},t.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},t.prototype.notify=function(e,t){var a=this.nextResultListeners;a.size&&(this.nextResultListeners=new Set,a.forEach(function(a){return a(e,t)}))},t.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add(function(a,i){t||(t=!0,e(a,i))})},t}(n.c);(0,o.r)(p)},5762(e,t,a){a.d(t,{x:()=>n});var i=a(36054);function n(e,t,a){return new i.c(function(i){var n={then:function(e){return new Promise(function(t){return t(e())})}};function r(e,t){return function(a){if(e){var r=function(){return i.closed?0:e(a)};n=n.then(r,r).then(function(e){return i.next(e)},function(e){return i.error(e)})}else i[t](a)}}var o={next:r(t,"next"),error:r(a,"error"),complete:function(){n.then(function(){return i.complete()})}},s=e.subscribe(o);return function(){return s.unsubscribe()}})}},87613(e,t,a){a.d(t,{w:()=>i});function i(e,t,a){var i=[];e.forEach(function(e){return e[t]&&i.push(e)}),i.forEach(function(e){return e[t](a)})}},35892(e,t,a){a.d(t,{r:()=>r});var i=a(36054),n=a(51360);function r(e){function t(t){Object.defineProperty(e,t,{value:i.c})}return n.ol&&Symbol.species&&t(Symbol.species),t("@@species"),e}},30234(e,t,a){a.d(t,{X:()=>i});function i(e){return e.catch(function(){}),e}},73972(e,t,a){a.d(t,{r:()=>i});var i="3.13.8"},88958(e,a,i){let n;i.d(a,{kv:()=>ef,lJ:()=>eN,hF:()=>eI});let r=(e,t=[])=>"up"===e.name||t.includes("vim")&&"k"===e.name||t.includes("emacs")&&e.ctrl&&"p"===e.name,o=(e,t=[])=>"down"===e.name||t.includes("vim")&&"j"===e.name||t.includes("emacs")&&e.ctrl&&"n"===e.name,s=e=>"enter"===e.name||"return"===e.name;class p extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(e){super(),this.cause=e?.cause}}class l extends Error{name="CancelPromptError";message="Prompt was canceled"}class d extends Error{name="ExitPromptError"}class u extends Error{name="HookError"}class c extends Error{name="ValidationError"}let m=t("node:async_hooks"),f=new m.AsyncLocalStorage;function h(){let e=f.getStore();if(!e)throw new u("[Inquirer] Hook functions can only be called from within a prompt");return e}function v(e){return m.AsyncResource.bind((...t)=>{let a=h(),i=!1,n=a.handleChange;a.handleChange=()=>{i=!0};let r=e(...t);return i&&n(),a.handleChange=n,r})}function g(e){let t=h(),{index:a}=t,i=e({get:()=>t.hooks[a],set(e){t.hooks[a]=e},initialized:a in t.hooks});return t.index++,i}let y={queue(e){let t=h(),{index:a}=t;t.hooksEffect.push(()=>{t.hooksCleanup[a]?.();let i=e(h().rl);if(null!=i&&"function"!=typeof i)throw new c("useEffect return value must be a cleanup function or nothing.");t.hooksCleanup[a]=i})},run(){let e=h();v(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=h();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function D(e){return g(t=>{let a=m.AsyncResource.bind(function(e){t.get()!==e&&(t.set(e),h().handleChange())});if(t.initialized)return[t.get(),a];let i="function"==typeof e?e():e;return t.set(i),[i,a]})}function b(e,t){g(a=>{let i=a.get();(!Array.isArray(i)||t.some((e,t)=>!Object.is(e,i[t])))&&y.queue(e),a.set(t)})}var x=i(57504),_=i(1708);let w={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"\xbd",oneThird:"⅓",oneQuarter:"\xbc",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"\xbe",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},E={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},F={...w,...E},C={...w,tick:"√",info:"i",warning:"‼",cross:"\xd7",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(\xd7)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xd7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xd7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},T=("win32"!==_.platform?"linux"===_.env.TERM:!_.env.WT_SESSION&&!_.env.TERMINUS_SUBLIME&&"{cmd::Cmder}"!==_.env.ConEmuTask&&"Terminus-Sublime"!==_.env.TERM_PROGRAM&&"vscode"!==_.env.TERM_PROGRAM&&"xterm-256color"!==_.env.TERM&&"alacritty"!==_.env.TERM&&"JetBrains-JediTerm"!==_.env.TERMINAL_EMULATOR)?C:F;Object.entries(E);let A={prefix:{idle:x.blue("?"),done:x.green(T.tick)},spinner:{interval:80,frames:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"].map(e=>x.yellow(e))},style:{answer:x.cyan,message:x.bold,error:e=>x.red(`> ${e}`),defaultAnswer:e=>x.dim(`(${e})`),help:x.dim,highlight:x.cyan,key:e=>x.cyan(x.bold(`<${e}>`))}};function S(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function O(...e){return function e(...t){let a={};for(let i of t)for(let[t,n]of Object.entries(i)){let i=a[t];a[t]=S(i)&&S(n)?e(i,n):n}return a}(A,...e.filter(e=>null!=e))}function N({status:e="idle",theme:t}){let[a,i]=D(!1),[n,r]=D(0),{prefix:o,spinner:s}=O(t);if(b(()=>{if("loading"===e){let e,t=-1,a=setTimeout(()=>{i(!0),e=setInterval(()=>{r((t+=1)%s.frames.length)},s.interval)},300);return()=>{clearTimeout(a),clearInterval(e)}}i(!1)},[e]),a)return s.frames[n];let p="loading"===e?"idle":e;return"string"==typeof o?o:o[p]??o.idle}function k(e,t){return g(a=>{let i=a.get();if(!i||i.dependencies.length!==t.length||i.dependencies.some((e,a)=>e!==t[a])){let i=e();return a.set({value:i,dependencies:t}),i}return i.value})}function I(e){return D({current:e})[0]}function $(e){let t=I(e);t.current=e,b(e=>{let a=!1,i=v((i,n)=>{a||t.current(n,e)});return e.input.on("keypress",i),()=>{a=!0,e.input.removeListener("keypress",i)}},[])}var j=i(74),B=i(61893);function R(e,t){return e.split("\n").flatMap(e=>B(e,t,{trim:!1,hard:!0}).split("\n").map(e=>e.trimEnd())).join("\n")}function V(){return j({defaultWidth:80,output:h().rl.output})}function P({items:e,active:t,renderItem:a,pageSize:i,loop:n=!0}){let r=V(),o=t=>(t%e.length+e.length)%e.length,s=e.map((e,i)=>null==e?[]:R(a({item:e,index:i,isActive:i===t}),r).split("\n")),p=s.reduce((e,t)=>e+t.length,0),l=e=>s[e]??[],d=function({active:e,renderedItems:t,pageSize:a,loop:i}){let n=I({lastPointer:e,lastActive:void 0}),{lastPointer:r,lastActive:o}=n.current,s=Math.floor(a/2),p=t.reduce((e,t)=>e+t.length,0),l=t.slice(0,e).reduce((e,t)=>e+t.length,0),d=l;if(p>a)if(i)d=r,null!=o&&o<e&&e-o<a&&(d=Math.min(s,1===Math.abs(e-o)?Math.min(r+(t[o]?.length??0),Math.max(l,r)):r+e-o));else{let i=t.slice(e).reduce((e,t)=>e+t.length,0);d=i<a-s?a-i:Math.min(l,s)}return n.current.lastPointer=d,n.current.lastActive=e,d}({active:t,renderedItems:s,pageSize:i,loop:n}),u=l(t).slice(0,i),c=d+u.length<=i?d:i-u.length,m=Array.from({length:i});m.splice(c,u.length,...u);let f=new Set([t]),h=c+u.length,v=o(t+1);for(;h<i&&!f.has(v)&&(n&&p>i?v!==t:v>t);){let e=l(v).slice(0,i-h);m.splice(h,e.length,...e),f.add(v),h+=e.length,v=o(v+1)}for(h=c-1,v=o(t-1);h>=0&&!f.has(v)&&(n&&p>i?v!==t:v<t);){let e=l(v),t=e.slice(Math.max(0,e.length-h-1));m.splice(h-t.length+1,t.length,...t),f.add(v),h-=t.length,v=o(v-1)}return m.filter(e=>"string"==typeof e).join("\n")}let L=t("node:readline");var M=i(83329);let U=[];U.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&U.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&U.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");let q=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,G=Symbol.for("signal-exit emitter"),z=globalThis,Y=Object.defineProperty.bind(Object);class Q{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(z[G])return z[G];Y(z,G,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let a=this.listeners[e],i=a.indexOf(t);-1!==i&&(0===i&&1===a.length?a.length=0:a.splice(i,1))}emit(e,t,a){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let n of this.listeners[e])i=!0===n(t,a)||i;return"exit"===e&&(i=this.emit("afterExit",t,a)||i),i}}class J{}class H extends J{#i="win32"===W.platform?"SIGINT":"SIGHUP";#n=new Q;#r;#o;#s;#p={};#l=!1;constructor(e){for(let t of(super(),this.#r=e,this.#p={},U))this.#p[t]=()=>{let a=this.#r.listeners(t),{count:i}=this.#n;if("object"==typeof e.__signal_exit_emitter__&&"number"==typeof e.__signal_exit_emitter__.count&&(i+=e.__signal_exit_emitter__.count),a.length===i){this.unload();let a=this.#n.emit("exit",null,t),i="SIGHUP"===t?this.#i:t;a||e.kill(e.pid,i)}};this.#s=e.reallyExit,this.#o=e.emit}onExit(e,t){if(!q(this.#r))return()=>{};!1===this.#l&&this.load();let a=t?.alwaysLast?"afterExit":"exit";return this.#n.on(a,e),()=>{this.#n.removeListener(a,e),0===this.#n.listeners.exit.length&&0===this.#n.listeners.afterExit.length&&this.unload()}}load(){if(!this.#l){for(let e of(this.#l=!0,this.#n.count+=1,U))try{let t=this.#p[e];t&&this.#r.on(e,t)}catch(e){}this.#r.emit=(e,...t)=>this.#d(e,...t),this.#r.reallyExit=e=>this.#u(e)}}unload(){this.#l&&(this.#l=!1,U.forEach(e=>{let t=this.#p[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)}catch(e){}}),this.#r.emit=this.#o,this.#r.reallyExit=this.#s,this.#n.count-=1)}#u(e){return q(this.#r)?(this.#r.exitCode=e||0,this.#n.emit("exit",this.#r.exitCode,null),this.#s.call(this.#r,this.#r.exitCode)):0}#d(e,...t){let a=this.#o;if(!("exit"===e&&q(this.#r)))return a.call(this.#r,e,...t);{"number"==typeof t[0]&&(this.#r.exitCode=t[0]);let i=a.call(this.#r,e,...t);return this.#n.emit("exit",this.#r.exitCode,null),i}}}let W=globalThis.process,{onExit:K,load:X,unload:Z}=(n=q(W)?new H(W):new class extends J{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>n.onExit(e,t),load:()=>n.load(),unload:()=>n.unload()});var ee=i(57975);let et=(e=1)=>e>0?`\u001B[${e}A`:"",ea=(e=1)=>e>0?`\u001B[${e}B`:"",ei=(e,t)=>"number"!=typeof t||Number.isNaN(t)?`\u001B[${e+1}G`:`\u001B[${t+1};${e+1}H`,en="\x1b[2K",er=e=>e>0?(en+et(1)).repeat(e-1)+en+"\x1b[G":"";class eo{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(e){this.rl=e,this.cursorPos=e.getCursorPos()}write(e){this.rl.output.unmute(),this.rl.output.write(e),this.rl.output.mute()}render(e,t=""){let a=e.split("\n").pop()??"",i=(0,ee.stripVTControlCharacters)(a),n=i;this.rl.line.length>0&&(n=n.slice(0,-this.rl.line.length)),this.rl.setPrompt(n),this.cursorPos=this.rl.getCursorPos();let r=V();e=R(e,r),t=R(t,r),i.length%r==0&&(e+="\n");let o=e+(t?"\n"+t:""),s=Math.floor(i.length/r)-this.cursorPos.rows+(t?t.split("\n").length:0);s>0&&(o+=et(s)),o+=ei(this.cursorPos.cols),this.write(ea(this.extraLinesUnderPrompt)+er(this.height)+o),this.extraLinesUnderPrompt=s,this.height=o.split("\n").length}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(ei(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt("");let t=ea(this.extraLinesUnderPrompt);t+=e?er(this.height):"\n",t+="\x1b[?25h",this.write(t),this.rl.close()}}class es extends Promise{static withResolver(){let e,t;return{promise:new Promise((a,i)=>{e=a,t=i}),resolve:e,reject:t}}}function ep(e){let t=function(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,a)=>{let i=a.slice(1);return t=i,i},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}();return(a,i={})=>{let{input:n=process.stdin,signal:r}=i,o=new Set,s=new M;s.pipe(i.output??process.stdout);let u=L.createInterface({terminal:!0,input:n,output:s}),c=new eo(u),{promise:h,resolve:v,reject:g}=es.withResolver(),D=()=>g(new l);if(r){let e=()=>g(new p({cause:r.reason}));if(r.aborted)return e(),Object.assign(h,{cancel:D});r.addEventListener("abort",e),o.add(()=>r.removeEventListener("abort",e))}o.add(K((e,t)=>{g(new d(`User force closed the prompt with ${e} ${t}`))}));let b=()=>g(new d("User force closed the prompt with SIGINT"));u.on("SIGINT",b),o.add(()=>u.removeListener("SIGINT",b));let x=()=>c.checkCursorPos();u.input.on("keypress",x),o.add(()=>u.input.removeListener("keypress",x));let _={rl:u,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}};return f.run(_,()=>{var n;let r;return n=function(e){_.handleChange=()=>{_.index=0,e()},_.handleChange()},r=m.AsyncResource.bind(()=>y.clearAll()),u.on("close",r),o.add(()=>u.removeListener("close",r)),n(()=>{try{let i=e(a,e=>{setImmediate(()=>v(e))});if(void 0===i){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.
|
|
19
19
|
at ${e}`)}let[n,r]="string"==typeof i?[i]:i;c.render(n,r),y.run()}catch(e){g(e)}}),Object.assign(h.then(e=>(y.clearAll(),e),e=>{throw y.clearAll(),e}).finally(()=>{o.forEach(e=>e()),c.done({clearContent:!!i.clearPromptOnDone}),s.end()}).then(()=>h),{cancel:D})})}}class el{separator=x.dim(Array.from({length:15}).join(T.line));type="separator";constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&"object"==typeof e&&"type"in e&&"separator"===e.type)}}let ed={icon:{checked:x.green(T.circleFilled),unchecked:T.circle,cursor:T.pointer},style:{disabledChoice:e=>x.dim(`- ${e}`),renderSelectedChoices:e=>e.map(e=>e.short).join(", "),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always",keybindings:[]};function eu(e){return!el.isSeparator(e)&&!e.disabled}function ec(e){return eu(e)&&e.checked}function em(e){return eu(e)?{...e,checked:!e.checked}:e}let ef=ep((e,t)=>{let a,i,{instructions:n,pageSize:p=7,loop:l=!0,required:d,validate:u=()=>!0}=e,m={all:"a",invert:"i",...e.shortcuts},f=O(ed,e.theme),{keybindings:h}=f,[v,g]=D("idle"),y=N({status:v,theme:f}),[b,x]=D(e.choices.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,checkedName:e,disabled:!1,checked:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(a.description=e.description),a})),_=k(()=>{let e=b.findIndex(eu),t=b.findLastIndex(eu);if(-1===e)throw new c("[checkbox prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[b]),[w,E]=D(_.first),[F,C]=D();$(async e=>{if(s(e)){let e=b.filter(ec),a=await u([...e]);d&&!b.some(ec)?C("At least one choice must be selected"):!0===a?(g("done"),t(e.map(e=>e.value))):C(a||"You must select a valid value")}else if(r(e,h)||o(e,h)){if(l||r(e,h)&&w!==_.first||o(e,h)&&w!==_.last){let t=r(e,h)?-1:1,a=w;do a=(a+t+b.length)%b.length;while(!eu(b[a]));E(a)}}else if("space"===e.name)C(void 0),x(b.map((e,t)=>t===w?em(e):e));else if(e.name===m.all){let e=b.some(e=>eu(e)&&!e.checked);x(b.map(function(t){return eu(t)?{...t,checked:e}:t}))}else if(e.name===m.invert)x(b.map(em));else if("1234567890".includes(e.name)){let t=Number(e.name)-1,a=-1,i=b.findIndex(e=>!el.isSeparator(e)&&++a===t),n=b[i];n&&eu(n)&&(E(i),x(b.map((e,t)=>t===i?em(e):e)))}});let T=f.style.message(e.message,v),A=P({items:b,active:w,renderItem({item:e,isActive:t}){if(el.isSeparator(e))return` ${e.separator}`;if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return f.style.disabledChoice(`${e.name} ${t}`)}t&&(a=e.description);let i=e.checked?f.icon.checked:f.icon.unchecked,n=e.checked?e.checkedName:e.name,r=t?f.style.highlight:e=>e,o=t?f.icon.cursor:" ";return r(`${o}${i} ${n}`)},pageSize:p,loop:l});if("done"===v){let e=b.filter(ec);return[y,T,f.style.answer(f.style.renderSelectedChoices(e,b))].filter(Boolean).join(" ")}if("never"!==f.helpMode&&!1!==n)if("string"==typeof n)i=n;else{let e=[["↑↓","navigate"],["space","select"]];m.all&&e.push([m.all,"all"]),m.invert&&e.push([m.invert,"invert"]),e.push(["⏎","submit"]),i=f.style.keysHelpTip(e)}let S=[[y,T].filter(Boolean).join(" "),A," ",a?f.style.description(a):"",F?f.style.error(F):"",i].filter(Boolean).join("\n").trimEnd();return`${S}\u001b[?25l`});var eh=i(68023),ev=i(35317),eg=i(79896),ey=i(76760),eD=i(48161),eb=i(77598),ex=i(65679);class e_ extends Error{originalError;constructor(e){super(`Failed to create temporary file. ${e.message}`),this.originalError=e}}class ew extends Error{originalError;constructor(e){super(`Failed to launch editor. ${e.message}`),this.originalError=e}}class eE extends Error{originalError;constructor(e){super(`Failed to read temporary file. ${e.message}`),this.originalError=e}}class eF extends Error{originalError;constructor(e){super(`Failed to remove temporary file. ${e.message}`),this.originalError=e}}function eC(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}class eT{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(e="",t){this.text=e,t&&(this.fileOptions=t),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(e){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(e,void 0,this.text)}catch(t){setImmediate(e,t,void 0)}})}catch(t){setImmediate(e,t,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let e=(function(e){let t=[],a="";for(let i=0;i<e.length;i++){let n=e.charAt(i);i>0&&" "===n&&"\\"!==e[i-1]&&a.length>0?(t.push(a),a=""):a=`${a}${n}`}return a.length>0&&t.push(a),t})(process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim").map(e=>e.replace("\\ "," ")),t=e.shift();this.editor={args:e,bin:t}}createTemporaryFile(){try{let e=this.fileOptions.dir??eD.tmpdir(),t=(0,eb.randomUUID)(),a=eC(this.fileOptions.prefix),i=eC(this.fileOptions.postfix),n=`${a}${t}${i}`,r=ey.resolve(e,n),o=ey.resolve(e)+ey.sep;if(!r.startsWith(o))throw Error("Resolved temporary file escaped the base directory");this.tempFile=r;let s={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(s.mode=this.fileOptions.mode),(0,eg.writeFileSync)(this.tempFile,this.text,s)}catch(e){throw new e_(e)}}readTemporaryFile(){try{let e=(0,eg.readFileSync)(this.tempFile);if(0===e.length)this.text="";else{let t=(0,eh.detect)(e)??"utf8";ex.encodingExists(t)||(t="utf8"),this.text=ex.decode(e,t)}}catch(e){throw new eE(e)}}removeTemporaryFile(){try{(0,eg.unlinkSync)(this.tempFile)}catch(e){throw new eF(e)}}launchEditor(){try{let e=(0,ev.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=e.status??0}catch(e){throw new ew(e)}}launchEditorAsync(e){try{(0,ev.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",t=>{this.lastExitStatus=t,setImmediate(e)})}catch(e){throw new ew(e)}}}let eA={validationFailureMode:"keep"};function eS(e,t){let a=!1!==t;return/^(y|yes)/i.test(e)?a=!0:/^(n|no)/i.test(e)&&(a=!1),a}function eO(e){return e?"Yes":"No"}ep((e,t)=>{let{waitForUserInput:a=!0,file:{postfix:i=e.postfix??".txt",...n}={},validate:r=()=>!0}=e,o=O(eA,e.theme),[p,l]=D("idle"),[d="",u]=D(e.default),[c,m]=D(),f=N({status:p,theme:o});function h(a){a.pause();let s=async(i,n)=>{if(a.resume(),i)m(i.toString());else{l("loading");let a=n??"",i=await r(a);!0===i?(m(void 0),l("done"),t(a)):("clear"===o.validationFailureMode?u(e.default):u(a),m(i||"You must provide a valid value"),l("idle"))}};!function(e="",t,a){let i=new eT(e,a);i.runAsync((e,a)=>{if(e)setImmediate(t,e,void 0);else try{i.cleanup(),setImmediate(t,void 0,a)}catch(e){setImmediate(t,e,void 0)}})}(d,(e,t)=>void s(e,t),{postfix:i,...n})}b(e=>{a||h(e)},[]),$((e,t)=>{"idle"===p&&s(e)&&h(t)});let v=o.style.message(e.message,p),g="";if("loading"===p)g=o.style.help("Received");else if("idle"===p){let e=o.style.key("enter");g=o.style.help(`Press ${e} to launch your preferred editor.`)}let y="";return c&&(y=o.style.error(c)),[[f,v,g].filter(Boolean).join(" "),y]});let eN=ep((e,t)=>{let{transformer:a=eO}=e,[i,n]=D("idle"),[r,o]=D(""),p=O(e.theme),l=N({status:i,theme:p});$((p,l)=>{if("idle"===i)if(s(p)){let i=eS(r,e.default);o(a(i)),n("done"),t(i)}else if("tab"===p.name){let t=eO(!eS(r,e.default));l.clearLine(0),l.write(t),o(t)}else o(l.line)});let d=r,u="";"done"===i?d=p.style.answer(r):u=` ${p.style.defaultAnswer(!1===e.default?"y/N":"Y/n")}`;let c=p.style.message(e.message,i);return`${l} ${c}${u} ${d}`}),ek={validationFailureMode:"keep"},eI=ep((e,t)=>{let a,{prefill:i="tab"}=e,n=O(ek,e.theme),[r,o]=D("idle"),[p="",l]=D(e.default),[d,u]=D(),[c,m]=D(""),f=N({status:r,theme:n});async function h(t){let{required:a,pattern:i,patternError:n="Invalid input"}=e;return a&&!t?"You must provide a value":i&&!i.test(t)?n:"function"!=typeof e.validate||await e.validate(t)||"You must provide a valid value"}$(async(e,a)=>{if("idle"===r)if(s(e)){let e=c||p;o("loading");let i=await h(e);!0===i?(m(e),o("done"),t(e)):("clear"===n.validationFailureMode?m(""):a.write(c),u(i),o("idle"))}else"backspace"!==e.name||c?"tab"!==e.name||c?(m(a.line),u(void 0)):(l(void 0),a.clearLine(0),a.write(p),m(p)):l(void 0)}),b(e=>{"editable"===i&&p&&(e.write(p),m(p))},[]);let v=n.style.message(e.message,r),g=c;"function"==typeof e.transformer?g=e.transformer(c,{isFinal:"done"===r}):"done"===r&&(g=n.style.answer(c)),p&&"done"!==r&&!c&&(a=n.style.defaultAnswer(p));let y="";return d&&(y=n.style.error(d)),[[f,v,a,g].filter(e=>void 0!==e).join(" "),y]});function e$(e,{min:t,max:a,step:i}){return!(null==e||Number.isNaN(e))&&(e<t||e>a?`Value must be between ${t} and ${a}`:"any"===i||(1e6*e-(Number.isFinite(t)?1e6*t:0))%(1e6*i)==0||`Value must be a multiple of ${i}${Number.isFinite(t)?` starting from ${t}`:""}`)}ep((e,t)=>{let a,{validate:i=()=>!0,min:n=-1/0,max:r=1/0,step:o=1,required:p=!1}=e,l=O(e.theme),[d,u]=D("idle"),[c,m]=D(""),[f="",h]=D(!0===e$(e.default,{min:n,max:r,step:o})?e.default?.toString():void 0),[v,g]=D(),y=N({status:d,theme:l});$(async(e,a)=>{if("idle"===d)if(s(e)){let e=c||f,s=""===e?void 0:Number(e);u("loading");let l=!0;(p||null!=s)&&(l=e$(s,{min:n,max:r,step:o})),!0===l&&(l=await i(s)),!0===l?(m(String(s??"")),u("done"),t(s)):(a.write(c),g(l||"You must provide a valid numeric value"),u("idle"))}else"backspace"!==e.name||c?"tab"!==e.name||c?(m(a.line),g(void 0)):(h(void 0),a.clearLine(0),a.write(f),m(f)):h(void 0)});let b=l.style.message(e.message,d),x=c;"done"===d&&(x=l.style.answer(c)),f&&"done"!==d&&!c&&(a=l.style.defaultAnswer(f));let _="";return v&&(_=l.style.error(v)),[[y,b,a,x].filter(e=>void 0!==e).join(" "),_]});let ej={key:"h",name:"Help, list all options",value:void 0};ep((e,t)=>{let{default:a="h"}=e,i=k(()=>e.choices.map(e=>{if(el.isSeparator(e))return e;let t="name"in e?e.name:String(e.value);return{value:"value"in e?e.value:t,name:t,key:e.key.toLowerCase()}}),[e.choices]),[n,r]=D("idle"),[o,p]=D(""),[l,d]=D(e.expanded??!1),[u,c]=D(),m=O(e.theme),f=N({theme:m,status:n});$((e,n)=>{if(s(e)){let e=(o||a).toLowerCase();if("h"!==e||l){let a=i.find(t=>!el.isSeparator(t)&&t.key===e);a?(r("done"),p(e),t(a.value)):""===o?c("Please input a value"):c(`"${x.red(o)}" isn't an available option`)}else d(!0)}else p(n.line),c(void 0)});let h=m.style.message(e.message,n);if("done"===n){let e=i.find(e=>!el.isSeparator(e)&&e.key===o.toLowerCase());return`${f} ${h} ${m.style.answer(e.name)}`}let v=l?i:[...i,ej],g="",y=v.map(e=>el.isSeparator(e)?"":e.key===a?e.key.toUpperCase():e.key).join("");y=` ${m.style.defaultAnswer(y)}`,l&&(y="",g=v.map(e=>{if(el.isSeparator(e))return` ${e.separator}`;let t=` ${e.key}) ${e.name}`;return e.key===o.toLowerCase()?m.style.highlight(t):t}).join("\n"));let b="",_=i.find(e=>!el.isSeparator(e)&&e.key===o.toLowerCase());_&&(b=`${x.cyan(">>")} ${_.name}`);let w="";return u&&(w=m.style.error(u)),[`${f} ${h}${y} ${o}`,[g,b,w].filter(Boolean).join("\n")]});let eB=/\d+/;function eR(e){return null!=e&&!el.isSeparator(e)}function eV(e,t){let a,i=t.filter(eR);return!(a=i.find(t=>t.key===e))&&eB.test(e)&&(a=i[Number.parseInt(e,10)-1]),a?[a,t.indexOf(a)]:[void 0,void 0]}ep((e,t)=>{let{loop:a=!0}=e,i=k(()=>{var t;let a;return t=e.choices,a=0,t.map(e=>{if(el.isSeparator(e))return e;if(a+=1,"string"==typeof e)return{value:e,name:e,short:e,key:String(a)};let t=e.name??String(e.value);return{value:e.value,name:t,short:e.short??t,key:e.key??String(a)}})},[e.choices]),[n,p]=D("idle"),[l,d]=D(""),[u,m]=D(),f=O(e.theme),h=N({status:n,theme:f}),v=k(()=>{let e=i.findIndex(eR),t=i.findLastIndex(eR);if(-1===e)throw new c("[select prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[i]);$((e,n)=>{if(s(e)){let[e]=eV(l,i);eR(e)?(d(e.short),p("done"),t(e.value)):""===l?m("Please input a value"):m(`"${x.red(l)}" isn't an available option`)}else if(r(e)||o(e)){n.clearLine(0);let[t,s]=eV(l,i);if(t){if(a||r(e)&&s!==v.first||o(e)&&s!==v.last){let t=r(e)?-1:1,a=s;do a=(a+t+i.length)%i.length;while(!eR(i[a]));d(i[a].key)}}else d((o(e)?i.find(eR):i.findLast(eR)).key)}else d(n.line),m(void 0)});let g=f.style.message(e.message,n);if("done"===n)return`${h} ${g} ${f.style.answer(l)}`;let y=i.map(e=>{if(el.isSeparator(e))return` ${e.separator}`;let t=` ${e.key}) ${e.name}`;return e.key===l.toLowerCase()?f.style.highlight(t):t}).join("\n"),b="";return u&&(b=f.style.error(u)),[`${h} ${g} ${l}`,[y,b].filter(Boolean).join("\n")]}),ep((e,t)=>{let a,{validate:i=()=>!0}=e,n=O(e.theme),[r,o]=D("idle"),[p,l]=D(),[d,u]=D(""),c=N({status:r,theme:n});$(async(e,a)=>{if("idle"===r)if(s(e)){o("loading");let e=await i(d);!0===e?(u(d),o("done"),t(d)):(a.write(d),l(e||"You must provide a valid value"),o("idle"))}else u(a.line),l(void 0)});let m=n.style.message(e.message,r),f="";e.mask?f=("string"==typeof e.mask?e.mask:"*").repeat(d.length):"done"!==r&&(a=`${n.style.help("[input is masked]")}\u001b[?25l`),"done"===r&&(f=n.style.answer(f));let h="";return p&&(h=n.style.error(p)),[[c,m,e.mask?f:a].join(" "),h]});let eP={icon:{cursor:T.pointer},style:{disabled:e=>x.dim(`- ${e}`),searchTerm:e=>x.cyan(e),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always"};function eL(e){return!el.isSeparator(e)&&!e.disabled}ep((e,t)=>{let a,i,n,{pageSize:p=7,validate:l=()=>!0}=e,d=O(eP,e.theme),[u,c]=D("loading"),[m,f]=D(""),[h,v]=D([]),[g,y]=D(),x=N({status:u,theme:d}),_=k(()=>({first:h.findIndex(eL),last:h.findLastIndex(eL)}),[h]),[w=_.first,E]=D();b(()=>{let t=new AbortController;return c("loading"),y(void 0),(async()=>{try{let a=await e.source(m||void 0,{signal:t.signal});t.signal.aborted||(E(void 0),y(void 0),v(a.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,disabled:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(a.description=e.description),a})),c("idle"))}catch(e){!t.signal.aborted&&e instanceof Error&&y(e.message)}})(),()=>{t.abort()}},[m]);let F=h[w];$(async(e,a)=>{if(s(e))if(F){c("loading");let e=await l(F.value);c("idle"),!0===e?(c("done"),t(F.value)):F.name===m?y(e||"You must provide a valid value"):(a.write(F.name),f(F.name))}else a.write(m);else if("tab"===e.name&&F)a.clearLine(0),a.write(F.name),f(F.name);else if("loading"!==u&&(r(e)||o(e))){if(a.clearLine(0),r(e)&&w!==_.first||o(e)&&w!==_.last){let t=r(e)?-1:1,a=w;do a=(a+t+h.length)%h.length;while(!eL(h[a]));E(a)}}else f(a.line)});let C=d.style.message(e.message,u);if("never"!==d.helpMode)if(e.instructions){let{pager:t,navigation:i}=e.instructions;a=d.style.help(h.length>p?t:i)}else a=d.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]);let T=P({items:h,active:w,renderItem({item:e,isActive:t}){if(el.isSeparator(e))return` ${e.separator}`;if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return d.style.disabled(`${e.name} ${t}`)}let a=t?d.style.highlight:e=>e,i=t?d.icon.cursor:" ";return a(`${i} ${e.name}`)},pageSize:p,loop:!1});if(g?i=d.style.error(g):0===h.length&&""!==m&&"idle"===u&&(i=d.style.error("No results found")),"done"===u&&F)return[x,C,d.style.answer(F.short)].filter(Boolean).join(" ").trimEnd();n=d.style.searchTerm(m);let A=F?.description;return[[x,C,n].filter(Boolean).join(" ").trimEnd(),[i??T," ",A?d.style.description(A):"",a].filter(Boolean).join("\n").trimEnd()]});let eM={icon:{cursor:T.pointer},style:{disabled:e=>x.dim(`- ${e}`),description:e=>x.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${x.bold(e)} ${x.dim(t)}`).join(x.dim(" • "))},helpMode:"always",indexMode:"hidden",keybindings:[]};function eU(e){return!el.isSeparator(e)&&!e.disabled}ep((e,t)=>{let a,{loop:i=!0,pageSize:n=7}=e,p=O(eM,e.theme),{keybindings:l}=p,[d,u]=D("idle"),m=N({status:d,theme:p}),f=I(),h=!l.includes("vim"),v=k(()=>e.choices.map(e=>{if(el.isSeparator(e))return e;if("string"==typeof e)return{value:e,name:e,short:e,disabled:!1};let t=e.name??String(e.value),a={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(a.description=e.description),a}),[e.choices]),g=k(()=>{let e=v.findIndex(eU),t=v.findLastIndex(eU);if(-1===e)throw new c("[select prompt] No selectable choices. All choices are disabled.");return{first:e,last:t}},[v]),y=k(()=>"default"in e?v.findIndex(t=>eU(t)&&t.value===e.default):-1,[e.default,v]),[x,_]=D(-1===y?g.first:y),w=v[x];$((e,a)=>{if(clearTimeout(f.current),s(e))u("done"),t(w.value);else if(r(e,l)||o(e,l)){if(a.clearLine(0),i||r(e,l)&&x!==g.first||o(e,l)&&x!==g.last){let t=r(e,l)?-1:1,a=x;do a=(a+t+v.length)%v.length;while(!eU(v[a]));_(a)}}else if("1234567890".includes(e.name)&&!Number.isNaN(Number(a.line))){let e=Number(a.line)-1,t=-1,i=v.findIndex(a=>!el.isSeparator(a)&&++t===e),n=v[i];null!=n&&eU(n)&&_(i),f.current=setTimeout(()=>{a.clearLine(0)},700)}else if("backspace"===e.name)a.clearLine(0);else if(h){let e=a.line.toLowerCase(),t=v.findIndex(t=>!el.isSeparator(t)&&!!eU(t)&&t.name.toLowerCase().startsWith(e));-1!==t&&_(t),f.current=setTimeout(()=>{a.clearLine(0)},700)}}),b(()=>()=>{clearTimeout(f.current)},[]);let E=p.style.message(e.message,d);if("never"!==p.helpMode)if(e.instructions){let{pager:t,navigation:i}=e.instructions;a=p.style.help(v.length>n?t:i)}else a=p.style.keysHelpTip([["↑↓","navigate"],["⏎","select"]]);let F=0,C=P({items:v,active:x,renderItem({item:e,isActive:t,index:a}){if(el.isSeparator(e))return F++,` ${e.separator}`;let i="number"===p.indexMode?`${a+1-F}. `:"";if(e.disabled){let t="string"==typeof e.disabled?e.disabled:"(disabled)";return p.style.disabled(`${i}${e.name} ${t}`)}let n=t?p.style.highlight:e=>e,r=t?p.icon.cursor:" ";return n(`${r} ${i}${e.name}`)},pageSize:n,loop:i});if("done"===d)return[m,E,p.style.answer(w.short)].filter(Boolean).join(" ");let{description:T}=w,A=[[m,E].filter(Boolean).join(" "),C," ",T?p.style.description(T):"",a].filter(Boolean).join("\n").trimEnd();return`${A}\u001b[?25l`})},31088(e,t,a){function i(){}a.d(t,{C:()=>n});class n{constructor(e=1/0,t=i){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){let t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){let t=this.map.get(e);if(t&&t!==this.newest){let{older:e,newer:a}=t;a&&(a.older=e),e&&(e.newer=a),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=a)}return t}set(e,t){let a=this.getNode(e);return a?a.value=t:(a={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=a),this.newest=a,this.oldest=this.oldest||a,this.map.set(e,a),a.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){let t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}}},54019(e,t,a){function i(){}a.d(t,{l:()=>s});let n="u">typeof WeakRef?WeakRef:function(e){return{deref:()=>e}},r="u">typeof WeakMap?WeakMap:Map,o="u">typeof FinalizationRegistry?FinalizationRegistry:function(){return{register:i,unregister:i}};class s{constructor(e=1/0,t=i){this.max=e,this.dispose=t,this.map=new r,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{let e=this.unfinalizedNodes.values();for(let t=0;t<10024;t++){let t=e.next().value;if(!t)break;this.unfinalizedNodes.delete(t);let a=t.key;delete t.key,t.keyRef=new n(a),this.registry.register(a,t,t)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new o(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){let t=this.getNode(e);return t&&t.value}getNode(e){let t=this.map.get(e);if(t&&t!==this.newest){let{older:e,newer:a}=t;a&&(a.older=e),e&&(e.newer=a),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=a)}return t}set(e,t){let a=this.getNode(e);return a?a.value=t:(a={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=a),this.newest=a,this.oldest=this.oldest||a,this.scheduleFinalization(a),this.map.set(e,a),this.size++,a.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;let t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){let t=this.map.get(e);return!!t&&(this.deleteNode(t),!0)}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}},55888(e,t,a){a.r(t),a.d(t,{default:()=>p,equal:()=>s});let{toString:i,hasOwnProperty:n}=Object.prototype,r=Function.prototype.toString,o=new Map;function s(e,t){try{return function e(t,a){if(t===a)return!0;let o=i.call(t);if(o!==i.call(a))return!1;switch(o){case"[object Array]":if(t.length!==a.length)break;case"[object Object]":{if(c(t,a))return!0;let i=l(t),r=l(a),o=i.length;if(o!==r.length)return!1;for(let e=0;e<o;++e)if(!n.call(a,i[e]))return!1;for(let n=0;n<o;++n){let r=i[n];if(!e(t[r],a[r]))return!1}return!0}case"[object Error]":return t.name===a.name&&t.message===a.message;case"[object Number]":if(t!=t)return a!=a;case"[object Boolean]":case"[object Date]":return+t==+a;case"[object RegExp]":case"[object String]":return t==`${a}`;case"[object Map]":case"[object Set]":{if(t.size!==a.size)return!1;if(c(t,a))return!0;let i=t.entries(),n="[object Map]"===o;for(;;){let t=i.next();if(t.done)break;let[r,o]=t.value;if(!a.has(r)||n&&!e(o,a.get(r)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),a=new Uint8Array(a);case"[object DataView]":{let e=t.byteLength;if(e===a.byteLength)for(;e--&&t[e]===a[e];);return -1===e}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{var s,p;let e,i=r.call(t);if(i!==r.call(a))return!1;return s=i,p=u,!((e=s.length-p.length)>=0)||s.indexOf(p,e)!==e}}return!1}(e,t)}finally{o.clear()}}let p=s;function l(e){return Object.keys(e).filter(d,e)}function d(e){return void 0!==this[e]}let u="{ [native code] }";function c(e,t){let a=o.get(e);if(a){if(a.has(t))return!0}else o.set(e,a=new Set);return a.add(t),!1}},44592(e,t,a){a.r(t),a.d(t,{Trie:()=>s});let i=()=>Object.create(null),{forEach:n,slice:r}=Array.prototype,{hasOwnProperty:o}=Object.prototype;class s{constructor(e=!0,t=i){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return n.call(e,e=>t=t.getChildTrie(e)),o.call(t,"data")?t.data:t.data=this.makeData(r.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let a=0,i=e.length;t&&a<i;++a){let i=t.mapFor(e[a],!1);t=i&&i.get(e[a])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){let a=e[0],i=this.mapFor(a,!1),n=i&&i.get(a);n&&(t=n.removeArray(r.call(e,1)),n.data||n.weak||n.strong&&n.strong.size||i.delete(a))}else t=this.data,delete this.data;return t}getChildTrie(e){let t=this.mapFor(e,!0),a=t.get(e);return a||t.set(e,a=new s(this.weakness,this.makeData)),a}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}},98247(e,t,a){a.d(t,{v:()=>D});var i,n,r,o=a(99436),s=a(35679),p=a(73284),l=a(30155),d=a(23258),u=a(92642),c=a(94979),m=a(16928),f=a(79896);function h(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(h=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var a=this.s.return;return void 0===a?Promise.resolve({value:e,done:!0}):t(a.apply(this.s,arguments))},throw:function(e){var a=this.s.return;return void 0===a?Promise.reject(e):t(a.apply(this.s,arguments))}},new h(e)}var v=()=>{var e=(0,d.getCurrentProfile)(),t=(0,d.getToken)(e);return t||(console.error(p.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,u.W)((0,d.getActivityLogBaseUrl)(),t)},g=e=>new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z"),y=(e,t)=>{if(!e)return"";var a="string"==typeof e?e:JSON.stringify(e);return a.length>t?a.slice(0,t-1)+"…":a},D=new s.uB("activity-log").alias("al").description("Activity log queries (read-only)");D.command("events").description("Query activity log events (all types)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("--device <id>","Filter by device ID").option("--type <type>","Filter by event type: general, data, local_sync").option("--event-name <name>","Filter by event name").option("--subspace <id>","Filter by subspace ID").option("--sender <id>","Filter by sender").option("--limit <n>","Max events to display",parseInt).option("-j, --json","Output as JSON array").option("--jsonl","Output as JSONL (one JSON per line)").action((i=o(function*(e){var t=v(),a=(o=(0,c.p)(e.startTime),new Date(s=e.endTime?(0,c.p)(e.endTime):new Date().toISOString())-new Date(o)>2592e6&&(console.error(p.Ay.red("Time range must be 30 days or less")),process.exit(1)),d={start_time:o,end_time:s},e.device&&(d.device_id=e.device),e.type&&(d.event_type=e.type),e.eventName&&(d.event_name=e.eventName),e.subspace&&(d.subspace_id=e.subspace),e.sender&&(d.sender=e.sender),d);if(e.jsonl){var i=0;try{var n=!1,r=!1;try{for(var o,s,d,u,m,f=function(e){var t,a,i,n=2;for("u">typeof Symbol&&(a=Symbol.asyncIterator,i=Symbol.iterator);n--;){if(a&&null!=(t=e[a]))return t.call(e);if(i&&null!=(t=e[i]))return new h(t.call(e));a="@@asyncIterator",i="@@iterator"}throw TypeError("Object is not async iterable")}(t.events(a));n=!(m=yield f.next()).done;n=!1){var D=m.value;if(console.log(JSON.stringify(D)),i++,e.limit&&i>=e.limit)break}}catch(e){r=!0,u=e}finally{try{n&&null!=f.return&&(yield f.return())}finally{if(r)throw u}}}catch(e){console.error(p.Ay.red(`Failed to query events: ${e.message}`)),process.exit(1)}return}var b=(0,l.default)("Querying events...").start();try{var x=yield t.collectEvents(a,{limit:e.limit});if(b.stop(),e.json)return void console.log(JSON.stringify(x,null,2));if(0===x.length)return void console.log(p.Ay.yellow("No events found"));for(var _ of(console.log(p.Ay.bold(`
|
|
20
20
|
Activity Log Events (${x.length})`)),console.log("─".repeat(100)),console.log(p.Ay.gray(`${"Timestamp".padEnd(24)} ${"Type".padEnd(12)} ${"Device".padEnd(14)} ${"Event Name".padEnd(28)} ${"Sender".padEnd(16)} Payload`)),console.log("─".repeat(100)),x)){var w=g(_.timestamp),E=(_.event_type||"").padEnd(12),F=y(_.device_id,14).padEnd(14),C=y(_.event_name,28).padEnd(28),T=y(_.sender,16).padEnd(16),A=y(_.payload,40);console.log(`${w} ${E} ${F} ${C} ${T} ${p.Ay.gray(A)}`)}console.log("─".repeat(100))}catch(e){b.fail(`Failed to query events: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),D.command("screenshots").description("List screenshot timestamps for a device").requiredOption("--device <id>","Device ID (required)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("-j, --json","Output as JSON").action((n=o(function*(e){var t=v(),a=(0,c.p)(e.startTime),i=e.endTime?(0,c.p)(e.endTime):new Date().toISOString();new Date(i)-new Date(a)>2592e6&&(console.error(p.Ay.red("Time range must be 30 days or less")),process.exit(1));var n={device_id:e.device,start_time:a,end_time:i},r=(0,l.default)("Querying screenshots...").start();try{var o=yield t.collectScreenshots(n);if(r.stop(),e.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(p.Ay.yellow("No screenshots found"));console.log(p.Ay.bold(`
|
|
21
|
-
Screenshots (${o.length})`)),console.log("─".repeat(40)),console.log(p.Ay.gray(`${"#".padStart(4)} Timestamp`)),console.log("─".repeat(40)),o.forEach((e,t)=>{console.log(`${String(t+1).padStart(4)} ${g(e.timestamp)}`)}),console.log("─".repeat(40))}catch(e){r.fail(`Failed to query screenshots: ${e.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),D.command("screenshot").description("Download a screenshot image").requiredOption("--device <id>","Device ID").requiredOption("--ts <timestamp>","Screenshot timestamp (ISO 8601 or epoch ms)").option("--space <id>","Workspace/space ID (auto-detected from profile)").option("-o, --output <path>","Output file path").option("--open","Open with OS default viewer after download").action((r=o(function*(e){var t,i,n=v(),r=e.space||(t=(0,d.getCurrentProfile)(),i=(0,d.getTokenInfo)(t),i?.workspaceId);r||(console.error(p.Ay.red("Could not determine workspace ID. Use --space <id> or log in first.")),process.exit(1));var o=/^\d+$/.test(e.ts)?e.ts:new Date(e.ts).getTime(),s=(0,l.default)("Downloading screenshot...").start();try{var u=yield n.downloadScreenshot(r,e.device,o);s.stop();var c=e.output||`screenshot-${e.device}-${o}.jpg`,h=m.resolve(c);f.writeFileSync(h,u);var g=(u.length/1024).toFixed(1);if(console.log(p.Ay.green(`✓ Screenshot saved: ${h} (${g} KB)`)),e.open){var y=(yield Promise.resolve().then(a.t.bind(a,35317,19))).exec,D="darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open";y(`${D} "${h}"`)}}catch(e){s.fail(`Failed to download screenshot: ${e.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},17422(e,t,a){a.d(t,{B:()=>
|
|
22
|
-
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
${
|
|
21
|
+
Screenshots (${o.length})`)),console.log("─".repeat(40)),console.log(p.Ay.gray(`${"#".padStart(4)} Timestamp`)),console.log("─".repeat(40)),o.forEach((e,t)=>{console.log(`${String(t+1).padStart(4)} ${g(e.timestamp)}`)}),console.log("─".repeat(40))}catch(e){r.fail(`Failed to query screenshots: ${e.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),D.command("screenshot").description("Download a screenshot image").requiredOption("--device <id>","Device ID").requiredOption("--ts <timestamp>","Screenshot timestamp (ISO 8601 or epoch ms)").option("--space <id>","Workspace/space ID (auto-detected from profile)").option("-o, --output <path>","Output file path").option("--open","Open with OS default viewer after download").action((r=o(function*(e){var t,i,n=v(),r=e.space||(t=(0,d.getCurrentProfile)(),i=(0,d.getTokenInfo)(t),i?.workspaceId);r||(console.error(p.Ay.red("Could not determine workspace ID. Use --space <id> or log in first.")),process.exit(1));var o=/^\d+$/.test(e.ts)?e.ts:new Date(e.ts).getTime(),s=(0,l.default)("Downloading screenshot...").start();try{var u=yield n.downloadScreenshot(r,e.device,o);s.stop();var c=e.output||`screenshot-${e.device}-${o}.jpg`,h=m.resolve(c);f.writeFileSync(h,u);var g=(u.length/1024).toFixed(1);if(console.log(p.Ay.green(`✓ Screenshot saved: ${h} (${g} KB)`)),e.open){var y=(yield Promise.resolve().then(a.t.bind(a,35317,19))).exec,D="darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open";y(`${D} "${h}"`)}}catch(e){s.fail(`Failed to download screenshot: ${e.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},17422(e,t,a){a.d(t,{B:()=>N});var i,n,r,o,s,p,l,d,u,c,m,f,h,v,g,y=a(99436),D=a(35679),b=a(73284),x=a(30155),_=a(79896),w=a(44618),E=a(7586),F=a(56493),C=a(68168),T=a(74049),A=a(23258),S=a(98593),O=(e,t)=>({id:e?._id||t,name:e?.name||"Unnamed",currentVersion:e?.current_version||null,unreleasedChanges:!!e?.has_unreleased_changes}),N=new D.uB("app").description("Application management");N.command("new").description("Create a new application").requiredOption("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--example <key>","Create from example template").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((i=y(function*(e){var t=(0,F.o)(),i=e.json?null:(0,x.default)("Creating application...").start();try{var n={name:e.name};e.description&&(n.description=e.description),e.layoutWidth&&(n.layoutWidth=e.layoutWidth),e.layoutHeight&&(n.layoutHeight=e.layoutHeight),e.example&&(n.createExampleKey=e.example);var r=yield t.createApplication(n);if(e.json&&!e.init?console.log(JSON.stringify(r,null,2)):!e.json&&(i.succeed(`Application created: ${b.Ay.green(r.name)}`),console.log(` ID: ${b.Ay.gray(r._id)}`),r.description&&console.log(` ${b.Ay.gray(r.description)}`)),e.init){i&&i.stop();var o=(yield a.e(602).then(a.bind(a,6553))).initProject;yield o("application",r._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):i.fail(`Failed to create application: ${t.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),N.command("share-info <applicationId>").description("Show public share info (releases available for share-new) for an application").option("-j, --json","Output as JSON").action((n=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Fetching share info...").start();try{var n=yield a.publicApplicationShareInfo({id:e});if(i&&i.stop(),!n)return void(t.json?console.log(JSON.stringify(null)):console.log(b.Ay.yellow("No share info found for this application")));if(t.json)return void console.log(JSON.stringify(n,null,2));var r=[...n.share?.selected_releases||[]].sort((e,t)=>new Date(t.date||0)-new Date(e.date||0));console.log(b.Ay.bold(`
|
|
22
|
+
Share Info: ${n.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`App ID: ${b.Ay.gray(n._id)}`),n.description&&console.log(`Description: ${n.description}`),n.owner?.id_from_user&&console.log(`Owner: ${b.Ay.gray(n.owner.id_from_user)}`),n.share?.tags?.length&&console.log(`Tags: ${n.share.tags.join(", ")}`),n.share?.type&&console.log(`Type: ${n.share.type}`),console.log(`
|
|
23
|
+
${b.Ay.bold("Selected Releases")} (${r.length})`),0===r.length?console.log(b.Ay.gray(" None")):r.forEach(e=>{console.log(`
|
|
24
|
+
${b.Ay.cyan(e.name||"(unnamed)")} ${b.Ay.gray(e.date||"")}`),console.log(` Version ID: ${b.Ay.green(e.version)}`),console.log(` Release ID: ${b.Ay.gray(e._id)}`),e.note&&console.log(` Note: ${b.Ay.gray(e.note)}`)}),console.log("\n"+"─".repeat(60)),console.log(b.Ay.gray("Use:"),`bricks app share-new --app-id ${n._id} --version <name>`),console.log(b.Ay.gray("Or: "),"bricks app share-new --version-id <Version ID>")}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to fetch share info: ${e.message}`),process.exit(1)}}),function(e,t){return n.apply(this,arguments)})),N.command("share-new").description("Create a new application from a shared release version").option("--app-id <id>","Source shared application ID (requires --version)").option("--version <name>","Release name to use from the source app (requires --app-id)").option("--version-id <id>","Share version ID (from `app share-info`); skips lookup").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-w, --workspace-id <id>","Target workspace ID (default: current profile workspace)").option("--skip-if-exists","Return existing application if one already exists with this share version").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((r=y(function*(e){var t=(0,F.o)(),i=e.json?null:(0,x.default)("Creating application from shared version...").start();try{if(!e.versionId&&!(e.appId&&e.version))throw Error("Provide --version-id, or both --app-id and --version. Run `bricks app share-info <appId>` to discover values.");var n=e.workspaceId||(0,A.getTokenInfo)((0,A.getCurrentProfile)())?.workspaceId;if(!n)throw Error("Workspace ID is required. Use --workspace-id or log in again.");var r=e.versionId;if(!r){i&&(i.text="Resolving share version...");var o=yield t.publicApplicationShareInfo({id:e.appId}),s=o?.share?.selected_releases||[],p=s.find(t=>t.name===e.version);if(!p){var l=s.map(e=>e.name).filter(Boolean).join(", ")||"none";throw Error(`Release "${e.version}" not found on app ${e.appId}. Available: ${l}`)}r=p.version,i&&(i.text="Creating application from shared version...")}var d={workspaceId:n,shareVersionId:r};e.name&&(d.name=e.name),e.description&&(d.description=e.description),e.skipIfExists&&(d.skipIfExists=!0);var u=yield t.createApplicationWithShareVersion(d);if(e.json&&!e.init?console.log(JSON.stringify(u,null,2)):!e.json&&(i.succeed(`Application created: ${b.Ay.green(u.name)}`),console.log(` ID: ${b.Ay.gray(u._id)}`),u.description&&console.log(` ${b.Ay.gray(u.description)}`)),e.init){i&&i.stop();var c=(yield a.e(602).then(a.bind(a,6553))).initProject;yield c("application",u._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):i.fail(`Failed to create application from shared version: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)})),N.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((o=y(function*(e){var t=(0,F.o)(),a=(0,x.default)("Fetching applications...").start();try{var i=yield t.applications({keyword:e.keyword});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(b.Ay.yellow("No applications found"));console.log(b.Ay.bold("\nApplications")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.has_unreleased_changes?b.Ay.yellow("●"):b.Ay.green("●"),a=e.current_version?`v${e.current_version}`:b.Ay.gray("no version");console.log(`${t} ${b.Ay.cyan(e.name)} ${b.Ay.gray(a)}`),console.log(` ID: ${b.Ay.gray(e._id)}`),e.description&&console.log(` ${b.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list applications: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),N.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action((s=y(function*(e,t){var a=(0,F.o)(),i=(0,x.default)("Fetching application...").start();try{var n=yield a.application({id:e,composed:t.composed});if(i.stop(),n||(console.log(b.Ay.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(b.Ay.bold(`
|
|
25
|
+
Application: ${n.name}`)),console.log("─".repeat(60)),console.log(`ID: ${b.Ay.gray(n._id)}`),console.log(`Description: ${n.description||b.Ay.gray("N/A")}`),console.log(`Tags: ${n.tags?.join(", ")||b.Ay.gray("None")}`),console.log(`Created: ${b.Ay.gray(n.create_datetime)}`),console.log(`Modified: ${b.Ay.gray(n.last_modify_datetime)}`),console.log(`
|
|
26
|
+
${b.Ay.bold("Version")}`),n.current_version){if(console.log(`Current: v${n.current_version}`),n.current_version_details){var r=n.current_version_details;r.name&&console.log(`Release Name: ${r.name}`),r.note&&console.log(`Release Note: ${b.Ay.gray(r.note)}`),r.create_datetime&&console.log(`Released At: ${b.Ay.gray(r.create_datetime)}`)}}else console.log(`Current: ${b.Ay.gray("No version")}`);if(console.log(`Unreleased: ${n.has_unreleased_changes?b.Ay.yellow("Yes"):b.Ay.green("No")}`),console.log(`
|
|
27
|
+
${b.Ay.bold("Features")}`),console.log(`Short Edit: ${n.short_edit?.enabled?b.Ay.green("Enabled"):b.Ay.gray("Disabled")}`),n.short_edit?.enabled&&n.short_edit.ref_map){var o=Object.keys(n.short_edit.ref_map).length;console.log(` References: ${o} editable properties`)}console.log(`Automation: ${n.canvas_control?.enable_schedule?b.Ay.green("Scheduled"):b.Ay.gray("No schedule")}`),n.lock?.locked&&console.log(`Locked: ${b.Ay.yellow("Yes")} (at ${n.lock.locked_at||"N/A"})`),n.sync_key&&console.log(`Sync Key: ${b.Ay.gray(n.sync_key)}`),n.devices?.length>0?(console.log(`
|
|
28
|
+
${b.Ay.bold("Bound Devices")} (${n.devices.length})`),n.devices.forEach(e=>{var t="active"===e.status?b.Ay.green("●"):b.Ay.gray("○"),a=e.frame?b.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(`
|
|
29
|
+
${b.Ay.bold("Bound Devices")}: ${b.Ay.gray("None")}`),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get application: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),N.command("resolve <query>").description("Resolve an application name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((p=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Resolving application...").start();try{var n=yield(0,C.Y)(()=>a.application({id:e})),r=n?[n]:yield a.applications({keyword:e,paginate:{limit:t.limit}}),o=(0,C.K)({resource:"application",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,E.GF)(o);if(o.resolved){var s=o.resolved;console.log(b.Ay.bold("\nResolved Application")),console.log("─".repeat(60)),console.log(`Name: ${b.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${b.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(b.Ay.yellow(`No applications matched "${e}"`));console.log(b.Ay.bold(`
|
|
30
|
+
Matching Applications (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${b.Ay.cyan(e.name||"Unnamed")} ${b.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve application: ${t.message}`):(0,E.OW)(t.message,{resource:"application",query:e}),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),N.command("update <id>").description("Update application name, description, and/or configuration").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 (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((l=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Updating application...").start();try{var n={id:e};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.config?n.config=t.config:t.file&&(n.config=_.readFileSync(t.file,"utf-8")),void 0!==n.config&&(n.validateConfig=!1!==t.validate),t.lastCommitId&&(n.lastCommitId=t.lastCommitId);var r=yield a.updateApplication(n);t.json?(0,S.yd)({action:"application.update",target:O(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Application updated: ${b.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(b.Ay.yellow("Note: Application has unreleased changes")))}catch(a){t.json?(0,E.OW)(a.message,{action:"application.update",target:{id:e}}):i.fail(`Failed to update application: ${a.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),N.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((d=y(function*(e,t){var a=(0,F.o)(),i=(0,x.default)("Applying short edit...").start();try{var n=JSON.parse(t.list);Array.isArray(n)||(i.fail("List must be a JSON array"),process.exit(1));var r=yield a.shortEditApplication({id:e,list:n});i.succeed(`Short edit applied to: ${b.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),N.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((u=y(function*(e,t){var a=(0,F.o)(),i=(0,x.default)("Fetching short edit references...").start();try{var n=yield a.application({id:e});if(i.stop(),!n?.short_edit?.enabled)return void console.log(b.Ay.yellow("Short Edit is not enabled for this application"));var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,w.V)(n.short_edit.ref_map,{keyword:t.keyword,types:r});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(b.Ay.yellow("No short edit references found"));console.log(b.Ay.bold(`
|
|
31
|
+
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(b.Ay.cyan(`
|
|
32
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?b.Ay.gray(`- ${t.title}`):"";console.log(` ${b.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),N.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)").option("--dry-run","Validate inputs and show the binding plan without applying it").option("-j, --json","Output as JSON").action((c=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Updating device bindings...").start();try{var n=yield a.application({id:e});if(!n)throw Error("Application not found");var r=t.bind?t.bind.split(",").map(e=>e.trim()):[],o=t.unbind?t.unbind.split(",").map(e=>e.trim()):[],s={id:e};if(r.length>0&&(s.bindDevices=r),o.length>0&&(s.unbindDevices=o),t.dryRun){i&&i.stop(),(0,S.S5)({action:"application.bind",target:O(n,e),request:{bindDevices:r,unbindDevices:o},checks:[(0,S.Iy)("application exists",!0,`${n.name} (${n._id})`),(0,S.Iy)("device changes provided",r.length+o.length>0,`bind=${r.length}, unbind=${o.length}`)],json:t.json});return}yield a.bindApplication(s),t.json?(0,S.yd)({action:"application.bind",target:O(n,e),result:{bindDevices:r,unbindDevices:o},json:!0}):i.succeed("Device bindings updated")}catch(a){t.json?(0,E.OW)(a.message,{action:"application.bind",target:{id:e}}):i.fail(`Failed to update bindings: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),N.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((m=y(function*(e,t,a){var i=(0,F.o)(),n=(0,x.default)("Triggering automation...").start();try{yield i.triggerApplicationCanvasControl({id:e,testId:t,play:!a.stop&&a.play,setupAtLaunch:a.setupAtLaunch,matchGroup:a.matchGroup}),n.succeed(`Automation triggered: ${b.Ay.green(t)}`)}catch(e){n.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,a){return m.apply(this,arguments)})),N.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((f=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Releasing application...").start();try{var n=(0,T.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.application({id:e});if(!p)throw Error("Application not found");if(p.lock?.enabled)throw Error("Application is locked");var l=t.version||t.name||p.name||"Untitled",d=(0,T.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"application.release",target:O(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,S.Iy)("application exists",!0,`${p.name} (${p._id})`),(0,S.Iy)("application is unlocked",!p.lock?.enabled),(0,S.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseApplication({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,S.yd)({action:"application.release",target:O(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Application released: ${b.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"application.release",target:{id:e}}):i.fail(`Failed to release application: ${a.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),N.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((h=y(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,x.default)("Pulling application project...").start();try{var n=yield a.applicationProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Application project fetched: ${b.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),N.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").action((v=y(function*(e,t){_.existsSync(e)||(console.error(b.Ay.red(`Config file not found: ${e}`)),process.exit(1));var i=(0,x.default)("Validating config...").start();try{var n=_.readFileSync(e,"utf-8"),r=JSON.parse(n),o=yield Promise.all([a.e(587),a.e(10),a.e(511)]).then(a.t.bind(a,38890,19)),s=o.checkConfig,p=o.checkConfigDeprecatedFeatures,l=s(r),d=p(r);if(i.stop(),t.json){console.log(JSON.stringify({...l,deprecations:d},null,2)),l.valid||process.exit(1);return}if(l.valid&&0===d.length)return void console.log(b.Ay.green("✓ Config is valid"));console.log(b.Ay.bold("\nConfig Validation Report")),console.log("─".repeat(60)),l.schema.length>0&&(console.log(b.Ay.red(`
|
|
30
33
|
Schema Errors (${l.schema.length})
|
|
31
|
-
`)),l.schema.forEach((e,t)=>{var a=e.instancePath||e.dataPath||"/";console.log(` ${
|
|
34
|
+
`)),l.schema.forEach((e,t)=>{var a=e.instancePath||e.dataPath||"/";console.log(` ${b.Ay.red(`${t+1}.`)} ${b.Ay.bold(a)}`),console.log(` ${e.message}`),e.params?.pattern&&console.log(` ${b.Ay.gray(`pattern: ${e.params.pattern}`)}`)})),l.ref.length>0&&(console.log(b.Ay.red(`
|
|
32
35
|
Reference Errors (${l.ref.length})
|
|
33
|
-
`)),l.ref.forEach((e,t)=>{console.log(` ${
|
|
36
|
+
`)),l.ref.forEach((e,t)=>{console.log(` ${b.Ay.red(`${t+1}.`)} ${b.Ay.bold(e.field)}`),console.log(` ${e.message}`)})),d.length>0&&(console.log(b.Ay.yellow(`
|
|
34
37
|
Deprecation Warnings (${d.length})
|
|
35
|
-
`)),d.forEach((e,t)=>{console.log(` ${y.Ay.yellow(`${t+1}.`)} ${y.Ay.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var u=l.schema.length+l.ref.length;l.valid?console.log(y.Ay.yellow(`⚠ ${d.length} warning(s)`)):console.log(y.Ay.red(`✗ ${u} error(s)`)+(d.length>0?y.Ay.yellow(`, ${d.length} warning(s)`):"")),l.valid||process.exit(1)}catch(e){i.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").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((h=v(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("application",e,t)}),function(e,t){return h.apply(this,arguments)}))},55614(e,a,i){i.d(a,{s:()=>y});var n,r,o,s,p,l=i(99436),d=i(35679),u=i(73284),c=i(30155);let m=t("readline");var f=i(23258),h=i(85382),v=i(7586),g=(n=l(function*(){var e=(0,f.getCurrentProfile)(),t=(0,f.getCurrentProfileSource)(),a=(0,f.getTokenInfo)(e),i=(0,f.getBaseUrl)();if(!a?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var n=(0,h.createClient)(i,a.token),r=yield n.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:r?._id||a.workspaceId||null,workspaceName:r?.name||a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:r?{_id:r._id,name:r.name,description:r.description||null}:null,error:null}}catch(n){return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:a.workspaceId||null,workspaceName:a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:null,error:{message:n.message}}}}),function(){return n.apply(this,arguments)}),y=new d.uB("auth").description("Authentication and token management");y.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((r=l(function*(e,t){var a,i=t.profile||(0,f.getCurrentProfile)(),n=t.name,r=e;!r&&(console.log(u.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(u.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(r=yield(a=m.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{a.question("Enter passcode: ",t=>{a.close(),e(t.trim())})})))||(console.log(u.Ay.red("Passcode is required")),process.exit(1)));var o=(0,c.default)("Validating passcode...").start();try{var s=(0,h.createPublicClient)((0,f.getBaseUrl)()),p=yield s.checkWorkspaceOTP(r);p.valid||(o.fail(`Invalid passcode: ${p.error||"Unknown error"}`),process.exit(1)),o.text=`Exchanging passcode for token (workspace: ${p.workspaceName})...`;var l=yield s.exchangeWorkspaceOTP(r);l.token||(o.fail("Failed to obtain token"),process.exit(1));var d=(0,h.createClient)((0,f.getBaseUrl)(),l.token),v=yield d.workspace();v||(o.fail("Token validation failed"),process.exit(1)),(0,f.setToken)(i,{token:l.token,name:n||v.name,workspaceId:v._id,workspaceName:v.name}),(0,f.setCurrentProfile)(i),o.succeed(`Logged in to workspace: ${u.Ay.green(v.name)} (profile: ${u.Ay.cyan(i)})`)}catch(e){o.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),y.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((o=l(function*(e){var t=e.profile||(0,f.getCurrentProfile)(),a=e.token,i=e.name;a||(console.error(u.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(u.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray("Select your workspace and create a new token.\n")),console.log(u.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var n=(0,c.default)("Validating token...").start();try{var r=(0,h.createClient)((0,f.getBaseUrl)(),a),o=yield r.workspace();o||(n.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,f.setToken)(t,{token:a,name:i||o.name,workspaceId:o._id,workspaceName:o.name}),(0,f.setCurrentProfile)(t),n.succeed(`Logged in to workspace: ${u.Ay.green(o.name)} (profile: ${u.Ay.cyan(t)})`)}catch(e){n.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),y.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((s=l(function*(e){var t=e.profile;if(e.all){(0,f.listProfiles)().forEach(e=>(0,f.removeToken)(e.name)),console.log(u.Ay.green("All profiles removed"));return}var a=t||(0,f.getCurrentProfile)();(0,f.getTokenInfo)(a)?((0,f.removeToken)(a),console.log(u.Ay.green(`Logged out from profile: ${a}`))):console.log(u.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return s.apply(this,arguments)})),y.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((p=l(function*(e){var t=(0,f.getCurrentProfile)(),a=(0,f.getTokenInfo)(t);if(!a)return e.json?void(0,v.GF)((yield g())):(console.log(u.Ay.yellow("Not logged in")),void console.log(u.Ay.gray("Use `bricks auth login` to login")));if(e.json)return void(0,v.GF)((yield g()));var i=(0,c.default)("Checking connection...").start();try{var n=(0,h.createClient)((0,f.getBaseUrl)(),a.token),r=yield n.workspace();i.stop(),console.log(u.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${u.Ay.cyan(t)}`),console.log(`Workspace: ${u.Ay.green(r.name)}`),console.log(`Workspace ID: ${u.Ay.gray(r._id)}`);var o=(0,f.getBaseUrl)(),s=a.baseUrl;console.log(`Base URL: ${u.Ay.gray(o)}${s?"":u.Ay.gray(" (global)")}`),console.log(`Logged in: ${u.Ay.gray(a.createdAt)}`),console.log("─".repeat(40))}catch(e){i.fail(`Connection failed: ${e.message}`)}}),function(e){return p.apply(this,arguments)})),y.command("list").description("List all saved profiles").action(()=>{var e=(0,f.listProfiles)();if(0===e.length){console.log(u.Ay.yellow("No saved profiles")),console.log(u.Ay.gray("Use `bricks auth login` to login"));return}console.log(u.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?u.Ay.green("● "):" ",a=e.current?u.Ay.green(e.name):e.name,i=e.baseUrl?u.Ay.gray(` [${e.baseUrl}]`):"";console.log(`${t}${a.padEnd(15)} ${u.Ay.gray(e.workspaceName||"Unknown")}${i}`)}),console.log("─".repeat(60))}),y.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,f.getTokenInfo)(e);if(!t){console.log(u.Ay.red(`Profile not found: ${e}`)),console.log(u.Ay.gray("Use `bricks auth list` to see available profiles"));return}(0,f.setCurrentProfile)(e),console.log(u.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(u.Ay.gray(`Workspace: ${t.workspaceName}`))}),y.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,f.setBaseUrl)(e),console.log(u.Ay.green(`Global base URL set to: ${e}`));else{var a=(0,f.getCurrentProfile)();(0,f.setBaseUrl)(e,a),console.log(u.Ay.green(`Base URL for profile ${u.Ay.cyan(a)} set to: ${e}`))}})},59845(e,t,a){a.d(t,{Q:()=>I});var i,n,r,o,s,p,l,d,u,c,m,f=a(99436),h=a(35679),v=a(73284),g=a(77598),y=a(48161),D=a(76760),b=a(51455),x=a(27549),_=a(41314),w=8089,E=(i=f(function*(e,t,a=3e3){var i;try{var n=new AbortController;i=setTimeout(()=>n.abort(),a);var r=yield fetch(`http://${e}:${t}/buttress/info`,{signal:n.signal});if(!r.ok)return null;return yield r.json()}catch{return null}finally{void 0!==i&&clearTimeout(i)}}),function(e,t){return i.apply(this,arguments)}),F=D.join(y.homedir(),".bricks-cli","buttress"),C=e=>D.join(e||F,"state.json"),T=()=>{try{return`buttress-${x.machineIdSync()}`}catch{return null}},A=(n=f(function*(e){var t=C(e);try{var a=yield b.readFile(t,"utf8");return JSON.parse(a)}catch(e){if("ENOENT"===e.code)return null;throw e}}),function(e){return n.apply(this,arguments)}),S=(r=f(function*(e,t){var a=t||F,i=C(t);yield b.mkdir(a,{recursive:!0});var n=`${i}.tmp-${process.pid}`;return yield b.writeFile(n,JSON.stringify(e,null,2),"utf8"),yield b.rename(n,i),i}),function(e,t){return r.apply(this,arguments)}),O=(o=f(function*(e){var t=C(e);try{return yield b.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return o.apply(this,arguments)}),N=(s=f(function*({timeout:e=3e3,verify:t=!0,port:a=w,onStatus:i}={}){i?.(`Scanning UDP ${a} for ${e}ms...`);var n,r=yield(({timeout:e=3e3,idleTimeout:t=0,port:a=w}={})=>new Promise((i,n)=>{var r=new Map,o=_.createSocket("udp4"),s=null,p=null,l=!1,d=()=>{if(!l){l=!0,clearTimeout(s),clearTimeout(p);try{o.close()}catch{}i([...r.values()])}};o.on("error",e=>{if(!l){l=!0,clearTimeout(s),clearTimeout(p);try{o.close()}catch{}n(e)}}),o.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if("2.0"!==i.v||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var n=i.d?.info;if(!n)return;var o={...n,address:a.address},s=o.id||`${a.address}:${o.port}`;r.has(s)||(r.set(s,o),t&&!l&&(clearTimeout(p),p=setTimeout(d,t)))}catch{}}),o.bind(()=>{o.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${Math.random().toString(36).slice(2,9)}`}}));for(var i of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var t of Object.values(y.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.add(n)}())continue;return[...e]})())o.send(t,0,t.length,a,i);s=setTimeout(d,e)})}))({timeout:e,port:a});return 0===r.length?[]:t?(i?.(`Verifying ${r.length} server(s)...`),yield Promise.all(r.map((n=f(function*(e){var t=yield E(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return n.apply(this,arguments)})))):r}),function(){return s.apply(this,arguments)}),k=(p=f(function*(){var e=yield Promise.resolve().then(a.bind(a,23258)),t=e.getToken,i=e.getBaseUrl,n=e.getCurrentProfile,r=(yield Promise.resolve().then(a.bind(a,85382))).createClient,o=t(n());return o||(console.error(v.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),r(i(),o)}),function(){return p.apply(this,arguments)}),I=new h.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");I.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action((l=f(function*(e){var t,i,n,r,o,s,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=e.serverId||T();l||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var d=(i=(t=g.generateKeyPairSync("ed25519")).publicKey,n=t.privateKey,r=i.export({type:"spki",format:"der"}),o=n.export({type:"pkcs8",format:"der"}),s=g.createHash("sha256").update(r).digest("hex").slice(0,16),{publicKeySpki:r.toString("base64"),privateKeyPkcs8:o.toString("base64"),kid:s}),u=yield k(),c=p(`Binding buttress server ${v.Ay.cyan(l)}...`).start();try{var m=yield u.bindButtressServer({serverId:l,name:e.name,serverPublicKey:{spkiBase64:d.publicKeySpki,kid:d.kid}});c.stop();var f={workspace:{id:m.workspaceId,name:m.workspaceName,serverId:m.serverId,issuerPublicKey:m.issuerPublicKey.pem,kid:m.issuerPublicKey.kid,boundAt:new Date().toISOString()},serverKeyPair:d};if(e.print){console.warn(v.Ay.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
38
|
+
`)),d.forEach((e,t)=>{console.log(` ${b.Ay.yellow(`${t+1}.`)} ${b.Ay.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var u=l.schema.length+l.ref.length;l.valid?console.log(b.Ay.yellow(`⚠ ${d.length} warning(s)`)):console.log(b.Ay.red(`✗ ${u} error(s)`)+(d.length>0?b.Ay.yellow(`, ${d.length} warning(s)`):"")),l.valid||process.exit(1)}catch(e){i.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return v.apply(this,arguments)})),N.command("ctor-init <id>").alias("project-init").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((g=y(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("application",e,t)}),function(e,t){return g.apply(this,arguments)}))},55614(e,a,i){i.d(a,{s:()=>y});var n,r,o,s,p,l=i(99436),d=i(35679),u=i(73284),c=i(30155);let m=t("readline");var f=i(23258),h=i(85382),v=i(7586),g=(n=l(function*(){var e=(0,f.getCurrentProfile)(),t=(0,f.getCurrentProfileSource)(),a=(0,f.getTokenInfo)(e),i=(0,f.getBaseUrl)();if(!a?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var n=(0,h.createClient)(i,a.token),r=yield n.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:r?._id||a.workspaceId||null,workspaceName:r?.name||a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:r?{_id:r._id,name:r.name,description:r.description||null}:null,error:null}}catch(n){return{ok:!1,profile:e,profileSource:t,baseUrl:i,auth:{available:!0,source:"config",workspaceId:a.workspaceId||null,workspaceName:a.workspaceName||null,createdAt:a.createdAt||null,tokenPreview:(0,v.$l)(a.token)},workspace:null,error:{message:n.message}}}}),function(){return n.apply(this,arguments)}),y=new d.uB("auth").description("Authentication and token management");y.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((r=l(function*(e,t){var a,i=t.profile||(0,f.getCurrentProfile)(),n=t.name,r=e;!r&&(console.log(u.Ay.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(u.Ay.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(r=yield(a=m.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{a.question("Enter passcode: ",t=>{a.close(),e(t.trim())})})))||(console.log(u.Ay.red("Passcode is required")),process.exit(1)));var o=(0,c.default)("Validating passcode...").start();try{var s=(0,h.createPublicClient)((0,f.getBaseUrl)()),p=yield s.checkWorkspaceOTP(r);p.valid||(o.fail(`Invalid passcode: ${p.error||"Unknown error"}`),process.exit(1)),o.text=`Exchanging passcode for token (workspace: ${p.workspaceName})...`;var l=yield s.exchangeWorkspaceOTP(r);l.token||(o.fail("Failed to obtain token"),process.exit(1));var d=(0,h.createClient)((0,f.getBaseUrl)(),l.token),v=yield d.workspace();v||(o.fail("Token validation failed"),process.exit(1)),(0,f.setToken)(i,{token:l.token,name:n||v.name,workspaceId:v._id,workspaceName:v.name}),(0,f.setCurrentProfile)(i),o.succeed(`Logged in to workspace: ${u.Ay.green(v.name)} (profile: ${u.Ay.cyan(i)})`)}catch(e){o.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),y.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((o=l(function*(e){var t=e.profile||(0,f.getCurrentProfile)(),a=e.token,i=e.name;a||(console.error(u.Ay.red("Error: Token is required. Use -t or --token to provide it.")),console.log(u.Ay.gray("\nYou can get a workspace token from BRICKS Controller:")+u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${u.Ay.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(u.Ay.gray("Select your workspace and create a new token.\n")),console.log(u.Ay.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var n=(0,c.default)("Validating token...").start();try{var r=(0,h.createClient)((0,f.getBaseUrl)(),a),o=yield r.workspace();o||(n.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,f.setToken)(t,{token:a,name:i||o.name,workspaceId:o._id,workspaceName:o.name}),(0,f.setCurrentProfile)(t),n.succeed(`Logged in to workspace: ${u.Ay.green(o.name)} (profile: ${u.Ay.cyan(t)})`)}catch(e){n.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return o.apply(this,arguments)})),y.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((s=l(function*(e){var t=e.profile;if(e.all){(0,f.listProfiles)().forEach(e=>(0,f.removeToken)(e.name)),console.log(u.Ay.green("All profiles removed"));return}var a=t||(0,f.getCurrentProfile)();(0,f.getTokenInfo)(a)?((0,f.removeToken)(a),console.log(u.Ay.green(`Logged out from profile: ${a}`))):console.log(u.Ay.yellow(`No token found for profile: ${a}`))}),function(e){return s.apply(this,arguments)})),y.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((p=l(function*(e){var t=(0,f.getCurrentProfile)(),a=(0,f.getTokenInfo)(t);if(!a)return e.json?void(0,v.GF)((yield g())):(console.log(u.Ay.yellow("Not logged in")),void console.log(u.Ay.gray("Use `bricks auth login` to login")));if(e.json)return void(0,v.GF)((yield g()));var i=(0,c.default)("Checking connection...").start();try{var n=(0,h.createClient)((0,f.getBaseUrl)(),a.token),r=yield n.workspace();i.stop(),console.log(u.Ay.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${u.Ay.cyan(t)}`),console.log(`Workspace: ${u.Ay.green(r.name)}`),console.log(`Workspace ID: ${u.Ay.gray(r._id)}`);var o=(0,f.getBaseUrl)(),s=a.baseUrl;console.log(`Base URL: ${u.Ay.gray(o)}${s?"":u.Ay.gray(" (global)")}`),console.log(`Logged in: ${u.Ay.gray(a.createdAt)}`),console.log("─".repeat(40))}catch(e){i.fail(`Connection failed: ${e.message}`)}}),function(e){return p.apply(this,arguments)})),y.command("list").description("List all saved profiles").action(()=>{var e=(0,f.listProfiles)();if(0===e.length){console.log(u.Ay.yellow("No saved profiles")),console.log(u.Ay.gray("Use `bricks auth login` to login"));return}console.log(u.Ay.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?u.Ay.green("● "):" ",a=e.current?u.Ay.green(e.name):e.name,i=e.baseUrl?u.Ay.gray(` [${e.baseUrl}]`):"";console.log(`${t}${a.padEnd(15)} ${u.Ay.gray(e.workspaceName||"Unknown")}${i}`)}),console.log("─".repeat(60))}),y.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,f.getTokenInfo)(e);if(!t){console.log(u.Ay.red(`Profile not found: ${e}`)),console.log(u.Ay.gray("Use `bricks auth list` to see available profiles"));return}(0,f.setCurrentProfile)(e),console.log(u.Ay.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(u.Ay.gray(`Workspace: ${t.workspaceName}`))}),y.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,f.setBaseUrl)(e),console.log(u.Ay.green(`Global base URL set to: ${e}`));else{var a=(0,f.getCurrentProfile)();(0,f.setBaseUrl)(e,a),console.log(u.Ay.green(`Base URL for profile ${u.Ay.cyan(a)} set to: ${e}`))}})},59845(e,t,a){a.d(t,{Q:()=>I});var i,n,r,o,s,p,l,d,u,c,m,f=a(99436),h=a(35679),v=a(73284),g=a(77598),y=a(48161),D=a(76760),b=a(51455),x=a(27549),_=a(41314),w=8089,E=(i=f(function*(e,t,a=3e3){var i;try{var n=new AbortController;i=setTimeout(()=>n.abort(),a);var r=yield fetch(`http://${e}:${t}/buttress/info`,{signal:n.signal});if(!r.ok)return null;return yield r.json()}catch{return null}finally{void 0!==i&&clearTimeout(i)}}),function(e,t){return i.apply(this,arguments)}),F=D.join(y.homedir(),".bricks-cli","buttress"),C=e=>D.join(e||F,"state.json"),T=()=>{try{return`buttress-${x.machineIdSync()}`}catch{return null}},A=(n=f(function*(e){var t=C(e);try{var a=yield b.readFile(t,"utf8");return JSON.parse(a)}catch(e){if("ENOENT"===e.code)return null;throw e}}),function(e){return n.apply(this,arguments)}),S=(r=f(function*(e,t){var a=t||F,i=C(t);yield b.mkdir(a,{recursive:!0});var n=`${i}.tmp-${process.pid}`;return yield b.writeFile(n,JSON.stringify(e,null,2),"utf8"),yield b.rename(n,i),i}),function(e,t){return r.apply(this,arguments)}),O=(o=f(function*(e){var t=C(e);try{return yield b.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return o.apply(this,arguments)}),N=(s=f(function*({timeout:e=3e3,verify:t=!0,port:a=w,onStatus:i}={}){i?.(`Scanning UDP ${a} for ${e}ms...`);var n,r=yield(({timeout:e=3e3,idleTimeout:t=0,port:a=w}={})=>new Promise((i,n)=>{var r=new Map,o=_.createSocket("udp4"),s=null,p=null,l=!1,d=()=>{if(!l){l=!0,clearTimeout(s),clearTimeout(p);try{o.close()}catch{}i([...r.values()])}};o.on("error",e=>{if(!l){l=!0,clearTimeout(s),clearTimeout(p);try{o.close()}catch{}n(e)}}),o.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if("2.0"!==i.v||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var n=i.d?.info;if(!n)return;var o={...n,address:a.address},s=o.id||`${a.address}:${o.port}`;r.has(s)||(r.set(s,o),t&&!l&&(clearTimeout(p),p=setTimeout(d,t)))}catch{}}),o.bind(()=>{o.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${Math.random().toString(36).slice(2,9)}`}}));for(var i of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var t of Object.values(y.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.add(n)}())continue;return[...e]})())o.send(t,0,t.length,a,i);s=setTimeout(d,e)})}))({timeout:e,port:a});return 0===r.length?[]:t?(i?.(`Verifying ${r.length} server(s)...`),yield Promise.all(r.map((n=f(function*(e){var t=yield E(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return n.apply(this,arguments)})))):r}),function(){return s.apply(this,arguments)}),k=(p=f(function*(){var e=yield Promise.resolve().then(a.bind(a,23258)),t=e.getToken,i=e.getBaseUrl,n=e.getCurrentProfile,r=(yield Promise.resolve().then(a.bind(a,85382))).createClient,o=t(n());return o||(console.error(v.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),r(i(),o)}),function(){return p.apply(this,arguments)}),I=new h.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");I.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action((l=f(function*(e){var t,i,n,r,o,s,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=e.serverId||T();l||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var d=(i=(t=g.generateKeyPairSync("ed25519")).publicKey,n=t.privateKey,r=i.export({type:"spki",format:"der"}),o=n.export({type:"pkcs8",format:"der"}),s=g.createHash("sha256").update(r).digest("hex").slice(0,16),{publicKeySpki:r.toString("base64"),privateKeyPkcs8:o.toString("base64"),kid:s}),u=yield k(),c=p(`Binding buttress server ${v.Ay.cyan(l)}...`).start();try{var m=yield u.bindButtressServer({serverId:l,name:e.name,serverPublicKey:{spkiBase64:d.publicKeySpki,kid:d.kid}});c.stop();var f={workspace:{id:m.workspaceId,name:m.workspaceName,serverId:m.serverId,issuerPublicKey:m.issuerPublicKey.pem,kid:m.issuerPublicKey.kid,boundAt:new Date().toISOString()},serverKeyPair:d};if(e.print){console.warn(v.Ay.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
36
39
|
`);return}var h=yield S(f,e.stateDir);console.log(v.Ay.green("✓"),"Buttress server bound to workspace."),console.log(` Workspace: ${v.Ay.bold(m.workspaceName)} (${m.workspaceId})`),console.log(` Server id: ${v.Ay.cyan(m.serverId)}`),console.log(` Issuer kid: ${v.Ay.gray(m.issuerPublicKey.kid)}`),console.log(` Announce kid: ${v.Ay.gray(d.kid)}`),console.log(` State file: ${v.Ay.gray(h)}`),console.log(),console.log(v.Ay.yellow("Restart buttress-server for the binding to take effect."))}catch(e){c.fail(`Bind failed: ${e.message}`),process.exit(1)}}),function(e){return l.apply(this,arguments)})),I.command("unbind").description("Unbind a buttress server from this workspace").option("-s, --server-id <id>","Buttress server id (auto-detected by default)").option("--state-dir <dir>","Override the buttress state directory").option("--keep-local","Do not remove the local state.json file").action((d=f(function*(e){var t=e.serverId||T();t||(console.error(v.Ay.red("Could not detect a local server id. Pass --server-id explicitly.")),process.exit(1));var a=yield k();try{if((yield a.unbindButtressServer({serverId:t}))?console.log(v.Ay.green("✓"),`Unbound ${v.Ay.cyan(t)} from workspace.`):console.log(v.Ay.yellow("!"),`${v.Ay.cyan(t)} was not bound to this workspace.`),!e.keepLocal){var i=C(e.stateDir),n=yield A(e.stateDir);n?.workspace?.serverId===t&&(yield O(e.stateDir),console.log(v.Ay.gray(`Removed local state file: ${i}`)))}}catch(e){console.error(v.Ay.red(`Unbind failed: ${e.message}`)),process.exit(1)}}),function(e){return d.apply(this,arguments)})),I.command("status").description("Show local buttress binding state and the workspace-side bound list").option("--state-dir <dir>","Override the buttress state directory").option("-j, --json","Output as JSON").action((u=f(function*(e){var t=yield A(e.stateDir),a=null;try{var i=yield k();a=yield i.buttressServers()}catch(e){a={error:e.message}}e.json?console.log(JSON.stringify({local:t,remote:a},null,2)):(console.log(v.Ay.bold("\nLocal buttress state")),console.log("─".repeat(60)),t?.workspace?(console.log(` Workspace: ${v.Ay.bold(t.workspace.name)} (${t.workspace.id})`),console.log(` Server id: ${v.Ay.cyan(t.workspace.serverId)}`),console.log(` Issuer kid: ${v.Ay.gray(t.workspace.kid)}`),console.log(` Bound at: ${v.Ay.gray(t.workspace.boundAt)}`),console.log(` File: ${v.Ay.gray(C(e.stateDir))}`)):console.log(v.Ay.gray(" not bound (no state.json found)")),console.log(v.Ay.bold("\nWorkspace-side bound servers")),console.log("─".repeat(60)),Array.isArray(a)?0===a.length?console.log(v.Ay.gray(" none")):a.forEach(e=>{console.log(` ${v.Ay.cyan(e.serverId)} ${v.Ay.gray(e.name||"")} ${v.Ay.gray(e.boundAt||"")}`)}):a?.error&&console.log(v.Ay.red(` failed to fetch: ${a.error}`)))}),function(e){return u.apply(this,arguments)})),I.command("issue-token").description("Issue a long-lived workspace-scoped buttress access token (CLI/CTOR usage)").option("--ttl <seconds>","Time-to-live in seconds (default 30 days)",e=>parseInt(e,10)).option("-j, --json","Output as JSON").action((c=f(function*(e){var t=yield k();try{var a=yield t.issueButtressAccessToken({ttlSeconds:e.ttl});if(e.json)return void console.log(JSON.stringify(a,null,2));console.log(v.Ay.green("✓"),"Buttress access token issued."),console.log(` Workspace: ${a.workspaceId}`),console.log(` Expires: ${a.expiresAt}`),console.log(` jti: ${v.Ay.gray(a.jti)}`),console.log(),console.log(v.Ay.cyan(a.token))}catch(e){console.error(v.Ay.red(`Issue token failed: ${e.message}`)),process.exit(1)}}),function(e){return c.apply(this,arguments)})),I.command("scan").description("Scan LAN for buttress-servers via UDP and verify each via /buttress/info").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-p, --port <port>","UDP discovery port",String(w)).option("--udp-only","Skip HTTP /buttress/info verification").option("-j, --json","Output as JSON").action((m=f(function*(e){var t=(yield Promise.resolve().then(a.bind(a,30155))).default,i=yield Promise.resolve().then(a.bind(a,23258)),n=i.getCurrentProfile,r=i.getTokenInfo,o=parseInt(e.timeout,10),s=parseInt(e.port,10),p=[],l=t(`Scanning for buttress-servers (${o}ms)...`).start();try{p=yield N({timeout:o,port:s,verify:!e.udpOnly,onStatus:e=>{l.text=e}}),l.stop()}catch(e){l.fail(`Scan failed: ${e.message}`),process.exit(1)}var d=n(),u=r(d)?.workspaceId||null;if(e.json)return void console.log(JSON.stringify({servers:p,workspaceId:u},null,2));if(0===p.length)return void console.log(v.Ay.yellow("No buttress-servers found on the LAN."));for(var c of(console.log(v.Ay.bold(`
|
|
37
40
|
Found ${p.length} buttress-server(s)`)),console.log("─".repeat(70)),p)){var m=!1===c.verified?v.Ay.red("unverified"):v.Ay.green("online"),f=c.workspace?.id,h=f&&u&&f===u,g=c.authentication?.bound?v.Ay.yellow("JWT required"):v.Ay.gray("open");console.log(` ${v.Ay.bold(c.name||"Unknown")} ${v.Ay.gray(`(${c.address}:${c.port})`)} [${m}]`),c.id&&console.log(` Server id: ${v.Ay.cyan(c.id)}`),c.version&&console.log(` Version: ${v.Ay.green(c.version)}`);var y=c.authentication?.kid?v.Ay.gray(` (kid: ${c.authentication.kid})`):"";if(console.log(` Auth: ${g}${y}`),f){var D=h?v.Ay.green(`${f} ${v.Ay.bold("(current profile)")}`):v.Ay.gray(f);console.log(` Workspace: ${D}`)}if(Array.isArray(c.generators)&&c.generators.length>0)for(var b of(console.log(" Generators:"),c.generators)){var x=[];"number"==typeof b.score&&x.push(`score ${b.score.toFixed(1)}`),!0===b.hasGpu?x.push("GPU ✓"):!1===b.hasGpu&&x.push("GPU ✗"),"number"==typeof b.usableBytes&&x.push(`${(b.usableBytes/0x40000000).toFixed(1)} GB usable`);var _=x.length>0?` ${v.Ay.gray(x.join(" "))}`:"";console.log(` - ${v.Ay.cyan(b.type)}${_}`)}}console.log("─".repeat(70)),p.some(e=>e.authentication?.bound)&&(console.log(),console.log(v.Ay.gray("To connect to a bound server, run `bricks buttress issue-token` for a workspace access token.")))}),function(e){return m.apply(this,arguments)}))},71335(e,t,a){a.d(t,{oT:()=>d});var i=a(35679),n=a(73284),r=a(23258),o={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},s=e=>{var t=Object.entries(o).find(([,t])=>e===t);return t?t[0]:null},p={prod:"https://activity-log.bricks.tools",beta:"https://activity-log-beta.bricks.tools",dev:"http://localhost:8088"},l=e=>{var t=Object.entries(p).find(([,t])=>e===t);return t?t[0]:null},d=new i.uB("config").description("CLI configuration management");d.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set endpoint environment").option("-p, --profile","Set for current profile instead of global").action((e,t)=>{if(!e){var a=(0,r.getBaseUrl)(),i=s(a),d=(0,r.getActivityLogBaseUrl)(),u=l(d);console.log(n.Ay.bold("\nEndpoint Configuration")),console.log("─".repeat(50)),console.log(n.Ay.bold("BRICKS")),console.log(` URL: ${n.Ay.cyan(a)}`),console.log(` Environment: ${i?n.Ay.green(i):n.Ay.yellow("custom")}`),console.log(n.Ay.bold("Activity Log")),console.log(` URL: ${n.Ay.cyan(d)}`),console.log(` Environment: ${u?n.Ay.green(u):n.Ay.yellow("custom")}`),console.log("─".repeat(50)),console.log(n.Ay.gray("\nUsage: bricks config endpoint <prod|beta|dev>"));return}var c=Object.keys(o);c.includes(e)||(console.error(n.Ay.red(`Invalid environment: ${e}`)),console.log(n.Ay.gray(`Valid options: ${c.join(", ")}`)),process.exit(1));var m=o[e],f=p[e],h=t.profile?(0,r.getCurrentProfile)():null;(0,r.setBaseUrl)(m,h),(0,r.setActivityLogBaseUrl)(f,h);var v=t.profile?` (profile: ${(0,r.getCurrentProfile)()})`:"";console.log(n.Ay.green(`✓ Endpoint changed to ${e}${v}`)),console.log(n.Ay.gray(` BRICKS: ${m}`)),console.log(n.Ay.gray(` Activity Log: ${f}`)),console.log(n.Ay.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(n.Ay.gray("Use `bricks auth status` to check your connection."))}),d.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,r.getBaseUrl)(),a=s(t);if(e.json)return void console.log(JSON.stringify({endpoint:t,environment:a||"custom"},null,2));console.log(n.Ay.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`BRICKS: ${n.Ay.cyan(t)}`),a?console.log(`Environment: ${n.Ay.green(a)}`):console.log(`Environment: ${n.Ay.yellow("custom")}`);var i=(0,r.getActivityLogBaseUrl)(),o=l(i);console.log(`Activity Log: ${n.Ay.cyan(i)} ${o?n.Ay.green(`(${o})`):n.Ay.yellow("(custom)")}`),console.log("─".repeat(50))})},42400(e,t,a){a.a(e,async function(e,i){try{a.d(t,{D:()=>f});var n=a(35679),r=a(69278),o=a(16928),s=a(70857),p=a(84361),l=e([p]);p=(l.then?(await l)():l)[0];var d=process.env.BRICKS_PROJECT_DESKTOP_DATA_DIR||o.join(s.homedir(),".bricks-project-desktop"),u=o.join(d,"acp.sock"),c=`[acp] Cannot connect to CTOR.
|
|
38
41
|
Make sure the desktop app is running and ACP is enabled in Settings.
|
|
@@ -60,7 +63,7 @@ ${y.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(y.Ay.red(`Error: $
|
|
|
60
63
|
Found ${p.length} DevTools server(s)`)),console.log("─".repeat(80));var c=function*(e){var t=!1===e.verified?k.Ay.red("unverified"):k.Ay.green("online"),a=e.hasPasscode?k.Ay.yellow("passcode"):k.Ay.gray("open"),i=(e.protocols||[]).map(e=>k.Ay.cyan(e)).join(", "),n=e.workspaceId&&u&&e.workspaceId===u,r=e.addresses||[e.address],o=r.filter(t=>t!==e.address),s=o.length>0?`${e.address}:${e.port} +${o.length} more`:`${e.address}:${e.port}`;if(console.log(` ${k.Ay.bold(e.name||"Unknown")} ${k.Ay.gray(`(${s})`)} [${t}]`),o.length>0&&console.log(` Addresses: ${r.map(e=>k.Ay.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${k.Ay.green(e.version)}`),e.chromeInspect){var p=e.passcode?k.Ay.cyan(e.passcode):k.Ay.gray("no passcode");console.log(` Chrome Inspect: ${k.Ay.green("supported")} (passcode: ${p})`)}var l=` Protocols: ${i||k.Ay.gray("none")} Auth: ${a}`;if(e.deviceId&&(l+=` Device: ${k.Ay.gray(e.deviceId)}`),console.log(l),e.workspaceId){var d=n?k.Ay.green(`${e.workspaceId} (current profile)`):k.Ay.gray(e.workspaceId);console.log(` Workspace: ${d}`)}};for(var m of p)yield*c(m);console.log("─".repeat(80));var f=p[0],h=`${f.address}:${f.port||19851}`,v=f.passcode?`/ws/${encodeURIComponent(f.passcode)}`:"/ws/<passcode>";console.log(k.Ay.gray(`
|
|
61
64
|
Connect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${v}`)),console.log(k.Ay.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${v}`)),process.exit(0)}catch(e){s.fail(`Scan failed: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),q.command("open <address>").description("Show DevTools server information").option("-p, --port <port>","Server port","19851").option("--info","Show connection URLs").action((p=O(function*(e,t){var i=(yield Promise.resolve().then(a.bind(a,30155))).default,n=(yield Promise.resolve().then(a.bind(a,75646))).verifyDevToolsServer,r=parseInt(t.port,10),o=`${e}:${r}`,s=i(`Fetching server info from ${o}...`).start(),p=yield n(e,r);p||(s.fail(`Could not reach DevTools server at ${o}`),process.exit(1)),s.stop();var l=yield B(e,r),d=l?R(l?.[0]?.webSocketDebuggerUrl):null,u=d?`/ws/${encodeURIComponent(d)}`:"/ws/<passcode>";if(t.info){console.log(k.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${k.Ay.cyan(`http://${o}`)}`),console.log(` CDP: ${k.Ay.cyan(`http://${o}/devtools-frontend/inspector.html?ws=${o}${u}`)}`),console.log(` CDP legacy: ${k.Ay.cyan(`devtools://devtools/bundled/inspector.html?ws=${o}${u}`)}`),console.log(` MCP: ${k.Ay.cyan(`http://${o}/mcp`)}`),console.log(` MCP SSE: ${k.Ay.cyan(`http://${o}/sse`)}`),console.log(` Info: ${k.Ay.cyan(`http://${o}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(k.Ay.bold("Authorization")),d&&console.log(` Passcode: ${k.Ay.cyan(d)}`),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),console.log(` ${k.Ay.gray(`Authorization: Bearer ${d||"<passcode>"}`)}`);return}if(console.log(k.Ay.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${k.Ay.cyan(p.name||"Unknown")}`),console.log(` Version: ${p.version?k.Ay.green(p.version):k.Ay.gray("N/A")}`),console.log(` Device ID: ${k.Ay.gray(p.deviceId||"N/A")}`),console.log(` Workspace: ${k.Ay.gray(p.workspaceId||"N/A")}`),console.log(` Protocols: ${(p.protocols||[]).map(e=>k.Ay.cyan(e)).join(", ")||k.Ay.gray("none")}`),console.log(` Auth: ${p.hasPasscode?k.Ay.yellow("passcode required"):k.Ay.gray("open")}`),console.log(` Port: ${p.port}`),l){var c=d?k.Ay.cyan(d):k.Ay.gray("no passcode");console.log(` Inspect: ${k.Ay.green("chrome://inspect supported")} (passcode: ${c})`)}else console.log(` Inspect: ${k.Ay.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),p.version&&!U(p.version)&&console.log(k.Ay.yellow(`
|
|
62
65
|
CDP commands require version >= ${L}`)),console.log(k.Ay.gray(`
|
|
63
|
-
Use --info to see connection URLs`))}),function(e,t){return p.apply(this,arguments)})),G(q.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((l=O(function*(e){var t;yield z(e,(t=O(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(k.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(k.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return l.apply(this,arguments)}));var J=q.command("brick").description("Brick component inspection");G(J.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((d=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(Q(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return d.apply(this,arguments)})),G(J.command("query <selector>").description("Find brick by CSS selector")).action((u=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(k.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=Y((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(k.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(k.Ay.bold("Attributes:")),Object.entries(o))){var p=S(s,2),l=p[0],d=p[1];console.log(` ${k.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return u.apply(this,arguments)})),G(J.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((c=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(k.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=Y((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?k.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return c.apply(this,arguments)})),G(J.command("attributes <nodeId>").description("Get brick attributes")).action((m=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=Y((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(k.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=S(r,2),s=o[0],p=o[1];console.log(` ${k.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),G(J.command("box-model <nodeId>").description("Get brick dimensions and position")).action((f=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(k.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),G(J.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((h=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${k.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(k.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${k.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),G(J.command("focus <nodeId>").description("Focus a brick element")).action((v=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(k.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)}));var H=q.command("input").description("Input emulation");G(H.command("tap <x> <y>").description("Tap/click at coordinates")).action((g=O(function*(e,t,a){var i;yield z(a,(i=O(function*(a){var i=parseFloat(e),n=parseFloat(t);yield a.send("Input.dispatchMouseEvent",{type:"mousePressed",x:i,y:n,button:"left",clickCount:1}),yield a.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:i,y:n,button:"left",clickCount:1}),console.log(k.Ay.green(`Tapped at (${i}, ${n})`))}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return g.apply(this,arguments)})),G(H.command("type <text>").description("Insert text into focused element")).action((y=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.insertText",{text:e}),console.log(k.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)})),G(H.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((D=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(k.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)}));var W=q.command("network").description("Network inspection");G(W.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((b=O(function*(e){var t;yield z(e,(t=O(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(k.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?k.Ay.red("ERR"):r.status?r.status<300?k.Ay.green(r.status):r.status<400?k.Ay.yellow(r.status):k.Ay.red(r.status):k.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${k.Ay.bold(r.method.padEnd(6))} ${s} ${k.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return b.apply(this,arguments)})),G(W.command("get <requestId>").description("Get response body for a network request")).action((x=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(k.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var K=q.command("storage").description("Storage inspection"),X=K.command("system").description("System key-value storage");G(X.command("persist").description("Show persistent system storage entries")).action((_=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!0}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Persistent Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return _.apply(this,arguments)})),G(X.command("memory").description("Show in-memory system storage entries")).action((w=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!1}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Memory Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)}));var Z=K.command("data-bank").description("Property Bank data stores");G(Z.command("list").description("List Property Banks")).action((E=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:"bricks://app"})).databaseNames.filter(e=>e.startsWith("DATA-"));if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Property Banks (${a.length})`)),a))console.log(` ${k.Ay.cyan(i)}`)}),function(e){return t.apply(this,arguments)}))}),function(e){return E.apply(this,arguments)})),G(Z.command("get <name> <store>").description("Query Property Bank data").option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0")).action((F=O(function*(e,t,a){var i;yield z(a,(i=O(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:e,objectStoreName:t,indexName:"",skipCount:parseInt(a.skip,10),pageSize:parseInt(a.limit,10)})).objectStoreDataEntries;if(a.json)return void console.log(JSON.stringify(n,null,2));for(var r of(console.log(k.Ay.bold(`${e} / ${t} (${n.length} entries)`)),console.log("─".repeat(60)),n)){var o=JSON.stringify(r.key?.value??r.key),s=JSON.stringify(r.value?.value??r.value),p=s.length>100?s.substring(0,100)+"...":s;console.log(` ${k.Ay.cyan(o)}: ${p}`)}}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return F.apply(this,arguments)})),G(K.command("generator-cache").description("Show generator cache entries")).action((C=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:"GENERATOR_CACHE",objectStoreName:"entries",indexName:"",skipCount:0,pageSize:100})).objectStoreDataEntries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Generator Cache (${a.length} entries)`)),console.log("─".repeat(60)),a)){var n=JSON.stringify(i.key?.value??i.key),r=JSON.stringify(i.value?.value??i.value),o=r.length>100?r.substring(0,100)+"...":r;console.log(` ${k.Ay.cyan(n)}: ${o}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return C.apply(this,arguments)}));var ee=q.command("runtime").description("Runtime and evaluation");G(ee.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((T=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(k.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(k.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(k.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(k.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return T.apply(this,arguments)})),G(ee.command("properties <objectId>").description("Get properties of a remote object")).action((A=O(function*(e,t){var a;yield z(t,(a=O(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(k.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||k.Ay.gray(`[${r?.type}]`);console.log(` ${k.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return A.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(23258),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.14",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>_});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),D=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},b=(e,t)=>({id:e?._id||t,name:e?.name||"Unnamed",deviceCount:e?.devices?.length||0}),x=["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"],_=new c.uB("group").description("Device Group management");_.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.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)}}),function(e){return i.apply(this,arguments)})),_.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
66
|
+
Use --info to see connection URLs`))}),function(e,t){return p.apply(this,arguments)})),G(q.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((l=O(function*(e){var t;yield z(e,(t=O(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(k.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(k.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return l.apply(this,arguments)}));var J=q.command("brick").description("Brick component inspection");G(J.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((d=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(Q(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return d.apply(this,arguments)})),G(J.command("query <selector>").description("Find brick by CSS selector")).action((u=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(k.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=Y((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(k.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(k.Ay.bold("Attributes:")),Object.entries(o))){var p=S(s,2),l=p[0],d=p[1];console.log(` ${k.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return u.apply(this,arguments)})),G(J.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((c=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(k.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=Y((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?k.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return c.apply(this,arguments)})),G(J.command("attributes <nodeId>").description("Get brick attributes")).action((m=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=Y((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(k.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=S(r,2),s=o[0],p=o[1];console.log(` ${k.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),G(J.command("box-model <nodeId>").description("Get brick dimensions and position")).action((f=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(k.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),G(J.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((h=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${k.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(k.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${k.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),G(J.command("focus <nodeId>").description("Focus a brick element")).action((v=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(k.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)}));var H=q.command("input").description("Input emulation");G(H.command("tap <x> <y>").description("Tap/click at coordinates")).action((g=O(function*(e,t,a){var i;yield z(a,(i=O(function*(a){var i=parseFloat(e),n=parseFloat(t);yield a.send("Input.dispatchMouseEvent",{type:"mousePressed",x:i,y:n,button:"left",clickCount:1}),yield a.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:i,y:n,button:"left",clickCount:1}),console.log(k.Ay.green(`Tapped at (${i}, ${n})`))}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return g.apply(this,arguments)})),G(H.command("type <text>").description("Insert text into focused element")).action((y=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.insertText",{text:e}),console.log(k.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)})),G(H.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((D=O(function*(e,t){var a;yield z(t,(a=O(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(k.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)}));var W=q.command("network").description("Network inspection");G(W.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((b=O(function*(e){var t;yield z(e,(t=O(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(k.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(k.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?k.Ay.red("ERR"):r.status?r.status<300?k.Ay.green(r.status):r.status<400?k.Ay.yellow(r.status):k.Ay.red(r.status):k.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${k.Ay.bold(r.method.padEnd(6))} ${s} ${k.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return b.apply(this,arguments)})),G(W.command("get <requestId>").description("Get response body for a network request")).action((x=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(k.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var K=q.command("storage").description("Storage inspection"),X=K.command("system").description("System key-value storage");G(X.command("persist").description("Show persistent system storage entries")).action((_=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!0}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Persistent Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return _.apply(this,arguments)})),G(X.command("memory").description("Show in-memory system storage entries")).action((w=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("DOMStorage.enable");var a=(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:"bricks://app",isLocalStorage:!1}})).entries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Memory Storage (${a.length} items)`)),console.log("─".repeat(60)),a)){var n=S(i,2),r=n[0],o=n[1],s=o.length>80?o.substring(0,80)+"...":o;console.log(` ${k.Ay.cyan(r)}: ${s}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)}));var Z=K.command("data-bank").description("Property Bank data stores");G(Z.command("list").description("List Property Banks")).action((E=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:"bricks://app"})).databaseNames.filter(e=>e.startsWith("DATA-"));if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Property Banks (${a.length})`)),a))console.log(` ${k.Ay.cyan(i)}`)}),function(e){return t.apply(this,arguments)}))}),function(e){return E.apply(this,arguments)})),G(Z.command("get <name> <store>").description("Query Property Bank data").option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0")).action((F=O(function*(e,t,a){var i;yield z(a,(i=O(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:e,objectStoreName:t,indexName:"",skipCount:parseInt(a.skip,10),pageSize:parseInt(a.limit,10)})).objectStoreDataEntries;if(a.json)return void console.log(JSON.stringify(n,null,2));for(var r of(console.log(k.Ay.bold(`${e} / ${t} (${n.length} entries)`)),console.log("─".repeat(60)),n)){var o=JSON.stringify(r.key?.value??r.key),s=JSON.stringify(r.value?.value??r.value),p=s.length>100?s.substring(0,100)+"...":s;console.log(` ${k.Ay.cyan(o)}: ${p}`)}}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return F.apply(this,arguments)})),G(K.command("generator-cache").description("Show generator cache entries")).action((C=O(function*(e){var t;yield z(e,(t=O(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestData",{securityOrigin:"bricks://app",databaseName:"GENERATOR_CACHE",objectStoreName:"entries",indexName:"",skipCount:0,pageSize:100})).objectStoreDataEntries;if(e.json)return void console.log(JSON.stringify(a,null,2));for(var i of(console.log(k.Ay.bold(`Generator Cache (${a.length} entries)`)),console.log("─".repeat(60)),a)){var n=JSON.stringify(i.key?.value??i.key),r=JSON.stringify(i.value?.value??i.value),o=r.length>100?r.substring(0,100)+"...":r;console.log(` ${k.Ay.cyan(n)}: ${o}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return C.apply(this,arguments)}));var ee=q.command("runtime").description("Runtime and evaluation");G(ee.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((T=O(function*(e,t){var a;yield z(t,(a=O(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(k.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(k.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(k.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(k.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return T.apply(this,arguments)})),G(ee.command("properties <objectId>").description("Get properties of a remote object")).action((A=O(function*(e,t){var a;yield z(t,(a=O(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(k.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||k.Ay.gray(`[${r?.type}]`);console.log(` ${k.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return A.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(23258),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.16",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>_});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),D=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},b=(e,t)=>({id:e?._id||t,name:e?.name||"Unnamed",deviceCount:e?.devices?.length||0}),x=["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"],_=new c.uB("group").description("Device Group management");_.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.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)}}),function(e){return i.apply(this,arguments)})),_.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
64
67
|
Device Group: ${n.name}`)),console.log("─".repeat(60)),console.log(`ID: ${m.Ay.gray(n._id)}`),console.log(`Description: ${n.description||m.Ay.gray("N/A")}`),console.log(`Tags: ${n.tags?.join(", ")||m.Ay.gray("None")}`),console.log(`Created: ${m.Ay.gray(n.create_datetime)}`),console.log(`Modified: ${m.Ay.gray(n.last_modify_datetime)}`),n.devices?.length>0&&(console.log(`
|
|
65
68
|
${m.Ay.bold("Devices")} (${n.devices.length})`),n.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){i.fail(`Failed to get group: ${e.message}`),process.exit(1)}}),function(e,t){return n.apply(this,arguments)})),_.command("resolve <query>").description("Resolve a device group name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((r=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Resolving device group...").start();try{var n=yield(0,g.Y)(()=>a.deviceGroup({id:e})),r=n?[n]:yield a.deviceGroups({paginate:{limit:t.limit}}),o=n?r:(r||[]).filter(t=>t.name?.toLowerCase().includes(e.trim().toLowerCase())),s=(0,g.K)({resource:"group",query:e,items:o||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,h.GF)(s);if(s.resolved){var p=s.resolved;console.log(m.Ay.bold("\nResolved Device Group")),console.log("─".repeat(60)),console.log(`Name: ${m.Ay.cyan(p.name||"Unnamed")}`),console.log(`ID: ${m.Ay.gray(p._id)}`),console.log(`Selected By: ${s.selectedBy}`),console.log("─".repeat(60));return}if(0===s.matches.length)return void console.log(m.Ay.yellow(`No device groups matched "${e}"`));console.log(m.Ay.bold(`
|
|
66
69
|
Matching Device Groups (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${m.Ay.cyan(e.name||"Unnamed")} ${m.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve device group: ${t.message}`):(0,h.OW)(t.message,{resource:"group",query:e}),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),_.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action((o=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching devices...").start();try{var n=yield a.devicesByGroup({id:e});if(i.stop(),t.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.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)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,a=D(t),i=e.name||e.device_name||e.device_target_name,n=e.entry_detail?.application?.name||m.Ay.gray("No app");console.log(`${a} ${m.Ay.cyan(i.padEnd(30))} ${n}`)}),console.log("─".repeat(80))}catch(e){i.fail(`Failed to get devices: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),_.command("dispatch <id> <action>").description("Dispatch action to all devices in group").option("--dry-run","Validate inputs and show the dispatch plan without sending it").option("-j, --json","Output as JSON").action((s=u(function*(e,t,a){var i=(0,v.o)(),n=a.json?null:(0,f.default)(`Dispatching ${t}...`).start();x.includes(t)||(a.json?(0,h.OW)(`Invalid action. Valid actions: ${x.join(", ")}`,{action:"group.dispatch",target:{id:e}}):n.fail(`Invalid action. Valid actions: ${x.join(", ")}`),process.exit(1));try{var r=yield i.deviceGroup({id:e});if(!r)throw Error("Device group not found");if(a.dryRun){n&&n.stop(),(0,y.S5)({action:"group.dispatch",target:b(r,e),request:{action:t},checks:[(0,y.Iy)("group exists",!0,`${r.name} (${r._id})`),(0,y.Iy)("action is valid",!0)],json:a.json});return}var o=yield i.dispatchDeviceGroupAction({id:e,action:t});a.json?(0,y.yd)({action:"group.dispatch",target:b(r,e),result:{action:t,success:o?.success||0,failed:o?.failed||0},json:!0}):(n.succeed(`Action dispatched: ${m.Ay.green(t)}`),o&&(console.log(`Success: ${m.Ay.green(o.success||0)}`),console.log(`Failed: ${m.Ay.red(o.failed||0)}`)))}catch(t){a.json?(0,h.OW)(t.message,{action:"group.dispatch",target:{id:e}}):n.fail(`Failed to dispatch action: ${t.message}`),process.exit(1)}}),function(e,t,a){return s.apply(this,arguments)})),_.command("refresh <id>").description("Refresh all devices in group").option("--dry-run","Validate inputs and show the refresh plan without sending it").option("-j, --json","Output as JSON").action((p=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Refreshing devices...").start();try{var n=yield a.deviceGroup({id:e});if(!n)throw Error("Device group not found");if(t.dryRun){i&&i.stop(),(0,y.S5)({action:"group.refresh",target:b(n,e),request:{action:"refresh"},checks:[(0,y.Iy)("group exists",!0,`${n.name} (${n._id})`)],json:t.json});return}var r=yield a.dispatchDeviceGroupAction({id:e,action:"refresh"});t.json?(0,y.yd)({action:"group.refresh",target:b(n,e),result:{success:r?.success||0,failed:r?.failed||0},json:!0}):(i.succeed("Devices refreshed"),r&&(console.log(`Success: ${m.Ay.green(r.success||0)}`),console.log(`Failed: ${m.Ay.red(r.failed||0)}`)))}catch(a){t.json?(0,h.OW)(a.message,{action:"group.refresh",target:{id:e}}):i.fail(`Failed to refresh: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),_.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action((l=u(function*(e,t){var a,i=(0,v.o)(),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.
|
|
@@ -79,7 +82,7 @@ ${v.Ay.bold("Usage")}`),console.log(`Used In: ${n.use_count.total_count} ap
|
|
|
79
82
|
${v.Ay.bold("Exposed Properties")} (${n.expose_properties.length})`),n.expose_properties.forEach(e=>{console.log(` - ${v.Ay.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get module: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),A.command("resolve <query>").description("Resolve a module name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((s=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Resolving module...").start();try{var n=yield(0,E.Y)(()=>a.module({id:e})),r=n?[n]:yield a.modules({keyword:e,paginate:{limit:t.limit}}),o=(0,E.K)({resource:"module",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,_.GF)(o);if(o.resolved){var s=o.resolved;console.log(v.Ay.bold("\nResolved Module")),console.log("─".repeat(60)),console.log(`Name: ${v.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${v.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(v.Ay.yellow(`No modules matched "${e}"`));console.log(v.Ay.bold(`
|
|
80
83
|
Matching Modules (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${v.Ay.cyan(e.name||"Unnamed")} ${v.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve module: ${t.message}`):(0,_.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),A.command("update <id>").description("Update module name, description, and/or configuration").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 (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((p=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Updating module...").start();try{var n={id:e};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.config?n.config=t.config:t.file&&(n.config=y.readFileSync(t.file,"utf-8")),void 0!==n.config&&(n.validateConfig=!1!==t.validate),t.lastCommitId&&(n.lastCommitId=t.lastCommitId);var r=yield a.updateModule(n);t.json?(0,C.yd)({action:"module.update",target:T(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Module updated: ${v.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(v.Ay.yellow("Note: Module has unreleased changes")))}catch(a){t.json?(0,_.OW)(a.message,{action:"module.update",target:{id:e}}):i.fail(`Failed to update module: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),A.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((l=f(function*(e,t){var a=(0,w.o)(),i=(0,g.default)("Applying short edit...").start();try{var n=JSON.parse(t.list);Array.isArray(n)||(i.fail("List must be a JSON array"),process.exit(1));var r=yield a.shortEditModule({id:e,list:n});i.succeed(`Short edit applied to: ${v.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.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((d=f(function*(e,t){var a=(0,w.o)(),i=(0,g.default)("Fetching short edit references...").start();try{var n=yield a.module({id:e});if(i.stop(),!n?.short_edit?.enabled)return void console.log(v.Ay.yellow("Short Edit is not enabled for this module"));var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,x.V)(n.short_edit.ref_map,{keyword:t.keyword,types:r});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(v.Ay.yellow("No short edit references found"));console.log(v.Ay.bold(`
|
|
81
84
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(v.Ay.cyan(`
|
|
82
|
-
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?v.Ay.gray(`- ${t.title}`):"";console.log(` ${v.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((u=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Releasing module...").start();try{var n=(0,F.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.module({id:e});if(!p)throw Error("Module not found");if(p.is_public)throw Error("Public module deployment is temporarily not recommended");var l=t.version||t.name||p.name||"Untitled",d=(0,F.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("module is private",!p.is_public),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${v.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((c=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${v.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").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((m=f(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("module",e,t)}),function(e,t){return m.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),D=a(48161),b=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),_=a(31421),w=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,C=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,T=e=>"beta"===e?"beta":"latest",A=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),S=(n=c(function*(e){return(yield A(C(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),O=(r=c(function*(e){var t=T(e),a=yield A(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?O(e):S(e)}),function(e,t){return o.apply(this,arguments)}),k=(e,t,a={})=>{var i=(0,_.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield A(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(D.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield w.writeFile(n,i),F||(yield w.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(C(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];k(o,s)}finally{yield w.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void k("npm",["install","-g",`${E}@${T(t)}`]);if("bun"===e)return void k("bun",["install","-g",`${E}@${T(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.
|
|
85
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?v.Ay.gray(`- ${t.title}`):"";console.log(` ${v.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((u=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Releasing module...").start();try{var n=(0,F.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.module({id:e});if(!p)throw Error("Module not found");if(p.is_public)throw Error("Public module deployment is temporarily not recommended");var l=t.version||t.name||p.name||"Untitled",d=(0,F.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,C.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,C.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,C.Iy)("module is private",!p.is_public),(0,C.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,C.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${v.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,_.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((c=f(function*(e,t){var a=(0,w.o)(),i=t.json?null:(0,g.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${v.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").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((m=f(function*(e,t){var i=(yield a.e(602).then(a.bind(a,6553))).initProject;yield i("module",e,t)}),function(e,t){return m.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),D=a(48161),b=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),_=a(31421),w=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,C=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,T=e=>"beta"===e?"beta":"latest",A=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),S=(n=c(function*(e){return(yield A(C(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),O=(r=c(function*(e){var t=T(e),a=yield A(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?O(e):S(e)}),function(e,t){return o.apply(this,arguments)}),k=(e,t,a={})=>{var i=(0,_.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield A(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(D.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield w.writeFile(n,i),F||(yield w.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(C(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];k(o,s)}finally{yield w.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void k("npm",["install","-g",`${E}@${T(t)}`]);if("bun"===e)return void k("bun",["install","-g",`${E}@${T(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.16",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=D.homedir(),realpath:i=b}={})=>{let n;var r=(n=e)?y.basename(n).replace(/\.exe$/i,""):"";if("bricks"===r||"bricks-beta"===r)return{method:"binary",execPath:e,installDir:y.dirname(e)};var o=i(t),s=((e,t)=>{if(!e)return null;var a=y.sep,i=`${a}node_modules${a}${t.replace(/\//g,a)}${a}`,n=e.indexOf(i);return -1===n?null:e.slice(0,n)})(o,"@fugood/bricks-cli");if(s){var p=y.sep,l=y.join(a,".bun","install","global");return s===l||s.startsWith(l+p)?{method:"bun",installRoot:s}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(s)?{method:"pnpm",installRoot:s}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(s)?{method:"yarn",installRoot:s}:{method:"npm",installRoot:s.endsWith(`${p}lib`)?s.slice(0,-`${p}lib`.length):s}}return{method:"unknown",execPath:e,scriptPath:o}})(),n=e.channel||(({version:e,execPath:t}={})=>{var a=t||process.execPath;return a&&/[\\/]bricks-beta(?:\.exe)?$/i.test(a)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.16")?"beta":"release"})({version:a,execPath:i.execPath});console.log(f.Ay.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${f.Ay.cyan(a)}`),console.log(`Channel : ${f.Ay.cyan(n)}`),console.log(`Detected method : ${f.Ay.cyan(i.method)}`),i.execPath&&"binary"===i.method&&console.log(`Binary path : ${f.Ay.gray(i.execPath)}`),i.installRoot&&console.log(`Install root : ${f.Ay.gray(i.installRoot)}`);var r="npm"===i.method||"bun"===i.method?"npm":"cdn",o=(0,h.default)(`Fetching latest version info (${r})...`).start(),s=null,p=null;try{s=(yield N(n,i.method)).version,o.succeed(`Latest ${n} (${r}): ${f.Ay.green(s)}`)}catch(e){p=e,o.warn(`Could not fetch version info: ${e.message}`)}var l=s&&s===a;if(e.checkUpdate){if(p&&process.exit(2),l)return void console.log(f.Ay.green("\nUp to date."));s&&(console.log(f.Ay.yellow(`
|
|
83
86
|
Update available: ${a} → ${s}. Run 'bricks update-cli' to install.`)),process.exit(1)),console.log(f.Ay.yellow("\nCould not determine current version.")),process.exit(2)}if(l&&(console.log(f.Ay.green("\nAlready running the latest version.")),!(yield R({message:"Reinstall anyway?",defaultValue:!1,autoYes:e.yes}))))return void console.log(f.Ay.gray("Skipped."));var d=["npm","bun","binary"].includes(i.method);d||console.log(f.Ay.yellow(`Cannot auto-detect installer (method: ${i.method}); falling back to binary install.`));var u=d?i.method:"binary";if(!(yield R({message:`Update CLI using "${u}" method?`,defaultValue:!0,autoYes:e.yes})))return void console.log(f.Ay.yellow("Cancelled."));var m=(t=c(function*(e){console.log(f.Ay.cyan(`
|
|
84
87
|
→ Running ${e} update...`));try{return yield j(e,n,i),!0}catch(t){return console.error(f.Ay.yellow(`
|
|
85
88
|
${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,arguments)}),v=yield m(u);!v&&"binary"!==u&&(console.log(f.Ay.cyan("\nFalling back to binary install (same method used by the desktop app).")),(yield R({message:"Try the binary installer as a fallback?",defaultValue:!0,autoYes:e.yes}))&&(v=yield m("binary"))),v||(console.error(f.Ay.red("\nUpdate failed. See messages above.")),process.exit(1)),console.log(f.Ay.green("\nUpdate complete."))}),function(e){return u.apply(this,arguments)}))},92642(e,t,a){a.d(t,{W:()=>_});var i,n,r,o=a(99436),s=a(5018),p=a(44668),l=a(4275),d=a(32235),u=a(62192),c=a(79657),m=a(64007);function f(e){var t,a,i,n=2;for("u">typeof Symbol&&(a=Symbol.asyncIterator,i=Symbol.iterator);n--;){if(a&&null!=(t=e[a]))return t.call(e);if(i&&null!=(t=e[i]))return new h(t.call(e));a="@@asyncIterator",i="@@iterator"}throw TypeError("Object is not async iterable")}function h(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(h=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var a=this.s.return;return void 0===a?Promise.resolve({value:e,done:!0}):t(a.apply(this.s,arguments))},throw:function(e){var a=this.s.return;return void 0===a?Promise.reject(e):t(a.apply(this.s,arguments))}},new h(e)}function v(){return(v=l(function*(e){var t=e.headers.get("content-type")||"";if(t.includes("application/json")){var a=yield d(e.json());if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));var i=Object.keys(a.data||{})[0];if(i&&Array.isArray(a.data[i]))for(var n of a.data[i])yield n;return}var r=t.match(/boundary="?([^";]+)"?/),o=r?r[1]:"-",s=`--${o}`,p="",l=!1,c=new TextDecoder,m=function*(){for(var e;-1!==(e=p.indexOf(s));){var t=p.slice(0,e);(p=p.slice(e+s.length)).startsWith("\r\n")?p=p.slice(2):p.startsWith("\n")&&(p=p.slice(1));var a=t.indexOf("\r\n\r\n"),i=-1!==a?t.slice(a+4).trim():t.trim();if(i){var n=void 0;try{n=JSON.parse(i)}catch{continue}if(n.errors?.length)throw Error(n.errors.map(e=>e.message).join("\n"));if(n.data){for(var r of Object.values(n.data))if(Array.isArray(r))for(var o of r)yield o}if(Array.isArray(n.incremental)){for(var d of n.incremental)if(Array.isArray(d.items))for(var u of d.items)yield u}if(!1===n.hasNext){l=!0;return}}}};try{var h=!1,v=!1;try{for(var g,y,D=f(e.body);h=!(y=yield d(D.next())).done;h=!1){var b=y.value;if(p+=c.decode(b,{stream:!0}),yield*u(f(m()),d),l)break}}catch(e){v=!0,g=e}finally{try{h&&null!=D.return&&(yield d(D.return()))}finally{if(v)throw g}}}catch(e){if(!e.message?.includes("Premature close")||!l)throw e}if(!l&&p.trim()){var x,_=p.indexOf("\r\n\r\n"),w=-1!==_?p.slice(_+4).trim():p.trim();if(w&&!w.startsWith("--")){try{x=JSON.parse(w)}catch{}if(x){if(x.errors?.length)throw Error(x.errors.map(e=>e.message).join("\n"));if(x.data){for(var E of Object.values(x.data))if(Array.isArray(E))for(var F of E)yield F}if(Array.isArray(x.incremental)){for(var C of x.incremental)if(Array.isArray(C.items))for(var T of C.items)yield T}!1===x.hasNext&&(l=!0)}}}e.body?.destroy()})).apply(this,arguments)}var g=`
|
|
@@ -280,6 +283,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
280
283
|
}
|
|
281
284
|
id_for_devices
|
|
282
285
|
sync_key
|
|
286
|
+
bricks_project_last_commit_id
|
|
283
287
|
create_datetime
|
|
284
288
|
last_modify_datetime
|
|
285
289
|
}
|
|
@@ -310,6 +314,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
310
314
|
use_count {
|
|
311
315
|
total_count
|
|
312
316
|
}
|
|
317
|
+
bricks_project_last_commit_id
|
|
313
318
|
create_datetime
|
|
314
319
|
last_modify_datetime
|
|
315
320
|
}
|
|
@@ -320,7 +325,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
320
325
|
description
|
|
321
326
|
current_version
|
|
322
327
|
}
|
|
323
|
-
`},89293(e,t,a){a.r(t),a.d(t,{bindApplication:()=>
|
|
328
|
+
`},89293(e,t,a){a.r(t),a.d(t,{bindApplication:()=>c,bindButtressServer:()=>x,controlDevice:()=>o,createApplication:()=>p,createApplicationWithShareVersion:()=>l,createDevice:()=>r,createMediaFileUploadRequest:()=>D,createModule:()=>f,dispatchDeviceGroupAction:()=>s,issueButtressAccessToken:()=>w,releaseApplication:()=>y,releaseModule:()=>b,shortEditApplication:()=>u,shortEditModule:()=>v,triggerApplicationCanvasControl:()=>m,unbindButtressServer:()=>_,updateApplication:()=>d,updateModule:()=>h,updateWorkspace:()=>g});var i=a(94370),n=a(48596),r=(0,i.default)`
|
|
324
329
|
mutation CLI_createDevice($bindPasscode: String, $name: String, $deviceName: String) {
|
|
325
330
|
createDevice(bindPasscode: $bindPasscode, name: $name, deviceName: $deviceName) {
|
|
326
331
|
...cliDeviceArguments
|
|
@@ -361,6 +366,25 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
361
366
|
}
|
|
362
367
|
${n.$7}
|
|
363
368
|
`,l=(0,i.default)`
|
|
369
|
+
mutation CLI_createApplicationWithShareVersion(
|
|
370
|
+
$workspaceId: ID
|
|
371
|
+
$name: String
|
|
372
|
+
$description: String
|
|
373
|
+
$shareVersionId: ID
|
|
374
|
+
$skipIfExists: Boolean
|
|
375
|
+
) {
|
|
376
|
+
createApplicationWithShareVersion(
|
|
377
|
+
workspaceId: $workspaceId
|
|
378
|
+
name: $name
|
|
379
|
+
description: $description
|
|
380
|
+
shareVersionId: $shareVersionId
|
|
381
|
+
skipIfExists: $skipIfExists
|
|
382
|
+
) {
|
|
383
|
+
...cliApplicationShortArguments
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
${n.$7}
|
|
387
|
+
`,d=(0,i.default)`
|
|
364
388
|
mutation CLI_updateApplication(
|
|
365
389
|
$id: ID!
|
|
366
390
|
$config: String
|
|
@@ -383,7 +407,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
383
407
|
}
|
|
384
408
|
}
|
|
385
409
|
${n.$7}
|
|
386
|
-
`,
|
|
410
|
+
`,u=(0,i.default)`
|
|
387
411
|
mutation CLI_shortEditApplication(
|
|
388
412
|
$id: ID!
|
|
389
413
|
$list: [ShortEditInput]!
|
|
@@ -395,7 +419,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
395
419
|
}
|
|
396
420
|
}
|
|
397
421
|
${n.$7}
|
|
398
|
-
`,
|
|
422
|
+
`,c=(0,i.default)`
|
|
399
423
|
mutation CLI_bindApplication(
|
|
400
424
|
$id: ID!
|
|
401
425
|
$bindDevices: [ID]
|
|
@@ -416,7 +440,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
416
440
|
}
|
|
417
441
|
}
|
|
418
442
|
}
|
|
419
|
-
`,
|
|
443
|
+
`,m=(0,i.default)`
|
|
420
444
|
mutation CLI_triggerApplicationCanvasControl(
|
|
421
445
|
$id: ID!
|
|
422
446
|
$testId: String!
|
|
@@ -434,7 +458,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
434
458
|
_id
|
|
435
459
|
}
|
|
436
460
|
}
|
|
437
|
-
`,
|
|
461
|
+
`,f=(0,i.default)`
|
|
438
462
|
mutation CLI_createModule(
|
|
439
463
|
$name: String
|
|
440
464
|
$description: String
|
|
@@ -459,7 +483,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
459
483
|
}
|
|
460
484
|
}
|
|
461
485
|
${n.$V}
|
|
462
|
-
`,
|
|
486
|
+
`,h=(0,i.default)`
|
|
463
487
|
mutation CLI_updateModule(
|
|
464
488
|
$id: ID!
|
|
465
489
|
$config: String
|
|
@@ -480,7 +504,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
480
504
|
}
|
|
481
505
|
}
|
|
482
506
|
${n.$V}
|
|
483
|
-
`,
|
|
507
|
+
`,v=(0,i.default)`
|
|
484
508
|
mutation CLI_shortEditModule(
|
|
485
509
|
$id: ID!
|
|
486
510
|
$list: [ShortEditInput]!
|
|
@@ -492,7 +516,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
492
516
|
name
|
|
493
517
|
}
|
|
494
518
|
}
|
|
495
|
-
`,
|
|
519
|
+
`,g=(0,i.default)`
|
|
496
520
|
mutation CLI_updateWorkspace(
|
|
497
521
|
$name: String
|
|
498
522
|
$description: String
|
|
@@ -516,7 +540,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
516
540
|
}
|
|
517
541
|
}
|
|
518
542
|
}
|
|
519
|
-
`,
|
|
543
|
+
`,y=(0,i.default)`
|
|
520
544
|
mutation CLI_releaseApplication(
|
|
521
545
|
$id: ID!
|
|
522
546
|
$config: String
|
|
@@ -535,7 +559,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
535
559
|
name
|
|
536
560
|
}
|
|
537
561
|
}
|
|
538
|
-
`,
|
|
562
|
+
`,D=(0,i.default)`
|
|
539
563
|
mutation CLI_createMediaFileUploadRequest(
|
|
540
564
|
$name: String!
|
|
541
565
|
$description: String!
|
|
@@ -562,7 +586,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
562
586
|
}
|
|
563
587
|
}
|
|
564
588
|
}
|
|
565
|
-
`,
|
|
589
|
+
`,b=(0,i.default)`
|
|
566
590
|
mutation CLI_releaseModule(
|
|
567
591
|
$id: ID!
|
|
568
592
|
$config: String
|
|
@@ -582,7 +606,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
582
606
|
name
|
|
583
607
|
}
|
|
584
608
|
}
|
|
585
|
-
`,
|
|
609
|
+
`,x=(0,i.default)`
|
|
586
610
|
mutation CLI_bindButtressServer(
|
|
587
611
|
$serverId: String!
|
|
588
612
|
$name: String
|
|
@@ -598,11 +622,11 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
598
622
|
}
|
|
599
623
|
}
|
|
600
624
|
}
|
|
601
|
-
`,
|
|
625
|
+
`,_=(0,i.default)`
|
|
602
626
|
mutation CLI_unbindButtressServer($serverId: String!) {
|
|
603
627
|
unbindButtressServer(serverId: $serverId)
|
|
604
628
|
}
|
|
605
|
-
`,
|
|
629
|
+
`,w=(0,i.default)`
|
|
606
630
|
mutation CLI_issueButtressAccessToken($ttlSeconds: Int) {
|
|
607
631
|
issueButtressAccessToken(ttlSeconds: $ttlSeconds) {
|
|
608
632
|
token
|
|
@@ -611,7 +635,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
611
635
|
jti
|
|
612
636
|
}
|
|
613
637
|
}
|
|
614
|
-
`},43741(e,t,a){a.r(t),a.d(t,{application:()=>u,applicationProject:()=>
|
|
638
|
+
`},43741(e,t,a){a.r(t),a.d(t,{application:()=>u,applicationProject:()=>E,applications:()=>c,buttressServers:()=>C,checkBindDevicePasscode:()=>g,device:()=>o,deviceGroup:()=>p,deviceGroups:()=>l,deviceUsage:()=>w,devices:()=>s,devicesByGroup:()=>d,mediaBox:()=>x,mediaBoxes:()=>b,mediaFile:()=>_,mediaFiles:()=>y,mediaWorkspace:()=>D,module:()=>f,moduleProject:()=>F,modules:()=>h,publicApplicationShareInfo:()=>m,publicModules:()=>v,workspace:()=>r});var i=a(94370),n=a(48596),r=(0,i.default)`
|
|
615
639
|
query CLI_workspace {
|
|
616
640
|
workspace {
|
|
617
641
|
...cliWorkspaceArguments
|
|
@@ -680,31 +704,56 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
680
704
|
}
|
|
681
705
|
${n.$7}
|
|
682
706
|
`,m=(0,i.default)`
|
|
707
|
+
query CLI_publicApplicationShareInfo($id: ID!) {
|
|
708
|
+
publicApplicationShareInfo(id: $id) {
|
|
709
|
+
_id
|
|
710
|
+
name
|
|
711
|
+
description
|
|
712
|
+
owner {
|
|
713
|
+
_id
|
|
714
|
+
id_from_user
|
|
715
|
+
}
|
|
716
|
+
share {
|
|
717
|
+
description
|
|
718
|
+
tags
|
|
719
|
+
type
|
|
720
|
+
usage
|
|
721
|
+
selected_releases {
|
|
722
|
+
_id
|
|
723
|
+
version
|
|
724
|
+
name
|
|
725
|
+
note
|
|
726
|
+
date
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
`,f=(0,i.default)`
|
|
683
732
|
query CLI_module($id: ID!) {
|
|
684
733
|
module(id: $id) {
|
|
685
734
|
...cliModuleArguments
|
|
686
735
|
}
|
|
687
736
|
}
|
|
688
737
|
${n.$V}
|
|
689
|
-
`,
|
|
738
|
+
`,h=(0,i.default)`
|
|
690
739
|
query CLI_modules($keyword: String, $paginate: Paginate) {
|
|
691
740
|
modules(keyword: $keyword, paginate: $paginate) {
|
|
692
741
|
...cliModuleShortArguments
|
|
693
742
|
}
|
|
694
743
|
}
|
|
695
744
|
${n.J6}
|
|
696
|
-
`,
|
|
745
|
+
`,v=(0,i.default)`
|
|
697
746
|
query CLI_publicModules($keyword: String!, $limit: Int) {
|
|
698
747
|
publicModules(keyword: $keyword, paginate: { limit: $limit }) {
|
|
699
748
|
...cliModuleShortArguments
|
|
700
749
|
}
|
|
701
750
|
}
|
|
702
751
|
${n.J6}
|
|
703
|
-
`,
|
|
752
|
+
`,g=(0,i.default)`
|
|
704
753
|
query CLI_checkBindDevicePasscode($passcode: String!) {
|
|
705
754
|
checkBindDevicePasscode(passcode: $passcode)
|
|
706
755
|
}
|
|
707
|
-
`,
|
|
756
|
+
`,y=(0,i.default)`
|
|
708
757
|
query CLI_mediaFiles(
|
|
709
758
|
$boxId: ID!
|
|
710
759
|
$includeTypes: [String]
|
|
@@ -747,7 +796,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
747
796
|
}
|
|
748
797
|
}
|
|
749
798
|
}
|
|
750
|
-
`,
|
|
799
|
+
`,D=(0,i.default)`
|
|
751
800
|
query CLI_mediaWorkspace {
|
|
752
801
|
mediaWorkspace {
|
|
753
802
|
id
|
|
@@ -760,7 +809,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
760
809
|
updatedAt
|
|
761
810
|
}
|
|
762
811
|
}
|
|
763
|
-
`,
|
|
812
|
+
`,b=(0,i.default)`
|
|
764
813
|
query CLI_mediaBoxes {
|
|
765
814
|
mediaBoxes {
|
|
766
815
|
id
|
|
@@ -781,7 +830,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
781
830
|
}
|
|
782
831
|
}
|
|
783
832
|
}
|
|
784
|
-
`,
|
|
833
|
+
`,x=(0,i.default)`
|
|
785
834
|
query CLI_mediaBox($id: ID!) {
|
|
786
835
|
mediaBox(id: $id) {
|
|
787
836
|
id
|
|
@@ -802,7 +851,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
802
851
|
}
|
|
803
852
|
}
|
|
804
853
|
}
|
|
805
|
-
`,
|
|
854
|
+
`,_=(0,i.default)`
|
|
806
855
|
query CLI_mediaFile($id: ID!) {
|
|
807
856
|
mediaFile(id: $id) {
|
|
808
857
|
id
|
|
@@ -833,7 +882,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
833
882
|
}
|
|
834
883
|
}
|
|
835
884
|
}
|
|
836
|
-
`,
|
|
885
|
+
`,w=(0,i.default)`
|
|
837
886
|
query CLI_deviceUsage($deviceId: ID, $startDate: Date, $endDate: Date) {
|
|
838
887
|
deviceUsage(deviceId: $deviceId, startDate: $startDate, endDate: $endDate) {
|
|
839
888
|
_id
|
|
@@ -852,7 +901,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
852
901
|
}
|
|
853
902
|
}
|
|
854
903
|
}
|
|
855
|
-
`,
|
|
904
|
+
`,E=(0,i.default)`
|
|
856
905
|
query CLI_applicationProject(
|
|
857
906
|
$id: ID!
|
|
858
907
|
$buildApplicationOnly: Boolean
|
|
@@ -870,7 +919,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
870
919
|
setupGeminiCLI: $setupGeminiCLI
|
|
871
920
|
)
|
|
872
921
|
}
|
|
873
|
-
`,
|
|
922
|
+
`,F=(0,i.default)`
|
|
874
923
|
query CLI_moduleProject(
|
|
875
924
|
$id: ID!
|
|
876
925
|
$buildApplicationOnly: Boolean
|
|
@@ -888,7 +937,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
888
937
|
setupGeminiCLI: $setupGeminiCLI
|
|
889
938
|
)
|
|
890
939
|
}
|
|
891
|
-
`,
|
|
940
|
+
`,C=(0,i.default)`
|
|
892
941
|
query CLI_buttressServers {
|
|
893
942
|
buttressServers {
|
|
894
943
|
serverId
|
|
@@ -897,7 +946,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
897
946
|
lastSeenAt
|
|
898
947
|
}
|
|
899
948
|
}
|
|
900
|
-
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>F});var n,r=a(99436),o=a(35679),s=a(73284),p=a(23258),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(71335),g=a(429),y=a(80274),D=a(42400),b=a(98247),x=a(11405),_=a(86141),w=a(59845),E=e([D]);D=(E.then?(await E)():E)[0];var F=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.
|
|
949
|
+
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>F});var n,r=a(99436),o=a(35679),s=a(73284),p=a(23258),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(71335),g=a(429),y=a(80274),D=a(42400),b=a(98247),x=a(11405),_=a(86141),w=a(59845),E=e([D]);D=(E.then?(await E)():E)[0];var F=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.16","-v, --version","output the version number").enablePositionalOptions(),o.DM.addCommand(d.s),o.DM.addCommand(u._),o.DM.addCommand(c.B),o.DM.addCommand(m.A),o.DM.addCommand(f.p),o.DM.addCommand(h.u),o.DM.addCommand(v.oT),o.DM.addCommand(g.K),o.DM.addCommand(y.g),o.DM.addCommand(D.D),o.DM.addCommand(b.v),o.DM.addCommand(x.l),o.DM.addCommand(_.D),o.DM.addCommand(w.Q),o.DM.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(r(function*(){try{var e=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield e()}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),o.DM.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action((e=r(function*(e){var t=yield Promise.resolve().then(a.bind(a,23258)),i=t.getToken,n=t.getBaseUrl,r=t.getCurrentProfile,o=(yield Promise.resolve().then(a.bind(a,85382))).createClient,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=r(),d=i(l);d||(console.error(s.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var u=p("Fetching workspace info...").start();try{var c=o(n(),d),m=yield c.workspace();if(u.stop(),e.json)return void console.log(JSON.stringify(m,null,2));console.log(s.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${s.Ay.green(m.name)}`),console.log(`ID: ${s.Ay.gray(m._id)}`),console.log(`Description: ${m.description||s.Ay.gray("N/A")}`),console.log(`
|
|
901
950
|
${s.Ay.bold("Data")}`),console.log(`Remote Update: ${m.bank?.enable_remote_update?s.Ay.green("Enabled"):s.Ay.gray("Disabled")}`),console.log(`Spacename: ${m.bank?.spacename||s.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){u.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),o.DM.on("--help",()=>{console.log(""),console.log(s.Ay.bold("Examples:")),console.log(""),console.log(s.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.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(s.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(s.Ay.cyan(" https://control.bricks.tools")),console.log(s.Ay.gray(" Go to Workspace Settings > API Token"))});var i=process.argv.slice(2);if(0===i.length){if((0,l.b)(i))try{var n=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield n();return}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}console.error(s.Ay.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),o.DM.outputHelp();return}yield o.DM.parseAsync(process.argv)}),function(){return n.apply(this,arguments)});let C=F;i()}catch(e){i(e)}})},56493(e,t,a){a.d(t,{o:()=>o});var i=a(73284),n=a(23258),r=a(85382),o=()=>{var e=(0,n.getCurrentProfile)(),t=(0,n.getToken)(e);return t||(console.error(i.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,r.createClient)((0,n.getBaseUrl)(),t)}},7586(e,t,a){a.d(t,{$l:()=>r,GF:()=>i,OW:()=>n});var i=e=>{console.log(JSON.stringify(e,null,2))},n=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},r=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},8479(e,t,a){a.d(t,{b:()=>n,z:()=>i});var i=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),n=(e=[])=>0===e.length&&i()},23258(e,t,i){i.r(t),i.d(t,{setActivityLogBaseUrl:()=>w,listProfiles:()=>x,removeToken:()=>h,setBaseUrl:()=>d,setProfileOverride:()=>g,getBaseUrl:()=>l,CONFIG_PATH:()=>s,CONFIG_DIR:()=>o,getCurrentProfileSource:()=>D,default:()=>F,getToken:()=>c,clearConfig:()=>E,getTokens:()=>u,getActivityLogBaseUrl:()=>_,getTokenInfo:()=>m,setCurrentProfile:()=>b,getCurrentProfile:()=>y,setToken:()=>f});var n=i(16928),r=i(70857),o=n.join(r.homedir(),".bricks-cli"),s=n.join(o,"config.json"),p=new a({projectName:"bricks-cli",cwd:o,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},createdAt:{type:"string"},baseUrl:{type:"string"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"}}}),l=()=>{var e=y(),t=p.get("tokens");return t[e]?.baseUrl||p.get("baseUrl")},d=(e,t)=>{if(!t)return void p.set("baseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].baseUrl=e,p.set("tokens",a)},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"),i=a[e];a[e]={...i?.baseUrl?{baseUrl:i.baseUrl}:{},...i?.activityLogBaseUrl?{activityLogBaseUrl:i.activityLogBaseUrl}:{},...t,createdAt:new Date().toISOString()},p.set("tokens",a)},h=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},v=null,g=e=>{v=e},y=()=>v||process.env.BRICKS_PROFILE||p.get("currentProfile"),D=()=>v?"override":process.env.BRICKS_PROFILE?"env":"config",b=e=>p.set("currentProfile",e),x=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},_=()=>{var e=y(),t=p.get("tokens");return t[e]?.activityLogBaseUrl||p.get("activityLogBaseUrl")},w=(e,t)=>{if(!t)return void p.set("activityLogBaseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].activityLogBaseUrl=e,p.set("tokens",a)},E=()=>{p.clear()};let F=p},75646(e,t,a){a.r(t),a.d(t,{discoverDevToolsServers:()=>d,httpProbeSubnet:()=>u,verifyDevToolsServer:()=>c});var i,n,r=a(99436),o=a(41314),s=a(48161),p="bricks-devtools",l=()=>{var e=[];for(var t of Object.values(s.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.push({address:a.address,broadcast:n})}())continue;return e},d=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((a,i)=>{var n=new Map,r=o.createSocket("udp4"),s=null,d=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}a([...n.values()])}};r.on("error",e=>{if(!u){u=!0,clearTimeout(s),clearTimeout(d);try{r.close()}catch{}i(e)}}),r.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if(i.s!==p||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var r=i.d?.info;if(!r)return;var o=a.address,s=`${o}:${r.port}`;n.has(s)||(n.set(s,{...r,address:o}),t&&!u&&(clearTimeout(d),d=setTimeout(c,t)))}catch{}}),r.bind(()=>{r.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:p,d:{id:`cli-${Math.random().toString(36).substring(2,9)}`}})),a=new Set(["255.255.255.255","127.0.0.1"]);for(var i of l())a.add(i.broadcast);for(var n of a)r.send(t,0,t.length,19900,n);s=setTimeout(c,e)})}),u=(i=r(function*({port:e=19851,connectTimeout:t=500,concurrency:a=50,timeout:i=0}={}){var n=l();if(0===n.length)return[];var o=[],s=i>0?Date.now()+i:0,p=[],d=new Set;for(var u of n){var m=u.address.split(".").slice(0,3).join(".");if(!d.has(m)){d.add(m);for(var f=1;f<255;f++)p.push(`${m}.${f}`)}}for(var h=0;h<p.length&&!(s&&Date.now()>=s);h+=a){var v=p.slice(h,h+a);yield Promise.allSettled(v.map(function(){var a=r(function*(a){var i=yield c(a,e,t);i&&o.push({...i,address:a,port:e})});return function(e){return a.apply(this,arguments)}}()))}return o}),function(){return i.apply(this,arguments)}),c=(n=r(function*(e,t,a=3e3){try{var i=new AbortController,n=setTimeout(()=>i.abort(),a),r=yield fetch(`http://${e}:${t}/devtools/info`,{signal:i.signal});if(clearTimeout(n),!r.ok)return null;return yield r.json()}catch{return null}}),function(e,t){return n.apply(this,arguments)})},74049(e,t,a){a.d(t,{Ku:()=>s,w9:()=>o});var i=a(79896),n=a(16928),r=new Set(["CTOR","CTOR Desktop"]),o=e=>{var t,a=`Release by ${(t=process.env.BRICKS_RELEASE_SIGN)&&r.has(t)?t:"BRICKS CLI"}`;return e?`${e}
|
|
902
951
|
|
|
903
952
|
${a}`:a},s=e=>{if(e.endsWith(".json")||e.includes("/")){if(!i.existsSync(e))throw Error(`Config file not found: ${e}`);var t=i.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:n.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},68168(e,t,a){a.d(t,{K:()=>o,Y:()=>s});var i,n=a(99436),r=e=>String(e||"").trim().toLowerCase(),o=({resource:e,query:t,items:a,fields:i,selectedBy:n=null})=>{var o=r(t),s=a.filter(e=>i.some(t=>r(t.split(".").reduce((e,t)=>e?.[t],e)??null)===o)),p=null,l=n;return"id"===n?p=a[0]||null:1===s.length?(p=s[0],l="exact"):1===a.length&&(p=a[0],l="single"),{resource:e,query:t,exactMatchCount:s.length,matchCount:a.length,selectedBy:l,ambiguous:a.length>1&&!p,resolved:p,matches:a}},s=(i=n(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return i.apply(this,arguments)})},60450(e,t,a){a.d(t,{Gu:()=>m,he:()=>h,wR:()=>u});var i,n,r,o=a(99436),s=a(79657),p=a(73024),l=a(76760),d=a(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,c=(i=o(function*(e,t,a){var i=yield e.mediaFiles({boxId:t,userTags:[`bricks_screenshot_${a}`],limit:1});return i?.[0]||null}),function(e,t,a){return i.apply(this,arguments)}),m=(e,{preferThumbnail:t=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var a=e.meta,i=a.storageEndpoint,n=a.originalFileKey,r=(t?(e=>{var t=e?.meta;if(!t)return null;if("Video"===e.fileType&&t.videoThumbOriginalFileKey)return t.videoThumbOriginalFileKey;var a=t.imageVersions||[];if(!Array.isArray(a)||0===a.length)return null;var i=a.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,t)=>e.width-t.width);return(i[0]||a[0])?.key||null})(e):null)||n;return r?`${i}/${r}`:null},f=(n=o(function*(e,t=null){var a=yield(0,s.Ay)(e);if(!a.ok)throw Error(`Failed to download screenshot: ${a.statusText}`);var i=yield a.buffer(),n=t||l.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),r=l.dirname(n);return p.existsSync(r)||p.mkdirSync(r,{recursive:!0}),p.writeFileSync(n,i),n}),function(e){return n.apply(this,arguments)}),h=(r=o(function*(e,t,a,i=null,n={}){var r=u(t)&&t.media_resource?.system_media_box_id||null;if(!r)return{error:"Media workspace not enabled for this workspace"};var o=yield c(e,r,a);if(!o)return{error:"No screenshot available for this device"};var s=m(o,n);return s?{path:yield f(s,i),file:o,url:s}:{error:"Could not build screenshot URL"}}),function(e,t,a){return r.apply(this,arguments)})},44618(e,t,a){a.d(t,{V:()=>r});var i={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},n=e=>e?.split("_")?.[0]||"",r=(e,{keyword:t,types:a}={})=>{var r=t?.trim().toLowerCase()||"",o=a?.length>0?new Set(a.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null;return Object.entries(Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var a=n(e);if(o&&!o.has(a))return!1;if(!r)return!0;var i=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(r)||i.includes(r)}).reduce((e,[t,a])=>{var i=n(t);return e[i]||(e[i]=[]),e[i].push({shortId:t,ref:a}),e},{})).map(([e,t])=>({prefix:e,label:i[e]||e,refs:t.sort((e,t)=>{var a=e.ref?.title||e.shortId,i=t.ref?.title||t.shortId;return String(a).localeCompare(String(i))})})).sort((e,t)=>e.label.localeCompare(t.label))}},94979(e,t,a){a.d(t,{p:()=>r});var i=/^(\d+)(s|m|h|d|w)$/,n={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function r(e){var t=e.match(i);if(t){var a=parseInt(t[1],10),r=n[t[2]];return new Date(Date.now()-a*r).toISOString()}var o=new Date(e);if(isNaN(o.getTime()))throw Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return o.toISOString()}},98593(e,t,a){a.d(t,{Iy:()=>r,S5:()=>s,yd:()=>p});var i=a(73284),n=a(7586),r=(e,t,a)=>({label:e,ok:t,detail:a}),o=e=>null==e?i.Ay.gray("N/A"):"object"==typeof e?i.Ay.gray(JSON.stringify(e,null,2)):String(e),s=({action:e,target:t,request:a,checks:r=[],json:s=!1})=>{s?(0,n.GF)({ok:!0,dryRun:!0,action:e,target:t||null,request:a||null,checks:r}):(console.log(i.Ay.bold(`
|