[{"data":1,"prerenderedAt":1361},["ShallowReactive",2],{"quirekit-doc:\u002Fclassic\u002Fmedia":3,"quirekit-source:classic\u002Fmedia\u002Fsession.ts":227,"mdc--k4zy2z-key":228},{"id":4,"title":5,"body":6,"description":215,"extension":216,"keywords":217,"locale":218,"meta":219,"navigation":220,"order":221,"path":222,"section":223,"seo":224,"stem":225,"__hash__":226},"docs\u002Fclassic\u002Fmedia.zh-CN.md","图片与持久媒体",{"type":7,"value":8,"toc":206},"minimark",[9,13,18,25,96,103,107,130,134,144,147,151,174,181,185,192,200,203],[10,11,12],"p",{},"正文 JSON 保存图片引用，图片字节由媒体服务管理。只下载 JSON，不能保证换浏览器后还看得到图片。默认内存媒体服务适合预览；正式产品需要自己的资源身份、存储和恢复流程。",[14,15,17],"h2",{"id":16},"_1-在创建实例前准备媒体服务","1. 在创建实例前准备媒体服务",[10,19,20,24],{},[21,22,23],"code",{},"media"," 是创建时服务，所有已挂载后端与文件服务共享它。各接口的用途如下：",[26,27,28,41],"table",{},[29,30,31],"thead",{},[32,33,34,38],"tr",{},[35,36,37],"th",{},"接口",[35,39,40],{},"职责",[42,43,44,58,68,86],"tbody",{},[32,45,46,52],{},[47,48,49],"td",{},[21,50,51],{},"sink.put(asset)",[47,53,54,55],{},"同步登记完整字节，返回 ",[21,56,57],{},"{ kind: 'asset', assetId }",[32,59,60,65],{},[47,61,62],{},[21,63,64],{},"resolver.resolve(reference)",[47,66,67],{},"根据引用取得字节，可同步或异步返回",[32,69,70,75],{},[47,71,72],{},[21,73,74],{},"registrar.register(asset)",[47,76,77,78,81,82,85],{},"返回 ",[21,79,80],{},"accept()"," \u002F ",[21,83,84],{},"rollback()"," lease，管理可能失败的插入",[32,87,88,93],{},[47,89,90],{},[21,91,92],{},"createAssetId(kind)",[47,94,95],{},"分配在资源库内长期唯一的 ID",[10,97,98,99,102],{},"不要把异步上传函数直接当作 ",[21,100,101],{},"sink.put()","。可先由应用下载资源，建立同步工作集；或者上传完成后在一次受保护的提交里登记与插入。",[14,104,106],{"id":105},"_2-建立可保存的工作集","2. 建立可保存的工作集",[10,108,109,110,113,114,117,118,121,122,125,126,129],{},"下面的例程复用 ",[21,111,112],{},"@quirekit\u002Fmedia"," 内存库，额外记录已接受的资源清单。",[21,115,116],{},"restored"," 来自应用读取的资源字节；",[21,119,120],{},"allocateId"," 使用服务器发放的全局唯一 ID，若在客户端生成 UUID，使用 ",[21,123,124],{},"uuid"," 的 ",[21,127,128],{},"v4","。",[131,132],"docs-recipe",{"name":133},"classic\u002Fmedia\u002Fsession",[10,135,136,137,129,140,143],{},"创建时传 ",[21,138,139],{},"media: session.media",[21,141,142],{},"snapshotAssets()"," 返回独立字节副本，供应用上传；它不是可直接塞进普通 JSON 的二进制编码。应用可把字节存入对象存储或 IndexedDB，并另存包含 assetId、内容类型和存储位置的清单。",[10,145,146],{},"已经接受的资源仍可能被撤销历史引用。例程保留它们，不根据当前可见图片立即删除；资源回收由文档与历史的保存策略决定。相同 assetId 不能重新指向不同字节。",[14,148,150],{"id":149},"_3-保存与恢复的顺序","3. 保存与恢复的顺序",[152,153,154,165,168,171],"ol",{},[155,156,157,158,161,162,129],"li",{},"捕获同一时点的 ",[21,159,160],{},"instance.getJSON()"," 与 ",[21,163,164],{},"session.snapshotAssets()",[155,166,167],{},"上传并确认本次正文所需资源；失败时保留未保存状态，不发布引用缺失资源的新版本。",[155,169,170],{},"提交正文版本及资源清单。版本冲突与原子发布由应用存储协议处理。",[155,172,173],{},"再次打开时，按清单取回字节，用原 assetId 创建工作集，然后创建 Classic 并传入正文和媒体服务。",[10,175,176,177,180],{},"普通 ",[21,178,179],{},"JSON.stringify(Uint8Array)"," 不会得到可直接恢复的媒体包；不要只保存浏览器 object URL。object URL 属于当前浏览器资源，不能作为文档的长期身份。",[14,182,184],{"id":183},"_4-docx-与失败清理","4. DOCX 与失败清理",[10,186,187,188,191],{},"官方 DOCX 服务解析时暂存新图片，只有导入仍有效、可以写入当前文档时才登记到 ",[21,189,190],{},"instance.media","；正文提交失败会回滚本次新 lease。提供 registrar 能让失败清理有明确所有者；只有 sink 的自定义实现需要自行处理部分登记失败后的清理。",[10,193,194,195,129],{},"导出时 resolver 必须能返回真实字节，图片在屏幕上显示成功不能替代导出验证。外链引用的抓取策略由应用显式决定；跨域、失效链接和离线访问都要验证。转换警告与失败处理见",[196,197,199],"a",{"href":198},"\u002Fclassic\u002Ffiles","保存与文件",[14,201,202],{"id":202},"验证一次完整生命周期",[10,204,205],{},"插入图片后保存，销毁实例，使用新工作集和保存内容重新创建，再导出 DOCX；图片应可解析且 assetId 保持不变。另外验证上传失败、取消导入、重复导入同一资源，以及删除图片后撤销。检查资源字节和正文结构，不只检查页面截图。",{"title":207,"searchDepth":208,"depth":208,"links":209},"",2,[210,211,212,213,214],{"id":16,"depth":208,"text":17},{"id":105,"depth":208,"text":106},{"id":149,"depth":208,"text":150},{"id":183,"depth":208,"text":184},{"id":202,"depth":208,"text":202},"把图片字节和规范引用一起保存，支持刷新恢复、撤销和 DOCX 导入导出。","md",null,"zh-CN",{},true,3,"\u002Fclassic\u002Fmedia","Classic 开发",{"title":5,"description":215},"classic\u002Fmedia.zh-CN","4xT7_rxUwSL5oleS1Ywweby6YPAM6mj8MjHFoTqzXQ0","import { createQuireMemoryMediaRepository, type QuireMediaAssetInput, type QuireAssetMediaReference } from \"@quirekit\u002Fmedia\";\nimport type { ClassicEditorMediaServices } from \"@quirekit\u002Fclassic-editor\";\n\n\u002F**\n * Builds the synchronous working set from bytes restored by the host before mounting.\n * @param restored - Assets fetched with the document's asset manifest.\n * @param allocateId - Host allocator of globally unique persistent IDs, such as server-issued IDs.\n * @returns Classic services and an accepted-asset snapshot for durable storage.\n *\u002F\nexport function createDocumentMedia(restored: readonly QuireMediaAssetInput[], allocateId: () => string) {\n  const repository = createQuireMemoryMediaRepository();\n  const references = new Map\u003Cstring, QuireAssetMediaReference>();\n  for (const asset of restored) { const reference = repository.put(asset); references.set(reference.assetId, reference); }\n  const media: ClassicEditorMediaServices = {\n    resolver: repository,\n    createAssetId: allocateId,\n    sink: {\n      \u002F** @param asset - Complete in-memory bytes. @returns Registered reference. *\u002F\n      put(asset) { const reference = repository.put(asset); references.set(reference.assetId, reference); return reference; },\n    },\n    registrar: {\n      \u002F** @param asset - Provisional authoring bytes. @returns Lease accepting only committed assets into the save manifest. *\u002F\n      register(asset) {\n        const lease = repository.register(asset);\n        return {\n          reference: lease.reference,\n          \u002F** @returns Whether this operation accepted the asset. *\u002F\n          accept() {\n            const accepted = lease.accept();\n            if (accepted) references.set(lease.reference.assetId, lease.reference);\n            return accepted;\n          },\n          \u002F** @returns Whether unaccepted new bytes were removed. *\u002F\n          rollback: () => lease.rollback(),\n        };\n      },\n    },\n  };\n  return {\n    media,\n    \u002F** @returns Owned byte copies, including assets retained for undo; not JSON strings or object URLs. *\u002F\n    snapshotAssets(): readonly QuireMediaAssetInput[] {\n      return [...references.values()].map(reference => {\n        const asset = repository.resolve(reference)!;\n        return { assetId: reference.assetId, kind: asset.kind, bytes: asset.bytes,\n          mimeType: asset.mimeType, fileName: asset.fileName, intrinsicSize: asset.intrinsicSize };\n      });\n    },\n  };\n}\n",{"data":229,"body":230},{},{"type":231,"children":232},"root",[233,1355],{"type":234,"tag":235,"props":236,"children":240},"element","pre",{"className":237,"code":238,"language":239,"meta":207,"style":207},"language-ts shiki shiki-themes github-light github-light github-dark","import { createQuireMemoryMediaRepository, type QuireMediaAssetInput, type QuireAssetMediaReference } from \"@quirekit\u002Fmedia\";\nimport type { ClassicEditorMediaServices } from \"@quirekit\u002Fclassic-editor\";\n\n\u002F**\n * Builds the synchronous working set from bytes restored by the host before mounting.\n * @param restored - Assets fetched with the document's asset manifest.\n * @param allocateId - Host allocator of globally unique persistent IDs, such as server-issued IDs.\n * @returns Classic services and an accepted-asset snapshot for durable storage.\n *\u002F\nexport function createDocumentMedia(restored: readonly QuireMediaAssetInput[], allocateId: () => string) {\n  const repository = createQuireMemoryMediaRepository();\n  const references = new Map\u003Cstring, QuireAssetMediaReference>();\n  for (const asset of restored) { const reference = repository.put(asset); references.set(reference.assetId, reference); }\n  const media: ClassicEditorMediaServices = {\n    resolver: repository,\n    createAssetId: allocateId,\n    sink: {\n      \u002F** @param asset - Complete in-memory bytes. @returns Registered reference. *\u002F\n      put(asset) { const reference = repository.put(asset); references.set(reference.assetId, reference); return reference; },\n    },\n    registrar: {\n      \u002F** @param asset - Provisional authoring bytes. @returns Lease accepting only committed assets into the save manifest. *\u002F\n      register(asset) {\n        const lease = repository.register(asset);\n        return {\n          reference: lease.reference,\n          \u002F** @returns Whether this operation accepted the asset. *\u002F\n          accept() {\n            const accepted = lease.accept();\n            if (accepted) references.set(lease.reference.assetId, lease.reference);\n            return accepted;\n          },\n          \u002F** @returns Whether unaccepted new bytes were removed. *\u002F\n          rollback: () => lease.rollback(),\n        };\n      },\n    },\n  };\n  return {\n    media,\n    \u002F** @returns Owned byte copies, including assets retained for undo; not JSON strings or object URLs. *\u002F\n    snapshotAssets(): readonly QuireMediaAssetInput[] {\n      return [...references.values()].map(reference => {\n        const asset = repository.resolve(reference)!;\n        return { assetId: reference.assetId, kind: asset.kind, bytes: asset.bytes,\n          mimeType: asset.mimeType, fileName: asset.fileName, intrinsicSize: asset.intrinsicSize };\n      });\n    },\n  };\n}\n\n","ts",[241],{"type":234,"tag":21,"props":242,"children":243},{"__ignoreMap":207},[244,298,328,336,346,355,379,401,419,428,507,536,588,660,691,700,709,718,749,815,824,833,863,884,916,929,938,956,970,1002,1025,1039,1048,1065,1097,1106,1115,1123,1132,1145,1154,1172,1203,1260,1299,1312,1321,1330,1338,1346],{"type":234,"tag":245,"props":246,"children":249},"span",{"class":247,"line":248},"line",1,[250,257,263,268,273,277,282,287,293],{"type":234,"tag":245,"props":251,"children":253},{"style":252},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[254],{"type":255,"value":256},"text","import",{"type":234,"tag":245,"props":258,"children":260},{"style":259},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[261],{"type":255,"value":262}," { createQuireMemoryMediaRepository, ",{"type":234,"tag":245,"props":264,"children":265},{"style":252},[266],{"type":255,"value":267},"type",{"type":234,"tag":245,"props":269,"children":270},{"style":259},[271],{"type":255,"value":272}," QuireMediaAssetInput, ",{"type":234,"tag":245,"props":274,"children":275},{"style":252},[276],{"type":255,"value":267},{"type":234,"tag":245,"props":278,"children":279},{"style":259},[280],{"type":255,"value":281}," QuireAssetMediaReference } ",{"type":234,"tag":245,"props":283,"children":284},{"style":252},[285],{"type":255,"value":286},"from",{"type":234,"tag":245,"props":288,"children":290},{"style":289},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[291],{"type":255,"value":292}," \"@quirekit\u002Fmedia\"",{"type":234,"tag":245,"props":294,"children":295},{"style":259},[296],{"type":255,"value":297},";\n",{"type":234,"tag":245,"props":299,"children":300},{"class":247,"line":208},[301,305,310,315,319,324],{"type":234,"tag":245,"props":302,"children":303},{"style":252},[304],{"type":255,"value":256},{"type":234,"tag":245,"props":306,"children":307},{"style":252},[308],{"type":255,"value":309}," type",{"type":234,"tag":245,"props":311,"children":312},{"style":259},[313],{"type":255,"value":314}," { ClassicEditorMediaServices } ",{"type":234,"tag":245,"props":316,"children":317},{"style":252},[318],{"type":255,"value":286},{"type":234,"tag":245,"props":320,"children":321},{"style":289},[322],{"type":255,"value":323}," \"@quirekit\u002Fclassic-editor\"",{"type":234,"tag":245,"props":325,"children":326},{"style":259},[327],{"type":255,"value":297},{"type":234,"tag":245,"props":329,"children":330},{"class":247,"line":221},[331],{"type":234,"tag":245,"props":332,"children":333},{"emptyLinePlaceholder":220},[334],{"type":255,"value":335},"\n",{"type":234,"tag":245,"props":337,"children":339},{"class":247,"line":338},4,[340],{"type":234,"tag":245,"props":341,"children":343},{"style":342},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[344],{"type":255,"value":345},"\u002F**\n",{"type":234,"tag":245,"props":347,"children":349},{"class":247,"line":348},5,[350],{"type":234,"tag":245,"props":351,"children":352},{"style":342},[353],{"type":255,"value":354}," * Builds the synchronous working set from bytes restored by the host before mounting.\n",{"type":234,"tag":245,"props":356,"children":358},{"class":247,"line":357},6,[359,364,369,374],{"type":234,"tag":245,"props":360,"children":361},{"style":342},[362],{"type":255,"value":363}," * ",{"type":234,"tag":245,"props":365,"children":366},{"style":252},[367],{"type":255,"value":368},"@param",{"type":234,"tag":245,"props":370,"children":371},{"style":259},[372],{"type":255,"value":373}," restored",{"type":234,"tag":245,"props":375,"children":376},{"style":342},[377],{"type":255,"value":378}," - Assets fetched with the document's asset manifest.\n",{"type":234,"tag":245,"props":380,"children":382},{"class":247,"line":381},7,[383,387,391,396],{"type":234,"tag":245,"props":384,"children":385},{"style":342},[386],{"type":255,"value":363},{"type":234,"tag":245,"props":388,"children":389},{"style":252},[390],{"type":255,"value":368},{"type":234,"tag":245,"props":392,"children":393},{"style":259},[394],{"type":255,"value":395}," allocateId",{"type":234,"tag":245,"props":397,"children":398},{"style":342},[399],{"type":255,"value":400}," - Host allocator of globally unique persistent IDs, such as server-issued IDs.\n",{"type":234,"tag":245,"props":402,"children":404},{"class":247,"line":403},8,[405,409,414],{"type":234,"tag":245,"props":406,"children":407},{"style":342},[408],{"type":255,"value":363},{"type":234,"tag":245,"props":410,"children":411},{"style":252},[412],{"type":255,"value":413},"@returns",{"type":234,"tag":245,"props":415,"children":416},{"style":342},[417],{"type":255,"value":418}," Classic services and an accepted-asset snapshot for durable storage.\n",{"type":234,"tag":245,"props":420,"children":422},{"class":247,"line":421},9,[423],{"type":234,"tag":245,"props":424,"children":425},{"style":342},[426],{"type":255,"value":427}," *\u002F\n",{"type":234,"tag":245,"props":429,"children":431},{"class":247,"line":430},10,[432,437,442,448,453,458,463,468,473,478,482,486,491,496,502],{"type":234,"tag":245,"props":433,"children":434},{"style":252},[435],{"type":255,"value":436},"export",{"type":234,"tag":245,"props":438,"children":439},{"style":252},[440],{"type":255,"value":441}," function",{"type":234,"tag":245,"props":443,"children":445},{"style":444},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[446],{"type":255,"value":447}," createDocumentMedia",{"type":234,"tag":245,"props":449,"children":450},{"style":259},[451],{"type":255,"value":452},"(",{"type":234,"tag":245,"props":454,"children":456},{"style":455},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[457],{"type":255,"value":116},{"type":234,"tag":245,"props":459,"children":460},{"style":252},[461],{"type":255,"value":462},":",{"type":234,"tag":245,"props":464,"children":465},{"style":252},[466],{"type":255,"value":467}," readonly",{"type":234,"tag":245,"props":469,"children":470},{"style":444},[471],{"type":255,"value":472}," QuireMediaAssetInput",{"type":234,"tag":245,"props":474,"children":475},{"style":259},[476],{"type":255,"value":477},"[], ",{"type":234,"tag":245,"props":479,"children":480},{"style":444},[481],{"type":255,"value":120},{"type":234,"tag":245,"props":483,"children":484},{"style":252},[485],{"type":255,"value":462},{"type":234,"tag":245,"props":487,"children":488},{"style":259},[489],{"type":255,"value":490}," () ",{"type":234,"tag":245,"props":492,"children":493},{"style":252},[494],{"type":255,"value":495},"=>",{"type":234,"tag":245,"props":497,"children":499},{"style":498},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[500],{"type":255,"value":501}," string",{"type":234,"tag":245,"props":503,"children":504},{"style":259},[505],{"type":255,"value":506},") {\n",{"type":234,"tag":245,"props":508,"children":510},{"class":247,"line":509},11,[511,516,521,526,531],{"type":234,"tag":245,"props":512,"children":513},{"style":252},[514],{"type":255,"value":515},"  const",{"type":234,"tag":245,"props":517,"children":518},{"style":498},[519],{"type":255,"value":520}," repository",{"type":234,"tag":245,"props":522,"children":523},{"style":252},[524],{"type":255,"value":525}," =",{"type":234,"tag":245,"props":527,"children":528},{"style":444},[529],{"type":255,"value":530}," createQuireMemoryMediaRepository",{"type":234,"tag":245,"props":532,"children":533},{"style":259},[534],{"type":255,"value":535},"();\n",{"type":234,"tag":245,"props":537,"children":539},{"class":247,"line":538},12,[540,544,549,553,558,563,568,573,578,583],{"type":234,"tag":245,"props":541,"children":542},{"style":252},[543],{"type":255,"value":515},{"type":234,"tag":245,"props":545,"children":546},{"style":498},[547],{"type":255,"value":548}," references",{"type":234,"tag":245,"props":550,"children":551},{"style":252},[552],{"type":255,"value":525},{"type":234,"tag":245,"props":554,"children":555},{"style":252},[556],{"type":255,"value":557}," new",{"type":234,"tag":245,"props":559,"children":560},{"style":444},[561],{"type":255,"value":562}," Map",{"type":234,"tag":245,"props":564,"children":565},{"style":259},[566],{"type":255,"value":567},"\u003C",{"type":234,"tag":245,"props":569,"children":570},{"style":498},[571],{"type":255,"value":572},"string",{"type":234,"tag":245,"props":574,"children":575},{"style":259},[576],{"type":255,"value":577},", ",{"type":234,"tag":245,"props":579,"children":580},{"style":444},[581],{"type":255,"value":582},"QuireAssetMediaReference",{"type":234,"tag":245,"props":584,"children":585},{"style":259},[586],{"type":255,"value":587},">();\n",{"type":234,"tag":245,"props":589,"children":591},{"class":247,"line":590},13,[592,597,602,607,612,617,622,626,631,635,640,645,650,655],{"type":234,"tag":245,"props":593,"children":594},{"style":252},[595],{"type":255,"value":596},"  for",{"type":234,"tag":245,"props":598,"children":599},{"style":259},[600],{"type":255,"value":601}," (",{"type":234,"tag":245,"props":603,"children":604},{"style":252},[605],{"type":255,"value":606},"const",{"type":234,"tag":245,"props":608,"children":609},{"style":498},[610],{"type":255,"value":611}," asset",{"type":234,"tag":245,"props":613,"children":614},{"style":252},[615],{"type":255,"value":616}," of",{"type":234,"tag":245,"props":618,"children":619},{"style":259},[620],{"type":255,"value":621}," restored) { ",{"type":234,"tag":245,"props":623,"children":624},{"style":252},[625],{"type":255,"value":606},{"type":234,"tag":245,"props":627,"children":628},{"style":498},[629],{"type":255,"value":630}," reference",{"type":234,"tag":245,"props":632,"children":633},{"style":252},[634],{"type":255,"value":525},{"type":234,"tag":245,"props":636,"children":637},{"style":259},[638],{"type":255,"value":639}," repository.",{"type":234,"tag":245,"props":641,"children":642},{"style":444},[643],{"type":255,"value":644},"put",{"type":234,"tag":245,"props":646,"children":647},{"style":259},[648],{"type":255,"value":649},"(asset); references.",{"type":234,"tag":245,"props":651,"children":652},{"style":444},[653],{"type":255,"value":654},"set",{"type":234,"tag":245,"props":656,"children":657},{"style":259},[658],{"type":255,"value":659},"(reference.assetId, reference); }\n",{"type":234,"tag":245,"props":661,"children":663},{"class":247,"line":662},14,[664,668,673,677,682,686],{"type":234,"tag":245,"props":665,"children":666},{"style":252},[667],{"type":255,"value":515},{"type":234,"tag":245,"props":669,"children":670},{"style":498},[671],{"type":255,"value":672}," media",{"type":234,"tag":245,"props":674,"children":675},{"style":252},[676],{"type":255,"value":462},{"type":234,"tag":245,"props":678,"children":679},{"style":444},[680],{"type":255,"value":681}," ClassicEditorMediaServices",{"type":234,"tag":245,"props":683,"children":684},{"style":252},[685],{"type":255,"value":525},{"type":234,"tag":245,"props":687,"children":688},{"style":259},[689],{"type":255,"value":690}," {\n",{"type":234,"tag":245,"props":692,"children":694},{"class":247,"line":693},15,[695],{"type":234,"tag":245,"props":696,"children":697},{"style":259},[698],{"type":255,"value":699},"    resolver: repository,\n",{"type":234,"tag":245,"props":701,"children":703},{"class":247,"line":702},16,[704],{"type":234,"tag":245,"props":705,"children":706},{"style":259},[707],{"type":255,"value":708},"    createAssetId: allocateId,\n",{"type":234,"tag":245,"props":710,"children":712},{"class":247,"line":711},17,[713],{"type":234,"tag":245,"props":714,"children":715},{"style":259},[716],{"type":255,"value":717},"    sink: {\n",{"type":234,"tag":245,"props":719,"children":721},{"class":247,"line":720},18,[722,727,731,735,740,744],{"type":234,"tag":245,"props":723,"children":724},{"style":342},[725],{"type":255,"value":726},"      \u002F** ",{"type":234,"tag":245,"props":728,"children":729},{"style":252},[730],{"type":255,"value":368},{"type":234,"tag":245,"props":732,"children":733},{"style":259},[734],{"type":255,"value":611},{"type":234,"tag":245,"props":736,"children":737},{"style":342},[738],{"type":255,"value":739}," - Complete in-memory bytes. ",{"type":234,"tag":245,"props":741,"children":742},{"style":252},[743],{"type":255,"value":413},{"type":234,"tag":245,"props":745,"children":746},{"style":342},[747],{"type":255,"value":748}," Registered reference. *\u002F\n",{"type":234,"tag":245,"props":750,"children":752},{"class":247,"line":751},19,[753,758,762,767,772,776,780,784,788,792,796,800,805,810],{"type":234,"tag":245,"props":754,"children":755},{"style":444},[756],{"type":255,"value":757},"      put",{"type":234,"tag":245,"props":759,"children":760},{"style":259},[761],{"type":255,"value":452},{"type":234,"tag":245,"props":763,"children":764},{"style":455},[765],{"type":255,"value":766},"asset",{"type":234,"tag":245,"props":768,"children":769},{"style":259},[770],{"type":255,"value":771},") { ",{"type":234,"tag":245,"props":773,"children":774},{"style":252},[775],{"type":255,"value":606},{"type":234,"tag":245,"props":777,"children":778},{"style":498},[779],{"type":255,"value":630},{"type":234,"tag":245,"props":781,"children":782},{"style":252},[783],{"type":255,"value":525},{"type":234,"tag":245,"props":785,"children":786},{"style":259},[787],{"type":255,"value":639},{"type":234,"tag":245,"props":789,"children":790},{"style":444},[791],{"type":255,"value":644},{"type":234,"tag":245,"props":793,"children":794},{"style":259},[795],{"type":255,"value":649},{"type":234,"tag":245,"props":797,"children":798},{"style":444},[799],{"type":255,"value":654},{"type":234,"tag":245,"props":801,"children":802},{"style":259},[803],{"type":255,"value":804},"(reference.assetId, reference); ",{"type":234,"tag":245,"props":806,"children":807},{"style":252},[808],{"type":255,"value":809},"return",{"type":234,"tag":245,"props":811,"children":812},{"style":259},[813],{"type":255,"value":814}," reference; },\n",{"type":234,"tag":245,"props":816,"children":818},{"class":247,"line":817},20,[819],{"type":234,"tag":245,"props":820,"children":821},{"style":259},[822],{"type":255,"value":823},"    },\n",{"type":234,"tag":245,"props":825,"children":827},{"class":247,"line":826},21,[828],{"type":234,"tag":245,"props":829,"children":830},{"style":259},[831],{"type":255,"value":832},"    registrar: {\n",{"type":234,"tag":245,"props":834,"children":836},{"class":247,"line":835},22,[837,841,845,849,854,858],{"type":234,"tag":245,"props":838,"children":839},{"style":342},[840],{"type":255,"value":726},{"type":234,"tag":245,"props":842,"children":843},{"style":252},[844],{"type":255,"value":368},{"type":234,"tag":245,"props":846,"children":847},{"style":259},[848],{"type":255,"value":611},{"type":234,"tag":245,"props":850,"children":851},{"style":342},[852],{"type":255,"value":853}," - Provisional authoring bytes. ",{"type":234,"tag":245,"props":855,"children":856},{"style":252},[857],{"type":255,"value":413},{"type":234,"tag":245,"props":859,"children":860},{"style":342},[861],{"type":255,"value":862}," Lease accepting only committed assets into the save manifest. *\u002F\n",{"type":234,"tag":245,"props":864,"children":866},{"class":247,"line":865},23,[867,872,876,880],{"type":234,"tag":245,"props":868,"children":869},{"style":444},[870],{"type":255,"value":871},"      register",{"type":234,"tag":245,"props":873,"children":874},{"style":259},[875],{"type":255,"value":452},{"type":234,"tag":245,"props":877,"children":878},{"style":455},[879],{"type":255,"value":766},{"type":234,"tag":245,"props":881,"children":882},{"style":259},[883],{"type":255,"value":506},{"type":234,"tag":245,"props":885,"children":887},{"class":247,"line":886},24,[888,893,898,902,906,911],{"type":234,"tag":245,"props":889,"children":890},{"style":252},[891],{"type":255,"value":892},"        const",{"type":234,"tag":245,"props":894,"children":895},{"style":498},[896],{"type":255,"value":897}," lease",{"type":234,"tag":245,"props":899,"children":900},{"style":252},[901],{"type":255,"value":525},{"type":234,"tag":245,"props":903,"children":904},{"style":259},[905],{"type":255,"value":639},{"type":234,"tag":245,"props":907,"children":908},{"style":444},[909],{"type":255,"value":910},"register",{"type":234,"tag":245,"props":912,"children":913},{"style":259},[914],{"type":255,"value":915},"(asset);\n",{"type":234,"tag":245,"props":917,"children":919},{"class":247,"line":918},25,[920,925],{"type":234,"tag":245,"props":921,"children":922},{"style":252},[923],{"type":255,"value":924},"        return",{"type":234,"tag":245,"props":926,"children":927},{"style":259},[928],{"type":255,"value":690},{"type":234,"tag":245,"props":930,"children":932},{"class":247,"line":931},26,[933],{"type":234,"tag":245,"props":934,"children":935},{"style":259},[936],{"type":255,"value":937},"          reference: lease.reference,\n",{"type":234,"tag":245,"props":939,"children":941},{"class":247,"line":940},27,[942,947,951],{"type":234,"tag":245,"props":943,"children":944},{"style":342},[945],{"type":255,"value":946},"          \u002F** ",{"type":234,"tag":245,"props":948,"children":949},{"style":252},[950],{"type":255,"value":413},{"type":234,"tag":245,"props":952,"children":953},{"style":342},[954],{"type":255,"value":955}," Whether this operation accepted the asset. *\u002F\n",{"type":234,"tag":245,"props":957,"children":959},{"class":247,"line":958},28,[960,965],{"type":234,"tag":245,"props":961,"children":962},{"style":444},[963],{"type":255,"value":964},"          accept",{"type":234,"tag":245,"props":966,"children":967},{"style":259},[968],{"type":255,"value":969},"() {\n",{"type":234,"tag":245,"props":971,"children":973},{"class":247,"line":972},29,[974,979,984,988,993,998],{"type":234,"tag":245,"props":975,"children":976},{"style":252},[977],{"type":255,"value":978},"            const",{"type":234,"tag":245,"props":980,"children":981},{"style":498},[982],{"type":255,"value":983}," accepted",{"type":234,"tag":245,"props":985,"children":986},{"style":252},[987],{"type":255,"value":525},{"type":234,"tag":245,"props":989,"children":990},{"style":259},[991],{"type":255,"value":992}," lease.",{"type":234,"tag":245,"props":994,"children":995},{"style":444},[996],{"type":255,"value":997},"accept",{"type":234,"tag":245,"props":999,"children":1000},{"style":259},[1001],{"type":255,"value":535},{"type":234,"tag":245,"props":1003,"children":1005},{"class":247,"line":1004},30,[1006,1011,1016,1020],{"type":234,"tag":245,"props":1007,"children":1008},{"style":252},[1009],{"type":255,"value":1010},"            if",{"type":234,"tag":245,"props":1012,"children":1013},{"style":259},[1014],{"type":255,"value":1015}," (accepted) references.",{"type":234,"tag":245,"props":1017,"children":1018},{"style":444},[1019],{"type":255,"value":654},{"type":234,"tag":245,"props":1021,"children":1022},{"style":259},[1023],{"type":255,"value":1024},"(lease.reference.assetId, lease.reference);\n",{"type":234,"tag":245,"props":1026,"children":1028},{"class":247,"line":1027},31,[1029,1034],{"type":234,"tag":245,"props":1030,"children":1031},{"style":252},[1032],{"type":255,"value":1033},"            return",{"type":234,"tag":245,"props":1035,"children":1036},{"style":259},[1037],{"type":255,"value":1038}," accepted;\n",{"type":234,"tag":245,"props":1040,"children":1042},{"class":247,"line":1041},32,[1043],{"type":234,"tag":245,"props":1044,"children":1045},{"style":259},[1046],{"type":255,"value":1047},"          },\n",{"type":234,"tag":245,"props":1049,"children":1051},{"class":247,"line":1050},33,[1052,1056,1060],{"type":234,"tag":245,"props":1053,"children":1054},{"style":342},[1055],{"type":255,"value":946},{"type":234,"tag":245,"props":1057,"children":1058},{"style":252},[1059],{"type":255,"value":413},{"type":234,"tag":245,"props":1061,"children":1062},{"style":342},[1063],{"type":255,"value":1064}," Whether unaccepted new bytes were removed. *\u002F\n",{"type":234,"tag":245,"props":1066,"children":1068},{"class":247,"line":1067},34,[1069,1074,1079,1083,1087,1092],{"type":234,"tag":245,"props":1070,"children":1071},{"style":444},[1072],{"type":255,"value":1073},"          rollback",{"type":234,"tag":245,"props":1075,"children":1076},{"style":259},[1077],{"type":255,"value":1078},": () ",{"type":234,"tag":245,"props":1080,"children":1081},{"style":252},[1082],{"type":255,"value":495},{"type":234,"tag":245,"props":1084,"children":1085},{"style":259},[1086],{"type":255,"value":992},{"type":234,"tag":245,"props":1088,"children":1089},{"style":444},[1090],{"type":255,"value":1091},"rollback",{"type":234,"tag":245,"props":1093,"children":1094},{"style":259},[1095],{"type":255,"value":1096},"(),\n",{"type":234,"tag":245,"props":1098,"children":1100},{"class":247,"line":1099},35,[1101],{"type":234,"tag":245,"props":1102,"children":1103},{"style":259},[1104],{"type":255,"value":1105},"        };\n",{"type":234,"tag":245,"props":1107,"children":1109},{"class":247,"line":1108},36,[1110],{"type":234,"tag":245,"props":1111,"children":1112},{"style":259},[1113],{"type":255,"value":1114},"      },\n",{"type":234,"tag":245,"props":1116,"children":1118},{"class":247,"line":1117},37,[1119],{"type":234,"tag":245,"props":1120,"children":1121},{"style":259},[1122],{"type":255,"value":823},{"type":234,"tag":245,"props":1124,"children":1126},{"class":247,"line":1125},38,[1127],{"type":234,"tag":245,"props":1128,"children":1129},{"style":259},[1130],{"type":255,"value":1131},"  };\n",{"type":234,"tag":245,"props":1133,"children":1135},{"class":247,"line":1134},39,[1136,1141],{"type":234,"tag":245,"props":1137,"children":1138},{"style":252},[1139],{"type":255,"value":1140},"  return",{"type":234,"tag":245,"props":1142,"children":1143},{"style":259},[1144],{"type":255,"value":690},{"type":234,"tag":245,"props":1146,"children":1148},{"class":247,"line":1147},40,[1149],{"type":234,"tag":245,"props":1150,"children":1151},{"style":259},[1152],{"type":255,"value":1153},"    media,\n",{"type":234,"tag":245,"props":1155,"children":1157},{"class":247,"line":1156},41,[1158,1163,1167],{"type":234,"tag":245,"props":1159,"children":1160},{"style":342},[1161],{"type":255,"value":1162},"    \u002F** ",{"type":234,"tag":245,"props":1164,"children":1165},{"style":252},[1166],{"type":255,"value":413},{"type":234,"tag":245,"props":1168,"children":1169},{"style":342},[1170],{"type":255,"value":1171}," Owned byte copies, including assets retained for undo; not JSON strings or object URLs. *\u002F\n",{"type":234,"tag":245,"props":1173,"children":1175},{"class":247,"line":1174},42,[1176,1181,1186,1190,1194,1198],{"type":234,"tag":245,"props":1177,"children":1178},{"style":444},[1179],{"type":255,"value":1180},"    snapshotAssets",{"type":234,"tag":245,"props":1182,"children":1183},{"style":259},[1184],{"type":255,"value":1185},"()",{"type":234,"tag":245,"props":1187,"children":1188},{"style":252},[1189],{"type":255,"value":462},{"type":234,"tag":245,"props":1191,"children":1192},{"style":252},[1193],{"type":255,"value":467},{"type":234,"tag":245,"props":1195,"children":1196},{"style":444},[1197],{"type":255,"value":472},{"type":234,"tag":245,"props":1199,"children":1200},{"style":259},[1201],{"type":255,"value":1202},"[] {\n",{"type":234,"tag":245,"props":1204,"children":1206},{"class":247,"line":1205},43,[1207,1212,1217,1222,1227,1232,1237,1242,1246,1251,1256],{"type":234,"tag":245,"props":1208,"children":1209},{"style":252},[1210],{"type":255,"value":1211},"      return",{"type":234,"tag":245,"props":1213,"children":1214},{"style":259},[1215],{"type":255,"value":1216}," [",{"type":234,"tag":245,"props":1218,"children":1219},{"style":252},[1220],{"type":255,"value":1221},"...",{"type":234,"tag":245,"props":1223,"children":1224},{"style":259},[1225],{"type":255,"value":1226},"references.",{"type":234,"tag":245,"props":1228,"children":1229},{"style":444},[1230],{"type":255,"value":1231},"values",{"type":234,"tag":245,"props":1233,"children":1234},{"style":259},[1235],{"type":255,"value":1236},"()].",{"type":234,"tag":245,"props":1238,"children":1239},{"style":444},[1240],{"type":255,"value":1241},"map",{"type":234,"tag":245,"props":1243,"children":1244},{"style":259},[1245],{"type":255,"value":452},{"type":234,"tag":245,"props":1247,"children":1248},{"style":455},[1249],{"type":255,"value":1250},"reference",{"type":234,"tag":245,"props":1252,"children":1253},{"style":252},[1254],{"type":255,"value":1255}," =>",{"type":234,"tag":245,"props":1257,"children":1258},{"style":259},[1259],{"type":255,"value":690},{"type":234,"tag":245,"props":1261,"children":1263},{"class":247,"line":1262},44,[1264,1268,1272,1276,1280,1285,1290,1295],{"type":234,"tag":245,"props":1265,"children":1266},{"style":252},[1267],{"type":255,"value":892},{"type":234,"tag":245,"props":1269,"children":1270},{"style":498},[1271],{"type":255,"value":611},{"type":234,"tag":245,"props":1273,"children":1274},{"style":252},[1275],{"type":255,"value":525},{"type":234,"tag":245,"props":1277,"children":1278},{"style":259},[1279],{"type":255,"value":639},{"type":234,"tag":245,"props":1281,"children":1282},{"style":444},[1283],{"type":255,"value":1284},"resolve",{"type":234,"tag":245,"props":1286,"children":1287},{"style":259},[1288],{"type":255,"value":1289},"(reference)",{"type":234,"tag":245,"props":1291,"children":1292},{"style":252},[1293],{"type":255,"value":1294},"!",{"type":234,"tag":245,"props":1296,"children":1297},{"style":259},[1298],{"type":255,"value":297},{"type":234,"tag":245,"props":1300,"children":1302},{"class":247,"line":1301},45,[1303,1307],{"type":234,"tag":245,"props":1304,"children":1305},{"style":252},[1306],{"type":255,"value":924},{"type":234,"tag":245,"props":1308,"children":1309},{"style":259},[1310],{"type":255,"value":1311}," { assetId: reference.assetId, kind: asset.kind, bytes: asset.bytes,\n",{"type":234,"tag":245,"props":1313,"children":1315},{"class":247,"line":1314},46,[1316],{"type":234,"tag":245,"props":1317,"children":1318},{"style":259},[1319],{"type":255,"value":1320},"          mimeType: asset.mimeType, fileName: asset.fileName, intrinsicSize: asset.intrinsicSize };\n",{"type":234,"tag":245,"props":1322,"children":1324},{"class":247,"line":1323},47,[1325],{"type":234,"tag":245,"props":1326,"children":1327},{"style":259},[1328],{"type":255,"value":1329},"      });\n",{"type":234,"tag":245,"props":1331,"children":1333},{"class":247,"line":1332},48,[1334],{"type":234,"tag":245,"props":1335,"children":1336},{"style":259},[1337],{"type":255,"value":823},{"type":234,"tag":245,"props":1339,"children":1341},{"class":247,"line":1340},49,[1342],{"type":234,"tag":245,"props":1343,"children":1344},{"style":259},[1345],{"type":255,"value":1131},{"type":234,"tag":245,"props":1347,"children":1349},{"class":247,"line":1348},50,[1350],{"type":234,"tag":245,"props":1351,"children":1352},{"style":259},[1353],{"type":255,"value":1354},"}\n",{"type":234,"tag":1356,"props":1357,"children":1358},"style",{},[1359],{"type":255,"value":1360},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",1793045224557]