lunchboxjs 2.1.13 → 2.1.15

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.
@@ -11,8 +11,8 @@
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const R=globalThis,he=i=>i,B=R.trustedTypes,ce=B?B.createPolicy("lit-html",{createHTML:i=>i}):void 0,_e="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,be="?"+$,Fe=`<${be}>`,w=document,N=()=>w.createComment(""),x=i=>i===null||typeof i!="object"&&typeof i!="function",te=Array.isArray,Je=i=>te(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",V=`[
14
- \f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,le=/-->/g,de=/>/g,_=RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,pe=/"/g,ve=/^(?:script|style|textarea|title)$/i,Ke=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),se=Ke(1),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),me=new WeakMap,b=w.createTreeWalker(w,129);function Ce(i,e){if(!te(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ce!==void 0?ce.createHTML(e):e}const Ze=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=O;for(let a=0;a<t;a++){const h=i[a];let c,d,l=-1,p=0;for(;p<h.length&&(o.lastIndex=p,d=o.exec(h),d!==null);)p=o.lastIndex,o===O?d[1]==="!--"?o=le:d[1]!==void 0?o=de:d[2]!==void 0?(ve.test(d[2])&&(r=RegExp("</"+d[2],"g")),o=_):d[3]!==void 0&&(o=_):o===_?d[0]===">"?(o=r??O,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?_:d[3]==='"'?pe:ue):o===pe||o===ue?o=_:o===le||o===de?o=O:(o=_,r=void 0);const E=o===_&&i[a+1].startsWith("/>")?" ":"";n+=o===O?h+Fe:l>=0?(s.push(c),h.slice(0,l)+_e+h.slice(l)+$+E):h+$+(l===-2?a:E)}return[Ce(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class L{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,h=this.parts,[c,d]=Ze(e,t);if(this.el=L.createElement(c,s),b.currentNode=this.el.content,t===2||t===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(r=b.nextNode())!==null&&h.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const l of r.getAttributeNames())if(l.endsWith(_e)){const p=d[o++],E=r.getAttribute(l).split($),j=/([.?@])?(.*)/.exec(p);h.push({type:1,index:n,name:j[2],strings:E,ctor:j[1]==="."?Xe:j[1]==="?"?Qe:j[1]==="@"?et:z}),r.removeAttribute(l)}else l.startsWith($)&&(h.push({type:6,index:n}),r.removeAttribute(l));if(ve.test(r.tagName)){const l=r.textContent.split($),p=l.length-1;if(p>0){r.textContent=B?B.emptyScript:"";for(let E=0;E<p;E++)r.append(l[E],N()),b.nextNode(),h.push({type:2,index:++n});r.append(l[p],N())}}}else if(r.nodeType===8)if(r.data===be)h.push({type:2,index:n});else{let l=-1;for(;(l=r.data.indexOf($,l+1))!==-1;)h.push({type:7,index:n}),l+=$.length-1}n++}}static createElement(e,t){const s=w.createElement("template");return s.innerHTML=e,s}}function P(i,e,t=i,s){var o,a;if(e===T)return e;let r=s!==void 0?(o=t._$Co)==null?void 0:o[s]:t._$Cl;const n=x(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=r:t._$Cl=r),r!==void 0&&(e=P(i,r._$AS(i,e.values),r,s)),e}class Ye{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=((e==null?void 0:e.creationScope)??w).importNode(t,!0);b.currentNode=r;let n=b.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new H(n,n.nextSibling,this,e):h.type===1?c=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(c=new tt(n,this,e)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=b.nextNode(),o++)}return b.currentNode=w,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class H{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=P(this,e,t),x(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==T&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==u&&x(this._$AH)?this._$AA.nextSibling.data=e:this.T(w.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=L.createElement(Ce(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Ye(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=me.get(e.strings);return t===void 0&&me.set(e.strings,t=new L(e)),t}k(e){te(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new H(this.O(N()),this.O(N()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const r=he(e).nextSibling;he(e).remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class z{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=u}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=P(this,e,t,0),o=!x(e)||e!==this._$AH&&e!==T,o&&(this._$AH=e);else{const a=e;let h,c;for(e=n[0],h=0;h<n.length-1;h++)c=P(this,a[s+h],t,h),c===T&&(c=this._$AH[h]),o||(o=!x(c)||c!==this._$AH[h]),c===u?e=u:e!==u&&(e+=(c??"")+n[h+1]),this._$AH[h]=c}o&&!r&&this.j(e)}j(e){e===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Xe extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===u?void 0:e}}class Qe extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==u)}}class et extends z{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=P(this,e,t,0)??u)===T)return;const s=this._$AH,r=e===u&&s!==u||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==u&&(s===u||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class tt{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){P(this,e)}}const W=R.litHtmlPolyfillSupport;W==null||W(L,H),(R.litHtmlVersions??(R.litHtmlVersions=[])).push("3.3.2");const st=(i,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let r=s._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;s._$litPart$=r=new H(e.insertBefore(N(),n),n,void 0,t??{})}return r._$AI(i),r};/**
14
+ \f\r]`,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,le=/-->/g,de=/>/g,_=RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,pe=/"/g,ve=/^(?:script|style|textarea|title)$/i,Ke=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),se=Ke(1),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),me=new WeakMap,b=w.createTreeWalker(w,129);function Ce(i,e){if(!te(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ce!==void 0?ce.createHTML(e):e}const Ze=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=P;for(let a=0;a<t;a++){const h=i[a];let c,d,l=-1,p=0;for(;p<h.length&&(o.lastIndex=p,d=o.exec(h),d!==null);)p=o.lastIndex,o===P?d[1]==="!--"?o=le:d[1]!==void 0?o=de:d[2]!==void 0?(ve.test(d[2])&&(r=RegExp("</"+d[2],"g")),o=_):d[3]!==void 0&&(o=_):o===_?d[0]===">"?(o=r??P,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?_:d[3]==='"'?pe:ue):o===pe||o===ue?o=_:o===le||o===de?o=P:(o=_,r=void 0);const E=o===_&&i[a+1].startsWith("/>")?" ":"";n+=o===P?h+Fe:l>=0?(s.push(c),h.slice(0,l)+_e+h.slice(l)+$+E):h+$+(l===-2?a:E)}return[Ce(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class L{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,h=this.parts,[c,d]=Ze(e,t);if(this.el=L.createElement(c,s),b.currentNode=this.el.content,t===2||t===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(r=b.nextNode())!==null&&h.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const l of r.getAttributeNames())if(l.endsWith(_e)){const p=d[o++],E=r.getAttribute(l).split($),j=/([.?@])?(.*)/.exec(p);h.push({type:1,index:n,name:j[2],strings:E,ctor:j[1]==="."?Xe:j[1]==="?"?Qe:j[1]==="@"?et:z}),r.removeAttribute(l)}else l.startsWith($)&&(h.push({type:6,index:n}),r.removeAttribute(l));if(ve.test(r.tagName)){const l=r.textContent.split($),p=l.length-1;if(p>0){r.textContent=B?B.emptyScript:"";for(let E=0;E<p;E++)r.append(l[E],N()),b.nextNode(),h.push({type:2,index:++n});r.append(l[p],N())}}}else if(r.nodeType===8)if(r.data===be)h.push({type:2,index:n});else{let l=-1;for(;(l=r.data.indexOf($,l+1))!==-1;)h.push({type:7,index:n}),l+=$.length-1}n++}}static createElement(e,t){const s=w.createElement("template");return s.innerHTML=e,s}}function O(i,e,t=i,s){var o,a;if(e===T)return e;let r=s!==void 0?(o=t._$Co)==null?void 0:o[s]:t._$Cl;const n=x(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=r:t._$Cl=r),r!==void 0&&(e=O(i,r._$AS(i,e.values),r,s)),e}class Ye{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=((e==null?void 0:e.creationScope)??w).importNode(t,!0);b.currentNode=r;let n=b.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new H(n,n.nextSibling,this,e):h.type===1?c=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(c=new tt(n,this,e)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=b.nextNode(),o++)}return b.currentNode=w,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class H{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),x(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==T&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==u&&x(this._$AH)?this._$AA.nextSibling.data=e:this.T(w.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=L.createElement(Ce(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Ye(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=me.get(e.strings);return t===void 0&&me.set(e.strings,t=new L(e)),t}k(e){te(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new H(this.O(N()),this.O(N()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const r=he(e).nextSibling;he(e).remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class z{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=u}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=O(this,e,t,0),o=!x(e)||e!==this._$AH&&e!==T,o&&(this._$AH=e);else{const a=e;let h,c;for(e=n[0],h=0;h<n.length-1;h++)c=O(this,a[s+h],t,h),c===T&&(c=this._$AH[h]),o||(o=!x(c)||c!==this._$AH[h]),c===u?e=u:e!==u&&(e+=(c??"")+n[h+1]),this._$AH[h]=c}o&&!r&&this.j(e)}j(e){e===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Xe extends z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===u?void 0:e}}class Qe extends z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==u)}}class et extends z{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??u)===T)return;const s=this._$AH,r=e===u&&s!==u||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==u&&(s===u||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class tt{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const W=R.litHtmlPolyfillSupport;W==null||W(L,H),(R.litHtmlVersions??(R.litHtmlVersions=[])).push("3.3.2");const st=(i,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let r=s._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;s._$litPart$=r=new H(e.insertBefore(N(),n),n,void 0,t??{})}return r._$AI(i),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -24,7 +24,7 @@
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */function lt(i){return y({...i,state:!0,attribute:!1})}var dt=Object.defineProperty,Se=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&dt(e,t,r),r};const Z="raycast",ye=[Z,"args","data"],Ee=i=>i.split("-");class U extends C{constructor(e){super(),this.classSource=e,this.instance=null,this.dispose=[],this.mutationObserver=null,this.tryAddOnce=!1,this.connected=!1}observeAttributes(){this.mutationObserver=new MutationObserver(e=>{e.forEach(t=>{if(!t.attributeName)return;const s=this.attributes.getNamedItem(t.attributeName);s&&this.updateProperty(s)})}),this.mutationObserver.observe(this,{attributes:!0})}parsedArgs(){const e=this.args??this.getAttribute("args")??[];return typeof e=="string"?JSON.parse(e):e}createUnderlyingThreeObject(){this.instance=new this.classSource(...this.parsedArgs().map(e=>G(e,this)))}refreshAttributes(){this.getAttributeNames().forEach(e=>{const t=this.attributes.getNamedItem(e);t&&this.updateProperty(t)}),Array.from(this.attributes).forEach(this.updateProperty.bind(this))}async onUnderlyingThreeObjectReady(){var s,r,n,o;const e=this.instance;e.uuid&&this.setAttribute(we,e.uuid);let t=fe(this);for(;this!=null&&this.connected&&!this.tryAddOnce&&!t;)await new Promise(requestAnimationFrame),t=fe(this);if(t&&t.instance||(s=t==null?void 0:t.three)!=null&&s.scene){const a=this.instance,h=this.instance,c=t.instance,d=t.instance??((r=t.three)==null?void 0:r.scene),l=this.instance;if((n=a.type)!=null&&n.toLowerCase().includes("geometry")&&c.geometry)c.geometry=a;else if((o=h.type)!=null&&o.toLowerCase().includes("material")&&c.material)c.material=h;else if(d.add)try{d.add(l),this.dispatchEvent(new CustomEvent("instanceadded",{detail:{instance:this.instance,parent:d}}))}catch{throw new Error(`Error adding ${this.tagName} to ${d}`)}const p=this.getAttribute("attach");p&&this.executeAttach(p,this.instance)}}connectedCallback(){super.connectedCallback(),this.observeAttributes.call(this),this.createUnderlyingThreeObject.call(this),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("instancecreated",{detail:{instance:this.instance}})),this.connected=!0,this.onUnderlyingThreeObjectReady.call(this)}updateProperty(e){const{name:t,value:s}=e;let r=t;Object.keys(this.instance??{}).forEach(a=>{a.toLowerCase()===r&&(r=a)});const n=Ee(r);if(ye.includes(r)||ye.includes(n[0]))return;let o=G(s,this);try{o=JSON.parse(s===""?"true":s)}catch{}this.instance&&K(this.instance,n,o)}executeAttach(e,t){const s=this.parentElement;s.instance&&K(s.instance,Ee(e),t)}disconnectedCallback(){super.disconnectedCallback();const e=[this.instance];this.disposeThreeObjects.call(this,e),this.connected=!1}disposeThreeObjects(e){e.forEach(t=>{var n,o;if(!t)return;const s=t,r=t;(n=s.dispose)==null||n.call(s),(o=r.removeFromParent)==null||o.call(r)})}render(){return se`<slot></slot>`}createRenderRoot(){return this}}Se([y({type:Boolean,attribute:"try-add-once"})],U.prototype,"tryAddOnce");Se([lt()],U.prototype,"connected");const Te=i=>{const e=typeof i=="string"?f[i]:i;if(!it(e))return null;const t=i.toString().toLowerCase().endsWith("loader");class s extends U{constructor(){super(e)}}class r extends U{constructor(){super(...arguments),this.loader=null}createUnderlyingThreeObject(){this.loader=new e(...this.parsedArgs().map(o=>G(o,this)))}async onUnderlyingThreeObjectReady(){const o=this.getAttribute("src");if(!o)throw new Error("Loader requires a source.");if(!this.loader)throw new Error(`Missing loader ${this.tagName}`);this.loader.load(o,a=>{this.instance=a;const h=this.getAttribute("attach");h&&this.executeAttach(h,a),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("loaded",{detail:{instance:a}}))},void 0,a=>{throw new Error(`error loading: ${o}`+a)})}disconnectedCallback(){super.disconnectedCallback(),this.disposeThreeObjects.call(this,[this.loader])}}return t?r:s};var ut=Object.defineProperty,A=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&ut(e,t,r),r};const pt="orthographic",$e=1/0,re=class re extends C{constructor(){super(),this.scratchV2=new f.Vector2,this.three={scene:new f.Scene,camera:null,renderer:null},this.background=null,this.dpr=$e,this.headless=!1,this.manualRender=!1,this.dispatchBeforeRender=!1,this.dispatchAfterRender=!1,this.rendererArgs=[],this.cameraArgs=[],this.raycaster=new f.Raycaster,this.raycastPool=[],this.frame=1/0,this.resizeObserver=new ResizeObserver(e=>{e.forEach(({target:t,contentRect:s})=>{var r;if(t===this&&((r=this.three.renderer)==null||r.setSize(s.width*this.dpr,s.height*this.dpr),this.three.camera)){const n=s.width/s.height;if(this.three.camera.type.toLowerCase()==="perspectivecamera")this.three.camera.aspect=n,this.three.camera.updateProjectionMatrix();else if(this.three.camera.type.toLowerCase()==="orthographiccamera"){const o=s.height/s.width,a=10;this.three.camera.top=o*a,this.three.camera.bottom=-o*a,this.three.camera.right=a,this.three.camera.left=-a,this.three.camera.updateProjectionMatrix()}this.manualRender||this.renderThree()}})})}connectedCallback(){if(super.connectedCallback(),this.dpr===$e&&(this.dpr=window.devicePixelRatio),this.getAttribute(pt)!==null?this.three.camera=new f.OrthographicCamera(...this.cameraArgs):this.three.camera=new f.PerspectiveCamera(...this.cameraArgs.length?this.cameraArgs:[75]),["scene","camera","renderer"].forEach(e=>{const t=this[e]??this.getAttribute(e)??{},s=typeof t=="string"?JSON.parse(t):t;Object.entries(s).forEach(([r,n])=>{this.three[e]&&K(this.three[e],r.split("-"),G(n,this))})}),this.resizeObserver.observe(this),this.background!==null&&(this.three.scene.background=new f.Color(this.background)),!this.headless){const e=new f.WebGLRenderer(...this.rendererArgs);e.domElement.addEventListener("pointermove",this.onPointerMove.bind(this)),e.domElement.addEventListener("mousemove",this.onPointerMove.bind(this)),e.domElement.addEventListener("click",this.onClick.bind(this)),this.three.renderer=e}this.manualRender||this.updateLoop()}disconnectedCallback(){var e,t,s,r;(e=this.three.renderer)==null||e.domElement.removeEventListener("pointermove",this.onPointerMove.bind(this)),(t=this.three.renderer)==null||t.domElement.removeEventListener("mousemove",this.onPointerMove.bind(this)),(s=this.three.renderer)==null||s.domElement.removeEventListener("click",this.onClick.bind(this)),(r=this.three.renderer)==null||r.dispose(),this.resizeObserver.unobserve(this),cancelAnimationFrame(this.frame)}handleDefaultSlotChange(e){e.target.assignedElements().forEach(t=>{const s=t;s.instance instanceof f.Object3D&&t.getAttributeNames().includes(Z)&&t.getAttributeNames().includes(Z)&&this.raycastPool.push(s.instance)}),this.renderThree()}runRaycast(e){var a,h;if(!this.raycastPool.length||!this.three.camera)return[];const t=((a=this.three.renderer)==null?void 0:a.domElement.width)??0,s=((h=this.three.renderer)==null?void 0:h.domElement.height)??0,r=this.scratchV2.clone().set(e.clientX/(t/this.dpr)*2-1,-(e.clientY/(s/this.dpr))*2+1);return this.raycaster.setFromCamera(r,this.three.camera),this.raycaster.intersectObjects(this.raycastPool).map(c=>({intersect:c,element:this.querySelector(`[${we}="${c.object.uuid}"]`)}))}onPointerMove(e){this.runRaycast.bind(this)(e).forEach(s=>{var r,n,o,a;e.type==="pointermove"?((r=s.element)==null||r.dispatchEvent(new PointerEvent("pointermove")),(n=s.element)==null||n.dispatchEvent(new CustomEvent(Oe,{detail:s}))):e.type==="mousemove"&&((o=s.element)==null||o.dispatchEvent(new MouseEvent("mousemove")),(a=s.element)==null||a.dispatchEvent(new CustomEvent(Me,{detail:s})))})}onClick(e){let t=[];if(e instanceof TouchEvent){const s=e.touches[0];t=this.runRaycast.bind(this)(s),t.forEach(r=>{var n;(n=r.element)==null||n.dispatchEvent(new TouchEvent("touchstart"))})}else t=this.runRaycast.bind(this)(e),t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new MouseEvent("click"))});t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new CustomEvent(Re,{detail:s}))})}updateLoop(){this.renderThree(),this.manualRender||(this.frame=requestAnimationFrame(this.updateLoop.bind(this)))}renderThree(e,t){var s;this.dispatchBeforeRender&&this.dispatchEvent(new CustomEvent(Ne,{})),this.three.camera&&((s=this.three.renderer)==null||s.render(e??this.three.scene,t??this.three.camera),this.dispatchAfterRender&&this.dispatchEvent(new CustomEvent(xe,{})))}render(){var e;return se`
27
+ */function lt(i){return y({...i,state:!0,attribute:!1})}var dt=Object.defineProperty,Se=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&dt(e,t,r),r};const Z="raycast",ye=[Z,"args","data"],Ee=i=>i.split("-");class U extends C{constructor(e){super(),this.classSource=e,this.instance=null,this.dispose=[],this.mutationObserver=null,this.tryAddOnce=!1,this.connected=!1}observeAttributes(){this.mutationObserver=new MutationObserver(e=>{e.forEach(t=>{var r;if(!t.attributeName||(r=Object.getPrototypeOf(this).constructor.observedAttributes)!=null&&r.includes(t.attributeName))return;const s=this.attributes.getNamedItem(t.attributeName);s&&this.updateProperty(s)})}),this.mutationObserver.observe(this,{attributes:!0})}parsedArgs(){const e=this.args??this.getAttribute("args")??[];return typeof e=="string"?JSON.parse(e):e}createUnderlyingThreeObject(){this.instance=new this.classSource(...this.parsedArgs().map(e=>G(e,this)))}refreshAttributes(){this.getAttributeNames().forEach(e=>{const t=this.attributes.getNamedItem(e);t&&this.updateProperty(t)}),Array.from(this.attributes).forEach(this.updateProperty.bind(this))}async onUnderlyingThreeObjectReady(){var s,r,n,o;const e=this.instance;e.uuid&&this.setAttribute(we,e.uuid);let t=fe(this);for(;this!=null&&this.connected&&!this.tryAddOnce&&!t;)await new Promise(requestAnimationFrame),t=fe(this);if(t&&t.instance||(s=t==null?void 0:t.three)!=null&&s.scene){const a=this.instance,h=this.instance,c=t.instance,d=t.instance??((r=t.three)==null?void 0:r.scene),l=this.instance;if((n=a.type)!=null&&n.toLowerCase().includes("geometry")&&c.geometry)c.geometry=a;else if((o=h.type)!=null&&o.toLowerCase().includes("material")&&c.material)c.material=h;else if(d.add)try{d.add(l),this.dispatchEvent(new CustomEvent("instanceadded",{detail:{instance:this.instance,parent:d}}))}catch{throw new Error(`Error adding ${this.tagName} to ${d}`)}const p=this.getAttribute("attach");p&&this.executeAttach(p,this.instance)}}connectedCallback(){super.connectedCallback(),this.observeAttributes.call(this),this.createUnderlyingThreeObject.call(this),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("instancecreated",{detail:{instance:this.instance}})),this.connected=!0,this.onUnderlyingThreeObjectReady.call(this)}updateProperty(e){const{name:t,value:s}=e;let r=t;Object.keys(this.instance??{}).forEach(a=>{a.toLowerCase()===r&&(r=a)});const n=Ee(r);if(ye.includes(r)||ye.includes(n[0]))return;let o=G(s,this);try{o=JSON.parse(s===""?"true":s)}catch{}this.instance&&K(this.instance,n,o)}executeAttach(e,t){const s=this.parentElement;s.instance&&K(s.instance,Ee(e),t)}disconnectedCallback(){super.disconnectedCallback();const e=[this.instance];this.disposeThreeObjects.call(this,e),this.connected=!1}disposeThreeObjects(e){e.forEach(t=>{var n,o;if(!t)return;const s=t,r=t;(n=s.dispose)==null||n.call(s),(o=r.removeFromParent)==null||o.call(r)})}render(){return se`<slot></slot>`}createRenderRoot(){return this}}Se([y({type:Boolean,attribute:"try-add-once"})],U.prototype,"tryAddOnce");Se([lt()],U.prototype,"connected");const Te=i=>{const e=typeof i=="string"?f[i]:i;if(!it(e))return null;const t=i.toString().toLowerCase().endsWith("loader");class s extends U{constructor(){super(e)}}class r extends U{constructor(){super(...arguments),this.loader=null}createUnderlyingThreeObject(){this.loader=new e(...this.parsedArgs().map(o=>G(o,this)))}async onUnderlyingThreeObjectReady(){const o=this.getAttribute("src");if(!o)throw new Error("Loader requires a source.");if(!this.loader)throw new Error(`Missing loader ${this.tagName}`);this.loader.load(o,a=>{this.instance=a;const h=this.getAttribute("attach");h&&this.executeAttach(h,a),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("loaded",{detail:{instance:a}}))},void 0,a=>{throw new Error(`error loading: ${o}`+a)})}disconnectedCallback(){super.disconnectedCallback(),this.disposeThreeObjects.call(this,[this.loader])}}return t?r:s};var ut=Object.defineProperty,A=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&ut(e,t,r),r};const pt="orthographic",$e=1/0,re=class re extends C{constructor(){super(),this.scratchV2=new f.Vector2,this.three={scene:new f.Scene,camera:null,renderer:null},this.background=null,this.dpr=$e,this.headless=!1,this.manualRender=!1,this.dispatchBeforeRender=!1,this.dispatchAfterRender=!1,this.rendererArgs=[],this.cameraArgs=[],this.raycaster=new f.Raycaster,this.raycastPool=[],this.frame=1/0,this.resizeObserver=new ResizeObserver(e=>{e.forEach(({target:t,contentRect:s})=>{var r;if(t===this&&((r=this.three.renderer)==null||r.setSize(s.width*this.dpr,s.height*this.dpr),this.three.camera)){const n=s.width/s.height;if(this.three.camera.type.toLowerCase()==="perspectivecamera")this.three.camera.aspect=n,this.three.camera.updateProjectionMatrix();else if(this.three.camera.type.toLowerCase()==="orthographiccamera"){const o=s.height/s.width,a=10;this.three.camera.top=o*a,this.three.camera.bottom=-o*a,this.three.camera.right=a,this.three.camera.left=-a,this.three.camera.updateProjectionMatrix()}this.manualRender||this.renderThree()}})})}connectedCallback(){if(super.connectedCallback(),this.dpr===$e&&(this.dpr=window.devicePixelRatio),this.getAttribute(pt)!==null?this.three.camera=new f.OrthographicCamera(...this.cameraArgs):this.three.camera=new f.PerspectiveCamera(...this.cameraArgs.length?this.cameraArgs:[75]),["scene","camera","renderer"].forEach(e=>{const t=this[e]??this.getAttribute(e)??{},s=typeof t=="string"?JSON.parse(t):t;Object.entries(s).forEach(([r,n])=>{this.three[e]&&K(this.three[e],r.split("-"),G(n,this))})}),this.resizeObserver.observe(this),this.background!==null&&(this.three.scene.background=new f.Color(this.background)),!this.headless){const e=new f.WebGLRenderer(...this.rendererArgs);e.domElement.addEventListener("pointermove",this.onPointerMove.bind(this)),e.domElement.addEventListener("mousemove",this.onPointerMove.bind(this)),e.domElement.addEventListener("click",this.onClick.bind(this)),this.three.renderer=e}this.manualRender||this.updateLoop()}disconnectedCallback(){var e,t,s,r;(e=this.three.renderer)==null||e.domElement.removeEventListener("pointermove",this.onPointerMove.bind(this)),(t=this.three.renderer)==null||t.domElement.removeEventListener("mousemove",this.onPointerMove.bind(this)),(s=this.three.renderer)==null||s.domElement.removeEventListener("click",this.onClick.bind(this)),(r=this.three.renderer)==null||r.dispose(),this.resizeObserver.unobserve(this),cancelAnimationFrame(this.frame)}handleDefaultSlotChange(e){e.target.assignedElements().forEach(t=>{const s=t;s.instance instanceof f.Object3D&&t.getAttributeNames().includes(Z)&&t.getAttributeNames().includes(Z)&&this.raycastPool.push(s.instance)}),this.renderThree()}runRaycast(e){var a,h;if(!this.raycastPool.length||!this.three.camera)return[];const t=((a=this.three.renderer)==null?void 0:a.domElement.width)??0,s=((h=this.three.renderer)==null?void 0:h.domElement.height)??0,r=this.scratchV2.clone().set(e.clientX/(t/this.dpr)*2-1,-(e.clientY/(s/this.dpr))*2+1);return this.raycaster.setFromCamera(r,this.three.camera),this.raycaster.intersectObjects(this.raycastPool).map(c=>({intersect:c,element:this.querySelector(`[${we}="${c.object.uuid}"]`)}))}onPointerMove(e){this.runRaycast.bind(this)(e).forEach(s=>{var r,n,o,a;e.type==="pointermove"?((r=s.element)==null||r.dispatchEvent(new PointerEvent("pointermove")),(n=s.element)==null||n.dispatchEvent(new CustomEvent(Pe,{detail:s}))):e.type==="mousemove"&&((o=s.element)==null||o.dispatchEvent(new MouseEvent("mousemove")),(a=s.element)==null||a.dispatchEvent(new CustomEvent(Me,{detail:s})))})}onClick(e){let t=[];if(e instanceof TouchEvent){const s=e.touches[0];t=this.runRaycast.bind(this)(s),t.forEach(r=>{var n;(n=r.element)==null||n.dispatchEvent(new TouchEvent("touchstart"))})}else t=this.runRaycast.bind(this)(e),t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new MouseEvent("click"))});t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new CustomEvent(Re,{detail:s}))})}updateLoop(){this.renderThree(),this.manualRender||(this.frame=requestAnimationFrame(this.updateLoop.bind(this)))}renderThree(e,t){var s;this.dispatchBeforeRender&&this.dispatchEvent(new CustomEvent(Ne,{})),this.three.camera&&((s=this.three.renderer)==null||s.render(e??this.three.scene,t??this.three.camera),this.dispatchAfterRender&&this.dispatchEvent(new CustomEvent(xe,{})))}render(){var e;return se`
28
28
  <slot @slotchange=${this.handleDefaultSlotChange}></slot>
29
29
  ${(e=this.three.renderer)==null?void 0:e.domElement}
30
30
  `}};re.styles=De`
@@ -40,4 +40,4 @@
40
40
  max-width: 100%;
41
41
  max-height: 100%;
42
42
  }
43
- `;let m=re;A([y()],m.prototype,"background");A([y()],m.prototype,"dpr");A([y()],m.prototype,"headless");A([y({attribute:"manual-render",type:Boolean})],m.prototype,"manualRender");A([y({attribute:"dispatch-before-render",type:Boolean})],m.prototype,"dispatchBeforeRender");A([y({attribute:"dispatch-after-render",type:Boolean})],m.prototype,"dispatchAfterRender");A([y({attribute:"renderer-args",type:Object})],m.prototype,"rendererArgs");A([y({attribute:"camera-args",type:Object})],m.prototype,"cameraArgs");class Pe extends C{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new f.Vector3}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=k(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),e.getWorldPosition(this.scratchV3),this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const a=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);a.divideScalar(devicePixelRatio),this.scratchV3.multiply(a),Array.from(this.children).forEach(h=>{h.style.setProperty("--left",`${this.scratchV3.x}px`),h.style.setProperty("--top",`${this.scratchV3.y}px`)})};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return se`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":m,"html-anchor":Pe}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...Y].forEach(t=>{const s=Le(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Oe="threepointermove",Me="threemousemove",Re="threeclick",Ne="beforerender",xe="afterrender",Le=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=Y.map(Le);exports.AFTER_RENDER_EVENT_NAME=xe;exports.BEFORE_RENDER_EVENT_NAME=Ne;exports.HtmlAnchor=Pe;exports.THREE_CLICK_EVENT_NAME=Re;exports.THREE_MOUSE_MOVE_EVENT_NAME=Me;exports.THREE_POINTER_MOVE_EVENT_NAME=Oe;exports.ThreeBase=U;exports.ThreeLunchbox=m;exports.autoComponents=Y;exports.extend=ft;exports.initLunchbox=mt;exports.webComponentNames=yt;
43
+ `;let m=re;A([y()],m.prototype,"background");A([y()],m.prototype,"dpr");A([y()],m.prototype,"headless");A([y({attribute:"manual-render",type:Boolean})],m.prototype,"manualRender");A([y({attribute:"dispatch-before-render",type:Boolean})],m.prototype,"dispatchBeforeRender");A([y({attribute:"dispatch-after-render",type:Boolean})],m.prototype,"dispatchAfterRender");A([y({attribute:"renderer-args",type:Object})],m.prototype,"rendererArgs");A([y({attribute:"camera-args",type:Object})],m.prototype,"cameraArgs");class Oe extends C{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new f.Vector3}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=k(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),e.getWorldPosition(this.scratchV3),this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const a=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);a.divideScalar(devicePixelRatio),this.scratchV3.multiply(a),Array.from(this.children).forEach(h=>{h.style.setProperty("--left",`${this.scratchV3.x}px`),h.style.setProperty("--top",`${this.scratchV3.y}px`)})};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return se`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":m,"html-anchor":Oe}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...Y].forEach(t=>{const s=Le(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Pe="threepointermove",Me="threemousemove",Re="threeclick",Ne="beforerender",xe="afterrender",Le=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=Y.map(Le);exports.AFTER_RENDER_EVENT_NAME=xe;exports.BEFORE_RENDER_EVENT_NAME=Ne;exports.HtmlAnchor=Oe;exports.THREE_CLICK_EVENT_NAME=Re;exports.THREE_MOUSE_MOVE_EVENT_NAME=Me;exports.THREE_POINTER_MOVE_EVENT_NAME=Pe;exports.ThreeBase=U;exports.ThreeLunchbox=m;exports.autoComponents=Y;exports.extend=ft;exports.initLunchbox=mt;exports.webComponentNames=yt;
@@ -820,7 +820,8 @@ class G extends C {
820
820
  observeAttributes() {
821
821
  this.mutationObserver = new MutationObserver((e) => {
822
822
  e.forEach((t) => {
823
- if (!t.attributeName)
823
+ var r;
824
+ if (!t.attributeName || (r = Object.getPrototypeOf(this).constructor.observedAttributes) != null && r.includes(t.attributeName))
824
825
  return;
825
826
  const s = this.attributes.getNamedItem(t.attributeName);
826
827
  s && this.updateProperty(s);
@@ -12,11 +12,11 @@
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const N=globalThis,de=i=>i,B=N.trustedTypes,ue=B?B.createPolicy("lit-html",{createHTML:i=>i}):void 0,pe="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,me="?"+A,Je=`<${me}>`,b=document,x=()=>b.createComment(""),L=i=>i===null||typeof i!="object"&&typeof i!="function",Y=Array.isArray,Ke=i=>Y(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",X=`[
14
14
  \f\r]`,U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fe=/-->/g,ye=/>/g,v=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ee=/'/g,$e=/"/g,ge=/^(?:script|style|textarea|title)$/i,Ze=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),Q=Ze(1),P=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Ae=new WeakMap,C=b.createTreeWalker(b,129);function _e(i,e){if(!Y(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ue!==void 0?ue.createHTML(e):e}const Ye=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=U;for(let a=0;a<t;a++){const h=i[a];let c,d,l=-1,f=0;for(;f<h.length&&(o.lastIndex=f,d=o.exec(h),d!==null);)f=o.lastIndex,o===U?d[1]==="!--"?o=fe:d[1]!==void 0?o=ye:d[2]!==void 0?(ge.test(d[2])&&(r=RegExp("</"+d[2],"g")),o=v):d[3]!==void 0&&(o=v):o===v?d[0]===">"?(o=r??U,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?v:d[3]==='"'?$e:Ee):o===$e||o===Ee?o=v:o===fe||o===ye?o=U:(o=v,r=void 0);const $=o===v&&i[a+1].startsWith("/>")?" ":"";n+=o===U?h+Je:l>=0?(s.push(c),h.slice(0,l)+pe+h.slice(l)+A+$):h+A+(l===-2?a:$)}return[_e(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class H{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,h=this.parts,[c,d]=Ye(e,t);if(this.el=H.createElement(c,s),C.currentNode=this.el.content,t===2||t===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(r=C.nextNode())!==null&&h.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const l of r.getAttributeNames())if(l.endsWith(pe)){const f=d[o++],$=r.getAttribute(l).split(A),V=/([.?@])?(.*)/.exec(f);h.push({type:1,index:n,name:V[2],strings:$,ctor:V[1]==="."?Qe:V[1]==="?"?et:V[1]==="@"?tt:G}),r.removeAttribute(l)}else l.startsWith(A)&&(h.push({type:6,index:n}),r.removeAttribute(l));if(ge.test(r.tagName)){const l=r.textContent.split(A),f=l.length-1;if(f>0){r.textContent=B?B.emptyScript:"";for(let $=0;$<f;$++)r.append(l[$],x()),C.nextNode(),h.push({type:2,index:++n});r.append(l[f],x())}}}else if(r.nodeType===8)if(r.data===me)h.push({type:2,index:n});else{let l=-1;for(;(l=r.data.indexOf(A,l+1))!==-1;)h.push({type:7,index:n}),l+=A.length-1}n++}}static createElement(e,t){const s=b.createElement("template");return s.innerHTML=e,s}}function O(i,e,t=i,s){var o,a;if(e===P)return e;let r=s!==void 0?(o=t._$Co)==null?void 0:o[s]:t._$Cl;const n=L(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=r:t._$Cl=r),r!==void 0&&(e=O(i,r._$AS(i,e.values),r,s)),e}class Xe{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=((e==null?void 0:e.creationScope)??b).importNode(t,!0);C.currentNode=r;let n=C.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new j(n,n.nextSibling,this,e):h.type===1?c=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(c=new st(n,this,e)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=C.nextNode(),o++)}return C.currentNode=b,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class j{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),L(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==P&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&L(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=H.createElement(_e(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Xe(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ae.get(e.strings);return t===void 0&&Ae.set(e.strings,t=new H(e)),t}k(e){Y(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new j(this.O(x()),this.O(x()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const r=de(e).nextSibling;de(e).remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class G{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=O(this,e,t,0),o=!L(e)||e!==this._$AH&&e!==P,o&&(this._$AH=e);else{const a=e;let h,c;for(e=n[0],h=0;h<n.length-1;h++)c=O(this,a[s+h],t,h),c===P&&(c=this._$AH[h]),o||(o=!L(c)||c!==this._$AH[h]),c===p?e=p:e!==p&&(e+=(c??"")+n[h+1]),this._$AH[h]=c}o&&!r&&this.j(e)}j(e){e===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Qe extends G{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===p?void 0:e}}class et extends G{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==p)}}class tt extends G{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??p)===P)return;const s=this._$AH,r=e===p&&s!==p||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==p&&(s===p||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class st{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const ee=N.litHtmlPolyfillSupport;ee==null||ee(H,j),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.3.2");const rt=(i,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let r=s._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;s._$litPart$=r=new j(e.insertBefore(x(),n),n,void 0,t??{})}return r._$AI(i),r};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ee=/'/g,$e=/"/g,ge=/^(?:script|style|textarea|title)$/i,Ze=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),Q=Ze(1),O=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Ae=new WeakMap,C=b.createTreeWalker(b,129);function _e(i,e){if(!Y(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ue!==void 0?ue.createHTML(e):e}const Ye=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=U;for(let a=0;a<t;a++){const h=i[a];let c,d,l=-1,f=0;for(;f<h.length&&(o.lastIndex=f,d=o.exec(h),d!==null);)f=o.lastIndex,o===U?d[1]==="!--"?o=fe:d[1]!==void 0?o=ye:d[2]!==void 0?(ge.test(d[2])&&(r=RegExp("</"+d[2],"g")),o=v):d[3]!==void 0&&(o=v):o===v?d[0]===">"?(o=r??U,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?v:d[3]==='"'?$e:Ee):o===$e||o===Ee?o=v:o===fe||o===ye?o=U:(o=v,r=void 0);const $=o===v&&i[a+1].startsWith("/>")?" ":"";n+=o===U?h+Je:l>=0?(s.push(c),h.slice(0,l)+pe+h.slice(l)+A+$):h+A+(l===-2?a:$)}return[_e(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class H{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,h=this.parts,[c,d]=Ye(e,t);if(this.el=H.createElement(c,s),C.currentNode=this.el.content,t===2||t===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(r=C.nextNode())!==null&&h.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const l of r.getAttributeNames())if(l.endsWith(pe)){const f=d[o++],$=r.getAttribute(l).split(A),V=/([.?@])?(.*)/.exec(f);h.push({type:1,index:n,name:V[2],strings:$,ctor:V[1]==="."?Qe:V[1]==="?"?et:V[1]==="@"?tt:G}),r.removeAttribute(l)}else l.startsWith(A)&&(h.push({type:6,index:n}),r.removeAttribute(l));if(ge.test(r.tagName)){const l=r.textContent.split(A),f=l.length-1;if(f>0){r.textContent=B?B.emptyScript:"";for(let $=0;$<f;$++)r.append(l[$],x()),C.nextNode(),h.push({type:2,index:++n});r.append(l[f],x())}}}else if(r.nodeType===8)if(r.data===me)h.push({type:2,index:n});else{let l=-1;for(;(l=r.data.indexOf(A,l+1))!==-1;)h.push({type:7,index:n}),l+=A.length-1}n++}}static createElement(e,t){const s=b.createElement("template");return s.innerHTML=e,s}}function P(i,e,t=i,s){var o,a;if(e===O)return e;let r=s!==void 0?(o=t._$Co)==null?void 0:o[s]:t._$Cl;const n=L(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=r:t._$Cl=r),r!==void 0&&(e=P(i,r._$AS(i,e.values),r,s)),e}class Xe{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=((e==null?void 0:e.creationScope)??b).importNode(t,!0);C.currentNode=r;let n=C.nextNode(),o=0,a=0,h=s[0];for(;h!==void 0;){if(o===h.index){let c;h.type===2?c=new j(n,n.nextSibling,this,e):h.type===1?c=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(c=new st(n,this,e)),this._$AV.push(c),h=s[++a]}o!==(h==null?void 0:h.index)&&(n=C.nextNode(),o++)}return C.currentNode=b,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class j{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=P(this,e,t),L(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&L(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=H.createElement(_e(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Xe(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ae.get(e.strings);return t===void 0&&Ae.set(e.strings,t=new H(e)),t}k(e){Y(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new j(this.O(x()),this.O(x()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const r=de(e).nextSibling;de(e).remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class G{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=P(this,e,t,0),o=!L(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let h,c;for(e=n[0],h=0;h<n.length-1;h++)c=P(this,a[s+h],t,h),c===O&&(c=this._$AH[h]),o||(o=!L(c)||c!==this._$AH[h]),c===p?e=p:e!==p&&(e+=(c??"")+n[h+1]),this._$AH[h]=c}o&&!r&&this.j(e)}j(e){e===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Qe extends G{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===p?void 0:e}}class et extends G{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==p)}}class tt extends G{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=P(this,e,t,0)??p)===O)return;const s=this._$AH,r=e===p&&s!==p||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==p&&(s===p||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class st{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){P(this,e)}}const ee=N.litHtmlPolyfillSupport;ee==null||ee(H,j),(N.litHtmlVersions??(N.litHtmlVersions=[])).push("3.3.2");const rt=(i,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let r=s._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;s._$litPart$=r=new j(e.insertBefore(x(),n),n,void 0,t??{})}return r._$AI(i),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const w=globalThis;class S extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return P}}S._$litElement$=!0,S.finalized=!0,(He=w.litElementHydrateSupport)==null||He.call(w,{LitElement:S});const te=w.litElementPolyfillSupport;te==null||te({LitElement:S}),(w.litElementVersions??(w.litElementVersions=[])).push("4.2.2");const it=(i,e,t)=>{if(!e)return;const s=Array.isArray(e)?e:e.match(/([^[.\]])+/g),r=s==null?void 0:s.reduce((n,o)=>n&&n[o],i);return r===void 0?t:r};function nt(i){if(!i)return!1;const e=i.constructor&&i.constructor.toString().substring(0,5)==="class";if(i.prototype===void 0)return e;const t=i.prototype.constructor&&i.prototype.constructor.toString&&i.prototype.constructor.toString().substring(0,5)==="class";return e||t}const ot=(()=>{const i="[object Number]",t=Object.prototype.toString;function s(n){return!!n&&typeof n=="object"}return function(o){return typeof o=="number"||s(o)&&t.call(o)==i}})(),at=(i,e,t)=>{const s=Array.isArray(e)?e:e.match(/([^[.\]])+/g);s==null||s.reduce((r,n,o)=>(r[n]===void 0&&(r[n]={}),o===s.length-1&&(r[n]=t),r[n]),i)},be="data-three-uuid",ve=i=>{var t,s,r;let e=i.parentNode;for(;e&&!(e!=null&&e.instance)&&!((t=e==null?void 0:e.three)!=null&&t.scene);)e=(e==null?void 0:e.parentNode)||(e==null?void 0:e.host)||((r=(s=e.getRootNode)==null?void 0:s.call(e))==null?void 0:r.host);return e};function z(i,e){return i?i instanceof ShadowRoot?z(i.host,e):i instanceof HTMLElement&&(typeof e=="string"&&i.matches(e)||typeof e=="function"&&e(i))?i:z(i.parentNode,e):null}const se=(i,e,t)=>{var n,o;const s=it(i,e);if(ot(t)&&(s!=null&&s.setScalar))s.setScalar(+t);else if(s!=null&&s.set)if(typeof t=="string"){const a=t.split(","),h=a.every(c=>!c.match(/^[^\d,]+$/));if((n=t.toLowerCase().trim().match(/^#[\dabcdef]{3,6}$/))!=null&&n.length)if(t.length===4){const c=[t[1],t[1],t[2],t[2],t[3],t[3]].join("");s.set(+`0x${c}`)}else s.set(+`0x${t.slice(1)}`);else a!=null&&a.length&&h?s.set(...a.map(c=>+c)):s.set(t)}else{const a=Array.isArray(t)?t:[t];s.set(...a)}else at(i,e,t);const r=i;typeof r.type=="string"&&((o=r.type)!=null&&o.toLowerCase().endsWith("material"))&&(r.needsUpdate=!0)},re={$scene:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.scene},$camera:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.camera},$renderer:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.renderer},$domElement:i=>{var t;const e=i.closest("three-lunchbox");return(t=e==null?void 0:e.three.renderer)==null?void 0:t.domElement}},q=(i,e)=>{var s;if(typeof i!="string")return i;if(i==="")return!0;const t=(s=re[i])==null?void 0:s.call(re,e);return CSS.supports("color",i)?new y.Color(i):t??i};/**
19
+ */const w=globalThis;class S extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return O}}S._$litElement$=!0,S.finalized=!0,(He=w.litElementHydrateSupport)==null||He.call(w,{LitElement:S});const te=w.litElementPolyfillSupport;te==null||te({LitElement:S}),(w.litElementVersions??(w.litElementVersions=[])).push("4.2.2");const it=(i,e,t)=>{if(!e)return;const s=Array.isArray(e)?e:e.match(/([^[.\]])+/g),r=s==null?void 0:s.reduce((n,o)=>n&&n[o],i);return r===void 0?t:r};function nt(i){if(!i)return!1;const e=i.constructor&&i.constructor.toString().substring(0,5)==="class";if(i.prototype===void 0)return e;const t=i.prototype.constructor&&i.prototype.constructor.toString&&i.prototype.constructor.toString().substring(0,5)==="class";return e||t}const ot=(()=>{const i="[object Number]",t=Object.prototype.toString;function s(n){return!!n&&typeof n=="object"}return function(o){return typeof o=="number"||s(o)&&t.call(o)==i}})(),at=(i,e,t)=>{const s=Array.isArray(e)?e:e.match(/([^[.\]])+/g);s==null||s.reduce((r,n,o)=>(r[n]===void 0&&(r[n]={}),o===s.length-1&&(r[n]=t),r[n]),i)},be="data-three-uuid",ve=i=>{var t,s,r;let e=i.parentNode;for(;e&&!(e!=null&&e.instance)&&!((t=e==null?void 0:e.three)!=null&&t.scene);)e=(e==null?void 0:e.parentNode)||(e==null?void 0:e.host)||((r=(s=e.getRootNode)==null?void 0:s.call(e))==null?void 0:r.host);return e};function z(i,e){return i?i instanceof ShadowRoot?z(i.host,e):i instanceof HTMLElement&&(typeof e=="string"&&i.matches(e)||typeof e=="function"&&e(i))?i:z(i.parentNode,e):null}const se=(i,e,t)=>{var n,o;const s=it(i,e);if(ot(t)&&(s!=null&&s.setScalar))s.setScalar(+t);else if(s!=null&&s.set)if(typeof t=="string"){const a=t.split(","),h=a.every(c=>!c.match(/^[^\d,]+$/));if((n=t.toLowerCase().trim().match(/^#[\dabcdef]{3,6}$/))!=null&&n.length)if(t.length===4){const c=[t[1],t[1],t[2],t[2],t[3],t[3]].join("");s.set(+`0x${c}`)}else s.set(+`0x${t.slice(1)}`);else a!=null&&a.length&&h?s.set(...a.map(c=>+c)):s.set(t)}else{const a=Array.isArray(t)?t:[t];s.set(...a)}else at(i,e,t);const r=i;typeof r.type=="string"&&((o=r.type)!=null&&o.toLowerCase().endsWith("material"))&&(r.needsUpdate=!0)},re={$scene:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.scene},$camera:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.camera},$renderer:i=>{const e=i.closest("three-lunchbox");return e==null?void 0:e.three.renderer},$domElement:i=>{var t;const e=i.closest("three-lunchbox");return(t=e==null?void 0:e.three.renderer)==null?void 0:t.domElement}},q=(i,e)=>{var s;if(typeof i!="string")return i;if(i==="")return!0;const t=(s=re[i])==null?void 0:s.call(re,e);return CSS.supports("color",i)?new y.Color(i):t??i};/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
@@ -24,7 +24,7 @@
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */function lt(i){return E({...i,state:!0,attribute:!1})}var dt=Object.defineProperty,Ce=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&dt(e,t,r),r};const ie="raycast",we=[ie,"args","data"],Se=i=>i.split("-");class D extends S{constructor(e){super(),this.classSource=e,this.instance=null,this.dispose=[],this.mutationObserver=null,this.tryAddOnce=!1,this.connected=!1}observeAttributes(){this.mutationObserver=new MutationObserver(e=>{e.forEach(t=>{if(!t.attributeName)return;const s=this.attributes.getNamedItem(t.attributeName);s&&this.updateProperty(s)})}),this.mutationObserver.observe(this,{attributes:!0})}parsedArgs(){const e=this.args??this.getAttribute("args")??[];return typeof e=="string"?JSON.parse(e):e}createUnderlyingThreeObject(){this.instance=new this.classSource(...this.parsedArgs().map(e=>q(e,this)))}refreshAttributes(){this.getAttributeNames().forEach(e=>{const t=this.attributes.getNamedItem(e);t&&this.updateProperty(t)}),Array.from(this.attributes).forEach(this.updateProperty.bind(this))}async onUnderlyingThreeObjectReady(){var s,r,n,o;const e=this.instance;e.uuid&&this.setAttribute(be,e.uuid);let t=ve(this);for(;this!=null&&this.connected&&!this.tryAddOnce&&!t;)await new Promise(requestAnimationFrame),t=ve(this);if(t&&t.instance||(s=t==null?void 0:t.three)!=null&&s.scene){const a=this.instance,h=this.instance,c=t.instance,d=t.instance??((r=t.three)==null?void 0:r.scene),l=this.instance;if((n=a.type)!=null&&n.toLowerCase().includes("geometry")&&c.geometry)c.geometry=a;else if((o=h.type)!=null&&o.toLowerCase().includes("material")&&c.material)c.material=h;else if(d.add)try{d.add(l),this.dispatchEvent(new CustomEvent("instanceadded",{detail:{instance:this.instance,parent:d}}))}catch{throw new Error(`Error adding ${this.tagName} to ${d}`)}const f=this.getAttribute("attach");f&&this.executeAttach(f,this.instance)}}connectedCallback(){super.connectedCallback(),this.observeAttributes.call(this),this.createUnderlyingThreeObject.call(this),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("instancecreated",{detail:{instance:this.instance}})),this.connected=!0,this.onUnderlyingThreeObjectReady.call(this)}updateProperty(e){const{name:t,value:s}=e;let r=t;Object.keys(this.instance??{}).forEach(a=>{a.toLowerCase()===r&&(r=a)});const n=Se(r);if(we.includes(r)||we.includes(n[0]))return;let o=q(s,this);try{o=JSON.parse(s===""?"true":s)}catch{}this.instance&&se(this.instance,n,o)}executeAttach(e,t){const s=this.parentElement;s.instance&&se(s.instance,Se(e),t)}disconnectedCallback(){super.disconnectedCallback();const e=[this.instance];this.disposeThreeObjects.call(this,e),this.connected=!1}disposeThreeObjects(e){e.forEach(t=>{var n,o;if(!t)return;const s=t,r=t;(n=s.dispose)==null||n.call(s),(o=r.removeFromParent)==null||o.call(r)})}render(){return Q`<slot></slot>`}createRenderRoot(){return this}}Ce([E({type:Boolean,attribute:"try-add-once"})],D.prototype,"tryAddOnce"),Ce([lt()],D.prototype,"connected");const Te=i=>{const e=typeof i=="string"?y[i]:i;if(!nt(e))return null;const t=i.toString().toLowerCase().endsWith("loader");class s extends D{constructor(){super(e)}}class r extends D{constructor(){super(...arguments),this.loader=null}createUnderlyingThreeObject(){this.loader=new e(...this.parsedArgs().map(o=>q(o,this)))}async onUnderlyingThreeObjectReady(){const o=this.getAttribute("src");if(!o)throw new Error("Loader requires a source.");if(!this.loader)throw new Error(`Missing loader ${this.tagName}`);this.loader.load(o,a=>{this.instance=a;const h=this.getAttribute("attach");h&&this.executeAttach(h,a),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("loaded",{detail:{instance:a}}))},void 0,a=>{throw new Error(`error loading: ${o}`+a)})}disconnectedCallback(){super.disconnectedCallback(),this.disposeThreeObjects.call(this,[this.loader])}}return t?r:s};var ut=Object.defineProperty,_=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&ut(e,t,r),r};const pt="orthographic",Pe=1/0,ne=class ne extends S{constructor(){super(),this.scratchV2=new y.Vector2,this.three={scene:new y.Scene,camera:null,renderer:null},this.background=null,this.dpr=Pe,this.headless=!1,this.manualRender=!1,this.dispatchBeforeRender=!1,this.dispatchAfterRender=!1,this.rendererArgs=[],this.cameraArgs=[],this.raycaster=new y.Raycaster,this.raycastPool=[],this.frame=1/0,this.resizeObserver=new ResizeObserver(e=>{e.forEach(({target:t,contentRect:s})=>{var r;if(t===this&&((r=this.three.renderer)==null||r.setSize(s.width*this.dpr,s.height*this.dpr),this.three.camera)){const n=s.width/s.height;if(this.three.camera.type.toLowerCase()==="perspectivecamera")this.three.camera.aspect=n,this.three.camera.updateProjectionMatrix();else if(this.three.camera.type.toLowerCase()==="orthographiccamera"){const o=s.height/s.width,a=10;this.three.camera.top=o*a,this.three.camera.bottom=-o*a,this.three.camera.right=a,this.three.camera.left=-a,this.three.camera.updateProjectionMatrix()}this.manualRender||this.renderThree()}})})}connectedCallback(){if(super.connectedCallback(),this.dpr===Pe&&(this.dpr=window.devicePixelRatio),this.getAttribute(pt)!==null?this.three.camera=new y.OrthographicCamera(...this.cameraArgs):this.three.camera=new y.PerspectiveCamera(...this.cameraArgs.length?this.cameraArgs:[75]),["scene","camera","renderer"].forEach(e=>{const t=this[e]??this.getAttribute(e)??{},s=typeof t=="string"?JSON.parse(t):t;Object.entries(s).forEach(([r,n])=>{this.three[e]&&se(this.three[e],r.split("-"),q(n,this))})}),this.resizeObserver.observe(this),this.background!==null&&(this.three.scene.background=new y.Color(this.background)),!this.headless){const e=new y.WebGLRenderer(...this.rendererArgs);e.domElement.addEventListener("pointermove",this.onPointerMove.bind(this)),e.domElement.addEventListener("mousemove",this.onPointerMove.bind(this)),e.domElement.addEventListener("click",this.onClick.bind(this)),this.three.renderer=e}this.manualRender||this.updateLoop()}disconnectedCallback(){var e,t,s,r;(e=this.three.renderer)==null||e.domElement.removeEventListener("pointermove",this.onPointerMove.bind(this)),(t=this.three.renderer)==null||t.domElement.removeEventListener("mousemove",this.onPointerMove.bind(this)),(s=this.three.renderer)==null||s.domElement.removeEventListener("click",this.onClick.bind(this)),(r=this.three.renderer)==null||r.dispose(),this.resizeObserver.unobserve(this),cancelAnimationFrame(this.frame)}handleDefaultSlotChange(e){e.target.assignedElements().forEach(t=>{const s=t;s.instance instanceof y.Object3D&&t.getAttributeNames().includes(ie)&&t.getAttributeNames().includes(ie)&&this.raycastPool.push(s.instance)}),this.renderThree()}runRaycast(e){var a,h;if(!this.raycastPool.length||!this.three.camera)return[];const t=((a=this.three.renderer)==null?void 0:a.domElement.width)??0,s=((h=this.three.renderer)==null?void 0:h.domElement.height)??0,r=this.scratchV2.clone().set(e.clientX/(t/this.dpr)*2-1,-(e.clientY/(s/this.dpr))*2+1);return this.raycaster.setFromCamera(r,this.three.camera),this.raycaster.intersectObjects(this.raycastPool).map(c=>({intersect:c,element:this.querySelector(`[${be}="${c.object.uuid}"]`)}))}onPointerMove(e){this.runRaycast.bind(this)(e).forEach(s=>{var r,n,o,a;e.type==="pointermove"?((r=s.element)==null||r.dispatchEvent(new PointerEvent("pointermove")),(n=s.element)==null||n.dispatchEvent(new CustomEvent(Me,{detail:s}))):e.type==="mousemove"&&((o=s.element)==null||o.dispatchEvent(new MouseEvent("mousemove")),(a=s.element)==null||a.dispatchEvent(new CustomEvent(Re,{detail:s})))})}onClick(e){let t=[];if(e instanceof TouchEvent){const s=e.touches[0];t=this.runRaycast.bind(this)(s),t.forEach(r=>{var n;(n=r.element)==null||n.dispatchEvent(new TouchEvent("touchstart"))})}else t=this.runRaycast.bind(this)(e),t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new MouseEvent("click"))});t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new CustomEvent(Ne,{detail:s}))})}updateLoop(){this.renderThree(),this.manualRender||(this.frame=requestAnimationFrame(this.updateLoop.bind(this)))}renderThree(e,t){var s;this.dispatchBeforeRender&&this.dispatchEvent(new CustomEvent(xe,{})),this.three.camera&&((s=this.three.renderer)==null||s.render(e??this.three.scene,t??this.three.camera),this.dispatchAfterRender&&this.dispatchEvent(new CustomEvent(Le,{})))}render(){var e;return Q`
27
+ */function lt(i){return E({...i,state:!0,attribute:!1})}var dt=Object.defineProperty,Ce=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&dt(e,t,r),r};const ie="raycast",we=[ie,"args","data"],Se=i=>i.split("-");class D extends S{constructor(e){super(),this.classSource=e,this.instance=null,this.dispose=[],this.mutationObserver=null,this.tryAddOnce=!1,this.connected=!1}observeAttributes(){this.mutationObserver=new MutationObserver(e=>{e.forEach(t=>{var r;if(!t.attributeName||(r=Object.getPrototypeOf(this).constructor.observedAttributes)!=null&&r.includes(t.attributeName))return;const s=this.attributes.getNamedItem(t.attributeName);s&&this.updateProperty(s)})}),this.mutationObserver.observe(this,{attributes:!0})}parsedArgs(){const e=this.args??this.getAttribute("args")??[];return typeof e=="string"?JSON.parse(e):e}createUnderlyingThreeObject(){this.instance=new this.classSource(...this.parsedArgs().map(e=>q(e,this)))}refreshAttributes(){this.getAttributeNames().forEach(e=>{const t=this.attributes.getNamedItem(e);t&&this.updateProperty(t)}),Array.from(this.attributes).forEach(this.updateProperty.bind(this))}async onUnderlyingThreeObjectReady(){var s,r,n,o;const e=this.instance;e.uuid&&this.setAttribute(be,e.uuid);let t=ve(this);for(;this!=null&&this.connected&&!this.tryAddOnce&&!t;)await new Promise(requestAnimationFrame),t=ve(this);if(t&&t.instance||(s=t==null?void 0:t.three)!=null&&s.scene){const a=this.instance,h=this.instance,c=t.instance,d=t.instance??((r=t.three)==null?void 0:r.scene),l=this.instance;if((n=a.type)!=null&&n.toLowerCase().includes("geometry")&&c.geometry)c.geometry=a;else if((o=h.type)!=null&&o.toLowerCase().includes("material")&&c.material)c.material=h;else if(d.add)try{d.add(l),this.dispatchEvent(new CustomEvent("instanceadded",{detail:{instance:this.instance,parent:d}}))}catch{throw new Error(`Error adding ${this.tagName} to ${d}`)}const f=this.getAttribute("attach");f&&this.executeAttach(f,this.instance)}}connectedCallback(){super.connectedCallback(),this.observeAttributes.call(this),this.createUnderlyingThreeObject.call(this),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("instancecreated",{detail:{instance:this.instance}})),this.connected=!0,this.onUnderlyingThreeObjectReady.call(this)}updateProperty(e){const{name:t,value:s}=e;let r=t;Object.keys(this.instance??{}).forEach(a=>{a.toLowerCase()===r&&(r=a)});const n=Se(r);if(we.includes(r)||we.includes(n[0]))return;let o=q(s,this);try{o=JSON.parse(s===""?"true":s)}catch{}this.instance&&se(this.instance,n,o)}executeAttach(e,t){const s=this.parentElement;s.instance&&se(s.instance,Se(e),t)}disconnectedCallback(){super.disconnectedCallback();const e=[this.instance];this.disposeThreeObjects.call(this,e),this.connected=!1}disposeThreeObjects(e){e.forEach(t=>{var n,o;if(!t)return;const s=t,r=t;(n=s.dispose)==null||n.call(s),(o=r.removeFromParent)==null||o.call(r)})}render(){return Q`<slot></slot>`}createRenderRoot(){return this}}Ce([E({type:Boolean,attribute:"try-add-once"})],D.prototype,"tryAddOnce"),Ce([lt()],D.prototype,"connected");const Te=i=>{const e=typeof i=="string"?y[i]:i;if(!nt(e))return null;const t=i.toString().toLowerCase().endsWith("loader");class s extends D{constructor(){super(e)}}class r extends D{constructor(){super(...arguments),this.loader=null}createUnderlyingThreeObject(){this.loader=new e(...this.parsedArgs().map(o=>q(o,this)))}async onUnderlyingThreeObjectReady(){const o=this.getAttribute("src");if(!o)throw new Error("Loader requires a source.");if(!this.loader)throw new Error(`Missing loader ${this.tagName}`);this.loader.load(o,a=>{this.instance=a;const h=this.getAttribute("attach");h&&this.executeAttach(h,a),this.refreshAttributes.call(this),this.dispatchEvent(new CustomEvent("loaded",{detail:{instance:a}}))},void 0,a=>{throw new Error(`error loading: ${o}`+a)})}disconnectedCallback(){super.disconnectedCallback(),this.disposeThreeObjects.call(this,[this.loader])}}return t?r:s};var ut=Object.defineProperty,_=(i,e,t,s)=>{for(var r=void 0,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(e,t,r)||r);return r&&ut(e,t,r),r};const pt="orthographic",Oe=1/0,ne=class ne extends S{constructor(){super(),this.scratchV2=new y.Vector2,this.three={scene:new y.Scene,camera:null,renderer:null},this.background=null,this.dpr=Oe,this.headless=!1,this.manualRender=!1,this.dispatchBeforeRender=!1,this.dispatchAfterRender=!1,this.rendererArgs=[],this.cameraArgs=[],this.raycaster=new y.Raycaster,this.raycastPool=[],this.frame=1/0,this.resizeObserver=new ResizeObserver(e=>{e.forEach(({target:t,contentRect:s})=>{var r;if(t===this&&((r=this.three.renderer)==null||r.setSize(s.width*this.dpr,s.height*this.dpr),this.three.camera)){const n=s.width/s.height;if(this.three.camera.type.toLowerCase()==="perspectivecamera")this.three.camera.aspect=n,this.three.camera.updateProjectionMatrix();else if(this.three.camera.type.toLowerCase()==="orthographiccamera"){const o=s.height/s.width,a=10;this.three.camera.top=o*a,this.three.camera.bottom=-o*a,this.three.camera.right=a,this.three.camera.left=-a,this.three.camera.updateProjectionMatrix()}this.manualRender||this.renderThree()}})})}connectedCallback(){if(super.connectedCallback(),this.dpr===Oe&&(this.dpr=window.devicePixelRatio),this.getAttribute(pt)!==null?this.three.camera=new y.OrthographicCamera(...this.cameraArgs):this.three.camera=new y.PerspectiveCamera(...this.cameraArgs.length?this.cameraArgs:[75]),["scene","camera","renderer"].forEach(e=>{const t=this[e]??this.getAttribute(e)??{},s=typeof t=="string"?JSON.parse(t):t;Object.entries(s).forEach(([r,n])=>{this.three[e]&&se(this.three[e],r.split("-"),q(n,this))})}),this.resizeObserver.observe(this),this.background!==null&&(this.three.scene.background=new y.Color(this.background)),!this.headless){const e=new y.WebGLRenderer(...this.rendererArgs);e.domElement.addEventListener("pointermove",this.onPointerMove.bind(this)),e.domElement.addEventListener("mousemove",this.onPointerMove.bind(this)),e.domElement.addEventListener("click",this.onClick.bind(this)),this.three.renderer=e}this.manualRender||this.updateLoop()}disconnectedCallback(){var e,t,s,r;(e=this.three.renderer)==null||e.domElement.removeEventListener("pointermove",this.onPointerMove.bind(this)),(t=this.three.renderer)==null||t.domElement.removeEventListener("mousemove",this.onPointerMove.bind(this)),(s=this.three.renderer)==null||s.domElement.removeEventListener("click",this.onClick.bind(this)),(r=this.three.renderer)==null||r.dispose(),this.resizeObserver.unobserve(this),cancelAnimationFrame(this.frame)}handleDefaultSlotChange(e){e.target.assignedElements().forEach(t=>{const s=t;s.instance instanceof y.Object3D&&t.getAttributeNames().includes(ie)&&t.getAttributeNames().includes(ie)&&this.raycastPool.push(s.instance)}),this.renderThree()}runRaycast(e){var a,h;if(!this.raycastPool.length||!this.three.camera)return[];const t=((a=this.three.renderer)==null?void 0:a.domElement.width)??0,s=((h=this.three.renderer)==null?void 0:h.domElement.height)??0,r=this.scratchV2.clone().set(e.clientX/(t/this.dpr)*2-1,-(e.clientY/(s/this.dpr))*2+1);return this.raycaster.setFromCamera(r,this.three.camera),this.raycaster.intersectObjects(this.raycastPool).map(c=>({intersect:c,element:this.querySelector(`[${be}="${c.object.uuid}"]`)}))}onPointerMove(e){this.runRaycast.bind(this)(e).forEach(s=>{var r,n,o,a;e.type==="pointermove"?((r=s.element)==null||r.dispatchEvent(new PointerEvent("pointermove")),(n=s.element)==null||n.dispatchEvent(new CustomEvent(Me,{detail:s}))):e.type==="mousemove"&&((o=s.element)==null||o.dispatchEvent(new MouseEvent("mousemove")),(a=s.element)==null||a.dispatchEvent(new CustomEvent(Re,{detail:s})))})}onClick(e){let t=[];if(e instanceof TouchEvent){const s=e.touches[0];t=this.runRaycast.bind(this)(s),t.forEach(r=>{var n;(n=r.element)==null||n.dispatchEvent(new TouchEvent("touchstart"))})}else t=this.runRaycast.bind(this)(e),t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new MouseEvent("click"))});t.forEach(s=>{var r;(r=s.element)==null||r.dispatchEvent(new CustomEvent(Ne,{detail:s}))})}updateLoop(){this.renderThree(),this.manualRender||(this.frame=requestAnimationFrame(this.updateLoop.bind(this)))}renderThree(e,t){var s;this.dispatchBeforeRender&&this.dispatchEvent(new CustomEvent(xe,{})),this.three.camera&&((s=this.three.renderer)==null||s.render(e??this.three.scene,t??this.three.camera),this.dispatchAfterRender&&this.dispatchEvent(new CustomEvent(Le,{})))}render(){var e;return Q`
28
28
  <slot @slotchange=${this.handleDefaultSlotChange}></slot>
29
29
  ${(e=this.three.renderer)==null?void 0:e.domElement}
30
30
  `}};ne.styles=ke`
@@ -40,4 +40,4 @@
40
40
  max-width: 100%;
41
41
  max-height: 100%;
42
42
  }
43
- `;let m=ne;_([E()],m.prototype,"background"),_([E()],m.prototype,"dpr"),_([E()],m.prototype,"headless"),_([E({attribute:"manual-render",type:Boolean})],m.prototype,"manualRender"),_([E({attribute:"dispatch-before-render",type:Boolean})],m.prototype,"dispatchBeforeRender"),_([E({attribute:"dispatch-after-render",type:Boolean})],m.prototype,"dispatchAfterRender"),_([E({attribute:"renderer-args",type:Object})],m.prototype,"rendererArgs"),_([E({attribute:"camera-args",type:Object})],m.prototype,"cameraArgs");class Oe extends S{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new y.Vector3}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=z(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),e.getWorldPosition(this.scratchV3),this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const a=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);a.divideScalar(devicePixelRatio),this.scratchV3.multiply(a),Array.from(this.children).forEach(h=>{h.style.setProperty("--left",`${this.scratchV3.x}px`),h.style.setProperty("--top",`${this.scratchV3.y}px`)})};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return Q`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":m,"html-anchor":Oe}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...W].forEach(t=>{const s=Ue(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Me="threepointermove",Re="threemousemove",Ne="threeclick",xe="beforerender",Le="afterrender",Ue=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=W.map(Ue);u.AFTER_RENDER_EVENT_NAME=Le,u.BEFORE_RENDER_EVENT_NAME=xe,u.HtmlAnchor=Oe,u.THREE_CLICK_EVENT_NAME=Ne,u.THREE_MOUSE_MOVE_EVENT_NAME=Re,u.THREE_POINTER_MOVE_EVENT_NAME=Me,u.ThreeBase=D,u.ThreeLunchbox=m,u.autoComponents=W,u.extend=ft,u.initLunchbox=mt,u.webComponentNames=yt,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
43
+ `;let m=ne;_([E()],m.prototype,"background"),_([E()],m.prototype,"dpr"),_([E()],m.prototype,"headless"),_([E({attribute:"manual-render",type:Boolean})],m.prototype,"manualRender"),_([E({attribute:"dispatch-before-render",type:Boolean})],m.prototype,"dispatchBeforeRender"),_([E({attribute:"dispatch-after-render",type:Boolean})],m.prototype,"dispatchAfterRender"),_([E({attribute:"renderer-args",type:Object})],m.prototype,"rendererArgs"),_([E({attribute:"camera-args",type:Object})],m.prototype,"cameraArgs");class Pe extends S{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new y.Vector3}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=z(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),e.getWorldPosition(this.scratchV3),this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const a=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);a.divideScalar(devicePixelRatio),this.scratchV3.multiply(a),Array.from(this.children).forEach(h=>{h.style.setProperty("--left",`${this.scratchV3.x}px`),h.style.setProperty("--top",`${this.scratchV3.y}px`)})};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return Q`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":m,"html-anchor":Pe}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...W].forEach(t=>{const s=Ue(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Me="threepointermove",Re="threemousemove",Ne="threeclick",xe="beforerender",Le="afterrender",Ue=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=W.map(Ue);u.AFTER_RENDER_EVENT_NAME=Le,u.BEFORE_RENDER_EVENT_NAME=xe,u.HtmlAnchor=Pe,u.THREE_CLICK_EVENT_NAME=Ne,u.THREE_MOUSE_MOVE_EVENT_NAME=Re,u.THREE_POINTER_MOVE_EVENT_NAME=Me,u.ThreeBase=D,u.ThreeLunchbox=m,u.autoComponents=W,u.extend=ft,u.initLunchbox=mt,u.webComponentNames=yt,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "types": "./src/types.d.ts"
14
14
  }
15
15
  },
16
- "version": "2.1.13",
16
+ "version": "2.1.15",
17
17
  "type": "module",
18
18
  "types": "./src/types.d.ts",
19
19
  "scripts": {
@@ -54,7 +54,7 @@ export class HtmlAnchor extends LitElement {
54
54
  }
55
55
 
56
56
  // Setup - save local parent and try adding update
57
- connectedCallback() {
57
+ override connectedCallback() {
58
58
  super.connectedCallback();
59
59
 
60
60
  const parent = this.parentNode as Lunchbox<THREE.Object3D>;
@@ -73,16 +73,16 @@ export class HtmlAnchor extends LitElement {
73
73
  }
74
74
 
75
75
  // Teardown
76
- disconnectedCallback(): void {
76
+ override disconnectedCallback(): void {
77
77
  if (this.frame !== -1) cancelAnimationFrame(this.frame);
78
78
  }
79
79
 
80
80
 
81
- protected render(): unknown {
81
+ override render(): unknown {
82
82
  return html`<slot></slot>`
83
83
  }
84
84
 
85
- protected createRenderRoot() {
85
+ override createRenderRoot() {
86
86
  return this;
87
87
  }
88
88
  }
package/src/index.ts CHANGED
@@ -2,8 +2,8 @@ import { autoComponents } from './auto-components';
2
2
  import { buildClass } from './three-base';
3
3
  import { ThreeLunchbox } from './three-lunchbox';
4
4
  import { IsClass } from './utils';
5
- import * as THREE from '../node_modules/@types/three';
6
5
  import { HtmlAnchor } from './html-anchor';
6
+ import type { Intersection, Object3DEventMap, Scene, Object3D } from 'three';
7
7
 
8
8
  export * from './three-lunchbox';
9
9
  export * from './html-anchor';
@@ -29,9 +29,9 @@ export { ThreeBase } from './three-base';
29
29
  * mesh?.instance.position.set(0, 1, 0); // - or anything else you can do with a mesh
30
30
  * ```
31
31
  */
32
- export type Lunchbox<T = THREE.Object3D> = Element & LunchboxProperties<T>
32
+ export type Lunchbox<T = Object3D> = Element & LunchboxProperties<T>
33
33
 
34
- export type LunchboxProperties<T = THREE.Object3D> = {
34
+ export type LunchboxProperties<T = Object3D> = {
35
35
  instance: T;
36
36
  }
37
37
 
@@ -65,7 +65,7 @@ export const initLunchbox = ({
65
65
  return;
66
66
  }
67
67
 
68
- const result = buildClass(className as keyof typeof THREE);
68
+ const result = buildClass(className as any);
69
69
  if (result) {
70
70
  customElements.define(kebabCase, result);
71
71
  }
@@ -111,14 +111,14 @@ export const THREE_CLICK_EVENT_NAME = 'threeclick';
111
111
  export const BEFORE_RENDER_EVENT_NAME = 'beforerender';
112
112
  export const AFTER_RENDER_EVENT_NAME = 'afterrender';
113
113
  export type ThreeIntersectEvent = {
114
- intersect: THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>>;
114
+ intersect: Intersection<Object3D<Object3DEventMap>>;
115
115
  element: Element | null;
116
116
  }
117
117
  export interface InstanceEvent<T = unknown> {
118
118
  instance: T;
119
119
  }
120
120
  export type InstanceAddedEvent<T = unknown> = InstanceEvent<T> & {
121
- parent: THREE.Scene | THREE.Object3D
121
+ parent: Scene | Object3D
122
122
  }
123
123
  export interface LoadedEvent<T = unknown> {
124
124
  loaded: T;
package/src/three-base.ts CHANGED
@@ -39,7 +39,10 @@ export abstract class ThreeBase<U extends new (...args: any) => any> extends Lit
39
39
  // ==================
40
40
  this.mutationObserver = new MutationObserver(mutations => {
41
41
  mutations.forEach(mutation => {
42
+ // Ignore if no value
42
43
  if (!mutation.attributeName) return;
44
+ // Ignore if this is one of the observed Lit attributes
45
+ if (Object.getPrototypeOf(this).constructor.observedAttributes?.includes(mutation.attributeName)) return;
43
46
  const attr = this.attributes.getNamedItem(mutation.attributeName);
44
47
  if (attr) {
45
48
  this.updateProperty(attr);
@@ -101,7 +101,7 @@ export class ThreeLunchbox extends LitElement {
101
101
  }
102
102
 
103
103
  /** To run on start. */
104
- connectedCallback(): void {
104
+ override connectedCallback(): void {
105
105
  super.connectedCallback();
106
106
  if (this.dpr === DEFAULT_DPR) {
107
107
  this.dpr = window.devicePixelRatio;
@@ -150,7 +150,7 @@ export class ThreeLunchbox extends LitElement {
150
150
  }
151
151
  }
152
152
 
153
- disconnectedCallback(): void {
153
+ override disconnectedCallback(): void {
154
154
  this.three.renderer?.domElement.removeEventListener('pointermove', this.onPointerMove.bind(this));
155
155
  this.three.renderer?.domElement.removeEventListener('mousemove', this.onPointerMove.bind(this));
156
156
  this.three.renderer?.domElement.removeEventListener('click', this.onClick.bind(this));
@@ -245,7 +245,7 @@ export class ThreeLunchbox extends LitElement {
245
245
 
246
246
  /** Container styles */
247
247
  // TODO: fill window, fit-to-container
248
- static styles = css`
248
+ static override styles = css`
249
249
  :host {
250
250
  width: 100%;
251
251
  height: 100%;
@@ -284,7 +284,7 @@ export class ThreeLunchbox extends LitElement {
284
284
  }
285
285
  }
286
286
 
287
- render() {
287
+ override render() {
288
288
  // TODO: more robust slot changes
289
289
  return html`
290
290
  <slot @slotchange=${this.handleDefaultSlotChange}></slot>