@doodle-engine/react 0.0.6 → 0.0.8

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @doodle-engine/react
2
2
 
3
+ ## 0.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 599ce7c: Dev tooling and DSL validation
8
+ - Updated dependencies [599ce7c]
9
+ - @doodle-engine/core@0.0.8
10
+
11
+ ## 0.0.7
12
+
13
+ ### Patch Changes
14
+
15
+ - b7ac02f: Fix Github release tagging
16
+ - Updated dependencies [b7ac02f]
17
+ - @doodle-engine/core@0.0.7
18
+
3
19
  ## 0.0.6
4
20
 
5
21
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"GameProvider.d.ts","sourceRoot":"","sources":["../src/GameProvider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;QACxC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;QACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QAClC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;QACtC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;QAChD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACpC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACnC,QAAQ,EAAE,MAAM,QAAQ,CAAA;QACxB,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;KACvC,CAAA;CACF;AAED,eAAO,MAAM,WAAW,wCAA+C,CAAA;AAEvE,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,eAAe,EAAE,QAAQ,CAAA;IACzB,0BAA0B;IAC1B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAgGpF"}
1
+ {"version":3,"file":"GameProvider.d.ts","sourceRoot":"","sources":["../src/GameProvider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAmD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,MAAM,EAAkB,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;QACxC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;QACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QAClC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;QACtC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;QAChD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACpC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACnC,QAAQ,EAAE,MAAM,QAAQ,CAAA;QACxB,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;KACvC,CAAA;CACF;AAED,eAAO,MAAM,WAAW,wCAA+C,CAAA;AAEvE,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,eAAe,EAAE,QAAQ,CAAA;IACzB,0BAA0B;IAC1B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CA4GpF"}
package/dist/react.cjs CHANGED
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ne;function ye(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&(function(){function t(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===y?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case d:return"Fragment";case L:return"Profiler";case w:return"StrictMode";case _:return"Suspense";case D:return"SuspenseList";case v:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case u:return"Portal";case J:return s.displayName||"Context";case I:return(s._context.displayName||"Context")+".Consumer";case F:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case p:return i=s.displayName||null,i!==null?i:t(s.type)||"Memo";case m:i=s._payload,s=s._init;try{return t(s(i))}catch{}}return null}function n(s){return""+s}function r(s){try{n(s);var i=!1}catch{i=!0}if(i){i=console;var b=i.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return b.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),n(s)}}function a(s){if(s===d)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===m)return"<...>";try{var i=t(s);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function l(){var s=P.A;return s===null?null:s.getOwner()}function c(){return Error("react-stack-top-frame")}function f(s){if($.call(s,"key")){var i=Object.getOwnPropertyDescriptor(s,"key").get;if(i&&i.isReactWarning)return!1}return s.key!==void 0}function h(s,i){function b(){A||(A=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}b.isReactWarning=!0,Object.defineProperty(s,"key",{get:b,configurable:!0})}function x(){var s=t(this.type);return M[s]||(M[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function g(s,i,b,S,z,X){var k=b.ref;return s={$$typeof:T,type:s,key:i,props:b,_owner:S},(k!==void 0?k:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:x}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function j(s,i,b,S,z,X){var k=i.children;if(k!==void 0)if(S)if(G(k)){for(S=0;S<k.length;S++)R(k[S]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else R(k);if($.call(i,"key")){k=t(s);var Y=Object.keys(i).filter(function(Se){return Se!=="key"});S=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",V[k+S]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ne;function Ee(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&(function(){function t(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===E?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case d:return"Fragment";case L:return"Profiler";case w:return"StrictMode";case _:return"Suspense";case D:return"SuspenseList";case v:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case u:return"Portal";case J:return s.displayName||"Context";case I:return(s._context.displayName||"Context")+".Consumer";case F:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case p:return i=s.displayName||null,i!==null?i:t(s.type)||"Memo";case m:i=s._payload,s=s._init;try{return t(s(i))}catch{}}return null}function n(s){return""+s}function r(s){try{n(s);var i=!1}catch{i=!0}if(i){i=console;var b=i.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return b.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),n(s)}}function a(s){if(s===d)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===m)return"<...>";try{var i=t(s);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function l(){var s=P.A;return s===null?null:s.getOwner()}function c(){return Error("react-stack-top-frame")}function f(s){if($.call(s,"key")){var i=Object.getOwnPropertyDescriptor(s,"key").get;if(i&&i.isReactWarning)return!1}return s.key!==void 0}function h(s,i){function b(){A||(A=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}b.isReactWarning=!0,Object.defineProperty(s,"key",{get:b,configurable:!0})}function x(){var s=t(this.type);return M[s]||(M[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function g(s,i,b,S,z,X){var k=b.ref;return s={$$typeof:T,type:s,key:i,props:b,_owner:S},(k!==void 0?k:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:x}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function j(s,i,b,S,z,X){var k=i.children;if(k!==void 0)if(S)if(G(k)){for(S=0;S<k.length;S++)R(k[S]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else R(k);if($.call(i,"key")){k=t(s);var Y=Object.keys(i).filter(function(Se){return Se!=="key"});S=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",V[k+S]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,S,k,Y,k),V[k+S]=!0)}if(k=null,b!==void 0&&(r(b),k=""+b),f(i)&&(r(i.key),k=""+i.key),"key"in i){b={};for(var H in i)H!=="key"&&(b[H]=i[H])}else b=i;return k&&h(b,typeof s=="function"?s.displayName||s.name||"Unknown":s),g(s,k,b,l(),z,X)}function R(s){C(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===m&&(s._payload.status==="fulfilled"?C(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function C(s){return typeof s=="object"&&s!==null&&s.$$typeof===T}var E=o,T=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),J=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.for("react.client.reference"),P=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,G=Array.isArray,O=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(s){return s()}};var A,M={},B=E.react_stack_bottom_frame.bind(E,c)(),N=O(a(c)),V={};q.Fragment=d,q.jsx=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!1,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)},q.jsxs=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!0,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)}})()),q}var ae;function Ee(){return ae||(ae=1,process.env.NODE_ENV==="production"?Q.exports=ke():Q.exports=ye()),Q.exports}var e=Ee();const Z=o.createContext(null);function le({engine:t,initialSnapshot:n,children:r}){const[a,l]=o.useState(n),c=o.useCallback(u=>{const d=t.selectChoice(u);l(d)},[t]),f=o.useCallback(u=>{const d=t.talkTo(u);l(d)},[t]),h=o.useCallback(u=>{const d=t.takeItem(u);l(d)},[t]),x=o.useCallback(u=>{const d=t.travelTo(u);l(d)},[t]),g=o.useCallback((u,d)=>{const w=t.writeNote(u,d);l(w)},[t]),j=o.useCallback(u=>{const d=t.deleteNote(u);l(d)},[t]),R=o.useCallback(u=>{const d=t.setLocale(u);l(d)},[t]),C=o.useCallback(()=>t.saveGame(),[t]),E=o.useCallback(u=>{const d=t.loadGame(u);l(d)},[t]),T={snapshot:a,actions:{selectChoice:c,talkTo:f,takeItem:h,travelTo:x,writeNote:g,deleteNote:j,setLocale:R,saveGame:C,loadGame:E}};return e.jsx(Z.Provider,{value:T,children:r})}function K(){const t=o.useContext(Z);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function ee(t,n={}){var p;const{audioBasePath:r="/audio",masterVolume:a=1,musicVolume:l=.7,soundVolume:c=.8,voiceVolume:f=1,crossfadeDuration:h=1e3}=n,[x,g]=o.useState(a),[j,R]=o.useState(l),[C,E]=o.useState(c),[T,u]=o.useState(f),d=o.useRef(null),w=o.useRef(null),L=o.useRef(null),I=o.useRef(null);o.useEffect(()=>{const m=new Audio;m.loop=!0,d.current=m;const v=new Audio;return w.current=v,()=>{I.current&&clearInterval(I.current),m.pause(),v.pause(),m.src="",v.src=""}},[]),o.useEffect(()=>{const m=d.current;if(!m)return;const v=t.music;if(v!==L.current)if(L.current=v,!v)F(m,h);else{const y=`${r}/music/${v}`;J(m,y,h)}m.volume=x*j},[t.music,x,j,r,h]),o.useEffect(()=>{var y;const m=w.current;if(!m)return;const v=(y=t.dialogue)==null?void 0:y.voice;v&&(m.pause(),m.currentTime=0,m.src=`${r}/voice/${v}`,m.volume=x*T,m.play().catch(P=>{console.warn("Voice playback failed:",P)}))},[(p=t.dialogue)==null?void 0:p.voice,x,T,r]),o.useEffect(()=>{t.pendingSounds.length!==0&&t.pendingSounds.forEach(m=>{const v=new Audio(`${r}/sfx/${m}`);v.volume=x*C,v.play().catch(y=>{console.warn("Sound playback failed:",y)})})},[t.pendingSounds,x,C,r]);const J=(m,v,y)=>{F(m,y/2).then(()=>{m.src=v,m.load(),m.volume=0,m.play().then(()=>{_(m,y/2,x*j)}).catch(P=>{console.warn("Music playback failed:",P)})})},F=(m,v)=>new Promise(y=>{const P=m.volume,$=20,G=v/$,O=P/$;let A=0;const M=setInterval(()=>{A++,m.volume=Math.max(0,P-O*A),A>=$&&(clearInterval(M),m.pause(),m.currentTime=0,y())},G);I.current=M}),_=(m,v,y)=>{const $=v/20,G=y/20;let O=0;const A=setInterval(()=>{O++,m.volume=Math.min(y,G*O),O>=20&&clearInterval(A)},$);I.current=A};return{setMasterVolume:g,setMusicVolume:R,setSoundVolume:E,setVoiceVolume:u,stopAll:()=>{d.current&&(d.current.pause(),d.current.currentTime=0),w.current&&(w.current.pause(),w.current.currentTime=0)}}}const Ce={click:"click.ogg",menuOpen:"menu_open.ogg",menuClose:"menu_close.ogg"};function oe(t={}){const{enabled:n=!0,basePath:r="/audio/ui",volume:a=.5,sounds:l={}}=t,[c,f]=o.useState(n),[h,x]=o.useState(a),g=o.useRef({...Ce,...l}),j=o.useCallback(u=>{if(!c||!u)return;const d=new Audio(`${r}/${u}`);d.volume=h,d.play().catch(()=>{})},[c,h,r]),R=o.useCallback(u=>{const d=g.current[u];d&&j(d)},[j]),C=o.useCallback(()=>j(g.current.click),[j]),E=o.useCallback(()=>j(g.current.menuOpen),[j]),T=o.useCallback(()=>j(g.current.menuClose),[j]);return{playClick:C,playMenuOpen:E,playMenuClose:T,playSound:R,setEnabled:f,setVolume:x,enabled:c,volume:h}}function ce({dialogue:t,className:n=""}){return e.jsxs("div",{className:`dialogue-box ${n}`,children:[t.portrait&&e.jsx("div",{className:"dialogue-portrait",children:e.jsx("img",{src:t.portrait,alt:t.speakerName})}),e.jsxs("div",{className:"dialogue-content",children:[e.jsx("div",{className:"dialogue-speaker",children:t.speakerName}),e.jsx("div",{className:"dialogue-text",children:t.text})]})]})}function ie({choices:t,onSelectChoice:n,className:r=""}){return t.length===0?null:e.jsx("div",{className:`choice-list ${r}`,children:t.map(a=>e.jsx("button",{className:"choice-button",onClick:()=>n(a.id),children:a.text},a.id))})}function ue({location:t,className:n=""}){return e.jsxs("div",{className:`location-view ${n}`,children:[t.banner&&e.jsx("div",{className:"location-banner",children:e.jsx("img",{src:t.banner,alt:t.name})}),e.jsxs("div",{className:"location-content",children:[e.jsx("h1",{className:"location-name",children:t.name}),e.jsx("p",{className:"location-description",children:t.description})]})]})}function de({characters:t,onTalkTo:n,className:r=""}){return t.length===0?null:e.jsxs("div",{className:`character-list ${r}`,children:[e.jsx("h2",{children:"Characters"}),e.jsx("div",{className:"character-grid",children:t.map(a=>e.jsxs("button",{className:"character-card",onClick:()=>n(a.id),children:[a.portrait&&e.jsx("img",{src:a.portrait,alt:a.name,className:"character-portrait"}),e.jsx("div",{className:"character-name",children:a.name})]},a.id))})]})}function me({items:t,className:n=""}){const[r,a]=o.useState(null);return e.jsxs("div",{className:`inventory ${n}`,children:[e.jsx("h2",{children:"Inventory"}),t.length===0?e.jsx("p",{className:"inventory-empty",children:"No items"}):e.jsx("div",{className:"inventory-grid",children:t.map(l=>e.jsxs("div",{className:"inventory-item",onClick:()=>a(l),children:[l.icon&&e.jsx("img",{src:l.icon,alt:l.name,className:"item-icon"}),e.jsx("div",{className:"item-name",children:l.name})]},l.id))}),r&&e.jsx("div",{className:"item-modal-overlay",onClick:()=>a(null),children:e.jsxs("div",{className:"item-modal",onClick:l=>l.stopPropagation(),children:[r.image&&e.jsx("img",{src:r.image,alt:r.name,className:"item-modal-image"}),e.jsx("h3",{className:"item-modal-name",children:r.name}),e.jsx("p",{className:"item-modal-description",children:r.description}),e.jsx("button",{className:"item-modal-close",onClick:()=>a(null),children:"Close"})]})})]})}function fe({quests:t,entries:n,className:r=""}){return e.jsxs("div",{className:`journal ${r}`,children:[e.jsx("h2",{children:"Journal"}),t.length>0&&e.jsxs("div",{className:"journal-quests",children:[e.jsx("h3",{children:"Active Quests"}),t.map(a=>e.jsxs("div",{className:"quest-entry",children:[e.jsx("div",{className:"quest-name",children:a.name}),e.jsx("div",{className:"quest-description",children:a.description}),e.jsx("div",{className:"quest-stage",children:a.currentStageDescription})]},a.id))]}),n.length>0&&e.jsxs("div",{className:"journal-entries",children:[e.jsx("h3",{children:"Entries"}),n.map(a=>e.jsxs("div",{className:`journal-entry journal-category-${a.category}`,children:[e.jsx("div",{className:"entry-title",children:a.title}),e.jsx("div",{className:"entry-text",children:a.text})]},a.id))]}),t.length===0&&n.length===0&&e.jsx("p",{className:"journal-empty",children:"No entries yet"})]})}function he({map:t,onTravelTo:n,className:r=""}){return t?e.jsxs("div",{className:`map-view ${r}`,children:[e.jsx("h2",{children:t.name}),e.jsxs("div",{className:"map-container",style:{position:"relative"},children:[t.image&&e.jsx("img",{src:t.image,alt:t.name,className:"map-image"}),t.locations.map(a=>e.jsx("button",{className:`map-marker ${a.isCurrent?"current":""}`,style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`},onClick:()=>!a.isCurrent&&n(a.id),disabled:a.isCurrent,title:a.name,children:a.name},a.id))]})]}):null}function ve({notifications:t,className:n=""}){return t.length===0?null:e.jsx("div",{className:`notification-area ${n}`,children:t.map((r,a)=>e.jsx("div",{className:"notification",children:r},a))})}function pe({onSave:t,onLoad:n,storageKey:r="doodle-engine-save",className:a=""}){const[l,c]=o.useState(""),f=()=>{const g=t();localStorage.setItem(r,JSON.stringify(g)),c("Saved!"),setTimeout(()=>c(""),2e3)},h=()=>{const g=localStorage.getItem(r);if(!g){c("No save found"),setTimeout(()=>c(""),2e3);return}const j=JSON.parse(g);n(j),c("Loaded!"),setTimeout(()=>c(""),2e3)},x=localStorage.getItem(r)!==null;return e.jsxs("div",{className:`save-load-panel ${a}`,children:[e.jsx("button",{className:"save-button",onClick:f,children:"Save"}),e.jsx("button",{className:"load-button",onClick:h,disabled:!x,children:"Load"}),l&&e.jsx("span",{className:"save-load-message",children:l})]})}function xe({className:t=""}){const{snapshot:n,actions:r}=K();ee(n);const a=Object.entries(n.variables).filter(([l])=>!l.startsWith("_"));return e.jsxs("div",{className:`game-renderer ${t}`,children:[e.jsx(ve,{notifications:n.notifications}),e.jsxs("div",{className:"game-main",children:[e.jsx(ue,{location:n.location}),n.dialogue&&e.jsxs("div",{className:"dialogue-container",children:[e.jsx(ce,{dialogue:n.dialogue}),e.jsx(ie,{choices:n.choices,onSelectChoice:r.selectChoice})]}),!n.dialogue&&e.jsx(de,{characters:n.charactersHere,onTalkTo:r.talkTo})]}),e.jsxs("div",{className:"game-sidebar",children:[e.jsx(pe,{onSave:r.saveGame,onLoad:r.loadGame}),a.length>0&&e.jsxs("div",{className:"resources",children:[e.jsx("h2",{children:"Resources"}),e.jsx("ul",{className:"resources-list",children:a.map(([l,c])=>e.jsxs("li",{className:"resource-entry",children:[e.jsx("span",{className:"resource-name",children:l}),e.jsx("span",{className:"resource-value",children:c})]},l))})]}),n.party.length>0&&e.jsxs("div",{className:"party",children:[e.jsx("h2",{children:"Party"}),e.jsx("ul",{className:"party-list",children:n.party.map(l=>e.jsx("li",{className:"party-member",children:e.jsx("span",{className:"party-member-name",children:l.name})},l.id))})]}),e.jsx(me,{items:n.inventory}),e.jsx(fe,{quests:n.quests,entries:n.journal}),n.map&&e.jsx(he,{map:n.map,onTravelTo:r.travelTo})]})]})}function je({logoSrc:t,title:n,onComplete:r,duration:a=2e3,className:l=""}){return o.useEffect(()=>{const c=setTimeout(r,a);return()=>clearTimeout(c)},[r,a]),e.jsxs("div",{className:`splash-screen ${l}`,onClick:r,children:[t&&e.jsx("img",{src:t,alt:n||"",className:"splash-logo"}),n&&e.jsx("h1",{className:"splash-title",children:n}),e.jsx("div",{className:"splash-loading",children:"Loading..."})]})}function be({title:t="Doodle Engine",subtitle:n,logoSrc:r,hasSaveData:a,onNewGame:l,onContinue:c,onSettings:f,className:h=""}){return e.jsxs("div",{className:`title-screen ${h}`,children:[r&&e.jsx("img",{src:r,alt:t,className:"title-logo"}),e.jsx("h1",{className:"title-heading",children:t}),n&&e.jsx("p",{className:"title-subtitle",children:n}),e.jsxs("div",{className:"title-menu",children:[e.jsx("button",{className:"title-button",onClick:l,children:"New Game"}),a&&e.jsx("button",{className:"title-button",onClick:c,children:"Continue"}),e.jsx("button",{className:"title-button",onClick:f,children:"Settings"})]})]})}function Ne({onResume:t,onSave:n,onLoad:r,onSettings:a,onQuitToTitle:l,className:c=""}){return e.jsx("div",{className:`pause-menu-overlay ${c}`,children:e.jsxs("div",{className:"pause-menu",children:[e.jsx("h2",{className:"pause-title",children:"Paused"}),e.jsxs("div",{className:"pause-buttons",children:[e.jsx("button",{className:"pause-button",onClick:t,children:"Resume"}),e.jsx("button",{className:"pause-button",onClick:n,children:"Save"}),e.jsx("button",{className:"pause-button",onClick:r,children:"Load"}),e.jsx("button",{className:"pause-button",onClick:a,children:"Settings"}),e.jsx("button",{className:"pause-button pause-button-quit",onClick:l,children:"Quit to Title"})]})]})})}function se({audioControls:t,uiSoundControls:n,availableLocales:r,currentLocale:a,onLocaleChange:l,onBack:c,className:f=""}){return e.jsxs("div",{className:`settings-panel ${f}`,children:[e.jsx("h2",{className:"settings-title",children:"Settings"}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Audio"}),e.jsx(W,{label:"Master",value:1,onChange:t.setMasterVolume}),e.jsx(W,{label:"Music",value:.7,onChange:t.setMusicVolume}),e.jsx(W,{label:"Sound Effects",value:.8,onChange:t.setSoundVolume}),e.jsx(W,{label:"Voice",value:1,onChange:t.setVoiceVolume}),n&&e.jsx(W,{label:"UI Sounds",value:n.volume,onChange:n.setVolume})]}),r&&r.length>1&&l&&e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Language"}),e.jsx("select",{className:"settings-locale-select",value:a,onChange:h=>l(h.target.value),children:r.map(h=>e.jsx("option",{value:h.code,children:h.label},h.code))})]}),e.jsx("button",{className:"settings-back-button",onClick:c,children:"Back"})]})}function W({label:t,value:n,onChange:r}){return e.jsxs("div",{className:"volume-slider",children:[e.jsx("label",{className:"volume-label",children:t}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:n,onChange:a=>r(parseFloat(a.target.value)),className:"volume-input"})]})}function ge({src:t,basePath:n="/video",onComplete:r,className:a=""}){const l=o.useRef(null);return o.useEffect(()=>{const c=f=>{(f.key==="Escape"||f.key===" "||f.key==="Enter")&&(f.preventDefault(),r())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),e.jsxs("div",{className:`video-player-overlay ${a}`,children:[e.jsx("video",{ref:l,src:`${n}/${t}`,autoPlay:!0,onEnded:r,className:"video-player-video"}),e.jsx("button",{className:"video-player-skip-button",onClick:r,children:"Skip"})]})}function Te({registry:t,config:n,title:r="Doodle Engine",subtitle:a,logoSrc:l,splashDuration:c=2e3,uiSounds:f,audioOptions:h,storageKey:x="doodle-engine-save",availableLocales:g,videoBasePath:j="/video",className:R=""}){const[C,E]=o.useState(c>0?"splash":"title"),[T,u]=o.useState(!1),[d,w]=o.useState(!1),[L,I]=o.useState("title"),[J,F]=o.useState(null),[_,D]=o.useState(null),p=oe(f===!1?{enabled:!1}:f),m=localStorage.getItem(x)!==null,v=o.useCallback(()=>{const N={currentLocation:n.startLocation,currentTime:{...n.startTime},flags:{...n.startFlags},variables:{...n.startVariables},inventory:[...n.startInventory],questProgress:{},unlockedJournalEntries:[],playerNotes:[],dialogueState:null,characterState:{},itemLocations:{},mapEnabled:!0,notifications:[],pendingSounds:[],pendingVideo:null,currentLocale:"en"};return new re.Engine(t,N)},[t,n]),y=o.useCallback(()=>{p.playClick();const N=v(),V=N.newGame(n);D({engine:N,snapshot:V}),E("playing")},[v,n,p]),P=o.useCallback(()=>{p.playClick();const N=localStorage.getItem(x);if(!N)return;const V=JSON.parse(N),s=v(),i=s.loadGame(V);D({engine:s,snapshot:i}),E("playing")},[v,x,p]),$=o.useCallback(()=>{if(!_)return;p.playClick();const N=_.engine.saveGame();localStorage.setItem(x,JSON.stringify(N)),u(!1)},[_,x,p]),G=o.useCallback(()=>{const N=localStorage.getItem(x);if(!N||!_)return;p.playClick();const V=JSON.parse(N),s=_.engine.loadGame(V);D({engine:_.engine,snapshot:s}),u(!1)},[_,x,p]),O=o.useCallback(()=>{p.playClick(),u(!1),w(!1),D(null),E("title")},[p]),A=o.useCallback(N=>{p.playMenuOpen(),I(N),w(!0),N==="pause"&&u(!1)},[p]),M=o.useCallback(()=>{p.playMenuClose(),w(!1),L==="pause"&&u(!0)},[L,p]);o.useEffect(()=>{if(C!=="playing")return;const N=V=>{V.key==="Escape"&&(V.preventDefault(),d?M():(T?p.playMenuClose():p.playMenuOpen(),u(s=>!s)))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[C,T,d,M,p]);const B={setMasterVolume:()=>{},setMusicVolume:()=>{},setSoundVolume:()=>{},setVoiceVolume:()=>{},stopAll:()=>{}};return C==="splash"?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(je,{logoSrc:l,title:r,onComplete:()=>E("title"),duration:c})}):C==="title"?e.jsx("div",{className:`game-shell ${R}`,children:d?e.jsx(se,{audioControls:B,uiSoundControls:f!==!1?p:void 0,availableLocales:g,onBack:M}):e.jsx(be,{title:r,subtitle:a,logoSrc:l,hasSaveData:m,onNewGame:y,onContinue:P,onSettings:()=>A("title")})}):_?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(le,{engine:_.engine,initialSnapshot:_.snapshot,children:e.jsx(we,{audioOptions:h,uiSoundControls:f!==!1?p:void 0,showPauseMenu:T,showSettings:d,availableLocales:g,videoBasePath:j,pendingVideo:J,setPendingVideo:F,onPause:()=>{p.playMenuOpen(),u(!0)},onResume:()=>{p.playMenuClose(),u(!1)},onSave:$,onLoad:G,onSettings:()=>A("pause"),onQuitToTitle:O,onCloseSettings:M})})}):null}function we({audioOptions:t,uiSoundControls:n,showPauseMenu:r,showSettings:a,availableLocales:l,videoBasePath:c,pendingVideo:f,setPendingVideo:h,onPause:x,onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:E,onCloseSettings:T}){const{snapshot:u,actions:d}=K(),w=ee(u,t);return o.useEffect(()=>{u.pendingVideo&&h(u.pendingVideo)},[u.pendingVideo,h]),e.jsxs(e.Fragment,{children:[f&&e.jsx(ge,{src:f,basePath:c,onComplete:()=>h(null)}),e.jsx(xe,{}),!r&&!a&&!f&&e.jsx("button",{className:"game-shell-menu-button",onClick:x,"aria-label":"Menu",children:"Menu"}),r&&e.jsx(Ne,{onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:E}),a&&e.jsx(se,{audioControls:w,uiSoundControls:n,availableLocales:l,currentLocale:(u.time,void 0),onLocaleChange:d.setLocale,onBack:T})]})}Object.defineProperty(exports,"VERSION",{enumerable:!0,get:()=>re.VERSION});exports.CharacterList=de;exports.ChoiceList=ie;exports.DialogueBox=ce;exports.GameContext=Z;exports.GameProvider=le;exports.GameRenderer=xe;exports.GameShell=Te;exports.Inventory=me;exports.Journal=fe;exports.LocationView=ue;exports.MapView=he;exports.NotificationArea=ve;exports.PauseMenu=Ne;exports.SaveLoadPanel=pe;exports.SettingsPanel=se;exports.SplashScreen=je;exports.TitleScreen=be;exports.VideoPlayer=ge;exports.useAudioManager=ee;exports.useGame=K;exports.useUISounds=oe;
22
+ <%s key={someKey} {...props} />`,S,k,Y,k),V[k+S]=!0)}if(k=null,b!==void 0&&(r(b),k=""+b),f(i)&&(r(i.key),k=""+i.key),"key"in i){b={};for(var H in i)H!=="key"&&(b[H]=i[H])}else b=i;return k&&h(b,typeof s=="function"?s.displayName||s.name||"Unknown":s),g(s,k,b,l(),z,X)}function R(s){C(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===m&&(s._payload.status==="fulfilled"?C(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function C(s){return typeof s=="object"&&s!==null&&s.$$typeof===T}var y=o,T=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),J=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),P=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,G=Array.isArray,O=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(s){return s()}};var A,M={},B=y.react_stack_bottom_frame.bind(y,c)(),N=O(a(c)),V={};q.Fragment=d,q.jsx=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!1,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)},q.jsxs=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!0,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)}})()),q}var ae;function ye(){return ae||(ae=1,process.env.NODE_ENV==="production"?Q.exports=ke():Q.exports=Ee()),Q.exports}var e=ye();const Z=o.createContext(null);function le({engine:t,initialSnapshot:n,children:r}){const[a,l]=o.useState(n);o.useEffect(()=>{},[t]);const c=o.useCallback(u=>{const d=t.selectChoice(u);l(d)},[t]),f=o.useCallback(u=>{const d=t.talkTo(u);l(d)},[t]),h=o.useCallback(u=>{const d=t.takeItem(u);l(d)},[t]),x=o.useCallback(u=>{const d=t.travelTo(u);l(d)},[t]),g=o.useCallback((u,d)=>{const w=t.writeNote(u,d);l(w)},[t]),j=o.useCallback(u=>{const d=t.deleteNote(u);l(d)},[t]),R=o.useCallback(u=>{const d=t.setLocale(u);l(d)},[t]),C=o.useCallback(()=>t.saveGame(),[t]),y=o.useCallback(u=>{const d=t.loadGame(u);l(d)},[t]),T={snapshot:a,actions:{selectChoice:c,talkTo:f,takeItem:h,travelTo:x,writeNote:g,deleteNote:j,setLocale:R,saveGame:C,loadGame:y}};return e.jsx(Z.Provider,{value:T,children:r})}function K(){const t=o.useContext(Z);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function ee(t,n={}){var p;const{audioBasePath:r="/audio",masterVolume:a=1,musicVolume:l=.7,soundVolume:c=.8,voiceVolume:f=1,crossfadeDuration:h=1e3}=n,[x,g]=o.useState(a),[j,R]=o.useState(l),[C,y]=o.useState(c),[T,u]=o.useState(f),d=o.useRef(null),w=o.useRef(null),L=o.useRef(null),I=o.useRef(null);o.useEffect(()=>{const m=new Audio;m.loop=!0,d.current=m;const v=new Audio;return w.current=v,()=>{I.current&&clearInterval(I.current),m.pause(),v.pause(),m.src="",v.src=""}},[]),o.useEffect(()=>{const m=d.current;if(!m)return;const v=t.music;if(v!==L.current)if(L.current=v,!v)F(m,h);else{const E=`${r}/music/${v}`;J(m,E,h)}m.volume=x*j},[t.music,x,j,r,h]),o.useEffect(()=>{var E;const m=w.current;if(!m)return;const v=(E=t.dialogue)==null?void 0:E.voice;v&&(m.pause(),m.currentTime=0,m.src=`${r}/voice/${v}`,m.volume=x*T,m.play().catch(P=>{console.warn("Voice playback failed:",P)}))},[(p=t.dialogue)==null?void 0:p.voice,x,T,r]),o.useEffect(()=>{t.pendingSounds.length!==0&&t.pendingSounds.forEach(m=>{const v=new Audio(`${r}/sfx/${m}`);v.volume=x*C,v.play().catch(E=>{console.warn("Sound playback failed:",E)})})},[t.pendingSounds,x,C,r]);const J=(m,v,E)=>{F(m,E/2).then(()=>{m.src=v,m.load(),m.volume=0,m.play().then(()=>{_(m,E/2,x*j)}).catch(P=>{console.warn("Music playback failed:",P)})})},F=(m,v)=>new Promise(E=>{const P=m.volume,$=20,G=v/$,O=P/$;let A=0;const M=setInterval(()=>{A++,m.volume=Math.max(0,P-O*A),A>=$&&(clearInterval(M),m.pause(),m.currentTime=0,E())},G);I.current=M}),_=(m,v,E)=>{const $=v/20,G=E/20;let O=0;const A=setInterval(()=>{O++,m.volume=Math.min(E,G*O),O>=20&&clearInterval(A)},$);I.current=A};return{setMasterVolume:g,setMusicVolume:R,setSoundVolume:y,setVoiceVolume:u,stopAll:()=>{d.current&&(d.current.pause(),d.current.currentTime=0),w.current&&(w.current.pause(),w.current.currentTime=0)}}}const Ce={click:"click.ogg",menuOpen:"menu_open.ogg",menuClose:"menu_close.ogg"};function oe(t={}){const{enabled:n=!0,basePath:r="/audio/ui",volume:a=.5,sounds:l={}}=t,[c,f]=o.useState(n),[h,x]=o.useState(a),g=o.useRef({...Ce,...l}),j=o.useCallback(u=>{if(!c||!u)return;const d=new Audio(`${r}/${u}`);d.volume=h,d.play().catch(()=>{})},[c,h,r]),R=o.useCallback(u=>{const d=g.current[u];d&&j(d)},[j]),C=o.useCallback(()=>j(g.current.click),[j]),y=o.useCallback(()=>j(g.current.menuOpen),[j]),T=o.useCallback(()=>j(g.current.menuClose),[j]);return{playClick:C,playMenuOpen:y,playMenuClose:T,playSound:R,setEnabled:f,setVolume:x,enabled:c,volume:h}}function ce({dialogue:t,className:n=""}){return e.jsxs("div",{className:`dialogue-box ${n}`,children:[t.portrait&&e.jsx("div",{className:"dialogue-portrait",children:e.jsx("img",{src:t.portrait,alt:t.speakerName})}),e.jsxs("div",{className:"dialogue-content",children:[e.jsx("div",{className:"dialogue-speaker",children:t.speakerName}),e.jsx("div",{className:"dialogue-text",children:t.text})]})]})}function ie({choices:t,onSelectChoice:n,className:r=""}){return t.length===0?null:e.jsx("div",{className:`choice-list ${r}`,children:t.map(a=>e.jsx("button",{className:"choice-button",onClick:()=>n(a.id),children:a.text},a.id))})}function ue({location:t,className:n=""}){return e.jsxs("div",{className:`location-view ${n}`,children:[t.banner&&e.jsx("div",{className:"location-banner",children:e.jsx("img",{src:t.banner,alt:t.name})}),e.jsxs("div",{className:"location-content",children:[e.jsx("h1",{className:"location-name",children:t.name}),e.jsx("p",{className:"location-description",children:t.description})]})]})}function de({characters:t,onTalkTo:n,className:r=""}){return t.length===0?null:e.jsxs("div",{className:`character-list ${r}`,children:[e.jsx("h2",{children:"Characters"}),e.jsx("div",{className:"character-grid",children:t.map(a=>e.jsxs("button",{className:"character-card",onClick:()=>n(a.id),children:[a.portrait&&e.jsx("img",{src:a.portrait,alt:a.name,className:"character-portrait"}),e.jsx("div",{className:"character-name",children:a.name})]},a.id))})]})}function me({items:t,className:n=""}){const[r,a]=o.useState(null);return e.jsxs("div",{className:`inventory ${n}`,children:[e.jsx("h2",{children:"Inventory"}),t.length===0?e.jsx("p",{className:"inventory-empty",children:"No items"}):e.jsx("div",{className:"inventory-grid",children:t.map(l=>e.jsxs("div",{className:"inventory-item",onClick:()=>a(l),children:[l.icon&&e.jsx("img",{src:l.icon,alt:l.name,className:"item-icon"}),e.jsx("div",{className:"item-name",children:l.name})]},l.id))}),r&&e.jsx("div",{className:"item-modal-overlay",onClick:()=>a(null),children:e.jsxs("div",{className:"item-modal",onClick:l=>l.stopPropagation(),children:[r.image&&e.jsx("img",{src:r.image,alt:r.name,className:"item-modal-image"}),e.jsx("h3",{className:"item-modal-name",children:r.name}),e.jsx("p",{className:"item-modal-description",children:r.description}),e.jsx("button",{className:"item-modal-close",onClick:()=>a(null),children:"Close"})]})})]})}function fe({quests:t,entries:n,className:r=""}){return e.jsxs("div",{className:`journal ${r}`,children:[e.jsx("h2",{children:"Journal"}),t.length>0&&e.jsxs("div",{className:"journal-quests",children:[e.jsx("h3",{children:"Active Quests"}),t.map(a=>e.jsxs("div",{className:"quest-entry",children:[e.jsx("div",{className:"quest-name",children:a.name}),e.jsx("div",{className:"quest-description",children:a.description}),e.jsx("div",{className:"quest-stage",children:a.currentStageDescription})]},a.id))]}),n.length>0&&e.jsxs("div",{className:"journal-entries",children:[e.jsx("h3",{children:"Entries"}),n.map(a=>e.jsxs("div",{className:`journal-entry journal-category-${a.category}`,children:[e.jsx("div",{className:"entry-title",children:a.title}),e.jsx("div",{className:"entry-text",children:a.text})]},a.id))]}),t.length===0&&n.length===0&&e.jsx("p",{className:"journal-empty",children:"No entries yet"})]})}function he({map:t,onTravelTo:n,className:r=""}){return t?e.jsxs("div",{className:`map-view ${r}`,children:[e.jsx("h2",{children:t.name}),e.jsxs("div",{className:"map-container",style:{position:"relative"},children:[t.image&&e.jsx("img",{src:t.image,alt:t.name,className:"map-image"}),t.locations.map(a=>e.jsx("button",{className:`map-marker ${a.isCurrent?"current":""}`,style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`},onClick:()=>!a.isCurrent&&n(a.id),disabled:a.isCurrent,title:a.name,children:a.name},a.id))]})]}):null}function ve({notifications:t,className:n=""}){return t.length===0?null:e.jsx("div",{className:`notification-area ${n}`,children:t.map((r,a)=>e.jsx("div",{className:"notification",children:r},a))})}function pe({onSave:t,onLoad:n,storageKey:r="doodle-engine-save",className:a=""}){const[l,c]=o.useState(""),f=()=>{const g=t();localStorage.setItem(r,JSON.stringify(g)),c("Saved!"),setTimeout(()=>c(""),2e3)},h=()=>{const g=localStorage.getItem(r);if(!g){c("No save found"),setTimeout(()=>c(""),2e3);return}const j=JSON.parse(g);n(j),c("Loaded!"),setTimeout(()=>c(""),2e3)},x=localStorage.getItem(r)!==null;return e.jsxs("div",{className:`save-load-panel ${a}`,children:[e.jsx("button",{className:"save-button",onClick:f,children:"Save"}),e.jsx("button",{className:"load-button",onClick:h,disabled:!x,children:"Load"}),l&&e.jsx("span",{className:"save-load-message",children:l})]})}function xe({className:t=""}){const{snapshot:n,actions:r}=K();ee(n);const a=Object.entries(n.variables).filter(([l])=>!l.startsWith("_"));return e.jsxs("div",{className:`game-renderer ${t}`,children:[e.jsx(ve,{notifications:n.notifications}),e.jsxs("div",{className:"game-main",children:[e.jsx(ue,{location:n.location}),n.dialogue&&e.jsxs("div",{className:"dialogue-container",children:[e.jsx(ce,{dialogue:n.dialogue}),e.jsx(ie,{choices:n.choices,onSelectChoice:r.selectChoice})]}),!n.dialogue&&e.jsx(de,{characters:n.charactersHere,onTalkTo:r.talkTo})]}),e.jsxs("div",{className:"game-sidebar",children:[e.jsx(pe,{onSave:r.saveGame,onLoad:r.loadGame}),a.length>0&&e.jsxs("div",{className:"resources",children:[e.jsx("h2",{children:"Resources"}),e.jsx("ul",{className:"resources-list",children:a.map(([l,c])=>e.jsxs("li",{className:"resource-entry",children:[e.jsx("span",{className:"resource-name",children:l}),e.jsx("span",{className:"resource-value",children:c})]},l))})]}),n.party.length>0&&e.jsxs("div",{className:"party",children:[e.jsx("h2",{children:"Party"}),e.jsx("ul",{className:"party-list",children:n.party.map(l=>e.jsx("li",{className:"party-member",children:e.jsx("span",{className:"party-member-name",children:l.name})},l.id))})]}),e.jsx(me,{items:n.inventory}),e.jsx(fe,{quests:n.quests,entries:n.journal}),n.map&&e.jsx(he,{map:n.map,onTravelTo:r.travelTo})]})]})}function je({logoSrc:t,title:n,onComplete:r,duration:a=2e3,className:l=""}){return o.useEffect(()=>{const c=setTimeout(r,a);return()=>clearTimeout(c)},[r,a]),e.jsxs("div",{className:`splash-screen ${l}`,onClick:r,children:[t&&e.jsx("img",{src:t,alt:n||"",className:"splash-logo"}),n&&e.jsx("h1",{className:"splash-title",children:n}),e.jsx("div",{className:"splash-loading",children:"Loading..."})]})}function be({title:t="Doodle Engine",subtitle:n,logoSrc:r,hasSaveData:a,onNewGame:l,onContinue:c,onSettings:f,className:h=""}){return e.jsxs("div",{className:`title-screen ${h}`,children:[r&&e.jsx("img",{src:r,alt:t,className:"title-logo"}),e.jsx("h1",{className:"title-heading",children:t}),n&&e.jsx("p",{className:"title-subtitle",children:n}),e.jsxs("div",{className:"title-menu",children:[e.jsx("button",{className:"title-button",onClick:l,children:"New Game"}),a&&e.jsx("button",{className:"title-button",onClick:c,children:"Continue"}),e.jsx("button",{className:"title-button",onClick:f,children:"Settings"})]})]})}function Ne({onResume:t,onSave:n,onLoad:r,onSettings:a,onQuitToTitle:l,className:c=""}){return e.jsx("div",{className:`pause-menu-overlay ${c}`,children:e.jsxs("div",{className:"pause-menu",children:[e.jsx("h2",{className:"pause-title",children:"Paused"}),e.jsxs("div",{className:"pause-buttons",children:[e.jsx("button",{className:"pause-button",onClick:t,children:"Resume"}),e.jsx("button",{className:"pause-button",onClick:n,children:"Save"}),e.jsx("button",{className:"pause-button",onClick:r,children:"Load"}),e.jsx("button",{className:"pause-button",onClick:a,children:"Settings"}),e.jsx("button",{className:"pause-button pause-button-quit",onClick:l,children:"Quit to Title"})]})]})})}function se({audioControls:t,uiSoundControls:n,availableLocales:r,currentLocale:a,onLocaleChange:l,onBack:c,className:f=""}){return e.jsxs("div",{className:`settings-panel ${f}`,children:[e.jsx("h2",{className:"settings-title",children:"Settings"}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Audio"}),e.jsx(W,{label:"Master",value:1,onChange:t.setMasterVolume}),e.jsx(W,{label:"Music",value:.7,onChange:t.setMusicVolume}),e.jsx(W,{label:"Sound Effects",value:.8,onChange:t.setSoundVolume}),e.jsx(W,{label:"Voice",value:1,onChange:t.setVoiceVolume}),n&&e.jsx(W,{label:"UI Sounds",value:n.volume,onChange:n.setVolume})]}),r&&r.length>1&&l&&e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Language"}),e.jsx("select",{className:"settings-locale-select",value:a,onChange:h=>l(h.target.value),children:r.map(h=>e.jsx("option",{value:h.code,children:h.label},h.code))})]}),e.jsx("button",{className:"settings-back-button",onClick:c,children:"Back"})]})}function W({label:t,value:n,onChange:r}){return e.jsxs("div",{className:"volume-slider",children:[e.jsx("label",{className:"volume-label",children:t}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:n,onChange:a=>r(parseFloat(a.target.value)),className:"volume-input"})]})}function ge({src:t,basePath:n="/video",onComplete:r,className:a=""}){const l=o.useRef(null);return o.useEffect(()=>{const c=f=>{(f.key==="Escape"||f.key===" "||f.key==="Enter")&&(f.preventDefault(),r())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),e.jsxs("div",{className:`video-player-overlay ${a}`,children:[e.jsx("video",{ref:l,src:`${n}/${t}`,autoPlay:!0,onEnded:r,className:"video-player-video"}),e.jsx("button",{className:"video-player-skip-button",onClick:r,children:"Skip"})]})}function Te({registry:t,config:n,title:r="Doodle Engine",subtitle:a,logoSrc:l,splashDuration:c=2e3,uiSounds:f,audioOptions:h,storageKey:x="doodle-engine-save",availableLocales:g,videoBasePath:j="/video",className:R=""}){const[C,y]=o.useState(c>0?"splash":"title"),[T,u]=o.useState(!1),[d,w]=o.useState(!1),[L,I]=o.useState("title"),[J,F]=o.useState(null),[_,D]=o.useState(null),p=oe(f===!1?{enabled:!1}:f),m=localStorage.getItem(x)!==null,v=o.useCallback(()=>{const N={currentLocation:n.startLocation,currentTime:{...n.startTime},flags:{...n.startFlags},variables:{...n.startVariables},inventory:[...n.startInventory],questProgress:{},unlockedJournalEntries:[],playerNotes:[],dialogueState:null,characterState:{},itemLocations:{},mapEnabled:!0,notifications:[],pendingSounds:[],pendingVideo:null,currentLocale:"en"};return new re.Engine(t,N)},[t,n]),E=o.useCallback(()=>{p.playClick();const N=v(),V=N.newGame(n);D({engine:N,snapshot:V}),y("playing")},[v,n,p]),P=o.useCallback(()=>{p.playClick();const N=localStorage.getItem(x);if(!N)return;const V=JSON.parse(N),s=v(),i=s.loadGame(V);D({engine:s,snapshot:i}),y("playing")},[v,x,p]),$=o.useCallback(()=>{if(!_)return;p.playClick();const N=_.engine.saveGame();localStorage.setItem(x,JSON.stringify(N)),u(!1)},[_,x,p]),G=o.useCallback(()=>{const N=localStorage.getItem(x);if(!N||!_)return;p.playClick();const V=JSON.parse(N),s=_.engine.loadGame(V);D({engine:_.engine,snapshot:s}),u(!1)},[_,x,p]),O=o.useCallback(()=>{p.playClick(),u(!1),w(!1),D(null),y("title")},[p]),A=o.useCallback(N=>{p.playMenuOpen(),I(N),w(!0),N==="pause"&&u(!1)},[p]),M=o.useCallback(()=>{p.playMenuClose(),w(!1),L==="pause"&&u(!0)},[L,p]);o.useEffect(()=>{if(C!=="playing")return;const N=V=>{V.key==="Escape"&&(V.preventDefault(),d?M():(T?p.playMenuClose():p.playMenuOpen(),u(s=>!s)))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[C,T,d,M,p]);const B={setMasterVolume:()=>{},setMusicVolume:()=>{},setSoundVolume:()=>{},setVoiceVolume:()=>{},stopAll:()=>{}};return C==="splash"?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(je,{logoSrc:l,title:r,onComplete:()=>y("title"),duration:c})}):C==="title"?e.jsx("div",{className:`game-shell ${R}`,children:d?e.jsx(se,{audioControls:B,uiSoundControls:f!==!1?p:void 0,availableLocales:g,onBack:M}):e.jsx(be,{title:r,subtitle:a,logoSrc:l,hasSaveData:m,onNewGame:E,onContinue:P,onSettings:()=>A("title")})}):_?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(le,{engine:_.engine,initialSnapshot:_.snapshot,children:e.jsx(we,{audioOptions:h,uiSoundControls:f!==!1?p:void 0,showPauseMenu:T,showSettings:d,availableLocales:g,videoBasePath:j,pendingVideo:J,setPendingVideo:F,onPause:()=>{p.playMenuOpen(),u(!0)},onResume:()=>{p.playMenuClose(),u(!1)},onSave:$,onLoad:G,onSettings:()=>A("pause"),onQuitToTitle:O,onCloseSettings:M})})}):null}function we({audioOptions:t,uiSoundControls:n,showPauseMenu:r,showSettings:a,availableLocales:l,videoBasePath:c,pendingVideo:f,setPendingVideo:h,onPause:x,onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:y,onCloseSettings:T}){const{snapshot:u,actions:d}=K(),w=ee(u,t);return o.useEffect(()=>{u.pendingVideo&&h(u.pendingVideo)},[u.pendingVideo,h]),e.jsxs(e.Fragment,{children:[f&&e.jsx(ge,{src:f,basePath:c,onComplete:()=>h(null)}),e.jsx(xe,{}),!r&&!a&&!f&&e.jsx("button",{className:"game-shell-menu-button",onClick:x,"aria-label":"Menu",children:"Menu"}),r&&e.jsx(Ne,{onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:y}),a&&e.jsx(se,{audioControls:w,uiSoundControls:n,availableLocales:l,currentLocale:(u.time,void 0),onLocaleChange:d.setLocale,onBack:T})]})}Object.defineProperty(exports,"VERSION",{enumerable:!0,get:()=>re.VERSION});exports.CharacterList=de;exports.ChoiceList=ie;exports.DialogueBox=ce;exports.GameContext=Z;exports.GameProvider=le;exports.GameRenderer=xe;exports.GameShell=Te;exports.Inventory=me;exports.Journal=fe;exports.LocationView=ue;exports.MapView=he;exports.NotificationArea=ve;exports.PauseMenu=Ne;exports.SaveLoadPanel=pe;exports.SettingsPanel=se;exports.SplashScreen=je;exports.TitleScreen=be;exports.VideoPlayer=ge;exports.useAudioManager=ee;exports.useGame=K;exports.useUISounds=oe;