mcard-studio 0.0.1 → 0.0.3

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.
Files changed (212) hide show
  1. package/README.md +3 -0
  2. package/astro.config.mjs +46 -2
  3. package/bin/mcard-studio.mjs +1 -1
  4. package/cli/lib/runtimeContext.mjs +6 -3
  5. package/dist/client/_astro/{ChartAnalyticsViewlet.Cevj0EOs.js → ChartAnalyticsViewlet.CBW-JyA3.js} +1 -1
  6. package/dist/client/_astro/ClmPcardViewlet.cvKsR2ng.js +3 -0
  7. package/dist/client/_astro/D3GraphViewlet.8YEIrCGL.js +2 -0
  8. package/dist/client/_astro/DockviewSpatialWorkbench.BTd66LPl.js +12 -0
  9. package/dist/client/_astro/DocumentViewlets.KY1HcNka.js +2 -0
  10. package/dist/client/_astro/DxfViewlet.B3N5zpZR.js +1 -0
  11. package/dist/client/_astro/ExcalidrawWhiteboardViewlet.CMJGCQN4.js +1 -0
  12. package/dist/client/_astro/{FaroVCardSpanInstrumenter.BIk2NhJY.js → FaroVCardSpanInstrumenter.ClIqZujq.js} +1 -1
  13. package/dist/client/_astro/{FontSpecimenViewlet.CpONhJh0.js → FontSpecimenViewlet.ChIyr0B8.js} +1 -1
  14. package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.D3FSc061.js +1 -0
  15. package/dist/client/_astro/{ImageViewlet.CHeNvX6L.js → ImageViewlet.Cs-u7-wt.js} +1 -1
  16. package/dist/client/_astro/{KatexFormulaViewlet.Cy_InWOK.js → KatexFormulaViewlet.0nOzV_qD.js} +1 -1
  17. package/dist/client/_astro/KoishiChatViewlet.DLsMmwdb.js +16 -0
  18. package/dist/client/_astro/MCardLibraryHarness.WBT9W10S.js +2 -0
  19. package/dist/client/_astro/{MarkdownViewlet.qoPlM-TZ.js → MarkdownViewlet.BIolkNXf.js} +25 -25
  20. package/dist/client/_astro/{MermaidDiagramViewlet.RnwDfQl6.js → MermaidDiagramViewlet.CkRk7QsS.js} +1 -1
  21. package/dist/client/_astro/PCardRendererBridge.DhaRSprd.js +1 -0
  22. package/dist/client/_astro/RendererPCardRegistry.brM2KiQs.js +1 -0
  23. package/dist/client/_astro/{SchemaYamlViewlet.D6HVdmrq.js → SchemaYamlViewlet.Bc7nkK4M.js} +1 -1
  24. package/dist/client/_astro/{ShellContainer.astro_astro_type_script_index_0_lang.2oi8fhQo.js → ShellContainer.astro_astro_type_script_index_0_lang.5q1gCLvf.js} +1 -1
  25. package/dist/client/_astro/{Spatial3dViewlet.CCYBSSib.js → Spatial3dViewlet.C-jjhr0A.js} +1 -1
  26. package/dist/client/_astro/{StudioLayout.CBgiVbeb.css → StudioLayout.CX8XGtZV.css} +1 -1
  27. package/dist/client/_astro/StudioWorkbench.B1QwGHWM.js +7 -0
  28. package/dist/client/_astro/{SvgViewlet.BxlWQ-JX.js → SvgViewlet.uGxvb06H.js} +1 -1
  29. package/dist/client/_astro/{TerminalView.DWZR-hUa.js → TerminalView.DP7G7E1m.js} +4 -4
  30. package/dist/client/_astro/{ThemeSettingsViewlet.Cb1r8fWw.js → ThemeSettingsViewlet.UaTHcGnF.js} +1 -1
  31. package/dist/client/_astro/{TikzDiagramViewlet.CqY7VTeP.js → TikzDiagramViewlet.O8MJyXfT.js} +1 -1
  32. package/dist/client/_astro/VideoPlayerViewlet.-ycmo3kY.js +1 -0
  33. package/dist/client/_astro/WebappZenViewlet.PNce4u2T.js +1 -0
  34. package/dist/client/_astro/{WelcomeViewport.LwKTA6h7.js → WelcomeViewport.CZ6RxGSw.js} +1 -1
  35. package/dist/client/_astro/{agentIdentityCredentialService.BtKVsl2C.js → agentIdentityCredentialService.BEtZzBlO.js} +5 -5
  36. package/dist/client/_astro/cardTypeDetector.C2HH5RnU.js +1 -0
  37. package/dist/client/_astro/disposable.BmlxZrDf.js +1 -0
  38. package/dist/client/_astro/{markdownService.D-tM2RYx.js → markdownService.CpuKl0vp.js} +1 -1
  39. package/dist/client/_astro/{mcardStore.BiAvqM-D.js → mcardStore.nSWnzeLg.js} +2 -2
  40. package/dist/client/_astro/mcardVfs.BSdys1Y7.js +3 -0
  41. package/dist/client/_astro/pathsConfig.CSBBSzwH.js +2 -0
  42. package/dist/client/_astro/polyfills.Bi7kO8cu.js +1 -0
  43. package/dist/client/_astro/rendererEventBus.DirFDmGw.js +1 -0
  44. package/dist/client/_astro/themeStore.BajxvCga.js +1 -0
  45. package/dist/client/_astro/{tikzCompiler.DFojjdxR.js → tikzCompiler.-fXMNQpz.js} +1 -1
  46. package/dist/client/_astro/{useMCardHydration.Co47OH3D.js → useMCardHydration.Bjj_N5Gv.js} +1 -1
  47. package/dist/client/_astro/vendor-ai.D6NcJ6lu.js +69 -0
  48. package/dist/client/_astro/vendor-clm-kernel.B0kxq3g4.js +108 -0
  49. package/dist/client/_astro/vfsHandles.D4Pq18pW.js +1 -0
  50. package/dist/client/_astro/vfsPersistence.DVrd1BZj.js +1 -0
  51. package/dist/client/_astro/vfsTransactions.DBNtFuRz.js +1 -0
  52. package/dist/client/_astro/{workspaceStore.CXakha4Y.js → workspaceStore.DUHW2YBc.js} +1 -1
  53. package/dist/client/js/buffer-polyfill.js +14 -0
  54. package/dist/server/chunks/{StudioLayout_D163irJ0.mjs → StudioLayout_taayQJ5b.mjs} +2 -2
  55. package/dist/server/chunks/{_.._ZXsz792-.mjs → _.._CoQKwo62.mjs} +137 -91
  56. package/dist/server/chunks/{_handle__D_cIJYrU.mjs → _handle__D8dKQPUS.mjs} +3 -3
  57. package/dist/server/chunks/{cardTypeDetector_CyW1Xnmy.mjs → cardTypeDetector_C55M_HWS.mjs} +9 -0
  58. package/dist/server/chunks/{cards_B89BvF6W.mjs → cards_rVOc8K6H.mjs} +2 -2
  59. package/dist/server/chunks/cas_DTxlZ4Le.mjs +68 -0
  60. package/dist/server/chunks/{dispatch_DOwSKukU.mjs → dispatch_BTW4E_BJ.mjs} +8 -7
  61. package/dist/server/chunks/{dispatch_CxWKiHpn.mjs → dispatch_MbkljUxD.mjs} +8 -8
  62. package/dist/server/chunks/{export_DRouradA.mjs → export_DkEwDE2T.mjs} +3 -3
  63. package/dist/server/chunks/{health_Dfa5I0-X.mjs → health_cRt0M0yu.mjs} +1 -1
  64. package/dist/server/chunks/{mcard-library_DvPPUs9_.mjs → mcard-library_CLHvyslV.mjs} +1 -1
  65. package/dist/server/chunks/{mcardVfs_CeezzRvt.mjs → mcardVfs_DvNburKb.mjs} +5 -30
  66. package/dist/server/chunks/{move__RFvIDkq.mjs → move_DYcaXBLV.mjs} +6 -6
  67. package/dist/server/chunks/{pathsConfig_CgNYYLVm.mjs → pathsConfig_Dack-p2f.mjs} +13 -3
  68. package/dist/server/chunks/{proxy_CrWJQIBe.mjs → proxy_CMbbdBPW.mjs} +2 -2
  69. package/dist/server/chunks/{raw_DzNDaDVP.mjs → raw_C97sJWhg.mjs} +59 -26
  70. package/dist/server/chunks/{serverBootstrap_XKo2s6Ha.mjs → serverBootstrap_BDdSRIu5.mjs} +2 -2
  71. package/dist/server/chunks/tree_BwmO-pTe.mjs +186 -0
  72. package/dist/server/chunks/vfsCore_DIKpk-pk.mjs +98 -0
  73. package/dist/server/chunks/{vfsTreeScan_CKp7kMt9.mjs → vfsTreeScan_CRoCluPB.mjs} +18 -10
  74. package/dist/server/chunks/workspaceRoot_CRx3taID.mjs +157 -0
  75. package/dist/server/chunks/{write_popiFsO7.mjs → write_BLsmsTIx.mjs} +6 -5
  76. package/dist/server/chunks/{ws-server-init_CkcgcI5V.mjs → ws-server-init_Cfft7U5u.mjs} +343 -298
  77. package/dist/server/entry.mjs +8 -4
  78. package/dist/server/entry2.mjs +67 -28
  79. package/dist/server/virtual_astro_middleware.mjs +2 -2
  80. package/package.json +2 -2
  81. package/public/js/buffer-polyfill.js +14 -0
  82. package/src/components/studio/views/cardViewlets/ClmRegistryComponentViewlet.tsx +133 -0
  83. package/src/components/studio/views/cardViewlets/DxfViewlet.tsx +230 -0
  84. package/src/components/studio/views/cardViewlets/VideoPlayerViewlet.tsx +4 -4
  85. package/src/components/studio/views/cardViewlets/coreViewletDefs.ts +2 -2
  86. package/src/components/studio/views/cardViewlets/documents/AudioPlayerViewlet.tsx +15 -3
  87. package/src/components/studio/views/cardViewlets/documents/PdfViewlet.tsx +25 -7
  88. package/src/components/studio/views/cardViewlets/markdown/stages/wikilinkStage.ts +2 -1
  89. package/src/components/studio/views/cardViewlets/mediaViewletDefs.ts +21 -1
  90. package/src/components/studio/views/cardViewlets/webapp/WebappCanvas.tsx +40 -15
  91. package/src/components/studio/views/cardViewlets/webapp/WebappDevicePresetBar.tsx +108 -0
  92. package/src/components/studio/views/cardViewlets/webapp/WebappZenViewlet.tsx +23 -30
  93. package/src/components/studio/views/fileTree/MCardFileTree.tsx +71 -54
  94. package/src/components/studio/views/fileTree/hooks/useFileTreeSync.ts +0 -1
  95. package/src/components/studio/views/fileTree/hooks/usePartitionedTrees.ts +68 -23
  96. package/src/components/studio/views/fileTree/hooks/useSectionAccordion.ts +21 -11
  97. package/src/components/studio/views/functions/UnifiedFunctionExplorerViewlet.tsx +168 -0
  98. package/src/components/studio/views/history/HistoryPanel.tsx +110 -0
  99. package/src/components/studio/views/lineage/LineagePanel.tsx +152 -0
  100. package/src/components/studio/views/navigation/HandleLineageDrawer.tsx +89 -0
  101. package/src/components/studio/views/navigation/MultiCardCollectionBrowser.tsx +154 -0
  102. package/src/components/studio/views/pills/HashPill.tsx +101 -0
  103. package/src/components/studio/views/residency/ResidencyIndicator.tsx +82 -0
  104. package/src/config/app_config.json +3 -3
  105. package/src/core/projection/catalog.ts +105 -0
  106. package/src/core/projection/collection.ts +148 -0
  107. package/src/core/projection/handleSubscription.ts +132 -0
  108. package/src/core/projection/index.ts +4 -0
  109. package/src/core/projection/selectors.ts +29 -0
  110. package/src/core/projection/views.ts +242 -0
  111. package/src/core/refinement/designMetrics.ts +104 -0
  112. package/src/core/refinement/fibrationProjector.ts +142 -0
  113. package/src/core/refinement/lagrangianEngine.ts +137 -0
  114. package/src/core/refinement/refinementCommands.ts +82 -0
  115. package/src/core/viewport/deviceArchetypeRegistry.ts +177 -0
  116. package/src/core/viewport/viewportAudit.ts +150 -0
  117. package/src/edge/storeFilter.d.ts +4 -0
  118. package/src/edge/storeFilter.js +54 -0
  119. package/src/edge/storeFilter.ts +52 -0
  120. package/src/layouts/StudioLayout.astro +1 -0
  121. package/src/lib/cryptoPolyfill.js +77 -1
  122. package/src/lib/fsPolyfill.js +65 -0
  123. package/src/lib/urlPolyfill.js +21 -0
  124. package/src/lib/zlibPolyfill.js +35 -0
  125. package/src/packages/mcard-studio/package.json +2 -2
  126. package/src/packages/mcard-studio/type/legacyMapping.ts +5 -0
  127. package/src/packages/mcard-studio/viewlets/manifests.ts +2 -0
  128. package/src/packages/mcard-studio/viewlets/moduleMap.ts +12 -0
  129. package/src/packages/mcard-studio/viewlets/refinementManifests.ts +114 -0
  130. package/src/pages/api/dispatch.ts +3 -2
  131. package/src/pages/api/vfs/cas.ts +114 -0
  132. package/src/pages/api/vfs/move.ts +5 -5
  133. package/src/pages/api/vfs/raw.ts +72 -27
  134. package/src/pages/api/vfs/tree.ts +130 -11
  135. package/src/pages/api/vfs/write.ts +5 -4
  136. package/src/pages/index.astro +75 -0
  137. package/src/server/api/kernelDispatch.ts +8 -8
  138. package/src/server/artifactCollectionService.ts +4 -7
  139. package/src/server/artifactRepository.ts +4 -3
  140. package/src/server/clmRunner.mjs +1 -1
  141. package/src/server/collectionOwner.mjs +5 -5
  142. package/src/server/effects/executionPersistenceService.mjs +11 -11
  143. package/src/server/effects/resultSealingService.mjs +2 -2
  144. package/src/server/fileIngestService.mjs +21 -9
  145. package/src/server/fileWatcherService.mjs +4 -1
  146. package/src/server/handlers/fileChangeHandler.mjs +18 -10
  147. package/src/server/handlers/saveExecutionLogHandler.mjs +6 -6
  148. package/src/server/notificationService.mjs +14 -1
  149. package/src/server/scripts/buildSeedingMemory.mjs +3 -3
  150. package/src/server/serverMemoryRepository.ts +41 -59
  151. package/src/server/vfsTreeScan.ts +16 -10
  152. package/src/server/workspaceRoot.ts +143 -5
  153. package/src/services/cardTypeDetector.ts +4 -0
  154. package/src/services/databaseSyncService.ts +30 -46
  155. package/src/services/inBrowserLlm/engines/litertEngine.ts +1 -1
  156. package/src/services/namespaceProtocolClient.ts +221 -0
  157. package/src/services/renderers/pcard/RendererPCardRegistry.ts +4 -66
  158. package/src/services/renderers/pcard/modalitySpecs.ts +125 -0
  159. package/src/services/renderers/pcard/types.ts +7 -1
  160. package/src/services/renderers/rendererEventBus.ts +5 -3
  161. package/src/services/unifiedFunctionExecutionService.ts +145 -0
  162. package/src/services/vfs/vfsCore.ts +12 -1
  163. package/src/services/vfs/vfsMigration.ts +95 -0
  164. package/src/services/vfs/vfsMutations.ts +17 -35
  165. package/src/services/vfs/vfsPersistence.ts +19 -24
  166. package/src/services/vfs/vfsSync.ts +55 -17
  167. package/src/services/vfs/vfsVersions.ts +23 -34
  168. package/src/services/workbenchExecutionPolicy.ts +183 -0
  169. package/src/stores/mcardCollectionStore.ts +2 -0
  170. package/src/styles/dockview.css +34 -0
  171. package/src/ui/viewlets/FibrationRefinementViewlet.tsx +155 -0
  172. package/src/ui/viewlets/PetriConformanceViewlet.tsx +166 -0
  173. package/src/ui/viewlets/ResponsiveViewportLabViewlet.tsx +175 -0
  174. package/src/ui/viewlets/SprintGovernanceViewlet.tsx +176 -0
  175. package/src/ui/viewlets/viewletFocus.ts +35 -0
  176. package/src/ui/viewlets/viewportLabParts.tsx +190 -0
  177. package/dist/client/_astro/ClmPcardViewlet.DW5Yft0E.js +0 -3
  178. package/dist/client/_astro/D3GraphViewlet.DAjPz1DP.js +0 -2
  179. package/dist/client/_astro/DockviewSpatialWorkbench.DyQjSoHd.js +0 -12
  180. package/dist/client/_astro/DocumentViewlets.Dm_GL3AL.js +0 -2
  181. package/dist/client/_astro/ExcalidrawWhiteboardViewlet.DrlW7B6G.js +0 -1
  182. package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.DGXU-3Lu.js +0 -1
  183. package/dist/client/_astro/KoishiChatViewlet.B0eDEMnT.js +0 -16
  184. package/dist/client/_astro/MCardLibraryHarness.CUJLJFBt.js +0 -2
  185. package/dist/client/_astro/PCardRendererBridge.BnyaE05I.js +0 -1
  186. package/dist/client/_astro/RendererPCardRegistry.CLr4j1Ub.js +0 -1
  187. package/dist/client/_astro/StudioWorkbench.CF0SOYwy.js +0 -7
  188. package/dist/client/_astro/VideoPlayerViewlet.DoSYmmoQ.js +0 -1
  189. package/dist/client/_astro/WebappZenViewlet.CQW50OhX.js +0 -1
  190. package/dist/client/_astro/cardTypeDetector.C9kGObMh.js +0 -1
  191. package/dist/client/_astro/disposable.66apX1Q2.js +0 -1
  192. package/dist/client/_astro/empty.DOwCrGXH.js +0 -1
  193. package/dist/client/_astro/mcardVfs.Bj-RA0p7.js +0 -2
  194. package/dist/client/_astro/path.CR60mj9W.js +0 -1
  195. package/dist/client/_astro/pathsConfig.D0hV34p7.js +0 -2
  196. package/dist/client/_astro/polyfills.DcBkS56X.js +0 -1
  197. package/dist/client/_astro/rendererEventBus.CyFnSRLk.js +0 -1
  198. package/dist/client/_astro/themeStore.zUMFLo3Q.js +0 -1
  199. package/dist/client/_astro/vendor-ai.CZe7UVVK.js +0 -69
  200. package/dist/client/_astro/vfsHandles.B-nczBRy.js +0 -1
  201. package/dist/client/_astro/vfsPersistence.D6zRzVML.js +0 -1
  202. package/dist/client/_astro/vfsTransactions.04mkEHxD.js +0 -1
  203. package/dist/server/chunks/cryptoPolyfill_99rxUwYC.mjs +0 -180
  204. package/dist/server/chunks/kernelHash_DRaj51hY.mjs +0 -5
  205. package/dist/server/chunks/tree_CE2BhvyJ.mjs +0 -76
  206. package/dist/server/chunks/vfsCore_B6nCiBl5.mjs +0 -21
  207. package/dist/server/chunks/workspaceRoot_DVSUbYkd.mjs +0 -71
  208. package/src/server/kernelHash.ts +0 -22
  209. package/src/server/storage/cardCollection.ts +0 -94
  210. package/src/server/storage/index.ts +0 -3
  211. package/src/server/storage/mcard.ts +0 -99
  212. package/src/server/storage/sqliteNodeEngine.ts +0 -121
@@ -1 +0,0 @@
1
- var e=[],t=[],n=typeof Uint8Array<`u`?Uint8Array:Array,r=!1;function i(){r=!0;for(var n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,i=0,a=n.length;i<a;++i)e[i]=n[i],t[n.charCodeAt(i)]=i;t[45]=62,t[95]=63}function a(e){r||i();var a,o,s,c,l,u,d=e.length;if(d%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);l=e[d-2]===`=`?2:+(e[d-1]===`=`),u=new n(d*3/4-l),s=l>0?d-4:d;var f=0;for(a=0,o=0;a<s;a+=4,o+=3)c=t[e.charCodeAt(a)]<<18|t[e.charCodeAt(a+1)]<<12|t[e.charCodeAt(a+2)]<<6|t[e.charCodeAt(a+3)],u[f++]=c>>16&255,u[f++]=c>>8&255,u[f++]=c&255;return l===2?(c=t[e.charCodeAt(a)]<<2|t[e.charCodeAt(a+1)]>>4,u[f++]=c&255):l===1&&(c=t[e.charCodeAt(a)]<<10|t[e.charCodeAt(a+1)]<<4|t[e.charCodeAt(a+2)]>>2,u[f++]=c>>8&255,u[f++]=c&255),u}function o(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[t&63]}function s(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(o(r));return i.join(``)}function c(t){r||i();for(var n,a=t.length,o=a%3,c=``,l=[],u=16383,d=0,f=a-o;d<f;d+=u)l.push(s(t,d,d+u>f?f:d+u));return o===1?(n=t[a-1],c+=e[n>>2],c+=e[n<<4&63],c+=`==`):o===2&&(n=(t[a-2]<<8)+t[a-1],c+=e[n>>10],c+=e[n>>4&63],c+=e[n<<2&63],c+=`=`),l.push(c),l.join(``)}function l(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)}function u(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}var d={}.toString,f=Array.isArray||function(e){return d.call(e)==`[object Array]`};h.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT===void 0||globalThis.TYPED_ARRAY_SUPPORT,p();function p(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function m(e,t){if(p()<t)throw RangeError(`Invalid typed array length`);return h.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=h.prototype):(e===null&&(e=new h(t)),e.length=t),e}function h(e,t,n){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(e,t,n);if(typeof e==`number`){if(typeof t==`string`)throw Error(`If encoding is specified then the first argument must be a string`);return y(this,e)}return g(this,e,t,n)}h.poolSize=8192,h._augment=function(e){return e.__proto__=h.prototype,e};function g(e,t,n,r){if(typeof t==`number`)throw TypeError(`"value" argument must not be a number`);return typeof ArrayBuffer<`u`&&t instanceof ArrayBuffer?S(e,t,n,r):typeof t==`string`?b(e,t,n):ee(e,t)}h.from=function(e,t,n){return g(null,e,t,n)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function _(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be a number`);if(e<0)throw RangeError(`"size" argument must not be negative`)}function v(e,t,n,r){return _(t),t<=0||n===void 0?m(e,t):typeof r==`string`?m(e,t).fill(n,r):m(e,t).fill(n)}h.alloc=function(e,t,n){return v(null,e,t,n)};function y(e,t){if(_(t),e=m(e,t<0?0:C(t)|0),!h.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}h.allocUnsafe=function(e){return y(null,e)},h.allocUnsafeSlow=function(e){return y(null,e)};function b(e,t,n){if((typeof n!=`string`||n===``)&&(n=`utf8`),!h.isEncoding(n))throw TypeError(`"encoding" must be a valid string encoding`);var r=T(t,n)|0;e=m(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function x(e,t){var n=t.length<0?0:C(t.length)|0;e=m(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function S(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw RangeError(`'offset' is out of bounds`);if(t.byteLength<n+(r||0))throw RangeError(`'length' is out of bounds`);return t=n===void 0&&r===void 0?new Uint8Array(t):r===void 0?new Uint8Array(t,n):new Uint8Array(t,n,r),h.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=h.prototype):e=x(e,t),e}function ee(e,t){if(w(t)){var n=C(t.length)|0;return e=m(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<`u`&&t.buffer instanceof ArrayBuffer||`length`in t)return typeof t.length!=`number`||ce(t.length)?m(e,0):x(e,t);if(t.type===`Buffer`&&f(t.data))return x(e,t.data)}throw TypeError(`First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.`)}function C(e){if(e>=p())throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+p().toString(16)+` bytes`);return e|0}h.isBuffer=le;function w(e){return!!(e!=null&&e._isBuffer)}h.compare=function(e,t){if(!w(e)||!w(t))throw TypeError(`Arguments must be Buffers`);if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},h.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},h.concat=function(e,t){if(!f(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return h.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=h.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!w(a))throw TypeError(`"list" argument must be an Array of Buffers`);a.copy(r,i),i+=a.length}return r};function T(e,t){if(w(e))return e.length;if(typeof ArrayBuffer<`u`&&typeof ArrayBuffer.isView==`function`&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!=`string`&&(e=``+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:case void 0:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Z(e).length;default:if(r)return X(e).length;t=(``+t).toLowerCase(),r=!0}}h.byteLength=T;function E(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return z(this,t,n);case`utf8`:case`utf-8`:return I(this,t,n);case`ascii`:return re(this,t,n);case`latin1`:case`binary`:return R(this,t,n);case`base64`:return F(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return B(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}h.prototype._isBuffer=!0;function D(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}h.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(var t=0;t<e;t+=2)D(this,t,t+1);return this},h.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(var t=0;t<e;t+=4)D(this,t,t+3),D(this,t+1,t+2);return this},h.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(var t=0;t<e;t+=8)D(this,t,t+7),D(this,t+1,t+6),D(this,t+2,t+5),D(this,t+3,t+4);return this},h.prototype.toString=function(){var e=this.length|0;return e===0?``:arguments.length===0?I(this,0,e):E.apply(this,arguments)},h.prototype.equals=function(e){if(!w(e))throw TypeError(`Argument must be a Buffer`);return this===e||h.compare(this,e)===0},h.prototype.inspect=function(){var e=``,t=50;return this.length>0&&(e=this.toString(`hex`,0,t).match(/.{2}/g).join(` `),this.length>t&&(e+=` ... `)),`<Buffer `+e+`>`},h.prototype.compare=function(e,t,n,r,i){if(!w(e))throw TypeError(`Argument must be a Buffer`);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),l=e.slice(t,n),u=0;u<s;++u)if(c[u]!==l[u]){a=c[u],o=l[u];break}return a<o?-1:+(o<a)};function O(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=h.from(t,r)),w(t))return t.length===0?-1:k(e,t,n,r,i);if(typeof t==`number`)return t&=255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function k(e,t,n,r,i){var a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}var l;if(i){var u=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===s)return u*a}else u!==-1&&(l-=l-u),u=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){for(var d=!0,f=0;f<s;f++)if(c(e,l+f)!==c(t,f)){d=!1;break}if(d)return l}return-1}h.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},h.prototype.indexOf=function(e,t,n){return O(this,e,t,n,!0)},h.prototype.lastIndexOf=function(e,t,n){return O(this,e,t,n,!1)};function te(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;if(a%2!=0)throw TypeError(`Invalid hex string`);r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(o*2,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function A(e,t,n,r){return Q(X(t,e.length-n),e,n,r)}function j(e,t,n,r){return Q(oe(t),e,n,r)}function M(e,t,n,r){return j(e,t,n,r)}function N(e,t,n,r){return Q(Z(t),e,n,r)}function P(e,t,n,r){return Q(se(t,e.length-n),e,n,r)}h.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t|=0,isFinite(n)?(n|=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;for(var a=!1;;)switch(r){case`hex`:return te(this,e,t,n);case`utf8`:case`utf-8`:return A(this,e,t,n);case`ascii`:return j(this,e,t,n);case`latin1`:case`binary`:return M(this,e,t,n);case`base64`:return N(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return P(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},h.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function F(e,t,n){return t===0&&n===e.length?c(e):c(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,d;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],(c&192)==128&&(d=(a&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)==128&&(l&192)==128&&(d=(a&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],(c&192)==128&&(l&192)==128&&(u&192)==128&&(d=(a&15)<<18|(c&63)<<12|(l&63)<<6|u&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=s}return ne(r)}var L=4096;function ne(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=L));return n}function re(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function R(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function z(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i=``,a=t;a<n;++a)i+=ae(e[a]);return i}function B(e,t,n){for(var r=e.slice(t,n),i=``,a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}h.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(h.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=h.prototype;else{var i=t-e;r=new h(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r};function V(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}h.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},h.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},h.prototype.readUInt8=function(e,t){return t||V(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||V(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return t||V(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||V(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},h.prototype.readUInt32BE=function(e,t){return t||V(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},h.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},h.prototype.readInt8=function(e,t){return t||V(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},h.prototype.readInt16LE=function(e,t){t||V(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},h.prototype.readInt16BE=function(e,t){t||V(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},h.prototype.readInt32LE=function(e,t){return t||V(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return t||V(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||V(e,4,this.length),l(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||V(e,4,this.length),l(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||V(e,8,this.length),l(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||V(e,8,this.length),l(this,e,!1,52,8)};function H(e,t,n,r,i,a){if(!w(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}h.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;H(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},h.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;H(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},h.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function U(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}h.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):U(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):U(this,e,t,!1),t+2};function W(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>(r?i:3-i)*8&255}h.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):W(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):W(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);H(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},h.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);H(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},h.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},h.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):U(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):U(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):W(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):W(this,e,t,!1),t+4};function G(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function K(e,t,n,r,i){return i||G(e,t,n,4),u(e,t,n,r,23,4),n+4}h.prototype.writeFloatLE=function(e,t,n){return K(this,e,t,!0,n)},h.prototype.writeFloatBE=function(e,t,n){return K(this,e,t,!1,n)};function q(e,t,n,r,i){return i||G(e,t,n,8),u(e,t,n,r,52,8),n+8}h.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},h.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},h.prototype.copy=function(e,t,n,r){if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`sourceStart out of bounds`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n,a;if(this===e&&n<t&&t<r)for(a=i-1;a>=0;--a)e[a+t]=this[a+n];else if(i<1e3||!h.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},h.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!h.isEncoding(r))throw TypeError(`Unknown encoding: `+r)}else typeof e==`number`&&(e&=255);if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;var a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{var o=w(e)?e:X(new h(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var J=/[^+\/0-9A-Za-z-_]/g;function Y(e){if(e=ie(e).replace(J,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ie(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function ae(e){return e<16?`0`+e.toString(16):e.toString(16)}function X(e,t){t||=1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function oe(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function se(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Z(e){return a(Y(e))}function Q(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ce(e){return e!==e}function le(e){return e!=null&&(!!e._isBuffer||$(e)||ue(e))}function $(e){return!!e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function ue(e){return typeof e.readFloatLE==`function`&&typeof e.slice==`function`&&$(e.slice(0,0))}typeof window<`u`&&(window.Buffer=window.Buffer||h,window.global=window.global||window,window.process=window.process||{env:{},browser:!0,version:``}),typeof globalThis<`u`&&(globalThis.Buffer=globalThis.Buffer||h,globalThis.global=globalThis.global||globalThis,globalThis.process=globalThis.process||{env:{},browser:!0,version:``});
@@ -1 +0,0 @@
1
- import{g as e}from"./themeStore.zUMFLo3Q.js";var t=e(null);function n(e){let n={...e,timestamp:Date.now()};t.set(n)}export{n as t};
@@ -1 +0,0 @@
1
- import{MCardFileSystem as e}from"clm-kernel";var t=[],n=0,r=null,i=4,a=globalThis.nanostoresGlobal||={epoch:0},o=()=>{let e,a;for(;n<t.length;){a=n,n+=i;let o=r?.get(t[a]);if(o){if(!o.has(t[a+1]))continue;o.clear()}try{t[a](t[a+1].value,t[a+2],t[a+3])}catch(t){e=t}}if(t.length=n=0,e)throw e},s=e=>{let s=[],c={eq:Object.is,get(){return c.lc||c.listen(()=>{})(),c.value},init:e,lc:0,listen(e){return c.lc=s.push(e),()=>{r?.get(e)?.delete(c);for(let r=n;r<t.length;)t[r]===e&&t[r+1]===c?t.splice(r,i):r+=i;let a=s.indexOf(e);~a&&(s.splice(a,1),--c.lc||c.off())}},notify(e,n){a.epoch++;let r=!t.length&&!0;for(let r of s)t.push(r,c,e,n);r&&o()},off(){},set(e){let t=c.value;c.eq(t,e)||(c.value=e,c.notify(t))},subscribe(e){let t=c.listen(e);return e(c.value),t},value:e};return c},c=e.createOptimal({dbPath:`.clm/content_memory.db`}),l=(e,t)=>`mcard:ui/${e}/${t}`;function u(e,t,n,r,i){return{id:e,handle:l(`theme`,e),tokens:r,meta:{name:t,contrast:n,...i?{densityHint:i}:{}}}}var d=[u(`dark-default`,`VS Code Dark+ Classic`,`AA`,{"--mcard-bg-canvas":`#1e1e1e`,"--mcard-bg-surface":`#252526`,"--mcard-bg-surface-hover":`#2a2d2e`,"--mcard-bg-elevated":`#2d2d30`,"--mcard-border-default":`#3c3c3c`,"--mcard-border-subtle":`#333333`,"--mcard-text-primary":`#cccccc`,"--mcard-text-secondary":`#9d9d9d`,"--mcard-text-muted":`#858585`,"--mcard-accent-primary":`#007acc`,"--mcard-accent-hover":`#0e639c`,"--mcard-focus-ring":`#007fd4`}),u(`light-clean`,`Clean Light Modern`,`AAA`,{"--mcard-bg-canvas":`#f8fafc`,"--mcard-bg-surface":`#ffffff`,"--mcard-bg-surface-hover":`#f1f5f9`,"--mcard-bg-elevated":`#ffffff`,"--mcard-border-default":`#cbd5e1`,"--mcard-border-subtle":`#e2e8f0`,"--mcard-text-primary":`#0f172a`,"--mcard-text-secondary":`#334155`,"--mcard-text-muted":`#64748b`,"--mcard-accent-primary":`#0284c7`,"--mcard-accent-hover":`#0369a1`,"--mcard-focus-ring":`#0284c7`}),u(`high-contrast`,`High Contrast Stark`,`AAA`,{"--mcard-bg-canvas":`#000000`,"--mcard-bg-surface":`#000000`,"--mcard-bg-surface-hover":`#1a1a1a`,"--mcard-bg-elevated":`#000000`,"--mcard-border-default":`#ffffff`,"--mcard-border-subtle":`#ffffff`,"--mcard-text-primary":`#ffffff`,"--mcard-text-secondary":`#ffffff`,"--mcard-text-muted":`#ffff00`,"--mcard-accent-primary":`#ffff00`,"--mcard-accent-hover":`#ffff66`,"--mcard-focus-ring":`#ffff00`}),u(`monochrome-eink`,`Paper & E-Ink Minimal`,`AAA`,{"--mcard-bg-canvas":`#ffffff`,"--mcard-bg-surface":`#ffffff`,"--mcard-bg-surface-hover":`#f2f2f2`,"--mcard-bg-elevated":`#ffffff`,"--mcard-border-default":`#000000`,"--mcard-border-subtle":`#000000`,"--mcard-text-primary":`#000000`,"--mcard-text-secondary":`#000000`,"--mcard-text-muted":`#404040`,"--mcard-accent-primary":`#000000`,"--mcard-accent-hover":`#333333`,"--mcard-focus-ring":`#000000`}),u(`matrix-cyber`,`Cyberpunk Terminal`,`AAA`,{"--mcard-bg-canvas":`#0a0e14`,"--mcard-bg-surface":`#0f1620`,"--mcard-bg-surface-hover":`#14202c`,"--mcard-bg-elevated":`#0f1620`,"--mcard-border-default":`#123d2a`,"--mcard-border-subtle":`#0d2b1e`,"--mcard-text-primary":`#b6f5c8`,"--mcard-text-secondary":`#7fd39a`,"--mcard-text-muted":`#4e9c68`,"--mcard-accent-primary":`#00ff66`,"--mcard-accent-hover":`#66ffa3`,"--mcard-focus-ring":`#00ff66`})],f=[{id:`compact`,handle:l(`density`,`compact`),tokens:{"--mcard-font-size-base":`11px`,"--mcard-row-height":`22px`},meta:{name:`Compact`,baseFont:11,rowHeight:22,scale:.65}},{id:`comfortable`,handle:l(`density`,`comfortable`),tokens:{"--mcard-font-size-base":`13px`,"--mcard-row-height":`28px`},meta:{name:`Comfortable`,baseFont:13,rowHeight:28,scale:1}},{id:`spacious`,handle:l(`density`,`spacious`),tokens:{"--mcard-font-size-base":`15px`,"--mcard-row-height":`36px`},meta:{name:`Spacious`,baseFont:15,rowHeight:36,scale:1.3}}],p=[{id:`workbench`,handle:l(`layout`,`workbench`),variant:`workbench`,slots:[`header`,`rail`,`main`,`status`],chrome:{header:!0,activityRail:!0,statusRibbon:!0}},{id:`card-embed`,handle:l(`layout`,`card-embed`),variant:`card-embed`,slots:[`main`],chrome:{header:!1,activityRail:!1,statusRibbon:!1}},{id:`presentation`,handle:l(`layout`,`presentation`),variant:`presentation`,slots:[`main`],chrome:{header:!1,activityRail:!1,statusRibbon:!1}},{id:`minimal`,handle:l(`layout`,`minimal`),variant:`minimal`,slots:[`main`],chrome:{header:!1,activityRail:!1,statusRibbon:!1}},{id:`tensor-split`,handle:l(`layout`,`tensor-split`),variant:`tensor-split`,slots:[`left`,`right`],chrome:{header:!0,activityRail:!1,statusRibbon:!0}}],m=[{id:`desktop-wide`,handle:l(`responsive`,`desktop-wide`),containerQuery:!0,breakpoints:{base:{minWidth:1200,tokens:{"--mcard-rail-collapsed":`0`},affordances:[`rail`,`dockview`,`split`]}}},{id:`laptop`,handle:l(`responsive`,`laptop`),containerQuery:!0,breakpoints:{base:{minWidth:900,tokens:{"--mcard-rail-collapsed":`0`},affordances:[`rail`,`dockview`]}}},{id:`tablet-narrow`,handle:l(`responsive`,`tablet-narrow`),containerQuery:!0,breakpoints:{base:{minWidth:600,tokens:{"--mcard-rail-collapsed":`1`},affordances:[`rail-collapsed`,`stacked`]}}},{id:`mobile-compact`,handle:l(`responsive`,`mobile-compact`),containerQuery:!0,breakpoints:{base:{minWidth:0,tokens:{"--mcard-rail-collapsed":`1`},affordances:[`single-panel`]}}}],h=[{id:`workbench`,handle:l(`context`,`workbench`),tokens:{},flags:[]},{id:`embedded`,handle:l(`context`,`embedded`),tokens:{"--mcard-shell-header-height":`0px`},flags:[`no-chrome`]},{id:`presentation`,handle:l(`context`,`presentation`),tokens:{"--mcard-font-size-base":`15px`},flags:[`hidden-panels`]},{id:`kiosk`,handle:l(`context`,`kiosk`),tokens:{},flags:[`locked`]},{id:`accessible-motion`,handle:l(`context`,`accessible-motion`),tokens:{"--mcard-motion-scale":`0`},flags:[`reduced-motion`]},{id:`coarse-pointer`,handle:l(`context`,`coarse-pointer`),tokens:{"--mcard-hit-target":`40px`},flags:[`touch`]}],g=[{id:`browser-web`,handle:l(`environment`,`browser-web`),runtime:`browser`,detection:`isBrowser && !window.__TAURI__`,notes:`Browser tab / PWA; native split-view & File System Access affordances.`},{id:`tauri-desktop`,handle:l(`environment`,`tauri-desktop`),runtime:`tauri`,detection:`window.__TAURI__ || window.__TAURI_INTERNALS__`,notes:`Tauri WebView; native window chrome, OS menu, native FS dialog.`},{id:`tauri-mobile`,handle:l(`environment`,`tauri-mobile`),runtime:`tauri`,detection:`tauri && (pointer: coarse)`,notes:`Tauri mobile; touch density, safe-area insets.`}],_=`mcard:ui/`,v=[`theme`,`tokens`,`density`,`layout`,`renderer`,`responsive`,`context`,`environment`,`shell`];function y(e,t){return`${_}${e}/${t}`}function b(e,t){if(!e)return null;let n=e.trim();if(n.startsWith(_))return n;let r=/^mcard:([a-z]+)\/(.+)$/.exec(n);return r&&v.includes(r[1])?`${_}${r[1]}/${r[2]}`:t&&!n.includes(`:`)?y(t,n):null}function x(e){return b(e,`theme`)}function S(e){return b(e,`density`)}function C(e){let t={...e.tokens};return t[`--mcard-theme-id`]=e.id,t}function w(e){return{...e.tokens,"--mcard-density-id":e.id}}function T(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return null}let n=t;return!n||typeof n.id!=`string`||typeof n.handle!=`string`||typeof n.tokens!=`object`||n.tokens===null?null:n}function E(){let e=[],t=(t,n)=>{for(let r of n)e.push({facet:t,id:r.id,handle:r.handle,payload:r})};return t(`theme`,d),t(`density`,f),t(`layout`,p),t(`responsive`,m),t(`context`,h),t(`environment`,g),e}var D=class{byHandle=new Map;byId=new Map;constructor(e=E()){for(let t of e){this.byHandle.set(t.handle,t);let e=this.byId.get(t.id)??[];e.push(t),this.byId.set(t.id,e)}}list(e){let t=[...this.byHandle.values()];return(e?t.filter(t=>t.facet===e):t).map(({facet:e,id:t,handle:n})=>({facet:e,id:t,handle:n}))}get(e){return this.byHandle.get(e)??null}resolve(e){let t=b(e);if(t)return t;let n=this.byId.get(e);return n&&n.length===1?n[0].handle:null}};function O(e,t=`base`){let n=e?.payload;return n?n.tokens?n.tokens:(n.breakpoints?.[t]??Object.values(n.breakpoints??{})[0])?.tokens??{}:{}}function k(e,t=new D){let n={},r=(e,r)=>{let i=t.resolve(e)??e;Object.assign(n,O(t.get(i),r))};return r(e.theme),r(e.density),r(e.environment),r(e.responsive),r(e.context),n}var A=`mcard:ui/theme/dark-default`,j=`mcard:ui/density/comfortable`,M=s(A),N=s(j),P=s(`browser-web`),F=s(`desktop-wide`),I=s(`workbench`),L=new D,R=()=>typeof document<`u`&&!!document.documentElement;function z(e){if(!R())return;let t=document.documentElement;for(let[n,r]of Object.entries(e))t.style.setProperty(n,r)}function B(e){try{let t=c.get(e);if(!t)return null;let n=t.payload;return T(n.kind===`text`?n.value:n.kind===`scalar`?String(n.value):n.kind===`structured`?JSON.stringify(n.value):JSON.stringify(n))}catch{return null}}function V(e){let t=L.get(e);return t?t.payload:B(e)}function H(e){let t=L.get(e);return t?t.payload:f.find(t=>t.handle===e)??null}function U(){let e=k({theme:M.get(),density:N.get(),responsive:F.get(),context:I.get(),environment:P.get()},L);if(z(e),R()){let e=document.documentElement;e.setAttribute(`data-theme`,M.get().split(`/`).pop()??`dark-default`),e.setAttribute(`data-density`,N.get().split(`/`).pop()??`comfortable`),e.setAttribute(`data-environment`,P.get()),e.setAttribute(`data-context`,I.get())}return e}var W=class{ctx;constructor(e={}){this.ctx=e}emit(e,t){try{this.ctx.emit?.(e,t)}catch{}}applyHandle(e){let t=x(e)??L.resolve(e),n=t?V(t):null;if(!t||!n)return this.emit(`theme:unresolved`,t??e),t===`mcard:ui/theme/dark-default`?null:this.applyHandle(A);if(z(C(n)),R()){document.documentElement.setAttribute(`data-theme`,n.id);try{localStorage.setItem(`mcard_theme`,t)}catch{}}return M.set(t),this.emit(`theme:change`,{handle:t}),t}setTheme(e){return this.applyHandle(e)}setDensity(e){let t=S(e)??L.resolve(e);if(!t)return null;let n=H(t);if(n&&z(w(n)),R()){document.documentElement.setAttribute(`data-density`,n?.id??e);try{localStorage.setItem(`mcard_density`,t)}catch{}}return N.set(t),this.emit(`density:change`,{handle:t}),t}setResponsive(e){return F.set(e),U(),this.emit(`responsive:change`,{id:e}),e}setContext(e){return I.set(e),U(),this.emit(`context:change`,{id:e}),e}setEnvironment(e){return P.set(e),U(),this.emit(`environment:change`,{id:e}),e}};function G(e){return new W(e)}export{a as _,M as a,B as c,T as d,C as f,s as g,c as h,F as i,L as l,d as m,N as n,U as o,f as p,P as r,G as s,I as t,k as u};