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.
- package/README.md +3 -0
- package/astro.config.mjs +46 -2
- package/bin/mcard-studio.mjs +1 -1
- package/cli/lib/runtimeContext.mjs +6 -3
- package/dist/client/_astro/{ChartAnalyticsViewlet.Cevj0EOs.js → ChartAnalyticsViewlet.CBW-JyA3.js} +1 -1
- package/dist/client/_astro/ClmPcardViewlet.cvKsR2ng.js +3 -0
- package/dist/client/_astro/D3GraphViewlet.8YEIrCGL.js +2 -0
- package/dist/client/_astro/DockviewSpatialWorkbench.BTd66LPl.js +12 -0
- package/dist/client/_astro/DocumentViewlets.KY1HcNka.js +2 -0
- package/dist/client/_astro/DxfViewlet.B3N5zpZR.js +1 -0
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.CMJGCQN4.js +1 -0
- package/dist/client/_astro/{FaroVCardSpanInstrumenter.BIk2NhJY.js → FaroVCardSpanInstrumenter.ClIqZujq.js} +1 -1
- package/dist/client/_astro/{FontSpecimenViewlet.CpONhJh0.js → FontSpecimenViewlet.ChIyr0B8.js} +1 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.D3FSc061.js +1 -0
- package/dist/client/_astro/{ImageViewlet.CHeNvX6L.js → ImageViewlet.Cs-u7-wt.js} +1 -1
- package/dist/client/_astro/{KatexFormulaViewlet.Cy_InWOK.js → KatexFormulaViewlet.0nOzV_qD.js} +1 -1
- package/dist/client/_astro/KoishiChatViewlet.DLsMmwdb.js +16 -0
- package/dist/client/_astro/MCardLibraryHarness.WBT9W10S.js +2 -0
- package/dist/client/_astro/{MarkdownViewlet.qoPlM-TZ.js → MarkdownViewlet.BIolkNXf.js} +25 -25
- package/dist/client/_astro/{MermaidDiagramViewlet.RnwDfQl6.js → MermaidDiagramViewlet.CkRk7QsS.js} +1 -1
- package/dist/client/_astro/PCardRendererBridge.DhaRSprd.js +1 -0
- package/dist/client/_astro/RendererPCardRegistry.brM2KiQs.js +1 -0
- package/dist/client/_astro/{SchemaYamlViewlet.D6HVdmrq.js → SchemaYamlViewlet.Bc7nkK4M.js} +1 -1
- 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
- package/dist/client/_astro/{Spatial3dViewlet.CCYBSSib.js → Spatial3dViewlet.C-jjhr0A.js} +1 -1
- package/dist/client/_astro/{StudioLayout.CBgiVbeb.css → StudioLayout.CX8XGtZV.css} +1 -1
- package/dist/client/_astro/StudioWorkbench.B1QwGHWM.js +7 -0
- package/dist/client/_astro/{SvgViewlet.BxlWQ-JX.js → SvgViewlet.uGxvb06H.js} +1 -1
- package/dist/client/_astro/{TerminalView.DWZR-hUa.js → TerminalView.DP7G7E1m.js} +4 -4
- package/dist/client/_astro/{ThemeSettingsViewlet.Cb1r8fWw.js → ThemeSettingsViewlet.UaTHcGnF.js} +1 -1
- package/dist/client/_astro/{TikzDiagramViewlet.CqY7VTeP.js → TikzDiagramViewlet.O8MJyXfT.js} +1 -1
- package/dist/client/_astro/VideoPlayerViewlet.-ycmo3kY.js +1 -0
- package/dist/client/_astro/WebappZenViewlet.PNce4u2T.js +1 -0
- package/dist/client/_astro/{WelcomeViewport.LwKTA6h7.js → WelcomeViewport.CZ6RxGSw.js} +1 -1
- package/dist/client/_astro/{agentIdentityCredentialService.BtKVsl2C.js → agentIdentityCredentialService.BEtZzBlO.js} +5 -5
- package/dist/client/_astro/cardTypeDetector.C2HH5RnU.js +1 -0
- package/dist/client/_astro/disposable.BmlxZrDf.js +1 -0
- package/dist/client/_astro/{markdownService.D-tM2RYx.js → markdownService.CpuKl0vp.js} +1 -1
- package/dist/client/_astro/{mcardStore.BiAvqM-D.js → mcardStore.nSWnzeLg.js} +2 -2
- package/dist/client/_astro/mcardVfs.BSdys1Y7.js +3 -0
- package/dist/client/_astro/pathsConfig.CSBBSzwH.js +2 -0
- package/dist/client/_astro/polyfills.Bi7kO8cu.js +1 -0
- package/dist/client/_astro/rendererEventBus.DirFDmGw.js +1 -0
- package/dist/client/_astro/themeStore.BajxvCga.js +1 -0
- package/dist/client/_astro/{tikzCompiler.DFojjdxR.js → tikzCompiler.-fXMNQpz.js} +1 -1
- package/dist/client/_astro/{useMCardHydration.Co47OH3D.js → useMCardHydration.Bjj_N5Gv.js} +1 -1
- package/dist/client/_astro/vendor-ai.D6NcJ6lu.js +69 -0
- package/dist/client/_astro/vendor-clm-kernel.B0kxq3g4.js +108 -0
- package/dist/client/_astro/vfsHandles.D4Pq18pW.js +1 -0
- package/dist/client/_astro/vfsPersistence.DVrd1BZj.js +1 -0
- package/dist/client/_astro/vfsTransactions.DBNtFuRz.js +1 -0
- package/dist/client/_astro/{workspaceStore.CXakha4Y.js → workspaceStore.DUHW2YBc.js} +1 -1
- package/dist/client/js/buffer-polyfill.js +14 -0
- package/dist/server/chunks/{StudioLayout_D163irJ0.mjs → StudioLayout_taayQJ5b.mjs} +2 -2
- package/dist/server/chunks/{_.._ZXsz792-.mjs → _.._CoQKwo62.mjs} +137 -91
- package/dist/server/chunks/{_handle__D_cIJYrU.mjs → _handle__D8dKQPUS.mjs} +3 -3
- package/dist/server/chunks/{cardTypeDetector_CyW1Xnmy.mjs → cardTypeDetector_C55M_HWS.mjs} +9 -0
- package/dist/server/chunks/{cards_B89BvF6W.mjs → cards_rVOc8K6H.mjs} +2 -2
- package/dist/server/chunks/cas_DTxlZ4Le.mjs +68 -0
- package/dist/server/chunks/{dispatch_DOwSKukU.mjs → dispatch_BTW4E_BJ.mjs} +8 -7
- package/dist/server/chunks/{dispatch_CxWKiHpn.mjs → dispatch_MbkljUxD.mjs} +8 -8
- package/dist/server/chunks/{export_DRouradA.mjs → export_DkEwDE2T.mjs} +3 -3
- package/dist/server/chunks/{health_Dfa5I0-X.mjs → health_cRt0M0yu.mjs} +1 -1
- package/dist/server/chunks/{mcard-library_DvPPUs9_.mjs → mcard-library_CLHvyslV.mjs} +1 -1
- package/dist/server/chunks/{mcardVfs_CeezzRvt.mjs → mcardVfs_DvNburKb.mjs} +5 -30
- package/dist/server/chunks/{move__RFvIDkq.mjs → move_DYcaXBLV.mjs} +6 -6
- package/dist/server/chunks/{pathsConfig_CgNYYLVm.mjs → pathsConfig_Dack-p2f.mjs} +13 -3
- package/dist/server/chunks/{proxy_CrWJQIBe.mjs → proxy_CMbbdBPW.mjs} +2 -2
- package/dist/server/chunks/{raw_DzNDaDVP.mjs → raw_C97sJWhg.mjs} +59 -26
- package/dist/server/chunks/{serverBootstrap_XKo2s6Ha.mjs → serverBootstrap_BDdSRIu5.mjs} +2 -2
- package/dist/server/chunks/tree_BwmO-pTe.mjs +186 -0
- package/dist/server/chunks/vfsCore_DIKpk-pk.mjs +98 -0
- package/dist/server/chunks/{vfsTreeScan_CKp7kMt9.mjs → vfsTreeScan_CRoCluPB.mjs} +18 -10
- package/dist/server/chunks/workspaceRoot_CRx3taID.mjs +157 -0
- package/dist/server/chunks/{write_popiFsO7.mjs → write_BLsmsTIx.mjs} +6 -5
- package/dist/server/chunks/{ws-server-init_CkcgcI5V.mjs → ws-server-init_Cfft7U5u.mjs} +343 -298
- package/dist/server/entry.mjs +8 -4
- package/dist/server/entry2.mjs +67 -28
- package/dist/server/virtual_astro_middleware.mjs +2 -2
- package/package.json +2 -2
- package/public/js/buffer-polyfill.js +14 -0
- package/src/components/studio/views/cardViewlets/ClmRegistryComponentViewlet.tsx +133 -0
- package/src/components/studio/views/cardViewlets/DxfViewlet.tsx +230 -0
- package/src/components/studio/views/cardViewlets/VideoPlayerViewlet.tsx +4 -4
- package/src/components/studio/views/cardViewlets/coreViewletDefs.ts +2 -2
- package/src/components/studio/views/cardViewlets/documents/AudioPlayerViewlet.tsx +15 -3
- package/src/components/studio/views/cardViewlets/documents/PdfViewlet.tsx +25 -7
- package/src/components/studio/views/cardViewlets/markdown/stages/wikilinkStage.ts +2 -1
- package/src/components/studio/views/cardViewlets/mediaViewletDefs.ts +21 -1
- package/src/components/studio/views/cardViewlets/webapp/WebappCanvas.tsx +40 -15
- package/src/components/studio/views/cardViewlets/webapp/WebappDevicePresetBar.tsx +108 -0
- package/src/components/studio/views/cardViewlets/webapp/WebappZenViewlet.tsx +23 -30
- package/src/components/studio/views/fileTree/MCardFileTree.tsx +71 -54
- package/src/components/studio/views/fileTree/hooks/useFileTreeSync.ts +0 -1
- package/src/components/studio/views/fileTree/hooks/usePartitionedTrees.ts +68 -23
- package/src/components/studio/views/fileTree/hooks/useSectionAccordion.ts +21 -11
- package/src/components/studio/views/functions/UnifiedFunctionExplorerViewlet.tsx +168 -0
- package/src/components/studio/views/history/HistoryPanel.tsx +110 -0
- package/src/components/studio/views/lineage/LineagePanel.tsx +152 -0
- package/src/components/studio/views/navigation/HandleLineageDrawer.tsx +89 -0
- package/src/components/studio/views/navigation/MultiCardCollectionBrowser.tsx +154 -0
- package/src/components/studio/views/pills/HashPill.tsx +101 -0
- package/src/components/studio/views/residency/ResidencyIndicator.tsx +82 -0
- package/src/config/app_config.json +3 -3
- package/src/core/projection/catalog.ts +105 -0
- package/src/core/projection/collection.ts +148 -0
- package/src/core/projection/handleSubscription.ts +132 -0
- package/src/core/projection/index.ts +4 -0
- package/src/core/projection/selectors.ts +29 -0
- package/src/core/projection/views.ts +242 -0
- package/src/core/refinement/designMetrics.ts +104 -0
- package/src/core/refinement/fibrationProjector.ts +142 -0
- package/src/core/refinement/lagrangianEngine.ts +137 -0
- package/src/core/refinement/refinementCommands.ts +82 -0
- package/src/core/viewport/deviceArchetypeRegistry.ts +177 -0
- package/src/core/viewport/viewportAudit.ts +150 -0
- package/src/edge/storeFilter.d.ts +4 -0
- package/src/edge/storeFilter.js +54 -0
- package/src/edge/storeFilter.ts +52 -0
- package/src/layouts/StudioLayout.astro +1 -0
- package/src/lib/cryptoPolyfill.js +77 -1
- package/src/lib/fsPolyfill.js +65 -0
- package/src/lib/urlPolyfill.js +21 -0
- package/src/lib/zlibPolyfill.js +35 -0
- package/src/packages/mcard-studio/package.json +2 -2
- package/src/packages/mcard-studio/type/legacyMapping.ts +5 -0
- package/src/packages/mcard-studio/viewlets/manifests.ts +2 -0
- package/src/packages/mcard-studio/viewlets/moduleMap.ts +12 -0
- package/src/packages/mcard-studio/viewlets/refinementManifests.ts +114 -0
- package/src/pages/api/dispatch.ts +3 -2
- package/src/pages/api/vfs/cas.ts +114 -0
- package/src/pages/api/vfs/move.ts +5 -5
- package/src/pages/api/vfs/raw.ts +72 -27
- package/src/pages/api/vfs/tree.ts +130 -11
- package/src/pages/api/vfs/write.ts +5 -4
- package/src/pages/index.astro +75 -0
- package/src/server/api/kernelDispatch.ts +8 -8
- package/src/server/artifactCollectionService.ts +4 -7
- package/src/server/artifactRepository.ts +4 -3
- package/src/server/clmRunner.mjs +1 -1
- package/src/server/collectionOwner.mjs +5 -5
- package/src/server/effects/executionPersistenceService.mjs +11 -11
- package/src/server/effects/resultSealingService.mjs +2 -2
- package/src/server/fileIngestService.mjs +21 -9
- package/src/server/fileWatcherService.mjs +4 -1
- package/src/server/handlers/fileChangeHandler.mjs +18 -10
- package/src/server/handlers/saveExecutionLogHandler.mjs +6 -6
- package/src/server/notificationService.mjs +14 -1
- package/src/server/scripts/buildSeedingMemory.mjs +3 -3
- package/src/server/serverMemoryRepository.ts +41 -59
- package/src/server/vfsTreeScan.ts +16 -10
- package/src/server/workspaceRoot.ts +143 -5
- package/src/services/cardTypeDetector.ts +4 -0
- package/src/services/databaseSyncService.ts +30 -46
- package/src/services/inBrowserLlm/engines/litertEngine.ts +1 -1
- package/src/services/namespaceProtocolClient.ts +221 -0
- package/src/services/renderers/pcard/RendererPCardRegistry.ts +4 -66
- package/src/services/renderers/pcard/modalitySpecs.ts +125 -0
- package/src/services/renderers/pcard/types.ts +7 -1
- package/src/services/renderers/rendererEventBus.ts +5 -3
- package/src/services/unifiedFunctionExecutionService.ts +145 -0
- package/src/services/vfs/vfsCore.ts +12 -1
- package/src/services/vfs/vfsMigration.ts +95 -0
- package/src/services/vfs/vfsMutations.ts +17 -35
- package/src/services/vfs/vfsPersistence.ts +19 -24
- package/src/services/vfs/vfsSync.ts +55 -17
- package/src/services/vfs/vfsVersions.ts +23 -34
- package/src/services/workbenchExecutionPolicy.ts +183 -0
- package/src/stores/mcardCollectionStore.ts +2 -0
- package/src/styles/dockview.css +34 -0
- package/src/ui/viewlets/FibrationRefinementViewlet.tsx +155 -0
- package/src/ui/viewlets/PetriConformanceViewlet.tsx +166 -0
- package/src/ui/viewlets/ResponsiveViewportLabViewlet.tsx +175 -0
- package/src/ui/viewlets/SprintGovernanceViewlet.tsx +176 -0
- package/src/ui/viewlets/viewletFocus.ts +35 -0
- package/src/ui/viewlets/viewportLabParts.tsx +190 -0
- package/dist/client/_astro/ClmPcardViewlet.DW5Yft0E.js +0 -3
- package/dist/client/_astro/D3GraphViewlet.DAjPz1DP.js +0 -2
- package/dist/client/_astro/DockviewSpatialWorkbench.DyQjSoHd.js +0 -12
- package/dist/client/_astro/DocumentViewlets.Dm_GL3AL.js +0 -2
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.DrlW7B6G.js +0 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.DGXU-3Lu.js +0 -1
- package/dist/client/_astro/KoishiChatViewlet.B0eDEMnT.js +0 -16
- package/dist/client/_astro/MCardLibraryHarness.CUJLJFBt.js +0 -2
- package/dist/client/_astro/PCardRendererBridge.BnyaE05I.js +0 -1
- package/dist/client/_astro/RendererPCardRegistry.CLr4j1Ub.js +0 -1
- package/dist/client/_astro/StudioWorkbench.CF0SOYwy.js +0 -7
- package/dist/client/_astro/VideoPlayerViewlet.DoSYmmoQ.js +0 -1
- package/dist/client/_astro/WebappZenViewlet.CQW50OhX.js +0 -1
- package/dist/client/_astro/cardTypeDetector.C9kGObMh.js +0 -1
- package/dist/client/_astro/disposable.66apX1Q2.js +0 -1
- package/dist/client/_astro/empty.DOwCrGXH.js +0 -1
- package/dist/client/_astro/mcardVfs.Bj-RA0p7.js +0 -2
- package/dist/client/_astro/path.CR60mj9W.js +0 -1
- package/dist/client/_astro/pathsConfig.D0hV34p7.js +0 -2
- package/dist/client/_astro/polyfills.DcBkS56X.js +0 -1
- package/dist/client/_astro/rendererEventBus.CyFnSRLk.js +0 -1
- package/dist/client/_astro/themeStore.zUMFLo3Q.js +0 -1
- package/dist/client/_astro/vendor-ai.CZe7UVVK.js +0 -69
- package/dist/client/_astro/vfsHandles.B-nczBRy.js +0 -1
- package/dist/client/_astro/vfsPersistence.D6zRzVML.js +0 -1
- package/dist/client/_astro/vfsTransactions.04mkEHxD.js +0 -1
- package/dist/server/chunks/cryptoPolyfill_99rxUwYC.mjs +0 -180
- package/dist/server/chunks/kernelHash_DRaj51hY.mjs +0 -5
- package/dist/server/chunks/tree_CE2BhvyJ.mjs +0 -76
- package/dist/server/chunks/vfsCore_B6nCiBl5.mjs +0 -21
- package/dist/server/chunks/workspaceRoot_DVSUbYkd.mjs +0 -71
- package/src/server/kernelHash.ts +0 -22
- package/src/server/storage/cardCollection.ts +0 -94
- package/src/server/storage/index.ts +0 -3
- package/src/server/storage/mcard.ts +0 -99
- package/src/server/storage/sqliteNodeEngine.ts +0 -121
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e}from"./vendor-clm-kernel.B0kxq3g4.js";import{h as t}from"./themeStore.BajxvCga.js";import{y as n}from"./mcardStore.nSWnzeLg.js";import{n as r}from"./pathsConfig.CSBBSzwH.js";import{n as i,t as a}from"./cardTypeDetector.C2HH5RnU.js";function o(e){let t=(e||``).trim(),n=t,r=`raw`;n.startsWith(`mcard://`)?(r=`mcard`,n=n.slice(8)):n.startsWith(`mcard:`)?(r=`mcard`,n=n.slice(6)):n.startsWith(`pcard://`)?(r=`pcard`,n=n.slice(8)):n.startsWith(`pcard:`)&&(r=`pcard`,n=n.slice(6));let[i,a]=n.split(`#`),[o,s]=i.split(`?`),c={};if(s)try{new URLSearchParams(s).forEach((e,t)=>{c[t]=e})}catch{s.split(`&`).forEach(e=>{let[t,n]=e.split(`=`);t&&(c[decodeURIComponent(t)]=decodeURIComponent(n||``))})}return{cleanHandle:o.trim(),scheme:r,params:c,anchor:a?a.trim():void 0,rawTarget:t}}function s(e,t){let n=(e||``).trim();n.startsWith(`mcard://`)&&(n=n.replace(/^mcard:\/\//,``));let i=n.replace(/:/g,`/`).replace(/^[\/\\]+/,``);return i.toLowerCase().endsWith(`.md`)?r({b64:i,versionHash:t,cacheBust:!t}):r({path:i,versionHash:t,cacheBust:!t})}function c(e,t,r){if(!e)return null;let i=r||n.get();if(!i)return null;let a=o(e).cleanHandle;if(!a)return null;if(i[a])return i[a];let s=a.replace(/\//g,`:`);if(i[s])return i[s];let c=a.replace(/:/g,`/`);if(i[c])return i[c];if(!s.endsWith(`.md`)&&i[`${s}.md`])return i[`${s}.md`];let l=Object.values(i),u=l.find(e=>e.handle===a||e.handle===s||e.handle===c||e.path===a||e.path===c||e.path.replace(/\//g,`:`)===s);if(u)return u;if(!a.endsWith(`.md`)){let e=`${a}.md`,t=`${s}.md`;if(u=l.find(n=>n.handle===t||n.path===e||n.name===e),u)return u}let d=a.toLowerCase(),f=d.endsWith(`.md`)?d:`${d}.md`;if(u=l.find(e=>{let t=e.name.toLowerCase(),n=t.replace(/\.[^.]+$/,``);return t===d||t===f||n===d}),u)return u;if(t&&t.path){let e=t.path.substring(0,t.path.lastIndexOf(`/`));if(e){let t=`${e}/${a}`.replace(/\/+/g,`/`),n=t.replace(/\//g,`:`);if(i[n])return i[n];if(!n.endsWith(`.md`)&&i[`${n}.md`])return i[`${n}.md`];if(u=l.find(e=>e.path===t||e.path===`${t}.md`),u)return u}}return u=l.find(e=>e.path.endsWith(`/${a}`)||e.path.endsWith(`/${a}.md`)||e.handle.endsWith(`:${s}`)||e.handle.endsWith(`:${s}.md`)),u||null}async function l(r){if(!r)return null;try{let o=await e({uri:r,backend:t.storageBackend,fallback:`stale`,cache:!0});if(o.content){let e=i(r),t=a({path:r,mimeType:e}),s={handle:r,hash:o.hash,path:r.replace(/:/g,`/`),name:r.split(`:`).pop()||r,mimeType:e,detectedType:t.detectedType,epistemicStatus:`definition`,readOnly:!0,content:o.content,subclass:t.subclass};return n.setKey(r,s),s}}catch(e){console.warn(`[MCardVFS] Remote resolution failed for ${r}:`,e)}return null}export{s as n,l as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{L as t}from"./vendor-clm-kernel.B0kxq3g4.js";import{_ as n,b as r,g as i,h as a,v as o,x as s,y as c}from"./themeStore.BajxvCga.js";import{a as l,y as u}from"./mcardStore.nSWnzeLg.js";import{t as d}from"./pathsConfig.CSBBSzwH.js";var f=class{options;isFlushing=!1;flushPromise=null;currentGeneration=0;retryAttempts=0;debounceTimer=null;state=`idle`;constructor(e){this.options=e}scheduleFlush(e=300){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.flush().catch(e=>console.error(`[StorageSupervisor] Flush error:`,e))},e)}async flush(){return this.isFlushing&&this.flushPromise?this.flushPromise:(this.isFlushing=!0,this.transition(`saving`),this.flushPromise=(async()=>{try{await this.options.flush(),this.currentGeneration++,this.retryAttempts=0,this.transition(`persistent`)}catch(e){throw this.transition(`error`),e}finally{this.isFlushing=!1,this.flushPromise=null}})(),this.flushPromise)}handleStaleConflict(e,t){this.transition(`stale`),console.warn(`[StorageSupervisor] Stale writer conflict: expected gen ${e}, found ${t}`)}async retryFlush(){try{return await this.flush(),!0}catch{return this.retryAttempts++,!1}}getState(){return this.state}getCurrentGeneration(){return this.currentGeneration}getRetryAttempts(){return this.retryAttempts}dispose(){this.debounceTimer&&=(clearTimeout(this.debounceTimer),null),this.isFlushing=!1,this.flushPromise=null}transition(e){this.state=e,this.options.onStateChange?.(e)}},p=e({STORE_CAS:()=>i,STORE_HANDLES:()=>n,STORE_HISTORY:()=>o,STORE_SNAPSHOTS:()=>r,getSqliteBytesFromIndexedDb:()=>C,hydrateFromIndexedDb:()=>x,idbGet:()=>h,idbGetAll:()=>g,idbPut:()=>_,loadCardsFromIndexedDb:()=>w,openIndexedDb:()=>s,saveSqliteBytesToIndexedDb:()=>S,triggerIndexedDbSync:()=>b,vfsStorageSupervisor:()=>y}),m=d.paths.workspace_dirname;async function h(e,t){try{let n=await s();return new Promise((r,i)=>{let a=n.transaction(e,`readonly`).objectStore(e).get(t);a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)})}catch{return}}async function g(e){try{let t=await s();return new Promise((n,r)=>{let i=t.transaction(e,`readonly`).objectStore(e).getAll();i.onsuccess=()=>n(i.result||[]),i.onerror=()=>r(i.error)})}catch{return[]}}async function _(e,t,n){try{let r=await s();return new Promise((i,a)=>{let o=r.transaction(e,`readwrite`).objectStore(e),s=n===void 0?o.put(t):o.put(t,n);s.onsuccess=()=>i(),s.onerror=()=>a(s.error)})}catch{}}async function v(){if(typeof window>`u`||!window.indexedDB)return;let e=u.get(),t=Object.values(e),l=`${m}:`,d=t.filter(e=>e.handle.startsWith(l)||e.scope===m||e.path.startsWith(`${m}/`)),f=(await s()).transaction([i,n,o,r,c],`readwrite`),p=f.objectStore(i),h=f.objectStore(n);h.clear();for(let e of d)e.hash&&e.content!==void 0&&p.put({hash:e.hash,content:e.content,mimeType:e.mimeType,size:typeof e.content==`string`?e.content.length:e.content?.byteLength||0}),h.put({handle:e.handle,scope:m,path:e.path,name:e.name,hash:e.hash,detectedType:e.detectedType,epistemicStatus:e.epistemicStatus,mtime:e.mtime||Date.now()});let g=a.storageBackend;if(g&&typeof g.exportBinary==`function`){let e=g.exportBinary();e&&f.objectStore(r).put({id:`latest`,bytes:e,mtime:Date.now()})}let _=d.map(e=>({handle:e.handle,hash:e.hash,path:e.path,name:e.name,mimeType:e.mimeType,detectedType:e.detectedType,epistemicStatus:e.epistemicStatus,readOnly:e.readOnly,subclass:e.subclass,content:e.content}));f.objectStore(c).put(_,`clm_cards`)}var y=new f({flush:v,onStateChange:e=>{l({isPersistent:e===`persistent`,lastSavedIso:new Date().toISOString(),supervisorState:e})}});function b(){let e=u.get(),t=Object.values(e),n=0;for(let e of t)typeof e.content==`string`?n+=e.content.length:e.content instanceof Uint8Array&&(n+=e.content.byteLength);let r=a.storageBackend.constructor.name,i=r.includes(`Sqlite`)?`sqlite`:r.includes(`SqlJs`)?`sqljs`:`memory`;l({backendType:i,cardCount:t.length,totalBytes:n,isPersistent:!0,lastSavedIso:new Date().toISOString()}),y.scheduleFlush(300)}async function x(){if(typeof window>`u`||!window.indexedDB)return!1;try{let e=await g(n),r=`${m}:`,o=e.filter(e=>e.scope===m||e.handle&&e.handle.startsWith(r)),s=u.get(),d=t.create(`did:clm:agent:idb`),f=0,p=0;if(o.length>0)for(let e of o){let t=``;if(e.hash){let n=await h(i,e.hash);n&&n.content!==void 0&&(t=n.content)}if(!s[e.handle]||!s[e.handle].content){let n=a.writeFile(e.path,t||``,d);s[e.handle]={...e,content:t,coreCard:n},f++}typeof t==`string`&&(p+=t.length)}else{let e=await h(c,`clm_cards`);if(Array.isArray(e)&&e.length>0){for(let t of e)if((t.path.startsWith(`${m}/`)||t.handle.startsWith(r))&&(!s[t.handle]||!s[t.handle].content)){let e=a.writeFile(t.path,t.content||``,d);s[t.handle]={...t,coreCard:e},f++}}}return f>0&&(u.set({...s}),l({cardCount:Object.keys(s).length,totalBytes:p,isPersistent:!0,lastSavedIso:new Date().toISOString()}),!0)}catch(e){return console.warn(`[MCardVFS] Failed to hydrate from IndexedDB:`,e),!1}}async function S(e){typeof window<`u`&&window.indexedDB&&await _(r,{id:`latest`,bytes:e,mtime:Date.now()})}async function C(){if(typeof window<`u`&&window.indexedDB)return(await h(r,`latest`))?.bytes}async function w(){if(typeof window<`u`&&window.indexedDB)return h(c,`clm_cards`)}export{p as i,S as n,b as r,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,L as t}from"./vendor-clm-kernel.B0kxq3g4.js";import{h as n}from"./themeStore.BajxvCga.js";import{y as r}from"./mcardStore.nSWnzeLg.js";import{r as i}from"./pathsConfig.CSBBSzwH.js";import{n as a,t as o}from"./cardTypeDetector.C2HH5RnU.js";import{r as s}from"./vfsPersistence.DVrd1BZj.js";async function c(i){let c=t.create(`did:clm:agent:user`),l=[];for(let t of i){let i=t.name.replace(/^[/\\]+/,``),s=`uploads/${i}`,u=s.replace(/\//g,`:`),d=t.mimeType||a(i),f=o({path:s,mimeType:d}),p=n.writeFile(s,t.content,c),m={handle:u,hash:p.hash.asHex(),path:s,name:i,mimeType:d,detectedType:f.detectedType,epistemicStatus:e(s),readOnly:!1,scope:`local-db`,subclass:f.subclass,content:t.content,coreCard:p};r.setKey(u,m),l.push(m)}return s(),l}async function l(e){let a=i(`vfs_tree`),o=await fetch(`${a}?scope=${encodeURIComponent(e)}`);if(!o.ok)throw Error(`Failed to fetch scope ${e} for forking: HTTP ${o.status}`);let c=await o.json();if(!c.success||!Array.isArray(c.files))throw Error(`Malformed tree response for fork`);let l=t.create(`did:clm:agent:user`),u=0;for(let t of c.files){let i=`forked/${e}/${t.path}`,a=i.replace(/\//g,`:`),o=t.content??``,s=n.writeFile(i,o,l),c={...t,handle:a,hash:s.hash.asHex(),path:i,name:t.name,readOnly:!1,scope:`local-db`,content:o,coreCard:s};r.setKey(a,c),u++}return s(),u}export{c as executeFileUploadTransaction,l as executeForkDirectoryTransaction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime.Dd_uD5pT.js";import{S as t}from"./themeStore.BajxvCga.js";import{i as n}from"./pathsConfig.CSBBSzwH.js";var r=e({$activeWorkspaceRoot:()=>o,$explorerSearchFilter:()=>c,clearExplorerSearchFilter:()=>d,setActiveWorkspaceRoot:()=>s,setExplorerSearchFilter:()=>u}),i=`clm:active_workspace_scope`;function a(){if(typeof window<`u`)try{let e=localStorage.getItem(i);if(e===`local-db`||n().some(t=>t.id===e)&&e)return e}catch{}return`local-db`}var o=t(a());function s(e){let t=e===`local-db`,r=n().some(t=>t.id===e);if(!t&&!r){console.warn(`[WorkspaceStore] Invalid workspace scope: ${e}`);return}if(o.set(e),typeof window<`u`)try{localStorage.setItem(i,e)}catch{}}var c=t(``),l=null;function u(e,t=!1){if(l&&=(clearTimeout(l),null),t){c.set(e);return}l=setTimeout(()=>{c.set(e),l=null},150)}function d(){l&&=(clearTimeout(l),null),c.set(``)}export{r as a,u as i,c as n,d as r,o as t};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(()=>{var yr=Object.create;var H=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Br=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var N=(i,r)=>()=>(r||i((r={exports:{}}).exports,r),r.exports);var dr=(i,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of xr(r))!Er.call(i,e)&&e!==t&&H(i,e,{get:()=>r[e],enumerable:!(n=wr(r,e))||n.enumerable});return i};var gr=(i,r,t)=>(t=i!=null?yr(Br(i)):{},dr(r||!i||!i.__esModule?H(t,"default",{value:i,enumerable:!0}):t,i));var z=N(S=>{"use strict";S.byteLength=Ir;S.toByteArray=Ar;S.fromByteArray=Rr;var B=[],w=[],mr=typeof Uint8Array<"u"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(m=0,V=M.length;m<V;++m)B[m]=M[m],w[M.charCodeAt(m)]=m;var m,V;w[45]=62;w[95]=63;function X(i){var r=i.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function Ir(i){var r=X(i),t=r[0],n=r[1];return(t+n)*3/4-n}function Fr(i,r,t){return(r+t)*3/4-t}function Ar(i){var r,t=X(i),n=t[0],e=t[1],o=new mr(Fr(i,n,e)),u=0,f=e>0?n-4:n,c;for(c=0;c<f;c+=4)r=w[i.charCodeAt(c)]<<18|w[i.charCodeAt(c+1)]<<12|w[i.charCodeAt(c+2)]<<6|w[i.charCodeAt(c+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return e===2&&(r=w[i.charCodeAt(c)]<<2|w[i.charCodeAt(c+1)]>>4,o[u++]=r&255),e===1&&(r=w[i.charCodeAt(c)]<<10|w[i.charCodeAt(c+1)]<<4|w[i.charCodeAt(c+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Ur(i){return B[i>>18&63]+B[i>>12&63]+B[i>>6&63]+B[i&63]}function Tr(i,r,t){for(var n,e=[],o=r;o<t;o+=3)n=(i[o]<<16&16711680)+(i[o+1]<<8&65280)+(i[o+2]&255),e.push(Ur(n));return e.join("")}function Rr(i){for(var r,t=i.length,n=t%3,e=[],o=16383,u=0,f=t-n;u<f;u+=o)e.push(Tr(i,u,u+o>f?f:u+o));return n===1?(r=i[t-1],e.push(B[r>>2]+B[r<<4&63]+"==")):n===2&&(r=(i[t-2]<<8)+i[t-1],e.push(B[r>>10]+B[r>>4&63]+B[r<<2&63]+"=")),e.join("")}});var J=N(k=>{k.read=function(i,r,t,n,e){var o,u,f=e*8-n-1,c=(1<<f)-1,l=c>>1,s=-7,p=t?e-1:0,F=t?-1:1,x=i[r+p];for(p+=F,o=x&(1<<-s)-1,x>>=-s,s+=f;s>0;o=o*256+i[r+p],p+=F,s-=8);for(u=o&(1<<-s)-1,o>>=-s,s+=n;s>0;u=u*256+i[r+p],p+=F,s-=8);if(o===0)o=1-l;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-l}return(x?-1:1)*u*Math.pow(2,o-n)};k.write=function(i,r,t,n,e,o){var u,f,c,l=o*8-e-1,s=(1<<l)-1,p=s>>1,F=e===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,L=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+p>=1?r+=F/c:r+=F*Math.pow(2,1-p),r*c>=2&&(u++,c/=2),u+p>=s?(f=0,u=s):u+p>=1?(f=(r*c-1)*Math.pow(2,e),u=u+p):(f=r*Math.pow(2,p-1)*Math.pow(2,e),u=0));e>=8;i[t+x]=f&255,x+=L,f/=256,e-=8);for(u=u<<e|f,l+=e;l>0;i[t+x]=u&255,x+=L,u/=256,l-=8);i[t+x-L]|=ar*128}});var lr=N(R=>{"use strict";var D=z(),U=J(),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=h;R.SlowBuffer=Nr;R.INSPECT_MAX_BYTES=50;var _=2147483647;R.kMaxLength=_;h.TYPED_ARRAY_SUPPORT=Cr();!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Cr(){try{let i=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(i,r),i.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function d(i){if(i>_)throw new RangeError('The value "'+i+'" is invalid for option "size"');let r=new Uint8Array(i);return Object.setPrototypeOf(r,h.prototype),r}function h(i,r,t){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return G(i)}return rr(i,r,t)}h.poolSize=8192;function rr(i,r,t){if(typeof i=="string")return _r(i,r);if(ArrayBuffer.isView(i))return br(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(E(i,ArrayBuffer)||i&&E(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(E(i,SharedArrayBuffer)||i&&E(i.buffer,SharedArrayBuffer)))return P(i,r,t);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=i.valueOf&&i.valueOf();if(n!=null&&n!==i)return h.from(n,r,t);let e=Lr(i);if(e)return e;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return h.from(i[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}h.from=function(i,r,t){return rr(i,r,t)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function tr(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function Sr(i,r,t){return tr(i),i<=0?d(i):r!==void 0?typeof t=="string"?d(i).fill(r,t):d(i).fill(r):d(i)}h.alloc=function(i,r,t){return Sr(i,r,t)};function G(i){return tr(i),d(i<0?0:Y(i)|0)}h.allocUnsafe=function(i){return G(i)};h.allocUnsafeSlow=function(i){return G(i)};function _r(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!h.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=ir(i,r)|0,n=d(t),e=n.write(i,r);return e!==t&&(n=n.slice(0,e)),n}function $(i){let r=i.length<0?0:Y(i.length)|0,t=d(r);for(let n=0;n<r;n+=1)t[n]=i[n]&255;return t}function br(i){if(E(i,Uint8Array)){let r=new Uint8Array(i);return P(r.buffer,r.byteOffset,r.byteLength)}return $(i)}function P(i,r,t){if(r<0||i.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(i):t===void 0?n=new Uint8Array(i,r):n=new Uint8Array(i,r,t),Object.setPrototypeOf(n,h.prototype),n}function Lr(i){if(h.isBuffer(i)){let r=Y(i.length)|0,t=d(r);return t.length===0||i.copy(t,0,0,r),t}if(i.length!==void 0)return typeof i.length!="number"||W(i.length)?d(0):$(i);if(i.type==="Buffer"&&Array.isArray(i.data))return $(i.data)}function Y(i){if(i>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return i|0}function Nr(i){return+i!=i&&(i=0),h.alloc(+i)}h.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==h.prototype};h.compare=function(r,t){if(E(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),E(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(r)||!h.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,e=t.length;for(let o=0,u=Math.min(n,e);o<u;++o)if(r[o]!==t[o]){n=r[o],e=t[o];break}return n<e?-1:e<n?1:0};h.isEncoding=function(r){switch(String(r).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(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let e=h.allocUnsafe(t),o=0;for(n=0;n<r.length;++n){let u=r[n];if(E(u,Uint8Array))o+u.length>e.length?(h.isBuffer(u)||(u=h.from(u)),u.copy(e,o)):Uint8Array.prototype.set.call(e,u,o);else if(h.isBuffer(u))u.copy(e,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return e};function ir(i,r){if(h.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||E(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let t=i.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let e=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return O(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return sr(i).length;default:if(e)return n?-1:O(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=ir;function Mr(i,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return jr(this,r,t);case"utf8":case"utf-8":return er(this,r,t);case"ascii":return qr(this,r,t);case"latin1":case"binary":return Wr(this,r,t);case"base64":return Gr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hr(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),n=!0}}h.prototype._isBuffer=!0;function I(i,r,t){let n=i[r];i[r]=i[t],i[t]=n}h.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)I(this,t,t+1);return this};h.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)I(this,t,t+3),I(this,t+1,t+2);return this};h.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)I(this,t,t+7),I(this,t+1,t+6),I(this,t+2,t+5),I(this,t+3,t+4);return this};h.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?er(this,0,r):Mr.apply(this,arguments)};h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=function(r){if(!h.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){let r="",t=R.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};K&&(h.prototype[K]=h.prototype.inspect);h.prototype.compare=function(r,t,n,e,o){if(E(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),!h.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),e===void 0&&(e=0),o===void 0&&(o=this.length),t<0||n>r.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&t>=n)return 0;if(e>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,e>>>=0,o>>>=0,this===r)return 0;let u=o-e,f=n-t,c=Math.min(u,f),l=this.slice(e,o),s=r.slice(t,n);for(let p=0;p<c;++p)if(l[p]!==s[p]){u=l[p],f=s[p];break}return u<f?-1:f<u?1:0};function nr(i,r,t,n,e){if(i.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,W(t)&&(t=e?0:i.length-1),t<0&&(t=i.length+t),t>=i.length){if(e)return-1;t=i.length-1}else if(t<0)if(e)t=0;else return-1;if(typeof r=="string"&&(r=h.from(r,n)),h.isBuffer(r))return r.length===0?-1:Z(i,r,t,n,e);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?e?Uint8Array.prototype.indexOf.call(i,r,t):Uint8Array.prototype.lastIndexOf.call(i,r,t):Z(i,[r],t,n,e);throw new TypeError("val must be string, number or Buffer")}function Z(i,r,t,n,e){let o=1,u=i.length,f=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(i.length<2||r.length<2)return-1;o=2,u/=2,f/=2,t/=2}function c(s,p){return o===1?s[p]:s.readUInt16BE(p*o)}let l;if(e){let s=-1;for(l=t;l<u;l++)if(c(i,l)===c(r,s===-1?0:l-s)){if(s===-1&&(s=l),l-s+1===f)return s*o}else s!==-1&&(l-=l-s),s=-1}else for(t+f>u&&(t=u-f),l=t;l>=0;l--){let s=!0;for(let p=0;p<f;p++)if(c(i,l+p)!==c(r,p)){s=!1;break}if(s)return l}return-1}h.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1};h.prototype.indexOf=function(r,t,n){return nr(this,r,t,n,!0)};h.prototype.lastIndexOf=function(r,t,n){return nr(this,r,t,n,!1)};function kr(i,r,t,n){t=Number(t)||0;let e=i.length-t;n?(n=Number(n),n>e&&(n=e)):n=e;let o=r.length;n>o/2&&(n=o/2);let u;for(u=0;u<n;++u){let f=parseInt(r.substr(u*2,2),16);if(W(f))return u;i[t+u]=f}return u}function Dr(i,r,t,n){return b(O(r,i.length-t),i,t,n)}function $r(i,r,t,n){return b(Jr(r),i,t,n)}function Pr(i,r,t,n){return b(sr(r),i,t,n)}function Or(i,r,t,n){return b(Kr(r,i.length-t),i,t,n)}h.prototype.write=function(r,t,n,e){if(t===void 0)e="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")e=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,e===void 0&&(e="utf8")):(e=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");let u=!1;for(;;)switch(e){case"hex":return kr(this,r,t,n);case"utf8":case"utf-8":return Dr(this,r,t,n);case"ascii":case"latin1":case"binary":return $r(this,r,t,n);case"base64":return Pr(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Or(this,r,t,n);default:if(u)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),u=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Gr(i,r,t){return r===0&&t===i.length?D.fromByteArray(i):D.fromByteArray(i.slice(r,t))}function er(i,r,t){t=Math.min(i.length,t);let n=[],e=r;for(;e<t;){let o=i[e],u=null,f=o>239?4:o>223?3:o>191?2:1;if(e+f<=t){let c,l,s,p;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[e+1],(c&192)===128&&(p=(o&31)<<6|c&63,p>127&&(u=p));break;case 3:c=i[e+1],l=i[e+2],(c&192)===128&&(l&192)===128&&(p=(o&15)<<12|(c&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(u=p));break;case 4:c=i[e+1],l=i[e+2],s=i[e+3],(c&192)===128&&(l&192)===128&&(s&192)===128&&(p=(o&15)<<18|(c&63)<<12|(l&63)<<6|s&63,p>65535&&p<1114112&&(u=p))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),e+=f}return Yr(n)}var Q=4096;function Yr(i){let r=i.length;if(r<=Q)return String.fromCharCode.apply(String,i);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,i.slice(n,n+=Q));return t}function qr(i,r,t){let n="";t=Math.min(i.length,t);for(let e=r;e<t;++e)n+=String.fromCharCode(i[e]&127);return n}function Wr(i,r,t){let n="";t=Math.min(i.length,t);for(let e=r;e<t;++e)n+=String.fromCharCode(i[e]);return n}function jr(i,r,t){let n=i.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let e="";for(let o=r;o<t;++o)e+=Zr[i[o]];return e}function Hr(i,r,t){let n=i.slice(r,t),e="";for(let o=0;o<n.length-1;o+=2)e+=String.fromCharCode(n[o]+n[o+1]*256);return e}h.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let e=this.subarray(r,t);return Object.setPrototypeOf(e,h.prototype),e};function a(i,r,t){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>t)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r],o=1,u=0;for(;++u<t&&(o*=256);)e+=this[r+u]*o;return e};h.prototype.readUintBE=h.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r+--t],o=1;for(;t>0&&(o*=256);)e+=this[r+--t]*o;return e};h.prototype.readUint8=h.prototype.readUInt8=function(r,t){return r=r>>>0,t||a(r,1,this.length),this[r]};h.prototype.readUint16LE=h.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||a(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUint16BE=h.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||a(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUint32LE=h.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||a(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUint32BE=h.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readBigUInt64LE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(e)+(BigInt(o)<<BigInt(32))});h.prototype.readBigUInt64BE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(e)<<BigInt(32))+BigInt(o)});h.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r],o=1,u=0;for(;++u<t&&(o*=256);)e+=this[r+u]*o;return o*=128,e>=o&&(e-=Math.pow(2,8*t)),e};h.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=t,o=1,u=this[r+--e];for(;e>0&&(o*=256);)u+=this[r+--e]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};h.prototype.readInt8=function(r,t){return r=r>>>0,t||a(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,t){r=r>>>0,t||a(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};h.prototype.readInt16BE=function(r,t){r=r>>>0,t||a(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};h.prototype.readInt32LE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readBigInt64LE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(e)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)});h.prototype.readBigInt64BE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(e)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)});h.prototype.readFloatLE=function(r,t){return r=r>>>0,t||a(r,4,this.length),U.read(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,t){return r=r>>>0,t||a(r,4,this.length),U.read(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||a(r,8,this.length),U.read(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||a(r,8,this.length),U.read(this,r,!1,52,8)};function y(i,r,t,n,e,o){if(!h.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>e||r<o)throw new RangeError('"value" argument is out of bounds');if(t+n>i.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,n=n>>>0,!e){let f=Math.pow(2,8*n)-1;y(this,r,t,n,f,0)}let o=1,u=0;for(this[t]=r&255;++u<n&&(o*=256);)this[t+u]=r/o&255;return t+n};h.prototype.writeUintBE=h.prototype.writeUIntBE=function(r,t,n,e){if(r=+r,t=t>>>0,n=n>>>0,!e){let f=Math.pow(2,8*n)-1;y(this,r,t,n,f,0)}let o=n-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+n};h.prototype.writeUint8=h.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,1,255,0),this[t]=r&255,t+1};h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function or(i,r,t,n,e){pr(r,n,e,i,t,7);let o=Number(r&BigInt(4294967295));i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u,t}function ur(i,r,t,n,e){pr(r,n,e,i,t,7);let o=Number(r&BigInt(4294967295));i[t+7]=o,o=o>>8,i[t+6]=o,o=o>>8,i[t+5]=o,o=o>>8,i[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return i[t+3]=u,u=u>>8,i[t+2]=u,u=u>>8,i[t+1]=u,u=u>>8,i[t]=u,t+8}h.prototype.writeBigUInt64LE=g(function(r,t=0){return or(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeBigUInt64BE=g(function(r,t=0){return ur(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){let c=Math.pow(2,8*n-1);y(this,r,t,n,c-1,-c)}let o=0,u=1,f=0;for(this[t]=r&255;++o<n&&(u*=256);)r<0&&f===0&&this[t+o-1]!==0&&(f=1),this[t+o]=(r/u>>0)-f&255;return t+n};h.prototype.writeIntBE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){let c=Math.pow(2,8*n-1);y(this,r,t,n,c-1,-c)}let o=n-1,u=1,f=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&f===0&&this[t+o+1]!==0&&(f=1),this[t+o]=(r/u>>0)-f&255;return t+n};h.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};h.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};h.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};h.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};h.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};h.prototype.writeBigInt64LE=g(function(r,t=0){return or(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});h.prototype.writeBigInt64BE=g(function(r,t=0){return ur(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function hr(i,r,t,n,e,o){if(t+n>i.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function fr(i,r,t,n,e){return r=+r,t=t>>>0,e||hr(i,r,t,4,34028234663852886e22,-34028234663852886e22),U.write(i,r,t,n,23,4),t+4}h.prototype.writeFloatLE=function(r,t,n){return fr(this,r,t,!0,n)};h.prototype.writeFloatBE=function(r,t,n){return fr(this,r,t,!1,n)};function cr(i,r,t,n,e){return r=+r,t=t>>>0,e||hr(i,r,t,8,17976931348623157e292,-17976931348623157e292),U.write(i,r,t,n,52,8),t+8}h.prototype.writeDoubleLE=function(r,t,n){return cr(this,r,t,!0,n)};h.prototype.writeDoubleBE=function(r,t,n){return cr(this,r,t,!1,n)};h.prototype.copy=function(r,t,n,e){if(!h.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!e&&e!==0&&(e=this.length),t>=r.length&&(t=r.length),t||(t=0),e>0&&e<n&&(e=n),e===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),r.length-t<e-n&&(e=r.length-t+n);let o=e-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,e):Uint8Array.prototype.set.call(r,this.subarray(n,e),t),o};h.prototype.fill=function(r,t,n,e){if(typeof r=="string"){if(typeof t=="string"?(e=t,t=0,n=this.length):typeof n=="string"&&(e=n,n=this.length),e!==void 0&&typeof e!="string")throw new TypeError("encoding must be a string");if(typeof e=="string"&&!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);if(r.length===1){let u=r.charCodeAt(0);(e==="utf8"&&u<128||e==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o<n;++o)this[o]=r;else{let u=h.isBuffer(r)?r:h.from(r,e),f=u.length;if(f===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=u[o%f]}return this};var A={};function q(i,r,t){A[i]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);q("ERR_INVALID_ARG_TYPE",function(i,r){return`The "${i}" argument must be of type number. Received type ${typeof r}`},TypeError);q("ERR_OUT_OF_RANGE",function(i,r,t){let n=`The value of "${i}" is out of range.`,e=t;return Number.isInteger(t)&&Math.abs(t)>2**32?e=v(String(t)):typeof t=="bigint"&&(e=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(e=v(e)),e+="n"),n+=` It must be ${r}. Received ${e}`,n},RangeError);function v(i){let r="",t=i.length,n=i[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${i.slice(t-3,t)}${r}`;return`${i.slice(0,t)}${r}`}function Vr(i,r,t){T(r,"offset"),(i[r]===void 0||i[r+t]===void 0)&&C(r,i.length-(t+1))}function pr(i,r,t,n,e,o){if(i>t||i<r){let u=typeof r=="bigint"?"n":"",f;throw o>3?r===0||r===BigInt(0)?f=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:f=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:f=`>= ${r}${u} and <= ${t}${u}`,new A.ERR_OUT_OF_RANGE("value",f,i)}Vr(n,e,o)}function T(i,r){if(typeof i!="number")throw new A.ERR_INVALID_ARG_TYPE(r,"number",i)}function C(i,r,t){throw Math.floor(i)!==i?(T(i,t),new A.ERR_OUT_OF_RANGE(t||"offset","an integer",i)):r<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,i)}var Xr=/[^+/0-9A-Za-z-_]/g;function zr(i){if(i=i.split("=")[0],i=i.trim().replace(Xr,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function O(i,r){r=r||1/0;let t,n=i.length,e=null,o=[];for(let u=0;u<n;++u){if(t=i.charCodeAt(u),t>55295&&t<57344){if(!e){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}e=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),e=t;continue}t=(e-55296<<10|t-56320)+65536}else e&&(r-=3)>-1&&o.push(239,191,189);if(e=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Jr(i){let r=[];for(let t=0;t<i.length;++t)r.push(i.charCodeAt(t)&255);return r}function Kr(i,r){let t,n,e,o=[];for(let u=0;u<i.length&&!((r-=2)<0);++u)t=i.charCodeAt(u),n=t>>8,e=t%256,o.push(e),o.push(n);return o}function sr(i){return D.toByteArray(zr(i))}function b(i,r,t,n){let e;for(e=0;e<n&&!(e+t>=r.length||e>=i.length);++e)r[e+t]=i[e];return e}function E(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function W(i){return i!==i}var Zr=(function(){let i="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let e=0;e<16;++e)r[n+e]=i[t]+i[e]}return r})();function g(i){return typeof BigInt>"u"?Qr:i}function Qr(){throw new Error("BigInt not supported")}});var j=gr(lr());typeof window<"u"&&(window.Buffer=j.Buffer,window.global=window.global||window,window.process=window.process||{env:{},browser:!0,version:""});typeof globalThis<"u"&&(globalThis.Buffer=j.Buffer,globalThis.global=globalThis.global||globalThis,globalThis.process=globalThis.process||{env:{},browser:!0,version:""});})();
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
ieee754/index.js:
|
|
5
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
6
|
+
|
|
7
|
+
buffer/index.js:
|
|
8
|
+
(*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*)
|
|
14
|
+
*/
|
|
@@ -107,10 +107,10 @@ var $$StudioLayout = createComponent(($$result, $$props, $$slots) => {
|
|
|
107
107
|
"title": title,
|
|
108
108
|
"description": description,
|
|
109
109
|
"theme": resolvedTheme
|
|
110
|
-
})}
|
|
110
|
+
})}<script src="/js/buffer-polyfill.js"><\/script>${renderComponent($$result, "ThemeScript", $$ThemeScript, {})}${renderHead($$result)}</head><body>${renderComponent($$result, "ShellContainer", $$ShellContainer, {
|
|
111
111
|
"variant": resolvedLayout,
|
|
112
112
|
"hideChrome": hideChrome
|
|
113
113
|
}, { "default": ($$result) => renderTemplate`${renderSlot($$result, $$slots["default"])}` })}</body></html>`;
|
|
114
114
|
}, "/Users/bkoo/Documents/Development/GovTech/MCard_TDD/mcard-studio/src/layouts/StudioLayout.astro", void 0);
|
|
115
115
|
//#endregion
|
|
116
|
-
export { $$StudioLayout as t };
|
|
116
|
+
export { renderScript as n, $$StudioLayout as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
2
|
import { D as createAstro, f as renderTemplate, g as maybeRenderHead, o as renderComponent } from "./server_DQgO1z9H.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_jjPF-nBO.mjs";
|
|
4
|
-
import { t as $$StudioLayout } from "./
|
|
5
|
-
import { i as
|
|
6
|
-
import { t as studioMCardFs } from "./
|
|
7
|
-
import "./
|
|
4
|
+
import { t as $$StudioLayout } from "./StudioLayout_taayQJ5b.mjs";
|
|
5
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
6
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
7
|
+
import "./mcardVfs_DvNburKb.mjs";
|
|
8
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { ContentHash, parseTriadManifest, parseYamlOrJson, routeHandle } from "clm-kernel";
|
|
@@ -17,6 +17,137 @@ var $$PCardView = createComponent(($$result, $$props, $$slots) => {
|
|
|
17
17
|
return renderTemplate`${maybeRenderHead($$result)}<main class="pcard-container" data-astro-cid-ih2q6tja>${card ? renderTemplate`<article class="pcard-view" data-astro-cid-ih2q6tja><header class="pcard-header" data-astro-cid-ih2q6tja><div class="badge" data-astro-cid-ih2q6tja>PCARD</div><h1 class="pcard-title" data-astro-cid-ih2q6tja>${card.handle}</h1><div class="hash-tag" data-astro-cid-ih2q6tja><code data-astro-cid-ih2q6tja>${card.hash}</code></div><span class="runtime-pill" data-astro-cid-ih2q6tja>Runtime: ${card.runtime}</span></header><section class="pcard-body" data-astro-cid-ih2q6tja><h2 class="section-title" data-astro-cid-ih2q6tja>Manifest / Content</h2><pre class="content-pre" data-astro-cid-ih2q6tja><code data-astro-cid-ih2q6tja>${card.content}</code></pre></section></article>` : renderTemplate`<div class="not-found-view" data-astro-cid-ih2q6tja><h1 class="not-found-title" data-astro-cid-ih2q6tja>404 — PCard Not Found</h1><p class="not-found-desc" data-astro-cid-ih2q6tja>The requested handle <code data-astro-cid-ih2q6tja>${handle}</code> could not be resolved in the sovereign archive.</p><a href="/" class="back-link" data-astro-cid-ih2q6tja>Return to Studio Workbench</a></div>`}</main>`;
|
|
18
18
|
}, "/Users/bkoo/Documents/Development/GovTech/MCard_TDD/mcard-studio/src/components/studio/pcard/PCardView.astro", void 0);
|
|
19
19
|
//#endregion
|
|
20
|
+
//#region src/services/renderers/pcard/modalitySpecs.ts
|
|
21
|
+
var MODALITIES = [
|
|
22
|
+
"mermaid",
|
|
23
|
+
"katex",
|
|
24
|
+
"d3",
|
|
25
|
+
"chartjs",
|
|
26
|
+
"excalidraw",
|
|
27
|
+
"three",
|
|
28
|
+
"tikz",
|
|
29
|
+
"table",
|
|
30
|
+
"clm-registry-component",
|
|
31
|
+
"function-explorer",
|
|
32
|
+
"fibration-dashboard",
|
|
33
|
+
"petri-inspector",
|
|
34
|
+
"sprint-governance",
|
|
35
|
+
"viewport-lab"
|
|
36
|
+
];
|
|
37
|
+
var MODALITY_SPECS = {
|
|
38
|
+
mermaid: {
|
|
39
|
+
displayName: "Mermaid Diagram PCard",
|
|
40
|
+
description: "Reactive SVG flowcharts, sequence diagrams, and class graphs",
|
|
41
|
+
mimes: ["text/vnd.mermaid", "text/x-mermaid"],
|
|
42
|
+
exts: [".mermaid", ".mmd"]
|
|
43
|
+
},
|
|
44
|
+
katex: {
|
|
45
|
+
displayName: "KaTeX Math PCard",
|
|
46
|
+
description: "Zero-bundle mathematical typography and equation proofs",
|
|
47
|
+
mimes: [
|
|
48
|
+
"text/x-tex",
|
|
49
|
+
"application/x-latex",
|
|
50
|
+
"text/x-math"
|
|
51
|
+
],
|
|
52
|
+
exts: [
|
|
53
|
+
".math",
|
|
54
|
+
".latex",
|
|
55
|
+
".tex"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
d3: {
|
|
59
|
+
displayName: "D3.js Graph PCard",
|
|
60
|
+
description: "Interactive topological force networks and hierarchical trees",
|
|
61
|
+
mimes: ["application/vnd.d3+json", "application/x-graph"],
|
|
62
|
+
exts: [
|
|
63
|
+
".d3.json",
|
|
64
|
+
".graph.json",
|
|
65
|
+
".adjlist"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
chartjs: {
|
|
69
|
+
displayName: "Chart.js Analytics PCard",
|
|
70
|
+
description: "Multi-series timeseries, bar, radar, and statistical distributions",
|
|
71
|
+
mimes: ["application/vnd.chartjs+json", "application/x-timeseries"],
|
|
72
|
+
exts: [".chart.json", ".timeseries.json"]
|
|
73
|
+
},
|
|
74
|
+
excalidraw: {
|
|
75
|
+
displayName: "Excalidraw Whiteboard PCard",
|
|
76
|
+
description: "Spatial hand-drawn conceptual sketching and architecture canvas",
|
|
77
|
+
mimes: ["application/vnd.excalidraw+json", "application/x-excalidraw"],
|
|
78
|
+
exts: [".excalidraw", ".excalidraw.json"]
|
|
79
|
+
},
|
|
80
|
+
three: {
|
|
81
|
+
displayName: "Three.js 3D Viewport PCard",
|
|
82
|
+
description: "WebGL spatial geometry, meshes, and lighting environments",
|
|
83
|
+
mimes: [
|
|
84
|
+
"model/gltf-binary",
|
|
85
|
+
"model/gltf+json",
|
|
86
|
+
"model/obj",
|
|
87
|
+
"model/stl"
|
|
88
|
+
],
|
|
89
|
+
exts: [
|
|
90
|
+
".glb",
|
|
91
|
+
".gltf",
|
|
92
|
+
".obj",
|
|
93
|
+
".stl",
|
|
94
|
+
".3ds"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
tikz: {
|
|
98
|
+
displayName: "TikZ Categorical Vector PCard",
|
|
99
|
+
description: "High-fidelity commutative diagrams and LaTeX vector diagrams",
|
|
100
|
+
mimes: ["text/x-tikz", "text/x-tikzcd"],
|
|
101
|
+
exts: [
|
|
102
|
+
".tikz",
|
|
103
|
+
".tikzcd",
|
|
104
|
+
".tikz-cd"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
table: {
|
|
108
|
+
displayName: "GFM Data Table PCard",
|
|
109
|
+
description: "Tabular record grids, sorting, filtering, and CSV evaluation",
|
|
110
|
+
mimes: ["text/csv", "text/tab-separated-values"],
|
|
111
|
+
exts: [".csv", ".tsv"]
|
|
112
|
+
},
|
|
113
|
+
"clm-registry-component": {
|
|
114
|
+
displayName: "CLM Registry Component PCard",
|
|
115
|
+
description: "Sharded clm-registry components and portal island cartridges",
|
|
116
|
+
mimes: ["application/vnd.mcard.registry+json"],
|
|
117
|
+
exts: [".registry.json", ".clm-registry.json"]
|
|
118
|
+
},
|
|
119
|
+
"function-explorer": {
|
|
120
|
+
displayName: "Supported Function Explorer PCard",
|
|
121
|
+
description: "Discoverable function and capability descriptors; never executable",
|
|
122
|
+
mimes: ["application/vnd.mcard.catalog+json"],
|
|
123
|
+
exts: [".catalog.json", ".function-catalog.json"]
|
|
124
|
+
},
|
|
125
|
+
"fibration-dashboard": {
|
|
126
|
+
displayName: "Least-Action & Fibration Dashboard PCard",
|
|
127
|
+
description: "Software Lagrangian trajectories and base-to-fiber refinement projections",
|
|
128
|
+
mimes: ["application/vnd.mcard.fibration+json"],
|
|
129
|
+
exts: [".fibration.json", ".assessment.json"]
|
|
130
|
+
},
|
|
131
|
+
"petri-inspector": {
|
|
132
|
+
displayName: "Petri Marking & Fiber Conformance PCard",
|
|
133
|
+
description: "Read-only Petri-net markings and MIME taxonomy fiber conformance",
|
|
134
|
+
mimes: ["application/vnd.mcard.petri+json"],
|
|
135
|
+
exts: [".petri.json", ".marking.json"]
|
|
136
|
+
},
|
|
137
|
+
"sprint-governance": {
|
|
138
|
+
displayName: "Sprint & Deployment Governance PCard",
|
|
139
|
+
description: "Sprint registry projections, DoD seals, and deployment unit budgets",
|
|
140
|
+
mimes: ["application/vnd.mcard.governance+json"],
|
|
141
|
+
exts: [".governance.json", ".sprint-registry.json"]
|
|
142
|
+
},
|
|
143
|
+
"viewport-lab": {
|
|
144
|
+
displayName: "Responsive Viewport Lab PCard",
|
|
145
|
+
description: "Quad-device responsive matrix: wearable, cellphone, laptop, and desktop",
|
|
146
|
+
mimes: ["application/vnd.mcard.viewport+json"],
|
|
147
|
+
exts: [".viewport.json", ".viewport-matrix.json"]
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
//#endregion
|
|
20
151
|
//#region src/services/renderers/pcard/RendererPCardRegistry.ts
|
|
21
152
|
/**
|
|
22
153
|
* RendererPCardRegistry.ts — Canonical Registry for Renderer PCards (Program PR / Sprint PR-01)
|
|
@@ -63,93 +194,8 @@ var RendererPCardRegistry = class {
|
|
|
63
194
|
return Array.from(this.pcards.values());
|
|
64
195
|
}
|
|
65
196
|
registerDefaults() {
|
|
66
|
-
const modalities =
|
|
67
|
-
|
|
68
|
-
"katex",
|
|
69
|
-
"d3",
|
|
70
|
-
"chartjs",
|
|
71
|
-
"excalidraw",
|
|
72
|
-
"three",
|
|
73
|
-
"tikz",
|
|
74
|
-
"table"
|
|
75
|
-
];
|
|
76
|
-
const specs = {
|
|
77
|
-
mermaid: {
|
|
78
|
-
displayName: "Mermaid Diagram PCard",
|
|
79
|
-
description: "Reactive SVG flowcharts, sequence diagrams, and class graphs",
|
|
80
|
-
mimes: ["text/vnd.mermaid", "text/x-mermaid"],
|
|
81
|
-
exts: [".mermaid", ".mmd"]
|
|
82
|
-
},
|
|
83
|
-
katex: {
|
|
84
|
-
displayName: "KaTeX Math PCard",
|
|
85
|
-
description: "Zero-bundle mathematical typography and equation proofs",
|
|
86
|
-
mimes: [
|
|
87
|
-
"text/x-tex",
|
|
88
|
-
"application/x-latex",
|
|
89
|
-
"text/x-math"
|
|
90
|
-
],
|
|
91
|
-
exts: [
|
|
92
|
-
".math",
|
|
93
|
-
".latex",
|
|
94
|
-
".tex"
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
d3: {
|
|
98
|
-
displayName: "D3.js Graph PCard",
|
|
99
|
-
description: "Interactive topological force networks and hierarchical trees",
|
|
100
|
-
mimes: ["application/vnd.d3+json", "application/x-graph"],
|
|
101
|
-
exts: [
|
|
102
|
-
".d3.json",
|
|
103
|
-
".graph.json",
|
|
104
|
-
".adjlist"
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
chartjs: {
|
|
108
|
-
displayName: "Chart.js Analytics PCard",
|
|
109
|
-
description: "Multi-series timeseries, bar, radar, and statistical distributions",
|
|
110
|
-
mimes: ["application/vnd.chartjs+json", "application/x-timeseries"],
|
|
111
|
-
exts: [".chart.json", ".timeseries.json"]
|
|
112
|
-
},
|
|
113
|
-
excalidraw: {
|
|
114
|
-
displayName: "Excalidraw Whiteboard PCard",
|
|
115
|
-
description: "Spatial hand-drawn conceptual sketching and architecture canvas",
|
|
116
|
-
mimes: ["application/vnd.excalidraw+json", "application/x-excalidraw"],
|
|
117
|
-
exts: [".excalidraw", ".excalidraw.json"]
|
|
118
|
-
},
|
|
119
|
-
three: {
|
|
120
|
-
displayName: "Three.js 3D Viewport PCard",
|
|
121
|
-
description: "WebGL spatial geometry, meshes, and lighting environments",
|
|
122
|
-
mimes: [
|
|
123
|
-
"model/gltf-binary",
|
|
124
|
-
"model/gltf+json",
|
|
125
|
-
"model/obj",
|
|
126
|
-
"model/stl"
|
|
127
|
-
],
|
|
128
|
-
exts: [
|
|
129
|
-
".glb",
|
|
130
|
-
".gltf",
|
|
131
|
-
".obj",
|
|
132
|
-
".stl",
|
|
133
|
-
".3ds"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
tikz: {
|
|
137
|
-
displayName: "TikZ Categorical Vector PCard",
|
|
138
|
-
description: "High-fidelity commutative diagrams and LaTeX vector diagrams",
|
|
139
|
-
mimes: ["text/x-tikz", "text/x-tikzcd"],
|
|
140
|
-
exts: [
|
|
141
|
-
".tikz",
|
|
142
|
-
".tikzcd",
|
|
143
|
-
".tikz-cd"
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
table: {
|
|
147
|
-
displayName: "GFM Data Table PCard",
|
|
148
|
-
description: "Tabular record grids, sorting, filtering, and CSV evaluation",
|
|
149
|
-
mimes: ["text/csv", "text/tab-separated-values"],
|
|
150
|
-
exts: [".csv", ".tsv"]
|
|
151
|
-
}
|
|
152
|
-
};
|
|
197
|
+
const modalities = MODALITIES;
|
|
198
|
+
const specs = MODALITY_SPECS;
|
|
153
199
|
for (const mod of modalities) {
|
|
154
200
|
const s = specs[mod];
|
|
155
201
|
this.register({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { i as
|
|
2
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
3
3
|
import { a as notFound, r as json, t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
4
|
-
import { t as studioMCardFs } from "./
|
|
5
|
-
import "./
|
|
4
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
5
|
+
import "./mcardVfs_DvNburKb.mjs";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { ContentHash, parseTriadManifest, parseYamlOrJson, routeHandle } from "clm-kernel";
|
|
@@ -216,6 +216,11 @@ var RULES = [
|
|
|
216
216
|
match: (c) => c.mime === "text/html",
|
|
217
217
|
result: (c) => details("media", "document", "MCard", "HtmlViewer", c.mime)
|
|
218
218
|
},
|
|
219
|
+
{
|
|
220
|
+
id: "dxf",
|
|
221
|
+
match: (c) => c.mime === "image/vnd.dxf" || c.path.endsWith(".dxf"),
|
|
222
|
+
result: (c) => details("media", "document", "MCard", "DxfViewer", "image/vnd.dxf")
|
|
223
|
+
},
|
|
219
224
|
{
|
|
220
225
|
id: "image",
|
|
221
226
|
match: (c) => c.mime.startsWith("image/"),
|
|
@@ -298,6 +303,10 @@ function sniffMimeType(filePath) {
|
|
|
298
303
|
if (detected !== "application/octet-stream") return detected;
|
|
299
304
|
if (ext === "rs") return "text/rust";
|
|
300
305
|
if (ext === "sh") return "text/x-sh";
|
|
306
|
+
if (ext === "dxf") return "image/vnd.dxf";
|
|
307
|
+
if (ext === "webm") return "video/webm";
|
|
308
|
+
if (ext === "ogg") return "audio/ogg";
|
|
309
|
+
if (ext === "flac") return "audio/flac";
|
|
301
310
|
return "application/octet-stream";
|
|
302
311
|
}
|
|
303
312
|
/** Normalize a node into the (path, mime, text-content) triple the policy consumes. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as PATHS } from "./
|
|
3
|
-
import {
|
|
2
|
+
import { t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { r as json, t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
5
5
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
6
6
|
import { basename, join } from "node:path";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
+
import { t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
3
|
+
import { t as studioMCardFs } from "./vfsCore_DIKpk-pk.mjs";
|
|
4
|
+
import { ContentHash, ScopeAccessError, resolveIn } from "clm-kernel";
|
|
5
|
+
//#region src/pages/api/vfs/cas.ts
|
|
6
|
+
var cas_exports = /* @__PURE__ */ __exportAll({ GET: () => GET });
|
|
7
|
+
var GET = async ({ request, url }) => {
|
|
8
|
+
const hashParam = url.searchParams.get("hash")?.trim();
|
|
9
|
+
const scopeParam = url.searchParams.get("scope")?.trim();
|
|
10
|
+
const pathHint = url.searchParams.get("pathHint")?.trim() || url.searchParams.get("path")?.trim();
|
|
11
|
+
if (!hashParam) return error("Missing required query parameter: hash", 400);
|
|
12
|
+
if (!hashParam.includes(":")) return error("Parameter must be a qualified reference (<algo>:<hex>); bare digests are forbidden", 400);
|
|
13
|
+
const [algo, hex] = hashParam.split(":");
|
|
14
|
+
if (!algo || !hex || hex.length < 32) return error("Malformed qualified reference", 400);
|
|
15
|
+
const etag = `"${hashParam}"`;
|
|
16
|
+
const ifNoneMatch = request.headers.get("if-none-match")?.trim();
|
|
17
|
+
if (ifNoneMatch === etag || ifNoneMatch === hashParam) return new Response(null, {
|
|
18
|
+
status: 304,
|
|
19
|
+
headers: {
|
|
20
|
+
"ETag": etag,
|
|
21
|
+
"Cache-Control": "private, max-age=31536000, immutable"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
const backend = studioMCardFs.backend || studioMCardFs.storageBackend;
|
|
26
|
+
const archiveDir = studioMCardFs.archiveDir || process.env.CLM_ARCHIVE_DIR;
|
|
27
|
+
if (scopeParam) {
|
|
28
|
+
const scopeContext = {
|
|
29
|
+
roots: scopeParam.split(",").map((s) => s.trim()).filter(Boolean),
|
|
30
|
+
backend,
|
|
31
|
+
archiveDir
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
if (!resolveIn(scopeContext, hashParam, pathHint)) return error(`Access denied: hash '${hashParam}' is outside authorization scope`, 403);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err instanceof ScopeAccessError) return error(`Path hint escaping scope root rejected: ${err.message}`, 403);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let bytes;
|
|
41
|
+
if (backend && typeof backend.getRaw === "function") bytes = backend.getRaw(hashParam);
|
|
42
|
+
if (!bytes && backend && typeof backend.getRecord === "function") {
|
|
43
|
+
const rec = backend.getRecord(hashParam);
|
|
44
|
+
if (rec) bytes = rec.content;
|
|
45
|
+
}
|
|
46
|
+
if (!bytes && backend && typeof backend.get === "function") {
|
|
47
|
+
const card = backend.get(ContentHash.parse(hashParam));
|
|
48
|
+
if (card) bytes = typeof card.toPreimage === "function" ? card.toPreimage() : new TextEncoder().encode(JSON.stringify(card.toJSON ? card.toJSON() : card));
|
|
49
|
+
}
|
|
50
|
+
if (!bytes) return error(`Object not found for qualified hash ${hashParam}`, 404);
|
|
51
|
+
return new Response(bytes, {
|
|
52
|
+
status: 200,
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": "application/octet-stream",
|
|
55
|
+
"Content-Length": bytes.byteLength.toString(),
|
|
56
|
+
"ETag": etag,
|
|
57
|
+
"Cache-Control": "private, max-age=31536000, immutable"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
return error(err instanceof Error ? err.message : "Internal CAS retrieval error", 500);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region \0virtual:astro:page:src/pages/api/vfs/cas@_@ts
|
|
66
|
+
var page = () => cas_exports;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { page };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as PATHS } from "./
|
|
3
|
-
import { i as
|
|
2
|
+
import { t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
|
+
import { createRecord, qualify } from "clm-kernel";
|
|
6
7
|
import { atom } from "nanostores";
|
|
7
8
|
//#region src/stores/marking.ts
|
|
8
9
|
var marking = atom({ places: {} });
|
|
@@ -80,7 +81,7 @@ async function ensureKeyPair() {
|
|
|
80
81
|
keyPair = await crypto.subtle.generateKey({ name: "Ed25519" }, false, ["sign", "verify"]);
|
|
81
82
|
return keyPair;
|
|
82
83
|
}
|
|
83
|
-
async function computeHash(data) {
|
|
84
|
+
async function computeHash$1(data) {
|
|
84
85
|
const encoder = new TextEncoder();
|
|
85
86
|
const digest = await crypto.subtle.digest("SHA-256", encoder.encode(data));
|
|
86
87
|
return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -93,7 +94,7 @@ async function signVCard(params) {
|
|
|
93
94
|
sponsorDid: params.sponsorDid,
|
|
94
95
|
markingTransition: params.markingTransition
|
|
95
96
|
});
|
|
96
|
-
const payloadHash = await computeHash(payload);
|
|
97
|
+
const payloadHash = await computeHash$1(payload);
|
|
97
98
|
const encoder = new TextEncoder();
|
|
98
99
|
const signature = await crypto.subtle.sign("Ed25519", kp.privateKey, encoder.encode(payload));
|
|
99
100
|
const sigHex = Array.from(new Uint8Array(signature)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -103,7 +104,7 @@ async function signVCard(params) {
|
|
|
103
104
|
signature: sigHex,
|
|
104
105
|
sponsorDid: params.sponsorDid,
|
|
105
106
|
firedBy: "browser",
|
|
106
|
-
parentMarkingHash: await computeHash(JSON.stringify(params.markingTransition.before))
|
|
107
|
+
parentMarkingHash: await computeHash$1(JSON.stringify(params.markingTransition.before))
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
//#endregion
|
|
@@ -247,7 +248,7 @@ var POST = async ({ request }) => {
|
|
|
247
248
|
}
|
|
248
249
|
} catch {}
|
|
249
250
|
const pcard = {
|
|
250
|
-
hash:
|
|
251
|
+
hash: qualify(createRecord(action.pcardHandle)).asPrefixed(),
|
|
251
252
|
runtime,
|
|
252
253
|
concrete_impl: { runtime }
|
|
253
254
|
};
|
|
@@ -257,7 +258,7 @@ var POST = async ({ request }) => {
|
|
|
257
258
|
} catch {
|
|
258
259
|
const sealedVCard = await signVCard({
|
|
259
260
|
pcardHash: pcard.hash,
|
|
260
|
-
outputMCardHash:
|
|
261
|
+
outputMCardHash: qualify(createRecord(action.intent || "default-intent")).asPrefixed(),
|
|
261
262
|
sponsorDid: action.sponsorDid || "did:clm:agent:server",
|
|
262
263
|
markingTransition: {
|
|
263
264
|
before: action.currentMarking ?? {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { createRecord, qualify } from "clm-kernel";
|
|
3
3
|
//#region src/server/api/kernelDispatch.ts
|
|
4
4
|
async function handleKernelDispatch(intent, headers) {
|
|
5
5
|
if (headers.get("x-requested-with") !== "MCardStudio-BFF") return {
|
|
@@ -13,19 +13,19 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
13
13
|
switch (intent.kind) {
|
|
14
14
|
case "TouchMCard": {
|
|
15
15
|
const content = intent.payload && intent.payload.content || "";
|
|
16
|
-
const hash =
|
|
16
|
+
const hash = qualify(createRecord(content)).asPrefixed();
|
|
17
17
|
return {
|
|
18
18
|
status: 200,
|
|
19
19
|
body: { events: [{
|
|
20
20
|
kind: "MCardTouched",
|
|
21
21
|
intentId: intent.id,
|
|
22
22
|
uri: intent.uri,
|
|
23
|
-
hash
|
|
23
|
+
hash
|
|
24
24
|
}] }
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
case "ReadMCard": {
|
|
28
|
-
const hash = intent.ref.kind === "hash" ? intent.ref.hash :
|
|
28
|
+
const hash = intent.ref.kind === "hash" ? intent.ref.hash : qualify(createRecord(intent.ref.handle)).asPrefixed();
|
|
29
29
|
return {
|
|
30
30
|
status: 200,
|
|
31
31
|
body: { events: [{
|
|
@@ -41,8 +41,8 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
41
41
|
body: { events: [{
|
|
42
42
|
kind: "ExecutionReceipt",
|
|
43
43
|
intentId: intent.id,
|
|
44
|
-
receiptHash:
|
|
45
|
-
outputHash:
|
|
44
|
+
receiptHash: qualify(createRecord(intent.pcardRef)).asPrefixed(),
|
|
45
|
+
outputHash: qualify(createRecord(intent.inputRef || "")).asPrefixed(),
|
|
46
46
|
fiberId: `fiber:${intent.id}`
|
|
47
47
|
}] }
|
|
48
48
|
};
|
|
@@ -52,7 +52,7 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
52
52
|
kind: "ContinuationResumed",
|
|
53
53
|
intentId: intent.id,
|
|
54
54
|
token: intent.token,
|
|
55
|
-
receiptHash:
|
|
55
|
+
receiptHash: qualify(createRecord(intent.token)).asPrefixed()
|
|
56
56
|
}] }
|
|
57
57
|
};
|
|
58
58
|
case "MembraneAction": return {
|
|
@@ -60,7 +60,7 @@ async function handleKernelDispatch(intent, headers) {
|
|
|
60
60
|
body: { events: [{
|
|
61
61
|
kind: "ActionApplied",
|
|
62
62
|
intentId: intent.id,
|
|
63
|
-
postHash:
|
|
63
|
+
postHash: qualify(createRecord(intent.action.type)).asPrefixed()
|
|
64
64
|
}] }
|
|
65
65
|
};
|
|
66
66
|
case "ObserveProcess": return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./
|
|
3
|
-
import { i as
|
|
2
|
+
import { n as getWhitelistedDirectoryProjections, t as PATHS } from "./pathsConfig_Dack-p2f.mjs";
|
|
3
|
+
import { i as repoRoot, o as workspaceRoot } from "./workspaceRoot_CRx3taID.mjs";
|
|
4
4
|
import { t as error } from "./apiUtils_B3BX89fM.mjs";
|
|
5
|
-
import { n as toTreeFiles, t as scanRoots } from "./
|
|
5
|
+
import { n as toTreeFiles, t as scanRoots } from "./vfsTreeScan_CRoCluPB.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime_8H4AJuhK.mjs";
|
|
2
|
-
import { t as getServerCordisContext } from "./
|
|
2
|
+
import { t as getServerCordisContext } from "./serverBootstrap_BDdSRIu5.mjs";
|
|
3
3
|
import { r as json } from "./apiUtils_B3BX89fM.mjs";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { execSync } from "node:child_process";
|