@naanouff/w3dts-scenedd 0.0.0-stage → 0.1.22
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 +100 -3
- package/dist/codecs/ComponentCodecRegistry.d.ts +20 -0
- package/dist/codecs/ComponentCodecRegistry.d.ts.map +1 -0
- package/dist/contracts/ISceneComponentCodec.d.ts +69 -0
- package/dist/contracts/ISceneComponentCodec.d.ts.map +1 -0
- package/dist/descriptors/EngineConfigDescriptor.d.ts +18 -0
- package/dist/descriptors/EngineConfigDescriptor.d.ts.map +1 -0
- package/dist/descriptors/EntityDescriptor.d.ts +270 -0
- package/dist/descriptors/EntityDescriptor.d.ts.map +1 -0
- package/dist/descriptors/EnvironmentDescriptor.d.ts +30 -0
- package/dist/descriptors/EnvironmentDescriptor.d.ts.map +1 -0
- package/dist/descriptors/PhysicsSetupDescriptor.d.ts +12 -0
- package/dist/descriptors/PhysicsSetupDescriptor.d.ts.map +1 -0
- package/dist/descriptors/ResourceManifest.d.ts +57 -0
- package/dist/descriptors/ResourceManifest.d.ts.map +1 -0
- package/dist/descriptors/SceneDescriptor.d.ts +52 -0
- package/dist/descriptors/SceneDescriptor.d.ts.map +1 -0
- package/dist/descriptors/ScriptDescriptor.d.ts +15 -0
- package/dist/descriptors/ScriptDescriptor.d.ts.map +1 -0
- package/dist/descriptors/TerrainDescriptor.d.ts +39 -0
- package/dist/descriptors/TerrainDescriptor.d.ts.map +1 -0
- package/dist/descriptors/index.d.ts +13 -0
- package/dist/descriptors/index.d.ts.map +1 -0
- package/dist/extensions/w3dtsUiExtension.d.ts +113 -0
- package/dist/extensions/w3dtsUiExtension.d.ts.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/serialization/SceneDeserializer.d.ts +7 -0
- package/dist/serialization/SceneDeserializer.d.ts.map +1 -0
- package/dist/serialization/SceneSerializer.d.ts +30 -0
- package/dist/serialization/SceneSerializer.d.ts.map +1 -0
- package/dist/serialization/binaryCodec.d.ts +7 -0
- package/dist/serialization/binaryCodec.d.ts.map +1 -0
- package/dist/serialization/cdnAssetUrls.d.ts +18 -0
- package/dist/serialization/cdnAssetUrls.d.ts.map +1 -0
- package/dist/serialization/constants.d.ts +17 -0
- package/dist/serialization/constants.d.ts.map +1 -0
- package/dist/serialization/extensionEnabled.d.ts +10 -0
- package/dist/serialization/extensionEnabled.d.ts.map +1 -0
- package/dist/serialization/fetchRemote.d.ts +12 -0
- package/dist/serialization/fetchRemote.d.ts.map +1 -0
- package/dist/serialization/loadManifestUrlTextures.d.ts +23 -0
- package/dist/serialization/loadManifestUrlTextures.d.ts.map +1 -0
- package/dist/serialization/materialDescriptorProperties.d.ts +32 -0
- package/dist/serialization/materialDescriptorProperties.d.ts.map +1 -0
- package/dist/serialization/materialTextureManifest.d.ts +23 -0
- package/dist/serialization/materialTextureManifest.d.ts.map +1 -0
- package/dist/serialization/meshEmbeddedCodec.d.ts +11 -0
- package/dist/serialization/meshEmbeddedCodec.d.ts.map +1 -0
- package/dist/serialization/migrateSceneDocument.d.ts +10 -0
- package/dist/serialization/migrateSceneDocument.d.ts.map +1 -0
- package/dist/serialization/sceneFileLoad.d.ts +10 -0
- package/dist/serialization/sceneFileLoad.d.ts.map +1 -0
- package/dist/serialization/scenePak.d.ts +49 -0
- package/dist/serialization/scenePak.d.ts.map +1 -0
- package/dist/serialization/scenepakMetadata.d.ts +19 -0
- package/dist/serialization/scenepakMetadata.d.ts.map +1 -0
- package/dist/serialization/serializeGraphManifest.d.ts +12 -0
- package/dist/serialization/serializeGraphManifest.d.ts.map +1 -0
- package/dist/serialization/standaloneFinalize.d.ts +34 -0
- package/dist/serialization/standaloneFinalize.d.ts.map +1 -0
- package/dist/serialization/types.d.ts +206 -0
- package/dist/serialization/types.d.ts.map +1 -0
- package/dist/validation/SceneValidator.d.ts +1394 -0
- package/dist/validation/SceneValidator.d.ts.map +1 -0
- package/dist/w3dts-scenedd.es.js +5514 -0
- package/dist/w3dts-scenedd.umd.js +1 -0
- package/package.json +55 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("@naanouff/w3dts-core"),require("gl-matrix")):typeof define=="function"&&define.amd?define(["exports","@naanouff/w3dts-core","gl-matrix"],b):(_=typeof globalThis<"u"?globalThis:_||self,b(_.W3dtsScenedd={},_.W3dtsCore,_.glMatrix))})(this,function(_,b,Se){"use strict";var ji=Object.defineProperty;var Pi=(_,b,Se)=>b in _?ji(_,b,{enumerable:!0,configurable:!0,writable:!0,value:Se}):_[b]=Se;var Ut=(_,b,Se)=>Pi(_,typeof b!="symbol"?b+"":b,Se);var Y;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return t.objectValues(s)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(const s of a)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(Y||(Y={}));var Wr;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Wr||(Wr={}));const k=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),at=t=>{switch(typeof t){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(t)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(t)?k.array:t===null?k.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.promise:typeof Map<"u"&&t instanceof Map?k.map:typeof Set<"u"&&t instanceof Set?k.set:typeof Date<"u"&&t instanceof Date?k.date:k.object;default:return k.unknown}},y=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ce extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,c=0;for(;c<s.path.length;){const u=s.path[c];c===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(s))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return a(this),n}static assert(e){if(!(e instanceof ce))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}ce.create=t=>new ce(t);const ir=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===k.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Y.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Y.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,Y.assertNever(t)}return{message:r}};let Bn=ir;function Wn(){return Bn}const Vn=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}};function w(t,e){const r=Wn(),n=Vn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ir?void 0:ir].filter(a=>!!a)});t.common.issues.push(n)}class Te{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return R;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return Te.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return R;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}}const R=Object.freeze({status:"aborted"}),Ct=t=>({status:"dirty",value:t}),Le=t=>({status:"valid",value:t}),Vr=t=>t.status==="aborted",Hr=t=>t.status==="dirty",vt=t=>t.status==="valid",$t=t=>typeof Promise<"u"&&t instanceof Promise;var E;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(E||(E={}));class We{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Yr=(t,e)=>{if(vt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new ce(t.common.issues);return this._error=r,this._error}}};function P(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{const{message:c}=t;return s.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}class W{get description(){return this._def.description}_getType(e){return at(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:at(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Te,ctx:{common:e.parent.common,data:e.data,parsedType:at(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if($t(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:at(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Yr(n,a)}"~validate"(e){var n,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:at(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return vt(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(a=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>vt(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:at(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await($t(a)?a:Promise.resolve(a));return Yr(n,i)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const s=e(a),o=()=>i.addIssue({code:y.custom,...n(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new ft({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Qe.create(this,this._def)}nullable(){return ht.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Gt.create(this,this._def)}or(e){return jt.create([this,e],this._def)}and(e){return Pt.create(this,e,this._def)}transform(e){return new ft({...P(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Zt({...P(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new nn({typeName:N.ZodBranded,type:this,...P(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Bt({...P(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return pr.create(this,e)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hn=/^c[^\s-]{8,}$/i,Yn=/^[0-9a-z]+$/,qn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Kn=/^[a-z0-9_-]{21}$/i,Xn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ea=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ta="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sr;const ra=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,na=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,aa=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ia=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ca=new RegExp(`^${qr}$`);function Jr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function la(t){return new RegExp(`^${Jr(t)}$`)}function da(t){let e=`${qr}T${Jr(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function ua(t,e){return!!((e==="v4"||!e)&&ra.test(t)||(e==="v6"||!e)&&aa.test(t))}function fa(t,e){if(!Xn.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function ha(t,e){return!!((e==="v4"||!e)&&na.test(t)||(e==="v6"||!e)&&ia.test(t))}class Ke extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){const i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:k.string,received:i.parsedType}),R}const n=new Te;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?w(a,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&w(a,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")ea.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")sr||(sr=new RegExp(ta,"u")),sr.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Jn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Kn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Hn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Yn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")qn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),w(a,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?da(i).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ca.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?la(i).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Qn.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ua(e.data,i.version)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?fa(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"jwt",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ha(e.data,i.version)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cidr",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?sa.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?oa.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"base64url",code:y.invalid_string,message:i.message}),n.dirty()):Y.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:y.invalid_string,...E.errToObj(n)})}_addCheck(e){return new Ke({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...E.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...E.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...E.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...E.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...E.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...E.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...E.errToObj(r)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new Ke({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ke({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ke({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ke.create=t=>new Ke({checks:[],typeName:N.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...P(t)});function ma(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,i=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}class bt extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){const i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:k.number,received:i.parsedType}),R}let n;const a=new Te;for(const i of this._def.checks)i.kind==="int"?Y.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?ma(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_finite,message:i.message}),a.dirty()):Y.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,E.toString(r))}gt(e,r){return this.setLimit("min",e,!1,E.toString(r))}lte(e,r){return this.setLimit("max",e,!0,E.toString(r))}lt(e,r){return this.setLimit("max",e,!1,E.toString(r))}setLimit(e,r,n,a){return new bt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(a)}]})}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}bt.create=t=>new bt({checks:[],typeName:N.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...P(t)});class Et extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==k.bigint)return this._getInvalidInput(e);let n;const a=new Te;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):Y.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:k.bigint,received:r.parsedType}),R}gte(e,r){return this.setLimit("min",e,!0,E.toString(r))}gt(e,r){return this.setLimit("min",e,!1,E.toString(r))}lte(e,r){return this.setLimit("max",e,!0,E.toString(r))}lt(e,r){return this.setLimit("max",e,!1,E.toString(r))}setLimit(e,r,n,a){return new Et({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(a)}]})}_addCheck(e){return new Et({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Et.create=t=>new Et({checks:[],typeName:N.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...P(t)});class or extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.boolean,received:n.parsedType}),R}return Le(e.data)}}or.create=t=>new or({typeName:N.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...P(t)});class Lt extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){const i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:k.date,received:i.parsedType}),R}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_date}),R}const n=new Te;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Y.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Lt({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Lt.create=t=>new Lt({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:N.ZodDate,...P(t)});class Kr extends W{_parse(e){if(this._getType(e)!==k.symbol){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.symbol,received:n.parsedType}),R}return Le(e.data)}}Kr.create=t=>new Kr({typeName:N.ZodSymbol,...P(t)});class cr extends W{_parse(e){if(this._getType(e)!==k.undefined){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.undefined,received:n.parsedType}),R}return Le(e.data)}}cr.create=t=>new cr({typeName:N.ZodUndefined,...P(t)});class lr extends W{_parse(e){if(this._getType(e)!==k.null){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.null,received:n.parsedType}),R}return Le(e.data)}}lr.create=t=>new lr({typeName:N.ZodNull,...P(t)});class Xr extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Le(e.data)}}Xr.create=t=>new Xr({typeName:N.ZodAny,...P(t)});class dr extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Le(e.data)}}dr.create=t=>new dr({typeName:N.ZodUnknown,...P(t)});class it extends W{_parse(e){const r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:k.never,received:r.parsedType}),R}}it.create=t=>new it({typeName:N.ZodNever,...P(t)});class Qr extends W{_parse(e){if(this._getType(e)!==k.undefined){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.void,received:n.parsedType}),R}return Le(e.data)}}Qr.create=t=>new Qr({typeName:N.ZodVoid,...P(t)});class Ve extends W{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==k.array)return w(r,{code:y.invalid_type,expected:k.array,received:r.parsedType}),R;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(w(r,{code:s?y.too_big:y.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(w(r,{code:y.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(w(r,{code:y.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,o)=>a.type._parseAsync(new We(r,s,r.path,o)))).then(s=>Te.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new We(r,s,r.path,o)));return Te.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new Ve({...this._def,minLength:{value:e,message:E.toString(r)}})}max(e,r){return new Ve({...this._def,maxLength:{value:e,message:E.toString(r)}})}length(e,r){return new Ve({...this._def,exactLength:{value:e,message:E.toString(r)}})}nonempty(e){return this.min(1,e)}}Ve.create=(t,e)=>new Ve({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...P(e)});function _t(t){if(t instanceof me){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Qe.create(_t(n))}return new me({...t._def,shape:()=>e})}else return t instanceof Ve?new Ve({...t._def,type:_t(t.element)}):t instanceof Qe?Qe.create(_t(t.unwrap())):t instanceof ht?ht.create(_t(t.unwrap())):t instanceof dt?dt.create(t.items.map(e=>_t(e))):t}class me extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=Y.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==k.object){const u=this._getOrReturnCtx(e);return w(u,{code:y.invalid_type,expected:k.object,received:u.parsedType}),R}const{status:n,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof it&&this._def.unknownKeys==="strip"))for(const u in a.data)s.includes(u)||o.push(u);const c=[];for(const u of s){const f=i[u],m=a.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new We(a,m,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof it){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:a.data[f]}});else if(u==="strict")o.length>0&&(w(a,{code:y.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of o){const m=a.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new We(a,m,a.path,f)),alwaysSet:f in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const m=await f.key,g=await f.value;u.push({key:m,value:g,alwaysSet:f.alwaysSet})}return u}).then(u=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new me({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s;const a=((s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:E.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new me({...this._def,unknownKeys:"strip"})}passthrough(){return new me({...this._def,unknownKeys:"passthrough"})}extend(e){return new me({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new me({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new me({...this._def,catchall:e})}pick(e){const r={};for(const n of Y.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new me({...this._def,shape:()=>r})}omit(e){const r={};for(const n of Y.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new me({...this._def,shape:()=>r})}deepPartial(){return _t(this)}partial(e){const r={};for(const n of Y.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new me({...this._def,shape:()=>r})}required(e){const r={};for(const n of Y.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Qe;)i=i._def.innerType;r[n]=i}return new me({...this._def,shape:()=>r})}keyof(){return tn(Y.objectKeys(this.shape))}}me.create=(t,e)=>new me({shape:()=>t,unknownKeys:"strip",catchall:it.create(),typeName:N.ZodObject,...P(e)}),me.strictCreate=(t,e)=>new me({shape:()=>t,unknownKeys:"strict",catchall:it.create(),typeName:N.ZodObject,...P(e)}),me.lazycreate=(t,e)=>new me({shape:t,unknownKeys:"strip",catchall:it.create(),typeName:N.ZodObject,...P(e)});class jt extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(o=>new ce(o.ctx.common.issues));return w(r,{code:y.invalid_union,unionErrors:s}),R}if(r.common.async)return Promise.all(n.map(async i=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(a);{let i;const s=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(c=>new ce(c));return w(r,{code:y.invalid_union,unionErrors:o}),R}}get options(){return this._def.options}}jt.create=(t,e)=>new jt({options:t,typeName:N.ZodUnion,...P(e)});const Xe=t=>t instanceof hr?Xe(t.schema):t instanceof ft?Xe(t.innerType()):t instanceof Ft?[t.value]:t instanceof ut?t.options:t instanceof mr?Y.objectValues(t.enum):t instanceof Zt?Xe(t._def.innerType):t instanceof cr?[void 0]:t instanceof lr?[null]:t instanceof Qe?[void 0,...Xe(t.unwrap())]:t instanceof ht?[null,...Xe(t.unwrap())]:t instanceof nn||t instanceof Wt?Xe(t.unwrap()):t instanceof Bt?Xe(t._def.innerType):[];class ur extends W{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.object)return w(r,{code:y.invalid_type,expected:k.object,received:r.parsedType}),R;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const i of r){const s=Xe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new ur({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...P(n)})}}function fr(t,e){const r=at(t),n=at(e);if(t===e)return{valid:!0,data:t};if(r===k.object&&n===k.object){const a=Y.objectKeys(e),i=Y.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(const o of i){const c=fr(t[o],e[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(r===k.array&&n===k.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const s=t[i],o=e[i],c=fr(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===k.date&&n===k.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Pt extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(i,s)=>{if(Vr(i)||Vr(s))return R;const o=fr(i.value,s.value);return o.valid?((Hr(i)||Hr(s))&&r.dirty(),{status:r.value,value:o.data}):(w(n,{code:y.invalid_intersection_types}),R)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Pt.create=(t,e,r)=>new Pt({left:t,right:e,typeName:N.ZodIntersection,...P(r)});class dt extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.array)return w(n,{code:y.invalid_type,expected:k.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return w(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((s,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new We(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Te.mergeArray(r,s)):Te.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new dt({...this._def,rest:e})}}dt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dt({items:t,typeName:N.ZodTuple,rest:null,...P(e)})};class zt extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.object)return w(n,{code:y.invalid_type,expected:k.object,received:n.parsedType}),R;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new We(n,o,n.path,o)),value:s._parse(new We(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Te.mergeObjectAsync(r,a):Te.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof W?new zt({keyType:e,valueType:r,typeName:N.ZodRecord,...P(n)}):new zt({keyType:Ke.create(),valueType:e,typeName:N.ZodRecord,...P(r)})}}class en extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.map)return w(n,{code:y.invalid_type,expected:k.map,received:n.parsedType}),R;const a=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new We(n,o,n.path,[u,"key"])),value:i._parse(new We(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of s){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return R;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of s){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return R;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}}}}en.create=(t,e,r)=>new en({valueType:e,keyType:t,typeName:N.ZodMap,...P(r)});class It extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.set)return w(n,{code:y.invalid_type,expected:k.set,received:n.parsedType}),R;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(w(n,{code:y.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(w(n,{code:y.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(c){const u=new Set;for(const f of c){if(f.status==="aborted")return R;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>i._parse(new We(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(e,r){return new It({...this._def,minSize:{value:e,message:E.toString(r)}})}max(e,r){return new It({...this._def,maxSize:{value:e,message:E.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}It.create=(t,e)=>new It({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...P(e)});class hr extends W{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}hr.create=(t,e)=>new hr({getter:t,typeName:N.ZodLazy,...P(e)});class Ft extends W{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return w(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft({value:t,typeName:N.ZodLiteral,...P(e)});function tn(t,e){return new ut({values:t,typeName:N.ZodEnum,...P(e)})}class ut extends W{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{expected:Y.joinValues(n),received:r.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{received:r.data,code:y.invalid_enum_value,options:n}),R}return Le(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return ut.create(e,{...this._def,...r})}exclude(e,r=this._def){return ut.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}ut.create=tn;class mr extends W{_parse(e){const r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==k.string&&n.parsedType!==k.number){const a=Y.objectValues(r);return w(n,{expected:Y.joinValues(a),received:n.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=Y.objectValues(r);return w(n,{received:n.data,code:y.invalid_enum_value,options:a}),R}return Le(e.data)}get enum(){return this._def.values}}mr.create=(t,e)=>new mr({values:t,typeName:N.ZodNativeEnum,...P(e)});class Gt extends W{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==k.promise&&r.common.async===!1)return w(r,{code:y.invalid_type,expected:k.promise,received:r.parsedType}),R;const n=r.parsedType===k.promise?r.data:Promise.resolve(r.data);return Le(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Gt.create=(t,e)=>new Gt({type:t,typeName:N.ZodPromise,...P(e)});class ft extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{w(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return R;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?R:c.status==="dirty"||r.value==="dirty"?Ct(c.value):c});{if(r.value==="aborted")return R;const o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?R:o.status==="dirty"||r.value==="dirty"?Ct(o.value):o}}if(a.type==="refinement"){const s=o=>{const c=a.refinement(o,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?R:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?R:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vt(s))return R;const o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>vt(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:r.value,value:o})):R);Y.assertNever(a)}}ft.create=(t,e,r)=>new ft({schema:t,typeName:N.ZodEffects,effect:e,...P(r)}),ft.createWithPreprocess=(t,e,r)=>new ft({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...P(r)});class Qe extends W{_parse(e){return this._getType(e)===k.undefined?Le(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qe.create=(t,e)=>new Qe({innerType:t,typeName:N.ZodOptional,...P(e)});class ht extends W{_parse(e){return this._getType(e)===k.null?Le(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ht.create=(t,e)=>new ht({innerType:t,typeName:N.ZodNullable,...P(e)});class Zt extends W{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===k.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Zt.create=(t,e)=>new Zt({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});class Bt extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return $t(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ce(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Bt.create=(t,e)=>new Bt({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});class rn extends W{_parse(e){if(this._getType(e)!==k.nan){const n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:k.nan,received:n.parsedType}),R}return{status:"valid",value:e.data}}}rn.create=t=>new rn({typeName:N.ZodNaN,...P(t)});class nn extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class pr extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R:i.status==="dirty"?(r.dirty(),Ct(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?R:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new pr({in:e,out:r,typeName:N.ZodPipeline})}}class Wt extends W{_parse(e){const r=this._def.innerType._parse(e),n=a=>(vt(a)&&(a.value=Object.freeze(a.value)),a);return $t(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Wt.create=(t,e)=>new Wt({innerType:t,typeName:N.ZodReadonly,...P(e)});var N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));const A=Ke.create,l=bt.create,ue=or.create,st=dr.create;it.create;const we=Ve.create,T=me.create;jt.create;const an=ur.create;Pt.create;const wt=dt.create,Ae=zt.create,H=Ft.create,Re=ut.create;Gt.create,Qe.create,ht.create;const gr="w3dts-scenedd",yr="1.0",sn="0.1.0",mt="w3dts-texture:";function on(t){if(t===null||typeof t!="object"||Array.isArray(t))return t;const r={...t};return r.format==null&&(r.format=gr),r.formatVersion==null&&(r.formatVersion=yr),r}const pe=wt([l(),l(),l()]),cn=wt([l(),l(),l(),l()]),pa=T({position:pe,rotation:cn,scale:pe}),ga=an("type",[T({type:H("renderable"),meshId:A(),materialId:A(),castShadow:ue().optional(),visible:ue().optional()}),T({type:H("static")}),T({type:H("hidden")}),T({type:H("instancedMesh"),meshId:A(),materialId:A(),instances:we(l()),count:l(),castShadow:ue().optional()}),T({type:H("directionalLight"),color:pe,intensity:l(),castShadow:ue().optional(),direction:pe.optional()}),T({type:H("pointLight"),color:pe,intensity:l(),range:l()}),T({type:H("spotLight"),color:pe,intensity:l(),range:l(),angle:l(),penumbra:l()}),T({type:H("areaLight"),color:pe,intensity:l(),width:l(),height:l()}),T({type:H("camera"),fov:l(),near:l(),far:l(),isPrimary:ue().optional(),isMain:ue().optional(),firstPersonEyeOffsetY:l().optional()}),T({type:H("cameraController"),mode:Re(["none","orbital","fps","chase"]),applyOn:Re(["play","gameFocus","always"]).optional(),fpsSpeed:l().optional(),fpsSprintSpeed:l().optional(),fpsSensitivity:l().optional(),fpsDampingFactor:l().optional(),fpsPlayerHeight:l().optional(),fpsFlightMode:ue().optional(),orbitalMinDistance:l().optional(),orbitalMaxDistance:l().optional(),orbitalZoomSensitivity:l().optional(),orbitalRotateSpeed:l().optional(),orbitalDamping:l().optional(),orbitalLeftMouseMode:Re(["rotate","pan","zoom"]).nullable().optional(),chaseTargetEntityId:A().optional(),chaseDistance:l().optional(),chaseHeight:l().optional(),chaseLookAhead:l().optional(),chaseLookHeight:l().optional(),chaseFocusSmoothXZ:l().optional(),chaseFocusSmoothY:l().optional(),chaseYawSmooth:l().optional()}),T({type:H("gproc"),graphId:A(),parameters:Ae(st()).optional(),materialIds:we(A()).optional()}),T({type:H("particle"),graphId:A(),materialId:A(),meshId:A().optional(),maxParticles:l().int().positive().optional(),palette:Re(["ember","smoke"]).optional(),parameters:Ae(st()).optional(),enabled:ue().optional(),castShadow:ue().optional()}),T({type:H("rigidBody"),mass:l(),useGravity:ue(),isKinematic:ue(),drag:l(),angularDrag:l(),restitution:l(),friction:l()}),T({type:H("collider"),shape:Re(["box","sphere","capsule","plane"]),size:pe.optional(),offset:pe.optional(),radius:l().optional(),height:l().optional(),collisionGroup:l().int().optional(),collisionMask:l().int().optional(),shapes:we(T({type:Re(["box","sphere"]),size:pe.optional(),radius:l().optional(),offset:pe.optional(),rotation:cn.optional(),collisionGroup:l().int().optional(),collisionMask:l().int().optional(),isTrigger:ue().optional()})).optional()}),T({type:H("vehicle"),maxSteerAngle:l().optional(),steerSpeed:l().optional(),maxSpeed:l().optional(),driveTorque:l().optional(),brakeTorque:l().optional(),rayMask:l().int().optional(),antiRollStiffness:l().optional(),rollDamping:l().optional(),pitchDamping:l().optional(),airAngularDamping:l().optional(),yawAssist:l().optional(),uprightStiffness:l().optional(),antiWheelie:l().optional(),leanMax:l().optional(),wheels:we(T({id:A().optional(),hardpoint:pe,restLength:l().optional(),travel:l().optional(),stiffness:l().optional(),damping:l().optional(),radius:l().optional(),driven:ue().optional(),steered:ue().optional(),mu:l().optional(),longitudinalStiffness:l().optional(),corneringStiffness:l().optional()})).optional()}),T({type:H("decal"),materialId:A().optional(),size:pe}),T({type:H("streamableScene"),url:A(),lodDistances:we(l())}),T({type:H("color"),value:wt([l(),l(),l(),l()])}),T({type:H("scriptBinding"),scriptId:A(),properties:Ae(st()).optional()}),T({type:H("playerSpawn"),priority:l().optional()}),T({type:H("health"),max:l().optional(),current:l().optional(),enabled:ue().optional()}),T({type:H("weapon"),damage:l().optional(),range:l().optional(),spreadHalfDeg:l().optional(),cooldownSec:l().optional(),ammo:l().optional(),magazineCapacity:l().optional(),reserveAmmo:l().optional(),reloadDurationSec:l().optional(),enabled:ue().optional()}),T({type:H("characterMotor"),enabled:ue().optional(),radius:l().optional(),capsuleHeight:l().optional(),stepHeight:l().optional(),maxSlopeRadians:l().optional(),skinWidth:l().optional(),jumpImpulseSpeed:l().optional(),gravity:l().optional(),swimSpeedWalk:l().optional(),swimSpeedSprint:l().optional(),swimVerticalMaxSpeed:l().optional()}),T({type:H("navAgent"),navMeshKey:A().min(1),speed:l().optional(),arrivalRadius:l().optional(),destination:pe.optional(),visionRange:l().optional(),visionHalfFovDeg:l().optional(),showVisionConeInEditor:ue().optional()}),T({type:H("navAgentPatrolFsm"),waypoints:we(pe).min(1),loseSightGraceSec:l().optional(),investigateHoldSec:l().optional(),visionEyeYOffset:l().optional(),patrolIndex:l().int().nonnegative().optional()}),T({type:H("collectible"),collected:ue().optional()}),T({type:H("navPerceptionTarget"),isActive:ue().optional()}),T({type:H("chessPiece"),color:Re(["white","black"]),role:Re(["pawn","knight","bishop","rook","queen","king"]),square:A().optional()}),T({type:H("audioSource"),clipId:A(),loop:ue().optional(),volume:l().optional(),minDistance:l().optional(),maxDistance:l().optional(),coneInnerAngle:l().optional(),coneOuterAngle:l().optional(),coneOuterGain:l().optional(),bus:Re(["music","sfx","ambient"]).optional()})]),ya=T({id:A(),name:A().optional(),parentId:A().optional(),transform:pa.optional(),components:we(ga)}),xt=T({id:A(),url:A().optional(),inline:st().optional()}),va=T({renderGraph:xt,shaderGraphs:we(xt),geometryGraphs:we(xt),terrainGraphs:we(xt),particleGraphs:we(xt).optional(),scriptGraphs:we(xt).optional()}),ba=T({verticesBase64:A().min(1),indicesBase64:A().min(1),indexFormat:Re(["uint16","uint32"]),vertexStrideFloats:l().int().positive().max(64).optional()}),_a=T({url:A().optional(),name:A().optional(),embedded:ba.optional()}).superRefine((t,e)=>{const n=(t.url??"").trim().length>0;t.embedded!=null&&n&&e.addIssue({code:y.custom,message:"Mesh entry cannot combine embedded geometry and a non-empty url",path:["embedded"]})}),wa=T({dataBase64:A().min(1)}),xa=T({url:A().optional(),format:Re(["hdr","png","jpg","ktx2"]).optional(),srgb:ue().optional(),embedded:wa.optional()}).superRefine((t,e)=>{var i;const r=(t.url??"").trim(),n=!!((i=t.embedded)!=null&&i.dataBase64&&t.embedded.dataBase64.length>0),a=r.length>0;n&&a?e.addIssue({code:y.custom,message:"Texture entry cannot combine embedded.dataBase64 with url",path:["embedded"]}):!n&&!a&&e.addIssue({code:y.custom,message:"Texture entry must have a non-empty url or embedded.dataBase64",path:["url"]})}),Sa=T({name:A(),shadingModel:Re(["pbr","unlit","toon","graph"]),shaderGraphId:A().optional(),properties:Ae(st()).optional(),textureRefs:Ae(A()).optional()}),ka=T({type:Re(["quad","cube","sphere","plane","cylinder","capsule","grassTuft"]),params:Ae(l()).optional()}),Ca=T({meshes:Ae(_a),primitives:Ae(ka).optional(),textures:Ae(xa),materials:Ae(Sa),audioClips:Ae(T({url:A()})).optional()}),Ea=T({gravity:pe,fixedTimeStep:l(),maxStepsPerFrame:l(),solverIterations:l(),broadphase:Re(["sap","bruteforce"])}),Ia=an("type",[T({type:H("procedural"),sunDirection:pe.optional(),turbidity:l().optional()}),T({type:H("hdr"),textureId:A()})]),Ta=T({skybox:Ia.optional(),ambientLight:T({color:pe,intensity:l()}).optional(),ibl:T({textureId:A(),intensity:l()}).optional(),fog:T({color:pe,density:l(),near:l(),far:l()}).optional()}),Aa=T({kind:Re(["ocean","lake","pond","river"]),name:A().optional(),waterLevel:l(),centerX:l().optional(),centerZ:l().optional(),radius:l().optional(),chunkSize:l().optional(),viewDistance:l().optional(),waveAmplitude:l().optional(),waveFrequency:l().optional(),shoreWidth:l().optional(),absorption:wt([l(),l(),l()]).optional(),shallowColor:wt([l(),l(),l()]).optional(),deepColor:wt([l(),l(),l()]).optional(),splinePoints:we(T({x:l(),z:l()})).optional()}),Ra=T({graphId:A(),config:Ae(st()),chunkSize:l(),lodDistances:we(l()),streamInDistance:l(),streamOutDistance:l(),waterBodies:we(Aa).optional()}),Na=T({level:l(),materialId:A()}),Ma=T({id:A(),name:A(),language:H("typescript"),source:A().optional(),sourceUrl:A().optional(),bindings:Ae(st()).optional()}).refine(t=>typeof t.source=="string"&&t.source.length>0||typeof t.sourceUrl=="string"&&t.sourceUrl.length>0,{message:"Script must have non-empty source or sourceUrl",path:["source"]}),Oa=T({name:A(),description:A().optional(),author:A().optional(),createdAt:A(),engineVersion:A(),engine:A().optional(),copyright:A().optional(),packageVersions:Ae(A()).optional(),tags:we(A()).optional(),projectName:A().optional(),serializerPackageVersion:A().optional()}),Da=T({version:H("1.0"),format:H("w3dts-scenedd").optional(),formatVersion:A().optional(),extensions:Ae(st()).optional(),metadata:Oa,engineConfig:va,resources:Ca,entities:we(ya),physics:Ea.optional(),environment:Ta.optional(),terrain:Ra.optional(),water:Na.optional(),scripts:we(Ma).optional()});function Ua(t){const e=new Set,r=n=>e.add(n.id);return t.engineConfig.renderGraph&&r(t.engineConfig.renderGraph),t.engineConfig.shaderGraphs.forEach(r),t.engineConfig.geometryGraphs.forEach(r),t.engineConfig.terrainGraphs.forEach(r),(t.engineConfig.particleGraphs??[]).forEach(r),e}function $a(t){const e=new Set;for(const r of t.engineConfig.particleGraphs??[])e.add(r.id);return e}function La(t){var c,u,f;const e=new Set([...Object.keys(t.resources.meshes),...Object.keys(t.resources.primitives??{})]),r=new Set(Object.keys(t.resources.textures)),n=new Set(Object.keys(t.resources.materials)),a=Ua(t),i=$a(t),s=new Set((t.scripts??[]).map(m=>m.id));for(const m of t.engineConfig.scriptGraphs??[])s.add(m.id);for(const[m,g]of t.engineConfig.shaderGraphs.entries()){if(g.inline==null)continue;const S=b.validateShaderGraphShape(g.inline,{strictSocketMetadata:!1});if(!S.valid)throw new ce(S.issues.map(O=>({code:"custom",message:`ShaderGraph "${g.id}" is invalid: ${O.message}`,path:["engineConfig","shaderGraphs",m,"inline",...O.path.split(".").filter(Boolean)]})))}const o=new Set(t.entities.map(m=>m.id));t.terrain&&o.add("Terrain"),t.water&&o.add("Water");for(const m of Object.values(t.resources.materials)){if(m.shaderGraphId!=null&&!a.has(m.shaderGraphId))throw new ce([{code:"custom",message:`Material "${m.name}" references shaderGraphId "${m.shaderGraphId}" not found in engineConfig.shaderGraphs`,path:["resources","materials"]}]);if(m.textureRefs){for(const[g,S]of Object.entries(m.textureRefs))if(!r.has(S))throw new ce([{code:"custom",message:`Material "${m.name}" references texture "${S}" not found in resources.textures`,path:["resources","materials"]}])}}for(const m of t.entities){if(m.parentId!=null&&!o.has(m.parentId))throw new ce([{code:"custom",message:`Entity "${m.id}" references parentId "${m.parentId}" not found in entities`,path:["entities"]}]);for(const g of m.components){if(g.type==="decal"){const S="materialId"in g?g.materialId:void 0;if(S===void 0||S==="")continue}if(g.type==="renderable"||g.type==="instancedMesh"||g.type==="decal"){const S="materialId"in g?g.materialId:void 0;if(S!=null&&S!==""&&!n.has(S))throw new ce([{code:"custom",message:`Entity "${m.id}" component references materialId "${S}" not found in resources.materials`,path:["entities"]}])}if(g.type==="renderable"||g.type==="instancedMesh"){const S=g.meshId;if(e.has(S))continue}if(g.type==="gproc"){if(!a.has(g.graphId))throw new ce([{code:"custom",message:`Entity "${m.id}" gproc references graphId "${g.graphId}" not found in engineConfig`,path:["entities"]}]);if(g.materialIds){for(const S of g.materialIds)if(!n.has(S))throw new ce([{code:"custom",message:`Entity "${m.id}" gproc references materialId "${S}" not found in resources.materials`,path:["entities"]}])}}if(g.type==="particle"){if(!i.has(g.graphId))throw new ce([{code:"custom",message:`Entity "${m.id}" particle references graphId "${g.graphId}" not found in engineConfig.particleGraphs`,path:["entities"]}]);if(!n.has(g.materialId))throw new ce([{code:"custom",message:`Entity "${m.id}" particle references materialId "${g.materialId}" not found in resources.materials`,path:["entities"]}]);if(g.meshId!=null&&g.meshId!==""&&!e.has(g.meshId))throw new ce([{code:"custom",message:`Entity "${m.id}" particle references meshId "${g.meshId}" not found in resources.meshes`,path:["entities"]}])}if(g.type==="scriptBinding"&&!s.has(g.scriptId))throw new ce([{code:"custom",message:`Entity "${m.id}" scriptBinding references scriptId "${g.scriptId}" not found in scripts or engineConfig.scriptGraphs`,path:["entities"]}])}}if(((u=(c=t.environment)==null?void 0:c.skybox)==null?void 0:u.type)==="hdr"&&!r.has(t.environment.skybox.textureId))throw new ce([{code:"custom",message:`Environment skybox references textureId "${t.environment.skybox.textureId}" not found in resources.textures`,path:["environment"]}]);if((f=t.environment)!=null&&f.ibl&&!r.has(t.environment.ibl.textureId))throw new ce([{code:"custom",message:`Environment ibl references textureId "${t.environment.ibl.textureId}" not found in resources.textures`,path:["environment"]}]);if(t.terrain&&!a.has(t.terrain.graphId))throw new ce([{code:"custom",message:`Terrain references graphId "${t.terrain.graphId}" not found in engineConfig.terrainGraphs`,path:["terrain"]}]);if(t.water&&!n.has(t.water.materialId))throw new ce([{code:"custom",message:`Water references materialId "${t.water.materialId}" not found in resources.materials`,path:["water"]}]);return t}const ln=Da.transform(La);function vr(t){return ln.parse(on(t))}function br(t){return typeof t=="object"&&t!==null&&"createView"in t&&typeof t.createView=="function"}function dn(t){return`${mt}${encodeURIComponent(t)}`}function un(t,e,r,n){var s,o,c;const a=r,i=(s=a.findTextureCacheKey)==null?void 0:s.bind(r);if(i)for(const[u,f]of Object.entries(t)){const m=(n==null?void 0:n.get(u))??((o=a.getMaterialByName)==null?void 0:o.call(a,u))??((c=a.getMaterialByName)==null?void 0:c.call(a,f.name));if(!(m!=null&&m.properties))continue;const g={};for(const[S,O]of m.properties.entries()){if(!br(O))continue;const $=i(O);$&&(g[S]=$,e[$]||(e[$]={url:dn($)}))}Object.keys(g).length>0&&(t[u]={...f,textureRefs:g})}}function fn(t,e,r){var s,o,c;if(!r)return;const a=(s=e.getTexture)==null?void 0:s.bind(e);if(!a)return;const i=new Set;((o=r.skybox)==null?void 0:o.type)==="hdr"&&r.skybox.textureId&&i.add(r.skybox.textureId),(c=r.ibl)!=null&&c.textureId&&i.add(r.ibl.textureId);for(const u of i)t[u]==null&&a(u)!=null&&(t[u]={url:dn(u)})}function hn(t,e){var i;const r=new Map,a=(i=e.getTexture)==null?void 0:i.bind(e);if(!a)return r;for(const[s,o]of Object.entries(t)){const c=(o.url??"").trim();if(!c.startsWith(mt))continue;const u=decodeURIComponent(c.slice(mt.length)),f=a(u);f!=null&&r.set(s,f)}return r}function Vt(t,e){return e==null?!0:Array.isArray(e)?e.includes(t):e.has(t)}function Ht(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function _r(t){const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}const Yt=20;function wr(t){const e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(t),e}function xr(t){const e=new Uint8Array(t.vertices.buffer,t.vertices.byteOffset,t.vertices.byteLength),r=new Uint8Array(t.indices.buffer,t.indices.byteOffset,t.indices.byteLength);return{verticesBase64:Ht(e),indicesBase64:Ht(r),indexFormat:t.indexFormat==="uint16"?"uint16":"uint32",vertexStrideFloats:Yt}}function mn(t,e,r){const n=e.vertexStrideFloats!=null&&e.vertexStrideFloats>0?e.vertexStrideFloats:Yt;if(n!==Yt)throw new Error(`Unsupported vertexStrideFloats ${n} (only ${Yt} is supported)`);const a=_r(e.verticesBase64);if(a.byteLength%4!==0)throw new Error("embedded vertices byte length must be a multiple of 4");const i=new Float32Array(wr(a));if(i.length%n!==0)throw new Error("embedded vertex float count must be divisible by vertex stride");const s=_r(e.indicesBase64);let o;if(e.indexFormat==="uint16"){if(s.byteLength%2!==0)throw new Error("uint16 embedded indices must have even byte length");o=new Uint16Array(wr(s))}else{if(s.byteLength%4!==0)throw new Error("uint32 embedded indices must have byte length multiple of 4");o=new Uint32Array(wr(s))}return new b.Mesh(i,o,r??t)}function qt(t){return t.split("?")[0].toLowerCase()}async function ja(t,e,r,n,a){var i,s;try{const o=await e(t);if(!o.ok){(i=a==null?void 0:a.debug)==null||i.call(a,`[inlineRemoteEngineConfigGraphs] ${r} id=${n} fetch failed ${t} (${o.status})`);return}return await o.json()}catch(o){const c=o instanceof Error?o.message:String(o);(s=a==null?void 0:a.debug)==null||s.call(a,`[inlineRemoteEngineConfigGraphs] ${r} id=${n}: ${c}`);return}}async function pn(t,e,r,n){if(t.inline!==void 0&&t.inline!==null)return;const a=(t.url??"").trim();if(!a)return;const i=t.id??"(no id)",s=await ja(a,r,e,i,n);s!==void 0&&(t.inline=s,delete t.url)}async function gn(t,e){var i,s;const r=(e==null?void 0:e.fetchFn)??globalThis.fetch;if(typeof r!="function"){(s=(i=e==null?void 0:e.logger)==null?void 0:i.debug)==null||s.call(i,"[inlineRemoteEngineConfigGraphs] skip (no fetch)");return}const n=t.engineConfig;await pn(n.renderGraph,"renderGraph",r,e==null?void 0:e.logger);const a=[{list:n.shaderGraphs,label:"shaderGraph"},{list:n.geometryGraphs,label:"geometryGraph"},{list:n.terrainGraphs,label:"terrainGraph"},{list:n.particleGraphs??[],label:"particleGraph"},{list:n.scriptGraphs??[],label:"scriptGraph"}];for(const{list:o,label:c}of a)for(const u of o)await pn(u,c,r,e==null?void 0:e.logger)}async function yn(t,e){var a,i,s,o,c,u,f,m,g,S,O,$,z,X,V,G;const r=t.resources.textures,n=(e==null?void 0:e.fetchFn)??globalThis.fetch;for(const[J,ee]of Object.entries(r)){if((a=ee.embedded)!=null&&a.dataBase64&&ee.embedded.dataBase64.length>0)continue;const K=(ee.url??"").trim();if(K){if(K.startsWith(mt)){const Z=decodeURIComponent(K.slice(mt.length)),M=(s=(i=e==null?void 0:e.resolveW3dtsTextureSourceUrl)==null?void 0:i.call(e,Z))==null?void 0:s.trim();let I=await((o=e==null?void 0:e.resolveW3dtsTextureBytes)==null?void 0:o.call(e,Z));if(!(I!=null&&I.length)&&typeof n=="function"&&M)try{const U=await n(M);U.ok?I=new Uint8Array(await U.arrayBuffer()):(u=(c=e==null?void 0:e.logger)==null?void 0:c.debug)==null||u.call(c,`[finalizeStandaloneResources] w3dts source fetch failed ${J} ${M} (${U.status})`)}catch(U){const oe=U instanceof Error?U.message:String(U);(m=(f=e==null?void 0:e.logger)==null?void 0:f.debug)==null||m.call(f,`[finalizeStandaloneResources] w3dts source fetch ${J}: ${oe}`)}if(!(I!=null&&I.length)){(S=(g=e==null?void 0:e.logger)==null?void 0:g.debug)==null||S.call(g,`[finalizeStandaloneResources] skip w3dts-texture "${J}" (no bytes from resolver or source url)`);continue}const D={...ee};if(delete D.url,D.embedded={dataBase64:Ht(I)},D.format==null&&(qt(K).endsWith(".hdr")||qt(Z).endsWith(".hdr"))&&(D.format="hdr"),D.format==null&&M){const U=qt(M);U.endsWith(".hdr")?D.format="hdr":U.endsWith(".jpg")||U.endsWith(".jpeg")?D.format="jpg":U.endsWith(".png")&&(D.format="png")}r[J]=D;continue}if(typeof n!="function"){($=(O=e==null?void 0:e.logger)==null?void 0:O.debug)==null||$.call(O,`[finalizeStandaloneResources] skip "${J}" (no fetch for url load)`);continue}try{const Z=await n(K);if(!Z.ok){(X=(z=e==null?void 0:e.logger)==null?void 0:z.debug)==null||X.call(z,`[finalizeStandaloneResources] fetch failed ${J} ${K} (${Z.status})`);continue}const M=await Z.arrayBuffer(),I=new Uint8Array(M),D={...ee};delete D.url,D.embedded={dataBase64:Ht(I)};const U=qt(K);D.format==null&&(U.endsWith(".hdr")?D.format="hdr":U.endsWith(".jpg")||U.endsWith(".jpeg")?D.format="jpg":U.endsWith(".png")?D.format="png":U.endsWith(".ktx2")&&(D.format="ktx2")),r[J]=D}catch(Z){const M=Z instanceof Error?Z.message:String(Z);(G=(V=e==null?void 0:e.logger)==null?void 0:V.debug)==null||G.call(V,`[finalizeStandaloneResources] texture "${J}": ${M}`)}}}}const Pa=16;function Jt(t){return[Number(t[0]??0),Number(t[1]??0),Number(t[2]??0)]}function Tt(t){const e=Math.min(t.length,Pa),r=new Array(e);for(let n=0;n<e;n++)r[n]=Number(t[n]);return r}function za(t){return t==null?t:Array.isArray(t)?t.length>0&&typeof t[0]=="number"?Tt(t):t:typeof t=="object"&&t!==null&&!(t instanceof Map)&&"length"in t&&typeof t[0]=="number"?Tt(t):(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||typeof t=="object"&&!(t instanceof Map),t)}function Sr(t){const e={},r=t.properties,n=V=>{if(r)return r instanceof Map?r.get(V):r[V]},a=n("baseColor"),i=t.diffuseColor;if(a&&a.length>=4)e.baseColor=Tt(a),e.diffuseColor=Jt(a);else if(a&&a.length>=3)e.baseColor=Tt(a),e.diffuseColor=Jt(a);else if(i&&i.length>=3){const V=Jt(i);e.diffuseColor=V,e.baseColor=V}const s=n("emissiveColor")??t.emissiveColor;s&&s.length>=4?e.emissiveColor=Tt(s):s&&s.length>=3&&(e.emissiveColor=Jt(s));const o=n("metallic");e.metallic=typeof o=="number"?o:typeof t.metallic=="number"?t.metallic:void 0;const c=n("roughness");e.roughness=typeof c=="number"?c:typeof t.roughness=="number"?t.roughness:void 0;const u=n("uvScale"),f=u&&u.length>=2?u:t.uvScale;f&&(e.uvScale=[f[0]??1,f[1]??1]);const m=n("uvOffset"),g=m&&m.length>=2?m:t.uvOffset;g&&(e.uvOffset=[g[0]??0,g[1]??0]);const S=n("uvRotation");e.uvRotation=typeof S=="number"?S:typeof t.uvRotation=="number"?t.uvRotation:void 0;const O=n("alphaMode"),$=typeof O=="string"?O:t.alphaMode;$&&(e.alphaMode=$);const z=n("alphaCutoff");e.alphaCutoff=typeof z=="number"?z:typeof t.alphaCutoff=="number"?t.alphaCutoff:void 0;const X=n("doubleSided");if(e.doubleSided=typeof X=="boolean"?X:typeof t.doubleSided=="boolean"?t.doubleSided:void 0,r){const V=r instanceof Map?r.entries():Object.entries(r);for(const[G,J]of V)e[G]===void 0&&(br(J)||(e[G]=za(J)))}return e.baseColor===void 0&&e.diffuseColor&&(e.baseColor=e.diffuseColor),e}function Kt(t,e){if(t.length===0)return;const r=typeof(e==null?void 0:e.id)=="string"?e.id:void 0,n=typeof(e==null?void 0:e.name)=="string"?e.name:void 0,a=t.find(i=>i!==r&&i!==n);return a||(r&&t.includes(r)?r:t[0])}function Fa(t,e,r){if(e==null)return r;const n=[];for(const[o,c]of t)c===e&&n.push(o);const a=e,i=Kt(n,a);if(i)return i;const s=typeof a.id=="string"?a.id:void 0;if(s){const o=[];for(const[u,f]of t)f!==e&&(f&&typeof f=="object"&&f.id===s&&o.push(u),u===s&&o.push(u));const c=Kt([...new Set(o)],a);if(c)return c}return r}const Ga="1.0";function pt(t){return[t[0]??0,t[1]??0,t[2]??0]}function Za(t){return[t[0]??0,t[1]??0,t[2]??0,t[3]??1]}function Xt(t){return Array.from(t.entries()).map(([e,r])=>({id:e,inline:r}))}function Ba(t,e){const r=new Set(e.map(n=>n.id));for(const n of t)for(const a of n.components){if(a.type!=="gproc"||r.has(a.graphId))continue;const i=e.filter(c=>{const u=c.inline;return u!=null&&typeof u=="object"&&u.id===a.graphId});if(i.length===0)continue;const s=i[0].inline,o=Kt(i.map(c=>c.id),s)??i[0].id;a.graphId=o}}const Wa=(t,...e)=>{};function et(t,e,...r){var n;(((n=t==null?void 0:t.logger)==null?void 0:n.debug)??Wa)(e,...r)}function Va(){const t=new WeakMap;let e=0;return r=>{var i;let n=t.get(r);return n===void 0&&(n=e++,t.set(r,n)),`${(i=r.name)!=null&&i.trim()?r.name.replace(/\s+/g,"_"):"mesh"}__o${n}`}}function Ha(){const t=new WeakMap;let e=0;return r=>{var i;let n=t.get(r);return n===void 0&&(n=e++,t.set(r,n)),`${(i=r.name)!=null&&i.trim()?r.name.replace(/\s+/g,"_"):"mat"}__o${n}`}}function vn(t,e,r){var be,Q,Ee,je,Pe,v,C;et(r,"serialize() start",{hasGetScriptBinding:!!(r!=null&&r.getScriptBinding),hasGetScriptGraphs:!!(r!=null&&r.getScriptGraphs)});const n=[],a={},i={},s={},o={},c=Va(),u=Ha(),f=new Map;let m;const g=new Set,S=new Map;function O(d){let p=S.get(d);if(p!=null)return p;const F=t.getComponent(d,b.NameComponent),ae=(F==null?void 0:F.name)??`e_${d}`;let h=ae,x=0;for(;g.has(h);)h=`${ae}_${x++}`;return g.add(h),S.set(d,h),h}const $=t.query([b.TransformComponent]),z=[],X=r==null?void 0:r.sceneRootEntity,V=r==null?void 0:r.componentCodecRegistry,G={heroWaterBodies:[]};for(const[d,[p]]of $.iter())if(!t.getComponent(d,b.ChunkComponent)&&!(V!=null&&V.shouldSkipEntity({world:t,entity:d}))&&!t.getComponent(d,b.EditorOnlyComponent)&&!(X!==void 0&&d===X)){if(X===void 0){const F=t.getComponent(d,b.HierarchyComponent),ae=t.getComponent(d,b.NameComponent);if((F==null?void 0:F.parent)==null&&(ae==null?void 0:ae.name)==="Scene Root")continue}z.push([d,p])}const J=e.getCachedGraphs("terrain-graph"),ee=J.size>0?Array.from(J.keys())[0]??"terrain":"terrain";for(const[d,p]of z){const F={world:t,entity:d,resourceManager:e,options:r,stableId:O,meshManifestId:c,materialManifestId:u,materials:o,meshes:a,primitives:i,liveMaterialsByManifestId:f,log:(_e,...de)=>et(r,_e,...de),hero:G,firstTerrainGraphId:ee};if(V){const _e=V.trySerializeHeroEntity(F);if(_e==="consumed"||_e==="skip-entity")continue}const ae=O(d),h=t.getComponent(d,b.NameComponent),x=t.getComponent(d,b.HierarchyComponent),B=(x==null?void 0:x.parent)??null;let Me=B!=null?O(B):void 0;B!=null&&(B===X||X===void 0&&((be=t.getComponent(B,b.NameComponent))==null?void 0:be.name)==="Scene Root"&&((Q=t.getComponent(B,b.HierarchyComponent))==null?void 0:Q.parent)==null)&&(Me=void 0);const Oe={position:pt(p.position),rotation:Za(p.rotation),scale:pt(p.scale)},L=[];let ie=!1;if(V){const _e=V.serializeEntityComponents(F);_e.components.length>0&&L.push(..._e.components),ie=_e.suppressRenderable===!0}if(!ie){const _e=t.getComponent(d,b.RenderableComponent);if(_e){const ke=_e.mesh,Ie=_e.material,qe=ke?c(ke):`mesh_${d}`,Be=Ie?u(Ie):`mat_${d}`,Je=ke&&ke.primitiveSource;if(ke&&!a[qe]&&!i[qe]){const ze=ke.bakedGeometryDirty===!0;Je&&!ze?i[qe]={type:Je.type,params:Je.params}:(r==null?void 0:r.standaloneResources)===!0||ze?a[qe]={embedded:xr(ke),name:ke.name}:(r==null?void 0:r.includeProceduralMeshesInResources)===!0&&(a[qe]={url:"",name:ke.name})}if(Ie&&f.set(Be,Ie),Ie&&!o[Be]){const ze=Ie.shaderGraph,kt=Sr(Ie);et(r,`material[${Be}]`,{baseColor:kt.baseColor,diffuseColor:kt.diffuseColor,emissiveColor:kt.emissiveColor,keys:Object.keys(kt)}),o[Be]={name:Ie.name,shadingModel:Ie.shadingModel,shaderGraphId:ze==null?void 0:ze.id,properties:Object.keys(kt).length>0?kt:void 0}}L.push({type:"renderable",meshId:qe,materialId:Be,castShadow:_e.castShadow,visible:b.isEntityLocallyVisible(t,d)})}t.getComponent(d,b.StaticComponent)&&L.push({type:"static"}),t.getComponent(d,b.HiddenComponent)&&L.push({type:"hidden"});const de=t.getComponent(d,b.InstancedMeshComponent);if(de){const ke=de.mesh?c(de.mesh):`mesh_${d}`,Ie=de.material?u(de.material):`mat_${d}`,qe=de.mesh&&de.mesh.primitiveSource;if(de.mesh&&!a[ke]&&!i[ke]&&(qe?i[ke]={type:qe.type,params:qe.params}:(r==null?void 0:r.standaloneResources)===!0?a[ke]={embedded:xr(de.mesh),name:de.mesh.name}:(r==null?void 0:r.includeProceduralMeshesInResources)===!0&&(a[ke]={url:"",name:de.mesh.name})),de.material&&f.set(Ie,de.material),de.material&&!o[Ie]){const Je=de.material,ze=Sr(de.material);et(r,`material[${Ie}] (instanced)`,{baseColor:ze.baseColor,diffuseColor:ze.diffuseColor,emissiveColor:ze.emissiveColor}),o[Ie]={name:Je.name,shadingModel:Je.shadingModel,shaderGraphId:(Ee=Je.shaderGraph)==null?void 0:Ee.id,properties:Object.keys(ze).length>0?ze:void 0}}let Be;if(r!=null&&r.getInstanceData){const Je=r.getInstanceData(d,de);Be=Je?Array.from(Je):[]}else r!=null&&r.getInstanceDataAsync?(Be=[],(m??(m=[])).push({compRef:{type:"instancedMesh",meshId:ke,materialId:Ie,instances:Be,count:de.instanceCount,castShadow:de.castShadow},entity:d,comp:de})):Be=[];r!=null&&r.getInstanceDataAsync?L.push(m.slice(-1)[0].compRef):L.push({type:"instancedMesh",meshId:ke,materialId:Ie,instances:Be,count:de.instanceCount,castShadow:de.castShadow})}}const q=t.getComponent(d,b.DirectionalLightComponent);q&&L.push({type:"directionalLight",color:pt(q.color),intensity:q.intensity,castShadow:q.shadowsEnabled});const re=t.getComponent(d,b.PointLightComponent);re&&L.push({type:"pointLight",color:pt(re.color),intensity:re.intensity,range:re.range});const Ze=t.getComponent(d,b.SpotLightComponent);Ze&&L.push({type:"spotLight",color:pt(Ze.color),intensity:Ze.intensity,range:Ze.range,angle:Ze.innerAngle,penumbra:Ze.outerAngle-Ze.innerAngle});const rt=t.getComponent(d,b.AreaLightComponent);rt&&L.push({type:"areaLight",color:pt(rt.color),intensity:rt.intensity,width:rt.width,height:rt.height});const nt=t.getComponent(d,b.CameraComponent);nt&&L.push({type:"camera",fov:nt.fov,near:nt.near,far:nt.far,isPrimary:nt.isActive,isMain:nt.isMain,firstPersonEyeOffsetY:nt.firstPersonEyeOffsetY});const j=t.getComponent(d,b.GameCameraControllerComponent);j&&L.push({type:"cameraController",mode:j.mode,...j.applyOn!=="play"?{applyOn:j.applyOn}:{},...j.fpsSpeed!=null?{fpsSpeed:j.fpsSpeed}:{},...j.fpsSprintSpeed!=null?{fpsSprintSpeed:j.fpsSprintSpeed}:{},...j.fpsSensitivity!=null?{fpsSensitivity:j.fpsSensitivity}:{},...j.fpsDampingFactor!=null?{fpsDampingFactor:j.fpsDampingFactor}:{},...j.fpsPlayerHeight!=null?{fpsPlayerHeight:j.fpsPlayerHeight}:{},...j.fpsFlightMode!=null?{fpsFlightMode:j.fpsFlightMode}:{},...j.orbitalMinDistance!=null?{orbitalMinDistance:j.orbitalMinDistance}:{},...j.orbitalMaxDistance!=null?{orbitalMaxDistance:j.orbitalMaxDistance}:{},...j.orbitalZoomSensitivity!=null?{orbitalZoomSensitivity:j.orbitalZoomSensitivity}:{},...j.orbitalRotateSpeed!=null?{orbitalRotateSpeed:j.orbitalRotateSpeed}:{},...j.orbitalDamping!=null?{orbitalDamping:j.orbitalDamping}:{},...j.orbitalLeftMouseMode!==null?{orbitalLeftMouseMode:j.orbitalLeftMouseMode}:{},...j.chaseTargetEntityId!=null?{chaseTargetEntityId:j.chaseTargetEntityId}:{},...j.chaseDistance!=null?{chaseDistance:j.chaseDistance}:{},...j.chaseHeight!=null?{chaseHeight:j.chaseHeight}:{},...j.chaseLookAhead!=null?{chaseLookAhead:j.chaseLookAhead}:{},...j.chaseLookHeight!=null?{chaseLookHeight:j.chaseLookHeight}:{},...j.chaseFocusSmoothXZ!=null?{chaseFocusSmoothXZ:j.chaseFocusSmoothXZ}:{},...j.chaseFocusSmoothY!=null?{chaseFocusSmoothY:j.chaseFocusSmoothY}:{},...j.chaseYawSmooth!=null?{chaseYawSmooth:j.chaseYawSmooth}:{}});const Br=t.getComponent(d,b.PlayerSpawnComponent);Br&&L.push({type:"playerSpawn",...Br.priority!==0?{priority:Br.priority}:{}});const Fn=t.getComponent(d,b.StreamableSceneComponent);Fn&&L.push({type:"streamableScene",url:"",lodDistances:Fn.lodDistances??[]});const Gn=t.getComponent(d,b.DecalComponent);Gn&&L.push({type:"decal",size:pt(Gn.size)});const Zn=t.getComponent(d,b.ColorComponent);if(Zn){const _e=Zn.value;L.push({type:"color",value:[_e[0]??1,_e[1]??1,_e[2]??1,_e[3]??1]})}const yt=(je=r==null?void 0:r.getScriptBinding)==null?void 0:je.call(r,d);et(r,`entity id=${ae} name=${(h==null?void 0:h.name)??ae} getScriptBinding=`,yt??"(none)"),yt&&L.push({type:"scriptBinding",scriptId:yt.scriptId,...yt.properties&&typeof yt.properties=="object"&&Object.keys(yt.properties).length>0?{properties:yt.properties}:{}}),n.push({id:ae,name:h==null?void 0:h.name,parentId:Me,transform:Oe,components:L})}const K=Xt(e.getCachedGraphs("shader-graph")),Z=Xt(e.getCachedGraphs("geometry-graph")),M=Xt(e.getCachedGraphs("terrain-graph")),I=Xt(e.getCachedGraphs("particle-graph"));Ba(n,Z);const D=(Pe=r==null?void 0:r.getGameRenderGraphEntry)==null?void 0:Pe.call(r),U=e.getCachedGraphs("render-graph"),oe=Array.from(U.keys())[0],$e=D??(oe!=null?{id:oe,inline:U.get(oe)}:{id:"default"}),fe=((v=r==null?void 0:r.getScriptGraphs)==null?void 0:v.call(r))??[],ge=n.filter(d=>d.components.some(p=>p.type==="scriptBinding")).length;et(r,"scriptGraphs",fe.length,"ids=",fe.map(d=>d.id)),et(r,"geometryGraphs",Z.length,"ids=",Z.map(d=>d.id)),et(r,"entities with scriptBinding",ge,"of",n.length),un(o,s,e,f);const le=(C=r==null?void 0:r.getEnvironmentDescriptor)==null?void 0:C.call(r);fn(s,e,le);const te={renderGraph:$e,shaderGraphs:K,geometryGraphs:Z,terrainGraphs:M,...I.length>0?{particleGraphs:I}:{},...fe.length>0?{scriptGraphs:fe}:{}},ye={name:(r==null?void 0:r.sceneName)??"Untitled Scene",projectName:r==null?void 0:r.projectName,createdAt:new Date().toISOString(),engineVersion:(r==null?void 0:r.engineVersion)??Ga,engine:"w3dts",copyright:"cyril.tarriet@gmail.com",packageVersions:(r==null?void 0:r.packageVersions)??{},serializerPackageVersion:sn};let ne;const Ye=r==null?void 0:r.enabledSceneExtensionIds;for(const d of(r==null?void 0:r.sceneExtensions)??[]){if(!d.serialize)continue;if(!Vt(d.id,Ye)){et(r,"serialize: skip sceneExtension (not in enabledSceneExtensionIds)",d.id);continue}const p=d.serialize({world:t,resourceManager:e,options:r,entityToId:S});p!==void 0&&(ne||(ne={}),ne[d.id]=p)}let he=G.terrainDesc;const Ne=G.waterDesc;he&&G.heroWaterBodies.length>0&&(he={...he,waterBodies:G.heroWaterBodies});const ve={version:"1.0",format:gr,formatVersion:yr,metadata:ye,engineConfig:te,resources:{meshes:a,primitives:i,textures:s,materials:o},entities:n,...he!=null?{terrain:he}:{},...Ne!=null?{water:Ne}:{},...le!=null?{environment:le}:{},...ne!=null?{extensions:ne}:{}};return m!=null&&m.length&&(r!=null&&r.getInstanceDataAsync)?{descriptor:ve,pendingInstanceData:m}:ve}function Ya(t){return typeof t=="object"&&t!==null&&"pendingInstanceData"in t&&"descriptor"in t}async function qa(t,e,r){const n=vn(t,e,r);let a;if(Ya(n)){a=n.descriptor;const i=n.pendingInstanceData;if(i.length>0&&(r!=null&&r.getInstanceDataAsync))for(const s of i){const o=await r.getInstanceDataAsync(s.entity,s.comp);o&&(s.compRef.instances=Array.from(o))}}else a=n;if(r!=null&&r.standaloneResources){const i=r.standaloneFetchFn??globalThis.fetch;await yn(a,{resolveW3dtsTextureBytes:r.resolveW3dtsTextureBytes,resolveW3dtsTextureSourceUrl:r.resolveW3dtsTextureSourceUrl,fetchFn:i,logger:r.logger}),r.standaloneInlineGraphs!==!1&&await gn(a,{fetchFn:i,logger:r.logger})}return a}function bn(t){const e=(t??"").trim();return e.length>0&&!e.startsWith(mt)}function _n(t,e){var r;return e?!1:(r=t.embedded)!=null&&r.dataBase64&&t.embedded.dataBase64.length>0?!0:bn(t.url)}function Ja(t){return t.split("?")[0].toLowerCase()}function Ka(t){if(typeof globalThis>"u")return t;const e=globalThis.__W3DTS_RESOLVE_PUBLIC_ASSET_URL__;return typeof e=="function"?e(t):t}function Xa(t){switch(t){case"jpg":return"image/jpeg";case"png":return"image/png";case"hdr":return"application/octet-stream";case"ktx2":return"image/ktx2";default:return"application/octet-stream"}}async function wn(t,e,r){var o;if((o=r.embedded)!=null&&o.dataBase64){const c=_r(r.embedded.dataBase64);if(r.format==="hdr"){const S=new ArrayBuffer(c.byteLength);return new Uint8Array(S).set(c),(await b.TextureLoader.createFromHDRBuffer(t,S,e)).texture}const m=`data:${Xa(r.format)};base64,${r.embedded.dataBase64}`,g=await b.TextureLoader.create(t,m,{generateMips:!0,flipY:!1});return g.texture.label=e,g.texture}const n=Ka((r.url??"").trim());if(!n)return;const a=Ja(n),i=r.format==="hdr"||a.endsWith(".hdr");if(i&&!a.endsWith(".hdr")){const c=await fetch(n);if(!c.ok)throw new Error(`Failed to fetch HDR texture: ${n} (${c.status})`);const u=await c.arrayBuffer();return(await b.TextureLoader.createFromHDRBuffer(t,u,e)).texture}return(await b.TextureLoader.create(t,n,{generateMips:!i})).texture}async function xn(t){var g,S;const{textures:e,resourceManager:r,device:n,resolvedTextures:a,options:i,reportProgress:s,yieldIfNeeded:o}=t,c=Object.entries(e).filter(([O,$])=>!!_n($,a.has(O))),u=c.length;let f=0;const m=(i==null?void 0:i.loadTextureEntry)??wn;for(const[O,$]of c){try{const z=await m(n,O,$);if(z!=null){const X=($.url??"").trim();r.registerTexture(O,z,X||void 0),a.set(O,z)}}catch(z){const X=z instanceof Error?z.message:String(z);(S=(g=i==null?void 0:i.logger)==null?void 0:g.debug)==null||S.call(g,`[SceneDeserializer] texture "${O}" load failed: ${X}`),i!=null&&i.logger||console.warn("[SceneDeserializer] texture load failed",O,z)}f++,s==null||s(f,u),o&&await o()}}async function Sn(t){const e=await fetch(t);if(!e.ok)throw new Error(`defaultFetchGraphJson: HTTP ${e.status} for ${t}`);return e.json()}async function kn(t){const e=await fetch(t);if(!e.ok)throw new Error(`defaultFetchScriptSource: HTTP ${e.status} for ${t}`);return e.text()}function Qt(t){return Se.vec3.fromValues(t[0],t[1],t[2])}function Qa(t){const e=new Map(t.map(i=>[i.id,i])),r=[],n=new Set;function a(i){if(!n.has(i.id)){if(i.parentId!=null&&!n.has(i.parentId)){const s=e.get(i.parentId);s&&a(s)}r.push(i),n.add(i.id)}}for(const i of t)a(i);return r}const xe=(t,e,...r)=>{var n;(n=t==null?void 0:t.logger)==null||n.debug(e,...r),t!=null&&t.logger||console.log("[SceneDeserializer]",e,...r)},ei=/__o\d+$/;function kr(t,e,r,n){var c,u;const a=e.get(t);if(a)return a;const i=r(t);if(i)return i;const s=(u=(c=n==null?void 0:n[t])==null?void 0:c.name)==null?void 0:u.trim();if(s){const f=r(s);if(f)return f}const o=t.replace(ei,"");if(o!==t)return r(o)}async function ti(t,e,r){var oe,$e,fe,ge,le,te,ye,ne,Ye,he,Ne,ve,be,Q,Ee,je,Pe;const n=vr(t),{world:a,resourceManager:i}=e,s=((oe=r==null?void 0:r.asyncScheduling)==null?void 0:oe.enabled)===!0,o=Math.max(1,(($e=r==null?void 0:r.asyncScheduling)==null?void 0:$e.entityChunkSize)??50),c=async()=>{s&&await b.yieldToMain()},u=(v,C,d)=>{var p;s&&((p=r==null?void 0:r.onProgress)==null||p.call(r,v,C,d))};xe(r,"deserialize() start",{hasAddScriptBinding:!!(r!=null&&r.addScriptBinding)});const f=(r==null?void 0:r.fetchGraphJson)??(typeof globalThis.fetch=="function"?Sn:void 0);async function m(v,C){if(v.inline!=null)return v.inline;if(v.url){if(!f){xe(r,`Graph ${C} id=${v.id}: url set but no fetch (pass DeserializeOptions.fetchGraphJson or use global fetch)`,v.url);return}return xe(r,`fetch graph ${C}`,v.id,v.url),f(v.url)}}const g=await m(n.engineConfig.renderGraph,"renderGraph");g!=null&&i.upsertGraphResource("render-graph",g,n.engineConfig.renderGraph.id);for(const v of n.engineConfig.shaderGraphs){const C=await m(v,"shaderGraph");C!=null&&i.upsertGraphResource("shader-graph",C,v.id)}for(const v of n.engineConfig.geometryGraphs){const C=await m(v,"geometryGraph");C!=null&&i.upsertGraphResource("geometry-graph",C,v.id)}for(const v of n.engineConfig.terrainGraphs){const C=await m(v,"terrainGraph");C!=null&&i.upsertGraphResource("terrain-graph",C,v.id)}for(const v of n.engineConfig.particleGraphs??[]){const C=await m(v,"particleGraph");C!=null&&i.upsertGraphResource("particle-graph",C,v.id)}const S=n.engineConfig.scriptGraphs;xe(r,"scriptGraphs in descriptor",(S==null?void 0:S.length)??0,"ids=",(S==null?void 0:S.map(v=>v.id))??[]);for(const v of S??[]){const C=await m(v,"scriptGraph");C!=null&&(i.upsertGraphResource("script-graph",C,v.id),xe(r,"registered script-graph",v.id))}if((fe=n.scripts)!=null&&fe.length&&(r!=null&&r.onScriptsResolved)){const v=r.fetchScriptSource??(typeof globalThis.fetch=="function"?kn:void 0),C=[];for(const d of n.scripts)if(d.sourceUrl&&(!d.source||d.source.length===0))if(v){xe(r,"fetch script source",d.id,d.sourceUrl);const p=await v(d.sourceUrl);C.push({...d,source:p})}else xe(r,`Script ${d.id}: sourceUrl set but no fetch (pass DeserializeOptions.fetchScriptSource or use global fetch)`,d.sourceUrl),C.push(d);else C.push(d);await r.onScriptsResolved(C)}else if((ge=n.scripts)!=null&&ge.length)for(const v of n.scripts)v.sourceUrl&&(!v.source||v.source.length===0)&&xe(r,`Script ${v.id}: sourceUrl present but onScriptsResolved omitted; source not fetched`,v.sourceUrl);u("graphs"),await c();const O=hn(n.resources.textures,i),$=(te=(le=e.engine)==null?void 0:le.webGPUContext)==null?void 0:te.device;$?await xn({textures:n.resources.textures,resourceManager:i,device:$,resolvedTextures:O,options:r,reportProgress:s&&(r!=null&&r.onProgress)?(v,C)=>r.onProgress("textures",v,C):void 0,yieldIfNeeded:s?c:void 0}):xe(r,"skip URL texture load: no engine.webGPUContext.device (w3dts-texture: refs still resolve)"),await c(),n.environment&&(r!=null&&r.applyEnvironmentFromDescriptor)&&(xe(r,"applyEnvironmentFromDescriptor"),await r.applyEnvironmentFromDescriptor(n.environment,{params:e,resourceManager:i}),await c());const z=new Map,X=i.getCachedGraphs("shader-graph"),V=v=>v.properties??{};for(const[v,C]of Object.entries(n.resources.materials)){const d=C.shaderGraphId?X.get(C.shaderGraphId):void 0,p=V(C);xe(r,`material[${v}] from descriptor`,{baseColor:p.baseColor,diffuseColor:p.diffuseColor,emissiveColor:p.emissiveColor});const F=Array.isArray(p.baseColor)&&p.baseColor.length>=3?p.baseColor:Array.isArray(p.diffuseColor)&&p.diffuseColor.length>=3?p.diffuseColor:void 0,ae=F?Se.vec3.fromValues(Number(F[0]),Number(F[1]),Number(F[2])):void 0,h=Array.isArray(p.emissiveColor)&&p.emissiveColor.length>=3?p.emissiveColor:void 0,x=h?Se.vec3.fromValues(Number(h[0]),Number(h[1]),Number(h[2])):void 0,B=new b.Material({name:C.name,shadingModel:C.shadingModel,shaderGraph:d,diffuseColor:ae,emissiveColor:x,metallic:typeof p.metallic=="number"?p.metallic:void 0,roughness:typeof p.roughness=="number"?p.roughness:void 0,uvScale:Array.isArray(p.uvScale)&&p.uvScale.length>=2?[Number(p.uvScale[0]),Number(p.uvScale[1])]:void 0,uvOffset:Array.isArray(p.uvOffset)&&p.uvOffset.length>=2?[Number(p.uvOffset[0]),Number(p.uvOffset[1])]:void 0,uvRotation:typeof p.uvRotation=="number"?p.uvRotation:void 0,alphaMode:typeof p.alphaMode=="string"?p.alphaMode:void 0,alphaCutoff:typeof p.alphaCutoff=="number"?p.alphaCutoff:void 0,doubleSided:typeof p.doubleSided=="boolean"?p.doubleSided:void 0,properties:p});if(Object.keys(p).length>0)for(const[ie,q]of Object.entries(p)){let re=q;if(Array.isArray(q)&&q.length>=2&&typeof q[0]=="number"){const Ze=d==null?void 0:d.properties,rt=(ye=Ze==null?void 0:Ze[ie])==null?void 0:ye.type,nt=(ie==="baseColor"||ie==="emissiveColor")&&q.length>=4&&rt==null;rt==="vec4f"||nt?re=[Number(q[0]),Number(q[1]),Number(q[2]),q.length>=4?Number(q[3]):1]:rt==="vec2f"||q.length===2?re=[Number(q[0]),Number(q[1])]:q.length>=3&&(re=Se.vec3.fromValues(Number(q[0]),Number(q[1]),Number(q[2])))}B.properties.set(ie,re)}const Me=Array.isArray(p.baseColor)&&p.baseColor.length>=3?p.baseColor:Array.isArray(p.diffuseColor)&&p.diffuseColor.length>=3?p.diffuseColor:null;if(d&&((ne=d.properties)==null?void 0:ne.baseColor)!==void 0&&!B.properties.has("baseColor")&&Me){const ie=Me,q=(Ye=d.properties.baseColor)==null?void 0:Ye.type,re=q==="vec4f"||q==null&&ie.length>=4;B.properties.set("baseColor",re?[Number(ie[0]),Number(ie[1]),Number(ie[2]),ie.length>=4?Number(ie[3]):1]:Se.vec3.fromValues(Number(ie[0]),Number(ie[1]),Number(ie[2])))}if(d&&((he=d.properties)==null?void 0:he.emissiveColor)!==void 0&&!B.properties.has("emissiveColor")&&h&&h.length>=3){const ie=(Ne=d.properties.emissiveColor)==null?void 0:Ne.type,q=ie==="vec4f"||ie==null&&h.length>=4;B.properties.set("emissiveColor",q?[Number(h[0]),Number(h[1]),Number(h[2]),h.length>=4?Number(h[3]):1]:Se.vec3.fromValues(Number(h[0]),Number(h[1]),Number(h[2])))}const Oe=B.properties.get("baseColor");Oe&&Oe.length>=3&&(B.diffuseColor[0]=Number(Oe[0]),B.diffuseColor[1]=Number(Oe[1]),B.diffuseColor[2]=Number(Oe[2]));const L=B.properties.get("emissiveColor");if(L&&L.length>=3&&(B.emissiveColor[0]=Number(L[0]),B.emissiveColor[1]=Number(L[1]),B.emissiveColor[2]=Number(L[2])),C.textureRefs)for(const[ie,q]of Object.entries(C.textureRefs)){const re=O.get(q);re&&B.properties.set(ie,re)}i.uploadMaterial(B),z.set(v,B)}u("materials"),await c();const G=new Map,J=n.resources.primitives??{};for(const[v,C]of Object.entries(J)){const d=C.params??{};let p;switch(C.type){case"quad":p=b.PrimitiveFactory.createQuad();break;case"cube":{const F=d.worldUvScaleX,ae=d.worldUvScaleY,h=d.worldUvScaleZ,x=F!=null&&ae!=null&&h!=null;p=b.PrimitiveFactory.createCube(d.size??1,x?{worldUvScale:[Number(F),Number(ae),Number(h)]}:void 0);break}case"sphere":p=b.PrimitiveFactory.createSphere(d.radius??.5,d.latitudeBands??30,d.longitudeBands??30);break;case"plane":p=b.PrimitiveFactory.createPlane(d.size??10,d.uvRepeat??1);break;case"cylinder":p=b.PrimitiveFactory.createCylinder(d.radiusTop??d.radius??1,d.radiusBottom??d.radius??1,d.height??1,d.radialSegments??8,d.heightSegments??1);break;case"capsule":p=b.PrimitiveFactory.createCapsule(d.radius??.5,d.height??1,d.radialSegments??16,d.ringsCylinder??1,d.ringsCap??4);break;case"grassTuft":p=b.PrimitiveFactory.createGrassTuft(d.width??1,d.height??1);break;default:continue}p.name=v,i.uploadMesh(p),G.set(v,p)}for(const[v,C]of Object.entries(n.resources.meshes))if(!(!C.embedded||G.has(v)))try{const d=mn(v,C.embedded,C.name??v);i.uploadMesh(d),G.set(v,d)}catch(d){xe(r,`embedded mesh "${v}" failed`,d)}const ee=r==null?void 0:r.modelLoader;if(ee)for(const[v,C]of Object.entries(n.resources.meshes)){if(G.has(v))continue;const d=(C.url??"").trim();if(d)try{const p=await ee.load(d,a);if(p==null)continue;const F=ae=>{const h=ae.entityId,x=a.getComponent(h,b.RenderableComponent);x!=null&&x.mesh&&(G.set(v,x.mesh),x.material&&!z.has(v)&&z.set(v,x.material));for(const B of ae.children)F(B)};F(p),a.destroyEntity(p.entityId)}catch{}}u("meshes"),await c();const K=new Map,Z=e.scene.entityId;if(Z!=null)for(const v of n.entities)v.parentId==null&&(v.name==="Scene Root"||v.id==="Scene Root")&&K.set(v.id,Z);await((ve=r==null?void 0:r.componentCodecRegistry)==null?void 0:ve.deserializeSceneHeroes({world:a,params:e,validated:n,options:r,entityMap:K,sceneRoot:Z,log:(v,...C)=>xe(r,v,...C),reportProgress:u})),u("terrainWater"),await c();const M=Qa(n.entities);for(let v=0;v<M.length;v+=o){const C=M.slice(v,v+o);for(const d of C){if(K.has(d.id))continue;const p=a.createEntity();K.set(d.id,p),a.addComponent(p,new b.NameComponent(d.name??d.id));const F=new b.TransformComponent;d.transform&&(F.position[0]=d.transform.position[0],F.position[1]=d.transform.position[1],F.position[2]=d.transform.position[2],F.rotation[0]=d.transform.rotation[0],F.rotation[1]=d.transform.rotation[1],F.rotation[2]=d.transform.rotation[2],F.rotation[3]=d.transform.rotation[3],F.scale[0]=d.transform.scale[0],F.scale[1]=d.transform.scale[1],F.scale[2]=d.transform.scale[2],F.updateLocalTransform()),a.addComponent(p,F);const ae=d.parentId!=null?K.get(d.parentId):null;if(a.addComponent(p,new b.HierarchyComponent(ae??null)),ae!=null){const h=a.getComponent(ae,b.HierarchyComponent);h&&h.children.push(p)}for(const h of d.components)switch(h.type){case"renderable":{const x=kr(h.meshId,G,Me=>i.getMeshByName(Me),n.resources.meshes),B=z.get(h.materialId);if(x&&B){const Me=h.visible??!0;a.addComponent(p,new b.RenderableComponent(x,B,h.castShadow??!0,Me)),Me||a.addComponent(p,new b.HiddenComponent)}break}case"static":a.addComponent(p,new b.StaticComponent);break;case"hidden":a.hasComponent(p,b.HiddenComponent)||a.addComponent(p,new b.HiddenComponent);break;case"instancedMesh":{const x=kr(h.meshId,G,Oe=>i.getMeshByName(Oe),n.resources.meshes),B=z.get(h.materialId),Me=(Q=(be=e.engine)==null?void 0:be.webGPUContext)==null?void 0:Q.device;if(x&&B&&Me&&h.count>=0){let L;if(h.instances.length>=h.count*36)L=new Float32Array(h.instances.slice(0,h.count*36));else{L=new Float32Array(h.count*36);for(let q=0;q<h.count;q++){const re=q*36;L[re+0]=1,L[re+5]=1,L[re+10]=1,L[re+15]=1,L[re+16+0]=1,L[re+16+5]=1,L[re+16+10]=1,L[re+16+15]=1,L[re+32]=1,L[re+33]=1,L[re+34]=1,L[re+35]=1}}const ie=Me.createBuffer({label:`InstancedMesh_${d.id}`,size:L.byteLength,usage:3,mappedAtCreation:!0});new Float32Array(ie.getMappedRange()).set(L),ie.unmap(),a.addComponent(p,new b.InstancedMeshComponent(x,B,ie,h.count,1/0,0,void 0,void 0,h.castShadow??!0))}break}case"directionalLight":{a.addComponent(p,new b.DirectionalLightComponent({color:Qt(h.color),intensity:h.intensity,shadowsEnabled:h.castShadow??!1}));const x=h.direction;if(x&&x.length>=3){const B=a.getComponent(p,b.TransformComponent);if(B){const Me=Se.vec3.fromValues(0,-1,0),Oe=Se.vec3.fromValues(Number(x[0]),Number(x[1]),Number(x[2])),L=Se.vec3.length(Oe);L>1e-6&&(Se.vec3.scale(Oe,Oe,1/L),Se.quat.rotationTo(B.rotation,Me,Oe),B.updateLocalTransform())}}break}case"pointLight":a.addComponent(p,new b.PointLightComponent({color:Qt(h.color),intensity:h.intensity,range:h.range}));break;case"spotLight":a.addComponent(p,new b.SpotLightComponent({color:Qt(h.color),intensity:h.intensity,range:h.range,innerAngle:h.angle,outerAngle:h.angle+h.penumbra}));break;case"areaLight":a.addComponent(p,new b.AreaLightComponent({color:Qt(h.color),intensity:h.intensity,width:h.width,height:h.height}));break;case"camera":{const x=new b.CameraComponent;x.fov=h.fov,x.near=h.near,x.far=h.far,x.isActive=h.isPrimary??!0,x.isMain=h.isMain??!1,typeof h.firstPersonEyeOffsetY=="number"&&(x.firstPersonEyeOffsetY=h.firstPersonEyeOffsetY),a.addComponent(p,x);break}case"cameraController":{const x=new b.GameCameraControllerComponent(h.mode,h.applyOn??"play");typeof h.fpsSpeed=="number"&&(x.fpsSpeed=h.fpsSpeed),typeof h.fpsSprintSpeed=="number"&&(x.fpsSprintSpeed=h.fpsSprintSpeed),typeof h.fpsSensitivity=="number"&&(x.fpsSensitivity=h.fpsSensitivity),typeof h.fpsDampingFactor=="number"&&(x.fpsDampingFactor=h.fpsDampingFactor),typeof h.fpsPlayerHeight=="number"&&(x.fpsPlayerHeight=h.fpsPlayerHeight),typeof h.fpsFlightMode=="boolean"&&(x.fpsFlightMode=h.fpsFlightMode),typeof h.orbitalMinDistance=="number"&&(x.orbitalMinDistance=h.orbitalMinDistance),typeof h.orbitalMaxDistance=="number"&&(x.orbitalMaxDistance=h.orbitalMaxDistance),typeof h.orbitalZoomSensitivity=="number"&&(x.orbitalZoomSensitivity=h.orbitalZoomSensitivity),typeof h.orbitalRotateSpeed=="number"&&(x.orbitalRotateSpeed=h.orbitalRotateSpeed),typeof h.orbitalDamping=="number"&&(x.orbitalDamping=h.orbitalDamping),h.orbitalLeftMouseMode!==void 0&&(x.orbitalLeftMouseMode=h.orbitalLeftMouseMode),typeof h.chaseTargetEntityId=="string"&&(x.chaseTargetEntityId=h.chaseTargetEntityId),typeof h.chaseDistance=="number"&&(x.chaseDistance=h.chaseDistance),typeof h.chaseHeight=="number"&&(x.chaseHeight=h.chaseHeight),typeof h.chaseLookAhead=="number"&&(x.chaseLookAhead=h.chaseLookAhead),typeof h.chaseLookHeight=="number"&&(x.chaseLookHeight=h.chaseLookHeight),typeof h.chaseFocusSmoothXZ=="number"&&(x.chaseFocusSmoothXZ=h.chaseFocusSmoothXZ),typeof h.chaseFocusSmoothY=="number"&&(x.chaseFocusSmoothY=h.chaseFocusSmoothY),typeof h.chaseYawSmooth=="number"&&(x.chaseYawSmooth=h.chaseYawSmooth),a.addComponent(p,x);break}case"playerSpawn":a.addComponent(p,new b.PlayerSpawnComponent(typeof h.priority=="number"&&Number.isFinite(h.priority)?h.priority:0));break;case"decal":{const x=new b.DecalComponent;((Ee=h.size)==null?void 0:Ee.length)>=3&&(x.size[0]=h.size[0],x.size[1]=h.size[1],x.size[2]=h.size[2]),a.addComponent(p,x);break}case"color":{const x=h.value;a.addComponent(p,new b.ColorComponent(Se.vec4.fromValues(x[0],x[1],x[2],x[3])));break}case"scriptBinding":{xe(r,"scriptBinding entity",d.id,"scriptId=",h.scriptId,"addScriptBinding=",!!(r!=null&&r.addScriptBinding)),(je=r==null?void 0:r.addScriptBinding)==null||je.call(r,p,h.scriptId,h.properties);break}default:(Pe=r==null?void 0:r.componentCodecRegistry)==null||Pe.deserializeComponent({world:a,entity:p,comp:h,params:e,validated:n,options:r,meshMap:G,materialMap:z,resourceManager:i,entityDescriptorId:d.id,log:(x,...B)=>xe(r,x,...B)});break}}if(s){const d=Math.min(v+C.length,M.length);u("entities",d,M.length),await c()}}n.physics&&(r!=null&&r.applyPhysicsDescriptor)&&(xe(r,"applyPhysicsDescriptor"),await r.applyPhysicsDescriptor(n.physics,{params:e}),await c());const I=n.extensions,D=r==null?void 0:r.sceneExtensions,U=r==null?void 0:r.enabledSceneExtensionIds;if(I&&Object.keys(I).length>0&&U!=null)for(const v of Object.keys(I))Vt(v,U)||xe(r,"extensions payload skipped (id not in enabledSceneExtensionIds)",v);if(I&&(D!=null&&D.length)){let v=0;for(const C of D){if(!Vt(C.id,U)){xe(r,"deserialize: skip sceneExtension handler (not in enabledSceneExtensionIds)",C.id),v++,s&&(u("extensions",v,D.length),await c());continue}const d=I[C.id];d!==void 0&&C.deserialize&&await C.deserialize(d,{params:e,validated:n,logger:r==null?void 0:r.logger,entityMap:K}),v++,s&&(u("extensions",v,D.length),await c())}}}var Ce=Uint8Array,De=Uint16Array,Cr=Int32Array,er=new Ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),tr=new Ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Er=new Ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cn=function(t,e){for(var r=new De(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var a=new Cr(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return{b:r,r:a}},En=Cn(er,2),In=En.b,Ir=En.r;In[28]=258,Ir[258]=28;for(var Tn=Cn(tr,0),ri=Tn.b,An=Tn.r,Tr=new De(32768),se=0;se<32768;++se){var ot=(se&43690)>>1|(se&21845)<<1;ot=(ot&52428)>>2|(ot&13107)<<2,ot=(ot&61680)>>4|(ot&3855)<<4,Tr[se]=((ot&65280)>>8|(ot&255)<<8)>>1}for(var He=function(t,e,r){for(var n=t.length,a=0,i=new De(e);a<n;++a)t[a]&&++i[t[a]-1];var s=new De(e);for(a=1;a<e;++a)s[a]=s[a-1]+i[a-1]<<1;var o;if(r){o=new De(1<<e);var c=15-e;for(a=0;a<n;++a)if(t[a])for(var u=a<<4|t[a],f=e-t[a],m=s[t[a]-1]++<<f,g=m|(1<<f)-1;m<=g;++m)o[Tr[m]>>c]=u}else for(o=new De(n),a=0;a<n;++a)t[a]&&(o[a]=Tr[s[t[a]-1]++]>>15-t[a]);return o},ct=new Ce(288),se=0;se<144;++se)ct[se]=8;for(var se=144;se<256;++se)ct[se]=9;for(var se=256;se<280;++se)ct[se]=7;for(var se=280;se<288;++se)ct[se]=8;for(var At=new Ce(32),se=0;se<32;++se)At[se]=5;var ni=He(ct,9,0),ai=He(ct,9,1),ii=He(At,5,0),si=He(At,5,1),Ar=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},Fe=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},Rr=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Nr=function(t){return(t+7)/8|0},Rn=function(t,e,r){return(r==null||r>t.length)&&(r=t.length),new Ce(t.subarray(e,r))},oi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ge=function(t,e,r){var n=new Error(e||oi[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,Ge),!r)throw n;return n},ci=function(t,e,r,n){var a=t.length,i=0;if(!a||e.f&&!e.l)return r||new Ce(0);var s=!r,o=s||e.i!=2,c=e.i;s&&(r=new Ce(a*3));var u=function(d){var p=r.length;if(d>p){var F=new Ce(Math.max(p*2,d));F.set(r),r=F}},f=e.f||0,m=e.p||0,g=e.b||0,S=e.l,O=e.d,$=e.m,z=e.n,X=a*8;do{if(!S){f=Fe(t,m,1);var V=Fe(t,m+1,3);if(m+=3,V)if(V==1)S=ai,O=si,$=9,z=5;else if(V==2){var K=Fe(t,m,31)+257,Z=Fe(t,m+10,15)+4,M=K+Fe(t,m+5,31)+1;m+=14;for(var I=new Ce(M),D=new Ce(19),U=0;U<Z;++U)D[Er[U]]=Fe(t,m+U*3,7);m+=Z*3;for(var oe=Ar(D),$e=(1<<oe)-1,fe=He(D,oe,1),U=0;U<M;){var ge=fe[Fe(t,m,$e)];m+=ge&15;var G=ge>>4;if(G<16)I[U++]=G;else{var le=0,te=0;for(G==16?(te=3+Fe(t,m,3),m+=2,le=I[U-1]):G==17?(te=3+Fe(t,m,7),m+=3):G==18&&(te=11+Fe(t,m,127),m+=7);te--;)I[U++]=le}}var ye=I.subarray(0,K),ne=I.subarray(K);$=Ar(ye),z=Ar(ne),S=He(ye,$,1),O=He(ne,z,1)}else Ge(1);else{var G=Nr(m)+4,J=t[G-4]|t[G-3]<<8,ee=G+J;if(ee>a){c&&Ge(0);break}o&&u(g+J),r.set(t.subarray(G,ee),g),e.b=g+=J,e.p=m=ee*8,e.f=f;continue}if(m>X){c&&Ge(0);break}}o&&u(g+131072);for(var Ye=(1<<$)-1,he=(1<<z)-1,Ne=m;;Ne=m){var le=S[Rr(t,m)&Ye],ve=le>>4;if(m+=le&15,m>X){c&&Ge(0);break}if(le||Ge(2),ve<256)r[g++]=ve;else if(ve==256){Ne=m,S=null;break}else{var be=ve-254;if(ve>264){var U=ve-257,Q=er[U];be=Fe(t,m,(1<<Q)-1)+In[U],m+=Q}var Ee=O[Rr(t,m)&he],je=Ee>>4;Ee||Ge(3),m+=Ee&15;var ne=ri[je];if(je>3){var Q=tr[je];ne+=Rr(t,m)&(1<<Q)-1,m+=Q}if(m>X){c&&Ge(0);break}o&&u(g+131072);var Pe=g+be;if(g<ne){var v=i-ne,C=Math.min(ne,Pe);for(v+g<0&&Ge(3);g<C;++g)r[g]=n[v+g]}for(;g<Pe;++g)r[g]=r[g-ne]}}e.l=S,e.p=Ne,e.b=g,e.f=f,S&&(f=1,e.m=$,e.d=O,e.n=z)}while(!f);return g!=r.length&&s?Rn(r,0,g):r.subarray(0,g)},tt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},Rt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8,t[n+2]|=r>>16},Mr=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var a=r.length,i=r.slice();if(!a)return{t:Dn,l:0};if(a==1){var s=new Ce(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(ee,K){return ee.f-K.f}),r.push({s:-1,f:25001});var o=r[0],c=r[1],u=0,f=1,m=2;for(r[0]={s:-1,f:o.f+c.f,l:o,r:c};f!=a-1;)o=r[r[u].f<r[m].f?u++:m++],c=r[u!=f&&r[u].f<r[m].f?u++:m++],r[f++]={s:-1,f:o.f+c.f,l:o,r:c};for(var g=i[0].s,n=1;n<a;++n)i[n].s>g&&(g=i[n].s);var S=new De(g+1),O=Or(r[f-1],S,0);if(O>e){var n=0,$=0,z=O-e,X=1<<z;for(i.sort(function(K,Z){return S[Z.s]-S[K.s]||K.f-Z.f});n<a;++n){var V=i[n].s;if(S[V]>e)$+=X-(1<<O-S[V]),S[V]=e;else break}for($>>=z;$>0;){var G=i[n].s;S[G]<e?$-=1<<e-S[G]++-1:++n}for(;n>=0&&$;--n){var J=i[n].s;S[J]==e&&(--S[J],++$)}O=e}return{t:new Ce(S),l:O}},Or=function(t,e,r){return t.s==-1?Math.max(Or(t.l,e,r+1),Or(t.r,e,r+1)):e[t.s]=r},Nn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new De(++e),n=0,a=t[0],i=1,s=function(c){r[n++]=c},o=1;o<=e;++o)if(t[o]==a&&o!=e)++i;else{if(!a&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(a),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(a);i=1,a=t[o]}return{c:r.subarray(0,n),n:e}},Nt=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},Mn=function(t,e,r){var n=r.length,a=Nr(e+2);t[a]=n&255,t[a+1]=n>>8,t[a+2]=t[a]^255,t[a+3]=t[a+1]^255;for(var i=0;i<n;++i)t[a+i+4]=r[i];return(a+4+n)*8},On=function(t,e,r,n,a,i,s,o,c,u,f){tt(e,f++,r),++a[256];for(var m=Mr(a,15),g=m.t,S=m.l,O=Mr(i,15),$=O.t,z=O.l,X=Nn(g),V=X.c,G=X.n,J=Nn($),ee=J.c,K=J.n,Z=new De(19),M=0;M<V.length;++M)++Z[V[M]&31];for(var M=0;M<ee.length;++M)++Z[ee[M]&31];for(var I=Mr(Z,7),D=I.t,U=I.l,oe=19;oe>4&&!D[Er[oe-1]];--oe);var $e=u+5<<3,fe=Nt(a,ct)+Nt(i,At)+s,ge=Nt(a,g)+Nt(i,$)+s+14+3*oe+Nt(Z,D)+2*Z[16]+3*Z[17]+7*Z[18];if(c>=0&&$e<=fe&&$e<=ge)return Mn(e,f,t.subarray(c,c+u));var le,te,ye,ne;if(tt(e,f,1+(ge<fe)),f+=2,ge<fe){le=He(g,S,0),te=g,ye=He($,z,0),ne=$;var Ye=He(D,U,0);tt(e,f,G-257),tt(e,f+5,K-1),tt(e,f+10,oe-4),f+=14;for(var M=0;M<oe;++M)tt(e,f+3*M,D[Er[M]]);f+=3*oe;for(var he=[V,ee],Ne=0;Ne<2;++Ne)for(var ve=he[Ne],M=0;M<ve.length;++M){var be=ve[M]&31;tt(e,f,Ye[be]),f+=D[be],be>15&&(tt(e,f,ve[M]>>5&127),f+=ve[M]>>12)}}else le=ni,te=ct,ye=ii,ne=At;for(var M=0;M<o;++M){var Q=n[M];if(Q>255){var be=Q>>18&31;Rt(e,f,le[be+257]),f+=te[be+257],be>7&&(tt(e,f,Q>>23&31),f+=er[be]);var Ee=Q&31;Rt(e,f,ye[Ee]),f+=ne[Ee],Ee>3&&(Rt(e,f,Q>>5&8191),f+=tr[Ee])}else Rt(e,f,le[Q]),f+=te[Q]}return Rt(e,f,le[256]),f+te[256]},li=new Cr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Dn=new Ce(0),di=function(t,e,r,n,a,i){var s=i.z||t.length,o=new Ce(n+s+5*(1+Math.ceil(s/7e3))+a),c=o.subarray(n,o.length-a),u=i.l,f=(i.r||0)&7;if(e){f&&(c[0]=i.r>>3);for(var m=li[e-1],g=m>>13,S=m&8191,O=(1<<r)-1,$=i.p||new De(32768),z=i.h||new De(O+1),X=Math.ceil(r/3),V=2*X,G=function(ae){return(t[ae]^t[ae+1]<<X^t[ae+2]<<V)&O},J=new Cr(25e3),ee=new De(288),K=new De(32),Z=0,M=0,I=i.i||0,D=0,U=i.w||0,oe=0;I+2<s;++I){var $e=G(I),fe=I&32767,ge=z[$e];if($[fe]=ge,z[$e]=fe,U<=I){var le=s-I;if((Z>7e3||D>24576)&&(le>423||!u)){f=On(t,c,0,J,ee,K,M,D,oe,I-oe,f),D=Z=M=0,oe=I;for(var te=0;te<286;++te)ee[te]=0;for(var te=0;te<30;++te)K[te]=0}var ye=2,ne=0,Ye=S,he=fe-ge&32767;if(le>2&&$e==G(I-he))for(var Ne=Math.min(g,le)-1,ve=Math.min(32767,I),be=Math.min(258,le);he<=ve&&--Ye&&fe!=ge;){if(t[I+ye]==t[I+ye-he]){for(var Q=0;Q<be&&t[I+Q]==t[I+Q-he];++Q);if(Q>ye){if(ye=Q,ne=he,Q>Ne)break;for(var Ee=Math.min(he,Q-2),je=0,te=0;te<Ee;++te){var Pe=I-he+te&32767,v=$[Pe],C=Pe-v&32767;C>je&&(je=C,ge=Pe)}}}fe=ge,ge=$[fe],he+=fe-ge&32767}if(ne){J[D++]=268435456|Ir[ye]<<18|An[ne];var d=Ir[ye]&31,p=An[ne]&31;M+=er[d]+tr[p],++ee[257+d],++K[p],U=I+ye,++Z}else J[D++]=t[I],++ee[t[I]]}}for(I=Math.max(I,U);I<s;++I)J[D++]=t[I],++ee[t[I]];f=On(t,c,u,J,ee,K,M,D,oe,I-oe,f),u||(i.r=f&7|c[f/8|0]<<3,f-=7,i.h=z,i.p=$,i.i=I,i.w=U)}else{for(var I=i.w||0;I<s+u;I+=65535){var F=I+65535;F>=s&&(c[f/8|0]=u,F=s),f=Mn(c,f+1,t.subarray(I,F))}i.i=s}return Rn(o,0,n+Nr(f)+a)},Un=function(){var t=1,e=0;return{p:function(r){for(var n=t,a=e,i=r.length|0,s=0;s!=i;){for(var o=Math.min(s+2655,i);s<o;++s)a+=n+=r[s];n=(n&65535)+15*(n>>16),a=(a&65535)+15*(a>>16)}t=n,e=a},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},ui=function(t,e,r,n,a){if(!a&&(a={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),s=new Ce(i.length+t.length);s.set(i),s.set(t,i.length),t=s,a.w=i.length}return di(t,e.level==null?6:e.level,e.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,r,n,a)},$n=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},fi=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;if(t[0]=120,t[1]=n<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var a=Un();a.p(e.dictionary),$n(t,2,a.d())}},hi=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&Ge(6,"invalid zlib data"),(t[1]>>5&1)==1&&Ge(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function mi(t,e){e||(e={});var r=Un();r.p(t);var n=ui(t,e,e.dictionary?6:2,4);return fi(n,e),$n(n,n.length-4,r.d()),n}function pi(t,e){return ci(t.subarray(hi(t),-4),{i:2},e,e)}var gi=typeof TextDecoder<"u"&&new TextDecoder,yi=0;try{gi.decode(Dn,{stream:!0}),yi=1}catch{}const lt=new Uint8Array([87,51,68,83,67,78,80,75]),Ue=12,St=1,Mt=2,rr=64*1024;function Dr(t){if(t.byteLength<lt.length)return!1;for(let e=0;e<lt.length;e++)if(t[e]!==lt[e])return!1;return!0}function Ln(t){return t.byteLength<12?!1:t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80}function Ur(t,e){return t.getUint32(e,!0)}function vi(t){for(let e=0;e<lt.length;e++)if(t[e]!==lt[e])throw new Error("scenepak: invalid magic (expected W3DSCNPK)")}function bi(t){if(t!==St&&t!==Mt)throw new Error(`scenepak: unsupported container version ${t} (supported: ${St}, ${Mt})`)}function $r(t){if(t.byteLength<Ue)throw new Error(`scenepak: file too small (${t.byteLength} bytes)`);vi(t);const e=new DataView(t.buffer,t.byteOffset,t.byteLength),r=Ur(e,8);if(bi(r),r===St)return Ue;if(t.byteLength<Ue+4)throw new Error("scenepak: truncated thumbnail header");const n=Ur(e,Ue);if(n>rr)throw new Error(`scenepak: thumbnail too large (${n} bytes)`);const a=Ue+4+n;if(t.byteLength<a)throw new Error("scenepak: truncated thumbnail");return a}function _i(t){if(t.byteLength<Ue||!Dr(t))return null;const e=new DataView(t.buffer,t.byteOffset,t.byteLength),r=Ur(e,8);if(r===St||r!==Mt)return null;const n=$r(t),a=Ue+4;return n<=a?null:t.slice(a,n)}function wi(t){if(t.byteLength>rr)throw new Error(`scenepak: thumbnail too large (${t.byteLength} bytes, max ${rr})`);if(!Ln(t))throw new Error("scenepak: thumbnail must be WebP bytes")}function xi(t,e){const r=JSON.stringify(t),n=new TextEncoder().encode(r),a=mi(n,{level:6}),i=e==null?void 0:e.thumbnail;if(!i||i.byteLength===0){const f=new Uint8Array(Ue+a.byteLength);return f.set(lt,0),new DataView(f.buffer).setUint32(8,St,!0),f.set(a,Ue),f}wi(i);const s=i.byteLength,o=Ue+4+s,c=new Uint8Array(o+a.byteLength);c.set(lt,0);const u=new DataView(c.buffer);return u.setUint32(8,Mt,!0),u.setUint32(Ue,s,!0),c.set(i,Ue+4),c.set(a,o),c}function jn(t){const e=$r(t),r=t.subarray(e),n=pi(r),a=new TextDecoder("utf-8",{fatal:!0}).decode(n);return JSON.parse(a)}function Si(t){return t.charCodeAt(0)===65279?t.slice(1):t}function Pn(t){const e=t instanceof Uint8Array?t:new Uint8Array(t);if(Dr(e))return jn(e);const r=Si(new TextDecoder("utf-8",{fatal:!1}).decode(e));return JSON.parse(r)}function ki(t){return vr(Pn(t))}class Ci{constructor(){Ut(this,"byType",new Map);Ut(this,"heroCodec");Ut(this,"aggregateEntitySerialize");Ut(this,"domainDeserialize")}register(e){return this.byType.set(e.descriptorType,e),this}registerMany(e){for(const r of e)this.register(r);return this}registerHeroCodec(e){return this.heroCodec=e,this}registerAggregateEntitySerialize(e){return this.aggregateEntitySerialize=e,this}registerDomainDeserialize(e){return this.domainDeserialize=e,this}shouldSkipEntity(e){var r,n;return((n=(r=this.heroCodec)==null?void 0:r.shouldSkipEntity)==null?void 0:n.call(r,e))===!0}trySerializeHeroEntity(e){var r,n;return((n=(r=this.heroCodec)==null?void 0:r.trySerializeHeroEntity)==null?void 0:n.call(r,e))??"not-hero"}serializeEntityComponents(e){if(this.aggregateEntitySerialize)return this.aggregateEntitySerialize(e);const r=[];let n=!1;for(const a of this.byType.values()){if(!a.serializeFromEntity)continue;const i=a.serializeFromEntity(e);i&&(i.components.length>0&&r.push(...i.components),i.suppressRenderable&&(n=!0))}return{components:r,suppressRenderable:n}}deserializeComponent(e){var n;if((n=this.domainDeserialize)!=null&&n.call(this,e))return!0;const r=this.byType.get(e.comp.type);return r!=null&&r.deserializeToEntity?(r.deserializeToEntity(e),!0):!1}async deserializeSceneHeroes(e){var r,n;await((n=(r=this.heroCodec)==null?void 0:r.deserializeSceneHeroes)==null?void 0:n.call(r,e))}}const Ei="@naanouff/w3dts-ui";function gt(t){return typeof t=="object"&&t!==null}function nr(t){return typeof t=="number"&&Number.isFinite(t)}function Ii(t){if(gt(t)&&!(!nr(t.x)||!nr(t.y)||!nr(t.w)||!nr(t.h)))return{x:t.x,y:t.y,w:t.w,h:t.h}}function Lr(t){if(gt(t)&&Object.values(t).every(e=>typeof e=="string"))return t}const Ti=new Set(["frame","text","button","input","checkbox"]);function jr(t){if(!gt(t))return;const e=typeof t.id=="string"?t.id.trim():"";if(!e)return;const r=Ii(t.layout);if(!r)return;const n=typeof t.name=="string"&&t.name.trim()?t.name.trim():void 0,a=t.kind;if(a==="widget"){const c=typeof t.widgetId=="string"?t.widgetId.trim():"";return c?{id:e,kind:"widget",widgetId:c,layout:r,...n?{name:n}:{}}:void 0}if(typeof a!="string"||!Ti.has(a))return;const i=Lr(t.style),s=Lr(t.props),o=[];if(Array.isArray(t.children))for(const c of t.children){const u=jr(c);u&&o.push(u)}return{id:e,kind:a,layout:r,...n?{name:n}:{},...i?{style:i}:{},...s?{props:s}:{},...o.length>0?{children:o}:{}}}function Pr(t){if(!gt(t))return;const e=jr(t.root);if(e)return{root:e}}function zr(t){const e=t.trim();return e?/^(https?:|data:|blob:)/i.test(e)||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:e.includes("<")||e.includes("{")?!1:/\.(wxml|wss|uxml|html|htm|uss|css)(\?|#|$)/i.test(e):!1}function Fr(t,e){const r=typeof e=="string"&&e.trim().length>0?e.trim():void 0,n=typeof t=="string"?t:void 0;if(n!=null&&n.length>0&&!zr(n))return{kind:"inline",text:n};if(r)return{kind:"url",url:r};if(n!=null&&n.length>0&&zr(n))return{kind:"url",url:n.trim()}}function Ot(t){return Fr(t.wxml,t.wxmlUrl)}function Dt(t){return Fr(t.wss,t.wssUrl)}const Ai=Ot,Ri=Dt;async function zn(t,e){const r=await e(t);if(!r.ok)throw new Error(`Failed to fetch UI asset (${r.status}): ${t}`);return r.text()}async function Ni(t,e=globalThis.fetch.bind(globalThis)){const r=Ot(t),n=Dt(t);if(!r||!n)throw new Error(`UIDocument "${t.id}" missing wxml and/or wss (inline or url)`);const[a,i]=await Promise.all([r.kind==="inline"?Promise.resolve(r.text):zn(r.url,e),n.kind==="inline"?Promise.resolve(n.text):zn(n.url,e)]);return{wxml:a,wss:i}}function Gr(t){var a,i;const e=Ot(t),r=Dt(t),n={id:t.id,layer:t.layer,...t.bindings?{bindings:{...t.bindings}}:{},...t.ir?{ir:structuredClone(t.ir)}:{}};return(e==null?void 0:e.kind)==="inline"?n.wxml=e.text:(e==null?void 0:e.kind)==="url"&&(n.wxmlUrl=e.url),(r==null?void 0:r.kind)==="inline"?n.wss=r.text:(r==null?void 0:r.kind)==="url"&&(n.wssUrl=r.url),(a=t.wxmlUrl)!=null&&a.trim()&&n.wxml&&(n.wxmlUrl=t.wxmlUrl.trim()),(i=t.wssUrl)!=null&&i.trim()&&n.wss&&(n.wssUrl=t.wssUrl.trim()),n}function Zr(t){const e={id:t.id,ir:structuredClone(t.ir)};return typeof t.wxml=="string"&&t.wxml.length>0&&(e.wxml=t.wxml),typeof t.wss=="string"&&t.wss.length>0&&(e.wss=t.wss),e}function Mi(t){const e=Gr(t),r={id:e.id,layer:e.layer,...e.bindings?{bindings:{...e.bindings}}:{},...e.ir?{ir:structuredClone(e.ir)}:{}};return e.wxml?r.wxml=e.wxml:e.wxmlUrl&&(r.wxmlUrl=e.wxmlUrl),e.wss?r.wss=e.wss:e.wssUrl&&(r.wssUrl=e.wssUrl),e.wxml&&e.wxmlUrl&&(r.wxmlUrl=e.wxmlUrl),e.wss&&e.wssUrl&&(r.wssUrl=e.wssUrl),r}function Oi(t){return Zr(t)}function ar(t,...e){for(const r of e){const n=t[r];if(typeof n=="string")return n}}function Di(t){if(!gt(t))return;const e=typeof t.id=="string"?t.id.trim():"",r=t.layer;if(!e||r!=="hud"&&r!=="menu"&&r!=="modal")return;const n=ar(t,"wxml","uxml"),a=ar(t,"wss","uss"),i=ar(t,"wxmlUrl","uxmlUrl"),s=ar(t,"wssUrl","ussUrl"),o=typeof i=="string"&&i.trim().length>0?i.trim():void 0,c=typeof s=="string"&&s.trim().length>0?s.trim():void 0,u=Pr(t.ir),f={id:e,layer:r,wxml:n,wss:a,wxmlUrl:o,wssUrl:c,...u?{ir:u}:{}};if(!!!(Ot(f)&&Dt(f))&&!u)return;const g=Lr(t.bindings);return g&&(f.bindings=g),Gr(f)}function Ui(t){if(!gt(t))return;const e=typeof t.id=="string"?t.id.trim():"";if(!e)return;const r=Pr(t.ir);if(!r)return;const n=typeof t.wxml=="string"&&t.wxml.length>0?t.wxml:void 0,a=typeof t.wss=="string"&&t.wss.length>0?t.wss:void 0;return Zr({id:e,ir:r,wxml:n,wss:a})}function $i(t){if(!gt(t)||!Array.isArray(t.documents))return;const e=[];for(const n of t.documents){const a=Di(n);a&&e.push(a)}if(e.length===0)return;const r=[];if(Array.isArray(t.widgets))for(const n of t.widgets){const a=Ui(n);a&&r.push(a)}return r.length>0?{documents:e,widgets:r}:{documents:e}}function Li(t="root"){return{root:{id:t,kind:"frame",name:"Root",layout:{x:0,y:0,w:400,h:300},style:{background:"rgba(8, 10, 14, 0.72)",borderRadius:"8px"},children:[]}}}Object.defineProperty(_,"yieldToMain",{enumerable:!0,get:()=>b.yieldToMain}),_.ComponentCodecRegistry=Ci,_.SCENEDD_FORMAT_ID=gr,_.SCENEDD_FORMAT_VERSION=yr,_.SCENEDD_PACKAGE_VERSION=sn,_.SCENEPAK_CONTAINER_VERSION=St,_.SCENEPAK_HEADER_BYTE_LENGTH=Ue,_.SCENEPAK_MAGIC=lt,_.SCENEPAK_THUMB_CONTAINER_VERSION=Mt,_.SCENEPAK_THUMB_MAX_BYTES=rr,_.SceneDescriptorSchema=ln,_.W3DTS_TEXTURE_URL_PREFIX=mt,_.W3DTS_UI_EXTENSION_ID=Ei,_.buildMaterialDescriptorProperties=Sr,_.createMeshFromEmbedded=mn,_.decodeScenePakJson=jn,_.defaultFetchGraphJson=Sn,_.defaultFetchScriptSource=kn,_.defaultLoadTextureEntry=wn,_.deserialize=ti,_.emptyW3dtsUiIr=Li,_.encodeMeshEmbedded=xr,_.encodeScenePakJson=xi,_.enrichMaterialsTextureManifest=un,_.ensureEnvironmentTextureManifestEntries=fn,_.finalizeStandaloneResources=yn,_.getW3dtsUiDocumentUssSource=Ri,_.getW3dtsUiDocumentUxmlSource=Ai,_.getW3dtsUiDocumentWssSource=Dt,_.getW3dtsUiDocumentWxmlSource=Ot,_.inlineRemoteEngineConfigGraphs=gn,_.isLikelyGpuTexture=br,_.isSceneExtensionIdEnabled=Vt,_.isScenePakBytes=Dr,_.isW3dtsUiAssetRef=zr,_.isWebpBytes=Ln,_.loadManifestUrlTextures=xn,_.loadSceneDescriptorFromFileBytes=ki,_.migrateSceneDocument=on,_.normalizeW3dtsUiDocumentEntry=Gr,_.normalizeW3dtsUiWidgetEntry=Zr,_.parseSceneFileBytes=Pn,_.parseW3dtsUiExtensionPayload=$i,_.parseW3dtsUiIr=Pr,_.parseW3dtsUiNode=jr,_.pickPreferredGraphCacheKey=Kt,_.readScenePakThumbnail=_i,_.resolveCachedGraphManifestId=Fa,_.resolveMeshByManifestId=kr,_.resolveRegisteredTextureUrls=hn,_.resolveW3dtsUiAssetSource=Fr,_.resolveW3dtsUiDocumentTexts=Ni,_.scenePakJsonOffset=$r,_.serialize=vn,_.serializeAsync=qa,_.shouldLoadManifestTextureEntry=_n,_.shouldLoadManifestTextureFromUrl=bn,_.toEmbeddedW3dtsUiDocumentEntry=Mi,_.toEmbeddedW3dtsUiWidgetEntry=Oi,_.validateScene=vr,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naanouff/w3dts-scenedd",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.22",
|
|
4
|
+
"description": "Scene Data-Driven: types, validation, and serialization for W3DTS scenes",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"main": "./dist/w3dts-scenedd.umd.js",
|
|
7
|
+
"module": "./dist/w3dts-scenedd.es.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/w3dts-scenedd.es.js",
|
|
14
|
+
"require": "./dist/w3dts-scenedd.umd.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/naanouff/w3dts.git"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"fflate": "^0.8.2",
|
|
30
|
+
"gl-matrix": "^3.4.3",
|
|
31
|
+
"zod": "^3.23.8",
|
|
32
|
+
"@naanouff/w3dts-core": "0.0.38",
|
|
33
|
+
"@naanouff/w3dts-logger": "0.0.23"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"c8": "^8.0.0",
|
|
37
|
+
"typescript": "^5.5.4",
|
|
38
|
+
"vite": "^5.4.21",
|
|
39
|
+
"vite-plugin-dts": "^4.0.3",
|
|
40
|
+
"vitest": "^3.2.7",
|
|
41
|
+
"@naanouff/w3dts-physics": "0.0.29",
|
|
42
|
+
"@naanouff/w3dts-particles": "0.1.5",
|
|
43
|
+
"@naanouff/w3dts-gproc": "0.2.9",
|
|
44
|
+
"@naanouff/w3dts-terrain": "0.0.28",
|
|
45
|
+
"@naanouff/w3dts-character": "0.0.21",
|
|
46
|
+
"@naanouff/w3dts-ai-agents": "0.0.21",
|
|
47
|
+
"@naanouff/w3dts-chess": "0.0.6",
|
|
48
|
+
"@naanouff/w3dts-audio": "0.0.20",
|
|
49
|
+
"@naanouff/w3dts-xr-interaction": "0.0.1",
|
|
50
|
+
"@naanouff/w3dts-combat": "0.0.20"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "vite build --watch",
|
|
54
|
+
"build": "vite build",
|
|
55
|
+
"test": "vitest --run",
|
|
56
|
+
"test:cov": "vitest --run --coverage --config=vitest.config.ts"
|
|
57
|
+
}
|
|
6
58
|
}
|