lecodes-cli 2.0.9 → 2.0.11
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/index.js +151 -94
- package/package.json +8 -8
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +3 -3
- package/runtime/web/player.js +2 -2
- package/runtime/web-lite/assets/{index-3CbsYWmo.js → index-BttBnvIf.js} +1 -1
- package/runtime/web-lite/assets/scene3d-D8LdhX0V.js +888 -0
- package/runtime/web-lite/features.json +2 -2
- package/runtime/web-lite/lite.js +2 -2
- package/src/dev/webRunner.ts +1 -1
- package/runtime/web-lite/assets/scene3d-CX7MAqmN.js +0 -866
package/runtime/web/VERSION.json
CHANGED
package/runtime/web/player.js
CHANGED
|
@@ -10,7 +10,7 @@ var kn=Object.defineProperty;var Rn=(n,t,e)=>t in n?kn(n,t,{enumerable:!0,config
|
|
|
10
10
|
`)){if(i.length===0){s.push("");continue}let o=i;for(;o;){if(e(o)<=t){s.push(o),r=Math.max(r,e(o));break}let a=0,h=-1,l=0;for(;(l=o.indexOf(" ",l+1))!==-1&&!(e(o.substring(0,l))>t);)h=l;if(h>0)a=h;else{let f=o.indexOf(" ");f===-1&&(f=o.length);const u=o.substring(0,f);if(e(u)>t){for(let d=1;d<=u.length;d++)if(e(u.substring(0,d))>t){a=d-1;break}}else for(let d=f+1;d<=o.length;d++)if(e(o.substring(0,d))>t){a=d-1;break}}a<=0&&(a=1);const c=o.substring(0,a);s.push(c),r=Math.max(r,e(c)),o=o.substring(a+(h>0?1:0))}}return{lines:s,maxWidth:r}}const Dt="…";function hn(n,t,e,s){const r=t.lineClamp??0;if(r<=0||n.length<=r)return n;const i=n.slice(0,r);return t.textOverflow==="clip"||(i[r-1]=ts(i[r-1],e,s)),i}function ts(n,t,e){if(!isFinite(t))return n+Dt;const s=[...n];let r=s.length;for(;r>0&&e(s.slice(0,r).join("")+Dt)>t;)r--;return s.slice(0,r).join("").trimEnd()+Dt}function es(n,t,e){const s=ee(n),r=ln(s),i=isNaN(e)?1/0:e,o=c=>t.measureText(c,r),a=vt(n.text??"",i,o),h=hn(a.lines,n.style,i,o);let l=a.maxWidth;if(h!==a.lines){l=0;for(const c of h)l=Math.max(l,o(c))}return{width:Math.ceil(l),height:Math.ceil(h.length*s.lineHeight)}}function ns(n,t,e){const s=n.style,r={family:s.fontFamily??"Roboto",size:s.fontSize??14,weight:s.fontWeight??400,italic:s.fontStyle==="italic",letterSpacing:s.letterSpacing??0},i=s.lineHeight,o=n.value??"";if(n.type==="input")return{width:Math.ceil(t.measureText(o,r)),height:Math.ceil(i)};const a=isNaN(e)?1/0:e,h=vt(o,a,l=>t.measureText(l,r));return{width:Math.ceil(h.maxWidth),height:Math.ceil(Math.max(1,h.lines.length)*i)}}function rs(n,t,e,s){const r=n.imageSrcRaw;let i=0,o=0;if(n.sourceRect)i=n.sourceRect[2],o=n.sourceRect[3];else if(en(r)){const l=Qt(r.svg);if(l)i=l.width,o=l.height;else{const c=t.getImage(t.resolveSrc(r)??"");i=(c==null?void 0:c.naturalWidth)??0,o=(c==null?void 0:c.naturalHeight)??0}}else{const l=t.resolveSrc(r),c=l?t.getImage(l):void 0;i=(c==null?void 0:c.naturalWidth)??0,o=(c==null?void 0:c.naturalHeight)??0}if(i===0||o===0)return{width:0,height:0};const a=Math.min(e/i,s/o),h=isNaN(e)&&isNaN(s)?1:isNaN(e)?s/o:isNaN(s)?e/i:Math.min(a,1);return{width:i*h,height:o*h}}function ss(n,t,e,s,r,i,o={}){t.beginFrame(s,r);for(const a of n)un(a.tree,t,e,o);t.endFrame()}function un(n,t,e,s){const{style:r,rect:i}=n;t.save();const o=r.opacity!==void 0&&r.opacity<1?r.opacity:void 0,a=o!==void 0&&n.children.length>0;if(a?t.beginGroup(o):o!==void 0&&t.setAlpha(o),r.transform){const[c,f,u,d,p,b]=r.transform,g=r.transformOrigin,x=i.x+(g?g.xPercent?i.width*g.x/100:g.x:i.width/2),m=i.y+(g?g.yPercent?i.height*g.y/100:g.y:i.height/2);t.translate(x,m),t.transform(c,f,u,d,p,b),t.translate(-x,-m)}const h=te(r.borderRadius,i);if(Zt(r.backgroundColor)||t.fillRoundRect(i,h,r.backgroundColor),r.backgroundImage){const c=e.getImage(r.backgroundImage);c&&c.naturalWidth>0&&c.naturalHeight>0&&(t.save(),Se(h)&&t.clipRoundRect(i,h),t.drawImage(c,null,i,{fit:is(r.backgroundSize),tile:r.backgroundSize==="tile"}),t.restore())}if(r.backgroundGradients)for(let c=r.backgroundGradients.length-1;c>=0;c--){const f=r.backgroundGradients[c];f.stops.length>0&&t.fillGradient(i,h,f)}if(n.image&&n.image.naturalWidth>0&&n.image.naturalHeight>0){const c=n.sourceRect;t.save(),Se(h)&&t.clipRoundRect(i,h),t.drawImage(n.image,c?{x:c[0],y:c[1],width:c[2],height:c[3]}:null,i,{fit:c?"fill":r.objectFit??"contain",tint:It(n.image.src)?r.tintColor:void 0,radius:h}),t.restore()}n.type==="text"&&n.lines&&n.lines.length>0&&as(n,t,e),(n.type==="input"||n.type==="textarea")&&n.id!==s.editing&&ls(n,t,e,h),(n.type==="video"||n.type==="native")&&(s.surfaces?t.clearRoundRect(i,h):n.type==="video"&&cs(n,t,e,h)),n.clip&&t.clipRoundRect(i,h);for(const c of n.children)c.overlay!==void 0&&!Zt(c.overlay)&&t.fillRoundRect(i,void 0,c.overlay),un(c,t,e,s);r.dim!==void 0&&r.dim>0&&t.fillRoundRect(i,h,Math.round(Math.min(1,r.dim)*255)>>>0);const l=os(r.border);l&&t.strokeBorder(i,h,l),a&&t.endGroup(),t.restore()}function is(n){return n==="contain"||n==="fill"?n:"cover"}function os(n){if(!n)return null;const t={};let e=!1;for(const s of["top","right","bottom","left"]){const r=n[s];r&&r.width>0&&(r.color>>>0)%256!==0&&(t[s]=r,e=!0)}return e?t:null}const dn=(n,t)=>{var s;const e=t??"Roboto";return((s=n.resolveFontFamily)==null?void 0:s.call(n,e))??e};function as(n,t,e){var g,x,m;const s=n.style,r={family:dn(e,s.fontFamily),size:s.fontSize??14,weight:s.fontWeight??400,italic:s.fontStyle==="italic",letterSpacing:s.letterSpacing??0},i=s.color??255,o=s.lineHeight,a=s.textAlign??"start",h=e.fontMetrics(r),{rect:l,lines:c}=n,f=((g=n.padding)==null?void 0:g[0])??0,u=((x=n.padding)==null?void 0:x[1])??0,d=((m=n.padding)==null?void 0:m[2])??0,p=l.x+f,b=l.width-f-d;for(let v=0;v<c.length;v++){const _=c[v],P=l.y+u+v*o+(o-(h.ascent+h.descent))/2+h.ascent,I=e.measureText(_,r),F=a==="center"?p+(b-I)/2:a==="end"?p+b-I:p;if(t.fillText(_,F,P,r,i),s.textDecoration==="underline"||s.textDecoration==="line-through"){const D=Math.max(1,r.size/14),R=s.textDecoration==="underline"?P+D:P-r.size*.3;t.fillRoundRect({x:F,y:R,width:I,height:D},void 0,i)}}}function cs(n,t,e,s){const{rect:r}=n;Zt(n.style.backgroundColor)&&t.fillRoundRect(r,s,286463999);const i=Math.min(r.width,r.height)*.3;if(i>=6){const o={family:"Roboto",size:i,weight:400,italic:!1,letterSpacing:0},a=e.fontMetrics(o),h=e.measureText("▶",o),l=r.x+(r.width-h)/2,c=r.y+(r.height-(a.ascent+a.descent))/2+a.ascent;t.fillText("▶",l,c,o,4294967244)}}function ls(n,t,e,s){var z,G,V,y,L;const r=n.style,i={family:dn(e,r.fontFamily),size:r.fontSize??14,weight:r.fontWeight??400,italic:r.fontStyle==="italic",letterSpacing:r.letterSpacing??0},o=n.value??"",a=o.length===0,h=r.inputType==="password"&&!a,l=a?r.placeholder??"":h?"•".repeat(o.length):o,c=a?r.placeholderColor??2576980479:r.color??255,{rect:f}=n,u=((z=n.padding)==null?void 0:z[0])??0,d=((G=n.padding)==null?void 0:G[1])??0,p=((V=n.padding)==null?void 0:V[2])??0,b=((y=n.padding)==null?void 0:y[3])??0,g=f.x+u,x=f.width-u-p,m=f.y+d,v=f.height-d-b,_=e.fontMetrics(i),M=r.lineHeight,P=r.textAlign??"start",I=n.type==="textarea",F=I?vt(l,x,A=>e.measureText(A,i)).lines:[l],D=A=>P==="center"?g+(x-A)/2:P==="end"?g+x-A:g,R=A=>I?m+A*M+(M-(_.ascent+_.descent))/2+_.ascent:m+(v-(_.ascent+_.descent))/2+_.ascent;t.save(),t.clipRoundRect(f,s);for(let A=0;A<F.length;A++){const H=F[A];H.length>0&&t.fillText(H,D(e.measureText(H,i)),R(A),i,c)}if((L=n.state)!=null&&L.focused){const A=a?[""]:I?vt(h?"•".repeat(o.length):o,x,N=>e.measureText(N,i)).lines:[l],H=A.length-1,Y=e.measureText(A[H],i),J=a?D(0):D(Y)+Y,S=R(H),k=Math.max(1,i.size/14);t.fillRoundRect({x:J,y:S-_.ascent,width:k,height:_.ascent+_.descent},void 0,r.color??255)}t.restore()}function fn(n,t=[],e={}){const s=e.precision??2,r=e.includeIds??!1,i=n?ne(n,s,r):null;if(t.length===0)return i;const o=t.map(a=>ne(a,s,r));return i?(i.overlays=o,i):{type:"frame",overlays:o}}function hs(n,t=[],e){return JSON.stringify(fn(n,t,e),null,2)}function ut(n,t){const e=10**t;return Math.round(n*e)/e}function ne(n,t,e){var o,a;const s=n.rect,r={type:n.type};n.name&&(r.name=n.name),r.rect=[ut(s.x,t),ut(s.y,t),ut(s.width,t),ut(s.height,t)],e&&(r.id=n.id);const i=ds(n.style);return i&&(r.style=i),n.text!==void 0&&(r.text=n.text),n.lines&&(n.lines.length!==1||n.lines[0]!==n.text)&&(r.lines=n.lines),n.value!==void 0&&n.value!==""&&(r.value=n.value),n.style.placeholder!==void 0&&(r.placeholder=n.style.placeholder),n.image&&(r.image={src:n.image.src,natural:[n.image.naturalWidth,n.image.naturalHeight]}),n.sourceRect&&(r.sourceRect=n.sourceRect),n.state&&(n.state.pressed||(o=n.state.classes)!=null&&o.length)&&(r.state={...n.state.pressed?{pressed:!0}:{},...(a=n.state.classes)!=null&&a.length?{classes:n.state.classes}:{}}),n.scroll&&(r.scroll={offset:ut(n.scroll.offset,t),content:ut(n.scroll.content,t)}),n.children.length>0&&(r.children=n.children.map(h=>ne(h,t,e))),r}function us(n){return n.tl===n.tr&&n.tr===n.br&&n.br===n.bl?n.tl:[n.tl,n.tr,n.br,n.bl]}function ds(n){const t={};if(n.backgroundColor!==void 0&&(t.backgroundColor=lt(n.backgroundColor)),n.opacity!==void 0&&(t.opacity=n.opacity),n.color!==void 0&&(t.color=lt(n.color)),n.fontSize!==void 0&&(t.fontSize=n.fontSize),n.fontFamily!==void 0&&(t.fontFamily=n.fontFamily),n.fontWeight!==void 0&&(t.fontWeight=n.fontWeight),n.fontStyle!==void 0&&n.fontStyle!=="normal"&&(t.fontStyle=n.fontStyle),n.lineHeight!==void 0&&(t.lineHeight=n.lineHeight),n.letterSpacing&&(t.letterSpacing=n.letterSpacing),n.textAlign!==void 0&&n.textAlign!=="start"&&(t.textAlign=n.textAlign),n.textDecoration!==void 0&&n.textDecoration!=="none"&&(t.textDecoration=n.textDecoration),n.lineClamp&&(t.lineClamp=n.lineClamp,n.textOverflow==="clip"&&(t.textOverflow=n.textOverflow)),n.objectFit!==void 0&&(t.objectFit=n.objectFit),n.tintColor!==void 0&&(t.tintColor=lt(n.tintColor)),n.overlayColor!==void 0&&(t.overlayColor=lt(n.overlayColor)),n.backgroundImage!==void 0&&(t.backgroundImage=n.backgroundImage),n.backgroundSize!==void 0&&(t.backgroundSize=n.backgroundSize),n.backgroundGradients!==void 0&&n.backgroundGradients.length>0&&(t.backgroundGradients=n.backgroundGradients.map(e=>{const s=e.stops.map(r=>({color:lt(r.color),position:r.position}));if(e.type==="radial"){const r={type:"radial",shape:e.shape,extent:e.extent,cx:e.cx,cy:e.cy,stops:s};return e.extent==="explicit"&&(r.rx=e.rx,r.ry=e.ry,r.rxUnit=e.rxUnit,r.ryUnit=e.ryUnit),r}return{angle:e.angle,stops:s}})),n.borderRadius&&(n.borderRadius.tl||n.borderRadius.tr||n.borderRadius.br||n.borderRadius.bl)&&(t.borderRadius=us(n.borderRadius)),n.border){const e={};for(const s of["top","right","bottom","left"]){const r=n.border[s];r&&r.width>0&&(e[s]={width:r.width,color:lt(r.color)})}Object.keys(e).length>0&&(t.border=e)}return Object.keys(t).length>0?t:void 0}const fs=.32,ps=4,Ae=new Map;function re(n){if(!n)return n;if(n.startsWith("canvas:"))return`lecodes-canvas://${n.slice(7)}`;if(n.startsWith("svg:")){let t=Ae.get(n);return t===void 0&&(t=nn(n.slice(4)),Ae.set(n,t)),t}return n}class gs{constructor(t,e){w(this,"parent",null);w(this,"children",[]);w(this,"style",{lineHeight:14*1.2});w(this,"name");w(this,"text","");w(this,"src");w(this,"value","");w(this,"sourceRect");w(this,"viewName");w(this,"viewParams");w(this,"playerId",0);w(this,"viewId",0);w(this,"flags",0);w(this,"layoutRect",null);w(this,"scrollOffset",0);w(this,"wrapCache");w(this,"jsNode");w(this,"bgRaw");w(this,"bgSrc");this.id=t,this.type=e,this.jsNode={type:e,_id:t}}get measured(){return this.type==="text"||this.type==="image"||this.editable}get editable(){return this.type==="input"||this.type==="textarea"}get scrollable(){return this.type==="scrollable"||this.type==="scrollableScreen"||this.type==="vlist"}get scrollAxis(){return this.style.scrollAxis==="x"?"x":"y"}get interactive(){return(this.flags&Ar)!==0}get imageSrcRaw(){return this.type==="image"?re(this.src):void 0}has(t){return(this.flags&t)!==0}}class ms{constructor(t,e,s={}){w(this,"nodes",new Map);w(this,"root",null);w(this,"leaving",null);w(this,"leavingAbove",!1);w(this,"pagerShown",new Map);w(this,"pagerLeaving",new Map);w(this,"destKind",-1);w(this,"layerRoots",[]);w(this,"width",0);w(this,"height",0);w(this,"focused",null);w(this,"pressed",new Set);w(this,"gestures",new Map);w(this,"vlists",new Set);w(this,"frameCache",null);w(this,"painted",null);w(this,"fontsPending",0);w(this,"lastToast",null);w(this,"dirty",!0);w(this,"onDestination",null);w(this,"onDropped",null);w(this,"layoutPtr",0);w(this,"padPtr",0);w(this,"lastCreated",0);w(this,"hoverX",0);w(this,"hoverY",0);w(this,"hoverInside",!1);w(this,"hoverMoved",!1);this.M=t,this.host=e,this.options=s}install(){const t=new DataView(new ArrayBuffer(8)),e=(s,r,i,o,a,h)=>{const l=this.measure(r,i,a);return t.setFloat32(4,l.width,!0),t.setFloat32(0,l.height,!0),t.getBigUint64(0,!0)};this.M._setMeasureFunc(this.M.addFunction(e,"jiififi"))}measure(t,e,s){const r=this.nodes.get(t);if(!r)return{width:0,height:0};const i=this.M;Kr(i,t)&&(Jr(i,t,r.style),this.resolveBackground(r));const o=r;return r.type==="text"?es(o,this.host,e):r.type==="image"?rs(o,this.host,e,s):r.editable?ns(o,this.host,e):{width:0,height:0}}resize(t,e){this.width=t,this.height=e,this.M._creatorWebResize(t,e),this.M._setConditionValue(t,e),this.dirty=!0}setSafeArea(t,e=[]){const[s,r,i,o]=t??(this.width>this.height?[0,8,0,20]:[20,0,8,0]),a={top:1,right:2,bottom:4,left:8};this.M._setSafeAreaBars(e.reduce((h,l)=>h|a[l],0)),this.M._setSafePaddings(s,r,i,o,0),this.dirty=!0}layoutFrame(){const t=this.M;Qr(t,(r,i)=>{const o=this.nodes.get(r);o&&(i(o.style),this.resolveBackground(o))})>0&&(this.dirty=!0);const s=t._creatorWebLayoutFrame(this.width,this.height);s>0&&this.readLayoutBatch(s);for(const r of this.vlists)if(t._vlistExists(r.id)){t._vlistUpdateLayout(r.id);for(const i of r.children)this.deliverSubtree(i)}}needsPaint(){return this.dirty||this.frameCache===null||this.frameCache!==this.painted}deliverSubtree(t){const e=this.M;if(this.layoutPtr||(this.layoutPtr=e._malloc(16)),e._getLayoutPointer(t.id,this.layoutPtr)){const s=this.layoutPtr>>2,r={x:e.HEAPF32[s],y:e.HEAPF32[s+1],width:e.HEAPF32[s+2],height:e.HEAPF32[s+3]},i=t.layoutRect,o=!i||i.x!==r.x||i.y!==r.y||i.width!==r.width||i.height!==r.height;t.layoutRect=r,o&&(this.dirty=!0),o&&t.has(_e)&&e._creatorWebNodeLayout(t.id,r.x,r.y,r.width,r.height)}for(const s of t.children)this.deliverSubtree(s)}readLayoutBatch(t){const e=this.M,s=e._collectNodes()>>>2,r=e._collectRects()>>>2,i=e.HEAPU32,o=e.HEAPF32;for(let a=0;a<t;a++){const h=i[s+a],l=this.nodes.get(h);if(!l)continue;const c=o[r+a*4],f=o[r+a*4+1],u=o[r+a*4+2],d=o[r+a*4+3],p={x:c,y:f,width:u-c,height:d-f},b=l.layoutRect,g=!b||b.x!==p.x||b.y!==p.y||b.width!==p.width||b.height!==p.height;l.layoutRect=p,g&&(this.dirty=!0),g&&l.has(_e)&&e._creatorWebNodeLayout(h,c,f,p.width,p.height)}}frame(){if(this.frameCache&&!this.dirty)return this.frameCache;const t=[],e={x:0,y:0,width:this.width,height:this.height},s=this.leaving?this.build(this.leaving,e):null;if(s&&!this.leavingAbove&&t.push({tree:s,leaving:!0}),this.root){const r=this.build(this.root,e);r&&t.push({tree:r})}s&&this.leavingAbove&&t.push({tree:s,leaving:!0});for(const r of this.layerRoots){const i=this.build(r,e);i&&t.push({tree:i,widget:!0})}return this.frameCache=t,this.dirty=!1,t}renderTree(){var t;return((t=this.frame().find(e=>!e.widget&&!e.leaving))==null?void 0:t.tree)??null}widgetTrees(){return this.frame().filter(t=>t.widget).map(t=>t.tree)}widgets(){return this.widgetTrees()}serialize(){return fn(this.renderTree(),this.widgetTrees())}toText(){return hs(this.renderTree(),this.widgetTrees())}paint(t,e){const s=this.frame();ss(s,t,this.host,this.width,this.height,void 0,e),this.painted=s}build(t,e){const s=this.M,r=(i,o,a,h)=>{var x;if(i.style.display==="none")return null;let l,c,f,u;if(h)l=e.x,c=e.y,f=e.width,u=e.height;else{const m=i.layoutRect;if(!m)return null;l=o+m.x,c=a+m.y,f=m.width,u=m.height}const d={id:i.id,type:i.type,rect:{x:l,y:c,width:f,height:u},style:i.style,children:[]};i.name&&(d.name=i.name);const p=i;if(i.type==="text"){const m=ee(p),v=ln(m);d.text=i.text;const _=this.padding(i.id);(_[0]||_[1]||_[2]||_[3])&&(d.padding=_);const M=f-_[0]-_[2],P=`${M}|${v.size}|${v.weight}|${v.italic?1:0}|${v.letterSpacing}|${v.family}|${i.style.lineClamp??0}|${i.style.textOverflow??""}|${i.text}`;if(((x=i.wrapCache)==null?void 0:x.key)===P)d.lines=i.wrapCache.lines;else{const I=D=>this.host.measureText(D,v),F=hn(vt(i.text,M,I).lines,i.style,M,I);i.wrapCache={key:P,lines:F},d.lines=F}d.style={...i.style,color:m.color,fontSize:m.fontSize,fontFamily:m.fontFamily,fontWeight:m.fontWeight,fontStyle:m.fontStyle,lineHeight:m.lineHeight,letterSpacing:m.letterSpacing,textAlign:m.textAlign,textDecoration:m.textDecoration}}else if(i.type==="image"){const m=this.host.resolveSrc(i.imageSrcRaw),v=m?this.host.getImage(m):void 0;d.image=v??(m?{src:m,naturalWidth:0,naturalHeight:0}:void 0),i.sourceRect&&(d.sourceRect=i.sourceRect)}else if(i.editable){d.value=i.value;const m=this.padding(i.id);(m[0]||m[1]||m[2]||m[3])&&(d.padding=m);const v=ee(p);d.style={...i.style,color:v.color,fontSize:v.fontSize,fontFamily:v.fontFamily,fontWeight:v.fontWeight,fontStyle:v.fontStyle,lineHeight:v.lineHeight,letterSpacing:v.letterSpacing,textAlign:v.textAlign,textDecoration:v.textDecoration}}i.type==="widget"&&i.style.overlayColor!==void 0&&(d.overlay=i.style.overlayColor),i.interactive&&(d.state={pressed:this.pressed.has(i.id)}),i.editable&&this.focused===i&&(d.state={...d.state,focused:!0}),i.style.overflow==="hidden"&&(d.clip=!0);let b=l,g=c;if(i.scrollable){const m=i.scrollAxis,v=m==="x"?s._getContentWidth(i.id):s._getContentHeight(i.id);d.clip=!0,d.scroll={offset:i.scrollOffset,content:v,axis:m},m==="x"?b=l-i.scrollOffset:g=c-i.scrollOffset}if(i.type==="pager"){const m=s._creatorWebPagerSelectedIndex(i.id),v=s._creatorWebPagerStackLen(i.id,m),_=v>0?s._creatorWebPagerPageNode(i.id,m,v-1):0,M=_?this.nodes.get(_):void 0;M?this.pagerShown.set(i.id,M):this.pagerShown.delete(i.id);const P=this.pagerLeaving.get(i.id);for(const I of P&&P.page!==M?P.above?[M,P.page]:[P.page,M]:[M]){const F=I?r(I,l,c,!1):null;F&&d.children.push(F)}return d}if(i.type==="vlist"){for(const m of i.children){const v=s._getParentNode(m.id);if(!v)continue;const _=s._vlistItemOffsetOf(i.id,v);if(Number.isNaN(_))continue;const M=r(m,l,c+_-i.scrollOffset,!1);M&&d.children.push(M)}return d}for(const m of i.children){const v=r(m,b,g,!1);v&&d.children.push(v)}return d};return r(t,0,0,!0)}paddingOf(t){return this.padding(t)}padding(t){const e=this.M;this.padPtr||(this.padPtr=e._malloc(16)),e._getPaddingPointer(t,this.padPtr);const s=this.padPtr>>2;return[e.HEAPF32[s],e.HEAPF32[s+1],e.HEAPF32[s+2],e.HEAPF32[s+3]]}withStr(t,e){const s=this.M.stringToNewUTF8(t);try{return e(s)}finally{this.M._free(s)}}get(t){return this.nodes.get(t)}findAll(t){const e=[],s=r=>{r.name===t&&e.push(r);for(const i of r.children)s(i)};for(const r of this.frame())s(r.tree);return e}findRect(t){const e=s=>{if(s.id===t)return s.rect;for(const r of s.children){const i=e(r);if(i)return i}return null};for(const s of this.frame()){const r=e(s.tree);if(r)return r}return null}toast(){return this.lastToast}pendingFonts(){return this.fontsPending}keyboardHeight(){return this.focused?this.options.keyboardHeight?this.options.keyboardHeight():Math.round(this.height*fs):0}focusedId(){var t;return((t=this.focused)==null?void 0:t.id)??0}nodeFactory(t,e,s,r){this.lastCreated=t;const i=new gs(t,e);this.nodes.set(t,i),e==="vlist"&&this.vlists.add(i);const o=this.nodes.get(s);o&&this.link(o,i,Math.max(0,r)),this.dirty=!0}link(t,e,s){e.parent&&(e.parent.children=e.parent.children.filter(r=>r!==e)),e.parent=t,t.children.splice(Math.min(s,t.children.length),0,e)}insertNode(t,e,s){const r=this.nodes.get(t),i=this.nodes.get(e);r&&i&&this.link(r,i,s),this.dirty=!0}removeNode(t,e){var i;const s=this.nodes.get(t),r=this.nodes.get(e);!s||!r||(this.forget(r),s.children=s.children.filter(o=>o!==r),r.parent===s&&(r.parent=null),((i=this.pagerLeaving.get(t))==null?void 0:i.page)===r&&this.pagerLeaving.delete(t),this.pagerShown.get(t)===r&&this.pagerShown.delete(t),this.dirty=!0)}releaseNode(t){const e=this.nodes.get(t);if(!e)return;this.nodes.delete(t),this.forget(e),e.parent&&(e.parent.children=e.parent.children.filter(r=>r!==e)),this.root===e&&(this.root=null),this.leaving===e&&(this.leaving=null),this.pagerShown.delete(t),this.pagerLeaving.delete(t);for(const[r,i]of this.pagerLeaving)i.page===e&&this.pagerLeaving.delete(r);this.focused===e&&(this.focused=null,this.M._creatorWebSetShrunkRoot(0,0),this.emitKeyboard());const s=this.layerRoots.indexOf(e);s>=0&&this.layerRoots.splice(s,1),this.vlists.delete(e),this.pressed.delete(t),this.dirty=!0}forget(t){for(const e of this.gestures.values())e.node===t&&(e.node=null),e.scroll===t&&(e.scroll=null),e.backdrop===t&&(e.backdrop=null),e.edit===t&&(e.edit=null);for(const e of t.children)this.forget(e)}setPropertyString(t,e,s){const r=this.nodes.get(t);if(!r)return;const i=s??"";switch(e){case"text":r.text=i,r.wrapCache=void 0;break;case"value":r.value=i;break;case"name":r.name=i||void 0;break;case"src":{r.src=i||void 0;const o=this.host.resolveSrc(this.srcOf(r));o&&!this.host.getImage(o)&&this.host.loadImage(o).then(()=>{this.nodes.get(t)===r&&this.M._nodeHasMeasure(t)&&this.M._markNodeDirty(t),this.dirty=!0}).catch(()=>{});break}case"sourceRect":{const o=i.split(" ").map(Number);r.sourceRect=o.length===4?[o[0],o[1],o[2],o[3]]:void 0;break}case"focus":i==="1"||i==="true"?this.focusInput(t):this.focused===r&&this.blurInput();break;case"viewName":r.viewName=i;break;case"viewParams":r.viewParams=i;break}this.dirty=!0}srcOf(t){return re(t.src)}resolveBackground(t){const e=t.style.backgroundImage||void 0;if(e!==t.bgRaw){t.bgRaw=e,t.bgSrc=e?this.host.resolveSrc(re(e)):void 0;const s=t.bgSrc;s&&!this.host.getImage(s)&&this.host.loadImage(s).then(()=>{this.dirty=!0}).catch(()=>{})}t.style.backgroundImage=t.bgSrc}setPropertyInt(t,e,s){const r=this.nodes.get(t);r&&(e==="playerId"?r.playerId=s:e==="viewId"&&(r.viewId=s)),this.dirty=!0}setFlags(t,e){const s=this.nodes.get(t);s&&(s.flags=e>>>0)}leave(t){this.root&&(this.leaving=this.root,this.leavingAbove=t,this.root=null)}openView(t,e,s,r,i,o){var h;this.destKind=t;const a=t===Te?this.nodes.get(e)??null:null;a!==this.root&&this.leave(!o||a===null),this.leaving===a&&(this.leaving=null),this.root=a,this.focused&&this.blurInput(),this.dirty=!0,(h=this.onDestination)==null||h.call(this,t,s)}dropView(t,e,s){var r;if(t===Te){const i=this.nodes.get(e)??null;i!==null&&this.leaving===i&&(this.leaving=null),i!==null&&this.root===i&&(this.root=null)}this.dirty=!0,(r=this.onDropped)==null||r.call(this,t,s)}closeView(){var t;this.destKind=-1,this.leave(!0),this.dirty=!0,(t=this.onDestination)==null||t.call(this,-1,0)}layerOpen(t){const e=this.nodes.get(t);e&&!this.layerRoots.includes(e)&&this.layerRoots.push(e),this.dirty=!0}layerClose(t){const e=this.nodes.get(t);for(const r of this.gestures.values())r.backdrop===e&&(r.backdrop=null);const s=e?this.layerRoots.indexOf(e):-1;s>=0&&this.layerRoots.splice(s,1),this.dirty=!0}registerFont(t,e,s,r,i,o){this.fontsPending++,this.host.loadFont(e,t,{weight:s,style:r===2?"italic":"normal"}).then(()=>{this.invalidateText(),i()},a=>o(String(a))).finally(()=>{this.fontsPending--})}invalidateText(){for(const t of this.nodes.values())t.wrapCache=void 0,t.measured&&t.type!=="image"&&this.M._nodeHasMeasure(t.id)&&this.M._markNodeDirty(t.id);this.dirty=!0}showToast(t,e){var s,r;this.lastToast=t,(r=(s=this.options).onToast)==null||r.call(s,t,e)}getButtonPressed(t){return this.pressed.has(t)}getTextValue(t){var e;return((e=this.nodes.get(t))==null?void 0:e.value)??""}getBoundingRect(t){const e=this.findRect(t);return e?[e.x,e.y,e.width,e.height]:null}longPressHandler(t,e){const s=this.gestures.get(t);s&&(s.swallowClick=!0)}vlistScroll(t,e,s){const r=this.nodes.get(t);r&&(r.scrollOffset=e),this.dirty=!0}pagerCommand(t,e,s){this.pagerLeaving.delete(t),this.dirty=!0}pagerShowPage(t,e,s){const r=this.nodes.get(e),i=this.pagerShown.get(t);r&&this.pagerShown.set(t,r),i&&i!==r&&this.pagerLeaving.set(t,{page:i,above:!s}),this.dirty=!0}pagerDropPage(t,e){var s;((s=this.pagerLeaving.get(t))==null?void 0:s.page.id)===e&&this.pagerLeaving.delete(t),this.dirty=!0}refreshDone(t){}rootOf(t){let e=t;for(;e.parent&&e.type!=="widget";)e=e.parent;return e}emitKeyboard(){var e,s;const t=this.keyboardHeight();(s=(e=this.options).onKeyboard)==null||s.call(e,t),this.M._creatorWebKeyboardEvent(t,0)}focusInput(t){const e=this.nodes.get(t);!e||!e.editable||this.focused===e||(this.focused&&this.blurInput(),this.focused=e,this.M._setNodeFocused(t,1),e.has(Fr)&&this.M._creatorWebNodeEvent(t,_r),this.M._creatorWebSetShrunkRoot(this.rootOf(e).id,this.keyboardHeight()),this.emitKeyboard(),this.dirty=!0)}blurInput(){const t=this.focused;t&&(this.focused=null,this.M._setNodeFocused(t.id,0),t.has(Nr)&&this.M._creatorWebNodeEvent(t.id,Tr),this.M._creatorWebSetShrunkRoot(0,0),this.emitKeyboard(),this.dirty=!0)}setInputValue(t,e){const s=this.nodes.get(t);s&&(s.value=e,s.has(Ir)&&this.withStr(e,r=>this.M._creatorWebNodeEventStr(t,Er,r)),this.M._nodeHasMeasure(t)&&this.M._markNodeDirty(t),this.dirty=!0)}submitInput(){const t=this.focused;return t?(t.has(Ur)&&this.withStr(t.value,e=>this.M._creatorWebNodeEventStr(t.id,kr,e)),this.focused===t&&this.blurInput(),!0):!1}scrollMax(t){const e=this.findRect(t.id)??t.layoutRect??{width:0,height:0},s=t.scrollAxis==="x"?e.width:e.height,r=t.scrollAxis==="x"?this.M._getContentWidth(t.id):this.M._getContentHeight(t.id);return Math.max(0,r-s)}scrollBy(t,e){const s=this.nodes.get(t);if(!s||!s.scrollable)return!1;const r=this.scrollMax(s),i=s.scrollOffset+e,o=Math.min(r,Math.max(0,i)),a=i<0?i:i>r?i-r:0;return a!==0&&s.has(Cr)&&this.M._creatorWebNodeEventNum(t,xr,a),o===s.scrollOffset?!1:(s.scrollOffset=o,s.type==="vlist"&&this.M._vlistExists(t)&&this.M._vlistOnScroll(t,o),s.has(Pr)&&this.M._creatorWebNodeScroll(t,o),this.dirty=!0,!0)}topInteractive(t,e){const s=this.frame();for(let r=s.length-1;r>=0;r--){const i=ft(s[r].tree,t,e,o=>{var a;return((a=this.nodes.get(o.id))==null?void 0:a.interactive)??!1});if(i.node)return this.nodes.get(i.node.id)??null;if(i.blocker)return null}return null}setPressed(t,e){e?this.pressed.add(t.id):this.pressed.delete(t.id),this.nodes.get(t.id)===t&&this.M._setNodePressed(t.id,e?1:0),this.dirty=!0}pointerHover(t,e){this.hoverX=t,this.hoverY=e,this.hoverInside=!0,this.hoverMoved=!0}pointerLeave(){this.hoverInside&&(this.hoverInside=!1,this.hoverMoved=!0)}get hasHover(){return typeof this.M._creatorWebHover=="function"}tickHover(){if(!this.hasHover||!this.hoverMoved&&!this.dirty)return;this.hoverMoved=!1;const t=this.hoverInside?this.topInteractive(this.hoverX,this.hoverY):null;this.M._creatorWebHover((t==null?void 0:t.id)??0,this.hoverX,this.hoverY)}pointerDown(t,e,s){const r=this.M;r._creatorWeb2dSceneOpen()&&r._creatorWeb2dEmitPointer(0,t,e,s);const i={node:null,scroll:null,backdrop:null,edit:null,global:!1,dismiss:!0,lastX:e,lastY:s,acc:0,scrolling:!1,swallowClick:!1};this.gestures.set(t,i);const o=this.frame();for(let a=o.length-1;a>=0;a--){const h=ft(o[a].tree,e,s,l=>{var c;return((c=this.nodes.get(l.id))==null?void 0:c.editable)??!1});if(h.node){const l=this.nodes.get(h.node.id);this.focusInput(l.id),i.edit=l,i.dismiss=!1;return}if(h.blocker)break}for(let a=o.length-1;a>=0;a--){const h=o[a],l=ft(h.tree,e,s,u=>{var d;return((d=this.nodes.get(u.id))==null?void 0:d.interactive)??!1}),c=ft(h.tree,e,s,u=>!!u.scroll&&u.scroll.content>(u.scroll.axis==="x"?u.rect.width:u.rect.height)+.5),f=c.node?this.nodes.get(c.node.id)??null:null;if(l.node){const u=this.nodes.get(l.node.id);i.node=u,i.scroll=f,i.dismiss=u.type!=="button",this.setPressed(u,!0),r._creatorWebNodeTouchStart(u.id,t,e,s);return}if(f){i.scroll=f;return}if(l.blocker){i.backdrop=l.outside?this.nodes.get(l.blocker.id)??null:null;return}}i.global=!0,r._creatorWebSceneTouchStart(t,e,s)}pointerMove(t,e,s){const r=this.gestures.get(t);if(!r)return;const i=this.M;i._creatorWeb2dSceneOpen()&&i._creatorWeb2dEmitPointer(1,t,e,s);const o=e-r.lastX,a=s-r.lastY;if(r.lastX=e,r.lastY=s,r.acc+=Math.abs(o)+Math.abs(a),!r.edit){if(!r.scrolling&&r.scroll&&r.acc>ps&&(r.scrolling=!0,r.node&&this.setPressed(r.node,!1)),r.scrolling&&r.scroll){this.scrollBy(r.scroll.id,r.scroll.scrollAxis==="x"?-o:-a);return}i._creatorWebTouchMove(t,e,s,o,a)}}pointerUp(t,e,s){const r=this.gestures.get(t);if(!r)return;this.gestures.delete(t);const i=this.M;i._creatorWeb2dSceneOpen()&&i._creatorWeb2dEmitPointer(2,t,e,s);const o=e-r.lastX,a=s-r.lastY;i._creatorWebTouchEnd(t,e,s,o,a),!r.edit&&(r.scrolling&&r.scroll&&r.scroll.has(Or)&&i._creatorWebNodeEvent(r.scroll.id,Sr),r.dismiss&&!r.scrolling&&this.focused&&this.blurInput(),r.node?(this.setPressed(r.node,!1),!r.scrolling&&!r.swallowClick&&this.topInteractive(e,s)===r.node&&r.node.has(Mr)&&i._creatorWebNodeClick(r.node.id,t,e,s)):r.backdrop?!r.scrolling&&r.backdrop.has(Wr)&&i._creatorWebNodeEvent(r.backdrop.id,Rr):r.global&&(r.scrolling||i._creatorWebSceneTouchClick(t,e,s)))}pointerCancel(t){const e=this.gestures.get(t);if(!e)return;this.gestures.delete(t);const s=this.M;s._creatorWeb2dSceneOpen()&&s._creatorWeb2dEmitPointer(3,t,e.lastX,e.lastY),e.node&&this.setPressed(e.node,!1),s._creatorWebTouchCancel(t)}wheel(t,e,s,r){const i=this.frame();for(let o=i.length-1;o>=0;o--){const a=ft(i[o].tree,t,e,h=>!!h.scroll&&h.scroll.content>(h.scroll.axis==="x"?h.rect.width:h.rect.height)+.5);if(a.node){const h=this.nodes.get(a.node.id);return h?this.scrollBy(h.id,h.scrollAxis==="x"?s:r):!1}if(a.blocker)return!1}return!1}longPress(t,e,s){const r=this.gestures.get(t);r!=null&&r.node&&r.node.has(Lr)&&this.M._creatorWebNodeLongPress(r.node.id,t,e,s)}isVlist(t){return this.vlists.has(t)}}const ys=`
|
|
11
11
|
.lc-field { position: absolute; left: 0; top: 0; margin: 0; border: none; outline: none; background: none; resize: none; box-sizing: border-box; transform-origin: 0 0; pointer-events: auto; overflow: hidden; -webkit-appearance: none; appearance: none; }
|
|
12
12
|
.lc-field::placeholder { color: var(--lc-placeholder, #999); opacity: 1; }
|
|
13
|
-
`,Me=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),ws=n=>n.type==="native"||n.type==="video",bs=[1,0,0,1,0,0],Ht=(n,t)=>[n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]],vs=(n,t)=>{if(!n)return t;const e=Math.max(n.x,t.x),s=Math.max(n.y,t.y);return{x:e,y:s,width:Math.max(0,Math.min(n.x+n.width,t.x+t.width)-e),height:Math.max(0,Math.min(n.y+n.height,t.y+t.height)-s)}};class Mt extends ms{constructor(e,s,r,i,o={}){super(e,s,o);w(this,"doc");w(this,"factories",new Map);w(this,"versions",new Map);w(this,"views",new Map);w(this,"wrappers",new Map);w(this,"shown",new Map);w(this,"destination",null);w(this,"field",null);w(this,"placedFor",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=ys,i.appendChild(a)}paintOptions(){var e;return{surfaces:!0,editing:(e=this.field)==null?void 0:e.id}}registerView(e,s,r=1){this.factories.set(e,s),this.versions.set(e,r)}unregisterView(e){this.factories.delete(e),this.versions.delete(e)}isViewSupported(e){return this.factories.has(e)}viewVersion(e){return this.versions.get(e)??0}ensureView(e,s,r){const i=this.views.get(e);if(i&&(i.name!==s||i.params!==r))this.destroyView(e);else if(i)return i.handle;const o=this.factories.get(s);if(!o)return null;let a={};try{a=r?JSON.parse(r):{}}catch{}const h=o(a,{emit:(l,c)=>this.M.jsb.viewEvent(e,l,c)},this.doc);return h.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:h}),h}destroyView(e){var r,i;const s=this.views.get(e);s&&(this.views.delete(e),(i=(r=s.handle).destroy)==null||i.call(r),s.handle.el.remove())}viewCall(e,s,r,i,o){const a=this.views.get(e);if(!(a!=null&&a.handle.call)){o(`NativeView call "${s}": no live instance or no call handler (viewId ${e})`);return}try{Promise.resolve(a.handle.call(s,Array.isArray(r)?r:[])).then(h=>{h===void 0?i():i(h)},h=>o(h instanceof Error?h.message:String(h)))}catch(h){o(h instanceof Error?h.message:String(h))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==Wt)return;this.dropDestination();const h=this.ensureView(r,i,o);if(!h)return;const l=this.doc.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:auto;",l.appendChild(h.el),this.under.prepend(l),this.destination={viewId:r,el:l}}dropView(e,s,r){var i;super.dropView(e,s,r),e===Wt&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==Wt&&this.dropDestination()}dropDestination(){var e;(e=this.destination)==null||e.el.remove(),this.destination=null}releaseNode(e){var r,i;const s=this.get(e);((r=this.field)==null?void 0:r.id)===e&&this.unmountField(),super.releaseNode(e),(i=this.shown.get(e))==null||i.remove(),this.shown.delete(e),this.wrappers.delete(e),(s==null?void 0:s.type)==="native"&&s.viewId&&this.destroyView(s.viewId)}focusInput(e){var i;if(super.focusInput(e),this.focusedId()!==e||((i=this.field)==null?void 0:i.id)===e)return;this.unmountField();const s=this.get(e);if(!s)return;const r=this.doc.createElement(s.type==="textarea"?"textarea":"input");r.className="lc-field",r.setAttribute("autocomplete","off"),r.value=s.value,r.addEventListener("input",()=>{this.focusedId()===e&&this.setInputValue(e,r.value)}),r.addEventListener("keydown",o=>{o.key==="Enter"&&r.tagName==="INPUT"&&(o.preventDefault(),this.submitInput())}),r.addEventListener("blur",()=>{var o;((o=this.field)==null?void 0:o.el)===r&&this.focusedId()===e&&this.blurInput()}),this.over.appendChild(r),this.field={id:e,el:r},this.placedFor=null,this.place(),r.focus({preventScroll:!0})}blurInput(){super.blurInput(),this.unmountField()}unmountField(){const e=this.field;e&&(this.field=null,e.el.remove(),this.placedFor=null)}setPropertyString(e,s,r){var i,o;if(super.setPropertyString(e,s,r),s==="value"&&((i=this.field)==null?void 0:i.id)===e){const a=((o=this.get(e))==null?void 0:o.value)??"";this.field.el.value!==a&&(this.field.el.value=a)}}find(){var i;const e=[],s=(i=this.field)==null?void 0:i.id,r=(o,a,h)=>{let l=a;const c=o.style.transform;if(c){const u=o.style.transformOrigin,d=o.rect.x+(u?u.xPercent?o.rect.width*u.x/100:u.x:o.rect.width/2),p=o.rect.y+(u?u.yPercent?o.rect.height*u.y/100:u.y:o.rect.height/2);l=Ht(Ht(Ht(a,[1,0,0,1,d,p]),c),[1,0,0,1,-d,-p])}(ws(o)||o.id===s)&&e.push({node:o,matrix:l,clip:h});const f=o.clip?vs(h,o.rect):h;for(const u of o.children)r(u,l,f)};for(const o of this.frame())r(o.tree,bs,null);return e}static put(e,s){const{rect:r}=s.node,i=e.style;i.position="absolute",i.left="0",i.top="0",i.width=r.width+"px",i.height=r.height+"px",i.transformOrigin="0 0",i.transform=`matrix(${s.matrix.join(",")}) translate(${r.x}px,${r.y}px)`;const o=s.clip;i.clipPath=o?`inset(${Math.max(0,o.y-r.y)}px ${Math.max(0,r.x+r.width-(o.x+o.width))}px ${Math.max(0,r.y+r.height-(o.y+o.height))}px ${Math.max(0,o.x-r.x)}px)`:""}surfaceElement(e){const s=this.get(e.id);if(!s)return null;if(s.type==="video"){const o=ce(s.playerId);return o instanceof HTMLVideoElement?o:null}if(!s.viewId)return null;const r=this.ensureView(s.viewId,s.viewName??"",s.viewParams??"");if(!r)return null;let i=this.wrappers.get(s.id);return i||(i=this.doc.createElement("div"),this.wrappers.set(s.id,i)),r.el.parentElement!==i&&i.replaceChildren(r.el),i}styleField(e,s){var f,u;const r=s.style,i=e.style,[o,a,h,l]=s.padding??[0,0,0,0];i.padding=`${a}px ${h}px ${l}px ${o}px`,i.color=Me(r.color,"#000000ff"),i.caretColor=i.color;const c=r.fontFamily??"Roboto";if(i.fontFamily=((u=(f=this.host).resolveFontFamily)==null?void 0:u.call(f,c))??c,i.fontSize=(r.fontSize??14)+"px",i.fontWeight=String(r.fontWeight??400),i.fontStyle=r.fontStyle??"normal",i.letterSpacing=(r.letterSpacing??0)+"px",i.lineHeight=e.tagName==="TEXTAREA"&&r.lineHeight!==void 0?r.lineHeight+"px":"normal",i.textAlign=r.textAlign==="center"?"center":r.textAlign==="end"?"right":"left",i.borderRadius="0",e.placeholder=r.placeholder??"",i.setProperty("--lc-placeholder",Me(r.placeholderColor,"#999999ff")),e instanceof HTMLInputElement){const d=r.inputType??"text";e.type!==d&&(e.type=d)}}place(){var r;const e=this.frame();if(e===this.placedFor)return;this.placedFor=e;const s=new Set;for(const i of this.find()){const{node:o}=i;if(o.id===((r=this.field)==null?void 0:r.id)){this.styleField(this.field.el,o),Mt.put(this.field.el,i);continue}const a=this.surfaceElement(o);a&&(s.add(o.id),a.parentElement!==this.under&&this.under.appendChild(a),a.style.display="block",a.style.opacity="",a.style.pointerEvents="auto",a instanceof HTMLVideoElement&&(a.style.objectFit=o.style.objectFit??"contain"),Mt.put(a,i),this.shown.set(o.id,a))}for(const[i,o]of this.shown)s.has(i)||(o.style.display="none",this.shown.delete(i))}surfaceAt(e,s){const r=this.frame();for(let i=r.length-1;i>=0;i--){const o=r[i];if(o.leaving)continue;const a=ft(o.tree,e,s,h=>{var l,c;return h.type==="native"||(((l=this.get(h.id))==null?void 0:l.interactive)??!1)||(((c=this.get(h.id))==null?void 0:c.editable)??!1)||!!h.scroll});if(a.node)return a.node.type==="native";if(a.blocker)return!1}return this.destination!==null}dispose(){this.unmountField();for(const e of[...this.views.keys()])this.destroyView(e);this.dropDestination();for(const e of this.shown.values())e instanceof HTMLVideoElement||e.remove();this.shown.clear()}}function xs(n,t,e,s){const r=n.createElement("div");r.textContent=e,r.style.cssText="position:absolute;left:50%;bottom:48px;transform:translateX(-50%);max-width:80%;padding:10px 16px;border-radius:8px;background:rgba(30,30,30,0.92);color:#fff;font:13px/1.4 system-ui,sans-serif;z-index:30;pointer-events:none;",t.appendChild(r),setTimeout(()=>r.remove(),s>0?s:2e3)}const Ss=500,Le=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],Es=(n,t)=>{const e=n.ownerDocument,{canvas:s}=t;s.style.display="block",s.style.pointerEvents="none",n.style.touchAction="none";const r=s.getContext("2d"),i=()=>{const y=e.createElement("div");return y.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",y},o=i(),a=i();n.insertBefore(o,s),s.after(a);const h=new ar({resolveAssetUrl:y=>Yn(y),canvasSurfaces:t.canvasHost}),l=new Mt(t.M,h,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onToast:(y,L)=>xs(e,n,y,L)});let c=1,f=new Ee(r,c),u=!0;const d=()=>{(u||l.needsPaint())&&(u=!1,l.paint(f,l.paintOptions())),l.place()},p=(y,L,A)=>{y<=0||L<=0||(A!==c&&(c=A,f=new Ee(r,c)),u=!0,l.resize(y,L))},b=y=>{l.setSafeArea([y.top,y.right,y.bottom,y.left],y.bars??[])},g=y=>{const L=n.getBoundingClientRect(),A=ae(n);return[(y.clientX-L.left)/A,(y.clientY-L.top)/A]},x=y=>y.target instanceof Node&&a.contains(y.target),m=y=>y.target instanceof Node&&o.contains(y.target),v=y=>{m(y)&&y.stopPropagation()},_=new Set,M=new Map,P=y=>{const L=M.get(y);L!==void 0&&(clearTimeout(L),M.delete(y))},I=y=>{if(x(y))return;const[L,A]=g(y);if(!l.surfaceAt(L,A)){v(y),_.add(y.pointerId);try{n.setPointerCapture(y.pointerId)}catch{}l.pointerDown(y.pointerId,L,A),P(y.pointerId),M.set(y.pointerId,window.setTimeout(()=>{M.delete(y.pointerId),l.longPress(y.pointerId,L,A)},Ss))}},F=y=>{const[L,A]=g(y);_.has(y.pointerId)&&(v(y),l.pointerMove(y.pointerId,L,A)),y.pointerType==="mouse"&&(x(y)||!_.has(y.pointerId)&&l.surfaceAt(L,A)?l.pointerLeave():l.pointerHover(L,A))},D=y=>{y.pointerType==="mouse"&&l.pointerLeave()},R=y=>{if(!_.delete(y.pointerId))return;v(y),P(y.pointerId);const[L,A]=g(y);l.pointerUp(y.pointerId,L,A)},z=y=>{_.delete(y.pointerId)&&(P(y.pointerId),l.pointerCancel(y.pointerId))},G=y=>{if(x(y))return;const[L,A]=g(y);if(l.surfaceAt(L,A))return;v(y);const H=y.deltaMode===1?16:y.deltaMode===2?l.height:1;l.wheel(L,A,y.deltaX*H,y.deltaY*H)&&y.preventDefault()},V=y=>{var Y;if(x(y))return;const L="clientX"in y?y:(Y=y.changedTouches)==null?void 0:Y[0];if(!L)return;const[A,H]=g(L);l.surfaceAt(A,H)||(v(y),y.type==="mousedown"&&y.preventDefault())};n.addEventListener("pointerdown",I,!0),n.addEventListener("pointermove",F,!0),n.addEventListener("pointerleave",D),n.addEventListener("pointerup",R,!0),n.addEventListener("pointercancel",z,!0),n.addEventListener("wheel",G,{passive:!1,capture:!0});for(const y of Le)n.addEventListener(y,V,!0);return{ui:l,render:d,resize:p,setSafeArea:b,destroy(){for(const y of M.keys())P(y);n.removeEventListener("pointerdown",I,!0),n.removeEventListener("pointermove",F,!0),n.removeEventListener("pointerleave",D),n.removeEventListener("pointerup",R,!0),n.removeEventListener("pointercancel",z,!0),n.removeEventListener("wheel",G,!0);for(const y of Le)n.removeEventListener(y,V,!0);l.dispose(),o.remove(),a.remove()}}},_s=["miter","round","bevel"],Ts=["butt","round","square"],ks=["left","center","right","start","end"],Rs=["alphabetic","top","middle","bottom","hanging","ideographic"],Pe=["nonzero","evenodd"],As=["pad","reflect","repeat"],Bt={COLOR:0,RADIAL:2},bt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},X={SET_TRANSFORM:0,SAVE:1,RESTORE:2,CLIP:3,FILL_PATH:4,STROKE_PATH:5,FILL_TEXT:6,STROKE_TEXT:7,DRAW_IMAGE:8,CLEAR_RECT:9};class Ms{constructor(t,e){w(this,"pos",0);this.w=t,this.strings=e}f(){if(this.pos>=this.w.length)throw new Error("draw list: truncated");return this.w[this.pos++]}i(){return this.f()|0}str(){const t=this.i();if(t<0||t>=this.strings.length)throw new Error(`draw list: bad string index ${t}`);return this.strings[t]}color(){return[this.f(),this.f(),this.f(),this.f()]}matrix(){return[this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]}paint(){const t=this.i(),e=this.f();if(t===Bt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===Bt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=As[this.i()]??"pad",h=this.i(),l=[];for(let c=0;c<h;c++)l.push({offset:this.f(),color:this.color()});return t===Bt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:l}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:l}}stroke(){const t=this.f(),e=_s[this.i()]??"miter",s=Ts[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let h=0;h<o;h++)a.push(this.f());return{width:t,join:e,cap:s,miterLimit:r,dashOffset:i,dash:a}}font(){return{family:this.str(),size:this.f(),weight:this.i(),italic:this.i()!==0}}path(){const t=this.i(),e=this.pos+t;if(e>this.w.length)throw new Error("draw list: truncated path");const s=[];for(;this.pos<e;)switch(this.i()){case bt.MOVE:s.push(["M",this.f(),this.f()]);break;case bt.LINE:s.push(["L",this.f(),this.f()]);break;case bt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case bt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case bt.CLOSE:s.push(["Z"]);break;default:throw new Error("draw list: bad path verb")}return s}rect4(){return[this.f(),this.f(),this.f(),this.f()]}}const Ls=(n,t)=>{const e=new Ms(n,t),s=[];for(;e.pos+2<=n.length;){const r=e.i(),i=e.i(),o=e.pos+i;if(i<0||o>n.length)throw new Error("draw list: truncated command");switch(r){case X.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case X.SAVE:s.push({cmd:"save"});break;case X.RESTORE:s.push({cmd:"restore"});break;case X.CLIP:{const a=Pe[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case X.FILL_PATH:{const a=Pe[e.i()]??"nonzero",h=e.paint();s.push({cmd:"fillPath",rule:a,paint:h,path:e.path()});break}case X.STROKE_PATH:{const a=e.stroke(),h=e.paint();s.push({cmd:"strokePath",stroke:a,paint:h,path:e.path()});break}case X.FILL_TEXT:case X.STROKE_TEXT:{const a=e.str(),h=e.f(),l=e.f(),c=e.f(),f=e.font(),u=ks[e.i()]??"start",d=Rs[e.i()]??"alphabetic",p=e.f();if(r===X.STROKE_TEXT){const b=e.stroke();s.push({cmd:"strokeText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,stroke:b,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,paint:e.paint()});break}case X.DRAW_IMAGE:{const a=e.i(),h=e.rect4(),l=e.rect4();s.push({cmd:"drawImage",surface:a,src:h,dst:l,alpha:e.f()});break}case X.CLEAR_RECT:s.push({cmd:"clearRect",rect:e.rect4()});break}if(e.pos!==o){if(e.pos>o)throw new Error(`draw list: command ${r} overran its length`);e.pos=o}}return s},Ps=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),pn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,gn=(n,t=n.family)=>{const e=Ps.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Tt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Cs=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,$t=(n,t)=>{n.beginPath();for(const e of t)switch(e[0]){case"M":n.moveTo(e[1],e[2]);break;case"L":n.lineTo(e[1],e[2]);break;case"Q":n.quadraticCurveTo(e[1],e[2],e[3],e[4]);break;case"C":n.bezierCurveTo(e[1],e[2],e[3],e[4],e[5],e[6]);break;case"Z":n.closePath();break}},Ce=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,pn(e.color))},kt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=pn(t.color),s();return}const r=t.matrix;if(Cs(r)){let o;if(t.kind==="linear"){const[a,h]=Tt(r,0,0),[l,c]=Tt(r,1,0);o=n.createLinearGradient(a,h,l,c)}else{const a=Math.hypot(r[0],r[1]),[h,l]=Tt(r,0,0),[c,f]=Tt(r,t.fx,t.fy);o=n.createRadialGradient(c,f,t.r0*a,h,l,a)}Ce(o,t),n[e==="fill"?"fillStyle":"strokeStyle"]=o,s();return}n.save(),n.transform(r[0],r[1],r[2],r[3],r[4],r[5]);const i=t.kind==="linear"?n.createLinearGradient(0,0,1,0):n.createRadialGradient(t.fx,t.fy,t.r0,0,0,1);Ce(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Oe=(n,t)=>{n.lineWidth=t.width,n.lineJoin=t.join,n.lineCap=t.cap,n.miterLimit=t.miterLimit,n.setLineDash(t.dash),n.lineDashOffset=t.dashOffset},Ie=(n,t,e)=>{n.font=gn(t.font,e.fontFamily?e.fontFamily(t.font.family):t.font.family),n.textAlign=t.align,n.textBaseline=t.baseline,"letterSpacing"in n&&(n.letterSpacing=`${t.letterSpacing}px`)},Os=(n,t,e={})=>{var r;n.save();let s=0;try{n.setTransform(1,0,0,1,0,0),n.globalAlpha=1;for(const i of t)switch(i.cmd){case"setTransform":n.setTransform(i.matrix[0],i.matrix[1],i.matrix[2],i.matrix[3],i.matrix[4],i.matrix[5]);break;case"save":n.save(),s++;break;case"restore":s>0&&(n.restore(),s--);break;case"clip":$t(n,i.path),n.clip(i.rule);break;case"fillPath":$t(n,i.path),kt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":$t(n,i.path),Oe(n,i.stroke),kt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":Ie(n,i,e),kt(n,i.paint,"fill",()=>i.maxWidth>0?n.fillText(i.text,i.x,i.y,i.maxWidth):n.fillText(i.text,i.x,i.y));break;case"strokeText":Ie(n,i,e),Oe(n,i.stroke),kt(n,i.paint,"stroke",()=>i.maxWidth>0?n.strokeText(i.text,i.x,i.y,i.maxWidth):n.strokeText(i.text,i.x,i.y));break;case"drawImage":{const o=(r=e.image)==null?void 0:r.call(e,i.surface);if(!o)break;n.globalAlpha=i.alpha,n.drawImage(o,i.src[0],i.src[1],i.src[2],i.src[3],i.dst[0],i.dst[1],i.dst[2],i.dst[3]);break}case"clearRect":n.clearRect(i.rect[0],i.rect[1],i.rect[2],i.rect[3]);break;default:{const o=i;throw new Error(`unhandled draw command ${o.cmd}`)}}}finally{for(;s>0;s--)n.restore();n.restore()}},Is=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(l,c,f)=>{if(!t)return null;let u=e.get(l);return u?(u.width!==c||u.height!==f)&&(u.width=c,u.height=f):(u=new OffscreenCanvas(c,f),e.set(l,u)),u},i={paint:(l,c,f,u,d,p)=>{const b=r(l,Math.max(1,c),Math.max(1,f)),g=b==null?void 0:b.getContext("2d");!b||!g||(g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,b.width,b.height),Os(g,Ls(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(l,c,f,u,d,p)=>{if(p[0]=0,p[1]=0,p[2]=0,!t||(s||(s=new OffscreenCanvas(1,1).getContext("2d")),!s))return;s.font=gn({family:c,size:f,weight:u,italic:d},c);const b=s.measureText(l);p[0]=b.width,p[1]=b.fontBoundingBoxAscent??b.actualBoundingBoxAscent,p[2]=b.fontBoundingBoxDescent??b.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(l,c)=>{const f=o(l);return f?(c[0]=f.width,c[1]=f.height,new Uint8Array(f.data.buffer,f.data.byteOffset,f.data.byteLength)):null},releaseSurface:l=>{e.delete(l)}},o=l=>{const c=e.get(l),f=c==null?void 0:c.getContext("2d");return!c||!f?null:{data:f.getImageData(0,0,c.width,c.height).data,width:c.width,height:c.height}};return{table:i,readSurface:o,getSurface:l=>{const c=e.get(l);return c?{canvas:c,width:c.width,height:c.height}:null},surfaceToDataUrl:l=>{var u;const c=e.get(l);if(!c||typeof document>"u")return null;const f=document.createElement("canvas");return f.width=c.width,f.height=c.height,(u=f.getContext("2d"))==null||u.drawImage(c,0,0),f.toDataURL()}}},Fs=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,Ns=(n,t="woff2")=>{const e=/^\/\/ fonts: (.+)$/m.exec(n);if(!e)return[];const s=[];for(const r of e[1].split(";")){const i=r.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(r.slice(0,i));o&&s.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:r.slice(i+1).replace("{fmt}",t)})}return s},Us=async(n,t,e=2e3)=>{const s=t??(typeof document>"u"?void 0:document);if(!(s!=null&&s.fonts)||n.length===0)return;const r=[];for(const i of n)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});s.fonts.add(o),r.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(r),new Promise(i=>setTimeout(i,e))])},mn="Roboto",Ws=[`400 14px ${mn}`],Fe="data-lecodes-fonts",Ds=async(n=Ws,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${Fe}]`)){const s=new URL(Fs,document.baseURI).href,r=e.createElement("style");r.setAttribute(Fe,""),r.textContent=`@font-face{font-family:"${mn}";src:url("${s}") format("woff2");font-weight:100 900;font-display:swap}`,e.head.appendChild(r)}try{await Promise.all(n.map(s=>e.fonts.load(s)))}catch{}}},Ne="2.0.9",Gt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},Hs=(n,t)=>Gt(n)!==null&&Gt(n)===Gt(t),Bs=[171,75,84,88,32,50,48,187,13,10,26,10],$s=n=>n.length>=12&&Bs.every((t,e)=>n[e]===t),Gs=(n,t)=>{const e={antialias:!1,depth:!0,alpha:!1,stencil:!1,desynchronized:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"high-performance",premultipliedAlpha:!0,preserveDrawingBuffer:t},s=n.newCanvas(),r=s.getContext("webgl2",e);if(!r)throw new Error("WebGL2 is not available");let i=null,o=!1;const a=[],h=()=>{const c=r.createTexture();return r.bindTexture(r.TEXTURE_2D,c),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),c},l=(c,f,u,d)=>{const p=c.GL.getNewId(c.GL.textures);return c.GL.textures[p]=f,c._importTexture(p,u,d)>>>0};return{canvas:s,context:r,options:e,table(c){return i=c,{engineCreated(){c._createSwapChainHeadless(s.width,s.height),c._creatorWebSetViewport(s.width,s.height),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,u,d,p){const b=et(f);if(!b){p(`createTexture: no buffer behind id ${f}`);return}const g=new Uint8Array(b);if($s(g)){const x=c._malloc(g.length);c.HEAPU8.set(g,x);const m=c._createTextureFromKtx2(x,g.length)>>>0;if(c._free(x),m===4294967295){p("KTX2 transcode failed");return}d(m,c._getTextureWidth(m),c._getTextureHeight(m));return}createImageBitmap(Ot(f)).then(x=>{const m=h();r.texStorage2D(r.TEXTURE_2D,1,u&1?r.RGBA8:r.SRGB8_ALPHA8,x.width,x.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,r.RGBA,r.UNSIGNED_BYTE,x),d(l(c,m,x.width,x.height),x.width,x.height)},x=>p(x instanceof Error?x.message:String(x)))},createMediaPlayerTexture(f){const u=ce(f);if(!u)return 0;const d=h();return a.push({player:u,texture:d,lastTime:0}),l(c,d,0,0)}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&i._creatorWebSetViewport(s.width,s.height)},frame(){for(const c of a)c.player.readyState<2||c.player.currentTime===c.lastTime||(c.lastTime=c.player.currentTime,r.bindTexture(r.TEXTURE_2D,c.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,c.player))},destroy(){var c;a.length=0,(c=r.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},Vs=n=>{const t={alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,desynchronized:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e=n.newCanvas(),s=e.getContext("webgl2",t);if(!s)throw new Error("WebGL2 is not available");let r=null,i=!1;const o=()=>{!r||!i||(r._c2dSetViewport(e.width,e.height),r._c2dSetDensity(n.size().factor))},a=()=>{r&&(r._creatorWeb2dEnsureInited(),i=!0,o(),e.style.display="block")},h=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(l){return r=l,{open2DScene:a,close2DScene:h}},show:a,hide:h,resize:o,frame(l){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(l)},destroy(){var l;(l=s.getExtension("WEBGL_lose_context"))==null||l.loseContext()}}},Ue=n=>{if(typeof n=="number"||typeof n=="bigint"||typeof WebAssembly<"u"&&n instanceof WebAssembly.RuntimeError)return!0;const t=n instanceof Error?n.stack??"":"";return/\bwasm\b|wasm-function|\.wasm/i.test(t)},We="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yn={};for(let n=0;n<We.length;n++)yn[We[n]]=n;const js=n=>{const t=[];let e=0,s=0;for(const r of n){const i=yn[r];if(i===void 0)break;const o=i&32;if(s+=(i&31)<<e,o)e+=5;else{const a=s&1;s>>=1,t.push(a?-s:s),s=0,e=0}}return t};class zs{constructor(t){w(this,"sources");w(this,"lines");this.sources=t.sources,this.lines=[];let e=0,s=0,r=0;for(const i of t.mappings.split(";")){const o=[];let a=0;if(i)for(const h of i.split(",")){const l=js(h);l.length!==0&&(a+=l[0],l.length>=4&&(e+=l[1],s+=l[2],r+=l[3],o.push([a,e,s,r])))}this.lines.push(o)}}originalPositionFor(t,e){const s=this.lines[t-1];if(!s||s.length===0)return null;let r=null;for(const o of s)if(o[0]<=e)r=o;else break;r??(r=s[0]);const i=this.sources[r[1]];return i===void 0?null:{source:i,line:r[2]+1,column:r[3]}}}const Xs=n=>{const t=n.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const e=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new zs(JSON.parse(e))}catch{return null}};let dt=null;const Ys=()=>{if(dt!==null)return dt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return dt=e?parseInt(e[1],10)-1:2,dt}return dt=2,dt},Vt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=Ys(),r=[];for(const i of e.split(`
|
|
13
|
+
`,Me=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),ws=n=>n.type==="native"||n.type==="video",bs=[1,0,0,1,0,0],Ht=(n,t)=>[n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]],vs=(n,t)=>{if(!n)return t;const e=Math.max(n.x,t.x),s=Math.max(n.y,t.y);return{x:e,y:s,width:Math.max(0,Math.min(n.x+n.width,t.x+t.width)-e),height:Math.max(0,Math.min(n.y+n.height,t.y+t.height)-s)}};class Mt extends ms{constructor(e,s,r,i,o={}){super(e,s,o);w(this,"doc");w(this,"factories",new Map);w(this,"versions",new Map);w(this,"views",new Map);w(this,"wrappers",new Map);w(this,"shown",new Map);w(this,"destination",null);w(this,"field",null);w(this,"placedFor",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=ys,i.appendChild(a)}paintOptions(){var e;return{surfaces:!0,editing:(e=this.field)==null?void 0:e.id}}registerView(e,s,r=1){this.factories.set(e,s),this.versions.set(e,r)}unregisterView(e){this.factories.delete(e),this.versions.delete(e)}isViewSupported(e){return this.factories.has(e)}viewVersion(e){return this.versions.get(e)??0}ensureView(e,s,r){const i=this.views.get(e);if(i&&(i.name!==s||i.params!==r))this.destroyView(e);else if(i)return i.handle;const o=this.factories.get(s);if(!o)return null;let a={};try{a=r?JSON.parse(r):{}}catch{}const h=o(a,{emit:(l,c)=>this.M.jsb.viewEvent(e,l,c)},this.doc);return h.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:h}),h}destroyView(e){var r,i;const s=this.views.get(e);s&&(this.views.delete(e),(i=(r=s.handle).destroy)==null||i.call(r),s.handle.el.remove())}viewCall(e,s,r,i,o){const a=this.views.get(e);if(!(a!=null&&a.handle.call)){o(`NativeView call "${s}": no live instance or no call handler (viewId ${e})`);return}try{Promise.resolve(a.handle.call(s,Array.isArray(r)?r:[])).then(h=>{h===void 0?i():i(h)},h=>o(h instanceof Error?h.message:String(h)))}catch(h){o(h instanceof Error?h.message:String(h))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==Wt)return;this.dropDestination();const h=this.ensureView(r,i,o);if(!h)return;const l=this.doc.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:auto;",l.appendChild(h.el),this.under.prepend(l),this.destination={viewId:r,el:l}}dropView(e,s,r){var i;super.dropView(e,s,r),e===Wt&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==Wt&&this.dropDestination()}dropDestination(){var e;(e=this.destination)==null||e.el.remove(),this.destination=null}releaseNode(e){var r,i;const s=this.get(e);((r=this.field)==null?void 0:r.id)===e&&this.unmountField(),super.releaseNode(e),(i=this.shown.get(e))==null||i.remove(),this.shown.delete(e),this.wrappers.delete(e),(s==null?void 0:s.type)==="native"&&s.viewId&&this.destroyView(s.viewId)}focusInput(e){var i;if(super.focusInput(e),this.focusedId()!==e||((i=this.field)==null?void 0:i.id)===e)return;this.unmountField();const s=this.get(e);if(!s)return;const r=this.doc.createElement(s.type==="textarea"?"textarea":"input");r.className="lc-field",r.setAttribute("autocomplete","off"),r.value=s.value,r.addEventListener("input",()=>{this.focusedId()===e&&this.setInputValue(e,r.value)}),r.addEventListener("keydown",o=>{o.key==="Enter"&&r.tagName==="INPUT"&&(o.preventDefault(),this.submitInput())}),r.addEventListener("blur",()=>{var o;((o=this.field)==null?void 0:o.el)===r&&this.focusedId()===e&&this.blurInput()}),this.over.appendChild(r),this.field={id:e,el:r},this.placedFor=null,this.place(),r.focus({preventScroll:!0})}blurInput(){super.blurInput(),this.unmountField()}unmountField(){const e=this.field;e&&(this.field=null,e.el.remove(),this.placedFor=null)}setPropertyString(e,s,r){var i,o;if(super.setPropertyString(e,s,r),s==="value"&&((i=this.field)==null?void 0:i.id)===e){const a=((o=this.get(e))==null?void 0:o.value)??"";this.field.el.value!==a&&(this.field.el.value=a)}}find(){var i;const e=[],s=(i=this.field)==null?void 0:i.id,r=(o,a,h)=>{let l=a;const c=o.style.transform;if(c){const u=o.style.transformOrigin,d=o.rect.x+(u?u.xPercent?o.rect.width*u.x/100:u.x:o.rect.width/2),p=o.rect.y+(u?u.yPercent?o.rect.height*u.y/100:u.y:o.rect.height/2);l=Ht(Ht(Ht(a,[1,0,0,1,d,p]),c),[1,0,0,1,-d,-p])}(ws(o)||o.id===s)&&e.push({node:o,matrix:l,clip:h});const f=o.clip?vs(h,o.rect):h;for(const u of o.children)r(u,l,f)};for(const o of this.frame())r(o.tree,bs,null);return e}static put(e,s){const{rect:r}=s.node,i=e.style;i.position="absolute",i.left="0",i.top="0",i.width=r.width+"px",i.height=r.height+"px",i.transformOrigin="0 0",i.transform=`matrix(${s.matrix.join(",")}) translate(${r.x}px,${r.y}px)`;const o=s.clip;i.clipPath=o?`inset(${Math.max(0,o.y-r.y)}px ${Math.max(0,r.x+r.width-(o.x+o.width))}px ${Math.max(0,r.y+r.height-(o.y+o.height))}px ${Math.max(0,o.x-r.x)}px)`:""}surfaceElement(e){const s=this.get(e.id);if(!s)return null;if(s.type==="video"){const o=ce(s.playerId);return o instanceof HTMLVideoElement?o:null}if(!s.viewId)return null;const r=this.ensureView(s.viewId,s.viewName??"",s.viewParams??"");if(!r)return null;let i=this.wrappers.get(s.id);return i||(i=this.doc.createElement("div"),this.wrappers.set(s.id,i)),r.el.parentElement!==i&&i.replaceChildren(r.el),i}styleField(e,s){var f,u;const r=s.style,i=e.style,[o,a,h,l]=s.padding??[0,0,0,0];i.padding=`${a}px ${h}px ${l}px ${o}px`,i.color=Me(r.color,"#000000ff"),i.caretColor=i.color;const c=r.fontFamily??"Roboto";if(i.fontFamily=((u=(f=this.host).resolveFontFamily)==null?void 0:u.call(f,c))??c,i.fontSize=(r.fontSize??14)+"px",i.fontWeight=String(r.fontWeight??400),i.fontStyle=r.fontStyle??"normal",i.letterSpacing=(r.letterSpacing??0)+"px",i.lineHeight=e.tagName==="TEXTAREA"&&r.lineHeight!==void 0?r.lineHeight+"px":"normal",i.textAlign=r.textAlign==="center"?"center":r.textAlign==="end"?"right":"left",i.borderRadius="0",e.placeholder=r.placeholder??"",i.setProperty("--lc-placeholder",Me(r.placeholderColor,"#999999ff")),e instanceof HTMLInputElement){const d=r.inputType??"text";e.type!==d&&(e.type=d)}}place(){var r;const e=this.frame();if(e===this.placedFor)return;this.placedFor=e;const s=new Set;for(const i of this.find()){const{node:o}=i;if(o.id===((r=this.field)==null?void 0:r.id)){this.styleField(this.field.el,o),Mt.put(this.field.el,i);continue}const a=this.surfaceElement(o);a&&(s.add(o.id),a.parentElement!==this.under&&this.under.appendChild(a),a.style.display="block",a.style.opacity="",a.style.pointerEvents="auto",a instanceof HTMLVideoElement&&(a.style.objectFit=o.style.objectFit??"contain"),Mt.put(a,i),this.shown.set(o.id,a))}for(const[i,o]of this.shown)s.has(i)||(o.style.display="none",this.shown.delete(i))}surfaceAt(e,s){const r=this.frame();for(let i=r.length-1;i>=0;i--){const o=r[i];if(o.leaving)continue;const a=ft(o.tree,e,s,h=>{var l,c;return h.type==="native"||(((l=this.get(h.id))==null?void 0:l.interactive)??!1)||(((c=this.get(h.id))==null?void 0:c.editable)??!1)||!!h.scroll});if(a.node)return a.node.type==="native";if(a.blocker)return!1}return this.destination!==null}dispose(){this.unmountField();for(const e of[...this.views.keys()])this.destroyView(e);this.dropDestination();for(const e of this.shown.values())e instanceof HTMLVideoElement||e.remove();this.shown.clear()}}function xs(n,t,e,s){const r=n.createElement("div");r.textContent=e,r.style.cssText="position:absolute;left:50%;bottom:48px;transform:translateX(-50%);max-width:80%;padding:10px 16px;border-radius:8px;background:rgba(30,30,30,0.92);color:#fff;font:13px/1.4 system-ui,sans-serif;z-index:30;pointer-events:none;",t.appendChild(r),setTimeout(()=>r.remove(),s>0?s:2e3)}const Ss=500,Le=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],Es=(n,t)=>{const e=n.ownerDocument,{canvas:s}=t;s.style.display="block",s.style.pointerEvents="none",n.style.touchAction="none";const r=s.getContext("2d"),i=()=>{const y=e.createElement("div");return y.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",y},o=i(),a=i();n.insertBefore(o,s),s.after(a);const h=new ar({resolveAssetUrl:y=>Yn(y),canvasSurfaces:t.canvasHost}),l=new Mt(t.M,h,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onToast:(y,L)=>xs(e,n,y,L)});let c=1,f=new Ee(r,c),u=!0;const d=()=>{(u||l.needsPaint())&&(u=!1,l.paint(f,l.paintOptions())),l.place()},p=(y,L,A)=>{y<=0||L<=0||(A!==c&&(c=A,f=new Ee(r,c)),u=!0,l.resize(y,L))},b=y=>{l.setSafeArea([y.top,y.right,y.bottom,y.left],y.bars??[])},g=y=>{const L=n.getBoundingClientRect(),A=ae(n);return[(y.clientX-L.left)/A,(y.clientY-L.top)/A]},x=y=>y.target instanceof Node&&a.contains(y.target),m=y=>y.target instanceof Node&&o.contains(y.target),v=y=>{m(y)&&y.stopPropagation()},_=new Set,M=new Map,P=y=>{const L=M.get(y);L!==void 0&&(clearTimeout(L),M.delete(y))},I=y=>{if(x(y))return;const[L,A]=g(y);if(!l.surfaceAt(L,A)){v(y),_.add(y.pointerId);try{n.setPointerCapture(y.pointerId)}catch{}l.pointerDown(y.pointerId,L,A),P(y.pointerId),M.set(y.pointerId,window.setTimeout(()=>{M.delete(y.pointerId),l.longPress(y.pointerId,L,A)},Ss))}},F=y=>{const[L,A]=g(y);_.has(y.pointerId)&&(v(y),l.pointerMove(y.pointerId,L,A)),y.pointerType==="mouse"&&(x(y)||!_.has(y.pointerId)&&l.surfaceAt(L,A)?l.pointerLeave():l.pointerHover(L,A))},D=y=>{y.pointerType==="mouse"&&l.pointerLeave()},R=y=>{if(!_.delete(y.pointerId))return;v(y),P(y.pointerId);const[L,A]=g(y);l.pointerUp(y.pointerId,L,A)},z=y=>{_.delete(y.pointerId)&&(P(y.pointerId),l.pointerCancel(y.pointerId))},G=y=>{if(x(y))return;const[L,A]=g(y);if(l.surfaceAt(L,A))return;v(y);const H=y.deltaMode===1?16:y.deltaMode===2?l.height:1;l.wheel(L,A,y.deltaX*H,y.deltaY*H)&&y.preventDefault()},V=y=>{var Y;if(x(y))return;const L="clientX"in y?y:(Y=y.changedTouches)==null?void 0:Y[0];if(!L)return;const[A,H]=g(L);l.surfaceAt(A,H)||(v(y),y.type==="mousedown"&&y.preventDefault())};n.addEventListener("pointerdown",I,!0),n.addEventListener("pointermove",F,!0),n.addEventListener("pointerleave",D),n.addEventListener("pointerup",R,!0),n.addEventListener("pointercancel",z,!0),n.addEventListener("wheel",G,{passive:!1,capture:!0});for(const y of Le)n.addEventListener(y,V,!0);return{ui:l,render:d,resize:p,setSafeArea:b,destroy(){for(const y of M.keys())P(y);n.removeEventListener("pointerdown",I,!0),n.removeEventListener("pointermove",F,!0),n.removeEventListener("pointerleave",D),n.removeEventListener("pointerup",R,!0),n.removeEventListener("pointercancel",z,!0),n.removeEventListener("wheel",G,!0);for(const y of Le)n.removeEventListener(y,V,!0);l.dispose(),o.remove(),a.remove()}}},_s=["miter","round","bevel"],Ts=["butt","round","square"],ks=["left","center","right","start","end"],Rs=["alphabetic","top","middle","bottom","hanging","ideographic"],Pe=["nonzero","evenodd"],As=["pad","reflect","repeat"],Bt={COLOR:0,RADIAL:2},bt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},X={SET_TRANSFORM:0,SAVE:1,RESTORE:2,CLIP:3,FILL_PATH:4,STROKE_PATH:5,FILL_TEXT:6,STROKE_TEXT:7,DRAW_IMAGE:8,CLEAR_RECT:9};class Ms{constructor(t,e){w(this,"pos",0);this.w=t,this.strings=e}f(){if(this.pos>=this.w.length)throw new Error("draw list: truncated");return this.w[this.pos++]}i(){return this.f()|0}str(){const t=this.i();if(t<0||t>=this.strings.length)throw new Error(`draw list: bad string index ${t}`);return this.strings[t]}color(){return[this.f(),this.f(),this.f(),this.f()]}matrix(){return[this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]}paint(){const t=this.i(),e=this.f();if(t===Bt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===Bt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=As[this.i()]??"pad",h=this.i(),l=[];for(let c=0;c<h;c++)l.push({offset:this.f(),color:this.color()});return t===Bt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:l}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:l}}stroke(){const t=this.f(),e=_s[this.i()]??"miter",s=Ts[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let h=0;h<o;h++)a.push(this.f());return{width:t,join:e,cap:s,miterLimit:r,dashOffset:i,dash:a}}font(){return{family:this.str(),size:this.f(),weight:this.i(),italic:this.i()!==0}}path(){const t=this.i(),e=this.pos+t;if(e>this.w.length)throw new Error("draw list: truncated path");const s=[];for(;this.pos<e;)switch(this.i()){case bt.MOVE:s.push(["M",this.f(),this.f()]);break;case bt.LINE:s.push(["L",this.f(),this.f()]);break;case bt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case bt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case bt.CLOSE:s.push(["Z"]);break;default:throw new Error("draw list: bad path verb")}return s}rect4(){return[this.f(),this.f(),this.f(),this.f()]}}const Ls=(n,t)=>{const e=new Ms(n,t),s=[];for(;e.pos+2<=n.length;){const r=e.i(),i=e.i(),o=e.pos+i;if(i<0||o>n.length)throw new Error("draw list: truncated command");switch(r){case X.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case X.SAVE:s.push({cmd:"save"});break;case X.RESTORE:s.push({cmd:"restore"});break;case X.CLIP:{const a=Pe[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case X.FILL_PATH:{const a=Pe[e.i()]??"nonzero",h=e.paint();s.push({cmd:"fillPath",rule:a,paint:h,path:e.path()});break}case X.STROKE_PATH:{const a=e.stroke(),h=e.paint();s.push({cmd:"strokePath",stroke:a,paint:h,path:e.path()});break}case X.FILL_TEXT:case X.STROKE_TEXT:{const a=e.str(),h=e.f(),l=e.f(),c=e.f(),f=e.font(),u=ks[e.i()]??"start",d=Rs[e.i()]??"alphabetic",p=e.f();if(r===X.STROKE_TEXT){const b=e.stroke();s.push({cmd:"strokeText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,stroke:b,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,paint:e.paint()});break}case X.DRAW_IMAGE:{const a=e.i(),h=e.rect4(),l=e.rect4();s.push({cmd:"drawImage",surface:a,src:h,dst:l,alpha:e.f()});break}case X.CLEAR_RECT:s.push({cmd:"clearRect",rect:e.rect4()});break}if(e.pos!==o){if(e.pos>o)throw new Error(`draw list: command ${r} overran its length`);e.pos=o}}return s},Ps=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),pn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,gn=(n,t=n.family)=>{const e=Ps.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Tt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Cs=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,$t=(n,t)=>{n.beginPath();for(const e of t)switch(e[0]){case"M":n.moveTo(e[1],e[2]);break;case"L":n.lineTo(e[1],e[2]);break;case"Q":n.quadraticCurveTo(e[1],e[2],e[3],e[4]);break;case"C":n.bezierCurveTo(e[1],e[2],e[3],e[4],e[5],e[6]);break;case"Z":n.closePath();break}},Ce=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,pn(e.color))},kt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=pn(t.color),s();return}const r=t.matrix;if(Cs(r)){let o;if(t.kind==="linear"){const[a,h]=Tt(r,0,0),[l,c]=Tt(r,1,0);o=n.createLinearGradient(a,h,l,c)}else{const a=Math.hypot(r[0],r[1]),[h,l]=Tt(r,0,0),[c,f]=Tt(r,t.fx,t.fy);o=n.createRadialGradient(c,f,t.r0*a,h,l,a)}Ce(o,t),n[e==="fill"?"fillStyle":"strokeStyle"]=o,s();return}n.save(),n.transform(r[0],r[1],r[2],r[3],r[4],r[5]);const i=t.kind==="linear"?n.createLinearGradient(0,0,1,0):n.createRadialGradient(t.fx,t.fy,t.r0,0,0,1);Ce(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Oe=(n,t)=>{n.lineWidth=t.width,n.lineJoin=t.join,n.lineCap=t.cap,n.miterLimit=t.miterLimit,n.setLineDash(t.dash),n.lineDashOffset=t.dashOffset},Ie=(n,t,e)=>{n.font=gn(t.font,e.fontFamily?e.fontFamily(t.font.family):t.font.family),n.textAlign=t.align,n.textBaseline=t.baseline,"letterSpacing"in n&&(n.letterSpacing=`${t.letterSpacing}px`)},Os=(n,t,e={})=>{var r;n.save();let s=0;try{n.setTransform(1,0,0,1,0,0),n.globalAlpha=1;for(const i of t)switch(i.cmd){case"setTransform":n.setTransform(i.matrix[0],i.matrix[1],i.matrix[2],i.matrix[3],i.matrix[4],i.matrix[5]);break;case"save":n.save(),s++;break;case"restore":s>0&&(n.restore(),s--);break;case"clip":$t(n,i.path),n.clip(i.rule);break;case"fillPath":$t(n,i.path),kt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":$t(n,i.path),Oe(n,i.stroke),kt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":Ie(n,i,e),kt(n,i.paint,"fill",()=>i.maxWidth>0?n.fillText(i.text,i.x,i.y,i.maxWidth):n.fillText(i.text,i.x,i.y));break;case"strokeText":Ie(n,i,e),Oe(n,i.stroke),kt(n,i.paint,"stroke",()=>i.maxWidth>0?n.strokeText(i.text,i.x,i.y,i.maxWidth):n.strokeText(i.text,i.x,i.y));break;case"drawImage":{const o=(r=e.image)==null?void 0:r.call(e,i.surface);if(!o)break;n.globalAlpha=i.alpha,n.drawImage(o,i.src[0],i.src[1],i.src[2],i.src[3],i.dst[0],i.dst[1],i.dst[2],i.dst[3]);break}case"clearRect":n.clearRect(i.rect[0],i.rect[1],i.rect[2],i.rect[3]);break;default:{const o=i;throw new Error(`unhandled draw command ${o.cmd}`)}}}finally{for(;s>0;s--)n.restore();n.restore()}},Is=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(l,c,f)=>{if(!t)return null;let u=e.get(l);return u?(u.width!==c||u.height!==f)&&(u.width=c,u.height=f):(u=new OffscreenCanvas(c,f),e.set(l,u)),u},i={paint:(l,c,f,u,d,p)=>{const b=r(l,Math.max(1,c),Math.max(1,f)),g=b==null?void 0:b.getContext("2d");!b||!g||(g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,b.width,b.height),Os(g,Ls(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(l,c,f,u,d,p)=>{if(p[0]=0,p[1]=0,p[2]=0,!t||(s||(s=new OffscreenCanvas(1,1).getContext("2d")),!s))return;s.font=gn({family:c,size:f,weight:u,italic:d},c);const b=s.measureText(l);p[0]=b.width,p[1]=b.fontBoundingBoxAscent??b.actualBoundingBoxAscent,p[2]=b.fontBoundingBoxDescent??b.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(l,c)=>{const f=o(l);return f?(c[0]=f.width,c[1]=f.height,new Uint8Array(f.data.buffer,f.data.byteOffset,f.data.byteLength)):null},releaseSurface:l=>{e.delete(l)}},o=l=>{const c=e.get(l),f=c==null?void 0:c.getContext("2d");return!c||!f?null:{data:f.getImageData(0,0,c.width,c.height).data,width:c.width,height:c.height}};return{table:i,readSurface:o,getSurface:l=>{const c=e.get(l);return c?{canvas:c,width:c.width,height:c.height}:null},surfaceToDataUrl:l=>{var u;const c=e.get(l);if(!c||typeof document>"u")return null;const f=document.createElement("canvas");return f.width=c.width,f.height=c.height,(u=f.getContext("2d"))==null||u.drawImage(c,0,0),f.toDataURL()}}},Fs=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,Ns=(n,t="woff2")=>{const e=/^\/\/ fonts: (.+)$/m.exec(n);if(!e)return[];const s=[];for(const r of e[1].split(";")){const i=r.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(r.slice(0,i));o&&s.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:r.slice(i+1).replace("{fmt}",t)})}return s},Us=async(n,t,e=2e3)=>{const s=t??(typeof document>"u"?void 0:document);if(!(s!=null&&s.fonts)||n.length===0)return;const r=[];for(const i of n)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});s.fonts.add(o),r.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(r),new Promise(i=>setTimeout(i,e))])},mn="Roboto",Ws=[`400 14px ${mn}`],Fe="data-lecodes-fonts",Ds=async(n=Ws,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${Fe}]`)){const s=new URL(Fs,document.baseURI).href,r=e.createElement("style");r.setAttribute(Fe,""),r.textContent=`@font-face{font-family:"${mn}";src:url("${s}") format("woff2");font-weight:100 900;font-display:swap}`,e.head.appendChild(r)}try{await Promise.all(n.map(s=>e.fonts.load(s)))}catch{}}},Ne="2.0.11",Gt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},Hs=(n,t)=>Gt(n)!==null&&Gt(n)===Gt(t),Bs=[171,75,84,88,32,50,48,187,13,10,26,10],$s=n=>n.length>=12&&Bs.every((t,e)=>n[e]===t),Gs=(n,t)=>{const e={antialias:!1,depth:!0,alpha:!1,stencil:!1,desynchronized:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"high-performance",premultipliedAlpha:!0,preserveDrawingBuffer:t},s=n.newCanvas(),r=s.getContext("webgl2",e);if(!r)throw new Error("WebGL2 is not available");let i=null,o=!1;const a=[],h=()=>{const c=r.createTexture();return r.bindTexture(r.TEXTURE_2D,c),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),c},l=(c,f,u,d)=>{const p=c.GL.getNewId(c.GL.textures);return c.GL.textures[p]=f,c._importTexture(p,u,d)>>>0};return{canvas:s,context:r,options:e,table(c){return i=c,{engineCreated(){c._createSwapChainHeadless(s.width,s.height),c._creatorWebSetViewport(s.width,s.height),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,u,d,p){const b=et(f);if(!b){p(`createTexture: no buffer behind id ${f}`);return}const g=new Uint8Array(b);if($s(g)){const x=c._malloc(g.length);c.HEAPU8.set(g,x);const m=c._createTextureFromKtx2(x,g.length)>>>0;if(c._free(x),m===4294967295){p("KTX2 transcode failed");return}d(m,c._getTextureWidth(m),c._getTextureHeight(m));return}createImageBitmap(Ot(f)).then(x=>{const m=h();r.texStorage2D(r.TEXTURE_2D,1,u&1?r.RGBA8:r.SRGB8_ALPHA8,x.width,x.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,r.RGBA,r.UNSIGNED_BYTE,x),d(l(c,m,x.width,x.height),x.width,x.height)},x=>p(x instanceof Error?x.message:String(x)))},createMediaPlayerTexture(f){const u=ce(f);if(!u)return 0;const d=h();return a.push({player:u,texture:d,lastTime:0}),l(c,d,0,0)}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&i._creatorWebSetViewport(s.width,s.height)},frame(){for(const c of a)c.player.readyState<2||c.player.currentTime===c.lastTime||(c.lastTime=c.player.currentTime,r.bindTexture(r.TEXTURE_2D,c.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,c.player))},destroy(){var c;a.length=0,(c=r.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},Vs=n=>{const t={alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,desynchronized:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e=n.newCanvas(),s=e.getContext("webgl2",t);if(!s)throw new Error("WebGL2 is not available");let r=null,i=!1;const o=()=>{!r||!i||(r._c2dSetViewport(e.width,e.height),r._c2dSetDensity(n.size().factor))},a=()=>{r&&(r._creatorWeb2dEnsureInited(),i=!0,o(),e.style.display="block")},h=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(l){return r=l,{open2DScene:a,close2DScene:h}},show:a,hide:h,resize:o,frame(l){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(l)},destroy(){var l;(l=s.getExtension("WEBGL_lose_context"))==null||l.loseContext()}}},Ue=n=>{if(typeof n=="number"||typeof n=="bigint"||typeof WebAssembly<"u"&&n instanceof WebAssembly.RuntimeError)return!0;const t=n instanceof Error?n.stack??"":"";return/\bwasm\b|wasm-function|\.wasm/i.test(t)},We="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yn={};for(let n=0;n<We.length;n++)yn[We[n]]=n;const js=n=>{const t=[];let e=0,s=0;for(const r of n){const i=yn[r];if(i===void 0)break;const o=i&32;if(s+=(i&31)<<e,o)e+=5;else{const a=s&1;s>>=1,t.push(a?-s:s),s=0,e=0}}return t};class zs{constructor(t){w(this,"sources");w(this,"lines");this.sources=t.sources,this.lines=[];let e=0,s=0,r=0;for(const i of t.mappings.split(";")){const o=[];let a=0;if(i)for(const h of i.split(",")){const l=js(h);l.length!==0&&(a+=l[0],l.length>=4&&(e+=l[1],s+=l[2],r+=l[3],o.push([a,e,s,r])))}this.lines.push(o)}}originalPositionFor(t,e){const s=this.lines[t-1];if(!s||s.length===0)return null;let r=null;for(const o of s)if(o[0]<=e)r=o;else break;r??(r=s[0]);const i=this.sources[r[1]];return i===void 0?null:{source:i,line:r[2]+1,column:r[3]}}}const Xs=n=>{const t=n.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const e=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new zs(JSON.parse(e))}catch{return null}};let dt=null;const Ys=()=>{if(dt!==null)return dt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return dt=e?parseInt(e[1],10)-1:2,dt}return dt=2,dt},Vt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=Ys(),r=[];for(const i of e.split(`
|
|
14
14
|
`)){const o=i.match(/<anonymous>:(\d+):(\d+)/);if(!o)continue;const a=parseInt(o[1],10)-s,h=parseInt(o[2],10)-1;if(a<1)continue;const l=t.originalPositionFor(a,h<0?0:h);if(!l)continue;const c=i.match(/at\s+([^\s(]+)\s*\(/);r.push({fn:c?c[1]:null,source:l.source,line:l.line,column:l.column})}return r},qs=/^\[ERROR\] (run|host callback|JsDispatch|timer|setLoop|animate|tween)\b:? ?([\s\S]*)$/,Ks=(n,t)=>{const e=[],s=(l,c,f,u)=>{var b,g;if(f.length===0&&Ue(c)){const x=typeof c=="number"||typeof c=="bigint"?`code ${c}`:c instanceof Error?c.message||c.name:String(c),m=[u,x].filter(_=>!!_).filter((_,M,P)=>P.indexOf(_)===M).join(`
|
|
15
15
|
`);console.error(`[lecodes] native engine error — ${m||x} (see the console for the engine's message)`);const v={message:"Native engine error",detail:m,frames:[],native:!0,stack:c instanceof Error?c.stack:void 0};(b=l.onError)==null||b.call(l,v),v.stack&&t&&jn(v.stack).then(_=>{var M;_.length>0&&((M=l.onError)==null||M.call(l,{...v,nativeFrames:_}))});return}const d=c instanceof Error?c.message:String(c),p=f[0];console.error(p?`[lecodes] ${d}
|
|
16
16
|
at ${p.source}:${p.line}:${p.column}${p.fn?` (${p.fn})`:""}`:`[lecodes] ${d}`),(g=l.onError)==null||g.call(l,{message:d,frames:f,stack:c instanceof Error?c.stack:void 0})},r=(l,c)=>{for(let u=e.length-1;u>=0;u--){const d=e[u];if(!d.sourceMap)continue;const p=Vt(l,d.sourceMap);if(p.length>0)return s(d,l,p,c)}const f=e[e.length-1];f&&Ue(l)&&s(f,l,[],c)};let i=null;const o=()=>{const l=e[e.length-1],c=i;if(i=null,!c||!l)return;const f=new Error(c.message.replace(/^Error: /,""));f.stack=c.stack.join(`
|
|
@@ -18,4 +18,4 @@ var kn=Object.defineProperty;var Rn=(n,t,e)=>t in n?kn(n,t,{enumerable:!0,config
|
|
|
18
18
|
`);return i={message:(f??"").replace(/^JsTask /,""),stack:u},n.setTimeout(o,0),!0},dispose(){n.removeEventListener("error",a),n.removeEventListener("unhandledrejection",h),e.length=0}}},wn=n=>{var h,l,c,f;const t=n.slice(0,2e3),e=new Set,s=t.match(/\/\/ preload: (.+)/);if(s)for(const u of s[1].split(";"))e.add(u);const r=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((h=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:h[1])??null,o=((c=(l=t.match(/^\/\/ name: (.+)$/m))==null?void 0:l[1])==null?void 0:c.trim())??null,a=new Set((((f=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:f[1])??"").split(";").map(u=>u.trim()).filter(Boolean));return{sdk:i,name:o,preloads:e,gl:r,is2d:t.includes("// 2d: enable"),plugins:a,bootFonts:Ns(t)}},Js=n=>n.gl!=="off"?"full":n.is2d?"2d":"ui",Qs=n=>{const t=n.ownerDocument,e=t.defaultView??window;let s=1/0;const r=(d,p)=>{const b=Math.min(s,(e.devicePixelRatio||1)*ae(n));return{width:d,height:p,factor:b,pixelWidth:Math.max(1,Math.round(d*b)),pixelHeight:Math.max(1,Math.round(p*b))}};let i=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));const o=[],a=d=>{d.width!==i.pixelWidth&&(d.width=i.pixelWidth),d.height!==i.pixelHeight&&(d.height=i.pixelHeight)},h=()=>{const d=t.createElement("canvas");return d.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:none;",n.appendChild(d),a(d),o.push(d),d},l=new Set,c=d=>{if(!(d.width<=0||d.height<=0)){i=d;for(const p of o)a(p);for(const p of l)p(i)}},f=new ResizeObserver(([d])=>{var v;if(!d)return;const{width:p,height:b}=d.contentRect,g=(v=d.devicePixelContentBoxSize)==null?void 0:v[0],x=r(p,b),m=g&&Math.abs(g.inlineSize-p*x.factor)<=1&&Math.abs(g.blockSize-b*x.factor)<=1;if(!g||!m){c(x);return}c({width:p,height:b,pixelWidth:Math.max(1,g.inlineSize),pixelHeight:Math.max(1,g.blockSize),factor:x.factor})});try{f.observe(n,{box:"device-pixel-content-box"})}catch{f.observe(n)}return{root:n,doc:t,win:e,size:()=>i,newCanvas:h,remeasure:d=>{d!==void 0&&(s=d>0?d:1/0);const p=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));(p.pixelWidth!==i.pixelWidth||p.pixelHeight!==i.pixelHeight||p.factor!==i.factor)&&c(p)},onResize(d){return l.add(d),()=>{l.delete(d)}},destroy(){f.disconnect(),l.clear();for(const d of o)d.remove();o.length=0}}},Zs=n=>{const t=[],e=new Set;return{has:s=>e.has(s),register(s,r){e.has(s)||(e.add(s),r({registerView:(i,o,a=1)=>{t.push({id:s,version:a,kind:"view",name:i,factory:o})},registerService:(i,o,a=1)=>{t.push({id:s,version:a,kind:"service",name:i,factory:o})},putBuffer:ot,getBuffer:et}))},allow(s){var i,o;const r=new Set(s);for(const a of t){const h=r.has(a.id);a.kind==="view"?h?(i=n.registerView)==null||i.call(n,a.name,a.factory,a.version):(o=n.unregisterView)==null||o.call(n,a.name):h?n.registerService(a.name,a.factory,a.version):n.unregisterService(a.name)}}}},ti=n=>{const t=n.ownerDocument.createElement("div");t.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);",n.appendChild(t);const e=i=>Math.round(parseFloat(i)||0),s=()=>{const i=getComputedStyle(t);return{top:e(i.paddingTop),right:e(i.paddingRight),bottom:e(i.paddingBottom),left:e(i.paddingLeft)}};let r=null;return{set(i){r=i},current:()=>r??s(),destroy(){t.remove()}}},ei={lightmap:"world","lightmap-masked":"world","lightmap-lite":"world","lightmap-masked-lite":"world",terrain:"world","terrain-lightmap":"world",foliage:"world","foliage-masked":"world"},De="material:",ni=n=>{const t=new Set;for(const e of n)e.startsWith(De)&&t.add(ei[e.slice(De.length)]??"base");return[...t].sort((e,s)=>e==="base"?-1:s==="base"?1:e.localeCompare(s))},ri=""+new URL("assets/materials-uri4FvPE.bin",import.meta.url).href,si=""+new URL("assets/materials-world-CQWt8TAm.bin",import.meta.url).href,ii=""+new URL("assets/neutral_ibl128-D-lzdkLN.ktx",import.meta.url).href,oi=""+new URL("assets/uberarchive-DLH-kBhM.bin",import.meta.url).href,ai={base:ri,world:si},ci=n=>{const t=new Uint8Array(n.reduce((s,r)=>s+r.byteLength,0));let e=0;for(const s of n)t.set(new Uint8Array(s),e),e+=s.byteLength;return t.buffer},li=async n=>{const t=async o=>{const a=await fetch(o);if(!a.ok)throw new Error(`${o} → HTTP ${a.status}`);return a.arrayBuffer()},e=ni(n).map(o=>ai[o]).filter(o=>!!o),[s,r,...i]=await Promise.all([t(ii),t(oi),...e.map(t)]);return{1:s,2:r,...i.length>0?{3:ci(i)}:{}}},hi=n=>{const t=()=>n.push(document.hidden?"pause":"resume"),e=()=>n.push("online"),s=()=>n.push("offline");return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),window.addEventListener("offline",s),{table:{state:()=>document.hidden?"background":"active",isOnline:()=>navigator.onLine,openUrl(i){window.open(i,"_blank","noopener")},setOrientation(i){var h,l,c,f;const o=i==="landscape"||i==="portrait"?i:"auto";if(n.onOrientation){n.onOrientation(o);return}const a=typeof screen<"u"?screen.orientation:void 0;if(a)try{o==="auto"?(h=a.unlock)==null||h.call(a):(f=(c=(l=a.lock)==null?void 0:l.call(a,o))==null?void 0:c.catch)==null||f.call(c,()=>{})}catch{}}},emit:(i,o)=>n.push(i,o),dispose(){document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener("offline",s)}}},ui=(n,t,e,s)=>{try{const r=document.createElement("input");r.type="file",r.multiple=e,s&&(r.accept=s),r.onchange=async()=>{const{files:i}=r;if(e){const o=[];if(!i)return n([]);for(let a of i)o.push([ot(await a.arrayBuffer()),a.name,a.size]);n(o)}else{if(!i||i.length===0)return n(null);n([[ot(await i[0].arrayBuffer()),i[0].name,i[0].size]])}},window.addEventListener("focus",()=>{setTimeout(()=>{(!r.files||r.files.length===0)&&n(e?[]:null)},300)},{once:!0}),r.click()}catch(r){t(r)}},di=n=>({get platform(){return"web"},get language(){return n()},get pixelRatio(){return window.devicePixelRatio||1},vibrate(){var t;try{(t=navigator.vibrate)==null||t.call(navigator,30)}catch{}},clipboardWrite(t){var e;(e=navigator.clipboard)==null||e.writeText(t).catch(()=>{})},clipboardRead(t,e){const s=navigator.clipboard;if(!(s!=null&&s.readText)){e("Clipboard is not available");return}s.readText().then(t,r=>e(r instanceof Error?r.message:"Clipboard read failed"))},share(t){const e=URL.createObjectURL(Ot(t)),s=document.createElement("a");s.href=e,s.download="image.png",document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(e)},openFilePicker:(t,e,s,r)=>ui(t,e,s,r??void 0),requestCamera(t){t()}}),fi=(n={})=>({local:t=>Zn(t),dispose:t=>qn(t),request(t,e,s,r,i,o,a,h){if(t.startsWith("id:")){const f=Number(t.slice(3));o(f,et(f)?200:404);return}const l={};for(let f=0;f+1<s.length;f+=2)l[s[f]]=s[f+1];let c;if(i.length>0){const f=new FormData;for(const u of i)u.key!==null&&(u.bufferId>0?f.append(u.key,Ot(u.bufferId),u.filename??void 0):f.append(u.key,u.value??""));c=f}else r!==null&&(c=r);(async()=>{var f;try{const u=await fetch(t,{method:e,headers:l,body:c,mode:"cors",credentials:"omit"}),d=h?(f=u.body)==null?void 0:f.getReader():void 0;if(!d){o(ot(await u.arrayBuffer()),u.status);return}const p=Number(u.headers.get("content-length"))||void 0,b=[];let g=0;for(;;){const{done:v,value:_}=await d.read();if(v)break;_&&(b.push(_),g+=_.length,h({loaded:g,total:p}))}const x=new Uint8Array(g);let m=0;for(const v of b)x.set(v,m),m+=v.length;o(ot(x.buffer),u.status)}catch(u){a(u instanceof Error?u.message:String(u))}})()},buffer:t=>{const e=et(t);return e?new Uint8Array(e):null},putBuffer:t=>ot(t.slice().buffer),bufferSlice(t,e,s){const r=et(t);if(!r)return null;const i=Math.max(0,Math.min(e,r.byteLength)),o=Math.max(i,Math.min(s,r.byteLength));return new Uint8Array(r,i,o-i)},systemBuffer:t=>{const e=n[t];return e?new Uint8Array(e):null}}),He=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],jt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],Rt=4,zt=16,Be=16,pi=.5,gi=n=>{const t=new Set;let e=null;const s=(S,k,N=-1,C=0)=>{e==null||e(S,k,N,C)},r=S=>{if(!S.code)return;const k=t.has(S.code);t.add(S.code),s(0,S.code,-1,k||S.repeat?1:0)},i=S=>{S.code&&t.delete(S.code)&&s(1,S.code)},o=()=>{for(const S of[...t])S.startsWith("Gamepad")||(t.delete(S),s(1,S))},{root:a}=n;let h=0,l=0,c=0,f=0,u=0,d=0,p=0,b=0,g=0,x=0;const m=S=>{if(S.pointerType&&S.pointerType!=="mouse")return;const k=a.getBoundingClientRect();h=S.clientX-k.left,l=S.clientY-k.top,c+=S.movementX||0,f+=S.movementY||0},v=S=>{const k=He[S.button];k&&(t.add(k),s(0,k))},_=S=>{const k=He[S.button];k&&t.delete(k)&&s(1,k)},M=S=>{const k=S.deltaMode===0?.01:1;u+=S.deltaX*k,d+=S.deltaY*k},P=S=>{document.pointerLockElement===a&&S.preventDefault()},I=[],F=[],D=[],R=()=>{var k,N;const S=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let C=0;C<Rt;C++){const Q=S[C]??null,E=!!Q&&Q.connected;if(E!==!!I[C]){if(I[C]=E,!E){for(const q of jt)t.delete(q+"@"+C)&&(s(1,q,C),z(q));D[C]=[],F[C]=[0,0,0,0,0,0]}s(E?2:3,"",C)}if(!Q||!E)continue;const O=Q.axes,U=Q.buttons,rt=((k=U[6])==null?void 0:k.value)??0,wt=((N=U[7])==null?void 0:N.value)??0;F[C]=[O[0]??0,O[1]??0,O[2]??0,O[3]??0,rt,wt];const de=D[C]??(D[C]=[]);for(let q=0;q<jt.length;q++){const Ft=U[q],St=!!Ft&&(Ft.pressed||Ft.value>pi);if(St===!!de[q])continue;de[q]=St;const Et=jt[q];St?t.add(Et+"@"+C):t.delete(Et+"@"+C),z(Et),s(St?0:1,Et,C)}}},z=S=>{let k=!1;for(let N=0;N<Rt&&!k;N++)t.has(S+"@"+N)&&(k=!0);k?t.add(S):t.delete(S)};let G=0;const V=()=>{p=c,b=f,g=u,x=d,c=f=u=d=0,R(),G=requestAnimationFrame(V)},y=n.windows.filter((S,k,N)=>S&&N.indexOf(S)===k);for(const S of y)n.keyboard!==!1&&(S.addEventListener("keydown",r),S.addEventListener("keyup",i)),S.addEventListener("blur",o);return a.addEventListener("pointermove",m,!0),a.addEventListener("mousedown",v,!0),window.addEventListener("mouseup",_,!0),a.addEventListener("wheel",M,{passive:!0,capture:!0}),a.addEventListener("contextmenu",P,!0),typeof requestAnimationFrame=="function"&&(G=requestAnimationFrame(V)),{inputKey:(S,k)=>k>=0&&S.startsWith("Gamepad")?t.has(S+"@"+k):t.has(S),inputRead:S=>{var k;switch(S){case 0:return h;case 1:return l;case 2:return p;case 3:return b;case 4:return g;case 5:return x;case 6:return document.pointerLockElement===a?1:0;case 7:{let N=0;for(let C=0;C<Rt;C++)I[C]&&N++;return N}}if(S>=zt){const N=Math.floor((S-zt)/Be),C=(S-zt)%Be;return N>=Rt||!I[N]?0:C===0?1:((k=F[N])==null?void 0:k[C-1])??0}return 0},inputSetPointerLock:S=>{if(!S)return document.pointerLockElement===a&&document.exitPointerLock(),!0;if(document.pointerLockElement===a)return!0;if(typeof a.requestPointerLock!="function")return!1;try{const k=a.requestPointerLock({unadjustedMovement:!0});return k&&typeof k.catch=="function"&&k.catch(()=>{try{a.requestPointerLock()}catch{}}),!0}catch{return!1}},registerInputEvent:S=>{e=S},dispose:()=>{for(const S of y)S.removeEventListener("keydown",r),S.removeEventListener("keyup",i),S.removeEventListener("blur",o);a.removeEventListener("pointermove",m,!0),a.removeEventListener("mousedown",v,!0),window.removeEventListener("mouseup",_,!0),a.removeEventListener("wheel",M,!0),a.removeEventListener("contextmenu",P,!0),G&&cancelAnimationFrame(G),document.pointerLockElement===a&&document.exitPointerLock(),t.clear(),e=null}}},mi=n=>{const t=gi(n);return t.registerInputEvent(n.push),{table:{key:t.inputKey,read:t.inputRead,setPointerLock:t.inputSetPointerLock,keyboardHeight:n.keyboardHeight},dispose:t.dispose}},yi={createVideo:dr,createAudio:fr,setVolume:pr,setPlaying:gr,setLoop:mr,time:yr,setTime:wr,duration:br,remove:vr},wi=()=>{const n=new Map,t=new Map,e=new Map;let s=1;return{registerService:(u,d,p=1)=>{n.set(u,d),t.set(u,p)},unregisterService:u=>{n.delete(u),t.delete(u)},isServiceSupported:u=>n.has(u),serviceVersion:u=>t.get(u)??0,serviceOpen:(u,d,p)=>{const b=n.get(u);if(!b)return-1;const g=s++,x=b(d?JSON.parse(d):{},{emit:(m,v)=>{v===void 0?p(m):p(m,v)}});return e.set(g,x),g},serviceCall:(u,d,p,b,g)=>{const x=e.get(u);if(!(x!=null&&x.call)){g(`Service call "${d}": no live session or no call handler (serviceId ${u})`);return}try{Promise.resolve(x.call(d,Array.isArray(p)?p:[])).then(m=>{m===void 0?b():b(m)},m=>g(m instanceof Error?m.message:String(m)))}catch(m){g(m instanceof Error?m.message:String(m))}},serviceClose:u=>{var d,p;(p=(d=e.get(u))==null?void 0:d.close)==null||p.call(d),e.delete(u)},destroy:()=>{var u;for(const d of e.values())(u=d.close)==null||u.call(d);e.clear()}}},bi=()=>{const n=wi();return{table:{supported:n.isServiceSupported,version:n.serviceVersion,open:n.serviceOpen,call:n.serviceCall,close:n.serviceClose},registerService:n.registerService,unregisterService:n.unregisterService,dispose:n.destroy}},vi=()=>{const n=[];return{table:{open(e,s){const r=new WebSocket(e);return r.addEventListener("open",()=>s("open")),r.addEventListener("message",i=>s("message",i.data)),r.addEventListener("close",i=>s("close",i.code)),r.addEventListener("error",()=>s("error")),n.push(r),n.length-1},send(e,s){var r;(r=n[e])==null||r.send(s)},close(e){var s;(s=n[e])==null||s.close()}},dispose(){for(const e of n)e.readyState===WebSocket.OPEN&&e.close();n.length=0}}},xi=n=>{const t=e=>`lecodes:${n}:${e}`;return{load(e){try{return window.localStorage.getItem(t(e))}catch{return null}},save(e,s){try{window.localStorage.setItem(t(e),s)}catch{}}}},$e=()=>{const n={};return{global:n,evaluate:e=>{const s=Object.getOwnPropertyNames(n);return new Function(...s,e)(...s.map(r=>n[r]))}}},Si={fetch:Xn,getBuffer:et,getBlob:Ot,putBuffer:ot,putLocalBuffer:Kn,hasLocalBuffer:Jn,getLocalName:Qn,getPlayer:ce,removePlayers:an},Ei=(n,t)=>({nodeFactory(){},setPropertyString(){},setPropertyInt(){},setFlags(){},insertNode(){},removeNode(){},releaseNode(){},openView(e,s,r){n(e,r)},dropView(e,s,r){t(e,r)},closeView(){n(-1,0)},layerOpen(){},layerClose(){},registerFont(e,s,r,i,o){o()},showToast(){},getButtonPressed:()=>!1,getTextValue:()=>"",vlistScroll(){}}),_i=async(n,t={})=>{var Q;const e=t.header,s=t.profile??(e?Js(e):"full"),r=(e==null?void 0:e.preloads)??new Set,i=t.ui!==!1,o=s==="full",a=s==="2d"||s==="full"&&!!(e!=null&&e.is2d),h=Qs(n),{doc:l,win:c}=h,f=i?Promise.all([Ds(void 0,l),Us((e==null?void 0:e.bootFonts)??[],l)]):null,u=o?Gs(h,r.has("capture")):null,d=a?Vs(h):null,p=i?h.newCanvas():null,b=Ks(c,o);o&&zn();const[g,x]=await Promise.all([Cn(s,{glContext:u==null?void 0:u.context,glOptions:u==null?void 0:u.options,gl2dContext:d==null?void 0:d.context,gl2dOptions:d==null?void 0:d.options,moduleArgs:{print:E=>{b.runtimeLine(E)?console.debug(E):console.log(E)},printErr:E=>{console.error(E)}}}),o?li(r):Promise.resolve({})]),m=(E,O)=>{const U=g.stringToNewUTF8(E);try{return O(U)}finally{g._free(U)}};let v=null,_=-1,M=-1;const P=(E,O)=>{M=E,E===Ut&&(u==null||u.show()),E===ke&&(d==null||d.show()),v&&E===Ut&&O!==_&&(_=O,v.openScene(O))},I=E=>{E!==M&&(E===Ut&&(u==null||u.hide(),v&&_>=0&&(_=-1,v.closeScene())),E===ke&&(d==null||d.hide()))},F=Is(),R=p?Es(n,{M:g,canvas:p,canvasHost:F,keyboardHeight:()=>{const E=c.visualViewport;return E?Math.max(0,Math.round((c.innerHeight-E.height-E.offsetTop)/ae(n))):0}}):null;R&&(R.ui.onDestination=P,R.ui.onDropped=I);const z=hi({onOrientation:t.onOrientation,push:(E,O)=>{E==="url"&&O!==void 0&&m(O,U=>g._creatorWebSetLaunchUrl(U)),m(E,U=>{O===void 0?g._creatorWebAppEvent(U,0):m(O,rt=>g._creatorWebAppEvent(U,rt))})}}),G=vi(),V=bi(),y=mi({windows:[...new Set([c,...t.keyboardTargets??[]])],root:n,keyboard:t.keyboard!==!1,push:(E,O,U,rt)=>m(O,wt=>g._creatorWebInputEvent(E,wt,U,rt)),keyboardHeight:()=>(R==null?void 0:R.ui.keyboardHeight())??0}),L={ui:(R==null?void 0:R.ui)??Ei(P,I),app:z.table,device:di(t.language??(()=>(c.navigator.language||"en").slice(0,2))),fetch:fi(x),storage:xi(t.project??(e==null?void 0:e.name)??"app"),socket:G.table,service:V.table,input:y.table,media:yi,canvas:F.table,...u?{gl:u.table(g)}:{},...d?{scene2d:d.table(g)}:{}},A=$e(),H=A.global;Bn(g,{host:L,world:A,newWorld:$e});const Y=Zs({...R?{registerView:(E,O,U)=>R.ui.registerView(E,O,U),unregisterView:E=>R.ui.unregisterView(E)}:{},registerService:V.registerService,unregisterService:V.unregisterService});g._creatorWebInit(),t.launchUrl&&m(t.launchUrl,E=>g._creatorWebSetLaunchUrl(E)),R==null||R.ui.install(),!o&&t.engine3d&&(v=await t.engine3d({newCanvas:h.newCanvas,preloads:r,canvasHost:F,stores:Si}),Object.defineProperty(H,"_creator",{value:v,configurable:!0,writable:!0,enumerable:!1})),o&&(e==null?void 0:e.gl)!=="defer"&&((Q=H._creator)==null||Q.createEngine());const J=ti(n);t.safeArea&&J.set(t.safeArea);const S=E=>{var O;u==null||u.resize(),d==null||d.resize(),(O=v==null?void 0:v._onResize)==null||O.call(v,E.width,E.height,E.factor),R?(R.resize(E.width,E.height,E.factor),R.setSafeArea(J.current())):g._creatorWebResize(E.width,E.height)};h.onResize(S),S(h.size());let k=0;const N=E=>{k=c.requestAnimationFrame(N),u==null||u.frame(),g._creatorWebTick(E),d==null||d.frame(E),R&&(R.ui.layoutFrame(),R.ui.tickHover(),R.render())};k=c.requestAnimationFrame(N),await f;let C=!1;return{profile:s,M:g,world:H,ui:(R==null?void 0:R.ui)??null,engine3d:()=>v,getBuffer:E=>et(E),run(E,O={}){const U=O.header??wn(E);if(!Hs(U.sdk,Ne))throw new Error(`This app was built with LeCodes SDK ${U.sdk??"older than 2.0"}; this host runs SDK ${Ne}. It needs a new build.`);const rt=b.track(E,O.onError);return Y.allow(U.plugins),m(E,wt=>g._creatorWebRun(wt)),{dispose:rt.drop}},registerPlugin:(E,O)=>Y.register(E,O),hasPlugin:Y.has,locate:b.locate,safeArea:()=>J.current(),setSafeArea(E){J.set(E),R==null||R.setSafeArea(J.current())},remeasure:h.remeasure,emitAppEvent:z.emit,destroy(){var E;C||(C=!0,c.cancelAnimationFrame(k),b.dispose(),R==null||R.destroy(),y.dispose(),G.dispose(),V.dispose(),z.dispose(),an(),J.destroy(),(E=v==null?void 0:v._dispose)==null||E.call(v),u==null||u.destroy(),d==null||d.destroy(),h.destroy())}}},Ti=(n,t)=>new Promise(e=>{const s=n.ownerDocument.defaultView??window;s.requestAnimationFrame(()=>{try{const r=[...n.querySelectorAll("canvas")].filter(l=>l.width>0&&l.height>0&&s.getComputedStyle(l).display!=="none");if(r.length===0){e(null);return}const i=n.getBoundingClientRect(),o=t??Math.max(...r.map(l=>l.width))/Math.max(1,i.width),a=n.ownerDocument.createElement("canvas");a.width=Math.max(1,Math.round(i.width*o)),a.height=Math.max(1,Math.round(i.height*o));const h=a.getContext("2d");if(!h){e(null);return}h.fillStyle="#000000",h.fillRect(0,0,a.width,a.height);for(const l of r)h.drawImage(l,0,0,l.width,l.height,0,0,a.width,a.height);e(a.toDataURL("image/png"))}catch{e(null)}})}),ki=n=>{if(typeof n=="string")return n;if(n instanceof Error)return n.stack?`${String(n)}
|
|
19
19
|
${n.stack}`:String(n);try{return JSON.stringify(n)}catch{return String(n)}},Ri=(n,t)=>{const e=o=>{fetch(`${n}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let s=-1;const r=async()=>{try{const{v:o}=await(await fetch(`${n}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(r,2500)};setTimeout(r,2500);const i=()=>{let o;try{o=new WebSocket(n.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:s})),o.onmessage=a=>{let h={};try{h=JSON.parse(String(a.data))}catch{return}h.type==="reload"&&typeof h.v=="number"&&t(h.v)},o.onclose=()=>{setTimeout(i,2e3)}};return i(),{bundleUrl:o=>`${n}/bundle.js?t=web&v=${o}`,versionOf(o,a){const h=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(h)?h:a},ran(o){s=o},log:(o,a)=>e({type:"log",level:o,text:a.map(ki).join(" ")}),error:o=>e({type:"error",text:o})}},Ai={camera:()=>K(()=>import("./assets/camera-5XOM8eHl.js"),[],import.meta.url).then(n=>t=>n.register(t)),geolocation:()=>K(()=>import("./assets/geolocation-BjTKN9_P.js"),[],import.meta.url).then(n=>t=>n.register(t)),map:()=>K(()=>import("./assets/map-XzoOFt0E.js").then(n=>n.m),[],import.meta.url).then(n=>t=>n.register(t,()=>K(()=>import("./assets/map-CyBxOSV0.js"),[],import.meta.url).then(e=>e.resources))),"qr-scanner":()=>K(()=>import("./assets/qr-scanner-CK_cYoJR.js"),[],import.meta.url).then(n=>t=>n.register(t))},Mi=async(n,t)=>{await Promise.all([...t].map(async e=>{const s=Ai[e];if(!(!s||n.hasPlugin(e)))try{n.registerPlugin(e,await s())}catch(r){console.warn(`[lecodes] the "${e}" plugin failed to load: ${r instanceof Error?r.message:String(r)}`)}}))},le=n=>typeof n=="object"&&n!==null,gt=n=>typeof n=="number"&&Number.isFinite(n),Li=n=>{if(!le(n))return null;switch(n.ask){case"tree":return{ask:"tree"};case"text":return{ask:"text"};case"at":return gt(n.x)&>(n.y)?{ask:"at",x:n.x,y:n.y}:null;case"node":return gt(n.node)?{ask:"node",node:n.node}:null;default:return null}},bn=n=>{if(!le(n))return null;const t=s=>typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.round(s):0,e=Array.isArray(n.bars)?n.bars.filter(s=>s==="top"||s==="right"||s==="bottom"||s==="left"):void 0;return{top:t(n.top),right:t(n.right),bottom:t(n.bottom),left:t(n.left),...e?{bars:e}:{}}},Pi=n=>{const t=n.get("safe-area");if(!t)return null;const[e,s,r,i]=t.split(",").map(Number);return bn({top:e,right:s,bottom:r,left:i,bars:(n.get("bars")??"").split(",")})},Ci=n=>{if(!le(n))return null;switch(n.type){case"lecodes:run":return typeof n.src=="string"?{type:"lecodes:run",src:n.src}:null;case"lecodes:reload":return{type:"lecodes:reload"};case"lecodes:safe-area":return{type:"lecodes:safe-area",insets:bn(n.insets)};case"lecodes:language":return typeof n.language=="string"&&n.language?{type:"lecodes:language",language:n.language}:null;case"lecodes:inspect":{const t=Li(n.question);return t&>(n.request)?{type:"lecodes:inspect",request:n.request,question:t}:null}case"lecodes:capture":{if(!gt(n.request))return null;const t=gt(n.pixelRatio)&&n.pixelRatio>0?Math.min(4,n.pixelRatio):void 0;return{type:"lecodes:capture",request:n.request,...t!==void 0?{pixelRatio:t}:{}}}default:return null}},Oi=(n,t)=>{try{const e=new URL(n,t);return e.origin===new URL(t).origin&&(e.protocol==="http:"||e.protocol==="https:")?e.href:null}catch{return null}},Ii=(n,t)=>{const e=n.parent!==n?n.parent:null,s=r=>{if(!e||r.source!==e)return;const i=Ci(r.data);i&&t(i)};return n.addEventListener("message",s),{embedded:e!==null,post(r){e==null||e.postMessage(r,"*")},close(){n.removeEventListener("message",s)}}},he=window.lecodesPlayerConfig??{},mt=document.getElementById("app"),Xt=document.getElementById("loader"),Ge=document.getElementById("error"),at=new URLSearchParams(location.search),vn=n=>Xt==null?void 0:Xt.classList.toggle("on",n),xn=n=>{Ge&&(Ge.textContent=window.parent===window?n:"")};let se=he.language||at.get("lang")||(navigator.language||"en").slice(0,2),Lt=he.safeArea??Pi(at),W=null;const Ve=()=>{var n;return(n=W==null?void 0:W.world)==null?void 0:n._creatorTree},Pt=at.has("test")?{ready:!1,dump:()=>{var n;return((n=Ve())==null?void 0:n.debugDump())??'{"roots":[]}'},rect:n=>{var s;const t=(s=Ve())==null?void 0:s.getBoundingClientRect(n);if(!t)return null;const e=mt.getBoundingClientRect();return[e.left+t[0],e.top+t[1],t[2],t[3]]}}:null;Pt&&(window.lecodesTest=Pt);const Fi=at.has("inspect"),ie=Fi?K(()=>import("./assets/inspect-DdJ50Kun.js"),[],import.meta.url):null;let pt=null;const Ni=async(n,t)=>{const{createInspector:e}=await(ie??K(()=>import("./assets/inspect-DdJ50Kun.js"),[],import.meta.url));W&&pt===null&&(pt=e(W)),nt.post({type:"lecodes:inspected",request:n,answer:(pt==null?void 0:pt.answer(t))??null})},je=at.has("dev")?new URL(at.get("dev")||"..",location.href).href.replace(/\/$/,""):null,ze=n=>{var s;const t=n.frames[0],e=t?`
|
|
20
20
|
at ${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:(s=n.nativeFrames)!=null&&s.length?`
|
|
21
|
-
in ${n.nativeFrames[0]}`:"";return`${n.detail?`${n.message}: ${n.detail}`:n.message}${e}`},Sn=n=>{xn(ze(n)),nt.post({type:"lecodes:error",error:n}),j==null||j.error(ze(n))},En=n=>Sn({message:n,frames:[]});let it=null,Yt=!1,qt=null;const Ui=async n=>{vn(!0),xn(""),W==null||W.destroy(),W=null,pt=null,mt.replaceChildren();const t=await fetch(n.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${n.src} → HTTP ${t.status}`);const e=await t.text(),s=wn(e);W=await _i(mt,{header:s,language:()=>se,launchUrl:location.href,...Lt?{safeArea:Lt}:{},...nt.embedded?{onOrientation:r=>nt.post({type:"lecodes:orientation",mode:r})}:{}}),await Mi(W,s.plugins),ie&&(await ie).recordSites(W),W.run(e,{onError:Sn}),Pt&&(Pt.ready=!0),j&&n.version!==void 0&&(Ct=j.versionOf(t,n.version),j.ran(Ct)),nt.post({type:"lecodes:ready",src:n.src})},ct=n=>{if(Yt){qt=n;return}Yt=!0,it=n,Ui(n).catch(t=>En(t instanceof Error?t.message:String(t))).finally(()=>{vn(!1),Yt=!1;const t=qt;qt=null,t&&ct(t)})},ue=n=>{const t=Oi(n,location.href);t?ct({src:t}):En(`The player runs bundles of its own origin only: ${n}`)},_n=n=>{Lt=n,W==null||W.setSafeArea(Lt)},Tn=async n=>({image:W?await Ti(mt,n):null,width:mt.clientWidth,height:mt.clientHeight}),nt=Ii(window,n=>{switch(n.type){case"lecodes:run":ue(n.src);break;case"lecodes:reload":it&&ct(it);break;case"lecodes:safe-area":_n(n.insets);break;case"lecodes:inspect":Ni(n.request,n.question);break;case"lecodes:capture":Tn(n.pixelRatio).then(t=>nt.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===se)break;se=n.language,it&&ct(it);break}});let Ct=-1;const j=je?Ri(je,n=>{Ct>=0&&n!==Ct&&ct({src:j.bundleUrl(n),version:n})}):null;if(j||nt.embedded){let n=!1;for(const t of["log","warn","error"]){const e=console[t];console[t]=(...s)=>{if(e.apply(console,s),!(n||typeof s[0]=="string"&&s[0].startsWith("[lecodes] "))){n=!0;try{j==null||j.log(t,s),nt.post({type:"lecodes:log",level:t,text:s.map(r=>typeof r=="string"?r:r instanceof Error?String(r):(()=>{try{return JSON.stringify(r)}catch{return String(r)}})()).join(" ")})}finally{n=!1}}}}}window.lecodesPlayer={version:"
|
|
21
|
+
in ${n.nativeFrames[0]}`:"";return`${n.detail?`${n.message}: ${n.detail}`:n.message}${e}`},Sn=n=>{xn(ze(n)),nt.post({type:"lecodes:error",error:n}),j==null||j.error(ze(n))},En=n=>Sn({message:n,frames:[]});let it=null,Yt=!1,qt=null;const Ui=async n=>{vn(!0),xn(""),W==null||W.destroy(),W=null,pt=null,mt.replaceChildren();const t=await fetch(n.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${n.src} → HTTP ${t.status}`);const e=await t.text(),s=wn(e);W=await _i(mt,{header:s,language:()=>se,launchUrl:location.href,...Lt?{safeArea:Lt}:{},...nt.embedded?{onOrientation:r=>nt.post({type:"lecodes:orientation",mode:r})}:{}}),await Mi(W,s.plugins),ie&&(await ie).recordSites(W),W.run(e,{onError:Sn}),Pt&&(Pt.ready=!0),j&&n.version!==void 0&&(Ct=j.versionOf(t,n.version),j.ran(Ct)),nt.post({type:"lecodes:ready",src:n.src})},ct=n=>{if(Yt){qt=n;return}Yt=!0,it=n,Ui(n).catch(t=>En(t instanceof Error?t.message:String(t))).finally(()=>{vn(!1),Yt=!1;const t=qt;qt=null,t&&ct(t)})},ue=n=>{const t=Oi(n,location.href);t?ct({src:t}):En(`The player runs bundles of its own origin only: ${n}`)},_n=n=>{Lt=n,W==null||W.setSafeArea(Lt)},Tn=async n=>({image:W?await Ti(mt,n):null,width:mt.clientWidth,height:mt.clientHeight}),nt=Ii(window,n=>{switch(n.type){case"lecodes:run":ue(n.src);break;case"lecodes:reload":it&&ct(it);break;case"lecodes:safe-area":_n(n.insets);break;case"lecodes:inspect":Ni(n.request,n.question);break;case"lecodes:capture":Tn(n.pixelRatio).then(t=>nt.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===se)break;se=n.language,it&&ct(it);break}});let Ct=-1;const j=je?Ri(je,n=>{Ct>=0&&n!==Ct&&ct({src:j.bundleUrl(n),version:n})}):null;if(j||nt.embedded){let n=!1;for(const t of["log","warn","error"]){const e=console[t];console[t]=(...s)=>{if(e.apply(console,s),!(n||typeof s[0]=="string"&&s[0].startsWith("[lecodes] "))){n=!0;try{j==null||j.log(t,s),nt.post({type:"lecodes:log",level:t,text:s.map(r=>typeof r=="string"?r:r instanceof Error?String(r):(()=>{try{return JSON.stringify(r)}catch{return String(r)}})()).join(" ")})}finally{n=!1}}}}}window.lecodesPlayer={version:"5538554-2026-10-08",get host(){return W},run:ue,reload(){it&&ct(it)},setSafeArea:_n,capture:async n=>(await Tn(n)).image};const Xe=he.src??at.get("src");j?ct({src:j.bundleUrl(0),version:0}):Xe&&ue(Xe);export{K as _};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./basis-C64VHDVD.js","./worker-Caf-yYEI.js","./draco-BiISTFcR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{e as o}from"../lite.js";import{G as i}from"./scene3d-
|
|
2
|
+
import{e as o}from"../lite.js";import{G as i}from"./scene3d-D8LdhX0V.js";let a=null,n=null,c=null;const u=[171,75,84,88,32,50,48,187,13,10,26,10],m=t=>t.length>=12&&u.every((e,r)=>t[r]===e),g=t=>{if(t.byteLength<80)return!0;const e=new DataView(t),r=e.getUint32(48,!0);return r+15>t.byteLength?!0:e.getUint8(r+14)!==1},h=async(t,e)=>(await l(t),c.parseTexture(e));let s=null;const w=async t=>{s??(s=o(async()=>{const{createBasisManager:r}=await import("./basis-C64VHDVD.js");return{createBasisManager:r}},__vite__mapDeps([0,1]),import.meta.url).then(({createBasisManager:r})=>r(null)).catch(r=>{throw s=null,r}));const e=await(await s).parseTexture(t);if(!e||e.isCompressedTexture)throw new Error("KTX2 did not transcode to an image");return e},p=()=>(a??(a=o(async()=>{const{createDracoManager:t}=await import("./draco-BiISTFcR.js");return{createDracoManager:t}},__vite__mapDeps([2,1]),import.meta.url).then(({createDracoManager:t})=>t()).then(t=>{i.setDracoManager(t)}).catch(t=>{throw a=null,t})),a),l=t=>(n??(n=o(async()=>{const{createBasisManager:e}=await import("./basis-C64VHDVD.js");return{createBasisManager:e}},__vite__mapDeps([0,1]),import.meta.url).then(({createBasisManager:e})=>e(t)).then(e=>{c=e,i.setBasisManager(e)}).catch(e=>{throw n=null,e})),n);export{w as decodeKtx2Image,l as ensureBasisTranscoder,p as ensureDracoDecoder,m as isKtx2Bytes,g as ktx2IsSrgb,h as transcodeKtx2};
|