@fugood/bricks-cli 2.25.0-beta.74 → 2.25.0-beta.76

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/6818.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.74")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
1
+ export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.76")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
package/lib/7294.js ADDED
@@ -0,0 +1,19 @@
1
+ import*as e from"ink";import*as r from"react";import*as t from"react/jsx-runtime";export const __rspack_esm_id=7294;export const __rspack_esm_ids=[7294];export const __webpack_modules__={8498(r){r.exports=e},51649(e){e.exports=r},71178(e){e.exports=t},94685(e,r,t){t.r(r),t.d(r,{AppList:()=>k,CONTROL_ACTIONS:()=>h,MainMenu:()=>D,Header:()=>j,ModuleDetail:()=>O,ONLINE_THRESHOLD_MS:()=>f,ShortEditEditor:()=>J,MediaFileList:()=>$,App:()=>eo,DeviceDetail:()=>A,VIEWS:()=>x,runInteractiveMode:()=>es,DeviceList:()=>I,MediaBoxList:()=>N,Loading:()=>T,DeviceControl:()=>B,ProjectInitView:()=>ei,GroupDetail:()=>R,ModuleList:()=>L,MediaBoxDetail:()=>U,GroupList:()=>P,Footer:()=>v,DeviceStatus:()=>b,AppDetail:()=>w,DeviceScreenshot:()=>C,MediaFileDetail:()=>G});var l,n=t(99436),i=t(51649),o=t(8498),a=t(68832),s=t(85382),c=t(47988),d=t(31802),u=t(60450),x={MAIN:"main",DEVICES:"devices",DEVICE_DETAIL:"device_detail",DEVICE_CONTROL:"device_control",DEVICE_SCREENSHOT:"device_screenshot",APPS:"apps",APP_DETAIL:"app_detail",APP_SHORT_EDIT:"app_short_edit",APP_PROJECT_INIT:"app_project_init",MODULES:"modules",MODULE_DETAIL:"module_detail",MODULE_SHORT_EDIT:"module_short_edit",MODULE_PROJECT_INIT:"module_project_init",GROUPS:"groups",GROUP_DETAIL:"group_detail",MEDIA_BOXES:"media_boxes",MEDIA_BOX_DETAIL:"media_box_detail",MEDIA_FILES:"media_files",MEDIA_FILE_DETAIL:"media_file_detail",ACTIVITY_LOG:"activity_log"},h=[{label:"Refresh Application",value:"refresh"},{label:"Clear Cache",value:"clear-cache"},{label:"Take Screenshot",value:"take-screenshot"},{label:"Open System Menu",value:"system-menu-open"},{label:"Close System Menu",value:"system-menu-close"},{label:"Open Debug Panel",value:"debug-panel-open"},{label:"Close Debug Panel",value:"debug-panel-close"},{label:"Enable Logging",value:"logging-on"},{label:"Disable Logging",value:"logging-off"},{label:"← Back",value:"back"}],f=3e5,m=t(47882),p=t(71178),g=(e,r=!0)=>{var t=Math.floor(60),l=a((0,i.useState)(t),2),n=l[0],o=l[1],s=a((0,i.useState)(null),2),c=s[0],d=s[1],u=(0,i.useRef)(e);(0,i.useEffect)(()=>{u.current=e},[e]);var x=(0,i.useCallback)(()=>{o(t),d(Date.now())},[t]);return(0,i.useEffect)(()=>{if(r){var e=setInterval(()=>{o(e=>e<=1?(u.current?.(),d(Date.now()),t):e-1)},1e3);return()=>clearInterval(e)}},[r,t]),(0,i.useEffect)(()=>{r&&(o(t),d(Date.now()))},[r,t]),{countdown:n,lastRefreshTime:c,resetCountdown:x}},y=({countdown:e,lastRefreshTime:r})=>(0,p.jsx)(o.Box,{children:(0,p.jsxs)(o.Text,{color:"gray",children:["Next refresh in ",(0,p.jsxs)(o.Text,{color:"cyan",children:[e,"s"]}),r&&(0,p.jsxs)(o.Text,{color:"gray",children:[" (last: ",r?new Date(r).toLocaleTimeString():null,")"]})]})}),j=({workspace:e,view:r})=>(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"BRICKS CLI"}),(0,p.jsx)(o.Text,{color:"gray",children:" - Interactive Mode"})]}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Workspace: "}),(0,p.jsx)(o.Text,{color:"green",children:e?.name||"Not connected"}),(0,p.jsx)(o.Text,{color:"gray",children:" | View: "}),(0,p.jsx)(o.Text,{color:"yellow",children:r})]}),(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)})]}),v=()=>(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"─".repeat(60)}),(0,p.jsxs)(o.Text,{color:"gray",children:["Press ",(0,p.jsx)(o.Text,{color:"cyan",children:"q"})," to quit, ",(0,p.jsx)(o.Text,{color:"cyan",children:"Esc"})," to go back"]})]}),T=({text:e})=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(m.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",e||"Loading..."]})]}),b=({lastAliveTime:e})=>{if(!e)return(0,p.jsx)(o.Text,{color:"gray",children:"○ Unknown"});var r=Date.now()-new Date(e).getTime();if(r<=f)return(0,p.jsx)(o.Text,{color:"green",children:"● Online"});var t=Math.floor(r/6e4);if(t<60)return(0,p.jsxs)(o.Text,{color:"yellow",children:["○ Offline (",t,"m ago)"]});var l=Math.floor(t/60);if(l<24)return(0,p.jsxs)(o.Text,{color:"red",children:["○ Offline (",l,"h ago)"]});var n=Math.floor(l/24);return(0,p.jsxs)(o.Text,{color:"red",children:["○ Offline (",n,"d ago)"]})},_=t(48724),D=({onSelect:e,mediaEnabled:r,activityLogEnabled:t})=>{var l=[{label:"Devices",value:x.DEVICES},{label:"Applications",value:x.APPS},{label:"Modules",value:x.MODULES},{label:"Device Groups",value:x.GROUPS},...r?[{label:"Media Flow",value:x.MEDIA_BOXES}]:[],...t?[{label:"Activity Log",value:x.ACTIVITY_LOG}]:[],{label:"Exit",value:"exit"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Main Menu"}),(0,p.jsx)(_.Ay,{items:l,onSelect:e})]})},S="1"===process.env.BRICKS_CLI_DISTRIBUTION,E=e=>{var r=a((0,i.useState)(null),2),l=r[0],n=r[1];return((0,i.useEffect)(()=>{if(!S){var e=!0;return t.e(8166).then(t.bind(t,29557)).then(r=>{e&&n(()=>r.default)}).catch(()=>{e&&n(!1)}),()=>{e=!1}}},[]),S||!1===l)?(0,p.jsx)(o.Text,{color:"gray",children:"Image preview is not available in this CLI build."}):l?(0,p.jsx)(l,{...e}):(0,p.jsx)(T,{text:"Preparing image preview..."})},I=({devices:e,loading:r,onSelect:t,countdown:l,lastRefreshTime:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading devices..."});if(!e?.length)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No devices found"}),(0,p.jsx)(y,{countdown:l,lastRefreshTime:n})]});var i=[...e.map(e=>{var r=(e=>{if(!e)return"○ Unknown";var r=Date.now()-new Date(e).getTime();if(r<=f)return"● Online";var t=Math.floor(r/6e4);if(t<60)return`○ ${t}m ago`;var l=Math.floor(t/60);if(l<24)return`○ ${l}h ago`;var n=Math.floor(l/24);return`○ ${n}d ago`})(e.entry_detail?.watch_dog_timer?.last_alive_time);return{label:`${r} - ${e.name||e.device_name}`,value:e._id,device:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Devices (",e.length,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(y,{countdown:l,lastRefreshTime:n})]}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},A=({device:e,loading:r,error:t,onSelect:l,mediaEnabled:n,countdown:i,lastRefreshTime:a})=>{if(r)return(0,p.jsx)(T,{text:"Loading device..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Device not found"});var s=[{label:"Control Device",value:"control"},...n?[{label:"View Screenshot",value:"screenshot"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],c=e.entry_detail,d=c?.screen,u=c?.update,x=c?.local_sync;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||e.device_name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(y,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:"Status: "}),(0,p.jsx)(b,{lastAliveTime:c?.watch_dog_timer?.last_alive_time})]}),(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),c?.application&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Application"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Name: ",c.application.name]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" Mode: ",c.operation_mode||"N/A"]})]}),d&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screen"}),d.resolution&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Resolution: ",d.resolution.width,"x",d.resolution.height,d.resolution.scale&&` @${d.resolution.scale}x`]}),d.orientation&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Orientation: ",d.orientation]}),d.touch&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Touch:"," ",d.touch.available?`Yes (${d.touch.touch_point} points)`:"No"]})]}),(c?.memory_usage||c?.disk_usage)&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"System"}),c.memory_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Memory: ",Math.round(100*c.memory_usage),"%"]}),c.disk_usage&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Disk: ",Math.round(100*c.disk_usage),"%"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Capabilities"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Sound: ",c?.sound?.available?"✓":"✗"," | ","Camera: ",c?.camera?.available?"✓":"✗"," | ","Audio In: ",c?.audio_in?.available?"✓":"✗"]})]}),x&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Local Sync"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Role: ",x.is_main?"Main":"Peer",x.peer_count>0&&` | Peers: ${x.peer_count}`,x.mean_latency&&` | Latency: ${x.mean_latency}ms`]})]}),u&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Update"}),(0,p.jsxs)(o.Text,{color:u.need_update?"yellow":"gray",children:[" ","Status: ",u.need_update?"⚠ Update available":"✓ Up to date"]}),u.current_version&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Version: ",u.current_version]})]})]}),(0,p.jsx)(_.Ay,{items:s,onSelect:l})]})},B=({device:e,onSelect:r,controlling:t,controlResult:l})=>(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Control: ",e?.name||e?.device_name]}),t&&(0,p.jsx)(T,{text:"Sending command..."}),l&&(0,p.jsx)(o.Text,{color:l.success?"green":"red",children:l.message}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:h,onSelect:r})})]}),C=({device:e,screenshot:r,loading:t,error:l,onSelect:n})=>{var i=r?.file?.meta,a=i?.originalWidth!=null&&i?.originalHeight!=null,s=i?.originalFileSize!=null;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Screenshot: ",e?.name||e?.device_name||"Unknown"]}),t&&(0,p.jsx)(T,{text:"Loading screenshot..."}),l&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"red",children:String(l)})}),!t&&!l&&r&&(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Box,{height:30,children:(0,p.jsx)(E,{src:r.path,width:80,alt:"Device screenshot"})}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Screenshot Details"}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:"Screenshot saved to: "}),(0,p.jsx)(o.Text,{color:"cyan",children:String(r.path||"")})]}),a&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",String(i.originalWidth),"x",String(i.originalHeight)]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(i.originalFileSize)/1024).toFixed(1)," KB"]}),r.file?.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:["Updated: ",new Date(r.file.updatedAt).toLocaleString()]})]})]}),!t&&!l&&!r&&(0,p.jsx)(o.Box,{marginY:1,children:(0,p.jsx)(o.Text,{color:"yellow",children:"No screenshot available. Try taking a new one."})}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"Take New Screenshot",value:"take"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})})]})},k=({apps:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading applications..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No applications found"});var l=[...e.map(e=>({label:`${e.has_unreleased_changes?"●":"○"} ${e.name}`,value:e._id,app:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Applications (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:l,onSelect:t})]})},w=({app:e,loading:r,error:t,onSelect:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading application..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Application not found"});var n=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],i=e.devices?.length||0,a=e.devices?.filter(e=>"online"===e.status)?.length||0;return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]}),e.current_version_details&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Released: v",e.current_version_details.version||"N/A"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Devices"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Total: ",i,i>0&&` (${a} online)`]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Features"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Canvas Control: ",e.canvas_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Device Control: ",e.device_control?.enabled?"✓ Enabled":"✗ Disabled"]}),(0,p.jsxs)(o.Text,{color:e.lock?.enabled?"yellow":"gray",children:[" ","Lock: ",e.lock?.enabled?"\uD83D\uDD12 Locked":"\uD83D\uDD13 Unlocked"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:n,onSelect:l})]})},L=({modules:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading modules..."});var l=[...(e||[]).map(e=>({label:`${e.current_version?"●":"○"} ${e.name}`,value:e._id,module:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Modules (",e?.length||0,")"]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No modules found"}),(0,p.jsx)(_.Ay,{items:l,onSelect:t})]})},O=({module:e,loading:r,error:t,onSelect:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading module..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Module not found"});var n=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Version"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),(0,p.jsxs)(o.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Usage"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Used in: ",e.use_count?.total_count||0," application(s)"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Settings"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Public: ",e.is_public?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modifiable: ",e.is_allow_modify?"✓ Yes":"✗ No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]})]}),e.expose_properties?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Exposed Properties"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.expose_properties.length," properties exposed"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:n,onSelect:l})]})},P=({groups:e,loading:r,onSelect:t,countdown:l,lastRefreshTime:n})=>{if(r)return(0,p.jsx)(T,{text:"Loading device groups..."});var i=[...(e||[]).map(e=>({label:`📁 ${e.name} (${e.devices?.length||0} devices)`,value:e._id,group:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{marginBottom:1,children:[(0,p.jsxs)(o.Text,{bold:!0,children:["Device Groups (",e?.length||0,")"]}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(y,{countdown:l,lastRefreshTime:n})]}),!e?.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No device groups found"}),(0,p.jsx)(_.Ay,{items:i,onSelect:t})]})},M=({loading:e,groupDevices:r})=>e?(0,p.jsx)(T,{text:"Loading devices..."}):r?.length?(0,p.jsxs)(p.Fragment,{children:[r.slice(0,10).map(e=>(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{color:"gray",children:" "}),(0,p.jsx)(b,{lastAliveTime:e.entry_detail?.watch_dog_timer?.last_alive_time}),(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||e.device_name]}),e.device_target_name&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","(",e.device_target_name,")"]})]},e._id)),r.length>10&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",r.length-10," more"]})]}):(0,p.jsx)(o.Text,{color:"gray",children:" No devices in this group"}),R=({group:e,groupDevices:r,loading:t,error:l,onSelect:n,countdown:i,lastRefreshTime:a})=>t&&!e?(0,p.jsx)(T,{text:"Loading device group..."}):l?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",l]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:n})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name}),(0,p.jsx)(o.Text,{color:"gray",children:" - "}),(0,p.jsx)(y,{countdown:i,lastRefreshTime:a})]}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Devices (",e.devices?.length||0,")"]}),(0,p.jsx)(M,{loading:t,groupDevices:r})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&(0,p.jsxs)(o.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:n})]}):(0,p.jsx)(o.Text,{color:"red",children:"Device group not found"}),N=({boxes:e,loading:r,onSelect:t})=>{if(r)return(0,p.jsx)(T,{text:"Loading media boxes..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media boxes found"});var l=[...e.map(e=>({label:`📦 ${e.name||"Unnamed"}`,value:e.id,box:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Boxes (",e.length,")"]}),(0,p.jsx)(_.Ay,{items:l,onSelect:t})]})},U=({box:e,loading:r,error:t,onSelect:l})=>r&&!e?(0,p.jsx)(T,{text:"Loading media box..."}):t?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]}):e?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),e.tags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),null!=e.size&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",e.size]}),e.passcodes?.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsxs)(o.Text,{bold:!0,color:"white",children:["Passcodes (",e.passcodes.length,")"]}),e.passcodes.slice(0,5).map(e=>(0,p.jsxs)(o.Text,{color:"gray",children:[" ",e.name||"Passcode",": ",e.code]},e.id)),e.passcodes.length>5&&(0,p.jsxs)(o.Text,{color:"gray",dimColor:!0,children:[" ","... and ",e.passcodes.length-5," more"]})]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"List Files",value:"files"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})]}):(0,p.jsx)(o.Text,{color:"red",children:"Media box not found"}),$=({files:e,loading:r,onSelect:t,box:l})=>{if(r)return(0,p.jsx)(T,{text:"Loading media files..."});if(!e?.length)return(0,p.jsx)(o.Text,{color:"yellow",children:"No media files found"});var n=[...e.map(e=>{var r;return{label:`${"Image"===(r=e.fileType)?"\uD83D\uDDBC":"Video"===r?"\uD83C\uDF9E":"Audio"===r?"\uD83C\uDFB5":"\uD83D\uDCC4"} ${e.name||"Unnamed"}`,value:e.id,file:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,marginBottom:1,children:["Media Files (",e.length,")",l?.name?` - ${l.name}`:""]}),(0,p.jsx)(_.Ay,{items:n,onSelect:t})]})},G=({file:e,loading:r,error:t,onSelect:l})=>{if(r&&!e)return(0,p.jsx)(T,{text:"Loading media file..."});if(t)return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",t]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:l})]});if(!e)return(0,p.jsx)(o.Text,{color:"red",children:"Media file not found"});var n=e.meta,i=(0,u.buildScreenshotUrl)(e),a=(0,u.buildScreenshotUrl)(e,{preferThumbnail:!0}),s=!!(a&&a!==i);return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&(0,p.jsx)(o.Text,{color:"gray",children:e.description}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"gray",children:["ID: ",e.id]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Box ID: ",e.boxId]}),(0,p.jsxs)(o.Text,{color:"gray",children:["Type: ",e.fileType]}),e.userTags?.length>0&&(0,p.jsxs)(o.Text,{color:"gray",children:["Tags: ",e.userTags.join(", ")]}),n?.originalWidth!=null&&n?.originalHeight!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["Size: ",n.originalWidth,"x",n.originalHeight]}),n?.originalFileSize!=null&&(0,p.jsxs)(o.Text,{color:"gray",children:["File: ",(Number(n.originalFileSize)/1024).toFixed(1)," KB"]}),i&&(0,p.jsxs)(o.Text,{color:"gray",children:["Original URL: ",i]}),s&&(0,p.jsxs)(o.Text,{color:"gray",children:["Thumbnail URL: ",a]}),(0,p.jsxs)(o.Box,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(o.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&(0,p.jsxs)(o.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),(0,p.jsx)(_.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:l})]})},F=t(92642),V=(e,r)=>{if(!e)return"";var t="string"==typeof e?e:JSON.stringify(e);return t.length>r?t.slice(0,r-1)+"…":t},H=({onBack:e})=>{var r=a((0,i.useState)([]),2),t=r[0],l=r[1],s=a((0,i.useState)(!0),2),u=s[0],x=s[1],h=a((0,i.useState)(null),2),f=h[0],m=h[1];return(0,i.useEffect)(()=>{var e,r=(0,c.getCurrentProfile)(),t=(0,d.getConnectionContext)(r),i=t.auth,o=t.activityLogBaseUrl;if(!i){m("Not logged in. Run `bricks auth login` first."),x(!1);return}if(!o){m("Activity log URL not configured."),x(!1);return}var a=(0,F.createActivityLogClient)(o,i),s=new Date(Date.now()-36e5).toISOString(),u=new Date().toISOString(),h=new AbortController;return(e=n(function*(){try{var e=yield a.collectEvents({start_time:s,end_time:u},{limit:50,signal:h.signal});l(e)}catch(e){"AbortError"!==e.name&&m(e.message)}x(!1)}),function(){return e.apply(this,arguments)})(),()=>h.abort()},[]),(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Activity Log (last 1h)"}),u&&(0,p.jsx)(T,{text:"Fetching events..."}),f&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",f]}),!u&&!f&&0===t.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No events found in the last hour"}),!u&&t.length>0&&(0,p.jsxs)(o.Box,{flexDirection:"column",marginBottom:1,children:[(0,p.jsxs)(o.Text,{color:"gray",children:["Timestamp".padEnd(22)," ","Type".padEnd(12)," ","Device".padEnd(14)," ","Event Name".padEnd(24)," Sender"]}),t.map((e,r)=>(0,p.jsxs)(o.Text,{children:[new Date(e.timestamp).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z").padEnd(22)," ",V(e.event_type||"",12).padEnd(12)," ",V(e.device_id||"",14).padEnd(14)," ",V(e.event_name||"",24).padEnd(24)," ",V(e.sender||"",16)]},r)),t.length>=50&&(0,p.jsxs)(o.Text,{color:"yellow",children:["Showing first ",50," events"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:r=>"back"===r.value&&e()})]})},z=t(29253),Y=t(44618),q=["B","C","G","D"],J=({instanceType:e,instance:r,client:t,onDone:l,onCancel:s})=>{var c,d=(0,o.useApp)().exit,u=a((0,i.useState)("select_ref"),2),x=u[0],h=u[1],f=a((0,i.useState)(""),2),m=f[0],g=f[1],y=a((0,i.useState)("search"),2),j=y[0],v=y[1],b=a((0,i.useState)(null),2),D=b[0],S=b[1],E=a((0,i.useState)(null),2),I=E[0],A=E[1],B=a((0,i.useState)(""),2),C=B[0],k=B[1],w=a((0,i.useState)(""),2),L=w[0],O=w[1],P=a((0,i.useState)(null),2),M=P[0],R=P[1],N=r?.short_edit?.ref_map||{},U=Object.entries(N).filter(([,e])=>e&&!e.hide),$=(0,Y.V)(N,{keyword:m,types:q}),G=$.flatMap(e=>[{label:e.label,value:`__header_${e.prefix}__`,isHeader:!0},...e.refs.map(({shortId:e,ref:r})=>({label:`${r.title||e} (${e})`,value:e,ref:r}))]),F=[...m?[{label:"↻ Clear Search",value:"__clear_search__"}]:[],{label:"← Back",value:"__back__"}],V=G.length>0?[...G,...F]:F,H=V.findIndex(e=>!e.isHeader&&!e.value?.startsWith("__"));(0,o.useInput)((e,r)=>{r.tab&&"select_ref"===x?v(e=>"search"===e?"list":"search"):(r.escape&&("select_ref"===x&&s(),"input_path"===x&&h("select_ref"),"input_content"===x&&h("input_path"),"confirm"===x&&h("input_content"),"done"===x&&s()),"q"===e&&"input_path"!==x&&"input_content"!==x&&("select_ref"!==x||"search"!==j)&&d())},{isActive:!0});var J=(c=n(function*(){if(t&&r?._id&&D){h("submitting"),R(null);try{var n={shortId:D,path:C.trim(),content:(e=>{var r=e.trim();if(""===r)return null;try{return JSON.parse(r)}catch{return r}})(L),forwardDataLink:!0};I?.inner_ref?.pid&&(n.innerRefParentShortId=I.inner_ref.pid),"application"===e?yield t.shortEditApplication({id:r._id,list:[n]}):yield t.shortEditModule({id:r._id,list:[n]}),yield l(),h("done")}catch(e){R(e.message),h("confirm")}}}),function(){return c.apply(this,arguments)});return r?.short_edit?.enabled?0===U.length?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"yellow",children:"No Short Edit references found."}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]}):"select_ref"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,children:"Short Edit References"}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Showing: Brick, Canvas, Generator, Data"}),(0,p.jsxs)(o.Box,{marginTop:1,flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"gray",children:"Search (title or shortId)"}),(0,p.jsx)(z.A,{value:m,placeholder:"type to filter, Enter to focus list",onChange:e=>g(e),onSubmit:()=>v("list"),focus:"search"===j}),(0,p.jsx)(o.Text,{color:"gray",dimColor:!0,children:"Press Tab to switch focus"})]}),(0,p.jsxs)(o.Box,{marginTop:1,children:[0===$.length&&(0,p.jsx)(o.Text,{color:"yellow",children:"No references match your search."}),(0,p.jsx)(_.Ay,{items:V,isFocused:"list"===j,initialIndex:H>-1?H:0,indicatorComponent:()=>null,itemComponent:({label:e,isSelected:r,isHeader:t})=>t?(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(o.Text,{bold:!0,color:"white",children:e})}):(0,p.jsxs)(o.Text,{color:r?"blue":void 0,children:[r?"❯":" "," ",e]}),onSelect:e=>{if("__back__"===e.value)return void s();if("__clear_search__"===e.value){g(""),v("search");return}e.isHeader||(S(e.value),A(e.ref),h("input_path"))}})]})]}):"input_path"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||D," (",D,")"]})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter property path (e.g. title, property.backgroundColor)"}),M&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",M]}),(0,p.jsx)(z.A,{value:C,placeholder:"path",onChange:e=>{k(e),M&&R(null)},onSubmit:e=>{var r=e.trim();r?(k(r),h("input_content")):R("Path is required")},focus:!0})]}):"input_content"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsx)(o.Text,{marginTop:1,children:"Enter new content (JSON or plain text). Empty to clear."}),M&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",M]}),(0,p.jsx)(z.A,{value:L,placeholder:"content",onChange:e=>{O(e),M&&R(null)},onSubmit:()=>h("confirm"),focus:!0})]}):"submitting"===x?(0,p.jsx)(T,{text:"Applying short edit..."}):"done"===x?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{color:"green",children:"Short edit applied successfully."}),(0,p.jsx)(_.Ay,{items:[{label:"Edit another property",value:"again"},{label:"← Back",value:"back"}],onSelect:e=>{"again"===e.value?(h("select_ref"),S(null),A(null),k(""),O(""),R(null)):s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,marginBottom:1,children:"Confirm Short Edit"}),(0,p.jsxs)(o.Text,{children:["Reference:"," ",(0,p.jsxs)(o.Text,{color:"cyan",children:[I?.title||D," (",D,")"]})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C})]}),(0,p.jsxs)(o.Text,{children:["Content: ",(0,p.jsx)(o.Text,{color:"cyan",children:L||"<empty>"})]}),M&&(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",M]}),(0,p.jsx)(_.Ay,{items:[{label:"Apply",value:"apply"},{label:"Edit Path",value:"edit_path"},{label:"Edit Content",value:"edit_content"},{label:"← Back",value:"back"}],onSelect:e=>{"apply"===e.value&&J(),"edit_path"===e.value&&h("input_path"),"edit_content"===e.value&&h("input_content"),"back"===e.value&&s()}})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{color:"yellow",children:["Short Edit is not enabled for this ",e,"."]}),(0,p.jsx)(_.Ay,{items:[{label:"← Back",value:"back"}],onSelect:s})]})},K=t(16928),W=t(79896),X=t(10750),Q=t(77768),Z="options",ee="output_dir",er="confirm",et="generating",el="post_install",en="done",ei=({type:e,instance:r,client:t,onDone:l,onCancel:s})=>{var c,d=(0,o.useApp)().exit,u=a((0,i.useState)(Z),2),x=u[0],h=u[1],f=a((0,i.useState)({setupGitHubActions:!0,setupAgents:!0,setupClaudeCode:!0,setupGeminiCLI:!1,runBunInstall:!0,initGit:!0}),2),g=f[0],y=f[1],j=a((0,i.useState)(process.cwd()),2),v=j[0],T=j[1],b=a((0,i.useState)(""),2),D=b[0],S=b[1],E=a((0,i.useState)(null),2),I=E[0],A=E[1],B=a((0,i.useState)(null),2),C=B[0],k=B[1],w=X(r?.name||"bricks-ctor"),L=K.resolve(v,w),O=(0,i.useCallback)(e=>{"back"===e.value?s():"continue"===e.value?h(ee):y(r=>({...r,[e.value]:!r[e.value]}))},[s]),P=(0,i.useCallback)(()=>{W.existsSync(L)?A(`Directory already exists: ${L}`):(A(null),h(er))},[L]),M=(0,i.useCallback)((c=n(function*(l){if("back"===l.value)return void h(ee);if("cancel"===l.value)return void s();if("confirm"===l.value){h(et);try{S("Fetching project from BRICKS...");var n="application"===e,i=n?t.queries.applicationProject:t.queries.moduleProject,o=(yield t.query(i,{id:r._id,buildApplicationOnly:!1,setupGitHubActions:g.setupGitHubActions,setupAgents:g.setupAgents,setupClaudeCode:g.setupClaudeCode,setupGeminiCLI:g.setupGeminiCLI}))[n?"applicationProject":"moduleProject"];if(!o?.files)throw Error("Failed to fetch project files");S("Creating project directory..."),W.mkdirSync(L,{recursive:!0}),S(`Writing ${o.files.length} files...`);var a=yield(0,Q.KN)(o.files,L);(0,Q.oz)(a),h(el);var c={path:L,files:o.files.length,bunInstalled:!1,gitInitialized:!1};Object.assign(c,(yield(0,Q.o0)(L,{install:g.runBunInstall,git:g.initGit,onStatus:S}))),k(c),h(en)}catch(e){A(e.message),h(Z)}}}),function(e){return c.apply(this,arguments)}),[t,r,e,g,L,s]),R=(0,i.useCallback)(e=>{"exit"===e.value?d():l()},[d,l]);if(x===Z){var N=[{label:`${g.setupGitHubActions?"[x]":"[ ]"} GitHub Actions workflow`,value:"setupGitHubActions"},{label:`${g.setupAgents?"[x]":"[ ]"} AGENTS.md`,value:"setupAgents"},{label:`${g.setupClaudeCode?"[x]":"[ ]"} CLAUDE.md`,value:"setupClaudeCode"},{label:`${g.setupGeminiCLI?"[x]":"[ ]"} GEMINI.md`,value:"setupGeminiCLI"},{label:`${g.runBunInstall?"[x]":"[ ]"} Run bun install after generation`,value:"runBunInstall"},{label:`${g.initGit?"[x]":"[ ]"} Initialize git repository`,value:"initGit"},{label:"→ Continue",value:"continue"},{label:"← Back",value:"back"}];return(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsxs)(o.Text,{bold:!0,color:"cyan",children:["Initialize BRICKS Project: ",r?.name||"Untitled"]}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Select options for project generation (press Enter to toggle)"}),I&&(0,p.jsxs)(o.Text,{color:"red",marginBottom:1,children:["Error: ",I]}),(0,p.jsx)(_.Ay,{items:N,onSelect:O})]})}return x===ee?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Output Directory"}),(0,p.jsx)(o.Text,{color:"gray",marginBottom:1,children:"Enter the parent directory for the project:"}),I&&(0,p.jsx)(o.Text,{color:"red",marginBottom:1,children:I}),(0,p.jsxs)(o.Box,{children:[(0,p.jsx)(o.Text,{children:"Directory: "}),(0,p.jsx)(z.A,{value:v,onChange:T,onSubmit:P})]}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["Project will be created at: ",L]})]}):x===er?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Confirm Project Generation"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Name: ",(0,p.jsx)(o.Text,{color:"green",children:r?.name||"Untitled"})]}),(0,p.jsxs)(o.Text,{children:["Type: ",(0,p.jsx)(o.Text,{color:"yellow",children:e})]}),(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:L})]}),(0,p.jsx)(o.Text,{color:"gray",marginTop:1,children:"Options:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GitHub Actions: ",g.setupGitHubActions?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - AGENTS.md: ",g.setupAgents?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - CLAUDE.md: ",g.setupClaudeCode?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - GEMINI.md: ",g.setupGeminiCLI?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Run bun install: ",g.runBunInstall?"Yes":"No"]}),(0,p.jsxs)(o.Text,{color:"gray",children:[" - Initialize git: ",g.initGit?"Yes":"No"]})]}),(0,p.jsx)(_.Ay,{items:[{label:"Confirm & Generate",value:"confirm"},{label:"← Change Directory",value:"back"},{label:"Cancel",value:"cancel"}],onSelect:M})]}):x===et||x===el?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"cyan",children:"Generating Project..."}),(0,p.jsxs)(o.Box,{marginY:1,children:[(0,p.jsx)(o.Text,{color:"green",children:(0,p.jsx)(m.A,{type:"dots"})}),(0,p.jsxs)(o.Text,{children:[" ",D]})]})]}):x===en&&C?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(o.Text,{bold:!0,color:"green",children:"Project initialized successfully!"}),(0,p.jsxs)(o.Box,{marginY:1,flexDirection:"column",children:[(0,p.jsxs)(o.Text,{children:["Path: ",(0,p.jsx)(o.Text,{color:"cyan",children:C.path})]}),(0,p.jsxs)(o.Text,{children:["Files: ",(0,p.jsx)(o.Text,{color:"green",children:C.files})]}),(0,p.jsxs)(o.Text,{children:["Dependencies:"," ",(0,p.jsx)(o.Text,{color:C.bunInstalled?"green":"yellow",children:C.bunInstalled?"Installed":"Not installed (run bun install manually)"})]}),(0,p.jsxs)(o.Text,{children:["Git:"," ",(0,p.jsx)(o.Text,{color:C.gitInitialized?"green":"yellow",children:C.gitInitialized?"Initialized":"Not initialized"})]})]}),(0,p.jsx)(o.Text,{bold:!0,marginY:1,children:"Next steps:"}),(0,p.jsxs)(o.Text,{color:"gray",children:[" cd ",w]}),!C.bunInstalled&&(0,p.jsx)(o.Text,{color:"gray",children:" bun install"}),(0,p.jsx)(o.Text,{color:"gray",children:" bun invoke-simulator"}),(0,p.jsxs)(o.Text,{color:"gray",marginTop:1,children:["For more information, see ",w,"/README.md"]}),(0,p.jsx)(o.Box,{marginTop:1,children:(0,p.jsx)(_.Ay,{items:[{label:"← Back to Detail",value:"back"},{label:"Exit CLI",value:"exit"}],onSelect:R})})]}):null};let eo=()=>{var e,r,t,l,h,f,m,y,b=(0,o.useApp)().exit,_=a((0,i.useState)(x.MAIN),2),S=_[0],E=_[1],M=a((0,i.useState)(null),2),F=M[0],V=M[1],z=a((0,i.useState)(null),2),Y=z[0],q=z[1],K=a((0,i.useState)(!0),2),W=K[0],X=K[1],Q=a((0,i.useState)(null),2),Z=Q[0],ee=Q[1],er=a((0,i.useState)(!1),2),et=er[0],el=er[1],en=a((0,i.useState)([]),2),eo=en[0],ea=en[1],es=a((0,i.useState)(null),2),ec=es[0],ed=es[1],eu=a((0,i.useState)([]),2),ex=eu[0],eh=eu[1],ef=a((0,i.useState)(null),2),em=ef[0],ep=ef[1],eg=a((0,i.useState)([]),2),ey=eg[0],ej=eg[1],ev=a((0,i.useState)(null),2),eT=ev[0],eb=ev[1],e_=a((0,i.useState)([]),2),eD=e_[0],eS=e_[1],eE=a((0,i.useState)(null),2),eI=eE[0],eA=eE[1],eB=a((0,i.useState)([]),2),eC=eB[0],ek=eB[1],ew=a((0,i.useState)(!1),2),eL=ew[0],eO=ew[1],eP=a((0,i.useState)(null),2),eM=eP[0],eR=eP[1],eN=a((0,i.useState)(null),2),eU=eN[0],e$=eN[1],eG=a((0,i.useState)(null),2),eF=eG[0],eV=eG[1],eH=a((0,i.useState)(null),2),ez=eH[0],eY=eH[1],eq=a((0,i.useState)([]),2),eJ=eq[0],eK=eq[1],eW=a((0,i.useState)(null),2),eX=eW[0],eQ=eW[1],eZ=a((0,i.useState)([]),2),e0=eZ[0],e1=eZ[1],e2=a((0,i.useState)(null),2),e4=e2[0],e6=e2[1],e7=S===x.DEVICES,e9=S===x.DEVICE_DETAIL,e8=S===x.GROUPS,e5=S===x.GROUP_DETAIL;(0,i.useEffect)(()=>{var e=(0,c.getCurrentProfile)(),r=(0,d.getConnectionContext)(e),t=r.auth,l=r.baseUrl;if(el(!!r.activityLogBaseUrl),!t){ee("Not logged in. Run `bricks auth login` first."),X(!1);return}var n=(0,s.createClient)(l,t);V(n),n.workspace().then(e=>{q(e),X(!1)}).catch(e=>{ee(e.message),X(!1)})},[]),(0,o.useInput)((e,r)=>{"q"===e&&b(),r.escape&&(S===x.DEVICE_CONTROL?(E(x.DEVICE_DETAIL),eR(null)):S===x.DEVICE_SCREENSHOT?(E(x.DEVICE_DETAIL),eV(null),eY(null)):S===x.DEVICE_DETAIL?(E(x.DEVICES),ed(null)):S===x.APP_DETAIL?(E(x.APPS),ep(null)):S===x.MODULE_DETAIL?(E(x.MODULES),eb(null)):S===x.GROUP_DETAIL?(E(x.GROUPS),eA(null),ek([])):S===x.MEDIA_FILE_DETAIL?(E(x.MEDIA_FILES),e6(null)):S===x.MEDIA_FILES?(E(x.MEDIA_BOX_DETAIL),e6(null)):S===x.MEDIA_BOX_DETAIL?(E(x.MEDIA_BOXES),eQ(null),e1([])):S===x.MEDIA_BOXES?E(x.MAIN):S!==x.MAIN&&E(x.MAIN))},{isActive:S!==x.APP_SHORT_EDIT&&S!==x.MODULE_SHORT_EDIT&&S!==x.APP_PROJECT_INIT&&S!==x.MODULE_PROJECT_INIT});var e3=(0,i.useCallback)(n(function*(){if(F){X(!0);try{var e=yield F.devices({});ea(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),re=(0,i.useCallback)((e=n(function*(e){if(F){X(!0),e$(null);try{var r=yield F.device({id:e});ed(r)}catch(e){e$(e.message)}X(!1)}}),function(r){return e.apply(this,arguments)}),[F]),rr=(0,i.useCallback)(n(function*(){if(F){X(!0);try{var e=yield F.applications({});eh(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rt=(0,i.useCallback)((r=n(function*(e){if(F){X(!0),e$(null);try{var r=yield F.application({id:e});ep(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return r.apply(this,arguments)}),[F]),rl=(0,i.useCallback)(n(function*(){if(F){X(!0);try{var e=yield F.modules({});ej(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rn=(0,i.useCallback)((t=n(function*(e){if(F){X(!0),e$(null);try{var r=yield F.module({id:e});eb(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return t.apply(this,arguments)}),[F]),ri=(0,i.useCallback)(n(function*(){if(F){X(!0);try{var e=yield F.deviceGroups({});eS(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),ro=(0,i.useCallback)((l=n(function*(e){if(F){X(!0),e$(null);try{var r=yield Promise.all([F.deviceGroup({id:e}),F.devicesByGroup({id:e})]),t=a(r,2),l=t[0],n=t[1];eA(l),ek(n||[])}catch(e){e$(e.message)}X(!1)}}),function(e){return l.apply(this,arguments)}),[F]),ra=(0,i.useCallback)(n(function*(){if(F){X(!0);try{var e=yield F.mediaBoxes();eK(e||[])}catch(e){ee(e.message)}X(!1)}}),[F]),rs=(0,i.useCallback)((h=n(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaBox({id:e});eQ(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return h.apply(this,arguments)}),[F]),rc=(0,i.useCallback)((f=n(function*(e){if(F){X(!0);try{var r=yield F.mediaFiles({boxId:e});e1(r||[])}catch(e){ee(e.message)}X(!1)}}),function(e){return f.apply(this,arguments)}),[F]),rd=(0,i.useCallback)((m=n(function*(e){if(F){X(!0),e$(null);try{var r=yield F.mediaFile({id:e});e6(r)}catch(e){e$(e.message)}X(!1)}}),function(e){return m.apply(this,arguments)}),[F]),ru=(0,i.useCallback)((y=n(function*(e){if(F&&ec){eO(!0),eR(null);try{yield F.controlDevice({id:ec._id,type:e}),eR({success:!0,message:`Command sent: ${e}`})}catch(e){eR({success:!1,message:e.message})}eO(!1)}}),function(e){return y.apply(this,arguments)}),[F,ec]),rx=(0,i.useCallback)(n(function*(e=!1){if(F&&ec&&Y){X(!0),eY(null),eV(null);try{e&&(yield F.controlDevice({id:ec._id,type:"take-screenshot"}),yield new Promise(e=>setTimeout(e,3e3)));var r=yield(0,u.fetchAndSaveScreenshot)(F,Y,ec._id,null,{preferThumbnail:!0});r.error?eY(r.error):eV(r)}catch(e){eY(e.message)}X(!1)}}),[F,ec,Y]),rh=g((0,i.useCallback)(()=>{F&&e3()},[F,e3]),e7),rf=g((0,i.useCallback)(()=>{F&&ec&&re(ec._id)},[F,ec,re]),e9),rm=g((0,i.useCallback)(()=>{F&&ri()},[F,ri]),e8),rp=g((0,i.useCallback)(()=>{F&&eI&&ro(eI._id)},[F,eI,ro]),e5);return W&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(j,{workspace:Y,view:S}),(0,p.jsx)(T,{text:"Connecting to workspace..."})]}):Z&&!Y?(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(j,{workspace:Y,view:S}),(0,p.jsxs)(o.Text,{color:"red",children:["Error: ",Z]}),(0,p.jsx)(v,{})]}):(0,p.jsxs)(o.Box,{flexDirection:"column",children:[(0,p.jsx)(j,{workspace:Y,view:S}),S===x.MAIN&&(0,p.jsx)(D,{onSelect:e=>{"exit"===e.value?b():(E(e.value),e.value===x.DEVICES?e3():e.value===x.APPS?rr():e.value===x.MODULES?rl():e.value===x.GROUPS?ri():e.value===x.MEDIA_BOXES&&ra())},mediaEnabled:(0,u.isMediaEnabled)(Y),activityLogEnabled:et}),S===x.DEVICES&&(0,p.jsx)(I,{devices:eo,loading:W,onSelect:e=>{if("back"===e.value)return void E(x.MAIN);if("refresh"===e.value){e3(),rh.resetCountdown();return}ed(null),X(!0),E(x.DEVICE_DETAIL),re(e.value)},countdown:rh.countdown,lastRefreshTime:rh.lastRefreshTime}),S===x.DEVICE_DETAIL&&(0,p.jsx)(A,{device:ec,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.DEVICES),ed(null);return}if("refresh"===e.value){re(ec._id),rf.resetCountdown();return}"control"===e.value&&(E(x.DEVICE_CONTROL),eR(null)),"screenshot"===e.value&&(E(x.DEVICE_SCREENSHOT),eV(null),eY(null),rx(!1))},mediaEnabled:(0,u.isMediaEnabled)(Y),countdown:rf.countdown,lastRefreshTime:rf.lastRefreshTime}),S===x.DEVICE_CONTROL&&(0,p.jsx)(B,{device:ec,onSelect:e=>{if("back"===e.value){E(x.DEVICE_DETAIL),eR(null);return}ru(e.value)},controlling:eL,controlResult:eM}),S===x.DEVICE_SCREENSHOT&&(0,p.jsx)(C,{device:ec,screenshot:eF,loading:W,error:ez,onSelect:e=>{if("back"===e.value){E(x.DEVICE_DETAIL),eV(null),eY(null);return}"refresh"===e.value?rx(!1):"take"===e.value&&rx(!0)}}),S===x.APPS&&(0,p.jsx)(k,{apps:ex,loading:W,onSelect:e=>{"back"===e.value?E(x.MAIN):"refresh"===e.value?rr():(ep(null),X(!0),E(x.APP_DETAIL),rt(e.value))}}),S===x.APP_DETAIL&&(0,p.jsx)(w,{app:em,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.APPS),ep(null);return}"refresh"===e.value?rt(em._id):("short_edit"===e.value&&(E(x.APP_SHORT_EDIT),e$(null)),"project_init"===e.value&&(E(x.APP_PROJECT_INIT),e$(null)))}}),S===x.APP_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"application",instance:em,client:F,onDone:n(function*(){return rt(em._id)}),onCancel:()=>E(x.APP_DETAIL)}),S===x.APP_PROJECT_INIT&&(0,p.jsx)(ei,{type:"application",instance:em,client:F,onDone:()=>E(x.APP_DETAIL),onCancel:()=>E(x.APP_DETAIL)}),S===x.MODULES&&(0,p.jsx)(L,{modules:ey,loading:W,onSelect:e=>{"back"===e.value?E(x.MAIN):"refresh"===e.value?rl():(eb(null),X(!0),E(x.MODULE_DETAIL),rn(e.value))}}),S===x.MODULE_DETAIL&&(0,p.jsx)(O,{module:eT,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.MODULES),eb(null);return}"refresh"===e.value?rn(eT._id):("short_edit"===e.value&&(E(x.MODULE_SHORT_EDIT),e$(null)),"project_init"===e.value&&(E(x.MODULE_PROJECT_INIT),e$(null)))}}),S===x.MODULE_SHORT_EDIT&&(0,p.jsx)(J,{instanceType:"module",instance:eT,client:F,onDone:n(function*(){return rn(eT._id)}),onCancel:()=>E(x.MODULE_DETAIL)}),S===x.MODULE_PROJECT_INIT&&(0,p.jsx)(ei,{type:"module",instance:eT,client:F,onDone:()=>E(x.MODULE_DETAIL),onCancel:()=>E(x.MODULE_DETAIL)}),S===x.GROUPS&&(0,p.jsx)(P,{groups:eD,loading:W,onSelect:e=>{if("back"===e.value)return void E(x.MAIN);if("refresh"===e.value){ri(),rm.resetCountdown();return}eA(null),ek([]),X(!0),E(x.GROUP_DETAIL),ro(e.value)},countdown:rm.countdown,lastRefreshTime:rm.lastRefreshTime}),S===x.GROUP_DETAIL&&(0,p.jsx)(R,{group:eI,groupDevices:eC,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.GROUPS),eA(null),ek([]);return}"refresh"===e.value&&(ro(eI._id),rp.resetCountdown())},countdown:rp.countdown,lastRefreshTime:rp.lastRefreshTime}),S===x.ACTIVITY_LOG&&(0,p.jsx)(H,{onBack:()=>E(x.MAIN)}),S===x.MEDIA_BOXES&&(0,p.jsx)(N,{boxes:eJ,loading:W,onSelect:e=>{"back"===e.value?E(x.MAIN):"refresh"===e.value?ra():(eQ(null),e1([]),X(!0),E(x.MEDIA_BOX_DETAIL),rs(e.value))}}),S===x.MEDIA_BOX_DETAIL&&(0,p.jsx)(U,{box:eX,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.MEDIA_BOXES),eQ(null),e1([]);return}"refresh"===e.value?rs(eX.id):"files"===e.value&&(e1([]),e6(null),E(x.MEDIA_FILES),rc(eX.id))}}),S===x.MEDIA_FILES&&(0,p.jsx)($,{files:e0,box:eX,loading:W,onSelect:e=>{if("back"===e.value){E(x.MEDIA_BOX_DETAIL),e6(null);return}"refresh"===e.value?rc(eX.id):(e6(null),X(!0),E(x.MEDIA_FILE_DETAIL),rd(e.value))}}),S===x.MEDIA_FILE_DETAIL&&(0,p.jsx)(G,{file:e4,loading:W,error:eU,onSelect:e=>{if("back"===e.value){E(x.MEDIA_FILES),e6(null);return}"refresh"===e.value&&rd(e4.id)}}),(0,p.jsx)(v,{})]})};var ea="1"===process.env.BRICKS_CLI_DISTRIBUTION,es=(l=n(function*(){if(ea)return void(0,o.render)((0,p.jsx)(eo,{}));var e=(yield t.e(8166).then(t.bind(t,29557))).TerminalInfoProvider;(0,o.render)((0,p.jsx)(e,{children:(0,p.jsx)(eo,{})}))}),function(){return l.apply(this,arguments)})},92642(e,r,t){t.r(r),t.d(r,{ActivityLogClient:()=>E,createActivityLogClient:()=>I});var l,n,i,o,a,s=t(67996),c=t(99436),d=t(5018),u=t(44668),x=t(4275),h=t(32235),f=t(62192),m=t(79657),p=t(64007);function g(e){var r,t,l,n=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,l=Symbol.iterator);n--;){if(t&&null!=(r=e[t]))return r.call(e);if(l&&null!=(r=e[l]))return new y(r.call(e));t="@@asyncIterator",l="@@iterator"}throw TypeError("Object is not async iterable")}function y(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(y=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new y(e)}function*j(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var r of Object.values(e.data))if(Array.isArray(r))for(var t of r)yield t}if(Array.isArray(e.incremental)){for(var l of e.incremental)if(Array.isArray(l.items))for(var n of l.items)yield n}}function v(){return(v=x(function*(e){var r=e.headers.get("content-type")||"";if(r.includes("application/json")){var t=yield h(e.json());if(t.errors?.length)throw Error(t.errors.map(e=>e.message).join("\n"));var l=Object.keys(t.data||{})[0];if(l&&Array.isArray(t.data[l]))for(var n of t.data[l])yield n;return}var i=r.match(/boundary="?([^";]+)"?/),o=i?i[1]:"-",a=`--${o}`,s="",c=!1,d=new TextDecoder,u=e=>{for(var r=0;-1!==(r=e.indexOf(a,r));){if(0===r||"\n"===e[r-1])return r;r+=a.length}return -1},x=function*(){for(var e;-1!==(e=u(s));){var r=s.slice(0,e);(s=s.slice(e+a.length)).startsWith("\r\n")?s=s.slice(2):s.startsWith("\n")&&(s=s.slice(1));var t=r.indexOf("\r\n\r\n"),l=-1!==t?r.slice(t+4).trim():r.trim();if(l){var n=void 0;try{n=JSON.parse(l)}catch{continue}if(yield*j(n),!1===n.hasNext){c=!0;return}}}};try{var m=!1,p=!1;try{for(var y,v,T=g(e.body);m=!(v=yield h(T.next())).done;m=!1){var b=v.value;if(s+=d.decode(b,{stream:!0}),yield*f(g(x()),h),c)break}}catch(e){p=!0,y=e}finally{try{m&&null!=T.return&&(yield h(T.return()))}finally{if(p)throw y}}}catch(e){if(!e.message?.includes("Premature close")||!c)throw e}if(!c&&s.trim()){var _,D=s.indexOf("\r\n\r\n"),S=-1!==D?s.slice(D+4).trim():s.trim();if(S&&!S.startsWith("--")){try{_=JSON.parse(S)}catch{}_&&(yield*f(g(j(_)),h),!1===_.hasNext&&(c=!0))}}e.body?.destroy()})).apply(this,arguments)}var T=`
2
+ query AL_events($filter: EventsFilter!) {
3
+ events(filter: $filter) @stream {
4
+ device_id
5
+ event_type
6
+ event_name
7
+ subspace_id
8
+ sender
9
+ payload
10
+ timestamp
11
+ }
12
+ }
13
+ `,b=`
14
+ query AL_screenshots($filter: ScreenshotFilter!) {
15
+ screenshots(filter: $filter) @stream {
16
+ timestamp
17
+ }
18
+ }
19
+ `,_=["authorization"];function D(e){var r,t,l,n=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,l=Symbol.iterator);n--;){if(t&&null!=(r=e[t]))return r.call(e);if(l&&null!=(r=e[l]))return new S(r.call(e));t="@@asyncIterator",l="@@iterator"}throw TypeError("Object is not async iterable")}function S(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(S=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new S(e)}var E=u(function e(r,t){var l;d(this,e),this.baseUrl=r,this.auth="string"==typeof t?{kind:"token",token:t,getHeaders:(l=c(function*(){return{authorization:`Bearer ${t}`}}),function(){return l.apply(this,arguments)})}:t,this.token=this.auth?.token,this.graphqlUrl=`${r}/api/graphql`,this.fetch=function(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return m.Ay;var t=new p(r);return(e,r={})=>(0,m.Ay)(e,{...r,agent:t})}(r)},[{key:"authHeaders",value:(l=c(function*(){var e=yield this.auth.getHeaders();return{Authorization:e.authorization,...s(e,_)}}),function(){return l.apply(this,arguments)})},{key:"authenticatedFetch",value:(n=c(function*(e,r={}){var t,l=this,n=(t=c(function*(){return l.fetch(e,{...r,headers:{...r.headers,...yield l.authHeaders()}})}),function(){return t.apply(this,arguments)}),i=yield n();return 401!==i.status||"function"!=typeof this.auth.refresh?i:(i.body?.destroy?.(),yield this.auth.refresh(),n())}),function(e){return n.apply(this,arguments)})},{key:"streamQuery",value:function(e,r){var t=this;return x(function*(e,r,{signal:l}={}){var n=yield h(t.authenticatedFetch(t.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:'multipart/mixed; boundary="-", application/json'},body:JSON.stringify({query:e,variables:r}),signal:l}));if(!n.ok){var i=yield h(n.text().catch(()=>""));throw Error(`Activity-log query failed (${n.status}): ${i}`)}yield*f(D(function(e){return v.apply(this,arguments)}(n)),h)}).apply(this,arguments)}},{key:"events",value:function(e,r){var t=this;return x(function*(){yield*f(D(t.streamQuery(T,{filter:e},r)),h)})()}},{key:"screenshots",value:function(e,r){var t=this;return x(function*(){yield*f(D(t.streamQuery(b,{filter:e},r)),h)})()}},{key:"collectEvents",value:(i=c(function*(e,{limit:r,signal:t}={}){var l=[],n=!1,i=!1;try{for(var o,a,s=D(this.events(e,{signal:t}));n=!(a=yield s.next()).done;n=!1){var c=a.value;if(l.push(c),r&&l.length>=r)break}}catch(e){i=!0,o=e}finally{try{n&&null!=s.return&&(yield s.return())}finally{if(i)throw o}}return l}),function(e){return i.apply(this,arguments)})},{key:"collectScreenshots",value:(o=c(function*(e,{signal:r}={}){var t=[],l=!1,n=!1;try{for(var i,o,a=D(this.screenshots(e,{signal:r}));l=!(o=yield a.next()).done;l=!1){var s=o.value;t.push(s)}}catch(e){n=!0,i=e}finally{try{l&&null!=a.return&&(yield a.return())}finally{if(n)throw i}}return t}),function(e){return o.apply(this,arguments)})},{key:"downloadScreenshot",value:(a=c(function*(e,r,t,{signal:l}={}){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot?ts=${encodeURIComponent(t)}`,i=yield this.authenticatedFetch(n,{signal:l});if(!i.ok){var o=yield i.text().catch(()=>"");throw Error(`Screenshot fetch failed (${i.status}): ${o}`)}return Buffer.from((yield i.arrayBuffer()))}),function(e,r,t){return a.apply(this,arguments)})}]),I=(e,r)=>new E(e,r)},77768(e,r,t){t.d(r,{BZ:()=>j,KN:()=>p,kU:()=>m,o0:()=>y,oz:()=>g});var l,n,i,o,a=t(99436),s=t(16928),c=t(79896),d=t(35317),u=t(10750),x=e=>{try{return(0,d.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},h=(e,r,t)=>new Promise((l,n)=>{var i=[e,...r].join(" "),o=(0,d.spawn)(i,[],{cwd:t,stdio:"pipe",shell:!0}),a=[];o.stderr.on("data",e=>a.push(e)),o.on("close",e=>{0===e?l():n(Error(Buffer.concat(a).toString().trim()||`Command failed with code ${e}`))}),o.on("error",n)}),f=(l=a(function*(e,r){try{var l=(yield t.e(7456).then(t.bind(t,79491))).format;return(yield l(r,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,r){return l.apply(this,arguments)}),m=(e=[])=>{var r=e.find(e=>"application.json"===e.name);if(!r)return"bricks-ctor";try{var t=JSON.parse(r.input);return u(t.name||"bricks-ctor")}catch{return"bricks-ctor"}},p=(n=a(function*(e,r){var t;return Promise.all(e.map((t=a(function*(e){var t=s.join(r,e.name),l=e.input;return e.formatable&&(l=yield f(l,t)),{...e,filePath:t,content:l}}),function(e){return t.apply(this,arguments)})))}),function(e,r){return n.apply(this,arguments)}),g=e=>{e.forEach(e=>{c.mkdirSync(s.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},y=(i=a(function*(e,r={}){var t="function"==typeof r.onStatus?r.onStatus:()=>{},l=!1,n=!1;if(!1!==r.install&&x("bun")){t("Installing dependencies (bun install)...");try{yield h("bun",["install"],e),l=!0}catch{}}if(!1!==r.git&&x("git")){t("Initializing git repository...");try{yield h("git",["init"],e),yield h("git",["add","."],e),yield h("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),n=!0}catch{}}return{bunInstalled:l,gitInitialized:n}}),function(e){return i.apply(this,arguments)}),j=(o=a(function*(e,r,t){var l=t.client,n=t.output,i=t.outputAsTarget;if(!l)throw Error("client is required");if(!n)throw Error("output directory is required");var o=(e=>{for(var r=s.resolve(e);;){if(c.existsSync(s.join(r,"application.json"))||c.existsSync(s.join(r,"module.json")))return r;var t=s.dirname(r);if(t===r)return null;r=t}})(i?s.dirname(s.resolve(n)):n);if(o)throw Error(`Cannot initialize a new BRICKS project inside an existing project (${o}). Choose a directory outside the project.`);var a="application"===e?l.applicationProject:l.moduleProject,d=yield a({id:r,buildApplicationOnly:!1,setupGitHubActions:!1!==t.githubActions,setupAgents:!1!==t.agents,setupClaudeCode:!1!==t.claude,setupGeminiCLI:!0===t.gemini});if(!d?.files)throw Error(`${e} project not found`);var u=m(d.files),x=i?s.resolve(n):s.resolve(n,u);if(c.existsSync(x))throw Error(`Directory already exists: ${x}`);c.mkdirSync(x,{recursive:!0}),g((yield p(d.files,x)));var h=yield y(x,t),f=h.bunInstalled,j=h.gitInitialized;return{success:!0,path:x,files:d.files.length,bunInstalled:f,gitInitialized:j}}),function(e,r,t){return o.apply(this,arguments)})},60450(e,r,t){t.r(r),t.d(r,{buildScreenshotUrl:()=>f,downloadScreenshot:()=>m,fetchAndSaveScreenshot:()=>p,getDeviceScreenshot:()=>h,getSystemMediaBoxId:()=>x,isMediaEnabled:()=>u});var l,n,i,o=t(99436),a=t(79657),s=t(73024),c=t(76760),d=t(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,x=e=>u(e)&&e.media_resource?.system_media_box_id||null,h=(l=o(function*(e,r,t){var l=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${t}`],limit:1});return l?.[0]||null}),function(e,r,t){return l.apply(this,arguments)}),f=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var t=e.meta,l=t.storageEndpoint,n=t.originalFileKey,i=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var t=r.imageVersions||[];if(!Array.isArray(t)||0===t.length)return null;var l=t.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(l[0]||t[0])?.key||null})(e):null)||n;return i?`${l}/${i}`:null},m=(n=o(function*(e,r=null){var t=yield(0,a.Ay)(e);if(!t.ok)throw Error(`Failed to download screenshot: ${t.statusText}`);var l=yield t.buffer(),n=r||c.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),i=c.dirname(n);return s.existsSync(i)||s.mkdirSync(i,{recursive:!0}),s.writeFileSync(n,l),n}),function(e){return n.apply(this,arguments)}),p=(i=o(function*(e,r,t,l=null,n={}){var i=x(r);if(!i)return{error:"Media workspace not enabled for this workspace"};var o=yield h(e,i,t);if(!o)return{error:"No screenshot available for this device"};var a=f(o,n);return a?{path:yield m(a,l),file:o,url:a}:{error:"Could not build screenshot URL"}}),function(e,r,t){return i.apply(this,arguments)})}};
package/lib/7494.js ADDED
@@ -0,0 +1,18 @@
1
+ export const __rspack_esm_id=7494;export const __rspack_esm_ids=[7494];export const __webpack_modules__={59957(e,r,t){t.r(r),t.d(r,{BricksControllerClient:()=>f,createControllerClient:()=>y});var n,i=t(99436),a=t(5018),o=t(44668),s=t(54506),l=t(78549),p=t(94370),c=t(75149),h=s.ApolloClient,u=s.InMemoryCache,d=s.HttpLink,_=l.o,f=o(function e(r,t){a(this,e),this.baseUrl=r,this.endpoint="/api/graphql";var n,o=new d({uri:`${r}${this.endpoint}`,fetch:(0,c.P)(r)}),s=_((n=i(function*(e,{headers:r}){return{headers:{...r,authorization:`Bearer ${yield t()}`}}}),function(e,r){return n.apply(this,arguments)}));this.apolloClient=new h({link:s.concat(o),cache:new u,defaultOptions:{query:{errorPolicy:"all",fetchPolicy:"no-cache"}}})},[{key:"workspaces",value:(n=i(function*(){for(var e=(0,p.default)`
2
+ query cliWorkspaces($paginate: Paginate) {
3
+ workspaces(paginate: $paginate) {
4
+ _id
5
+ name
6
+ description
7
+ billing {
8
+ plan {
9
+ type
10
+ period
11
+ }
12
+ lock {
13
+ features
14
+ }
15
+ }
16
+ }
17
+ }
18
+ `,r=[],t=0;;t+=100){var n=yield this.apolloClient.query({query:e,variables:{paginate:{limit:100,offset:t}}}),i=n.data,a=n.errors;if(a?.length>0)throw Error(a.map(({message:e})=>e).join("\n"));var o=i.workspaces||[];if(r.push(...o),o.length<100)return r}}),function(){return n.apply(this,arguments)})}]),y=(e,r)=>new f(e,r)},75149(e,r,t){t.d(r,{P:()=>a});var n=t(79657),i=t(64007);function a(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return n.Ay;var t=new i(r);return(e,r={})=>(0,n.Ay)(e,{...r,agent:t})}}};
package/lib/7511.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=7511;export const __rspack_esm_ids=[7511];export const __webpack_modules__={66422(e,t){let i=e=>`PROPERTY_BANK_DATA_NODE_${e}`,a={isLocalSyncMainDevice:{id:i("325068e3-89b6-4c6a-942b-126d38c84a62"),title:"SYSTEM: Is Local Sync Main Device",description:"The current device is main for local sync",type:"bool",value:!0},currentCanvasId:{id:i("2dfeb635-deb4-481a-9d17-ea7b1fe19f74"),title:"SYSTEM: Current Canvas ID",description:"ID for known current canvas",type:"string",value:""},previousCanvasId:{id:i("2971e463-0b0e-45b7-bbfb-a01d8fd49db3"),title:"SYSTEM: Previous Canvas ID",description:"ID for known previous canvas",type:"string",value:""},canvasIdHistory:{id:i("1a086f39-817d-40ed-92f0-5a999535d3dd"),title:"SYSTEM: Change Canvas History",description:"Change Canvas ID History (Limit: 10)",type:"array",schema:{type:"string",allowNewItem:!1,allowCustomProperty:!1},value:[]},rootSubspaceInfo:{id:i("c0817f4a-1ff3-40ed-9cbf-71d8cefd2cd9"),title:"SYSTEM: Root Subspace Info",description:"Root Subspace Information",type:"object",value:{}},subspaceInfo:{id:i("2657ec09-7323-46c3-a96e-3d8b5a0f79b3"),title:"SYSTEM: Current Subspace Info",description:"Current Subspace Information",type:"object",value:{}},uniqueID:{id:i("6f4a543f-a88a-4a83-bf53-223259263be3"),title:"SYSTEM: Unique ID",description:"Unique ID of current device",type:"string",value:"unknown"},appVersion:{id:i("d614a258-2a45-4f91-9f6b-3936038cb2b1"),title:"SYSTEM: App Version",description:"App Version of current installed BRICKS Foundation app",type:"string",value:"unknown"},lastUpdateTime:{id:i("956f3b3e-cb0b-47ca-8119-65663910d110"),title:"SYSTEM: Last Update Time",description:"Last update time of current installed BRICKS Foundation app",type:"string",value:"2019-07-09T03:32:27.058Z"},deviceName:{id:i("7b9d9ad4-e9a2-47cd-91d3-b64187895c16"),title:"SYSTEM: Device Name",description:"Name of current device",type:"string",value:"Default Device Name"},deviceType:{id:i("b0beae12-e45e-4870-ae15-858eeac566fa"),title:"SYSTEM: Device Type",description:"Type of current device (Handset, Tv, Tablet)",type:"string",value:"Tv"},operationMode:{id:i("2e715d3b-92bf-4761-b5c0-ca21f7c1ada8"),title:"SYSTEM: Operation Mode",description:"Operation Mode of current device (android, ios, ...)",type:"string",value:"android"},operationVersion:{id:i("fa886963-0a16-4b5f-b4ea-6c25b049db03"),title:"SYSTEM: Operation Version",description:"Operation Version of current device",type:"string",value:""},screenWidth:{id:i("2942470a-c3bc-413e-8f2c-30a89aded3f8"),title:"SYSTEM: Screen Width",description:"Width of current device main screen",type:"number",value:1280},screenHeight:{id:i("4f031e27-f67b-40e0-a317-9f6c5215d97d"),title:"SYSTEM: Screen Height",description:"Height of current device main screen",type:"number",value:768},screenScale:{id:i("c3c9b7aa-1dc1-4be1-8a4a-d9e299b9eeaa"),title:"SYSTEM: Screen Scale",description:"Scale of current device main screen",type:"number",value:2},screenFontScale:{id:i("0312f380-d525-4938-82d2-5b35ef8ef1e8"),title:"SYSTEM: Screen Font Scale",description:"Font scale of current device main screen",type:"number",value:1},orientation:{id:i("4f584f51-a250-4f97-a2f8-d5e6a3affb4f"),title:"SYSTEM: Orientation",description:"Orientation of current device main screen",type:"string",value:"landspace"},touchAvailable:{id:i("1fe7555f-df41-43ce-a268-3ea1b5efda6d"),title:"SYSTEM: Touch Available",description:"Is touch available of current device main screen?",type:"bool",value:!0},soundAvailable:{id:i("bf839498-f7d6-4212-ac3a-b409e3ad77a5"),title:"SYSTEM: Sound Available",description:"Is sound available of current device?",type:"bool",value:!0},cameraAvailable:{id:i("4878f3c2-8bb8-4c94-855c-06bda5a287d5"),title:"SYSTEM: Camera Available",description:"Is camera available of current device?",type:"bool",value:!0},audioInputAvailable:{id:i("4854b259-96c1-40d7-b17b-47156b4698dc"),title:"SYSTEM: Audio Input Available",description:"Is audio input available of current device?",type:"bool",value:!1},networkType:{id:i("1cbb1756-e53c-45a9-be23-5d84a214e144"),title:"SYSTEM: Network Type",description:"Network Type of current device",type:"string",value:"wifi"},networkConnected:{id:i("687b62fe-ead5-417a-b415-9bd5233784a4"),title:"SYSTEM: Network Connected",description:"Is Network connected of current device?",type:"bool",value:!0},networkIpAddress:{id:i("41971ba7-8294-4aa6-a425-ecd39853c3e6"),title:"SYSTEM: Network IP Address",description:"Current network IP address",type:"string",value:""},networkDetails:{id:i("9351fbfc-4ace-477a-b05d-41ac9b05087d"),title:"SYSTEM: Network Details",description:"Network details, provide different data depends on Network Type",type:"object",value:null},isInternetReachable:{id:i("e367ae7e-46ec-46d0-b87d-51e544591ff9"),title:"SYSTEM: Internet Reachable",description:"Is Internet reachable?",type:"bool",value:!0},isWifiEnabled:{id:i("be395305-fb85-4d05-8506-22a4ae8c7b9e"),title:"SYSTEM: Wifi Enabled",description:"Is WiFi enabled?",type:"bool",value:!0},deviceDisplayName:{id:i("76356a9a-fc46-11ec-9905-db53d6811cb7"),title:"SYSTEM: Device Display Name",description:"Current device display name",type:"string",value:""},workspaceName:{id:i("d857125e-0401-40f1-b768-56190aa8e147"),title:"SYSTEM: Workspace Name",description:"Current workspace name",type:"string",value:""},applicationInfo:{id:i("935d3322-84aa-4465-b1e7-241d1f024267"),title:"SYSTEM: Application Info",description:"Current application info",type:"object",value:{}},applicationName:{id:i("df395fd6-a754-4b60-8bac-1360933e6707"),title:"SYSTEM: Application Name",description:"Current application name",type:"string",value:""},deviceID:{id:i("8b5c2d9e-f0a1-4b2c-8d3e-4f5a6b7c8d9e"),title:"SYSTEM: Device ID",description:"Device ID of current device",type:"string",value:"unknown"},macAddress:{id:i("f01fcc78-0723-11ed-ac00-877339de1030"),title:"SYSTEM: MAC Address",description:"Network adapter MAC address of current device",type:"string",value:""},bindDeviceCode:{id:i("1ca90262-3584-11ed-8c9a-174949844872"),title:"SYSTEM: Bind Device Code",description:"The passcode to bind the device",type:"string",value:"",hide:!0},bindDeviceCodeExpire:{id:i("5b52d204-3584-11ed-bb5e-abb4d270daf1"),title:"SYSTEM: Bind Device Code Expire Time",description:"The expire time of bind passcode",type:"string",value:"",hide:!0},bindDeviceUrl:{id:i("833a7db2-3584-11ed-88dd-3b3d3ff58855"),title:"SYSTEM: Bind Device URL",description:"The URL to bind the device",type:"string",value:"",hide:!0},bindDeviceUseApplication:{id:i("631bbce8-9c90-4590-b8ec-8b27f4a0e50b"),title:"SYSTEM: Selected Application on Bind Device",description:"Current selected use application info on Bind Device",type:"object",value:null,hide:!0},isApplicationPreview:{id:i("c673967a-3996-11ed-96d9-efbc3f7eac53"),title:"SYSTEM: Is Preview Mode",description:"Is current in preview mode?",type:"bool",value:"",hide:!0},isSupportAuthInDevice:{id:i("beb2a666-3e18-11ed-bdab-6f0cb082fa67"),title:"SYSTEM: Is Support Auth In Device",description:"Is current device support auth in device?",type:"bool",value:"",hide:!0},env:{id:i("74e7a574-1099-4fe5-b193-8a9ea7d20ed0"),title:"SYSTEM: Environment Variables",description:"Environment Variables of the device",type:"object",value:{}},isViewDebugModeEnabled:{id:i("3f61c4f6-1e02-492e-8e4c-a8dc4a5bc101"),title:"SYSTEM: Is View Debug mode Enabled",description:"Is View Debug mode enabled?",type:"bool",value:!1},language:{id:i("f0ed0a03-6195-459f-9ffe-bca61923f94e"),title:"SYSTEM: Language",description:"Language of the device",type:"string",value:""},aiFilters:{id:i("3ffc1e98-8f65-4cc8-a949-3da8d2092ccb"),title:"SYSTEM: AI Filters",description:"AI filters configuration from the application",type:"array",value:[]},systemOpenAIApiKey:{id:i("a1b2c3d4-5e6f-7890-abcd-ef1234567890"),title:"SYSTEM: OpenAI API Key",description:"System OpenAI API Key (only available if application enabled)",type:"string",value:""},systemAnthropicApiKey:{id:i("b2c3d4e5-6f78-9012-bcde-f23456789012"),title:"SYSTEM: Anthropic API Key",description:"System Anthropic API Key (only available if application enabled)",type:"string",value:""},systemGeminiApiKey:{id:i("c3d4e5f6-7890-1234-cdef-345678901234"),title:"SYSTEM: Gemini API Key",description:"System Gemini API Key (only available if application enabled)",type:"string",value:""},ggmlBackendDevices:{id:i("9e8f7a6b-5c4d-3e2f-1a0b-9c8d7e6f5a4b"),title:"SYSTEM: GGML Backend Devices",description:"Available GGML backend devices with supported generators",type:"array",schema:{type:"object",allowNewItem:!1,allowCustomProperty:!1},value:[]}};t.idMap=Object.entries(a).reduce((e,[t,i])=>(e[t]=i.id,e),{}),Object.fromEntries(Object.entries(t.idMap).map(([e,t])=>[t,e])),t.MI=Object.entries(a).reduce((e,[t,i])=>{let{id:a,...r}=i;return e[t]=r,e},{}),Object.keys(t.MI)},18501(e,t,i){let{docs:a}=i(5867);t.isCommand=e=>!!(e&&e.type&&e.type.startsWith("command-node-")),t.getPorts=e=>e?Array.isArray(e)?e:[e]:[],t.getCommandCallbackFromPort=(e,i)=>{let r=e[i];if(!t.isCommand(r))return null;let n=a[r.type.replace("command-node-","")]?.commands?.[r.properties?.command];return n?.iterateeFrom||n?.invocationFrom||null},t.checkDisableTriggerCommand=(e,i)=>t.getPorts(e[i.id]?.in?.[i.port]).some(e=>e?.disable_trigger_command),t.findCircularReferenceIds=e=>{let i,a=(i=new Map,Object.keys(e).reduce((a,r)=>{let n=[];return Object.values(e[r]?.out||{}).forEach(a=>{t.getPorts(a).forEach(a=>{((e,i,a)=>{var r;return!!i&&!!e[i.id]&&!(i.port===(r=i.id,a.has(r)||a.set(r,t.getCommandCallbackFromPort(e,r)),a.get(r))||t.checkDisableTriggerCommand(e,i))})(e,a,i)&&n.push(a.id)})}),a[r]=n,a},{})),r=new Map;return Object.keys(e).filter(t=>e[t]?.type==="data-node").filter(e=>((e,t,i)=>{if(i.has(e))return i.get(e);let a=[{id:e,edgeIndex:0,reachesCycle:!1}],r=new Set([e]);for(;a.length>0;){let e=a[a.length-1],n=t[e.id]||[];if(e.reachesCycle||e.edgeIndex>=n.length){r.delete(e.id),i.set(e.id,e.reachesCycle),a.pop(),e.reachesCycle&&a.length>0&&(a[a.length-1].reachesCycle=!0);continue}let o=n[e.edgeIndex];if(e.edgeIndex+=1,i.has(o)){i.get(o)&&(e.reachesCycle=!0);continue}if(r.has(o)){e.reachesCycle=!0;continue}r.add(o),a.push({id:o,edgeIndex:0,reachesCycle:!1})}return i.get(e)||!1})(e,a,r))},t.hasCircularReference=e=>t.findCircularReferenceIds(e).length>0;let r=(e={})=>Object.entries(e).reduce((e,[t,i])=>(e[t]=Array.isArray(i)?i.slice():i,e),{}),n=new WeakSet,o=(e,t,i)=>{if(!i)return;let a=((e,t)=>{let i=e[t];if(!i)return e[t]=[],e[t];if(!Array.isArray(i))return e[t]=[i],e[t];if(!n.has(i)){let e=0;for(let t of i)t&&(i[e]=t,e+=1);i.length=e,n.add(i)}return i})(e,t);(Array.isArray(i)?i:[i]).forEach(e=>{e&&a.push(e)})};t.getCalcMap=e=>e?.script_map||e?.scriptMap||e?.map||{},t.composeMap=e=>Object.values(e).reduce((e,i)=>Object.entries(t.getCalcMap(i)).reduce((e,[i,a])=>{if(e[i]){if(t.isCommand(a))throw Error(`Doesn't allow same command id in another map, ${i}`);let r=e[i];Object.keys(a?.in||{}).forEach(e=>{o(r.in,e,a.in[e])}),Object.keys(a?.out||{}).forEach(e=>{o(r.out,e,a.out[e])})}else e[i]={...a,in:r(a?.in),out:r(a?.out)};return e},e),{})},86343(e,t,i){let{v4:a}=i(45620),r=i(95479),n=i(56005),{nameMap:o,brickMapping:s,generatorMapping:c}=i(63981);t.idByItem=(e={})=>e.canvas_id||e.subspace_id||e.brick_id||e.generator_id||e.property_bank_id||e.property_bank_calc_id||e.bank_id||e.scene_id,t.getAnimationType=e=>e.type||e.compose_type||e.composeType,t.cleanUpAnimationMap=e=>Object.entries(e).reduce((e,[t,i])=>((i.type||i.compose_type)&&(e[t]=i),e),{}),t.matchItemByItem=(e,t)=>{let i;if(!e)return!1;switch("string"==typeof t&&(i=t),e.type){case"brick":return e.brick_id===(i||t.brick_id);case"subspace":return e.subspace_id===(i||t.subspace_id);case"canvas":return e.canvas_id===(i||t.canvas_id);case"generator":return e.generator_id===(i||t.generator_id);case"property_bank":return e.property_bank_id===(i||t.property_bank_id);default:return!1}},t.makePasscode=()=>a(),t.kindOneOfTypes={string:["color","datetime","id","graphql","rich-text-content","sandbox-script","llm-prompt","media-resource-image","media-resource-video","media-resource-audio","media-resource-file","lottie-file-uri","rive-file-uri","ggml-model-asset","gguf-model-asset","mlx-model-asset","binary-asset","scene3d-objects"],number:["unit"],object:["tts-speaker-config"],"array-object":["llm-tools","llm-messages","mcp-server-resources","mcp-server-tools","mcp-server-prompts"]},t.getKindOneOfTypes=(e,i)=>"array"===e?"object"===i?t.kindOneOfTypes[`${e}-${i}`]:void 0:t.kindOneOfTypes[e],t.unitOneOfTypes=["grid","px","ms"],t.idOneOfTypes=["canvas","brick","generator","animation","property_bank"],t.typeToName={brick:"Brick",generator:"Generator",subspace:"Subspace",canvas:"Canvas",animation:"Animation",property_bank:"Data",property_bank_calc:"Calculation"},t.getBrickName=(e,i,a)=>{let n;if(!i)return e.toUpperCase();if(i.title)return i.title;switch(e){case"bank":n="BANK";break;case"subspace":n="SUBSPACE";break;case"canvas":n="CANVAS";break;case"animation":n=`<${r(t.getAnimationType(i))}>`;break;case"property_bank":n="<Data>";break;case"property_bank_calc":n="<Map>";break;case"state_group":n="<Switch Case>";break;default:n=`<${o[i.template_key||i.templateKey]||"Unknown"}>`}return a&&a.length>10?n+=` (${a.replace(/[A-Z_]+/g,"").substr(0,6)}...)`:a&&(n+=` (${a})`),n},t.getEventLabel=(e,{templateKey:t,itemType:i}={})=>{if(!e)return"";let a=e;return"subspace"===i?a=e.replace("SUBSPACE_ACTION_",""):t&&(a=e.replace(`${t}_`,"").replace("CANVAS_","")),r(n(r(a)))},t.getCallInternalActions=e=>{let t=s[e]||c[e];if(t)return t.callInternalActions},t.mapToList=(e,i)=>Object.entries(i).reduce((i,[a,r])=>(i.push({id:a,...r,title:t.getBrickName(e,r,a)}),i),[]);let d={subspaceMap:"subspace",brickMap:"brick",generatorMap:"generator",propertyBankMap:"property_bank",propertyAvailableToAdd:"property_bank",canvasMap:"canvas",animationMap:"animation"},l={};t.mapToListForDerivedState=(e,i,a,r)=>{let n=a[e]||l;return n!==r[e]?{[e]:n,[i]:t.mapToList(d[e],n)}:{}},t.arrayTypePrefix="array of ",t.propertyBankTypes=["string","number","bool","object","any",`${t.arrayTypePrefix}string`,`${t.arrayTypePrefix}number`,`${t.arrayTypePrefix}bool`,`${t.arrayTypePrefix}object`],t.animationRunTypes=["once","loop"],t.stopPropagationOnKeyBackspace=e=>{8===e.keyCode&&e.stopPropagation()},t.nestedTypes=["object","array","any"],t.isPropertyBankTypeNested=e=>t.nestedTypes.includes(e),t.propertyTypeToSchema=e=>{let i=e.indexOf(t.arrayTypePrefix)>-1,a=e.replace(t.arrayTypePrefix,"");return{type:a,properties:"object"===a?{}:void 0,allowNewItem:i,allowCustomProperty:"object"===a}}},33770(e,t,i){let{idMap:a}=i(66422),{forEachEventAction:r,getActionParam:n}=i(78078),o="PROPERTY_BANK_DATA_NODE_",s=new Set(Object.values(a||{}).filter(e=>"string"==typeof e&&e.startsWith(o)));e.exports=function(e){let t,i,a=[],c=(t=new Set(s),Object.values(e.subspace_map||{}).forEach(e=>{e&&"object"==typeof e&&Object.keys(e.property_bank_map||{}).forEach(e=>t.add(e))}),t),d=(i=new Set,Object.values(e.subspace_map||{}).forEach(e=>{e&&"object"==typeof e&&Object.keys(e.canvas_map||{}).forEach(e=>i.add(e))}),i);return r(e,(e,t)=>{if("PROPERTY_BANK_EXPRESSION"===e.action){let i;Array.isArray(i=n(e,"VARIABLES"))&&i.forEach((e,i)=>{let r=e?.id;if("string"!=typeof r||!r.startsWith(o)||c.has(r))return;let n=e.key?`\`${e.key}\``:`at index ${i}`;a.push({field:`${t}.VARIABLES[${i}].id`,message:`PROPERTY_BANK_EXPRESSION variable ${n} references data node \`${r}\`, which is not defined in any subspace.`})})}else"CHANGE_CANVAS"===e.action&&((e,t,i,a)=>{if("SYSTEM"!==e.handler)return;let r=n(e,"CANVAS_ID");"string"!=typeof r||!r||r.startsWith("PROPERTY_BANK#")||r.startsWith("VARIABLE#")||!r.startsWith("CANVAS_")||i.has(r)||a.push({field:`${t}.CANVAS_ID`,message:`CHANGE_CANVAS references canvas \`${r}\`, which is not defined in any subspace.`})})(e,t,d,a)}),a}},37517(e,t,i){let{composeMap:a,findCircularReferenceIds:r}=i(18501);e.exports=function(e){let t=[];return Object.entries(e.subspace_map||{}).forEach(([e,i])=>{if(i.module?.link)return;let n=i.property_bank_calc_map;if(!n||0===Object.keys(n).length)return;let o=`subspace_map.${e}.property_bank_calc_map`;try{let e=a(n),i=r(e);if(i.length>0){let a=i.slice(0,5).map(t=>e[t].title||t),r=i.length>5?` and ${i.length-5} more`:"";t.push({field:o,message:`Circular reference detected in data calculation. Affected nodes: ${a.join(", ")}${r}. Please check the data connections for loops.`})}}catch(e){t.push({field:o,message:e.message})}}),t}},41900(e){e.exports={expressionFoldAcornOptions:{ecmaVersion:2022,allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0},getUnfoldableStatementDescription:(e,t=null)=>{for(let t=0;t<e.length;t+=1){let i=e[t];if("ExpressionStatement"===i.type){let{expression:e}=i;if("AssignmentExpression"===e.type&&"Identifier"!==e.left.type)return"an assignment to a member or computed target";continue}if("VariableDeclaration"===i.type){if(i.declarations.some(e=>"Identifier"!==e.id.type||!e.init))return"a variable declaration with destructuring or no initializer";continue}if(t!==e.length-1||"ReturnStatement"!==i.type)return`an unsupported ${i.type}`}return t}}},78078(e,t,i){let{parse:a}=i(89236),{expressionFoldAcornOptions:r}=i(41900),n=(e,t)=>{let i=e.parameter_list||e.parameterList||[];if(!Array.isArray(i))return;let a=i.find(e=>(e?.input_to_receiver||e?.inputToReceiver)===t);return a?a.result_from_sender??a.resultFromSender:void 0},o=(e,t,i)=>{if(e&&"object"==typeof e){if(Array.isArray(e))return void e.forEach((e,a)=>o(e,`${t}[${a}]`,i));Object.entries(e).forEach(([e,a])=>{("event_map"===e||"eventMap"===e)&&a&&"object"==typeof a?Object.entries(a).forEach(([a,r])=>{Array.isArray(r)&&r.forEach((r,n)=>{r&&"object"==typeof r&&i(r,`${t}.${e}.${a}[${n}]`)})}):a&&"object"==typeof a&&o(a,`${t}.${e}`,i)})}},s=(e,t)=>{Object.entries(e.subspace_map||{}).forEach(([e,i])=>{!i||"object"!=typeof i||i.module?.link||o(i,`subspace_map.${e}`,t)})};e.exports=function(e){let t=[];return s(e,(e,i)=>{if("PROPERTY_BANK_EXPRESSION"!==e.action)return;let o=n(e,"EXPRESSION");if("string"!=typeof o||o.startsWith("PROPERTY_BANK#"))return;let s=(e=>{if(!e.trim())return"Expression is empty";try{a(e,r)}catch(e){return`Expression does not parse: ${e.message}`}return null})(o);s&&t.push({field:i,message:s})}),t},e.exports.forEachEventAction=s,e.exports.getActionParam=n},38890(e,t,i){let{getDocByTemplateKey:a}=i(63981),r=i(80211),n=i(45907),o=i(37517),s=i(78078),c=i(33770),{lintConfig:d,lintRuleCodes:l}=i(9098),{getBrickName:p}=i(86343);t.lintConfig=d,t.lintRuleCodes=l;let u=(e,t,i,a)=>({id:e,name:"Used Deprecated Feature",data:`The \`${p("brick",t,e)}\` brick in \`${p("subspace",i,a)}\` have been deprecated, it may not work in the future, please consider to remove it. If you can't see the item, please enable \`Show Deprecated Features\` in setting.`});t.checkConfigDeprecatedFeatures=e=>{let t=[];return Object.entries(e.subspace_map||{}).forEach(([e,i])=>{Object.entries(i.brick_map||{}).forEach(([r,n])=>{(void 0!==n.property?.borderLeftWidth||void 0!==n.property?.borderRightWidth||void 0!==n.property?.borderTopWidth||void 0!==n.property?.borderBottomWidth)&&t.push({id:r,name:"Used Deprecated Feature",data:`In v2.16, we have been changed \`Border Width\` to \`Border Size\` (Unit \`px\` to \`grid\`). The \`${p("brick",n,r)}\` brick still used the border width. Please re-edit it to transfer to the new unit.`});let o=a(n.template_key);o?.brickMeta?.deprecated&&t.push(u(r,n,i,e))}),Object.entries(i.generator_map||{}).forEach(([r,n])=>{let o=a(n.template_key);o?.brickMeta?.deprecated&&t.push(u(r,n,i,e))})}),t},t.checkConfig=(e,t={})=>{let i={schema:r(e),ref:n(e,t),calc:t.checkCalc?o(e):[],expression:t.checkExpressions?s(e):[],actionRef:t.checkActionRefs?c(e):[]};return i.valid=0===i.schema.length&&0===i.ref.length&&0===i.calc.length&&0===i.expression.length&&0===i.actionRef.length,i.message=i.schema.concat(i.ref).concat(i.calc).concat(i.expression).concat(i.actionRef).map(({instancePath:e,field:t,message:i})=>{let a=e||t;return a?`${a}: ${i}`:i}).join("\n"),i}},27899(e){let t=["x","y","width","height"],i=e=>"string"==typeof e&&e.startsWith("PROPERTY_BANK_"),a=/PROPERTY_BANK#(PROPERTY_BANK_[A-Za-z0-9_-]+)/g,r=/(?:BRICK|ANIMATION|SUBSPACE)_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g,n=(e,t=new Set)=>{if("string"==typeof e){let i;for(a.lastIndex=0;i=a.exec(e);)t.add(i[1])}else Array.isArray(e)?e.forEach(e=>n(e,t)):e&&"object"==typeof e&&(i(e.id)&&t.add(e.id),Object.values(e).forEach(e=>n(e,t)));return t},o=(e,t)=>{if("string"==typeof e){let i;for(r.lastIndex=0;i=r.exec(e);)t.add(i[0])}else Array.isArray(e)?e.forEach(e=>o(e,t)):e&&"object"==typeof e&&Object.values(e).forEach(e=>o(e,t));return t},s=(e,t)=>{Object.entries(e.subspace_map||{}).forEach(([e,i])=>{!i||"object"!=typeof i||i.module?.link||t(e,i)})},c=(e,t)=>{s(e,(e,i)=>{Object.entries(i.canvas_map||{}).forEach(([a,r])=>{let n=Array.isArray(r?.item_list)?r.item_list:[];t({subspaceId:e,subspace:i,canvasId:a,canvas:r,items:n})})})},d=[["brick_map","brick"],["generator_map","generator"],["property_bank_map","property_bank"],["canvas_map","canvas"]],l=(e,t,i)=>{d.forEach(([a,r])=>{Object.entries(t[a]||{}).forEach(([t,n])=>{Object.entries(n?.event_map||{}).forEach(([n,o])=>{Array.isArray(o)&&i({ownerType:r,ownerId:t,eventKey:n,list:o,path:`subspace_map.${e}.${a}.${t}.event_map.${n}`})})})})},p=(e,t)=>(e.parameter_list||[]).find(e=>e?.input_to_receiver===t)?.result_from_sender;e.exports={FRAME_KEYS:t,isBankNodeId:i,collectBankReads:n,forEachSubspace:s,forEachCanvas:c,forEachCanvasItem:(e,t)=>{c(e,e=>{e.items.forEach((i,a)=>{t({...e,item:i,index:a})})})},forEachEventList:l,getParamValue:p,hasParamValue:(e,t)=>{let i=p(e,t);return null!=i&&""!==i},collectDynamicallyReferencedIds:e=>{let t=new Set;return s(e,(e,i)=>{l(e,i,({list:e})=>{e.forEach(e=>o(e?.parameter_list,t))})}),o(e.automation_map,t),o(e.test_map,t),t},frameIsNumeric:e=>!!e&&t.every(t=>"number"==typeof e[t]),framesAlmostEqual:(e,i,a=.01)=>t.every(t=>Math.abs(e[t]-i[t])<=a),frameContains:(e,t,i=.01)=>e.x<=t.x+i&&e.y<=t.y+i&&e.x+e.width>=t.x+t.width-i&&e.y+e.height>=t.y+t.height-i,framesIntersect:(e,t)=>!(e.x+e.width<=t.x||t.x+t.width<=e.x||e.y+e.height<=t.y||t.y+t.height<=e.y),getItemId:e=>e?.brick_id||e?.subspace_id||null,itemHasAnimations:e=>!!e?.animations&&Object.keys(e.animations).length>0}},9098(e,t,i){let{collectDynamicallyReferencedIds:a}=i(27899),r=[i(98632),i(84223),i(92260),i(96810),i(60760),i(40566),i(31172),i(59707),i(39425)],n=r.map(e=>e.code),o=e=>Array.isArray(e)?e:"string"==typeof e&&e?e.split(",").map(e=>e.trim()).filter(Boolean):null;e.exports={lintConfig:(e,t={})=>{let i,s=o(t.only),c=o(t.ignore),d=[...s||[],...c||[]].filter(e=>!n.includes(e));if(d.length>0)throw Error(`Unknown lint rule code(s): ${d.join(", ")}. Valid codes: ${n.join(", ")}`);if(!e||"object"!=typeof e)return[];let l=r.filter(e=>(!s||s.includes(e.code))&&(!c||!c.includes(e.code)));if(0===l.length)return[];let p={configType:"module"===t.configType?"module":"app",gridStep:"number"==typeof t.gridStep&&t.gridStep>0?t.gridStep:.5,get dynamicRefIds(){return i||(i=a(e)),i}},u=[];return l.forEach(t=>{try{t.check(e,p,e=>u.push({severity:t.severity,code:t.code,path:"",subspaceId:null,itemId:null,hint:null,...e}))}catch(e){u.push({severity:"warning",code:t.code,path:"",subspaceId:null,itemId:null,message:`Lint rule crashed: ${e.message}`,hint:null})}}),u},lintRuleCodes:n}},98632(e,t,i){let{composeMap:a}=i(18501),{forEachSubspace:r,forEachEventList:n,collectBankReads:o,isBankNodeId:s,getParamValue:c}=i(27899),d=(e,t)=>t.map(t=>c(e,t)).filter(s),l={PROPERTY_BANK:{waitable:!0,targets:e=>(e.parameter_list||[]).map(e=>e?.input_to_receiver).filter(s)},PROPERTY_BANK_EXPRESSION:{waitable:!0,targets:e=>d(e,["RESULT","ERROR_RESULT"])},PROPERTY_BANK_COMMAND:{waitable:!0,targets:(e,t)=>((e,t)=>{let i=t();if(!i)return[];let a=[],r=new Set,n=(e.parameter_list||[]).map(e=>e?.input_to_receiver).filter(s);for(let e=0;e<n.length;e+=1){let t=n[e];if(r.has(t))continue;r.add(t);let o=i[t];o&&Object.values(o.out||{}).forEach(e=>{(e||[]).forEach(e=>{e?.id&&(e.id.includes("DATA_NODE")&&a.push(e.id),n.push(e.id))})})}return a})(e,t)},STORAGE_RETRIEVE:{waitable:!0,targets:e=>d(e,["STORAGE_RETRIEVE_RESULT"])},OPEN_FILE:{waitable:!0,targets:e=>d(e,["SAVE_PROPERTY","SAVE_DETAIL_PROPERTY","ERROR_SAVE_PROPERTY"])},SAVE_UPDATE_SNAPSHOT:{waitable:!0,targets:e=>d(e,["SNAPSHOT_SAVE_RESULT","SNAPSHOT_ERROR_RESULT"])},TRIGGER_APPLICATION_FILTER:{waitable:!0,targets:e=>d(e,["RESULT","ERROR_RESULT"])},TAKE_SCREENSHOT:{waitable:!1,targets:e=>d(e,["TAKE_SCREENSHOT_SAVE_PROPERTY"])}},p=/(^|_)RESULT$|_SAVE_PROPERTY$/;e.exports={code:"data-update-race",severity:"warning",description:"A data node is written without wait_async and read by a later action in the same event",check(e,t,i){r(e,(e,t)=>{let r,c=()=>{if(void 0===r)try{r=a(t.property_bank_calc_map||{})}catch{r=null}return r};n(e,t,({path:t,list:a})=>{let r=new Map;a.forEach((a,n)=>{if(!a||"object"!=typeof a)return;if("SYSTEM"===a.handler&&"DELAY"===a.action)return void r.clear();let d=new Set;(a.parameter_list||[]).forEach(e=>o(e?.result_from_sender,d)),d.forEach(o=>{let s=r.get(o);s&&(i({path:`${t}.${n}`,subspaceId:e,itemId:o,message:`\`${o}\` is written by action #${s.index} (${s.action}) without waiting, then read by action #${n} (${a.action}) — the read can still see the previous value.`,hint:s.waitable?`Set \`wait_async: true\` on action #${s.index} (${s.action}).`:`${s.action} ignores \`wait_async\` for its data write — insert a SYSTEM DELAY action between the two, or move the read into the data node's value-change event.`}),r.delete(o))});let u=((e,t)=>{if("SYSTEM"===e.handler){let i=l[e.action];if(!i)return null;let a=i.targets(e,t);return a.length>0?{targets:a,waitable:i.waitable}:null}let i=(e.parameter_list||[]).filter(e=>"string"==typeof e?.input_to_receiver&&p.test(e.input_to_receiver)&&s(e.result_from_sender)).map(e=>e.result_from_sender);return i.length>0?{targets:i,waitable:!0}:null})(a,c);if(!u)return;let f=!0===a.wait_async&&u.waitable;u.targets.forEach(e=>{f?r.delete(e):r.set(e,{index:n,action:a.action,waitable:u.waitable})})})})})}}},39425(e,t,i){let{forEachSubspace:a,forEachEventList:r,getParamValue:n}=i(27899),o=new Set(["Math","Date","Object","Array","Number","String","Boolean","JSON","RegExp","Intl","isNaN","isFinite","parseInt","parseFloat"]);e.exports={code:"expression-global-variable",severity:"error",description:"A PROPERTY_BANK_EXPRESSION variable is named after a JS global and is silently ignored at runtime",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{if(a?.handler!=="SYSTEM"||"PROPERTY_BANK_EXPRESSION"!==a.action)return;let s=n(a,"VARIABLES");Array.isArray(s)&&s.forEach(a=>{let n=a?.key;"string"==typeof n&&o.has(n)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,message:`Expression variable "${n}" is named after the JS global \`${n}\` and is silently ignored — the global takes precedence in the expression scope, so the bound value is never used.`,hint:`Rename the variable (e.g. "${n}Value") so the expression reads the bound value.`})})})})})}}},40566(e,t,i){let{forEachSubspace:a,forEachEventList:r,hasParamValue:n}=i(27899),o=[{action:"STORAGE_RETRIEVE",severity:"error",isMissing:e=>!n(e,"STORAGE_RETRIEVE_RESULT"),message:"STORAGE_RETRIEVE requires a STORAGE_RETRIEVE_RESULT parameter — without it the action throws at runtime.",hint:"Add a STORAGE_RETRIEVE_RESULT parameter pointing at a data node."},{action:"TAKE_SCREENSHOT",severity:"warning",isMissing:e=>!n(e,"TAKE_SCREENSHOT_SAVE_PROPERTY"),message:"TAKE_SCREENSHOT without TAKE_SCREENSHOT_SAVE_PROPERTY is silently skipped at runtime.",hint:"Add a TAKE_SCREENSHOT_SAVE_PROPERTY parameter pointing at a data node."},{action:"OPEN_FILE",severity:"warning",isMissing:e=>!n(e,"SAVE_PROPERTY")&&!n(e,"SAVE_DETAIL_PROPERTY"),message:"OPEN_FILE has no SAVE_PROPERTY / SAVE_DETAIL_PROPERTY — the picked file is discarded.",hint:"Add SAVE_PROPERTY (file uri) or SAVE_DETAIL_PROPERTY (file detail) parameters."},{action:"OPEN_URL",severity:"warning",isMissing:e=>!n(e,"URL"),message:"OPEN_URL has no URL parameter — the action does nothing.",hint:"Add a URL parameter."}];e.exports={code:"missing-result-param",severity:"warning",description:"An action is missing the parameter that receives or drives its effect",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{if(a?.handler!=="SYSTEM")return;let n=o.find(e=>e.action===a.action);n&&n.isMissing(a)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,severity:n.severity,message:n.message,hint:n.hint})})})})}}},92260(e,t,i){let{forEachCanvasItem:a,frameIsNumeric:r,getItemId:n,FRAME_KEYS:o}=i(27899),s=["width","height"];e.exports={code:"off-grid-frame",severity:"warning",description:"Frame values should be multiples of the 0.5 grid step",check(e,t,i){let c=t.gridStep;a(e,({subspaceId:e,canvasId:t,item:a,index:d})=>{let l=a?.frame;if(!r(l))return;let p=o.filter(e=>{let t=l[e];return(!s.includes(e)||!(t<=c))&&Math.abs(t-Math.round(t/c)*c)>.001});0!==p.length&&i({path:`subspace_map.${e}.canvas_map.${t}.item_list.${d}.frame`,subspaceId:e,itemId:n(a),message:`Frame ${p.map(e=>`${e}=${l[e]}`).join(", ")} ${1===p.length?"is":"are"} not aligned to the ${c} grid step.`,hint:`Round frame values to multiples of ${c}.`})})}}},96810(e,t,i){let{forEachCanvasItem:a,frameIsNumeric:r,getItemId:n,itemHasAnimations:o}=i(27899);e.exports={code:"out-of-bounds-frame",severity:"warning",description:"An element is fully outside the subspace layout or has a non-positive size",check(e,t,i){a(e,({subspaceId:a,subspace:s,canvasId:c,item:d,index:l})=>{let p=s.layout;if("number"!=typeof p?.width||"number"!=typeof p?.height||p.width<=0||p.height<=0)return;let u=d?.frame;if(!r(u)||!0===u.exceed_boundary||u.standby_frame||o(d))return;let f=n(d);if(f&&t.dynamicRefIds.has(f))return;let b=`subspace_map.${a}.canvas_map.${c}.item_list.${l}.frame`;if(u.width<=0||u.height<=0)return void i({path:b,subspaceId:a,itemId:f,message:`Frame has a non-positive size (width=${u.width}, height=${u.height}) — the element renders nothing.`,hint:"Give the element a positive size, or remove it if unused."});let h=a===e.root_subspace_id,m=u.x>=p.width||u.x+u.width<=0,y=u.y>=p.height||u.y+u.height<=0;(m||!h&&y)&&i({path:b,subspaceId:a,itemId:f,message:`Frame (x=${u.x}, y=${u.y}, width=${u.width}, height=${u.height}) is fully outside the ${p.width}\xd7${p.height} layout — nothing is visible.`,hint:"Move the element back into the layout, or set `exceed_boundary` if the placement is intentional."})})}}},84223(e,t,i){let{FRAME_KEYS:a,forEachCanvas:r,frameIsNumeric:n,framesAlmostEqual:o,framesIntersect:s,itemHasAnimations:c}=i(27899),d=new Set(["BRICK_TEXT","BRICK_RICH_TEXT"]),l=["linearGradientEnabled","blurEnabled"],p=e=>Object.values(e?.event_map||{}).some(e=>Array.isArray(e)&&e.length>0),u=/^backgroundColor$|^border/,f=(e,t)=>{if(e?.type!=="brick")return null;let i=t[e.brick_id];return d.has(i?.template_key)?i:null},b=e=>a.map(t=>Math.floor(e[t]/.01)),h=e=>e.join(":"),m=(e,t,i,a)=>{if(!n(t?.frame)||!f(t,i))return;let r=h(b(t.frame)),o=(e.get(r)||0)+a;o>0?e.set(r,o):e.delete(r)};e.exports={code:"redundant-rect-overlay",severity:"info",description:"A plain Rect behind a same-frame Text/RichText can be folded into the text brick",check(e,t,i){r(e,({subspaceId:e,subspace:a,canvasId:r,items:d})=>{let y,E=a.brick_map||{},_=(y=new Map,d.forEach(e=>m(y,e,E,1)),y);d.forEach((a,y)=>{if(m(_,a,E,-1),a?.type!=="brick"||!n(a.frame))return;let g=E[a.brick_id];if(g?.template_key!=="BRICK_RECT"||c(a)||t.dynamicRefIds.has(a.brick_id))return;let S={...g.property,...a.property};if(l.some(e=>S[e])||!((e,t)=>{let[i,a,r,n]=b(t);for(let t=-1;t<=1;t+=1)for(let o=-1;o<=1;o+=1)for(let s=-1;s<=1;s+=1)for(let c=-1;c<=1;c+=1)if(e.has(h([i+t,a+o,r+s,n+c])))return!0;return!1})(_,a.frame))return;let v=p(g);for(let t=y+1;t<d.length;t+=1){let c=d[t];if(!n(c?.frame))continue;let l=f(c,E);if(l&&o(a.frame,c.frame,.01)){let t={...l.property,...c.property};if(Object.keys(t).some(e=>u.test(e)&&void 0!==t[e])||v&&p(l))return;i({path:`subspace_map.${e}.canvas_map.${r}.item_list.${y}`,subspaceId:e,itemId:a.brick_id,message:`Rect \`${g.title||a.brick_id}\` has the same frame as the ${l.template_key} above it and only uses base styles`+(v?", behind its press handler.":"."),hint:v?"Make the Text brick pressable, move backgroundColor / border / radius and the press handler onto it, then remove the Rect.":"Set backgroundColor / border / radius directly on the text brick and remove the Rect."});return}if(s(a.frame,c.frame))return}})})}}},31172(e,t,i){let{autoGeneratedItemIdKind:a}=i(99470),{forEachSubspace:r}=i(27899),n="PROPERTY_BANK_",o=()=>({children:Object.create(null),ids:null}),s=(e,t)=>{let i=e;for(let e of t)i.children[e]||(i.children[e]=o()),i=i.children[e];i.ids||(i.ids=[]),i.ids.push(t)},c=(e,t,i,a)=>{let r=i.children[e[a]];if(r){r.ids&&r.ids.forEach(e=>{t.set(e,t.get(e)+1)});for(let i=a+1;i<e.length&&(r=r.children[e[i]]);i+=1)r.ids&&r.ids.forEach(e=>{t.set(e,t.get(e)+1)})}};e.exports={code:"unused-data-node",severity:"info",description:"A data node is defined but never referenced anywhere in the config",check(e,t,i){let d=JSON.stringify(e),l=[];r(e,(i,r)=>{("module"!==t.configType||i!==e.root_subspace_id)&&Object.entries(r.property_bank_map||{}).forEach(([e,t])=>{!(!t||"object"!=typeof t||t.kind===a||t.enable_remote_update||t.global_remote_update_prop||t.linkedFrom||t.alias||t.preload||r.routing?.[e]?.enabled_routing)&&(Object.values(t?.event_map||{}).some(e=>Array.isArray(e)&&e.length>0)||l.push({subspaceId:i,nodeId:e,node:t}))})});let p=((e,t)=>{let i=[...new Set(t)];if(0===i.length)return new Map;let a=new Map(i.map(e=>[e,0])),r=o(),d=o(),l=!1,p=!1;if(i.forEach(e=>{e.startsWith(n)?(s(r,e),l=!0):(s(d,e),p=!0)}),l){let t=e.indexOf(n);for(;-1!==t;)c(e,a,r,t),t=e.indexOf(n,t+1)}if(p)for(let t=0;t<e.length;t+=1)c(e,a,d,t);return a})(d,l.map(({nodeId:e})=>e));l.forEach(({subspaceId:e,nodeId:t,node:a})=>{(p.get(t)||0)>1||i({path:`subspace_map.${e}.property_bank_map.${t}`,subspaceId:e,itemId:t,message:`Data node \`${a.title||t}\` is never referenced in the config.`,hint:"Remove it, or keep it if external tooling depends on it."})})}}},60760(e,t,i){let{forEachSubspace:a,forEachEventList:r}=i(27899),n=new Set(["MESSAGE","ALERT","POPUP_RESET","TAKE_SCREENSHOT","THROW_EXCEPTION","RESTART_FOUNDATION","DYNAMIC_BRICK","DYNAMIC_BRICK_RESET","DYNAMIC_ANIMATION","DYNAMIC_ANIMATION_RESET","DYNAMIC_ANIMATION_STOP","CHANNEL_SUBSCRIBE","CHANNEL_UNSUBSCRIBE","CHANNEL_PUBLISH","DISMISS_KEYBOARD","STORAGE_SET","STORAGE_DELETE","DELAY","USE_SHARE_APPLICATION","AUTH_IN_DEVICE","REFRESH_BINDCODE","STOP_APPLICATION_FILTER"]);e.exports={code:"wait-async-no-op",severity:"info",description:"wait_async is set on an action that ignores it",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{a?.handler!=="SYSTEM"||!0!==a.wait_async||n.has(a.action)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,message:"DELAY"===a.action?"DELAY always waits for its timeout — `wait_async: true` is redundant.":`\`wait_async: true\` has no effect on ${a.action}; the action does not block the chain.`,hint:"DELAY"===a.action?"Remove the redundant flag.":"Remove the flag, or restructure if you relied on it for sequencing."})})})})}}},59707(e,t,i){let{forEachCanvas:a,frameIsNumeric:r,frameContains:n,itemHasAnimations:o}=i(27899);e.exports={code:"z-order-cover",severity:"info",description:"A later opaque element fully covers an earlier pressable element",check(e,t,i){a(e,({subspaceId:e,subspace:a,canvasId:s,items:c})=>{let d=a.brick_map||{},l=[];if(c.forEach((e,t)=>{if(e?.type!=="brick"||!r(e.frame))return;let i=d[e.brick_id];i&&Object.entries(i?.event_map||{}).some(([e,t])=>e.includes("_ON_PRESS")&&Array.isArray(t)&&t.length>0)&&l.push({item:e,index:t,brick:i})}),0===l.length)return;let p=t.dynamicRefIds,u=c.map((e,t)=>((e,t,i,a)=>{let n;if(e?.type!=="brick"||!r(e.frame)||o(e)||a.has(e.brick_id))return null;let s=i[e.brick_id],c={...s?.property,...e.property};return"string"==typeof(n=c.backgroundColor)&&(/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*1(?:\.0+)?\s*\)$/.test(n)||/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(n)||/^#[0-9a-fA-F]{6}$/.test(n))&&(void 0===c.opacity||1===c.opacity)?{index:t,item:e,brick:s,frame:e.frame}:null})(e,t,d,p)).filter(Boolean),f=(e=>{let t=Array(e.length),i=1/0,a=1/0,r=-1/0,n=-1/0,o=-1/0,s=-1/0;for(let c=e.length-1;c>=0;c-=1){let{frame:d}=e[c];i=Math.min(i,d.x),a=Math.min(a,d.y),r=Math.max(r,d.x+d.width),n=Math.max(n,d.y+d.height),o=Math.max(o,d.width),s=Math.max(s,d.height),t[c]={minX:i,minY:a,maxRight:r,maxBottom:n,maxWidth:o,maxHeight:s}}return t})(u),b=0;l.forEach(({item:t,index:a,brick:r})=>{let c,d;if(!(o(t)||p.has(t.brick_id))){for(;b<u.length&&u[b].index<=a;)b+=1;if(c=f[b],d=t.frame,c&&c.minX<=d.x+.01&&c.minY<=d.y+.01&&c.maxRight>=d.x+d.width-.01&&c.maxBottom>=d.y+d.height-.01&&c.maxWidth>=d.width-.02&&c.maxHeight>=d.height-.02)for(let o=b;o<u.length;o+=1){let c=u[o];if(n(c.frame,t.frame))return void i({path:`subspace_map.${e}.canvas_map.${s}.item_list.${a}`,subspaceId:e,itemId:t.brick_id,message:`Pressable \`${r.title||t.brick_id}\` is fully covered by the opaque \`${c.brick?.title||c.item.brick_id}\` later in the item list — it is invisible and untappable.`,hint:"Reorder the items, shrink the covering element, or remove the hidden one."})}}})})}}}};
1
+ export const __rspack_esm_id=7511;export const __rspack_esm_ids=[7511];export const __webpack_modules__={66422(e,t){let i=e=>`PROPERTY_BANK_DATA_NODE_${e}`,a={isLocalSyncMainDevice:{id:i("325068e3-89b6-4c6a-942b-126d38c84a62"),title:"SYSTEM: Is Local Sync Main Device",description:"The current device is main for local sync",type:"bool",value:!0},currentCanvasId:{id:i("2dfeb635-deb4-481a-9d17-ea7b1fe19f74"),title:"SYSTEM: Current Canvas ID",description:"ID for known current canvas",type:"string",value:""},previousCanvasId:{id:i("2971e463-0b0e-45b7-bbfb-a01d8fd49db3"),title:"SYSTEM: Previous Canvas ID",description:"ID for known previous canvas",type:"string",value:""},canvasIdHistory:{id:i("1a086f39-817d-40ed-92f0-5a999535d3dd"),title:"SYSTEM: Change Canvas History",description:"Change Canvas ID History (Limit: 10)",type:"array",schema:{type:"string",allowNewItem:!1,allowCustomProperty:!1},value:[]},rootSubspaceInfo:{id:i("c0817f4a-1ff3-40ed-9cbf-71d8cefd2cd9"),title:"SYSTEM: Root Subspace Info",description:"Root Subspace Information",type:"object",value:{}},subspaceInfo:{id:i("2657ec09-7323-46c3-a96e-3d8b5a0f79b3"),title:"SYSTEM: Current Subspace Info",description:"Current Subspace Information",type:"object",value:{}},uniqueID:{id:i("6f4a543f-a88a-4a83-bf53-223259263be3"),title:"SYSTEM: Unique ID",description:"Unique ID of current device",type:"string",value:"unknown"},appVersion:{id:i("d614a258-2a45-4f91-9f6b-3936038cb2b1"),title:"SYSTEM: App Version",description:"App Version of current installed BRICKS Foundation app",type:"string",value:"unknown"},lastUpdateTime:{id:i("956f3b3e-cb0b-47ca-8119-65663910d110"),title:"SYSTEM: Last Update Time",description:"Last update time of current installed BRICKS Foundation app",type:"string",value:"2019-07-09T03:32:27.058Z"},deviceName:{id:i("7b9d9ad4-e9a2-47cd-91d3-b64187895c16"),title:"SYSTEM: Device Name",description:"Name of current device",type:"string",value:"Default Device Name"},deviceType:{id:i("b0beae12-e45e-4870-ae15-858eeac566fa"),title:"SYSTEM: Device Type",description:"Type of current device (Handset, Tv, Tablet)",type:"string",value:"Tv"},operationMode:{id:i("2e715d3b-92bf-4761-b5c0-ca21f7c1ada8"),title:"SYSTEM: Operation Mode",description:"Operation Mode of current device (android, ios, ...)",type:"string",value:"android"},operationVersion:{id:i("fa886963-0a16-4b5f-b4ea-6c25b049db03"),title:"SYSTEM: Operation Version",description:"Operation Version of current device",type:"string",value:""},screenWidth:{id:i("2942470a-c3bc-413e-8f2c-30a89aded3f8"),title:"SYSTEM: Screen Width",description:"Width of current device main screen",type:"number",value:1280},screenHeight:{id:i("4f031e27-f67b-40e0-a317-9f6c5215d97d"),title:"SYSTEM: Screen Height",description:"Height of current device main screen",type:"number",value:768},screenScale:{id:i("c3c9b7aa-1dc1-4be1-8a4a-d9e299b9eeaa"),title:"SYSTEM: Screen Scale",description:"Scale of current device main screen",type:"number",value:2},screenFontScale:{id:i("0312f380-d525-4938-82d2-5b35ef8ef1e8"),title:"SYSTEM: Screen Font Scale",description:"Font scale of current device main screen",type:"number",value:1},orientation:{id:i("4f584f51-a250-4f97-a2f8-d5e6a3affb4f"),title:"SYSTEM: Orientation",description:"Orientation of current device main screen",type:"string",value:"landspace"},touchAvailable:{id:i("1fe7555f-df41-43ce-a268-3ea1b5efda6d"),title:"SYSTEM: Touch Available",description:"Is touch available of current device main screen?",type:"bool",value:!0},soundAvailable:{id:i("bf839498-f7d6-4212-ac3a-b409e3ad77a5"),title:"SYSTEM: Sound Available",description:"Is sound available of current device?",type:"bool",value:!0},cameraAvailable:{id:i("4878f3c2-8bb8-4c94-855c-06bda5a287d5"),title:"SYSTEM: Camera Available",description:"Is camera available of current device?",type:"bool",value:!0},audioInputAvailable:{id:i("4854b259-96c1-40d7-b17b-47156b4698dc"),title:"SYSTEM: Audio Input Available",description:"Is audio input available of current device?",type:"bool",value:!1},networkType:{id:i("1cbb1756-e53c-45a9-be23-5d84a214e144"),title:"SYSTEM: Network Type",description:"Network Type of current device",type:"string",value:"wifi"},networkConnected:{id:i("687b62fe-ead5-417a-b415-9bd5233784a4"),title:"SYSTEM: Network Connected",description:"Is Network connected of current device?",type:"bool",value:!0},networkIpAddress:{id:i("41971ba7-8294-4aa6-a425-ecd39853c3e6"),title:"SYSTEM: Network IP Address",description:"Current network IP address",type:"string",value:""},networkDetails:{id:i("9351fbfc-4ace-477a-b05d-41ac9b05087d"),title:"SYSTEM: Network Details",description:"Network details, provide different data depends on Network Type",type:"object",value:null},isInternetReachable:{id:i("e367ae7e-46ec-46d0-b87d-51e544591ff9"),title:"SYSTEM: Internet Reachable",description:"Is Internet reachable?",type:"bool",value:!0},isWifiEnabled:{id:i("be395305-fb85-4d05-8506-22a4ae8c7b9e"),title:"SYSTEM: Wifi Enabled",description:"Is WiFi enabled?",type:"bool",value:!0},deviceDisplayName:{id:i("76356a9a-fc46-11ec-9905-db53d6811cb7"),title:"SYSTEM: Device Display Name",description:"Current device display name",type:"string",value:""},workspaceName:{id:i("d857125e-0401-40f1-b768-56190aa8e147"),title:"SYSTEM: Workspace Name",description:"Current workspace name",type:"string",value:""},applicationInfo:{id:i("935d3322-84aa-4465-b1e7-241d1f024267"),title:"SYSTEM: Application Info",description:"Current application info",type:"object",value:{}},applicationName:{id:i("df395fd6-a754-4b60-8bac-1360933e6707"),title:"SYSTEM: Application Name",description:"Current application name",type:"string",value:""},deviceID:{id:i("8b5c2d9e-f0a1-4b2c-8d3e-4f5a6b7c8d9e"),title:"SYSTEM: Device ID",description:"Device ID of current device",type:"string",value:"unknown"},macAddress:{id:i("f01fcc78-0723-11ed-ac00-877339de1030"),title:"SYSTEM: MAC Address",description:"Network adapter MAC address of current device",type:"string",value:""},bindDeviceCode:{id:i("1ca90262-3584-11ed-8c9a-174949844872"),title:"SYSTEM: Bind Device Code",description:"The passcode to bind the device",type:"string",value:"",hide:!0},bindDeviceCodeExpire:{id:i("5b52d204-3584-11ed-bb5e-abb4d270daf1"),title:"SYSTEM: Bind Device Code Expire Time",description:"The expire time of bind passcode",type:"string",value:"",hide:!0},bindDeviceUrl:{id:i("833a7db2-3584-11ed-88dd-3b3d3ff58855"),title:"SYSTEM: Bind Device URL",description:"The URL to bind the device",type:"string",value:"",hide:!0},bindDeviceUseApplication:{id:i("631bbce8-9c90-4590-b8ec-8b27f4a0e50b"),title:"SYSTEM: Selected Application on Bind Device",description:"Current selected use application info on Bind Device",type:"object",value:null,hide:!0},isApplicationPreview:{id:i("c673967a-3996-11ed-96d9-efbc3f7eac53"),title:"SYSTEM: Is Preview Mode",description:"Is current in preview mode?",type:"bool",value:"",hide:!0},isSupportAuthInDevice:{id:i("beb2a666-3e18-11ed-bdab-6f0cb082fa67"),title:"SYSTEM: Is Support Auth In Device",description:"Is current device support auth in device?",type:"bool",value:"",hide:!0},env:{id:i("74e7a574-1099-4fe5-b193-8a9ea7d20ed0"),title:"SYSTEM: Environment Variables",description:"Environment Variables of the device",type:"object",value:{}},isViewDebugModeEnabled:{id:i("3f61c4f6-1e02-492e-8e4c-a8dc4a5bc101"),title:"SYSTEM: Is View Debug mode Enabled",description:"Is View Debug mode enabled?",type:"bool",value:!1},language:{id:i("f0ed0a03-6195-459f-9ffe-bca61923f94e"),title:"SYSTEM: Language",description:"Language of the device",type:"string",value:""},aiFilters:{id:i("3ffc1e98-8f65-4cc8-a949-3da8d2092ccb"),title:"SYSTEM: AI Filters",description:"AI filters configuration from the application",type:"array",value:[]},systemOpenAIApiKey:{id:i("a1b2c3d4-5e6f-7890-abcd-ef1234567890"),title:"SYSTEM: OpenAI API Key",description:"System OpenAI API Key (only available if application enabled)",type:"string",value:""},systemAnthropicApiKey:{id:i("b2c3d4e5-6f78-9012-bcde-f23456789012"),title:"SYSTEM: Anthropic API Key",description:"System Anthropic API Key (only available if application enabled)",type:"string",value:""},systemGeminiApiKey:{id:i("c3d4e5f6-7890-1234-cdef-345678901234"),title:"SYSTEM: Gemini API Key",description:"System Gemini API Key (only available if application enabled)",type:"string",value:""},ggmlBackendDevices:{id:i("9e8f7a6b-5c4d-3e2f-1a0b-9c8d7e6f5a4b"),title:"SYSTEM: GGML Backend Devices",description:"Available GGML backend devices with supported generators",type:"array",schema:{type:"object",allowNewItem:!1,allowCustomProperty:!1},value:[]}};t.idMap=Object.entries(a).reduce((e,[t,i])=>(e[t]=i.id,e),{}),Object.fromEntries(Object.entries(t.idMap).map(([e,t])=>[t,e])),t.MI=Object.entries(a).reduce((e,[t,i])=>{let{id:a,...r}=i;return e[t]=r,e},{}),Object.keys(t.MI)},18501(e,t,i){let{docs:a}=i(5867);t.isCommand=e=>!!(e&&e.type&&e.type.startsWith("command-node-")),t.getPorts=e=>e?Array.isArray(e)?e:[e]:[],t.getCommandCallbackFromPort=(e,i)=>{let r=e[i];if(!t.isCommand(r))return null;let n=a[r.type.replace("command-node-","")]?.commands?.[r.properties?.command];return n?.iterateeFrom||n?.invocationFrom||null},t.checkDisableTriggerCommand=(e,i)=>t.getPorts(e[i.id]?.in?.[i.port]).some(e=>e?.disable_trigger_command),t.findCircularReferenceIds=e=>{let i,a=(i=new Map,Object.keys(e).reduce((a,r)=>{let n=[];return Object.values(e[r]?.out||{}).forEach(a=>{t.getPorts(a).forEach(a=>{((e,i,a)=>{var r;return!!i&&!!e[i.id]&&!(i.port===(r=i.id,a.has(r)||a.set(r,t.getCommandCallbackFromPort(e,r)),a.get(r))||t.checkDisableTriggerCommand(e,i))})(e,a,i)&&n.push(a.id)})}),a[r]=n,a},{})),r=new Map;return Object.keys(e).filter(t=>e[t]?.type==="data-node").filter(e=>((e,t,i)=>{if(i.has(e))return i.get(e);let a=[{id:e,edgeIndex:0,reachesCycle:!1}],r=new Set([e]);for(;a.length>0;){let e=a[a.length-1],n=t[e.id]||[];if(e.reachesCycle||e.edgeIndex>=n.length){r.delete(e.id),i.set(e.id,e.reachesCycle),a.pop(),e.reachesCycle&&a.length>0&&(a[a.length-1].reachesCycle=!0);continue}let o=n[e.edgeIndex];if(e.edgeIndex+=1,i.has(o)){i.get(o)&&(e.reachesCycle=!0);continue}if(r.has(o)){e.reachesCycle=!0;continue}r.add(o),a.push({id:o,edgeIndex:0,reachesCycle:!1})}return i.get(e)||!1})(e,a,r))},t.hasCircularReference=e=>t.findCircularReferenceIds(e).length>0;let r=(e={})=>Object.entries(e).reduce((e,[t,i])=>(e[t]=Array.isArray(i)?i.slice():i,e),{}),n=new WeakSet,o=(e,t,i)=>{if(!i)return;let a=((e,t)=>{let i=e[t];if(!i)return e[t]=[],e[t];if(!Array.isArray(i))return e[t]=[i],e[t];if(!n.has(i)){let e=0;for(let t of i)t&&(i[e]=t,e+=1);i.length=e,n.add(i)}return i})(e,t);(Array.isArray(i)?i:[i]).forEach(e=>{e&&a.push(e)})};t.getCalcMap=e=>e?.script_map||e?.scriptMap||e?.map||{},t.composeMap=e=>Object.values(e).reduce((e,i)=>Object.entries(t.getCalcMap(i)).reduce((e,[i,a])=>{if(e[i]){if(t.isCommand(a))throw Error(`Doesn't allow same command id in another map, ${i}`);let r=e[i];Object.keys(a?.in||{}).forEach(e=>{o(r.in,e,a.in[e])}),Object.keys(a?.out||{}).forEach(e=>{o(r.out,e,a.out[e])})}else e[i]={...a,in:r(a?.in),out:r(a?.out)};return e},e),{})},86343(e,t,i){let{v4:a}=i(45620),r=i(95479),n=i(56005),{nameMap:o,brickMapping:s,generatorMapping:c}=i(63981);t.idByItem=(e={})=>e.canvas_id||e.subspace_id||e.brick_id||e.generator_id||e.property_bank_id||e.property_bank_calc_id||e.bank_id||e.scene_id,t.getAnimationType=e=>e.type||e.compose_type||e.composeType,t.cleanUpAnimationMap=e=>Object.entries(e).reduce((e,[t,i])=>((i.type||i.compose_type)&&(e[t]=i),e),{}),t.matchItemByItem=(e,t)=>{let i;if(!e)return!1;switch("string"==typeof t&&(i=t),e.type){case"brick":return e.brick_id===(i||t.brick_id);case"subspace":return e.subspace_id===(i||t.subspace_id);case"canvas":return e.canvas_id===(i||t.canvas_id);case"generator":return e.generator_id===(i||t.generator_id);case"property_bank":return e.property_bank_id===(i||t.property_bank_id);default:return!1}},t.makePasscode=()=>a(),t.kindOneOfTypes={string:["color","datetime","id","graphql","rich-text-content","sandbox-script","llm-prompt","media-resource-image","media-resource-video","media-resource-audio","media-resource-file","lottie-file-uri","rive-file-uri","ggml-model-asset","gguf-model-asset","mlx-model-asset","binary-asset","scene3d-objects"],number:["unit"],object:["tts-speaker-config"],"array-object":["llm-tools","llm-messages","mcp-server-resources","mcp-server-tools","mcp-server-prompts"]},t.getKindOneOfTypes=(e,i)=>"array"===e?"object"===i?t.kindOneOfTypes[`${e}-${i}`]:void 0:t.kindOneOfTypes[e],t.unitOneOfTypes=["grid","px","ms"],t.idOneOfTypes=["canvas","brick","generator","animation","property_bank"],t.typeToName={brick:"Brick",generator:"Generator",subspace:"Subspace",canvas:"Canvas",animation:"Animation",property_bank:"Data",property_bank_calc:"Calculation"},t.getBrickName=(e,i,a)=>{let n;if(!i)return e.toUpperCase();if(i.title)return i.title;switch(e){case"bank":n="BANK";break;case"subspace":n="SUBSPACE";break;case"canvas":n="CANVAS";break;case"animation":n=`<${r(t.getAnimationType(i))}>`;break;case"property_bank":n="<Data>";break;case"property_bank_calc":n="<Map>";break;case"state_group":n="<Switch Case>";break;default:n=`<${o[i.template_key||i.templateKey]||"Unknown"}>`}return a&&a.length>10?n+=` (${a.replace(/[A-Z_]+/g,"").substr(0,6)}...)`:a&&(n+=` (${a})`),n},t.getEventLabel=(e,{templateKey:t,itemType:i}={})=>{if(!e)return"";let a=e;return"subspace"===i?a=e.replace("SUBSPACE_ACTION_",""):t&&(a=e.replace(`${t}_`,"").replace("CANVAS_","")),r(n(r(a)))},t.getCallInternalActions=e=>{let t=s[e]||c[e];if(t)return t.callInternalActions},t.mapToList=(e,i)=>Object.entries(i).reduce((i,[a,r])=>(i.push({id:a,...r,title:t.getBrickName(e,r,a)}),i),[]);let d={subspaceMap:"subspace",brickMap:"brick",generatorMap:"generator",propertyBankMap:"property_bank",propertyAvailableToAdd:"property_bank",canvasMap:"canvas",animationMap:"animation"},l={};t.mapToListForDerivedState=(e,i,a,r)=>{let n=a[e]||l;return n!==r[e]?{[e]:n,[i]:t.mapToList(d[e],n)}:{}},t.arrayTypePrefix="array of ",t.propertyBankTypes=["string","number","bool","object","any",`${t.arrayTypePrefix}string`,`${t.arrayTypePrefix}number`,`${t.arrayTypePrefix}bool`,`${t.arrayTypePrefix}object`],t.animationRunTypes=["once","loop"],t.stopPropagationOnKeyBackspace=e=>{8===e.keyCode&&e.stopPropagation()},t.nestedTypes=["object","array","any"],t.isPropertyBankTypeNested=e=>t.nestedTypes.includes(e),t.propertyTypeToSchema=e=>{let i=e.indexOf(t.arrayTypePrefix)>-1,a=e.replace(t.arrayTypePrefix,"");return{type:a,properties:"object"===a?{}:void 0,allowNewItem:i,allowCustomProperty:"object"===a}}},33770(e,t,i){let{idMap:a}=i(66422),{forEachEventAction:r,getActionParam:n}=i(78078),o="PROPERTY_BANK_DATA_NODE_",s=new Set(Object.values(a||{}).filter(e=>"string"==typeof e&&e.startsWith(o)));e.exports=function(e){let t,i,a=[],c=(t=new Set(s),Object.values(e.subspace_map||{}).forEach(e=>{e&&"object"==typeof e&&Object.keys(e.property_bank_map||{}).forEach(e=>t.add(e))}),t),d=(i=new Set,Object.values(e.subspace_map||{}).forEach(e=>{e&&"object"==typeof e&&Object.keys(e.canvas_map||{}).forEach(e=>i.add(e))}),i);return r(e,(e,t)=>{if("PROPERTY_BANK_EXPRESSION"===e.action){let i;Array.isArray(i=n(e,"VARIABLES"))&&i.forEach((e,i)=>{let r=e?.id;if("string"!=typeof r||!r.startsWith(o)||c.has(r))return;let n=e.key?`\`${e.key}\``:`at index ${i}`;a.push({field:`${t}.VARIABLES[${i}].id`,message:`PROPERTY_BANK_EXPRESSION variable ${n} references data node \`${r}\`, which is not defined in any subspace.`})})}else"CHANGE_CANVAS"===e.action&&((e,t,i,a)=>{if("SYSTEM"!==e.handler)return;let r=n(e,"CANVAS_ID");"string"!=typeof r||!r||r.startsWith("PROPERTY_BANK#")||r.startsWith("VARIABLE#")||!r.startsWith("CANVAS_")||i.has(r)||a.push({field:`${t}.CANVAS_ID`,message:`CHANGE_CANVAS references canvas \`${r}\`, which is not defined in any subspace.`})})(e,t,d,a)}),a}},37517(e,t,i){let{composeMap:a,findCircularReferenceIds:r}=i(18501);e.exports=function(e){let t=[];return Object.entries(e.subspace_map||{}).forEach(([e,i])=>{if(i.module?.link)return;let n=i.property_bank_calc_map;if(!n||0===Object.keys(n).length)return;let o=`subspace_map.${e}.property_bank_calc_map`;try{let e=a(n),i=r(e);if(i.length>0){let a=i.slice(0,5).map(t=>e[t].title||t),r=i.length>5?` and ${i.length-5} more`:"";t.push({field:o,message:`Circular reference detected in data calculation. Affected nodes: ${a.join(", ")}${r}. Please check the data connections for loops.`})}}catch(e){t.push({field:o,message:e.message})}}),t}},41900(e){e.exports={expressionFoldAcornOptions:{ecmaVersion:2022,allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0},getUnfoldableStatementDescription:(e,t=null)=>{for(let t=0;t<e.length;t+=1){let i=e[t];if("ExpressionStatement"===i.type){let{expression:e}=i;if("AssignmentExpression"===e.type&&"Identifier"!==e.left.type)return"an assignment to a member or computed target";continue}if("VariableDeclaration"===i.type){if(i.declarations.some(e=>"Identifier"!==e.id.type||!e.init))return"a variable declaration with destructuring or no initializer";continue}if(t!==e.length-1||"ReturnStatement"!==i.type)return`an unsupported ${i.type}`}return t}}},78078(e,t,i){let{parse:a}=i(89236),{expressionFoldAcornOptions:r}=i(41900),n=(e,t)=>{let i=e.parameter_list||e.parameterList||[];if(!Array.isArray(i))return;let a=i.find(e=>(e?.input_to_receiver||e?.inputToReceiver)===t);return a?a.result_from_sender??a.resultFromSender:void 0},o=(e,t,i)=>{if(e&&"object"==typeof e){if(Array.isArray(e))return void e.forEach((e,a)=>o(e,`${t}[${a}]`,i));Object.entries(e).forEach(([e,a])=>{("event_map"===e||"eventMap"===e)&&a&&"object"==typeof a?Object.entries(a).forEach(([a,r])=>{Array.isArray(r)&&r.forEach((r,n)=>{r&&"object"==typeof r&&i(r,`${t}.${e}.${a}[${n}]`)})}):a&&"object"==typeof a&&o(a,`${t}.${e}`,i)})}},s=(e,t)=>{Object.entries(e.subspace_map||{}).forEach(([e,i])=>{!i||"object"!=typeof i||i.module?.link||o(i,`subspace_map.${e}`,t)})};e.exports=function(e){let t=[];return s(e,(e,i)=>{if("PROPERTY_BANK_EXPRESSION"!==e.action)return;let o=n(e,"EXPRESSION");if("string"!=typeof o||o.startsWith("PROPERTY_BANK#"))return;let s=(e=>{if(!e.trim())return"Expression is empty";try{a(e,r)}catch(e){return`Expression does not parse: ${e.message}`}return null})(o);s&&t.push({field:i,message:s})}),t},e.exports.forEachEventAction=s,e.exports.getActionParam=n},38890(e,t,i){let{getDocByTemplateKey:a}=i(63981),r=i(80211),n=i(45907),o=i(37517),s=i(78078),c=i(33770),{lintConfig:d,lintRuleCodes:l}=i(9098),{getBrickName:p}=i(86343);t.lintConfig=d,t.lintRuleCodes=l;let u=(e,t,i,a)=>({id:e,name:"Used Deprecated Feature",data:`The \`${p("brick",t,e)}\` brick in \`${p("subspace",i,a)}\` have been deprecated, it may not work in the future, please consider to remove it. If you can't see the item, please enable \`Show Deprecated Features\` in setting.`});t.checkConfigDeprecatedFeatures=e=>{let t=[];return Object.entries(e.subspace_map||{}).forEach(([e,i])=>{Object.entries(i.brick_map||{}).forEach(([r,n])=>{(void 0!==n.property?.borderLeftWidth||void 0!==n.property?.borderRightWidth||void 0!==n.property?.borderTopWidth||void 0!==n.property?.borderBottomWidth)&&t.push({id:r,name:"Used Deprecated Feature",data:`In v2.16, we have been changed \`Border Width\` to \`Border Size\` (Unit \`px\` to \`grid\`). The \`${p("brick",n,r)}\` brick still used the border width. Please re-edit it to transfer to the new unit.`});let o=a(n.template_key);o?.brickMeta?.deprecated&&t.push(u(r,n,i,e))}),Object.entries(i.generator_map||{}).forEach(([r,n])=>{let o=a(n.template_key);o?.brickMeta?.deprecated&&t.push(u(r,n,i,e))})}),t},t.checkConfig=(e,t={})=>{let i={schema:r(e),ref:n(e,t),calc:t.checkCalc?o(e):[],expression:t.checkExpressions?s(e):[],actionRef:t.checkActionRefs?c(e):[]};return i.valid=0===i.schema.length&&0===i.ref.length&&0===i.calc.length&&0===i.expression.length&&0===i.actionRef.length,i.message=i.schema.concat(i.ref).concat(i.calc).concat(i.expression).concat(i.actionRef).map(({instancePath:e,field:t,message:i})=>{let a=e||t;return a?`${a}: ${i}`:i}).join("\n"),i}},27899(e){let t=["x","y","width","height"],i=e=>"string"==typeof e&&e.startsWith("PROPERTY_BANK_"),a=/PROPERTY_BANK#(PROPERTY_BANK_[A-Za-z0-9_-]+)/g,r=/(?:BRICK|ANIMATION|SUBSPACE)_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g,n=(e,t=new Set)=>{if("string"==typeof e){let i;for(a.lastIndex=0;i=a.exec(e);)t.add(i[1])}else Array.isArray(e)?e.forEach(e=>n(e,t)):e&&"object"==typeof e&&(i(e.id)&&t.add(e.id),Object.values(e).forEach(e=>n(e,t)));return t},o=(e,t)=>{if("string"==typeof e){let i;for(r.lastIndex=0;i=r.exec(e);)t.add(i[0])}else Array.isArray(e)?e.forEach(e=>o(e,t)):e&&"object"==typeof e&&Object.values(e).forEach(e=>o(e,t));return t},s=(e,t)=>{Object.entries(e.subspace_map||{}).forEach(([e,i])=>{!i||"object"!=typeof i||i.module?.link||t(e,i)})},c=(e,t)=>{s(e,(e,i)=>{Object.entries(i.canvas_map||{}).forEach(([a,r])=>{let n=Array.isArray(r?.item_list)?r.item_list:[];t({subspaceId:e,subspace:i,canvasId:a,canvas:r,items:n})})})},d=[["brick_map","brick"],["generator_map","generator"],["property_bank_map","property_bank"],["canvas_map","canvas"]],l=(e,t,i)=>{d.forEach(([a,r])=>{Object.entries(t[a]||{}).forEach(([t,n])=>{Object.entries(n?.event_map||{}).forEach(([n,o])=>{Array.isArray(o)&&i({ownerType:r,ownerId:t,eventKey:n,list:o,path:`subspace_map.${e}.${a}.${t}.event_map.${n}`})})})})},p=(e,t)=>(e.parameter_list||[]).find(e=>e?.input_to_receiver===t)?.result_from_sender;e.exports={FRAME_KEYS:t,isBankNodeId:i,collectBankReads:n,forEachSubspace:s,forEachCanvas:c,forEachCanvasItem:(e,t)=>{c(e,e=>{e.items.forEach((i,a)=>{t({...e,item:i,index:a})})})},forEachEventList:l,getParamValue:p,hasParamValue:(e,t)=>{let i=p(e,t);return null!=i&&""!==i},collectDynamicallyReferencedIds:e=>{let t=new Set;return s(e,(e,i)=>{l(e,i,({list:e})=>{e.forEach(e=>o(e?.parameter_list,t))})}),o(e.automation_map,t),o(e.test_map,t),t},frameIsNumeric:e=>!!e&&t.every(t=>"number"==typeof e[t]),framesAlmostEqual:(e,i,a=.01)=>t.every(t=>Math.abs(e[t]-i[t])<=a),frameContains:(e,t,i=.01)=>e.x<=t.x+i&&e.y<=t.y+i&&e.x+e.width>=t.x+t.width-i&&e.y+e.height>=t.y+t.height-i,framesIntersect:(e,t)=>!(e.x+e.width<=t.x||t.x+t.width<=e.x||e.y+e.height<=t.y||t.y+t.height<=e.y),getItemId:e=>e?.brick_id||e?.subspace_id||null,itemHasAnimations:e=>!!e?.animations&&Object.keys(e.animations).length>0}},9098(e,t,i){let{collectDynamicallyReferencedIds:a}=i(27899),r=[i(98632),i(84223),i(92260),i(96810),i(60760),i(40566),i(31172),i(59707),i(39425)],n=r.map(e=>e.code),o=e=>Array.isArray(e)?e:"string"==typeof e&&e?e.split(",").map(e=>e.trim()).filter(Boolean):null;e.exports={lintConfig:(e,t={})=>{let i,s=o(t.only),c=o(t.ignore),d=[...s||[],...c||[]].filter(e=>!n.includes(e));if(d.length>0)throw Error(`Unknown lint rule code(s): ${d.join(", ")}. Valid codes: ${n.join(", ")}`);if(!e||"object"!=typeof e)return[];let l=r.filter(e=>(!s||s.includes(e.code))&&(!c||!c.includes(e.code)));if(0===l.length)return[];let p={configType:"module"===t.configType?"module":"app",gridStep:"number"==typeof t.gridStep&&t.gridStep>0?t.gridStep:.5,get dynamicRefIds(){return i||(i=a(e)),i}},u=[];return l.forEach(t=>{try{t.check(e,p,e=>u.push({severity:t.severity,code:t.code,path:"",subspaceId:null,itemId:null,hint:null,...e}))}catch(e){u.push({severity:"warning",code:t.code,path:"",subspaceId:null,itemId:null,message:`Lint rule crashed: ${e.message}`,hint:null})}}),u},lintRuleCodes:n}},98632(e,t,i){let{composeMap:a}=i(18501),{forEachSubspace:r,forEachEventList:n,collectBankReads:o,isBankNodeId:s,getParamValue:c}=i(27899),d=(e,t)=>t.map(t=>c(e,t)).filter(s),l={PROPERTY_BANK:{waitable:!0,targets:e=>(e.parameter_list||[]).map(e=>e?.input_to_receiver).filter(s)},PROPERTY_BANK_EXPRESSION:{waitable:!0,targets:e=>d(e,["RESULT","ERROR_RESULT"])},PROPERTY_BANK_COMMAND:{waitable:!0,targets:(e,t)=>((e,t)=>{let i=t();if(!i)return[];let a=[],r=new Set,n=(e.parameter_list||[]).map(e=>e?.input_to_receiver).filter(s);for(let e=0;e<n.length;e+=1){let t=n[e];if(r.has(t))continue;r.add(t);let o=i[t];o&&Object.values(o.out||{}).forEach(e=>{(e||[]).forEach(e=>{e?.id&&(e.id.includes("DATA_NODE")&&a.push(e.id),n.push(e.id))})})}return a})(e,t)},STORAGE_RETRIEVE:{waitable:!0,targets:e=>d(e,["STORAGE_RETRIEVE_RESULT"])},OPEN_FILE:{waitable:!0,targets:e=>d(e,["SAVE_PROPERTY","SAVE_DETAIL_PROPERTY","ERROR_SAVE_PROPERTY"])},SAVE_UPDATE_SNAPSHOT:{waitable:!0,targets:e=>d(e,["SNAPSHOT_SAVE_RESULT","SNAPSHOT_ERROR_RESULT"])},TRIGGER_APPLICATION_FILTER:{waitable:!0,targets:e=>d(e,["RESULT","ERROR_RESULT"])},TAKE_SCREENSHOT:{waitable:!1,targets:e=>d(e,["TAKE_SCREENSHOT_SAVE_PROPERTY"])}},p=/(^|_)RESULT$|_SAVE_PROPERTY$/;e.exports={code:"data-update-race",severity:"warning",description:"A data node is written without wait_async and read by a later action in the same event",check(e,t,i){r(e,(e,t)=>{let r,c=()=>{if(void 0===r)try{r=a(t.property_bank_calc_map||{})}catch{r=null}return r};n(e,t,({path:t,list:a})=>{let r=new Map;a.forEach((a,n)=>{if(!a||"object"!=typeof a)return;if("SYSTEM"===a.handler&&"DELAY"===a.action)return void r.clear();let d=new Set;(a.parameter_list||[]).forEach(e=>o(e?.result_from_sender,d)),d.forEach(o=>{let s=r.get(o);s&&(i({path:`${t}.${n}`,subspaceId:e,itemId:o,message:`\`${o}\` is written by action #${s.index} (${s.action}) without waiting, then read by action #${n} (${a.action}) — the read can still see the previous value.`,hint:s.waitable?`Set \`wait_async: true\` on action #${s.index} (${s.action}).`:`${s.action} ignores \`wait_async\` for its data write — insert a SYSTEM DELAY action between the two, or move the read into the data node's value-change event.`}),r.delete(o))});let u=((e,t)=>{if("SYSTEM"===e.handler){let i=l[e.action];if(!i)return null;let a=i.targets(e,t);return a.length>0?{targets:a,waitable:i.waitable}:null}let i=(e.parameter_list||[]).filter(e=>"string"==typeof e?.input_to_receiver&&p.test(e.input_to_receiver)&&s(e.result_from_sender)).map(e=>e.result_from_sender);return i.length>0?{targets:i,waitable:!0}:null})(a,c);if(!u)return;let f=!0===a.wait_async&&u.waitable;u.targets.forEach(e=>{f?r.delete(e):r.set(e,{index:n,action:a.action,waitable:u.waitable})})})})})}}},39425(e,t,i){let{forEachSubspace:a,forEachEventList:r,getParamValue:n}=i(27899),o=new Set(["Math","Date","Object","Array","Number","String","Boolean","JSON","RegExp","Intl","isNaN","isFinite","parseInt","parseFloat","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI"]);e.exports={code:"expression-global-variable",severity:"error",description:"A PROPERTY_BANK_EXPRESSION variable is named after a JS global and is silently ignored at runtime",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{if(a?.handler!=="SYSTEM"||"PROPERTY_BANK_EXPRESSION"!==a.action)return;let s=n(a,"VARIABLES");Array.isArray(s)&&s.forEach(a=>{let n=a?.key;"string"==typeof n&&o.has(n)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,message:`Expression variable "${n}" is named after the JS global \`${n}\` and is silently ignored — the global takes precedence in the expression scope, so the bound value is never used.`,hint:`Rename the variable (e.g. "${n}Value") so the expression reads the bound value.`})})})})})}}},40566(e,t,i){let{forEachSubspace:a,forEachEventList:r,hasParamValue:n}=i(27899),o=[{action:"STORAGE_RETRIEVE",severity:"error",isMissing:e=>!n(e,"STORAGE_RETRIEVE_RESULT"),message:"STORAGE_RETRIEVE requires a STORAGE_RETRIEVE_RESULT parameter — without it the action throws at runtime.",hint:"Add a STORAGE_RETRIEVE_RESULT parameter pointing at a data node."},{action:"TAKE_SCREENSHOT",severity:"warning",isMissing:e=>!n(e,"TAKE_SCREENSHOT_SAVE_PROPERTY"),message:"TAKE_SCREENSHOT without TAKE_SCREENSHOT_SAVE_PROPERTY is silently skipped at runtime.",hint:"Add a TAKE_SCREENSHOT_SAVE_PROPERTY parameter pointing at a data node."},{action:"OPEN_FILE",severity:"warning",isMissing:e=>!n(e,"SAVE_PROPERTY")&&!n(e,"SAVE_DETAIL_PROPERTY"),message:"OPEN_FILE has no SAVE_PROPERTY / SAVE_DETAIL_PROPERTY — the picked file is discarded.",hint:"Add SAVE_PROPERTY (file uri) or SAVE_DETAIL_PROPERTY (file detail) parameters."},{action:"OPEN_URL",severity:"warning",isMissing:e=>!n(e,"URL"),message:"OPEN_URL has no URL parameter — the action does nothing.",hint:"Add a URL parameter."}];e.exports={code:"missing-result-param",severity:"warning",description:"An action is missing the parameter that receives or drives its effect",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{if(a?.handler!=="SYSTEM")return;let n=o.find(e=>e.action===a.action);n&&n.isMissing(a)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,severity:n.severity,message:n.message,hint:n.hint})})})})}}},92260(e,t,i){let{forEachCanvasItem:a,frameIsNumeric:r,getItemId:n,FRAME_KEYS:o}=i(27899),s=["width","height"];e.exports={code:"off-grid-frame",severity:"warning",description:"Frame values should be multiples of the 0.5 grid step",check(e,t,i){let c=t.gridStep;a(e,({subspaceId:e,canvasId:t,item:a,index:d})=>{let l=a?.frame;if(!r(l))return;let p=o.filter(e=>{let t=l[e];return(!s.includes(e)||!(t<=c))&&Math.abs(t-Math.round(t/c)*c)>.001});0!==p.length&&i({path:`subspace_map.${e}.canvas_map.${t}.item_list.${d}.frame`,subspaceId:e,itemId:n(a),message:`Frame ${p.map(e=>`${e}=${l[e]}`).join(", ")} ${1===p.length?"is":"are"} not aligned to the ${c} grid step.`,hint:`Round frame values to multiples of ${c}.`})})}}},96810(e,t,i){let{forEachCanvasItem:a,frameIsNumeric:r,getItemId:n,itemHasAnimations:o}=i(27899);e.exports={code:"out-of-bounds-frame",severity:"warning",description:"An element is fully outside the subspace layout or has a non-positive size",check(e,t,i){a(e,({subspaceId:a,subspace:s,canvasId:c,item:d,index:l})=>{let p=s.layout;if("number"!=typeof p?.width||"number"!=typeof p?.height||p.width<=0||p.height<=0)return;let u=d?.frame;if(!r(u)||!0===u.exceed_boundary||u.standby_frame||o(d))return;let f=n(d);if(f&&t.dynamicRefIds.has(f))return;let b=`subspace_map.${a}.canvas_map.${c}.item_list.${l}.frame`;if(u.width<=0||u.height<=0)return void i({path:b,subspaceId:a,itemId:f,message:`Frame has a non-positive size (width=${u.width}, height=${u.height}) — the element renders nothing.`,hint:"Give the element a positive size, or remove it if unused."});let h=a===e.root_subspace_id,m=u.x>=p.width||u.x+u.width<=0,y=u.y>=p.height||u.y+u.height<=0;(m||!h&&y)&&i({path:b,subspaceId:a,itemId:f,message:`Frame (x=${u.x}, y=${u.y}, width=${u.width}, height=${u.height}) is fully outside the ${p.width}\xd7${p.height} layout — nothing is visible.`,hint:"Move the element back into the layout, or set `exceed_boundary` if the placement is intentional."})})}}},84223(e,t,i){let{FRAME_KEYS:a,forEachCanvas:r,frameIsNumeric:n,framesAlmostEqual:o,framesIntersect:s,itemHasAnimations:c}=i(27899),d=new Set(["BRICK_TEXT","BRICK_RICH_TEXT"]),l=["linearGradientEnabled","blurEnabled"],p=e=>Object.values(e?.event_map||{}).some(e=>Array.isArray(e)&&e.length>0),u=/^backgroundColor$|^border/,f=(e,t)=>{if(e?.type!=="brick")return null;let i=t[e.brick_id];return d.has(i?.template_key)?i:null},b=e=>a.map(t=>Math.floor(e[t]/.01)),h=e=>e.join(":"),m=(e,t,i,a)=>{if(!n(t?.frame)||!f(t,i))return;let r=h(b(t.frame)),o=(e.get(r)||0)+a;o>0?e.set(r,o):e.delete(r)};e.exports={code:"redundant-rect-overlay",severity:"info",description:"A plain Rect behind a same-frame Text/RichText can be folded into the text brick",check(e,t,i){r(e,({subspaceId:e,subspace:a,canvasId:r,items:d})=>{let y,E=a.brick_map||{},_=(y=new Map,d.forEach(e=>m(y,e,E,1)),y);d.forEach((a,y)=>{if(m(_,a,E,-1),a?.type!=="brick"||!n(a.frame))return;let g=E[a.brick_id];if(g?.template_key!=="BRICK_RECT"||c(a)||t.dynamicRefIds.has(a.brick_id))return;let S={...g.property,...a.property};if(l.some(e=>S[e])||!((e,t)=>{let[i,a,r,n]=b(t);for(let t=-1;t<=1;t+=1)for(let o=-1;o<=1;o+=1)for(let s=-1;s<=1;s+=1)for(let c=-1;c<=1;c+=1)if(e.has(h([i+t,a+o,r+s,n+c])))return!0;return!1})(_,a.frame))return;let v=p(g);for(let t=y+1;t<d.length;t+=1){let c=d[t];if(!n(c?.frame))continue;let l=f(c,E);if(l&&o(a.frame,c.frame,.01)){let t={...l.property,...c.property};if(Object.keys(t).some(e=>u.test(e)&&void 0!==t[e])||v&&p(l))return;i({path:`subspace_map.${e}.canvas_map.${r}.item_list.${y}`,subspaceId:e,itemId:a.brick_id,message:`Rect \`${g.title||a.brick_id}\` has the same frame as the ${l.template_key} above it and only uses base styles`+(v?", behind its press handler.":"."),hint:v?"Make the Text brick pressable, move backgroundColor / border / radius and the press handler onto it, then remove the Rect.":"Set backgroundColor / border / radius directly on the text brick and remove the Rect."});return}if(s(a.frame,c.frame))return}})})}}},31172(e,t,i){let{autoGeneratedItemIdKind:a}=i(99470),{forEachSubspace:r}=i(27899),n="PROPERTY_BANK_",o=()=>({children:Object.create(null),ids:null}),s=(e,t)=>{let i=e;for(let e of t)i.children[e]||(i.children[e]=o()),i=i.children[e];i.ids||(i.ids=[]),i.ids.push(t)},c=(e,t,i,a)=>{let r=i.children[e[a]];if(r){r.ids&&r.ids.forEach(e=>{t.set(e,t.get(e)+1)});for(let i=a+1;i<e.length&&(r=r.children[e[i]]);i+=1)r.ids&&r.ids.forEach(e=>{t.set(e,t.get(e)+1)})}};e.exports={code:"unused-data-node",severity:"info",description:"A data node is defined but never referenced anywhere in the config",check(e,t,i){let d=JSON.stringify(e),l=[];r(e,(i,r)=>{("module"!==t.configType||i!==e.root_subspace_id)&&Object.entries(r.property_bank_map||{}).forEach(([e,t])=>{!(!t||"object"!=typeof t||t.kind===a||t.enable_remote_update||t.global_remote_update_prop||t.linkedFrom||t.alias||t.preload||r.routing?.[e]?.enabled_routing)&&(Object.values(t?.event_map||{}).some(e=>Array.isArray(e)&&e.length>0)||l.push({subspaceId:i,nodeId:e,node:t}))})});let p=((e,t)=>{let i=[...new Set(t)];if(0===i.length)return new Map;let a=new Map(i.map(e=>[e,0])),r=o(),d=o(),l=!1,p=!1;if(i.forEach(e=>{e.startsWith(n)?(s(r,e),l=!0):(s(d,e),p=!0)}),l){let t=e.indexOf(n);for(;-1!==t;)c(e,a,r,t),t=e.indexOf(n,t+1)}if(p)for(let t=0;t<e.length;t+=1)c(e,a,d,t);return a})(d,l.map(({nodeId:e})=>e));l.forEach(({subspaceId:e,nodeId:t,node:a})=>{(p.get(t)||0)>1||i({path:`subspace_map.${e}.property_bank_map.${t}`,subspaceId:e,itemId:t,message:`Data node \`${a.title||t}\` is never referenced in the config.`,hint:"Remove it, or keep it if external tooling depends on it."})})}}},60760(e,t,i){let{forEachSubspace:a,forEachEventList:r}=i(27899),n=new Set(["MESSAGE","ALERT","POPUP_RESET","TAKE_SCREENSHOT","THROW_EXCEPTION","RESTART_FOUNDATION","DYNAMIC_BRICK","DYNAMIC_BRICK_RESET","DYNAMIC_ANIMATION","DYNAMIC_ANIMATION_RESET","DYNAMIC_ANIMATION_STOP","CHANNEL_SUBSCRIBE","CHANNEL_UNSUBSCRIBE","CHANNEL_PUBLISH","DISMISS_KEYBOARD","STORAGE_SET","STORAGE_DELETE","DELAY","USE_SHARE_APPLICATION","AUTH_IN_DEVICE","REFRESH_BINDCODE","STOP_APPLICATION_FILTER"]);e.exports={code:"wait-async-no-op",severity:"info",description:"wait_async is set on an action that ignores it",check(e,t,i){a(e,(e,t)=>{r(e,t,({path:t,list:a})=>{a.forEach((a,r)=>{a?.handler!=="SYSTEM"||!0!==a.wait_async||n.has(a.action)&&i({path:`${t}.${r}`,subspaceId:e,itemId:null,message:"DELAY"===a.action?"DELAY always waits for its timeout — `wait_async: true` is redundant.":`\`wait_async: true\` has no effect on ${a.action}; the action does not block the chain.`,hint:"DELAY"===a.action?"Remove the redundant flag.":"Remove the flag, or restructure if you relied on it for sequencing."})})})})}}},59707(e,t,i){let{forEachCanvas:a,frameIsNumeric:r,frameContains:n,itemHasAnimations:o}=i(27899);e.exports={code:"z-order-cover",severity:"info",description:"A later opaque element fully covers an earlier pressable element",check(e,t,i){a(e,({subspaceId:e,subspace:a,canvasId:s,items:c})=>{let d=a.brick_map||{},l=[];if(c.forEach((e,t)=>{if(e?.type!=="brick"||!r(e.frame))return;let i=d[e.brick_id];i&&Object.entries(i?.event_map||{}).some(([e,t])=>e.includes("_ON_PRESS")&&Array.isArray(t)&&t.length>0)&&l.push({item:e,index:t,brick:i})}),0===l.length)return;let p=t.dynamicRefIds,u=c.map((e,t)=>((e,t,i,a)=>{let n;if(e?.type!=="brick"||!r(e.frame)||o(e)||a.has(e.brick_id))return null;let s=i[e.brick_id],c={...s?.property,...e.property};return"string"==typeof(n=c.backgroundColor)&&(/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*1(?:\.0+)?\s*\)$/.test(n)||/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(n)||/^#[0-9a-fA-F]{6}$/.test(n))&&(void 0===c.opacity||1===c.opacity)?{index:t,item:e,brick:s,frame:e.frame}:null})(e,t,d,p)).filter(Boolean),f=(e=>{let t=Array(e.length),i=1/0,a=1/0,r=-1/0,n=-1/0,o=-1/0,s=-1/0;for(let c=e.length-1;c>=0;c-=1){let{frame:d}=e[c];i=Math.min(i,d.x),a=Math.min(a,d.y),r=Math.max(r,d.x+d.width),n=Math.max(n,d.y+d.height),o=Math.max(o,d.width),s=Math.max(s,d.height),t[c]={minX:i,minY:a,maxRight:r,maxBottom:n,maxWidth:o,maxHeight:s}}return t})(u),b=0;l.forEach(({item:t,index:a,brick:r})=>{let c,d;if(!(o(t)||p.has(t.brick_id))){for(;b<u.length&&u[b].index<=a;)b+=1;if(c=f[b],d=t.frame,c&&c.minX<=d.x+.01&&c.minY<=d.y+.01&&c.maxRight>=d.x+d.width-.01&&c.maxBottom>=d.y+d.height-.01&&c.maxWidth>=d.width-.02&&c.maxHeight>=d.height-.02)for(let o=b;o<u.length;o+=1){let c=u[o];if(n(c.frame,t.frame))return void i({path:`subspace_map.${e}.canvas_map.${s}.item_list.${a}`,subspaceId:e,itemId:t.brick_id,message:`Pressable \`${r.title||t.brick_id}\` is fully covered by the opaque \`${c.brick?.title||c.item.brick_id}\` later in the item list — it is invisible and untappable.`,hint:"Reorder the items, shrink the covering element, or remove the hidden one."})}}})})}}}};