@fugood/bricks-cli 2.24.9 → 2.24.11
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/146.js +1 -0
- package/lib/153.js +1 -1
- package/lib/169.js +1 -0
- package/lib/209.js +1 -0
- package/lib/336.js +1 -0
- package/lib/378.js +1 -0
- package/lib/480.js +1 -0
- package/lib/611.js +1 -0
- package/lib/627.js +1 -0
- package/lib/632.js +1 -0
- package/lib/637.js +1 -0
- package/lib/657.js +1 -0
- package/lib/7.js +1 -0
- package/lib/700.js +863 -0
- package/lib/703.js +1 -1
- package/lib/718.js +1 -0
- package/lib/737.js +226 -226
- package/lib/779.js +1 -1
- package/lib/890.js +1 -1
- package/lib/90.js +1 -0
- package/lib/996.js +1 -0
- package/lib/index.js +1 -863
- package/package.json +1 -1
- package/lib/63.js +0 -1
package/lib/146.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __webpack_esm_id__=146;export const __webpack_esm_ids__=[146];export const __webpack_esm_modules__={4275:(e,t,r)=>{var n=r(16699);function o(e){var t,r;function o(t,r){try{var s=e[t](r),a=s.value,u=a instanceof n;Promise.resolve(u?a.v:a).then(function(r){if(u){var n="return"===t?"return":"next";if(!a.k||r.done)return o(n,r);r=e[n](r).value}i(s.done?"return":"normal",r)},function(e){o("throw",e)})}catch(e){i("throw",e)}}function i(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?o(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(i,s){var a={key:e,arg:n,resolve:i,reject:s,next:null};r?r=r.next=a:(t=r=a,o(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)},e.exports=function(e){return function(){return new o(e.apply(this,arguments))}},e.exports.__esModule=!0,e.exports.default=e.exports},5018:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},14319:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},16699:e=>{e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},23878:(e,t,r)=>{var n=r(14319).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},32235:(e,t,r)=>{var n=r(16699);e.exports=function(e){return new n(e,0)},e.exports.__esModule=!0,e.exports.default=e.exports},44668:(e,t,r)=>{var n=r(56347);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},56347:(e,t,r)=>{var n=r(14319).default,o=r(23878);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},62192:(e,t,r)=>{var n=r(16699);e.exports=function(e){var t={},r=!1;function o(t,o){return r=!0,o=new Promise(function(r){r(e[t](o))}),{done:!1,value:new n(o,1)}}return t["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(e){return r?(r=!1,e):o("next",e)},"function"==typeof e.throw&&(t.throw=function(e){if(r)throw r=!1,e;return o("throw",e)}),"function"==typeof e.return&&(t.return=function(e){return r?(r=!1,e):o("return",e)}),t},e.exports.__esModule=!0,e.exports.default=e.exports},77146:(e,t,r)=>{r.d(t,{ActivityLogClient:()=>w,createActivityLogClient:()=>_}),r.r(t);var n=r(99436),o=r(5018),i=r(44668),s=r(4275),a=r(32235),u=r(62192),l=r(79657),f=r(64007);function c(e){var t,r,n,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new y(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function y(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return y=function(e){this.s=e,this.n=e.next},y.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new y(e)}function*p(e){if(e.errors?.length)throw new Error(e.errors.map(e=>e.message).join("\n"));if(e.data)for(var t of Object.values(e.data))if(Array.isArray(t))for(var r of t)yield r;if(Array.isArray(e.incremental))for(var n of e.incremental)if(Array.isArray(n.items))for(var o of n.items)yield o}function v(){return(v=s(function*(e){var t=e.headers.get("content-type")||"";if(t.includes("application/json")){var r=yield a(e.json());if(r.errors?.length)throw new Error(r.errors.map(e=>e.message).join("\n"));var n=Object.keys(r.data||{})[0];if(n&&Array.isArray(r.data[n]))for(var o of r.data[n])yield o}else{var i=t.match(/boundary="?([^";]+)"?/),s=`--${i?i[1]:"-"}`,l="",f=!1,y=new TextDecoder,v=e=>{for(var t=0;-1!==(t=e.indexOf(s,t));){if(0===t||"\n"===e[t-1])return t;t+=s.length}return-1},h=function*(){for(var e;-1!==(e=v(l));){var t=l.slice(0,e);(l=l.slice(e+s.length)).startsWith("\r\n")?l=l.slice(2):l.startsWith("\n")&&(l=l.slice(1));var r=t.indexOf("\r\n\r\n"),n=-1!==r?t.slice(r+4).trim():t.trim();if(n){var o=void 0;try{o=JSON.parse(n)}catch{continue}if(yield*p(o),!1===o.hasNext)return void(f=!0)}}};try{var d,m=!1,x=!1;try{for(var b,w=c(e.body);m=!(b=yield a(w.next())).done;m=!1){var _=b.value;if(l+=y.decode(_,{stream:!0}),yield*u(c(h()),a),f)break}}catch(e){x=!0,d=e}finally{try{m&&null!=w.return&&(yield a(w.return()))}finally{if(x)throw d}}}catch(e){if(!e.message?.includes("Premature close")||!f)throw e}if(!f&&l.trim()){var g=l.indexOf("\r\n\r\n"),k=-1!==g?l.slice(g+4).trim():l.trim();if(k&&!k.startsWith("--")){var S;try{S=JSON.parse(k)}catch{}S&&(yield*u(c(p(S)),a),!1===S.hasNext&&(f=!0))}}e.body?.destroy()}})).apply(this,arguments)}function h(e){var t,r,n,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new d(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function d(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return d=function(e){this.s=e,this.n=e.next},d.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new d(e)}var m,x,b,w=i(function e(t,r){o(this,e),this.baseUrl=t,this.token=r,this.graphqlUrl=`${t}/api/graphql`,this.fetch=function(e){var t=process.env.HTTPS_PROXY||process.env.https_proxy;if(!t||!e.startsWith("https://"))return l.Ay;var r=new f(t);return(e,t={})=>(0,l.Ay)(e,{...t,agent:r})}(t)},[{key:"streamQuery",value:function(e,t){var r=this;return s(function*(e,t,{signal:n}={}){var o=yield a(r.fetch(r.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.token}`,Accept:'multipart/mixed; boundary="-", application/json'},body:JSON.stringify({query:e,variables:t}),signal:n}));if(!o.ok){var i=yield a(o.text().catch(()=>""));throw new Error(`Activity-log query failed (${o.status}): ${i}`)}yield*u(h(function(e){return v.apply(this,arguments)}(o)),a)}).apply(this,arguments)}},{key:"events",value:function(e,t){var r=this;return s(function*(){yield*u(h(r.streamQuery("\n query AL_events($filter: EventsFilter!) {\n events(filter: $filter) @stream {\n device_id\n event_type\n event_name\n subspace_id\n sender\n payload\n timestamp\n }\n }\n",{filter:e},t)),a)})()}},{key:"screenshots",value:function(e,t){var r=this;return s(function*(){yield*u(h(r.streamQuery("\n query AL_screenshots($filter: ScreenshotFilter!) {\n screenshots(filter: $filter) @stream {\n timestamp\n }\n }\n",{filter:e},t)),a)})()}},{key:"collectEvents",value:(b=n(function*(e,{limit:t,signal:r}={}){var n,o=[],i=!1,s=!1;try{for(var a,u=h(this.events(e,{signal:r}));i=!(a=yield u.next()).done;i=!1){var l=a.value;if(o.push(l),t&&o.length>=t)break}}catch(e){s=!0,n=e}finally{try{i&&null!=u.return&&(yield u.return())}finally{if(s)throw n}}return o}),function(e){return b.apply(this,arguments)})},{key:"collectScreenshots",value:(x=n(function*(e,{signal:t}={}){var r,n=[],o=!1,i=!1;try{for(var s,a=h(this.screenshots(e,{signal:t}));o=!(s=yield a.next()).done;o=!1){var u=s.value;n.push(u)}}catch(e){i=!0,r=e}finally{try{o&&null!=a.return&&(yield a.return())}finally{if(i)throw r}}return n}),function(e){return x.apply(this,arguments)})},{key:"downloadScreenshot",value:(m=n(function*(e,t,r,{signal:n}={}){var o=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(t)}/screenshot?ts=${encodeURIComponent(r)}`,i=yield this.fetch(o,{headers:{Authorization:`Bearer ${this.token}`},signal:n});if(!i.ok){var s=yield i.text().catch(()=>"");throw new Error(`Screenshot fetch failed (${i.status}): ${s}`)}return Buffer.from(yield i.arrayBuffer())}),function(e,t,r){return m.apply(this,arguments)})}]),_=(e,t)=>new w(e,t)}};
|
package/lib/153.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_id__=153;export const __webpack_esm_ids__=[153];export const __webpack_esm_modules__={8870:(e,t,i)=>{var r=i(65650),n=Object.prototype,o=n.hasOwnProperty,u=n.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),i=e[a];try{e[a]=void 0;var r=!0}catch(e){}var n=u.call(e);return r&&(t?e[a]=i:delete e[a]),n}},10482:e=>{var t="\\ud800-\\udfff",i="\\u2700-\\u27bf",r="a-z\\xdf-\\xf6\\xf8-\\xff",n="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",u="["+o+"]",a="\\d+",l="["+i+"]",c="["+r+"]",s="[^"+t+o+a+i+r+n+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",p="["+n+"]",g="(?:"+c+"|"+s+")",y="(?:"+p+"|"+s+")",v="(?:['’](?:d|ll|m|re|s|t|ve))?",x="(?:['’](?:D|LL|M|RE|S|T|VE))?",h="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",m="[\\ufe0e\\ufe0f]?",b=m+h+("(?:\\u200d(?:"+["[^"+t+"]",d,f].join("|")+")"+m+h+")*"),A="(?:"+[l,d,f].join("|")+")"+b,j=RegExp([p+"?"+c+"+"+v+"(?="+[u,p,"$"].join("|")+")",y+"+"+x+"(?="+[u,p+g,"$"].join("|")+")",p+"?"+g+"+"+v,p+"+"+x,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",a,A].join("|"),"g");e.exports=function(e){return e.match(j)||[]}},10750:(e,t,i)=>{var r=i(93640)(function(e,t,i){return e+(i?"-":"")+t.toLowerCase()});e.exports=r},15813:e=>{var t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return t.test(e)}},18050:(e,t,i)=>{i.d(t,{BZ:()=>m,KN:()=>v,kU:()=>y,o0:()=>h,oz:()=>x});var r,n,o,u,a=i(99436),l=i(16928),c=i(79896),s=i(35317),d=i(10750),f=e=>{try{return(0,s.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},p=(e,t,i)=>new Promise((r,n)=>{var o=[e,...t].join(" "),u=(0,s.spawn)(o,[],{cwd:i,stdio:"pipe",shell:!0}),a=[];u.stderr.on("data",e=>a.push(e)),u.on("close",e=>{if(0===e)r();else{var t=Buffer.concat(a).toString().trim();n(new Error(t||`Command failed with code ${e}`))}}),u.on("error",n)}),g=(r=a(function*(e,t){try{var r=(yield Promise.resolve().then(i.bind(i,79491))).format;return(yield r(t,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,t){return r.apply(this,arguments)}),y=(e=[])=>{var t=e.find(e=>"application.json"===e.name);if(!t)return"bricks-ctor";try{var i=JSON.parse(t.input);return d(i.name||"bricks-ctor")}catch{return"bricks-ctor"}},v=(n=a(function*(e,t){return Promise.all(e.map((i=a(function*(e){var i=l.join(t,e.name),r=e.input;return e.formatable&&(r=yield g(r,i)),{...e,filePath:i,content:r}}),function(e){return i.apply(this,arguments)})));var i}),function(e,t){return n.apply(this,arguments)}),x=e=>{e.forEach(e=>{c.mkdirSync(l.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},h=(o=a(function*(e,t={}){var i="function"==typeof t.onStatus?t.onStatus:()=>{},r=!1,n=!1;if(!1!==t.install&&f("bun")){i("Installing dependencies (bun install)...");try{yield p("bun",["install"],e),r=!0}catch{}}if(!1!==t.git&&f("git")){i("Initializing git repository...");try{yield p("git",["init"],e),yield p("git",["add","."],e),yield p("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),n=!0}catch{}}return{bunInstalled:r,gitInitialized:n}}),function(e){return o.apply(this,arguments)}),m=(u=a(function*(e,t,i){var r=i.client,n=i.output,o=i.outputAsTarget;if(!r)throw new Error("client is required");if(!n)throw new Error("output directory is required");var u=(e=>{for(var t=l.resolve(e);;){if(c.existsSync(l.join(t,"application.json"))||c.existsSync(l.join(t,"module.json")))return t;var i=l.dirname(t);if(i===t)return null;t=i}})(o?l.dirname(l.resolve(n)):n);if(u)throw new Error(`Cannot initialize a new BRICKS project inside an existing project (${u}). Choose a directory outside the project.`);var a="application"===e,s=a?"applicationProject":"moduleProject",d=a?r.queries.applicationProject:r.queries.moduleProject,f=(yield r.query(d,{id:t,buildApplicationOnly:!1,setupGitHubActions:!1!==i.githubActions,setupAgents:!1!==i.agents,setupClaudeCode:!1!==i.claude,setupGeminiCLI:!0===i.gemini}))[s];if(!f?.files)throw new Error(`${e} project not found`);var p=y(f.files),g=o?l.resolve(n):l.resolve(n,p);if(c.existsSync(g))throw new Error(`Directory already exists: ${g}`);c.mkdirSync(g,{recursive:!0});var m=yield v(f.files,g);x(m);var b=yield h(g,i),A=b.bunInstalled,j=b.gitInitialized;return{success:!0,path:g,files:f.files.length,bunInstalled:A,gitInitialized:j}}),function(e,t,i){return u.apply(this,arguments)})},29005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},39546:e=>{var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},39850:(e,t,i)=>{var r=i(39546),n=i(15813),o=i(95243),u=i(10482);e.exports=function(e,t,i){return e=o(e),void 0===(t=i?void 0:t)?n(e)?u(e):r(e):e.match(t)||[]}},44187:e=>{e.exports=function(e,t,i,r){var n=-1,o=null==e?0:e.length;for(r&&o&&(i=e[++n]);++n<o;)i=t(i,e[n],n,e);return i}},45881:(e,t,i)=>{var r=i(69968),n=i(95243),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=n(e))&&e.replace(o,r).replace(u,"")}},47153:(e,t,i)=>{i.r(t),i.d(t,{initProject:()=>p});var r,n,o=i(99436),u=i(16928),a=i(88568),l=i(29790),c=i(84553),s=i(88055),d=i(18050),f=(r=o(function*(e,t){console.log(a.Ay.bold.cyan(`\nInitialize BRICKS Project: ${t}\n`));var i=yield(0,c.kv)({message:"Select files to include:",choices:[{name:"GitHub Actions workflow (.github/workflows/ci.yml)",value:"githubActions",checked:!1!==e.githubActions},{name:"AGENTS.md",value:"agents",checked:!1!==e.agents},{name:"CLAUDE.md",value:"claude",checked:!1!==e.claude},{name:"GEMINI.md",value:"gemini",checked:!0===e.gemini}]}),r=yield(0,c.kv)({message:"Select post-generation steps:",choices:[{name:"Run bun install",value:"install",checked:!1!==e.install},{name:"Initialize git repository",value:"git",checked:!1!==e.git}]}),n=e.output?u.resolve(e.output):u.join(process.cwd(),t),o=yield(0,c.hF)({message:"Output directory:",default:n});return{githubActions:i.includes("githubActions"),agents:i.includes("agents"),claude:i.includes("claude"),gemini:i.includes("gemini"),install:r.includes("install"),git:r.includes("git"),output:o,outputAsTarget:!0}}),function(e,t){return r.apply(this,arguments)}),p=(n=o(function*(e,t,i){var r=(0,s.o)(),n=i.json,o=i.yes||n,c="application"===e,p=c?"applicationProject":"moduleProject",g=c?r.queries.applicationProject:r.queries.moduleProject,y=n?null:(0,l.default)(`Fetching ${e} info...`).start(),v="bricks-ctor";try{var x=(yield r.query(g,{id:t,buildApplicationOnly:!0}))[p];x?.files&&(v=(0,d.kU)(x.files)),y&&y.stop()}catch{y&&y.stop()}var h={...i};if(!o)try{var m=yield f(i,v);h={...i,...m}}catch{console.log(a.Ay.yellow("\nCancelled")),process.exit(0)}y=n?null:(0,l.default)(`Fetching ${e} project...`).start();var b=Boolean(h.output);try{var A=yield(0,d.BZ)(e,t,{client:r,output:b?h.output:process.cwd(),outputAsTarget:b||!0===h.outputAsTarget,install:h.install,git:h.git,githubActions:h.githubActions,agents:h.agents,claude:h.claude,gemini:h.gemini});y&&y.succeed(`Project created: ${a.Ay.green(A.path)} (${A.files} files)`),n?console.log(JSON.stringify(A)):(console.log(""),console.log(a.Ay.bold.green("Project initialized successfully!")),console.log(""),console.log(a.Ay.bold("Next steps:")),console.log(a.Ay.gray(` cd ${u.basename(A.path)}`)),A.bunInstalled||console.log(a.Ay.gray(" bun install")),console.log(a.Ay.gray(" bun preview")),console.log(""),console.log(a.Ay.gray(`For more information, see ${u.basename(A.path)}/README.md`)))}catch(t){n?console.error(JSON.stringify({error:t.message})):y?y.fail(`Failed to initialize ${e} project: ${t.message}`):console.error(a.Ay.red(`Failed to initialize ${e} project: ${t.message}`)),process.exit(1)}}),function(e,t,i){return n.apply(this,arguments)})},51035:e=>{e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},51187:(e,t,i)=>{var r=i(87379),n=i(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==r(e)}},52291:(e,t,i)=>{var r=i(65650),n=i(65111),o=i(53142),u=i(51187),a=r?r.prototype:void 0,l=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return n(t,e)+"";if(u(t))return l?l.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i}},53142:e=>{var t=Array.isArray;e.exports=t},65111:e=>{e.exports=function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}},65650:(e,t,i)=>{var r=i(78942).Symbol;e.exports=r},69968:(e,t,i)=>{var r=i(51035)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});e.exports=r},74967:e=>{var t="object"==typeof global&&global&&global.Object===Object&&global;e.exports=t},78942:(e,t,i)=>{var r=i(74967),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();e.exports=o},80547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},87379:(e,t,i)=>{var r=i(65650),n=i(8870),o=i(29005),u=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?n(e):o(e)}},93640:(e,t,i)=>{var r=i(44187),n=i(45881),o=i(39850),u=RegExp("['’]","g");e.exports=function(e){return function(t){return r(o(n(t).replace(u,"")),e,"")}}},95243:(e,t,i)=>{var r=i(52291);e.exports=function(e){return null==e?"":r(e)}}};
|
|
1
|
+
export const __webpack_esm_id__=153;export const __webpack_esm_ids__=[153];export const __webpack_esm_modules__={8870:(e,t,i)=>{var n=i(65650),r=Object.prototype,o=r.hasOwnProperty,u=r.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),i=e[a];try{e[a]=void 0;var n=!0}catch(e){}var r=u.call(e);return n&&(t?e[a]=i:delete e[a]),r}},10482:e=>{var t="\\ud800-\\udfff",i="\\u2700-\\u27bf",n="a-z\\xdf-\\xf6\\xf8-\\xff",r="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",u="["+o+"]",a="\\d+",l="["+i+"]",c="["+n+"]",s="[^"+t+o+a+i+n+r+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",p="["+r+"]",g="(?:"+c+"|"+s+")",y="(?:"+p+"|"+s+")",x="(?:['’](?:d|ll|m|re|s|t|ve))?",h="(?:['’](?:D|LL|M|RE|S|T|VE))?",v="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",b="[\\ufe0e\\ufe0f]?",m=b+v+("(?:\\u200d(?:"+["[^"+t+"]",d,f].join("|")+")"+b+v+")*"),j="(?:"+[l,d,f].join("|")+")"+m,A=RegExp([p+"?"+c+"+"+x+"(?="+[u,p,"$"].join("|")+")",y+"+"+h+"(?="+[u,p+g,"$"].join("|")+")",p+"?"+g+"+"+x,p+"+"+h,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",a,j].join("|"),"g");e.exports=function(e){return e.match(A)||[]}},10750:(e,t,i)=>{var n=i(93640)(function(e,t,i){return e+(i?"-":"")+t.toLowerCase()});e.exports=n},15813:e=>{var t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return t.test(e)}},18050:(e,t,i)=>{i.d(t,{BZ:()=>b,KN:()=>x,kU:()=>y,o0:()=>v,oz:()=>h});var n,r,o,u,a=i(99436),l=i(16928),c=i(79896),s=i(35317),d=i(10750),f=e=>{try{return(0,s.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},p=(e,t,i)=>new Promise((n,r)=>{var o=[e,...t].join(" "),u=(0,s.spawn)(o,[],{cwd:i,stdio:"pipe",shell:!0}),a=[];u.stderr.on("data",e=>a.push(e)),u.on("close",e=>{if(0===e)n();else{var t=Buffer.concat(a).toString().trim();r(new Error(t||`Command failed with code ${e}`))}}),u.on("error",r)}),g=(n=a(function*(e,t){try{var n=(yield Promise.resolve().then(i.bind(i,79491))).format;return(yield n(t,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,t){return n.apply(this,arguments)}),y=(e=[])=>{var t=e.find(e=>"application.json"===e.name);if(!t)return"bricks-ctor";try{var i=JSON.parse(t.input);return d(i.name||"bricks-ctor")}catch{return"bricks-ctor"}},x=(r=a(function*(e,t){return Promise.all(e.map((i=a(function*(e){var i=l.join(t,e.name),n=e.input;return e.formatable&&(n=yield g(n,i)),{...e,filePath:i,content:n}}),function(e){return i.apply(this,arguments)})));var i}),function(e,t){return r.apply(this,arguments)}),h=e=>{e.forEach(e=>{c.mkdirSync(l.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},v=(o=a(function*(e,t={}){var i="function"==typeof t.onStatus?t.onStatus:()=>{},n=!1,r=!1;if(!1!==t.install&&f("bun")){i("Installing dependencies (bun install)...");try{yield p("bun",["install"],e),n=!0}catch{}}if(!1!==t.git&&f("git")){i("Initializing git repository...");try{yield p("git",["init"],e),yield p("git",["add","."],e),yield p("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),r=!0}catch{}}return{bunInstalled:n,gitInitialized:r}}),function(e){return o.apply(this,arguments)}),b=(u=a(function*(e,t,i){var n=i.client,r=i.output,o=i.outputAsTarget;if(!n)throw new Error("client is required");if(!r)throw new Error("output directory is required");var u=(e=>{for(var t=l.resolve(e);;){if(c.existsSync(l.join(t,"application.json"))||c.existsSync(l.join(t,"module.json")))return t;var i=l.dirname(t);if(i===t)return null;t=i}})(o?l.dirname(l.resolve(r)):r);if(u)throw new Error(`Cannot initialize a new BRICKS project inside an existing project (${u}). Choose a directory outside the project.`);var a="application"===e?n.applicationProject:n.moduleProject,s=yield a({id:t,buildApplicationOnly:!1,setupGitHubActions:!1!==i.githubActions,setupAgents:!1!==i.agents,setupClaudeCode:!1!==i.claude,setupGeminiCLI:!0===i.gemini});if(!s?.files)throw new Error(`${e} project not found`);var d=y(s.files),f=o?l.resolve(r):l.resolve(r,d);if(c.existsSync(f))throw new Error(`Directory already exists: ${f}`);c.mkdirSync(f,{recursive:!0});var p=yield x(s.files,f);h(p);var g=yield v(f,i),b=g.bunInstalled,m=g.gitInitialized;return{success:!0,path:f,files:s.files.length,bunInstalled:b,gitInitialized:m}}),function(e,t,i){return u.apply(this,arguments)})},29005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},39546:e=>{var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},39850:(e,t,i)=>{var n=i(39546),r=i(15813),o=i(95243),u=i(10482);e.exports=function(e,t,i){return e=o(e),void 0===(t=i?void 0:t)?r(e)?u(e):n(e):e.match(t)||[]}},44187:e=>{e.exports=function(e,t,i,n){var r=-1,o=null==e?0:e.length;for(n&&o&&(i=e[++r]);++r<o;)i=t(i,e[r],r,e);return i}},45881:(e,t,i)=>{var n=i(69968),r=i(95243),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=r(e))&&e.replace(o,n).replace(u,"")}},47153:(e,t,i)=>{i.r(t),i.d(t,{initProject:()=>p});var n,r,o=i(99436),u=i(16928),a=i(88568),l=i(29790),c=i(60637),s=i(88055),d=i(18050),f=(n=o(function*(e,t){console.log(a.default.bold.cyan(`\nInitialize BRICKS Project: ${t}\n`));var i=yield(0,c.checkbox)({message:"Select files to include:",choices:[{name:"GitHub Actions workflow (.github/workflows/ci.yml)",value:"githubActions",checked:!1!==e.githubActions},{name:"AGENTS.md",value:"agents",checked:!1!==e.agents},{name:"CLAUDE.md",value:"claude",checked:!1!==e.claude},{name:"GEMINI.md",value:"gemini",checked:!0===e.gemini}]}),n=yield(0,c.checkbox)({message:"Select post-generation steps:",choices:[{name:"Run bun install",value:"install",checked:!1!==e.install},{name:"Initialize git repository",value:"git",checked:!1!==e.git}]}),r=e.output?u.resolve(e.output):u.join(process.cwd(),t),o=yield(0,c.input)({message:"Output directory:",default:r});return{githubActions:i.includes("githubActions"),agents:i.includes("agents"),claude:i.includes("claude"),gemini:i.includes("gemini"),install:n.includes("install"),git:n.includes("git"),output:o,outputAsTarget:!0}}),function(e,t){return n.apply(this,arguments)}),p=(r=o(function*(e,t,i){var n=(0,s.requireAuth)(),r=i.json,o=i.yes||r,c="application"===e?n.applicationProject:n.moduleProject,p=r?null:(0,l.default)(`Fetching ${e} info...`).start(),g="bricks-ctor";try{var y=yield c({id:t,buildApplicationOnly:!0});y?.files&&(g=(0,d.kU)(y.files)),p&&p.stop()}catch{p&&p.stop()}var x={...i};if(!o)try{var h=yield f(i,g);x={...i,...h}}catch{console.log(a.default.yellow("\nCancelled")),process.exit(0)}p=r?null:(0,l.default)(`Fetching ${e} project...`).start();var v=Boolean(x.output);try{var b=yield(0,d.BZ)(e,t,{client:n,output:v?x.output:process.cwd(),outputAsTarget:v||!0===x.outputAsTarget,install:x.install,git:x.git,githubActions:x.githubActions,agents:x.agents,claude:x.claude,gemini:x.gemini});p&&p.succeed(`Project created: ${a.default.green(b.path)} (${b.files} files)`),r?console.log(JSON.stringify(b)):(console.log(""),console.log(a.default.bold.green("Project initialized successfully!")),console.log(""),console.log(a.default.bold("Next steps:")),console.log(a.default.gray(` cd ${u.basename(b.path)}`)),b.bunInstalled||console.log(a.default.gray(" bun install")),console.log(a.default.gray(" bun preview")),console.log(""),console.log(a.default.gray(`For more information, see ${u.basename(b.path)}/README.md`)))}catch(t){r?console.error(JSON.stringify({error:t.message})):p?p.fail(`Failed to initialize ${e} project: ${t.message}`):console.error(a.default.red(`Failed to initialize ${e} project: ${t.message}`)),process.exit(1)}}),function(e,t,i){return r.apply(this,arguments)})},51035:e=>{e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},51187:(e,t,i)=>{var n=i(87379),r=i(80547);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==n(e)}},52291:(e,t,i)=>{var n=i(65650),r=i(65111),o=i(53142),u=i(51187),a=n?n.prototype:void 0,l=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return r(t,e)+"";if(u(t))return l?l.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i}},53142:e=>{var t=Array.isArray;e.exports=t},65111:e=>{e.exports=function(e,t){for(var i=-1,n=null==e?0:e.length,r=Array(n);++i<n;)r[i]=t(e[i],i,e);return r}},65650:(e,t,i)=>{var n=i(78942).Symbol;e.exports=n},69968:(e,t,i)=>{var n=i(51035)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"});e.exports=n},74967:e=>{var t="object"==typeof global&&global&&global.Object===Object&&global;e.exports=t},78942:(e,t,i)=>{var n=i(74967),r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")();e.exports=o},80547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},87379:(e,t,i)=>{var n=i(65650),r=i(8870),o=i(29005),u=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?r(e):o(e)}},93640:(e,t,i)=>{var n=i(44187),r=i(45881),o=i(39850),u=RegExp("['’]","g");e.exports=function(e){return function(t){return n(o(r(t).replace(u,"")),e,"")}}},95243:(e,t,i)=>{var n=i(52291);e.exports=function(e){return null==e?"":n(e)}}};
|
package/lib/169.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __webpack_esm_id__=169;export const __webpack_esm_ids__=[169];export const __webpack_esm_modules__={98169:(e,a,r)=>{r.r(a),r.d(a,{BANK_DISABLED_MESSAGE:()=>o.GE,DEFAULT_BANK_KEY_NAME:()=>p,clearStoredBankCredentials:()=>_,issueBankCredentials:()=>k,resolveBankCredentials:()=>l});var n,s,t,c=r(99436),i=r(74752),o=r(63402),p="bricks-cli",k=(n=c(function*(e,{keyName:a}={}){var r=(0,i.getCurrentProfile)(),n=yield e.workspace(),s=n?.bank;if(!s?.enable_remote_update||!s?.spacename)throw new Error(o.GE);var t=(0,i.getBankCredentials)(r),c=new Set((s.keys||[]).map(e=>e.value)),k=a||p,l=yield e.updateWorkspace({newBankKey:{name:k,enableExpired:!1}}),_=(l?.bank?.keys||[]).find(e=>!c.has(e.value));if(!_)throw new Error("Failed to issue a Data Bank space key");t?.spacekey&&t.spacekey!==_.value&&(yield e.updateWorkspace({revokeBankKey:t.spacekey}).catch(()=>{}));var u={spacename:l.bank.spacename,spacekey:_.value,keyName:_.name||k,issuedAt:_.createAt||(new Date).toISOString()};return(0,i.setBankCredentials)(r,u),u}),function(e){return n.apply(this,arguments)}),l=(s=c(function*(e){if(process.env.BRICKS_BANK_SPACENAME&&process.env.BRICKS_BANK_SPACEKEY)return{spacename:process.env.BRICKS_BANK_SPACENAME,spacekey:process.env.BRICKS_BANK_SPACEKEY,source:"env"};var a=(0,i.getBankCredentials)((0,i.getCurrentProfile)());return a?.spacename&&a?.spacekey?{...a,source:"profile"}:{...yield k(e),source:"issued"}}),function(e){return s.apply(this,arguments)}),_=(t=c(function*(e,{revoke:a}={}){var r=(0,i.getCurrentProfile)(),n=(0,i.getBankCredentials)(r),s=!1;return a&&n?.spacekey&&(yield e.updateWorkspace({revokeBankKey:n.spacekey}),s=!0),{cleared:(0,i.clearBankCredentials)(r),revoked:s}}),function(e){return t.apply(this,arguments)})}};
|
package/lib/209.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __webpack_esm_id__=209;export const __webpack_esm_ids__=[209];export const __webpack_esm_modules__={56209:(e,r,n)=>{n.r(r),n.d(r,{runWithConcurrency:()=>o});var t,_=n(99436),o=(t=_(function*(e,r,n){var t,o=[],i=0,c=(t=_(function*(){for(;i<e.length;){var r=i++;o[r]=yield n(e[r],r)}}),function(){return t.apply(this,arguments)}),s=Number.isInteger(r)&&r>0?r:1,a=Array.from({length:Math.min(s,e.length)},()=>c());return yield Promise.all(a),o}),function(e,r,n){return t.apply(this,arguments)})}};
|
package/lib/336.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __webpack_esm_id__=336;export const __webpack_esm_ids__=[336];export const __webpack_esm_modules__={47336:(e,r,i)=>{i.r(r),i.d(r,{buildScreenshotUrl:()=>f,downloadScreenshot:()=>m,fetchAndSaveScreenshot:()=>p,getDeviceScreenshot:()=>h,getSystemMediaBoxId:()=>_,isMediaEnabled:()=>c});var n,t,o,a=i(99436),l=i(79657),s=i(73024),u=i(76760),d=i(48161),c=e=>!0===e?.media_resource?.enable_media_workspace,_=e=>c(e)&&e.media_resource?.system_media_box_id||null,h=(n=a(function*(e,r,i){var n=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${i}`],limit:1});return n?.[0]||null}),function(e,r,i){return n.apply(this,arguments)}),f=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var i=e.meta,n=i.storageEndpoint,t=i.originalFileKey,o=r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var i=r.imageVersions||[];if(!Array.isArray(i)||0===i.length)return null;var n=i.filter(e=>"BOUNDED"===e?.strategy&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(n[0]||i[0])?.key||null})(e):null,a=o||t;return a?`${n}/${a}`:null},m=(t=a(function*(e,r=null){var i=yield(0,l.Ay)(e);if(!i.ok)throw new Error(`Failed to download screenshot: ${i.statusText}`);var n=yield i.buffer(),t=r||u.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),o=u.dirname(t);return s.existsSync(o)||s.mkdirSync(o,{recursive:!0}),s.writeFileSync(t,n),t}),function(e){return t.apply(this,arguments)}),p=(o=a(function*(e,r,i,n=null,t={}){var o=_(r);if(!o)return{error:"Media workspace not enabled for this workspace"};var a=yield h(e,o,i);if(!a)return{error:"No screenshot available for this device"};var l=f(a,t);return l?{path:yield m(l,n),file:a,url:l}:{error:"Could not build screenshot URL"}}),function(e,r,i){return o.apply(this,arguments)})}};
|