@playcanvas/web-components 0.19.0 → 0.21.0
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/dist/app.d.cts +5 -99
- package/dist/app.d.ts +5 -99
- package/dist/asset-binding.d.cts +1 -0
- package/dist/asset-binding.d.ts +1 -0
- package/dist/components/anim-clip.d.cts +8 -10
- package/dist/components/anim-clip.d.ts +8 -10
- package/dist/components/anim-component.d.cts +5 -4
- package/dist/components/anim-component.d.ts +5 -4
- package/dist/components/audio-listener-component.d.cts +5 -4
- package/dist/components/audio-listener-component.d.ts +5 -4
- package/dist/components/button-component.d.cts +14 -9
- package/dist/components/button-component.d.ts +14 -9
- package/dist/components/camera-component.d.cts +5 -4
- package/dist/components/camera-component.d.ts +5 -4
- package/dist/components/collision-component.d.cts +5 -4
- package/dist/components/collision-component.d.ts +5 -4
- package/dist/components/component.d.cts +2 -2
- package/dist/components/component.d.ts +2 -2
- package/dist/components/element-component.d.cts +5 -4
- package/dist/components/element-component.d.ts +5 -4
- package/dist/components/gsplat-component.d.cts +5 -4
- package/dist/components/gsplat-component.d.ts +5 -4
- package/dist/components/joint-component.d.cts +29 -14
- package/dist/components/joint-component.d.ts +29 -14
- package/dist/components/layout-child-component.d.cts +5 -4
- package/dist/components/layout-child-component.d.ts +5 -4
- package/dist/components/layout-group-component.d.cts +5 -4
- package/dist/components/layout-group-component.d.ts +5 -4
- package/dist/components/light-component.d.cts +5 -4
- package/dist/components/light-component.d.ts +5 -4
- package/dist/components/particle-system-component.d.cts +22 -5
- package/dist/components/particle-system-component.d.ts +22 -5
- package/dist/components/render-component.d.cts +5 -4
- package/dist/components/render-component.d.ts +5 -4
- package/dist/components/rigid-body-component.d.cts +5 -4
- package/dist/components/rigid-body-component.d.ts +5 -4
- package/dist/components/screen-component.d.cts +5 -4
- package/dist/components/screen-component.d.ts +5 -4
- package/dist/components/script-component.d.cts +9 -6
- package/dist/components/script-component.d.ts +9 -6
- package/dist/components/script-instance.d.cts +14 -6
- package/dist/components/script-instance.d.ts +14 -6
- package/dist/components/scroll-view-component.d.cts +29 -16
- package/dist/components/scroll-view-component.d.ts +29 -16
- package/dist/components/scrollbar-component.d.cts +11 -7
- package/dist/components/scrollbar-component.d.ts +11 -7
- package/dist/components/sound-component.d.cts +5 -4
- package/dist/components/sound-component.d.ts +5 -4
- package/dist/custom-elements.json +59 -59
- package/dist/entity-reference.d.cts +13 -0
- package/dist/entity-reference.d.ts +13 -0
- package/dist/material.d.cts +8 -6
- package/dist/material.d.ts +8 -6
- package/dist/model.d.cts +8 -9
- package/dist/model.d.ts +8 -9
- package/dist/parse.d.cts +0 -3
- package/dist/parse.d.ts +0 -3
- package/dist/pointer-controller.d.cts +1 -0
- package/dist/pointer-controller.d.ts +1 -0
- package/dist/pwc.cjs +1085 -633
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +1085 -633
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.min.mjs +1 -1
- package/dist/pwc.min.mjs.map +1 -1
- package/dist/pwc.mjs +1086 -634
- package/dist/pwc.mjs.map +1 -1
- package/dist/sky.d.cts +6 -7
- package/dist/sky.d.ts +6 -7
- package/dist/vscode.html-custom-data.json +10 -10
- package/dist/web-types.json +58 -58
- package/package.json +3 -3
- package/src/app.ts +16 -416
- package/src/asset-binding.ts +141 -0
- package/src/components/anim-clip.ts +22 -45
- package/src/components/anim-component.ts +10 -6
- package/src/components/audio-listener-component.ts +6 -5
- package/src/components/button-component.ts +25 -15
- package/src/components/camera-component.ts +6 -5
- package/src/components/collision-component.ts +6 -5
- package/src/components/component.ts +6 -4
- package/src/components/element-component.ts +6 -5
- package/src/components/gsplat-component.ts +6 -5
- package/src/components/joint-component.ts +36 -20
- package/src/components/layout-child-component.ts +6 -5
- package/src/components/layout-group-component.ts +6 -5
- package/src/components/light-component.ts +6 -5
- package/src/components/particle-system-component.ts +56 -30
- package/src/components/render-component.ts +6 -5
- package/src/components/rigid-body-component.ts +6 -5
- package/src/components/screen-component.ts +6 -5
- package/src/components/script-component.ts +28 -17
- package/src/components/script-instance.ts +14 -6
- package/src/components/scroll-view-component.ts +56 -34
- package/src/components/scrollbar-component.ts +20 -13
- package/src/components/sound-component.ts +6 -5
- package/src/entity-reference.ts +237 -0
- package/src/material.ts +25 -29
- package/src/model.ts +24 -48
- package/src/parse.ts +0 -35
- package/src/pointer-controller.ts +550 -0
- package/src/sky.ts +19 -30
package/dist/pwc.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basisInitialize as e,WasmModule as t,Vec3 as i,Color as s,Vec4 as a,Quat as n,Vec2 as o,createGraphicsDevice as r,AppOptions as l,Keyboard as c,Mouse as h,ElementInput as p,AnimComponentSystem as b,AnimationComponentSystem as d,AudioListenerComponentSystem as u,ButtonComponentSystem as m,CameraComponentSystem as g,CollisionComponentSystem as _,ElementComponentSystem as f,GSplatComponentSystem as v,JointComponentSystem as y,LayoutChildComponentSystem as k,LayoutGroupComponentSystem as w,LightComponentSystem as M,ModelComponentSystem as x,ParticleSystemComponentSystem as S,RenderComponentSystem as C,RigidBodyComponentSystem as A,ScreenComponentSystem as F,ScriptComponentSystem as E,ScrollbarComponentSystem as R,ScrollViewComponentSystem as j,SoundComponentSystem as O,SpriteComponentSystem as L,ZoneComponentSystem as z,AnimClipHandler as T,AnimationHandler as D,AnimStateGraphHandler as H,AudioHandler as G,BinaryHandler as B,CssHandler as P,ContainerHandler as U,CubemapHandler as q,FolderHandler as W,FontHandler as $,GSplatHandler as Y,HierarchyHandler as I,HtmlHandler as K,JsonHandler as Q,MaterialHandler as X,ModelHandler as N,RenderHandler as J,ScriptHandler as Z,SceneHandler as V,ShaderHandler as ee,SpriteHandler as te,TemplateHandler as ie,TextHandler as se,TextureAtlasHandler as ae,TextureHandler as ne,SoundManager as oe,Lightmapper as re,BatchManager as le,XrManager as ce,AppBase as he,FILLMODE_NONE as pe,RESOLUTION_AUTO as be,Picker as de,MeshInstance as ue,Entity as me,Asset as ge,SPRITE_RENDERMODE_SIMPLE as _e,FILTER_LINEAR_MIPMAP_LINEAR as fe,FILTER_LINEAR as ve,ADDRESS_REPEAT as ye,SPRITE_RENDERMODE_SLICED as ke,SPRITE_RENDERMODE_TILED as we,ADDRESS_CLAMP_TO_EDGE as Me,ADDRESS_MIRRORED_REPEAT as xe,FILTER_NEAREST as Se,FILTER_NEAREST_MIPMAP_NEAREST as Ce,FILTER_LINEAR_MIPMAP_NEAREST as Ae,FILTER_NEAREST_MIPMAP_LINEAR as Fe,AnimTrack as Ee,ANIM_CONTROL_STATES as Re,BUTTON_TRANSITION_MODE_TINT as je,BUTTON_TRANSITION_MODE_SPRITE_CHANGE as Oe,TONEMAP_NONE as Le,PROJECTION_PERSPECTIVE as ze,GAMMA_SRGB as Te,GAMMA_NONE as De,XRTYPE_AR as He,XRTYPE_VR as Ge,TONEMAP_LINEAR as Be,TONEMAP_FILMIC as Pe,TONEMAP_HEJL as Ue,TONEMAP_ACES as qe,TONEMAP_ACES2 as We,TONEMAP_NEUTRAL as $e,PROJECTION_ORTHOGRAPHIC as Ye,ORIENTATION_HORIZONTAL as Ie,FITTING_NONE as Ke,FITTING_STRETCH as Qe,FITTING_SHRINK as Xe,FITTING_BOTH as Ne,ORIENTATION_VERTICAL as Je,SHADOW_PCF3_32F as Ze,SHADOW_PCF1_16F as Ve,SHADOW_PCF1_32F as et,SHADOW_PCF3_16F as tt,SHADOW_PCF5_16F as it,SHADOW_PCF5_32F as st,SHADOW_VSM_16F as at,SHADOW_VSM_32F as nt,SHADOW_PCSS_32F as ot,StandardMaterial as rt,BLEND_NONE as lt,CULLFACE_BACK as ct,FRESNEL_SCHLICK as ht,SPECOCC_AO as pt,BLEND_NORMAL as bt,BLEND_ADDITIVE as dt,BLEND_ADDITIVEALPHA as ut,BLEND_PREMULTIPLIED as mt,BLEND_MULTIPLICATIVE as gt,BLEND_MULTIPLICATIVE2X as _t,BLEND_SCREEN as ft,BLEND_MIN as vt,BLEND_MAX as yt,BLEND_SUBTRACTIVE as kt,CULLFACE_NONE as wt,CULLFACE_FRONT as Mt,CULLFACE_FRONTANDBACK as xt,FRESNEL_NONE as St,SPECOCC_NONE as Ct,SPECOCC_GLOSSDEPENDENT as At,SCALEMODE_NONE as Ft,SCALEMODE_BLEND as Et,SCROLL_MODE_BOUNCE as Rt,SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED as jt,SCROLLBAR_VISIBILITY_SHOW_ALWAYS as Ot,SCROLL_MODE_CLAMP as Lt,SCROLL_MODE_INFINITE as zt,EnvLighting as Tt,LAYERID_SKYBOX as Dt}from"playcanvas";class Ht extends HTMLElement{_readyPromise;_readyResolve;_readyResolved=!1;constructor(){super(),this._readyPromise=new Promise(e=>{this._readyResolve=e})}get closestApp(){return this.parentElement?.closest("pc-app")??null}get closestEntity(){return this.parentElement?.closest("pc-entity, pc-model, pc-node")??null}_onReady(){this._readyResolved||(this._readyResolved=!0,this._readyResolve(),this.dispatchEvent(new CustomEvent("ready",{bubbles:!0,composed:!0})))}_resetReady(){this._readyResolved&&(this._readyResolved=!1,this._readyPromise=new Promise(e=>{this._readyResolve=e}))}ready(){return this._readyPromise.then(()=>this)}}async function Gt(e){let t;if("string"==typeof e){"loading"===document.readyState&&await new Promise(e=>{document.addEventListener("DOMContentLoaded",e,{once:!0})});try{t=document.querySelector(e)}catch{throw new Error(`whenReady: '${e}' is not a valid CSS selector`)}if(!t)throw new Error(`whenReady: no element found matching '${e}'`)}else t=e;if(!(t instanceof Ht)){const i=t instanceof Element?`<${t.tagName.toLowerCase()}>`:String(e);throw new Error(`whenReady: ${i} does not initialize asynchronously`)}return await t.ready(),t}class Bt extends Ht{_loadPromise=null;connectedCallback(){this._getLoadPromise()}async _loadModule(){const i=this.getAttribute("name");if(!i)return void console.warn("pc-wasm requires a 'name' attribute - no module was configured");const s={glueUrl:this.getAttribute("glue")??void 0,wasmUrl:this.getAttribute("wasm")??void 0,fallbackUrl:this.getAttribute("fallback")??void 0};"Basis"===i?e(s):(t.setConfig(i,s),await new Promise(e=>{t.getInstance(i,()=>e())})),this._onReady()}_getLoadPromise(){return this._loadPromise||(this._loadPromise=this._loadModule()),this._loadPromise}}customElements.define("pc-wasm",Bt);const Pt=["pointerenter","pointerleave","pointerdown","pointerup","pointermove","click"],Ut=new Set(Pt),qt=Pt.map(e=>`on${e}`);class Wt extends Ht{_entity=null;_appElement=null;_listeners={};_inlineHandlerTypes=new Set;get entity(){return this._entity}_registerEntity(e){this._appElement=this.closestApp,this._appElement?._registerEntityElement(e,this)}_unregisterEntity(e){this._appElement?._unregisterEntityElement(e),this._appElement=null}_updateInlineHandler(e,t){const i=e.substring(2),s=this._inlineHandlerTypes.has(i),a=null!==t;a&&!s?(this._inlineHandlerTypes.add(i),this.dispatchEvent(new CustomEvent(`${i}:connect`,{bubbles:!0}))):!a&&s&&(this._inlineHandlerTypes.delete(i),this.dispatchEvent(new CustomEvent(`${i}:disconnect`,{bubbles:!0})))}addEventListener(e,t,i){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),super.addEventListener(e,t,i),Ut.has(e)&&this.dispatchEvent(new CustomEvent(`${e}:connect`,{bubbles:!0}))}removeEventListener(e,t,i){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(e=>e!==t)),super.removeEventListener(e,t,i),Ut.has(e)&&this.dispatchEvent(new CustomEvent(`${e}:disconnect`,{bubbles:!0}))}_hasListeners(e){return Boolean(this._listeners[e]?.length)||this._inlineHandlerTypes.has(e)}}class $t{_track;_fill;_sweep=null;_removal=null;constructor(e){this._track=document.createElement("div"),this._track.setAttribute("role","progressbar"),this._track.setAttribute("aria-label","Loading"),this._track.setAttribute("aria-valuemin","0"),this._track.setAttribute("aria-valuemax","100"),this._track.style.cssText=["position: absolute","top: 0","left: 0","width: 100%","height: var(--pc-loading-bar-height, 3px)","background: var(--pc-loading-bar-background, rgba(0, 0, 0, 0.1))","z-index: 10000","pointer-events: none","opacity: 1","transition: opacity 0.2s ease"].join("; "),this._fill=document.createElement("div"),this._fill.style.cssText=["width: 100%","height: 100%","transform-origin: left center","transform: scaleX(0)","background: var(--pc-loading-bar-color, #f60)","transition: transform 0.2s ease"].join("; "),this._track.appendChild(this._fill),e.appendChild(this._track),"function"==typeof this._fill.animate&&(this._sweep=this._fill.animate([{transform:"scaleX(0.25) translateX(-100%)"},{transform:"scaleX(0.25) translateX(500%)"}],{duration:1e3,iterations:1/0,easing:"ease-in-out"}))}progress(e,t){this._sweep&&(this._sweep.cancel(),this._sweep=null);const i=0===t?1:e/t;this._track.setAttribute("aria-valuenow",String(Math.round(100*i))),this._fill.style.transform=`scaleX(${i})`}complete(){null===this._removal&&(this._sweep&&(this._sweep.cancel(),this._sweep=null),this._track.setAttribute("aria-valuenow","100"),this._fill.style.transform="scaleX(1)",this._track.style.opacity="0",this._removal=setTimeout(()=>this._track.remove(),250))}destroy(){this._sweep&&(this._sweep.cancel(),this._sweep=null),null!==this._removal&&(clearTimeout(this._removal),this._removal=null),this._track.remove()}}const Yt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},It=(e,t)=>{const i=e.trim().split(/\s+/).map(Number);return i.length!==t||i.some(e=>!Number.isFinite(e))?null:i},Kt=e=>null===e?null:e.clone(),Qt=(e,t)=>null===e?t:"false"!==e,Xt=(e,t,i)=>{if(null===e)return Kt(t);const a=Yt[e.toLowerCase()];if(a)return(new s).fromString(a);if(/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)){let t=e.slice(1);return 3!==t.length&&4!==t.length||(t=t.split("").map(e=>e+e).join("")),(new s).fromString(`#${t}`)}const n=It(e,4)??It(e,3);return n?new s(n):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected a CSS color name, a hex color or 3 or 4 space-separated numbers. Using '${t}'.`),Kt(t))},Nt=(e,t,i,s)=>{if(null===e)return i;const a=Array.isArray(t)?t:[...t.keys()];return a.includes(e)?e:(console.warn(`Invalid value '${e}' for attribute '${s}'. Valid values: ${a.join(", ")}. Using '${i}'.`),i)},Jt=(e,t,i)=>{if(null===e)return t;const s=""===e.trim()?NaN:Number(e);return Number.isFinite(s)?s:(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected a finite number. Using '${t}'.`),t)},Zt=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,3);return s?(new n).setFromEulerAngles(s[0],s[1],s[2]):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 3 space-separated numbers. Using '${t}'.`),Kt(t))},Vt=(e,t=[])=>null===e?[...t]:e.split(",").map(e=>e.trim()).filter(e=>""!==e),ei=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,2);return s?new o(s):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 2 space-separated numbers. Using '${t}'.`),Kt(t))},ti=(e,t,s)=>{if(null===e)return Kt(t);const a=It(e,3);return a?new i(a):(console.warn(`Invalid value '${e}' for attribute '${s}'. Expected 3 space-separated numbers. Using '${t}'.`),Kt(t))},ii=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,4);return s?new a(s):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 4 space-separated numbers. Using '${t}'.`),Kt(t))},si=e=>{if(!e)return null;let t=null;try{t=document.querySelector(e)}catch{t=null}return t||(t=document.getElementById(e)??document.querySelector(`pc-entity[name="${e}"]`)),t?.entity??null},ai=["pointerenter","pointerleave","pointermove"],ni={pointermove:["pointermove"],pointerenter:["pointermove"],pointerleave:["pointermove"],pointerdown:["pointerdown"],pointerup:["pointerup"],click:["pointerdown","pointerup","pointercancel"]};class oi extends Ht{_canvas=null;_alpha=!0;_backend="webgpu";_antialias=!0;_depthBuffer=!0;_stencilBuffer=!0;_maxPixelRatio=1/0;_loadingBar=!0;_optionsLocked=!1;_bar=null;_hierarchyReady=!1;_bootGeneration=0;_entityElements=new Map;_picker=null;_hoveredEntity=null;_pickToken=0;_pointerHandlers={pointermove:null,pointerdown:null,pointerup:null,pointercancel:null};_downPicks=new Map;_clickListened=!1;_lastClick=null;_app=null;_loadProgress=0;_resizeObserver=null;get app(){return this._app}get loadProgress(){return this._loadProgress}constructor(){super(),Pt.forEach(e=>{this.addEventListener(`${e}:connect`,()=>this._syncCanvasListeners()),this.addEventListener(`${e}:disconnect`,()=>this._syncCanvasListeners())})}async connectedCallback(){const e=++this._bootGeneration;(()=>{const e="pc-app-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=":where(pc-app) { display: block; position: relative; width: 300px; height: 150px; }",document.head.appendChild(t)})(),this._loadingBar&&!this._bar&&(this._bar=new $t(this)),customElements.upgrade(this);const t=this.querySelectorAll(":scope > pc-wasm");if(await Promise.all(Array.from(t).map(e=>e._getLoadPromise())),e!==this._bootGeneration)return;this._canvas=document.createElement("canvas"),this._canvas.style.cssText="display: block; width: 100%; height: 100%; touch-action: none;",this.appendChild(this._canvas);const i={webgpu:["webgpu","webgl2"],webgl2:["webgl2"],null:["null"]}[this._backend]||[];this._optionsLocked=!0;const s=i.join(", ");let a;try{a=await r(this._canvas,{alpha:this._alpha,antialias:this._antialias,depth:this._depthBuffer,deviceTypes:i,stencil:this._stencilBuffer})}catch(t){if(e!==this._bootGeneration)return;this._canvas&&this.contains(this._canvas)&&this.removeChild(this._canvas),this._canvas=null,this._bar?.destroy(),this._bar=null;const i=`pc-app failed to create a graphics device (${s}) - ${t instanceof Error?t.message:String(t)}`;return console.error(i,t),void this.dispatchEvent(new ErrorEvent("error",{message:i,error:t}))}if(e!==this._bootGeneration)return void a.destroy();a.maxPixelRatio=this._maxPixelRatio;const n=new l;n.graphicsDevice=a,n.keyboard=new c(window),n.mouse=new h(this._canvas),n.elementInput=new p(this._canvas,{useMouse:!0,useTouch:!0}),n.componentSystems=[b,d,u,m,g,_,f,v,y,k,w,M,x,S,C,A,F,E,R,j,O,L,z],n.resourceHandlers=[T,D,H,G,B,P,U,q,W,$,Y,I,K,Q,X,N,J,Z,V,ee,te,ie,se,ae,ne],n.soundManager=new oe,n.lightmapper=re,n.batchManager=le,n.xr=ce;const o=new he(this._canvas);this._app=o,o.init(n),o.setCanvasFillMode(pe),o.setCanvasResolution(be),this._pickerCreate(),"undefined"!=typeof ResizeObserver&&(this._resizeObserver=new ResizeObserver(()=>this._syncCanvasSize()),this._resizeObserver.observe(this));const de=this.querySelectorAll(":scope > pc-asset");for(const t of Array.from(de)){t._createAsset();const i=t.asset;if(i&&(o.assets.add(i),e!==this._bootGeneration))return}const ue=this.querySelectorAll(":scope > pc-material");Array.from(ue).forEach(e=>{e._createMaterial()});const me=this.querySelectorAll("pc-entity, pc-model");if(Array.from(me).forEach(e=>{e._createEntity(o)}),me.forEach(e=>{e._buildHierarchy(o)}),e!==this._bootGeneration)return;this._hierarchyReady=!0;const ge=o.assets.list({preload:!0}).length;let _e=0;const fe=()=>{_e+=1,this._loadProgress=_e/ge,this._bar?.progress(_e,ge),this.dispatchEvent(new ProgressEvent("progress",{lengthComputable:!0,loaded:_e,total:ge}))};o.on("preload:progress",fe),this._loadProgress=0===ge?1:0,this._bar?.progress(0,ge),this.dispatchEvent(new ProgressEvent("progress",{lengthComputable:!0,loaded:0,total:ge})),e===this._bootGeneration&&o.preload(()=>{e===this._bootGeneration&&(o.off("preload:progress",fe),this._loadProgress=1,o.start(),o.once("frameend",()=>this._bar?.complete()),this._onReady())})}disconnectedCallback(){this._bootGeneration++,this._optionsLocked=!1,this._pickerDestroy(),this._app&&(this._app.destroy(),this._app=null),this._entityElements.clear(),this._loadProgress=0,this._bar?.destroy(),this._bar=null,this._hierarchyReady=!1,this._resetReady(),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._canvas&&this.contains(this._canvas)&&(this.removeChild(this._canvas),this._canvas=null)}_syncCanvasSize(){if(!this.app||this.app.xr?.active)return;this.app.updateCanvasSize();const{width:e,height:t}=this.app.graphicsDevice;this._picker?.resize(e,t)}_pickerCreate(){const{width:e,height:t}=this.app.graphicsDevice;this._picker=new de(this.app,e,t);const i=e=>t=>{e.call(this,t)};this._pointerHandlers.pointermove=i(this._onPointerMove),this._pointerHandlers.pointerdown=i(this._onPointerDown),this._pointerHandlers.pointerup=i(this._onPointerUp),this._pointerHandlers.pointercancel=e=>{this._downPicks.delete(e.pointerId)},this._syncCanvasListeners()}_pickerDestroy(){this._canvas&&Object.entries(this._pointerHandlers).forEach(([e,t])=>{t&&this._canvas.removeEventListener(e,t)}),this._picker=null,this._hoveredEntity=null,this._pointerHandlers={pointermove:null,pointerdown:null,pointerup:null,pointercancel:null},this._downPicks.clear(),this._clickListened=!1,this._lastClick=null}_registerEntityElement(e,t){this._entityElements.set(e,t)}_unregisterEntityElement(e){this._entityElements.delete(e)}elementFromEntity(e){return this._entityElements.get(e)??null}_hoverTarget(e){for(;null!==e;){const t=this._entityElements.get(e);if(t&&ai.some(e=>t._hasListeners(e)))return t;e=e.parent}return null}_elementWithListener(e,t){for(;null!==e;){const i=this._entityElements.get(e);if(i?._hasListeners(t))return i;e=e.parent}return null}_getPickerCoordinates(e,t){const i=t.getBoundingClientRect();if(0===i.width||0===i.height)return{x:e.clientX,y:e.clientY,mapped:!1};const s=t.width/i.width,a=t.height/i.height;return{x:(e.clientX-i.left)*s,y:(e.clientY-i.top)*a,mapped:!0}}_cameraContains(e,t,i,s){const a=e.rect,n=a.x*s.width,o=(1-a.y)*s.height,r=o-a.w*s.height;return t>=n&&t<n+a.z*s.width&&i>=r&&i<o}async _pickNode(e){const t=this.app,i=this._picker,s=this._canvas;if(!t||!i||!s)return null;const{x:a,y:n,mapped:o}=this._getPickerCoordinates(e,s),r=t.systems.camera?.cameras??[];for(let e=r.length-1;e>=0;e--){const l=r.at(e);if(!l||l.renderTarget)continue;if(o&&!this._cameraContains(l,a,n,s))continue;i.prepare(l,t.scene);const c=await i.getSelectionAsync(a,n);if(!this._picker||!this.app)return null;if(c.length>0){const e=c[0];return e instanceof ue?e.node:e.entity}if(l.clearColorBuffer)return null}return null}async _onPointerMove(e){if(!this._picker||!this.app)return;const t=++this._pickToken,i=await this._pickNode(e);if(t!==this._pickToken||!this._picker)return;const s=this._hoverTarget(i);this._hoveredEntity!==s&&(this._hoveredEntity&&this._hoveredEntity._hasListeners("pointerleave")&&this._hoveredEntity.dispatchEvent(new PointerEvent("pointerleave",e)),s&&s._hasListeners("pointerenter")&&s.dispatchEvent(new PointerEvent("pointerenter",e))),this._hoveredEntity=s,s&&s._hasListeners("pointermove")&&s.dispatchEvent(new PointerEvent("pointermove",e))}async _onPointerDown(e){if(!this._picker||!this.app)return;const t=this._pickNode(e);this._clickListened&&0===e.button&&this._downPicks.set(e.pointerId,t);const i=await t;if(!this._picker)return;const s=this._elementWithListener(i,"pointerdown");s&&s.dispatchEvent(new PointerEvent("pointerdown",e))}async _onPointerUp(e){if(!this._picker||!this.app)return;const t=this._downPicks.get(e.pointerId);this._downPicks.delete(e.pointerId);const i=await this._pickNode(e);if(!this._picker)return;const s=this._elementWithListener(i,"pointerup");if(s&&s.dispatchEvent(new PointerEvent("pointerup",e)),!t||0!==e.button)return;const a=await t;if(!this._picker)return;const n=this._elementWithListener(((e,t)=>{const i=new Set;for(let t=e;null!==t;t=t.parent)i.add(t);for(let e=t;null!==e;e=e.parent)if(i.has(e))return e;return null})(a,i),"click");if(n){const t=new PointerEvent("click",e),i=performance.now(),s=this._lastClick,a=s&&s.element===n&&i-s.time<=500?s.count+1:1;this._lastClick={element:n,time:i,count:a},Object.defineProperty(t,"detail",{value:a}),n.dispatchEvent(t)}}_syncCanvasListeners(){const e=this._canvas;if(!e)return;const t=Array.from(this.querySelectorAll("pc-entity, pc-model, pc-node")),i=new Set;for(const e of Pt)t.some(t=>t._hasListeners(e))&&ni[e].forEach(e=>i.add(e));this._clickListened=t.some(e=>e._hasListeners("click")),Object.entries(this._pointerHandlers).forEach(([t,s])=>{s&&(i.has(t)?e.addEventListener(t,s):e.removeEventListener(t,s))})}_warnIfBooted(e){this._optionsLocked&&console.warn(`Attribute '${e}' on <pc-app> is only read when the application boots, so this change has no effect. Set it before the element is connected, or remove and re-insert the element to reboot with the new value.`)}set alpha(e){this._warnIfBooted("alpha"),this._alpha=e}get alpha(){return this._alpha}set antialias(e){this._warnIfBooted("antialias"),this._antialias=e}get antialias(){return this._antialias}set backend(e){this._warnIfBooted("backend"),this._backend=e}get backend(){return this._backend}set depthBuffer(e){this._warnIfBooted("depth-buffer"),this._depthBuffer=e}get depthBuffer(){return this._depthBuffer}set loadingBar(e){this._loadingBar=e,!e&&this._bar&&(this._bar.destroy(),this._bar=null)}get loadingBar(){return this._loadingBar}set maxPixelRatio(e){this._maxPixelRatio=e,this.app&&(this.app.graphicsDevice.maxPixelRatio=e,this._syncCanvasSize())}get maxPixelRatio(){return this._maxPixelRatio}set stencilBuffer(e){this._warnIfBooted("stencil-buffer"),this._stencilBuffer=e}get stencilBuffer(){return this._stencilBuffer}static get observedAttributes(){return["alpha","antialias","backend","depth-buffer","loading-bar","max-pixel-ratio","stencil-buffer"]}attributeChangedCallback(e,t,i){switch(e){case"alpha":this.alpha=Qt(i,!0);break;case"antialias":this.antialias=Qt(i,!0);break;case"backend":this.backend=Nt(i,["webgpu","webgl2","null"],"webgpu",e);break;case"depth-buffer":this.depthBuffer=Qt(i,!0);break;case"loading-bar":this.loadingBar=Qt(i,!0);break;case"max-pixel-ratio":this.maxPixelRatio=Jt(i,1/0,e);break;case"stencil-buffer":this.stencilBuffer=Qt(i,!0)}}}customElements.define("pc-app",oi);const ri=(e,t)=>{const i=Array.from(e.querySelectorAll("pc-entity, pc-model")).filter(e=>e instanceof li);i.forEach(e=>e._createEntity(t)),i.forEach(e=>e._buildHierarchy(t))};class li extends Wt{_enabled=!0;_name="Untitled";_position=new i;_rotation=new i;_scale=new i(1,1,1);_tags=[];_built=!1;_createEntity(e){if(this._entity)return;const t=new me(this._name,e);this._entity=t,t.enabled=this._enabled,t.setLocalPosition(this._position),t.setLocalEulerAngles(this._rotation),t.setLocalScale(this._scale),this._tags.length>0&&t.tags.add(this._tags),this._registerEntity(t),t.once("destroy",this._onEntityDestroy,this)}_onEntityDestroy(e){this._unregisterEntity(e),this._entity=null,this._built=!1,this._resetReady()}_buildHierarchy(e){if(!this.entity||this._built)return;const t=this.closestEntity;t&&!t.entity||t instanceof li&&!t._built||(this._built=!0,t?.entity?t.entity.addChild(this.entity):e.root.addChild(this.entity),this._onBuilt())}_onBuilt(){this._onReady()}set enabled(e){this._enabled=e,this.entity&&(this.entity.enabled=e)}get enabled(){return this._enabled}set name(e){this._name=e,this.entity&&(this.entity.name=e)}get name(){return this._name}set position(e){this._position=e,this.entity&&this.entity.setLocalPosition(this._position)}get position(){return this._position}set rotation(e){this._rotation=e,this.entity&&this.entity.setLocalEulerAngles(this._rotation)}get rotation(){return this._rotation}set scale(e){this._scale=e,this.entity&&this.entity.setLocalScale(this._scale)}get scale(){return this._scale}set tags(e){this._tags=e,this.entity&&(this.entity.tags.clear(),this.entity.tags.add(this._tags))}get tags(){return this._tags}}class ci extends li{connectedCallback(){const e=this.closestApp;if(!e){const e=this.getAttribute("name"),t=e?` '${e}'`:"";return void console.warn(`pc-entity${t} must be a descendant of pc-app - entity not created`)}if(e._hierarchyReady){const t=e.app;this._createEntity(t),this._buildHierarchy(t),this._built&&ri(this,t)}}disconnectedCallback(){this._entity?.destroy()}static get observedAttributes(){return["enabled","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"enabled":this.enabled=Qt(s,!0);break;case"name":this.name=s??"Untitled";break;case"position":this.position=ti(s,i.ZERO,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,i.ONE,e);break;case"tags":this.tags=Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-entity",ci);var hi=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,s=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(n(s),{}).then(function(e){(i=e.instance).exports.__wasm_call_ctors()});function n(e){for(var i=new Uint8Array(e.length),s=0;s<e.length;++s){var a=e.charCodeAt(s);i[s]=a>96?a-97:a>64?a-39:a+4}var n=0;for(s=0;s<e.length;++s)i[n++]=i[s]<60?t[i[s]]:64*(i[s]-60)+i[++s];return i.buffer.slice(0,n)}function o(e,t,s,a,n,o){var r=i.exports.sbrk,l=s+3&-4,c=r(l*a),h=r(n.length),p=new Uint8Array(i.exports.memory.buffer);p.set(n,h);var b=e(c,s,a,h,n.length);if(0==b&&o&&o(c,l,a),t.set(p.subarray(c,c+s*a)),r(c-r(0)),0!=b)throw new Error("Malformed buffer data: "+b)}var r={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}function b(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(n(s))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+d.toString(),i=new Blob([t],{type:"text/javascript"}),a=URL.createObjectURL(i),r=0;r<e;++r)c[r]=p(a);URL.revokeObjectURL(a)}function d(e){a.then(function(){var t=e.data;try{var s=new Uint8Array(t.count*t.size);o(i.exports[t.mode],s,t.count,t.size,t.source,i.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:s},[s.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:a,supported:!0,useWorkers:function(e){b(e)},decodeVertexBuffer:function(e,t,s,a,n){o(i.exports.meshopt_decodeVertexBuffer,e,t,s,a,i.exports[r[n]])},decodeIndexBuffer:function(e,t,s,a){o(i.exports.meshopt_decodeIndexBuffer,e,t,s,a)},decodeIndexSequence:function(e,t,s,a){o(i.exports.meshopt_decodeIndexSequence,e,t,s,a)},decodeGltfBuffer:function(e,t,s,a,n,c){o(i.exports[l[n]],e,t,s,a,i.exports[r[c]])},decodeGltfBufferAsync:function(e,t,s,n,p){return c.length>0?function(e,t,i,s,a){for(var n=c[0],o=1;o<c.length;++o)c[o].pending<n.pending&&(n=c[o]);return new Promise(function(o,r){var l=new Uint8Array(i),c=h++;n.pending+=e,n.requests[c]={resolve:o,reject:r},n.object.postMessage({id:c,count:e,size:t,source:l,mode:s,filter:a},[l.buffer])})}(e,t,s,l[n],r[p]):a.then(function(){var a=new Uint8Array(e*t);return o(i.exports[l[n]],a,e,t,s,i.exports[r[p]]),a})}}}();const pi=new Map([["simple",_e],["sliced",ke],["tiled",we]]),bi=new Map([["repeat",ye],["clamp",Me],["mirror",xe]]),di=new Map([["nearest",Se],["linear",ve],["nearest-mip-nearest",Ce],["linear-mip-nearest",Ae],["nearest-mip-linear",Fe],["linear-mip-linear",fe]]),ui=new Map([["nearest",Se],["linear",ve]]),mi=e=>e.replace(/-/g,"_"),gi={addressU:ye,addressV:ye,anisotropy:1,flipY:!1,magFilter:ve,minFilter:fe,mipmaps:!0,srgb:!1},_i=[[["address-u","address-v","anisotropy","flip-y","mag-filter","min-filter","mipmaps","srgb"],["texture","textureatlas"]],[["atlas","frame-keys","pixels-per-unit","render-mode"],["sprite"]]],fi=new Map([["bin","binary"],["css","css"],["frag","shader"],["glb","container"],["glsl","shader"],["gltf","container"],["hdr","texture"],["html","html"],["jpg","texture"],["js","script"],["json","json"],["ktx2","texture"],["mp3","audio"],["mjs","script"],["ply","gsplat"],["png","texture"],["sog","gsplat"],["txt","text"],["vert","shader"],["webp","texture"]]),vi=(e,t,i)=>{if(e.extensions&&e.extensions.EXT_meshopt_compression){const s=e.extensions.EXT_meshopt_compression;Promise.all([hi.ready,t[s.buffer]]).then(e=>{const t=e[1],a=s.byteOffset||0,n=s.byteLength||0,o=s.count,r=s.byteStride,l=new Uint8Array(o*r),c=new Uint8Array(t.buffer,t.byteOffset+a,n);hi.decodeGltfBuffer(l,o,r,c,s.mode,s.filter),i(null,l)})}else i(null,null)};class yi extends Ht{_addressU=null;_addressV=null;_anisotropy=null;_flipY=null;_lazy=!1;_magFilter=null;_minFilter=null;_mipmaps=null;_srgb=null;asset=null;async connectedCallback(){const e=this.closestApp;if(e)if(this.parentElement===e){if(await e.ready(),this.isConnected&&this.parentElement===e){if(!this.asset){const t=e.app;if(!t)return;this._createAsset(),this.asset&&(t.assets.add(this.asset),this.lazy||t.assets.load(this.asset))}this.asset&&this._onReady()}}else console.warn(`pc-asset '${this.getAttribute("id")??this.getAttribute("src")}' must be a direct child of pc-app - asset not created`)}disconnectedCallback(){this._destroyAsset(),this._resetReady()}_onAssetLoad(){this.dispatchEvent(new Event("load"))}_onAssetError(e){this.dispatchEvent(new ErrorEvent("error",{message:e instanceof Error?e.message:String(e)}))}_createAsset(){const e=this.getAttribute("id")||"",t=this.getAttribute("src")||"";let i=this.getAttribute("type");if(!i){const e=t.split(".").pop();i=fi.get(e||"")??null}if(!i)return void console.warn(`Unsupported asset type: ${t}`);const s=_i.filter(([,e])=>!e.includes(i)).flatMap(([e])=>e).filter(e=>this.hasAttribute(e));s.length>0&&console.warn(`pc-asset '${e||t}' has attributes that do not apply to asset type '${i}' and are ignored: ${s.join(", ")}`);const a=this._buildData(i);this.asset="container"===i?new ge(e,i,{url:t},void 0,{bufferView:{processAsync:vi.bind(this)}}):new ge(e,i,"sprite"===i?null:t?{url:t}:null,a),this.asset.preload=!this._lazy,this.asset.on("load",this._onAssetLoad,this),this.asset.on("error",this._onAssetError,this)}_buildData(e){let t;const i=this.getAttribute("data");if(i)try{t=JSON.parse(i)}catch(e){console.warn(`Invalid 'data' JSON on pc-asset: ${i}`)}if("texture"!==e&&"textureatlas"!==e||(t=t??{},null!==this._addressU&&(t.addressu=this._addressU),null!==this._addressV&&(t.addressv=this._addressV),null!==this._anisotropy&&(t.anisotropy=this._anisotropy),null!==this._flipY&&(t.flipY=this._flipY),null!==this._magFilter&&(t.magfilter=mi(this._magFilter)),null!==this._minFilter&&(t.minfilter=mi(this._minFilter)),null!==this._mipmaps&&(t.mipmaps=this._mipmaps),null!==this._srgb&&(t.srgb=this._srgb)),"sprite"===e){t=t??{};const e=this.getAttribute("atlas")??t.textureAtlasAsset;if("string"==typeof e){const i=yi.get(e);i?t.textureAtlasAsset=i.id:console.warn(`pc-asset sprite '${this.getAttribute("id")}' could not find atlas '${e}'`)}const i=this.getAttribute("frame-keys");null!==i&&(t.frameKeys=i.split(/[\s,]+/).filter(Boolean));const s=this.getAttribute("pixels-per-unit");null!==s&&(t.pixelsPerUnit=Jt(s,1,"pixels-per-unit"));const a=this.getAttribute("render-mode");null!==a&&(t.renderMode=pi.get(Nt(a,pi,"simple","render-mode"))),t.renderMode=t.renderMode??_e,t.pixelsPerUnit=t.pixelsPerUnit??1,t.frameKeys=t.frameKeys??[]}return t}_texture(){const e=this.asset;return e?.resource?"texture"===e.type?e.resource:"textureatlas"===e.type?e.resource.texture??null:null:null}_applyTextureOption(e,t,i,s){const a=this.asset;if(!a||"texture"!==a.type&&"textureatlas"!==a.type)return;const n=a.data;null===i?delete n[e]:n[e]=i;const o=this._texture();o&&(o[t]=s??gi[t])}_destroyAsset(){this.asset&&(this.asset.off("load",this._onAssetLoad,this),this.asset.off("error",this._onAssetError,this),this.asset.registry?.remove(this.asset),this.asset.unload(),this.asset=null)}set addressU(e){this._addressU=e;const t=null===e?null:bi.get(e)??ye;this._applyTextureOption("addressu","addressU",e,t)}get addressU(){return this._addressU}set addressV(e){this._addressV=e;const t=null===e?null:bi.get(e)??ye;this._applyTextureOption("addressv","addressV",e,t)}get addressV(){return this._addressV}set anisotropy(e){this._anisotropy=e,this._applyTextureOption("anisotropy","anisotropy",e,e)}get anisotropy(){return this._anisotropy}set flipY(e){this._flipY=e,this._applyTextureOption("flipY","flipY",e,e)}get flipY(){return this._flipY}set lazy(e){this._lazy=e,this.asset&&(this.asset.preload=!e,e||this.asset.registry?.load(this.asset))}get lazy(){return this._lazy}set magFilter(e){this._magFilter=e;const t=null===e?null:mi(e),i=null===e?null:ui.get(e)??ve;this._applyTextureOption("magfilter","magFilter",t,i)}get magFilter(){return this._magFilter}set minFilter(e){this._minFilter=e;const t=null===e?null:mi(e),i=null===e?null:di.get(e)??fe;this._applyTextureOption("minfilter","minFilter",t,i)}get minFilter(){return this._minFilter}set mipmaps(e){this._mipmaps=e,this._applyTextureOption("mipmaps","mipmaps",e,e)}get mipmaps(){return this._mipmaps}set srgb(e){this._srgb=e,this._applyTextureOption("srgb","srgb",e,e)}get srgb(){return this._srgb}static get(e){const t=document.querySelector(`pc-asset[id="${e}"]`);return t?.asset}static get observedAttributes(){return["address-u","address-v","anisotropy","flip-y","lazy","mag-filter","min-filter","mipmaps","srgb"]}attributeChangedCallback(e,t,i){switch(e){case"address-u":this.addressU=null!==i?Nt(i,bi,"repeat",e):null;break;case"address-v":this.addressV=null!==i?Nt(i,bi,"repeat",e):null;break;case"anisotropy":this.anisotropy=null!==i?Jt(i,1,e):null;break;case"flip-y":this.flipY=null!==i?Qt(i,!1):null;break;case"lazy":this.lazy=Qt(i,!1);break;case"mag-filter":this.magFilter=null!==i?Nt(i,ui,"linear",e):null;break;case"min-filter":this.minFilter=null!==i?Nt(i,di,"linear-mip-linear",e):null;break;case"mipmaps":this.mipmaps=null!==i?Qt(i,!0):null;break;case"srgb":this.srgb=null!==i?Qt(i,!1):null}}}customElements.define("pc-asset",yi);const ki=e=>{const t=yi.get(e);return t&&t.registry?.load(t),t},wi=(e,t)=>{const i=(t.get(e.name)??0)>1?` [${e.index}]`:"",s=e.components.length>0?` (${e.components.join(", ")})`:"",a=e.materials.length>0?` {${e.materials.map(e=>e.name??"null").join(", ")}}`:"";return`${e.name}${i}${s}${a}`};class Mi extends li{_asset="";_contentEntity=null;_loadGeneration=0;_loadHandle=null;_errorHandle=null;get contentEntity(){return this._contentEntity}hierarchy(){const e=this._contentEntity;if(!e)return null;const t=new Map,i=(e,s)=>{const a=t.get(e.name)??0;t.set(e.name,a+1);const n={name:e.name,path:s||e.name,index:a,components:Object.keys(e.c??{}).sort(),materials:(e.render?.meshInstances??[]).map((e,t)=>({index:t,name:e.material?.name??null})),children:e.children.map(e=>i(e,s?`${s}/${e.name}`:e.name))};return Object.defineProperty(n,"toString",{enumerable:!1,value:()=>((e,t)=>{const i=[wi(e,t)],s=(e,a)=>{e.children.forEach((n,o)=>{const r=o===e.children.length-1;i.push(`${a}${r?"└─ ":"├─ "}${wi(n,t)}`),s(n,`${a}${r?" ":"│ "}`)})};return s(e,""),i.join("\n")})(n,t)}),n};return i(e,"")}connectedCallback(){const e=this.closestApp;if(!e){const e=this._asset?` '${this._asset}'`:"";return void console.warn(`pc-model${e} must be a descendant of pc-app - model not created`)}if(e._hierarchyReady){const t=e.app;this._createEntity(t),this._buildHierarchy(t),this._built&&ri(this,t)}}disconnectedCallback(){this._loadGeneration++,this._detachLoadHandlers(),this._entity?.destroy()}_onBuilt(){this._loadContent()}_onEntityDestroy(e){this._loadGeneration++,this._detachLoadHandlers(),this._contentEntity=null,super._onEntityDestroy(e)}_detachLoadHandlers(){this._loadHandle?.off(),this._loadHandle=null,this._errorHandle?.off(),this._errorHandle=null}_announceLoad(){this._onReady(),this.dispatchEvent(new Event("load"))}_instantiate(e){const t=e.instantiateRenderEntity();this._contentEntity=t,this._entity.addChild(t),this._announceLoad()}_destroyContent(){this._contentEntity?.destroy(),this._contentEntity=null}async _loadContent(){this._destroyContent();const e=++this._loadGeneration;this._detachLoadHandlers(),this._resetReady();const t=this.closestApp;if(!t)return;if(await t.ready(),e!==this._loadGeneration)return;if(!this._entity||!this._built)return;if(""===this._asset)return void this._onReady();const i=ki(this._asset);i?i.loaded?this._instantiate(i.resource):(this._loadHandle=i.once("load",()=>{this._detachLoadHandlers(),e===this._loadGeneration&&this._instantiate(i.resource)}),this._errorHandle=i.once("error",t=>{this._detachLoadHandlers(),e===this._loadGeneration&&(this.dispatchEvent(new ErrorEvent("error",{message:t instanceof Error?t.message:String(t)})),this._onReady())})):console.warn(`pc-model could not find asset '${this._asset}' - model not created`)}set asset(e){this._asset=e,this.isConnected&&this._loadContent()}get asset(){return this._asset}static get observedAttributes(){return["asset","enabled","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"asset":this.asset=s??"";break;case"enabled":this.enabled=Qt(s,!0);break;case"name":this.name=s??"Untitled";break;case"position":this.position=ti(s,i.ZERO,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,i.ONE,e);break;case"tags":this.tags=Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-model",Mi);class xi extends Ht{_componentName;_enabled=!0;_component=null;_appElement=null;_hostElement=null;_hostReadyListener=null;_connectionGeneration=0;constructor(e){super(),this._componentName=e}getInitialComponentData(){return{}}_applyComponent(){const e=this._hostElement?.entity??null;if(this._component&&this._component.entity===e)return;const t=this._component;if(t?.entity&&t.entity.c[this._componentName]===t&&t.entity.removeComponent(this._componentName),this._component=null,e){if(e.c[this._componentName]){const t=this.id?` '${this.id}'`:"";return void console.warn(`${this.tagName.toLowerCase()}${t} - '${e.name}' already has a '${this._componentName}' component - component not added`)}this._component=e.addComponent(this._componentName,this.getInitialComponentData())}}async _addComponent(){const e=this._connectionGeneration,t=this.closestEntity;if(!t){const e=this.id?` '${this.id}'`:"";return void console.warn(`${this.tagName.toLowerCase()}${e} must be a descendant of pc-entity, pc-model or pc-node - component not added`)}await t.ready(),e===this._connectionGeneration&&(this._hostElement=t,this._applyComponent(),this._hostReadyListener=t=>{t.target===this._hostElement&&e===this._connectionGeneration&&this._hostCycled()},t.addEventListener("ready",this._hostReadyListener))}_hostCycled(){this._resetReady(),this._applyComponent(),this._hostElement?.entity&&(this.initComponent(),this._onReady())}initComponent(){}async connectedCallback(){const e=++this._connectionGeneration;this._appElement=this.closestApp??null,await(this._appElement?.ready()),e===this._connectionGeneration&&(await this._addComponent(),e===this._connectionGeneration&&(this.initComponent(),this._onReady()))}disconnectedCallback(){this._connectionGeneration++,this._hostElement&&this._hostReadyListener&&this._hostElement.removeEventListener("ready",this._hostReadyListener),this._hostElement=null,this._hostReadyListener=null,this._appElement?.app&&this._component?.entity&&this._component.entity.removeComponent(this._componentName),this._component=null,this._appElement=null,this._resetReady()}get component(){return this._component}set enabled(e){this._enabled=e,this.component&&(this.component.enabled=e)}get enabled(){return this._enabled}static get observedAttributes(){return["enabled"]}attributeChangedCallback(e,t,i){if("enabled"===e)this.enabled=Qt(i,!0)}}class Si extends xi{_activate=!0;_assignedClips=new Map;_autoAssigned=!1;_clip="";_managedRootBone=null;_modelListenerTarget=null;_sourceGeneration=0;_speed=1;_transitionTime=0;_warnedClip=null;_onModelReady=e=>{e.target instanceof Mi&&this.component&&e.target!==this._modelListenerTarget&&(this._applyRootBone(),this.component.rebind())};_skeletonSource(){const e=this.parentElement;if(e instanceof Mi)return e;const t=e?e.querySelectorAll(":scope > pc-model"):null;return 1===t?.length&&t[0]instanceof Mi?t[0]:null}_applyRootBone(){const e=this.component;if(null!==e.rootBone&&e.rootBone!==this._managedRootBone)return;const t=this._skeletonSource()?.entity??null;e.rootBone!==t&&(e.rootBone=t),this._managedRootBone=t}constructor(){super("anim")}getInitialComponentData(){return{activate:this._activate,speed:this._speed}}initComponent(){if(!this.component)return;const e=this.closestEntity;e&&e!==this._modelListenerTarget&&(this._modelListenerTarget?.removeEventListener("ready",this._onModelReady),e.addEventListener("ready",this._onModelReady),this._modelListenerTarget=e),this._applyRootBone(),this.component.baseLayer?this._refreshClips():this._applyClips()}disconnectedCallback(){this._modelListenerTarget?.removeEventListener("ready",this._onModelReady),this._modelListenerTarget=null,this._sourceGeneration++,this._assignedClips.clear(),this._autoAssigned=!1,this._managedRootBone=null,super.disconnectedCallback()}_clipElements(){return Array.from(this.querySelectorAll(":scope > pc-anim-clip"))}_assignClip(e){this.component.assignAnimation(e.name,e._track??Ee.EMPTY,void 0,e.speed,e.loop)}_adoptClip(e){const t=e.name;return t?-1!==t.indexOf(".")?(e._markInvalid(`pc-anim-clip '${t}' - '.' in a clip name is reserved for blend tree paths - clip not assigned`),!1):this._assignedClips.has(t)?(e._markInvalid(`pc-anim-clip '${t}' - an earlier clip already uses this name - clip not assigned`),!1):(this._assignedClips.set(t,e),this._assignClip(e),e._resolveTrack(this),!0):(e._markInvalid("pc-anim-clip must have a name - clip not assigned"),!1)}_applyClips(e){if(!this.component)return;this._sourceGeneration++,this._assignedClips.clear(),this._autoAssigned=!1;const t=this._clipElements();if(0!==t.length){for(const e of t)this._adoptClip(e);this._applySelection(e)}else this._kickAutoAssign(e)}async _kickAutoAssign(e){const t=this._sourceGeneration,i=this.parentElement;if(!(i instanceof Mi))return;await i.ready();const s=this.component;if(t!==this._sourceGeneration||!s||this._clipElements().length>0)return;const a=yi.get(i.asset)?.resource;if(!a)return;const n=this.id?` '${this.id}'`:"";if(0===a.animations.length)return void console.warn(`pc-anim${n} - model '${i.asset}' has no animations`);const o=new Set;for(const e of a.animations){const t=e.resource;t instanceof Ee&&(-1===t.name.indexOf(".")?o.has(t.name)?console.warn(`pc-anim${n} - duplicate track name '${t.name}' - track skipped`):(o.add(t.name),s.assignAnimation(t.name,t)):console.warn(`pc-anim${n} - track '${t.name}' - '.' in a clip name is reserved for blend tree paths - track skipped`))}this._autoAssigned=o.size>0,this._applySelection(e)}_applySelection(e){const t=this.component,i=t?t.baseLayer:null;if(!t||!i)return;this._clip&&!i.states.includes(this._clip)&&this._warnUnknownClip(this._clip);let s=null;this._clip&&i.states.includes(this._clip)?s=this._clip:e&&i.states.includes(e.state)&&(s=e.state),s&&i.activeState!==s&&i.play(s),e&&(s===e.state&&(i.activeStateCurrentTime=e.time),i.playing=e.layerPlaying,t.playing=e.playing)}_warnUnknownClip(e){if(this._warnedClip===e)return;this._warnedClip=e;const t=this.id?` '${this.id}'`:"";console.warn(`pc-anim${t} has no clip named '${e}' - selection unchanged`)}_refreshClips(){const e=this.component;if(!e)return;this._applyRootBone();const t=e.baseLayer,i=t?{state:t.activeState,time:t.activeStateCurrentTime,playing:e.playing,layerPlaying:t.playing}:void 0;e.removeStateGraph(),this._applyClips(i)}_registerClip(e){this.component&&(this._autoAssigned?this._refreshClips():this._assignedClips.get(e.name)!==e&&(this._sourceGeneration++,this._adoptClip(e)&&this._applySelection()))}_unregisterClip(e){this.component&&this._assignedClips.get(e.name)===e&&this._refreshClips()}_onClipResolved(e){const t=this.component;if(!t||this._assignedClips.get(e.name)!==e)return!1;this._assignClip(e);const i=t.baseLayer;return i&&i.activeState===e.name&&i.play(e.name),!0}_onClipParamsChanged(e){const t=this.component;if(!t||this._assignedClips.get(e.name)!==e)return;this._assignClip(e);const i=t.baseLayer;if(i&&i.activeState===e.name){const t=i.activeStateCurrentTime;i.play(e.name),i.activeStateCurrentTime=t}}play(e){const t=this.component,i=t?t.baseLayer:null;if(t&&i){if(void 0!==e){if(!i.states.includes(e))return;i.play(e)}else i.play();t.playing=!0}}pause(){this.component&&(this.component.playing=!1)}transition(e,t){const i=this.component,s=i?i.baseLayer:null;i&&s&&s.states.includes(e)&&(s.transition(e,Math.max(0,t??this._transitionTime)),s.playing=!0,i.playing=!0)}get component(){return super.component}get clips(){const e=this.component?this.component.baseLayer:null;return e?e.states.filter(e=>!Re.includes(e)):[]}set activate(e){this._activate=e,this.component&&(this.component.activate=e)}get activate(){return this._activate}set clip(e){this._clip=e;const t=this.component,i=t?t.baseLayer:null;t&&i&&e&&(i.states.includes(e)?i.activeState!==e&&(this._transitionTime>0?this.transition(e):this.play(e)):this._warnUnknownClip(e))}get clip(){return this._clip}set speed(e){this._speed=e,this.component&&(this.component.speed=e)}get speed(){return this._speed}set transitionTime(e){this._transitionTime=e}get transitionTime(){return this._transitionTime}static get observedAttributes(){return[...super.observedAttributes,"activate","clip","speed","transition-time"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"activate":this.activate=Qt(i,!0);break;case"clip":this.clip=i??"";break;case"speed":this.speed=Jt(i,1,e);break;case"transition-time":this.transitionTime=Jt(i,0,e)}}}customElements.define("pc-anim",Si);class Ci extends Ht{_animElement=null;_asset="";_connectionGeneration=0;_errorHandle=null;_loadGeneration=0;_loadHandle=null;_loop=!0;_name="";_speed=1;_warnedSource=null;_warnedInvalid=!1;_track=null;async connectedCallback(){const e=++this._connectionGeneration,t=this.animElement;await(t?.ready());const i=t?t.component:null;e===this._connectionGeneration&&t&&i&&(this._animElement=t,t._registerClip(this))}disconnectedCallback(){this._connectionGeneration++,this._loadGeneration++,this._detachLoadHandlers(),this._animElement?._unregisterClip(this),this._animElement=null,this._track=null,this._resetReady()}get animElement(){const e=this.parentElement;if(!(e instanceof Si)){const e=this._name?` '${this._name}'`:"";return console.warn(`pc-anim-clip${e} must be a direct child of a pc-anim element`),null}return e}_detachLoadHandlers(){this._loadHandle?.off(),this._loadHandle=null,this._errorHandle?.off(),this._errorHandle=null}_markInvalid(e){this._warnedInvalid||(this._warnedInvalid=!0,console.warn(e))}async _resolveTrack(e){this._animElement=e;const t=++this._loadGeneration;if(this._detachLoadHandlers(),this._asset){const e=ki(this._asset);return e?e.loaded?void this._extractTrack(e,`asset '${this._asset}'`):(this._loadHandle=e.once("load",()=>{this._detachLoadHandlers(),t===this._loadGeneration&&this._extractTrack(e,`asset '${this._asset}'`)}),void(this._errorHandle=e.once("error",()=>{this._detachLoadHandlers(),t===this._loadGeneration&&this._warnSource(`pc-anim-clip '${this._name}' - asset '${this._asset}' failed to load - clip not assigned`)}))):void this._warnSource(`pc-anim-clip '${this._name}' could not find asset '${this._asset}' - clip not assigned`)}const i=e.parentElement;if(!(i instanceof Mi))return void this._warnSource(`pc-anim-clip '${this._name}' has no asset and no enclosing pc-model - clip not assigned`);if(await i.ready(),t!==this._loadGeneration)return;const s=yi.get(i.asset);s?.resource&&this._extractTrack(s,`model '${i.asset}'`)}_warnSource(e){this._warnedSource!==this._asset&&(this._warnedSource=this._asset,console.warn(e))}_extractTrack(e,t){const i=`pc-anim-clip '${this._name}'`;let s;switch(e.type){case"container":s=e.resource.animations.map(e=>e.resource);break;case"animation":s=e.resources;break;case"animclip":s=[e.resource];break;default:return void this._warnSource(`${i} - ${t} has type '${e.type}', expected 'container', 'animation' or 'animclip' - clip not assigned`)}const a=s.filter(e=>e instanceof Ee);if(0===a.length)return void this._warnSource(`${i} - ${t} contains no usable animation track - clip not assigned`);let n=a.find(e=>e.name===this._name);n||(n=a[0],a.length>1&&console.warn(`${i} - no track named '${this._name}' in ${t} - using '${n.name}' (available: ${a.map(e=>e.name).join(", ")})`)),this._track=n,this._animElement?._onClipResolved(this)&&this._onReady()}set asset(e){this._asset=e,this._warnedSource=null,this._animElement&&(this._resetReady(),this._track=null,this._resolveTrack(this._animElement))}get asset(){return this._asset}set loop(e){this._loop=e,this._animElement?._onClipParamsChanged(this)}get loop(){return this._loop}set name(e){this._name=e,this._warnedInvalid=!1,this._animElement&&(this._resetReady(),this._animElement._refreshClips())}get name(){return this._name}set speed(e){this._speed=e,this._animElement?._onClipParamsChanged(this)}get speed(){return this._speed}static get observedAttributes(){return["asset","loop","name","speed"]}attributeChangedCallback(e,t,i){switch(e){case"asset":this.asset=i??"";break;case"loop":this.loop=Qt(i,!0);break;case"name":this.name=i??"";break;case"speed":this.speed=Jt(i,1,e)}}}customElements.define("pc-anim-clip",Ci);class Ai extends xi{constructor(){super("audiolistener")}get component(){return super.component}}customElements.define("pc-audio-listener",Ai);const Fi=new Map([["tint",je],["sprite",Oe]]);class Ei extends xi{_active=!0;_image="";_hitPadding=new a(0,0,0,0);_transitionMode="tint";_hoverTint=new s(1,1,1,1);_pressedTint=new s(1,1,1,1);_inactiveTint=new s(1,1,1,1);_fadeDuration=0;_hoverSpriteAsset="";_hoverSpriteFrame=0;_pressedSpriteAsset="";_pressedSpriteFrame=0;_inactiveSpriteAsset="";_inactiveSpriteFrame=0;constructor(){super("button")}getInitialComponentData(){const e={active:this._active,hitPadding:this._hitPadding,transitionMode:Fi.get(this._transitionMode),hoverTint:this._hoverTint,pressedTint:this._pressedTint,inactiveTint:this._inactiveTint,fadeDuration:this._fadeDuration,hoverSpriteFrame:this._hoverSpriteFrame,pressedSpriteFrame:this._pressedSpriteFrame,inactiveSpriteFrame:this._inactiveSpriteFrame},t=this._image?si(this._image):this.closestEntity?.entity;t&&(e.imageEntity=t);const i=ki(this._hoverSpriteAsset);i&&(e.hoverSpriteAsset=i.id);const s=ki(this._pressedSpriteAsset);s&&(e.pressedSpriteAsset=s.id);const a=ki(this._inactiveSpriteAsset);return a&&(e.inactiveSpriteAsset=a.id),e}get component(){return super.component}set active(e){this._active=e,this.component&&(this.component.active=e)}get active(){return this._active}set image(e){this._image=e;const t=si(e);this.component&&t&&(this.component.imageEntity=t)}get image(){return this._image}set hitPadding(e){this._hitPadding=e,this.component&&(this.component.hitPadding=e)}get hitPadding(){return this._hitPadding}set transitionMode(e){this._transitionMode=e,this.component&&(this.component.transitionMode=Fi.get(e)??je)}get transitionMode(){return this._transitionMode}set hoverTint(e){this._hoverTint=e,this.component&&(this.component.hoverTint=e)}get hoverTint(){return this._hoverTint}set pressedTint(e){this._pressedTint=e,this.component&&(this.component.pressedTint=e)}get pressedTint(){return this._pressedTint}set inactiveTint(e){this._inactiveTint=e,this.component&&(this.component.inactiveTint=e)}get inactiveTint(){return this._inactiveTint}set fadeDuration(e){this._fadeDuration=e,this.component&&(this.component.fadeDuration=e)}get fadeDuration(){return this._fadeDuration}set hoverSpriteAsset(e){this._hoverSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.hoverSpriteAsset=t.id)}get hoverSpriteAsset(){return this._hoverSpriteAsset}set hoverSpriteFrame(e){this._hoverSpriteFrame=e,this.component&&(this.component.hoverSpriteFrame=e)}get hoverSpriteFrame(){return this._hoverSpriteFrame}set pressedSpriteAsset(e){this._pressedSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.pressedSpriteAsset=t.id)}get pressedSpriteAsset(){return this._pressedSpriteAsset}set pressedSpriteFrame(e){this._pressedSpriteFrame=e,this.component&&(this.component.pressedSpriteFrame=e)}get pressedSpriteFrame(){return this._pressedSpriteFrame}set inactiveSpriteAsset(e){this._inactiveSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.inactiveSpriteAsset=t.id)}get inactiveSpriteAsset(){return this._inactiveSpriteAsset}set inactiveSpriteFrame(e){this._inactiveSpriteFrame=e,this.component&&(this.component.inactiveSpriteFrame=e)}get inactiveSpriteFrame(){return this._inactiveSpriteFrame}static get observedAttributes(){return[...super.observedAttributes,"active","image","hit-padding","transition-mode","hover-tint","pressed-tint","inactive-tint","fade-duration","hover-sprite-asset","hover-sprite-frame","pressed-sprite-asset","pressed-sprite-frame","inactive-sprite-asset","inactive-sprite-frame"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"active":this.active=Qt(i,!0);break;case"image":this.image=i??"";break;case"hit-padding":this.hitPadding=ii(i,a.ZERO,e);break;case"transition-mode":this.transitionMode=Nt(i,Fi,"tint",e);break;case"hover-tint":this.hoverTint=Xt(i,s.WHITE,e);break;case"pressed-tint":this.pressedTint=Xt(i,s.WHITE,e);break;case"inactive-tint":this.inactiveTint=Xt(i,s.WHITE,e);break;case"fade-duration":this.fadeDuration=Jt(i,0,e);break;case"hover-sprite-asset":this.hoverSpriteAsset=i??"";break;case"hover-sprite-frame":this.hoverSpriteFrame=Jt(i,0,e);break;case"pressed-sprite-asset":this.pressedSpriteAsset=i??"";break;case"pressed-sprite-frame":this.pressedSpriteFrame=Jt(i,0,e);break;case"inactive-sprite-asset":this.inactiveSpriteAsset=i??"";break;case"inactive-sprite-frame":this.inactiveSpriteFrame=Jt(i,0,e)}}}customElements.define("pc-button",Ei);const Ri=new Map([["perspective",ze],["orthographic",Ye]]),ji=new Map([["none",Le],["linear",Be],["filmic",Pe],["hejl",Ue],["aces",qe],["aces2",We],["neutral",$e]]);class Oi extends xi{_clearColor=new s(.75,.75,.75,1);_clearColorBuffer=!0;_clearDepth=1;_clearDepthBuffer=!0;_clearStencilBuffer=!0;_cullFaces=!0;_farClip=1e3;_flipFaces=!1;_fov=45;_frustumCulling=!0;_gamma="srgb";_horizontalFov=!1;_nearClip=.1;_projection="perspective";_orthoHeight=10;_priority=0;_rect=new a(0,0,1,1);_scissorRect=new a(0,0,1,1);_tonemap="none";constructor(){super("camera")}getInitialComponentData(){return{clearColor:this._clearColor,clearColorBuffer:this._clearColorBuffer,clearDepth:this._clearDepth,clearDepthBuffer:this._clearDepthBuffer,clearStencilBuffer:this._clearStencilBuffer,cullFaces:this._cullFaces,farClip:this._farClip,flipFaces:this._flipFaces,fov:this._fov,frustumCulling:this._frustumCulling,gammaCorrection:"srgb"===this._gamma?Te:De,horizontalFov:this._horizontalFov,nearClip:this._nearClip,projection:Ri.get(this._projection)??ze,orthoHeight:this._orthoHeight,priority:this._priority,rect:this._rect,scissorRect:this._scissorRect,toneMapping:ji.get(this._tonemap)??Le}}get arAvailable(){return this._available(He)}get vrAvailable(){return this._available(Ge)}_available(e){const t=this.component?.system.app.xr;return Boolean(t?.supported&&t.isAvailable(e))}startXr(e,t){this.component&&this._available(e)&&this.component.startXr(e,t,{callback:t=>{t&&console.error(`WebXR ${e} failed to start: ${t.message}`)}})}endXr(){this.component&&this.component.endXr()}get component(){return super.component}set clearColor(e){this._clearColor=e,this.component&&(this.component.clearColor=e)}get clearColor(){return this._clearColor}set clearColorBuffer(e){this._clearColorBuffer=e,this.component&&(this.component.clearColorBuffer=e)}get clearColorBuffer(){return this._clearColorBuffer}set clearDepth(e){this._clearDepth=e,this.component&&(this.component.clearDepth=e)}get clearDepth(){return this._clearDepth}set clearDepthBuffer(e){this._clearDepthBuffer=e,this.component&&(this.component.clearDepthBuffer=e)}get clearDepthBuffer(){return this._clearDepthBuffer}set clearStencilBuffer(e){this._clearStencilBuffer=e,this.component&&(this.component.clearStencilBuffer=e)}get clearStencilBuffer(){return this._clearStencilBuffer}set cullFaces(e){this._cullFaces=e,this.component&&(this.component.cullFaces=e)}get cullFaces(){return this._cullFaces}set farClip(e){this._farClip=e,this.component&&(this.component.farClip=e)}get farClip(){return this._farClip}set flipFaces(e){this._flipFaces=e,this.component&&(this.component.flipFaces=e)}get flipFaces(){return this._flipFaces}set fov(e){this._fov=e,this.component&&(this.component.fov=e)}get fov(){return this._fov}set frustumCulling(e){this._frustumCulling=e,this.component&&(this.component.frustumCulling=e)}get frustumCulling(){return this._frustumCulling}set gamma(e){this._gamma=e,this.component&&(this.component.gammaCorrection="srgb"===e?Te:De)}get gamma(){return this._gamma}set horizontalFov(e){this._horizontalFov=e,this.component&&(this.component.horizontalFov=e)}get horizontalFov(){return this._horizontalFov}set nearClip(e){this._nearClip=e,this.component&&(this.component.nearClip=e)}get nearClip(){return this._nearClip}set orthoHeight(e){this._orthoHeight=e,this.component&&(this.component.orthoHeight=e)}get orthoHeight(){return this._orthoHeight}set priority(e){this._priority=e,this.component&&(this.component.priority=e)}get priority(){return this._priority}set projection(e){this._projection=e,this.component&&(this.component.projection=Ri.get(e)??ze)}get projection(){return this._projection}set rect(e){this._rect=e,this.component&&(this.component.rect=e)}get rect(){return this._rect}set scissorRect(e){this._scissorRect=e,this.component&&(this.component.scissorRect=e)}get scissorRect(){return this._scissorRect}set tonemap(e){this._tonemap=e,this.component&&(this.component.toneMapping=ji.get(e)??Le)}get tonemap(){return this._tonemap}static get observedAttributes(){return[...super.observedAttributes,"clear-color","clear-color-buffer","clear-depth","clear-depth-buffer","clear-stencil-buffer","cull-faces","far-clip","flip-faces","fov","frustum-culling","gamma","horizontal-fov","near-clip","ortho-height","priority","projection","rect","scissor-rect","tonemap"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"clear-color":this.clearColor=Xt(i,new s(.75,.75,.75,1),e);break;case"clear-color-buffer":this.clearColorBuffer=Qt(i,!0);break;case"clear-depth":this.clearDepth=Jt(i,1,e);break;case"clear-depth-buffer":this.clearDepthBuffer=Qt(i,!0);break;case"clear-stencil-buffer":this.clearStencilBuffer=Qt(i,!0);break;case"cull-faces":this.cullFaces=Qt(i,!0);break;case"far-clip":this.farClip=Jt(i,1e3,e);break;case"flip-faces":this.flipFaces=Qt(i,!1);break;case"fov":this.fov=Jt(i,45,e);break;case"frustum-culling":this.frustumCulling=Qt(i,!0);break;case"gamma":this.gamma=Nt(i,["linear","srgb"],"srgb",e);break;case"horizontal-fov":this.horizontalFov=Qt(i,!1);break;case"near-clip":this.nearClip=Jt(i,.1,e);break;case"ortho-height":this.orthoHeight=Jt(i,10,e);break;case"priority":this.priority=Jt(i,0,e);break;case"projection":this.projection=Nt(i,Ri,"perspective",e);break;case"rect":this.rect=ii(i,new a(0,0,1,1),e);break;case"scissor-rect":this.scissorRect=ii(i,new a(0,0,1,1),e);break;case"tonemap":this.tonemap=Nt(i,ji,"none",e)}}}customElements.define("pc-camera",Oi);class Li extends xi{_angularOffset=new n;_axis=1;_convexHull=!1;_halfExtents=new i(.5,.5,.5);_height=2;_linearOffset=new i;_radius=.5;_type="box";constructor(){super("collision")}getInitialComponentData(){return{axis:this._axis,angularOffset:this._angularOffset,convexHull:this._convexHull,halfExtents:this._halfExtents,height:this._height,linearOffset:this._linearOffset,radius:this._radius,type:this._type}}initComponent(){this._applyMeshGeometryDefault()}_applyMeshGeometryDefault(){const e=this.component;if(!e||"mesh"!==this._type||null!==e.renderAsset)return;const t=e.entity.render?.asset??null;null!==t?e.renderAsset=t:console.warn(`pc-collision type="mesh" on '${e.entity.name}' found no asset-backed render component to take geometry from - collider has no shape`)}get component(){return super.component}set angularOffset(e){this._angularOffset=e,this.component&&(this.component.angularOffset=e)}get angularOffset(){return this._angularOffset}set axis(e){this._axis=e,this.component&&(this.component.axis=e)}get axis(){return this._axis}set convexHull(e){this._convexHull=e,this.component&&(this.component.convexHull=e)}get convexHull(){return this._convexHull}set halfExtents(e){this._halfExtents=e,this.component&&(this.component.halfExtents=e)}get halfExtents(){return this._halfExtents}set height(e){this._height=e,this.component&&(this.component.height=e)}get height(){return this._height}set linearOffset(e){this._linearOffset=e,this.component&&(this.component.linearOffset=e)}get linearOffset(){return this._linearOffset}set radius(e){this._radius=e,this.component&&(this.component.radius=e)}get radius(){return this._radius}set type(e){this._type=e,this.component&&(this.component.type=e,this._applyMeshGeometryDefault())}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-offset","axis","convex-hull","half-extents","height","linear-offset","radius","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-offset":this.angularOffset=Zt(s,n.IDENTITY,e);break;case"axis":this.axis=Jt(s,1,e);break;case"convex-hull":this.convexHull=Qt(s,!1);break;case"half-extents":this.halfExtents=ti(s,new i(.5,.5,.5),e);break;case"height":this.height=Jt(s,2,e);break;case"linear-offset":this.linearOffset=ti(s,i.ZERO,e);break;case"radius":this.radius=Jt(s,.5,e);break;case"type":this.type=Nt(s,["box","capsule","compound","cone","cylinder","mesh","sphere"],"box",e)}}}customElements.define("pc-collision",Li);class zi extends xi{_anchor=new a(.5,.5,.5,.5);_autoWidth=!0;_autoHeight=!0;_autoFitWidth=!1;_autoFitHeight=!1;_color=new s(1,1,1,1);_enableMarkup=!1;_fontAsset="";_fontSize=32;_maxFontSize=32;_minFontSize=8;_height=0;_lineHeight=32;_margin=null;_mask=!1;_opacity=1;_pivot=new o(.5,.5);_pixelsPerUnit=null;_spriteAsset="";_spriteFrame=0;_text="";_textureAsset="";_type="group";_useInput=!1;_width=0;_wrapLines=!1;constructor(){super("element")}initComponent(){const e=this.component;e&&(e._text?._material&&(e._text._material.useFog=!0),e._dirtifyMask?.())}getInitialComponentData(){const e={anchor:this._anchor,autoWidth:this._autoWidth,autoHeight:this._autoHeight,autoFitWidth:this._autoFitWidth,autoFitHeight:this._autoFitHeight,color:this._color,enableMarkup:this._enableMarkup,fontSize:this._fontSize,maxFontSize:this._maxFontSize,minFontSize:this._minFontSize,height:this._height,lineHeight:this._lineHeight,mask:this._mask,opacity:this._opacity,pivot:this._pivot,spriteFrame:this._spriteFrame,type:this._type,text:this._text,useInput:this._useInput,width:this._width,wrapLines:this._wrapLines},t=ki(this._fontAsset);t&&(e.fontAsset=t.id);const i=ki(this._spriteAsset);i&&(e.spriteAsset=i.id);const s=ki(this._textureAsset);return s&&(e.textureAsset=s.id),this._margin&&(e.margin=this._margin),null!==this._pixelsPerUnit&&(e.pixelsPerUnit=this._pixelsPerUnit),e}get component(){return super.component}set anchor(e){this._anchor=e,this.component&&(this.component.anchor=e)}get anchor(){return this._anchor}set autoWidth(e){this._autoWidth=e,this.component&&(this.component.autoWidth=e)}get autoWidth(){return this._autoWidth}set autoHeight(e){this._autoHeight=e,this.component&&(this.component.autoHeight=e)}get autoHeight(){return this._autoHeight}set color(e){this._color=e,this.component&&(this.component.color=e)}get color(){return this._color}set enableMarkup(e){this._enableMarkup=e,this.component&&(this.component.enableMarkup=e)}get enableMarkup(){return this._enableMarkup}set fontAsset(e){this._fontAsset=e;const t=ki(e);this.component&&t&&(this.component.fontAsset=t.id)}get fontAsset(){return this._fontAsset}set fontSize(e){this._fontSize=e,this.component&&(this.component.fontSize=e)}get fontSize(){return this._fontSize}set height(e){this._height=e,this.component&&(this.component.height=e)}get height(){return this._height}set lineHeight(e){this._lineHeight=e,this.component&&(this.component.lineHeight=e)}get lineHeight(){return this._lineHeight}set margin(e){this._margin=e,this.component&&e&&(this.component.margin=e)}get margin(){return this._margin}set mask(e){this._mask=e,this.component&&(this.component.mask=e)}get mask(){return this._mask}set opacity(e){this._opacity=e,this.component&&(this.component.opacity=e)}get opacity(){return this._opacity}set pivot(e){this._pivot=e,this.component&&(this.component.pivot=e)}get pivot(){return this._pivot}set pixelsPerUnit(e){this._pixelsPerUnit=e,this.component&&null!==e&&(this.component.pixelsPerUnit=e)}get pixelsPerUnit(){return this._pixelsPerUnit}set spriteAsset(e){this._spriteAsset=e;const t=ki(e);this.component&&t&&(this.component.spriteAsset=t.id)}get spriteAsset(){return this._spriteAsset}set spriteFrame(e){this._spriteFrame=e,this.component&&(this.component.spriteFrame=e)}get spriteFrame(){return this._spriteFrame}set text(e){this._text=e,this.component&&(this.component.text=e)}get text(){return this._text}set textureAsset(e){this._textureAsset=e;const t=ki(e);this.component&&t&&(this.component.textureAsset=t.id)}get textureAsset(){return this._textureAsset}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set useInput(e){this._useInput=e,this.component&&(this.component.useInput=e)}get useInput(){return this._useInput}set width(e){this._width=e,this.component&&(this.component.width=e)}get width(){return this._width}set wrapLines(e){this._wrapLines=e,this.component&&(this.component.wrapLines=e)}get wrapLines(){return this._wrapLines}set autoFitWidth(e){this._autoFitWidth=e,this.component&&(this.component.autoFitWidth=e)}get autoFitWidth(){return this._autoFitWidth}set autoFitHeight(e){this._autoFitHeight=e,this.component&&(this.component.autoFitHeight=e)}get autoFitHeight(){return this._autoFitHeight}set minFontSize(e){this._minFontSize=e,this.component&&(this.component.minFontSize=e)}get minFontSize(){return this._minFontSize}set maxFontSize(e){this._maxFontSize=e,this.component&&(this.component.maxFontSize=e)}get maxFontSize(){return this._maxFontSize}static get observedAttributes(){return[...super.observedAttributes,"anchor","auto-width","auto-height","auto-fit-width","auto-fit-height","color","enable-markup","font-asset","font-size","max-font-size","min-font-size","height","line-height","margin","mask","opacity","pivot","pixels-per-unit","sprite-asset","sprite-frame","text","texture-asset","type","use-input","width","wrap-lines"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"anchor":this.anchor=ii(i,new a(.5,.5,.5,.5),e);break;case"auto-width":this.autoWidth=Qt(i,!0);break;case"auto-height":this.autoHeight=Qt(i,!0);break;case"auto-fit-width":this.autoFitWidth=Qt(i,!1);break;case"auto-fit-height":this.autoFitHeight=Qt(i,!1);break;case"color":this.color=Xt(i,s.WHITE,e);break;case"enable-markup":this.enableMarkup=Qt(i,!1);break;case"font-asset":this.fontAsset=i??"";break;case"font-size":this.fontSize=Jt(i,32,e);break;case"max-font-size":this.maxFontSize=Jt(i,32,e);break;case"min-font-size":this.minFontSize=Jt(i,8,e);break;case"height":this.height=Jt(i,0,e);break;case"line-height":this.lineHeight=Jt(i,32,e);break;case"margin":this.margin=ii(i,null,e);break;case"mask":this.mask=Qt(i,!1);break;case"opacity":this.opacity=Jt(i,1,e);break;case"pivot":this.pivot=ei(i,new o(.5,.5),e);break;case"pixels-per-unit":this.pixelsPerUnit=Jt(i,null,e);break;case"sprite-asset":this.spriteAsset=i??"";break;case"sprite-frame":this.spriteFrame=Jt(i,0,e);break;case"text":this.text=i??"";break;case"texture-asset":this.textureAsset=i??"";break;case"type":this.type=Nt(i,["group","image","text"],"group",e);break;case"use-input":this.useInput=Qt(i,!1);break;case"width":this.width=Jt(i,0,e);break;case"wrap-lines":this.wrapLines=Qt(i,!1)}}}customElements.define("pc-element",zi);class Ti extends xi{_angularDamping=new i(1,1,1);_angularEquilibrium=new i;_angularLimitsX=new o;_angularLimitsY=new o;_angularLimitsZ=new o;_angularMotionX="locked";_angularMotionY="locked";_angularMotionZ="locked";_angularStiffness=new i;_breakImpulse=1/0;_enableCollision=!1;_enableLimits=!1;_entityA="";_entityB="";_limits=new o(-45,45);_linearDamping=new i(1,1,1);_linearEquilibrium=new i;_linearLimitsX=new o;_linearLimitsY=new o;_linearLimitsZ=new o;_linearMotionX="locked";_linearMotionY="locked";_linearMotionZ="locked";_linearStiffness=new i;_maxMotorForce=0;_motorSpeed=0;_swingLimitY=45;_swingLimitZ=45;_twistLimit=20;_type="fixed";constructor(){super("joint")}getInitialComponentData(){return{angularDamping:this._angularDamping,angularEquilibrium:this._angularEquilibrium,angularLimitsX:this._angularLimitsX,angularLimitsY:this._angularLimitsY,angularLimitsZ:this._angularLimitsZ,angularMotionX:this._angularMotionX,angularMotionY:this._angularMotionY,angularMotionZ:this._angularMotionZ,angularStiffness:this._angularStiffness,breakImpulse:this._breakImpulse,enableCollision:this._enableCollision,enableLimits:this._enableLimits,entityA:si(this._entityA),entityB:si(this._entityB),limits:this._limits,linearDamping:this._linearDamping,linearEquilibrium:this._linearEquilibrium,linearLimitsX:this._linearLimitsX,linearLimitsY:this._linearLimitsY,linearLimitsZ:this._linearLimitsZ,linearMotionX:this._linearMotionX,linearMotionY:this._linearMotionY,linearMotionZ:this._linearMotionZ,linearStiffness:this._linearStiffness,maxMotorForce:this._maxMotorForce,motorSpeed:this._motorSpeed,swingLimitY:this._swingLimitY,swingLimitZ:this._swingLimitZ,twistLimit:this._twistLimit,type:this._type}}_onBreak(){this.dispatchEvent(new CustomEvent("break",{bubbles:!0,composed:!0}))}initComponent(){const e=this.component;e&&(e.off("break",this._onBreak,this),e.on("break",this._onBreak,this))}get component(){return super.component}set angularDamping(e){this._angularDamping=e,this.component&&(this.component.angularDamping=e)}get angularDamping(){return this._angularDamping}set angularEquilibrium(e){this._angularEquilibrium=e,this.component&&(this.component.angularEquilibrium=e)}get angularEquilibrium(){return this._angularEquilibrium}set angularLimitsX(e){this._angularLimitsX=e,this.component&&(this.component.angularLimitsX=e)}get angularLimitsX(){return this._angularLimitsX}set angularLimitsY(e){this._angularLimitsY=e,this.component&&(this.component.angularLimitsY=e)}get angularLimitsY(){return this._angularLimitsY}set angularLimitsZ(e){this._angularLimitsZ=e,this.component&&(this.component.angularLimitsZ=e)}get angularLimitsZ(){return this._angularLimitsZ}set angularMotionX(e){this._angularMotionX=e,this.component&&(this.component.angularMotionX=e)}get angularMotionX(){return this._angularMotionX}set angularMotionY(e){this._angularMotionY=e,this.component&&(this.component.angularMotionY=e)}get angularMotionY(){return this._angularMotionY}set angularMotionZ(e){this._angularMotionZ=e,this.component&&(this.component.angularMotionZ=e)}get angularMotionZ(){return this._angularMotionZ}set angularStiffness(e){this._angularStiffness=e,this.component&&(this.component.angularStiffness=e)}get angularStiffness(){return this._angularStiffness}set breakImpulse(e){this._breakImpulse=e,this.component&&(this.component.breakImpulse=e)}get breakImpulse(){return this._breakImpulse}set enableCollision(e){this._enableCollision=e,this.component&&(this.component.enableCollision=e)}get enableCollision(){return this._enableCollision}set enableLimits(e){this._enableLimits=e,this.component&&(this.component.enableLimits=e)}get enableLimits(){return this._enableLimits}set entityA(e){this._entityA=e,this.component&&(this.component.entityA=si(e))}get entityA(){return this._entityA}set entityB(e){this._entityB=e,this.component&&(this.component.entityB=si(e))}get entityB(){return this._entityB}set limits(e){this._limits=e,this.component&&(this.component.limits=e)}get limits(){return this._limits}set linearDamping(e){this._linearDamping=e,this.component&&(this.component.linearDamping=e)}get linearDamping(){return this._linearDamping}set linearEquilibrium(e){this._linearEquilibrium=e,this.component&&(this.component.linearEquilibrium=e)}get linearEquilibrium(){return this._linearEquilibrium}set linearLimitsX(e){this._linearLimitsX=e,this.component&&(this.component.linearLimitsX=e)}get linearLimitsX(){return this._linearLimitsX}set linearLimitsY(e){this._linearLimitsY=e,this.component&&(this.component.linearLimitsY=e)}get linearLimitsY(){return this._linearLimitsY}set linearLimitsZ(e){this._linearLimitsZ=e,this.component&&(this.component.linearLimitsZ=e)}get linearLimitsZ(){return this._linearLimitsZ}set linearMotionX(e){this._linearMotionX=e,this.component&&(this.component.linearMotionX=e)}get linearMotionX(){return this._linearMotionX}set linearMotionY(e){this._linearMotionY=e,this.component&&(this.component.linearMotionY=e)}get linearMotionY(){return this._linearMotionY}set linearMotionZ(e){this._linearMotionZ=e,this.component&&(this.component.linearMotionZ=e)}get linearMotionZ(){return this._linearMotionZ}set linearStiffness(e){this._linearStiffness=e,this.component&&(this.component.linearStiffness=e)}get linearStiffness(){return this._linearStiffness}set maxMotorForce(e){this._maxMotorForce=e,this.component&&(this.component.maxMotorForce=e)}get maxMotorForce(){return this._maxMotorForce}set motorSpeed(e){this._motorSpeed=e,this.component&&(this.component.motorSpeed=e)}get motorSpeed(){return this._motorSpeed}set swingLimitY(e){this._swingLimitY=e,this.component&&(this.component.swingLimitY=e)}get swingLimitY(){return this._swingLimitY}set swingLimitZ(e){this._swingLimitZ=e,this.component&&(this.component.swingLimitZ=e)}get swingLimitZ(){return this._swingLimitZ}set twistLimit(e){this._twistLimit=e,this.component&&(this.component.twistLimit=e)}get twistLimit(){return this._twistLimit}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-damping","angular-equilibrium","angular-limits-x","angular-limits-y","angular-limits-z","angular-motion-x","angular-motion-y","angular-motion-z","angular-stiffness","break-impulse","enable-collision","enable-limits","entity-a","entity-b","limits","linear-damping","linear-equilibrium","linear-limits-x","linear-limits-y","linear-limits-z","linear-motion-x","linear-motion-y","linear-motion-z","linear-stiffness","max-motor-force","motor-speed","swing-limit-y","swing-limit-z","twist-limit","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-damping":this.angularDamping=ti(s,i.ONE,e);break;case"angular-equilibrium":this.angularEquilibrium=ti(s,i.ZERO,e);break;case"angular-limits-x":this.angularLimitsX=ei(s,o.ZERO,e);break;case"angular-limits-y":this.angularLimitsY=ei(s,o.ZERO,e);break;case"angular-limits-z":this.angularLimitsZ=ei(s,o.ZERO,e);break;case"angular-motion-x":this.angularMotionX=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-motion-y":this.angularMotionY=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-motion-z":this.angularMotionZ=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-stiffness":this.angularStiffness=ti(s,i.ZERO,e);break;case"break-impulse":this.breakImpulse=Jt(s,1/0,e);break;case"enable-collision":this.enableCollision=Qt(s,!1);break;case"enable-limits":this.enableLimits=Qt(s,!1);break;case"entity-a":this.entityA=s??"";break;case"entity-b":this.entityB=s??"";break;case"limits":this.limits=ei(s,new o(-45,45),e);break;case"linear-damping":this.linearDamping=ti(s,i.ONE,e);break;case"linear-equilibrium":this.linearEquilibrium=ti(s,i.ZERO,e);break;case"linear-limits-x":this.linearLimitsX=ei(s,o.ZERO,e);break;case"linear-limits-y":this.linearLimitsY=ei(s,o.ZERO,e);break;case"linear-limits-z":this.linearLimitsZ=ei(s,o.ZERO,e);break;case"linear-motion-x":this.linearMotionX=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-motion-y":this.linearMotionY=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-motion-z":this.linearMotionZ=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-stiffness":this.linearStiffness=ti(s,i.ZERO,e);break;case"max-motor-force":this.maxMotorForce=Jt(s,0,e);break;case"motor-speed":this.motorSpeed=Jt(s,0,e);break;case"swing-limit-y":this.swingLimitY=Jt(s,45,e);break;case"swing-limit-z":this.swingLimitZ=Jt(s,45,e);break;case"twist-limit":this.twistLimit=Jt(s,20,e);break;case"type":this.type=Nt(s,["fixed","ball","hinge","slider","6dof"],"fixed",e)}}}customElements.define("pc-joint",Ti);class Di extends xi{_minWidth=0;_minHeight=0;_maxWidth=null;_maxHeight=null;_fitWidthProportion=0;_fitHeightProportion=0;_excludeFromLayout=!1;constructor(){super("layoutchild")}getInitialComponentData(){return{minWidth:this._minWidth,minHeight:this._minHeight,maxWidth:this._maxWidth,maxHeight:this._maxHeight,fitWidthProportion:this._fitWidthProportion,fitHeightProportion:this._fitHeightProportion,excludeFromLayout:this._excludeFromLayout}}get component(){return super.component}set minWidth(e){this._minWidth=e,this.component&&(this.component.minWidth=e)}get minWidth(){return this._minWidth}set minHeight(e){this._minHeight=e,this.component&&(this.component.minHeight=e)}get minHeight(){return this._minHeight}set maxWidth(e){this._maxWidth=e,this.component&&(this.component.maxWidth=e)}get maxWidth(){return this._maxWidth}set maxHeight(e){this._maxHeight=e,this.component&&(this.component.maxHeight=e)}get maxHeight(){return this._maxHeight}set fitWidthProportion(e){this._fitWidthProportion=e,this.component&&(this.component.fitWidthProportion=e)}get fitWidthProportion(){return this._fitWidthProportion}set fitHeightProportion(e){this._fitHeightProportion=e,this.component&&(this.component.fitHeightProportion=e)}get fitHeightProportion(){return this._fitHeightProportion}set excludeFromLayout(e){this._excludeFromLayout=e,this.component&&(this.component.excludeFromLayout=e)}get excludeFromLayout(){return this._excludeFromLayout}static get observedAttributes(){return[...super.observedAttributes,"min-width","min-height","max-width","max-height","fit-width-proportion","fit-height-proportion","exclude-from-layout"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"min-width":this.minWidth=Jt(i,0,e);break;case"min-height":this.minHeight=Jt(i,0,e);break;case"max-width":this.maxWidth=Jt(i,null,e);break;case"max-height":this.maxHeight=Jt(i,null,e);break;case"fit-width-proportion":this.fitWidthProportion=Jt(i,0,e);break;case"fit-height-proportion":this.fitHeightProportion=Jt(i,0,e);break;case"exclude-from-layout":this.excludeFromLayout=Qt(i,!1)}}}customElements.define("pc-layout-child",Di);const Hi=new Map([["horizontal",Ie],["vertical",Je]]),Gi=new Map([["none",Ke],["stretch",Qe],["shrink",Xe],["both",Ne]]);class Bi extends xi{_orientation="horizontal";_reverseX=!1;_reverseY=!1;_alignment=new o(0,1);_padding=new a(0,0,0,0);_spacing=new o(0,0);_widthFitting="none";_heightFitting="none";_wrap=!1;constructor(){super("layoutgroup")}getInitialComponentData(){return{orientation:Hi.get(this._orientation),reverseX:this._reverseX,reverseY:this._reverseY,alignment:this._alignment,padding:this._padding,spacing:this._spacing,widthFitting:Gi.get(this._widthFitting),heightFitting:Gi.get(this._heightFitting),wrap:this._wrap}}get component(){return super.component}set orientation(e){this._orientation=e,this.component&&(this.component.orientation=Hi.get(e)??Ie)}get orientation(){return this._orientation}set reverseX(e){this._reverseX=e,this.component&&(this.component.reverseX=e)}get reverseX(){return this._reverseX}set reverseY(e){this._reverseY=e,this.component&&(this.component.reverseY=e)}get reverseY(){return this._reverseY}set alignment(e){this._alignment=e,this.component&&(this.component.alignment=e)}get alignment(){return this._alignment}set padding(e){this._padding=e,this.component&&(this.component.padding=e)}get padding(){return this._padding}set spacing(e){this._spacing=e,this.component&&(this.component.spacing=e)}get spacing(){return this._spacing}set widthFitting(e){this._widthFitting=e,this.component&&(this.component.widthFitting=Gi.get(e)??Ke)}get widthFitting(){return this._widthFitting}set heightFitting(e){this._heightFitting=e,this.component&&(this.component.heightFitting=Gi.get(e)??Ke)}get heightFitting(){return this._heightFitting}set wrap(e){this._wrap=e,this.component&&(this.component.wrap=e)}get wrap(){return this._wrap}static get observedAttributes(){return[...super.observedAttributes,"orientation","reverse-x","reverse-y","alignment","padding","spacing","width-fitting","height-fitting","wrap"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"orientation":this.orientation=Nt(i,Hi,"horizontal",e);break;case"reverse-x":this.reverseX=Qt(i,!1);break;case"reverse-y":this.reverseY=Qt(i,!1);break;case"alignment":this.alignment=ei(i,new o(0,1),e);break;case"padding":this.padding=ii(i,a.ZERO,e);break;case"spacing":this.spacing=ei(i,o.ZERO,e);break;case"width-fitting":this.widthFitting=Nt(i,Gi,"none",e);break;case"height-fitting":this.heightFitting=Nt(i,Gi,"none",e);break;case"wrap":this.wrap=Qt(i,!1)}}}customElements.define("pc-layout-group",Bi);const Pi=new Map([["pcf1-16f",Ve],["pcf1-32f",et],["pcf3-16f",tt],["pcf3-32f",Ze],["pcf5-16f",it],["pcf5-32f",st],["vsm-16f",at],["vsm-32f",nt],["pcss-32f",ot]]);class Ui extends xi{_cascadeBlend=0;_cascadeDistribution=.5;_castShadows=!1;_color=new s(1,1,1);_innerConeAngle=40;_intensity=1;_normalOffsetBias=0;_numCascades=1;_outerConeAngle=45;_range=10;_shadowBias=.05;_shadowDistance=40;_shadowIntensity=1;_shadowResolution=1024;_shadowType="pcf3-32f";_type="directional";_vsmBias=.0025;_vsmBlurSize=11;_penumbraSize=1;_penumbraFalloff=1;_shadowSamples=16;_shadowBlockerSamples=16;constructor(){super("light")}getInitialComponentData(){return{cascadeBlend:this._cascadeBlend,cascadeDistribution:this._cascadeDistribution,castShadows:this._castShadows,color:this._color,innerConeAngle:this._innerConeAngle,intensity:this._intensity,normalOffsetBias:this._normalOffsetBias,numCascades:this._numCascades,outerConeAngle:this._outerConeAngle,penumbraFalloff:this._penumbraFalloff,penumbraSize:this._penumbraSize,range:this._range,shadowBias:this._shadowBias,shadowBlockerSamples:this._shadowBlockerSamples,shadowDistance:this._shadowDistance,shadowIntensity:this._shadowIntensity,shadowResolution:this._shadowResolution,shadowSamples:this._shadowSamples,shadowType:Pi.get(this._shadowType)??Ze,type:this._type,vsmBias:this._vsmBias,vsmBlurSize:this._vsmBlurSize}}get component(){return super.component}set cascadeBlend(e){this._cascadeBlend=e,this.component&&(this.component.cascadeBlend=e)}get cascadeBlend(){return this._cascadeBlend}set cascadeDistribution(e){this._cascadeDistribution=e,this.component&&(this.component.cascadeDistribution=e)}get cascadeDistribution(){return this._cascadeDistribution}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set color(e){this._color=e,this.component&&(this.component.color=e)}get color(){return this._color}set innerConeAngle(e){this._innerConeAngle=e,this.component&&(this.component.innerConeAngle=e)}get innerConeAngle(){return this._innerConeAngle}set intensity(e){this._intensity=e,this.component&&(this.component.intensity=e)}get intensity(){return this._intensity}set normalOffsetBias(e){this._normalOffsetBias=e,this.component&&(this.component.normalOffsetBias=e)}get normalOffsetBias(){return this._normalOffsetBias}set numCascades(e){this._numCascades=e,this.component&&(this.component.numCascades=e)}get numCascades(){return this._numCascades}set outerConeAngle(e){this._outerConeAngle=e,this.component&&(this.component.outerConeAngle=e)}get outerConeAngle(){return this._outerConeAngle}set range(e){this._range=e,this.component&&(this.component.range=e)}get range(){return this._range}set shadowBias(e){this._shadowBias=e,this.component&&(this.component.shadowBias=e)}get shadowBias(){return this._shadowBias}set shadowDistance(e){this._shadowDistance=e,this.component&&(this.component.shadowDistance=e)}get shadowDistance(){return this._shadowDistance}set shadowIntensity(e){this._shadowIntensity=e,this.component&&(this.component.shadowIntensity=e)}get shadowIntensity(){return this._shadowIntensity}set shadowResolution(e){this._shadowResolution=e,this.component&&(this.component.shadowResolution=e)}get shadowResolution(){return this._shadowResolution}set shadowType(e){this._shadowType=e,this.component&&(this.component.shadowType=Pi.get(e)??Ze)}get shadowType(){return this._shadowType}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set vsmBias(e){this._vsmBias=e,this.component&&(this.component.vsmBias=e)}get vsmBias(){return this._vsmBias}set vsmBlurSize(e){this._vsmBlurSize=e,this.component&&(this.component.vsmBlurSize=e)}get vsmBlurSize(){return this._vsmBlurSize}set penumbraSize(e){this._penumbraSize=e,this.component&&(this.component.penumbraSize=e)}get penumbraSize(){return this._penumbraSize}set penumbraFalloff(e){this._penumbraFalloff=e,this.component&&(this.component.penumbraFalloff=e)}get penumbraFalloff(){return this._penumbraFalloff}set shadowSamples(e){this._shadowSamples=e,this.component&&(this.component.shadowSamples=e)}get shadowSamples(){return this._shadowSamples}set shadowBlockerSamples(e){this._shadowBlockerSamples=e,this.component&&(this.component.shadowBlockerSamples=e)}get shadowBlockerSamples(){return this._shadowBlockerSamples}static get observedAttributes(){return[...super.observedAttributes,"cascade-blend","cascade-distribution","cast-shadows","color","inner-cone-angle","intensity","normal-offset-bias","num-cascades","outer-cone-angle","penumbra-falloff","penumbra-size","range","shadow-bias","shadow-blocker-samples","shadow-distance","shadow-intensity","shadow-resolution","shadow-samples","shadow-type","type","vsm-bias","vsm-blur-size"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"cascade-blend":this.cascadeBlend=Jt(i,0,e);break;case"cascade-distribution":this.cascadeDistribution=Jt(i,.5,e);break;case"cast-shadows":this.castShadows=Qt(i,!1);break;case"color":this.color=Xt(i,s.WHITE,e);break;case"inner-cone-angle":this.innerConeAngle=Jt(i,40,e);break;case"intensity":this.intensity=Jt(i,1,e);break;case"normal-offset-bias":this.normalOffsetBias=Jt(i,0,e);break;case"num-cascades":this.numCascades=Jt(i,1,e);break;case"outer-cone-angle":this.outerConeAngle=Jt(i,45,e);break;case"penumbra-falloff":this.penumbraFalloff=Jt(i,1,e);break;case"penumbra-size":this.penumbraSize=Jt(i,1,e);break;case"range":this.range=Jt(i,10,e);break;case"shadow-bias":this.shadowBias=Jt(i,.05,e);break;case"shadow-blocker-samples":this.shadowBlockerSamples=Jt(i,16,e);break;case"shadow-distance":this.shadowDistance=Jt(i,40,e);break;case"shadow-intensity":this.shadowIntensity=Jt(i,1,e);break;case"shadow-resolution":this.shadowResolution=Jt(i,1024,e);break;case"shadow-samples":this.shadowSamples=Jt(i,16,e);break;case"shadow-type":this.shadowType=Nt(i,Pi,"pcf3-32f",e);break;case"type":this.type=Nt(i,["directional","omni","spot"],"directional",e);break;case"vsm-bias":this.vsmBias=Jt(i,.0025,e);break;case"vsm-blur-size":this.vsmBlurSize=Jt(i,11,e)}}}customElements.define("pc-light",Ui);class qi extends xi{_asset="";constructor(){super("particlesystem")}getInitialComponentData(){const e=ki(this._asset);if(!e||!e.resource)return{};if(e.resource.colorMapAsset){const t=e.resource.colorMapAsset,i=ki(t)?.id;i&&(e.resource.colorMapAsset=i)}return e.resource}get component(){return super.component}applyConfig(e){if(this.component)for(const t in e)Object.hasOwn(e,t)&&(this.component[t]=e[t])}async _loadAsset(){await(this.closestApp?.ready());const e=ki(this._asset);e&&(e.loaded?this.applyConfig(e.resource):e.once("load",()=>{this.applyConfig(e.resource)}))}set asset(e){this._asset=e,this.isConnected&&this._loadAsset()}get asset(){return this._asset}play(){this.component&&this.component.play()}pause(){this.component&&this.component.pause()}reset(){this.component&&this.component.reset()}stop(){this.component&&this.component.stop()}static get observedAttributes(){return[...super.observedAttributes,"asset"]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"asset"===e)this.asset=i??""}}customElements.define("pc-particle-system",qi);const Wi=new Map([["none",lt],["normal",bt],["additive",dt],["additive-alpha",ut],["premultiplied",mt],["multiplicative",gt],["multiplicative-2x",_t],["screen",ft],["min",vt],["max",yt],["subtractive",kt]]),$i=new Map([["none",wt],["back",ct],["front",Mt],["front-and-back",xt]]),Yi=new Map([["none",St],["schlick",ht]]),Ii=new Map([["none",Ct],["ao",pt],["gloss-dependent",At]]),Ki=["none","bayer8","bluenoise","ignnoise"],Qi=["r","g","b","a","rgb"],Xi=["r","g","b","a"],Ni=["gloss","gloss-invert","gloss-map"],Ji=["roughness","roughness-map"];class Zi extends HTMLElement{_alphaTest=0;_alphaToCoverage=!1;_aoIntensity=1;_aoMap="";_aoMapChannel="g";_aoMapOffset=new o(0,0);_aoMapRotation=0;_aoMapTiling=new o(1,1);_aoMapUv=0;_blendType="none";_bumpiness=1;_cull="back";_depthBias=0;_depthTest=!0;_depthWrite=!0;_diffuse=new s(1,1,1);_diffuseMap="";_diffuseMapChannel="rgb";_diffuseMapOffset=new o(0,0);_diffuseMapRotation=0;_diffuseMapTiling=new o(1,1);_diffuseMapUv=0;_emissive=new s(0,0,0);_emissiveIntensity=1;_emissiveMap="";_emissiveMapChannel="rgb";_emissiveMapOffset=new o(0,0);_emissiveMapRotation=0;_emissiveMapTiling=new o(1,1);_emissiveMapUv=0;_enableGGXSpecular=!1;_fresnelModel="schlick";_gloss=.25;_glossInvert=!1;_glossMap="";_glossMapChannel="g";_glossMapOffset=new o(0,0);_glossMapRotation=0;_glossMapTiling=new o(1,1);_glossMapUv=0;_heightMap="";_heightMapChannel="g";_heightMapFactor=1;_heightMapOffset=new o(0,0);_heightMapRotation=0;_heightMapTiling=new o(1,1);_heightMapUv=0;_metalness=0;_metalnessMap="";_metalnessMapChannel="g";_metalnessMapOffset=new o(0,0);_metalnessMapRotation=0;_metalnessMapTiling=new o(1,1);_metalnessMapUv=0;_name="Untitled";_normalMap="";_normalMapOffset=new o(0,0);_normalMapRotation=0;_normalMapTiling=new o(1,1);_normalMapUv=0;_occludeDirect=!1;_occludeSpecular="ao";_opacity=1;_opacityDither="none";_opacityFadesSpecular=!0;_opacityMap="";_opacityMapChannel="a";_opacityMapOffset=new o(0,0);_opacityMapRotation=0;_opacityMapTiling=new o(1,1);_opacityMapUv=0;_slopeDepthBias=0;_specular=new s(0,0,0);_specularityFactor=1;_twoSidedLighting=!1;_useFog=!0;_useLighting=!0;_useMetalness=!0;_useMetalnessSpecularColor=!1;_useSkybox=!0;_useTonemap=!0;_mapHandles=new Map;_updateScheduled=!1;_glossConflictWarned=!1;material=null;async connectedCallback(){const e=this.parentElement?.closest("pc-app")??null;if(e&&this.parentElement===e){if(await e.ready(),this.isConnected&&this.parentElement===e&&!this.material){if(!e.app)return;this._createMaterial()}}else console.warn(`pc-material '${this.id}' must be a direct child of pc-app - material not created`)}_createMaterial(){const e=new rt;this.material=e,e.alphaTest=this._alphaTest,e.alphaToCoverage=this._alphaToCoverage,e.aoIntensity=this._aoIntensity,e.aoMapChannel=this._aoMapChannel,e.aoMapOffset=this._aoMapOffset,e.aoMapRotation=this._aoMapRotation,e.aoMapTiling=this._aoMapTiling,e.aoMapUv=this._aoMapUv,e.blendType=Wi.get(this._blendType)??lt,e.bumpiness=this._bumpiness,e.cull=$i.get(this._cull)??ct,e.depthBias=this._depthBias,e.depthTest=this._depthTest,e.depthWrite=this._depthWrite,e.diffuse=this._diffuse,e.diffuseMapChannel=this._diffuseMapChannel,e.diffuseMapOffset=this._diffuseMapOffset,e.diffuseMapRotation=this._diffuseMapRotation,e.diffuseMapTiling=this._diffuseMapTiling,e.diffuseMapUv=this._diffuseMapUv,e.emissive=this._emissive,e.emissiveIntensity=this._emissiveIntensity,e.emissiveMapChannel=this._emissiveMapChannel,e.emissiveMapOffset=this._emissiveMapOffset,e.emissiveMapRotation=this._emissiveMapRotation,e.emissiveMapTiling=this._emissiveMapTiling,e.emissiveMapUv=this._emissiveMapUv,e.enableGGXSpecular=this._enableGGXSpecular,e.fresnelModel=Yi.get(this._fresnelModel)??ht,e.gloss=this._gloss,e.glossInvert=this._glossInvert,e.glossMapChannel=this._glossMapChannel,e.glossMapOffset=this._glossMapOffset,e.glossMapRotation=this._glossMapRotation,e.glossMapTiling=this._glossMapTiling,e.glossMapUv=this._glossMapUv,e.heightMapChannel=this._heightMapChannel,e.heightMapFactor=this._heightMapFactor,e.heightMapOffset=this._heightMapOffset,e.heightMapRotation=this._heightMapRotation,e.heightMapTiling=this._heightMapTiling,e.heightMapUv=this._heightMapUv,e.metalness=this._metalness,e.metalnessMapChannel=this._metalnessMapChannel,e.metalnessMapOffset=this._metalnessMapOffset,e.metalnessMapRotation=this._metalnessMapRotation,e.metalnessMapTiling=this._metalnessMapTiling,e.metalnessMapUv=this._metalnessMapUv,e.name=this._name,e.normalMapOffset=this._normalMapOffset,e.normalMapRotation=this._normalMapRotation,e.normalMapTiling=this._normalMapTiling,e.normalMapUv=this._normalMapUv,e.occludeDirect=this._occludeDirect,e.occludeSpecular=Ii.get(this._occludeSpecular)??pt,e.opacity=this._opacity,e.opacityDither=this._opacityDither,e.opacityFadesSpecular=this._opacityFadesSpecular,e.opacityMapChannel=this._opacityMapChannel,e.opacityMapOffset=this._opacityMapOffset,e.opacityMapRotation=this._opacityMapRotation,e.opacityMapTiling=this._opacityMapTiling,e.opacityMapUv=this._opacityMapUv,e.slopeDepthBias=this._slopeDepthBias,e.specular=this._specular,e.specularityFactor=this._specularityFactor,e.twoSidedLighting=this._twoSidedLighting,e.useFog=this._useFog,e.useLighting=this._useLighting,e.useMetalness=this._useMetalness,e.useMetalnessSpecularColor=this._useMetalnessSpecularColor,e.useSkybox=this._useSkybox,e.useTonemap=this._useTonemap,this.aoMap=this._aoMap,this.diffuseMap=this._diffuseMap,this.emissiveMap=this._emissiveMap,this.glossMap=this._glossMap,this.heightMap=this._heightMap,this.metalnessMap=this._metalnessMap,this.normalMap=this._normalMap,this.opacityMap=this._opacityMap,e.update()}disconnectedCallback(){for(const e of this._mapHandles.values())e.off();this._mapHandles.clear(),this.material&&(this.material.destroy(),this.material=null)}_scheduleUpdate(){this._updateScheduled||(this._updateScheduled=!0,queueMicrotask(()=>{this._updateScheduled=!1,this.material?.update()}))}_warnGlossConflict(){const e=e=>`'${e.join("', '")}'`,t=Ji.filter(e=>this.hasAttribute(e)),i=Ni.filter(e=>this.hasAttribute(e));0!==t.length&&0!==i.length?this._glossConflictWarned||(this._glossConflictWarned=!0,console.warn(`pc-material '${this.id}' sets both ${e(t)} and ${e(i)} - the roughness-* attributes invert gloss, so the two families contradict each other. Use one or the other.`)):this._glossConflictWarned=!1}_setMap(e,t){if(this._mapHandles.get(t)?.off(),this._mapHandles.delete(t),!this.material)return;if(!e)return this.material[t]=null,void this._scheduleUpdate();const i=ki(e);i&&(i.loaded?this._applyMap(t,i.resource):this._mapHandles.set(t,i.once("load",()=>{this._mapHandles.delete(t),this._applyMap(t,i.resource)})))}_applyMap(e,t){this.material&&(this.material[e]=t,this._scheduleUpdate())}set alphaTest(e){this._alphaTest=e,this.material&&(this.material.alphaTest=e,this._scheduleUpdate())}get alphaTest(){return this._alphaTest}set alphaToCoverage(e){this._alphaToCoverage=e,this.material&&(this.material.alphaToCoverage=e,this._scheduleUpdate())}get alphaToCoverage(){return this._alphaToCoverage}set aoIntensity(e){this._aoIntensity=e,this.material&&(this.material.aoIntensity=e,this._scheduleUpdate())}get aoIntensity(){return this._aoIntensity}set aoMap(e){this._aoMap=e,this._setMap(e,"aoMap")}get aoMap(){return this._aoMap}set aoMapChannel(e){this._aoMapChannel=e,this.material&&(this.material.aoMapChannel=e,this._scheduleUpdate())}get aoMapChannel(){return this._aoMapChannel}set aoMapOffset(e){this._aoMapOffset=e,this.material&&(this.material.aoMapOffset=e,this._scheduleUpdate())}get aoMapOffset(){return this._aoMapOffset}set aoMapRotation(e){this._aoMapRotation=e,this.material&&(this.material.aoMapRotation=e,this._scheduleUpdate())}get aoMapRotation(){return this._aoMapRotation}set aoMapTiling(e){this._aoMapTiling=e,this.material&&(this.material.aoMapTiling=e,this._scheduleUpdate())}get aoMapTiling(){return this._aoMapTiling}set aoMapUv(e){this._aoMapUv=e,this.material&&(this.material.aoMapUv=e,this._scheduleUpdate())}get aoMapUv(){return this._aoMapUv}set blendType(e){this._blendType=e,this.material&&(this.material.blendType=Wi.get(e)??lt,this._scheduleUpdate())}get blendType(){return this._blendType}set bumpiness(e){this._bumpiness=e,this.material&&(this.material.bumpiness=e,this._scheduleUpdate())}get bumpiness(){return this._bumpiness}set cull(e){this._cull=e,this.material&&(this.material.cull=$i.get(e)??ct,this._scheduleUpdate())}get cull(){return this._cull}set depthBias(e){this._depthBias=e,this.material&&(this.material.depthBias=e,this._scheduleUpdate())}get depthBias(){return this._depthBias}set depthTest(e){this._depthTest=e,this.material&&(this.material.depthTest=e,this._scheduleUpdate())}get depthTest(){return this._depthTest}set depthWrite(e){this._depthWrite=e,this.material&&(this.material.depthWrite=e,this._scheduleUpdate())}get depthWrite(){return this._depthWrite}set diffuse(e){this._diffuse=e,this.material&&(this.material.diffuse=e,this._scheduleUpdate())}get diffuse(){return this._diffuse}set diffuseMap(e){this._diffuseMap=e,this._setMap(e,"diffuseMap")}get diffuseMap(){return this._diffuseMap}set diffuseMapChannel(e){this._diffuseMapChannel=e,this.material&&(this.material.diffuseMapChannel=e,this._scheduleUpdate())}get diffuseMapChannel(){return this._diffuseMapChannel}set diffuseMapOffset(e){this._diffuseMapOffset=e,this.material&&(this.material.diffuseMapOffset=e,this._scheduleUpdate())}get diffuseMapOffset(){return this._diffuseMapOffset}set diffuseMapRotation(e){this._diffuseMapRotation=e,this.material&&(this.material.diffuseMapRotation=e,this._scheduleUpdate())}get diffuseMapRotation(){return this._diffuseMapRotation}set diffuseMapTiling(e){this._diffuseMapTiling=e,this.material&&(this.material.diffuseMapTiling=e,this._scheduleUpdate())}get diffuseMapTiling(){return this._diffuseMapTiling}set diffuseMapUv(e){this._diffuseMapUv=e,this.material&&(this.material.diffuseMapUv=e,this._scheduleUpdate())}get diffuseMapUv(){return this._diffuseMapUv}set emissive(e){this._emissive=e,this.material&&(this.material.emissive=e,this._scheduleUpdate())}get emissive(){return this._emissive}set emissiveIntensity(e){this._emissiveIntensity=e,this.material&&(this.material.emissiveIntensity=e,this._scheduleUpdate())}get emissiveIntensity(){return this._emissiveIntensity}set emissiveMap(e){this._emissiveMap=e,this._setMap(e,"emissiveMap")}get emissiveMap(){return this._emissiveMap}set emissiveMapChannel(e){this._emissiveMapChannel=e,this.material&&(this.material.emissiveMapChannel=e,this._scheduleUpdate())}get emissiveMapChannel(){return this._emissiveMapChannel}set emissiveMapOffset(e){this._emissiveMapOffset=e,this.material&&(this.material.emissiveMapOffset=e,this._scheduleUpdate())}get emissiveMapOffset(){return this._emissiveMapOffset}set emissiveMapRotation(e){this._emissiveMapRotation=e,this.material&&(this.material.emissiveMapRotation=e,this._scheduleUpdate())}get emissiveMapRotation(){return this._emissiveMapRotation}set emissiveMapTiling(e){this._emissiveMapTiling=e,this.material&&(this.material.emissiveMapTiling=e,this._scheduleUpdate())}get emissiveMapTiling(){return this._emissiveMapTiling}set emissiveMapUv(e){this._emissiveMapUv=e,this.material&&(this.material.emissiveMapUv=e,this._scheduleUpdate())}get emissiveMapUv(){return this._emissiveMapUv}set enableGGXSpecular(e){this._enableGGXSpecular=e,this.material&&(this.material.enableGGXSpecular=e,this._scheduleUpdate())}get enableGGXSpecular(){return this._enableGGXSpecular}set fresnelModel(e){this._fresnelModel=e,this.material&&(this.material.fresnelModel=Yi.get(e)??ht,this._scheduleUpdate())}get fresnelModel(){return this._fresnelModel}set gloss(e){this._gloss=e,this.material&&(this.material.gloss=e,this._scheduleUpdate())}get gloss(){return this._gloss}set glossInvert(e){this._glossInvert=e,this.material&&(this.material.glossInvert=e,this._scheduleUpdate())}get glossInvert(){return this._glossInvert}set glossMap(e){this._glossMap=e,this._setMap(e,"glossMap")}get glossMap(){return this._glossMap}set glossMapChannel(e){this._glossMapChannel=e,this.material&&(this.material.glossMapChannel=e,this._scheduleUpdate())}get glossMapChannel(){return this._glossMapChannel}set glossMapOffset(e){this._glossMapOffset=e,this.material&&(this.material.glossMapOffset=e,this._scheduleUpdate())}get glossMapOffset(){return this._glossMapOffset}set glossMapRotation(e){this._glossMapRotation=e,this.material&&(this.material.glossMapRotation=e,this._scheduleUpdate())}get glossMapRotation(){return this._glossMapRotation}set glossMapTiling(e){this._glossMapTiling=e,this.material&&(this.material.glossMapTiling=e,this._scheduleUpdate())}get glossMapTiling(){return this._glossMapTiling}set glossMapUv(e){this._glossMapUv=e,this.material&&(this.material.glossMapUv=e,this._scheduleUpdate())}get glossMapUv(){return this._glossMapUv}set heightMap(e){this._heightMap=e,this._setMap(e,"heightMap")}get heightMap(){return this._heightMap}set heightMapChannel(e){this._heightMapChannel=e,this.material&&(this.material.heightMapChannel=e,this._scheduleUpdate())}get heightMapChannel(){return this._heightMapChannel}set heightMapFactor(e){this._heightMapFactor=e,this.material&&(this.material.heightMapFactor=e,this._scheduleUpdate())}get heightMapFactor(){return this._heightMapFactor}set heightMapOffset(e){this._heightMapOffset=e,this.material&&(this.material.heightMapOffset=e,this._scheduleUpdate())}get heightMapOffset(){return this._heightMapOffset}set heightMapRotation(e){this._heightMapRotation=e,this.material&&(this.material.heightMapRotation=e,this._scheduleUpdate())}get heightMapRotation(){return this._heightMapRotation}set heightMapTiling(e){this._heightMapTiling=e,this.material&&(this.material.heightMapTiling=e,this._scheduleUpdate())}get heightMapTiling(){return this._heightMapTiling}set heightMapUv(e){this._heightMapUv=e,this.material&&(this.material.heightMapUv=e,this._scheduleUpdate())}get heightMapUv(){return this._heightMapUv}set metalness(e){this._metalness=e,this.material&&(this.material.metalness=e,this._scheduleUpdate())}get metalness(){return this._metalness}set metalnessMap(e){this._metalnessMap=e,this._setMap(e,"metalnessMap")}get metalnessMap(){return this._metalnessMap}set metalnessMapChannel(e){this._metalnessMapChannel=e,this.material&&(this.material.metalnessMapChannel=e,this._scheduleUpdate())}get metalnessMapChannel(){return this._metalnessMapChannel}set metalnessMapOffset(e){this._metalnessMapOffset=e,this.material&&(this.material.metalnessMapOffset=e,this._scheduleUpdate())}get metalnessMapOffset(){return this._metalnessMapOffset}set metalnessMapRotation(e){this._metalnessMapRotation=e,this.material&&(this.material.metalnessMapRotation=e,this._scheduleUpdate())}get metalnessMapRotation(){return this._metalnessMapRotation}set metalnessMapTiling(e){this._metalnessMapTiling=e,this.material&&(this.material.metalnessMapTiling=e,this._scheduleUpdate())}get metalnessMapTiling(){return this._metalnessMapTiling}set metalnessMapUv(e){this._metalnessMapUv=e,this.material&&(this.material.metalnessMapUv=e,this._scheduleUpdate())}get metalnessMapUv(){return this._metalnessMapUv}set name(e){this._name=e,this.material&&(this.material.name=e)}get name(){return this._name}set normalMap(e){this._normalMap=e,this._setMap(e,"normalMap")}get normalMap(){return this._normalMap}set normalMapOffset(e){this._normalMapOffset=e,this.material&&(this.material.normalMapOffset=e,this._scheduleUpdate())}get normalMapOffset(){return this._normalMapOffset}set normalMapRotation(e){this._normalMapRotation=e,this.material&&(this.material.normalMapRotation=e,this._scheduleUpdate())}get normalMapRotation(){return this._normalMapRotation}set normalMapTiling(e){this._normalMapTiling=e,this.material&&(this.material.normalMapTiling=e,this._scheduleUpdate())}get normalMapTiling(){return this._normalMapTiling}set normalMapUv(e){this._normalMapUv=e,this.material&&(this.material.normalMapUv=e,this._scheduleUpdate())}get normalMapUv(){return this._normalMapUv}set occludeDirect(e){this._occludeDirect=e,this.material&&(this.material.occludeDirect=e,this._scheduleUpdate())}get occludeDirect(){return this._occludeDirect}set occludeSpecular(e){this._occludeSpecular=e,this.material&&(this.material.occludeSpecular=Ii.get(e)??pt,this._scheduleUpdate())}get occludeSpecular(){return this._occludeSpecular}set opacity(e){this._opacity=e,this.material&&(this.material.opacity=e,this._scheduleUpdate())}get opacity(){return this._opacity}set opacityDither(e){this._opacityDither=e,this.material&&(this.material.opacityDither=e,this._scheduleUpdate())}get opacityDither(){return this._opacityDither}set opacityFadesSpecular(e){this._opacityFadesSpecular=e,this.material&&(this.material.opacityFadesSpecular=e,this._scheduleUpdate())}get opacityFadesSpecular(){return this._opacityFadesSpecular}set opacityMap(e){this._opacityMap=e,this._setMap(e,"opacityMap")}get opacityMap(){return this._opacityMap}set opacityMapChannel(e){this._opacityMapChannel=e,this.material&&(this.material.opacityMapChannel=e,this._scheduleUpdate())}get opacityMapChannel(){return this._opacityMapChannel}set opacityMapOffset(e){this._opacityMapOffset=e,this.material&&(this.material.opacityMapOffset=e,this._scheduleUpdate())}get opacityMapOffset(){return this._opacityMapOffset}set opacityMapRotation(e){this._opacityMapRotation=e,this.material&&(this.material.opacityMapRotation=e,this._scheduleUpdate())}get opacityMapRotation(){return this._opacityMapRotation}set opacityMapTiling(e){this._opacityMapTiling=e,this.material&&(this.material.opacityMapTiling=e,this._scheduleUpdate())}get opacityMapTiling(){return this._opacityMapTiling}set opacityMapUv(e){this._opacityMapUv=e,this.material&&(this.material.opacityMapUv=e,this._scheduleUpdate())}get opacityMapUv(){return this._opacityMapUv}set roughness(e){this.gloss=e,this.glossInvert=!0}get roughness(){return this._gloss}set roughnessMap(e){this.glossMap=e,this.glossInvert=!0}get roughnessMap(){return this._glossMap}set slopeDepthBias(e){this._slopeDepthBias=e,this.material&&(this.material.slopeDepthBias=e,this._scheduleUpdate())}get slopeDepthBias(){return this._slopeDepthBias}set specular(e){this._specular=e,this.material&&(this.material.specular=e,this._scheduleUpdate())}get specular(){return this._specular}set specularityFactor(e){this._specularityFactor=e,this.material&&(this.material.specularityFactor=e,this._scheduleUpdate())}get specularityFactor(){return this._specularityFactor}set twoSidedLighting(e){this._twoSidedLighting=e,this.material&&(this.material.twoSidedLighting=e,this._scheduleUpdate())}get twoSidedLighting(){return this._twoSidedLighting}set useFog(e){this._useFog=e,this.material&&(this.material.useFog=e,this._scheduleUpdate())}get useFog(){return this._useFog}set useLighting(e){this._useLighting=e,this.material&&(this.material.useLighting=e,this._scheduleUpdate())}get useLighting(){return this._useLighting}set useMetalness(e){this._useMetalness=e,this.material&&(this.material.useMetalness=e,this._scheduleUpdate())}get useMetalness(){return this._useMetalness}set useMetalnessSpecularColor(e){this._useMetalnessSpecularColor=e,this.material&&(this.material.useMetalnessSpecularColor=e,this._scheduleUpdate())}get useMetalnessSpecularColor(){return this._useMetalnessSpecularColor}set useSkybox(e){this._useSkybox=e,this.material&&(this.material.useSkybox=e,this._scheduleUpdate())}get useSkybox(){return this._useSkybox}set useTonemap(e){this._useTonemap=e,this.material&&(this.material.useTonemap=e,this._scheduleUpdate())}get useTonemap(){return this._useTonemap}static get(e){const t=document.querySelector(`pc-material[id="${e}"]`);return t?.material}static get observedAttributes(){return["alpha-test","alpha-to-coverage","ao-intensity","ao-map","ao-map-channel","ao-map-offset","ao-map-rotation","ao-map-tiling","ao-map-uv","blend-type","bumpiness","cull","depth-bias","depth-test","depth-write","diffuse","diffuse-map","diffuse-map-channel","diffuse-map-offset","diffuse-map-rotation","diffuse-map-tiling","diffuse-map-uv","emissive","emissive-intensity","emissive-map","emissive-map-channel","emissive-map-offset","emissive-map-rotation","emissive-map-tiling","emissive-map-uv","enable-ggx-specular","fresnel-model","gloss","gloss-invert","gloss-map","gloss-map-channel","gloss-map-offset","gloss-map-rotation","gloss-map-tiling","gloss-map-uv","height-map","height-map-channel","height-map-factor","height-map-offset","height-map-rotation","height-map-tiling","height-map-uv","metalness","metalness-map","metalness-map-channel","metalness-map-offset","metalness-map-rotation","metalness-map-tiling","metalness-map-uv","name","normal-map","normal-map-offset","normal-map-rotation","normal-map-tiling","normal-map-uv","occlude-direct","occlude-specular","opacity","opacity-dither","opacity-fades-specular","opacity-map","opacity-map-channel","opacity-map-offset","opacity-map-rotation","opacity-map-tiling","opacity-map-uv","roughness","roughness-map","slope-depth-bias","specular","specularity-factor","two-sided-lighting","use-fog","use-lighting","use-metalness","use-metalness-specular-color","use-skybox","use-tonemap"]}attributeChangedCallback(e,t,i){switch(e){case"alpha-test":this.alphaTest=Jt(i,0,e);break;case"alpha-to-coverage":this.alphaToCoverage=Qt(i,!1);break;case"ao-intensity":this.aoIntensity=Jt(i,1,e);break;case"ao-map":this.aoMap=i??"";break;case"ao-map-channel":this.aoMapChannel=Nt(i,Xi,"g",e);break;case"ao-map-offset":this.aoMapOffset=ei(i,new o(0,0),e);break;case"ao-map-rotation":this.aoMapRotation=Jt(i,0,e);break;case"ao-map-tiling":this.aoMapTiling=ei(i,new o(1,1),e);break;case"ao-map-uv":this.aoMapUv=Jt(i,0,e);break;case"blend-type":this.blendType=Nt(i,Wi,"none",e);break;case"bumpiness":this.bumpiness=Jt(i,1,e);break;case"cull":this.cull=Nt(i,$i,"back",e);break;case"depth-bias":this.depthBias=Jt(i,0,e);break;case"depth-test":this.depthTest=Qt(i,!0);break;case"depth-write":this.depthWrite=Qt(i,!0);break;case"diffuse":this.diffuse=Xt(i,new s(1,1,1),e);break;case"diffuse-map":this.diffuseMap=i??"";break;case"diffuse-map-channel":this.diffuseMapChannel=Nt(i,Qi,"rgb",e);break;case"diffuse-map-offset":this.diffuseMapOffset=ei(i,new o(0,0),e);break;case"diffuse-map-rotation":this.diffuseMapRotation=Jt(i,0,e);break;case"diffuse-map-tiling":this.diffuseMapTiling=ei(i,new o(1,1),e);break;case"diffuse-map-uv":this.diffuseMapUv=Jt(i,0,e);break;case"emissive":this.emissive=Xt(i,new s(0,0,0),e);break;case"emissive-intensity":this.emissiveIntensity=Jt(i,1,e);break;case"emissive-map":this.emissiveMap=i??"";break;case"emissive-map-channel":this.emissiveMapChannel=Nt(i,Qi,"rgb",e);break;case"emissive-map-offset":this.emissiveMapOffset=ei(i,new o(0,0),e);break;case"emissive-map-rotation":this.emissiveMapRotation=Jt(i,0,e);break;case"emissive-map-tiling":this.emissiveMapTiling=ei(i,new o(1,1),e);break;case"emissive-map-uv":this.emissiveMapUv=Jt(i,0,e);break;case"enable-ggx-specular":this.enableGGXSpecular=Qt(i,!1);break;case"fresnel-model":this.fresnelModel=Nt(i,Yi,"schlick",e);break;case"gloss":this.gloss=Jt(i,.25,e),this._warnGlossConflict();break;case"gloss-invert":this.glossInvert=Qt(i,!1),this._warnGlossConflict();break;case"gloss-map":this.glossMap=i??"",this._warnGlossConflict();break;case"gloss-map-channel":this.glossMapChannel=Nt(i,Xi,"g",e);break;case"gloss-map-offset":this.glossMapOffset=ei(i,new o(0,0),e);break;case"gloss-map-rotation":this.glossMapRotation=Jt(i,0,e);break;case"gloss-map-tiling":this.glossMapTiling=ei(i,new o(1,1),e);break;case"gloss-map-uv":this.glossMapUv=Jt(i,0,e);break;case"height-map":this.heightMap=i??"";break;case"height-map-channel":this.heightMapChannel=Nt(i,Xi,"g",e);break;case"height-map-factor":this.heightMapFactor=Jt(i,1,e);break;case"height-map-offset":this.heightMapOffset=ei(i,new o(0,0),e);break;case"height-map-rotation":this.heightMapRotation=Jt(i,0,e);break;case"height-map-tiling":this.heightMapTiling=ei(i,new o(1,1),e);break;case"height-map-uv":this.heightMapUv=Jt(i,0,e);break;case"metalness":this.metalness=Jt(i,0,e);break;case"metalness-map":this.metalnessMap=i??"";break;case"metalness-map-channel":this.metalnessMapChannel=Nt(i,Xi,"g",e);break;case"metalness-map-offset":this.metalnessMapOffset=ei(i,new o(0,0),e);break;case"metalness-map-rotation":this.metalnessMapRotation=Jt(i,0,e);break;case"metalness-map-tiling":this.metalnessMapTiling=ei(i,new o(1,1),e);break;case"metalness-map-uv":this.metalnessMapUv=Jt(i,0,e);break;case"name":this.name=i??"Untitled";break;case"normal-map":this.normalMap=i??"";break;case"normal-map-offset":this.normalMapOffset=ei(i,new o(0,0),e);break;case"normal-map-rotation":this.normalMapRotation=Jt(i,0,e);break;case"normal-map-tiling":this.normalMapTiling=ei(i,new o(1,1),e);break;case"normal-map-uv":this.normalMapUv=Jt(i,0,e);break;case"occlude-direct":this.occludeDirect=Qt(i,!1);break;case"occlude-specular":this.occludeSpecular=Nt(i,Ii,"ao",e);break;case"opacity":this.opacity=Jt(i,1,e);break;case"opacity-dither":this.opacityDither=Nt(i,Ki,"none",e);break;case"opacity-fades-specular":this.opacityFadesSpecular=Qt(i,!0);break;case"opacity-map":this.opacityMap=i??"";break;case"opacity-map-channel":this.opacityMapChannel=Nt(i,Xi,"a",e);break;case"opacity-map-offset":this.opacityMapOffset=ei(i,new o(0,0),e);break;case"opacity-map-rotation":this.opacityMapRotation=Jt(i,0,e);break;case"opacity-map-tiling":this.opacityMapTiling=ei(i,new o(1,1),e);break;case"opacity-map-uv":this.opacityMapUv=Jt(i,0,e);break;case"roughness":this.gloss=Jt(i,.25,e),this.glossInvert=null!==i,this._warnGlossConflict();break;case"roughness-map":this.glossMap=i??"",this.glossInvert=null!==i,this._warnGlossConflict();break;case"slope-depth-bias":this.slopeDepthBias=Jt(i,0,e);break;case"specular":this.specular=Xt(i,new s(0,0,0),e);break;case"specularity-factor":this.specularityFactor=Jt(i,1,e);break;case"two-sided-lighting":this.twoSidedLighting=Qt(i,!1);break;case"use-fog":this.useFog=Qt(i,!0);break;case"use-lighting":this.useLighting=Qt(i,!0);break;case"use-metalness":this.useMetalness=Qt(i,!0);break;case"use-metalness-specular-color":this.useMetalnessSpecularColor=Qt(i,!1);break;case"use-skybox":this.useSkybox=Qt(i,!0);break;case"use-tonemap":this.useTonemap=Qt(i,!0)}}}customElements.define("pc-material",Zi);class Vi extends xi{_castShadows=!0;_material="";_receiveShadows=!0;_type="box";constructor(){super("render")}getInitialComponentData(){return{type:this._type,castShadows:this._castShadows,material:Zi.get(this._material),receiveShadows:this._receiveShadows}}get component(){return super.component}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set material(e){this._material=e;const t=Zi.get(e);this.component&&t&&(this.component.material=t)}get material(){return this._material}set receiveShadows(e){this._receiveShadows=e,this.component&&(this.component.receiveShadows=e)}get receiveShadows(){return this._receiveShadows}static get observedAttributes(){return[...super.observedAttributes,"cast-shadows","material","receive-shadows","type"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"cast-shadows":this.castShadows=Qt(i,!0);break;case"material":this.material=i??"";break;case"receive-shadows":this.receiveShadows=Qt(i,!0);break;case"type":this.type=Nt(i,["box","capsule","cone","cylinder","plane","sphere"],"box",e)}}}customElements.define("pc-render",Vi);class es extends xi{_angularDamping=0;_angularFactor=new i(1,1,1);_friction=.5;_linearDamping=0;_linearFactor=new i(1,1,1);_mass=1;_restitution=0;_rollingFriction=0;_type="static";constructor(){super("rigidbody")}getInitialComponentData(){return{angularDamping:this._angularDamping,angularFactor:this._angularFactor,friction:this._friction,linearDamping:this._linearDamping,linearFactor:this._linearFactor,mass:this._mass,restitution:this._restitution,rollingFriction:this._rollingFriction,type:this._type}}get component(){return super.component}set angularDamping(e){this._angularDamping=e,this.component&&(this.component.angularDamping=e)}get angularDamping(){return this._angularDamping}set angularFactor(e){this._angularFactor=e,this.component&&(this.component.angularFactor=e)}get angularFactor(){return this._angularFactor}set friction(e){this._friction=e,this.component&&(this.component.friction=e)}get friction(){return this._friction}set linearDamping(e){this._linearDamping=e,this.component&&(this.component.linearDamping=e)}get linearDamping(){return this._linearDamping}set linearFactor(e){this._linearFactor=e,this.component&&(this.component.linearFactor=e)}get linearFactor(){return this._linearFactor}set mass(e){this._mass=e,this.component&&(this.component.mass=e)}get mass(){return this._mass}set restitution(e){this._restitution=e,this.component&&(this.component.restitution=e)}get restitution(){return this._restitution}set rollingFriction(e){this._rollingFriction=e,this.component&&(this.component.rollingFriction=e)}get rollingFriction(){return this._rollingFriction}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-damping","angular-factor","friction","linear-damping","linear-factor","mass","restitution","rolling-friction","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-damping":this.angularDamping=Jt(s,0,e);break;case"angular-factor":this.angularFactor=ti(s,i.ONE,e);break;case"friction":this.friction=Jt(s,.5,e);break;case"linear-damping":this.linearDamping=Jt(s,0,e);break;case"linear-factor":this.linearFactor=ti(s,i.ONE,e);break;case"mass":this.mass=Jt(s,1,e);break;case"restitution":this.restitution=Jt(s,0,e);break;case"rolling-friction":this.rollingFriction=Jt(s,0,e);break;case"type":this.type=Nt(s,["static","dynamic","kinematic"],"static",e)}}}customElements.define("pc-rigid-body",es);const ts=new Map([["none",Ft],["blend",Et]]);class is extends xi{_screenSpace=!1;_resolution=new o(640,320);_referenceResolution=new o(640,320);_priority=0;_scaleMode="none";_scaleBlend=.5;constructor(){super("screen")}getInitialComponentData(){return{priority:this._priority,referenceResolution:this._referenceResolution,resolution:this._resolution,scaleBlend:this._scaleBlend,scaleMode:ts.get(this._scaleMode)??Ft,screenSpace:this._screenSpace}}get component(){return super.component}set priority(e){this._priority=e,this.component&&(this.component.priority=this._priority)}get priority(){return this._priority}set referenceResolution(e){this._referenceResolution=e,this.component&&(this.component.referenceResolution=this._referenceResolution)}get referenceResolution(){return this._referenceResolution}set resolution(e){this._resolution=e,this.component&&(this.component.resolution=this._resolution)}get resolution(){return this._resolution}set scaleBlend(e){this._scaleBlend=e,this.component&&(this.component.scaleBlend=this._scaleBlend)}get scaleBlend(){return this._scaleBlend}set scaleMode(e){this._scaleMode=e,this.component&&(this.component.scaleMode=ts.get(e)??Ft)}get scaleMode(){return this._scaleMode}set screenSpace(e){this._screenSpace=e,this.component&&(this.component.screenSpace=this._screenSpace)}get screenSpace(){return this._screenSpace}static get observedAttributes(){return[...super.observedAttributes,"screen-space","resolution","reference-resolution","priority","scale-blend","scale-mode"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"priority":this.priority=Jt(i,0,e);break;case"reference-resolution":this.referenceResolution=ei(i,new o(640,320),e);break;case"resolution":this.resolution=ei(i,new o(640,320),e);break;case"scale-blend":this.scaleBlend=Jt(i,.5,e);break;case"scale-mode":this.scaleMode=Nt(i,ts,"none",e);break;case"screen-space":this.screenSpace=Qt(i,!1)}}}customElements.define("pc-screen",is);const ss=new Map([["horizontal",Ie],["vertical",Je]]);class as extends xi{_orientation="horizontal";_value=0;_handleSize=.5;_handle="";constructor(){super("scrollbar")}getInitialComponentData(){const e={orientation:ss.get(this._orientation),value:this._value,handleSize:this._handleSize},t=si(this._handle);return t&&(e.handleEntity=t),e}get component(){return super.component}set orientation(e){this._orientation=e,this.component&&(this.component.orientation=ss.get(e)??Ie)}get orientation(){return this._orientation}set value(e){this._value=e,this.component&&(this.component.value=e)}get value(){return this._value}set handleSize(e){this._handleSize=e,this.component&&(this.component.handleSize=e)}get handleSize(){return this._handleSize}set handle(e){this._handle=e;const t=si(e);this.component&&t&&(this.component.handleEntity=t)}get handle(){return this._handle}static get observedAttributes(){return[...super.observedAttributes,"orientation","value","handle-size","handle"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"orientation":this.orientation=Nt(i,ss,"horizontal",e);break;case"value":this.value=Jt(i,0,e);break;case"handle-size":this.handleSize=Jt(i,.5,e);break;case"handle":this.handle=i??""}}}customElements.define("pc-scrollbar",as);const ns=new Map([["clamp",Lt],["bounce",Rt],["infinite",zt]]),os=new Map([["always",Ot],["when-required",jt]]);class rs extends xi{_horizontal=!0;_vertical=!0;_scrollMode="bounce";_bounceAmount=.1;_friction=.05;_useMouseWheel=!0;_mouseWheelSensitivity=new o(1,1);_horizontalScrollbarVisibility="when-required";_verticalScrollbarVisibility="when-required";_viewport="";_content="";_horizontalScrollbar="";_verticalScrollbar="";constructor(){super("scrollview")}getInitialComponentData(){const e={horizontal:this._horizontal,vertical:this._vertical,scrollMode:ns.get(this._scrollMode),bounceAmount:this._bounceAmount,friction:this._friction,useMouseWheel:this._useMouseWheel,mouseWheelSensitivity:this._mouseWheelSensitivity,horizontalScrollbarVisibility:os.get(this._horizontalScrollbarVisibility),verticalScrollbarVisibility:os.get(this._verticalScrollbarVisibility)},t=si(this._viewport);t&&(e.viewportEntity=t);const i=si(this._content);i&&(e.contentEntity=i);const s=si(this._horizontalScrollbar);s&&(e.horizontalScrollbarEntity=s);const a=si(this._verticalScrollbar);return a&&(e.verticalScrollbarEntity=a),e}get component(){return super.component}set horizontal(e){this._horizontal=e,this.component&&(this.component.horizontal=e)}get horizontal(){return this._horizontal}set vertical(e){this._vertical=e,this.component&&(this.component.vertical=e)}get vertical(){return this._vertical}set scrollMode(e){this._scrollMode=e,this.component&&(this.component.scrollMode=ns.get(e)??Rt)}get scrollMode(){return this._scrollMode}set bounceAmount(e){this._bounceAmount=e,this.component&&(this.component.bounceAmount=e)}get bounceAmount(){return this._bounceAmount}set friction(e){this._friction=e,this.component&&(this.component.friction=e)}get friction(){return this._friction}set useMouseWheel(e){this._useMouseWheel=e,this.component&&(this.component.useMouseWheel=e)}get useMouseWheel(){return this._useMouseWheel}set mouseWheelSensitivity(e){this._mouseWheelSensitivity=e,this.component&&(this.component.mouseWheelSensitivity=e)}get mouseWheelSensitivity(){return this._mouseWheelSensitivity}set horizontalScrollbarVisibility(e){this._horizontalScrollbarVisibility=e,this.component&&(this.component.horizontalScrollbarVisibility=os.get(e)??jt)}get horizontalScrollbarVisibility(){return this._horizontalScrollbarVisibility}set verticalScrollbarVisibility(e){this._verticalScrollbarVisibility=e,this.component&&(this.component.verticalScrollbarVisibility=os.get(e)??jt)}get verticalScrollbarVisibility(){return this._verticalScrollbarVisibility}set viewport(e){this._viewport=e;const t=si(e);this.component&&t&&(this.component.viewportEntity=t)}get viewport(){return this._viewport}set content(e){this._content=e;const t=si(e);this.component&&t&&(this.component.contentEntity=t)}get content(){return this._content}set horizontalScrollbar(e){this._horizontalScrollbar=e;const t=si(e);this.component&&t&&(this.component.horizontalScrollbarEntity=t)}get horizontalScrollbar(){return this._horizontalScrollbar}set verticalScrollbar(e){this._verticalScrollbar=e;const t=si(e);this.component&&t&&(this.component.verticalScrollbarEntity=t)}get verticalScrollbar(){return this._verticalScrollbar}static get observedAttributes(){return[...super.observedAttributes,"horizontal","vertical","scroll-mode","bounce-amount","friction","use-mouse-wheel","mouse-wheel-sensitivity","horizontal-scrollbar-visibility","vertical-scrollbar-visibility","viewport","content","horizontal-scrollbar","vertical-scrollbar"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"horizontal":this.horizontal=Qt(i,!0);break;case"vertical":this.vertical=Qt(i,!0);break;case"scroll-mode":this.scrollMode=Nt(i,ns,"bounce",e);break;case"bounce-amount":this.bounceAmount=Jt(i,.1,e);break;case"friction":this.friction=Jt(i,.05,e);break;case"use-mouse-wheel":this.useMouseWheel=Qt(i,!0);break;case"mouse-wheel-sensitivity":this.mouseWheelSensitivity=ei(i,o.ONE,e);break;case"horizontal-scrollbar-visibility":this.horizontalScrollbarVisibility=Nt(i,os,"when-required",e);break;case"vertical-scrollbar-visibility":this.verticalScrollbarVisibility=Nt(i,os,"when-required",e);break;case"viewport":this.viewport=i??"";break;case"content":this.content=i??"";break;case"horizontal-scrollbar":this.horizontalScrollbar=i??"";break;case"vertical-scrollbar":this.verticalScrollbar=i??""}}}customElements.define("pc-scroll-view",rs);class ls extends Ht{_attributes={};_enabled=!0;_script=null;set scriptAttributes(e){this._attributes=e??{},this.dispatchEvent(new CustomEvent("scriptattributeschange",{detail:{attributes:this._attributes},bubbles:!0}))}get scriptAttributes(){return this._attributes}set enabled(e){this._enabled=e,this.dispatchEvent(new CustomEvent("scriptenablechange",{detail:{enabled:e},bubbles:!0}))}get enabled(){return this._enabled}set name(e){this.setAttribute("name",e)}get name(){return this.getAttribute("name")??""}get script(){return this._script}connectedCallback(){"PC-SCRIPT"!==this.parentElement?.tagName&&console.warn(`pc-script-instance '${this.getAttribute("name")}' must be a direct child of pc-script - script not created`)}disconnectedCallback(){this._resetReady()}_onScriptCreated(){this._onReady()}static get observedAttributes(){return["attributes","enabled","name"]}attributeChangedCallback(e,t,i){switch(e){case"attributes":if(null===i){this.scriptAttributes={};break}try{this.scriptAttributes=JSON.parse(i)}catch(e){console.warn(`Invalid 'attributes' JSON on pc-script-instance '${this.getAttribute("name")}': ${e.message}`)}break;case"enabled":this.enabled=Qt(i,!0);break;case"name":null!==t&&t!==i&&this.dispatchEvent(new CustomEvent("scriptnamechange",{detail:{oldName:t,newName:i},bubbles:!0}))}}}customElements.define("pc-script-instance",ls);const cs=new Set([...ls.observedAttributes,"accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","exportparts","hidden","id","inert","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","popover","role","slot","spellcheck","style","tabindex","title","translate"]),hs=e=>cs.has(e)||e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("on")&&e in HTMLElement.prototype,ps=new Set(["app","entity","destroy","initialize","postInitialize","postUpdate","swap","update"]),bs=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),ds=(e,t)=>(i,s)=>{const a=It(i,e);return a?new t(a):(console.warn(`Invalid script attribute value '${s}'. Expected ${e} space-separated numbers after 'vec${e}:'.`),s)},us=new Map([["asset",(e,t)=>{const i=ki(e);return i||(console.warn(`Unable to resolve '${t}' in script attributes - no pc-asset found with id '${e}'.`),t)}],["entity",(e,t)=>{const i=si(e);return i||(console.warn(`Unable to resolve '${t}' in script attributes - no pc-entity found matching '${e}'.`),t)}],["vec2",ds(2,o)],["vec3",ds(3,i)],["vec4",ds(4,a)],["color",(e,t)=>{const i=It(e,4)??It(e,3);return i?new s(i):(console.warn(`Invalid script attribute value '${t}'. Expected 3 or 4 space-separated numbers after 'color:'.`),t)}]]),ms=e=>{const t=e.indexOf(":");if(t<=0)return null;const i=us.get(e.slice(0,t));return i?{convert:i,rest:e.slice(t+1)}:null};class gs extends xi{observer;constructor(){super("script"),this.observer=new MutationObserver(this.handleMutations.bind(this)),this.addEventListener("scriptattributeschange",this.handleScriptAttributesChange.bind(this)),this.addEventListener("scriptenablechange",this.handleScriptEnableChange.bind(this)),this.addEventListener("scriptnamechange",this.handleScriptNameChange.bind(this))}connectedCallback(){return this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0}),super.connectedCallback()}initComponent(){this.querySelectorAll(":scope > pc-script-instance").forEach(e=>{const t=this.scriptFor(e);t?this.applyDeclaredState(t,e):this.createScript(e)})}convertAttributes(e){if("string"==typeof e){const t=ms(e);return t?t.convert(t.rest,e):e}if(Array.isArray(e))return e.map(e=>this.convertAttributes(e));if(e&&"object"==typeof e){const t={};for(const i in e)t[i]=this.convertAttributes(e[i]);return t}return e}mergeDeep(e,t){for(const i in t){const s=t[i],a=e[i];if(this.isMathType(a)&&Array.isArray(s)){const t=this.arrayToMathType(a,s,i);t&&(e[i]=t);continue}s&&"object"==typeof s&&!Array.isArray(s)&&Object.getPrototypeOf(s)===Object.prototype?(a&&"object"==typeof a||(e[i]={}),this.mergeDeep(e[i],s)):e[i]=s}return e}isMathType(e){return e instanceof o||e instanceof i||e instanceof a||e instanceof s||e instanceof n}arrayToMathType(e,t,r){if(t.every(e=>"number"==typeof e&&Number.isFinite(e))){if(e instanceof o&&2===t.length)return new o(t);if(e instanceof i&&3===t.length)return new i(t);if(e instanceof a&&4===t.length)return new a(t);if(e instanceof s&&(3===t.length||4===t.length))return new s(t);if(e instanceof n&&3===t.length)return(new n).setFromEulerAngles(t[0],t[1],t[2])}return console.warn(`Cannot convert script attribute '${r}' array [${t}] to ${e.constructor.name}. Keeping the current value.`),null}applyAttributes(e,t,i){const s=this.convertAttributes(t);if(s&&"object"==typeof s&&(delete s.enabled,i))for(const e of i)delete s[e];this.mergeDeep(e,s)}inlineKeys(e){const t=new Set;for(const i of Array.from(e.attributes))hs(i.name)||t.add(bs(i.name));return t}scriptFor(e){const t=e.getAttribute("name");if(!t||!this.component)return null;const i=this.component.get(t);return i&&i===e._script?i:null}handleScriptAttributesChange(e){const t=e.target,i=this.scriptFor(t);i&&this.applyAttributes(i,e.detail.attributes,this.inlineKeys(t))}handleScriptEnableChange(e){const t=e.target;this.handleMutations(this.observer.takeRecords());const i=this.scriptFor(t);i&&(i.enabled=e.detail.enabled)}handleScriptNameChange(e){const t=e.target;if(t.parentElement!==this)return;if(!this.component)return;const{oldName:i}=e.detail;i&&t._script&&this.component.get(i)===t._script&&this.destroyScript(i),t._script=null,this.createScript(t)}createScript(e){const t=e.getAttribute("name");if(!t||!this.component)return null;const i=this.component.create(t,{enabled:!1});return i?(e._script=i,this.applyDeclaredState(i,e),e._onScriptCreated(),i):null}applyDeclaredState(e,t){this.applyAttributes(e,t.scriptAttributes,this.inlineKeys(t)),this.applyInlineAttributes(e,t),e.enabled=t.enabled}applyInlineAttributes(e,t){const i=t.getAttribute("name")??"";for(const s of Array.from(t.attributes))hs(s.name)||this.setScriptProperty(e,i,s.name,s.value)}applyScriptProperty(e,t){const i=this.scriptFor(e);if(!i)return;const s=e.getAttribute(t);if(null===s){const s=bs(t),a=e.scriptAttributes[s];return void(void 0!==a&&this.applyAttributes(i,{[s]:a}))}this.setScriptProperty(i,e.getAttribute("name")??"",t,s)}setScriptProperty(e,t,r,l){const c=bs(r);try{const p=e[c];if("function"==typeof p||ps.has(c))return void console.warn(`Ignoring attribute '${r}' on pc-script-instance '${t}' - '${c}' is part of the Script API.`);if("string"==typeof p)e[c]=l;else if(ms(l)){const t=this.convertAttributes(l);t===l&&null!=p||(e[c]=t)}else if("number"==typeof p)e[c]=Jt(l,p,r);else if("boolean"==typeof p)e[c]=Qt(l,p);else if(p instanceof o)e[c]=ei(l,p,r);else if(p instanceof i)e[c]=ti(l,p,r);else if(p instanceof a)e[c]=ii(l,p,r);else if(p instanceof s)e[c]=Xt(l,p,r);else if(p instanceof n)e[c]=Zt(l,p,r);else{const i=((e,t)=>{const i=new Set(Object.keys(e));for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(e)))i.add(t);for(const e of i)if(e!==t&&e.toLowerCase()===t.toLowerCase())return e;return null})(e,c);if(i)return void console.warn(`Script '${t}' has no attribute '${c}' - did you mean '${h=i,h.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}'? Attribute names are kebab-case.`);console.warn(`Script '${t}' has no typed attribute '${c}' - assigning the raw string from '${r}'.`),e[c]=l}}catch(e){console.warn(`Error applying attribute '${r}' to script '${t}': ${e.message}`)}var h}destroyScript(e){this.component&&this.component.destroy(e)}handleMutations(e){for(const t of e){if("attributes"===t.type){const e=t.target;e instanceof ls&&e.parentElement===this&&t.attributeName&&!hs(t.attributeName)&&this.applyScriptProperty(e,t.attributeName);continue}t.target===this&&(t.removedNodes.forEach(e=>{if(e instanceof ls){const t=e.getAttribute("name");t&&e._script&&this.component&&this.component.get(t)===e._script&&this.destroyScript(t),e._script=null}}),t.addedNodes.forEach(e=>{e instanceof ls&&this.createScript(e)}))}}disconnectedCallback(){this.observer.disconnect(),super.disconnectedCallback?.()}get component(){return super.component}}customElements.define("pc-script",gs);class _s extends xi{_distanceModel="linear";_maxDistance=1e4;_pitch=1;_positional=!1;_refDistance=1;_rollOffFactor=1;_volume=1;constructor(){super("sound")}getInitialComponentData(){return{distanceModel:this._distanceModel,maxDistance:this._maxDistance,pitch:this._pitch,positional:this._positional,refDistance:this._refDistance,rollOffFactor:this._rollOffFactor,volume:this._volume}}get component(){return super.component}set distanceModel(e){this._distanceModel=e,this.component&&(this.component.distanceModel=e)}get distanceModel(){return this._distanceModel}set maxDistance(e){this._maxDistance=e,this.component&&(this.component.maxDistance=e)}get maxDistance(){return this._maxDistance}set pitch(e){this._pitch=e,this.component&&(this.component.pitch=e)}get pitch(){return this._pitch}set positional(e){this._positional=e,this.component&&(this.component.positional=e)}get positional(){return this._positional}set refDistance(e){this._refDistance=e,this.component&&(this.component.refDistance=e)}get refDistance(){return this._refDistance}set rollOffFactor(e){this._rollOffFactor=e,this.component&&(this.component.rollOffFactor=e)}get rollOffFactor(){return this._rollOffFactor}set volume(e){this._volume=e,this.component&&(this.component.volume=e)}get volume(){return this._volume}static get observedAttributes(){return[...super.observedAttributes,"distance-model","max-distance","pitch","positional","ref-distance","roll-off-factor","volume"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"distance-model":this.distanceModel=Nt(i,["exponential","inverse","linear"],"linear",e);break;case"max-distance":this.maxDistance=Jt(i,1e4,e);break;case"pitch":this.pitch=Jt(i,1,e);break;case"positional":this.positional=Qt(i,!1);break;case"ref-distance":this.refDistance=Jt(i,1,e);break;case"roll-off-factor":this.rollOffFactor=Jt(i,1,e);break;case"volume":this.volume=Jt(i,1,e)}}}customElements.define("pc-sound",_s);class fs extends Ht{_asset="";_autoPlay=!1;_duration=null;_loop=!1;_name="";_overlap=!1;_pitch=1;_startTime=0;_volume=1;_soundElement=null;_connectionGeneration=0;soundSlot=null;async connectedCallback(){const e=++this._connectionGeneration,t=this.soundElement;await(t?.ready());const i=t?.component;if(e!==this._connectionGeneration||!i)return;const s={autoPlay:this._autoPlay,loop:this._loop,overlap:this._overlap,pitch:this._pitch,startTime:this._startTime,volume:this._volume};this._duration&&(s.duration=this._duration),this._soundElement=t,this.soundSlot=i.addSlot(this._name,s),this.asset=this._asset,this._autoPlay&&this.soundSlot.play(),this._onReady()}disconnectedCallback(){this._connectionGeneration++,this._soundElement?.component?.removeSlot(this._name),this._soundElement=null,this.soundSlot=null,this._resetReady()}get soundElement(){const e=this.parentElement;return e instanceof _s?e:(console.warn("pc-sound-slot must be a direct child of a pc-sound element"),null)}set asset(e){if(this._asset=e,this.soundSlot){const t=ki(e)?.id;t&&(this.soundSlot.asset=t)}}get asset(){return this._asset}set autoPlay(e){this._autoPlay=e,this.soundSlot&&(this.soundSlot.autoPlay=e)}get autoPlay(){return this._autoPlay}set duration(e){this._duration=e,this.soundSlot&&null!==e&&(this.soundSlot.duration=e)}get duration(){return this._duration}set loop(e){this._loop=e,this.soundSlot&&(this.soundSlot.loop=e)}get loop(){return this._loop}set name(e){this._name=e,this.soundSlot&&(this.soundSlot.name=e)}get name(){return this._name}set overlap(e){this._overlap=e,this.soundSlot&&(this.soundSlot.overlap=e)}get overlap(){return this._overlap}set pitch(e){this._pitch=e,this.soundSlot&&(this.soundSlot.pitch=e)}get pitch(){return this._pitch}set startTime(e){this._startTime=e,this.soundSlot&&(this.soundSlot.startTime=e)}get startTime(){return this._startTime}set volume(e){this._volume=e,this.soundSlot&&(this.soundSlot.volume=e)}get volume(){return this._volume}static get observedAttributes(){return["asset","auto-play","duration","loop","name","overlap","pitch","start-time","volume"]}attributeChangedCallback(e,t,i){switch(e){case"asset":this.asset=i??"";break;case"auto-play":this.autoPlay=Qt(i,!1);break;case"duration":this.duration=Jt(i,null,e);break;case"loop":this.loop=Qt(i,!1);break;case"name":this.name=i??"";break;case"overlap":this.overlap=Qt(i,!1);break;case"pitch":this.pitch=Jt(i,1,e);break;case"start-time":this.startTime=Jt(i,0,e);break;case"volume":this.volume=Jt(i,1,e)}}}customElements.define("pc-sound-slot",fs);class vs extends xi{_asset="";_castShadows=!1;_lodBaseDistance=5;_lodMultiplier=3;_lodRangeMin=0;_lodRangeMax=99;constructor(){super("gsplat")}getInitialComponentData(){return{asset:ki(this._asset),castShadows:this._castShadows,lodBaseDistance:this._lodBaseDistance,lodMultiplier:this._lodMultiplier,lodRangeMin:this._lodRangeMin,lodRangeMax:this._lodRangeMax}}get component(){return super.component}set asset(e){this._asset=e;const t=ki(e);this.component&&t&&(this.component.asset=t)}get asset(){return this._asset}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set lodBaseDistance(e){this._lodBaseDistance=e,this.component&&(this.component.lodBaseDistance=e)}get lodBaseDistance(){return this._lodBaseDistance}set lodMultiplier(e){this._lodMultiplier=e,this.component&&(this.component.lodMultiplier=e)}get lodMultiplier(){return this._lodMultiplier}set lodRangeMin(e){this._lodRangeMin=e,this.component&&(this.component.lodRangeMin=e)}get lodRangeMin(){return this._lodRangeMin}set lodRangeMax(e){this._lodRangeMax=e,this.component&&(this.component.lodRangeMax=e)}get lodRangeMax(){return this._lodRangeMax}static get observedAttributes(){return[...super.observedAttributes,"asset","cast-shadows","lod-base-distance","lod-multiplier","lod-range-min","lod-range-max"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"asset":this.asset=i??"";break;case"cast-shadows":this.castShadows=Qt(i,!1);break;case"lod-base-distance":this.lodBaseDistance=Jt(i,5,e);break;case"lod-multiplier":this.lodMultiplier=Jt(i,3,e);break;case"lod-range-min":this.lodRangeMin=Jt(i,0,e);break;case"lod-range-max":this.lodRangeMax=Jt(i,99,e)}}}customElements.define("pc-gsplat",vs);class ys extends Wt{_name="";_index=null;_state="pending";_path=null;_host=null;_hostListener=null;_destroyHandle=null;_authored={};_authoredRender=null;_baseline=null;_enabled=null;_position=null;_rotation=null;_scale=null;_tags=null;_materialOverrides=null;get state(){return this._state}get path(){return this._path}connectedCallback(){const e=this.parentElement?.closest("pc-model, pc-node")??null;if(!e){const e=this._name?` '${this._name}'`:"";return void console.warn(`pc-node${e} must be a descendant of pc-model - node not bound`)}this._host=e,this._hostListener=e=>{e.target===this._host&&this._rebind()},e.addEventListener("ready",this._hostListener),this._rebind()}disconnectedCallback(){this._host&&this._hostListener&&this._host.removeEventListener("ready",this._hostListener),this._host=null,this._hostListener=null,this._unbind(),this._state="pending"}_rebind(){const e=this._host,t=(e instanceof Mi?e.contentEntity:e?.entity)??null;if(!t||!this._name)return this._unbind(),void(this._state="pending");const i=this._resolve(t);i&&i===this._entity?this._path=this._pathOf(i,t):(this._unbind(),i&&this._bind(i,t))}_resolve(e){const t=e.find(e=>e.name===this._name);if(0===t.length){const t=this._closestName(e),i=t?` - closest match: '${t}'`:"";return console.warn(`pc-node '${this._name}' not found in ${this._describeHost()}${i}`),this._state="missing",null}let i;if(null!==this._index){if(this._index>=t.length)return console.warn(`pc-node '${this._name}' index ${this._index} is out of range - ${t.length} match(es) in ${this._describeHost()}`),this._state="missing",null;i=t[this._index]}else{if(t.length>1){const i=t.map((t,i)=>`[${i}] ${this._pathOf(t,e)}`).join(", ");return console.warn(`pc-node '${this._name}' is ambiguous in ${this._describeHost()} - specify index: ${i}`),this._state="ambiguous",null}i=t[0]}const s=this.closestApp?.elementFromEntity(i);return s&&s!==this?(console.warn(`pc-node '${this._name}' resolves to a node already bound by another element - element ignored`),this._state="duplicate",null):i}_bind(e,t){this._entity=e,this._registerEntity(e),this._destroyHandle=e.once("destroy",this._onEntityDestroy,this),this._state="bound",this._path=this._pathOf(e,t),this._authoredRender=e.render??null,this._applyOverrides(),this._onReady(),this._buildChildren()}_unbind(){const e=this._entity;e&&(this._revertOverrides(),this.querySelectorAll("pc-entity, pc-model").forEach(e=>{e.closestEntity===this&&e.entity?.destroy()}),this._destroyHandle?.off(),this._destroyHandle=null,this._unregisterEntity(e),this._entity=null,this._path=null,this._authored={},this._authoredRender=null,this.querySelectorAll("*").forEach(e=>{e instanceof xi&&e.closestEntity===this&&e._hostCycled()}),this._resetReady())}_onEntityDestroy(e){this._destroyHandle=null,this._unregisterEntity(e),this._entity=null,this._path=null,this._authored={},this._authoredRender=null,this._baseline=null,this._state="pending",this._resetReady()}_buildChildren(){const e=this.closestApp?.app;e&&ri(this,e)}_applyOverrides(){null!==this._enabled&&(this.enabled=this._enabled),null!==this._position&&(this.position=this._position),null!==this._rotation&&(this.rotation=this._rotation),null!==this._scale&&(this.scale=this._scale),null!==this._tags&&(this.tags=this._tags),null!==this._materialOverrides&&this._applyMaterialOverrides()}_revertOverrides(){const e=this._entity,t=this._authored;void 0!==t.enabled&&(e.enabled=t.enabled),t.position&&e.setLocalPosition(t.position),t.rotation&&e.setLocalRotation(t.rotation),t.scale&&e.setLocalScale(t.scale),t.tags&&(e.tags.clear(),e.tags.add(t.tags)),this._authored={},this._restoreBaseline()}_applyMaterialOverrides(){const e=`pc-node '${this._name}'`,t=this._materialOverrides?((e,t)=>{const i=[];for(const[s,a]of Object.entries(e))if("string"!=typeof a||""===a)console.warn(`${t} material-overrides '${s}' needs a pc-material id - rule ignored`);else if(s.startsWith("name:")){const e=s.slice(5);""===e?console.warn(`${t} material-overrides 'name:' selector is empty - rule ignored`):i.push({kind:"name",name:e,id:a})}else if(s.startsWith("index:")){const e=s.slice(6).trim(),n=""===e?NaN:Number(e);!Number.isInteger(n)||n<0?console.warn(`${t} material-overrides '${s}' is not a non-negative integer index - rule ignored`):i.push({kind:"index",index:n,id:a})}else console.warn(`${t} material-overrides '${s}' has no 'name:' or 'index:' prefix - rule ignored`);return i})(this._materialOverrides,e):[];if(0===t.length)return void this._restoreBaseline();if(!this._baseline){if(!this._authoredRender)return void console.warn(`${e} is bound to a node without an authored render component - material-overrides ignored`);this._baseline=this._authoredRender.meshInstances.map(e=>({meshInstance:e,material:e.material??null,name:e.material?.name??null}))}const i=this._baseline,s=t=>{const i=Zi.get(t);return i||console.warn(`${e} material-overrides could not resolve pc-material '${t}' - rule ignored`),i??null},a=i.map(e=>e.material);for(const n of t){if("name"!==n.kind)continue;const t=s(n.id);if(!t)continue;let o=!1;if(i.forEach((e,i)=>{e.name===n.name&&(a[i]=t,o=!0)}),!o){const t=i.map(e=>`'${e.name}'`).join(", ");console.warn(`${e} material-overrides 'name:${n.name}' matches no assignment - baseline names: ${t||"(none)"}`)}}for(const n of t){if("index"!==n.kind)continue;if(n.index>=i.length){console.warn(`${e} material-overrides 'index:${n.index}' is out of range - ${i.length} assignment(s)`);continue}const t=s(n.id);t&&(a[n.index]=t)}i.forEach((e,t)=>{e.meshInstance.material!==a[t]&&(e.meshInstance.material=a[t])})}_restoreBaseline(){const e=this._baseline;if(e){this._baseline=null;for(const t of e)t.meshInstance.material!==t.material&&(t.meshInstance.material=t.material)}}_pathOf(e,t){const i=[];for(let s=e;s&&s!==t;s=s.parent)i.unshift(s.name);return i.join("/")||e.name}_describeHost(){return this._host instanceof Mi?`model '${this._host.asset}'`:`pc-node '${this._host?.name??""}' subtree`}_closestName(e){let t=null,i=3;return e.find(e=>{const s=((e,t)=>{const i=Array.from({length:t.length+1},(e,t)=>t);for(let s=1;s<=e.length;s++){let a=i[0];i[0]=s;for(let n=1;n<=t.length;n++){const o=i[n];i[n]=Math.min(i[n]+1,i[n-1]+1,a+(e[s-1]===t[n-1]?0:1)),a=o}}return i[t.length]})(this._name,e.name);return s<i&&(i=s,t=e.name),!1}),t}set name(e){this._name=e,this.isConnected&&this._host&&this._rebind()}get name(){return this._name}set index(e){this._index=e,this.isConnected&&this._host&&this._rebind()}get index(){return this._index}set enabled(e){this._enabled=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.enabled??=t.enabled,t.enabled=e):void 0!==this._authored.enabled&&(t.enabled=this._authored.enabled,delete this._authored.enabled))}get enabled(){return this._enabled}set position(e){this._position=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.position??=t.getLocalPosition().clone(),t.setLocalPosition(e)):this._authored.position&&(t.setLocalPosition(this._authored.position),delete this._authored.position))}get position(){return this._position}set rotation(e){this._rotation=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.rotation??=t.getLocalRotation().clone(),t.setLocalEulerAngles(e)):this._authored.rotation&&(t.setLocalRotation(this._authored.rotation),delete this._authored.rotation))}get rotation(){return this._rotation}set scale(e){this._scale=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.scale??=t.getLocalScale().clone(),t.setLocalScale(e)):this._authored.scale&&(t.setLocalScale(this._authored.scale),delete this._authored.scale))}get scale(){return this._scale}set tags(e){this._tags=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.tags??=t.tags.list().slice(),t.tags.clear(),t.tags.add(e)):this._authored.tags&&(t.tags.clear(),t.tags.add(this._authored.tags),delete this._authored.tags))}get tags(){return this._tags}set materialOverrides(e){this._materialOverrides=null===e?null:Object.freeze({...e}),"bound"===this._state&&this._applyMaterialOverrides()}get materialOverrides(){return this._materialOverrides}static get observedAttributes(){return["enabled","index","material-overrides","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"enabled":this.enabled=null===s?null:Qt(s,!0);break;case"index":if(null===s)this.index=null;else{const e=""===s.trim()?NaN:Number(s);!Number.isInteger(e)||e<0?(console.warn(`pc-node index '${s}' is not a non-negative integer - treated as absent`),this.index=null):this.index=e}break;case"material-overrides":this.materialOverrides=null===s?null:((e,t)=>{let i;try{i=JSON.parse(e)}catch(e){return console.warn(`${t} material-overrides is not valid JSON - treated as absent: ${e.message}`),null}return null===i||"object"!=typeof i||Array.isArray(i)?(console.warn(`${t} material-overrides must be a JSON object - treated as absent`),null):i})(s,`pc-node '${this._name}'`);break;case"name":this.name=s??"";break;case"position":this.position=null===s?null:ti(s,i.ZERO,e);break;case"rotation":this.rotation=null===s?null:ti(s,i.ZERO,e);break;case"scale":this.scale=null===s?null:ti(s,i.ONE,e);break;case"tags":this.tags=null===s?null:Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-node",ys);class ks extends Ht{_exposure=1;_fog="none";_fogColor=new s(1,1,1);_fogDensity=0;_fogStart=0;_fogEnd=1e3;_gravity=new i(0,-9.81,0);_scene=null;get scene(){return this._scene}async connectedCallback(){const e=this.closestApp;if(!e)return void console.warn("pc-scene must be a descendant of pc-app - scene settings not applied");if(await e.ready(),!this.isConnected||this.closestApp!==e)return;const t=e.app;t&&(this._scene=t.scene,this._updateSceneSettings(),this._onReady())}disconnectedCallback(){this._scene=null,this._resetReady()}_updateSceneSettings(){this._scene&&(this._scene.exposure=this._exposure,this._scene.fog.type=this._fog,this._scene.fog.color=this._fogColor,this._scene.fog.density=this._fogDensity,this._scene.fog.start=this._fogStart,this._scene.fog.end=this._fogEnd,this._applyGravity(this._gravity))}_applyGravity(e){this.closestApp?.app?.systems.rigidbody?.gravity.copy(e)}set exposure(e){this._exposure=e,this.scene&&(this.scene.exposure=e)}get exposure(){return this._exposure}set fog(e){this._fog=e,this.scene&&(this.scene.fog.type=e)}get fog(){return this._fog}set fogColor(e){this._fogColor=e,this.scene&&(this.scene.fog.color=e)}get fogColor(){return this._fogColor}set fogDensity(e){this._fogDensity=e,this.scene&&(this.scene.fog.density=e)}get fogDensity(){return this._fogDensity}set fogStart(e){this._fogStart=e,this.scene&&(this.scene.fog.start=e)}get fogStart(){return this._fogStart}set fogEnd(e){this._fogEnd=e,this.scene&&(this.scene.fog.end=e)}get fogEnd(){return this._fogEnd}set gravity(e){this._gravity=e,this._scene&&this._applyGravity(e)}get gravity(){return this._gravity}static get observedAttributes(){return["exposure","fog","fog-color","fog-density","fog-start","fog-end","gravity"]}attributeChangedCallback(e,t,a){switch(e){case"exposure":this.exposure=Jt(a,1,e);break;case"fog":this.fog=Nt(a,["none","linear","exp","exp2"],"none",e);break;case"fog-color":this.fogColor=Xt(a,s.WHITE,e);break;case"fog-density":this.fogDensity=Jt(a,0,e);break;case"fog-start":this.fogStart=Jt(a,0,e);break;case"fog-end":this.fogEnd=Jt(a,1e3,e);break;case"gravity":this.gravity=ti(a,new i(0,-9.81,0),e)}}}customElements.define("pc-scene",ks);class ws extends Ht{_asset="";_center=new i(0,.01,0);_intensity=1;_rotation=new i;_mipLevel=0;_lighting=!1;_scale=new i(100,100,100);_type="infinite";_scene=null;_appElement=null;_loadGeneration=0;_loadHandle=null;connectedCallback(){this._loadSkybox(),this._onReady()}disconnectedCallback(){this._loadGeneration++,this._detachLoadHandler(),this._unloadSkybox(),this._appElement=null,this._resetReady()}_detachLoadHandler(){this._loadHandle?.off(),this._loadHandle=null}_generateSkybox(e){if(!this._scene)return;const t=e.resource,i=Tt.generateSkyboxCubemap(t);if(this._scene.skybox?.destroy(),this._scene.skybox=i,this._lighting){const e=Tt.generateLightingSource(t),i=Tt.generateAtlas(e);e.destroy(),this._scene.envAtlas?.destroy(),this._scene.envAtlas=i}const s=this._scene.layers.getLayerById(Dt);s&&(s.enabled="none"!==this._type),this._scene.sky.type=this._type,this._scene.sky.node.setLocalScale(this._scale),this._scene.sky.center=this._center,this._scene.skyboxIntensity=this._intensity,this._scene.skyboxMip=this._mipLevel}async _loadSkybox(){const e=++this._loadGeneration;this._detachLoadHandler();const t=await(this.closestApp?.ready());if(e!==this._loadGeneration)return;const i=t?.app;if(!t||!i)return;this._appElement=t;const s=ki(this._asset);s&&(this._scene=i.scene,s.loaded?this._generateSkybox(s):this._loadHandle=s.once("load",()=>{this._loadHandle=null,e===this._loadGeneration&&this._generateSkybox(s)}))}_unloadSkybox(){const e=this._scene;e&&(this._scene=null,this._appElement?.app&&(e.skybox?.destroy(),e.skybox=null,e.envAtlas?.destroy(),e.envAtlas=null))}set asset(e){this._asset=e,this.isConnected&&this._loadSkybox()}get asset(){return this._asset}set center(e){this._center=e,this._scene&&(this._scene.sky.center=this._center)}get center(){return this._center}set intensity(e){this._intensity=e,this._scene&&(this._scene.skyboxIntensity=this._intensity)}get intensity(){return this._intensity}set lighting(e){this._lighting=e}get lighting(){return this._lighting}set mipLevel(e){this._mipLevel=e,this._scene&&(this._scene.skyboxMip=this._mipLevel)}get mipLevel(){return this._mipLevel}set rotation(e){this._rotation=e,this._scene&&(this._scene.skyboxRotation=(new n).setFromEulerAngles(e))}get rotation(){return this._rotation}set scale(e){this._scale=e,this._scene&&this._scene.sky.node.setLocalScale(this._scale)}get scale(){return this._scale}set type(e){if(this._type=e,this._scene){this._scene.sky.type=this._type;const e=this._scene.layers.getLayerById(Dt);e&&(e.enabled="none"!==this._type)}}get type(){return this._type}static get observedAttributes(){return["asset","center","intensity","lighting","mip-level","rotation","scale","type"]}attributeChangedCallback(e,t,s){switch(e){case"asset":this.asset=s??"";break;case"center":this.center=ti(s,new i(0,.01,0),e);break;case"intensity":this.intensity=Jt(s,1,e);break;case"lighting":this.lighting=Qt(s,!1);break;case"mip-level":this.mipLevel=Jt(s,0,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,new i(100,100,100),e);break;case"type":this.type=Nt(s,["box","dome","infinite","none"],"infinite",e)}}}customElements.define("pc-sky",ws);export{Ci as AnimClipElement,Si as AnimComponentElement,oi as AppElement,yi as AssetElement,Ht as AsyncElement,Ai as AudioListenerComponentElement,Ei as ButtonComponentElement,Oi as CameraComponentElement,Li as CollisionComponentElement,xi as ComponentElement,zi as ElementComponentElement,Wt as EntityBaseElement,ci as EntityElement,li as EntityOwnerElement,vs as GSplatComponentElement,Ti as JointComponentElement,Di as LayoutChildComponentElement,Bi as LayoutGroupComponentElement,Ui as LightComponentElement,Zi as MaterialElement,Mi as ModelElement,ys as NodeElement,qi as ParticleSystemComponentElement,Vi as RenderComponentElement,es as RigidBodyComponentElement,ks as SceneElement,is as ScreenComponentElement,gs as ScriptComponentElement,ls as ScriptInstanceElement,rs as ScrollViewComponentElement,as as ScrollbarComponentElement,ws as SkyElement,_s as SoundComponentElement,fs as SoundSlotElement,Bt as WasmElement,Gt as whenReady};
|
|
1
|
+
import{basisInitialize as e,WasmModule as t,Vec3 as i,Color as s,Vec4 as a,Quat as n,Vec2 as r,Picker as o,MeshInstance as l,createGraphicsDevice as c,AppOptions as h,Keyboard as p,Mouse as b,ElementInput as d,AnimComponentSystem as m,AnimationComponentSystem as u,AudioListenerComponentSystem as g,ButtonComponentSystem as _,CameraComponentSystem as f,CollisionComponentSystem as v,ElementComponentSystem as y,GSplatComponentSystem as k,JointComponentSystem as w,LayoutChildComponentSystem as M,LayoutGroupComponentSystem as x,LightComponentSystem as S,ModelComponentSystem as C,ParticleSystemComponentSystem as A,RenderComponentSystem as F,RigidBodyComponentSystem as E,ScreenComponentSystem as R,ScriptComponentSystem as j,ScrollbarComponentSystem as O,ScrollViewComponentSystem as z,SoundComponentSystem as L,SpriteComponentSystem as T,ZoneComponentSystem as D,AnimClipHandler as B,AnimationHandler as P,AnimStateGraphHandler as G,AudioHandler as U,BinaryHandler as H,CssHandler as q,ContainerHandler as W,CubemapHandler as $,FolderHandler as Y,FontHandler as I,GSplatHandler as K,HierarchyHandler as Q,HtmlHandler as X,JsonHandler as N,MaterialHandler as J,ModelHandler as Z,RenderHandler as V,ScriptHandler as ee,SceneHandler as te,ShaderHandler as ie,SpriteHandler as se,TemplateHandler as ae,TextHandler as ne,TextureAtlasHandler as re,TextureHandler as oe,SoundManager as le,Lightmapper as ce,BatchManager as he,XrManager as pe,AppBase as be,FILLMODE_NONE as de,RESOLUTION_AUTO as me,Entity as ue,Asset as ge,SPRITE_RENDERMODE_SIMPLE as _e,FILTER_LINEAR_MIPMAP_LINEAR as fe,FILTER_LINEAR as ve,ADDRESS_REPEAT as ye,SPRITE_RENDERMODE_SLICED as ke,SPRITE_RENDERMODE_TILED as we,ADDRESS_CLAMP_TO_EDGE as Me,ADDRESS_MIRRORED_REPEAT as xe,FILTER_NEAREST as Se,FILTER_NEAREST_MIPMAP_NEAREST as Ce,FILTER_LINEAR_MIPMAP_NEAREST as Ae,FILTER_NEAREST_MIPMAP_LINEAR as Fe,AnimTrack as Ee,ANIM_CONTROL_STATES as Re,BUTTON_TRANSITION_MODE_TINT as je,BUTTON_TRANSITION_MODE_SPRITE_CHANGE as Oe,TONEMAP_NONE as ze,PROJECTION_PERSPECTIVE as Le,GAMMA_SRGB as Te,GAMMA_NONE as De,XRTYPE_AR as Be,XRTYPE_VR as Pe,TONEMAP_LINEAR as Ge,TONEMAP_FILMIC as Ue,TONEMAP_HEJL as He,TONEMAP_ACES as qe,TONEMAP_ACES2 as We,TONEMAP_NEUTRAL as $e,PROJECTION_ORTHOGRAPHIC as Ye,ORIENTATION_HORIZONTAL as Ie,FITTING_NONE as Ke,FITTING_STRETCH as Qe,FITTING_SHRINK as Xe,FITTING_BOTH as Ne,ORIENTATION_VERTICAL as Je,SHADOW_PCF3_32F as Ze,SHADOW_PCF1_16F as Ve,SHADOW_PCF1_32F as et,SHADOW_PCF3_16F as tt,SHADOW_PCF5_16F as it,SHADOW_PCF5_32F as st,SHADOW_VSM_16F as at,SHADOW_VSM_32F as nt,SHADOW_PCSS_32F as rt,StandardMaterial as ot,BLEND_NONE as lt,CULLFACE_BACK as ct,FRESNEL_SCHLICK as ht,SPECOCC_AO as pt,BLEND_NORMAL as bt,BLEND_ADDITIVE as dt,BLEND_ADDITIVEALPHA as mt,BLEND_PREMULTIPLIED as ut,BLEND_MULTIPLICATIVE as gt,BLEND_MULTIPLICATIVE2X as _t,BLEND_SCREEN as ft,BLEND_MIN as vt,BLEND_MAX as yt,BLEND_SUBTRACTIVE as kt,CULLFACE_NONE as wt,CULLFACE_FRONT as Mt,CULLFACE_FRONTANDBACK as xt,FRESNEL_NONE as St,SPECOCC_NONE as Ct,SPECOCC_GLOSSDEPENDENT as At,SCALEMODE_NONE as Ft,SCALEMODE_BLEND as Et,SCROLL_MODE_BOUNCE as Rt,SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED as jt,SCROLLBAR_VISIBILITY_SHOW_ALWAYS as Ot,SCROLL_MODE_CLAMP as zt,SCROLL_MODE_INFINITE as Lt,EnvLighting as Tt,LAYERID_SKYBOX as Dt}from"playcanvas";class Bt extends HTMLElement{_readyPromise;_readyResolve;_readyResolved=!1;constructor(){super(),this._readyPromise=new Promise(e=>{this._readyResolve=e})}get closestApp(){return this.parentElement?.closest("pc-app")??null}get closestEntity(){return this.parentElement?.closest("pc-entity, pc-model, pc-node")??null}_onReady(){this._readyResolved||(this._readyResolved=!0,this._readyResolve(),this.dispatchEvent(new CustomEvent("ready",{bubbles:!0,composed:!0})))}_resetReady(){this._readyResolved&&(this._readyResolved=!1,this._readyPromise=new Promise(e=>{this._readyResolve=e}))}ready(){return this._readyPromise.then(()=>this)}}async function Pt(e){let t;if("string"==typeof e){"loading"===document.readyState&&await new Promise(e=>{document.addEventListener("DOMContentLoaded",e,{once:!0})});try{t=document.querySelector(e)}catch{throw new Error(`whenReady: '${e}' is not a valid CSS selector`)}if(!t)throw new Error(`whenReady: no element found matching '${e}'`)}else t=e;if(!(t instanceof Bt)){const i=t instanceof Element?`<${t.tagName.toLowerCase()}>`:String(e);throw new Error(`whenReady: ${i} does not initialize asynchronously`)}return await t.ready(),t}class Gt extends Bt{_loadPromise=null;connectedCallback(){this._getLoadPromise()}async _loadModule(){const i=this.getAttribute("name");if(!i)return void console.warn("pc-wasm requires a 'name' attribute - no module was configured");const s={glueUrl:this.getAttribute("glue")??void 0,wasmUrl:this.getAttribute("wasm")??void 0,fallbackUrl:this.getAttribute("fallback")??void 0};"Basis"===i?e(s):(t.setConfig(i,s),await new Promise(e=>{t.getInstance(i,()=>e())})),this._onReady()}_getLoadPromise(){return this._loadPromise||(this._loadPromise=this._loadModule()),this._loadPromise}}customElements.define("pc-wasm",Gt);const Ut=["pointerenter","pointerleave","pointerdown","pointerup","pointermove","click"],Ht=new Set(Ut),qt=Ut.map(e=>`on${e}`);class Wt extends Bt{_entity=null;_appElement=null;_listeners={};_inlineHandlerTypes=new Set;get entity(){return this._entity}_registerEntity(e){this._appElement=this.closestApp,this._appElement?._registerEntityElement(e,this)}_unregisterEntity(e){this._appElement?._unregisterEntityElement(e),this._appElement=null}_updateInlineHandler(e,t){const i=e.substring(2),s=this._inlineHandlerTypes.has(i),a=null!==t;a&&!s?(this._inlineHandlerTypes.add(i),this.dispatchEvent(new CustomEvent(`${i}:connect`,{bubbles:!0}))):!a&&s&&(this._inlineHandlerTypes.delete(i),this.dispatchEvent(new CustomEvent(`${i}:disconnect`,{bubbles:!0})))}addEventListener(e,t,i){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),super.addEventListener(e,t,i),Ht.has(e)&&this.dispatchEvent(new CustomEvent(`${e}:connect`,{bubbles:!0}))}removeEventListener(e,t,i){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(e=>e!==t)),super.removeEventListener(e,t,i),Ht.has(e)&&this.dispatchEvent(new CustomEvent(`${e}:disconnect`,{bubbles:!0}))}_hasListeners(e){return Boolean(this._listeners[e]?.length)||this._inlineHandlerTypes.has(e)}}class $t{_track;_fill;_sweep=null;_removal=null;constructor(e){this._track=document.createElement("div"),this._track.setAttribute("role","progressbar"),this._track.setAttribute("aria-label","Loading"),this._track.setAttribute("aria-valuemin","0"),this._track.setAttribute("aria-valuemax","100"),this._track.style.cssText=["position: absolute","top: 0","left: 0","width: 100%","height: var(--pc-loading-bar-height, 3px)","background: var(--pc-loading-bar-background, rgba(0, 0, 0, 0.1))","z-index: 10000","pointer-events: none","opacity: 1","transition: opacity 0.2s ease"].join("; "),this._fill=document.createElement("div"),this._fill.style.cssText=["width: 100%","height: 100%","transform-origin: left center","transform: scaleX(0)","background: var(--pc-loading-bar-color, #f60)","transition: transform 0.2s ease"].join("; "),this._track.appendChild(this._fill),e.appendChild(this._track),"function"==typeof this._fill.animate&&(this._sweep=this._fill.animate([{transform:"scaleX(0.25) translateX(-100%)"},{transform:"scaleX(0.25) translateX(500%)"}],{duration:1e3,iterations:1/0,easing:"ease-in-out"}))}progress(e,t){this._sweep&&(this._sweep.cancel(),this._sweep=null);const i=0===t?1:e/t;this._track.setAttribute("aria-valuenow",String(Math.round(100*i))),this._fill.style.transform=`scaleX(${i})`}complete(){null===this._removal&&(this._sweep&&(this._sweep.cancel(),this._sweep=null),this._track.setAttribute("aria-valuenow","100"),this._fill.style.transform="scaleX(1)",this._track.style.opacity="0",this._removal=setTimeout(()=>this._track.remove(),250))}destroy(){this._sweep&&(this._sweep.cancel(),this._sweep=null),null!==this._removal&&(clearTimeout(this._removal),this._removal=null),this._track.remove()}}const Yt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},It=(e,t)=>{const i=e.trim().split(/\s+/).map(Number);return i.length!==t||i.some(e=>!Number.isFinite(e))?null:i},Kt=e=>null===e?null:e.clone(),Qt=(e,t)=>null===e?t:"false"!==e,Xt=(e,t,i)=>{if(null===e)return Kt(t);const a=Yt[e.toLowerCase()];if(a)return(new s).fromString(a);if(/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)){let t=e.slice(1);return 3!==t.length&&4!==t.length||(t=t.split("").map(e=>e+e).join("")),(new s).fromString(`#${t}`)}const n=It(e,4)??It(e,3);return n?new s(n):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected a CSS color name, a hex color or 3 or 4 space-separated numbers. Using '${t}'.`),Kt(t))},Nt=(e,t,i,s)=>{if(null===e)return i;const a=Array.isArray(t)?t:[...t.keys()];return a.includes(e)?e:(console.warn(`Invalid value '${e}' for attribute '${s}'. Valid values: ${a.join(", ")}. Using '${i}'.`),i)},Jt=(e,t,i)=>{if(null===e)return t;const s=""===e.trim()?NaN:Number(e);return Number.isFinite(s)?s:(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected a finite number. Using '${t}'.`),t)},Zt=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,3);return s?(new n).setFromEulerAngles(s[0],s[1],s[2]):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 3 space-separated numbers. Using '${t}'.`),Kt(t))},Vt=(e,t=[])=>null===e?[...t]:e.split(",").map(e=>e.trim()).filter(e=>""!==e),ei=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,2);return s?new r(s):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 2 space-separated numbers. Using '${t}'.`),Kt(t))},ti=(e,t,s)=>{if(null===e)return Kt(t);const a=It(e,3);return a?new i(a):(console.warn(`Invalid value '${e}' for attribute '${s}'. Expected 3 space-separated numbers. Using '${t}'.`),Kt(t))},ii=(e,t,i)=>{if(null===e)return Kt(t);const s=It(e,4);return s?new a(s):(console.warn(`Invalid value '${e}' for attribute '${i}'. Expected 4 space-separated numbers. Using '${t}'.`),Kt(t))},si=["pointerenter","pointerleave","pointermove"],ai={pointermove:["pointermove"],pointerenter:["pointermove"],pointerleave:["pointermove"],pointerdown:["pointerdown"],pointerup:["pointerup"],click:["pointerdown","pointerup","pointercancel"]};class ni{_host;_generation=0;_app=null;_canvas=null;_picker=null;_hoveredEntity=null;_pickToken=0;_pointerHandlers={pointermove:null,pointerdown:null,pointerup:null,pointercancel:null};_downPicks=new Map;_clickListened=!1;_lastClick=null;_dispatchChain=Promise.resolve();constructor(e){this._host=e}connect(e,t){this._generation++,this._app=e,this._canvas=t;const{width:i,height:s}=e.graphicsDevice;this._picker=new o(e,i,s);const a=e=>t=>{e.call(this,t)};this._pointerHandlers.pointermove=a(this._onPointerMove),this._pointerHandlers.pointerdown=a(this._onPointerDown),this._pointerHandlers.pointerup=a(this._onPointerUp),this._pointerHandlers.pointercancel=e=>{this._downPicks.delete(e.pointerId)},this.syncListeners()}disconnect(){this._generation++,this._canvas&&Object.entries(this._pointerHandlers).forEach(([e,t])=>{t&&this._canvas.removeEventListener(e,t)}),this._app=null,this._canvas=null,this._picker=null,this._hoveredEntity=null,this._pointerHandlers={pointermove:null,pointerdown:null,pointerup:null,pointercancel:null},this._downPicks.clear(),this._clickListened=!1,this._lastClick=null,this._dispatchChain=Promise.resolve()}resize(e,t){this._picker?.resize(e,t)}syncListeners(){const e=this._canvas;if(!e)return;const t=this._host.pointerTargets(),i=new Set;for(const e of Ut)t.some(t=>t._hasListeners(e))&&ai[e].forEach(e=>i.add(e));this._clickListened=t.some(e=>e._hasListeners("click")),Object.entries(this._pointerHandlers).forEach(([t,s])=>{s&&(i.has(t)?e.addEventListener(t,s):e.removeEventListener(t,s))})}_hoverTarget(e){for(;null!==e;){const t=this._host.elementFromNode(e);if(t&&si.some(e=>t._hasListeners(e)))return t;e=e.parent}return null}_elementWithListener(e,t){for(;null!==e;){const i=this._host.elementFromNode(e);if(i?._hasListeners(t))return i;e=e.parent}return null}_getPickerCoordinates(e,t){const i=t.getBoundingClientRect();if(0===i.width||0===i.height)return{x:e.clientX,y:e.clientY,mapped:!1};const s=t.width/i.width,a=t.height/i.height;return{x:(e.clientX-i.left)*s,y:(e.clientY-i.top)*a,mapped:!0}}_cameraContains(e,t,i,s){const a=e.rect,n=a.x*s.width,r=(1-a.y)*s.height,o=r-a.w*s.height;return t>=n&&t<n+a.z*s.width&&i>=o&&i<r}async _pickNode(e){const t=this._generation,i=this._app,s=this._picker,a=this._canvas;if(!i||!s||!a)return null;const{x:n,y:r,mapped:o}=this._getPickerCoordinates(e,a),c=i.systems.camera?.cameras??[];for(let e=c.length-1;e>=0;e--){const h=c.at(e);if(!h||h.renderTarget)continue;if(o&&!this._cameraContains(h,n,r,a))continue;s.prepare(h,i.scene);const p=await s.getSelectionAsync(n,r);if(t!==this._generation)return null;if(p.length>0){const e=p[0];return e instanceof l?e.node:e.entity}if(h.clearColorBuffer)return null}return null}async _onPointerMove(e){if(!this._picker||!this._app)return;const t=this._generation,i=++this._pickToken,s=await this._pickNode(e);if(i!==this._pickToken||t!==this._generation)return;const a=this._hoverTarget(s);this._hoveredEntity!==a&&(this._hoveredEntity&&this._hoveredEntity._hasListeners("pointerleave")&&this._hoveredEntity.dispatchEvent(new PointerEvent("pointerleave",e)),a&&a._hasListeners("pointerenter")&&a.dispatchEvent(new PointerEvent("pointerenter",e))),this._hoveredEntity=a,a&&a._hasListeners("pointermove")&&a.dispatchEvent(new PointerEvent("pointermove",e))}_chainDispatch(e){this._dispatchChain=this._dispatchChain.then(e).catch(e=>{console.error(e)})}_onPointerDown(e){if(!this._picker||!this._app)return;const t=this._generation,i=this._pickNode(e);this._clickListened&&0===e.button&&this._downPicks.set(e.pointerId,i),this._chainDispatch(async()=>{const s=await i;if(t!==this._generation)return;const a=this._elementWithListener(s,"pointerdown");a&&a.dispatchEvent(new PointerEvent("pointerdown",e))})}_onPointerUp(e){if(!this._picker||!this._app)return;const t=this._generation,i=this._downPicks.get(e.pointerId);this._downPicks.delete(e.pointerId);const s=this._pickNode(e);this._chainDispatch(async()=>{const i=await s;if(t!==this._generation)return;const a=this._elementWithListener(i,"pointerup");a&&a.dispatchEvent(new PointerEvent("pointerup",e))}),i&&0===e.button&&this._chainDispatch(async()=>{const a=await Promise.all([i,s]).catch(()=>null);if(!a||t!==this._generation)return;const[n,r]=a,o=this._elementWithListener(((e,t)=>{const i=new Set;for(let t=e;null!==t;t=t.parent)i.add(t);for(let e=t;null!==e;e=e.parent)if(i.has(e))return e;return null})(n,r),"click");if(o){const t=new PointerEvent("click",e),i=performance.now(),s=this._lastClick,a=s&&s.element===o&&i-s.time<=500?s.count+1:1;this._lastClick={element:o,time:i,count:a},Object.defineProperty(t,"detail",{value:a}),o.dispatchEvent(t)}})}}class ri extends Bt{_canvas=null;_alpha=!0;_backend="webgpu";_antialias=!0;_depthBuffer=!0;_stencilBuffer=!0;_maxPixelRatio=1/0;_loadingBar=!0;_optionsLocked=!1;_bar=null;_hierarchyReady=!1;_bootGeneration=0;_entityElements=new Map;_pointer=new ni({elementFromNode:e=>this._entityElements.get(e)??null,pointerTargets:()=>Array.from(this.querySelectorAll("pc-entity, pc-model, pc-node"))});_app=null;_loadProgress=0;_resizeObserver=null;get app(){return this._app}get loadProgress(){return this._loadProgress}constructor(){super(),Ut.forEach(e=>{this.addEventListener(`${e}:connect`,()=>this._pointer.syncListeners()),this.addEventListener(`${e}:disconnect`,()=>this._pointer.syncListeners())})}async connectedCallback(){const e=++this._bootGeneration;(()=>{const e="pc-app-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=":where(pc-app) { display: block; position: relative; width: 300px; height: 150px; }",document.head.appendChild(t)})(),this._loadingBar&&!this._bar&&(this._bar=new $t(this)),customElements.upgrade(this);const t=this.querySelectorAll(":scope > pc-wasm");if(await Promise.all(Array.from(t).map(e=>e._getLoadPromise())),e!==this._bootGeneration)return;this._canvas=document.createElement("canvas"),this._canvas.style.cssText="display: block; width: 100%; height: 100%; touch-action: none;",this.appendChild(this._canvas);const i={webgpu:["webgpu","webgl2"],webgl2:["webgl2"],null:["null"]}[this._backend]||[];this._optionsLocked=!0;const s=i.join(", ");let a;try{a=await c(this._canvas,{alpha:this._alpha,antialias:this._antialias,depth:this._depthBuffer,deviceTypes:i,stencil:this._stencilBuffer})}catch(t){if(e!==this._bootGeneration)return;this._canvas&&this.contains(this._canvas)&&this.removeChild(this._canvas),this._canvas=null,this._bar?.destroy(),this._bar=null;const i=`pc-app failed to create a graphics device (${s}) - ${t instanceof Error?t.message:String(t)}`;return console.error(i,t),void this.dispatchEvent(new ErrorEvent("error",{message:i,error:t}))}if(e!==this._bootGeneration)return void a.destroy();a.maxPixelRatio=this._maxPixelRatio;const n=new h;n.graphicsDevice=a,n.keyboard=new p(window),n.mouse=new b(this._canvas),n.elementInput=new d(this._canvas,{useMouse:!0,useTouch:!0}),n.componentSystems=[m,u,g,_,f,v,y,k,w,M,x,S,C,A,F,E,R,j,O,z,L,T,D],n.resourceHandlers=[B,P,G,U,H,q,W,$,Y,I,K,Q,X,N,J,Z,V,ee,te,ie,se,ae,ne,re,oe],n.soundManager=new le,n.lightmapper=ce,n.batchManager=he,n.xr=pe;const r=new be(this._canvas);this._app=r,r.init(n),r.setCanvasFillMode(de),r.setCanvasResolution(me),this._pointer.connect(r,this._canvas),"undefined"!=typeof ResizeObserver&&(this._resizeObserver=new ResizeObserver(()=>this._syncCanvasSize()),this._resizeObserver.observe(this));const o=this.querySelectorAll(":scope > pc-asset");for(const t of Array.from(o)){t._createAsset();const i=t.asset;if(i&&(r.assets.add(i),e!==this._bootGeneration))return}const l=this.querySelectorAll(":scope > pc-material");Array.from(l).forEach(e=>{e._createMaterial()});const ue=this.querySelectorAll("pc-entity, pc-model");if(Array.from(ue).forEach(e=>{e._createEntity(r)}),ue.forEach(e=>{e._buildHierarchy(r)}),e!==this._bootGeneration)return;this._hierarchyReady=!0;const ge=r.assets.list({preload:!0}).length;let _e=0;const fe=()=>{_e+=1,this._loadProgress=_e/ge,this._bar?.progress(_e,ge),this.dispatchEvent(new ProgressEvent("progress",{lengthComputable:!0,loaded:_e,total:ge}))};r.on("preload:progress",fe),this._loadProgress=0===ge?1:0,this._bar?.progress(0,ge),this.dispatchEvent(new ProgressEvent("progress",{lengthComputable:!0,loaded:0,total:ge})),e===this._bootGeneration&&r.preload(()=>{e===this._bootGeneration&&(r.off("preload:progress",fe),this._loadProgress=1,r.start(),r.once("frameend",()=>this._bar?.complete()),this._onReady())})}disconnectedCallback(){this._bootGeneration++,this._optionsLocked=!1,this._pointer.disconnect(),this._app&&(this._app.destroy(),this._app=null),this._entityElements.clear(),this._loadProgress=0,this._bar?.destroy(),this._bar=null,this._hierarchyReady=!1,this._resetReady(),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._canvas&&this.contains(this._canvas)&&(this.removeChild(this._canvas),this._canvas=null)}_syncCanvasSize(){if(!this.app||this.app.xr?.active)return;this.app.updateCanvasSize();const{width:e,height:t}=this.app.graphicsDevice;this._pointer.resize(e,t)}_registerEntityElement(e,t){this._entityElements.set(e,t)}_unregisterEntityElement(e){this._entityElements.delete(e)}elementFromEntity(e){return this._entityElements.get(e)??null}_warnIfBooted(e){this._optionsLocked&&console.warn(`Attribute '${e}' on <pc-app> is only read when the application boots, so this change has no effect. Set it before the element is connected, or remove and re-insert the element to reboot with the new value.`)}set alpha(e){this._warnIfBooted("alpha"),this._alpha=e}get alpha(){return this._alpha}set antialias(e){this._warnIfBooted("antialias"),this._antialias=e}get antialias(){return this._antialias}set backend(e){this._warnIfBooted("backend"),this._backend=e}get backend(){return this._backend}set depthBuffer(e){this._warnIfBooted("depth-buffer"),this._depthBuffer=e}get depthBuffer(){return this._depthBuffer}set loadingBar(e){this._loadingBar=e,!e&&this._bar&&(this._bar.destroy(),this._bar=null)}get loadingBar(){return this._loadingBar}set maxPixelRatio(e){this._maxPixelRatio=e,this.app&&(this.app.graphicsDevice.maxPixelRatio=e,this._syncCanvasSize())}get maxPixelRatio(){return this._maxPixelRatio}set stencilBuffer(e){this._warnIfBooted("stencil-buffer"),this._stencilBuffer=e}get stencilBuffer(){return this._stencilBuffer}static get observedAttributes(){return["alpha","antialias","backend","depth-buffer","loading-bar","max-pixel-ratio","stencil-buffer"]}attributeChangedCallback(e,t,i){switch(e){case"alpha":this.alpha=Qt(i,!0);break;case"antialias":this.antialias=Qt(i,!0);break;case"backend":this.backend=Nt(i,["webgpu","webgl2","null"],"webgpu",e);break;case"depth-buffer":this.depthBuffer=Qt(i,!0);break;case"loading-bar":this.loadingBar=Qt(i,!0);break;case"max-pixel-ratio":this.maxPixelRatio=Jt(i,1/0,e);break;case"stencil-buffer":this.stencilBuffer=Qt(i,!0)}}}customElements.define("pc-app",ri);const oi=(e,t)=>{const i=Array.from(e.querySelectorAll("pc-entity, pc-model")).filter(e=>e instanceof li);i.forEach(e=>e._createEntity(t)),i.forEach(e=>e._buildHierarchy(t))};class li extends Wt{_enabled=!0;_name="Untitled";_position=new i;_rotation=new i;_scale=new i(1,1,1);_tags=[];_built=!1;_createEntity(e){if(this._entity)return;const t=new ue(this._name,e);this._entity=t,t.enabled=this._enabled,t.setLocalPosition(this._position),t.setLocalEulerAngles(this._rotation),t.setLocalScale(this._scale),this._tags.length>0&&t.tags.add(this._tags),this._registerEntity(t),t.once("destroy",this._onEntityDestroy,this)}_onEntityDestroy(e){this._unregisterEntity(e),this._entity=null,this._built=!1,this._resetReady()}_buildHierarchy(e){if(!this.entity||this._built)return;const t=this.closestEntity;t&&!t.entity||t instanceof li&&!t._built||(this._built=!0,t?.entity?t.entity.addChild(this.entity):e.root.addChild(this.entity),this._onBuilt())}_onBuilt(){this._onReady()}set enabled(e){this._enabled=e,this.entity&&(this.entity.enabled=e)}get enabled(){return this._enabled}set name(e){this._name=e,this.entity&&(this.entity.name=e)}get name(){return this._name}set position(e){this._position=e,this.entity&&this.entity.setLocalPosition(this._position)}get position(){return this._position}set rotation(e){this._rotation=e,this.entity&&this.entity.setLocalEulerAngles(this._rotation)}get rotation(){return this._rotation}set scale(e){this._scale=e,this.entity&&this.entity.setLocalScale(this._scale)}get scale(){return this._scale}set tags(e){this._tags=e,this.entity&&(this.entity.tags.clear(),this.entity.tags.add(this._tags))}get tags(){return this._tags}}class ci extends li{connectedCallback(){const e=this.closestApp;if(!e){const e=this.getAttribute("name"),t=e?` '${e}'`:"";return void console.warn(`pc-entity${t} must be a descendant of pc-app - entity not created`)}if(e._hierarchyReady){const t=e.app;this._createEntity(t),this._buildHierarchy(t),this._built&&oi(this,t)}}disconnectedCallback(){this._entity?.destroy()}static get observedAttributes(){return["enabled","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"enabled":this.enabled=Qt(s,!0);break;case"name":this.name=s??"Untitled";break;case"position":this.position=ti(s,i.ZERO,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,i.ONE,e);break;case"tags":this.tags=Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-entity",ci);var hi=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,s=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(n(s),{}).then(function(e){(i=e.instance).exports.__wasm_call_ctors()});function n(e){for(var i=new Uint8Array(e.length),s=0;s<e.length;++s){var a=e.charCodeAt(s);i[s]=a>96?a-97:a>64?a-39:a+4}var n=0;for(s=0;s<e.length;++s)i[n++]=i[s]<60?t[i[s]]:64*(i[s]-60)+i[++s];return i.buffer.slice(0,n)}function r(e,t,s,a,n,r){var o=i.exports.sbrk,l=s+3&-4,c=o(l*a),h=o(n.length),p=new Uint8Array(i.exports.memory.buffer);p.set(n,h);var b=e(c,s,a,h,n.length);if(0==b&&r&&r(c,l,a),t.set(p.subarray(c,c+s*a)),o(c-o(0)),0!=b)throw new Error("Malformed buffer data: "+b)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}function b(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(n(s))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+r.toString()+d.toString(),i=new Blob([t],{type:"text/javascript"}),a=URL.createObjectURL(i),o=0;o<e;++o)c[o]=p(a);URL.revokeObjectURL(a)}function d(e){a.then(function(){var t=e.data;try{var s=new Uint8Array(t.count*t.size);r(i.exports[t.mode],s,t.count,t.size,t.source,i.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:s},[s.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:a,supported:!0,useWorkers:function(e){b(e)},decodeVertexBuffer:function(e,t,s,a,n){r(i.exports.meshopt_decodeVertexBuffer,e,t,s,a,i.exports[o[n]])},decodeIndexBuffer:function(e,t,s,a){r(i.exports.meshopt_decodeIndexBuffer,e,t,s,a)},decodeIndexSequence:function(e,t,s,a){r(i.exports.meshopt_decodeIndexSequence,e,t,s,a)},decodeGltfBuffer:function(e,t,s,a,n,c){r(i.exports[l[n]],e,t,s,a,i.exports[o[c]])},decodeGltfBufferAsync:function(e,t,s,n,p){return c.length>0?function(e,t,i,s,a){for(var n=c[0],r=1;r<c.length;++r)c[r].pending<n.pending&&(n=c[r]);return new Promise(function(r,o){var l=new Uint8Array(i),c=h++;n.pending+=e,n.requests[c]={resolve:r,reject:o},n.object.postMessage({id:c,count:e,size:t,source:l,mode:s,filter:a},[l.buffer])})}(e,t,s,l[n],o[p]):a.then(function(){var a=new Uint8Array(e*t);return r(i.exports[l[n]],a,e,t,s,i.exports[o[p]]),a})}}}();const pi=new Map([["simple",_e],["sliced",ke],["tiled",we]]),bi=new Map([["repeat",ye],["clamp",Me],["mirror",xe]]),di=new Map([["nearest",Se],["linear",ve],["nearest-mip-nearest",Ce],["linear-mip-nearest",Ae],["nearest-mip-linear",Fe],["linear-mip-linear",fe]]),mi=new Map([["nearest",Se],["linear",ve]]),ui=e=>e.replace(/-/g,"_"),gi={addressU:ye,addressV:ye,anisotropy:1,flipY:!1,magFilter:ve,minFilter:fe,mipmaps:!0,srgb:!1},_i=[[["address-u","address-v","anisotropy","flip-y","mag-filter","min-filter","mipmaps","srgb"],["texture","textureatlas"]],[["atlas","frame-keys","pixels-per-unit","render-mode"],["sprite"]]],fi=new Map([["bin","binary"],["css","css"],["frag","shader"],["glb","container"],["glsl","shader"],["gltf","container"],["hdr","texture"],["html","html"],["jpg","texture"],["js","script"],["json","json"],["ktx2","texture"],["mp3","audio"],["mjs","script"],["ply","gsplat"],["png","texture"],["sog","gsplat"],["txt","text"],["vert","shader"],["webp","texture"]]),vi=(e,t,i)=>{if(e.extensions&&e.extensions.EXT_meshopt_compression){const s=e.extensions.EXT_meshopt_compression;Promise.all([hi.ready,t[s.buffer]]).then(e=>{const t=e[1],a=s.byteOffset||0,n=s.byteLength||0,r=s.count,o=s.byteStride,l=new Uint8Array(r*o),c=new Uint8Array(t.buffer,t.byteOffset+a,n);hi.decodeGltfBuffer(l,r,o,c,s.mode,s.filter),i(null,l)})}else i(null,null)};class yi extends Bt{_addressU=null;_addressV=null;_anisotropy=null;_flipY=null;_lazy=!1;_magFilter=null;_minFilter=null;_mipmaps=null;_srgb=null;asset=null;async connectedCallback(){const e=this.closestApp;if(e)if(this.parentElement===e){if(await e.ready(),this.isConnected&&this.parentElement===e){if(!this.asset){const t=e.app;if(!t)return;this._createAsset(),this.asset&&(t.assets.add(this.asset),this.lazy||t.assets.load(this.asset))}this.asset&&this._onReady()}}else console.warn(`pc-asset '${this.getAttribute("id")??this.getAttribute("src")}' must be a direct child of pc-app - asset not created`)}disconnectedCallback(){this._destroyAsset(),this._resetReady()}_onAssetLoad(){this.dispatchEvent(new Event("load"))}_onAssetError(e){this.dispatchEvent(new ErrorEvent("error",{message:e instanceof Error?e.message:String(e)}))}_createAsset(){const e=this.getAttribute("id")||"",t=this.getAttribute("src")||"";let i=this.getAttribute("type");if(!i){const e=t.split(".").pop();i=fi.get(e||"")??null}if(!i)return void console.warn(`Unsupported asset type: ${t}`);const s=_i.filter(([,e])=>!e.includes(i)).flatMap(([e])=>e).filter(e=>this.hasAttribute(e));s.length>0&&console.warn(`pc-asset '${e||t}' has attributes that do not apply to asset type '${i}' and are ignored: ${s.join(", ")}`);const a=this._buildData(i);this.asset="container"===i?new ge(e,i,{url:t},void 0,{bufferView:{processAsync:vi.bind(this)}}):new ge(e,i,"sprite"===i?null:t?{url:t}:null,a),this.asset.preload=!this._lazy,this.asset.on("load",this._onAssetLoad,this),this.asset.on("error",this._onAssetError,this)}_buildData(e){let t;const i=this.getAttribute("data");if(i)try{t=JSON.parse(i)}catch(e){console.warn(`Invalid 'data' JSON on pc-asset: ${i}`)}if("texture"!==e&&"textureatlas"!==e||(t=t??{},null!==this._addressU&&(t.addressu=this._addressU),null!==this._addressV&&(t.addressv=this._addressV),null!==this._anisotropy&&(t.anisotropy=this._anisotropy),null!==this._flipY&&(t.flipY=this._flipY),null!==this._magFilter&&(t.magfilter=ui(this._magFilter)),null!==this._minFilter&&(t.minfilter=ui(this._minFilter)),null!==this._mipmaps&&(t.mipmaps=this._mipmaps),null!==this._srgb&&(t.srgb=this._srgb)),"sprite"===e){t=t??{};const e=this.getAttribute("atlas")??t.textureAtlasAsset;if("string"==typeof e){const i=yi.get(e);i?t.textureAtlasAsset=i.id:console.warn(`pc-asset sprite '${this.getAttribute("id")}' could not find atlas '${e}'`)}const i=this.getAttribute("frame-keys");null!==i&&(t.frameKeys=i.split(/[\s,]+/).filter(Boolean));const s=this.getAttribute("pixels-per-unit");null!==s&&(t.pixelsPerUnit=Jt(s,1,"pixels-per-unit"));const a=this.getAttribute("render-mode");null!==a&&(t.renderMode=pi.get(Nt(a,pi,"simple","render-mode"))),t.renderMode=t.renderMode??_e,t.pixelsPerUnit=t.pixelsPerUnit??1,t.frameKeys=t.frameKeys??[]}return t}_texture(){const e=this.asset;return e?.resource?"texture"===e.type?e.resource:"textureatlas"===e.type?e.resource.texture??null:null:null}_applyTextureOption(e,t,i,s){const a=this.asset;if(!a||"texture"!==a.type&&"textureatlas"!==a.type)return;const n=a.data;null===i?delete n[e]:n[e]=i;const r=this._texture();r&&(r[t]=s??gi[t])}_destroyAsset(){this.asset&&(this.asset.off("load",this._onAssetLoad,this),this.asset.off("error",this._onAssetError,this),this.asset.registry?.remove(this.asset),this.asset.unload(),this.asset=null)}set addressU(e){this._addressU=e;const t=null===e?null:bi.get(e)??ye;this._applyTextureOption("addressu","addressU",e,t)}get addressU(){return this._addressU}set addressV(e){this._addressV=e;const t=null===e?null:bi.get(e)??ye;this._applyTextureOption("addressv","addressV",e,t)}get addressV(){return this._addressV}set anisotropy(e){this._anisotropy=e,this._applyTextureOption("anisotropy","anisotropy",e,e)}get anisotropy(){return this._anisotropy}set flipY(e){this._flipY=e,this._applyTextureOption("flipY","flipY",e,e)}get flipY(){return this._flipY}set lazy(e){this._lazy=e,this.asset&&(this.asset.preload=!e,e||this.asset.registry?.load(this.asset))}get lazy(){return this._lazy}set magFilter(e){this._magFilter=e;const t=null===e?null:ui(e),i=null===e?null:mi.get(e)??ve;this._applyTextureOption("magfilter","magFilter",t,i)}get magFilter(){return this._magFilter}set minFilter(e){this._minFilter=e;const t=null===e?null:ui(e),i=null===e?null:di.get(e)??fe;this._applyTextureOption("minfilter","minFilter",t,i)}get minFilter(){return this._minFilter}set mipmaps(e){this._mipmaps=e,this._applyTextureOption("mipmaps","mipmaps",e,e)}get mipmaps(){return this._mipmaps}set srgb(e){this._srgb=e,this._applyTextureOption("srgb","srgb",e,e)}get srgb(){return this._srgb}static get(e){const t=document.querySelector(`pc-asset[id="${e}"]`);return t?.asset}static get observedAttributes(){return["address-u","address-v","anisotropy","flip-y","lazy","mag-filter","min-filter","mipmaps","srgb"]}attributeChangedCallback(e,t,i){switch(e){case"address-u":this.addressU=null!==i?Nt(i,bi,"repeat",e):null;break;case"address-v":this.addressV=null!==i?Nt(i,bi,"repeat",e):null;break;case"anisotropy":this.anisotropy=null!==i?Jt(i,1,e):null;break;case"flip-y":this.flipY=null!==i?Qt(i,!1):null;break;case"lazy":this.lazy=Qt(i,!1);break;case"mag-filter":this.magFilter=null!==i?Nt(i,mi,"linear",e):null;break;case"min-filter":this.minFilter=null!==i?Nt(i,di,"linear-mip-linear",e):null;break;case"mipmaps":this.mipmaps=null!==i?Qt(i,!0):null;break;case"srgb":this.srgb=null!==i?Qt(i,!1):null}}}customElements.define("pc-asset",yi);const ki=e=>{const t=yi.get(e);return t&&t.registry?.load(t),t};class wi{_generation=0;_loadHandle=null;_errorHandle=null;_detach(){this._loadHandle?.off(),this._loadHandle=null,this._errorHandle?.off(),this._errorHandle=null}cancel(){this._generation++,this._detach()}bind(e,t){const i=++this._generation;this._detach();const s=ki(e);if(!s)return;const{error:a}=t;if(s.loaded){if(null!=s.resource)return t.load(s),s;if(a)return a(`asset '${e}' failed to load`),s}return this._loadHandle=s.once("load",()=>{i===this._generation&&(this._detach(),t.load(s))}),a&&(this._errorHandle=s.once("error",e=>{i===this._generation&&(this._detach(),a(e))})),s}}const Mi=(e,t)=>{const i=(t.get(e.name)??0)>1?` [${e.index}]`:"",s=e.components.length>0?` (${e.components.join(", ")})`:"",a=e.materials.length>0?` {${e.materials.map(e=>e.name??"null").join(", ")}}`:"";return`${e.name}${i}${s}${a}`};class xi extends li{_asset="";_contentEntity=null;_loadGeneration=0;_binding=new wi;get contentEntity(){return this._contentEntity}hierarchy(){const e=this._contentEntity;if(!e)return null;const t=new Map,i=(e,s)=>{const a=t.get(e.name)??0;t.set(e.name,a+1);const n={name:e.name,path:s||e.name,index:a,components:Object.keys(e.c??{}).sort(),materials:(e.render?.meshInstances??[]).map((e,t)=>({index:t,name:e.material?.name??null})),children:e.children.map(e=>i(e,s?`${s}/${e.name}`:e.name))};return Object.defineProperty(n,"toString",{enumerable:!1,value:()=>((e,t)=>{const i=[Mi(e,t)],s=(e,a)=>{e.children.forEach((n,r)=>{const o=r===e.children.length-1;i.push(`${a}${o?"└─ ":"├─ "}${Mi(n,t)}`),s(n,`${a}${o?" ":"│ "}`)})};return s(e,""),i.join("\n")})(n,t)}),n};return i(e,"")}connectedCallback(){const e=this.closestApp;if(!e){const e=this._asset?` '${this._asset}'`:"";return void console.warn(`pc-model${e} must be a descendant of pc-app - model not created`)}if(e._hierarchyReady){const t=e.app;this._createEntity(t),this._buildHierarchy(t),this._built&&oi(this,t)}}disconnectedCallback(){this._loadGeneration++,this._binding.cancel(),this._entity?.destroy()}_onBuilt(){this._loadContent()}_onEntityDestroy(e){this._loadGeneration++,this._binding.cancel(),this._contentEntity=null,super._onEntityDestroy(e)}_announceLoad(){this._onReady(),this.dispatchEvent(new Event("load"))}_instantiate(e){const t=e.instantiateRenderEntity();this._contentEntity=t,this._entity.addChild(t),this._announceLoad()}_destroyContent(){this._contentEntity?.destroy(),this._contentEntity=null}async _loadContent(){this._destroyContent();const e=++this._loadGeneration;this._binding.cancel(),this._resetReady();const t=this.closestApp;if(!t)return;if(await t.ready(),e!==this._loadGeneration)return;if(!this._entity||!this._built)return;if(""===this._asset)return void this._onReady();this._binding.bind(this._asset,{load:({resource:e})=>this._instantiate(e),error:e=>{this.dispatchEvent(new ErrorEvent("error",{message:e instanceof Error?e.message:String(e)})),this._onReady()}})||console.warn(`pc-model could not find asset '${this._asset}' - model not created`)}set asset(e){this._asset=e,this.isConnected&&this._loadContent()}get asset(){return this._asset}static get observedAttributes(){return["asset","enabled","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"asset":this.asset=s??"";break;case"enabled":this.enabled=Qt(s,!0);break;case"name":this.name=s??"Untitled";break;case"position":this.position=ti(s,i.ZERO,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,i.ONE,e);break;case"tags":this.tags=Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-model",xi);class Si extends Bt{_componentName;_enabled=!0;_component=null;_appElement=null;_hostElement=null;_hostReadyListener=null;_connectionGeneration=0;constructor(e){super(),this._componentName=e}getInitialComponentData(){return{}}_applyComponent(){const e=this._hostElement?.entity??null;if(this._component&&this._component.entity===e)return;const t=this._component;if(t?.entity&&t.entity.c[this._componentName]===t&&t.entity.removeComponent(this._componentName),this._component=null,e){if(e.c[this._componentName]){const t=this.id?` '${this.id}'`:"";return void console.warn(`${this.tagName.toLowerCase()}${t} - '${e.name}' already has a '${this._componentName}' component - component not added`)}this._component=e.addComponent(this._componentName,this.getInitialComponentData())}}async _addComponent(){const e=this._connectionGeneration,t=this.closestEntity;if(!t){const e=this.id?` '${this.id}'`:"";return void console.warn(`${this.tagName.toLowerCase()}${e} must be a descendant of pc-entity, pc-model or pc-node - component not added`)}await t.ready(),e===this._connectionGeneration&&(this._hostElement=t,this._applyComponent(),this._hostReadyListener=t=>{t.target===this._hostElement&&e===this._connectionGeneration&&this._hostCycled()},t.addEventListener("ready",this._hostReadyListener))}_hostCycled(){this._resetReady(),this._applyComponent(),this._hostElement?.entity&&(this.initComponent(),this._onReady())}initComponent(){}async connectedCallback(){const e=++this._connectionGeneration;this._appElement=this.closestApp??null,await(this._appElement?.ready()),e===this._connectionGeneration&&(await this._addComponent(),e===this._connectionGeneration&&(this.initComponent(),this._onReady()))}disconnectedCallback(){this._connectionGeneration++,this._hostElement&&this._hostReadyListener&&this._hostElement.removeEventListener("ready",this._hostReadyListener),this._hostElement=null,this._hostReadyListener=null,this._appElement?.app&&this._component?.entity&&this._component.entity.removeComponent(this._componentName),this._component=null,this._appElement=null,this._resetReady()}get component(){return this._component}set enabled(e){this._enabled=e,this.component&&(this.component.enabled=e)}get enabled(){return this._enabled}static get observedAttributes(){return["enabled"]}attributeChangedCallback(e,t,i){if("enabled"===e)this.enabled=Qt(i,!0)}}class Ci extends Si{_activate=!0;_assignedClips=new Map;_autoAssigned=!1;_clip="";_managedRootBone=null;_modelListenerTarget=null;_sourceGeneration=0;_speed=1;_transitionTime=0;_warnedClip=null;_onModelReady=e=>{e.target instanceof xi&&this.component&&e.target!==this._modelListenerTarget&&(this._applyRootBone(),this.component.rebind())};_skeletonSource(){const e=this.parentElement;if(e instanceof xi)return e;const t=e?e.querySelectorAll(":scope > pc-model"):null;return 1===t?.length&&t[0]instanceof xi?t[0]:null}_applyRootBone(){const e=this.component;if(!e)return;if(null!==e.rootBone&&e.rootBone!==this._managedRootBone)return;const t=this._skeletonSource()?.entity??null;e.rootBone!==t&&(e.rootBone=t),this._managedRootBone=t}constructor(){super("anim")}getInitialComponentData(){return{activate:this._activate,speed:this._speed}}initComponent(){if(!this.component)return;const e=this.closestEntity;e&&e!==this._modelListenerTarget&&(this._modelListenerTarget?.removeEventListener("ready",this._onModelReady),e.addEventListener("ready",this._onModelReady),this._modelListenerTarget=e),this._applyRootBone(),this.component.baseLayer?this._refreshClips():this._applyClips()}disconnectedCallback(){this._modelListenerTarget?.removeEventListener("ready",this._onModelReady),this._modelListenerTarget=null,this._sourceGeneration++,this._assignedClips.clear(),this._autoAssigned=!1,this._managedRootBone=null,super.disconnectedCallback()}_clipElements(){return Array.from(this.querySelectorAll(":scope > pc-anim-clip"))}_assignClip(e){this.component?.assignAnimation(e.name,e._track??Ee.EMPTY,void 0,e.speed,e.loop)}_adoptClip(e){const t=e.name;return t?-1!==t.indexOf(".")?(e._markInvalid(`pc-anim-clip '${t}' - '.' in a clip name is reserved for blend tree paths - clip not assigned`),!1):this._assignedClips.has(t)?(e._markInvalid(`pc-anim-clip '${t}' - an earlier clip already uses this name - clip not assigned`),!1):(this._assignedClips.set(t,e),this._assignClip(e),e._resolveTrack(this),!0):(e._markInvalid("pc-anim-clip must have a name - clip not assigned"),!1)}_applyClips(e){if(!this.component)return;this._sourceGeneration++,this._assignedClips.clear(),this._autoAssigned=!1;const t=this._clipElements();if(0!==t.length){for(const e of t)this._adoptClip(e);this._applySelection(e)}else this._kickAutoAssign(e)}async _kickAutoAssign(e){const t=this._sourceGeneration,i=this.parentElement;if(!(i instanceof xi))return;await i.ready();const s=this.component;if(t!==this._sourceGeneration||!s||this._clipElements().length>0)return;const a=yi.get(i.asset)?.resource;if(!a)return;const n=this.id?` '${this.id}'`:"";if(0===a.animations.length)return void console.warn(`pc-anim${n} - model '${i.asset}' has no animations`);const r=new Set;for(const e of a.animations){const t=e.resource;t instanceof Ee&&(-1===t.name.indexOf(".")?r.has(t.name)?console.warn(`pc-anim${n} - duplicate track name '${t.name}' - track skipped`):(r.add(t.name),s.assignAnimation(t.name,t)):console.warn(`pc-anim${n} - track '${t.name}' - '.' in a clip name is reserved for blend tree paths - track skipped`))}this._autoAssigned=r.size>0,this._applySelection(e)}_applySelection(e){const t=this.component,i=t?t.baseLayer:null;if(!t||!i)return;this._clip&&!i.states.includes(this._clip)&&this._warnUnknownClip(this._clip);let s=null;this._clip&&i.states.includes(this._clip)?s=this._clip:e&&i.states.includes(e.state)&&(s=e.state),s&&i.activeState!==s&&i.play(s),e&&(s===e.state&&(i.activeStateCurrentTime=e.time),i.playing=e.layerPlaying,t.playing=e.playing)}_warnUnknownClip(e){if(this._warnedClip===e)return;this._warnedClip=e;const t=this.id?` '${this.id}'`:"";console.warn(`pc-anim${t} has no clip named '${e}' - selection unchanged`)}_refreshClips(){const e=this.component;if(!e)return;this._applyRootBone();const t=e.baseLayer,i=t?{state:t.activeState,time:t.activeStateCurrentTime,playing:e.playing,layerPlaying:t.playing}:void 0;e.removeStateGraph(),this._applyClips(i)}_registerClip(e){this.component&&(this._autoAssigned?this._refreshClips():this._assignedClips.get(e.name)!==e&&(this._sourceGeneration++,this._adoptClip(e)&&this._applySelection()))}_unregisterClip(e){this.component&&this._assignedClips.get(e.name)===e&&this._refreshClips()}_onClipResolved(e){const t=this.component;if(!t||this._assignedClips.get(e.name)!==e)return!1;this._assignClip(e);const i=t.baseLayer;return i&&i.activeState===e.name&&i.play(e.name),!0}_onClipParamsChanged(e){const t=this.component;if(!t||this._assignedClips.get(e.name)!==e)return;this._assignClip(e);const i=t.baseLayer;if(i&&i.activeState===e.name){const t=i.activeStateCurrentTime;i.play(e.name),i.activeStateCurrentTime=t}}play(e){const t=this.component,i=t?t.baseLayer:null;if(t&&i){if(void 0!==e){if(!i.states.includes(e))return;i.play(e)}else i.play();t.playing=!0}}pause(){this.component&&(this.component.playing=!1)}transition(e,t){const i=this.component,s=i?i.baseLayer:null;i&&s&&s.states.includes(e)&&(s.transition(e,Math.max(0,t??this._transitionTime)),s.playing=!0,i.playing=!0)}get component(){return super.component}get clips(){const e=this.component?this.component.baseLayer:null;return e?e.states.filter(e=>!Re.includes(e)):[]}set activate(e){this._activate=e,this.component&&(this.component.activate=e)}get activate(){return this._activate}set clip(e){this._clip=e;const t=this.component,i=t?t.baseLayer:null;t&&i&&e&&(i.states.includes(e)?i.activeState!==e&&(this._transitionTime>0?this.transition(e):this.play(e)):this._warnUnknownClip(e))}get clip(){return this._clip}set speed(e){this._speed=e,this.component&&(this.component.speed=e)}get speed(){return this._speed}set transitionTime(e){this._transitionTime=e}get transitionTime(){return this._transitionTime}static get observedAttributes(){return[...super.observedAttributes,"activate","clip","speed","transition-time"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"activate":this.activate=Qt(i,!0);break;case"clip":this.clip=i??"";break;case"speed":this.speed=Jt(i,1,e);break;case"transition-time":this.transitionTime=Jt(i,0,e)}}}customElements.define("pc-anim",Ci);class Ai extends Bt{_animElement=null;_asset="";_binding=new wi;_connectionGeneration=0;_loadGeneration=0;_loop=!0;_name="";_speed=1;_warnedSource=null;_warnedInvalid=!1;_track=null;async connectedCallback(){const e=++this._connectionGeneration,t=this.animElement;await(t?.ready());const i=t?t.component:null;e===this._connectionGeneration&&t&&i&&(this._animElement=t,t._registerClip(this))}disconnectedCallback(){this._connectionGeneration++,this._loadGeneration++,this._binding.cancel(),this._animElement?._unregisterClip(this),this._animElement=null,this._track=null,this._resetReady()}get animElement(){const e=this.parentElement;if(!(e instanceof Ci)){const e=this._name?` '${this._name}'`:"";return console.warn(`pc-anim-clip${e} must be a direct child of a pc-anim element`),null}return e}_markInvalid(e){this._warnedInvalid||(this._warnedInvalid=!0,console.warn(e))}async _resolveTrack(e){this._animElement=e;const t=++this._loadGeneration;if(this._binding.cancel(),this._asset){return void(this._binding.bind(this._asset,{load:e=>this._extractTrack(e,`asset '${this._asset}'`),error:()=>{this._warnSource(`pc-anim-clip '${this._name}' - asset '${this._asset}' failed to load - clip not assigned`)}})||this._warnSource(`pc-anim-clip '${this._name}' could not find asset '${this._asset}' - clip not assigned`))}const i=e.parentElement;if(!(i instanceof xi))return void this._warnSource(`pc-anim-clip '${this._name}' has no asset and no enclosing pc-model - clip not assigned`);if(await i.ready(),t!==this._loadGeneration)return;const s=yi.get(i.asset);s?.resource&&this._extractTrack(s,`model '${i.asset}'`)}_warnSource(e){this._warnedSource!==this._asset&&(this._warnedSource=this._asset,console.warn(e))}_extractTrack(e,t){const i=`pc-anim-clip '${this._name}'`;let s;switch(e.type){case"container":s=e.resource.animations.map(e=>e.resource);break;case"animation":s=e.resources;break;case"animclip":s=[e.resource];break;default:return void this._warnSource(`${i} - ${t} has type '${e.type}', expected 'container', 'animation' or 'animclip' - clip not assigned`)}const a=s.filter(e=>e instanceof Ee);if(0===a.length)return void this._warnSource(`${i} - ${t} contains no usable animation track - clip not assigned`);let n=a.find(e=>e.name===this._name);n||(n=a[0],a.length>1&&console.warn(`${i} - no track named '${this._name}' in ${t} - using '${n.name}' (available: ${a.map(e=>e.name).join(", ")})`)),this._track=n,this._animElement?._onClipResolved(this)&&this._onReady()}set asset(e){this._asset=e,this._warnedSource=null,this._animElement&&(this._resetReady(),this._track=null,this._resolveTrack(this._animElement))}get asset(){return this._asset}set loop(e){this._loop=e,this._animElement?._onClipParamsChanged(this)}get loop(){return this._loop}set name(e){this._name=e,this._warnedInvalid=!1,this._animElement&&(this._resetReady(),this._animElement._refreshClips())}get name(){return this._name}set speed(e){this._speed=e,this._animElement?._onClipParamsChanged(this)}get speed(){return this._speed}static get observedAttributes(){return["asset","loop","name","speed"]}attributeChangedCallback(e,t,i){switch(e){case"asset":this.asset=i??"";break;case"loop":this.loop=Qt(i,!0);break;case"name":this.name=i??"";break;case"speed":this.speed=Jt(i,1,e)}}}customElements.define("pc-anim-clip",Ai);class Fi extends Si{constructor(){super("audiolistener")}get component(){return super.component}}customElements.define("pc-audio-listener",Fi);const Ei=e=>{try{return document.querySelector(e)}catch{return null}},Ri=(e,t)=>{try{return e.matches(t)?e:e.querySelector(t)}catch{return null}},ji=e=>e?.entity??null,Oi=["pc-entity","pc-model","pc-node"],zi=Oi.join(", "),Li=(e,t)=>{if(!e)return null;if(e.startsWith("#"))return Ei(e);const i=e.replace(/["\\]/g,"\\$&"),s=Oi.map(e=>`${e}[name="${i}"]`).join(", ");if(t){let e=t.parentElement?.closest(zi);for(;e;){const t=Ri(e,s);if(t)return t;e=e.parentElement?.closest(zi)}const i=t.parentElement?.closest("pc-app");if(i){const e=Ri(i,s);if(e)return e}}return Ei(s)},Ti=e=>{if(!e)return"nothing in the document matches it";const t=`<${e.tagName.toLowerCase()}>`;return"entity"in e?`${t} matches it but is not backing an entity yet`:`${t} matches it but cannot back an entity`},Di=(e,t="")=>{const i=!e.startsWith("#")&&document.getElementById(e);return i&&"entity"in i?`A bare reference is a name - write '${t}#${CSS.escape(e)}' to reference the element with that id.`:""},Bi=(e,t,i,s)=>{if(!e)return null;const a=Li(e,t),n=ji(a);if(!n){let n=`Assign ${i} again once the entity exists.`;if(a&&!("entity"in a))n=`Point ${i} at a pc-entity, pc-model or pc-node instead.`;else if(!a){const t=Di(e);t&&(n=t)}console.warn(`${t.tagName.toLowerCase()} could not resolve ${i} '${e}' - ${Ti(a)} - ${s}. ${n}`)}return n},Pi=new Map([["tint",je],["sprite",Oe]]);class Gi extends Si{_active=!0;_image="";_hitPadding=new a(0,0,0,0);_transitionMode="tint";_hoverTint=new s(1,1,1,1);_pressedTint=new s(1,1,1,1);_inactiveTint=new s(1,1,1,1);_fadeDuration=0;_hoverSpriteAsset="";_hoverSpriteFrame=0;_pressedSpriteAsset="";_pressedSpriteFrame=0;_inactiveSpriteAsset="";_inactiveSpriteFrame=0;constructor(){super("button")}getInitialComponentData(){const e={active:this._active,hitPadding:this._hitPadding,transitionMode:Pi.get(this._transitionMode),hoverTint:this._hoverTint,pressedTint:this._pressedTint,inactiveTint:this._inactiveTint,fadeDuration:this._fadeDuration,hoverSpriteFrame:this._hoverSpriteFrame,pressedSpriteFrame:this._pressedSpriteFrame,inactiveSpriteFrame:this._inactiveSpriteFrame},t=this._image?Bi(this._image,this,"image","reference ignored"):this.closestEntity?.entity;t&&(e.imageEntity=t);const i=ki(this._hoverSpriteAsset);i&&(e.hoverSpriteAsset=i.id);const s=ki(this._pressedSpriteAsset);s&&(e.pressedSpriteAsset=s.id);const a=ki(this._inactiveSpriteAsset);return a&&(e.inactiveSpriteAsset=a.id),e}get component(){return super.component}set active(e){this._active=e,this.component&&(this.component.active=e)}get active(){return this._active}set image(e){if(this._image=e,this.component){const t=Bi(e,this,"image","reference ignored");t&&(this.component.imageEntity=t)}}get image(){return this._image}set hitPadding(e){this._hitPadding=e,this.component&&(this.component.hitPadding=e)}get hitPadding(){return this._hitPadding}set transitionMode(e){this._transitionMode=e,this.component&&(this.component.transitionMode=Pi.get(e)??je)}get transitionMode(){return this._transitionMode}set hoverTint(e){this._hoverTint=e,this.component&&(this.component.hoverTint=e)}get hoverTint(){return this._hoverTint}set pressedTint(e){this._pressedTint=e,this.component&&(this.component.pressedTint=e)}get pressedTint(){return this._pressedTint}set inactiveTint(e){this._inactiveTint=e,this.component&&(this.component.inactiveTint=e)}get inactiveTint(){return this._inactiveTint}set fadeDuration(e){this._fadeDuration=e,this.component&&(this.component.fadeDuration=e)}get fadeDuration(){return this._fadeDuration}set hoverSpriteAsset(e){this._hoverSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.hoverSpriteAsset=t.id)}get hoverSpriteAsset(){return this._hoverSpriteAsset}set hoverSpriteFrame(e){this._hoverSpriteFrame=e,this.component&&(this.component.hoverSpriteFrame=e)}get hoverSpriteFrame(){return this._hoverSpriteFrame}set pressedSpriteAsset(e){this._pressedSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.pressedSpriteAsset=t.id)}get pressedSpriteAsset(){return this._pressedSpriteAsset}set pressedSpriteFrame(e){this._pressedSpriteFrame=e,this.component&&(this.component.pressedSpriteFrame=e)}get pressedSpriteFrame(){return this._pressedSpriteFrame}set inactiveSpriteAsset(e){this._inactiveSpriteAsset=e;const t=ki(e);this.component&&t&&(this.component.inactiveSpriteAsset=t.id)}get inactiveSpriteAsset(){return this._inactiveSpriteAsset}set inactiveSpriteFrame(e){this._inactiveSpriteFrame=e,this.component&&(this.component.inactiveSpriteFrame=e)}get inactiveSpriteFrame(){return this._inactiveSpriteFrame}static get observedAttributes(){return[...super.observedAttributes,"active","image","hit-padding","transition-mode","hover-tint","pressed-tint","inactive-tint","fade-duration","hover-sprite-asset","hover-sprite-frame","pressed-sprite-asset","pressed-sprite-frame","inactive-sprite-asset","inactive-sprite-frame"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"active":this.active=Qt(i,!0);break;case"image":this.image=i??"";break;case"hit-padding":this.hitPadding=ii(i,a.ZERO,e);break;case"transition-mode":this.transitionMode=Nt(i,Pi,"tint",e);break;case"hover-tint":this.hoverTint=Xt(i,s.WHITE,e);break;case"pressed-tint":this.pressedTint=Xt(i,s.WHITE,e);break;case"inactive-tint":this.inactiveTint=Xt(i,s.WHITE,e);break;case"fade-duration":this.fadeDuration=Jt(i,0,e);break;case"hover-sprite-asset":this.hoverSpriteAsset=i??"";break;case"hover-sprite-frame":this.hoverSpriteFrame=Jt(i,0,e);break;case"pressed-sprite-asset":this.pressedSpriteAsset=i??"";break;case"pressed-sprite-frame":this.pressedSpriteFrame=Jt(i,0,e);break;case"inactive-sprite-asset":this.inactiveSpriteAsset=i??"";break;case"inactive-sprite-frame":this.inactiveSpriteFrame=Jt(i,0,e)}}}customElements.define("pc-button",Gi);const Ui=new Map([["perspective",Le],["orthographic",Ye]]),Hi=new Map([["none",ze],["linear",Ge],["filmic",Ue],["hejl",He],["aces",qe],["aces2",We],["neutral",$e]]);class qi extends Si{_clearColor=new s(.75,.75,.75,1);_clearColorBuffer=!0;_clearDepth=1;_clearDepthBuffer=!0;_clearStencilBuffer=!0;_cullFaces=!0;_farClip=1e3;_flipFaces=!1;_fov=45;_frustumCulling=!0;_gamma="srgb";_horizontalFov=!1;_nearClip=.1;_projection="perspective";_orthoHeight=10;_priority=0;_rect=new a(0,0,1,1);_scissorRect=new a(0,0,1,1);_tonemap="none";constructor(){super("camera")}getInitialComponentData(){return{clearColor:this._clearColor,clearColorBuffer:this._clearColorBuffer,clearDepth:this._clearDepth,clearDepthBuffer:this._clearDepthBuffer,clearStencilBuffer:this._clearStencilBuffer,cullFaces:this._cullFaces,farClip:this._farClip,flipFaces:this._flipFaces,fov:this._fov,frustumCulling:this._frustumCulling,gammaCorrection:"srgb"===this._gamma?Te:De,horizontalFov:this._horizontalFov,nearClip:this._nearClip,projection:Ui.get(this._projection)??Le,orthoHeight:this._orthoHeight,priority:this._priority,rect:this._rect,scissorRect:this._scissorRect,toneMapping:Hi.get(this._tonemap)??ze}}get arAvailable(){return this._available(Be)}get vrAvailable(){return this._available(Pe)}_available(e){const t=this.component?.system.app.xr;return Boolean(t?.supported&&t.isAvailable(e))}startXr(e,t){this.component&&this._available(e)&&this.component.startXr(e,t,{callback:t=>{t&&console.error(`WebXR ${e} failed to start: ${t.message}`)}})}endXr(){this.component&&this.component.endXr()}get component(){return super.component}set clearColor(e){this._clearColor=e,this.component&&(this.component.clearColor=e)}get clearColor(){return this._clearColor}set clearColorBuffer(e){this._clearColorBuffer=e,this.component&&(this.component.clearColorBuffer=e)}get clearColorBuffer(){return this._clearColorBuffer}set clearDepth(e){this._clearDepth=e,this.component&&(this.component.clearDepth=e)}get clearDepth(){return this._clearDepth}set clearDepthBuffer(e){this._clearDepthBuffer=e,this.component&&(this.component.clearDepthBuffer=e)}get clearDepthBuffer(){return this._clearDepthBuffer}set clearStencilBuffer(e){this._clearStencilBuffer=e,this.component&&(this.component.clearStencilBuffer=e)}get clearStencilBuffer(){return this._clearStencilBuffer}set cullFaces(e){this._cullFaces=e,this.component&&(this.component.cullFaces=e)}get cullFaces(){return this._cullFaces}set farClip(e){this._farClip=e,this.component&&(this.component.farClip=e)}get farClip(){return this._farClip}set flipFaces(e){this._flipFaces=e,this.component&&(this.component.flipFaces=e)}get flipFaces(){return this._flipFaces}set fov(e){this._fov=e,this.component&&(this.component.fov=e)}get fov(){return this._fov}set frustumCulling(e){this._frustumCulling=e,this.component&&(this.component.frustumCulling=e)}get frustumCulling(){return this._frustumCulling}set gamma(e){this._gamma=e,this.component&&(this.component.gammaCorrection="srgb"===e?Te:De)}get gamma(){return this._gamma}set horizontalFov(e){this._horizontalFov=e,this.component&&(this.component.horizontalFov=e)}get horizontalFov(){return this._horizontalFov}set nearClip(e){this._nearClip=e,this.component&&(this.component.nearClip=e)}get nearClip(){return this._nearClip}set orthoHeight(e){this._orthoHeight=e,this.component&&(this.component.orthoHeight=e)}get orthoHeight(){return this._orthoHeight}set priority(e){this._priority=e,this.component&&(this.component.priority=e)}get priority(){return this._priority}set projection(e){this._projection=e,this.component&&(this.component.projection=Ui.get(e)??Le)}get projection(){return this._projection}set rect(e){this._rect=e,this.component&&(this.component.rect=e)}get rect(){return this._rect}set scissorRect(e){this._scissorRect=e,this.component&&(this.component.scissorRect=e)}get scissorRect(){return this._scissorRect}set tonemap(e){this._tonemap=e,this.component&&(this.component.toneMapping=Hi.get(e)??ze)}get tonemap(){return this._tonemap}static get observedAttributes(){return[...super.observedAttributes,"clear-color","clear-color-buffer","clear-depth","clear-depth-buffer","clear-stencil-buffer","cull-faces","far-clip","flip-faces","fov","frustum-culling","gamma","horizontal-fov","near-clip","ortho-height","priority","projection","rect","scissor-rect","tonemap"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"clear-color":this.clearColor=Xt(i,new s(.75,.75,.75,1),e);break;case"clear-color-buffer":this.clearColorBuffer=Qt(i,!0);break;case"clear-depth":this.clearDepth=Jt(i,1,e);break;case"clear-depth-buffer":this.clearDepthBuffer=Qt(i,!0);break;case"clear-stencil-buffer":this.clearStencilBuffer=Qt(i,!0);break;case"cull-faces":this.cullFaces=Qt(i,!0);break;case"far-clip":this.farClip=Jt(i,1e3,e);break;case"flip-faces":this.flipFaces=Qt(i,!1);break;case"fov":this.fov=Jt(i,45,e);break;case"frustum-culling":this.frustumCulling=Qt(i,!0);break;case"gamma":this.gamma=Nt(i,["linear","srgb"],"srgb",e);break;case"horizontal-fov":this.horizontalFov=Qt(i,!1);break;case"near-clip":this.nearClip=Jt(i,.1,e);break;case"ortho-height":this.orthoHeight=Jt(i,10,e);break;case"priority":this.priority=Jt(i,0,e);break;case"projection":this.projection=Nt(i,Ui,"perspective",e);break;case"rect":this.rect=ii(i,new a(0,0,1,1),e);break;case"scissor-rect":this.scissorRect=ii(i,new a(0,0,1,1),e);break;case"tonemap":this.tonemap=Nt(i,Hi,"none",e)}}}customElements.define("pc-camera",qi);class Wi extends Si{_angularOffset=new n;_axis=1;_convexHull=!1;_halfExtents=new i(.5,.5,.5);_height=2;_linearOffset=new i;_radius=.5;_type="box";constructor(){super("collision")}getInitialComponentData(){return{axis:this._axis,angularOffset:this._angularOffset,convexHull:this._convexHull,halfExtents:this._halfExtents,height:this._height,linearOffset:this._linearOffset,radius:this._radius,type:this._type}}initComponent(){this._applyMeshGeometryDefault()}_applyMeshGeometryDefault(){const e=this.component;if(!e||"mesh"!==this._type||null!==e.renderAsset)return;const t=e.entity.render?.asset??null;null!==t?e.renderAsset=t:console.warn(`pc-collision type="mesh" on '${e.entity.name}' found no asset-backed render component to take geometry from - collider has no shape`)}get component(){return super.component}set angularOffset(e){this._angularOffset=e,this.component&&(this.component.angularOffset=e)}get angularOffset(){return this._angularOffset}set axis(e){this._axis=e,this.component&&(this.component.axis=e)}get axis(){return this._axis}set convexHull(e){this._convexHull=e,this.component&&(this.component.convexHull=e)}get convexHull(){return this._convexHull}set halfExtents(e){this._halfExtents=e,this.component&&(this.component.halfExtents=e)}get halfExtents(){return this._halfExtents}set height(e){this._height=e,this.component&&(this.component.height=e)}get height(){return this._height}set linearOffset(e){this._linearOffset=e,this.component&&(this.component.linearOffset=e)}get linearOffset(){return this._linearOffset}set radius(e){this._radius=e,this.component&&(this.component.radius=e)}get radius(){return this._radius}set type(e){this._type=e,this.component&&(this.component.type=e,this._applyMeshGeometryDefault())}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-offset","axis","convex-hull","half-extents","height","linear-offset","radius","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-offset":this.angularOffset=Zt(s,n.IDENTITY,e);break;case"axis":this.axis=Jt(s,1,e);break;case"convex-hull":this.convexHull=Qt(s,!1);break;case"half-extents":this.halfExtents=ti(s,new i(.5,.5,.5),e);break;case"height":this.height=Jt(s,2,e);break;case"linear-offset":this.linearOffset=ti(s,i.ZERO,e);break;case"radius":this.radius=Jt(s,.5,e);break;case"type":this.type=Nt(s,["box","capsule","compound","cone","cylinder","mesh","sphere"],"box",e)}}}customElements.define("pc-collision",Wi);class $i extends Si{_anchor=new a(.5,.5,.5,.5);_autoWidth=!0;_autoHeight=!0;_autoFitWidth=!1;_autoFitHeight=!1;_color=new s(1,1,1,1);_enableMarkup=!1;_fontAsset="";_fontSize=32;_maxFontSize=32;_minFontSize=8;_height=0;_lineHeight=32;_margin=null;_mask=!1;_opacity=1;_pivot=new r(.5,.5);_pixelsPerUnit=null;_spriteAsset="";_spriteFrame=0;_text="";_textureAsset="";_type="group";_useInput=!1;_width=0;_wrapLines=!1;constructor(){super("element")}initComponent(){const e=this.component;e&&(e._text?._material&&(e._text._material.useFog=!0),e._dirtifyMask?.())}getInitialComponentData(){const e={anchor:this._anchor,autoWidth:this._autoWidth,autoHeight:this._autoHeight,autoFitWidth:this._autoFitWidth,autoFitHeight:this._autoFitHeight,color:this._color,enableMarkup:this._enableMarkup,fontSize:this._fontSize,maxFontSize:this._maxFontSize,minFontSize:this._minFontSize,height:this._height,lineHeight:this._lineHeight,mask:this._mask,opacity:this._opacity,pivot:this._pivot,spriteFrame:this._spriteFrame,type:this._type,text:this._text,useInput:this._useInput,width:this._width,wrapLines:this._wrapLines},t=ki(this._fontAsset);t&&(e.fontAsset=t.id);const i=ki(this._spriteAsset);i&&(e.spriteAsset=i.id);const s=ki(this._textureAsset);return s&&(e.textureAsset=s.id),this._margin&&(e.margin=this._margin),null!==this._pixelsPerUnit&&(e.pixelsPerUnit=this._pixelsPerUnit),e}get component(){return super.component}set anchor(e){this._anchor=e,this.component&&(this.component.anchor=e)}get anchor(){return this._anchor}set autoWidth(e){this._autoWidth=e,this.component&&(this.component.autoWidth=e)}get autoWidth(){return this._autoWidth}set autoHeight(e){this._autoHeight=e,this.component&&(this.component.autoHeight=e)}get autoHeight(){return this._autoHeight}set color(e){this._color=e,this.component&&(this.component.color=e)}get color(){return this._color}set enableMarkup(e){this._enableMarkup=e,this.component&&(this.component.enableMarkup=e)}get enableMarkup(){return this._enableMarkup}set fontAsset(e){this._fontAsset=e;const t=ki(e);this.component&&t&&(this.component.fontAsset=t.id)}get fontAsset(){return this._fontAsset}set fontSize(e){this._fontSize=e,this.component&&(this.component.fontSize=e)}get fontSize(){return this._fontSize}set height(e){this._height=e,this.component&&(this.component.height=e)}get height(){return this._height}set lineHeight(e){this._lineHeight=e,this.component&&(this.component.lineHeight=e)}get lineHeight(){return this._lineHeight}set margin(e){this._margin=e,this.component&&e&&(this.component.margin=e)}get margin(){return this._margin}set mask(e){this._mask=e,this.component&&(this.component.mask=e)}get mask(){return this._mask}set opacity(e){this._opacity=e,this.component&&(this.component.opacity=e)}get opacity(){return this._opacity}set pivot(e){this._pivot=e,this.component&&(this.component.pivot=e)}get pivot(){return this._pivot}set pixelsPerUnit(e){this._pixelsPerUnit=e,this.component&&null!==e&&(this.component.pixelsPerUnit=e)}get pixelsPerUnit(){return this._pixelsPerUnit}set spriteAsset(e){this._spriteAsset=e;const t=ki(e);this.component&&t&&(this.component.spriteAsset=t.id)}get spriteAsset(){return this._spriteAsset}set spriteFrame(e){this._spriteFrame=e,this.component&&(this.component.spriteFrame=e)}get spriteFrame(){return this._spriteFrame}set text(e){this._text=e,this.component&&(this.component.text=e)}get text(){return this._text}set textureAsset(e){this._textureAsset=e;const t=ki(e);this.component&&t&&(this.component.textureAsset=t.id)}get textureAsset(){return this._textureAsset}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set useInput(e){this._useInput=e,this.component&&(this.component.useInput=e)}get useInput(){return this._useInput}set width(e){this._width=e,this.component&&(this.component.width=e)}get width(){return this._width}set wrapLines(e){this._wrapLines=e,this.component&&(this.component.wrapLines=e)}get wrapLines(){return this._wrapLines}set autoFitWidth(e){this._autoFitWidth=e,this.component&&(this.component.autoFitWidth=e)}get autoFitWidth(){return this._autoFitWidth}set autoFitHeight(e){this._autoFitHeight=e,this.component&&(this.component.autoFitHeight=e)}get autoFitHeight(){return this._autoFitHeight}set minFontSize(e){this._minFontSize=e,this.component&&(this.component.minFontSize=e)}get minFontSize(){return this._minFontSize}set maxFontSize(e){this._maxFontSize=e,this.component&&(this.component.maxFontSize=e)}get maxFontSize(){return this._maxFontSize}static get observedAttributes(){return[...super.observedAttributes,"anchor","auto-width","auto-height","auto-fit-width","auto-fit-height","color","enable-markup","font-asset","font-size","max-font-size","min-font-size","height","line-height","margin","mask","opacity","pivot","pixels-per-unit","sprite-asset","sprite-frame","text","texture-asset","type","use-input","width","wrap-lines"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"anchor":this.anchor=ii(i,new a(.5,.5,.5,.5),e);break;case"auto-width":this.autoWidth=Qt(i,!0);break;case"auto-height":this.autoHeight=Qt(i,!0);break;case"auto-fit-width":this.autoFitWidth=Qt(i,!1);break;case"auto-fit-height":this.autoFitHeight=Qt(i,!1);break;case"color":this.color=Xt(i,s.WHITE,e);break;case"enable-markup":this.enableMarkup=Qt(i,!1);break;case"font-asset":this.fontAsset=i??"";break;case"font-size":this.fontSize=Jt(i,32,e);break;case"max-font-size":this.maxFontSize=Jt(i,32,e);break;case"min-font-size":this.minFontSize=Jt(i,8,e);break;case"height":this.height=Jt(i,0,e);break;case"line-height":this.lineHeight=Jt(i,32,e);break;case"margin":this.margin=ii(i,null,e);break;case"mask":this.mask=Qt(i,!1);break;case"opacity":this.opacity=Jt(i,1,e);break;case"pivot":this.pivot=ei(i,new r(.5,.5),e);break;case"pixels-per-unit":this.pixelsPerUnit=Jt(i,null,e);break;case"sprite-asset":this.spriteAsset=i??"";break;case"sprite-frame":this.spriteFrame=Jt(i,0,e);break;case"text":this.text=i??"";break;case"texture-asset":this.textureAsset=i??"";break;case"type":this.type=Nt(i,["group","image","text"],"group",e);break;case"use-input":this.useInput=Qt(i,!1);break;case"width":this.width=Jt(i,0,e);break;case"wrap-lines":this.wrapLines=Qt(i,!1)}}}customElements.define("pc-element",$i);class Yi extends Si{_angularDamping=new i(1,1,1);_angularEquilibrium=new i;_angularLimitsX=new r;_angularLimitsY=new r;_angularLimitsZ=new r;_angularMotionX="locked";_angularMotionY="locked";_angularMotionZ="locked";_angularStiffness=new i;_breakImpulse=1/0;_enableCollision=!1;_enableLimits=!1;_entityA="";_entityB="";_limits=new r(-45,45);_linearDamping=new i(1,1,1);_linearEquilibrium=new i;_linearLimitsX=new r;_linearLimitsY=new r;_linearLimitsZ=new r;_linearMotionX="locked";_linearMotionY="locked";_linearMotionZ="locked";_linearStiffness=new i;_maxMotorForce=0;_motorSpeed=0;_swingLimitY=45;_swingLimitZ=45;_twistLimit=20;_type="fixed";constructor(){super("joint")}getInitialComponentData(){return{angularDamping:this._angularDamping,angularEquilibrium:this._angularEquilibrium,angularLimitsX:this._angularLimitsX,angularLimitsY:this._angularLimitsY,angularLimitsZ:this._angularLimitsZ,angularMotionX:this._angularMotionX,angularMotionY:this._angularMotionY,angularMotionZ:this._angularMotionZ,angularStiffness:this._angularStiffness,breakImpulse:this._breakImpulse,enableCollision:this._enableCollision,enableLimits:this._enableLimits,entityA:Bi(this._entityA,this,"entity-a","constraint not created"),entityB:Bi(this._entityB,this,"entity-b","constraint not created"),limits:this._limits,linearDamping:this._linearDamping,linearEquilibrium:this._linearEquilibrium,linearLimitsX:this._linearLimitsX,linearLimitsY:this._linearLimitsY,linearLimitsZ:this._linearLimitsZ,linearMotionX:this._linearMotionX,linearMotionY:this._linearMotionY,linearMotionZ:this._linearMotionZ,linearStiffness:this._linearStiffness,maxMotorForce:this._maxMotorForce,motorSpeed:this._motorSpeed,swingLimitY:this._swingLimitY,swingLimitZ:this._swingLimitZ,twistLimit:this._twistLimit,type:this._type}}_onBreak(){this.dispatchEvent(new CustomEvent("break",{bubbles:!0,composed:!0}))}initComponent(){const e=this.component;e&&(e.off("break",this._onBreak,this),e.on("break",this._onBreak,this))}get component(){return super.component}set angularDamping(e){this._angularDamping=e,this.component&&(this.component.angularDamping=e)}get angularDamping(){return this._angularDamping}set angularEquilibrium(e){this._angularEquilibrium=e,this.component&&(this.component.angularEquilibrium=e)}get angularEquilibrium(){return this._angularEquilibrium}set angularLimitsX(e){this._angularLimitsX=e,this.component&&(this.component.angularLimitsX=e)}get angularLimitsX(){return this._angularLimitsX}set angularLimitsY(e){this._angularLimitsY=e,this.component&&(this.component.angularLimitsY=e)}get angularLimitsY(){return this._angularLimitsY}set angularLimitsZ(e){this._angularLimitsZ=e,this.component&&(this.component.angularLimitsZ=e)}get angularLimitsZ(){return this._angularLimitsZ}set angularMotionX(e){this._angularMotionX=e,this.component&&(this.component.angularMotionX=e)}get angularMotionX(){return this._angularMotionX}set angularMotionY(e){this._angularMotionY=e,this.component&&(this.component.angularMotionY=e)}get angularMotionY(){return this._angularMotionY}set angularMotionZ(e){this._angularMotionZ=e,this.component&&(this.component.angularMotionZ=e)}get angularMotionZ(){return this._angularMotionZ}set angularStiffness(e){this._angularStiffness=e,this.component&&(this.component.angularStiffness=e)}get angularStiffness(){return this._angularStiffness}set breakImpulse(e){this._breakImpulse=e,this.component&&(this.component.breakImpulse=e)}get breakImpulse(){return this._breakImpulse}set enableCollision(e){this._enableCollision=e,this.component&&(this.component.enableCollision=e)}get enableCollision(){return this._enableCollision}set enableLimits(e){this._enableLimits=e,this.component&&(this.component.enableLimits=e)}get enableLimits(){return this._enableLimits}set entityA(e){this._entityA=e,this.component&&(this.component.entityA=Bi(e,this,"entity-a","constraint not created"))}get entityA(){return this._entityA}set entityB(e){this._entityB=e,this.component&&(this.component.entityB=Bi(e,this,"entity-b","constraint not created"))}get entityB(){return this._entityB}set limits(e){this._limits=e,this.component&&(this.component.limits=e)}get limits(){return this._limits}set linearDamping(e){this._linearDamping=e,this.component&&(this.component.linearDamping=e)}get linearDamping(){return this._linearDamping}set linearEquilibrium(e){this._linearEquilibrium=e,this.component&&(this.component.linearEquilibrium=e)}get linearEquilibrium(){return this._linearEquilibrium}set linearLimitsX(e){this._linearLimitsX=e,this.component&&(this.component.linearLimitsX=e)}get linearLimitsX(){return this._linearLimitsX}set linearLimitsY(e){this._linearLimitsY=e,this.component&&(this.component.linearLimitsY=e)}get linearLimitsY(){return this._linearLimitsY}set linearLimitsZ(e){this._linearLimitsZ=e,this.component&&(this.component.linearLimitsZ=e)}get linearLimitsZ(){return this._linearLimitsZ}set linearMotionX(e){this._linearMotionX=e,this.component&&(this.component.linearMotionX=e)}get linearMotionX(){return this._linearMotionX}set linearMotionY(e){this._linearMotionY=e,this.component&&(this.component.linearMotionY=e)}get linearMotionY(){return this._linearMotionY}set linearMotionZ(e){this._linearMotionZ=e,this.component&&(this.component.linearMotionZ=e)}get linearMotionZ(){return this._linearMotionZ}set linearStiffness(e){this._linearStiffness=e,this.component&&(this.component.linearStiffness=e)}get linearStiffness(){return this._linearStiffness}set maxMotorForce(e){this._maxMotorForce=e,this.component&&(this.component.maxMotorForce=e)}get maxMotorForce(){return this._maxMotorForce}set motorSpeed(e){this._motorSpeed=e,this.component&&(this.component.motorSpeed=e)}get motorSpeed(){return this._motorSpeed}set swingLimitY(e){this._swingLimitY=e,this.component&&(this.component.swingLimitY=e)}get swingLimitY(){return this._swingLimitY}set swingLimitZ(e){this._swingLimitZ=e,this.component&&(this.component.swingLimitZ=e)}get swingLimitZ(){return this._swingLimitZ}set twistLimit(e){this._twistLimit=e,this.component&&(this.component.twistLimit=e)}get twistLimit(){return this._twistLimit}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-damping","angular-equilibrium","angular-limits-x","angular-limits-y","angular-limits-z","angular-motion-x","angular-motion-y","angular-motion-z","angular-stiffness","break-impulse","enable-collision","enable-limits","entity-a","entity-b","limits","linear-damping","linear-equilibrium","linear-limits-x","linear-limits-y","linear-limits-z","linear-motion-x","linear-motion-y","linear-motion-z","linear-stiffness","max-motor-force","motor-speed","swing-limit-y","swing-limit-z","twist-limit","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-damping":this.angularDamping=ti(s,i.ONE,e);break;case"angular-equilibrium":this.angularEquilibrium=ti(s,i.ZERO,e);break;case"angular-limits-x":this.angularLimitsX=ei(s,r.ZERO,e);break;case"angular-limits-y":this.angularLimitsY=ei(s,r.ZERO,e);break;case"angular-limits-z":this.angularLimitsZ=ei(s,r.ZERO,e);break;case"angular-motion-x":this.angularMotionX=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-motion-y":this.angularMotionY=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-motion-z":this.angularMotionZ=Nt(s,["locked","limited","free"],"locked",e);break;case"angular-stiffness":this.angularStiffness=ti(s,i.ZERO,e);break;case"break-impulse":this.breakImpulse=Jt(s,1/0,e);break;case"enable-collision":this.enableCollision=Qt(s,!1);break;case"enable-limits":this.enableLimits=Qt(s,!1);break;case"entity-a":this.entityA=s??"";break;case"entity-b":this.entityB=s??"";break;case"limits":this.limits=ei(s,new r(-45,45),e);break;case"linear-damping":this.linearDamping=ti(s,i.ONE,e);break;case"linear-equilibrium":this.linearEquilibrium=ti(s,i.ZERO,e);break;case"linear-limits-x":this.linearLimitsX=ei(s,r.ZERO,e);break;case"linear-limits-y":this.linearLimitsY=ei(s,r.ZERO,e);break;case"linear-limits-z":this.linearLimitsZ=ei(s,r.ZERO,e);break;case"linear-motion-x":this.linearMotionX=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-motion-y":this.linearMotionY=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-motion-z":this.linearMotionZ=Nt(s,["locked","limited","free"],"locked",e);break;case"linear-stiffness":this.linearStiffness=ti(s,i.ZERO,e);break;case"max-motor-force":this.maxMotorForce=Jt(s,0,e);break;case"motor-speed":this.motorSpeed=Jt(s,0,e);break;case"swing-limit-y":this.swingLimitY=Jt(s,45,e);break;case"swing-limit-z":this.swingLimitZ=Jt(s,45,e);break;case"twist-limit":this.twistLimit=Jt(s,20,e);break;case"type":this.type=Nt(s,["fixed","ball","hinge","slider","6dof"],"fixed",e)}}}customElements.define("pc-joint",Yi);class Ii extends Si{_minWidth=0;_minHeight=0;_maxWidth=null;_maxHeight=null;_fitWidthProportion=0;_fitHeightProportion=0;_excludeFromLayout=!1;constructor(){super("layoutchild")}getInitialComponentData(){return{minWidth:this._minWidth,minHeight:this._minHeight,maxWidth:this._maxWidth,maxHeight:this._maxHeight,fitWidthProportion:this._fitWidthProportion,fitHeightProportion:this._fitHeightProportion,excludeFromLayout:this._excludeFromLayout}}get component(){return super.component}set minWidth(e){this._minWidth=e,this.component&&(this.component.minWidth=e)}get minWidth(){return this._minWidth}set minHeight(e){this._minHeight=e,this.component&&(this.component.minHeight=e)}get minHeight(){return this._minHeight}set maxWidth(e){this._maxWidth=e,this.component&&(this.component.maxWidth=e)}get maxWidth(){return this._maxWidth}set maxHeight(e){this._maxHeight=e,this.component&&(this.component.maxHeight=e)}get maxHeight(){return this._maxHeight}set fitWidthProportion(e){this._fitWidthProportion=e,this.component&&(this.component.fitWidthProportion=e)}get fitWidthProportion(){return this._fitWidthProportion}set fitHeightProportion(e){this._fitHeightProportion=e,this.component&&(this.component.fitHeightProportion=e)}get fitHeightProportion(){return this._fitHeightProportion}set excludeFromLayout(e){this._excludeFromLayout=e,this.component&&(this.component.excludeFromLayout=e)}get excludeFromLayout(){return this._excludeFromLayout}static get observedAttributes(){return[...super.observedAttributes,"min-width","min-height","max-width","max-height","fit-width-proportion","fit-height-proportion","exclude-from-layout"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"min-width":this.minWidth=Jt(i,0,e);break;case"min-height":this.minHeight=Jt(i,0,e);break;case"max-width":this.maxWidth=Jt(i,null,e);break;case"max-height":this.maxHeight=Jt(i,null,e);break;case"fit-width-proportion":this.fitWidthProportion=Jt(i,0,e);break;case"fit-height-proportion":this.fitHeightProportion=Jt(i,0,e);break;case"exclude-from-layout":this.excludeFromLayout=Qt(i,!1)}}}customElements.define("pc-layout-child",Ii);const Ki=new Map([["horizontal",Ie],["vertical",Je]]),Qi=new Map([["none",Ke],["stretch",Qe],["shrink",Xe],["both",Ne]]);class Xi extends Si{_orientation="horizontal";_reverseX=!1;_reverseY=!1;_alignment=new r(0,1);_padding=new a(0,0,0,0);_spacing=new r(0,0);_widthFitting="none";_heightFitting="none";_wrap=!1;constructor(){super("layoutgroup")}getInitialComponentData(){return{orientation:Ki.get(this._orientation),reverseX:this._reverseX,reverseY:this._reverseY,alignment:this._alignment,padding:this._padding,spacing:this._spacing,widthFitting:Qi.get(this._widthFitting),heightFitting:Qi.get(this._heightFitting),wrap:this._wrap}}get component(){return super.component}set orientation(e){this._orientation=e,this.component&&(this.component.orientation=Ki.get(e)??Ie)}get orientation(){return this._orientation}set reverseX(e){this._reverseX=e,this.component&&(this.component.reverseX=e)}get reverseX(){return this._reverseX}set reverseY(e){this._reverseY=e,this.component&&(this.component.reverseY=e)}get reverseY(){return this._reverseY}set alignment(e){this._alignment=e,this.component&&(this.component.alignment=e)}get alignment(){return this._alignment}set padding(e){this._padding=e,this.component&&(this.component.padding=e)}get padding(){return this._padding}set spacing(e){this._spacing=e,this.component&&(this.component.spacing=e)}get spacing(){return this._spacing}set widthFitting(e){this._widthFitting=e,this.component&&(this.component.widthFitting=Qi.get(e)??Ke)}get widthFitting(){return this._widthFitting}set heightFitting(e){this._heightFitting=e,this.component&&(this.component.heightFitting=Qi.get(e)??Ke)}get heightFitting(){return this._heightFitting}set wrap(e){this._wrap=e,this.component&&(this.component.wrap=e)}get wrap(){return this._wrap}static get observedAttributes(){return[...super.observedAttributes,"orientation","reverse-x","reverse-y","alignment","padding","spacing","width-fitting","height-fitting","wrap"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"orientation":this.orientation=Nt(i,Ki,"horizontal",e);break;case"reverse-x":this.reverseX=Qt(i,!1);break;case"reverse-y":this.reverseY=Qt(i,!1);break;case"alignment":this.alignment=ei(i,new r(0,1),e);break;case"padding":this.padding=ii(i,a.ZERO,e);break;case"spacing":this.spacing=ei(i,r.ZERO,e);break;case"width-fitting":this.widthFitting=Nt(i,Qi,"none",e);break;case"height-fitting":this.heightFitting=Nt(i,Qi,"none",e);break;case"wrap":this.wrap=Qt(i,!1)}}}customElements.define("pc-layout-group",Xi);const Ni=new Map([["pcf1-16f",Ve],["pcf1-32f",et],["pcf3-16f",tt],["pcf3-32f",Ze],["pcf5-16f",it],["pcf5-32f",st],["vsm-16f",at],["vsm-32f",nt],["pcss-32f",rt]]);class Ji extends Si{_cascadeBlend=0;_cascadeDistribution=.5;_castShadows=!1;_color=new s(1,1,1);_innerConeAngle=40;_intensity=1;_normalOffsetBias=0;_numCascades=1;_outerConeAngle=45;_range=10;_shadowBias=.05;_shadowDistance=40;_shadowIntensity=1;_shadowResolution=1024;_shadowType="pcf3-32f";_type="directional";_vsmBias=.0025;_vsmBlurSize=11;_penumbraSize=1;_penumbraFalloff=1;_shadowSamples=16;_shadowBlockerSamples=16;constructor(){super("light")}getInitialComponentData(){return{cascadeBlend:this._cascadeBlend,cascadeDistribution:this._cascadeDistribution,castShadows:this._castShadows,color:this._color,innerConeAngle:this._innerConeAngle,intensity:this._intensity,normalOffsetBias:this._normalOffsetBias,numCascades:this._numCascades,outerConeAngle:this._outerConeAngle,penumbraFalloff:this._penumbraFalloff,penumbraSize:this._penumbraSize,range:this._range,shadowBias:this._shadowBias,shadowBlockerSamples:this._shadowBlockerSamples,shadowDistance:this._shadowDistance,shadowIntensity:this._shadowIntensity,shadowResolution:this._shadowResolution,shadowSamples:this._shadowSamples,shadowType:Ni.get(this._shadowType)??Ze,type:this._type,vsmBias:this._vsmBias,vsmBlurSize:this._vsmBlurSize}}get component(){return super.component}set cascadeBlend(e){this._cascadeBlend=e,this.component&&(this.component.cascadeBlend=e)}get cascadeBlend(){return this._cascadeBlend}set cascadeDistribution(e){this._cascadeDistribution=e,this.component&&(this.component.cascadeDistribution=e)}get cascadeDistribution(){return this._cascadeDistribution}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set color(e){this._color=e,this.component&&(this.component.color=e)}get color(){return this._color}set innerConeAngle(e){this._innerConeAngle=e,this.component&&(this.component.innerConeAngle=e)}get innerConeAngle(){return this._innerConeAngle}set intensity(e){this._intensity=e,this.component&&(this.component.intensity=e)}get intensity(){return this._intensity}set normalOffsetBias(e){this._normalOffsetBias=e,this.component&&(this.component.normalOffsetBias=e)}get normalOffsetBias(){return this._normalOffsetBias}set numCascades(e){this._numCascades=e,this.component&&(this.component.numCascades=e)}get numCascades(){return this._numCascades}set outerConeAngle(e){this._outerConeAngle=e,this.component&&(this.component.outerConeAngle=e)}get outerConeAngle(){return this._outerConeAngle}set range(e){this._range=e,this.component&&(this.component.range=e)}get range(){return this._range}set shadowBias(e){this._shadowBias=e,this.component&&(this.component.shadowBias=e)}get shadowBias(){return this._shadowBias}set shadowDistance(e){this._shadowDistance=e,this.component&&(this.component.shadowDistance=e)}get shadowDistance(){return this._shadowDistance}set shadowIntensity(e){this._shadowIntensity=e,this.component&&(this.component.shadowIntensity=e)}get shadowIntensity(){return this._shadowIntensity}set shadowResolution(e){this._shadowResolution=e,this.component&&(this.component.shadowResolution=e)}get shadowResolution(){return this._shadowResolution}set shadowType(e){this._shadowType=e,this.component&&(this.component.shadowType=Ni.get(e)??Ze)}get shadowType(){return this._shadowType}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set vsmBias(e){this._vsmBias=e,this.component&&(this.component.vsmBias=e)}get vsmBias(){return this._vsmBias}set vsmBlurSize(e){this._vsmBlurSize=e,this.component&&(this.component.vsmBlurSize=e)}get vsmBlurSize(){return this._vsmBlurSize}set penumbraSize(e){this._penumbraSize=e,this.component&&(this.component.penumbraSize=e)}get penumbraSize(){return this._penumbraSize}set penumbraFalloff(e){this._penumbraFalloff=e,this.component&&(this.component.penumbraFalloff=e)}get penumbraFalloff(){return this._penumbraFalloff}set shadowSamples(e){this._shadowSamples=e,this.component&&(this.component.shadowSamples=e)}get shadowSamples(){return this._shadowSamples}set shadowBlockerSamples(e){this._shadowBlockerSamples=e,this.component&&(this.component.shadowBlockerSamples=e)}get shadowBlockerSamples(){return this._shadowBlockerSamples}static get observedAttributes(){return[...super.observedAttributes,"cascade-blend","cascade-distribution","cast-shadows","color","inner-cone-angle","intensity","normal-offset-bias","num-cascades","outer-cone-angle","penumbra-falloff","penumbra-size","range","shadow-bias","shadow-blocker-samples","shadow-distance","shadow-intensity","shadow-resolution","shadow-samples","shadow-type","type","vsm-bias","vsm-blur-size"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"cascade-blend":this.cascadeBlend=Jt(i,0,e);break;case"cascade-distribution":this.cascadeDistribution=Jt(i,.5,e);break;case"cast-shadows":this.castShadows=Qt(i,!1);break;case"color":this.color=Xt(i,s.WHITE,e);break;case"inner-cone-angle":this.innerConeAngle=Jt(i,40,e);break;case"intensity":this.intensity=Jt(i,1,e);break;case"normal-offset-bias":this.normalOffsetBias=Jt(i,0,e);break;case"num-cascades":this.numCascades=Jt(i,1,e);break;case"outer-cone-angle":this.outerConeAngle=Jt(i,45,e);break;case"penumbra-falloff":this.penumbraFalloff=Jt(i,1,e);break;case"penumbra-size":this.penumbraSize=Jt(i,1,e);break;case"range":this.range=Jt(i,10,e);break;case"shadow-bias":this.shadowBias=Jt(i,.05,e);break;case"shadow-blocker-samples":this.shadowBlockerSamples=Jt(i,16,e);break;case"shadow-distance":this.shadowDistance=Jt(i,40,e);break;case"shadow-intensity":this.shadowIntensity=Jt(i,1,e);break;case"shadow-resolution":this.shadowResolution=Jt(i,1024,e);break;case"shadow-samples":this.shadowSamples=Jt(i,16,e);break;case"shadow-type":this.shadowType=Nt(i,Ni,"pcf3-32f",e);break;case"type":this.type=Nt(i,["directional","omni","spot"],"directional",e);break;case"vsm-bias":this.vsmBias=Jt(i,.0025,e);break;case"vsm-blur-size":this.vsmBlurSize=Jt(i,11,e)}}}customElements.define("pc-light",Ji);class Zi extends Si{_asset="";_binding=new wi;constructor(){super("particlesystem")}getInitialComponentData(){const e=ki(this._asset);return e&&e.resource?(this._resolveColorMap(e.resource),e.resource):{}}initComponent(){const e=ki(this._asset);e&&!e.loaded&&this._bindConfig()}disconnectedCallback(){this._binding.cancel(),super.disconnectedCallback()}get component(){return super.component}_resolveColorMap(e){if(e.colorMapAsset){const t=ki(e.colorMapAsset)?.id;t&&(e.colorMapAsset=t)}}applyConfig(e){if(this.component){this._resolveColorMap(e);for(const t in e)Object.hasOwn(e,t)&&(this.component[t]=e[t])}}_bindConfig(){this._binding.bind(this._asset,{load:e=>this.applyConfig(e.resource)})}set asset(e){this._asset=e,this.isConnected&&this._bindConfig()}get asset(){return this._asset}play(){this.component&&this.component.play()}pause(){this.component&&this.component.pause()}reset(){this.component&&this.component.reset()}stop(){this.component&&this.component.stop()}static get observedAttributes(){return[...super.observedAttributes,"asset"]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"asset"===e)this.asset=i??""}}customElements.define("pc-particle-system",Zi);const Vi=new Map([["none",lt],["normal",bt],["additive",dt],["additive-alpha",mt],["premultiplied",ut],["multiplicative",gt],["multiplicative-2x",_t],["screen",ft],["min",vt],["max",yt],["subtractive",kt]]),es=new Map([["none",wt],["back",ct],["front",Mt],["front-and-back",xt]]),ts=new Map([["none",St],["schlick",ht]]),is=new Map([["none",Ct],["ao",pt],["gloss-dependent",At]]),ss=["none","bayer8","bluenoise","ignnoise"],as=["r","g","b","a","rgb"],ns=["r","g","b","a"],rs=["gloss","gloss-invert","gloss-map"],os=["roughness","roughness-map"];class ls extends HTMLElement{_alphaTest=0;_alphaToCoverage=!1;_aoIntensity=1;_aoMap="";_aoMapChannel="g";_aoMapOffset=new r(0,0);_aoMapRotation=0;_aoMapTiling=new r(1,1);_aoMapUv=0;_blendType="none";_bumpiness=1;_cull="back";_depthBias=0;_depthTest=!0;_depthWrite=!0;_diffuse=new s(1,1,1);_diffuseMap="";_diffuseMapChannel="rgb";_diffuseMapOffset=new r(0,0);_diffuseMapRotation=0;_diffuseMapTiling=new r(1,1);_diffuseMapUv=0;_emissive=new s(0,0,0);_emissiveIntensity=1;_emissiveMap="";_emissiveMapChannel="rgb";_emissiveMapOffset=new r(0,0);_emissiveMapRotation=0;_emissiveMapTiling=new r(1,1);_emissiveMapUv=0;_enableGGXSpecular=!1;_fresnelModel="schlick";_gloss=.25;_glossInvert=!1;_glossMap="";_glossMapChannel="g";_glossMapOffset=new r(0,0);_glossMapRotation=0;_glossMapTiling=new r(1,1);_glossMapUv=0;_heightMap="";_heightMapChannel="g";_heightMapFactor=1;_heightMapOffset=new r(0,0);_heightMapRotation=0;_heightMapTiling=new r(1,1);_heightMapUv=0;_metalness=0;_metalnessMap="";_metalnessMapChannel="g";_metalnessMapOffset=new r(0,0);_metalnessMapRotation=0;_metalnessMapTiling=new r(1,1);_metalnessMapUv=0;_name="Untitled";_normalMap="";_normalMapOffset=new r(0,0);_normalMapRotation=0;_normalMapTiling=new r(1,1);_normalMapUv=0;_occludeDirect=!1;_occludeSpecular="ao";_opacity=1;_opacityDither="none";_opacityFadesSpecular=!0;_opacityMap="";_opacityMapChannel="a";_opacityMapOffset=new r(0,0);_opacityMapRotation=0;_opacityMapTiling=new r(1,1);_opacityMapUv=0;_slopeDepthBias=0;_specular=new s(0,0,0);_specularityFactor=1;_twoSidedLighting=!1;_useFog=!0;_useLighting=!0;_useMetalness=!0;_useMetalnessSpecularColor=!1;_useSkybox=!0;_useTonemap=!0;_mapBindings=new Map;_updateScheduled=!1;_glossConflictWarned=!1;material=null;async connectedCallback(){const e=this.parentElement?.closest("pc-app")??null;if(e&&this.parentElement===e){if(await e.ready(),this.isConnected&&this.parentElement===e&&!this.material){if(!e.app)return;this._createMaterial()}}else console.warn(`pc-material '${this.id}' must be a direct child of pc-app - material not created`)}_createMaterial(){const e=new ot;this.material=e,e.alphaTest=this._alphaTest,e.alphaToCoverage=this._alphaToCoverage,e.aoIntensity=this._aoIntensity,e.aoMapChannel=this._aoMapChannel,e.aoMapOffset=this._aoMapOffset,e.aoMapRotation=this._aoMapRotation,e.aoMapTiling=this._aoMapTiling,e.aoMapUv=this._aoMapUv,e.blendType=Vi.get(this._blendType)??lt,e.bumpiness=this._bumpiness,e.cull=es.get(this._cull)??ct,e.depthBias=this._depthBias,e.depthTest=this._depthTest,e.depthWrite=this._depthWrite,e.diffuse=this._diffuse,e.diffuseMapChannel=this._diffuseMapChannel,e.diffuseMapOffset=this._diffuseMapOffset,e.diffuseMapRotation=this._diffuseMapRotation,e.diffuseMapTiling=this._diffuseMapTiling,e.diffuseMapUv=this._diffuseMapUv,e.emissive=this._emissive,e.emissiveIntensity=this._emissiveIntensity,e.emissiveMapChannel=this._emissiveMapChannel,e.emissiveMapOffset=this._emissiveMapOffset,e.emissiveMapRotation=this._emissiveMapRotation,e.emissiveMapTiling=this._emissiveMapTiling,e.emissiveMapUv=this._emissiveMapUv,e.enableGGXSpecular=this._enableGGXSpecular,e.fresnelModel=ts.get(this._fresnelModel)??ht,e.gloss=this._gloss,e.glossInvert=this._glossInvert,e.glossMapChannel=this._glossMapChannel,e.glossMapOffset=this._glossMapOffset,e.glossMapRotation=this._glossMapRotation,e.glossMapTiling=this._glossMapTiling,e.glossMapUv=this._glossMapUv,e.heightMapChannel=this._heightMapChannel,e.heightMapFactor=this._heightMapFactor,e.heightMapOffset=this._heightMapOffset,e.heightMapRotation=this._heightMapRotation,e.heightMapTiling=this._heightMapTiling,e.heightMapUv=this._heightMapUv,e.metalness=this._metalness,e.metalnessMapChannel=this._metalnessMapChannel,e.metalnessMapOffset=this._metalnessMapOffset,e.metalnessMapRotation=this._metalnessMapRotation,e.metalnessMapTiling=this._metalnessMapTiling,e.metalnessMapUv=this._metalnessMapUv,e.name=this._name,e.normalMapOffset=this._normalMapOffset,e.normalMapRotation=this._normalMapRotation,e.normalMapTiling=this._normalMapTiling,e.normalMapUv=this._normalMapUv,e.occludeDirect=this._occludeDirect,e.occludeSpecular=is.get(this._occludeSpecular)??pt,e.opacity=this._opacity,e.opacityDither=this._opacityDither,e.opacityFadesSpecular=this._opacityFadesSpecular,e.opacityMapChannel=this._opacityMapChannel,e.opacityMapOffset=this._opacityMapOffset,e.opacityMapRotation=this._opacityMapRotation,e.opacityMapTiling=this._opacityMapTiling,e.opacityMapUv=this._opacityMapUv,e.slopeDepthBias=this._slopeDepthBias,e.specular=this._specular,e.specularityFactor=this._specularityFactor,e.twoSidedLighting=this._twoSidedLighting,e.useFog=this._useFog,e.useLighting=this._useLighting,e.useMetalness=this._useMetalness,e.useMetalnessSpecularColor=this._useMetalnessSpecularColor,e.useSkybox=this._useSkybox,e.useTonemap=this._useTonemap,this.aoMap=this._aoMap,this.diffuseMap=this._diffuseMap,this.emissiveMap=this._emissiveMap,this.glossMap=this._glossMap,this.heightMap=this._heightMap,this.metalnessMap=this._metalnessMap,this.normalMap=this._normalMap,this.opacityMap=this._opacityMap,e.update()}disconnectedCallback(){for(const e of this._mapBindings.values())e.cancel();this.material&&(this.material.destroy(),this.material=null)}_scheduleUpdate(){this._updateScheduled||(this._updateScheduled=!0,queueMicrotask(()=>{this._updateScheduled=!1,this.material?.update()}))}_warnGlossConflict(){const e=e=>`'${e.join("', '")}'`,t=os.filter(e=>this.hasAttribute(e)),i=rs.filter(e=>this.hasAttribute(e));0!==t.length&&0!==i.length?this._glossConflictWarned||(this._glossConflictWarned=!0,console.warn(`pc-material '${this.id}' sets both ${e(t)} and ${e(i)} - the roughness-* attributes invert gloss, so the two families contradict each other. Use one or the other.`)):this._glossConflictWarned=!1}_setMap(e,t){let i=this._mapBindings.get(t);if(i||(i=new wi,this._mapBindings.set(t,i)),i.cancel(),this.material)return e?void i.bind(e,{load:e=>this._applyMap(t,e.resource)}):(this.material[t]=null,void this._scheduleUpdate())}_applyMap(e,t){this.material&&(this.material[e]=t,this._scheduleUpdate())}set alphaTest(e){this._alphaTest=e,this.material&&(this.material.alphaTest=e,this._scheduleUpdate())}get alphaTest(){return this._alphaTest}set alphaToCoverage(e){this._alphaToCoverage=e,this.material&&(this.material.alphaToCoverage=e,this._scheduleUpdate())}get alphaToCoverage(){return this._alphaToCoverage}set aoIntensity(e){this._aoIntensity=e,this.material&&(this.material.aoIntensity=e,this._scheduleUpdate())}get aoIntensity(){return this._aoIntensity}set aoMap(e){this._aoMap=e,this._setMap(e,"aoMap")}get aoMap(){return this._aoMap}set aoMapChannel(e){this._aoMapChannel=e,this.material&&(this.material.aoMapChannel=e,this._scheduleUpdate())}get aoMapChannel(){return this._aoMapChannel}set aoMapOffset(e){this._aoMapOffset=e,this.material&&(this.material.aoMapOffset=e,this._scheduleUpdate())}get aoMapOffset(){return this._aoMapOffset}set aoMapRotation(e){this._aoMapRotation=e,this.material&&(this.material.aoMapRotation=e,this._scheduleUpdate())}get aoMapRotation(){return this._aoMapRotation}set aoMapTiling(e){this._aoMapTiling=e,this.material&&(this.material.aoMapTiling=e,this._scheduleUpdate())}get aoMapTiling(){return this._aoMapTiling}set aoMapUv(e){this._aoMapUv=e,this.material&&(this.material.aoMapUv=e,this._scheduleUpdate())}get aoMapUv(){return this._aoMapUv}set blendType(e){this._blendType=e,this.material&&(this.material.blendType=Vi.get(e)??lt,this._scheduleUpdate())}get blendType(){return this._blendType}set bumpiness(e){this._bumpiness=e,this.material&&(this.material.bumpiness=e,this._scheduleUpdate())}get bumpiness(){return this._bumpiness}set cull(e){this._cull=e,this.material&&(this.material.cull=es.get(e)??ct,this._scheduleUpdate())}get cull(){return this._cull}set depthBias(e){this._depthBias=e,this.material&&(this.material.depthBias=e,this._scheduleUpdate())}get depthBias(){return this._depthBias}set depthTest(e){this._depthTest=e,this.material&&(this.material.depthTest=e,this._scheduleUpdate())}get depthTest(){return this._depthTest}set depthWrite(e){this._depthWrite=e,this.material&&(this.material.depthWrite=e,this._scheduleUpdate())}get depthWrite(){return this._depthWrite}set diffuse(e){this._diffuse=e,this.material&&(this.material.diffuse=e,this._scheduleUpdate())}get diffuse(){return this._diffuse}set diffuseMap(e){this._diffuseMap=e,this._setMap(e,"diffuseMap")}get diffuseMap(){return this._diffuseMap}set diffuseMapChannel(e){this._diffuseMapChannel=e,this.material&&(this.material.diffuseMapChannel=e,this._scheduleUpdate())}get diffuseMapChannel(){return this._diffuseMapChannel}set diffuseMapOffset(e){this._diffuseMapOffset=e,this.material&&(this.material.diffuseMapOffset=e,this._scheduleUpdate())}get diffuseMapOffset(){return this._diffuseMapOffset}set diffuseMapRotation(e){this._diffuseMapRotation=e,this.material&&(this.material.diffuseMapRotation=e,this._scheduleUpdate())}get diffuseMapRotation(){return this._diffuseMapRotation}set diffuseMapTiling(e){this._diffuseMapTiling=e,this.material&&(this.material.diffuseMapTiling=e,this._scheduleUpdate())}get diffuseMapTiling(){return this._diffuseMapTiling}set diffuseMapUv(e){this._diffuseMapUv=e,this.material&&(this.material.diffuseMapUv=e,this._scheduleUpdate())}get diffuseMapUv(){return this._diffuseMapUv}set emissive(e){this._emissive=e,this.material&&(this.material.emissive=e,this._scheduleUpdate())}get emissive(){return this._emissive}set emissiveIntensity(e){this._emissiveIntensity=e,this.material&&(this.material.emissiveIntensity=e,this._scheduleUpdate())}get emissiveIntensity(){return this._emissiveIntensity}set emissiveMap(e){this._emissiveMap=e,this._setMap(e,"emissiveMap")}get emissiveMap(){return this._emissiveMap}set emissiveMapChannel(e){this._emissiveMapChannel=e,this.material&&(this.material.emissiveMapChannel=e,this._scheduleUpdate())}get emissiveMapChannel(){return this._emissiveMapChannel}set emissiveMapOffset(e){this._emissiveMapOffset=e,this.material&&(this.material.emissiveMapOffset=e,this._scheduleUpdate())}get emissiveMapOffset(){return this._emissiveMapOffset}set emissiveMapRotation(e){this._emissiveMapRotation=e,this.material&&(this.material.emissiveMapRotation=e,this._scheduleUpdate())}get emissiveMapRotation(){return this._emissiveMapRotation}set emissiveMapTiling(e){this._emissiveMapTiling=e,this.material&&(this.material.emissiveMapTiling=e,this._scheduleUpdate())}get emissiveMapTiling(){return this._emissiveMapTiling}set emissiveMapUv(e){this._emissiveMapUv=e,this.material&&(this.material.emissiveMapUv=e,this._scheduleUpdate())}get emissiveMapUv(){return this._emissiveMapUv}set enableGGXSpecular(e){this._enableGGXSpecular=e,this.material&&(this.material.enableGGXSpecular=e,this._scheduleUpdate())}get enableGGXSpecular(){return this._enableGGXSpecular}set fresnelModel(e){this._fresnelModel=e,this.material&&(this.material.fresnelModel=ts.get(e)??ht,this._scheduleUpdate())}get fresnelModel(){return this._fresnelModel}set gloss(e){this._gloss=e,this.material&&(this.material.gloss=e,this._scheduleUpdate())}get gloss(){return this._gloss}set glossInvert(e){this._glossInvert=e,this.material&&(this.material.glossInvert=e,this._scheduleUpdate())}get glossInvert(){return this._glossInvert}set glossMap(e){this._glossMap=e,this._setMap(e,"glossMap")}get glossMap(){return this._glossMap}set glossMapChannel(e){this._glossMapChannel=e,this.material&&(this.material.glossMapChannel=e,this._scheduleUpdate())}get glossMapChannel(){return this._glossMapChannel}set glossMapOffset(e){this._glossMapOffset=e,this.material&&(this.material.glossMapOffset=e,this._scheduleUpdate())}get glossMapOffset(){return this._glossMapOffset}set glossMapRotation(e){this._glossMapRotation=e,this.material&&(this.material.glossMapRotation=e,this._scheduleUpdate())}get glossMapRotation(){return this._glossMapRotation}set glossMapTiling(e){this._glossMapTiling=e,this.material&&(this.material.glossMapTiling=e,this._scheduleUpdate())}get glossMapTiling(){return this._glossMapTiling}set glossMapUv(e){this._glossMapUv=e,this.material&&(this.material.glossMapUv=e,this._scheduleUpdate())}get glossMapUv(){return this._glossMapUv}set heightMap(e){this._heightMap=e,this._setMap(e,"heightMap")}get heightMap(){return this._heightMap}set heightMapChannel(e){this._heightMapChannel=e,this.material&&(this.material.heightMapChannel=e,this._scheduleUpdate())}get heightMapChannel(){return this._heightMapChannel}set heightMapFactor(e){this._heightMapFactor=e,this.material&&(this.material.heightMapFactor=e,this._scheduleUpdate())}get heightMapFactor(){return this._heightMapFactor}set heightMapOffset(e){this._heightMapOffset=e,this.material&&(this.material.heightMapOffset=e,this._scheduleUpdate())}get heightMapOffset(){return this._heightMapOffset}set heightMapRotation(e){this._heightMapRotation=e,this.material&&(this.material.heightMapRotation=e,this._scheduleUpdate())}get heightMapRotation(){return this._heightMapRotation}set heightMapTiling(e){this._heightMapTiling=e,this.material&&(this.material.heightMapTiling=e,this._scheduleUpdate())}get heightMapTiling(){return this._heightMapTiling}set heightMapUv(e){this._heightMapUv=e,this.material&&(this.material.heightMapUv=e,this._scheduleUpdate())}get heightMapUv(){return this._heightMapUv}set metalness(e){this._metalness=e,this.material&&(this.material.metalness=e,this._scheduleUpdate())}get metalness(){return this._metalness}set metalnessMap(e){this._metalnessMap=e,this._setMap(e,"metalnessMap")}get metalnessMap(){return this._metalnessMap}set metalnessMapChannel(e){this._metalnessMapChannel=e,this.material&&(this.material.metalnessMapChannel=e,this._scheduleUpdate())}get metalnessMapChannel(){return this._metalnessMapChannel}set metalnessMapOffset(e){this._metalnessMapOffset=e,this.material&&(this.material.metalnessMapOffset=e,this._scheduleUpdate())}get metalnessMapOffset(){return this._metalnessMapOffset}set metalnessMapRotation(e){this._metalnessMapRotation=e,this.material&&(this.material.metalnessMapRotation=e,this._scheduleUpdate())}get metalnessMapRotation(){return this._metalnessMapRotation}set metalnessMapTiling(e){this._metalnessMapTiling=e,this.material&&(this.material.metalnessMapTiling=e,this._scheduleUpdate())}get metalnessMapTiling(){return this._metalnessMapTiling}set metalnessMapUv(e){this._metalnessMapUv=e,this.material&&(this.material.metalnessMapUv=e,this._scheduleUpdate())}get metalnessMapUv(){return this._metalnessMapUv}set name(e){this._name=e,this.material&&(this.material.name=e)}get name(){return this._name}set normalMap(e){this._normalMap=e,this._setMap(e,"normalMap")}get normalMap(){return this._normalMap}set normalMapOffset(e){this._normalMapOffset=e,this.material&&(this.material.normalMapOffset=e,this._scheduleUpdate())}get normalMapOffset(){return this._normalMapOffset}set normalMapRotation(e){this._normalMapRotation=e,this.material&&(this.material.normalMapRotation=e,this._scheduleUpdate())}get normalMapRotation(){return this._normalMapRotation}set normalMapTiling(e){this._normalMapTiling=e,this.material&&(this.material.normalMapTiling=e,this._scheduleUpdate())}get normalMapTiling(){return this._normalMapTiling}set normalMapUv(e){this._normalMapUv=e,this.material&&(this.material.normalMapUv=e,this._scheduleUpdate())}get normalMapUv(){return this._normalMapUv}set occludeDirect(e){this._occludeDirect=e,this.material&&(this.material.occludeDirect=e,this._scheduleUpdate())}get occludeDirect(){return this._occludeDirect}set occludeSpecular(e){this._occludeSpecular=e,this.material&&(this.material.occludeSpecular=is.get(e)??pt,this._scheduleUpdate())}get occludeSpecular(){return this._occludeSpecular}set opacity(e){this._opacity=e,this.material&&(this.material.opacity=e,this._scheduleUpdate())}get opacity(){return this._opacity}set opacityDither(e){this._opacityDither=e,this.material&&(this.material.opacityDither=e,this._scheduleUpdate())}get opacityDither(){return this._opacityDither}set opacityFadesSpecular(e){this._opacityFadesSpecular=e,this.material&&(this.material.opacityFadesSpecular=e,this._scheduleUpdate())}get opacityFadesSpecular(){return this._opacityFadesSpecular}set opacityMap(e){this._opacityMap=e,this._setMap(e,"opacityMap")}get opacityMap(){return this._opacityMap}set opacityMapChannel(e){this._opacityMapChannel=e,this.material&&(this.material.opacityMapChannel=e,this._scheduleUpdate())}get opacityMapChannel(){return this._opacityMapChannel}set opacityMapOffset(e){this._opacityMapOffset=e,this.material&&(this.material.opacityMapOffset=e,this._scheduleUpdate())}get opacityMapOffset(){return this._opacityMapOffset}set opacityMapRotation(e){this._opacityMapRotation=e,this.material&&(this.material.opacityMapRotation=e,this._scheduleUpdate())}get opacityMapRotation(){return this._opacityMapRotation}set opacityMapTiling(e){this._opacityMapTiling=e,this.material&&(this.material.opacityMapTiling=e,this._scheduleUpdate())}get opacityMapTiling(){return this._opacityMapTiling}set opacityMapUv(e){this._opacityMapUv=e,this.material&&(this.material.opacityMapUv=e,this._scheduleUpdate())}get opacityMapUv(){return this._opacityMapUv}set roughness(e){this.gloss=e,this.glossInvert=!0}get roughness(){return this._gloss}set roughnessMap(e){this.glossMap=e,this.glossInvert=!0}get roughnessMap(){return this._glossMap}set slopeDepthBias(e){this._slopeDepthBias=e,this.material&&(this.material.slopeDepthBias=e,this._scheduleUpdate())}get slopeDepthBias(){return this._slopeDepthBias}set specular(e){this._specular=e,this.material&&(this.material.specular=e,this._scheduleUpdate())}get specular(){return this._specular}set specularityFactor(e){this._specularityFactor=e,this.material&&(this.material.specularityFactor=e,this._scheduleUpdate())}get specularityFactor(){return this._specularityFactor}set twoSidedLighting(e){this._twoSidedLighting=e,this.material&&(this.material.twoSidedLighting=e,this._scheduleUpdate())}get twoSidedLighting(){return this._twoSidedLighting}set useFog(e){this._useFog=e,this.material&&(this.material.useFog=e,this._scheduleUpdate())}get useFog(){return this._useFog}set useLighting(e){this._useLighting=e,this.material&&(this.material.useLighting=e,this._scheduleUpdate())}get useLighting(){return this._useLighting}set useMetalness(e){this._useMetalness=e,this.material&&(this.material.useMetalness=e,this._scheduleUpdate())}get useMetalness(){return this._useMetalness}set useMetalnessSpecularColor(e){this._useMetalnessSpecularColor=e,this.material&&(this.material.useMetalnessSpecularColor=e,this._scheduleUpdate())}get useMetalnessSpecularColor(){return this._useMetalnessSpecularColor}set useSkybox(e){this._useSkybox=e,this.material&&(this.material.useSkybox=e,this._scheduleUpdate())}get useSkybox(){return this._useSkybox}set useTonemap(e){this._useTonemap=e,this.material&&(this.material.useTonemap=e,this._scheduleUpdate())}get useTonemap(){return this._useTonemap}static get(e){const t=document.querySelector(`pc-material[id="${e}"]`);return t?.material}static get observedAttributes(){return["alpha-test","alpha-to-coverage","ao-intensity","ao-map","ao-map-channel","ao-map-offset","ao-map-rotation","ao-map-tiling","ao-map-uv","blend-type","bumpiness","cull","depth-bias","depth-test","depth-write","diffuse","diffuse-map","diffuse-map-channel","diffuse-map-offset","diffuse-map-rotation","diffuse-map-tiling","diffuse-map-uv","emissive","emissive-intensity","emissive-map","emissive-map-channel","emissive-map-offset","emissive-map-rotation","emissive-map-tiling","emissive-map-uv","enable-ggx-specular","fresnel-model","gloss","gloss-invert","gloss-map","gloss-map-channel","gloss-map-offset","gloss-map-rotation","gloss-map-tiling","gloss-map-uv","height-map","height-map-channel","height-map-factor","height-map-offset","height-map-rotation","height-map-tiling","height-map-uv","metalness","metalness-map","metalness-map-channel","metalness-map-offset","metalness-map-rotation","metalness-map-tiling","metalness-map-uv","name","normal-map","normal-map-offset","normal-map-rotation","normal-map-tiling","normal-map-uv","occlude-direct","occlude-specular","opacity","opacity-dither","opacity-fades-specular","opacity-map","opacity-map-channel","opacity-map-offset","opacity-map-rotation","opacity-map-tiling","opacity-map-uv","roughness","roughness-map","slope-depth-bias","specular","specularity-factor","two-sided-lighting","use-fog","use-lighting","use-metalness","use-metalness-specular-color","use-skybox","use-tonemap"]}attributeChangedCallback(e,t,i){switch(e){case"alpha-test":this.alphaTest=Jt(i,0,e);break;case"alpha-to-coverage":this.alphaToCoverage=Qt(i,!1);break;case"ao-intensity":this.aoIntensity=Jt(i,1,e);break;case"ao-map":this.aoMap=i??"";break;case"ao-map-channel":this.aoMapChannel=Nt(i,ns,"g",e);break;case"ao-map-offset":this.aoMapOffset=ei(i,new r(0,0),e);break;case"ao-map-rotation":this.aoMapRotation=Jt(i,0,e);break;case"ao-map-tiling":this.aoMapTiling=ei(i,new r(1,1),e);break;case"ao-map-uv":this.aoMapUv=Jt(i,0,e);break;case"blend-type":this.blendType=Nt(i,Vi,"none",e);break;case"bumpiness":this.bumpiness=Jt(i,1,e);break;case"cull":this.cull=Nt(i,es,"back",e);break;case"depth-bias":this.depthBias=Jt(i,0,e);break;case"depth-test":this.depthTest=Qt(i,!0);break;case"depth-write":this.depthWrite=Qt(i,!0);break;case"diffuse":this.diffuse=Xt(i,new s(1,1,1),e);break;case"diffuse-map":this.diffuseMap=i??"";break;case"diffuse-map-channel":this.diffuseMapChannel=Nt(i,as,"rgb",e);break;case"diffuse-map-offset":this.diffuseMapOffset=ei(i,new r(0,0),e);break;case"diffuse-map-rotation":this.diffuseMapRotation=Jt(i,0,e);break;case"diffuse-map-tiling":this.diffuseMapTiling=ei(i,new r(1,1),e);break;case"diffuse-map-uv":this.diffuseMapUv=Jt(i,0,e);break;case"emissive":this.emissive=Xt(i,new s(0,0,0),e);break;case"emissive-intensity":this.emissiveIntensity=Jt(i,1,e);break;case"emissive-map":this.emissiveMap=i??"";break;case"emissive-map-channel":this.emissiveMapChannel=Nt(i,as,"rgb",e);break;case"emissive-map-offset":this.emissiveMapOffset=ei(i,new r(0,0),e);break;case"emissive-map-rotation":this.emissiveMapRotation=Jt(i,0,e);break;case"emissive-map-tiling":this.emissiveMapTiling=ei(i,new r(1,1),e);break;case"emissive-map-uv":this.emissiveMapUv=Jt(i,0,e);break;case"enable-ggx-specular":this.enableGGXSpecular=Qt(i,!1);break;case"fresnel-model":this.fresnelModel=Nt(i,ts,"schlick",e);break;case"gloss":this.gloss=Jt(i,.25,e),this._warnGlossConflict();break;case"gloss-invert":this.glossInvert=Qt(i,!1),this._warnGlossConflict();break;case"gloss-map":this.glossMap=i??"",this._warnGlossConflict();break;case"gloss-map-channel":this.glossMapChannel=Nt(i,ns,"g",e);break;case"gloss-map-offset":this.glossMapOffset=ei(i,new r(0,0),e);break;case"gloss-map-rotation":this.glossMapRotation=Jt(i,0,e);break;case"gloss-map-tiling":this.glossMapTiling=ei(i,new r(1,1),e);break;case"gloss-map-uv":this.glossMapUv=Jt(i,0,e);break;case"height-map":this.heightMap=i??"";break;case"height-map-channel":this.heightMapChannel=Nt(i,ns,"g",e);break;case"height-map-factor":this.heightMapFactor=Jt(i,1,e);break;case"height-map-offset":this.heightMapOffset=ei(i,new r(0,0),e);break;case"height-map-rotation":this.heightMapRotation=Jt(i,0,e);break;case"height-map-tiling":this.heightMapTiling=ei(i,new r(1,1),e);break;case"height-map-uv":this.heightMapUv=Jt(i,0,e);break;case"metalness":this.metalness=Jt(i,0,e);break;case"metalness-map":this.metalnessMap=i??"";break;case"metalness-map-channel":this.metalnessMapChannel=Nt(i,ns,"g",e);break;case"metalness-map-offset":this.metalnessMapOffset=ei(i,new r(0,0),e);break;case"metalness-map-rotation":this.metalnessMapRotation=Jt(i,0,e);break;case"metalness-map-tiling":this.metalnessMapTiling=ei(i,new r(1,1),e);break;case"metalness-map-uv":this.metalnessMapUv=Jt(i,0,e);break;case"name":this.name=i??"Untitled";break;case"normal-map":this.normalMap=i??"";break;case"normal-map-offset":this.normalMapOffset=ei(i,new r(0,0),e);break;case"normal-map-rotation":this.normalMapRotation=Jt(i,0,e);break;case"normal-map-tiling":this.normalMapTiling=ei(i,new r(1,1),e);break;case"normal-map-uv":this.normalMapUv=Jt(i,0,e);break;case"occlude-direct":this.occludeDirect=Qt(i,!1);break;case"occlude-specular":this.occludeSpecular=Nt(i,is,"ao",e);break;case"opacity":this.opacity=Jt(i,1,e);break;case"opacity-dither":this.opacityDither=Nt(i,ss,"none",e);break;case"opacity-fades-specular":this.opacityFadesSpecular=Qt(i,!0);break;case"opacity-map":this.opacityMap=i??"";break;case"opacity-map-channel":this.opacityMapChannel=Nt(i,ns,"a",e);break;case"opacity-map-offset":this.opacityMapOffset=ei(i,new r(0,0),e);break;case"opacity-map-rotation":this.opacityMapRotation=Jt(i,0,e);break;case"opacity-map-tiling":this.opacityMapTiling=ei(i,new r(1,1),e);break;case"opacity-map-uv":this.opacityMapUv=Jt(i,0,e);break;case"roughness":this.gloss=Jt(i,.25,e),this.glossInvert=null!==i,this._warnGlossConflict();break;case"roughness-map":this.glossMap=i??"",this.glossInvert=null!==i,this._warnGlossConflict();break;case"slope-depth-bias":this.slopeDepthBias=Jt(i,0,e);break;case"specular":this.specular=Xt(i,new s(0,0,0),e);break;case"specularity-factor":this.specularityFactor=Jt(i,1,e);break;case"two-sided-lighting":this.twoSidedLighting=Qt(i,!1);break;case"use-fog":this.useFog=Qt(i,!0);break;case"use-lighting":this.useLighting=Qt(i,!0);break;case"use-metalness":this.useMetalness=Qt(i,!0);break;case"use-metalness-specular-color":this.useMetalnessSpecularColor=Qt(i,!1);break;case"use-skybox":this.useSkybox=Qt(i,!0);break;case"use-tonemap":this.useTonemap=Qt(i,!0)}}}customElements.define("pc-material",ls);class cs extends Si{_castShadows=!0;_material="";_receiveShadows=!0;_type="box";constructor(){super("render")}getInitialComponentData(){return{type:this._type,castShadows:this._castShadows,material:ls.get(this._material),receiveShadows:this._receiveShadows}}get component(){return super.component}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set material(e){this._material=e;const t=ls.get(e);this.component&&t&&(this.component.material=t)}get material(){return this._material}set receiveShadows(e){this._receiveShadows=e,this.component&&(this.component.receiveShadows=e)}get receiveShadows(){return this._receiveShadows}static get observedAttributes(){return[...super.observedAttributes,"cast-shadows","material","receive-shadows","type"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"cast-shadows":this.castShadows=Qt(i,!0);break;case"material":this.material=i??"";break;case"receive-shadows":this.receiveShadows=Qt(i,!0);break;case"type":this.type=Nt(i,["box","capsule","cone","cylinder","plane","sphere"],"box",e)}}}customElements.define("pc-render",cs);class hs extends Si{_angularDamping=0;_angularFactor=new i(1,1,1);_friction=.5;_linearDamping=0;_linearFactor=new i(1,1,1);_mass=1;_restitution=0;_rollingFriction=0;_type="static";constructor(){super("rigidbody")}getInitialComponentData(){return{angularDamping:this._angularDamping,angularFactor:this._angularFactor,friction:this._friction,linearDamping:this._linearDamping,linearFactor:this._linearFactor,mass:this._mass,restitution:this._restitution,rollingFriction:this._rollingFriction,type:this._type}}get component(){return super.component}set angularDamping(e){this._angularDamping=e,this.component&&(this.component.angularDamping=e)}get angularDamping(){return this._angularDamping}set angularFactor(e){this._angularFactor=e,this.component&&(this.component.angularFactor=e)}get angularFactor(){return this._angularFactor}set friction(e){this._friction=e,this.component&&(this.component.friction=e)}get friction(){return this._friction}set linearDamping(e){this._linearDamping=e,this.component&&(this.component.linearDamping=e)}get linearDamping(){return this._linearDamping}set linearFactor(e){this._linearFactor=e,this.component&&(this.component.linearFactor=e)}get linearFactor(){return this._linearFactor}set mass(e){this._mass=e,this.component&&(this.component.mass=e)}get mass(){return this._mass}set restitution(e){this._restitution=e,this.component&&(this.component.restitution=e)}get restitution(){return this._restitution}set rollingFriction(e){this._rollingFriction=e,this.component&&(this.component.rollingFriction=e)}get rollingFriction(){return this._rollingFriction}set type(e){this._type=e,this.component&&(this.component.type=e)}get type(){return this._type}static get observedAttributes(){return[...super.observedAttributes,"angular-damping","angular-factor","friction","linear-damping","linear-factor","mass","restitution","rolling-friction","type"]}attributeChangedCallback(e,t,s){switch(super.attributeChangedCallback(e,t,s),e){case"angular-damping":this.angularDamping=Jt(s,0,e);break;case"angular-factor":this.angularFactor=ti(s,i.ONE,e);break;case"friction":this.friction=Jt(s,.5,e);break;case"linear-damping":this.linearDamping=Jt(s,0,e);break;case"linear-factor":this.linearFactor=ti(s,i.ONE,e);break;case"mass":this.mass=Jt(s,1,e);break;case"restitution":this.restitution=Jt(s,0,e);break;case"rolling-friction":this.rollingFriction=Jt(s,0,e);break;case"type":this.type=Nt(s,["static","dynamic","kinematic"],"static",e)}}}customElements.define("pc-rigid-body",hs);const ps=new Map([["none",Ft],["blend",Et]]);class bs extends Si{_screenSpace=!1;_resolution=new r(640,320);_referenceResolution=new r(640,320);_priority=0;_scaleMode="none";_scaleBlend=.5;constructor(){super("screen")}getInitialComponentData(){return{priority:this._priority,referenceResolution:this._referenceResolution,resolution:this._resolution,scaleBlend:this._scaleBlend,scaleMode:ps.get(this._scaleMode)??Ft,screenSpace:this._screenSpace}}get component(){return super.component}set priority(e){this._priority=e,this.component&&(this.component.priority=this._priority)}get priority(){return this._priority}set referenceResolution(e){this._referenceResolution=e,this.component&&(this.component.referenceResolution=this._referenceResolution)}get referenceResolution(){return this._referenceResolution}set resolution(e){this._resolution=e,this.component&&(this.component.resolution=this._resolution)}get resolution(){return this._resolution}set scaleBlend(e){this._scaleBlend=e,this.component&&(this.component.scaleBlend=this._scaleBlend)}get scaleBlend(){return this._scaleBlend}set scaleMode(e){this._scaleMode=e,this.component&&(this.component.scaleMode=ps.get(e)??Ft)}get scaleMode(){return this._scaleMode}set screenSpace(e){this._screenSpace=e,this.component&&(this.component.screenSpace=this._screenSpace)}get screenSpace(){return this._screenSpace}static get observedAttributes(){return[...super.observedAttributes,"screen-space","resolution","reference-resolution","priority","scale-blend","scale-mode"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"priority":this.priority=Jt(i,0,e);break;case"reference-resolution":this.referenceResolution=ei(i,new r(640,320),e);break;case"resolution":this.resolution=ei(i,new r(640,320),e);break;case"scale-blend":this.scaleBlend=Jt(i,.5,e);break;case"scale-mode":this.scaleMode=Nt(i,ps,"none",e);break;case"screen-space":this.screenSpace=Qt(i,!1)}}}customElements.define("pc-screen",bs);const ds=new Map([["horizontal",Ie],["vertical",Je]]);class ms extends Si{_orientation="horizontal";_value=0;_handleSize=.5;_handle="";constructor(){super("scrollbar")}getInitialComponentData(){const e={orientation:ds.get(this._orientation),value:this._value,handleSize:this._handleSize},t=Bi(this._handle,this,"handle","reference ignored");return t&&(e.handleEntity=t),e}get component(){return super.component}set orientation(e){this._orientation=e,this.component&&(this.component.orientation=ds.get(e)??Ie)}get orientation(){return this._orientation}set value(e){this._value=e,this.component&&(this.component.value=e)}get value(){return this._value}set handleSize(e){this._handleSize=e,this.component&&(this.component.handleSize=e)}get handleSize(){return this._handleSize}set handle(e){if(this._handle=e,this.component){const t=Bi(e,this,"handle","reference ignored");t&&(this.component.handleEntity=t)}}get handle(){return this._handle}static get observedAttributes(){return[...super.observedAttributes,"orientation","value","handle-size","handle"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"orientation":this.orientation=Nt(i,ds,"horizontal",e);break;case"value":this.value=Jt(i,0,e);break;case"handle-size":this.handleSize=Jt(i,.5,e);break;case"handle":this.handle=i??""}}}customElements.define("pc-scrollbar",ms);const us=new Map([["clamp",zt],["bounce",Rt],["infinite",Lt]]),gs=new Map([["always",Ot],["when-required",jt]]);class _s extends Si{_horizontal=!0;_vertical=!0;_scrollMode="bounce";_bounceAmount=.1;_friction=.05;_useMouseWheel=!0;_mouseWheelSensitivity=new r(1,1);_horizontalScrollbarVisibility="when-required";_verticalScrollbarVisibility="when-required";_viewport="";_content="";_horizontalScrollbar="";_verticalScrollbar="";constructor(){super("scrollview")}getInitialComponentData(){const e={horizontal:this._horizontal,vertical:this._vertical,scrollMode:us.get(this._scrollMode),bounceAmount:this._bounceAmount,friction:this._friction,useMouseWheel:this._useMouseWheel,mouseWheelSensitivity:this._mouseWheelSensitivity,horizontalScrollbarVisibility:gs.get(this._horizontalScrollbarVisibility),verticalScrollbarVisibility:gs.get(this._verticalScrollbarVisibility)},t=Bi(this._viewport,this,"viewport","reference ignored");t&&(e.viewportEntity=t);const i=Bi(this._content,this,"content","reference ignored");i&&(e.contentEntity=i);const s=Bi(this._horizontalScrollbar,this,"horizontal-scrollbar","reference ignored");s&&(e.horizontalScrollbarEntity=s);const a=Bi(this._verticalScrollbar,this,"vertical-scrollbar","reference ignored");return a&&(e.verticalScrollbarEntity=a),e}get component(){return super.component}set horizontal(e){this._horizontal=e,this.component&&(this.component.horizontal=e)}get horizontal(){return this._horizontal}set vertical(e){this._vertical=e,this.component&&(this.component.vertical=e)}get vertical(){return this._vertical}set scrollMode(e){this._scrollMode=e,this.component&&(this.component.scrollMode=us.get(e)??Rt)}get scrollMode(){return this._scrollMode}set bounceAmount(e){this._bounceAmount=e,this.component&&(this.component.bounceAmount=e)}get bounceAmount(){return this._bounceAmount}set friction(e){this._friction=e,this.component&&(this.component.friction=e)}get friction(){return this._friction}set useMouseWheel(e){this._useMouseWheel=e,this.component&&(this.component.useMouseWheel=e)}get useMouseWheel(){return this._useMouseWheel}set mouseWheelSensitivity(e){this._mouseWheelSensitivity=e,this.component&&(this.component.mouseWheelSensitivity=e)}get mouseWheelSensitivity(){return this._mouseWheelSensitivity}set horizontalScrollbarVisibility(e){this._horizontalScrollbarVisibility=e,this.component&&(this.component.horizontalScrollbarVisibility=gs.get(e)??jt)}get horizontalScrollbarVisibility(){return this._horizontalScrollbarVisibility}set verticalScrollbarVisibility(e){this._verticalScrollbarVisibility=e,this.component&&(this.component.verticalScrollbarVisibility=gs.get(e)??jt)}get verticalScrollbarVisibility(){return this._verticalScrollbarVisibility}set viewport(e){if(this._viewport=e,this.component){const t=Bi(e,this,"viewport","reference ignored");t&&(this.component.viewportEntity=t)}}get viewport(){return this._viewport}set content(e){if(this._content=e,this.component){const t=Bi(e,this,"content","reference ignored");t&&(this.component.contentEntity=t)}}get content(){return this._content}set horizontalScrollbar(e){if(this._horizontalScrollbar=e,this.component){const t=Bi(e,this,"horizontal-scrollbar","reference ignored");t&&(this.component.horizontalScrollbarEntity=t)}}get horizontalScrollbar(){return this._horizontalScrollbar}set verticalScrollbar(e){if(this._verticalScrollbar=e,this.component){const t=Bi(e,this,"vertical-scrollbar","reference ignored");t&&(this.component.verticalScrollbarEntity=t)}}get verticalScrollbar(){return this._verticalScrollbar}static get observedAttributes(){return[...super.observedAttributes,"horizontal","vertical","scroll-mode","bounce-amount","friction","use-mouse-wheel","mouse-wheel-sensitivity","horizontal-scrollbar-visibility","vertical-scrollbar-visibility","viewport","content","horizontal-scrollbar","vertical-scrollbar"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"horizontal":this.horizontal=Qt(i,!0);break;case"vertical":this.vertical=Qt(i,!0);break;case"scroll-mode":this.scrollMode=Nt(i,us,"bounce",e);break;case"bounce-amount":this.bounceAmount=Jt(i,.1,e);break;case"friction":this.friction=Jt(i,.05,e);break;case"use-mouse-wheel":this.useMouseWheel=Qt(i,!0);break;case"mouse-wheel-sensitivity":this.mouseWheelSensitivity=ei(i,r.ONE,e);break;case"horizontal-scrollbar-visibility":this.horizontalScrollbarVisibility=Nt(i,gs,"when-required",e);break;case"vertical-scrollbar-visibility":this.verticalScrollbarVisibility=Nt(i,gs,"when-required",e);break;case"viewport":this.viewport=i??"";break;case"content":this.content=i??"";break;case"horizontal-scrollbar":this.horizontalScrollbar=i??"";break;case"vertical-scrollbar":this.verticalScrollbar=i??""}}}customElements.define("pc-scroll-view",_s);class fs extends Bt{_attributes={};_enabled=!0;_script=null;set scriptAttributes(e){this._attributes=e??{},this.dispatchEvent(new CustomEvent("scriptattributeschange",{detail:{attributes:this._attributes},bubbles:!0}))}get scriptAttributes(){return this._attributes}set enabled(e){this._enabled=e,this.dispatchEvent(new CustomEvent("scriptenablechange",{detail:{enabled:e},bubbles:!0}))}get enabled(){return this._enabled}set name(e){this.setAttribute("name",e)}get name(){return this.getAttribute("name")??""}get script(){return this._script}connectedCallback(){"PC-SCRIPT"!==this.parentElement?.tagName&&console.warn(`pc-script-instance '${this.getAttribute("name")}' must be a direct child of pc-script - script not created`)}disconnectedCallback(){this._resetReady()}_onScriptCreated(){this._onReady()}static get observedAttributes(){return["attributes","enabled","name"]}attributeChangedCallback(e,t,i){switch(e){case"attributes":if(null===i){this.scriptAttributes={};break}try{this.scriptAttributes=JSON.parse(i)}catch(e){console.warn(`Invalid 'attributes' JSON on pc-script-instance '${this.getAttribute("name")}': ${e.message}`)}break;case"enabled":this.enabled=Qt(i,!0);break;case"name":null!==t&&t!==i&&this.dispatchEvent(new CustomEvent("scriptnamechange",{detail:{oldName:t,newName:i},bubbles:!0}))}}}customElements.define("pc-script-instance",fs);const vs=new Set([...fs.observedAttributes,"accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","exportparts","hidden","id","inert","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","popover","role","slot","spellcheck","style","tabindex","title","translate"]),ys=e=>vs.has(e)||e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("on")&&e in HTMLElement.prototype,ks=new Set(["app","entity","destroy","initialize","postInitialize","postUpdate","swap","update"]),ws=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Ms=(e,t)=>(i,s)=>{const a=It(i,e);return a?new t(a):(console.warn(`Invalid script attribute value '${s}'. Expected ${e} space-separated numbers after 'vec${e}:'.`),s)},xs=new Map([["asset",(e,t)=>{const i=ki(e);return i||(console.warn(`Unable to resolve '${t}' in script attributes - no pc-asset found with id '${e}'.`),t)}],["entity",(e,t,i)=>{const s=((e,t)=>ji(Li(e,t)))(e,i);if(s)return s;const a=Li(e,i),n=a?"":Di(e,"entity:");return console.warn(`Unable to resolve '${t}' in script attributes - ${Ti(a)}.${n?` ${n}`:""}`),t}],["vec2",Ms(2,r)],["vec3",Ms(3,i)],["vec4",Ms(4,a)],["color",(e,t)=>{const i=It(e,4)??It(e,3);return i?new s(i):(console.warn(`Invalid script attribute value '${t}'. Expected 3 or 4 space-separated numbers after 'color:'.`),t)}]]),Ss=e=>{const t=e.indexOf(":");if(t<=0)return null;const i=xs.get(e.slice(0,t));return i?{convert:i,rest:e.slice(t+1)}:null};class Cs extends Si{observer;constructor(){super("script"),this.observer=new MutationObserver(this.handleMutations.bind(this)),this.addEventListener("scriptattributeschange",this.handleScriptAttributesChange.bind(this)),this.addEventListener("scriptenablechange",this.handleScriptEnableChange.bind(this)),this.addEventListener("scriptnamechange",this.handleScriptNameChange.bind(this))}connectedCallback(){return this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0}),super.connectedCallback()}initComponent(){this.querySelectorAll(":scope > pc-script-instance").forEach(e=>{const t=this.scriptFor(e);t?this.applyDeclaredState(t,e):this.createScript(e)})}convertAttributes(e){if("string"==typeof e){const t=Ss(e);return t?t.convert(t.rest,e,this):e}if(Array.isArray(e))return e.map(e=>this.convertAttributes(e));if(e&&"object"==typeof e){const t={};for(const i in e)t[i]=this.convertAttributes(e[i]);return t}return e}mergeDeep(e,t){for(const i in t){const s=t[i],a=e[i];if(this.isMathType(a)&&Array.isArray(s)){const t=this.arrayToMathType(a,s,i);t&&(e[i]=t);continue}s&&"object"==typeof s&&!Array.isArray(s)&&Object.getPrototypeOf(s)===Object.prototype?(a&&"object"==typeof a||(e[i]={}),this.mergeDeep(e[i],s)):e[i]=s}return e}isMathType(e){return e instanceof r||e instanceof i||e instanceof a||e instanceof s||e instanceof n}arrayToMathType(e,t,o){if(t.every(e=>"number"==typeof e&&Number.isFinite(e))){if(e instanceof r&&2===t.length)return new r(t);if(e instanceof i&&3===t.length)return new i(t);if(e instanceof a&&4===t.length)return new a(t);if(e instanceof s&&(3===t.length||4===t.length))return new s(t);if(e instanceof n&&3===t.length)return(new n).setFromEulerAngles(t[0],t[1],t[2])}return console.warn(`Cannot convert script attribute '${o}' array [${t}] to ${e.constructor.name}. Keeping the current value.`),null}applyAttributes(e,t,i){const s=this.convertAttributes(t);if(s&&"object"==typeof s&&(delete s.enabled,i))for(const e of i)delete s[e];this.mergeDeep(e,s)}inlineKeys(e){const t=new Set;for(const i of Array.from(e.attributes))ys(i.name)||t.add(ws(i.name));return t}scriptFor(e){const t=e.getAttribute("name");if(!t||!this.component)return null;const i=this.component.get(t);return i&&i===e._script?i:null}handleScriptAttributesChange(e){const t=e.target,i=this.scriptFor(t);i&&this.applyAttributes(i,e.detail.attributes,this.inlineKeys(t))}handleScriptEnableChange(e){const t=e.target;this.handleMutations(this.observer.takeRecords());const i=this.scriptFor(t);i&&(i.enabled=e.detail.enabled)}handleScriptNameChange(e){const t=e.target;if(t.parentElement!==this)return;if(!this.component)return;const{oldName:i}=e.detail;i&&t._script&&this.component.get(i)===t._script&&this.destroyScript(i),t._script=null,this.createScript(t)}createScript(e){const t=e.getAttribute("name");if(!t||!this.component)return null;const i=this.component.create(t,{enabled:!1});return i?(e._script=i,this.applyDeclaredState(i,e),e._onScriptCreated(),i):null}applyDeclaredState(e,t){this.applyAttributes(e,t.scriptAttributes,this.inlineKeys(t)),this.applyInlineAttributes(e,t),e.enabled=t.enabled}applyInlineAttributes(e,t){const i=t.getAttribute("name")??"";for(const s of Array.from(t.attributes))ys(s.name)||this.setScriptProperty(e,i,s.name,s.value)}applyScriptProperty(e,t){const i=this.scriptFor(e);if(!i)return;const s=e.getAttribute(t);if(null===s){const s=ws(t),a=e.scriptAttributes[s];return void(void 0!==a&&this.applyAttributes(i,{[s]:a}))}this.setScriptProperty(i,e.getAttribute("name")??"",t,s)}setScriptProperty(e,t,o,l){const c=ws(o);try{const p=e[c];if("function"==typeof p||ks.has(c))return void console.warn(`Ignoring attribute '${o}' on pc-script-instance '${t}' - '${c}' is part of the Script API.`);if("string"==typeof p)e[c]=l;else if(Ss(l)){const t=this.convertAttributes(l);t===l&&null!=p||(e[c]=t)}else if("number"==typeof p)e[c]=Jt(l,p,o);else if("boolean"==typeof p)e[c]=Qt(l,p);else if(p instanceof r)e[c]=ei(l,p,o);else if(p instanceof i)e[c]=ti(l,p,o);else if(p instanceof a)e[c]=ii(l,p,o);else if(p instanceof s)e[c]=Xt(l,p,o);else if(p instanceof n)e[c]=Zt(l,p,o);else{const i=((e,t)=>{const i=new Set(Object.keys(e));for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(e)))i.add(t);for(const e of i)if(e!==t&&e.toLowerCase()===t.toLowerCase())return e;return null})(e,c);if(i)return void console.warn(`Script '${t}' has no attribute '${c}' - did you mean '${h=i,h.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}'? Attribute names are kebab-case.`);console.warn(`Script '${t}' has no typed attribute '${c}' - assigning the raw string from '${o}'.`),e[c]=l}}catch(e){console.warn(`Error applying attribute '${o}' to script '${t}': ${e.message}`)}var h}destroyScript(e){this.component&&this.component.destroy(e)}handleMutations(e){for(const t of e){if("attributes"===t.type){const e=t.target;e instanceof fs&&e.parentElement===this&&t.attributeName&&!ys(t.attributeName)&&this.applyScriptProperty(e,t.attributeName);continue}t.target===this&&(t.removedNodes.forEach(e=>{if(e instanceof fs){const t=e.getAttribute("name");t&&e._script&&this.component&&this.component.get(t)===e._script&&this.destroyScript(t),e._script=null}}),t.addedNodes.forEach(e=>{e instanceof fs&&this.createScript(e)}))}}disconnectedCallback(){this.observer.disconnect(),super.disconnectedCallback?.()}get component(){return super.component}}customElements.define("pc-script",Cs);class As extends Si{_distanceModel="linear";_maxDistance=1e4;_pitch=1;_positional=!1;_refDistance=1;_rollOffFactor=1;_volume=1;constructor(){super("sound")}getInitialComponentData(){return{distanceModel:this._distanceModel,maxDistance:this._maxDistance,pitch:this._pitch,positional:this._positional,refDistance:this._refDistance,rollOffFactor:this._rollOffFactor,volume:this._volume}}get component(){return super.component}set distanceModel(e){this._distanceModel=e,this.component&&(this.component.distanceModel=e)}get distanceModel(){return this._distanceModel}set maxDistance(e){this._maxDistance=e,this.component&&(this.component.maxDistance=e)}get maxDistance(){return this._maxDistance}set pitch(e){this._pitch=e,this.component&&(this.component.pitch=e)}get pitch(){return this._pitch}set positional(e){this._positional=e,this.component&&(this.component.positional=e)}get positional(){return this._positional}set refDistance(e){this._refDistance=e,this.component&&(this.component.refDistance=e)}get refDistance(){return this._refDistance}set rollOffFactor(e){this._rollOffFactor=e,this.component&&(this.component.rollOffFactor=e)}get rollOffFactor(){return this._rollOffFactor}set volume(e){this._volume=e,this.component&&(this.component.volume=e)}get volume(){return this._volume}static get observedAttributes(){return[...super.observedAttributes,"distance-model","max-distance","pitch","positional","ref-distance","roll-off-factor","volume"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"distance-model":this.distanceModel=Nt(i,["exponential","inverse","linear"],"linear",e);break;case"max-distance":this.maxDistance=Jt(i,1e4,e);break;case"pitch":this.pitch=Jt(i,1,e);break;case"positional":this.positional=Qt(i,!1);break;case"ref-distance":this.refDistance=Jt(i,1,e);break;case"roll-off-factor":this.rollOffFactor=Jt(i,1,e);break;case"volume":this.volume=Jt(i,1,e)}}}customElements.define("pc-sound",As);class Fs extends Bt{_asset="";_autoPlay=!1;_duration=null;_loop=!1;_name="";_overlap=!1;_pitch=1;_startTime=0;_volume=1;_soundElement=null;_connectionGeneration=0;soundSlot=null;async connectedCallback(){const e=++this._connectionGeneration,t=this.soundElement;await(t?.ready());const i=t?.component;if(e!==this._connectionGeneration||!i)return;const s={autoPlay:this._autoPlay,loop:this._loop,overlap:this._overlap,pitch:this._pitch,startTime:this._startTime,volume:this._volume};this._duration&&(s.duration=this._duration),this._soundElement=t,this.soundSlot=i.addSlot(this._name,s),this.asset=this._asset,this._autoPlay&&this.soundSlot.play(),this._onReady()}disconnectedCallback(){this._connectionGeneration++,this._soundElement?.component?.removeSlot(this._name),this._soundElement=null,this.soundSlot=null,this._resetReady()}get soundElement(){const e=this.parentElement;return e instanceof As?e:(console.warn("pc-sound-slot must be a direct child of a pc-sound element"),null)}set asset(e){if(this._asset=e,this.soundSlot){const t=ki(e)?.id;t&&(this.soundSlot.asset=t)}}get asset(){return this._asset}set autoPlay(e){this._autoPlay=e,this.soundSlot&&(this.soundSlot.autoPlay=e)}get autoPlay(){return this._autoPlay}set duration(e){this._duration=e,this.soundSlot&&null!==e&&(this.soundSlot.duration=e)}get duration(){return this._duration}set loop(e){this._loop=e,this.soundSlot&&(this.soundSlot.loop=e)}get loop(){return this._loop}set name(e){this._name=e,this.soundSlot&&(this.soundSlot.name=e)}get name(){return this._name}set overlap(e){this._overlap=e,this.soundSlot&&(this.soundSlot.overlap=e)}get overlap(){return this._overlap}set pitch(e){this._pitch=e,this.soundSlot&&(this.soundSlot.pitch=e)}get pitch(){return this._pitch}set startTime(e){this._startTime=e,this.soundSlot&&(this.soundSlot.startTime=e)}get startTime(){return this._startTime}set volume(e){this._volume=e,this.soundSlot&&(this.soundSlot.volume=e)}get volume(){return this._volume}static get observedAttributes(){return["asset","auto-play","duration","loop","name","overlap","pitch","start-time","volume"]}attributeChangedCallback(e,t,i){switch(e){case"asset":this.asset=i??"";break;case"auto-play":this.autoPlay=Qt(i,!1);break;case"duration":this.duration=Jt(i,null,e);break;case"loop":this.loop=Qt(i,!1);break;case"name":this.name=i??"";break;case"overlap":this.overlap=Qt(i,!1);break;case"pitch":this.pitch=Jt(i,1,e);break;case"start-time":this.startTime=Jt(i,0,e);break;case"volume":this.volume=Jt(i,1,e)}}}customElements.define("pc-sound-slot",Fs);class Es extends Si{_asset="";_castShadows=!1;_lodBaseDistance=5;_lodMultiplier=3;_lodRangeMin=0;_lodRangeMax=99;constructor(){super("gsplat")}getInitialComponentData(){return{asset:ki(this._asset),castShadows:this._castShadows,lodBaseDistance:this._lodBaseDistance,lodMultiplier:this._lodMultiplier,lodRangeMin:this._lodRangeMin,lodRangeMax:this._lodRangeMax}}get component(){return super.component}set asset(e){this._asset=e;const t=ki(e);this.component&&t&&(this.component.asset=t)}get asset(){return this._asset}set castShadows(e){this._castShadows=e,this.component&&(this.component.castShadows=e)}get castShadows(){return this._castShadows}set lodBaseDistance(e){this._lodBaseDistance=e,this.component&&(this.component.lodBaseDistance=e)}get lodBaseDistance(){return this._lodBaseDistance}set lodMultiplier(e){this._lodMultiplier=e,this.component&&(this.component.lodMultiplier=e)}get lodMultiplier(){return this._lodMultiplier}set lodRangeMin(e){this._lodRangeMin=e,this.component&&(this.component.lodRangeMin=e)}get lodRangeMin(){return this._lodRangeMin}set lodRangeMax(e){this._lodRangeMax=e,this.component&&(this.component.lodRangeMax=e)}get lodRangeMax(){return this._lodRangeMax}static get observedAttributes(){return[...super.observedAttributes,"asset","cast-shadows","lod-base-distance","lod-multiplier","lod-range-min","lod-range-max"]}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case"asset":this.asset=i??"";break;case"cast-shadows":this.castShadows=Qt(i,!1);break;case"lod-base-distance":this.lodBaseDistance=Jt(i,5,e);break;case"lod-multiplier":this.lodMultiplier=Jt(i,3,e);break;case"lod-range-min":this.lodRangeMin=Jt(i,0,e);break;case"lod-range-max":this.lodRangeMax=Jt(i,99,e)}}}customElements.define("pc-gsplat",Es);class Rs extends Wt{_name="";_index=null;_state="pending";_path=null;_host=null;_hostListener=null;_destroyHandle=null;_authored={};_authoredRender=null;_baseline=null;_enabled=null;_position=null;_rotation=null;_scale=null;_tags=null;_materialOverrides=null;get state(){return this._state}get path(){return this._path}connectedCallback(){const e=this.parentElement?.closest("pc-model, pc-node")??null;if(!e){const e=this._name?` '${this._name}'`:"";return void console.warn(`pc-node${e} must be a descendant of pc-model - node not bound`)}this._host=e,this._hostListener=e=>{e.target===this._host&&this._rebind()},e.addEventListener("ready",this._hostListener),this._rebind()}disconnectedCallback(){this._host&&this._hostListener&&this._host.removeEventListener("ready",this._hostListener),this._host=null,this._hostListener=null,this._unbind(),this._state="pending"}_rebind(){const e=this._host,t=(e instanceof xi?e.contentEntity:e?.entity)??null;if(!t||!this._name)return this._unbind(),void(this._state="pending");const i=this._resolve(t);i&&i===this._entity?this._path=this._pathOf(i,t):(this._unbind(),i&&this._bind(i,t))}_resolve(e){const t=e.find(e=>e.name===this._name);if(0===t.length){const t=this._closestName(e),i=t?` - closest match: '${t}'`:"";return console.warn(`pc-node '${this._name}' not found in ${this._describeHost()}${i}`),this._state="missing",null}let i;if(null!==this._index){if(this._index>=t.length)return console.warn(`pc-node '${this._name}' index ${this._index} is out of range - ${t.length} match(es) in ${this._describeHost()}`),this._state="missing",null;i=t[this._index]}else{if(t.length>1){const i=t.map((t,i)=>`[${i}] ${this._pathOf(t,e)}`).join(", ");return console.warn(`pc-node '${this._name}' is ambiguous in ${this._describeHost()} - specify index: ${i}`),this._state="ambiguous",null}i=t[0]}const s=this.closestApp?.elementFromEntity(i);return s&&s!==this?(console.warn(`pc-node '${this._name}' resolves to a node already bound by another element - element ignored`),this._state="duplicate",null):i}_bind(e,t){this._entity=e,this._registerEntity(e),this._destroyHandle=e.once("destroy",this._onEntityDestroy,this),this._state="bound",this._path=this._pathOf(e,t),this._authoredRender=e.render??null,this._applyOverrides(),this._onReady(),this._buildChildren()}_unbind(){const e=this._entity;e&&(this._revertOverrides(),this.querySelectorAll("pc-entity, pc-model").forEach(e=>{e.closestEntity===this&&e.entity?.destroy()}),this._destroyHandle?.off(),this._destroyHandle=null,this._unregisterEntity(e),this._entity=null,this._path=null,this._authored={},this._authoredRender=null,this.querySelectorAll("*").forEach(e=>{e instanceof Si&&e.closestEntity===this&&e._hostCycled()}),this._resetReady())}_onEntityDestroy(e){this._destroyHandle=null,this._unregisterEntity(e),this._entity=null,this._path=null,this._authored={},this._authoredRender=null,this._baseline=null,this._state="pending",this._resetReady()}_buildChildren(){const e=this.closestApp?.app;e&&oi(this,e)}_applyOverrides(){null!==this._enabled&&(this.enabled=this._enabled),null!==this._position&&(this.position=this._position),null!==this._rotation&&(this.rotation=this._rotation),null!==this._scale&&(this.scale=this._scale),null!==this._tags&&(this.tags=this._tags),null!==this._materialOverrides&&this._applyMaterialOverrides()}_revertOverrides(){const e=this._entity,t=this._authored;void 0!==t.enabled&&(e.enabled=t.enabled),t.position&&e.setLocalPosition(t.position),t.rotation&&e.setLocalRotation(t.rotation),t.scale&&e.setLocalScale(t.scale),t.tags&&(e.tags.clear(),e.tags.add(t.tags)),this._authored={},this._restoreBaseline()}_applyMaterialOverrides(){const e=`pc-node '${this._name}'`,t=this._materialOverrides?((e,t)=>{const i=[];for(const[s,a]of Object.entries(e))if("string"!=typeof a||""===a)console.warn(`${t} material-overrides '${s}' needs a pc-material id - rule ignored`);else if(s.startsWith("name:")){const e=s.slice(5);""===e?console.warn(`${t} material-overrides 'name:' selector is empty - rule ignored`):i.push({kind:"name",name:e,id:a})}else if(s.startsWith("index:")){const e=s.slice(6).trim(),n=""===e?NaN:Number(e);!Number.isInteger(n)||n<0?console.warn(`${t} material-overrides '${s}' is not a non-negative integer index - rule ignored`):i.push({kind:"index",index:n,id:a})}else console.warn(`${t} material-overrides '${s}' has no 'name:' or 'index:' prefix - rule ignored`);return i})(this._materialOverrides,e):[];if(0===t.length)return void this._restoreBaseline();if(!this._baseline){if(!this._authoredRender)return void console.warn(`${e} is bound to a node without an authored render component - material-overrides ignored`);this._baseline=this._authoredRender.meshInstances.map(e=>({meshInstance:e,material:e.material??null,name:e.material?.name??null}))}const i=this._baseline,s=t=>{const i=ls.get(t);return i||console.warn(`${e} material-overrides could not resolve pc-material '${t}' - rule ignored`),i??null},a=i.map(e=>e.material);for(const n of t){if("name"!==n.kind)continue;const t=s(n.id);if(!t)continue;let r=!1;if(i.forEach((e,i)=>{e.name===n.name&&(a[i]=t,r=!0)}),!r){const t=i.map(e=>`'${e.name}'`).join(", ");console.warn(`${e} material-overrides 'name:${n.name}' matches no assignment - baseline names: ${t||"(none)"}`)}}for(const n of t){if("index"!==n.kind)continue;if(n.index>=i.length){console.warn(`${e} material-overrides 'index:${n.index}' is out of range - ${i.length} assignment(s)`);continue}const t=s(n.id);t&&(a[n.index]=t)}i.forEach((e,t)=>{e.meshInstance.material!==a[t]&&(e.meshInstance.material=a[t])})}_restoreBaseline(){const e=this._baseline;if(e){this._baseline=null;for(const t of e)t.meshInstance.material!==t.material&&(t.meshInstance.material=t.material)}}_pathOf(e,t){const i=[];for(let s=e;s&&s!==t;s=s.parent)i.unshift(s.name);return i.join("/")||e.name}_describeHost(){return this._host instanceof xi?`model '${this._host.asset}'`:`pc-node '${this._host?.name??""}' subtree`}_closestName(e){let t=null,i=3;return e.find(e=>{const s=((e,t)=>{const i=Array.from({length:t.length+1},(e,t)=>t);for(let s=1;s<=e.length;s++){let a=i[0];i[0]=s;for(let n=1;n<=t.length;n++){const r=i[n];i[n]=Math.min(i[n]+1,i[n-1]+1,a+(e[s-1]===t[n-1]?0:1)),a=r}}return i[t.length]})(this._name,e.name);return s<i&&(i=s,t=e.name),!1}),t}set name(e){this._name=e,this.isConnected&&this._host&&this._rebind()}get name(){return this._name}set index(e){this._index=e,this.isConnected&&this._host&&this._rebind()}get index(){return this._index}set enabled(e){this._enabled=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.enabled??=t.enabled,t.enabled=e):void 0!==this._authored.enabled&&(t.enabled=this._authored.enabled,delete this._authored.enabled))}get enabled(){return this._enabled}set position(e){this._position=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.position??=t.getLocalPosition().clone(),t.setLocalPosition(e)):this._authored.position&&(t.setLocalPosition(this._authored.position),delete this._authored.position))}get position(){return this._position}set rotation(e){this._rotation=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.rotation??=t.getLocalRotation().clone(),t.setLocalEulerAngles(e)):this._authored.rotation&&(t.setLocalRotation(this._authored.rotation),delete this._authored.rotation))}get rotation(){return this._rotation}set scale(e){this._scale=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.scale??=t.getLocalScale().clone(),t.setLocalScale(e)):this._authored.scale&&(t.setLocalScale(this._authored.scale),delete this._authored.scale))}get scale(){return this._scale}set tags(e){this._tags=e;const t="bound"===this._state?this._entity:null;t&&(null!==e?(this._authored.tags??=t.tags.list().slice(),t.tags.clear(),t.tags.add(e)):this._authored.tags&&(t.tags.clear(),t.tags.add(this._authored.tags),delete this._authored.tags))}get tags(){return this._tags}set materialOverrides(e){this._materialOverrides=null===e?null:Object.freeze({...e}),"bound"===this._state&&this._applyMaterialOverrides()}get materialOverrides(){return this._materialOverrides}static get observedAttributes(){return["enabled","index","material-overrides","name","position","rotation","scale","tags",...qt]}attributeChangedCallback(e,t,s){switch(e){case"enabled":this.enabled=null===s?null:Qt(s,!0);break;case"index":if(null===s)this.index=null;else{const e=""===s.trim()?NaN:Number(s);!Number.isInteger(e)||e<0?(console.warn(`pc-node index '${s}' is not a non-negative integer - treated as absent`),this.index=null):this.index=e}break;case"material-overrides":this.materialOverrides=null===s?null:((e,t)=>{let i;try{i=JSON.parse(e)}catch(e){return console.warn(`${t} material-overrides is not valid JSON - treated as absent: ${e.message}`),null}return null===i||"object"!=typeof i||Array.isArray(i)?(console.warn(`${t} material-overrides must be a JSON object - treated as absent`),null):i})(s,`pc-node '${this._name}'`);break;case"name":this.name=s??"";break;case"position":this.position=null===s?null:ti(s,i.ZERO,e);break;case"rotation":this.rotation=null===s?null:ti(s,i.ZERO,e);break;case"scale":this.scale=null===s?null:ti(s,i.ONE,e);break;case"tags":this.tags=null===s?null:Vt(s);break;case"onpointerenter":case"onpointerleave":case"onpointerdown":case"onpointerup":case"onpointermove":case"onclick":this._updateInlineHandler(e,s)}}}customElements.define("pc-node",Rs);class js extends Bt{_exposure=1;_fog="none";_fogColor=new s(1,1,1);_fogDensity=0;_fogStart=0;_fogEnd=1e3;_gravity=new i(0,-9.81,0);_scene=null;get scene(){return this._scene}async connectedCallback(){const e=this.closestApp;if(!e)return void console.warn("pc-scene must be a descendant of pc-app - scene settings not applied");if(await e.ready(),!this.isConnected||this.closestApp!==e)return;const t=e.app;t&&(this._scene=t.scene,this._updateSceneSettings(),this._onReady())}disconnectedCallback(){this._scene=null,this._resetReady()}_updateSceneSettings(){this._scene&&(this._scene.exposure=this._exposure,this._scene.fog.type=this._fog,this._scene.fog.color=this._fogColor,this._scene.fog.density=this._fogDensity,this._scene.fog.start=this._fogStart,this._scene.fog.end=this._fogEnd,this._applyGravity(this._gravity))}_applyGravity(e){this.closestApp?.app?.systems.rigidbody?.gravity.copy(e)}set exposure(e){this._exposure=e,this.scene&&(this.scene.exposure=e)}get exposure(){return this._exposure}set fog(e){this._fog=e,this.scene&&(this.scene.fog.type=e)}get fog(){return this._fog}set fogColor(e){this._fogColor=e,this.scene&&(this.scene.fog.color=e)}get fogColor(){return this._fogColor}set fogDensity(e){this._fogDensity=e,this.scene&&(this.scene.fog.density=e)}get fogDensity(){return this._fogDensity}set fogStart(e){this._fogStart=e,this.scene&&(this.scene.fog.start=e)}get fogStart(){return this._fogStart}set fogEnd(e){this._fogEnd=e,this.scene&&(this.scene.fog.end=e)}get fogEnd(){return this._fogEnd}set gravity(e){this._gravity=e,this._scene&&this._applyGravity(e)}get gravity(){return this._gravity}static get observedAttributes(){return["exposure","fog","fog-color","fog-density","fog-start","fog-end","gravity"]}attributeChangedCallback(e,t,a){switch(e){case"exposure":this.exposure=Jt(a,1,e);break;case"fog":this.fog=Nt(a,["none","linear","exp","exp2"],"none",e);break;case"fog-color":this.fogColor=Xt(a,s.WHITE,e);break;case"fog-density":this.fogDensity=Jt(a,0,e);break;case"fog-start":this.fogStart=Jt(a,0,e);break;case"fog-end":this.fogEnd=Jt(a,1e3,e);break;case"gravity":this.gravity=ti(a,new i(0,-9.81,0),e)}}}customElements.define("pc-scene",js);class Os extends Bt{_asset="";_center=new i(0,.01,0);_intensity=1;_rotation=new i;_mipLevel=0;_lighting=!1;_scale=new i(100,100,100);_type="infinite";_scene=null;_appElement=null;_loadGeneration=0;_binding=new wi;connectedCallback(){this._loadSkybox(),this._onReady()}disconnectedCallback(){this._loadGeneration++,this._binding.cancel(),this._unloadSkybox(),this._appElement=null,this._resetReady()}_generateSkybox(e){if(!this._scene)return;const t=e.resource,i=Tt.generateSkyboxCubemap(t);if(this._scene.skybox?.destroy(),this._scene.skybox=i,this._lighting){const e=Tt.generateLightingSource(t),i=Tt.generateAtlas(e);e.destroy(),this._scene.envAtlas?.destroy(),this._scene.envAtlas=i}const s=this._scene.layers.getLayerById(Dt);s&&(s.enabled="none"!==this._type),this._scene.sky.type=this._type,this._scene.sky.node.setLocalScale(this._scale),this._scene.sky.center=this._center,this._scene.skyboxIntensity=this._intensity,this._scene.skyboxMip=this._mipLevel}async _loadSkybox(){const e=++this._loadGeneration;this._binding.cancel();const t=await(this.closestApp?.ready());if(e!==this._loadGeneration)return;const i=t?.app;t&&i&&(this._appElement=t,ki(this._asset)&&(this._scene=i.scene,this._binding.bind(this._asset,{load:e=>this._generateSkybox(e)})))}_unloadSkybox(){const e=this._scene;e&&(this._scene=null,this._appElement?.app&&(e.skybox?.destroy(),e.skybox=null,e.envAtlas?.destroy(),e.envAtlas=null))}set asset(e){this._asset=e,this.isConnected&&this._loadSkybox()}get asset(){return this._asset}set center(e){this._center=e,this._scene&&(this._scene.sky.center=this._center)}get center(){return this._center}set intensity(e){this._intensity=e,this._scene&&(this._scene.skyboxIntensity=this._intensity)}get intensity(){return this._intensity}set lighting(e){this._lighting=e}get lighting(){return this._lighting}set mipLevel(e){this._mipLevel=e,this._scene&&(this._scene.skyboxMip=this._mipLevel)}get mipLevel(){return this._mipLevel}set rotation(e){this._rotation=e,this._scene&&(this._scene.skyboxRotation=(new n).setFromEulerAngles(e))}get rotation(){return this._rotation}set scale(e){this._scale=e,this._scene&&this._scene.sky.node.setLocalScale(this._scale)}get scale(){return this._scale}set type(e){if(this._type=e,this._scene){this._scene.sky.type=this._type;const e=this._scene.layers.getLayerById(Dt);e&&(e.enabled="none"!==this._type)}}get type(){return this._type}static get observedAttributes(){return["asset","center","intensity","lighting","mip-level","rotation","scale","type"]}attributeChangedCallback(e,t,s){switch(e){case"asset":this.asset=s??"";break;case"center":this.center=ti(s,new i(0,.01,0),e);break;case"intensity":this.intensity=Jt(s,1,e);break;case"lighting":this.lighting=Qt(s,!1);break;case"mip-level":this.mipLevel=Jt(s,0,e);break;case"rotation":this.rotation=ti(s,i.ZERO,e);break;case"scale":this.scale=ti(s,new i(100,100,100),e);break;case"type":this.type=Nt(s,["box","dome","infinite","none"],"infinite",e)}}}customElements.define("pc-sky",Os);export{Ai as AnimClipElement,Ci as AnimComponentElement,ri as AppElement,yi as AssetElement,Bt as AsyncElement,Fi as AudioListenerComponentElement,Gi as ButtonComponentElement,qi as CameraComponentElement,Wi as CollisionComponentElement,Si as ComponentElement,$i as ElementComponentElement,Wt as EntityBaseElement,ci as EntityElement,li as EntityOwnerElement,Es as GSplatComponentElement,Yi as JointComponentElement,Ii as LayoutChildComponentElement,Xi as LayoutGroupComponentElement,Ji as LightComponentElement,ls as MaterialElement,xi as ModelElement,Rs as NodeElement,Zi as ParticleSystemComponentElement,cs as RenderComponentElement,hs as RigidBodyComponentElement,js as SceneElement,bs as ScreenComponentElement,Cs as ScriptComponentElement,fs as ScriptInstanceElement,_s as ScrollViewComponentElement,ms as ScrollbarComponentElement,Os as SkyElement,As as SoundComponentElement,Fs as SoundSlotElement,Gt as WasmElement,Pt as whenReady};
|
|
2
2
|
//# sourceMappingURL=pwc.min.mjs.map
|