vis-core 0.33.16 → 0.33.18

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.
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n as r,r as s,t as i}from"./sha2-DroCzeNH.js";function n(e,t){if(null==e)return{};var r,s,i=function(e,t){if(null==e)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;r[s]=e[s]}return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var a,o,l,c=new class{constructor(t=32,r=67108864){e(this,"pending",/* @__PURE__ */new Map),e(this,"values",/* @__PURE__ */new Map),e(this,"bytes",0),e(this,"maxEntries",void 0),e(this,"maxBytes",void 0),this.maxEntries=t,this.maxBytes=r}load(e,t){const r=this.values.get(e);if(r)return this.values.delete(e),this.values.set(e,r),Promise.resolve(r);const s=this.pending.get(e);if(s)return s;const i=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===i&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===i&&this.pending.delete(e),t});return this.pending.set(e,i),i}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},d=e=>!!/\.(gzip|gz)(?:[?#]|$)/i.test(e),u=(a=s(function*(e,t,r=d){const s=yield window.fetch(e);if(!s.ok){try{var i;yield null===(i=s.body)||void 0===i?void 0:i.cancel()}catch(l){}throw new Error("Network response was not ok.")}let n=s;if(t)try{n=((e,t)=>{const r=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:r})},transform(e,i){s+=e.byteLength,t({percent:0===r?0:s/r,transferredBytes:s,totalBytes:r}),i.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:r})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:r,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(n,t)}catch(c){try{var a;yield null===(a=s.body)||void 0===a?void 0:a.cancel(c)}catch(u){}throw c}if(r(e)&&"gzip"!==n.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=n.body.pipeThrough(e);n=new Response(t)}const o=yield n.text();return{json:JSON.parse(o),bytes:2*o.length}}),function(e,t){return a.apply(this,arguments)}),p=(o=s(function*(e,t,r=d,s){try{var i,n;const a=null!==(i=null==s||null===(n=s.resolveURL)||void 0===n?void 0:n.call(s,e))&&void 0!==i?i:e,o=((e,t)=>{const r=null==t?void 0:t.cache;if(!1===r)return{enabled:!1,key:e,clone:!1};if(!0===r)return{enabled:!0,key:e,clone:!0};if(r&&"object"==typeof r){var s,i,n;const t=null===(s=r.enabled)||void 0===s||s;return{enabled:t,key:null!==(i=r.key)&&void 0!==i?i:e,clone:!!t&&(null===(n=r.clone)||void 0===n||n)}}return{enabled:!1,key:e,clone:!1}})(a,s),l=()=>u(a,t,()=>r(e)),d=(yield o.enabled?c.load(o.key,l):l()).json;return{res:o.enabled&&o.clone?structuredClone(d):d,err:void 0}}catch(a){return{res:void 0,err:a}}}),function(e,t){return o.apply(this,arguments)}),f=/^(?:[a-z]+:)?\/\//i,h=(l=s(function*(e,t){const{res:r,err:s}=yield p(((e,t="")=>f.test(e)?e:`${t.endsWith("/")?t.slice(0,-1):t}${e.startsWith("/")?e:`/${e}`}`)(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return r}),function(e,t){return l.apply(this,arguments)}),y=e=>"string"==typeof e&&!!e&&!/[:\\?#\0]/.test(e)&&!e.split("/").some(e=>!e||"."===e||".."===e);function m(e,t,r){var s,i;if(!(null==e?void 0:e.mapNavigation))return;if("static"===e.mapNavigation.mode)throw Error("此作品为固定场景展示,不支持运行时区域切换或重建。请以动态模式重新导出。");const n=void 0===r?Object.values(null!==(s=e.regions)&&void 0!==s?s:{}).flat():null===(i=e.regions)||void 0===i?void 0:i[r];if(void 0!==r&&!Object.values(e.mapNavigation.templates).includes(r)||!(null==n?void 0:n.includes(t)))throw Error(`区域 ${t} 或场景模板不在动态导出范围内,请调整范围和模板后重新导出。`)}function g(e){if(void 0===e)return;const t=e;if(!t||1!==t.version||!Array.isArray(t.entries))throw Error("Invalid runtime asset catalog");const r=/* @__PURE__ */new Set,s=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const o of t.entries){var n;if(!o||"string"!=typeof o.id||!o.id||r.has(o.id)||!y(o.path)||s.has(o.path)||!Array.isArray(o.sources)||!o.sources.length||o.sources.some(e=>"string"!=typeof e||!e||i.has(e))||new Set(o.sources).size!==o.sources.length||"string"!=typeof o.mimeType||!/^[\w.+-]+\/[\w.+-]+$/.test(o.mimeType)||!["identity","gzip"].includes(o.encoding)||!Number.isSafeInteger(o.bytes)||o.bytes<0||!/^[a-f0-9]{64}$/.test(o.sha256)||void 0!==o.data&&!(o.data instanceof ArrayBuffer))throw Error(`Invalid runtime asset: ${null!==(n=null==o?void 0:o.path)&&void 0!==n?n:"unknown"}`);r.add(o.id),s.add(o.path),o.sources.forEach(e=>i.add(e))}if(t.scope&&(!Number.isInteger(t.scope.rootAdcode)||t.scope.rootAdcode<0||!["province","city","district"].includes(t.scope.maxLevel)))throw Error("Invalid map export scope");const a=t.mapNavigation;if(void 0!==a){if(!a||!["static","dynamic"].includes(a.mode))throw Error("Invalid map navigation mode");if("dynamic"===a.mode&&(!a.scope||!Number.isInteger(a.scope.rootAdcode)||a.scope.rootAdcode<0||!["province","city","district"].includes(a.scope.maxLevel)||!a.templates||"object"!=typeof a.templates||Array.isArray(a.templates)||Object.entries(a.templates).some(([e,t])=>!["province","city","district"].includes(e)||"string"!=typeof t||!t.trim())))throw Error("Invalid map navigation templates or scope")}if(t.regions&&("object"!=typeof t.regions||Array.isArray(t.regions)||Object.values(t.regions).some(e=>!Array.isArray(e)||e.some(e=>!Number.isInteger(e)||e<0))))throw Error("Invalid runtime region catalog");if(void 0!==t.declaredSources&&(!Array.isArray(t.declaredSources)||t.declaredSources.some(e=>"string"!=typeof e||!e.trim())))throw Error("Invalid declared asset sources");if(void 0!==t.externalSources&&(!Array.isArray(t.externalSources)||t.externalSources.some(e=>"string"!=typeof e||!e.trim()||/[{}\0]/.test(e)||/^(?:data:|blob:|asset:)/i.test(e)||i.has(e))||new Set(t.externalSources).size!==t.externalSources.length))throw Error("Invalid external asset sources");if(void 0!==t.mapDataMode&&!["bundled","external"].includes(t.mapDataMode))throw Error("Invalid map data mode");if(void 0!==t.mapSwitchKey&&("string"!=typeof t.mapSwitchKey||!t.mapSwitchKey.trim()))throw Error("Invalid bundled map switch key");if(void 0!==t.projectId&&("string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64))throw Error("Invalid runtime asset project")}function v(e){const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function w(e){return e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function b(e){return A.apply(this,arguments)}function A(){return A=s(function*(e){const t=yield crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,"0")).join("")}),A.apply(this,arguments)}function x(e,t){return E.apply(this,arguments)}function E(){return(E=s(function*(e,t){if(t.length!==e.bytes||(yield b(t))!==e.sha256)throw Error(`资源校验失败:${e.path}`)})).apply(this,arguments)}function S(e,r){var s,i,n,a;if(!r)return e;if(!e)return structuredClone(r);const o=structuredClone(e),l=new Map(o.entries.map(e=>[e.id,e])),c=new Map(o.entries.flatMap(e=>e.sources.map(t=>[t,e.sha256])));for(const t of r.entries){for(const r of t.sources)if(c.has(r)&&c.get(r)!==t.sha256)throw Error(`资源地址存在不同内容:${r}。请修改资源地址或使用“打开项目”导入。`);const e=l.get(t.id);if(e)e.sources=[.../* @__PURE__ */new Set([...e.sources,...t.sources])];else{const e=structuredClone(t);o.entries.push(e),l.set(e.id,e)}for(const r of t.sources)c.set(r,t.sha256)}o.regions=t(t({},e.regions),r.regions),o.declaredSources=[.../* @__PURE__ */new Set([...null!==(s=e.declaredSources)&&void 0!==s?s:[],...null!==(i=r.declaredSources)&&void 0!==i?i:[]])];const d=[.../* @__PURE__ */new Set([...null!==(n=e.externalSources)&&void 0!==n?n:[],...null!==(a=r.externalSources)&&void 0!==a?a:[]])].filter(e=>!c.has(e));return d.length?o.externalSources=d:delete o.externalSources,g(o),o}var I=class{constructor(t,s="",n=!0){var a;e(this,"sources",/* @__PURE__ */new Map),e(this,"resolved",/* @__PURE__ */new Map),e(this,"externals",/* @__PURE__ */new Map),e(this,"catalog",void 0),e(this,"strict",void 0),e(this,"resolve",e=>{if(/^(data:|blob:)/i.test(e))return e;const t=this.sources.get(e);if(!t){const t=this.externals.get(e);if(void 0!==t)return t;if(!this.strict)return e;throw Error(`资源包未包含:${e}。请扩大导出范围或补充资源后重新导出。`)}let s=this.resolved.get(t.id);if(!s){if(void 0!==t.data){const e=w(t.data);if(e.byteLength!==t.bytes||r(i(e))!==t.sha256)throw Error(`资源校验失败:${t.path}`);s=URL.createObjectURL(new Blob([e],{type:"gzip"===t.encoding?"application/gzip":t.mimeType}))}else{const e=this.catalog.baseUrl;if(!e)throw Error(`资源缺少文件内容或部署地址:${t.path}`);const r="undefined"==typeof location?"https://bundle.invalid/":location.href;s=new URL(t.path,new URL(e,r)).href}this.resolved.set(t.id,s)}return s}),this.catalog=t,this.strict=n,g(t);const o=(e,t)=>{const r=this.sources.get(e);if(r&&r.id!==t.id)throw Error(`资源地址重复:${e}`);this.sources.set(e,t)},l=e=>/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)?[e,...s?[s+e]:[]]:[e,s+e,`${s.replace(/\/$/,"")}/${e.replace(/^\//,"")}`,`/${e.replace(/^\//,"")}`];for(const e of t.entries)for(const t of[...e.sources,`asset://${e.id}`])for(const r of l(t))o(r,e);for(const e of null!==(a=t.externalSources)&&void 0!==a?a:[]){const t=/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)?e:`${s.replace(/\/$/,"")}/${e.replace(/^\//,"")}`;for(const r of l(e))this.externals.set(r,t)}}dispose(){for(const e of this.resolved.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this.resolved.clear()}},j=["format","schemaVersion","scenes","assets"];function $(e){const t=e.replace(/[?#].*$/,""),r=e.slice(t.length),s=new URL(e,"https://bundle.invalid").pathname;if(/\.zip$/i.test(s)||/(?:^|\/)manifest\.json$/i.test(s))return e;if(/\.[^/]+$/.test(s))throw Error("vis-core 仅支持 ZIP、分包目录或 manifest.json;独立 JSON/GZ 请先通过编辑平台导入并导出 ZIP。");return`${t.replace(/\/$/,"")}/manifest.json${r}`}function B(e,t){return U.apply(this,arguments)}function U(){return(U=s(function*(e,t){try{const r=new Uint8Array(yield e.slice(0,2).arrayBuffer()),s=/\.(gz|gzip)$/i.test(t)||31===r[0]&&139===r[1]?yield new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).text():yield e.text(),i=JSON.parse(s);if(!i||"object"!=typeof i||Array.isArray(i))throw Error("需要 JSON 对象");return i}catch(r){throw new Error(`无法读取文件 ${t}:${r instanceof Error?r.message:String(r)}`,{cause:r})}})).apply(this,arguments)}function k(e){return O.apply(this,arguments)}function O(){return O=s(function*(e,r="project.zip"){var i;const[{default:a},o,{createTextureFile:l},{SCENE_DOCUMENT_FORMAT:c},{resolveRuntimeImages:d}]=yield Promise.all([import("jszip"),import("./validation-BGRVMCXQ.js").then(e=>e.r),import("./dist-CurDDdRW.js").then(e=>e.B),import("./schema-B2o51seO.js").then(e=>e.c),import("./runtimeImages-BFvQYajK.js").then(e=>e.a)]),u=o;let p;try{p=yield a.loadAsync(e instanceof Blob?yield e.arrayBuffer():e)}catch(N){throw new Error(`无法解压 ZIP 文件 ${r}`,{cause:N})}const f=Object.values(p.files).filter(e=>!e.dir&&/(^|\/)manifest\.json$/.test(e.name)&&!e.name.startsWith("__MACOSX/")),h=null!==(i=p.file("manifest.json"))&&void 0!==i?i:1===f.length?f[0]:void 0;if(!h)throw new Error(f.length>1?"ZIP 中有多个 manifest.json,无法确定要导入的项目":"ZIP 中缺少 manifest.json,请选择平台导出的场景分包 ZIP");const y=h.name.slice(0,-13),m=yield B(new Blob([yield h.async("uint8array")]),h.name);u.assertSceneManifest(m);const g=function(){var e=s(function*(e){if(/[:\\?#\0]/.test(e)||e.split("/").some(e=>!e||"."===e||".."===e))throw new Error(`ZIP 内文件路径无效:${e}`);const t=p.file(y+e);if(!t)throw new Error(`ZIP 中缺少文件:${e}`);if(t.unsafeOriginalName&&t.unsafeOriginalName!==t.name)throw new Error(`ZIP 内文件路径无效:${e}`);return new Blob([yield t.async("uint8array")])});return function(t){return e.apply(this,arguments)}}(),v=[];for(const t of m.scenes){var w,b;const e=yield B(yield g(t.source),t.source);if(!(null===(w=e.scene)||void 0===w?void 0:w.object)||e.id!==t.id||(null===(b=e.vis)||void 0===b?void 0:b.type)!==t.vis.type)throw new Error(`场景文件与 manifest 不匹配:${t.source}`);v.push(e)}const{format:A,schemaVersion:E,scenes:S,assets:I}=m,$=t(t({},n(m,j)),{},{format:c,schemaVersion:6,scenes:v});if(u.assertRuntimeSceneDocument($),$.runtimeAssets){delete $.runtimeAssets.baseUrl;for(const e of $.runtimeAssets.entries){const t=new Uint8Array(yield(yield g(e.path)).arrayBuffer());yield x(e,t),e.data=t.buffer}}const U=/* @__PURE__ */new Map,k={png:"image/png",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",bmp:"image/bmp"};for(const t of Object.keys(null!=I?I:{})){var O,T,L;const e=new Uint8Array(yield(yield g(t)).arrayBuffer()),r=null!==(O=null!==(T=null==I||null===(L=I[t])||void 0===L?void 0:L.mimeType)&&void 0!==T?T:k[t.split(".").pop()])&&void 0!==O?O:"application/octet-stream";U.set(t,l(e.buffer,r))}return d($,I,e=>U.get(e)),$}),O.apply(this,arguments)}var T=["assets"],L=e=>r(i(new Uint8Array(e))),N={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},M={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/avif":"avif","image/bmp":"bmp","image/svg+xml":"svg","image/vnd.radiance":"hdr","image/x-tga":"tga","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","video/quicktime":"mov","video/x-m4v":"m4v"},z=e=>"string"==typeof e&&/^assets\/[\w.-]+$/.test(e)&&!e.includes("..");function P(e){if(void 0!==e){if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid media asset manifest");for(const[t,r]of Object.entries(e)){if(!z(t)||!r||!/^[a-f0-9]{64}$/.test(r.sha256)||!Number.isSafeInteger(r.bytes)||r.bytes<0||!/^[\w.+-]+\/[\w.+-]+$/.test(r.mimeType)||!["image","hdr","tga","video","pixels"].includes(r.kind))throw Error(`Invalid media asset: ${t}`);if("pixels"===r.kind){const e=r.pixels;if(!e||!Object.hasOwn(N,e.type)||!Number.isSafeInteger(e.width)||e.width<=0||!Number.isSafeInteger(e.height)||e.height<=0||void 0!==e.depth&&(!Number.isSafeInteger(e.depth)||e.depth<=0)||r.bytes%N[e.type].BYTES_PER_ELEMENT)throw Error(`Invalid pixel asset: ${t}`)}else if(void 0!==r.pixels)throw Error(`Unexpected pixel metadata: ${t}`)}}}function C(e,r){if(r instanceof ArrayBuffer&&(r.byteLength!==e.bytes||L(r)!==e.sha256))throw Error("Media resource checksum mismatch");return"pixels"===e.kind?t(t({},e.pixels),{},{encoding:"binary",sha256:e.sha256,data:r}):{encoding:"file",kind:e.kind,mimeType:e.mimeType,sha256:e.sha256,data:r}}var D=class{constructor(){e(this,"payloads",/* @__PURE__ */new WeakMap),e(this,"graphs",/* @__PURE__ */new WeakMap),e(this,"rows",/* @__PURE__ */new WeakMap)}row(e,r,s){const i=this.rows.get(e);if(i&&i.graph===s)return i.row;const n=t(t({},e),{},{[r]:s});return this.rows.set(e,{graph:s,row:n}),n}writePayload(e){var r;if("string"==typeof e){const t=/^data:((?:image|video)\/[^;,]+);base64,([\s\S]*)$/i.exec(e);if(!t)return;const r=w(t[2]).buffer;e={encoding:"file",kind:t[1].toLowerCase().startsWith("video/")?"video":"image",mimeType:t[1],sha256:L(r),data:r}}if(!e||"object"!=typeof e)return;const s=this.payloads.get(e);if(s)return s;let i,n;if("file"===e.encoding){if(!(e.data instanceof ArrayBuffer))throw Error("Media export requires owned file bytes");if(i=e.data,n={kind:e.kind,mimeType:e.mimeType,sha256:L(i),bytes:i.byteLength},n.sha256!==e.sha256)throw Error("Media resource checksum mismatch")}else{if(!("binary"===e.encoding||Object.hasOwn(N,e.type)&&(Array.isArray(e.data)||ArrayBuffer.isView(e.data))))return;{const r=N[e.type];if(!r)throw Error("Invalid pixel array type");if("binary"===e.encoding){if(!(e.data instanceof ArrayBuffer)||L(e.data)!==e.sha256)throw Error("Invalid binary pixel resource");i=e.data}else{const t=Array.isArray(e.data)?new r(e.data):e.data;i=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}n={kind:"pixels",mimeType:"application/octet-stream",sha256:L(i),bytes:i.byteLength,pixels:t({type:e.type,width:e.width,height:e.height},void 0===e.depth?{}:{depth:e.depth})}}}const a=n.pixels?"-"+L((new TextEncoder).encode(JSON.stringify(n.pixels)).buffer).slice(0,16):"",o="pixels"===n.kind?"bin":null!==(r=M[n.mimeType])&&void 0!==r?r:"bin",l=`assets/${"video"===n.kind?"video":"image"}-${n.sha256}${a}.${o}`;P({[l]:n});const c={path:l,info:n,file:{data:new Uint8Array(i),mimeType:n.mimeType}};return this.payloads.set(e,c),c}prepare(e){var r;const s={},i={};if(void 0!==e._resourcePool||void 0!==e.imageAssets)throw Error("Import legacy resources in editor-platform");const a=e=>{s[e.path]=e.info,i[e.path]=e.file},o=e=>{if(!e)return e;const r=this.graphs.get(e);if(r)return r.files.forEach(a),r.graph;const s=/* @__PURE__ */new Map,i=e=>{const t=e;if(Array.isArray(t))return t.map(i);const r=this.writePayload(t);return r?(s.set(r.path,r),r.path):t},n=t({},e);e.images&&(n.images=e.images.map(e=>t(t({},e),{},{url:i(e.url)}))),e.textures&&(n.textures=e.textures.map(r=>{let s=r.userData;if(!s)return r;if(void 0!==s._dataTexBase64||"number"==typeof s._videoSrc||void 0!==e._texDataPool)throw Error("Import legacy texture data in editor-platform");return void 0!==s._videoSrc&&(s=t(t({},s),{},{_videoSrc:i(s._videoSrc)})),s===r.userData?r:t(t({},r),{},{userData:s})}));const o=[...s.values()];return o.forEach(a),this.graphs.set(e,{graph:n,files:o}),n},{assets:l}=e,c=t({},n(e,T));if(e.scene&&(c.scene=o(e.scene)),e.scenes&&(c.scenes=e.scenes.map(e=>this.row(e,"scene",o(e.scene)))),e.materialLibrary&&(c.materialLibrary=e.materialLibrary.map(e=>this.row(e,"material",o(e.material)))),e.prefabLibrary&&(c.prefabLibrary=e.prefabLibrary.map(e=>this.row(e,"snapshot",o(e.snapshot)))),null===(r=e.d)||void 0===r?void 0:r.chartBg){const r=e.d.chartBg,s=o({images:r.images,textures:[r]});c.d=t(t({},e.d),{},{chartBg:t(t({},s.textures[0]),s.images?{images:s.images}:{})})}return{document:c,assets:s,files:i}}};function _(e,t,r){var s,i,n,a;if(!t)return;P(t);const o=/* @__PURE__ */new Map,l=e=>{if(Array.isArray(e))return e.map(l);if("string"!=typeof e)return e;if(!Object.hasOwn(t,e)){if(/^assets\/(image|video)-[a-f0-9]{64}[.-]/.test(e))throw Error(`Missing media asset metadata: ${e}`);return e}return o.has(e)||o.set(e,C(t[e],r(e,t[e]))),o.get(e)},c=e=>{var t,r,s;for(const i of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])i.url=l(i.url);for(const i of null!==(r=null==e?void 0:e.textures)&&void 0!==r?r:[])void 0!==(null===(s=i.userData)||void 0===s?void 0:s._videoSrc)&&(i.userData._videoSrc=l(i.userData._videoSrc))};c(e.scene);for(const d of null!==(s=e.scenes)&&void 0!==s?s:[])c(d.scene);for(const d of null!==(i=e.materialLibrary)&&void 0!==i?i:[])c(d.material);for(const d of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])c(d.snapshot);(null===(a=e.d)||void 0===a?void 0:a.chartBg)&&c({images:e.d.chartBg.images,textures:[e.d.chartBg]})}var R="undefined"!=typeof crypto&&void 0!==crypto.subtle;function Z(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/g,"").replace(/-----END PUBLIC KEY-----/g,"").replace(/\s/g,""),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s.buffer}function K(){return(K=s(function*(e){return crypto.subtle.importKey("spki",Z(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])})).apply(this,arguments)}var V="-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEU2vGIjpJQFRkGxVrw4gZL3dXm/1\nfrZBlUc8gjzam/VNZbT1swQSq/kLPmYH7ZykBvLzp7SpNdvOQ8rAqdSdvg==\n-----END PUBLIC KEY-----";var F=R?function(e){return K.apply(this,arguments)}(V):null,W=R?null:new Uint8Array(Z(V)).slice(26);function Y(e){return J.apply(this,arguments)}function J(){return(J=s(function*(e){let t;try{t=function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,s=atob(t+"=".repeat(r)),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}(e)}catch(a){return null}if(t.length<=64)return null;const r=t.slice(0,t.length-64),s=t.slice(t.length-64);let i;try{if(R){const e=yield F;i=yield crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},e,s,r)}else{const{p256:e}=yield import("@noble/curves/nist.js");i=e.verify(s,r,W,{lowS:!1})}}catch(o){return null}if(!i)return null;const n=function(e){if(e.length<1)return null;if(123===e[0])try{const t=JSON.parse((new TextDecoder).decode(e));return 2!==t.version||!["runtime","preview"].includes(t.purpose)||"string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64||!Array.isArray(t.adcodes)||!t.adcodes.length||t.adcodes.length>65535||t.adcodes.some(e=>!Number.isInteger(e)||e<0||e>16777215)||new Set(t.adcodes).size!==t.adcodes.length||void 0!==t.expire&&(!Number.isSafeInteger(t.expire)||t.expire<=0)||"preview"===t.purpose&&!t.expire?null:{purpose:t.purpose,projectId:t.projectId,adcodes:t.adcodes,expire:t.expire}}catch(l){return null}const t=e[0],r=!!(2&t),s=!!(4&t),i=!!(8&t);if(-16&t||r&&(s||i))return null;let n,a=1;if(1&t){if(e.length<a+4)return null;n=36e5*((e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3])>>>0),a+=4}let o=null;if(!r){if(e.length<a+1)return null;let t=e[a++];if(i){if(e.length<a+1)return null;t=t<<8|e[a++]}if(!t||e.length!==a+3*t)return null;o=[];for(let r=0;r<t;r++){const t=e[a]<<16|e[a+1]<<8|e[a+2];o.push(t),a+=3}}return a!==e.length?null:{adcodes:o,expire:n,prefixMatch:s}}(r);return n?n.expire&&Date.now()>n.expire?null:n:null})).apply(this,arguments)}function Q(e,t,r){return q.apply(this,arguments)}function q(){return(q=s(function*(e,t,r){const s=yield Y(t);if(!(null==s?void 0:s.adcodes)||s.prefixMatch||"preview"===s.purpose||void 0!==r&&s.projectId!==r)return!1;const i=new Set(e),n=new Set(s.adcodes);return i.size>0&&i.size===n.size&&[...i].every(e=>n.has(e))})).apply(this,arguments)}function G(e,t){return H.apply(this,arguments)}function H(){return(H=s(function*(e,t){const r=yield Y(t);return!(!(null==r?void 0:r.adcodes)||r.prefixMatch||"preview"===r.purpose)&&r.adcodes.includes(e)})).apply(this,arguments)}var X=(e,t)=>{const r=ee(e),s=ee(t).map(function(e,t){return e^r[Math.floor(t%r.length)]}).join(",");return btoa(s)};function ee(e){const t=[];let r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t}export{x as _,P as a,h as b,k as c,m as d,g as f,S as g,v as h,D as i,$ as l,w as m,G as n,C as o,b as p,Q as r,_ as s,X as t,I as u,d as v,n as x,p as y};