cozyclay 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/INSTALL_FOR_AGENTS.md +146 -0
- package/README.md +74 -192
- package/THIRD_PARTY_NOTICES.md +0 -21
- package/bin/agent/agent-routes.mjs +22 -56
- package/bin/agent/agent-runner.mjs +5 -3
- package/bin/agent/main-agent.mjs +70 -0
- package/bin/agent/main-prompt.mjs +17 -0
- package/bin/agent/session-store.mjs +2 -2
- package/bin/agent/studio-prompt.mjs +1 -1
- package/bin/agent/studio-task-routes.mjs +185 -0
- package/bin/agent/studio-tasks.mjs +156 -0
- package/bin/agent/studio-tools.mjs +3 -2
- package/bin/agent/studio-turn-transaction.mjs +76 -0
- package/bin/cozyclay.mjs +5 -7
- package/dist/app/index.html +7 -6
- package/dist/assets/TaskBoard-DdDXMgZm.js +1 -0
- package/dist/assets/app-B2BpfCl2.js +5088 -0
- package/dist/assets/app-BlwOpest.css +1 -0
- package/dist/assets/compile-worker-D0pKioa0.js +5 -0
- package/dist/assets/landing-y3EqDgSZ.js +1 -0
- package/dist/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/dist/assets/motion3-compile-B887n77J.js +1 -0
- package/dist/assets/scene-asset-sync-COGOlF5T.css +1 -0
- package/dist/assets/scene-asset-sync-CQzEdsqu.js +13 -0
- package/dist/assets/task-board-BKaM7d-9.js +14 -0
- package/dist/assets/workflow-B8Dhzexj.js +179 -0
- package/dist/assets/x-bot-tpose-body-BusyR3eg.json +1 -0
- package/dist/assets/y-bot-tpose-body-Dy1VKChZ.json +1 -0
- package/dist/cozyclay-package.json +1 -1
- package/dist/greybox-to-video/index.html +2 -3
- package/dist/index.html +7 -57
- package/dist/llms.txt +2 -1
- package/dist/previs-software/index.html +2 -2
- package/dist/privacy/index.html +3 -7
- package/dist/seedance-camera-control/index.html +2 -2
- package/dist/sitemap.xml +5 -5
- package/dist/sw.js +5 -1
- package/dist/thumbs/blank-stage-dark.webp +0 -0
- package/dist/thumbs/blank-stage-light.webp +0 -0
- package/dist/workflow/index.html +5 -4
- package/mcp/mesh-file.mjs +3 -1
- package/mcp/server.mjs +3 -0
- package/package.json +3 -3
- package/src/App.jsx +50 -281
- package/src/analytics.js +3 -148
- package/src/app-stage.jsx +1 -1
- package/src/asset-pane.jsx +5 -10
- package/src/auto-flat.js +10 -0
- package/src/bus-task-scopes.js +69 -0
- package/src/bus-task-targets.js +48 -0
- package/src/bus-tasks.js +181 -0
- package/src/command-bus.js +15 -40
- package/src/command-history.js +36 -0
- package/src/commands/cast.js +10 -3
- package/src/commands/motion.js +2 -1
- package/src/commands/motion3-compile.js +51 -27
- package/src/commands/motion3.js +13 -7
- package/src/commands/project.js +1 -1
- package/src/commands/shared.js +9 -0
- package/src/commands/shot.js +16 -4
- package/src/controls.jsx +0 -11
- package/src/cuts.js +11 -0
- package/src/domains/cast.js +3 -2
- package/src/domains/motion.js +3 -10
- package/src/domains/playback.js +32 -0
- package/src/domains/scenes.js +3 -22
- package/src/domains/shots.js +5 -5
- package/src/dualview.jsx +11 -15
- package/src/hierarchy-panel.css +18 -4
- package/src/hierarchy-panel.jsx +12 -11
- package/src/kits/held.js +3 -2
- package/src/light-blockers.js +2 -2
- package/src/main.jsx +5 -0
- package/src/motion/ground.js +5 -14
- package/src/motion/playback-frame-store.js +79 -0
- package/src/motion/playback-probe.js +16 -0
- package/src/motion/playback-subject.js +7 -0
- package/src/motion/timeline.css +43 -5
- package/src/motion/timeline.jsx +4 -3
- package/src/motion3/body.js +37 -5
- package/src/motion3/carried.js +11 -3
- package/src/motion3/compile-job.js +1 -1
- package/src/motion3/compiler/anchors.js +33 -5
- package/src/motion3/compiler/compile.js +27 -4
- package/src/motion3/compiler/finger-close.js +137 -0
- package/src/motion3/compiler/grip.js +9 -3
- package/src/motion3/compiler/limbs.js +18 -3
- package/src/motion3/compiler/pose.js +6 -0
- package/src/motion3/compiler/socket-grip.js +34 -10
- package/src/motion3/compiler/validate-objects.js +17 -2
- package/src/motion3/compiler/validate-parts.js +2 -1
- package/src/motion3/compiler/vocab.js +4 -4
- package/src/motion3/describe.js +2 -2
- package/src/motion3/docs.js +1 -1
- package/src/motion3/fix/index.js +7 -3
- package/src/motion3/flight.js +38 -0
- package/src/motion3/free-motion.js +10 -7
- package/src/motion3/load.js +125 -0
- package/src/motion3/mass.js +23 -0
- package/src/motion3/object-keys.js +11 -6
- package/src/motion3/object-pose.js +11 -3
- package/src/motion3/pipeline.js +5 -0
- package/src/motion3/qa/explain.js +3 -1
- package/src/motion3/qa/grasp-checks.js +123 -0
- package/src/motion3/qa/hints-grasp.js +71 -0
- package/src/motion3/qa/index.js +3 -1
- package/src/motion3/qa/object-checks.js +7 -2
- package/src/motion3/qa/patch.js +2 -1
- package/src/motion3/qa/spec-checks.js +21 -1
- package/src/motion3/schema/fields.js +3 -3
- package/src/motion3/schema/topics.js +11 -10
- package/src/motion3/schema/types.js +5 -1
- package/src/motion3/seat.js +84 -0
- package/src/motion3/settle.js +11 -6
- package/src/motion3/shapes.js +70 -0
- package/src/motion3/skills/basic.js +61 -13
- package/src/motion3/skills/catch.js +71 -0
- package/src/motion3/skills/index.js +13 -4
- package/src/motion3/skills/info.js +14 -1
- package/src/motion3/skills/reach-human.js +139 -0
- package/src/motion3/skills/stance.js +92 -0
- package/src/motion3/skills/throw.js +72 -0
- package/src/motion3/sockets.js +21 -4
- package/src/motion3/views.js +28 -5
- package/src/object-catalog.jsx +0 -4
- package/src/object-gizmo.jsx +2 -1
- package/src/object-path.js +1 -1
- package/src/panels/ProjectPanel.jsx +42 -21
- package/src/panels/details.css +15 -4
- package/src/popover.js +37 -0
- package/src/posestudio.jsx +15 -10
- package/src/project-browser-art.jsx +19 -0
- package/src/project-browser.css +74 -121
- package/src/project-browser.jsx +36 -60
- package/src/props.jsx +4 -7
- package/src/retired-kinds.js +37 -0
- package/src/scene-objects.js +3 -7
- package/src/scenes.js +4 -5
- package/src/settings-menu.jsx +1 -20
- package/src/shell/BottomDock.jsx +9 -9
- package/src/shell/MenuBar.jsx +1 -9
- package/src/shell/PreferencesDialog.jsx +3 -4
- package/src/shell/ViewportToolbar.jsx +3 -3
- package/src/shell/add-camera-shot.js +11 -0
- package/src/shell/glass-regions.css +3 -2
- package/src/shell/glass.css +0 -5
- package/src/shell/lens-scrub-math.js +51 -0
- package/src/shell/lens-scrub.css +73 -0
- package/src/shell/lens-scrub.jsx +98 -0
- package/src/shell/mode.css +6 -5
- package/src/shell/preferences.css +1 -32
- package/src/shell/shell.css +18 -1
- package/src/shell/studio-shell-context.js +5 -0
- package/src/shot-frame.js +26 -0
- package/src/stage-canvas-rigs.jsx +7 -8
- package/src/stage-characters.jsx +26 -0
- package/src/stage-gizmo.js +43 -0
- package/src/stage-labels-ko.js +0 -6
- package/src/stage-startup-defaults.js +3 -9
- package/src/starter-scenes.js +5 -11
- package/src/studio-agent-commands.js +2 -2
- package/src/studio-agent-protocol.js +2 -7
- package/src/studio-app-binding.js +3 -3
- package/src/studio-elements.js +1 -1
- package/src/studio-error-codes.js +1 -1
- package/src/studio-motion-visual.js +4 -4
- package/src/styles/themes.css +13 -0
- package/src/styles.css +6 -674
- package/src/text/text-object.jsx +1 -1
- package/src/ui.jsx +8 -16
- package/src/use-embed-bridge.js +3 -6
- package/src/use-render-activity.js +3 -1
- package/src/view-ghosts.jsx +5 -3
- package/src/viewport-visible-rect.js +37 -0
- package/src/workflow/AgentPanel.jsx +75 -42
- package/src/workflow/AgentProgressCard.jsx +1 -1
- package/src/workflow/TaskBoard.jsx +102 -0
- package/src/workflow/TaskInline.jsx +114 -0
- package/src/workflow/agent-client.js +11 -25
- package/src/workflow/agent-panel.css +14 -1
- package/src/workflow/attachment-image.js +10 -3
- package/src/workflow/attachment-video.js +91 -0
- package/src/workflow/task-board.css +98 -0
- package/src/workflow/task-board.js +169 -0
- package/tools/check-eslint.mjs +2 -1
- package/tools/check-knip.mjs +2 -1
- package/tools/dev/pages/greybox-to-video.html +2 -3
- package/tools/dev/pages/previs-software.html +2 -2
- package/tools/dev/pages/privacy.html +3 -7
- package/tools/dev/pages/seedance-camera-control.html +2 -2
- package/tools/dev-full.mjs +11 -2
- package/tools/eslint-baseline.json +6 -6
- package/tools/knip-baseline.json +0 -11
- package/tools/loc-baseline.json +30 -31
- package/tools/metrics-snapshot.mjs +43 -5
- package/tools/render-start-thumbs.mjs +175 -0
- package/tools/run-tests.mjs +7 -14
- package/tools/sitemap.mjs +1 -1
- package/dist/assets/analytics-DbKG0NgD.js +0 -6
- package/dist/assets/app-34i-iUy1.js +0 -5088
- package/dist/assets/app-f-fkV5uP.css +0 -1
- package/dist/assets/compile-worker-DYpa2nvO.js +0 -5
- package/dist/assets/first-shot-handoff-CrGZ3n_O.js +0 -1
- package/dist/assets/landing-mq5bnqFE.js +0 -1
- package/dist/assets/scene-asset-sync-7J-w5oNh.js +0 -20
- package/dist/assets/scene-asset-sync-_S8NQl5B.css +0 -1
- package/dist/assets/workflow-dUhurYUc.js +0 -179
- package/dist/scenes/city-block.cclayproject +0 -1
- package/src/burn-in.js +0 -91
- package/src/camera-tutorial.jsx +0 -520
- package/src/facing-marks.js +0 -88
- package/src/first-shot-handoff.js +0 -44
- package/src/panels/motion.css +0 -197
- package/src/set-pieces.jsx +0 -183
- package/src/tutorial-analytics.js +0 -86
- package/src/tutorial-walk.js +0 -17
- package/src/use-camera-tutorial.js +0 -50
- package/src/use-semantic-state.js +0 -12
- package/tools/metrics/archive-traffic.mjs +0 -138
- package/tools/perf/ik-camera-drag.mjs +0 -138
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=.02,t=(e,t,n)=>Math.min(n,Math.max(t,e)),n=(e,t=0)=>typeof e==`number`&&Number.isFinite(e)?e:t;function r(e){let t=0;for(let n=0;n<e.length-1;n+=1)t+=(e[n]+e[n+1])/2;return t}function i(e,n){let r=t(n,0,1)*(e.length-1),i=Math.min(e.length-2,Math.floor(r)),a=r-i;return e[i]*(1-a)+e[i+1]*a}function a(e,t=24){if(!e.length)return Array(t).fill(1);if(e.length===1)return Array(t).fill(e[0]);let n=Array(t);for(let r=0;r<t;r+=1)n[r]=i(e,r/(t-1));return n}function o(e){let t=e.map(e=>Math.max(0,n(e,0))),i=r(t)/(t.length-1);return i<=1e-9?t.map(()=>1):t.map(e=>e/i)}function s(e){return e.every(e=>Math.abs(e-1)<1e-6)}function c(){return{cuts:[],envelopes:[Array(24).fill(1)]}}function l(e){return!e||e.cuts.length===0&&e.envelopes.every(s)}function u(e){if(!e||typeof e!=`object`)return null;let t=Array.isArray(e.cuts)?e.cuts:[],r=[];for(let e of t){let t=n(e?.t,NaN),i=n(e?.d,NaN);if(!(t>0&&t<1&&i>0&&i<1))continue;let a=r[r.length-1];a&&(t<=a.t+1e-6||i<=a.d+1e-6)||r.push({t,d:i})}let i=Array.isArray(e.envelopes)?e.envelopes:[],s=[];for(let e=0;e<=r.length;e+=1){let t=Array.isArray(i[e])?i[e].map(e=>n(e,1)):[];s.push(o(a(t.length>=2?t:[1,1])))}return{cuts:r,envelopes:s}}function d(e,r,i,a=.18){let o=e.length,s=Math.max(0,n(i,0)),c=t(n(r,0),0,1),l=a/3,u=Array(o);for(let e=0;e<o;e+=1){let t=Math.abs(e/(o-1)-c);u[e]=t<=l?1:t>=a?0:.5*(1+Math.cos((t-l)/(a-l)*Math.PI))}let d=e.map((e,t)=>Math.max(0,e*(1-u[t])+s*u[t])),f=e=>e===0||e===o-1?.5:1,p=o-1,m=0,h=0;for(let e=0;e<o;e+=1)u[e]>1e-9?m+=f(e)*d[e]:h+=f(e)*d[e];if(h>1e-9){let e=Math.max(0,(p-m)/h);for(let t=0;t<o;t+=1)u[t]<=1e-9&&(d[t]*=e);if(p-m<0){let e=p/m;for(let t=0;t<o;t+=1)u[t]>1e-9&&(d[t]*=e)}}else if(m>1e-9){let e=p/m;for(let t=0;t<o;t+=1)d[t]*=e}else return Array(o).fill(1);return d}function f(e,n){let i=e.length,a=r(e);if(a<=1e-9)return t(n,0,1);let o=t(n,0,1)*(i-1),s=Math.min(i-2,Math.floor(o)),c=o-s,l=0;for(let t=0;t<s;t+=1)l+=(e[t]+e[t+1])/2;let u=e[s]*(1-c)+e[s+1]*c;return l+=(e[s]+u)/2*c,l/a}function p(e,r){let i=t(n(r,0),0,1);if(!e)return i;let a=[{t:0,d:0},...e.cuts,{t:1,d:1}],o=0;for(;o<a.length-2&&i>a[o+1].t;)o+=1;let s=a[o],c=a[o+1],l=c.t-s.t,u=l>1e-9?(i-s.t)/l:1;return s.d+(c.d-s.d)*f(e.envelopes[o],u)}function m(e,t,n){let r=Array(24);for(let a=0;a<24;a+=1)r[a]=i(e,t+(n-t)*(a/23));return r}function h(e,t){let r=e??c(),i=n(t,NaN);if(!(i>.02&&i<.98))return e;for(let t of r.cuts)if(Math.abs(t.t-i)<.02)return e;let a=p(r,i);if(!(a>1e-6&&a<1-1e-6))return e;let s=0;for(;s<r.cuts.length&&i>r.cuts[s].t;)s+=1;let l=s===0?{t:0}:r.cuts[s-1],u=s===r.cuts.length?{t:1}:r.cuts[s],d=(i-l.t)/(u.t-l.t),f=r.envelopes[s];return{cuts:[...r.cuts.slice(0,s),{t:i,d:a},...r.cuts.slice(s)],envelopes:[...r.envelopes.slice(0,s),o(m(f,0,d)),o(m(f,d,1)),...r.envelopes.slice(s+1)]}}function g(e,t){if(!e||!e.cuts[t])return e;let n=[{t:0,d:0},...e.cuts,{t:1,d:1}],r=n[t],a=n[t+1],s=n[t+2],c=(a.t-r.t)/(s.t-r.t),l=(a.d-r.d)/(s.d-r.d),u=1-c,d=1-l,f=e.envelopes[t],p=e.envelopes[t+1],m=Array(24);for(let e=0;e<24;e+=1){let t=e/23;if(t<=c){let n=i(f,c>1e-9?t/c:0);m[e]=l/Math.max(1e-9,c)*n}else{let n=i(p,u>1e-9?(t-c)/u:0);m[e]=d/Math.max(1e-9,u)*n}}return{cuts:[...e.cuts.slice(0,t),...e.cuts.slice(t+1)],envelopes:[...e.envelopes.slice(0,t),o(m),...e.envelopes.slice(t+2)]}}var _=Object.freeze([`keys`,`follow`,`rail`]),ee=Object.freeze({distance:3,height:1.6,response:.7,lead:.25,railStartMode:`head`,maxDollySpeed:4,pitchOffsetDeg:0,orbitOffsetDeg:0});function v(e){return Array.isArray(e)?e.map(e=>({x:e.x,z:e.z})):null}function te(e){if(!e||typeof e!=`object`)return null;let t=Array.isArray(e.points)?e.points:Number.isFinite(e.start)&&Number.isFinite(e.end)?[{t:0,height:e.start},{t:1,height:e.end}]:null;if(!t)return null;let n=t.filter(e=>e&&Number.isFinite(e.t)&&Number.isFinite(e.height)).map(e=>({t:Math.max(0,Math.min(1,e.t)),height:Math.max(.1,e.height)})).sort((e,t)=>e.t-t.t).filter((e,t,n)=>t===n.length-1||n[t+1].t-e.t>1e-6).slice(0,8);return n.length<2?null:(n[0]={...n[0],t:0},n[n.length-1]={...n[n.length-1],t:1},{points:n})}function ne(e){return!e||typeof e!=`object`?null:e.mode===`off`?{mode:`off`}:e.mode===`range`?{mode:`range`,startFrame:e.startFrame,endFrame:e.endFrame}:null}function re(e){let t=Array.isArray(e?.ids)?e.ids.filter(e=>typeof e==`string`&&e).slice(0,4):[];if(t.length)return Number.isFinite(e.height)?{ids:t,height:e.height}:{ids:t};let n=e?.point;return n&&[n.x,n.y,n.z].every(Number.isFinite)?{point:{x:n.x,y:n.y,z:n.z}}:null}function y(e,t){let n=t?re(e.aim):null,r=t&&Number.isFinite(e.focalMm)&&e.focalMm>0?e.focalMm:null;return{...n?{aim:n}:{},...r?{focalMm:r}:{}}}function b(e={}){let t=e&&typeof e==`object`?e:{},n=_.includes(t.mode)?t.mode:`keys`,r={...ee,...t.followCam??{}},i=v(t.cameraRail),a=te(t.craneHeight)??(n===`rail`&&i?{points:[{t:0,height:r.height},{t:1,height:r.height}]}:null),o=u(t.dollyTiming);return{mode:n,followCam:r,cameraRail:i,railFollow:ne(t.railFollow),craneHeight:a,dollyTiming:l(o)?null:o,...y(t,i)}}function ie(e){return b(e)}function x(e,t={}){let n=b(e),r=t&&typeof t==`object`?t:{};return b({...n,...r,followCam:r.followCam?{...n.followCam,...r.followCam}:n.followCam,cameraRail:Object.hasOwn(r,`cameraRail`)?r.cameraRail:n.cameraRail,railFollow:Object.hasOwn(r,`railFollow`)?r.railFollow:n.railFollow,craneHeight:Object.hasOwn(r,`craneHeight`)?r.craneHeight:n.craneHeight,dollyTiming:Object.hasOwn(r,`dollyTiming`)?r.dollyTiming:n.dollyTiming})}function ae(e){let t=b(e);return x(t,{mode:t.mode===`rail`?`follow`:t.mode,cameraRail:null,railFollow:null,craneHeight:null})}var oe=e=>e&&typeof e==`object`?Object.freeze({...e}):e,S=Object.freeze([{path:`character.position`,type:`vec3`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},gizmo:{min:{x:-4,y:0,z:-4},max:{x:4,y:240,z:4}},note:`y is the feet`},{path:`character.rot`,type:`number`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:-180,max:180,angle:!0,note:`yaw degrees, wrapped at the upper bound`},{path:`character.scale`,type:`number`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,min:.2,max:3},{path:`character.subject`,type:`string`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.hidden`,type:`boolean`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.parent`,type:`id`,nullable:!0,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`scene object id the character is grouped under and rides; null stands in the world`},{path:`character.model`,type:`enum`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,enum:[`y-bot-tpose`,`x-bot-tpose`,`proxy-figure`]},{path:`character.posture`,type:`enum`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,enum:[`stand`,`sit`,`lie`]},{path:`character.tint`,type:`color`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.identityImage`,type:`image`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`data:image only`},{path:`character.pose`,type:`id`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`},{path:`character.waypoints`,type:`array`,persisted:!0,undoDomain:`cast`,normalizer:`createCharacterEntry`,actions:[`character.addWaypoint`,`character.moveWaypoint`,`character.removeWaypoint`,`character.clearWaypoints`],note:`root path pins, addressed by frame`},{path:`character.sessionMotion`,type:`array`,persisted:!1,undoDomain:`cast`,normalizer:`createCharacterEntry`,note:`dropped by createCharacterEntry`},{path:`character.ikKeys`,type:`array`,persisted:!1,undoDomain:`cast`,normalizer:`createCharacterEntry`,actions:[`character.setIkKey`,`character.removeIkKey`,`character.clearIkKeys`],note:`dropped by createCharacterEntry; keys travel as JSON quaternions/positions`},{path:`object.renderer`,type:`enum`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,enum:[`cube`,`sphere`,`capsule`,`cylinder`,`cone`,`plane`,`chair`,`car`,`small-plane`,`empty`,`light`,`effect`,`text`],note:`light is made from catalogue kind point-light or spot-light; effect (smoke, fire, rain, trail...) from kind effect; text (words, a sign, a logo) from kind text`},{path:`object.position`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:-240,y:0,z:-240},max:{x:240,y:240,z:240},note:`y is the object's base: y=0 rests on the floor; height/supportY rise from it`},{path:`object.rotation`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:-180,y:-180,z:-180},max:{x:180,y:180,z:180},angle:!0,note:`rot/rotX/rotZ degrees, wrapped at the upper bound`},{path:`object.scale`,type:`vec3`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:{x:.01,y:.01,z:.01},max:{x:100,y:100,z:100}},{path:`object.name`,type:`string`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.color`,type:`color`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.opacity`,type:`number`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,min:.05,max:1,note:`1 is solid; lower is see-through, e.g. 0.3 for clear glass`},{path:`object.parent`,type:`id`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.attach`,type:`id`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,actions:[`object.attach`,`object.detach`],note:`carried by a character's root or bone; channels convert so the prop stays put`},{path:`object.path`,type:`array`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`},{path:`object.remove`,type:`boolean`,persisted:!0,undoDomain:`objects`,normalizer:null,note:`lifecycle operation, not a document field`},{path:`object.cutout`,type:`image`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,actions:[`asset.import`],note:`assetId-backed cutout record; imported pictures and models are placed by asset.import`},{path:`object.light`,type:`object`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,note:`renderer light only. { type point|spot, color, intensity 0..1000 candela (lighter 0.45, candle 0.3, desk lamp 5, street lamp 40), range m (0 none), angle 1..89 deg spot half-angle, softness 0..1, shadow (first 2 lights only; inside a solid record it is blocked: receipt LIGHT_BLOCKED), flicker 0..1 (lighter 0.6), aim {x,y,z} world point or null = local -Y }, e.g. { intensity: 40, aim: { x: 0, y: 0, z: 1 } }; a take level track scales it`},{path:`object.glow`,type:`object`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,note:`any record: self-lit colour plus additive halo, same under any stage light; casts no shadow, so a light inside a glowing bulb shines out. { color, intensity 0..20, halo 0..4 x the record's radius }, e.g. ember { color: "#ff5a1f", intensity: 6, halo: 2 }; null removes; a take level track scales it`},{path:`object.text`,type:`object`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,note:`renderer text only: words in one record, e.g. object.add { kind: "text", text: { value: "CozyClay", size: 0.4 }, placement: { x, y, z, rot } }. { value: the words (up to 200 characters, \\n starts a line), size m height of a capital letter (default 0.3), depth m (0 = flat lettering in any script, default; above 0 = solid letters for Latin, digits and punctuation, and words with other characters stay flat), align left|center|right for several lines }. The record's footprint and height are measured from the words: x is the centre, y the bottom of the lowest line, and the letters face local +z and read toward local +x, so on a side facing +x set rot 90. Flat lettering on a surface: keep it 3 mm or more off the face. color is the letters' colour`},{path:`object.grasp`,type:`object`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,note:`grasp sockets: where a hand takes hold of the record, in its own axes (m from the base pivot), moving and saving with it. { <name>: { at: [x,y,z], axis?: [x,y,z] the line across the palm (a bar, a handle), from?: [x,y,z] the side the hand comes from (the palm faces against it), thumb?: [x,y,z] the axis end the thumb takes } }, at most 8; null removes. A motion spec anchor { kind: "object", object, socket: <name>, grasp } takes a hand by one; a thin body (a bar, a can, a handle) is a socket of its own, named by its id`},{path:`object.effect`,type:`object`,persisted:!0,undoDomain:`objects`,normalizer:`normalizeSceneObject`,note:`renderer effect only (object.add kind "effect"). { preset: smoke|exhale|steam|fire|sparks|dust|rain|snow|trail, rate particles/s, life s, size m start diameter, grow end/start size, speed m/s along the record's local +Y (rotX 90 aims +Z), spread 0..1 cone, gravity m/s2 (+ falls, - rises), wind {x,y,z} m/s, color, opacity 0..1, additive (emissive: fire, sparks), seed int, area {x,y,z} m birth box (rain/snow/dust fall through it from its top), width m trail ribbon across local Y }. A new preset loads its defaults and fields in the same set override them, e.g. { preset: "fire", rate: 40 }; the record stores the merged numbers. Particles are born where the record is at each frame (route, parent, take carry), only while it and its parents are shown, at rate x the take level. To emit from the body (a breath at the mouth), a motion spec entry objects.<id> = { follow: "landmark:mouth", aim: "face" } moves it there every frame. Measure with inspect_studio { scope: "entities", ids }: effect { frame (the playhead), alive, emitter [x,y,z], bounds { min, max } m }`},{path:`stage.keyLight.x`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.y`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:.5,max:30},{path:`stage.keyLight.z`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:-30,max:30},{path:`stage.keyLight.intensity`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:4},{path:`stage.keyLight.warmth`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:1},{path:`stage.environmentImage`,type:`image`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`data:image only`},{path:`stage.environment`,type:`string`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`location description every shot prompt is built from`},{path:`stage.style`,type:`string`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`look / style line for shot prompts`},{path:`stage.hasEnvSheet`,type:`boolean`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`author supplies an environment sheet instead of a description`},{path:`stage.camera`,documentPath:`shotAspect`,type:`enum`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,enum:[`16:9`,`2.39:1`,`9:16`,`1:1`,`4:3`,`12:7`,`fal 480P`],note:`output aspect ratio`},{path:`stage.cameraPresetId`,type:`id`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`},{path:`stage.sensorId`,type:`enum`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,enum:[`super16`,`super35`,`fullFrame`,`65mm`]},{path:`stage.keyLight.color`,type:`color`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`key light colour #rrggbb, overrides warmth, e.g. "#9db6e6" cool moonlight or "#ffad5c" low sun; null = white tinted by warmth`},{path:`stage.lighting.preset`,type:`enum`,persisted:!0,readOnly:!0,undoDomain:`stage`,normalizer:`createSceneStage`,enum:[`studio`,`day`,`overcast`,`golden`,`dusk`,`night`,`interior`,`stage`],note:`label of the last recipe stage.applyLighting applied; studio is the neutral grey default`},{path:`stage.lighting.sky`,type:`color`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`background and fog colour at the horizon, e.g. "#0b1426" night; null = the UI theme's studio grey`},{path:`stage.lighting.skyTop`,type:`color`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`sky colour overhead: shot camera and exports grade from sky at the horizon to this, e.g. "#020408"; null = flat sky`},{path:`stage.lighting.ambient`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:3,note:`multiplier on the hemisphere and ambient light; 1 = studio, 0.6 = night, 0 = black stage`},{path:`stage.lighting.hemiSky`,type:`color`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`hemisphere light from above, e.g. "#34507f" cool night sky; studio "#ffffff"`},{path:`stage.lighting.hemiGround`,type:`color`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`hemisphere bounce from below, e.g. "#6e5136" warm ground; studio "#5a5d64"`},{path:`stage.lighting.fill`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:3,note:`multiplier on the fixed fill and rim lights; 1 = studio, 0 = key only`},{path:`stage.lighting.fog`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:1,note:`haze 0..1 fading the set into the sky colour: 0 = far horizon only, 0.45 = from ~18 m to ~38 m, 1 = from 2 m to 14 m`},{path:`stage.lighting.exposure`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:.2,max:3,note:`camera exposure multiplier on lit surfaces; 1 = studio, e.g. 1.4 to lift a dark frame`},{path:`stage.lighting.shadowSoftness`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:1,note:`key shadow penumbra; 0 = crisp (studio), 0.75 = soft moonlight, 1 = overcast`},{path:`stage.lighting.envLight`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:2,note:`sky environment light on every surface: a map from sky, skyTop, hemiGround and a glow toward the key (sun or moon) tints and fills clay from all sides; it takes over the flat hemisphere as it rises. 0 = hemisphere only (studio), 1 = the map alone at the same brightness (every other recipe), e.g. 1.4 for a brighter fill`},{path:`stage.lighting.ao`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:1,note:`ambient occlusion strength: contact darkening within ~0.5 m where a body meets the floor or a prop and in creases (armpits, the back of a squat's knees), in the viewport and every export. 0 = off (studio), 0.8 = most recipes, 1 = overcast`},{path:`stage.lighting.hdr`,type:`id`,nullable:!0,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`HDR environment map that replaces the sky environment light: a built-in ("builtin:night-street", "builtin:overcast-field", "builtin:studio-softbox") or a file the user loaded ("hdr-<32 hex>"); inspect_studio { scope: "catalogue" } environments lists them with each map's brightest direction. It lights the set only while envLight > 0 (its light = map x hdrIntensity x envLight; studio has envLight 0, so set envLight 1). stage.applyLighting clears it unless keep has "lighting.hdr". null = the look's own sky`},{path:`stage.lighting.hdrRotation`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:-180,max:180,angle:!0,note:`degrees the HDR map turns about the vertical axis, light and backdrop together: +90 carries a light at +x (screen right from the default camera) to -z (behind the subject), so a brightest [x, y, z] lands at [x cos r + z sin r, y, z cos r - x sin r]; wrapped at the upper bound`},{path:`stage.lighting.hdrIntensity`,type:`number`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,min:0,max:4,note:`multiplier on the HDR map's radiance in its light and its backdrop; 1 = the file as authored, e.g. 0.5 to calm a bright daylight map`},{path:`stage.lighting.hdrBackground`,type:`boolean`,persisted:!0,undoDomain:`stage`,normalizer:`createSceneStage`,note:`true = the HDR map is the backdrop behind the set (the floor fades into its horizon), in the viewport, shot and every export; false = keep the look's sky as the backdrop and use the map only as light`},{path:`shot.crud`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,actions:[`shot.create`,`shot.split`,`shot.duplicate`,`shot.remove`,`shot.setRange`,`shot.reorder`],note:`create/split/duplicate/reorder/remove/range through the shared action registry`},{path:`shot.cameraKeys`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,frameMin:0},{path:`shot.cameraRail`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:`repairCamera`,actions:[`shot.setCameraRail`,`shot.clearCameraRail`],note:`rail points; crane/dolly timing follow the shot's camera block`},{path:`shot.targetModel`,type:`id`,persisted:!0,undoDomain:`shot`,normalizer:`repairCamera`},{path:`shot.kind`,type:`enum`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,enum:[`clip`,`still`],note:`clip or still; a still holds one picture for endFrame - startFrame + 1 frames`},{path:`shot.caption`,type:`string`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`trimmed, at most 500 characters`},{path:`shot.cast`,type:`array`,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`per-shot placement overrides keyed by character id: { x, z, rot, posture?, pose? }`},{path:`shot.stylizedAssetId`,type:`id`,nullable:!0,persisted:!0,undoDomain:`shot`,normalizer:null,readOnly:!0,note:`image asset id only`},{path:`shot.freeCamera`,type:`vec3`,persisted:!1,undoDomain:`shot`,normalizer:null,note:`transient until keyed`},{path:`scenes`,type:`array`,persisted:!0,undoDomain:null,normalizer:null,actions:[`scene.create`,`scene.duplicate`,`scene.rename`,`scene.delete`,`scene.switch`],note:`the project's scene list and the open scene; outside the undo history`},{path:`project`,type:`string`,persisted:!0,undoDomain:null,normalizer:null,actions:[`project.save`],note:`save to the current project file; opening one needs the user's file picker`},{path:`selection`,type:`id`,persisted:!1,undoDomain:null,normalizer:null},{path:`timeline`,type:`number`,persisted:!1,undoDomain:null,normalizer:null},{path:`view.mode`,type:`enum`,persisted:!1,undoDomain:null,normalizer:null,enum:[`scene`,`pose`,`camera`,`motion`]},{path:`view.partColoursGuideModeInset`,type:`array`,persisted:!1,undoDomain:null,normalizer:null,actions:[`view.setPartColours`,`view.setGuideMode`,`view.setInset`,`view.setGhosts`],note:`partColours/guideMode/inset/ghosts; viewer settings, not document fields`},{path:`read.sceneDescription`,type:`string`,persisted:!1,undoDomain:null,normalizer:null},{path:`read.captureFrame`,type:`image`,persisted:!1,undoDomain:null,normalizer:null},{path:`undo`,type:`boolean`,persisted:!1,undoDomain:null,normalizer:null}].map(e=>Object.freeze({...e,...e.enum?{enum:Object.freeze([...e.enum])}:{},...e.actions?{actions:Object.freeze([...e.actions])}:{},...e.min&&typeof e.min==`object`?{min:oe(e.min)}:{},...e.max&&typeof e.max==`object`?{max:oe(e.max)}:{},...e.gizmo?{gizmo:Object.freeze({min:oe(e.gizmo.min),max:oe(e.gizmo.max)})}:{}})));function se(e){return S.find(t=>t.path===e)}var ce=e=>e.persisted!==!1&&!e.actions&&!e.readOnly,le=Object.freeze(`INVALID_ARGUMENT.INVALID_CONTEXT.INVALID_IDENTITY.INVALID_TURN_ID.INVALID_SESSION_ID.INVALID_RECEIPT.INVALID_RANGE.INVALID_REQUEST.UNKNOWN_TOOL.UNKNOWN_VARIANT.DUPLICATE_NAME.CONTEXT_LIMIT.CONTEXT_TOO_LARGE.AMBIGUOUS_TARGET.AMBIGUOUS_BASIS.TARGET_NOT_READY.TARGET_BUSY.STALE_TARGET.STALE_SCENE.STALE_ENVIRONMENT.STALE_CURSOR.CAPABILITY_MISSING.LIVE_HUB_UNAVAILABLE.AUTH_REQUIRED.GENERATION_LIMIT.RATE_LIMITED.BACKEND_UNAVAILABLE.VERIFICATION_FAILED.REPAIR_REGRESSED.CANCELLED.UNCERTAIN_APPLY.UNDO_CONFLICT.CONFIRMATION_REQUIRED.TIMEOUT.UNDO_EXPIRED.INTERNAL_ERROR`.split(`.`)),ue=e=>e?.code??([`TypeError`,`ReferenceError`,`RangeError`,`SyntaxError`].includes(e?.name)?`INTERNAL_ERROR`:`INVALID_ARGUMENT`),de=`#c2c6c8`,C=[`#e2e5e6`,de,`#9aa1a5`,`#767d81`,`#d9b18c`,`#8fae9b`,`#d94a4a`,`#4a7bd9`,`#e2c04a`,`#4fa86a`],fe=6,pe=`cozyclay.objectColors.recent`,me=/^#?([0-9a-f]{3})$/i,he=/^#?([0-9a-f]{6})$/i;function w(e){if(typeof e!=`string`)return null;let t=e.trim(),n=me.exec(t);if(n)return`#${n[1].toLowerCase().replace(/./g,e=>e+e)}`;let r=he.exec(t);return r?`#${r[1].toLowerCase()}`:null}function ge(e,t){let n=Array.isArray(e)?e.map(w).filter((e,t,n)=>e&&n.indexOf(e)===t&&!C.includes(e)):[],r=w(t),i=(r&&!C.includes(r)?[r,...n.filter(e=>e!==r)]:n).slice(0,fe);return Array.isArray(e)&&i.length===e.length&&i.every((t,n)=>t===e[n])?e:i}function _e(e){try{let t=JSON.parse(e?.getItem(pe)??`[]`);return ge(Array.isArray(t)?t:[],null)}catch{return[]}}function ve(e,t){try{e?.setItem(pe,JSON.stringify(t))}catch{}}var ye=`effect`,be={kind:ye,label:`Effect`,group:`Effects`,footprint:{width:0,depth:0},height:0,color:`#7fd4f0`},T=(e,t,n)=>({x:e,y:t,z:n}),xe=T(0,0,0),Se=Object.freeze({smoke:{rate:60,life:2.8,size:.012,grow:6,speed:.05,spread:.1,gravity:-.3,wind:T(.02,0,0),color:`#7d8a99`,opacity:.42,additive:!1,area:xe,width:0},exhale:{rate:120,life:2.4,size:.035,grow:8,speed:.9,spread:.35,gravity:-.35,wind:T(.02,0,0),color:`#a3abb4`,opacity:.3,additive:!1,area:T(.01,0,.01),width:0},steam:{rate:26,life:2,size:.03,grow:4,speed:.1,spread:.2,gravity:-.45,wind:T(.02,0,0),color:`#bcc5ce`,opacity:.2,additive:!1,area:T(.07,0,.07),width:0},fire:{rate:140,life:.75,size:.12,grow:.3,speed:.4,spread:.15,gravity:-2.2,wind:xe,color:`#ff7a1f`,opacity:1,additive:!0,area:T(.22,0,.22),width:0},sparks:{rate:40,life:1,size:.012,grow:.6,speed:2.6,spread:.55,gravity:6,wind:xe,color:`#ff9d33`,opacity:1,additive:!0,area:T(.05,0,.05),width:0},dust:{rate:30,life:7,size:.014,grow:1.2,speed:0,spread:1,gravity:.01,wind:T(.04,0,.01),color:`#a89a82`,opacity:.55,additive:!1,area:T(3,2.2,3),width:0},rain:{rate:1600,life:1.2,size:.01,grow:1,speed:0,spread:0,gravity:9.8,wind:xe,color:`#9aabbd`,opacity:.4,additive:!1,area:T(8,5,8),width:0},snow:{rate:220,life:8,size:.025,grow:1,speed:0,spread:0,gravity:9.8,wind:T(.1,0,0),color:`#ffffff`,opacity:.85,additive:!1,area:T(8,4,8),width:0},trail:{rate:0,life:.3,size:0,grow:1,speed:0,spread:0,gravity:0,wind:xe,color:`#a7b8ca`,opacity:.75,additive:!1,area:xe,width:.5}}),Ce=Object.freeze(Object.keys(Se)),we={rate:[0,2e3],life:[.05,12],size:[.001,5],grow:[.05,20],speed:[0,60],spread:[0,1],gravity:[-30,30],opacity:[0,1],width:[0,10]},Te={wind:[-20,20],area:[0,100]},Ee=2147483647,De=([e,t],n,r)=>{let i=Number(n);return Number.isFinite(i)?Math.min(t,Math.max(e,i)):r};function Oe(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{},n=Ce.includes(t.preset)?t.preset:`smoke`,r=Se[n],i={preset:n};for(let[e,n]of Object.entries(we))i[e]=De(n,t[e],r[e]);for(let[e,n]of Object.entries(Te)){let a=t[e]&&typeof t[e]==`object`?t[e]:{};i[e]=T(...[`x`,`y`,`z`].map(t=>De(n,a[t],r[e][t])))}i.color=w(t.color)??r.color,i.additive=typeof t.additive==`boolean`?t.additive:r.additive;let a=Number(t.seed);return i.seed=Number.isFinite(a)?Math.min(Ee,Math.max(0,Math.round(a))):1,i}function ke(e){return e?.renderer===`effect`?{effect:Oe(e.effect)}:{}}function Ae(e,t){let n=e?.set?.effect?.preset;if(!Ce.includes(n))return e;let r=t?.find?.(t=>t.id===e.id)?.effect;if(r?.preset===n)return e;let i=structuredClone(Se[n]);return{...e,set:{...e.set,effect:{...i,seed:r?.seed??1,...e.set.effect}}}}var je=(e,t)=>({type:`number`,minimum:e,maximum:t}),Me=([e,t])=>({type:`object`,properties:{x:je(e,t),y:je(e,t),z:je(e,t)},required:[],additionalProperties:!1}),Ne=Object.freeze({type:`object`,properties:{preset:{type:`string`,enum:[...Ce]},...Object.fromEntries(Object.entries(we).map(([e,[t,n]])=>[e,je(t,n)])),...Object.fromEntries(Object.entries(Te).map(([e,t])=>[e,Me(t)])),color:{type:`string`,minLength:1,maxLength:32,pattern:`^#[0-9a-fA-F]{6}$`},additive:{type:`boolean`},seed:{type:`integer`,minimum:0,maximum:Ee}},required:[],additionalProperties:!1}),Pe=`text`,Fe=[375,307,454,1117,800,1213,1007,289,486,486,828,828,303,525,303,828,828,828,828,828,828,828,828,828,828,828,304,306,828,828,828,785,1374,1069,938,1043,968,824,778,1057,953,365,760,996,763,1135,949,1094,838,1096,947,915,894,926,997,1399,999,931,906,444,532,446,828,828,288,786,822,828,836,808,525,839,782,326,361,771,363,1174,782,871,824,833,513,775,511,782,828,1150,826,828,753,599,240,597,949],Ie=Object.freeze({resolution:1e3,ascent:1090,descent:333}),Le=1.5,Re=1.25,ze=.8,Be=.005,Ve={size:[.02,10],depth:[0,2]},He=200,Ue=8,We=[`left`,`center`,`right`],Ge=Object.freeze({value:`Text`,size:.3,depth:0,align:`center`}),Ke={kind:Pe,label:`Text`,group:`Text`,footprint:{width:1,depth:Be},height:.3,color:de},qe=Object.freeze({type:`object`,properties:{value:{type:`string`,minLength:1,maxLength:He},size:{type:`number`,minimum:Ve.size[0],maximum:Ve.size[1]},depth:{type:`number`,minimum:Ve.depth[0],maximum:Ve.depth[1]},align:{type:`string`,enum:We}},required:[],additionalProperties:!1}),Je=([e,t],n,r)=>{let i=Number(n);return Number.isFinite(i)?Math.min(t,Math.max(e,i)):r};function Ye(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{},n=[...(typeof t.value==`string`?t.value.replace(/\r\n?/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`).slice(0,Ue):[]).join(`
|
|
4
|
-
`)].slice(0,He).join(``);return{value:n.trim()?n:Ge.value,size:Je(Ve.size,t.size,Ge.size),depth:Je(Ve.depth,t.depth,Ge.depth),align:We.includes(t.align)?t.align:Ge.align}}var Xe=e=>e>=4352&&e<=4607||e>=11904&&e<=42191||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519;function Ze(e){let t=e.codePointAt(0);return t>=32&&t<=126?Fe[t-32]/Ie.resolution:Xe(t)?Re:ze}function Qe(e){return e.depth>0&&[...e.value].every(e=>e===`
|
|
5
|
-
`||e.codePointAt(0)>=32&&e.codePointAt(0)<=126)}function $e(e){let{size:t,align:n}=e,r=e.value.split(`
|
|
6
|
-
`),i=r.map(e=>[...e].reduce((e,t)=>e+Ze(t),0)*t),a=Math.max(...i,t*.2),o=Ie.descent/Ie.resolution*t;return{width:a,height:(r.length-1)*Le*t+(Ie.ascent+Ie.descent)/Ie.resolution*t,rows:r.map((e,s)=>({text:e,width:i[s],x:n===`left`?-a/2:n===`right`?a/2-i[s]:-i[s]/2,baseline:o+(r.length-1-s)*Le*t}))}}function et(e){if(e?.renderer!==`text`)return{};let t=Ye(e.text),{width:n,height:r}=$e(t),i=e=>Number(e.toFixed(4));return{text:t,footprint:{width:i(n),depth:i(Math.max(t.depth,Be))},height:i(r),supportY:i(r)}}function tt(e,t){if(e?.renderer!==`text`||t?.text===void 0||!t.text||typeof t.text!=`object`)return{};let n=et({renderer:Pe,text:{...e.text,...t.text}});return JSON.stringify(n.text)===JSON.stringify(e.text)?{}:n}var nt=24,rt=40,it=e=>{let t=JSON.stringify(e)??String(e);return t.length>rt?`${t.slice(0,37)}...`:t},at=e=>e===null?`null`:Array.isArray(e)?`an array`:typeof e==`object`?`an object`:typeof e==`number`&&!Number.isFinite(e)?String(e):`a ${typeof e}`,ot=e=>e.length>nt?`${e.slice(0,nt).join(`, `)}, ... (${e.length} in all)`:e.join(`, `),st=e=>Object.hasOwn(e,`const`)?JSON.stringify(e.const):e.type===`integer`?`an integer`:e.type===`array`?`an array${e.items?.type?` of ${e.items.type}s`:``}`:e.type===`object`?`an object`:e.type===`null`?`null`:`a ${e.type}`,ct=(e,t,n)=>`${e}: expected ${st(t)}, got ${Object.hasOwn(t,`const`)?it(n):at(n)}.`,lt=(e,t,n)=>{let r=Object.keys(t.properties);return`${e} has unknown field ${it(n)}; ${r.length?`allowed: ${ot(r)}`:`it takes no fields`}.`},ut=(e,t)=>`${e}: missing required field "${t}".`;function dt(e,t,n){if(!Array.isArray(n))return ct(e,t,n);let r=t.minItems??0,i=t.maxItems??1/0;return`${e}: expected ${r===i?`exactly ${r}`:i===1/0?`at least ${r}`:r===0?`at most ${i}`:`${r} to ${i}`} item${r===i&&r===1?``:`s`}, got ${n.length}.`}var ft=(e,t)=>{let n=new Set,r=t.map(e=>JSON.stringify(e)).find(e=>n.has(e)?!0:(n.add(e),!1));return`${e}: items must be unique; ${r&&r.length<=rt?r:`one item`} appears twice.`};function pt(e,t,n){if(typeof n!=`string`)return ct(e,t,n);if(!n.trim())return`${e}: must not be empty.`;let r=[...n].length;return t.maxLength!==void 0&&r>t.maxLength?t.description?`${e}: over ${t.maxLength} characters. ${t.description}`:`${e}: at most ${t.maxLength} characters, got ${r}.`:`${e}: ${it(n)} does not match ${t.pattern}.`}var mt=(e,t,n)=>`${e}: ${it(n)} is not one of: ${ot(t.enum)}.`;function ht(e,t,n){return typeof n!=`number`||!Number.isFinite(n)?ct(e,t,n):t.type===`integer`&&!Number.isSafeInteger(n)?`${e}: expected an integer, got ${n}.`:`${e}: must be greater than ${t.exclusiveMinimum}, got ${n}.`}var gt=e=>e.oneOf??e.anyOf?(e.oneOf??e.anyOf).every(gt):e.type!==`object`&&e.type!==`array`,_t=e=>[e.minimum,e.maximum].some(e=>e!==void 0)?` within [${[e.minimum??`-inf`,e.maximum??`inf`].join(`, `)}]`:``,vt=e=>e.oneOf??e.anyOf?(e.oneOf??e.anyOf).flatMap(vt):Object.hasOwn(e,`const`)?[JSON.stringify(e.const)]:e.enum?e.enum.map(e=>JSON.stringify(e)):e.type===`boolean`?[`true`,`false`]:[`${st(e)}${e.type===`number`||e.type===`integer`?_t(e):``}`];function yt(e,t,n){if(!t.every(({error:t})=>t.details?.path===e)||typeof n==`object`&&n&&!t.every(({branch:e})=>gt(e)))return null;let r=[...new Set(t.flatMap(({branch:e})=>vt(e)))],i=r.length>nt?[...r.slice(0,nt),`... (${r.length} in all)`]:r;return`${e} must be ${i.length>1?`${i.slice(0,-1).join(`, `)} or ${i.at(-1)}`:i[0]}, got ${typeof n==`object`&&n?at(n):it(n)}.`}var bt=[`storyboard`,`animation`],xt=[`stand`,`sit`,`lie`],St=65536,Ct=Object.freeze({entities:24,entityIndex:400,shots:8,assets:48,recentReceipts:3,jobs:8}),wt=Object.freeze([`inspect_studio`,`run_action`,`verify_result`]);Object.freeze([`operate_studio`,`arrange_objects`,`arrange_characters`,`patch_elements`,`frame_shot`,`undo_edit`]);var Tt=Object.freeze({inspect_studio:`Read the scene`,operate_studio:`Selection and view`,arrange_objects:`Arrange objects`,arrange_characters:`Arrange characters`,patch_elements:`Edit properties`,frame_shot:`Frame the shot`,verify_result:`Verify the result`,undo_edit:`Undo an edit`,run_action:`Run an editor action`}),Et=Object.freeze(Object.keys(Tt)),Dt=Object.freeze([`character`,`object`,`shot`,`stage`]);Object.freeze({character:`cast`,object:`objects`,shot:`shot`,stage:`stage`});var E=O({selectionKinds:[`scene`,`object`,`character`,`rig`,`camera`],modes:[`scene`,`pose`,`camera`,`motion`],shotModes:[`keys`,`follow`,`rail`],framingSizes:[`extreme close-up`,`close-up`,`medium close-up`,`medium shot`,`medium-wide shot`,`wide shot`,`extreme wide shot`],framingViews:[`front`,`front three-quarter`,`profile`,`rear three-quarter`,`back`],framingLevels:[`ground`,`low`,`hip`,`eye`,`high`,`overhead`],framingSides:[`left`,`right`],positionSides:[`left`,`right`,`front`,`behind`],positionBases:[`world`,`subject`,`shot_camera`],collisionPolicies:[`report`,`avoid`],objectOps:[`create`,`update`,`remove`,`group`,`ungroup`],characterOps:[`create`,`update`,`remove`],inspectionScopes:[`selection`,`scene`,`entities`,`shot`,`motion`,`catalogue`,`actions`,`document`],receiptStatuses:[`applied`,`partial`,`noop`,`transient`,`installed`,`undone`],opStatuses:[`applied`,`partial`,`noop`],jobStates:[`queued`,`generating`,`preparing`,`verifying`,`repairing`,`committing`,`reconciling`,`installed`,`review_required`,`failed`,`cancelled`,`stale_target`,`stale_environment`]}),D=class extends Error{constructor(e,t,n={}){super(t),this.name=`StudioProtocolError`,this.code=e,this.details=n}toJSON(){return{code:this.code,message:this.message,...Object.keys(this.details).length?{details:this.details}:{}}}},Ot=e=>new TextEncoder().encode(e).byteLength;function O(e){if(e&&typeof e==`object`&&!Object.isFrozen(e)){for(let t of Object.values(e))O(t);Object.freeze(e)}return e}var k=(e,t,n=`$`,r={})=>{throw new D(e,t,{path:n,...r})},A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=(e=120)=>({type:`string`,minLength:1,maxLength:e}),M=(e,t)=>({type:`number`,...e===void 0?{}:{minimum:e},...t===void 0?{}:{maximum:t}}),N=(e=0,t=2**53-1)=>({...M(e,t),type:`integer`}),P={type:`boolean`},F=e=>({const:e}),I=e=>({type:`string`,enum:e}),L=e=>({oneOf:[e,{type:`null`}]}),R=(e,t,n=0,r=!1)=>({type:`array`,items:e,minItems:n,maxItems:t,...r?{uniqueItems:r}:{}}),z=(e,t={})=>({type:`object`,properties:{...e,...t},required:Object.keys(e),additionalProperties:!1}),B=(...e)=>({oneOf:e}),kt={type:`object`,properties:{},required:[],additionalProperties:!0},V={...j(),pattern:`^[A-Za-z0-9][A-Za-z0-9._:-]*$`},At={...j(36),pattern:`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`},H=z({x:M(),y:M(),z:M()}),U={type:`number`,exclusiveMinimum:0},jt=z({x:U,y:U,z:U}),Mt={...z({startFrame:N(),endFrameExclusive:N(1)}),"x-studio-range":!0},W=(e=100,t=1)=>R(V,e,t,!0),G=j(120),Nt={...j(120),description:`Object id, or the name of a part created EARLIER in this ops list (create it first).`},Pt={workspaceId:V,documentEpoch:V,sceneId:V,sceneEpoch:V},Ft=z(Pt),It=z({surface:F(`studio`),...Pt,workspaceHandle:L(V)}),Lt=z({scene:N(),physics:N(),view:N()}),Rt=L(z({kind:I(E.selectionKinds),id:V},{hierarchyId:V})),zt=z({mode:I(E.modes),frame:N(),playing:P,lookThrough:P,grid:P,autoColor:P}),Bt=B(z({world:H}),z({relativeTo:Nt,basis:I(E.positionBases),side:I(E.positionSides),gapM:M(0),support:B(F(`floor`),z({objectId:Nt}))}),z({between:R(Nt,2,2,!0),fraction:M(0,1),support:F(`floor`)}),z({onObject:Nt},{offsetXZ:z({x:M(),z:M()})})),Vt=B(z({yawDeg:M()}),z({towardId:Nt}),z({sameAsId:Nt}),z({awayFromId:Nt})),Ht=B(z({intent:z({size:I(E.framingSizes),view:I(E.framingViews),level:I(E.framingLevels),side:I(E.framingSides)},{focalMm:U})}),z({exact:z({position:H,lookAt:H,focalMm:U})})),Ut={...I([`parent`]),description:`"parent" reads position.world, rotationDeg and facing.yawDeg in the parent's local frame (its pivot and rotation, not its scale); omit for world space.`},Wt=B(z({op:F(`create`),source:z({kind:V}),position:Bt},{name:G,facing:Vt,scale:jt,rotationDeg:{...H,description:`Euler XYZ degrees (x pitch, y yaw, z roll), as in update. Exclusive with facing. A pitched/rolled part rests its lowest corner on its support.`},parent:{...G,description:`Group this new object under a parent: an existing object id, or the name of an object created earlier in this same ops list. Moving the parent then moves it too.`},space:Ut}),z({op:F(`update`),id:V},{position:Bt,facing:Vt,rotationDeg:H,scale:jt,color:j(32),name:G,hidden:P,space:Ut}),z({op:F(`remove`),id:V}),z({op:F(`group`),parentId:V,childIds:W()}),z({op:F(`ungroup`),childIds:W()})),Gt=B(z({op:F(`create`),name:G,position:Bt},{facing:Vt,scale:U}),z({op:F(`update`),characterId:V},{position:Bt,facing:Vt,scale:U,name:G,hidden:P}),z({op:F(`remove`),characterId:V})),Kt={...j(2097152),pattern:`^data:image/[A-Za-z0-9.+-]+[;,]`},qt=z({frame:N(),framing:z({pos:H,yaw:M(),pitch:M(),fovDeg:M(1,179)})},{id:V}),Jt=B(M(0,1),z({t:M(0,1)},{bank:M(-90,90),pitch:M(-90,90)})),Yt=L(z({points:R(H,64,2)},{speed:M(0,50),faceTravel:P,loop:P,extend:P,marks:R(Jt,6)})),Xt=z({},{type:I([`point`,`spot`]),color:{...j(32),pattern:`^#[0-9a-fA-F]{6}$`},intensity:M(0,1e3),range:M(0,100),angle:M(1,89),softness:M(0,1),shadow:P,flicker:M(0,1),aim:L(H)}),Zt=L(z({},{color:{...j(32),pattern:`^#[0-9a-fA-F]{6}$`},intensity:M(0,20),halo:M(0,4)})),Qt=L(kt),$t={"character.pose":L(V),"character.identityImage":L(Kt),"object.light":Xt,"object.glow":Zt,"object.grasp":Qt,"object.effect":Ne,"object.text":qe,"object.parent":L(V),"object.path":Yt,"stage.environmentImage":L(Kt),"shot.cameraKeys":R(qt,64),"shot.targetModel":L(V)};function en(e){if(Object.hasOwn($t,e.path))return $t[e.path];if(e.type===`number`)return M(e.min,e.max);if(e.type===`boolean`)return P;if(e.type===`enum`)return I([...e.enum]);if(e.type===`id`)return V;if(e.type===`color`)return{...j(32),pattern:`^#[0-9a-fA-F]{6}$`};if(e.type===`image`)return L(Kt);if(e.type===`vec3`){let{min:t,max:n}=e;return t&&typeof t==`object`&&n&&typeof n==`object`?z({x:M(t.x,n.x),y:M(t.y,n.y),z:M(t.z,n.z)}):H}return e.type===`string`?j(240):null}function tn(e){return e.filter(ce).map(({path:e,type:t,min:n,max:r,enum:i,note:a})=>({path:e,type:t,...n===void 0?{}:{min:n&&typeof n==`object`?{...n}:n},...r===void 0?{}:{max:r&&typeof r==`object`?{...r}:r},...i?{enum:[...i]}:{},...a?{note:a}:{}}))}var nn=O(tn(S));function rn(e){let t={};for(let n of Dt){let r={};for(let t of e){if(!ce(t)||!t.path.startsWith(`${n}.`))continue;let e=en(t);e&&(r[t.path.slice(n.length+1)]=e)}t[n]={type:`object`,properties:r,required:[],additionalProperties:!1}}return t}var an=O(rn(S)),on=O(Object.fromEntries(Dt.map(e=>[e,Object.keys(an[e].properties).map(t=>`${e}.${t}`)]))),sn=B(z({target:z({kind:F(`character`),id:V}),set:an.character}),z({target:z({kind:F(`object`),id:V}),set:an.object}),z({target:z({kind:F(`shot`)},{id:V}),set:an.shot}),z({target:z({kind:F(`stage`)}),set:an.stage})),cn={inspect_studio:z({scope:I(E.inspectionScopes)},{ids:W(32),select:W(32),query:G,cursor:j(512),limit:{...N(1,32),default:12}}),operate_studio:z({},{selection:Rt,shotId:V,frame:N(),playing:P,mode:I(E.modes),view:z({},{lookThrough:P,grid:P,autoColor:P})}),arrange_objects:z({ops:{...R(Wt,100,1),description:`Applied in order, as one undo step. Each op sees the parts created by earlier ops, so build an assembly in one call: create the main part, then place the rest with position.onObject / relativeTo(+side,gapM) / between naming earlier parts (e.g. relativeTo "Hood"). Reference parts created in this call by name, never by id.`}},{collisionPolicy:{...I(E.collisionPolicies),default:`report`}}),arrange_characters:z({ops:R(Gt,8,1)}),patch_elements:z({ops:R(sn,32,1)}),frame_shot:z({subjectIds:W(1),framing:Ht},{shotId:V,caption:{type:`string`,maxLength:500},keyAtFrame:N()}),verify_result:z({checks:{...R(I([`placement`,`framing`,`motion`,`lighting`]),4,1,!0),description:`lighting measures the shot frame rendered at the playhead: checks.lighting { meanLuma 0..1, clippedPct (a channel at full scale), crushedPct (pure black), subjects: [{ id, meanLuma, contrast (5th to 95th percentile luma spread, 0..1) }] inside each target character's projected box, look: { preset, envLight, ao } the stage look's environment light and occlusion strength }. motion also answers exportFraming (one per character with a take): what the camera the export renders shows of the take over sampledFrames: camera (shot where a shot covers the frame, studio = the Studio camera as it stands when none does; shotIds), character { screenFraction [min, max] of the frame height, inFrame [lowest share of its joints' screen box inside the frame, frame], behindCamera, cut { head, hand_l, hand_r, foot_l, foot_r } }, and every object the take names { id, name, inFrame, out, cut }; out, cut and behindCamera are spans [first, last] of sampled frames; { character: { id }, reason } when it cannot be measured`}},{receiptId:V,targets:W(),range:B(F(`whole_clip`),Mt),visual:{...I([`none`,`frame`,`contact_sheet`,`plan`,`trace`]),default:`none`},frames:{...B(I([`even`,`beats`]),R(N(),8,1,!0)),default:`even`,description:`contact_sheet frames: even spacing, beats (grab/release, beat starts, the worst QA frames, then even fill, answered in visualRefs[0].picks), or up to 8 timeline frames of your choice`},views:{...R(I([`front`,`side`,`three-quarter`,`top`]),2,1,!0),description:`contact_sheet from cameras of its own around the character instead of the shot camera (which stays as it is): a row per view, each held still over the frames and framed on focus, so small actions fill the tile; side and three-quarter look from the focus's side; a sheet always holds two views at least 60 degrees apart: if the asked ones look along nearly one line, side, front or top is added and named in visualRefs[0].addedView`},focus:{...B(j(120),R(j(120),3,1,!0)),description:`with views: what to frame, as refs (object:<id>, joint:<Bone>, prop:<prop>.<point>, landmark:mouth); default the whole character`},trail:{...B(j(120),R(j(120),3,1,!0)),description:`with views: refs whose path over the range is drawn as one dot per frame (spacing shows speed; later frames faint, the tile's own frame ringed), colours in visualRefs[0].trails`},ghosts:{...P,description:`with views: each tile also shows the first target's poses around its frame as translucent ghosts (onion skin), earlier ones blue, later ones orange, carried props included, so spacing and arcs read in one tile; how many and how far apart is view.setGhosts (while it is off: 3 each side, every 4 frames), answered in visualRefs[0].ghosts`}}),undo_edit:z({receiptId:V}),run_action:z({action:V},{args:kt,confirmationToken:V})},ln=O(cn),un=O(Et.map(e=>({name:e,slice:1,parameters:cn[e]}))),dn=z({min:H,max:H}),fn=z({id:V,kind:I([`object`,`character`,`rig`]),token:V},{name:G,detailsOmitted:P,position:H,yawDeg:M(),rotationDeg:H,scale:B(U,jt),bounds:L(dn),libraryKind:V,renderer:V,color:L(j(32)),tint:L(j(32)),modelId:L(j(120)),assetId:V,parentId:L(V),attachment:L(z({characterId:V,bone:L(V)})),pathPointCount:N(0,64),pathMarks:R(B(M(0,1),z({t:M(0,1)},{bank:M(-90,90),pitch:M(-90,90)})),6),local:z({position:H,rotationDeg:H}),motion:z({takeId:L(V),frames:N(),ikKeyCount:N()},{poseId:L(V),keyIds:W(8,0)}),capabilities:z({rigReady:P,ik:P,measuredFeet:P}),characterKind:I([`rig`,`proxy`]),posture:I(xt)}),pn=z({id:V,kind:I([`object`,`character`,`rig`])},{name:G,position:H}),mn=z({id:V},{label:G,generation:F(`motion`),timeoutMs:N(1,3e5)}),hn=z({id:V,name:G,range:Mt,keyCount:N()},{subjectIds:W(24,0),kind:I([`clip`,`still`]),caption:j(500)}),gn=z({id:V,name:G,range:Mt,mode:I(E.shotModes)},{subjectIds:W(24,0),kind:I([`clip`,`still`]),caption:j(500)}),_n=z({position:H,lookAt:H,focalMm:U,sensorId:V,slate:G}),vn=I([`primitive`,`set-piece`,`image`,`mesh`]),yn=B(z({kind:V,name:G,type:vn}),z({id:V,name:G,type:vn})),bn=z({id:V,characterId:V,state:I(E.jobStates)},{targetIds:W(24,0),progress:L(M(0,1)),phase:G}),xn=z({schema:F(`studio-context-v1`),host:It,revision:Lt,units:z({distance:F(`m`),angle:F(`deg`),up:F(`+Y`),yawZero:F(`+Z`),yawPositiveToward:F(`+X`),pivot:F(`base`),fps:F(24),rangeEnd:F(`exclusive`)}),scene:z({name:G,aspect:j(40),floorY:M(),frameCount:N(),objectCount:N(),characterCount:N()},{previsMode:I(bt)}),selection:Rt,activeCharacterId:L(V),view:zt,shot:L(gn),camera:L(_n),entities:R(fn,24),entityPage:z({returned:N(0,24),total:N(),truncated:P,nextCursor:L(j(512))}),shots:R(hn,8),shotsTruncated:P,assets:R(yn,Ct.assets),recentReceipts:R(z({id:V,summary:G,canUndoDirect:P}),3),jobs:R(bn,8),capabilities:z({profile:F(`studio-slice-1`),tools:R(I(Et),Et.length,0,!0)},{rigReady:P,cameraReady:P,bridgeReady:P,storyboard:P})},{entityIndex:R(pn,Ct.entityIndex),actionIndex:R(mn,512)}),Sn=z({...Pt,targetId:V,token:V}),Cn=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],wn=z({dataUrl:{...j(6e6),pattern:`^data:image/(png|jpeg|webp);base64,`}},{name:j(120)}),Tn=z({surface:F(`studio`),sessionId:At,turnId:At,text:j(16e3),context:xn},{model:j(120),effort:I(Cn),attachFrame:P,attachments:R(wn,4,1),supervisor:P}),En=z({surface:F(`studio`),sessionId:At,turnId:At},{jobId:V}),Dn=z({before:N(),after:N()}),On=z({historyEntryId:V,entries:F(1),canUndoDirect:P}),kn=z({characterId:V,beforeTakeId:L(V),takeId:V,targetToken:V,frameCount:N(1),fps:F(24),durationSeconds:U,blocks:R(z({sourceBeat:N(0,7),startFrame:N(),endFrameExclusive:N(1)}),120,1),selectionChanged:F(!1)}),An=z({id:V,status:I([`verified`,`unverified`]),profile:F(`studio-motion-v1`),range:Mt,evaluatedFrames:N(),physicsRevision:N(),limitations:R(G,12)},{surfaceMeasured:P,maxFloorPenetrationM:M(0),maxContactSlipM:M(0),maxContactFloatM:M(0),unsupportedFrames:N(),supportedCollisionFrames:N(),continuityRegressed:P,semanticStatus:I([`pending_image_review`,`passed`,`failed`,`unavailable`])}),jn=z({path:j(120)},{number:M(),text:L(j(512)),flag:P,vec:H,count:N(),bytes:N()}),Mn=z({},{position:H,yawDeg:M(),rotationDeg:H,scale:B(U,jt),name:G,color:j(32),hidden:P,modelId:V,renderer:V,parentId:L(V),childIds:W(100,0),childCount:N(0),bounds:L(dn),removed:P,range:Mt,camera:_n,keyId:V,frame:N(),subjectIds:W(24,0),selection:Rt,activeCharacterId:L(V),shotId:L(V),view:zt,token:V,takeId:L(V),statureM:U,patched:R(jn,32,1)}),Nn=[`left`,`right`,`on-axis`],Pn=z({coverage:G},{relationSatisfied:P,overlapIds:W(100,0),actualGapM:M(),requestedGapM:M(0),maximumFootprintOverlapM:M(0),basis:I(E.positionBases),clipped:P,occluded:P,behindCamera:P,screenFraction:M(0),derivedSize:I(E.framingSizes),support:G,baseY:M(),facesTargetId:V,cameraSide:I(Nn),axisConsistent:P,evaluatedFrames:N(1),sampledFrames:R(N(),64,1),sampledChecks:R(z({frame:N(),screenFraction:M(),clipped:P,behindCamera:P,occluded:P}),64,1),issueFrames:R(z({frame:N(),codes:R(G,4,1),screenFraction:M()}),64,0)}),Fn=z({subjects:R(z({id:V,position:H,yawDeg:M()}),24),pairs:R(z({a:V,b:V,distanceM:M(0)}),24),shots:R(z({shotId:V,subjectIds:W(2,0),camera:L(z({position:H,lookAt:H})),cameraSide:L(I(Nn)),occluders:R(z({subjectId:V,byObjectId:V}),8)}),8),axisConsistent:L(P)}),In=z({code:V},{id:V,message:G,suggestedOutwardDeltaM:M(),count:N()}),Ln={ok:F(!0),commandId:V,receiptId:V,host:Ft,status:I(E.receiptStatuses),authored:P,revision:Dn,affectedIds:W(100,0),delta:R(z({id:V,after:Mn}),8),checks:Pn,undo:L(On),warnings:R(In,12)},Rn={counts:z({created:N(),updated:N(),deleted:N()}),detailCursor:L(j(512))},zn=R(z({index:N(),status:I(E.opStatuses)},{droppedPaths:R(j(120),32,1)}),32,1),Bn={...Ln,authored:F(!0),undo:On},Vn={action:V,summary:j(240)},Hn={completed:z({...Ln,status:F(`completed`),kind:I([`job`,`document`,`transaction`,`mutation`])},{...Vn,...Rn,output:kt,jobId:V,txId:V,nextHost:Ft,ops:zn}),started:z({...Ln,status:F(`started`),kind:F(`job`),jobId:V,authored:F(!1),undo:F(null)},{...Vn}),applied:z({...Bn,status:F(`applied`)},{mutated:F(!0),ops:zn,...Rn,...Vn}),partial:z({...Bn,status:F(`partial`),ops:zn},{mutated:F(!0),...Rn}),noop:z({...Ln,status:F(`noop`),authored:F(!1),mutated:F(!1),undo:F(null)},{ops:zn,...Vn}),transient:z({...Ln,status:F(`transient`),authored:F(!1),view:Dn,undo:F(null)},{mutated:P,...Vn}),installed:z({...Bn,status:F(`installed`),jobId:V,artifactId:V,installed:kn,verification:An},{mutated:F(!0),explicitUnverifiedAcceptance:P,acceptance:F(`advisory-policy`),repairs:z({autoPhysicsInvocations:N(0,1),fixCollisionsInvocations:N(0,1),remaining:N(0,2)}),...Rn}),undone:z({...Bn,status:F(`undone`),undoneReceiptId:V,restoredTargets:R(Sn,100,1)},{mutated:F(!0),...Rn})},Un=B(...Object.values(Hn)),Wn=z({ok:F(!1),commandId:V,host:Ft,code:I(le),phase:I([`admission`,`execution`,`prepare`,`verify`,`repair`,`commit`,`reconcile`,`undo`]),affectedIds:W(100,0),expectedTargets:R(Sn,24),currentTargets:R(Sn,24),mutated:B(P,F(`unknown`)),preserved:z({authoredState:I([`unchanged`,`changed`,`unknown`])}),recovery:z({action:I([`none`,`inspect`,`retry`,`new_intent`,`reconcile`,`sign_in`])},{retryAllowed:P})},{message:j(500),jobId:V,txId:V,candidates:R(z({id:V,kind:I([`object`,`character`,`rig`]),position:L(H)}),5)}),Gn=O({catalogue:un,variants:E,Vec3:H,FrameRange:Mt,PositionSpec:Bt,FacingSpec:Vt,ObjectOp:Wt,CharacterOp:Gt,Framing:Ht,Identity:Ft,Host:It,TargetGuard:Sn,Entity:fn,ShotSummary:hn,StudioContextV1:xn,StudioTurn:Tn,StudioStop:En,Receipt:Un,ReceiptVariants:Hn,Failure:Wn,GeometryFacts:Fn});function K(e,t,n=`INVALID_ARGUMENT`,r=`$`){if(e.oneOf||e.anyOf){let i=[],a=[];for(let o of e.oneOf??e.anyOf)try{i.push(K(o,t,n,r))}catch(e){if(!(e instanceof D))throw e;a.push({branch:o,error:e})}if(i.length===0&&a.length){let e=A(t)&&A(t.target)?t.target.kind:void 0,i=e!==void 0&&a.find(({branch:t})=>t.properties?.target?.properties?.kind?.const===e),o=!i&&yt(r,a,t);throw o&&k(n,o,r),(i||a.reduce((e,t)=>t.error.details.path.length>e.error.details.path.length?t:e)).error}return i.length!==1&&e.oneOf&&k(n,`${r}: matches ${i.length} variants; send the fields of exactly one.`,r),i[0]}if(Object.hasOwn(e,`const`))return t!==e.const&&k(n,ct(r,e,t),r),t;if(e.type===`null`)return t!==null&&k(n,ct(r,e,t),r),null;if(e.type===`object`){A(t)||k(n,ct(r,e,t),r);let i=e.additionalProperties===!0;for(let a of Object.keys(t))!Object.hasOwn(e.properties,a)&&!i&&k(n,lt(r,e,a),r);let a={};if(i)for(let n of Object.keys(t))Object.hasOwn(e.properties,n)||(a[n]=structuredClone(t[n]));for(let[i,o]of Object.entries(e.properties))Object.hasOwn(t,i)?a[i]=K(o,t[i],n,`${r}.${i}`):e.required.includes(i)?k(n,ut(r,i),`${r}.${i}`):Object.hasOwn(o,`default`)&&(a[i]=structuredClone(o.default));return e[`x-studio-range`]&&a.endFrameExclusive<=a.startFrame&&k(n,`Frame range must be nonempty and half-open.`,r),a}if(e.type===`array`){(!Array.isArray(t)||t.length<e.minItems||t.length>e.maxItems)&&k(n,dt(r,e,t),r);let i=t.map((t,i)=>K(e.items,t,n,`${r}[${i}]`));return e.uniqueItems&&new Set(i.map(e=>JSON.stringify(e))).size!==i.length&&k(n,ft(r,i),r),i}if(e.type===`string`)return(typeof t!=`string`||!t.trim()||e.maxLength!==void 0&&[...t].length>e.maxLength||e.pattern&&!new RegExp(e.pattern).test(t))&&k(n,pt(r,e,t),r),e.enum&&!e.enum.includes(t)&&k(n,mt(r,e,t),r),t;if(e.type===`boolean`)return typeof t!=`boolean`&&k(n,ct(r,e,t),r),t;if(e.type===`number`||e.type===`integer`)return(typeof t!=`number`||!Number.isFinite(t)||e.type===`integer`&&!Number.isSafeInteger(t)||e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum)&&k(n,ht(r,e,t),r),(e.minimum!==void 0&&t<e.minimum||e.maximum!==void 0&&t>e.maximum)&&k(n,`${r}: Expected a number within [${[e.minimum,e.maximum].filter(e=>e!==void 0).join(`, `)}], got ${t}.`,r),t;throw Error(`Unsupported internal Studio schema.`)}var Kn=e=>K(Ft,e,`INVALID_IDENTITY`);function qn(e){return[...new Set([...[`object`,`character`,`rig`].includes(e.selection?.kind)?[e.selection.id]:[],...e.activeCharacterId?[e.activeCharacterId]:[],...e.shot?.subjectIds??[],...e.jobs.flatMap(e=>[e.characterId,...e.targetIds??[]])])]}function Jn(e){let t=Ot(JSON.stringify(e)??``);t>65536&&k(`CONTEXT_TOO_LARGE`,`Studio context exceeds ${St/1024} KiB.`,`$`,{bytes:t,maxBytes:St});let n=K(xn,e,`INVALID_CONTEXT`),r=new Set(n.entities.map(e=>e.id));r.size!==n.entities.length&&k(`INVALID_CONTEXT`,`Duplicate entity ID.`);for(let e of qn(n))r.has(e)||k(`TARGET_NOT_READY`,`Mandatory target is absent from context.`);n.activeCharacterId&&!n.entities.some(e=>e.id===n.activeCharacterId&&e.kind===`character`)&&k(`INVALID_CONTEXT`,`Active target is not a character.`),[`object`,`character`,`rig`].includes(n.selection?.kind)&&!n.entities.some(e=>e.id===n.selection.id&&e.kind===n.selection.kind)&&k(`INVALID_CONTEXT`,`Selection kind disagrees with the selected entity.`),n.selection?.kind===`scene`&&n.selection.id!==n.host.sceneId&&k(`INVALID_CONTEXT`,`Selected scene is not the bound scene.`);for(let e of n.entities)e.bounds&&[`x`,`y`,`z`].some(t=>e.bounds.min[t]>e.bounds.max[t])&&k(`INVALID_CONTEXT`,`Inverted entity bounds.`),e.kind===`object`&&typeof e.scale==`number`&&k(`INVALID_CONTEXT`,`Objects use three-axis scale.`),e.kind!==`object`&&A(e.scale)&&k(`INVALID_CONTEXT`,`Cast uses scalar scale.`);let i=n.entityPage;if((i.returned!==n.entities.length||i.total<i.returned||i.truncated!==i.total>i.returned||(i.truncated?i.nextCursor===null:i.nextCursor!==null))&&k(`INVALID_CONTEXT`,`Entity pagination is inconsistent.`),n.entityIndex){let e=new Set(n.entityIndex.map(e=>e.id));e.size!==n.entityIndex.length&&k(`INVALID_CONTEXT`,`Duplicate entity index ID.`),(n.entityIndex.length>i.total||n.entities.some(t=>!e.has(t.id)))&&k(`INVALID_CONTEXT`,`Entity index must cover every detailed entity and no more than the total.`)}n.view.frame>=Math.max(1,n.scene.frameCount)&&k(`INVALID_CONTEXT`,`Playhead is outside the scene.`),new Set(n.shots.map(e=>e.id)).size!==n.shots.length&&k(`INVALID_CONTEXT`,`Duplicate shot ID.`);for(let e of[...n.shots,...n.shot?[n.shot]:[]])e.range.endFrameExclusive>n.scene.frameCount&&k(`INVALID_CONTEXT`,`Shot is outside the scene.`);return n.shot&&!n.shots.some(e=>e.id===n.shot.id&&e.range.startFrame===n.shot.range.startFrame&&e.range.endFrameExclusive===n.shot.range.endFrameExclusive)&&k(`INVALID_CONTEXT`,`Current shot and range must survive projection.`),n}function Yn(e){let t=new Set;for(let n of Array.isArray(e?.ops)?e.ops:[]){let e=A(n)?n.target?.kind:void 0;if(Dt.includes(e)){t.add(e);for(let t of A(n.set)?Object.keys(n.set):[])Object.hasOwn(an[e].properties,t)||k(`INVALID_ARGUMENT`,`Unknown ${e} path "${e}.${t}". Valid ${e} paths: ${on[e].join(`, `)}.`)}}t.size>1&&k(`INVALID_ARGUMENT`,`One domain per patch: split character, object, shot and stage edits into separate commands.`)}function Xn(e){(!A(e)||!Et.includes(e.name))&&k(`UNKNOWN_TOOL`,`Unsupported Studio tool.`),e.name===`patch_elements`&&Yn(e.args);let{args:t}=K(z({name:I(Et),args:cn[e.name]}),e);if(e.name===`inspect_studio`&&t.ids&&t.query!==void 0&&k(`INVALID_ARGUMENT`,`IDs and query are exclusive.`),e.name===`operate_studio`&&(!Object.keys(t).length||t.view&&!Object.keys(t.view).length)&&k(`INVALID_ARGUMENT`,`Transient operation must specify an action.`),t.ops){let e=t.ops.filter(e=>e.op===`create`&&e.name!==void 0).map(e=>e.name.normalize(`NFC`).trim());new Set(e).size!==e.length&&k(`DUPLICATE_NAME`,`Create names must be unique; resolve existing targets by ID.`);for(let e of t.ops)e.op===`update`&&Object.keys(e).length===2&&k(`INVALID_ARGUMENT`,`Update has no fields.`),e.facing&&e.rotationDeg&&k(`INVALID_ARGUMENT`,`Facing and rotationDeg are exclusive: facing sets yaw only (toward/away/same-as/yawDeg); rotationDeg {x,y,z} sets the full rotation, with y as the yaw.`),e.op===`group`&&e.childIds.includes(e.parentId)&&k(`INVALID_ARGUMENT`,`Cannot group an object under itself.`),e.op===`create`&&e.parent!==void 0&&e.name!==void 0&&e.parent.normalize(`NFC`).trim()===e.name.normalize(`NFC`).trim()&&k(`INVALID_ARGUMENT`,`Cannot group an object under itself.`);t.collisionPolicy===`avoid`&&!t.ops.some(e=>[`create`,`update`].includes(e.op)&&e.position?.relativeTo)&&k(`INVALID_ARGUMENT`,`collisionPolicy avoid needs at least one op with position.relativeTo (it nudges outward from that reference); other ops are placed as given.`)}if(e.name===`frame_shot`&&t.framing.exact&&JSON.stringify(t.framing.exact.position)===JSON.stringify(t.framing.exact.lookAt)&&k(`INVALID_ARGUMENT`,`Camera position and aim cannot coincide.`),e.name===`patch_elements`)for(let e of t.ops)Object.keys(e.set).length||k(`INVALID_ARGUMENT`,`Patch has no fields.`);return e.name===`verify_result`&&(!!t.receiptId==!!t.targets&&k(`INVALID_ARGUMENT`,`Exactly one of receiptId or targets is required.`),t.checks.includes(`motion`)&&t.range===void 0&&(t.range=`whole_clip`,Object.defineProperty(t,"rangeWasDefaulted",{value:!0,enumerable:!1}))),{name:e.name,args:t}}function q(e){if(e?.ok===!1){let t=K(Wn,e,`INVALID_RECEIPT`);return Ot(JSON.stringify(t))>8192&&k(`INVALID_RECEIPT`,`Failure receipt exceeds 8 KiB.`),(t.mutated===!1&&t.preserved.authoredState!==`unchanged`||t.mutated===!0&&t.preserved.authoredState!==`changed`||t.mutated===`unknown`&&(t.preserved.authoredState!==`unknown`||t.recovery.action!==`reconcile`||t.recovery.retryAllowed===!0))&&k(`INVALID_RECEIPT`,`Failure must preserve uncertainty and actual state evidence.`),O(t)}let t=K(Un,e,`INVALID_RECEIPT`);if(Ot(JSON.stringify(t))>8192&&k(`INVALID_RECEIPT`,`Receipt exceeds 8 KiB; use a detail cursor.`),t.delta.some(e=>!t.affectedIds.includes(e.id)||!Object.keys(e.after).length)&&k(`INVALID_RECEIPT`,`Readback must identify affected targets and actual state.`),t.ops){let e=t.ops.some(e=>e.status===`partial`);t.ops.some((e,t)=>e.index!==t)&&k(`INVALID_RECEIPT`,`Operation results must report every operation in order.`),t.ops.some(e=>e.status===`partial`!=!!e.droppedPaths?.length)&&k(`INVALID_RECEIPT`,`A partial operation must name the paths the domain dropped, and only a partial one may.`),t.status===`applied`&&e&&k(`INVALID_RECEIPT`,`Applied status cannot hide a dropped path.`),t.status===`partial`&&!e&&k(`INVALID_RECEIPT`,`Partial status requires at least one dropped path.`),t.status===`noop`&&t.ops.some(e=>e.status===`applied`)&&k(`INVALID_RECEIPT`,`A noop cannot report an applied operation.`)}if(t.status===`started`||t.status===`completed`?(t.revision.after<t.revision.before&&!t.nextHost&&k(`INVALID_RECEIPT`,`Completion revisions must not move backwards in one document.`),t.status===`started`&&(t.authored||t.undo||t.revision.before!==t.revision.after)&&k(`INVALID_RECEIPT`,`Started jobs cannot claim an authored commit.`),t.kind===`mutation`&&(!t.authored||!t.undo||t.revision.after<=t.revision.before||!t.delta.length)&&k(`INVALID_RECEIPT`,`A completed composite mutation needs retained undo and advancing revision evidence.`),t.undo&&(!t.authored||!t.affectedIds.length)&&k(`INVALID_RECEIPT`,`An undo entry requires an authored result and affected targets.`)):t.status===`noop`||t.status===`transient`?((t.authored||t.undo!==null||t.revision.before!==t.revision.after)&&k(`INVALID_RECEIPT`,`Non-authored operations cannot create history or advance authored revision.`),t.status===`noop`&&(t.mutated!==!1||t.delta.length)&&k(`INVALID_RECEIPT`,`Noop must prove no mutation.`),t.status===`transient`&&(!t.view||t.view.after<t.view.before||!t.delta.length)&&k(`INVALID_RECEIPT`,`Transient receipt requires view revisions and actual readback.`)):((!t.authored||!t.undo||t.revision.after!==t.revision.before+1||!t.affectedIds.length||!t.delta.length||t.mutated===!1)&&k(`INVALID_RECEIPT`,`Authored mutation requires one revision and one undo entry with actual readback.`),t.delta.length<t.affectedIds.length&&!t.detailCursor&&k(`INVALID_RECEIPT`,`Omitted batch readback requires a detail cursor.`)),t.status===`undone`&&(new Set(t.restoredTargets.map(e=>e.targetId)).size!==t.affectedIds.length||t.restoredTargets.some(e=>!t.affectedIds.includes(e.targetId)||Object.keys(Pt).some(n=>e[n]!==t.host[n])))&&k(`INVALID_RECEIPT`,`Undo must identify every restored target and its new token in the bound host.`),t.status===`installed`){(!t.jobId||!t.artifactId||!t.installed||!t.verification||!t.affectedIds.includes(t.installed.characterId))&&k(`INVALID_RECEIPT`,`Installation requires correlated target, artifact and verification evidence.`);let{frameCount:e,blocks:n}=t.installed,r=0;for(let e of n)(e.startFrame!==r||e.endFrameExclusive<=r||e.endFrameExclusive-r>120)&&k(`INVALID_RECEIPT`,`Installed schedule is not contiguous or bounded.`),r=e.endFrameExclusive;(r!==e||t.installed.durationSeconds!==e/24||t.verification.range.startFrame!==0||t.verification.range.endFrameExclusive!==e||t.verification.evaluatedFrames>e)&&k(`INVALID_RECEIPT`,`Installed schedule and verification coverage disagree.`),t.verification.status===`verified`&&t.verification.evaluatedFrames!==e&&k(`INVALID_RECEIPT`,`Verified motion requires whole-clip coverage.`),t.verification.status===`unverified`&&t.explicitUnverifiedAcceptance!==!0&&t.acceptance!==`advisory-policy`&&k(`INVALID_RECEIPT`,`Unverified installation requires explicit user or advisory-policy acceptance.`)}else(t.installed||t.verification||t.jobId&&![`started`,`completed`].includes(t.status)||t.artifactId||t.repairs||t.explicitUnverifiedAcceptance!==void 0)&&k(`INVALID_RECEIPT`,`Installation evidence is exclusive to installed receipts.`);return O(t)}var Zn=[`begin`,`mark`,`rollback`,`finish`,`cancel`],Qn=(e,t)=>Object.fromEntries(Zn.map(n=>[`agent.turn.${n}`,e({turnId:t})]));function $n(e,t){if(e===`agent.turn.mark`)return t.mark={point:t.session?.savepoint()??null,affectedIds:new Set(t.affectedIds),since:new Set},{txId:t.txId,affectedIds:[],toasts:[]};let{mark:n}=t;if(!n)throw new D(`STALE_TARGET`,`The agent turn has no mark to roll back to.`);return t.mark=null,t.edits=(t.edits??[]).filter(e=>e.mark!==n),t.session?.rollback(n.point??void 0),t.affectedIds=n.affectedIds,{txId:t.txId,affectedIds:[...n.since],toasts:[]}}var er=e=>e&&{point:e.session?.savepoint()??null,affectedIds:new Set(e.affectedIds),since:e.mark&&new Set(e.mark.since),mark:e.mark};function tr(e,t,n){return e&&t&&n?.ok&&n.authored&&(e.edits??=[]).push({...t,receiptId:n.receiptId,ids:n.affectedIds}),n}function nr(e,t,n,r,i){let a=e.edits??[],o=a.findIndex(e=>e.receiptId===t.receiptId);if(o<0)throw new D(`TARGET_BUSY`,`Finish the agent turn before traversing history or opening another transaction. Inside the turn, undo_edit with the receiptId of this message's newest edit reverts it${a.length?` (now ${a.at(-1).receiptId})`:``}; an earlier message's edit is undone after this one ends.`);let s=a[o];if(o<a.length-1)throw new D(`UNDO_CONFLICT`,`Later edits of this message come after it; undo them first, newest first: ${a.slice(o+1).reverse().map(e=>e.receiptId).join(`, `)}.`);return e.session.rollback(s.point??void 0),a.pop(),e.affectedIds=s.affectedIds,e.mark&&s.mark!==e.mark?e.mark={point:e.session.savepoint(),affectedIds:new Set(e.affectedIds),since:new Set}:e.mark&&(e.mark.since=s.since),{ok:!0,status:`completed`,kind:`transaction`,action:`edit.undo`,txId:e.txId,commandId:n.commandId,receiptId:crypto.randomUUID(),host:r.host,summary:`Undid ${s.receiptId} inside this message.`,authored:!1,revision:{before:r.revision,after:i().revision},affectedIds:s.ids,delta:[],checks:{coverage:`agent-turn-savepoint`},undo:null,warnings:[],output:{undoneReceiptId:s.receiptId}}}var J=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Y=(e,t)=>{throw new D(e,t)},rr=(e,t,n)=>e?.then?e.then(t,n):t(e),ir=e=>e.slice(-12).map(e=>({code:`STUDIO_TOAST`,message:[...e.message].slice(0,120).join(``)})),ar=0;function or({registry:e,ports:t}){let n=new Map,r=new Map,i=new Map,a=new Set,o=new Map,s=new Map,c=null;function l(n,r,i){if(i.origin===`ui`)return;if(n.exposure===`ui-only`&&Y(`CAPABILITY_MISSING`,n.uiOnlyHint??`This command is available only from the Studio UI.`),n.id===`load_scenes`){let t=e=>[...new Set(e.map(e=>e.id))].sort();if(J(t(r.document.scenes),t(e.state().scenes)))return}else if(n.exposure!==`confirm`||n.requiresConfirmation?.(e.state(),r)===!1)return;let a=o.get(i.confirmationToken);(!a||a.id!==n.id||!J(a.args,r)||!J(a.host,t.read().host)||a.expires<(t.now??Date.now)())&&Y(`CONFIRMATION_REQUIRED`,n.confirmationReason??`This command needs user confirmation.`),o.delete(i.confirmationToken)}let u=e=>{for(let t of a)t(e);t.emit?.(e)},d=Gn.TargetGuard.properties.targetId,f=e=>({type:`object`,properties:e,required:Object.keys(e),additionalProperties:!1}),p={type:`object`,properties:{},required:[],additionalProperties:!0},m={...Qn(f,d),"run.begin":f({id:d,args:p}),"run.update":f({txId:d,args:p}),"run.commit":f({txId:d}),"run.cancel":f({txId:d}),"job.await":{...f({jobId:d}),properties:{jobId:d,timeoutMs:{type:`integer`,minimum:1,maximum:3e5,default:3e4}}},"job.cancel":f({jobId:d}),"edit.undo":{...f({receiptId:d}),required:[]},"edit.redo":{...f({receiptId:d}),required:[]}},h=e=>(t.clearTimeout??clearTimeout)(e);function g(e,n=!1,i=new D(`CANCELLED`,`Transaction was cancelled.`)){r.delete(e.txId),h(e.timer),e.workTimer!==void 0&&h(e.workTimer),e.controller.abort(i),e.session.cancel({restore:J(e.before.host,t.read().host)}),u({type:`transaction.cancelled`,txId:e.txId,expired:n})}function _(e){e.timer!==void 0&&h(e.timer),e.timer=(t.setTimeout??setTimeout)(()=>g(e,!0),t.transactionIdleMs??3e4)}function ee(n,a,o,u){if(n.startsWith(`agent.turn.`)){if((o.origin!==`agent`||o.turnId!==a.turnId)&&Y(`CAPABILITY_MISSING`,`Only the owning agent turn can control this transaction.`),n===`agent.turn.begin`)return(c||r.size)&&Y(`TARGET_BUSY`,`Finish the open transaction first.`),c={txId:a.turnId,before:u,affectedIds:new Set,toasts:[],session:null},v(n,c,o,u);c?.txId!==a.turnId&&Y(`STALE_TARGET`,`The agent turn is no longer open.`);let e=c;if(n===`agent.turn.mark`||n===`agent.turn.rollback`)return v(n,$n(n,e),o,u);if(n===`agent.turn.cancel`)return c=null,e.session?.cancel(),v(n,e,o,u);try{e.historyEntryId=e.session?.commit().historyEntryId}catch(t){throw e.session?.cancel(),t}finally{c=null}return v(n,e,o,e.before)}let d=n===`edit.undo`||n===`edit.redo`;if(c&&!n.startsWith(`job.`)&&!(d&&!c.session)){if(n===`edit.undo`&&o.turnId===c.txId)return q(nr(c,a,o,u,()=>t.read()));Y(`TARGET_BUSY`,`Finish the agent turn before traversing history or opening another transaction.`)}if(d){let e=n===`edit.redo`,r=t.history?.(e),i=a.receiptId?t.receipt(a.receiptId):s.get(r)??(r?{receiptId:r,host:u.host,affectedIds:[u.host.sceneId],undo:{historyEntryId:r,entries:1,canUndoDirect:!0}}:null);if(!a.receiptId&&!i)return q({ok:!0,status:`noop`,action:n,commandId:o.commandId,receiptId:crypto.randomUUID(),host:u.host,authored:!1,mutated:!1,revision:{before:u.revision,after:u.revision},affectedIds:[],delta:[],checks:{coverage:`native-history-restoration`},undo:null,warnings:[]});(!i?.undo||!t.isRetained(i))&&Y(`UNDO_EXPIRED`,`The receipt no longer has a retained history entry.`),J(i.host,u.host)||Y(`STALE_SCENE`,`The receipt belongs to another document.`),(e?r!==i.undo.historyEntryId:!t.canUndo(i))&&Y(`UNDO_CONFLICT`,`Another edit owns the history boundary.`),(e?t.redo:t.undo)();let c=t.read(),l=i.affectedIds,d=l.map(e=>({...u.host,targetId:e,token:t.readTarget?.(e)??`removed-${crypto.randomUUID()}`}));return q({ok:!0,status:e?`applied`:`undone`,commandId:o.commandId,receiptId:crypto.randomUUID(),host:u.host,authored:!0,revision:{before:u.revision,after:c.revision},affectedIds:l,delta:l.slice(0,8).map(e=>({id:e,after:{token:d.find(t=>t.targetId===e).token}})),checks:{coverage:`native-history-restoration`},undo:{...i.undo,canUndoDirect:e},warnings:[],...e?{action:n,mutated:!0}:{undoneReceiptId:i.receiptId,restoredTargets:d},...l.length>8?{detailCursor:o.commandId}:{}})}if(n.startsWith(`job.`)){let e=i.get(a.jobId);(!e||!J(e.host,u.host))&&Y(`STALE_TARGET`,`Job is not in this document.`),n===`job.cancel`&&!e.outcome&&e.controller.abort(new D(`CANCELLED`,`Job was cancelled.`));let r;return(n===`job.await`&&!e.outcome?Promise.race([e.completion,new Promise((e,n)=>{r=(t.setTimeout??setTimeout)(()=>n(new D(`TIMEOUT`,`Job is still running.`)),a.timeoutMs)})]):e.completion).then(t=>q({...t,commandId:o.commandId,...t.ok?{receiptId:crypto.randomUUID()}:{},jobId:e.id})).finally(()=>{r!==void 0&&h(r)})}let f;if(n===`run.begin`){r.size&&Y(`TARGET_BUSY`,`Finish or cancel the open command transaction first.`);let n=e.prepare(a.id,a.args);l(n.entry,n.args,o),n.entry.kind!==`mutation`&&Y(`INVALID_ARGUMENT`,`Only mutations can open a transaction.`),f={txId:crypto.randomUUID(),entry:n.entry,before:u,origin:o.origin,targetId:n.args.characterId??null,controller:new AbortController,session:t.beginAction(n.entry.undoDomain,n.args.characterId??null),affectedIds:new Set,toasts:[]},r.set(f.txId,f),_(f)}else{if(f=r.get(a.txId),(!f||!J(f.before.host,u.host))&&Y(`STALE_TARGET`,`Transaction is no longer open in this document.`),o.origin!==f.origin&&Y(`TARGET_BUSY`,`This transaction belongs to another origin.`),f.updating&&n!==`run.cancel`&&Y(`TARGET_BUSY`,`A transaction update is still running.`),n===`run.update`){let i=e.prepare(f.entry.id,a.args);f.entry.undoDomain===`motion`&&i.args.characterId!==f.targetId&&Y(`INVALID_ARGUMENT`,`A motion transaction keeps its original target.`);let s=[],c=t.captureToasts?.(e=>s.push(typeof e==`string`?{message:e}:e)),l={origin:o.origin,signal:f.controller.signal,check(){f.controller.signal.throwIfAborted(),(!r.has(f.txId)||!J(f.before.host,t.read().host))&&Y(`STALE_TARGET`,`Transaction is no longer current.`)}},d=e=>{c?.(),h(f.workTimer),f.updating=!1,l.check(),s.length&&t.read().revision===u.revision&&Y(`TARGET_NOT_READY`,s.at(-1).message);for(let t of e.affectedIds)f.affectedIds.add(t);return f.toasts.push(...s),_(f),v(n,f,o,u)},p=e=>{throw c?.(),h(f.workTimer),f.updating=!1,!(e instanceof D)&&s.length&&t.read().revision===u.revision&&(e=new D(`TARGET_NOT_READY`,s.at(-1).message)),r.has(f.txId)&&g(f),e};try{f.updating=!0,h(f.timer),f.workTimer=(t.setTimeout??setTimeout)(()=>g(f,!0,new D(`TIMEOUT`,`${f.entry.id} exceeded its deadline.`)),f.entry.timeoutMs??3e4);let n=f.session.run(()=>e.invoke(f.entry,i.args,l));if(!n?.then)return d(n);let r=new Promise((e,t)=>f.controller.signal.addEventListener(`abort`,()=>t(f.controller.signal.reason),{once:!0}));return Promise.race([n,r]).then(d,p)}catch(e){return p(e)}}if(n===`run.cancel`&&g(f),n===`run.commit`){r.delete(f.txId),h(f.timer);try{f.historyEntryId=f.session.commit().historyEntryId}catch(e){throw f.session.cancel({restore:!1}),e}}}return v(n,f,o,n===`run.commit`?f.before:u)}function v(e,n,r,i){let a=t.read();return q({ok:!0,status:`completed`,kind:`transaction`,commandId:r.commandId,receiptId:crypto.randomUUID(),host:i.host,action:e,txId:n.txId,authored:!!n.historyEntryId,revision:{before:i.revision,after:a.revision},affectedIds:[...n.affectedIds],delta:[],checks:{coverage:`wire-transaction`},warnings:ir(n.toasts),undo:n.historyEntryId?{historyEntryId:n.historyEntryId,entries:1,canUndoDirect:!0}:null})}function te(e,n,r,i){let a=i??t.read().revision!==n.revision;return q({ok:!1,commandId:e.commandId,host:n.host,code:ue(r),phase:a?`commit`:`admission`,affectedIds:[],expectedTargets:[],currentTargets:[],mutated:a,preserved:{authoredState:a?`changed`:`unchanged`},recovery:{action:`inspect`,retryAllowed:!1},message:[...String(r.message||r)].slice(0,500).join(``)})}let ne=(e=[],t=[],n=0,r=12)=>{let i=[...n?[{code:`READBACK_TRUNCATED`,count:n,message:`Readback lists 8 of ${8+n} affected ids; inspect_studio scope entities with ids for the rest.`}]:[],...e,...ir(t)];return i.length<=r?i:[...i.slice(0,r-1),{code:`WARNINGS_TRUNCATED`,count:i.length-r+1,message:`${i.length-r+1} more warnings omitted.`}]};function re(e,n,r,i,a,o=[],s=null){let c=t.read(),l=c.revision!==r.revision,u=a??(l?s?.txId:null)??null;e.kind===`mutation`&&l&&!a&&!s&&Y(`UNCERTAIN_APPLY`,`${e.id} changed the scene without one undoable entry.`);let d=e.kind===`job`||e.kind===`document`||e.kind===`mutation`&&l&&(s||c.revision>r.revision+1),f=d||l?i.affectedIds:e.kind===`transient`?[r.host.sceneId]:[];if(s&&l)for(let e of f)s.affectedIds.add(e),s.mark?.since.add(e);let p=a=>q({ok:!0,commandId:n.commandId,receiptId:crypto.randomUUID(),host:r.host,action:e.id,summary:i.summary,status:d?`completed`:e.kind===`transient`?`transient`:l?`applied`:`noop`,authored:l,...d?{kind:e.kind,...i.output===void 0?{}:{output:i.output},...J(r.host,c.host)?{}:{nextHost:c.host}}:e.kind===`transient`?{view:{before:r.viewRevision??0,after:c.viewRevision??0}}:{mutated:l},revision:{before:r.revision,after:c.revision},affectedIds:f,delta:f.slice(0,8).map(e=>({id:e,after:t.readback?.(e,c,a>0)??{removed:!0}})),checks:{coverage:`studio-action:${e.id}`,...i.checks},warnings:ne(i.warnings,o,Math.max(0,f.length-8),a>1?4:12),undo:u?{historyEntryId:u,entries:1,canUndoDirect:!s}:null,...f.length>8?{detailCursor:n.commandId}:{}});for(let e=0;;e++)try{return p(e)}catch(t){if(e>=2||t?.code!==`INVALID_RECEIPT`||!/8 KiB/.test(t.message))throw t}}function y(a,o={},d={}){let f={origin:`ui`,commandId:crypto.randomUUID(),...d};f.origin===`ui`&&(a===`edit.undo`||a===`edit.redo`)&&t.finishHistoryGesture?.();let p=t.read(),g=t.journal();c&&!J(c.before.host,p.host)&&(c.session?.cancel({restore:!1}),c=null);let _=f.origin===`agent`&&f.turnId===c?.txId?c:null,v=(e,n,r,i=!1)=>_?(_.session??=t.beginAction(e,r),{result:_.session.run(()=>t.beginAction(e,r).run(n)),historyEntryId:null}):t.recordAction(e,n,r,i),ne=!1,y,b,ie,x,ae=!1,oe,S=new AbortController,se=()=>{b!==void 0&&h(b),ie!==void 0&&h(ie)},ce=[],le=()=>ce.length&&t.read().revision===p.revision?new D(`TARGET_NOT_READY`,ce.at(-1).message):null,ue=e=>{if(x?.background){let t=x.completionCommandId??=crypto.randomUUID();g.begin(t),e=q({...e,commandId:t,jobId:x.id})}let n=g.record(e);n.undo?.canUndoDirect&&!a.startsWith(`edit.`)&&s.set(n.undo.historyEntryId,n);for(let[e,n]of s)t.isRetained?.(n)===!1&&s.delete(e);return t.remember?.(n),n},de=e=>{se(),y?.(),y=null,e instanceof D||(e=le()??e),f.origin===`ui`&&e.uiMessage&&t.showRefusal?.(e.uiMessage);let n=te(f,p,e,x?ae:void 0),r=ne?ue(n):n;return x&&!x.completion&&(x.outcome=r,x.completion=Promise.resolve(r),u({type:`job.completed`,jobId:x.id,receipt:r})),r};try{f.origin!==`ui`&&!J(Kn(f.host),p.host)&&Y(`STALE_SCENE`,`The live document changed.`),f.turnId&&!_&&a!==`agent.turn.begin`&&Y(`STALE_TARGET`,`The agent turn is no longer open.`);let s=JSON.stringify({id:a,args:o,...f});if(!g.begin(f.commandId,s))return g.get(f.commandId)??n.get(f.commandId)??te(f,p,new D(`UNCERTAIN_APPLY`,`Command is still executing.`));ne=!0;let{entry:c,args:d}=m[a]?{args:K(m[a],o)}:e.prepare(a,o);if(f.origin!==`ui`&&(!c?.readOnly&&![`job.await`,`job.cancel`,`agent.turn.mark`,`agent.turn.rollback`,`agent.turn.finish`,`agent.turn.cancel`].includes(a)&&f.expectedRevision!==p.revision&&Y(`STALE_SCENE`,`Authored state changed; obtain fresh intent.`),!c?.readOnly&&p.busy&&!_&&!r.has(d.txId)&&!a.startsWith(`job.`)&&Y(`TARGET_BUSY`,`Finish the current editor gesture first.`)),m[a])return rr(ee(a,d,f,p),ue,de);r.size&&Y(`TARGET_BUSY`,`Finish or cancel the open command transaction first.`),_&&c.kind===`document`&&Y(`TARGET_BUSY`,`Finish the agent turn before changing documents.`),l(c,d,f),y=t.captureToasts?.(e=>ce.push(typeof e==`string`?{message:e}:e));let h=c.domain??c.undoDomain,C=c.target?.(d,p)??d.characterId??d.shotId??d.objectId,fe=C?t.readTarget?.(C):null,pe=h?p.domainRevisions?.[h]:null,me=()=>{let e=t.read();fe=C?t.readTarget?.(C):null,pe=h?e.domainRevisions?.[h]:null},he=new Set,w={origin:f.origin,signal:S.signal,check(){S.signal.throwIfAborted();let e=t.read();J(e.host,p.host)||Y(`STALE_TARGET`,`The open document or scene changed while the job was running.`),h&&e.domainRevisions?.[h]!==pe&&Y(`STALE_TARGET`,`The ${h} data changed while the job was running (revision ${pe} to ${e.domainRevisions?.[h]}); an edit landed between the request and its result.`),C&&t.readTarget?.(C)!==fe&&Y(`STALE_TARGET`,`${C} changed while the job was running.`)},commit(e){w.check(),h||Y(`INVALID_ARGUMENT`,`A committing job must declare its domain.`);let t=v(h,e,C??null);return t?.then&&Y(`INVALID_ARGUMENT`,`Job publication must be synchronous; prepare before commit.`),oe=t.historyEntryId,ae||=!!oe,x&&me(),t.result},run(t,n={}){x?w.check():S.signal.throwIfAborted();let r=e.prepare(t,n);l(r.entry,r.args,f);let i=()=>e.invoke(r.entry,r.args,w),a=r.entry.kind===`mutation`?v(r.entry.undoDomain,i,r.args.characterId??null,!0):{result:i()};return x&&me(),rr(a,e=>rr(e.result,t=>{x&&(w.check(),me(),ae||=!!e.historyEntryId);for(let e of t.affectedIds)he.add(e);return t}))}};c.kind===`job`&&(x={id:crypto.randomUUID(),host:p.host,controller:S,background:!1},i.set(x.id,x)),b=(t.setTimeout??setTimeout)(()=>{let e=new D(`TIMEOUT`,`${c.id} exceeded its deadline.`);S.abort(e)},x&&c.background===!0?3e5:c.timeoutMs??3e4);let ge=()=>{let t=e.invoke(c,d,w);if(!t?.then)return t;let n=new Promise((e,t)=>S.signal.addEventListener(`abort`,()=>t(S.signal.reason),{once:!0}));return Promise.race([t,n])},_e=er(_),ve=c.kind===`mutation`?v(c.undoDomain,ge,d.characterId??null):{result:ge(),historyEntryId:null},ye=({result:e,historyEntryId:t})=>rr(e,e=>{se(),y?.(),y=null;let n=e?.output===void 0?le():null;if(n)throw n;return tr(_,_e,ue(re(c,f,p,{...e,affectedIds:[...new Set([...e.affectedIds,...he])]},t??oe,ce,_)))}),be=ve?.then?ve.then(ye):ye(ve),T=be?.then?be.catch(de):be;if(x){x.completion=Promise.resolve(T).then(e=>(x.outcome=e,u({type:`job.completed`,jobId:x.id,receipt:e}),e));let e=()=>{x.background=!0;let e=t.read();return g.record(q({ok:!0,commandId:f.commandId,receiptId:crypto.randomUUID(),host:p.host,action:c.id,status:`started`,kind:`job`,jobId:x.id,authored:!1,revision:{before:e.revision,after:e.revision},affectedIds:[],delta:[],checks:{coverage:`studio-action:${c.id}`},warnings:[],undo:null}))};if(T?.then&&f.wait===!1)return e();if(T?.then&&c.background===!0){let r=Promise.race([x.completion,new Promise(n=>{ie=(t.setTimeout??setTimeout)(()=>n(e()),c.timeoutMs??3e4)})]).finally(()=>n.delete(f.commandId));return n.set(f.commandId,r),r}}if(T?.then){let e=(x?.completion??T).finally(()=>n.delete(f.commandId));return n.set(f.commandId,e),e}return T}catch(e){return de(e)}}function b(...e){ar++;try{let t=y(...e);return t?.then?t.finally(()=>{ar--}):(ar--,t)}catch(e){throw ar--,e}}return{run:b,confirm(n,r={}){let i=e.prepare(n,r),a=crypto.randomUUID();return o.set(a,{id:n,args:i.args,host:t.read().host,expires:(t.now??Date.now)()+3e5}),a},subscribe(e){return a.add(e),()=>a.delete(e)},dispose(){c?.session?.cancel(),c=null;for(let e of r.values())g(e);for(let e of i.values())e.outcome||e.controller.abort(new D(`CANCELLED`,`Studio closed.`));a.clear()}}}var sr=Object.freeze([`pose_edit`,`object_insert`,`cutout_insert`,`object_transform`,`shot_add`,`shot_edit`,`camera_key_record`,`rail_edit`,`prompt_block_add`,`prompt_block_edit`]);function X(e,t){if(e===t)return!0;if(typeof e==`number`&&typeof t==`number`)return Math.abs(e-t)<1e-8;if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;if(e instanceof Map||t instanceof Map)return e instanceof Map&&t instanceof Map&&e.size===t.size&&[...e].every(([e,n])=>t.has(e)&&X(n,t.get(e)));let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&X(e[n],t[n]))}var cr=e=>({bones:e?.bones??{},rootY:e?.rootY??0}),lr=(e=[])=>e.map(({frame:e,framing:t})=>({frame:e,framing:t})),ur=e=>({...e,camera:b(e.camera),cameraKeys:lr(e.cameraKeys)});function dr(e,t,n){if(t===n)return null;if(e===`pose`)return X(t,n)?null:`pose_edit`;if(e===`objects`){let e=n.find(e=>!t.some(t=>t.id===e.id));return e?e.renderer===`cutout`?`cutout_insert`:`object_insert`:X(t,n)?null:`object_transform`}if(e===`characters`){if(n.some(e=>!t.some(t=>t.id===e.id)))return`object_insert`;for(let e of n){let n=t.find(t=>t.id===e.id);if(n&&!X(cr(n.pose),cr(e.pose)))return`pose_edit`}let e=e=>e.map(({id:e,x:t,y:n=0,z:r,rot:i,scale:a=1,hidden:o=!1,model:s,tint:c,subject:l,identityImage:u})=>({id:e,x:t,y:n,z:r,rot:i,scale:a,hidden:o,model:s,tint:c,subject:l,identityImage:u}));return X(e(t),e(n))?null:`object_transform`}if(e===`shots`){if(n.some(e=>!t.some(t=>t.id===e.id)))return`shot_add`;for(let e of n){let n=t.find(t=>t.id===e.id);if(!n)continue;let r=b(e.camera),i=b(n.camera);if([`cameraRail`,`craneHeight`,`railFollow`,`dollyTiming`].some(e=>!X(r[e],i[e])))return`rail_edit`;let a=e.cameraKeys??[],o=n.cameraKeys??[];if(a.length>o.length||a.some(e=>{let t=o.find(t=>t.frame===e.frame);return t&&!X(t.framing,e.framing)}))return`camera_key_record`}return X(t.map(ur),n.map(ur))?null:`shot_edit`}return null}function fr(e){let t=new Set;return(n,r,i,a)=>{if(![`craft`,`playground`].includes(n)||t.has(n))return!1;let o=dr(r,i,a);return o?(t.add(n),e(`${n}:first_edit`,{edit_kind:o,definition_version:1}),!0):!1}}var pr=`modulepreload`,mr=function(e){return`/`+e},hr={},gr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=mr(t,n),t=s(t),t in hr)return;hr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:pr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},_r=Object.freeze([`read`,`camera`,`scene_write`,`prompt_authoring`,`frame_capture`,`motion_generate`,`motion_apply`,`project_io`,`other`]),vr=Object.freeze([`workflow_read`,`workflow_write`,`workflow_run`,`frame_capture`,`image_generate`,`scene_write`,`other`]),yr=Object.freeze([`workflow:run_requested`,`workflow:run_succeeded`,`workflow:run_failed`,`workflow:run_cancelled`,`workflow:result_applied`,`agent:turn_requested`,`agent:tool_executed`,`agent:turn_succeeded`,`agent:turn_failed`,`agent:turn_cancelled`,`agent:result_applied`,`mcp:tool_requested`,`mcp:tool_executed`,`mcp:result_applied`]),br=Object.freeze({"workflow:run_requested":[`surface`,`run_id`,`node_count_bucket`],"workflow:run_succeeded":[`run_id`,`duration_bucket`],"workflow:run_failed":[`run_id`,`duration_bucket`,`failure_code`],"workflow:run_cancelled":[`run_id`,`duration_bucket`,`failure_code`],"workflow:result_applied":[`run_id`],"agent:turn_requested":[`surface`,`turn_id`],"agent:tool_executed":[`turn_id`,`tool_category`,`outcome`,`duration_bucket`],"agent:turn_succeeded":[`turn_id`,`duration_bucket`],"agent:turn_failed":[`turn_id`,`duration_bucket`,`failure_code`],"agent:turn_cancelled":[`turn_id`,`duration_bucket`,`failure_code`],"agent:result_applied":[`turn_id`],"mcp:tool_requested":[`tool_category`,`request_id`],"mcp:tool_executed":[`tool_category`,`outcome`,`duration_bucket`,`request_id`],"mcp:result_applied":[`request_id`]}),xr=Object.freeze({surface:new Set([`studio`,`workflow`]),node_count_bucket:new Set([`0`,`1-3`,`4-10`,`gte11`]),duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`]),tool_category:new Set([..._r,...vr]),outcome:new Set([`succeeded`,`failed`,`uncertain`,`cancelled`])}),Sr=Object.freeze({source:new Set([`agent`,`manual`]),outcome:new Set([`ok`,`error`]),surface:new Set([`assets`,`agent`,`mcp`])}),Cr=`cozyclay.analyticsOptOut`,wr=`cozyclay.internalQa`,Tr=`cozyclay.analyticsActivation`,Er=`cozyclay.useCaseAsked`,Dr=Object.freeze({pose:Object.freeze([`pose_edit`]),camera:Object.freeze([`camera_key_record`,`rail_edit`]),object:Object.freeze([`object_insert`,`cutout_insert`,`object_transform`]),shot:Object.freeze([`shot_add`,`shot_edit`]),prompt:Object.freeze([`prompt_block_add`,`prompt_block_edit`])}),Or=Object.freeze(Object.keys(Dr).map(e=>`${e}_edit_bucket`)),kr=Object.freeze([`animation`,`film`,`game`,`ad_mv`,`personal`,`other`,`skip`]),Ar=Object.freeze([`team`,`solo`,`skip`]),jr=new Set([`storyboard`,`animation`]),Mr=Object.freeze([`latest`,`outdated`,`unknown`]),Nr=Object.freeze([`https://cozyclay.org`,`https://www.cozyclay.org`]),Pr=Object.freeze({"install:first_launch":[`heard_from`],"app:session_started":[],"app:session_ended":[`duration_bucket`,`action_count_bucket`,`scenes_touched`,...Or],"app:error":[`error_kind`,`error_type`,`error_source`,`error_file`,`error_line`,`error_col`],"device:profile":[`gpu_vendor`,`gpu_class`,`webgl`,`cpu_bucket`,`memory_bucket`,`frame_rate_bucket`],"survey:use_case":[`use_case`,`team`],"feature:used":[`name`],"hosted:composer_viewed":[],"hosted:login_started":[],"hosted:ticket_created":[],"hosted:result_opened":[],"hosted:opened_in_studio":[],"scene:created":[`scene_source`,`previs_mode`],"storyboard:panel_created":[`source`],"storyboard:panel_stylized":[`outcome`],"cast:proxy_added":[`surface`],"scene:loaded":[`scene_source`],"project:saved":[`object_count_bucket`,`shot_count_bucket`],"project:opened":[`age_bucket`],"craft:first_action":[`action_kind`],"craft:first_edit":[`edit_kind`,`definition_version`],"motion:backend_state":[`backend`,`host_configured`],"motion:generate_requested":[`surface`,`input_mode`,`request_id`],"motion:preflight_blocked":[`reason`,`surface`,`request_id`],"motion:preflight_passed":[`backend`,`surface`,`request_id`],"motion:job_started":[`backend`,`input_mode`,`request_id`],"motion:job_succeeded":[`backend`,`duration_bucket`,`input_mode`,`request_id`],"motion:job_failed":[`backend`,`duration_bucket`,`input_mode`,`error_code`,`request_id`],"motion:result_applied":[`request_id`,`backend`],"export:blocking_frame_succeeded":[`format`],"export:video_succeeded":[`format`],"export:keyframe_pack":[`entries`,`source`],"export:attempt_started":[`attempt_id`,`export_kind`,`format`,`surface`],"export:attempt_succeeded":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`],"export:attempt_failed":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`,`failure_code`],"export:attempt_cancelled":[`attempt_id`,`export_kind`,`format`,`surface`,`duration_bucket`,`failure_code`],"sample:played":[`from`],"playground:opened":[],"playground:first_action":[`action_kind`],"playground:first_edit":[`edit_kind`,`definition_version`],"activation:completed":[`activation_path`],"tutorial:started":[`surface`,`tutorial_version`,`start_source`],"tutorial:step_entered":[`surface`,`tutorial_version`,`step_kind`],"tutorial:step_completed":[`surface`,`tutorial_version`,`step_kind`,`elapsed_bucket`],"tutorial:completed":[`surface`,`tutorial_version`,`elapsed_bucket`],"tutorial:dismissed":[`surface`,`tutorial_version`,`step_kind`],sculpt_run:[`outcome`,`rounds`,`final_iou`,`duration_ms`,`had_target`],...br}),Fr=new Set([`pose_edit`,`pose_save`,`camera_fly`,`orbit`,`dolly_rail`,`crane_graph`,`timeline_scrub`,`prompt_block_add`,`shot_add`,`shot_cut`,`export_pose`,`export_frame`,`export_video`,`export_depth_video`,`export_keyframe_pack`,`fal_motion_open`,`mcp_connected`,`auto_color`,`plan_view`,`camera_tutorial`]),Ir=Object.freeze([`x`,`hn`,`reddit`,`github`,`friend`,`other`,`site`,`playground`]),Lr=new Set(Ir),Rr=new Set([`prompt`,`text`,`url`,`path`,`file`]),zr=Object.freeze({backend:new Set([`none`,`local_kimodo`,`hosted`,`fal`]),host_configured:new Set([!0,!1]),surface:new Set([`timeline`,`line_edit`,`trail`,`mcp`,`fal_card`,`agent`]),input_mode:new Set([`prompt`,`pose`,`edit`,`a_to_b`,`still`]),reason:new Set([`unconfigured`,`unreachable`,`unsupported_route`,`locked`,`missing_input`]),error_code:new Set([`aborted`,`unsupported_route`,`generation_failed`,`quota`,`unknown`]),duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`])}),Br=new Set([`unsupported_codec`,`encode_failed`,`render_failed`,`aborted`,`unknown`]),Vr=Object.freeze({export_kind:new Set([`video`,`depth_video`,`frame`,`keyframe_pack`,`workflow_send`,`animation_project`,`contact_sheet`,`panel_pack`,`animatic`]),format:new Set([`mp4`,`png`,`zip`,`cclayproject`]),surface:new Set([`studio`,`workflow`,`embed`]),duration_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`]),failure_code:Br}),Hr=Object.freeze({surface:new Set([`studio`,`playground`]),tutorial_version:new Set([1]),start_source:new Set([`query`,`settings`,`landing`]),step_kind:new Set([`fly`,`walk`,`dolly`,`orbit`,`shot`,`rail`,`play`]),elapsed_bucket:new Set([`lt1s`,`1-3s`,`3-10s`,`10-30s`,`gte30s`])}),Ur=Object.freeze([`done`,`cancelled`,`failed`]),Wr=10,Gr=864e5,Kr=Object.freeze({workflow:new Set([`aborted`,`capture_failed`,`generation_failed`,`unknown`]),agent:new Set([`aborted`,`auth`,`rate_limited`,`tool_failed`,`upstream`,`unknown`])}),qr=Object.freeze({error_kind:new Set([`error`,`unhandled_rejection`]),error_type:new Set([`Error`,`TypeError`,`RangeError`,`ReferenceError`,`SyntaxError`,`EvalError`,`URIError`,`AggregateError`,`AbortError`,`TimeoutError`,`NotAllowedError`,`NotSupportedError`,`NotFoundError`,`NotReadableError`,`InvalidStateError`,`QuotaExceededError`,`SecurityError`,`NetworkError`,`DataCloneError`,`OperationError`,`EncodingError`,`UnknownError`,`DOMException`,`non_error`,`other`]),error_source:new Set([`app`,`extension`,`external`,`unknown`])}),Jr=/^[A-Za-z0-9_.-]{1,80}\.(?:m?js|jsx|ts|tsx)$/,Yr=Object.freeze({gpu_vendor:new Set([`nvidia`,`amd`,`intel`,`apple`,`qualcomm`,`arm`,`software`,`other`,`unknown`]),gpu_class:new Set([`discrete`,`integrated`,`software`,`unknown`]),webgl:new Set([`webgl2`,`webgl1`,`none`]),cpu_bucket:new Set([`1-4`,`5-8`,`9-16`,`gte17`,`unknown`]),memory_bucket:new Set([`lt4`,`4-7`,`gte8`,`unknown`]),frame_rate_bucket:new Set([`lt20`,`20-40`,`40-55`,`gte55`,`unknown`])}),Z=null,Xr=!1,Q=!1,Zr=!1,Qr=null,$r=!1,ei=!1,ti=0,ni=0,ri=0,ii=!1,ai=!1,oi=new Set,si=new Map(Object.entries(Dr).flatMap(([e,t])=>t.map(t=>[t,e]))),ci=1e3,li=Object.fromEntries(Object.keys(Dr).map(e=>[e,0])),ui=null,di=-1/0,fi=10,pi=new Set,mi=!1,hi=!1,gi=new Set([`app:session_started`,`app:session_ended`,`install:first_launch`,`motion:backend_state`,`app:error`,`device:profile`]);function _i(){try{return globalThis.localStorage??null}catch{return null}}function vi(e){try{return _i()?.getItem(e)??null}catch{return null}}function yi(e,t){try{_i()?.setItem(e,t)}catch{}}function bi(e){return typeof e==`string`?e.trim().toLowerCase().replace(/[/.]+$/g,``):``}function xi(e){return e===void 0?[...Nr]:e.split(`,`).map(bi).filter(Boolean)}function Si(e,t){let n=bi(e);return Array.isArray(t)&&t.some(e=>n===bi(e))}var Ci=e=>typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):typeof e==`string`&&e.length<=32&&!/\s/.test(e);function wi(e,t){let n=Pr[e]??[];if(!t||typeof t!=`object`||Array.isArray(t))return{};let r={};for(let i of n)if(!(Rr.has(i)||!Object.hasOwn(t,i))&&!(e===`feature:used`&&(i!==`name`||!Fr.has(t[i])))&&!(e===`install:first_launch`&&(i!==`heard_from`||!Lr.has(t[i])))){if(e.startsWith(`export:attempt_`)){if(i===`attempt_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(!Vr[i]?.has(t[i]))continue}if(!(e===`export:keyframe_pack`&&(i===`source`&&t[i]!==`workflow`||i===`entries`&&(!Number.isFinite(t[i])||t[i]<0)))&&!((e===`craft:first_edit`||e===`playground:first_edit`)&&(i===`edit_kind`&&!sr.includes(t[i])||i===`definition_version`&&t[i]!==1))){if(e.startsWith(`motion:`)){if(i===`request_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(!zr[i]?.has(t[i]))continue}if(!(e.startsWith(`tutorial:`)&&!Hr[i]?.has(t[i]))){if(e.startsWith(`workflow:`)||e.startsWith(`agent:`)||e.startsWith(`mcp:`)){if(i===`run_id`||i===`turn_id`||i===`request_id`){if(typeof t[i]!=`string`||!/^[a-f0-9]{32}$/.test(t[i]))continue}else if(i===`surface`){if(!xr.surface.has(t[i])||e.startsWith(`workflow:`)&&t[i]!==`workflow`)continue}else if(i===`node_count_bucket`&&!xr.node_count_bucket.has(t[i]))continue;else if(i===`duration_bucket`&&!xr.duration_bucket.has(t[i]))continue;else if(i===`tool_category`){if(!(e.startsWith(`agent:`)?vr:_r).includes(t[i]))continue}else if(i===`outcome`){if(!(e===`mcp:tool_executed`?[`succeeded`,`failed`,`uncertain`,`cancelled`]:[`succeeded`,`failed`,`cancelled`]).includes(t[i]))continue}else if(i===`failure_code`&&!Kr[e.startsWith(`agent:`)?`agent`:`workflow`].has(t[i]))continue}if(e===`app:error`){if(i===`error_file`){typeof t[i]==`string`&&Jr.test(t[i])&&(r[i]=t[i]);continue}if(i===`error_line`||i===`error_col`){Number.isInteger(t[i])&&t[i]>=0&&t[i]<=1e7&&(r[i]=t[i]);continue}if(!qr[i]?.has(t[i]))continue}if(!(e===`device:profile`&&!Yr[i]?.has(t[i]))){if(e===`sculpt_run`){let e=t[i];i===`outcome`&&Ur.includes(e)||i===`rounds`&&Number.isInteger(e)&&e>=0&&e<=Wr?r[i]=e:i===`final_iou`&&typeof e==`number`&&e>=0&&e<=1?r[i]=Math.round(e*100)/100:i===`duration_ms`&&typeof e==`number`&&e>=0&&e<=Gr?r[i]=Math.round(e):i===`had_target`&&typeof e==`boolean`&&(r[i]=e);continue}i===`previs_mode`&&!jr.has(t[i])||(e.startsWith(`storyboard:`)||e.startsWith(`cast:`))&&!Sr[i]?.has(t[i])||e===`survey:use_case`&&(i===`use_case`&&!kr.includes(t[i])||i===`team`&&!Ar.includes(t[i]))||Ci(t[i])&&(r[i]=t[i])}}}}return r}Object.freeze([...Fr]);function Ti(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return t===0?`0`:t<=3?`1-3`:t<=10?`4-10`:`gte11`}function Ei(e){return!Number.isFinite(e)||e<6e4?`lt1m`:e<3e5?`1-5m`:e<9e5?`5-15m`:e<18e5?`15-30m`:`gte30m`}function Di(e){return!Number.isFinite(e)||e<0||e<36e5?`lt1h`:e<864e5?`1-24h`:e<6048e5?`1-7d`:e<2592e6?`7-30d`:`gte30d`}function Oi(){let e=String(globalThis.navigator?.userAgentData?.platform||globalThis.navigator?.platform||``).toLowerCase();return e.includes(`mac`)?`macos`:e.includes(`win`)?`windows`:e.includes(`linux`)?`linux`:e.includes(`android`)?`android`:e.includes(`iphone`)||e.includes(`ipad`)||e.includes(`ios`)?`ios`:`unknown`}function ki(e){return!Number.isFinite(e)||e<1e3?`lt1s`:e<3e3?`1-3s`:e<1e4?`3-10s`:e<3e4?`10-30s`:`gte30s`}function Ai(e){return!Number.isFinite(e)||e<=0?`unknown`:e<=4?`1-4`:e<=8?`5-8`:e<=16?`9-16`:`gte17`}function ji(e){return!Number.isFinite(e)||e<=0?`unknown`:e<4?`lt4`:e<8?`4-7`:`gte8`}function Mi(e){return!Number.isFinite(e)||e<=0?`unknown`:e<20?`lt20`:e<40?`20-40`:e<55?`40-55`:`gte55`}function Ni(e){let t=String(e??``).toLowerCase();return t.trim()?/swiftshader|llvmpipe|softpipe|software|basic render driver/.test(t)?{gpu_vendor:`software`,gpu_class:`software`}:/nvidia|geforce|quadro|\brtx\b|\bgtx\b|tesla/.test(t)?{gpu_vendor:`nvidia`,gpu_class:`discrete`}:/\bamd\b|radeon|\bati\b/.test(t)?{gpu_vendor:`amd`,gpu_class:/radeon\(tm\) graphics|radeon graphics|vega \d+ graphics|\b(?:610|660|680|740|760|780|880|890)m\b/.test(t)?`integrated`:`discrete`}:/intel|iris|uhd graphics|hd graphics/.test(t)?{gpu_vendor:`intel`,gpu_class:/arc(?:\(tm\))? [ab]\d{3}/.test(t)?`discrete`:`integrated`}:/apple|\bm[1-9](?: pro| max| ultra)?\b/.test(t)?{gpu_vendor:`apple`,gpu_class:`integrated`}:/adreno|qualcomm/.test(t)?{gpu_vendor:`qualcomm`,gpu_class:`integrated`}:/\bmali\b|\barm\b|powervr/.test(t)?{gpu_vendor:`arm`,gpu_class:`integrated`}:{gpu_vendor:`other`,gpu_class:`unknown`}:{gpu_vendor:`unknown`,gpu_class:`unknown`}}var Pi=/((?:https?|chrome-extension|moz-extension|safari-extension|safari-web-extension):\/\/[^\s()]+?):(\d+):(\d+)/g;function Fi(e,t){if(typeof e!=`string`||!e)return`unknown`;if(/^(?:chrome|moz|safari|safari-web)-extension:/.test(e))return`extension`;try{return t&&new URL(e).origin===t?`app`:`external`}catch{return`unknown`}}function Ii(e){try{let t=new URL(e).pathname.split(`/`).pop()??``;return Jr.test(t)?t:null}catch{return null}}function Li(e){try{if(e===null||typeof e!=`object`&&typeof e!=`function`)return`non_error`;let t=typeof e.name==`string`?e.name:``;return t&&t!==`non_error`&&t!==`other`&&qr.error_type.has(t)?t:typeof DOMException<`u`&&e instanceof DOMException?`DOMException`:e instanceof Error?`other`:`non_error`}catch{return`other`}}function Ri({error:e,filename:t,lineno:n,colno:r,kind:i=`error`}={},a=globalThis.location?.origin??``){let o={error_kind:i===`unhandled_rejection`?`unhandled_rejection`:`error`,error_type:Li(e),error_source:`unknown`},s=typeof t==`string`&&t?{url:t,line:n,col:r}:null;if(!s||Fi(s.url,a)!==`app`){let t=``;try{t=typeof e?.stack==`string`?e.stack.slice(0,4e3):``}catch{t=``}let n=[...t.matchAll(Pi)].map(e=>({url:e[1],line:Number(e[2]),col:Number(e[3])}));s=n.find(e=>Fi(e.url,a)===`app`)??s??n[0]??null}if(!s||(o.error_source=Fi(s.url,a),o.error_source!==`app`))return o;let c=Ii(s.url);return c&&(o.error_file=c),Number.isInteger(s.line)&&s.line>=0&&(o.error_line=s.line),Number.isInteger(s.col)&&s.col>=0&&(o.error_col=s.col),o}function zi(e,t=Date.now()){let n=si.get(e);if(!n)return!1;let r=n===ui&&t-di<ci;return ui=n,di=t,r||(li[n]+=1),e===`pose_edit`&&oa(`pose_edit`),!r}function Bi(){return Object.fromEntries(Object.entries(li).map(([e,t])=>[`${e}_edit_bucket`,Ti(t)]))}function Vi(e,t=`unknown`){try{if(e?.name===`AbortError`)return`aborted`;if(Br.has(e?.exportFailureCode))return e.exportFailureCode}catch{}return Br.has(t)?t:`unknown`}function Hi(e,t={}){let n=!1,r=null,i=NaN,a=()=>performance.now(),o=$,s=()=>{try{return a()}catch{return NaN}},c=(e,t)=>{try{Promise.resolve(o(e,wi(e,t))).catch(()=>{})}catch{}};try{a=t.now??a,o=t.capture??o;let n=[...globalThis.crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``);r={...wi(`export:attempt_started`,e),attempt_id:n},i=s(),c(`export:attempt_started`,r)}catch{r=null}let l=(e,t,a)=>{if(!n&&(n=!0,r))try{let n={...r,duration_bucket:ki(s()-i)};e===`failed`&&(n.failure_code=Vi(t,a),n.failure_code===`aborted`&&(e=`cancelled`)),c(`export:attempt_${e}`,n)}catch{}};return{succeed(){l(`succeeded`)},fail(e,t=`unknown`){l(`failed`,e,t)}}}var Ui=[`$current_url`,`$initial_current_url`,`$referrer`,`$initial_referrer`],Wi=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`,`ph_keyword`];function Gi(e){return typeof e==`string`?e.split(`#`)[0].split(`?`)[0]:e}function Ki(e){if(!e||typeof e!=`object`||!e.properties)return e;let t=[e.properties,e.properties.$set,e.properties.$set_once,e.$set,e.$set_once].filter(e=>e&&typeof e==`object`&&!Array.isArray(e));for(let e of t){for(let t of Ui)typeof e[t]==`string`&&(e[t]=Gi(e[t]));for(let t of Wi)delete e[t],delete e[`$initial_${t}`];for(let t of Object.keys(e))t.startsWith(`$session_entry_`)&&delete e[t]}return e}function qi(e){return e?.activationTracked!==!0}function Ji(){return Zr?!0:$i()?.distribution===`npm`?$i()?.telemetryEnabled!==!0:vi(Cr)===`1`}function Yi(){try{let e=_i();if(!e)return;let t=[];for(let n=0;n<e.length;n+=1){let r=e.key(n);r&&r.startsWith(`ph_`)&&r.endsWith(`_posthog`)&&t.push(r)}for(let n of t)e.removeItem(n)}catch{}}async function Xi(e){if($i()?.distribution!==`npm`)return{ok:!0,enabled:e};try{let t=await fetch(`/__cozyclay/telemetry`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)return{ok:!1,enabled:!e};let n=await t.json();return globalThis.__COZYCLAY_RUNTIME__=n,{ok:!0,enabled:n.telemetryEnabled===!0}}catch{return{ok:!1,enabled:!e}}}async function Zi(e){let t=e===!0,n=$i()?.distribution===`npm`;Zr=t;let r=await Xi(!t);if(Zr=!1,!r.ok)return Ji();let i=!r.enabled;if(yi(Cr,i?`1`:`0`),i&&Yi(),n&&!i)return globalThis.location?.reload(),!1;if(!Z&&!i&&await ia(),!Z)return i;try{i?(Q=!1,Z.opt_out_capturing()):(Z.opt_in_capturing(),Q=Xr)}catch{Q=!1}return i}function Qi(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_COZYCLAY_LIVE_PORT:`5184`}}function $i(){let e=globalThis.__COZYCLAY_RUNTIME__;return!e||typeof e!=`object`||Array.isArray(e)?null:e}function ea(e){try{let t=new URL(e);return t.protocol===`http:`&&[`127.0.0.1`,`localhost`].includes(t.hostname)}catch{return!1}}function ta({env:e=Qi(),origin:t=globalThis.location?.origin??``,runtime:n=$i()}={}){return e.PROD?n?.distribution===`npm`?n.telemetryEnabled===!0?ea(t)?typeof n.apiKey!=`string`||n.apiKey.length===0?{kind:`disabled`,reason:`no key`}:typeof n.installationId!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.installationId)?{kind:`disabled`,reason:`invalid anonymous identity`}:{kind:`enabled`,distribution:`npm`,apiKey:n.apiKey,apiHost:n.apiHost||`https://t.cozyclay.org`,appVersion:n.appVersion||null,installationId:n.installationId,firstLaunch:n.firstLaunch===!0,firstLaunchHeardFrom:Lr.has(n.firstLaunchHeardFrom)?n.firstLaunchHeardFrom:null,installKind:[`npx`,`global`,`clone`].includes(n.installKind)?n.installKind:`npx`,originKind:`local`,internalQa:n.internalQa===!0,updateStatus:Mr.includes(n.updateStatus)?n.updateStatus:`unknown`}:{kind:`disabled`,reason:`unapproved origin`}:{kind:`disabled`,reason:`opted out`}:e.VITE_POSTHOG_KEY?Si(t,xi(e.VITE_POSTHOG_ALLOWED_ORIGINS))?{kind:`enabled`,distribution:`hosted`,apiKey:e.VITE_POSTHOG_KEY,apiHost:e.VITE_POSTHOG_HOST||`https://us.i.posthog.com`,appVersion:e.VITE_APP_VERSION||null,installationId:null,firstLaunch:!1,firstLaunchHeardFrom:null,installKind:null,originKind:`hosted`,internalQa:vi(wr)===`1`,updateStatus:null}:{kind:`disabled`,reason:`unapproved origin`}:{kind:`disabled`,reason:`no key`}:{kind:`disabled`,reason:`not production`}}function na(e){return{distribution:e.distribution,...e.appVersion?{app_version:e.appVersion}:{},origin_kind:e.originKind,os:Oi(),...e.installKind?{install_kind:e.installKind}:{},...e.updateStatus?{update_status:e.updateStatus}:{},internal_qa:e.internalQa}}function ra(e){let t=ta({env:e});return t.kind===`disabled`?t.reason:Ji()?`opted out`:null}async function ia(){if(Xr||Qr)return Qr;if($i()?.distribution!==`npm`){let e=new URLSearchParams(globalThis.location?.search??``).getAll(`internal_qa`);e.length===1&&(e[0]===`1`||e[0]===`0`)&&yi(wr,e[0])}let e=Qi(),t=ra(e);if(t){ei||=(console.info(`[analytics] disabled: `+t),!0);return}Qr=(async()=>{try{let t=await gr(()=>import(`./module-MzlRiBjI.js`),[]);if(Ji())return;let n=ta({env:e});if(n.kind===`disabled`)return;Z=t.default??t,Z.init(n.apiKey,{api_host:n.apiHost,defaults:`2025-05-24`,autocapture:!1,capture_pageview:!1,capture_pageleave:!1,person_profiles:`never`,persistence:n.distribution===`npm`?`memory`:`localStorage`,respect_dnt:!0,disable_session_recording:!0,capture_dead_clicks:!1,capture_performance:!1,disable_capture_url_hashes:!0,save_campaign_params:!1,save_referrer:!1,mask_personal_data_properties:!0,request_batching:!1,advanced_disable_feature_flags:!0,disable_external_dependency_loading:!0,disable_surveys:!0,ui_host:`https://us.posthog.com`,bootstrap:n.installationId?{distinctID:n.installationId,isIdentifiedID:!1}:void 0,before_send:Ki}),Xr=!0,Q=!0;let r=na(n);if(Z.register(r),globalThis.__cozyclayAnalytics={instance:Z},Z.capture(`$pageview`),ti=Date.now(),_a(n,r),ua(),ga(),n.distribution===`npm`&&($(`app:session_started`),n.firstLaunch)){let e=n.firstLaunchHeardFrom;$(`install:first_launch`,e?{heard_from:e}:{})}}catch{console.info(`[analytics] initialization failed`)}})(),await Qr}function $(e,t={}){if(!(!Xr||!Q||!Z))try{if(Ji())return;let n=wi(e,t);gi.has(e)||(ni+=1,(e===`scene:created`||e===`scene:loaded`)&&(ri+=1)),Z.capture(e,n)}catch{}}function aa(e,{hadTarget:t=!1}={}){return Ur.includes(e?.stage)?{outcome:e.stage,rounds:e.round,...Number.isFinite(e.iou)?{final_iou:Math.round(e.iou*100)/100}:{},duration_ms:Math.round(e.elapsedMs),had_target:!!t}:null}function oa(e){return!Xr||!Q||!Z||!Fr.has(e)||oi.has(e)?!1:(oi.add(e),$(`feature:used`,{name:e}),!0)}function sa(){try{return Xr&&Q&&!!Z&&!Ji()}catch{return!1}}function ca(){return sa()&&vi(Er)!==`1`}function la(e,t){yi(Er,`1`),$(`survey:use_case`,{use_case:kr.includes(e)?e:`skip`,team:Ar.includes(t)?t:`skip`})}function ua(){if(mi||typeof window>`u`||typeof window.addEventListener!=`function`)return;mi=!0;let e=e=>{try{let t=Ri(e),n=[t.error_kind,t.error_type,t.error_source,t.error_file,t.error_line,t.error_col].join(`|`);if(pi.has(n)||pi.size>=fi)return;pi.add(n),$(`app:error`,t)}catch{}};window.addEventListener(`error`,t=>{try{if(typeof t?.message==`string`&&t.message.startsWith(`ResizeObserver loop`)||!t?.error&&!t?.filename)return;e({error:t?.error,filename:t?.filename,lineno:t?.lineno,colno:t?.colno,kind:`error`})}catch{}}),window.addEventListener(`unhandledrejection`,t=>{e({error:t?.reason,kind:`unhandled_rejection`})})}function da(){try{let e=globalThis.document?.createElement?.(`canvas`);if(!e?.getContext)return{webgl:`none`,renderer:``};let t=e.getContext(`webgl2`),n=t?`webgl2`:`none`;if(t||(t=e.getContext(`webgl`),t&&(n=`webgl1`)),!t)return{webgl:n,renderer:``};let r=``;try{let e=t.getExtension(`WEBGL_debug_renderer_info`);r=String(t.getParameter(e?e.UNMASKED_RENDERER_WEBGL:t.RENDERER)??``)}catch{r=``}try{t.getExtension(`WEBGL_lose_context`)?.loseContext()}catch{}return{webgl:n,renderer:r}}catch{return{webgl:`none`,renderer:``}}}var fa=8e3,pa=3e3,ma=6e4;function ha(){return new Promise(e=>{let t=globalThis.requestAnimationFrame;if(typeof t!=`function`){e(null);return}let n=()=>globalThis.document?.visibilityState===`hidden`,r=Date.now(),i=()=>{if(Date.now()-r>ma){e(null);return}if(n()){setTimeout(i,2e3);return}let a=0,o=0,s=r=>{if(n()){setTimeout(i,2e3);return}if(o||=r,a+=1,r-o>=pa){e((a-1)*1e3/(r-o));return}t(s)};t(s)};setTimeout(i,fa)})}async function ga(){if(!(hi||globalThis.document===void 0||typeof globalThis.requestAnimationFrame!=`function`)){hi=!0;try{let{webgl:e,renderer:t}=da(),n=Ni(t),r=await ha();$(`device:profile`,{...n,webgl:e,cpu_bucket:Ai(globalThis.navigator?.hardwareConcurrency),memory_bucket:ji(globalThis.navigator?.deviceMemory),frame_rate_bucket:Mi(r)})}catch{}}}function _a(e,t){if(ai||typeof window>`u`)return;ai=!0;let n=()=>{if(!(ii||!ti)){ii=!0;try{if(!Q||!Z||Ji()||Z.has_opted_out_capturing())return;let n={api_key:e.apiKey,event:`app:session_ended`,properties:{...t,distinct_id:Z.get_distinct_id(),duration_bucket:Ei(Date.now()-ti),action_count_bucket:Ti(ni),scenes_touched:Math.min(20,ri),...Bi()}},r=JSON.stringify(n),i=`${e.apiHost.replace(/\/$/,``)}/e/`;typeof globalThis.navigator?.sendBeacon==`function`?globalThis.navigator.sendBeacon(i,new Blob([r],{type:`application/json`})):fetch(i,{method:`POST`,body:r,keepalive:!0,headers:{"content-type":`application/json`}})}catch{}}};window.addEventListener(`pagehide`,n,{once:!0}),window.addEventListener(`beforeunload`,n,{once:!0})}function va(e){if(!(!Xr||!Q||$r)){if(!qi({activationTracked:vi(Tr)===`1`})){$r=!0;return}$r=!0,yi(Tr,`1`),$(`activation:completed`,{activation_path:e})}}export{ke as $,wt as A,q as B,fr as C,l as Ct,St as D,Ct as E,Gn as F,Ke as G,Jn as H,O as I,Qe as J,Pe as K,qn as L,ln as M,E as N,nn as O,D as P,ye as Q,en as R,gr as S,g as St,or as T,Kn as U,Xn as V,K as W,tt as X,$e as Y,be as Z,ca as _,e as _t,sa as a,_e as at,va as b,c as bt,Di as c,ue as ct,ia as d,ce as dt,Ae as et,zi as f,ie as ft,Zi as g,x as gt,aa as h,ae as ht,xr as i,w as it,Tt as j,Dt as k,Vi as l,S as lt,wi as m,y as mt,yr as n,de as nt,Ti as o,ge as ot,la as p,b as pt,et as q,br as r,C as rt,ki as s,ve as st,vr as t,Oe as tt,Ji as u,se as ut,Hi as v,u as vt,dr as w,p as wt,oa as x,h as xt,$ as y,d as yt,Ot as z};
|