phantasmal-world/2.b1070a6f6fa6c5cf2aec.js
Daan Vanden Bosch b0d2ed9115 Release 45.
2020-01-05 23:19:08 +01:00

1 line
29 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"0Xme":function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var s=i("sDu+"),n=i("jJhE"),r=(i("x1yY"),i("4VsB")),o=i("FXpb");class a extends s.a{constructor(t,e,i,s,n){super(n),this.element=Object(o.q)({className:`${e} core_Input`}),this._value=new r.a(this,t,this.set_value),this.value=this._value,this.input_element=Object(o.l)({className:`${s} core_Input_inner`}),this.input_element.type=i,this.input_element.addEventListener("change",()=>{this._value.set_val(this.get_value(),{silent:!1})}),n&&n.readonly&&this.set_attr("readOnly",!0),this.element.append(this.input_element)}set_enabled(t){super.set_enabled(t),this.input_element.disabled=!t}set_attr(t,e,i){if(null==e)return;const s=this.input_element,r=i||(t=>t);Object(n.a)(e)?(s[t]=r(e.val),this.disposable(e.observe(({value:e})=>s[t]=r(e)))):s[t]=r(e)}}},"488w":function(t,e,i){"use strict";i.d(e,"b",(function(){return l})),i.d(e,"a",(function(){return d}));var s=i("Womt"),n=i("tRdk"),r=i("kwt4"),o=i("vM2b");const a=new s.Vector3(0,1,0),h=new s.Vector2(0,0),u=new s.Vector3(0,0,0),c=new s.Quaternion(0,0,0,1),_=new s.Vector3(1,1,1);function l(t,e){new p(e).to_geometry_builder(t)}function d(t){return new p(new o.a).create_buffer_geometry(t)}class f{constructor(){this.vertices_stack=[]}put(t){this.vertices_stack.push(t)}get(t){const e=[];for(let i=this.vertices_stack.length-1;i>=0;i--){const s=this.vertices_stack[i][t];s&&e.push(s)}return e}}class p{constructor(t){this.vertices=new f,this.bone_id=0,this.builder=t}to_geometry_builder(t){this.object_to_geometry(t,void 0,new s.Matrix4)}create_buffer_geometry(t){return this.to_geometry_builder(t),this.builder.build()}object_to_geometry(t,e,i){const{no_translate:r,no_rotate:o,no_scale:a,hidden:h,break_child_trace:l,zxy_rotation_order:d,skip:f}=t.evaluation_flags,{position:p,rotation:b,scale:g}=t,m=new s.Euler(b.x,b.y,b.z,d?"ZXY":"ZYX"),w=(new s.Matrix4).compose(r?u:Object(n.a)(p),o?c:(new s.Quaternion).setFromEuler(m),a?_:Object(n.a)(g)).premultiply(i);let v;if(f?v=e:(v=new s.Bone,v.name=this.bone_id.toString(),v.position.set(p.x,p.y,p.z),v.setRotationFromEuler(m),v.scale.set(g.x,g.y,g.z),this.builder.add_bone(v),e&&e.add(v)),t.model&&!h&&this.model_to_geometry(t.model,w),this.bone_id++,!l)for(const e of t.children)this.object_to_geometry(e,v,w)}model_to_geometry(t,e){Object(r.b)(t)?this.njcm_model_to_geometry(t,e):this.xj_model_to_geometry(t,e)}njcm_model_to_geometry(t,e){const i=(new s.Matrix3).getNormalMatrix(e),r=t.vertices.map(t=>{const r=Object(n.a)(t.position),o=t.normal?Object(n.a)(t.normal):new s.Vector3(0,1,0);return r.applyMatrix4(e),o.applyMatrix3(i),{bone_id:this.bone_id,position:r,normal:o,bone_weight:t.bone_weight,bone_weight_status:t.bone_weight_status,calc_continue:t.calc_continue}});this.vertices.put(r);for(const e of t.meshes){const t=this.builder.index_count;for(let t=0;t<e.vertices.length;++t){const i=e.vertices[t],s=this.vertices.get(i.index);if(s.length){const n=s[0],r=n.normal||i.normal||a,o=this.builder.vertex_count;this.builder.add_vertex(n.position,r,e.has_tex_coords?i.tex_coords:h),t>=2&&(t%2==(e.clockwise_winding?1:0)?(this.builder.add_index(o-2),this.builder.add_index(o-1),this.builder.add_index(o)):(this.builder.add_index(o-2),this.builder.add_index(o),this.builder.add_index(o-1)));const u=[[0,0],[0,0],[0,0],[0,0]];for(let t=s.length-1;t>=0;t--){const e=s[t];u[e.bone_weight_status]=[e.bone_id,e.bone_weight]}const c=u.reduce((t,[,e])=>t+e,0);for(const[t,e]of u)this.builder.add_bone_weight(t,c>0?e/c:e)}}this.builder.add_group(t,this.builder.index_count-t,e.texture_id)}}xj_model_to_geometry(t,e){const i=this.builder.vertex_count,r=(new s.Matrix3).getNormalMatrix(e);for(const{position:i,normal:o,uv:a}of t.vertices){const t=Object(n.a)(i).applyMatrix4(e),u=(o?Object(n.a)(o):new s.Vector3(0,1,0)).applyMatrix3(r),c=a||h;this.builder.add_vertex(t,u,c)}let o;for(const e of t.meshes){const t=this.builder.index_count;let s=!1;for(let t=2;t<e.indices.length;++t){const n=i+e.indices[t-2],r=i+e.indices[t-1],o=i+e.indices[t],a=this.builder.get_position(n),h=this.builder.get_position(r),u=this.builder.get_position(o),c=this.builder.get_normal(n),_=this.builder.get_normal(r),l=this.builder.get_normal(o),d=h.clone().sub(a).cross(u.clone().sub(a));s&&d.negate(),(d.dot(c)<0?1:0)+(d.dot(_)<0?1:0)+(d.dot(l)<0?1:0)>=2&&(s=!s),s?(this.builder.add_index(r),this.builder.add_index(n),this.builder.add_index(o)):(this.builder.add_index(n),this.builder.add_index(r),this.builder.add_index(o)),s=!s}null!=e.material_properties.texture_id&&(o=e.material_properties.texture_id),this.builder.add_group(t,this.builder.index_count-t,o)}}}},"6cU9":function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var s=i("ouMO"),n=i("KVVN"),r=i("iPoI"),o=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((s=s.apply(t,e||[])).next())}))};class a extends n.a{constructor(t){super(t),this._files=Object(s.e)([]),this.files=this._files,this.element.classList.add("core_FileButton"),this.disposables(this.click.observe(()=>o(this,void 0,void 0,(function*(){this._files.val=yield Object(r.a)(t)})))),this.finalize_construction()}}},"9Ykw":function(t,e,i){"use strict";function s(t){const e=[];for(;t.bytes_left;){const i=t.u32(),s=t.u32();if(s>t.bytes_left)break;e.push({type:i,data:t.take(s)})}return e}i.d(e,"a",(function(){return s}))},"9dYx":function(t,e,i){"use strict";var s=i("bcBH");class n{constructor(t,e){this._position=0,this.endianness=t,this.offset=e}get position(){return this._position}get endianness(){return this.little_endian?s.a.Little:s.a.Big}set endianness(t){this.little_endian=t===s.a.Little}get bytes_left(){return this.size-this.position}seek(t){return this.seek_start(this.position+t)}seek_start(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=t,this}seek_end(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=this.size-t,this}u8(){return this.u8_at(this._position++)}u8_at(t){return this.check_offset(t,1),this.dv.getUint8(this.offset+t)}u16(){const t=this.u16_at(this.position);return this._position+=2,t}u16_at(t){return this.check_offset(t,2),this.dv.getUint16(this.offset+t,this.little_endian)}u32(){const t=this.u32_at(this.position);return this._position+=4,t}u32_at(t){return this.check_offset(t,4),this.dv.getUint32(this.offset+t,this.little_endian)}i8(){return this.i8_at(this._position++)}i8_at(t){return this.check_offset(t,1),this.dv.getInt8(this.offset+t)}i16(){const t=this.i16_at(this.position);return this._position+=2,t}i16_at(t){return this.check_offset(t,2),this.dv.getInt16(this.offset+t,this.little_endian)}i32(){const t=this.i32_at(this.position);return this._position+=4,t}i32_at(t){return this.check_offset(t,4),this.dv.getInt32(this.offset+t,this.little_endian)}f32(){const t=this.f32_at(this.position);return this._position+=4,t}f32_at(t){return this.check_offset(t,4),this.dv.getFloat32(this.offset+t,this.little_endian)}u8_array(t){this.check_size("n",t,t);const e=[];for(let i=0;i<t;++i)e.push(this.dv.getUint8(this.offset+this._position++));return e}u16_array(t){this.check_size("n",t,2*t);const e=[];for(let i=0;i<t;++i)e.push(this.dv.getUint16(this.offset+this.position,this.little_endian)),this._position+=2;return e}u32_array(t){this.check_size("n",t,4*t);const e=[];for(let i=0;i<t;++i)e.push(this.dv.getUint32(this.offset+this.position,this.little_endian)),this._position+=4;return e}i32_array(t){this.check_size("n",t,4*t);const e=[];for(let i=0;i<t;++i)e.push(this.dv.getInt32(this.offset+this.position,this.little_endian)),this._position+=4;return e}vec2_f32(){return{x:this.f32(),y:this.f32()}}vec3_f32(){return{x:this.f32(),y:this.f32(),z:this.f32()}}string_ascii(t,e,i){const s=[];for(let n=0;n<t;n++){const r=this.u8();if(e&&0===r){i&&this.seek(t-n-1);break}s.push(r)}return String.fromCodePoint(...s)}string_utf16(t,e,i){const s=[],n=Math.floor(t/2);for(let t=0;t<n;t++){const r=this.u16();if(e&&0===r){i&&this.seek(2*(n-t-1));break}s.push(r)}return String.fromCodePoint(...s)}string_ascii_at(t,e,i){const s=[];for(let n=0;n<e;n++){const e=this.u8_at(t+n);if(i&&0===e)break;s.push(e)}return String.fromCodePoint(...s)}string_utf16_at(t,e,i){const s=[],n=Math.floor(e/2);for(let e=0;e<n;e++){const n=this.u16_at(t+2*e);if(i&&0===n)break;s.push(n)}return String.fromCodePoint(...s)}array_buffer(t=this.size-this.position){this.check_size("size",t,t);const e=this.backing_buffer.slice(this.offset+this.position,this.offset+this.position+t);return this._position+=t,e}copy_to_uint8_array(t,e=this.size-this.position){return this.check_size("size",e,e),t.set(new Uint8Array(this.backing_buffer,this.offset+this.position,e)),this._position+=e,this}check_size(t,e,i){if(i<0||i>this.size-this.position)throw new Error(`${t} ${e} is out of bounds.`)}check_offset(t,e){if(t<0||t+e>this.size)throw new Error(`Offset ${t} is out of bounds.`)}}i.d(e,"a",(function(){return r}));class r extends n{write_u8(t){return this.write_u8_at(this.position,t),this._position+=1,this}write_u16(t){return this.write_u16_at(this.position,t),this._position+=2,this}write_u32(t){return this.write_u32_at(this.position,t),this._position+=4,this}write_i8(t){return this.write_i8_at(this.position,t),this._position+=1,this}write_i16(t){return this.write_i16_at(this.position,t),this._position+=2,this}write_i32(t){return this.write_i32_at(this.position,t),this._position+=4,this}write_f32(t){return this.write_f32_at(this.position,t),this._position+=4,this}write_u8_array(t){return this.write_u8_array_at(this.position,t),this._position+=t.length,this}write_u16_array(t){return this.write_u16_array_at(this.position,t),this._position+=2*t.length,this}write_u32_array(t){return this.write_u32_array_at(this.position,t),this._position+=4*t.length,this}write_i32_array(t){return this.write_i32_array_at(this.position,t),this._position+=4*t.length,this}write_vec2_f32(t){return this.write_vec2_f32_at(this.position,t),this._position+=8,this}write_vec3_f32(t){return this.write_vec3_f32_at(this.position,t),this._position+=12,this}write_cursor(t){const e=t.size-t.position;return this.ensure_size(e),t.copy_to_uint8_array(new Uint8Array(this.backing_buffer,this.offset+this.position,e),e),this._position+=e,this}write_string_ascii(t,e){return this.write_string_ascii_at(this.position,t,e),this._position+=e,this}write_string_utf16(t,e){return this.write_string_utf16_at(this.position,t,e),this._position+=e,this}write_u8_at(t,e){return this.ensure_size(1,t),this.dv.setUint8(t,e),this}write_u16_at(t,e){return this.ensure_size(2,t),this.dv.setUint16(t,e,this.little_endian),this}write_u32_at(t,e){return this.ensure_size(4,t),this.dv.setUint32(t,e,this.little_endian),this}write_i8_at(t,e){return this.ensure_size(1,t),this.dv.setInt8(t,e),this}write_i16_at(t,e){return this.ensure_size(2,t),this.dv.setInt16(t,e,this.little_endian),this}write_i32_at(t,e){return this.ensure_size(4,t),this.dv.setInt32(t,e,this.little_endian),this}write_f32_at(t,e){return this.ensure_size(4,t),this.dv.setFloat32(t,e,this.little_endian),this}write_u8_array_at(t,e){return this.ensure_size(e.length,t),new Uint8Array(this.backing_buffer,this.offset+t).set(new Uint8Array(e)),this}write_u16_array_at(t,e){this.ensure_size(2*e.length,t);const i=e.length;for(let s=0;s<i;s++)this.write_u16_at(t+2*s,e[s]);return this}write_u32_array_at(t,e){this.ensure_size(4*e.length,t);const i=e.length;for(let s=0;s<i;s++)this.write_u32_at(t+4*s,e[s]);return this}write_i32_array_at(t,e){this.ensure_size(4*e.length,t);const i=e.length;for(let s=0;s<i;s++)this.write_i32_at(t+4*s,e[s]);return this}write_vec2_f32_at(t,e){return this.ensure_size(8,t),this.dv.setFloat32(t,e.x,this.little_endian),this.dv.setFloat32(t+4,e.y,this.little_endian),this}write_vec3_f32_at(t,e){return this.ensure_size(12,t),this.dv.setFloat32(t,e.x,this.little_endian),this.dv.setFloat32(t+4,e.y,this.little_endian),this.dv.setFloat32(t+8,e.z,this.little_endian),this}write_string_ascii_at(t,e,i){this.ensure_size(i,t);const s=Math.min(i,e.length);for(let i=0;i<s;i++)this.write_u8_at(t+i,e.codePointAt(i));const n=i-s;for(let e=0;e<n;e++)this.write_u8_at(t+s+e,0);return this}write_string_utf16_at(t,e,i){this.ensure_size(i,t);const s=Math.floor(i/2),n=Math.min(s,e.length);for(let i=0;i<n;i++)this.write_u16_at(t+2*i,e.codePointAt(i));const r=s-n;for(let e=0;e<r;e++)this.write_u16_at(t+2*n+2*e,0);return this}ensure_size(t,e=this.position){const i=this.size-e;if(t>i)throw new Error(`${t} Bytes required but only ${i} available.`)}}},Eqai:function(t,e,i){"use strict";i.d(e,"a",(function(){return a})),i.d(e,"b",(function(){return h}));var s=i("Womt");const n=new s.MeshLambertMaterial({color:65280,side:s.DoubleSide}),r=new s.MeshLambertMaterial({color:16711935,side:s.DoubleSide}),o=new s.MeshLambertMaterial({skinning:!0,color:16711935,side:s.DoubleSide});function a(t,e,i=r){return u(t,e,i,s.Mesh)}function h(t,e,i=o){return u(t,e,i,s.SkinnedMesh)}function u(t,e,i,r){const{created_by_geometry_builder:o,normalized_material_indices:a,bones:h}=t.userData;let u;if(Array.isArray(e))if(o){u=[n];for(const[t,s]of a.entries())s>0&&(u[s]=e[t]||i)}else u=e;else u=e||i;const c=new r(t,u);return o&&h.length&&c instanceof s.SkinnedMesh&&(c.add(h[0]),c.bind(new s.Skeleton(h))),c}},Ftn7:function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));var s=i("pVCM"),n=i("Womt");s.a.install({THREE:Object.assign(Object.assign({},n),{MOUSE:Object.assign(Object.assign({},n.MOUSE),{LEFT:n.MOUSE.RIGHT,RIGHT:n.MOUSE.LEFT})})});class r{constructor(t){this._debug=!1,this.scene=new n.Scene,this.light_holder=new n.Group,this.render_scheduled=!1,this.animation_frame_handle=void 0,this.light=new n.HemisphereLight(16777215,5263440,1),this.controls_clock=new n.Clock,this.size=new n.Vector2(0,0),this.schedule_render=()=>{this.render_scheduled=!0},this.on_mouse_down=t=>{t.currentTarget&&t.currentTarget.focus()},this.call_render=()=>{const t=this.controls.update(this.controls_clock.getDelta()),e=this.render_scheduled||t;this.render_scheduled=!1,e&&this.render(),this.animation_frame_handle=requestAnimationFrame(this.call_render)},this.renderer=t,this.renderer.domElement.tabIndex=0,this.renderer.domElement.addEventListener("mousedown",this.on_mouse_down),this.renderer.domElement.style.outline="none",this.scene.background=new n.Color(1579032),this.light_holder.add(this.light),this.scene.add(this.light_holder)}get debug(){return this._debug}set debug(t){this._debug=t}get canvas_element(){return this.renderer.domElement}set_size(t,e){this.size.set(t,e),this.renderer.setSize(t,e),this.schedule_render()}pointer_pos_to_device_coords(t){t.set(t.x/this.size.width*2-1,t.y/this.size.height*-2+1)}start_rendering(){null==this.animation_frame_handle&&(this.schedule_render(),this.animation_frame_handle=requestAnimationFrame(this.call_render))}stop_rendering(){null!=this.animation_frame_handle&&(cancelAnimationFrame(this.animation_frame_handle),this.animation_frame_handle=void 0)}reset_camera(t,e){this.controls.setLookAt(t.x,t.y,t.z,e.x,e.y,e.z)}dispose(){this.renderer.dispose(),this.controls.dispose()}init_camera_controls(){this.controls=new s.a(this.camera,this.renderer.domElement),this.controls.dampingFactor=1,this.controls.draggingDampingFactor=1}render(){this.renderer.render(this.scene,this.camera)}}},NRxM:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("9dYx");class n extends s.a{constructor(t,e,i=0,s=t.byteLength-i){super(e,i),this._size=s,this.backing_buffer=t,this.dv=new DataView(t,0,t.byteLength)}get size(){return this._size}set size(t){if(t>this.backing_buffer.byteLength-this.offset)throw new Error(`Size ${t} is out of bounds.`);this._size=t}take(t){const e=this.offset+this.position,i=new n(this.backing_buffer,this.endianness,e,t);return this._position+=t,i}}},PE7g:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("0Xme");i("rY5A");class n extends s.a{constructor(t=0,e){if(super(t,"core_NumberInput","number","core_NumberInput_inner",e),this.preferred_label_position="left",e){const{min:t,max:i,step:s,width:n}=e;this.set_attr("min",t,String),this.set_attr("max",i,String),this.input_element.step="any",this.set_attr("step",s,String),null!=n&&(this.element.style.width=`${n}px`)}e&&null!=e.round_to&&e.round_to>=0?this.rounding_factor=Math.pow(10,e.round_to):this.rounding_factor=1,this.set_value(t),this.finalize_construction()}get_value(){return parseFloat(this.input_element.value)}set_value(t){this.input_element.valueAsNumber=Math.round(this.rounding_factor*t)/this.rounding_factor}}},bcBH:function(t,e,i){"use strict";var s;i.d(e,"a",(function(){return s})),function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(s||(s={}))},iPoI:function(t,e,i){"use strict";i.d(e,"a",(function(){return n})),i.d(e,"b",(function(){return r}));var s=i("FXpb");function n(t){return new Promise(e=>{var i,n,r,o;const a=Object(s.l)({type:"file"});a.accept=null!=(n=null===(i=t)||void 0===i?void 0:i.accept)?n:"",a.multiple=null!=(o=null===(r=t)||void 0===r?void 0:r.multiple)&&o,a.onchange=()=>{a.files&&a.files.length?e([...a.files]):e([])},a.click()})}function r(t){return new Promise((e,i)=>{const s=new FileReader;s.addEventListener("loadend",()=>{s.result instanceof ArrayBuffer?e(s.result):i(new Error("Couldn't read file."))}),s.readAsArrayBuffer(t)})}},iR5r:function(t,e,i){"use strict";i.d(e,"a",(function(){return n})),i.d(e,"b",(function(){return r}));var s=i("Womt");function n(t){return t.textures.map(r)}function r(t){let e,i;switch(t.format[1]){case 6:e=s.RGBA_S3TC_DXT1_Format,i=t.width*t.height/2;break;case 7:e=s.RGBA_S3TC_DXT3_Format,i=t.width*t.height;break;default:throw new Error(`Format ${t.format.join(", ")} not supported.`)}const n=new s.CompressedTexture([{data:new Uint8Array(t.data,0,i),width:t.width,height:t.height}],t.width,t.height,e);return n.minFilter=s.LinearFilter,n.wrapS=s.MirroredRepeatWrapping,n.wrapT=s.MirroredRepeatWrapping,n.needsUpdate=!0,n}},kwt4:function(t,e,i){"use strict";var s=i("9Ykw"),n=i("rwco");const r=n.c.get("core/data_formats/parsing/ninja/njcm");var o;function a(t,e){const i=t.u32(),s=t.u32(),n=t.vec3_f32(),r=t.f32(),a=[],u=[];if(i){t.seek_start(i);for(const i of h(t,e,!0))if(i.type===o.Vertex)for(const t of i.vertices)a[t.index]={position:t.position,normal:t.normal,bone_weight:t.bone_weight,bone_weight_status:t.bone_weight_status,calc_continue:t.calc_continue}}if(s){t.seek_start(s);let i=void 0;for(const s of h(t,e,!1))if(s.type===o.Tiny)i=s.texture_id;else if(s.type===o.Strip){for(const t of s.triangle_strips)t.texture_id=i;u.push(...s.triangle_strips)}}return{type:"njcm",vertices:a,meshes:u,collision_sphere_center:n,collision_sphere_radius:r}}function h(t,e,i){const s=[];let n=!0;for(;n;){const a=t.u8(),_=t.u8(),l=t.position;let d=0;if(0===a)s.push({type:o.Null,type_id:a});else if(1<=a&&a<=3)s.push({type:o.Bits,type_id:a});else if(4===a){const i=_,r=t.position;s.push({type:o.CachePolygonList,type_id:a,cache_index:i,offset:r}),e[i]=r,n=!1}else if(5===a){const n=_,r=e[n];null!=r&&(t.seek_start(r),s.push(...h(t,e,i))),s.push({type:o.DrawPolygonList,type_id:a,cache_index:n})}else if(8<=a&&a<=9){d=2;const e=t.u16();s.push({type:o.Tiny,type_id:a,flip_u:0!=(128&a),flip_v:0!=(64&a),clamp_u:0!=(32&a),clamp_v:0!=(16&a),mipmap_d_adjust:15&a,filter_mode:e>>>14,super_sample:0!=(64&e),texture_id:8191&e})}else 17<=a&&a<=31?(d=2+2*t.u16(),s.push({type:o.Material,type_id:a})):32<=a&&a<=50?(d=2+4*t.u16(),s.push({type:o.Vertex,type_id:a,vertices:u(t,a,_)})):56<=a&&a<=58?(d=2+2*t.u16(),s.push({type:o.Volume,type_id:a})):64<=a&&a<=75?(d=2+2*t.u16(),s.push({type:o.Strip,type_id:a,triangle_strips:c(t,a,_)})):255===a?(d=i?2:0,s.push({type:o.End,type_id:a}),n=!1):(d=2+2*t.u16(),s.push({type:o.Unknown,type_id:a}),r.warn(`Unknown chunk type ${a} at offset ${l}.`));t.seek_start(l+d)}return s}function u(t,e,i){if(e<32||e>50)return r.warn(`Unknown vertex chunk type ${e}.`),[];const s=3&i,n=0!=(128&i),o=t.u16(),a=t.u16(),h=[];for(let i=0;i<a;++i){const r={index:o+i,position:t.vec3_f32(),bone_weight:1,bone_weight_status:s,calc_continue:n};if(32===e)t.seek(4);else if(33===e)t.seek(4),r.normal=t.vec3_f32(),t.seek(4);else if(35<=e&&e<=40)37===e?(r.index=o+t.u16(),r.bone_weight=t.u16()/255):t.seek(4);else if(41<=e&&e<=47)r.normal=t.vec3_f32(),e>=42&&(44===e?(r.index=o+t.u16(),r.bone_weight=t.u16()/255):t.seek(4));else if(48<=e&&e<=50){const i=t.u32();r.normal={x:(i>>20&1023)/1023,y:(i>>10&1023)/1023,z:(1023&i)/1023},e>=49&&t.seek(4)}h.push(r)}return h}function c(t,e,i){const s={ignore_light:0!=(1&i),ignore_specular:0!=(2&i),ignore_ambient:0!=(4&i),use_alpha:0!=(8&i),double_side:0!=(16&i),flat_shading:0!=(32&i),environment_mapping:0!=(64&i)},n=t.u16(),r=n>>>14,o=16383&n;let a=!1,h=!1,u=!1,c=!1;switch(e){case 64:break;case 65:case 66:a=!0;break;case 67:u=!0;break;case 68:case 69:a=!0,u=!0;break;case 70:h=!0;break;case 71:case 72:a=!0,h=!0;break;case 73:break;case 74:case 75:c=!0;break;default:throw new Error(`Unexpected chunk type ID: ${e}.`)}const _=[];for(let e=0;e<o;++e){const e=t.i16(),i=e<1,n=Math.abs(e),o=[];for(let e=0;e<n;++e){const i={index:t.u16()};o.push(i),a&&(i.tex_coords={x:t.u16()/255,y:t.u16()/255}),h&&t.seek(4),u&&(i.normal={x:t.u16()/255,y:t.u16()/255,z:t.u16()/255}),c&&t.seek(8),e>=2&&t.seek(2*r)}_.push(Object.assign(Object.assign({},s),{clockwise_winding:i,has_tex_coords:a,has_normal:u,vertices:o}))}return _}!function(t){t[t.Unknown=0]="Unknown",t[t.Null=1]="Null",t[t.Bits=2]="Bits",t[t.CachePolygonList=3]="CachePolygonList",t[t.DrawPolygonList=4]="DrawPolygonList",t[t.Tiny=5]="Tiny",t[t.Material=6]="Material",t[t.Vertex=7]="Vertex",t[t.Volume=8]="Volume",t[t.Strip=9]="Strip",t[t.End=10]="End"}(o||(o={}));const _=n.c.get("core/data_formats/parsing/ninja/xj");function l(t){t.seek(4);const e=t.u32(),i=t.u32(),s=t.u32(),n=t.u32(),r=t.u32(),o=t.u32(),a={type:"xj",vertices:[],meshes:[],collision_sphere_position:t.vec3_f32(),collision_sphere_radius:t.f32()};return i>=1&&(i>1&&_.warn(`Vertex info count of ${i} was larger than expected.`),a.vertices.push(...function(t,e){t.seek_start(e);const i=t.u16();t.seek(2);const s=t.u32(),n=t.u32(),r=t.u32(),o=[];for(let e=0;e<r;++e){t.seek_start(s+e*n);const r=t.vec3_f32();let a,h;switch(i){case 3:a=t.vec3_f32(),h=t.vec2_f32();break;case 4:break;case 5:t.seek(4),h=t.vec2_f32();break;case 6:a=t.vec3_f32();break;case 7:a=t.vec3_f32(),h=t.vec2_f32();break;default:_.warn(`Unknown vertex type ${i} with size ${n}.`)}o.push({position:r,normal:a,uv:h})}return o}(t,e))),a.meshes.push(...d(t,s,n)),a.meshes.push(...d(t,r,o)),a}function d(t,e,i){const s=[];for(let n=0;n<i;++n){t.seek_start(e+20*n);const i=t.u32(),r=t.u32(),o=t.u32(),a=t.u32(),h=f(t,i,r);t.seek_start(o);const u=t.u16_array(a);s.push({material_properties:h,indices:u})}return s}function f(t,e,i){const s={};for(let n=0;n<i;++n){switch(t.seek_start(e+16*n),t.u32()){case 2:s.alpha_src=t.u32(),s.alpha_dst=t.u32();break;case 3:s.texture_id=t.u32();break;case 5:s.diffuse_r=t.u8(),s.diffuse_g=t.u8(),s.diffuse_b=t.u8(),s.diffuse_a=t.u8()}}return s}i.d(e,"a",(function(){return p})),i.d(e,"b",(function(){return g})),i.d(e,"c",(function(){return w})),i.d(e,"d",(function(){return v})),i.d(e,"e",(function(){return y}));const p=2*Math.PI/65535,b=1296255566;function g(t){return"njcm"===t.type}class m{constructor(t,e,i,s,n,r){this.bone_cache=new Map,this._bone_count=-1,this.evaluation_flags=t,this.model=e,this.position=i,this.rotation=s,this.scale=n,this._children=r,this.children=this._children}bone_count(){if(-1===this._bone_count){const t=[0];this.get_bone_internal(this,Number.MAX_SAFE_INTEGER,t),this._bone_count=t[0]}return this._bone_count}get_bone(t){let e=this.bone_cache.get(t);return void 0===e&&(e=this.get_bone_internal(this,t,[0]),this.bone_cache.set(t,e||null)),e||void 0}add_child(t){this._bone_count=-1,this.bone_cache.clear(),this._children.push(t)}get_bone_internal(t,e,i){if(!t.evaluation_flags.skip){const s=i[0]++;if(this.bone_cache.set(s,t),s===e)return t}if(!t.evaluation_flags.break_child_trace)for(const s of t.children){const t=this.get_bone_internal(s,e,i);if(t)return t}}}function w(t){return k(t,a,[])}function v(t){return k(t,l,void 0)}function y(t){return x(t,l,void 0)}function k(t,e,i){const n=Object(s.a)(t).filter(t=>t.type===b),r=[];for(const t of n)r.push(...x(t.data,e,i));return r}function x(t,e,i){const s=t.u32(),n=0!=(1&s),r=0!=(2&s),o=0!=(4&s),a=0!=(8&s),h=0!=(16&s),u=0!=(32&s),c=0!=(64&s),_=0!=(128&s),l=t.u32(),d=t.vec3_f32(),f={x:t.i32()*p,y:t.i32()*p,z:t.i32()*p},b=t.vec3_f32(),g=t.u32(),w=t.u32();let v,y,k;return l&&(t.seek_start(l),v=e(t,i)),g?(t.seek_start(g),y=x(t,e,i)):y=[],w?(t.seek_start(w),k=x(t,e,i)):k=[],[new m({no_translate:n,no_rotate:r,no_scale:o,hidden:a,break_child_trace:h,zxy_rotation_order:u,skip:c,shape_skip:_},v,d,f,b,y),...k]}},mKaR:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("Tpfs");class n{constructor(){this.disposer=new s.a}dispose(){this.disposer.dispose()}disposable(t){return this.disposer.add(t)}disposables(...t){this.disposer.add_all(...t)}}},oyid:function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var s=i("sDu+"),n=i("4VsB"),r=i("FXpb");class o extends s.a{constructor(t=!1,e){super(e),this.element=Object(r.l)({className:"core_CheckBox"}),this.preferred_label_position="right",this._checked=new n.a(this,t,this.set_checked),this.checked=this._checked,this.set_checked(t),this.element.type="checkbox",this.element.onchange=()=>this._checked.set_val(this.element.checked,{silent:!1}),this.finalize_construction()}set_enabled(t){super.set_enabled(t),this.element.disabled=!t}set_checked(t){this.element.checked=t}}},tRdk:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("Womt");function n(t){return new s.Vector3(t.x,t.y,t.z)}},vM2b:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("Womt");class n{constructor(){this.positions=[],this.normals=[],this.uvs=[],this.indices=[],this.bones=[],this.bone_indices=[],this.bone_weights=[],this.groups=[],this.material_indices=new Set([-1])}get vertex_count(){return this.positions.length/3}get index_count(){return this.indices.length}get_position(t){return new s.Vector3(this.positions[3*t],this.positions[3*t+1],this.positions[3*t+2])}get_normal(t){return new s.Vector3(this.normals[3*t],this.normals[3*t+1],this.normals[3*t+2])}add_vertex(t,e,i){this.positions.push(t.x,t.y,t.z),this.normals.push(e.x,e.y,e.z),this.uvs.push(i.x,i.y)}add_index(t){this.indices.push(t)}add_bone(t){this.bones.push(t)}add_bone_weight(t,e){this.bone_indices.push(t),this.bone_weights.push(e)}add_group(t,e,i){const s=this.groups[this.groups.length-1],n=null==i?-1:i;s&&s.material_index===n?s.size+=e:(this.groups.push({offset:t,size:e,material_index:n}),this.material_indices.add(n))}build(){const t=new s.BufferGeometry,e=t.userData;e.created_by_geometry_builder=!0,t.setAttribute("position",new s.Float32BufferAttribute(this.positions,3)),t.setAttribute("normal",new s.Float32BufferAttribute(this.normals,3)),t.setAttribute("uv",new s.Float32BufferAttribute(this.uvs,2)),t.setIndex(new s.Uint16BufferAttribute(this.indices,1)),this.bone_indices.length&&this.bones.length?(t.setAttribute("skinIndex",new s.Uint16BufferAttribute(this.bone_indices,4)),t.setAttribute("skinWeight",new s.Float32BufferAttribute(this.bone_weights,4)),e.bones=this.bones):e.bones=[];const i=new Map;let n=0;for(const t of[...this.material_indices].sort((t,e)=>t-e))i.set(t,n++);for(const e of this.groups)t.addGroup(e.offset,e.size,i.get(e.material_index));return e.normalized_material_indices=i,t.computeBoundingSphere(),t.computeBoundingBox(),t}}},w6HN:function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var s=i("TRid"),n=(i("IQIM"),i("sDu+")),r=i("FXpb");class o extends s.a{constructor(t,...e){super(t instanceof s.a?void 0:t),this.element=Object(r.h)({className:"core_ToolBar"}),this.height=33,this.element.style.height=`${this.height}px`,this.children=t instanceof s.a?[t,...e]:e;for(const t of this.children)if(this.disposable(t),t instanceof n.a&&t.label){const e=Object(r.h)({className:"core_ToolBar_group"});"left"===t.preferred_label_position||"top"===t.preferred_label_position?e.append(t.label.element,t.element):e.append(t.element,t.label.element),this.element.append(e)}else this.element.append(t.element);this.finalize_construction()}set_enabled(t){super.set_enabled(t);for(const e of this.children)e.enabled.val=t}}},yub1:function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var s=i("9Ykw");const n=i("rwco").c.get("core/data_formats/parsing/ninja/texture"),r=1213027928,o=1414682200;function a(t){const e=Object(s.a)(t),i=e.find(t=>t.type===r),a=i&&function(t){return{texture_count:t.u16()}}(i.data),h=e.filter(t=>t.type===o).map(t=>(function(t){const e=t.u32(),i=t.u32(),s=t.u32(),n=t.u16(),r=t.u16(),o=t.u32();return t.seek(36),{id:s,format:[e,i],width:n,height:r,size:o,data:t.array_buffer(o)}})(t.data));return a&&a.texture_count!==h.length&&n.warn(`Found ${h.length} textures instead of ${a.texture_count} as defined in the header.`),{textures:h}}}}]);