@vincentt-xr/sdk 2.0.0-alpha.6 → 2.0.0-alpha.7
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/GROUNDING.md +81 -3
- package/dist/{DebuggerUI-DYT_dk1E.cjs → DebuggerUI-B6bP6P9r.cjs} +1 -1
- package/dist/{DebuggerUI-C_rbLdkh.js → DebuggerUI-BjOMr8q_.js} +1 -1
- package/dist/{FaceMeshRenderer-D1WsrTLA.cjs → FaceMeshRenderer-C5l6VLdO.cjs} +6 -6
- package/dist/{FaceMeshRenderer-DSCd1H55.js → FaceMeshRenderer-wjAHrJzP.js} +102 -96
- package/dist/{FaceRetouch-DsE0Dbw-.cjs → FaceRetouch-BkJzoA79.cjs} +1 -1
- package/dist/{FaceRetouch-CMJbGThL.js → FaceRetouch-DwbKQJAN.js} +4 -4
- package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +11 -3
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +10 -4
- package/dist/components/FaceMesh/index.d.ts +2 -2
- package/dist/components/SceneObjectRenderer/index.d.ts +9 -2
- package/dist/components/XRMediaSurface/index.d.ts +2 -1
- package/dist/{contexts-DvQI4PqI.js → contexts-ByhzppYl.js} +3 -3
- package/dist/{contexts-h-9TRH0r.cjs → contexts-Dr62It_K.cjs} +1 -1
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui.cjs +1 -1
- package/dist/debug-ui.js +10 -10
- package/dist/entries/core.d.ts +3 -2
- package/dist/entries/face-effects.d.ts +2 -2
- package/dist/entries/tracking.d.ts +2 -0
- package/dist/face-effects.cjs +1 -1
- package/dist/face-effects.js +25 -24
- package/dist/{getFaceInfo-B43Cwq4n.js → getFaceInfo-C4QpCQIY.js} +1 -1
- package/dist/{getFaceInfo-DEzcL_Ub.cjs → getFaceInfo-fA1bFBub.cjs} +1 -1
- package/dist/hooks/useXRSession/facade.d.ts +2 -0
- package/dist/{index-I4eF5TKT.js → index-9dlAQAhy.js} +405 -400
- package/dist/{index-CY7Z8cHV.cjs → index-BjmTe9eM.cjs} +1 -1
- package/dist/{index-D67hHm44.cjs → index-BpEf2BBb.cjs} +1 -1
- package/dist/{index-B-s4YbWu.js → index-ByoNj0QP.js} +1 -1
- package/dist/{index-CxMEeCRP.cjs → index-CyUUurQT.cjs} +1 -1
- package/dist/index-DCiMbxC3.cjs +1 -0
- package/dist/{index-G_5h_FJQ.js → index-DXT3WccE.js} +808 -787
- package/dist/index-DpI-qo5X.cjs +17 -0
- package/dist/{index-DYfY9ljy.js → index-DyVF4vEW.js} +1 -1
- package/dist/{index-uE3sKczj.js → index-VJ0SJwmG.js} +1 -1
- package/dist/{internal-MvKrz0Nt.cjs → internal-Cq-TEQ5Y.cjs} +1 -1
- package/dist/{internal-ldPYiUF0.js → internal-Dmk1cTXq.js} +3 -3
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +1 -1
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +344 -330
- package/dist/main.cjs +1 -1
- package/dist/main.js +94 -91
- package/dist/{renderGroups-BJsx32q5.cjs → renderGroups-80H3DpTl.cjs} +1 -1
- package/dist/{renderGroups-CFt1yYLB.js → renderGroups-KZk6eRiY.js} +1 -1
- package/dist/{renderPasses-D-Krl6D0.cjs → renderPasses-BOoBSr8z.cjs} +1 -1
- package/dist/{renderPasses-C72MbZ-a.js → renderPasses-BcquyVtu.js} +4 -4
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screen2d/coordinates.d.ts +20 -0
- package/dist/{selectors-ByKNTXeA.js → selectors-B8H97CKA.js} +1 -1
- package/dist/{selectors-CAwmL9VW.cjs → selectors-CZLKT2Iv.cjs} +1 -1
- package/dist/{session-CANvoLD6.cjs → session-CpkiK5YA.cjs} +1 -1
- package/dist/{session-Dhi0OqZo.js → session-DLFN_VII.js} +1 -1
- package/dist/tracking/coordinates.d.ts +5 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +69 -66
- package/dist/types/common.d.ts +11 -1
- package/dist/types/gesture-tracking.d.ts +2 -2
- package/dist/types/hand-tracking.d.ts +3 -3
- package/dist/types/nodes.d.ts +2 -2
- package/dist/types/session.d.ts +7 -1
- package/dist/{useFaceInfo-BSZq7AO1.cjs → useFaceInfo-BJ8-_MOs.cjs} +1 -1
- package/dist/{useFaceInfo-FVQBBNdY.js → useFaceInfo-Dk426LTu.js} +3 -3
- package/dist/{useFaceResults-D62STzT1.js → useFaceResults-CtetsO9M.js} +1 -1
- package/dist/{useFaceResults-C3oZkn2Z.cjs → useFaceResults-wBJF3zyp.cjs} +1 -1
- package/docs/SDK_DOCUMENTATION.md +3 -0
- package/docs/api/capture-recording.mdx +9 -1
- package/docs/api/face-mesh.mdx +33 -0
- package/docs/api/runtime-3d.mdx +5 -0
- package/docs/api/screen-image.mdx +3 -1
- package/docs/api/screen-space-coordinates.mdx +31 -0
- package/docs/api/trackers.mdx +13 -0
- package/package.json +4 -1
- package/dist/index-C0-fg1Hk.cjs +0 -1
- package/dist/index-DPPpU5By.cjs +0 -17
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { FaceMesh, FACE_LANDMARK_Z_SCALE_FACTOR } from './FaceMesh';
|
|
2
2
|
export { CanonicalFaceMeshRenderer } from './canonical/CanonicalFaceMeshRenderer';
|
|
3
|
-
export type { CanonicalFaceMeshRendererProps } from './canonical/CanonicalFaceMeshRenderer';
|
|
3
|
+
export type { CanonicalFaceMeshRendererProps, FaceMeshMaterialOverride, FaceMeshMaterialOverrideContext, } from './canonical/CanonicalFaceMeshRenderer';
|
|
4
4
|
export { FaceMeshMaterial } from './canonical/FaceMeshMaterial';
|
|
5
5
|
export type { FaceMeshMaterialProps } from './canonical/FaceMeshMaterial';
|
|
6
|
-
export { DEFAULT_FACE_MESH_TRANSFORM, DEFAULT_FACE_MESH_RENDERER, FaceMeshRenderer, mapFaceMeshRendererSettingsToProps, resolveFaceMeshRendererSettings, type FaceMeshRendererSettings, } from './FaceMeshRenderer';
|
|
6
|
+
export { DEFAULT_FACE_MESH_TRANSFORM, DEFAULT_FACE_MESH_RENDERER, FaceMeshRenderer, mapFaceMeshRendererProps, mapFaceMeshRendererSettingsToProps, resolveFaceMeshRendererSettings, type FaceMeshRendererSettings, type FaceMeshRendererProps, } from './FaceMeshRenderer';
|
|
7
7
|
export { useCanonicalFaceMesh } from './canonical/useCanonicalFaceMesh';
|
|
8
8
|
export { canonicalFaceAlphaMaskUrl, canonicalFaceTextureStyle2Url, canonicalFaceTextureUrl, } from './canonical/assets';
|
|
9
9
|
export { parseCanonicalFaceModel, type ParsedCanonicalMesh, } from './canonical/parseCanonicalFaceModel';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FaceMeshMaterialOverride } from '../FaceMesh';
|
|
3
|
+
import { SceneComponent, SceneComponentId, SceneObjectId, SceneObjectStore } from '../../scene-object';
|
|
3
4
|
export type SceneObjectRendererProps = {
|
|
4
5
|
objectId: SceneObjectId;
|
|
5
6
|
store: SceneObjectStore;
|
|
@@ -12,5 +13,11 @@ export type SceneObjectRendererProps = {
|
|
|
12
13
|
fallback?: (message: string) => ReactNode;
|
|
13
14
|
/** Internal: descendants already share an ancestor ScreenSpaceUI plane. */
|
|
14
15
|
insideScreenSpaceUI?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Runtime-only material overrides keyed by FaceMeshRenderer component ID.
|
|
18
|
+
* These are deliberately separate from SceneObjectStore so Three.js
|
|
19
|
+
* materials and shader factories never enter serialized scene data.
|
|
20
|
+
*/
|
|
21
|
+
faceMeshMaterialOverrides?: Readonly<Partial<Record<SceneComponentId, FaceMeshMaterialOverride>>>;
|
|
15
22
|
};
|
|
16
|
-
export declare const SceneObjectRenderer: ({ editorMode, fallback, insideScreenSpaceUI, objectId, onComponentChange, renderLayer, renderOrder, store, }: SceneObjectRendererProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export declare const SceneObjectRenderer: ({ editorMode, faceMeshMaterialOverrides, fallback, insideScreenSpaceUI, objectId, onComponentChange, renderLayer, renderOrder, store, }: SceneObjectRendererProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { XRLayerConfig, XRMediaLayout, XRMediaSourceKind } from '../../types/compositor';
|
|
3
|
-
export declare const XRMediaSurface: ({ canvasRef, imageRef, layer, layout, mirrored, sourceKind, videoRef, }: {
|
|
3
|
+
export declare const XRMediaSurface: ({ canvasRef, imageRef, layer, layout, mirrored, onCaptureTarget, sourceKind, videoRef, }: {
|
|
4
4
|
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
5
5
|
imageRef: RefObject<HTMLImageElement | null>;
|
|
6
6
|
layer: XRLayerConfig;
|
|
7
7
|
layout: XRMediaLayout | null;
|
|
8
8
|
mirrored: boolean;
|
|
9
|
+
onCaptureTarget?: (canvas: HTMLCanvasElement | undefined) => void;
|
|
9
10
|
sourceKind: XRMediaSourceKind;
|
|
10
11
|
videoRef: RefObject<HTMLVideoElement | null>;
|
|
11
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,9 +6,9 @@ import { Canvas as ye, useThree as _e, useFrame as Se } from "@react-three/fiber
|
|
|
6
6
|
import { useRef as J, useState as Ee, useEffect as Q, useMemo as ne, useContext as fe, createContext as ve } from "react";
|
|
7
7
|
import * as D from "three";
|
|
8
8
|
import { R as pe } from "./renderLayers-zrK2pv5O.js";
|
|
9
|
-
import { a as Re, b as Te } from "./selectors-
|
|
10
|
-
import { u as xe } from "./index-
|
|
11
|
-
import { u as ke, S as Fe } from "./index-
|
|
9
|
+
import { a as Re, b as Te } from "./selectors-B8H97CKA.js";
|
|
10
|
+
import { u as xe } from "./index-9dlAQAhy.js";
|
|
11
|
+
import { u as ke, S as Fe } from "./index-VJ0SJwmG.js";
|
|
12
12
|
const ue = {
|
|
13
13
|
display: "flex",
|
|
14
14
|
alignItems: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ee=Object.defineProperty;var Te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>Te(e,typeof t!="symbol"?t+"":t,n);const B=require("react/jsx-runtime"),ne=require("@react-three/fiber"),A=require("react"),Fe=require("three"),fe=require("./renderLayers-lDtL0_43.cjs"),ie=require("./selectors-CAwmL9VW.cjs"),ue=require("./index-C0-fg1Hk.cjs"),se=require("./index-CY7Z8cHV.cjs");function Me(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=Me(Fe),xe={display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#363636",color:"white",fontFamily:"monospace"},Ae=()=>B.jsx("div",{style:xe,children:"Loading..."}),Ce=e=>B.jsx("div",{style:xe,children:e.error}),le={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10},ce={sceneColorTexture:null,sceneDepthTexture:null},ke=({onRenderOutputs:e,renderOutputs:t,size:n})=>{const{gl:a,scene:r,size:s}=ne.useThree(),{session:c}=ue.useXRContext(),i=Math.max(1,Math.round((n==null?void 0:n.width)??s.width)),d=Math.max(1,Math.round((n==null?void 0:n.height)??s.height)),f=!!(t.sceneColor||t.sceneDepth),l=A.useMemo(()=>{if(!f)return null;const o=new U.WebGLRenderTarget(i,d,{colorSpace:U.SRGBColorSpace,depthBuffer:!0,stencilBuffer:!1});return t.sceneDepth&&(o.depthTexture=new U.DepthTexture(i,d),o.depthTexture.format=U.DepthFormat,o.depthTexture.type=U.UnsignedShortType),o},[f,d,t.sceneDepth,i]);return A.useEffect(()=>{if(!l){e==null||e(ce);return}return e==null||e({sceneColorTexture:t.sceneColor?l.texture:null,sceneDepthTexture:t.sceneDepth&&l.depthTexture?l.depthTexture:null}),()=>{var o;l.dispose(),(o=l.depthTexture)==null||o.dispose(),e==null||e(ce)}},[e,t.sceneColor,t.sceneDepth,l]),ne.useFrame(()=>{if(!l)return;const o=[];t.excludeScreenUI!==!1&&r.traverse(x=>{x.visible&&x.renderOrder>=fe.RENDER_LAYERS.SCREEN_UI&&(o.push(x),x.visible=!1)});const p=a.getRenderTarget(),v=a.xr.enabled;a.xr.enabled=!1,a.setRenderTarget(l),a.clear(),c._renderFrame(),a.setRenderTarget(p),a.xr.enabled=v,o.forEach(x=>{x.visible=!0})},-100),null},Ie=({style:e,canvasProps:t,children:n,loadingComponent:a,loadingTransitionDuration:r,errorComponent:s,renderTargetSize:c,renderOutputs:i={},onRenderOutputs:d})=>{const f=A.useRef(null),l=A.useRef(null),o=A.useRef(null),p=A.useRef(!1),{session:v}=ue.useXRContext(),x=ie.useXRReady(),u=ie.useXRError(),[h,g]=A.useState(!0);return A.useEffect(()=>{if(c){v._setRenderSize(Math.round(c.width),Math.round(c.height));return}const S=(w,E)=>{w<=0||E<=0||v._setRenderSize(Math.round(w),Math.round(E))},m=()=>{!l.current||p.current||(p.current=!0,v._setRenderTarget(l.current))},M=(w,E)=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{o.current=null,S(w,E)})},_=new ResizeObserver(w=>{const E=w[0];if(!E)return;const{width:G,height:I}=E.contentRect;m(),M(G,I)});return f.current&&_.observe(f.current),m(),()=>{_.disconnect(),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null),p.current=!1}},[c,v]),A.useEffect(()=>{x&&(r?setTimeout(()=>{g(!1)},r):g(!1))},[x,r]),B.jsxs("div",{id:"vincentt-xr-container",ref:f,style:{width:"100%",height:"100%",...e,position:"relative"},children:[h&&B.jsx("div",{style:le,children:a||B.jsx(Ae,{})}),u&&B.jsx("div",{style:le,children:s||B.jsx(Ce,{error:u.message})}),B.jsxs(ne.Canvas,{id:"vincentt-xr-canvas",ref:l,dpr:[1,3],gl:{alpha:!0,preserveDrawingBuffer:!1,antialias:!0,stencil:!0,premultipliedAlpha:!1,toneMapping:U.NoToneMapping},...t,onCreated:S=>{c?v._setRenderSize(Math.round(c.width),Math.round(c.height)):v._setRenderTarget(l.current),v._setR3FState({renderer:S.gl,scene:S.scene,camera:S.camera}),S.gl.outputColorSpace=U.SRGBColorSpace,t!=null&&t.onCreated&&t.onCreated(S)},children:[B.jsx(ke,{onRenderOutputs:d,renderOutputs:i,size:c}),n]})]})},ve=(e,t,n,a,r)=>{const s=e/2,c=t/2,i=n.left*s+a.left,d=n.right*s-a.right,f=n.bottom*c+a.bottom,l=n.top*c-a.top,o=d-i,p=l-f,v=(i+d)/2,x=(f+l)/2,u=r[0]*o/2,h=r[1]*p/2;return{centerX:v,centerY:x,width:o,height:p,pivotX:u,pivotY:h}},Le={left:0,right:0,top:0,bottom:0},Be={left:0,right:0,top:0,bottom:0},Ge=[0,0],Xe=({anchors:e,offsets:t,pivot:n=Ge,children:a})=>{const{width:r,height:s}=se.useScreenSpace(),c=A.useMemo(()=>({anchors:{...Le,...e??{}},offsets:{...Be,...t??{}}}),[e,t]),i=A.useMemo(()=>ve(r,s,c.anchors,c.offsets,n),[r,s,c,n]);A.useEffect(()=>{const o=c.anchors;o.left>o.right&&console.warn(`[ScreenTransform] inverted X axis: anchors.left (${o.left}) > anchors.right (${o.right})`),o.bottom>o.top&&console.warn(`[ScreenTransform] inverted Y axis: anchors.bottom (${o.bottom}) > anchors.top (${o.top})`),i.width<=0&&console.warn(`[ScreenTransform] zero or negative width (${i.width.toFixed(3)}) — anchors + offsets collapse the X extent`),i.height<=0&&console.warn(`[ScreenTransform] zero or negative height (${i.height.toFixed(3)}) — anchors + offsets collapse the Y extent`)},[c,i.width,i.height]);const d=n[0]!==0||n[1]!==0,f=d?[1,1,1]:[i.width,i.height,1],l=!d&&i.width>0&&i.height>0?i.width/i.height:null;return B.jsx("group",{position:[i.centerX-i.pivotX,i.centerY-i.pivotY,0],scale:f,renderOrder:fe.RENDER_LAYERS.SCREEN_UI,children:B.jsx(se.ScreenRectAspectContext.Provider,{value:l,children:a})})};class pe{constructor(t,n){O(this,"capabilities");O(this,"snapshot");O(this,"listeners",new Set);O(this,"eventListeners",new Map);this.capabilities=t,this.snapshot={state:"idle",frame:0,time:0,playMode:"forward",loop:!0,loopCount:0,...n}}play(){const t=this.snapshot.state==="paused";this.update({state:"playing"}),this.emit(t?"Resume":"PlayBegin")}pause(){this.update({state:"paused"}),this.emit("Pause")}restart(){this.update({state:"playing",frame:0,time:0}),this.emit("PlayBegin")}setPlayMode(t){!this.capabilities.canReverse&&(t==="reverse"||t==="ping-pong"||t==="random")||this.update({playMode:t})}setLoop(t,n=0){this.update({loop:t,loopCount:n})}seek(t){this.capabilities.canSeek&&this.update({frame:Math.max(0,Math.floor(t)),time:Math.max(0,t)})}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}on(t,n){const a=this.eventListeners.get(t)??new Set;return a.add(n),this.eventListeners.set(t,a),()=>this.off(t,n)}off(t,n){var a;(a=this.eventListeners.get(t))==null||a.delete(n)}getSnapshot(){return this.snapshot}dispose(){this.listeners.clear(),this.eventListeners.clear(),this.snapshot={...this.snapshot,state:"idle"}}updateSnapshot(t){this.update(t)}emit(t){var n;(n=this.eventListeners.get(t))==null||n.forEach(a=>a({type:t,snapshot:this.snapshot}))}update(t){this.snapshot={...this.snapshot,...t},this.listeners.forEach(n=>n(this.snapshot))}}const ge=(e,t,n,a,r)=>{const s=Math.max(1,Math.floor(t)),c=Math.max(0,Math.floor(e)),i=n==="ping-pong"&&s>1?s*2-2:s,d=Math.floor(c/i),f=r>0?d>=r:!a&&c>=i,l=f?i-1:c%i;return{frame:n==="reverse"?s-1-l%s:n==="random"?l*7919%s:n==="ping-pong"&&l>=s?i-l:l,ended:f,loop:d}},De=(e,t,n)=>{const a=Math.max(1,Math.floor(n));return Math.floor(Math.max(0,e)*Math.max(0,t))%a};var he={},me,Ue;function je(e,t,n,s){var r=0,s=s===void 0?{}:s,c=s.loop===void 0?null:s.loop,i=s.palette===void 0?null:s.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function d(h){var g=h.length;if(g<2||g>256||g&g-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return g}e[r++]=71,e[r++]=73,e[r++]=70,e[r++]=56,e[r++]=57,e[r++]=97;var f=0,l=0;if(i!==null){for(var o=d(i);o>>=1;)++f;if(o=1<<f,--f,s.background!==void 0){if(l=s.background,l>=o)throw new Error("Background index out of range.");if(l===0)throw new Error("Background index explicitly passed as 0.")}}if(e[r++]=t&255,e[r++]=t>>8&255,e[r++]=n&255,e[r++]=n>>8&255,e[r++]=(i!==null?128:0)|f,e[r++]=l,e[r++]=0,i!==null)for(var p=0,v=i.length;p<v;++p){var x=i[p];e[r++]=x>>16&255,e[r++]=x>>8&255,e[r++]=x&255}if(c!==null){if(c<0||c>65535)throw new Error("Loop count invalid.");e[r++]=33,e[r++]=255,e[r++]=11,e[r++]=78,e[r++]=69,e[r++]=84,e[r++]=83,e[r++]=67,e[r++]=65,e[r++]=80,e[r++]=69,e[r++]=50,e[r++]=46,e[r++]=48,e[r++]=3,e[r++]=1,e[r++]=c&255,e[r++]=c>>8&255,e[r++]=0}var u=!1;this.addFrame=function(h,g,S,m,M,_){if(u===!0&&(--r,u=!1),_=_===void 0?{}:_,h<0||g<0||h>65535||g>65535)throw new Error("x/y invalid.");if(S<=0||m<=0||S>65535||m>65535)throw new Error("Width/Height invalid.");if(M.length<S*m)throw new Error("Not enough pixels for the frame size.");var w=!0,E=_.palette;if(E==null&&(w=!1,E=i),E==null)throw new Error("Must supply either a local or global palette.");for(var G=d(E),I=0;G>>=1;)++I;G=1<<I;var j=_.delay===void 0?0:_.delay,R=_.disposal===void 0?0:_.disposal;if(R<0||R>3)throw new Error("Disposal out of range.");var T=!1,k=0;if(_.transparent!==void 0&&_.transparent!==null&&(T=!0,k=_.transparent,k<0||k>=G))throw new Error("Transparent color index.");if((R!==0||T||j!==0)&&(e[r++]=33,e[r++]=249,e[r++]=4,e[r++]=R<<2|(T===!0?1:0),e[r++]=j&255,e[r++]=j>>8&255,e[r++]=k,e[r++]=0),e[r++]=44,e[r++]=h&255,e[r++]=h>>8&255,e[r++]=g&255,e[r++]=g>>8&255,e[r++]=S&255,e[r++]=S>>8&255,e[r++]=m&255,e[r++]=m>>8&255,e[r++]=w===!0?128|I-1:0,w===!0)for(var $=0,L=E.length;$<L;++$){var C=E[$];e[r++]=C>>16&255,e[r++]=C>>8&255,e[r++]=C&255}return r=$e(e,r,I<2?2:I,M),r},this.end=function(){return u===!1&&(e[r++]=59,u=!0),r},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(h){e=h},this.getOutputBufferPosition=function(){return r},this.setOutputBufferPosition=function(h){r=h}}function $e(e,t,n,a){e[t++]=n;var r=t++,s=1<<n,c=s-1,i=s+1,d=i+1,f=n+1,l=0,o=0;function p(_){for(;l>=_;)e[t++]=o&255,o>>=8,l-=8,t===r+256&&(e[r]=255,r=t++)}function v(_){o|=_<<l,l+=f,p(8)}var x=a[0]&c,u={};v(s);for(var h=1,g=a.length;h<g;++h){var S=a[h]&c,m=x<<8|S,M=u[m];if(M===void 0){for(o|=x<<l,l+=f;l>=8;)e[t++]=o&255,o>>=8,l-=8,t===r+256&&(e[r]=255,r=t++);d===4096?(v(s),d=i+1,f=n+1,u={}):(d>=1<<f&&++f,u[m]=d++),x=S}else x=M}return v(x),v(i),p(1),r+1===t?e[r]=0:(e[r]=t-r-1,e[t++]=0),t}function Pe(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!==56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,a=e[t++]|e[t++]<<8,r=e[t++],s=r>>7,c=r&7,i=1<<c+1;e[t++],e[t++];var d=null,f=null;s&&(d=t,f=i,t+=i*3);var l=!0,o=[],p=0,v=null,x=0,u=null;for(this.width=n,this.height=a;l&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,u=e[t++]|e[t++]<<8,t++;else for(t+=12;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var g=e[t++];p=e[t++]|e[t++]<<8,v=e[t++],g&1||(v=null),x=g>>2&7,t++;break;case 254:for(;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var S=e[t++]|e[t++]<<8,m=e[t++]|e[t++]<<8,M=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++],E=w>>7,G=w>>6&1,I=w&7,j=1<<I+1,R=d,T=f,k=!1;if(E){var k=!0;R=t,T=j,t+=j*3}var $=t;for(t++;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}o.push({x:S,y:m,width:M,height:_,has_local_palette:k,palette_offset:R,palette_size:T,data_offset:$,data_length:t-$,transparent_index:v,interlaced:!!G,delay:p,disposal:x});break;case 59:l=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return o.length},this.loopCount=function(){return u},this.frameInfo=function(L){if(L<0||L>=o.length)throw new Error("Frame index out of range.");return o[L]},this.decodeAndBlitFrameBGRA=function(L,C){var y=this.frameInfo(L),Z=y.width*y.height,P=new Uint8Array(Z);de(e,y.data_offset,P,Z);var q=y.palette_offset,W=y.transparent_index;W===null&&(W=256);var X=y.width,N=n-X,Y=X,K=(y.y*n+y.x)*4,Q=((y.y+y.height)*n+y.x)*4,F=K,V=N*4;y.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,b=P.length;z<b;++z){var D=P[z];if(Y===0&&(F+=V,Y=X,F>=Q&&(V=N*4+n*4*(H-1),F=K+(X+N)*(H<<1),H>>=1)),D===W)F+=4;else{var ee=e[q+D*3],te=e[q+D*3+1],re=e[q+D*3+2];C[F++]=re,C[F++]=te,C[F++]=ee,C[F++]=255}--Y}},this.decodeAndBlitFrameRGBA=function(L,C){var y=this.frameInfo(L),Z=y.width*y.height,P=new Uint8Array(Z);de(e,y.data_offset,P,Z);var q=y.palette_offset,W=y.transparent_index;W===null&&(W=256);var X=y.width,N=n-X,Y=X,K=(y.y*n+y.x)*4,Q=((y.y+y.height)*n+y.x)*4,F=K,V=N*4;y.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,b=P.length;z<b;++z){var D=P[z];if(Y===0&&(F+=V,Y=X,F>=Q&&(V=N*4+n*4*(H-1),F=K+(X+N)*(H<<1),H>>=1)),D===W)F+=4;else{var ee=e[q+D*3],te=e[q+D*3+1],re=e[q+D*3+2];C[F++]=ee,C[F++]=te,C[F++]=re,C[F++]=255}--Y}}}function de(e,t,n,a){for(var r=e[t++],s=1<<r,c=s+1,i=c+1,d=r+1,f=(1<<d)-1,l=0,o=0,p=0,v=e[t++],x=new Int32Array(4096),u=null;;){for(;l<16&&v!==0;)o|=e[t++]<<l,l+=8,v===1?v=e[t++]:--v;if(l<d)break;var h=o&f;if(o>>=d,l-=d,h===s){i=c+1,d=r+1,f=(1<<d)-1,u=null;continue}else if(h===c)break;for(var g=h<i?h:u,S=0,m=g;m>s;)m=x[m]>>8,++S;var M=m,_=p+S+(g!==h?1:0);if(_>a){console.log("Warning, gif stream longer than expected.");return}n[p++]=M,p+=S;var w=p;for(g!==h&&(n[p++]=M),m=g;S--;)m=x[m],n[--w]=m&255,m>>=8;u!==null&&i<4096&&(x[i++]=u<<8|M,i>=f+1&&d<12&&(++d,f=f<<1|1)),u=h}return p!==a&&console.log("Warning, gif stream shorter than expected."),n}try{Ue=he.GifWriter=je,me=he.GifReader=Pe}catch{}const qe=me;function We(e){return async(t,n)=>{const a=e.find(r=>r.canResolve(t));if(!a)throw new we("No texture provider matched source",t);return Se(a.resolve.bind(a),t,n)}}class we extends Error{constructor(n,a){super(n);O(this,"source");this.name="TextureSourceLoadError",this.source=a}}function J(e){if(e.aborted)throw new DOMException("Texture source load aborted","AbortError")}async function Se(e,t,n){J(n);const a=await e(t,n);return n.aborted&&(a.dispose(),J(n)),a}function Ne(e){e==null||e.dispose()}const _e=5*1024*1024,ae=1e6,oe=180,Ye=(e,t,n)=>{for(let a=n.y;a<n.y+n.height;a+=1)e.fill(0,(a*t+n.x)*4,(a*t+n.x+n.width)*4)},Ve=(e,t,n,a,r)=>t.byteLength>_e?`file is ${(t.byteLength/1024/1024).toFixed(1)} MB; max is 5 MB`:n*a>ae?`canvas is ${n}x${a}; max area is ${ae}`:r>oe?`frame count is ${r}; max is ${oe}`:r===0?"frame count is 0":e?null:"source URL is empty",He=e=>typeof e=="string"?e:e.src,ze={canResolve:e=>typeof e=="string"?/\.gif(?:[?#].*)?$/i.test(e):e.kind==="gif",async resolve(e,t){const n=He(e),a=await fetch(n,{signal:t});if(!a.ok)throw new Error(`GIF request failed with ${a.status}`);const r=new Uint8Array(await a.arrayBuffer());J(t);const s=new qe(r),c=s.numFrames(),i=Ve(n,r,s.width,s.height,c);if(i)throw console.warn(`[xr-sdk] GIF ScreenImage source rejected: ${i}`,n),new Error(`GIF source rejected: ${i}`);const d=document.createElement("canvas");d.width=s.width,d.height=s.height;const f=d.getContext("2d");if(!f)throw new Error("Could not create GIF canvas context");const l=new U.CanvasTexture(d);l.colorSpace=U.SRGBColorSpace;const o=new Uint8Array(s.width*s.height*4),p=new ImageData(new Uint8ClampedArray(o.buffer),s.width,s.height),v=Array.from({length:c},(R,T)=>s.frameInfo(T)),x=v.reduce((R,T)=>R+Math.max(20,T.delay*10),0)/1e3,u=new pe({canSeek:!1,canReverse:!1,supportsLoopCount:!0},{state:"ready",duration:x,frameCount:c});let h=0,g=0,S=!1,m=!1,M=0,_=0,w=null;const E=(R,T=!1)=>{T&&(o.fill(0),w=null),(w==null?void 0:w.info.disposal)===2?Ye(o,s.width,w.info):w!=null&&w.restorePixels&&o.set(w.restorePixels);const k=v[R],$=k.disposal===3?new Uint8Array(o):null;return s.decodeAndBlitFrameRGBA(R,o),f.putImageData(p,0,0),l.needsUpdate=!0,w={info:k,restorePixels:$},m=!0,u.updateSnapshot({frame:R,time:v.slice(0,R).reduce((L,C)=>L+Math.max(20,C.delay*10),0)/1e3}),m=!1,u.emit("KeyFrameInSecond"),Math.max(20,k.delay*10)},G=R=>{g=window.setTimeout(()=>{h=requestAnimationFrame(I)},R)},I=()=>{if(S||u.getSnapshot().state!=="playing")return;const R=u.getSnapshot(),T=ge(M,c,R.playMode,R.loop,R.loopCount);if(T.ended){u.updateSnapshot({state:"ended",frame:T.frame,time:x}),u.emit("PlayEnd");return}const k=T.loop!==_;_=T.loop,M+=1,G(E(T.frame,k))},j=u.subscribe(R=>{m||(clearTimeout(g),cancelAnimationFrame(h),R.state==="playing"&&(h=requestAnimationFrame(I)))});return E(0),u.play(),{texture:l,controller:u,metadata:{width:s.width,height:s.height,duration:x,frameCount:c},dispose(){S=!0,j(),clearTimeout(g),cancelAnimationFrame(h),u.dispose(),l.dispose()}}}},ye=A.createContext(null),Re=A.createContext(null),Oe=()=>A.useContext(ye),Ze=()=>A.useContext(Re);exports.BasicAnimatedTextureController=pe;exports.MAX_GIF_BYTES=_e;exports.MAX_GIF_FRAMES=oe;exports.MAX_GIF_PIXELS=ae;exports.ScreenTransform=Xe;exports.TextureSourceLoadError=we;exports.XRScene=Ie;exports.XRViewportRenderOutputsContext=Re;exports.XRViewportStateContext=ye;exports.computeScreenTransform=ve;exports.createTextureSourceResolver=We;exports.disposeResolvedTextureSource=Ne;exports.getPlaybackFrame=ge;exports.getSequenceFrame=De;exports.gifTextureSourceProvider=ze;exports.resolveTextureSource=Se;exports.throwIfAborted=J;exports.useXRViewportRenderOutputs=Ze;exports.useXRViewportState=Oe;
|
|
1
|
+
"use strict";var Ee=Object.defineProperty;var Te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>Te(e,typeof t!="symbol"?t+"":t,n);const B=require("react/jsx-runtime"),ne=require("@react-three/fiber"),A=require("react"),Fe=require("three"),fe=require("./renderLayers-lDtL0_43.cjs"),ie=require("./selectors-CZLKT2Iv.cjs"),ue=require("./index-DCiMbxC3.cjs"),se=require("./index-BjmTe9eM.cjs");function Me(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=Me(Fe),xe={display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#363636",color:"white",fontFamily:"monospace"},Ae=()=>B.jsx("div",{style:xe,children:"Loading..."}),Ce=e=>B.jsx("div",{style:xe,children:e.error}),le={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10},ce={sceneColorTexture:null,sceneDepthTexture:null},ke=({onRenderOutputs:e,renderOutputs:t,size:n})=>{const{gl:a,scene:r,size:s}=ne.useThree(),{session:c}=ue.useXRContext(),i=Math.max(1,Math.round((n==null?void 0:n.width)??s.width)),d=Math.max(1,Math.round((n==null?void 0:n.height)??s.height)),f=!!(t.sceneColor||t.sceneDepth),l=A.useMemo(()=>{if(!f)return null;const o=new U.WebGLRenderTarget(i,d,{colorSpace:U.SRGBColorSpace,depthBuffer:!0,stencilBuffer:!1});return t.sceneDepth&&(o.depthTexture=new U.DepthTexture(i,d),o.depthTexture.format=U.DepthFormat,o.depthTexture.type=U.UnsignedShortType),o},[f,d,t.sceneDepth,i]);return A.useEffect(()=>{if(!l){e==null||e(ce);return}return e==null||e({sceneColorTexture:t.sceneColor?l.texture:null,sceneDepthTexture:t.sceneDepth&&l.depthTexture?l.depthTexture:null}),()=>{var o;l.dispose(),(o=l.depthTexture)==null||o.dispose(),e==null||e(ce)}},[e,t.sceneColor,t.sceneDepth,l]),ne.useFrame(()=>{if(!l)return;const o=[];t.excludeScreenUI!==!1&&r.traverse(x=>{x.visible&&x.renderOrder>=fe.RENDER_LAYERS.SCREEN_UI&&(o.push(x),x.visible=!1)});const p=a.getRenderTarget(),v=a.xr.enabled;a.xr.enabled=!1,a.setRenderTarget(l),a.clear(),c._renderFrame(),a.setRenderTarget(p),a.xr.enabled=v,o.forEach(x=>{x.visible=!0})},-100),null},Ie=({style:e,canvasProps:t,children:n,loadingComponent:a,loadingTransitionDuration:r,errorComponent:s,renderTargetSize:c,renderOutputs:i={},onRenderOutputs:d})=>{const f=A.useRef(null),l=A.useRef(null),o=A.useRef(null),p=A.useRef(!1),{session:v}=ue.useXRContext(),x=ie.useXRReady(),u=ie.useXRError(),[h,g]=A.useState(!0);return A.useEffect(()=>{if(c){v._setRenderSize(Math.round(c.width),Math.round(c.height));return}const S=(w,E)=>{w<=0||E<=0||v._setRenderSize(Math.round(w),Math.round(E))},m=()=>{!l.current||p.current||(p.current=!0,v._setRenderTarget(l.current))},M=(w,E)=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{o.current=null,S(w,E)})},_=new ResizeObserver(w=>{const E=w[0];if(!E)return;const{width:G,height:I}=E.contentRect;m(),M(G,I)});return f.current&&_.observe(f.current),m(),()=>{_.disconnect(),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null),p.current=!1}},[c,v]),A.useEffect(()=>{x&&(r?setTimeout(()=>{g(!1)},r):g(!1))},[x,r]),B.jsxs("div",{id:"vincentt-xr-container",ref:f,style:{width:"100%",height:"100%",...e,position:"relative"},children:[h&&B.jsx("div",{style:le,children:a||B.jsx(Ae,{})}),u&&B.jsx("div",{style:le,children:s||B.jsx(Ce,{error:u.message})}),B.jsxs(ne.Canvas,{id:"vincentt-xr-canvas",ref:l,dpr:[1,3],gl:{alpha:!0,preserveDrawingBuffer:!1,antialias:!0,stencil:!0,premultipliedAlpha:!1,toneMapping:U.NoToneMapping},...t,onCreated:S=>{c?v._setRenderSize(Math.round(c.width),Math.round(c.height)):v._setRenderTarget(l.current),v._setR3FState({renderer:S.gl,scene:S.scene,camera:S.camera}),S.gl.outputColorSpace=U.SRGBColorSpace,t!=null&&t.onCreated&&t.onCreated(S)},children:[B.jsx(ke,{onRenderOutputs:d,renderOutputs:i,size:c}),n]})]})},ve=(e,t,n,a,r)=>{const s=e/2,c=t/2,i=n.left*s+a.left,d=n.right*s-a.right,f=n.bottom*c+a.bottom,l=n.top*c-a.top,o=d-i,p=l-f,v=(i+d)/2,x=(f+l)/2,u=r[0]*o/2,h=r[1]*p/2;return{centerX:v,centerY:x,width:o,height:p,pivotX:u,pivotY:h}},Le={left:0,right:0,top:0,bottom:0},Be={left:0,right:0,top:0,bottom:0},Ge=[0,0],Xe=({anchors:e,offsets:t,pivot:n=Ge,children:a})=>{const{width:r,height:s}=se.useScreenSpace(),c=A.useMemo(()=>({anchors:{...Le,...e??{}},offsets:{...Be,...t??{}}}),[e,t]),i=A.useMemo(()=>ve(r,s,c.anchors,c.offsets,n),[r,s,c,n]);A.useEffect(()=>{const o=c.anchors;o.left>o.right&&console.warn(`[ScreenTransform] inverted X axis: anchors.left (${o.left}) > anchors.right (${o.right})`),o.bottom>o.top&&console.warn(`[ScreenTransform] inverted Y axis: anchors.bottom (${o.bottom}) > anchors.top (${o.top})`),i.width<=0&&console.warn(`[ScreenTransform] zero or negative width (${i.width.toFixed(3)}) — anchors + offsets collapse the X extent`),i.height<=0&&console.warn(`[ScreenTransform] zero or negative height (${i.height.toFixed(3)}) — anchors + offsets collapse the Y extent`)},[c,i.width,i.height]);const d=n[0]!==0||n[1]!==0,f=d?[1,1,1]:[i.width,i.height,1],l=!d&&i.width>0&&i.height>0?i.width/i.height:null;return B.jsx("group",{position:[i.centerX-i.pivotX,i.centerY-i.pivotY,0],scale:f,renderOrder:fe.RENDER_LAYERS.SCREEN_UI,children:B.jsx(se.ScreenRectAspectContext.Provider,{value:l,children:a})})};class pe{constructor(t,n){O(this,"capabilities");O(this,"snapshot");O(this,"listeners",new Set);O(this,"eventListeners",new Map);this.capabilities=t,this.snapshot={state:"idle",frame:0,time:0,playMode:"forward",loop:!0,loopCount:0,...n}}play(){const t=this.snapshot.state==="paused";this.update({state:"playing"}),this.emit(t?"Resume":"PlayBegin")}pause(){this.update({state:"paused"}),this.emit("Pause")}restart(){this.update({state:"playing",frame:0,time:0}),this.emit("PlayBegin")}setPlayMode(t){!this.capabilities.canReverse&&(t==="reverse"||t==="ping-pong"||t==="random")||this.update({playMode:t})}setLoop(t,n=0){this.update({loop:t,loopCount:n})}seek(t){this.capabilities.canSeek&&this.update({frame:Math.max(0,Math.floor(t)),time:Math.max(0,t)})}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}on(t,n){const a=this.eventListeners.get(t)??new Set;return a.add(n),this.eventListeners.set(t,a),()=>this.off(t,n)}off(t,n){var a;(a=this.eventListeners.get(t))==null||a.delete(n)}getSnapshot(){return this.snapshot}dispose(){this.listeners.clear(),this.eventListeners.clear(),this.snapshot={...this.snapshot,state:"idle"}}updateSnapshot(t){this.update(t)}emit(t){var n;(n=this.eventListeners.get(t))==null||n.forEach(a=>a({type:t,snapshot:this.snapshot}))}update(t){this.snapshot={...this.snapshot,...t},this.listeners.forEach(n=>n(this.snapshot))}}const ge=(e,t,n,a,r)=>{const s=Math.max(1,Math.floor(t)),c=Math.max(0,Math.floor(e)),i=n==="ping-pong"&&s>1?s*2-2:s,d=Math.floor(c/i),f=r>0?d>=r:!a&&c>=i,l=f?i-1:c%i;return{frame:n==="reverse"?s-1-l%s:n==="random"?l*7919%s:n==="ping-pong"&&l>=s?i-l:l,ended:f,loop:d}},De=(e,t,n)=>{const a=Math.max(1,Math.floor(n));return Math.floor(Math.max(0,e)*Math.max(0,t))%a};var he={},me,Ue;function je(e,t,n,s){var r=0,s=s===void 0?{}:s,c=s.loop===void 0?null:s.loop,i=s.palette===void 0?null:s.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function d(h){var g=h.length;if(g<2||g>256||g&g-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return g}e[r++]=71,e[r++]=73,e[r++]=70,e[r++]=56,e[r++]=57,e[r++]=97;var f=0,l=0;if(i!==null){for(var o=d(i);o>>=1;)++f;if(o=1<<f,--f,s.background!==void 0){if(l=s.background,l>=o)throw new Error("Background index out of range.");if(l===0)throw new Error("Background index explicitly passed as 0.")}}if(e[r++]=t&255,e[r++]=t>>8&255,e[r++]=n&255,e[r++]=n>>8&255,e[r++]=(i!==null?128:0)|f,e[r++]=l,e[r++]=0,i!==null)for(var p=0,v=i.length;p<v;++p){var x=i[p];e[r++]=x>>16&255,e[r++]=x>>8&255,e[r++]=x&255}if(c!==null){if(c<0||c>65535)throw new Error("Loop count invalid.");e[r++]=33,e[r++]=255,e[r++]=11,e[r++]=78,e[r++]=69,e[r++]=84,e[r++]=83,e[r++]=67,e[r++]=65,e[r++]=80,e[r++]=69,e[r++]=50,e[r++]=46,e[r++]=48,e[r++]=3,e[r++]=1,e[r++]=c&255,e[r++]=c>>8&255,e[r++]=0}var u=!1;this.addFrame=function(h,g,S,m,M,_){if(u===!0&&(--r,u=!1),_=_===void 0?{}:_,h<0||g<0||h>65535||g>65535)throw new Error("x/y invalid.");if(S<=0||m<=0||S>65535||m>65535)throw new Error("Width/Height invalid.");if(M.length<S*m)throw new Error("Not enough pixels for the frame size.");var w=!0,E=_.palette;if(E==null&&(w=!1,E=i),E==null)throw new Error("Must supply either a local or global palette.");for(var G=d(E),I=0;G>>=1;)++I;G=1<<I;var j=_.delay===void 0?0:_.delay,R=_.disposal===void 0?0:_.disposal;if(R<0||R>3)throw new Error("Disposal out of range.");var T=!1,k=0;if(_.transparent!==void 0&&_.transparent!==null&&(T=!0,k=_.transparent,k<0||k>=G))throw new Error("Transparent color index.");if((R!==0||T||j!==0)&&(e[r++]=33,e[r++]=249,e[r++]=4,e[r++]=R<<2|(T===!0?1:0),e[r++]=j&255,e[r++]=j>>8&255,e[r++]=k,e[r++]=0),e[r++]=44,e[r++]=h&255,e[r++]=h>>8&255,e[r++]=g&255,e[r++]=g>>8&255,e[r++]=S&255,e[r++]=S>>8&255,e[r++]=m&255,e[r++]=m>>8&255,e[r++]=w===!0?128|I-1:0,w===!0)for(var $=0,L=E.length;$<L;++$){var C=E[$];e[r++]=C>>16&255,e[r++]=C>>8&255,e[r++]=C&255}return r=$e(e,r,I<2?2:I,M),r},this.end=function(){return u===!1&&(e[r++]=59,u=!0),r},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(h){e=h},this.getOutputBufferPosition=function(){return r},this.setOutputBufferPosition=function(h){r=h}}function $e(e,t,n,a){e[t++]=n;var r=t++,s=1<<n,c=s-1,i=s+1,d=i+1,f=n+1,l=0,o=0;function p(_){for(;l>=_;)e[t++]=o&255,o>>=8,l-=8,t===r+256&&(e[r]=255,r=t++)}function v(_){o|=_<<l,l+=f,p(8)}var x=a[0]&c,u={};v(s);for(var h=1,g=a.length;h<g;++h){var S=a[h]&c,m=x<<8|S,M=u[m];if(M===void 0){for(o|=x<<l,l+=f;l>=8;)e[t++]=o&255,o>>=8,l-=8,t===r+256&&(e[r]=255,r=t++);d===4096?(v(s),d=i+1,f=n+1,u={}):(d>=1<<f&&++f,u[m]=d++),x=S}else x=M}return v(x),v(i),p(1),r+1===t?e[r]=0:(e[r]=t-r-1,e[t++]=0),t}function Pe(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!==56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,a=e[t++]|e[t++]<<8,r=e[t++],s=r>>7,c=r&7,i=1<<c+1;e[t++],e[t++];var d=null,f=null;s&&(d=t,f=i,t+=i*3);var l=!0,o=[],p=0,v=null,x=0,u=null;for(this.width=n,this.height=a;l&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,u=e[t++]|e[t++]<<8,t++;else for(t+=12;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var g=e[t++];p=e[t++]|e[t++]<<8,v=e[t++],g&1||(v=null),x=g>>2&7,t++;break;case 254:for(;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var S=e[t++]|e[t++]<<8,m=e[t++]|e[t++]<<8,M=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++],E=w>>7,G=w>>6&1,I=w&7,j=1<<I+1,R=d,T=f,k=!1;if(E){var k=!0;R=t,T=j,t+=j*3}var $=t;for(t++;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}o.push({x:S,y:m,width:M,height:_,has_local_palette:k,palette_offset:R,palette_size:T,data_offset:$,data_length:t-$,transparent_index:v,interlaced:!!G,delay:p,disposal:x});break;case 59:l=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return o.length},this.loopCount=function(){return u},this.frameInfo=function(L){if(L<0||L>=o.length)throw new Error("Frame index out of range.");return o[L]},this.decodeAndBlitFrameBGRA=function(L,C){var y=this.frameInfo(L),Z=y.width*y.height,P=new Uint8Array(Z);de(e,y.data_offset,P,Z);var q=y.palette_offset,W=y.transparent_index;W===null&&(W=256);var X=y.width,N=n-X,Y=X,K=(y.y*n+y.x)*4,Q=((y.y+y.height)*n+y.x)*4,F=K,V=N*4;y.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,b=P.length;z<b;++z){var D=P[z];if(Y===0&&(F+=V,Y=X,F>=Q&&(V=N*4+n*4*(H-1),F=K+(X+N)*(H<<1),H>>=1)),D===W)F+=4;else{var ee=e[q+D*3],te=e[q+D*3+1],re=e[q+D*3+2];C[F++]=re,C[F++]=te,C[F++]=ee,C[F++]=255}--Y}},this.decodeAndBlitFrameRGBA=function(L,C){var y=this.frameInfo(L),Z=y.width*y.height,P=new Uint8Array(Z);de(e,y.data_offset,P,Z);var q=y.palette_offset,W=y.transparent_index;W===null&&(W=256);var X=y.width,N=n-X,Y=X,K=(y.y*n+y.x)*4,Q=((y.y+y.height)*n+y.x)*4,F=K,V=N*4;y.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,b=P.length;z<b;++z){var D=P[z];if(Y===0&&(F+=V,Y=X,F>=Q&&(V=N*4+n*4*(H-1),F=K+(X+N)*(H<<1),H>>=1)),D===W)F+=4;else{var ee=e[q+D*3],te=e[q+D*3+1],re=e[q+D*3+2];C[F++]=ee,C[F++]=te,C[F++]=re,C[F++]=255}--Y}}}function de(e,t,n,a){for(var r=e[t++],s=1<<r,c=s+1,i=c+1,d=r+1,f=(1<<d)-1,l=0,o=0,p=0,v=e[t++],x=new Int32Array(4096),u=null;;){for(;l<16&&v!==0;)o|=e[t++]<<l,l+=8,v===1?v=e[t++]:--v;if(l<d)break;var h=o&f;if(o>>=d,l-=d,h===s){i=c+1,d=r+1,f=(1<<d)-1,u=null;continue}else if(h===c)break;for(var g=h<i?h:u,S=0,m=g;m>s;)m=x[m]>>8,++S;var M=m,_=p+S+(g!==h?1:0);if(_>a){console.log("Warning, gif stream longer than expected.");return}n[p++]=M,p+=S;var w=p;for(g!==h&&(n[p++]=M),m=g;S--;)m=x[m],n[--w]=m&255,m>>=8;u!==null&&i<4096&&(x[i++]=u<<8|M,i>=f+1&&d<12&&(++d,f=f<<1|1)),u=h}return p!==a&&console.log("Warning, gif stream shorter than expected."),n}try{Ue=he.GifWriter=je,me=he.GifReader=Pe}catch{}const qe=me;function We(e){return async(t,n)=>{const a=e.find(r=>r.canResolve(t));if(!a)throw new we("No texture provider matched source",t);return Se(a.resolve.bind(a),t,n)}}class we extends Error{constructor(n,a){super(n);O(this,"source");this.name="TextureSourceLoadError",this.source=a}}function J(e){if(e.aborted)throw new DOMException("Texture source load aborted","AbortError")}async function Se(e,t,n){J(n);const a=await e(t,n);return n.aborted&&(a.dispose(),J(n)),a}function Ne(e){e==null||e.dispose()}const _e=5*1024*1024,ae=1e6,oe=180,Ye=(e,t,n)=>{for(let a=n.y;a<n.y+n.height;a+=1)e.fill(0,(a*t+n.x)*4,(a*t+n.x+n.width)*4)},Ve=(e,t,n,a,r)=>t.byteLength>_e?`file is ${(t.byteLength/1024/1024).toFixed(1)} MB; max is 5 MB`:n*a>ae?`canvas is ${n}x${a}; max area is ${ae}`:r>oe?`frame count is ${r}; max is ${oe}`:r===0?"frame count is 0":e?null:"source URL is empty",He=e=>typeof e=="string"?e:e.src,ze={canResolve:e=>typeof e=="string"?/\.gif(?:[?#].*)?$/i.test(e):e.kind==="gif",async resolve(e,t){const n=He(e),a=await fetch(n,{signal:t});if(!a.ok)throw new Error(`GIF request failed with ${a.status}`);const r=new Uint8Array(await a.arrayBuffer());J(t);const s=new qe(r),c=s.numFrames(),i=Ve(n,r,s.width,s.height,c);if(i)throw console.warn(`[xr-sdk] GIF ScreenImage source rejected: ${i}`,n),new Error(`GIF source rejected: ${i}`);const d=document.createElement("canvas");d.width=s.width,d.height=s.height;const f=d.getContext("2d");if(!f)throw new Error("Could not create GIF canvas context");const l=new U.CanvasTexture(d);l.colorSpace=U.SRGBColorSpace;const o=new Uint8Array(s.width*s.height*4),p=new ImageData(new Uint8ClampedArray(o.buffer),s.width,s.height),v=Array.from({length:c},(R,T)=>s.frameInfo(T)),x=v.reduce((R,T)=>R+Math.max(20,T.delay*10),0)/1e3,u=new pe({canSeek:!1,canReverse:!1,supportsLoopCount:!0},{state:"ready",duration:x,frameCount:c});let h=0,g=0,S=!1,m=!1,M=0,_=0,w=null;const E=(R,T=!1)=>{T&&(o.fill(0),w=null),(w==null?void 0:w.info.disposal)===2?Ye(o,s.width,w.info):w!=null&&w.restorePixels&&o.set(w.restorePixels);const k=v[R],$=k.disposal===3?new Uint8Array(o):null;return s.decodeAndBlitFrameRGBA(R,o),f.putImageData(p,0,0),l.needsUpdate=!0,w={info:k,restorePixels:$},m=!0,u.updateSnapshot({frame:R,time:v.slice(0,R).reduce((L,C)=>L+Math.max(20,C.delay*10),0)/1e3}),m=!1,u.emit("KeyFrameInSecond"),Math.max(20,k.delay*10)},G=R=>{g=window.setTimeout(()=>{h=requestAnimationFrame(I)},R)},I=()=>{if(S||u.getSnapshot().state!=="playing")return;const R=u.getSnapshot(),T=ge(M,c,R.playMode,R.loop,R.loopCount);if(T.ended){u.updateSnapshot({state:"ended",frame:T.frame,time:x}),u.emit("PlayEnd");return}const k=T.loop!==_;_=T.loop,M+=1,G(E(T.frame,k))},j=u.subscribe(R=>{m||(clearTimeout(g),cancelAnimationFrame(h),R.state==="playing"&&(h=requestAnimationFrame(I)))});return E(0),u.play(),{texture:l,controller:u,metadata:{width:s.width,height:s.height,duration:x,frameCount:c},dispose(){S=!0,j(),clearTimeout(g),cancelAnimationFrame(h),u.dispose(),l.dispose()}}}},ye=A.createContext(null),Re=A.createContext(null),Oe=()=>A.useContext(ye),Ze=()=>A.useContext(Re);exports.BasicAnimatedTextureController=pe;exports.MAX_GIF_BYTES=_e;exports.MAX_GIF_FRAMES=oe;exports.MAX_GIF_PIXELS=ae;exports.ScreenTransform=Xe;exports.TextureSourceLoadError=we;exports.XRScene=Ie;exports.XRViewportRenderOutputsContext=Re;exports.XRViewportStateContext=ye;exports.computeScreenTransform=ve;exports.createTextureSourceResolver=We;exports.disposeResolvedTextureSource=Ne;exports.getPlaybackFrame=ge;exports.getSequenceFrame=De;exports.gifTextureSourceProvider=ze;exports.resolveTextureSource=Se;exports.throwIfAborted=J;exports.useXRViewportRenderOutputs=Ze;exports.useXRViewportState=Oe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../session-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../session-CpkiK5YA.cjs");exports.MediaSourceSwitcher=e.MediaSourceSwitcher;exports.defaultMediaSources=e.defaultMediaSources;exports.sdkImageMediaSources=e.sdkImageMediaSources;exports.sdkVideoMediaSources=e.sdkVideoMediaSources;exports.useFaceTrackingMediaSourceSession=e.useFaceTrackingMediaSourceSession;exports.useMediaSourceSession=e.useMediaSourceSession;
|
package/dist/debug-ui.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("./session-CANvoLD6.cjs"),On=require("./debug-ui/default-setting.cjs"),e=require("react/jsx-runtime"),u=require("react"),We=require("./renderGroups-BJsx32q5.cjs"),$=require("./renderPasses-D-Krl6D0.cjs"),pe=require("react-dom"),$n=require("three"),X=require("./FaceMeshRenderer-D1WsrTLA.cjs"),Z=require("./FaceRetouch-DsE0Dbw-.cjs"),An=require("./index-CY7Z8cHV.cjs"),Dn=require("./index-D67hHm44.cjs"),At=require("@react-three/drei"),Bn=require("@react-three/fiber"),Dt=require("./index-DPPpU5By.cjs"),Pn=require("./contexts-h-9TRH0r.cjs"),Vn=require("./selectors-CAwmL9VW.cjs"),Hn={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},Kn={pointerEvents:"auto",width:306,maxHeight:"calc(100vh - 124px)",borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflow:"hidden"},_n=306,Gn=()=>({x:typeof window>"u"?14:window.innerWidth-(_n+20),y:30}),Un={display:"grid",gap:7,padding:"7px 8px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)"},Xn={display:"grid",gridTemplateColumns:"16px 22px minmax(0, 1fr) 28px",alignItems:"center",gap:7},Zn={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:700},Yn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(125,211,252,0.46)",background:"rgba(15,23,42,0.82)",color:"#f8fafc",fontSize:11,fontWeight:700,outline:"none",padding:"0 7px",boxSizing:"border-box"},qn={display:"flex",width:20,height:20,alignItems:"center",justifyContent:"center",borderRadius:7,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0"},Jn={width:16,height:18,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)"},Qn={display:"grid",gap:8,padding:8,overflowY:"auto",maxHeight:"calc(100vh - 215px)"},es={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 30px",gap:6},ts={width:"100%",height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(56,189,248,0.16)",color:"#e0f2fe",fontSize:10.5,fontWeight:700,cursor:"pointer"},ns=t=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",color:t?"#e0f2fe":"rgba(148,163,184,0.72)",background:t?"rgba(56,189,248,0.16)":"rgba(255,255,255,0.04)",cursor:"pointer",padding:0}),ss={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0},ls={width:"fit-content",maxWidth:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.07)",color:"#e2e8f0",fontSize:10,padding:"0 8px"},is=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),os=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"m12 2 8 4.6v10.8L12 22l-8-4.6V6.6L12 2zm0 2.3L6.3 7.6 12 10.9l5.7-3.3L12 4.3zM6 9.3v6.9l5 2.9v-6.9L6 9.3zm12 0-5 2.9v6.9l5-2.9V9.3z"})}),rs=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5c5 0 8.7 4.2 10 7-1.3 2.8-5 7-10 7s-8.7-4.2-10-7c1.3-2.8 5-7 10-7zm0 2c-3.6 0-6.4 2.7-7.7 5 1.3 2.3 4.1 5 7.7 5s6.4-2.7 7.7-5C18.4 9.7 15.6 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z"})}),as=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M3.3 2 22 20.7 20.7 22l-3.1-3.1A10.5 10.5 0 0 1 12 20c-5 0-8.7-4.2-10-7a16.4 16.4 0 0 1 4-4.9L2 3.3 3.3 2zm4.1 7.5A14.4 14.4 0 0 0 4.3 13c1.3 2.3 4.1 5 7.7 5 1.5 0 2.8-.5 4-1.2l-2.1-2.1A2.5 2.5 0 0 1 9.3 10L7.4 9.5zM12 4c5 0 8.7 4.2 10 7a15 15 0 0 1-3.2 4.2l-1.4-1.4A13 13 0 0 0 19.7 11C18.4 8.7 15.6 6 12 6c-.9 0-1.8.2-2.6.5L7.8 4.9C9.1 4.3 10.5 4 12 4z"})}),ds=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2z"})}),cs=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"})}),ps=async t=>{var l;if((l=navigator.clipboard)!=null&&l.writeText){await navigator.clipboard.writeText(t);return}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)},ut=({children:t,copyConfig:n,initialPosition:l,layer:s="Default Layer",objectId:a,objectName:d,onObjectNameChange:o,onPositionChange:r,onVisibleChange:y,position:p,title:x,visible:c})=>{const[g,h]=u.useState(l??Gn),i=p??g,[b,j]=u.useState(!1),[k,C]=u.useState(!0),L=d??x??a??"Scene Object",[S,w]=u.useState(!1),[O,T]=u.useState(L),B=u.useRef(null);u.useEffect(()=>{S||T(L)},[L,S]),u.useEffect(()=>{const M=ye=>{if(!B.current)return;const N={x:Math.max(8,ye.clientX-B.current.x),y:Math.max(8,ye.clientY-B.current.y)};h(N),r==null||r(N)},I=()=>{B.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",M),window.addEventListener("pointerup",I),()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",I)}},[r]);const _=M=>{const I=M.currentTarget.getBoundingClientRect();B.current={x:M.clientX-I.left,y:M.clientY-I.top},document.body.classList.add("select-none"),M.currentTarget.setPointerCapture(M.pointerId)},he=async()=>{try{await ps(JSON.stringify(n,null,2)),j(!0),window.setTimeout(()=>j(!1),1200)}catch{j(!1)}},te=()=>{const M=O.trim();if(w(!1),!o||!M||M===L){T(L);return}o(M)},xe=()=>{T(L),w(!1)};return typeof document>"u"?null:pe.createPortal(e.jsx("div",{style:{...Hn,left:i.x,top:i.y},children:e.jsxs("div",{style:Kn,children:[e.jsxs("div",{style:Un,children:[e.jsxs("div",{style:Xn,children:[e.jsx("div",{onPointerDown:_,style:Jn,children:e.jsx(is,{})}),e.jsx("span",{style:qn,children:e.jsx(os,{})}),S?e.jsx("input",{autoFocus:!0,"aria-label":"Object Name",style:Yn,value:O,onBlur:te,onChange:M=>T(M.currentTarget.value),onKeyDown:M=>{M.key==="Enter"&&te(),M.key==="Escape"&&xe()}}):e.jsx("button",{type:"button",style:{...Zn,padding:0,border:0,background:"transparent",color:"inherit",cursor:o?"text":"default",textAlign:"left"},onDoubleClick:()=>{o&&w(!0)},children:L}),e.jsx("button",{type:"button","aria-label":k?"Fold Inspector":"Expand Inspector",title:k?"Fold Inspector":"Expand Inspector",style:ss,onClick:()=>C(M=>!M),children:k?e.jsx(ds,{}):e.jsx(cs,{})})]}),k?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",style:ls,children:s}),e.jsxs("div",{style:es,children:[e.jsx("button",{type:"button",style:ts,onClick:he,children:b?"Copied Config":"Copy Config"}),e.jsx("button",{type:"button",style:ns(c),onClick:()=>y(!c),children:c?e.jsx(rs,{}):e.jsx(as,{})})]})]}):null]}),k?e.jsx("div",{style:Qn,children:t}):null]})}),document.body)},hs={clean:{fontWeight:400,strokeLayers:[],shadowLayers:[]},sticker:{color:"#101828",fontWeight:800,strokeLayers:[{color:"#ffffff",width:26,opacity:1},{color:"#101828",width:10,opacity:1}],shadowLayers:[]},"shadow-pop":{color:"#fff8df",fontWeight:800,strokeLayers:[{color:"#101828",width:12,opacity:1}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:18,offsetY:18,opacity:.9},{color:"#0f172a",blur:10,offsetX:10,offsetY:10,opacity:.35}]},neon:{color:"#ffffff",fontWeight:700,strokeLayers:[{color:"#9be7ff",width:8,opacity:.9}],shadowLayers:[{color:"#38bdf8",blur:18,opacity:.8},{color:"#0ea5e9",blur:40,opacity:.7},{color:"#7c3aed",blur:70,opacity:.5}]},editorial:{color:"#f8fafc",fontWeight:500,strokeLayers:[{color:"#0f172a",width:4,opacity:.5}],shadowLayers:[]},"comic-burst":{color:"#fff06a",fontWeight:900,strokeLayers:[{color:"#ef4444",width:28,opacity:1},{color:"#111827",width:12,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offsetX:12,offsetY:12,opacity:.65}]},"ice-outline":{color:"#eff8ff",fontWeight:800,strokeLayers:[{color:"#dbeafe",width:16,opacity:1},{color:"#1d4ed8",width:6,opacity:.95}],shadowLayers:[{color:"#38bdf8",blur:24,opacity:.32}]},"sunset-glow":{color:"#fff7ed",fontWeight:800,strokeLayers:[{color:"#fb7185",width:8,opacity:.95}],shadowLayers:[{color:"#fb7185",blur:18,opacity:.7},{color:"#f97316",blur:42,opacity:.55},{color:"#facc15",blur:70,opacity:.28}]},cutout:{color:"#fffaf0",fontWeight:800,strokeLayers:[{color:"#0f172a",width:6,opacity:.9}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:8,offsetY:8,opacity:.95},{color:"#0f172a",blur:0,offsetX:16,offsetY:16,opacity:.4}]},"badge-arc":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"arc",strength:100},strokeLayers:[{color:"#0b1020",width:24,opacity:1},{color:"#ffffff",width:8,opacity:1}],shadowLayers:[{color:"#020617",blur:8,offset:10,angle:-45,feather:.2,opacity:.65}]},"chrome-bulge":{color:"#f8fafc",fontWeight:900,outlineEnabled:!0,shadowEnabled:!1,glowEnabled:!0,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"bulge",strength:100},glow:{color:"#dbeafe",style:"contoured",intensity:.55,range:.35,horizontalAngle:0,verticalAngle:0},innerShadow:{color:"#64748b",opacity:.9,offset:16,angle:-45,feather:.25},strokeLayers:[{color:"#0f172a",width:5,opacity:.9}],shadowLayers:[]},"retro-wave":{color:"#fffbeb",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"wave",strength:100},glow:{color:"#fb7185",style:"outward",intensity:.65,range:.55,horizontalAngle:0,verticalAngle:0},strokeLayers:[{color:"#fb7185",width:12,opacity:1},{color:"#7c2d12",width:5,opacity:.9}],shadowLayers:[{color:"#7c2d12",blur:4,offset:14,angle:45,feather:.1,opacity:.75}]},"flag-pop":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"flag",strength:100},glow:{color:"#38bdf8",style:"outward",intensity:.5,range:.45,horizontalAngle:.15,verticalAngle:-.1},strokeLayers:[{color:"#fde047",width:18,opacity:1},{color:"#111827",width:7,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offset:14,angle:35,feather:0,opacity:.75}]},"fisheye-poster":{color:"#fff7ed",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"fisheye",strength:100},innerShadow:{color:"#92400e",opacity:.55,offset:10,angle:-45,feather:.15},strokeLayers:[{color:"#020617",width:24,opacity:1},{color:"#f97316",width:8,opacity:.9}],shadowLayers:[{color:"#020617",blur:0,offset:12,angle:40,feather:0,opacity:.8}]}},xs=[{label:"Space Grotesk",value:'"Space Grotesk", sans-serif'},{label:"Bebas Neue",value:'"Bebas Neue", sans-serif'},{label:"DM Serif Display",value:'"DM Serif Display", serif'},{label:"Caveat",value:'"Caveat", cursive'}],ys=["clean","sticker","shadow-pop","neon","editorial","comic-burst","ice-outline","sunset-glow","cutout","badge-arc","chrome-bulge","retro-wave","flag-pop","fisheye-poster"],us={clean:"NONE",sticker:"sticker","shadow-pop":"shadow-pop",neon:"neon",editorial:"editorial","comic-burst":"comic-burst","ice-outline":"ice-outline","sunset-glow":"sunset-glow",cutout:"cutout","badge-arc":"badge-arc","chrome-bulge":"chrome-bulge","retro-wave":"retro-wave","flag-pop":"flag-pop","fisheye-poster":"fisheye-poster"},gs=()=>({color:"#000000",opacity:1,width:30}),zt=()=>({color:"#000000",opacity:1,offset:10,angle:-45,feather:0,blur:0,offsetX:7.071,offsetY:-7.071}),hn=()=>({color:"#ffffff",style:"outward",intensity:.5,range:.5,horizontalAngle:0,verticalAngle:0}),xn=()=>({preset:"arc",strength:100}),bs=[{label:"Arc",value:"arc"},{label:"Arc Lower",value:"arc-lower"},{label:"Arc Upper",value:"arc-upper"},{label:"Arch",value:"arch"},{label:"Bulge",value:"bulge"},{label:"Shell Lower",value:"shell-lower"},{label:"Shell Upper",value:"shell-upper"},{label:"Flag",value:"flag"},{label:"Wave",value:"wave"},{label:"Fish",value:"fish"},{label:"Rise",value:"rise"},{label:"Fisheye",value:"fisheye"},{label:"Inflate",value:"inflate"},{label:"Squeeze",value:"squeeze"},{label:"Twist",value:"twist"}],fs=(t,n)=>{const l=hs[n],s=l.strokeLayers??t.style.strokeLayers,a=l.shadowLayers??t.style.shadowLayers;return{...t,textArtPreset:n,style:{...t.style,...l,fontWeight:t.style.bold?"bold":l.fontWeight??t.style.fontWeight,background:{...t.style.background,...l.background},outlineEnabled:l.strokeLayers?l.strokeLayers.length>0:t.style.outlineEnabled,shadowEnabled:l.shadowLayers?l.shadowLayers.length>0:t.style.shadowEnabled,strokeLayers:s,shadowLayers:a}}},yn=(t,n)=>({enabled:(n==null?void 0:n.enabled)??t.enabled,showGuides:(n==null?void 0:n.showTransformGuides)??t.showTransformGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(n==null?void 0:n.position)??t.position,size:(n==null?void 0:n.size)??t.size,rotation:(n==null?void 0:n.rotation)??t.rotation,scale2D:n==null?void 0:n.scale2D,referencePixelsPerUnit:n==null?void 0:n.referencePixelsPerUnit,pivot:(n==null?void 0:n.pivot)??t.pivot,renderOrder:(n==null?void 0:n.renderOrder)??t.renderOrder,overlay:(n==null?void 0:n.overlay)??t.overlay,visible:(n==null?void 0:n.visible)??t.visible}),js=(t,n)=>({...n,enabled:t.enabled,showTransformGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),un=(t,n)=>({...$.DEFAULT_SCREEN_TRANSFORM_2D,...n,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(n==null?void 0:n.scale2D)??$.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(n==null?void 0:n.referencePixelsPerUnit)??$.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ms={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Ss={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},ws={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},ks={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},vs={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Cs=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Rs={display:"grid",gap:7,padding:"0 7px 7px"},me={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},R={display:"flex",flexDirection:"column",gap:4},q={...R,gridColumn:"1 / -1"},Es={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px 8px 2px 12px",marginTop:-2,borderLeft:"1px solid rgba(255,255,255,0.10)"},Is={display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,width:"100%",padding:0,border:0,background:"transparent",fontSize:9,color:"rgba(226,232,240,0.64)",textTransform:"uppercase",cursor:"pointer"},zs={display:"flex",alignItems:"center",gap:6,minWidth:0},Ts={width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.06)",color:"rgba(226,232,240,0.72)",flex:"0 0 auto"},m={fontSize:9,color:"rgba(226,232,240,0.72)"},Wt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Ms={...Wt,height:72,padding:"7px",resize:"vertical",lineHeight:1.35,fontFamily:"inherit"},je={...Wt,padding:2,cursor:"pointer"},de={...Wt,appearance:"none"},Ws={opacity:.45,cursor:"not-allowed"},ce={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},it={width:16,height:16},Fs={display:"grid",gridTemplateColumns:"1.25fr repeat(4, 1fr)",gap:4,width:"100%"},He=t=>({height:26,borderRadius:8,border:t?"1px solid rgba(125,211,252,0.72)":"1px solid rgba(255,255,255,0.10)",background:t?"rgba(56,189,248,0.20)":"rgba(255,255,255,0.05)",color:t?"#f0f9ff":"#e2e8f0",fontSize:10.5,fontWeight:700,cursor:"pointer",padding:"0 6px"}),yt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"};function Ls({label:t,icon:n,open:l,onToggle:s,children:a}){return e.jsxs("div",{style:Ss,children:[e.jsxs("div",{style:ws,children:[e.jsx("button",{type:"button",onClick:s,style:vs,children:e.jsx("div",{style:Cs(l)})}),e.jsxs("div",{style:ks,children:[e.jsx("span",{style:ms,children:n}),e.jsx("span",{children:t})]})]}),l?e.jsx("div",{style:Rs,children:a}):null]})}const Bt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 6V4h16v2h-7v14h-2V6H4z"})}),Pt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 3a9 9 0 1 0 0 18h1.2a2.8 2.8 0 0 0 0-5.6h-.4a1.8 1.8 0 0 1 0-3.6H16a5 5 0 0 0 0-10h-4zm-4 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm1 5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6-7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})}),Ns=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 4h6v2H7.4l3.3 3.3-1.4 1.4L6 7.4V10H4V4zm10 0h6v6h-2V7.4l-3.3 3.3-1.4-1.4L16.6 6H14V4zM9.3 13.3l1.4 1.4L7.4 18H10v2H4v-6h2v2.6l3.3-3.3zm5.4 0 3.3 3.3V14h2v6h-6v-2h2.6l-3.3-3.3 1.4-1.4z"})}),Os=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 5h10v2H9v6h8v2H7V5zm4 8h6v6h-6v-2h4v-2h-4v-2z"})});function $s({value:t,onChange:n}){return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Text"}),e.jsx("textarea",{style:Ms,value:t.content.text,onChange:l=>n(s=>({...s,content:{...s.content,text:l.target.value}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Text Art"}),e.jsx("select",{style:de,value:t.textArtPreset,onChange:l=>n(s=>fs(s,l.target.value)),children:ys.map(l=>e.jsx("option",{value:l,children:us[l]},l))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Font"}),e.jsx("select",{style:de,value:t.style.fontFamily,onChange:l=>n(s=>({...s,style:{...s.style,fontFamily:l.target.value}})),children:xs.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]})]})}const As={width:"100%",boxSizing:"border-box",border:"1px solid rgba(148,163,184,0.22)",borderRadius:8,background:"rgba(15,23,42,0.8)",color:"#e2e8f0",padding:"7px 9px"},Ds=t=>/^-?\d*(\.\d*)?$/.test(t),F=({value:t,onChange:n,step:l=1,min:s,max:a,disabled:d=!1})=>{const[o,r]=u.useState(String(t));u.useEffect(()=>r(String(t)),[t]);const y=p=>Math.min(typeof a=="number"?a:1/0,Math.max(typeof s=="number"?s:-1/0,p));return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:{...As,...d?{cursor:"not-allowed",opacity:.45}:{}},value:o,disabled:d,onChange:p=>{if(d)return;const x=p.target.value;if(!Ds(x)||(r(x),["","-",".","-."].includes(x)))return;const c=Number(x);Number.isNaN(c)||n(y(c))},onBlur:()=>{if(d)return;const p=Number(o);if(Number.isNaN(p))return r(String(t));const x=y(p);r(String(x)),n(x)},onKeyDown:p=>{if(d||p.key!=="ArrowUp"&&p.key!=="ArrowDown")return;p.preventDefault();const x=p.shiftKey?l*10:p.altKey?l/10:l,c=p.key==="ArrowUp"?t+x:t-x;n(y(Number.isInteger(c)?c:Number(c.toFixed(6))))}})};function Bs({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Fill Mode"}),e.jsxs("select",{style:de,value:t.fillMode,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,fillMode:l.target.value}}})),children:[e.jsx("option",{value:"solid",children:"solid"}),e.jsx("option",{value:"gradient",children:"gradient"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Fill Area"}),e.jsxs("select",{style:de,value:t.fit,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,fit:l.target.value}}})),children:[e.jsx("option",{value:"text",children:"text"}),e.jsx("option",{value:"full",children:"full"})]})]}),t.fillMode==="solid"?e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Background Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,color:l.target.value}}}))})]}):e.jsx("div",{style:{gridColumn:"1 / -1",display:"grid",gap:6},children:t.gradientStops.slice(0,3).map((l,s)=>e.jsxs("label",{style:R,children:[e.jsxs("span",{style:m,children:["Gradient ",s+1]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 60px",gap:4},children:[e.jsx("input",{style:je,type:"color",value:l.color,onChange:a=>n(d=>{const o=[...d.style.background.gradientStops];return o[s]={...o[s],color:a.target.value},{...d,style:{...d.style,background:{...d.style.background,gradientStops:o}}}})}),e.jsx(F,{value:l.position,min:0,max:1,step:.05,onChange:a=>n(d=>{const o=[...d.style.background.gradientStops];return o[s]={...o[s],position:a},{...d,style:{...d.style,background:{...d.style.background,gradientStops:o}}}})})]})]},s))}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Background Opacity"}),e.jsx(F,{value:t.opacity,min:0,max:1,step:.05,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,opacity:l}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Corner Radius"}),e.jsx(F,{value:t.borderRadius,min:0,max:200,step:2,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderRadius:l}}}))})]})]})}function Ps({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Auto Width / Height"}),e.jsx("input",{type:"checkbox",style:it,checked:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,autoSize:l.target.checked}}}))})]})}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Width"}),e.jsx(F,{value:t.width,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,width:l}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Height"}),e.jsx(F,{value:t.height,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,height:l}}}))})]})]})}function Vs({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Background Stroke"}),e.jsx("input",{type:"checkbox",style:it,checked:t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderEnabled:l.target.checked,borderColor:l.target.checked&&s.style.background.borderColor==="transparent"?"#ffffff":s.style.background.borderColor,borderWidth:l.target.checked?Math.max(s.style.background.borderWidth,2):s.style.background.borderWidth}}}))})]})}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Stroke Color"}),e.jsx("input",{style:{...je,...t.borderEnabled?{}:Ws},type:"color",value:t.borderColor,disabled:!t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderColor:l.target.value}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Stroke Width"}),e.jsx(F,{value:t.borderWidth,min:0,max:64,step:1,disabled:!t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderWidth:l}}}))})]})]})}const gn={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"};function ot({checked:t,label:n,onChange:l}){return e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:n}),e.jsx("input",{type:"checkbox",style:it,checked:t,onChange:s=>l(s.target.checked)})]})})}function Be({children:t,label:n,open:l,setOpen:s}){return e.jsxs("div",{style:Es,children:[e.jsxs("button",{type:"button",style:Is,onClick:()=>s(a=>!a),children:[e.jsxs("span",{style:zs,children:[e.jsx(Os,{}),e.jsx("span",{children:n})]}),e.jsx("span",{style:Ts,children:l?"−":"+"})]}),l?t:null]})}function Hs({value:t,onChange:n,open:l,setOpen:s}){const a=t.style.background;return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Background Enabled"}),e.jsx("input",{type:"checkbox",style:it,checked:a.enabled,onChange:d=>n(o=>({...o,style:{...o.style,background:{...o.style.background,enabled:d.target.checked}}}))})]})}),a.enabled?e.jsx(Be,{label:"Background Settings",open:l,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{background:a,onChange:n}),e.jsx(Vs,{background:a,onChange:n}),e.jsx(Ps,{background:a,onChange:n})]})}):null]})}function Ks({bend:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,bend:{...r.style.bend??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Bend",checked:a.style.bendEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,bendEnabled:o,bend:r.style.bend??xn()}}))}),a.style.bendEnabled===!0?e.jsx(Be,{label:"Bend",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Bend Preset"}),e.jsx("select",{style:de,value:t.preset,onChange:o=>d({preset:o.target.value}),children:bs.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Bend Strength"}),e.jsx(F,{value:t.strength,min:-100,max:100,step:1,onChange:o=>d({strength:o})})]})]})}):null]})}function _s({glow:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,glow:{...r.style.glow??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Glow",checked:a.style.glowEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,glowEnabled:o,glow:r.style.glow??hn()}}))}),a.style.glowEnabled===!0?e.jsx(Be,{label:"Glow",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:o=>d({color:o.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Style"}),e.jsxs("select",{style:de,value:t.style,onChange:o=>d({style:o.target.value}),children:[e.jsx("option",{value:"outward",children:"Outward"}),e.jsx("option",{value:"contoured",children:"Contoured"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Intensity"}),e.jsx(F,{value:t.intensity??.5,min:0,max:1,step:.05,onChange:o=>d({intensity:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Range"}),e.jsx(F,{value:t.range??.5,min:0,max:1,step:.05,onChange:o=>d({range:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Horizontal Angle"}),e.jsx(F,{value:t.horizontalAngle??0,min:-.5,max:.5,step:.05,onChange:o=>d({horizontalAngle:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Vertical Angle"}),e.jsx(F,{value:t.verticalAngle??0,min:-.5,max:.5,step:.05,onChange:o=>d({verticalAngle:o})})]})]})}):null]})}const Gs={color:"#000000",opacity:1,offset:10,angle:-45,feather:0};function Us({innerShadow:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,innerShadow:{...r.style.innerShadow??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Inner Shadow",checked:a.style.innerShadowEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,innerShadowEnabled:o,innerShadow:r.style.innerShadow??Gs}}))}),a.style.innerShadowEnabled===!0?e.jsx(Be,{label:"Inner Shadow",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:o=>d({color:o.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Opacity"}),e.jsx(F,{value:t.opacity??1,min:0,max:1,step:.05,onChange:o=>d({opacity:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Offset"}),e.jsx(F,{value:t.offset??10,min:0,max:100,step:1,onChange:o=>d({offset:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Angle"}),e.jsx(F,{value:t.angle??-45,min:-180,max:180,step:1,onChange:o=>d({angle:o})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Shadow Feather"}),e.jsx(F,{value:t.feather??0,min:0,max:1,step:.05,onChange:o=>d({feather:o})})]})]})}):null]})}function Xs({layers:t,open:n,onChange:l,setOpen:s,value:a}){const d=(o,r)=>l(y=>{const p=[...y.style.strokeLayers??[]];return p[o]={...p[o],...r},{...y,style:{...y.style,strokeLayers:p}}});return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Outline",checked:a.style.outlineEnabled!==!1,onChange:o=>l(r=>({...r,style:{...r.style,outlineEnabled:o}}))}),a.style.outlineEnabled!==!1?e.jsx(Be,{label:"Outline Editor",open:n,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ce,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:m,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(o=>({...o,style:{...o.style,strokeLayers:[...o.style.strokeLayers??[],gs()]}})),children:"+"})]}),t.length>0?t.map((o,r)=>e.jsxs("div",{style:gn,children:[e.jsxs("div",{style:ce,children:[e.jsxs("span",{style:m,children:["Outline ",r+1]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(y=>({...y,style:{...y.style,strokeLayers:(y.style.strokeLayers??[]).filter((p,x)=>x!==r)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Outline Color"}),e.jsx("input",{style:je,type:"color",value:o.color,onChange:y=>d(r,{color:y.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Outline Opacity"}),e.jsx(F,{value:o.opacity??1,min:0,max:1,step:.05,onChange:y=>d(r,{opacity:y})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Outline Size"}),e.jsx(F,{value:o.width,min:0,max:100,step:1,onChange:y=>d(r,{width:y})})]})]})]},r)):e.jsx("div",{style:{...m,gridColumn:"1 / -1"},children:"No outlines. Use `+` to add one."})]})}):null]})}function Zs({layers:t,open:n,onChange:l,setOpen:s,value:a}){const d=(o,r)=>l(y=>{const p=[...y.style.shadowLayers??[]];return p[o]={...p[o],...r},{...y,style:{...y.style,shadowLayers:p}}});return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Outer Shadow",checked:a.style.shadowEnabled!==!1,onChange:o=>l(r=>{var y;return{...r,style:{...r.style,shadowEnabled:o,shadowLayers:o&&(((y=r.style.shadowLayers)==null?void 0:y.length)??0)===0?[zt()]:r.style.shadowLayers}}})}),a.style.shadowEnabled!==!1?e.jsx(Be,{label:"Shadow Editor",open:n,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ce,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:m,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(o=>({...o,style:{...o.style,shadowLayers:[...o.style.shadowLayers??[],zt()]}})),children:"+"})]}),t.length>0?t.map((o,r)=>e.jsxs("div",{style:gn,children:[e.jsxs("div",{style:ce,children:[e.jsxs("span",{style:m,children:["Shadow ",r+1]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(y=>({...y,style:{...y.style,shadowLayers:(y.style.shadowLayers??[]).filter((p,x)=>x!==r)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:o.color,onChange:y=>d(r,{color:y.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Opacity"}),e.jsx(F,{value:o.opacity??1,min:0,max:1,step:.05,onChange:y=>d(r,{opacity:y})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Offset"}),e.jsx(F,{value:o.offset??10,min:0,max:100,step:1,onChange:y=>d(r,{offset:y})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Angle"}),e.jsx(F,{value:o.angle??-45,min:-180,max:180,step:1,onChange:y=>d(r,{angle:y})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Shadow Feather"}),e.jsx(F,{value:o.feather??0,min:0,max:1,step:.05,onChange:y=>d(r,{feather:y})})]})]})]},r)):e.jsx("div",{style:{...m,gridColumn:"1 / -1"},children:"No outer shadows. Use `+` to add one."})]})}):null]})}function Ys({backgroundSettingsOpen:t,bend:n,bendSettingsOpen:l,glow:s,glowSettingsOpen:a,innerShadow:d,innerShadowSettingsOpen:o,onChange:r,outlineLayers:y,outlineSettingsOpen:p,setBackgroundSettingsOpen:x,setBendSettingsOpen:c,setGlowSettingsOpen:g,setInnerShadowSettingsOpen:h,setOutlineSettingsOpen:i,setShadowSettingsOpen:b,shadowLayers:j,shadowSettingsOpen:k,value:C}){return e.jsxs("div",{style:me,children:[e.jsx(Xs,{value:C,onChange:r,layers:y,open:p,setOpen:i}),e.jsx(Zs,{value:C,onChange:r,layers:j,open:k,setOpen:b}),e.jsx(Us,{value:C,onChange:r,innerShadow:d,open:a,setOpen:g}),e.jsx(_s,{value:C,onChange:r,glow:s,open:o,setOpen:h}),e.jsx(Ks,{value:C,onChange:r,bend:n,open:l,setOpen:c}),e.jsx(Hs,{value:C,onChange:r,open:t,setOpen:x})]})}function qs({value:t,onChange:n}){const l=t.style.bold===!0||t.style.fontStyle==="italic"||t.style.underline===!0||t.style.strikethrough===!0;return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Text Color"}),e.jsx("input",{style:je,type:"color",value:t.style.color,onChange:s=>n(a=>({...a,style:{...a.style,color:s.target.value}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Font Size"}),e.jsx(F,{value:t.style.fontSize,min:16,max:180,step:4,onChange:s=>n(a=>({...a,layout:{...a.layout,minFontSize:Math.min(a.layout.minFontSize??s,s)},style:{...a.style,fontSize:s}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Letter Spacing"}),e.jsx(F,{value:t.style.letterSpacing,min:0,max:1,step:.05,onChange:s=>n(a=>({...a,style:{...a.style,letterSpacing:s}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Line Spacing"}),e.jsx(F,{value:t.style.lineSpacing,min:0,max:1,step:.05,onChange:s=>n(a=>({...a,style:{...a.style,lineSpacing:s}}))})]}),e.jsxs("div",{style:q,children:[e.jsx("span",{style:m,children:"Text Style"}),e.jsxs("div",{style:Fs,children:[e.jsx("button",{type:"button",style:He(!l),onClick:()=>n(s=>({...s,style:{...s.style,bold:!1,fontWeight:s.style.fontWeight==="bold"?"normal":s.style.fontWeight,fontStyle:"normal",underline:!1,strikethrough:!1}})),children:"None"}),e.jsx("button",{type:"button",style:He(t.style.bold===!0),onClick:()=>n(s=>({...s,style:{...s.style,bold:s.style.bold!==!0,fontWeight:s.style.bold!==!0?"bold":400}})),children:"B"}),e.jsx("button",{type:"button",style:He(t.style.fontStyle==="italic"),onClick:()=>n(s=>({...s,style:{...s.style,fontStyle:s.style.fontStyle==="italic"?"normal":"italic"}})),children:"I"}),e.jsx("button",{type:"button",style:He(t.style.underline===!0),onClick:()=>n(s=>({...s,style:{...s.style,underline:s.style.underline!==!0}})),children:"U"}),e.jsx("button",{type:"button",style:He(t.style.strikethrough===!0),onClick:()=>n(s=>({...s,style:{...s.style,strikethrough:s.style.strikethrough!==!0}})),children:"S"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Horizontal Alignment"}),e.jsxs("select",{style:de,value:t.layout.textAlign??"center",onChange:s=>n(a=>({...a,layout:{...a.layout,textAlign:s.target.value}})),children:[e.jsx("option",{value:"left",children:"left"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"right",children:"right"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Vertical Alignment"}),e.jsxs("select",{style:de,value:t.layout.verticalAlign??"center",onChange:s=>n(a=>({...a,layout:{...a.layout,verticalAlign:s.target.value}})),children:[e.jsx("option",{value:"top",children:"top"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"bottom",children:"bottom"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Overflow"}),e.jsxs("select",{style:de,value:t.layout.overflow,onChange:s=>n(a=>({...a,layout:{...a.layout,overflow:s.target.value}})),children:[e.jsx("option",{value:"clip",children:"Clip text"}),e.jsx("option",{value:"ellipsis",children:"Show ellipsis"}),e.jsx("option",{value:"clamp",children:"Clamp"}),e.jsx("option",{value:"shrink",children:"Shrink"})]})]}),e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Resize To Fit"}),e.jsx("input",{type:"checkbox",style:it,checked:t.layout.resizeToFit===!0,onChange:s=>n(a=>({...a,layout:{...a.layout,resizeToFit:s.target.checked}}))})]})})]})}const Js={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},le={display:"flex",flexDirection:"column",gap:4},bt={...le,gridColumn:"1 / -1"},G={fontSize:9,color:"rgba(226,232,240,0.72)"},Qs={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},el={...Qs,fontVariantNumeric:"tabular-nums"},tl={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},nl={width:16,height:16},sl=t=>/^-?\d*(\.\d*)?$/.test(t),Q=({value:t,onChange:n,step:l=1,min:s,max:a,disabled:d=!1})=>{const[o,r]=u.useState(String(t));u.useEffect(()=>r(String(t)),[t]);const y=p=>{let x=p;return typeof s=="number"&&(x=Math.max(s,x)),typeof a=="number"&&(x=Math.min(a,x)),x};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:el,value:o,disabled:d,onChange:p=>{const x=p.target.value;if(!sl(x)||(r(x),x===""||x==="-"||x==="."||x==="-."))return;const c=Number(x);Number.isNaN(c)||n(y(c))},onBlur:()=>{const p=Number(o);if(Number.isNaN(p)){r(String(t));return}const x=y(p);r(String(x)),n(x)},onKeyDown:p=>{if(p.key!=="ArrowUp"&&p.key!=="ArrowDown")return;p.preventDefault();const x=p.shiftKey?l*10:p.altKey?l/10:l,c=p.key==="ArrowUp"?t+x:t-x;n(y(Number.isInteger(c)?c:Number(c.toFixed(6))))}})},Ft=({value:t,onChange:n,guideLabel:l,showRenderOrder:s=!0})=>{var a,d;return e.jsxs("div",{style:Js,children:[e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Position X"}),e.jsx(Q,{value:t.position.x,min:-4096,max:4096,step:1,onChange:o=>n({...t,position:{...t.position,x:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Position Y"}),e.jsx(Q,{value:t.position.y,min:-4096,max:4096,step:1,onChange:o=>n({...t,position:{...t.position,y:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Size X"}),e.jsx(Q,{value:t.size.width,min:0,max:8192,step:1,onChange:o=>n({...t,size:{...t.size,width:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Size Y"}),e.jsx(Q,{value:t.size.height,min:0,max:8192,step:1,onChange:o=>n({...t,size:{...t.size,height:o}})})]}),e.jsxs("label",{style:bt,children:[e.jsx("span",{style:G,children:"Rotation"}),e.jsx(Q,{value:t.rotation,min:-360,max:360,step:1,onChange:o=>n({...t,rotation:o})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Scale 2D X"}),e.jsx(Q,{value:((a=t.scale2D)==null?void 0:a.x)??1,min:-10,max:10,step:.01,onChange:o=>{var r;return n({...t,scale2D:{x:o,y:((r=t.scale2D)==null?void 0:r.y)??1}})}})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Scale 2D Y"}),e.jsx(Q,{value:((d=t.scale2D)==null?void 0:d.y)??1,min:-10,max:10,step:.01,onChange:o=>{var r;return n({...t,scale2D:{x:((r=t.scale2D)==null?void 0:r.x)??1,y:o}})}})]}),e.jsxs("label",{style:bt,children:[e.jsx("span",{style:G,children:"Reference Pixels Per Unit"}),e.jsx(Q,{value:t.referencePixelsPerUnit??32,min:1,max:512,step:1,onChange:o=>n({...t,referencePixelsPerUnit:o})})]}),s?e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Render Order"}),e.jsx(Q,{value:t.renderOrder,min:-9999,max:9999,step:1,onChange:o=>n({...t,renderOrder:o})})]}):null,e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Pivot X"}),e.jsx(Q,{value:t.pivot[0],min:0,max:1,step:.01,onChange:o=>n({...t,pivot:[o,t.pivot[1]]})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Pivot Y"}),e.jsx(Q,{value:t.pivot[1],min:0,max:1,step:.01,onChange:o=>n({...t,pivot:[t.pivot[0],o]})})]}),e.jsx("label",{style:bt,children:e.jsxs("div",{style:tl,children:[e.jsx("span",{style:G,children:l}),e.jsx("input",{type:"checkbox",style:nl,checked:t.showGuides,onChange:o=>n({...t,showGuides:o.target.checked})})]})})]})};function ll({value:t,onChange:n}){return e.jsx(Ft,{value:yn(t.transformation,t.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:l=>n(s=>({...s,transformation:js(l,s.transformation),screenTransform:un(l,s.screenTransform)}))})}const il=({value:t,onChange:n,copyLabel:l,inspector:s})=>{var ye;const[a,d]=u.useState(()=>$.createSceneObject({name:l??"Screen Text",renderGroupId:We.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=u.useState(()=>{const N=a.id,f=$.createDefaultComponent("ScreenTransform",N),v=$.createDefaultComponent("ScreenText",N),A=$.createDefaultComponent("Material",N),z=$.createDefaultComponent("Texture",N);return{screenTransform:f,screenText:v,material:A,texture:z}}),[r,y]=u.useState(!0),[p,x]=u.useState(!0),[c,g]=u.useState(!0),[h,i]=u.useState(!0),[b,j]=u.useState(!0),[k,C]=u.useState(!0),[L,S]=u.useState({text2d:!0,content:!0,transformation:!0,style:!0,textEffect:!0}),w=yn(t.screenText.transformation,t.screenText.screenTransform),O={object:{...a,componentIds:[o.screenTransform.id,o.screenText.id,o.material.id,o.texture.id]},kind:"screenText",components:[{...o.screenTransform,settings:t.screenText.screenTransform??un(w)},{...o.screenText,settings:t.screenText},{...o.material,settings:{...o.material.settings,color:t.screenText.style.color,opacity:t.screenText.style.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenText.style.background.textureUrl,flipX:t.screenText.style.background.textureFlipX,flipY:t.screenText.style.background.textureFlipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},T=N=>{n({...t,screenText:N(t.screenText)})},B=t.screenText.style.strokeLayers??[],_=t.screenText.style.shadowEnabled!==!1&&(((ye=t.screenText.style.shadowLayers)==null?void 0:ye.length)??0)===0?[zt()]:t.screenText.style.shadowLayers??[],he=t.screenText.style.innerShadow??{color:"#000000",opacity:1,offset:10,angle:-45,feather:0},te=t.screenText.style.glow??hn(),xe=t.screenText.style.bend??xn(),M=N=>S(f=>({...f,[N]:!f[N]})),I=(N,f,v,A)=>e.jsx(Ls,{label:f,icon:v,open:L[N],onToggle:()=>M(N),children:A},N);return e.jsxs(ut,{objectId:(s==null?void 0:s.objectId)??a.id,objectName:(s==null?void 0:s.objectName)??a.name,onObjectNameChange:(s==null?void 0:s.onObjectNameChange)??(N=>d(f=>({...f,name:N}))),layer:(s==null?void 0:s.layer)??"Default Layer",visible:(s==null?void 0:s.visible)??t.screenText.enabled,onVisibleChange:(s==null?void 0:s.onVisibleChange)??(N=>T(f=>({...f,enabled:N}))),copyConfig:(s==null?void 0:s.copyConfig)??O,initialPosition:s==null?void 0:s.initialPosition,position:s==null?void 0:s.position,onPositionChange:s==null?void 0:s.onPositionChange,title:s==null?void 0:s.title,children:[I("transformation","Transformation",e.jsx(Ns,{}),e.jsx(ll,{value:t.screenText,onChange:T})),I("text2d","2D Text",e.jsx(Bt,{}),e.jsxs(e.Fragment,{children:[I("content","Content",e.jsx(Bt,{}),e.jsx($s,{value:t.screenText,onChange:T})),I("style","Style",e.jsx(Pt,{}),e.jsx(qs,{value:t.screenText,onChange:T})),I("textEffect","Text Effect",e.jsx(Pt,{}),e.jsx(Ys,{value:t.screenText,onChange:T,outlineLayers:B,shadowLayers:_,innerShadow:he,glow:te,bend:xe,outlineSettingsOpen:r,setOutlineSettingsOpen:y,shadowSettingsOpen:p,setShadowSettingsOpen:x,innerShadowSettingsOpen:c,setInnerShadowSettingsOpen:g,glowSettingsOpen:h,setGlowSettingsOpen:i,bendSettingsOpen:b,setBendSettingsOpen:j,backgroundSettingsOpen:k,setBackgroundSettingsOpen:C}))]}))]})},ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAUAAgMAAAAToI2uAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFqampbGxsAAAA/lGquwAAAAN0Uk5T//8A18oNQQAABPRJREFUeJztzssNQWEYQEG3CP1oQqJGsdCfBFs7j8X8+eRMBbPtBtpWB35RWimtlFZKK6WV0kppZWj6uLrwrceltFFaKa2UVkorpZXSSmlldPp2XT350P5Q2iitlFZKK6WV0kpppbRSWimtlFZKK3+RPq8OvXM/lTZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK3+THqG0UloprZRWSiulldJKaaW0UloprZRWSiuv6VFKK6WV0kpppbRSWimtlFbGpgcqrZRWSiulldJKaaW0MjL9BFWtRqVFuJpUAAAAAElFTkSuQmCC",rl={placeholder:"Placeholder","hero-image":"Hero Image","photo-frame":"Default Frame"},al=Object.entries(rl).map(([t,n])=>({value:t,label:n})),dl={placeholder:{transformation:{showFitGuides:!1},image:{sourceKind:"default",stretchMode:"fit",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"hero-image":{transformation:{position:{x:0,y:.08},size:{width:.96,height:.62},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",stretchMode:"fillAndCut",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"photo-frame":{transformation:{position:{x:0,y:.01},size:{width:2,height:2},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",src:ol,stretchMode:"fill",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}}},cl=(t,n)=>{const l=dl[n];return{...t,preset:n,...l.enabled!==void 0?{enabled:l.enabled}:{},transformation:{...t.transformation,...l.transformation??{}},image:{...t.image,...l.image??{}}}},pl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},et={display:"flex",flexDirection:"column",gap:4},hl={...et,gridColumn:"1 / -1"},Ke={fontSize:9,color:"rgba(226,232,240,0.72)"},Lt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Vt={...Lt,appearance:"none"},xl={...Lt,fontVariantNumeric:"tabular-nums"},yl={...Lt,padding:2,cursor:"pointer"},ul=t=>/^-?\d*(\.\d*)?$/.test(t),Ht=({value:t,onChange:n,step:l=1,min:s,max:a})=>{const[d,o]=u.useState(String(t));u.useEffect(()=>o(String(t)),[t]);const r=y=>{let p=y;return typeof s=="number"&&(p=Math.max(s,p)),typeof a=="number"&&(p=Math.min(a,p)),p};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:xl,value:d,onChange:y=>{const p=y.target.value;if(!ul(p)||(o(p),p===""||p==="-"||p==="."||p==="-."))return;const x=Number(p);Number.isNaN(x)||n(r(x))},onBlur:()=>{const y=Number(d);if(Number.isNaN(y)){o(String(t));return}const p=r(y);o(String(p)),n(p)},onKeyDown:y=>{if(y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;y.preventDefault();const p=y.shiftKey?l*10:y.altKey?l/10:l,x=y.key==="ArrowUp"?t+p:t-p;n(r(Number.isInteger(x)?x:Number(x.toFixed(6))))}})},gl=({value:t,onChange:n})=>e.jsxs("div",{style:pl,children:[e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Material Type"}),e.jsxs("select",{style:Vt,value:t.materialType,onChange:l=>n({...t,materialType:l.target.value}),children:[e.jsx("option",{value:"unlit",children:"Unlit"}),e.jsx("option",{value:"standardPBR",children:"Standard PBR"}),e.jsx("option",{value:"matcap",children:"Matcap"})]})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Blend Mode"}),e.jsxs("select",{style:Vt,value:t.blendMode,onChange:l=>n({...t,blendMode:l.target.value}),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"add",children:"Add"}),e.jsx("option",{value:"subtract",children:"Subtract"}),e.jsx("option",{value:"multiply",children:"Multiply"}),e.jsx("option",{value:"screen",children:"Screen"}),e.jsx("option",{value:"lighten",children:"Lighten"}),e.jsx("option",{value:"darken",children:"Darken"}),e.jsx("option",{value:"overlay",children:"Overlay"}),e.jsx("option",{value:"softLight",children:"Soft Light"}),e.jsx("option",{value:"hardLight",children:"Hard Light"}),e.jsx("option",{value:"difference",children:"Difference"}),e.jsx("option",{value:"exclusion",children:"Exclusion"})]})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Opacity"}),e.jsx(Ht,{value:t.opacity,min:0,max:1,step:.01,onChange:l=>n({...t,opacity:l})})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Tint"}),e.jsx("input",{type:"color",style:yl,value:t.color,onChange:l=>n({...t,color:l.target.value})})]}),e.jsxs("label",{style:hl,children:[e.jsx("span",{style:Ke,children:"Alpha Test"}),e.jsx(Ht,{value:t.alphaTest,min:0,max:1,step:.01,onChange:l=>n({...t,alphaTest:l})})]})]}),bl={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},fl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},jl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},ml={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Sl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},wl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),kl={display:"grid",gap:7,padding:"0 7px 7px"},vl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},tt={display:"flex",flexDirection:"column",gap:4},ft={...tt,gridColumn:"1 / -1"},Se={fontSize:9,color:"rgba(226,232,240,0.72)"},bn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},jt={...bn,appearance:"none"},mt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},St={width:16,height:16},Cl=[{value:"default",label:"Default"},{value:"image",label:"Image"},{value:"gif",label:"GIF"}],Rl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 2v8.76l4.5-4.5 3.2 3.2 2.8-2.8L19 14.16V6H5zm12 3a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),El=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2h2v4h3l-4 4-4-4h3V2zm0 20v-4H8l4-4 4 4h-3v4h-2zM2 11h4V8l4 4-4 4v-3H2v-2zm20 0v2h-4v3l-4-4 4-4v3h4z"})}),Il=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2 3 7v10l9 5 9-5V7l-9-5zm0 2.3L17.9 7 12 9.7 6.1 7 12 4.3zM5 8.5l6 2.7v7.9l-6-3.3V8.5zm8 10.6v-7.9l6-2.7v7.3l-6 3.3z"})}),Kt=(t,n)=>({enabled:(n==null?void 0:n.enabled)??t.enabled,showGuides:(n==null?void 0:n.showTransformGuides)??t.showFitGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(n==null?void 0:n.position)??t.position,size:(n==null?void 0:n.size)??t.size,rotation:(n==null?void 0:n.rotation)??t.rotation,scale2D:n==null?void 0:n.scale2D,referencePixelsPerUnit:n==null?void 0:n.referencePixelsPerUnit,pivot:(n==null?void 0:n.pivot)??t.pivot,renderOrder:(n==null?void 0:n.renderOrder)??t.renderOrder,overlay:(n==null?void 0:n.overlay)??t.overlay,visible:(n==null?void 0:n.visible)??t.visible}),zl=(t,n)=>({...n,enabled:t.enabled,showFitGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),_t=(t,n)=>({...$.DEFAULT_SCREEN_TRANSFORM_2D,...n,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(n==null?void 0:n.scale2D)??$.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(n==null?void 0:n.referencePixelsPerUnit)??$.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),Tl=({value:t,onChange:n,copyLabel:l,inspector:s})=>{const[a,d]=u.useState(()=>$.createSceneObject({name:l??"Screen Image",renderGroupId:We.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=u.useState(()=>{const h=a.id,i=$.createDefaultComponent("ScreenTransform",h),b=$.createDefaultComponent("ScreenImage",h),j=$.createDefaultComponent("Material",h),k=$.createDefaultComponent("Texture",h);return{screenTransform:i,screenImage:b,material:j,texture:k}}),[r,y]=u.useState({transformation:!0,image:!0,material:!0}),p=Kt(t.screenImage.transformation,t.screenImage.screenTransform),x={object:{...a,componentIds:[o.screenTransform.id,o.screenImage.id,o.material.id,o.texture.id]},kind:"screenImage",components:[{...o.screenTransform,settings:t.screenImage.screenTransform??_t(p)},{...o.screenImage,settings:t.screenImage},{...o.material,settings:{...o.material.settings,color:t.screenImage.image.color,opacity:t.screenImage.image.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenImage.image.src||void 0,flipX:t.screenImage.image.flipX,flipY:t.screenImage.image.flipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},c=h=>{n({...t,screenImage:h(t.screenImage)})},g=(h,i,b,j)=>e.jsxs("div",{style:fl,children:[e.jsxs("div",{style:jl,children:[e.jsx("button",{type:"button",onClick:()=>y(k=>({...k,[h]:!k[h]})),style:Sl,children:e.jsx("div",{style:wl(r[h])})}),e.jsxs("div",{style:ml,children:[e.jsx("span",{style:bl,children:b}),e.jsx("span",{children:i})]})]}),r[h]?e.jsx("div",{style:kl,children:j}):null]},h);return e.jsxs(ut,{objectId:(s==null?void 0:s.objectId)??a.id,objectName:(s==null?void 0:s.objectName)??a.name,onObjectNameChange:(s==null?void 0:s.onObjectNameChange)??(h=>d(i=>({...i,name:h}))),layer:(s==null?void 0:s.layer)??"Default Layer",visible:(s==null?void 0:s.visible)??t.screenImage.enabled,onVisibleChange:(s==null?void 0:s.onVisibleChange)??(h=>c(i=>({...i,enabled:h}))),copyConfig:(s==null?void 0:s.copyConfig)??x,initialPosition:s==null?void 0:s.initialPosition,position:s==null?void 0:s.position,onPositionChange:s==null?void 0:s.onPositionChange,title:s==null?void 0:s.title,children:[g("transformation","Transformation",e.jsx(El,{}),e.jsx(Ft,{value:Kt(t.screenImage.transformation,t.screenImage.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:h=>c(i=>({...i,transformation:zl(h,i.transformation),screenTransform:_t(h,i.screenTransform)}))})),g("image","Image",e.jsx(Rl,{}),e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Preset"}),e.jsx("select",{style:jt,value:t.screenImage.preset,onChange:h=>c(i=>cl(i,h.target.value)),children:al.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))})]}),e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Source Kind"}),e.jsx("select",{style:jt,value:t.screenImage.image.sourceKind,onChange:h=>c(i=>({...i,image:{...i.image,sourceKind:h.target.value}})),children:Cl.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))})]}),t.screenImage.image.sourceKind==="image"||t.screenImage.image.sourceKind==="gif"?e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Source URL"}),e.jsx("input",{style:bn,value:t.screenImage.image.src,onChange:h=>c(i=>({...i,image:{...i.image,src:h.target.value}}))})]}):null,e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Stretch Mode"}),e.jsxs("select",{style:jt,value:t.screenImage.image.stretchMode,onChange:h=>c(i=>({...i,image:{...i.image,stretchMode:h.target.value}})),children:[e.jsx("option",{value:"fit",children:"Fit"}),e.jsx("option",{value:"fitWidth",children:"Fit Width"}),e.jsx("option",{value:"fitHeight",children:"Fit Height"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"stretch",children:"Stretch"}),e.jsx("option",{value:"fill",children:"Fill"}),e.jsx("option",{value:"fillAndCut",children:"Fill and Cut"})]})]}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Flip X"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.flipX,onChange:h=>c(i=>({...i,image:{...i.image,flipX:h.target.checked}}))})]})}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Flip Y"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.flipY,onChange:h=>c(i=>({...i,image:{...i.image,flipY:h.target.checked}}))})]})})]})),g("material","Material",e.jsx(Il,{}),e.jsxs("div",{style:vl,children:[e.jsx(gl,{value:t.screenImage.image,onChange:h=>c(i=>({...i,image:{...i.image,materialType:h.materialType,blendMode:h.blendMode,opacity:h.opacity,color:h.color,alphaTest:h.alphaTest}}))}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Transparent"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.transparent,onChange:h=>c(i=>({...i,image:{...i.image,transparent:h.target.checked}}))})]})})]}))]})},$e={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},Me={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Ml=({onChange:t,value:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[n.map((l,s)=>e.jsxs("div",{style:$e,children:[e.jsx("input",{"aria-label":`Gradient stop ${s+1} color`,type:"color",style:{...Me,padding:2},value:l.color,onChange:a=>t(n.map((d,o)=>o===s?{...d,color:a.currentTarget.value}:d))}),e.jsxs("span",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:4},children:[e.jsx("input",{"aria-label":`Gradient stop ${s+1} position`,type:"number",min:0,max:1,step:.05,style:Me,value:l.offset,onChange:a=>t(n.map((d,o)=>o===s?{...d,offset:Number(a.currentTarget.value)}:d))}),n.length>2?e.jsx("button",{type:"button",onClick:()=>t(n.filter((a,d)=>d!==s)),children:"−"}):null]})]},`${s}-${l.color}`)),n.length<X.MAX_SCREEN_GRADIENT_STOPS?e.jsx("button",{type:"button",onClick:()=>{var l;return t([...n,{offset:.5,color:((l=n[n.length-1])==null?void 0:l.color)??"#ffffff"}])},children:"Add stop"}):null]}),fn=({onChange:t,value:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Gradient"}),e.jsxs("select",{style:Me,value:n.type,onChange:l=>t({...n,type:l.currentTarget.value}),children:[e.jsx("option",{value:"linear",children:"Linear"}),e.jsx("option",{value:"radial",children:"Radial"}),e.jsx("option",{value:"angular",children:"Conic / Angular"})]})]}),e.jsx(Ml,{value:n.stops,onChange:l=>t({...n,stops:l})}),n.type!=="radial"?e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Angle"}),e.jsx("input",{type:"number",style:Me,step:5,value:n.angle,onChange:l=>t({...n,angle:Number(l.currentTarget.value)})})]}):null,n.type!=="linear"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Center X"}),e.jsx("input",{type:"number",style:Me,min:0,max:1,step:.05,value:n.center.x,onChange:l=>t({...n,center:{...n.center,x:Number(l.currentTarget.value)}})})]}),e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Center Y"}),e.jsx("input",{type:"number",style:Me,min:0,max:1,step:.05,value:n.center.y,onChange:l=>t({...n,center:{...n.center,y:Number(l.currentTarget.value)}})})]})]}):null,n.type==="radial"?e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Radius"}),e.jsx("input",{type:"number",style:Me,min:.01,step:.05,value:n.radius,onChange:l=>t({...n,radius:Number(l.currentTarget.value)})})]}):null]}),Gt={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},Ut={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},jn=({value:t,onChange:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:Gt,children:[e.jsx("span",{children:"Tint"}),e.jsx("input",{type:"color",style:{...Ut,padding:2},value:t.tint,onChange:l=>n({...t,tint:l.currentTarget.value})})]}),["opacity","frost","highlight"].map(l=>e.jsxs("label",{style:Gt,children:[e.jsx("span",{children:l[0].toUpperCase()+l.slice(1)}),e.jsx("input",{type:"number",style:Ut,min:0,max:1,step:.05,value:t[l],onChange:s=>n({...t,[l]:Number(s.currentTarget.value)})})]},l))]}),Wl={borderRadius:12,border:"1px solid rgba(255,255,255,.08)",background:"rgba(255,255,255,.03)",padding:8},Ae={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},nt={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},ne=({label:t,onValue:n,...l})=>e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:t}),e.jsx("input",{...l,type:"number",style:nt,onChange:s=>n(Number(s.currentTarget.value))})]}),mn=({value:t,onChange:n})=>e.jsxs("section",{style:Wl,children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,marginBottom:7},children:"Screen Shape"}),e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Shape"}),e.jsxs("select",{style:nt,value:t.kind,onChange:l=>n({...t,kind:l.currentTarget.value}),children:[e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"ellipse",children:"Ellipse"}),e.jsx("option",{value:"rectangle",children:"Rectangle"}),e.jsx("option",{value:"roundedRectangle",children:"Rounded Rectangle"}),e.jsx("option",{value:"polygon",children:"Polygon"}),e.jsx("option",{value:"star",children:"Star"}),e.jsx("option",{value:"line",children:"Line"})]})]}),t.kind!=="line"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Fill"}),e.jsxs("select",{style:nt,value:t.fillMode,onChange:l=>n({...t,fillMode:l.currentTarget.value}),children:[e.jsx("option",{value:"solid",children:"Solid"}),e.jsx("option",{value:"gradient",children:"Gradient"}),e.jsx("option",{value:"glass",children:"Glass"})]})]}),t.fillMode==="gradient"?e.jsx(fn,{value:t.gradient,onChange:l=>n({...t,gradient:l})}):t.fillMode==="glass"?e.jsx(jn,{value:t.glass,onChange:l=>n({...t,glass:l})}):e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Color"}),e.jsx("input",{type:"color",style:{...nt,padding:2},value:t.fillColor,onChange:l=>n({...t,fillColor:l.currentTarget.value})})]}),e.jsx(ne,{label:"Fill Opacity",min:0,max:1,step:.05,value:t.fillOpacity,onValue:l=>n({...t,fillOpacity:l})})]}):null,e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Stroke"}),e.jsx("input",{type:"color",style:{...nt,padding:2},value:t.strokeColor,onChange:l=>n({...t,strokeColor:l.currentTarget.value})})]}),e.jsx(ne,{label:"Stroke Width",min:0,step:1,value:t.strokeWidth,onValue:l=>n({...t,strokeWidth:l})}),e.jsx(ne,{label:"Stroke Opacity",min:0,max:1,step:.05,value:t.strokeOpacity,onValue:l=>n({...t,strokeOpacity:l})}),e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Dashed"}),e.jsx("input",{type:"checkbox",checked:t.dashed,onChange:l=>n({...t,dashed:l.currentTarget.checked})})]}),t.kind==="roundedRectangle"?e.jsx(ne,{label:"Corner Radius",min:0,max:.5,step:.01,value:t.cornerRadius,onValue:l=>n({...t,cornerRadius:l})}):null,t.kind==="polygon"||t.kind==="star"?e.jsx(ne,{label:t.kind==="star"?"Points":"Sides",min:3,max:12,step:1,value:t.sides,onValue:l=>n({...t,sides:l})}):null,t.kind==="star"?e.jsx(ne,{label:"Inner Radius",min:.05,max:.95,step:.05,value:t.innerRadiusRatio,onValue:l=>n({...t,innerRadiusRatio:l})}):null,t.kind==="line"?e.jsxs(e.Fragment,{children:[e.jsx(ne,{label:"Start X",min:0,max:1,step:.05,value:t.lineStart.x,onValue:l=>n({...t,lineStart:{...t.lineStart,x:l}})}),e.jsx(ne,{label:"Start Y",min:0,max:1,step:.05,value:t.lineStart.y,onValue:l=>n({...t,lineStart:{...t.lineStart,y:l}})}),e.jsx(ne,{label:"End X",min:0,max:1,step:.05,value:t.lineEnd.x,onValue:l=>n({...t,lineEnd:{...t.lineEnd,x:l}})}),e.jsx(ne,{label:"End Y",min:0,max:1,step:.05,value:t.lineEnd.y,onValue:l=>n({...t,lineEnd:{...t.lineEnd,y:l}})})]}):null]}),Fl={enabled:!0,bothHands:!0,visualScale:1,opacity:.92,pointRadius:3,lineWidth:3,labelScale:1.2,smoothing:.35,color:"#22d3ee",showBoundingBox:!0,showLabels:!1,logToConsole:!1},Ll={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},Sn={pointerEvents:"auto",width:286,borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:"rgba(148,163,184,0.55) rgba(255,255,255,0.06)",overscrollBehavior:"contain"},Nl={...Sn,width:32,height:32,borderRadius:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},Ol={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:7,padding:"7px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)"},$l={width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)",flex:"0 0 auto"},Al={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:600,minWidth:0},Xt={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Dl={display:"grid",gap:6,padding:7},Bl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Pl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Vl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Hl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Kl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),_l={display:"grid",gap:7,padding:"0 7px 7px"},Gl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},Te={display:"flex",flexDirection:"column",gap:4},_e={...Te,gridColumn:"1 / -1"},ee={fontSize:9,color:"rgba(226,232,240,0.72)"},Le={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Ge={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},Ue={width:16,height:16},Zt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"},Ul=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2zm0-8h10v2H7V6z"})}),Xl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.3 5.71 12 12l6.3 6.29-1.41 1.41L10.59 13.41 4.29 19.7 2.88 18.29 9.17 12 2.88 5.71 4.29 4.3l6.3 6.29 6.29-6.3z"})}),Zl=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),wt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2a1 1 0 0 1 1 1v6h1V3a1 1 0 1 1 2 0v6h1V4a1 1 0 1 1 2 0v7.3l1.6 2.4a5 5 0 0 1 .8 2.7V18a4 4 0 0 1-4 4H9a6 6 0 0 1-6-6v-3.5a2.5 2.5 0 0 1 5 0V15h1V3a1 1 0 0 1 1-1z"})}),Yl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5V2L7 7l5 5V9a4 4 0 1 1-4 4H6a6 6 0 1 0 6-8z"})}),ql=({value:t,onChange:n})=>{const[l,s]=u.useState(!0),[a,d]=u.useState({x:14,y:104}),[o,r]=u.useState(typeof window>"u"?0:window.innerHeight),[y,p]=u.useState({overlay:!0,visibility:!1}),x=u.useRef(null),c=Math.max(240,o-a.y-16);u.useEffect(()=>{const i=j=>{x.current&&d({x:Math.max(8,j.clientX-x.current.x),y:Math.max(8,j.clientY-x.current.y)})},b=()=>{x.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",b),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",b)}},[]),u.useEffect(()=>{const i=()=>r(window.innerHeight);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const g=i=>{const b=i.currentTarget.getBoundingClientRect();x.current={x:i.clientX-b.left,y:i.clientY-b.top},document.body.classList.add("select-none"),i.currentTarget.setPointerCapture(i.pointerId)},h=(i,b,j,k)=>e.jsxs("div",{style:Bl,children:[e.jsxs("div",{style:Pl,children:[e.jsx("button",{type:"button",onClick:()=>p(C=>({...C,[i]:!C[i]})),style:Hl,children:e.jsx("div",{style:Kl(y[i])})}),e.jsxs("div",{style:Vl,children:[e.jsx("span",{style:Xt,children:j}),e.jsx("span",{children:b})]})]}),y[i]?e.jsx("div",{style:_l,children:k}):null]},i);return typeof document>"u"?null:pe.createPortal(e.jsxs("div",{style:{...Ll,left:a.x,top:a.y},children:[e.jsx("style",{children:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("./session-CpkiK5YA.cjs"),On=require("./debug-ui/default-setting.cjs"),e=require("react/jsx-runtime"),u=require("react"),We=require("./renderGroups-80H3DpTl.cjs"),$=require("./renderPasses-BOoBSr8z.cjs"),pe=require("react-dom"),$n=require("three"),X=require("./FaceMeshRenderer-C5l6VLdO.cjs"),Z=require("./FaceRetouch-BkJzoA79.cjs"),An=require("./index-BjmTe9eM.cjs"),Dn=require("./index-BpEf2BBb.cjs"),At=require("@react-three/drei"),Bn=require("@react-three/fiber"),Dt=require("./index-DpI-qo5X.cjs"),Pn=require("./contexts-Dr62It_K.cjs"),Vn=require("./selectors-CZLKT2Iv.cjs"),Hn={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},Kn={pointerEvents:"auto",width:306,maxHeight:"calc(100vh - 124px)",borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflow:"hidden"},_n=306,Gn=()=>({x:typeof window>"u"?14:window.innerWidth-(_n+20),y:30}),Un={display:"grid",gap:7,padding:"7px 8px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)"},Xn={display:"grid",gridTemplateColumns:"16px 22px minmax(0, 1fr) 28px",alignItems:"center",gap:7},Zn={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:700},Yn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(125,211,252,0.46)",background:"rgba(15,23,42,0.82)",color:"#f8fafc",fontSize:11,fontWeight:700,outline:"none",padding:"0 7px",boxSizing:"border-box"},qn={display:"flex",width:20,height:20,alignItems:"center",justifyContent:"center",borderRadius:7,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0"},Jn={width:16,height:18,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)"},Qn={display:"grid",gap:8,padding:8,overflowY:"auto",maxHeight:"calc(100vh - 215px)"},es={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 30px",gap:6},ts={width:"100%",height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(56,189,248,0.16)",color:"#e0f2fe",fontSize:10.5,fontWeight:700,cursor:"pointer"},ns=t=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",color:t?"#e0f2fe":"rgba(148,163,184,0.72)",background:t?"rgba(56,189,248,0.16)":"rgba(255,255,255,0.04)",cursor:"pointer",padding:0}),ss={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0},ls={width:"fit-content",maxWidth:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.07)",color:"#e2e8f0",fontSize:10,padding:"0 8px"},is=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),os=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"m12 2 8 4.6v10.8L12 22l-8-4.6V6.6L12 2zm0 2.3L6.3 7.6 12 10.9l5.7-3.3L12 4.3zM6 9.3v6.9l5 2.9v-6.9L6 9.3zm12 0-5 2.9v6.9l5-2.9V9.3z"})}),rs=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5c5 0 8.7 4.2 10 7-1.3 2.8-5 7-10 7s-8.7-4.2-10-7c1.3-2.8 5-7 10-7zm0 2c-3.6 0-6.4 2.7-7.7 5 1.3 2.3 4.1 5 7.7 5s6.4-2.7 7.7-5C18.4 9.7 15.6 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z"})}),as=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M3.3 2 22 20.7 20.7 22l-3.1-3.1A10.5 10.5 0 0 1 12 20c-5 0-8.7-4.2-10-7a16.4 16.4 0 0 1 4-4.9L2 3.3 3.3 2zm4.1 7.5A14.4 14.4 0 0 0 4.3 13c1.3 2.3 4.1 5 7.7 5 1.5 0 2.8-.5 4-1.2l-2.1-2.1A2.5 2.5 0 0 1 9.3 10L7.4 9.5zM12 4c5 0 8.7 4.2 10 7a15 15 0 0 1-3.2 4.2l-1.4-1.4A13 13 0 0 0 19.7 11C18.4 8.7 15.6 6 12 6c-.9 0-1.8.2-2.6.5L7.8 4.9C9.1 4.3 10.5 4 12 4z"})}),ds=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2z"})}),cs=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"})}),ps=async t=>{var l;if((l=navigator.clipboard)!=null&&l.writeText){await navigator.clipboard.writeText(t);return}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)},ut=({children:t,copyConfig:n,initialPosition:l,layer:s="Default Layer",objectId:a,objectName:d,onObjectNameChange:o,onPositionChange:r,onVisibleChange:y,position:p,title:x,visible:c})=>{const[g,h]=u.useState(l??Gn),i=p??g,[b,j]=u.useState(!1),[k,C]=u.useState(!0),L=d??x??a??"Scene Object",[S,w]=u.useState(!1),[O,T]=u.useState(L),B=u.useRef(null);u.useEffect(()=>{S||T(L)},[L,S]),u.useEffect(()=>{const M=ye=>{if(!B.current)return;const N={x:Math.max(8,ye.clientX-B.current.x),y:Math.max(8,ye.clientY-B.current.y)};h(N),r==null||r(N)},I=()=>{B.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",M),window.addEventListener("pointerup",I),()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",I)}},[r]);const _=M=>{const I=M.currentTarget.getBoundingClientRect();B.current={x:M.clientX-I.left,y:M.clientY-I.top},document.body.classList.add("select-none"),M.currentTarget.setPointerCapture(M.pointerId)},he=async()=>{try{await ps(JSON.stringify(n,null,2)),j(!0),window.setTimeout(()=>j(!1),1200)}catch{j(!1)}},te=()=>{const M=O.trim();if(w(!1),!o||!M||M===L){T(L);return}o(M)},xe=()=>{T(L),w(!1)};return typeof document>"u"?null:pe.createPortal(e.jsx("div",{style:{...Hn,left:i.x,top:i.y},children:e.jsxs("div",{style:Kn,children:[e.jsxs("div",{style:Un,children:[e.jsxs("div",{style:Xn,children:[e.jsx("div",{onPointerDown:_,style:Jn,children:e.jsx(is,{})}),e.jsx("span",{style:qn,children:e.jsx(os,{})}),S?e.jsx("input",{autoFocus:!0,"aria-label":"Object Name",style:Yn,value:O,onBlur:te,onChange:M=>T(M.currentTarget.value),onKeyDown:M=>{M.key==="Enter"&&te(),M.key==="Escape"&&xe()}}):e.jsx("button",{type:"button",style:{...Zn,padding:0,border:0,background:"transparent",color:"inherit",cursor:o?"text":"default",textAlign:"left"},onDoubleClick:()=>{o&&w(!0)},children:L}),e.jsx("button",{type:"button","aria-label":k?"Fold Inspector":"Expand Inspector",title:k?"Fold Inspector":"Expand Inspector",style:ss,onClick:()=>C(M=>!M),children:k?e.jsx(ds,{}):e.jsx(cs,{})})]}),k?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",style:ls,children:s}),e.jsxs("div",{style:es,children:[e.jsx("button",{type:"button",style:ts,onClick:he,children:b?"Copied Config":"Copy Config"}),e.jsx("button",{type:"button",style:ns(c),onClick:()=>y(!c),children:c?e.jsx(rs,{}):e.jsx(as,{})})]})]}):null]}),k?e.jsx("div",{style:Qn,children:t}):null]})}),document.body)},hs={clean:{fontWeight:400,strokeLayers:[],shadowLayers:[]},sticker:{color:"#101828",fontWeight:800,strokeLayers:[{color:"#ffffff",width:26,opacity:1},{color:"#101828",width:10,opacity:1}],shadowLayers:[]},"shadow-pop":{color:"#fff8df",fontWeight:800,strokeLayers:[{color:"#101828",width:12,opacity:1}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:18,offsetY:18,opacity:.9},{color:"#0f172a",blur:10,offsetX:10,offsetY:10,opacity:.35}]},neon:{color:"#ffffff",fontWeight:700,strokeLayers:[{color:"#9be7ff",width:8,opacity:.9}],shadowLayers:[{color:"#38bdf8",blur:18,opacity:.8},{color:"#0ea5e9",blur:40,opacity:.7},{color:"#7c3aed",blur:70,opacity:.5}]},editorial:{color:"#f8fafc",fontWeight:500,strokeLayers:[{color:"#0f172a",width:4,opacity:.5}],shadowLayers:[]},"comic-burst":{color:"#fff06a",fontWeight:900,strokeLayers:[{color:"#ef4444",width:28,opacity:1},{color:"#111827",width:12,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offsetX:12,offsetY:12,opacity:.65}]},"ice-outline":{color:"#eff8ff",fontWeight:800,strokeLayers:[{color:"#dbeafe",width:16,opacity:1},{color:"#1d4ed8",width:6,opacity:.95}],shadowLayers:[{color:"#38bdf8",blur:24,opacity:.32}]},"sunset-glow":{color:"#fff7ed",fontWeight:800,strokeLayers:[{color:"#fb7185",width:8,opacity:.95}],shadowLayers:[{color:"#fb7185",blur:18,opacity:.7},{color:"#f97316",blur:42,opacity:.55},{color:"#facc15",blur:70,opacity:.28}]},cutout:{color:"#fffaf0",fontWeight:800,strokeLayers:[{color:"#0f172a",width:6,opacity:.9}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:8,offsetY:8,opacity:.95},{color:"#0f172a",blur:0,offsetX:16,offsetY:16,opacity:.4}]},"badge-arc":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"arc",strength:100},strokeLayers:[{color:"#0b1020",width:24,opacity:1},{color:"#ffffff",width:8,opacity:1}],shadowLayers:[{color:"#020617",blur:8,offset:10,angle:-45,feather:.2,opacity:.65}]},"chrome-bulge":{color:"#f8fafc",fontWeight:900,outlineEnabled:!0,shadowEnabled:!1,glowEnabled:!0,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"bulge",strength:100},glow:{color:"#dbeafe",style:"contoured",intensity:.55,range:.35,horizontalAngle:0,verticalAngle:0},innerShadow:{color:"#64748b",opacity:.9,offset:16,angle:-45,feather:.25},strokeLayers:[{color:"#0f172a",width:5,opacity:.9}],shadowLayers:[]},"retro-wave":{color:"#fffbeb",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"wave",strength:100},glow:{color:"#fb7185",style:"outward",intensity:.65,range:.55,horizontalAngle:0,verticalAngle:0},strokeLayers:[{color:"#fb7185",width:12,opacity:1},{color:"#7c2d12",width:5,opacity:.9}],shadowLayers:[{color:"#7c2d12",blur:4,offset:14,angle:45,feather:.1,opacity:.75}]},"flag-pop":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"flag",strength:100},glow:{color:"#38bdf8",style:"outward",intensity:.5,range:.45,horizontalAngle:.15,verticalAngle:-.1},strokeLayers:[{color:"#fde047",width:18,opacity:1},{color:"#111827",width:7,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offset:14,angle:35,feather:0,opacity:.75}]},"fisheye-poster":{color:"#fff7ed",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"fisheye",strength:100},innerShadow:{color:"#92400e",opacity:.55,offset:10,angle:-45,feather:.15},strokeLayers:[{color:"#020617",width:24,opacity:1},{color:"#f97316",width:8,opacity:.9}],shadowLayers:[{color:"#020617",blur:0,offset:12,angle:40,feather:0,opacity:.8}]}},xs=[{label:"Space Grotesk",value:'"Space Grotesk", sans-serif'},{label:"Bebas Neue",value:'"Bebas Neue", sans-serif'},{label:"DM Serif Display",value:'"DM Serif Display", serif'},{label:"Caveat",value:'"Caveat", cursive'}],ys=["clean","sticker","shadow-pop","neon","editorial","comic-burst","ice-outline","sunset-glow","cutout","badge-arc","chrome-bulge","retro-wave","flag-pop","fisheye-poster"],us={clean:"NONE",sticker:"sticker","shadow-pop":"shadow-pop",neon:"neon",editorial:"editorial","comic-burst":"comic-burst","ice-outline":"ice-outline","sunset-glow":"sunset-glow",cutout:"cutout","badge-arc":"badge-arc","chrome-bulge":"chrome-bulge","retro-wave":"retro-wave","flag-pop":"flag-pop","fisheye-poster":"fisheye-poster"},gs=()=>({color:"#000000",opacity:1,width:30}),zt=()=>({color:"#000000",opacity:1,offset:10,angle:-45,feather:0,blur:0,offsetX:7.071,offsetY:-7.071}),hn=()=>({color:"#ffffff",style:"outward",intensity:.5,range:.5,horizontalAngle:0,verticalAngle:0}),xn=()=>({preset:"arc",strength:100}),bs=[{label:"Arc",value:"arc"},{label:"Arc Lower",value:"arc-lower"},{label:"Arc Upper",value:"arc-upper"},{label:"Arch",value:"arch"},{label:"Bulge",value:"bulge"},{label:"Shell Lower",value:"shell-lower"},{label:"Shell Upper",value:"shell-upper"},{label:"Flag",value:"flag"},{label:"Wave",value:"wave"},{label:"Fish",value:"fish"},{label:"Rise",value:"rise"},{label:"Fisheye",value:"fisheye"},{label:"Inflate",value:"inflate"},{label:"Squeeze",value:"squeeze"},{label:"Twist",value:"twist"}],fs=(t,n)=>{const l=hs[n],s=l.strokeLayers??t.style.strokeLayers,a=l.shadowLayers??t.style.shadowLayers;return{...t,textArtPreset:n,style:{...t.style,...l,fontWeight:t.style.bold?"bold":l.fontWeight??t.style.fontWeight,background:{...t.style.background,...l.background},outlineEnabled:l.strokeLayers?l.strokeLayers.length>0:t.style.outlineEnabled,shadowEnabled:l.shadowLayers?l.shadowLayers.length>0:t.style.shadowEnabled,strokeLayers:s,shadowLayers:a}}},yn=(t,n)=>({enabled:(n==null?void 0:n.enabled)??t.enabled,showGuides:(n==null?void 0:n.showTransformGuides)??t.showTransformGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(n==null?void 0:n.position)??t.position,size:(n==null?void 0:n.size)??t.size,rotation:(n==null?void 0:n.rotation)??t.rotation,scale2D:n==null?void 0:n.scale2D,referencePixelsPerUnit:n==null?void 0:n.referencePixelsPerUnit,pivot:(n==null?void 0:n.pivot)??t.pivot,renderOrder:(n==null?void 0:n.renderOrder)??t.renderOrder,overlay:(n==null?void 0:n.overlay)??t.overlay,visible:(n==null?void 0:n.visible)??t.visible}),js=(t,n)=>({...n,enabled:t.enabled,showTransformGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),un=(t,n)=>({...$.DEFAULT_SCREEN_TRANSFORM_2D,...n,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(n==null?void 0:n.scale2D)??$.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(n==null?void 0:n.referencePixelsPerUnit)??$.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ms={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Ss={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},ws={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},ks={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},vs={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Cs=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Rs={display:"grid",gap:7,padding:"0 7px 7px"},me={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},R={display:"flex",flexDirection:"column",gap:4},q={...R,gridColumn:"1 / -1"},Es={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px 8px 2px 12px",marginTop:-2,borderLeft:"1px solid rgba(255,255,255,0.10)"},Is={display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,width:"100%",padding:0,border:0,background:"transparent",fontSize:9,color:"rgba(226,232,240,0.64)",textTransform:"uppercase",cursor:"pointer"},zs={display:"flex",alignItems:"center",gap:6,minWidth:0},Ts={width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.06)",color:"rgba(226,232,240,0.72)",flex:"0 0 auto"},m={fontSize:9,color:"rgba(226,232,240,0.72)"},Wt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Ms={...Wt,height:72,padding:"7px",resize:"vertical",lineHeight:1.35,fontFamily:"inherit"},je={...Wt,padding:2,cursor:"pointer"},de={...Wt,appearance:"none"},Ws={opacity:.45,cursor:"not-allowed"},ce={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},it={width:16,height:16},Fs={display:"grid",gridTemplateColumns:"1.25fr repeat(4, 1fr)",gap:4,width:"100%"},He=t=>({height:26,borderRadius:8,border:t?"1px solid rgba(125,211,252,0.72)":"1px solid rgba(255,255,255,0.10)",background:t?"rgba(56,189,248,0.20)":"rgba(255,255,255,0.05)",color:t?"#f0f9ff":"#e2e8f0",fontSize:10.5,fontWeight:700,cursor:"pointer",padding:"0 6px"}),yt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"};function Ls({label:t,icon:n,open:l,onToggle:s,children:a}){return e.jsxs("div",{style:Ss,children:[e.jsxs("div",{style:ws,children:[e.jsx("button",{type:"button",onClick:s,style:vs,children:e.jsx("div",{style:Cs(l)})}),e.jsxs("div",{style:ks,children:[e.jsx("span",{style:ms,children:n}),e.jsx("span",{children:t})]})]}),l?e.jsx("div",{style:Rs,children:a}):null]})}const Bt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 6V4h16v2h-7v14h-2V6H4z"})}),Pt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 3a9 9 0 1 0 0 18h1.2a2.8 2.8 0 0 0 0-5.6h-.4a1.8 1.8 0 0 1 0-3.6H16a5 5 0 0 0 0-10h-4zm-4 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm1 5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6-7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})}),Ns=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 4h6v2H7.4l3.3 3.3-1.4 1.4L6 7.4V10H4V4zm10 0h6v6h-2V7.4l-3.3 3.3-1.4-1.4L16.6 6H14V4zM9.3 13.3l1.4 1.4L7.4 18H10v2H4v-6h2v2.6l3.3-3.3zm5.4 0 3.3 3.3V14h2v6h-6v-2h2.6l-3.3-3.3 1.4-1.4z"})}),Os=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 5h10v2H9v6h8v2H7V5zm4 8h6v6h-6v-2h4v-2h-4v-2z"})});function $s({value:t,onChange:n}){return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Text"}),e.jsx("textarea",{style:Ms,value:t.content.text,onChange:l=>n(s=>({...s,content:{...s.content,text:l.target.value}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Text Art"}),e.jsx("select",{style:de,value:t.textArtPreset,onChange:l=>n(s=>fs(s,l.target.value)),children:ys.map(l=>e.jsx("option",{value:l,children:us[l]},l))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Font"}),e.jsx("select",{style:de,value:t.style.fontFamily,onChange:l=>n(s=>({...s,style:{...s.style,fontFamily:l.target.value}})),children:xs.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]})]})}const As={width:"100%",boxSizing:"border-box",border:"1px solid rgba(148,163,184,0.22)",borderRadius:8,background:"rgba(15,23,42,0.8)",color:"#e2e8f0",padding:"7px 9px"},Ds=t=>/^-?\d*(\.\d*)?$/.test(t),F=({value:t,onChange:n,step:l=1,min:s,max:a,disabled:d=!1})=>{const[o,r]=u.useState(String(t));u.useEffect(()=>r(String(t)),[t]);const y=p=>Math.min(typeof a=="number"?a:1/0,Math.max(typeof s=="number"?s:-1/0,p));return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:{...As,...d?{cursor:"not-allowed",opacity:.45}:{}},value:o,disabled:d,onChange:p=>{if(d)return;const x=p.target.value;if(!Ds(x)||(r(x),["","-",".","-."].includes(x)))return;const c=Number(x);Number.isNaN(c)||n(y(c))},onBlur:()=>{if(d)return;const p=Number(o);if(Number.isNaN(p))return r(String(t));const x=y(p);r(String(x)),n(x)},onKeyDown:p=>{if(d||p.key!=="ArrowUp"&&p.key!=="ArrowDown")return;p.preventDefault();const x=p.shiftKey?l*10:p.altKey?l/10:l,c=p.key==="ArrowUp"?t+x:t-x;n(y(Number.isInteger(c)?c:Number(c.toFixed(6))))}})};function Bs({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Fill Mode"}),e.jsxs("select",{style:de,value:t.fillMode,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,fillMode:l.target.value}}})),children:[e.jsx("option",{value:"solid",children:"solid"}),e.jsx("option",{value:"gradient",children:"gradient"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Fill Area"}),e.jsxs("select",{style:de,value:t.fit,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,fit:l.target.value}}})),children:[e.jsx("option",{value:"text",children:"text"}),e.jsx("option",{value:"full",children:"full"})]})]}),t.fillMode==="solid"?e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Background Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,color:l.target.value}}}))})]}):e.jsx("div",{style:{gridColumn:"1 / -1",display:"grid",gap:6},children:t.gradientStops.slice(0,3).map((l,s)=>e.jsxs("label",{style:R,children:[e.jsxs("span",{style:m,children:["Gradient ",s+1]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 60px",gap:4},children:[e.jsx("input",{style:je,type:"color",value:l.color,onChange:a=>n(d=>{const o=[...d.style.background.gradientStops];return o[s]={...o[s],color:a.target.value},{...d,style:{...d.style,background:{...d.style.background,gradientStops:o}}}})}),e.jsx(F,{value:l.position,min:0,max:1,step:.05,onChange:a=>n(d=>{const o=[...d.style.background.gradientStops];return o[s]={...o[s],position:a},{...d,style:{...d.style,background:{...d.style.background,gradientStops:o}}}})})]})]},s))}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Background Opacity"}),e.jsx(F,{value:t.opacity,min:0,max:1,step:.05,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,opacity:l}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Corner Radius"}),e.jsx(F,{value:t.borderRadius,min:0,max:200,step:2,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderRadius:l}}}))})]})]})}function Ps({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Auto Width / Height"}),e.jsx("input",{type:"checkbox",style:it,checked:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,autoSize:l.target.checked}}}))})]})}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Width"}),e.jsx(F,{value:t.width,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,width:l}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Height"}),e.jsx(F,{value:t.height,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,height:l}}}))})]})]})}function Vs({background:t,onChange:n}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Background Stroke"}),e.jsx("input",{type:"checkbox",style:it,checked:t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderEnabled:l.target.checked,borderColor:l.target.checked&&s.style.background.borderColor==="transparent"?"#ffffff":s.style.background.borderColor,borderWidth:l.target.checked?Math.max(s.style.background.borderWidth,2):s.style.background.borderWidth}}}))})]})}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Stroke Color"}),e.jsx("input",{style:{...je,...t.borderEnabled?{}:Ws},type:"color",value:t.borderColor,disabled:!t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderColor:l.target.value}}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Stroke Width"}),e.jsx(F,{value:t.borderWidth,min:0,max:64,step:1,disabled:!t.borderEnabled,onChange:l=>n(s=>({...s,style:{...s.style,background:{...s.style.background,borderWidth:l}}}))})]})]})}const gn={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"};function ot({checked:t,label:n,onChange:l}){return e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:n}),e.jsx("input",{type:"checkbox",style:it,checked:t,onChange:s=>l(s.target.checked)})]})})}function Be({children:t,label:n,open:l,setOpen:s}){return e.jsxs("div",{style:Es,children:[e.jsxs("button",{type:"button",style:Is,onClick:()=>s(a=>!a),children:[e.jsxs("span",{style:zs,children:[e.jsx(Os,{}),e.jsx("span",{children:n})]}),e.jsx("span",{style:Ts,children:l?"−":"+"})]}),l?t:null]})}function Hs({value:t,onChange:n,open:l,setOpen:s}){const a=t.style.background;return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Background Enabled"}),e.jsx("input",{type:"checkbox",style:it,checked:a.enabled,onChange:d=>n(o=>({...o,style:{...o.style,background:{...o.style.background,enabled:d.target.checked}}}))})]})}),a.enabled?e.jsx(Be,{label:"Background Settings",open:l,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{background:a,onChange:n}),e.jsx(Vs,{background:a,onChange:n}),e.jsx(Ps,{background:a,onChange:n})]})}):null]})}function Ks({bend:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,bend:{...r.style.bend??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Bend",checked:a.style.bendEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,bendEnabled:o,bend:r.style.bend??xn()}}))}),a.style.bendEnabled===!0?e.jsx(Be,{label:"Bend",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Bend Preset"}),e.jsx("select",{style:de,value:t.preset,onChange:o=>d({preset:o.target.value}),children:bs.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Bend Strength"}),e.jsx(F,{value:t.strength,min:-100,max:100,step:1,onChange:o=>d({strength:o})})]})]})}):null]})}function _s({glow:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,glow:{...r.style.glow??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Glow",checked:a.style.glowEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,glowEnabled:o,glow:r.style.glow??hn()}}))}),a.style.glowEnabled===!0?e.jsx(Be,{label:"Glow",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:o=>d({color:o.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Style"}),e.jsxs("select",{style:de,value:t.style,onChange:o=>d({style:o.target.value}),children:[e.jsx("option",{value:"outward",children:"Outward"}),e.jsx("option",{value:"contoured",children:"Contoured"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Intensity"}),e.jsx(F,{value:t.intensity??.5,min:0,max:1,step:.05,onChange:o=>d({intensity:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Range"}),e.jsx(F,{value:t.range??.5,min:0,max:1,step:.05,onChange:o=>d({range:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Horizontal Angle"}),e.jsx(F,{value:t.horizontalAngle??0,min:-.5,max:.5,step:.05,onChange:o=>d({horizontalAngle:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Vertical Angle"}),e.jsx(F,{value:t.verticalAngle??0,min:-.5,max:.5,step:.05,onChange:o=>d({verticalAngle:o})})]})]})}):null]})}const Gs={color:"#000000",opacity:1,offset:10,angle:-45,feather:0};function Us({innerShadow:t,open:n,onChange:l,setOpen:s,value:a}){const d=o=>l(r=>({...r,style:{...r.style,innerShadow:{...r.style.innerShadow??t,...o}}}));return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Inner Shadow",checked:a.style.innerShadowEnabled===!0,onChange:o=>l(r=>({...r,style:{...r.style,innerShadowEnabled:o,innerShadow:r.style.innerShadow??Gs}}))}),a.style.innerShadowEnabled===!0?e.jsx(Be,{label:"Inner Shadow",open:n,setOpen:s,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:o=>d({color:o.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Opacity"}),e.jsx(F,{value:t.opacity??1,min:0,max:1,step:.05,onChange:o=>d({opacity:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Offset"}),e.jsx(F,{value:t.offset??10,min:0,max:100,step:1,onChange:o=>d({offset:o})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Angle"}),e.jsx(F,{value:t.angle??-45,min:-180,max:180,step:1,onChange:o=>d({angle:o})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Shadow Feather"}),e.jsx(F,{value:t.feather??0,min:0,max:1,step:.05,onChange:o=>d({feather:o})})]})]})}):null]})}function Xs({layers:t,open:n,onChange:l,setOpen:s,value:a}){const d=(o,r)=>l(y=>{const p=[...y.style.strokeLayers??[]];return p[o]={...p[o],...r},{...y,style:{...y.style,strokeLayers:p}}});return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Outline",checked:a.style.outlineEnabled!==!1,onChange:o=>l(r=>({...r,style:{...r.style,outlineEnabled:o}}))}),a.style.outlineEnabled!==!1?e.jsx(Be,{label:"Outline Editor",open:n,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ce,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:m,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(o=>({...o,style:{...o.style,strokeLayers:[...o.style.strokeLayers??[],gs()]}})),children:"+"})]}),t.length>0?t.map((o,r)=>e.jsxs("div",{style:gn,children:[e.jsxs("div",{style:ce,children:[e.jsxs("span",{style:m,children:["Outline ",r+1]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(y=>({...y,style:{...y.style,strokeLayers:(y.style.strokeLayers??[]).filter((p,x)=>x!==r)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Outline Color"}),e.jsx("input",{style:je,type:"color",value:o.color,onChange:y=>d(r,{color:y.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Outline Opacity"}),e.jsx(F,{value:o.opacity??1,min:0,max:1,step:.05,onChange:y=>d(r,{opacity:y})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Outline Size"}),e.jsx(F,{value:o.width,min:0,max:100,step:1,onChange:y=>d(r,{width:y})})]})]})]},r)):e.jsx("div",{style:{...m,gridColumn:"1 / -1"},children:"No outlines. Use `+` to add one."})]})}):null]})}function Zs({layers:t,open:n,onChange:l,setOpen:s,value:a}){const d=(o,r)=>l(y=>{const p=[...y.style.shadowLayers??[]];return p[o]={...p[o],...r},{...y,style:{...y.style,shadowLayers:p}}});return e.jsxs(e.Fragment,{children:[e.jsx(ot,{label:"Outer Shadow",checked:a.style.shadowEnabled!==!1,onChange:o=>l(r=>{var y;return{...r,style:{...r.style,shadowEnabled:o,shadowLayers:o&&(((y=r.style.shadowLayers)==null?void 0:y.length)??0)===0?[zt()]:r.style.shadowLayers}}})}),a.style.shadowEnabled!==!1?e.jsx(Be,{label:"Shadow Editor",open:n,setOpen:s,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ce,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:m,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(o=>({...o,style:{...o.style,shadowLayers:[...o.style.shadowLayers??[],zt()]}})),children:"+"})]}),t.length>0?t.map((o,r)=>e.jsxs("div",{style:gn,children:[e.jsxs("div",{style:ce,children:[e.jsxs("span",{style:m,children:["Shadow ",r+1]}),e.jsx("button",{type:"button",style:yt,onClick:()=>l(y=>({...y,style:{...y.style,shadowLayers:(y.style.shadowLayers??[]).filter((p,x)=>x!==r)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:o.color,onChange:y=>d(r,{color:y.target.value})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Opacity"}),e.jsx(F,{value:o.opacity??1,min:0,max:1,step:.05,onChange:y=>d(r,{opacity:y})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Offset"}),e.jsx(F,{value:o.offset??10,min:0,max:100,step:1,onChange:y=>d(r,{offset:y})})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Shadow Angle"}),e.jsx(F,{value:o.angle??-45,min:-180,max:180,step:1,onChange:y=>d(r,{angle:y})})]}),e.jsxs("label",{style:q,children:[e.jsx("span",{style:m,children:"Shadow Feather"}),e.jsx(F,{value:o.feather??0,min:0,max:1,step:.05,onChange:y=>d(r,{feather:y})})]})]})]},r)):e.jsx("div",{style:{...m,gridColumn:"1 / -1"},children:"No outer shadows. Use `+` to add one."})]})}):null]})}function Ys({backgroundSettingsOpen:t,bend:n,bendSettingsOpen:l,glow:s,glowSettingsOpen:a,innerShadow:d,innerShadowSettingsOpen:o,onChange:r,outlineLayers:y,outlineSettingsOpen:p,setBackgroundSettingsOpen:x,setBendSettingsOpen:c,setGlowSettingsOpen:g,setInnerShadowSettingsOpen:h,setOutlineSettingsOpen:i,setShadowSettingsOpen:b,shadowLayers:j,shadowSettingsOpen:k,value:C}){return e.jsxs("div",{style:me,children:[e.jsx(Xs,{value:C,onChange:r,layers:y,open:p,setOpen:i}),e.jsx(Zs,{value:C,onChange:r,layers:j,open:k,setOpen:b}),e.jsx(Us,{value:C,onChange:r,innerShadow:d,open:a,setOpen:g}),e.jsx(_s,{value:C,onChange:r,glow:s,open:o,setOpen:h}),e.jsx(Ks,{value:C,onChange:r,bend:n,open:l,setOpen:c}),e.jsx(Hs,{value:C,onChange:r,open:t,setOpen:x})]})}function qs({value:t,onChange:n}){const l=t.style.bold===!0||t.style.fontStyle==="italic"||t.style.underline===!0||t.style.strikethrough===!0;return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Text Color"}),e.jsx("input",{style:je,type:"color",value:t.style.color,onChange:s=>n(a=>({...a,style:{...a.style,color:s.target.value}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Font Size"}),e.jsx(F,{value:t.style.fontSize,min:16,max:180,step:4,onChange:s=>n(a=>({...a,layout:{...a.layout,minFontSize:Math.min(a.layout.minFontSize??s,s)},style:{...a.style,fontSize:s}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Letter Spacing"}),e.jsx(F,{value:t.style.letterSpacing,min:0,max:1,step:.05,onChange:s=>n(a=>({...a,style:{...a.style,letterSpacing:s}}))})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Line Spacing"}),e.jsx(F,{value:t.style.lineSpacing,min:0,max:1,step:.05,onChange:s=>n(a=>({...a,style:{...a.style,lineSpacing:s}}))})]}),e.jsxs("div",{style:q,children:[e.jsx("span",{style:m,children:"Text Style"}),e.jsxs("div",{style:Fs,children:[e.jsx("button",{type:"button",style:He(!l),onClick:()=>n(s=>({...s,style:{...s.style,bold:!1,fontWeight:s.style.fontWeight==="bold"?"normal":s.style.fontWeight,fontStyle:"normal",underline:!1,strikethrough:!1}})),children:"None"}),e.jsx("button",{type:"button",style:He(t.style.bold===!0),onClick:()=>n(s=>({...s,style:{...s.style,bold:s.style.bold!==!0,fontWeight:s.style.bold!==!0?"bold":400}})),children:"B"}),e.jsx("button",{type:"button",style:He(t.style.fontStyle==="italic"),onClick:()=>n(s=>({...s,style:{...s.style,fontStyle:s.style.fontStyle==="italic"?"normal":"italic"}})),children:"I"}),e.jsx("button",{type:"button",style:He(t.style.underline===!0),onClick:()=>n(s=>({...s,style:{...s.style,underline:s.style.underline!==!0}})),children:"U"}),e.jsx("button",{type:"button",style:He(t.style.strikethrough===!0),onClick:()=>n(s=>({...s,style:{...s.style,strikethrough:s.style.strikethrough!==!0}})),children:"S"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Horizontal Alignment"}),e.jsxs("select",{style:de,value:t.layout.textAlign??"center",onChange:s=>n(a=>({...a,layout:{...a.layout,textAlign:s.target.value}})),children:[e.jsx("option",{value:"left",children:"left"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"right",children:"right"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Vertical Alignment"}),e.jsxs("select",{style:de,value:t.layout.verticalAlign??"center",onChange:s=>n(a=>({...a,layout:{...a.layout,verticalAlign:s.target.value}})),children:[e.jsx("option",{value:"top",children:"top"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"bottom",children:"bottom"})]})]}),e.jsxs("label",{style:R,children:[e.jsx("span",{style:m,children:"Overflow"}),e.jsxs("select",{style:de,value:t.layout.overflow,onChange:s=>n(a=>({...a,layout:{...a.layout,overflow:s.target.value}})),children:[e.jsx("option",{value:"clip",children:"Clip text"}),e.jsx("option",{value:"ellipsis",children:"Show ellipsis"}),e.jsx("option",{value:"clamp",children:"Clamp"}),e.jsx("option",{value:"shrink",children:"Shrink"})]})]}),e.jsx("label",{style:q,children:e.jsxs("div",{style:ce,children:[e.jsx("span",{style:m,children:"Resize To Fit"}),e.jsx("input",{type:"checkbox",style:it,checked:t.layout.resizeToFit===!0,onChange:s=>n(a=>({...a,layout:{...a.layout,resizeToFit:s.target.checked}}))})]})})]})}const Js={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},le={display:"flex",flexDirection:"column",gap:4},bt={...le,gridColumn:"1 / -1"},G={fontSize:9,color:"rgba(226,232,240,0.72)"},Qs={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},el={...Qs,fontVariantNumeric:"tabular-nums"},tl={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},nl={width:16,height:16},sl=t=>/^-?\d*(\.\d*)?$/.test(t),Q=({value:t,onChange:n,step:l=1,min:s,max:a,disabled:d=!1})=>{const[o,r]=u.useState(String(t));u.useEffect(()=>r(String(t)),[t]);const y=p=>{let x=p;return typeof s=="number"&&(x=Math.max(s,x)),typeof a=="number"&&(x=Math.min(a,x)),x};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:el,value:o,disabled:d,onChange:p=>{const x=p.target.value;if(!sl(x)||(r(x),x===""||x==="-"||x==="."||x==="-."))return;const c=Number(x);Number.isNaN(c)||n(y(c))},onBlur:()=>{const p=Number(o);if(Number.isNaN(p)){r(String(t));return}const x=y(p);r(String(x)),n(x)},onKeyDown:p=>{if(p.key!=="ArrowUp"&&p.key!=="ArrowDown")return;p.preventDefault();const x=p.shiftKey?l*10:p.altKey?l/10:l,c=p.key==="ArrowUp"?t+x:t-x;n(y(Number.isInteger(c)?c:Number(c.toFixed(6))))}})},Ft=({value:t,onChange:n,guideLabel:l,showRenderOrder:s=!0})=>{var a,d;return e.jsxs("div",{style:Js,children:[e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Position X"}),e.jsx(Q,{value:t.position.x,min:-4096,max:4096,step:1,onChange:o=>n({...t,position:{...t.position,x:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Position Y"}),e.jsx(Q,{value:t.position.y,min:-4096,max:4096,step:1,onChange:o=>n({...t,position:{...t.position,y:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Size X"}),e.jsx(Q,{value:t.size.width,min:0,max:8192,step:1,onChange:o=>n({...t,size:{...t.size,width:o}})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Size Y"}),e.jsx(Q,{value:t.size.height,min:0,max:8192,step:1,onChange:o=>n({...t,size:{...t.size,height:o}})})]}),e.jsxs("label",{style:bt,children:[e.jsx("span",{style:G,children:"Rotation"}),e.jsx(Q,{value:t.rotation,min:-360,max:360,step:1,onChange:o=>n({...t,rotation:o})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Scale 2D X"}),e.jsx(Q,{value:((a=t.scale2D)==null?void 0:a.x)??1,min:-10,max:10,step:.01,onChange:o=>{var r;return n({...t,scale2D:{x:o,y:((r=t.scale2D)==null?void 0:r.y)??1}})}})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Scale 2D Y"}),e.jsx(Q,{value:((d=t.scale2D)==null?void 0:d.y)??1,min:-10,max:10,step:.01,onChange:o=>{var r;return n({...t,scale2D:{x:((r=t.scale2D)==null?void 0:r.x)??1,y:o}})}})]}),e.jsxs("label",{style:bt,children:[e.jsx("span",{style:G,children:"Reference Pixels Per Unit"}),e.jsx(Q,{value:t.referencePixelsPerUnit??32,min:1,max:512,step:1,onChange:o=>n({...t,referencePixelsPerUnit:o})})]}),s?e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Render Order"}),e.jsx(Q,{value:t.renderOrder,min:-9999,max:9999,step:1,onChange:o=>n({...t,renderOrder:o})})]}):null,e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Pivot X"}),e.jsx(Q,{value:t.pivot[0],min:0,max:1,step:.01,onChange:o=>n({...t,pivot:[o,t.pivot[1]]})})]}),e.jsxs("label",{style:le,children:[e.jsx("span",{style:G,children:"Pivot Y"}),e.jsx(Q,{value:t.pivot[1],min:0,max:1,step:.01,onChange:o=>n({...t,pivot:[t.pivot[0],o]})})]}),e.jsx("label",{style:bt,children:e.jsxs("div",{style:tl,children:[e.jsx("span",{style:G,children:l}),e.jsx("input",{type:"checkbox",style:nl,checked:t.showGuides,onChange:o=>n({...t,showGuides:o.target.checked})})]})})]})};function ll({value:t,onChange:n}){return e.jsx(Ft,{value:yn(t.transformation,t.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:l=>n(s=>({...s,transformation:js(l,s.transformation),screenTransform:un(l,s.screenTransform)}))})}const il=({value:t,onChange:n,copyLabel:l,inspector:s})=>{var ye;const[a,d]=u.useState(()=>$.createSceneObject({name:l??"Screen Text",renderGroupId:We.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=u.useState(()=>{const N=a.id,f=$.createDefaultComponent("ScreenTransform",N),v=$.createDefaultComponent("ScreenText",N),A=$.createDefaultComponent("Material",N),z=$.createDefaultComponent("Texture",N);return{screenTransform:f,screenText:v,material:A,texture:z}}),[r,y]=u.useState(!0),[p,x]=u.useState(!0),[c,g]=u.useState(!0),[h,i]=u.useState(!0),[b,j]=u.useState(!0),[k,C]=u.useState(!0),[L,S]=u.useState({text2d:!0,content:!0,transformation:!0,style:!0,textEffect:!0}),w=yn(t.screenText.transformation,t.screenText.screenTransform),O={object:{...a,componentIds:[o.screenTransform.id,o.screenText.id,o.material.id,o.texture.id]},kind:"screenText",components:[{...o.screenTransform,settings:t.screenText.screenTransform??un(w)},{...o.screenText,settings:t.screenText},{...o.material,settings:{...o.material.settings,color:t.screenText.style.color,opacity:t.screenText.style.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenText.style.background.textureUrl,flipX:t.screenText.style.background.textureFlipX,flipY:t.screenText.style.background.textureFlipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},T=N=>{n({...t,screenText:N(t.screenText)})},B=t.screenText.style.strokeLayers??[],_=t.screenText.style.shadowEnabled!==!1&&(((ye=t.screenText.style.shadowLayers)==null?void 0:ye.length)??0)===0?[zt()]:t.screenText.style.shadowLayers??[],he=t.screenText.style.innerShadow??{color:"#000000",opacity:1,offset:10,angle:-45,feather:0},te=t.screenText.style.glow??hn(),xe=t.screenText.style.bend??xn(),M=N=>S(f=>({...f,[N]:!f[N]})),I=(N,f,v,A)=>e.jsx(Ls,{label:f,icon:v,open:L[N],onToggle:()=>M(N),children:A},N);return e.jsxs(ut,{objectId:(s==null?void 0:s.objectId)??a.id,objectName:(s==null?void 0:s.objectName)??a.name,onObjectNameChange:(s==null?void 0:s.onObjectNameChange)??(N=>d(f=>({...f,name:N}))),layer:(s==null?void 0:s.layer)??"Default Layer",visible:(s==null?void 0:s.visible)??t.screenText.enabled,onVisibleChange:(s==null?void 0:s.onVisibleChange)??(N=>T(f=>({...f,enabled:N}))),copyConfig:(s==null?void 0:s.copyConfig)??O,initialPosition:s==null?void 0:s.initialPosition,position:s==null?void 0:s.position,onPositionChange:s==null?void 0:s.onPositionChange,title:s==null?void 0:s.title,children:[I("transformation","Transformation",e.jsx(Ns,{}),e.jsx(ll,{value:t.screenText,onChange:T})),I("text2d","2D Text",e.jsx(Bt,{}),e.jsxs(e.Fragment,{children:[I("content","Content",e.jsx(Bt,{}),e.jsx($s,{value:t.screenText,onChange:T})),I("style","Style",e.jsx(Pt,{}),e.jsx(qs,{value:t.screenText,onChange:T})),I("textEffect","Text Effect",e.jsx(Pt,{}),e.jsx(Ys,{value:t.screenText,onChange:T,outlineLayers:B,shadowLayers:_,innerShadow:he,glow:te,bend:xe,outlineSettingsOpen:r,setOutlineSettingsOpen:y,shadowSettingsOpen:p,setShadowSettingsOpen:x,innerShadowSettingsOpen:c,setInnerShadowSettingsOpen:g,glowSettingsOpen:h,setGlowSettingsOpen:i,bendSettingsOpen:b,setBendSettingsOpen:j,backgroundSettingsOpen:k,setBackgroundSettingsOpen:C}))]}))]})},ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAUAAgMAAAAToI2uAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFqampbGxsAAAA/lGquwAAAAN0Uk5T//8A18oNQQAABPRJREFUeJztzssNQWEYQEG3CP1oQqJGsdCfBFs7j8X8+eRMBbPtBtpWB35RWimtlFZKK6WV0kppZWj6uLrwrceltFFaKa2UVkorpZXSSmlldPp2XT350P5Q2iitlFZKK6WV0kpppbRSWimtlFZKK3+RPq8OvXM/lTZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK3+THqG0UloprZRWSiulldJKaaW0UloprZRWSiuv6VFKK6WV0kpppbRSWimtlFbGpgcqrZRWSiulldJKaaW0MjL9BFWtRqVFuJpUAAAAAElFTkSuQmCC",rl={placeholder:"Placeholder","hero-image":"Hero Image","photo-frame":"Default Frame"},al=Object.entries(rl).map(([t,n])=>({value:t,label:n})),dl={placeholder:{transformation:{showFitGuides:!1},image:{sourceKind:"default",stretchMode:"fit",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"hero-image":{transformation:{position:{x:0,y:.08},size:{width:.96,height:.62},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",stretchMode:"fillAndCut",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"photo-frame":{transformation:{position:{x:0,y:.01},size:{width:2,height:2},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",src:ol,stretchMode:"fill",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}}},cl=(t,n)=>{const l=dl[n];return{...t,preset:n,...l.enabled!==void 0?{enabled:l.enabled}:{},transformation:{...t.transformation,...l.transformation??{}},image:{...t.image,...l.image??{}}}},pl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},et={display:"flex",flexDirection:"column",gap:4},hl={...et,gridColumn:"1 / -1"},Ke={fontSize:9,color:"rgba(226,232,240,0.72)"},Lt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Vt={...Lt,appearance:"none"},xl={...Lt,fontVariantNumeric:"tabular-nums"},yl={...Lt,padding:2,cursor:"pointer"},ul=t=>/^-?\d*(\.\d*)?$/.test(t),Ht=({value:t,onChange:n,step:l=1,min:s,max:a})=>{const[d,o]=u.useState(String(t));u.useEffect(()=>o(String(t)),[t]);const r=y=>{let p=y;return typeof s=="number"&&(p=Math.max(s,p)),typeof a=="number"&&(p=Math.min(a,p)),p};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:xl,value:d,onChange:y=>{const p=y.target.value;if(!ul(p)||(o(p),p===""||p==="-"||p==="."||p==="-."))return;const x=Number(p);Number.isNaN(x)||n(r(x))},onBlur:()=>{const y=Number(d);if(Number.isNaN(y)){o(String(t));return}const p=r(y);o(String(p)),n(p)},onKeyDown:y=>{if(y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;y.preventDefault();const p=y.shiftKey?l*10:y.altKey?l/10:l,x=y.key==="ArrowUp"?t+p:t-p;n(r(Number.isInteger(x)?x:Number(x.toFixed(6))))}})},gl=({value:t,onChange:n})=>e.jsxs("div",{style:pl,children:[e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Material Type"}),e.jsxs("select",{style:Vt,value:t.materialType,onChange:l=>n({...t,materialType:l.target.value}),children:[e.jsx("option",{value:"unlit",children:"Unlit"}),e.jsx("option",{value:"standardPBR",children:"Standard PBR"}),e.jsx("option",{value:"matcap",children:"Matcap"})]})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Blend Mode"}),e.jsxs("select",{style:Vt,value:t.blendMode,onChange:l=>n({...t,blendMode:l.target.value}),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"add",children:"Add"}),e.jsx("option",{value:"subtract",children:"Subtract"}),e.jsx("option",{value:"multiply",children:"Multiply"}),e.jsx("option",{value:"screen",children:"Screen"}),e.jsx("option",{value:"lighten",children:"Lighten"}),e.jsx("option",{value:"darken",children:"Darken"}),e.jsx("option",{value:"overlay",children:"Overlay"}),e.jsx("option",{value:"softLight",children:"Soft Light"}),e.jsx("option",{value:"hardLight",children:"Hard Light"}),e.jsx("option",{value:"difference",children:"Difference"}),e.jsx("option",{value:"exclusion",children:"Exclusion"})]})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Opacity"}),e.jsx(Ht,{value:t.opacity,min:0,max:1,step:.01,onChange:l=>n({...t,opacity:l})})]}),e.jsxs("label",{style:et,children:[e.jsx("span",{style:Ke,children:"Tint"}),e.jsx("input",{type:"color",style:yl,value:t.color,onChange:l=>n({...t,color:l.target.value})})]}),e.jsxs("label",{style:hl,children:[e.jsx("span",{style:Ke,children:"Alpha Test"}),e.jsx(Ht,{value:t.alphaTest,min:0,max:1,step:.01,onChange:l=>n({...t,alphaTest:l})})]})]}),bl={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},fl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},jl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},ml={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Sl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},wl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),kl={display:"grid",gap:7,padding:"0 7px 7px"},vl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},tt={display:"flex",flexDirection:"column",gap:4},ft={...tt,gridColumn:"1 / -1"},Se={fontSize:9,color:"rgba(226,232,240,0.72)"},bn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},jt={...bn,appearance:"none"},mt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},St={width:16,height:16},Cl=[{value:"default",label:"Default"},{value:"image",label:"Image"},{value:"gif",label:"GIF"}],Rl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 2v8.76l4.5-4.5 3.2 3.2 2.8-2.8L19 14.16V6H5zm12 3a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),El=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2h2v4h3l-4 4-4-4h3V2zm0 20v-4H8l4-4 4 4h-3v4h-2zM2 11h4V8l4 4-4 4v-3H2v-2zm20 0v2h-4v3l-4-4 4-4v3h4z"})}),Il=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2 3 7v10l9 5 9-5V7l-9-5zm0 2.3L17.9 7 12 9.7 6.1 7 12 4.3zM5 8.5l6 2.7v7.9l-6-3.3V8.5zm8 10.6v-7.9l6-2.7v7.3l-6 3.3z"})}),Kt=(t,n)=>({enabled:(n==null?void 0:n.enabled)??t.enabled,showGuides:(n==null?void 0:n.showTransformGuides)??t.showFitGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(n==null?void 0:n.position)??t.position,size:(n==null?void 0:n.size)??t.size,rotation:(n==null?void 0:n.rotation)??t.rotation,scale2D:n==null?void 0:n.scale2D,referencePixelsPerUnit:n==null?void 0:n.referencePixelsPerUnit,pivot:(n==null?void 0:n.pivot)??t.pivot,renderOrder:(n==null?void 0:n.renderOrder)??t.renderOrder,overlay:(n==null?void 0:n.overlay)??t.overlay,visible:(n==null?void 0:n.visible)??t.visible}),zl=(t,n)=>({...n,enabled:t.enabled,showFitGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),_t=(t,n)=>({...$.DEFAULT_SCREEN_TRANSFORM_2D,...n,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(n==null?void 0:n.scale2D)??$.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(n==null?void 0:n.referencePixelsPerUnit)??$.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),Tl=({value:t,onChange:n,copyLabel:l,inspector:s})=>{const[a,d]=u.useState(()=>$.createSceneObject({name:l??"Screen Image",renderGroupId:We.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=u.useState(()=>{const h=a.id,i=$.createDefaultComponent("ScreenTransform",h),b=$.createDefaultComponent("ScreenImage",h),j=$.createDefaultComponent("Material",h),k=$.createDefaultComponent("Texture",h);return{screenTransform:i,screenImage:b,material:j,texture:k}}),[r,y]=u.useState({transformation:!0,image:!0,material:!0}),p=Kt(t.screenImage.transformation,t.screenImage.screenTransform),x={object:{...a,componentIds:[o.screenTransform.id,o.screenImage.id,o.material.id,o.texture.id]},kind:"screenImage",components:[{...o.screenTransform,settings:t.screenImage.screenTransform??_t(p)},{...o.screenImage,settings:t.screenImage},{...o.material,settings:{...o.material.settings,color:t.screenImage.image.color,opacity:t.screenImage.image.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenImage.image.src||void 0,flipX:t.screenImage.image.flipX,flipY:t.screenImage.image.flipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},c=h=>{n({...t,screenImage:h(t.screenImage)})},g=(h,i,b,j)=>e.jsxs("div",{style:fl,children:[e.jsxs("div",{style:jl,children:[e.jsx("button",{type:"button",onClick:()=>y(k=>({...k,[h]:!k[h]})),style:Sl,children:e.jsx("div",{style:wl(r[h])})}),e.jsxs("div",{style:ml,children:[e.jsx("span",{style:bl,children:b}),e.jsx("span",{children:i})]})]}),r[h]?e.jsx("div",{style:kl,children:j}):null]},h);return e.jsxs(ut,{objectId:(s==null?void 0:s.objectId)??a.id,objectName:(s==null?void 0:s.objectName)??a.name,onObjectNameChange:(s==null?void 0:s.onObjectNameChange)??(h=>d(i=>({...i,name:h}))),layer:(s==null?void 0:s.layer)??"Default Layer",visible:(s==null?void 0:s.visible)??t.screenImage.enabled,onVisibleChange:(s==null?void 0:s.onVisibleChange)??(h=>c(i=>({...i,enabled:h}))),copyConfig:(s==null?void 0:s.copyConfig)??x,initialPosition:s==null?void 0:s.initialPosition,position:s==null?void 0:s.position,onPositionChange:s==null?void 0:s.onPositionChange,title:s==null?void 0:s.title,children:[g("transformation","Transformation",e.jsx(El,{}),e.jsx(Ft,{value:Kt(t.screenImage.transformation,t.screenImage.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:h=>c(i=>({...i,transformation:zl(h,i.transformation),screenTransform:_t(h,i.screenTransform)}))})),g("image","Image",e.jsx(Rl,{}),e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Preset"}),e.jsx("select",{style:jt,value:t.screenImage.preset,onChange:h=>c(i=>cl(i,h.target.value)),children:al.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))})]}),e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Source Kind"}),e.jsx("select",{style:jt,value:t.screenImage.image.sourceKind,onChange:h=>c(i=>({...i,image:{...i.image,sourceKind:h.target.value}})),children:Cl.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))})]}),t.screenImage.image.sourceKind==="image"||t.screenImage.image.sourceKind==="gif"?e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Source URL"}),e.jsx("input",{style:bn,value:t.screenImage.image.src,onChange:h=>c(i=>({...i,image:{...i.image,src:h.target.value}}))})]}):null,e.jsxs("label",{style:tt,children:[e.jsx("span",{style:Se,children:"Stretch Mode"}),e.jsxs("select",{style:jt,value:t.screenImage.image.stretchMode,onChange:h=>c(i=>({...i,image:{...i.image,stretchMode:h.target.value}})),children:[e.jsx("option",{value:"fit",children:"Fit"}),e.jsx("option",{value:"fitWidth",children:"Fit Width"}),e.jsx("option",{value:"fitHeight",children:"Fit Height"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"stretch",children:"Stretch"}),e.jsx("option",{value:"fill",children:"Fill"}),e.jsx("option",{value:"fillAndCut",children:"Fill and Cut"})]})]}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Flip X"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.flipX,onChange:h=>c(i=>({...i,image:{...i.image,flipX:h.target.checked}}))})]})}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Flip Y"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.flipY,onChange:h=>c(i=>({...i,image:{...i.image,flipY:h.target.checked}}))})]})})]})),g("material","Material",e.jsx(Il,{}),e.jsxs("div",{style:vl,children:[e.jsx(gl,{value:t.screenImage.image,onChange:h=>c(i=>({...i,image:{...i.image,materialType:h.materialType,blendMode:h.blendMode,opacity:h.opacity,color:h.color,alphaTest:h.alphaTest}}))}),e.jsx("label",{style:ft,children:e.jsxs("div",{style:mt,children:[e.jsx("span",{style:Se,children:"Transparent"}),e.jsx("input",{type:"checkbox",style:St,checked:t.screenImage.image.transparent,onChange:h=>c(i=>({...i,image:{...i.image,transparent:h.target.checked}}))})]})})]}))]})},$e={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},Me={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Ml=({onChange:t,value:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[n.map((l,s)=>e.jsxs("div",{style:$e,children:[e.jsx("input",{"aria-label":`Gradient stop ${s+1} color`,type:"color",style:{...Me,padding:2},value:l.color,onChange:a=>t(n.map((d,o)=>o===s?{...d,color:a.currentTarget.value}:d))}),e.jsxs("span",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:4},children:[e.jsx("input",{"aria-label":`Gradient stop ${s+1} position`,type:"number",min:0,max:1,step:.05,style:Me,value:l.offset,onChange:a=>t(n.map((d,o)=>o===s?{...d,offset:Number(a.currentTarget.value)}:d))}),n.length>2?e.jsx("button",{type:"button",onClick:()=>t(n.filter((a,d)=>d!==s)),children:"−"}):null]})]},`${s}-${l.color}`)),n.length<X.MAX_SCREEN_GRADIENT_STOPS?e.jsx("button",{type:"button",onClick:()=>{var l;return t([...n,{offset:.5,color:((l=n[n.length-1])==null?void 0:l.color)??"#ffffff"}])},children:"Add stop"}):null]}),fn=({onChange:t,value:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Gradient"}),e.jsxs("select",{style:Me,value:n.type,onChange:l=>t({...n,type:l.currentTarget.value}),children:[e.jsx("option",{value:"linear",children:"Linear"}),e.jsx("option",{value:"radial",children:"Radial"}),e.jsx("option",{value:"angular",children:"Conic / Angular"})]})]}),e.jsx(Ml,{value:n.stops,onChange:l=>t({...n,stops:l})}),n.type!=="radial"?e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Angle"}),e.jsx("input",{type:"number",style:Me,step:5,value:n.angle,onChange:l=>t({...n,angle:Number(l.currentTarget.value)})})]}):null,n.type!=="linear"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Center X"}),e.jsx("input",{type:"number",style:Me,min:0,max:1,step:.05,value:n.center.x,onChange:l=>t({...n,center:{...n.center,x:Number(l.currentTarget.value)}})})]}),e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Center Y"}),e.jsx("input",{type:"number",style:Me,min:0,max:1,step:.05,value:n.center.y,onChange:l=>t({...n,center:{...n.center,y:Number(l.currentTarget.value)}})})]})]}):null,n.type==="radial"?e.jsxs("label",{style:$e,children:[e.jsx("span",{children:"Radius"}),e.jsx("input",{type:"number",style:Me,min:.01,step:.05,value:n.radius,onChange:l=>t({...n,radius:Number(l.currentTarget.value)})})]}):null]}),Gt={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},Ut={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},jn=({value:t,onChange:n})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:Gt,children:[e.jsx("span",{children:"Tint"}),e.jsx("input",{type:"color",style:{...Ut,padding:2},value:t.tint,onChange:l=>n({...t,tint:l.currentTarget.value})})]}),["opacity","frost","highlight"].map(l=>e.jsxs("label",{style:Gt,children:[e.jsx("span",{children:l[0].toUpperCase()+l.slice(1)}),e.jsx("input",{type:"number",style:Ut,min:0,max:1,step:.05,value:t[l],onChange:s=>n({...t,[l]:Number(s.currentTarget.value)})})]},l))]}),Wl={borderRadius:12,border:"1px solid rgba(255,255,255,.08)",background:"rgba(255,255,255,.03)",padding:8},Ae={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},nt={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},ne=({label:t,onValue:n,...l})=>e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:t}),e.jsx("input",{...l,type:"number",style:nt,onChange:s=>n(Number(s.currentTarget.value))})]}),mn=({value:t,onChange:n})=>e.jsxs("section",{style:Wl,children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,marginBottom:7},children:"Screen Shape"}),e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Shape"}),e.jsxs("select",{style:nt,value:t.kind,onChange:l=>n({...t,kind:l.currentTarget.value}),children:[e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"ellipse",children:"Ellipse"}),e.jsx("option",{value:"rectangle",children:"Rectangle"}),e.jsx("option",{value:"roundedRectangle",children:"Rounded Rectangle"}),e.jsx("option",{value:"polygon",children:"Polygon"}),e.jsx("option",{value:"star",children:"Star"}),e.jsx("option",{value:"line",children:"Line"})]})]}),t.kind!=="line"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Fill"}),e.jsxs("select",{style:nt,value:t.fillMode,onChange:l=>n({...t,fillMode:l.currentTarget.value}),children:[e.jsx("option",{value:"solid",children:"Solid"}),e.jsx("option",{value:"gradient",children:"Gradient"}),e.jsx("option",{value:"glass",children:"Glass"})]})]}),t.fillMode==="gradient"?e.jsx(fn,{value:t.gradient,onChange:l=>n({...t,gradient:l})}):t.fillMode==="glass"?e.jsx(jn,{value:t.glass,onChange:l=>n({...t,glass:l})}):e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Color"}),e.jsx("input",{type:"color",style:{...nt,padding:2},value:t.fillColor,onChange:l=>n({...t,fillColor:l.currentTarget.value})})]}),e.jsx(ne,{label:"Fill Opacity",min:0,max:1,step:.05,value:t.fillOpacity,onValue:l=>n({...t,fillOpacity:l})})]}):null,e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Stroke"}),e.jsx("input",{type:"color",style:{...nt,padding:2},value:t.strokeColor,onChange:l=>n({...t,strokeColor:l.currentTarget.value})})]}),e.jsx(ne,{label:"Stroke Width",min:0,step:1,value:t.strokeWidth,onValue:l=>n({...t,strokeWidth:l})}),e.jsx(ne,{label:"Stroke Opacity",min:0,max:1,step:.05,value:t.strokeOpacity,onValue:l=>n({...t,strokeOpacity:l})}),e.jsxs("label",{style:Ae,children:[e.jsx("span",{children:"Dashed"}),e.jsx("input",{type:"checkbox",checked:t.dashed,onChange:l=>n({...t,dashed:l.currentTarget.checked})})]}),t.kind==="roundedRectangle"?e.jsx(ne,{label:"Corner Radius",min:0,max:.5,step:.01,value:t.cornerRadius,onValue:l=>n({...t,cornerRadius:l})}):null,t.kind==="polygon"||t.kind==="star"?e.jsx(ne,{label:t.kind==="star"?"Points":"Sides",min:3,max:12,step:1,value:t.sides,onValue:l=>n({...t,sides:l})}):null,t.kind==="star"?e.jsx(ne,{label:"Inner Radius",min:.05,max:.95,step:.05,value:t.innerRadiusRatio,onValue:l=>n({...t,innerRadiusRatio:l})}):null,t.kind==="line"?e.jsxs(e.Fragment,{children:[e.jsx(ne,{label:"Start X",min:0,max:1,step:.05,value:t.lineStart.x,onValue:l=>n({...t,lineStart:{...t.lineStart,x:l}})}),e.jsx(ne,{label:"Start Y",min:0,max:1,step:.05,value:t.lineStart.y,onValue:l=>n({...t,lineStart:{...t.lineStart,y:l}})}),e.jsx(ne,{label:"End X",min:0,max:1,step:.05,value:t.lineEnd.x,onValue:l=>n({...t,lineEnd:{...t.lineEnd,x:l}})}),e.jsx(ne,{label:"End Y",min:0,max:1,step:.05,value:t.lineEnd.y,onValue:l=>n({...t,lineEnd:{...t.lineEnd,y:l}})})]}):null]}),Fl={enabled:!0,bothHands:!0,visualScale:1,opacity:.92,pointRadius:3,lineWidth:3,labelScale:1.2,smoothing:.35,color:"#22d3ee",showBoundingBox:!0,showLabels:!1,logToConsole:!1},Ll={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},Sn={pointerEvents:"auto",width:286,borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:"rgba(148,163,184,0.55) rgba(255,255,255,0.06)",overscrollBehavior:"contain"},Nl={...Sn,width:32,height:32,borderRadius:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},Ol={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:7,padding:"7px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)"},$l={width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)",flex:"0 0 auto"},Al={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:600,minWidth:0},Xt={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Dl={display:"grid",gap:6,padding:7},Bl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Pl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Vl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Hl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Kl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),_l={display:"grid",gap:7,padding:"0 7px 7px"},Gl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},Te={display:"flex",flexDirection:"column",gap:4},_e={...Te,gridColumn:"1 / -1"},ee={fontSize:9,color:"rgba(226,232,240,0.72)"},Le={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},Ge={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},Ue={width:16,height:16},Zt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"},Ul=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2zm0-8h10v2H7V6z"})}),Xl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.3 5.71 12 12l6.3 6.29-1.41 1.41L10.59 13.41 4.29 19.7 2.88 18.29 9.17 12 2.88 5.71 4.29 4.3l6.3 6.29 6.29-6.3z"})}),Zl=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),wt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2a1 1 0 0 1 1 1v6h1V3a1 1 0 1 1 2 0v6h1V4a1 1 0 1 1 2 0v7.3l1.6 2.4a5 5 0 0 1 .8 2.7V18a4 4 0 0 1-4 4H9a6 6 0 0 1-6-6v-3.5a2.5 2.5 0 0 1 5 0V15h1V3a1 1 0 0 1 1-1z"})}),Yl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5V2L7 7l5 5V9a4 4 0 1 1-4 4H6a6 6 0 1 0 6-8z"})}),ql=({value:t,onChange:n})=>{const[l,s]=u.useState(!0),[a,d]=u.useState({x:14,y:104}),[o,r]=u.useState(typeof window>"u"?0:window.innerHeight),[y,p]=u.useState({overlay:!0,visibility:!1}),x=u.useRef(null),c=Math.max(240,o-a.y-16);u.useEffect(()=>{const i=j=>{x.current&&d({x:Math.max(8,j.clientX-x.current.x),y:Math.max(8,j.clientY-x.current.y)})},b=()=>{x.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",b),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",b)}},[]),u.useEffect(()=>{const i=()=>r(window.innerHeight);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const g=i=>{const b=i.currentTarget.getBoundingClientRect();x.current={x:i.clientX-b.left,y:i.clientY-b.top},document.body.classList.add("select-none"),i.currentTarget.setPointerCapture(i.pointerId)},h=(i,b,j,k)=>e.jsxs("div",{style:Bl,children:[e.jsxs("div",{style:Pl,children:[e.jsx("button",{type:"button",onClick:()=>p(C=>({...C,[i]:!C[i]})),style:Hl,children:e.jsx("div",{style:Kl(y[i])})}),e.jsxs("div",{style:Vl,children:[e.jsx("span",{style:Xt,children:j}),e.jsx("span",{children:b})]})]}),y[i]?e.jsx("div",{style:_l,children:k}):null]},i);return typeof document>"u"?null:pe.createPortal(e.jsxs("div",{style:{...Ll,left:a.x,top:a.y},children:[e.jsx("style",{children:`
|
|
2
2
|
.xr-hand-tracking-2d-scroll::-webkit-scrollbar { width: 10px; }
|
|
3
3
|
.xr-hand-tracking-2d-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 999px; }
|
|
4
4
|
.xr-hand-tracking-2d-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.55); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
|