narraeon 0.3.1 → 0.5.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.
Files changed (76) hide show
  1. package/dist/node/protocol/appPreferences.js +25 -0
  2. package/dist/node/protocol/conversationObservation.js +67 -0
  3. package/dist/node/protocol/v1.js +188 -34
  4. package/dist/node/protocol/worldExtensions.js +16 -0
  5. package/dist/node/protocol/worldMaintenance.js +77 -0
  6. package/dist/node/protocol/worldPromptDiagnostics.js +1 -0
  7. package/dist/node/runtime/ConversationChanges.js +24 -0
  8. package/dist/node/runtime/V1Runtime.js +447 -121
  9. package/dist/node/runtime/artifact/FileNativeArtifactStore.js +326 -12
  10. package/dist/node/runtime/authoring/AuthoringRequestSnapshot.js +63 -0
  11. package/dist/node/runtime/authoring/ModelToolConversation.js +218 -0
  12. package/dist/node/runtime/config/AppPreferencesStore.js +46 -17
  13. package/dist/node/runtime/content/ContentTreeFingerprint.js +13 -0
  14. package/dist/node/runtime/content/ContentWorkspace.js +43 -13
  15. package/dist/node/runtime/content/CurrentTreeContentLibrary.js +128 -46
  16. package/dist/node/runtime/content/FileNativeContentTree.js +28 -10
  17. package/dist/node/runtime/content/PackageFollowups.js +80 -0
  18. package/dist/node/runtime/extension/FrontendExtensionBundle.js +19 -14
  19. package/dist/node/runtime/extension/PackageScriptPermissions.js +70 -0
  20. package/dist/node/runtime/extension/WorldExtensionControls.js +205 -0
  21. package/dist/node/runtime/extension/WorldExtensionRequests.js +64 -0
  22. package/dist/node/runtime/model/FileNativeModelAdapters.js +21 -466
  23. package/dist/node/runtime/model/ModelConnectionStore.js +44 -10
  24. package/dist/node/runtime/model/ModelHost.js +31 -1
  25. package/dist/node/runtime/model/ModelHostStream.js +51 -5
  26. package/dist/node/runtime/play/FileNativeContinuityCorrection.js +55 -45
  27. package/dist/node/runtime/play/FileNativePlayPresetStore.js +256 -238
  28. package/dist/node/runtime/play/FileNativePlayTimelineStore.js +118 -9
  29. package/dist/node/runtime/play/OrderedFollowups.js +71 -0
  30. package/dist/node/runtime/play/OrderedPlayPrompts.js +180 -0
  31. package/dist/node/runtime/play/PlayCallChain.js +814 -61
  32. package/dist/node/runtime/play/PlayContinuity.js +88 -0
  33. package/dist/node/runtime/play/PlayDocumentTools.js +205 -287
  34. package/dist/node/runtime/play/PlayFollowupRequests.js +34 -3
  35. package/dist/node/runtime/play/PlayPresetWorkbench.js +45 -54
  36. package/dist/node/runtime/play/PlayPromptRun.js +86 -0
  37. package/dist/node/runtime/prompt/FileNativePromptCompiler.js +670 -93
  38. package/dist/node/runtime/prompt/FileNativeToolRegistry.js +37 -21
  39. package/dist/node/runtime/prompt/PromptCompilationCodec.js +322 -0
  40. package/dist/node/runtime/prompt/WorldMaintenanceReport.js +251 -0
  41. package/dist/node/runtime/prompt/WorldMaterialCoverage.js +83 -0
  42. package/dist/node/runtime/prompt/WorldPromptDiagnostics.js +185 -0
  43. package/dist/node/runtime/setting/FileNativeSettingImprovementStore.js +1027 -0
  44. package/dist/node/runtime/setting/SettingAuthoringTransaction.js +1339 -0
  45. package/dist/node/runtime/setting/SettingImprovementSession.js +714 -0
  46. package/dist/node/runtime/world/FileNativeAuthorityV3.js +88 -1
  47. package/dist/node/runtime/world/FileNativeWorldStore.js +292 -27
  48. package/dist/node/runtime/world/PlayerViewBindings.js +30 -0
  49. package/dist/node/runtime/world/PlayerViewRenderer.js +27 -34
  50. package/dist/node/runtime/world/WorldDocumentMaintenance.js +174 -0
  51. package/dist/node/runtime/world/WorldDocumentStore.js +166 -96
  52. package/dist/node/runtime/world/WorldOperationCoordinator.js +103 -2
  53. package/dist/node/runtime/world-revision/FileNativeWorldRevisionStore.js +696 -0
  54. package/dist/node/runtime/world-revision/WorldRevisionAuthoringTransaction.js +380 -0
  55. package/dist/node/runtime/world-revision/WorldRevisionSession.js +709 -0
  56. package/dist/node/runtime/world-revision/WorldRevisionWorkspace.js +494 -0
  57. package/dist/node/server/ConversationStream.js +109 -0
  58. package/dist/node/server/createServer.js +5 -1
  59. package/dist/node/shared/artifact-payload-contract.js +123 -0
  60. package/dist/node/shared/default-play-prompts.js +25 -45
  61. package/dist/node/shared/default-preset-host.js +114 -138
  62. package/dist/node/shared/default-setting-improvement-prompt.js +52 -38
  63. package/dist/node/shared/display-regex.js +114 -0
  64. package/dist/node/shared/first-party-action-choices.js +1 -6
  65. package/dist/node/shared/first-party-player-view.js +1 -6
  66. package/dist/node/shared/ordered-author-prompts.js +64 -0
  67. package/dist/node/shared/ordered-followups.js +42 -0
  68. package/dist/node/shared/ordered-play-prompts.js +73 -0
  69. package/dist/web/assets/index-BXfelCi9.js +1207 -0
  70. package/dist/web/assets/index-BYnhUxlk.css +1 -0
  71. package/dist/web/index.html +2 -2
  72. package/package.json +1 -1
  73. package/dist/node/runtime/model/SettingAuthorStream.js +0 -21
  74. package/dist/node/runtime/setting/DocumentCandidateSettingImprovement.js +0 -1731
  75. package/dist/web/assets/index-D5VqDvjY.js +0 -1192
  76. package/dist/web/assets/index-Xa0s35CJ.css +0 -1
@@ -0,0 +1,1207 @@
1
+ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(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 t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function te(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(te(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},P={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var ne=Array.isArray,N=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function F(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function I(e,t){ae++,ie[ae]=e.current,e.current=t}var se=oe(null),ce=oe(null),le=oe(null),L=oe(null);function ue(e,t){switch(I(le,t),I(ce,e),I(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(se),I(se,e)}function de(){F(se),F(ce),F(le)}function fe(e){e.memoizedState!==null&&I(L,e);var t=se.current,n=Hd(t,e.type);t!==n&&(I(ce,e),I(se,n))}function pe(e){ce.current===e&&(F(se),F(ce)),L.current===e&&(F(L),Qf._currentValue=re)}var R,me;function he(e){if(R===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||``,me=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+R+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,z=null;function Fe(e){if(typeof Me==`function`&&Ne(e),z&&typeof z.setStrictMode==`function`)try{z.setStrictMode(Pe,e)}catch{}}var B=Math.clz32?Math.clz32:Le,V=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(V(e)/Ie|0)|0}var H=256,Re=262144,ze=4194304;function Be(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ve(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-B(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Je(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Je(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-B(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ye(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-B(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Xe(e,t){var n=t&-t;return n=n&42?1:Ze(n),(n&(e.suspendedLanes|t))===0?n:0}function Ze(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function $e(){var e=P.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function et(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var tt=Math.random().toString(36).slice(2),nt=`__reactFiber$`+tt,rt=`__reactProps$`+tt,it=`__reactContainer$`+tt,at=`__reactEvents$`+tt,U=`__reactListeners$`+tt,ot=`__reactHandles$`+tt,st=`__reactResources$`+tt,ct=`__reactMarker$`+tt;function lt(e){delete e[nt],delete e[rt],delete e[at],delete e[U],delete e[ot]}function ut(e){var t=e[nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[it]||n[nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[nt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function dt(e){if(e=e[nt]||e[it]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function pt(e){var t=e[st];return t||=e[st]={hoistableStyles:new Map,hoistableScripts:new Map},t}function mt(e){e[ct]=!0}var ht=new Set,gt={};function _t(e,t){vt(e,t),vt(e+`Capture`,t)}function vt(e,t){for(gt[e]=t,e=0;e<t.length;e++)ht.add(t[e])}var yt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),bt={},xt={};function St(e){return be.call(xt,e)?!0:be.call(bt,e)?!1:yt.test(e)?xt[e]=!0:(bt[e]=!0,!1)}function Ct(e,t,n){if(St(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function wt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Tt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Et(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Dt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ot(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kt(e){if(!e._valueTracker){var t=Dt(e)?`checked`:`value`;e._valueTracker=Ot(e,t,``+e[t])}}function At(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Dt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function jt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Mt=/[\n"\\]/g;function Nt(e){return e.replace(Mt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Pt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Et(t)):e.value!==``+Et(t)&&(e.value=``+Et(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):It(e,o,Et(n)):It(e,o,Et(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Et(s):e.removeAttribute(`name`)}function Ft(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){kt(e);return}n=n==null?``:``+Et(n),t=t==null?n:``+Et(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),kt(e)}function It(e,t,n){t===`number`&&jt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Lt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Et(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Rt(e,t,n){if(t!=null&&(t=``+Et(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Et(n)}function zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(ne(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=Et(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),kt(e)}function Bt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ht(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Vt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ut(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Ht(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Ht(e,a,t[a])}function Wt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Gt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Kt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qt(e){return Kt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Jt(){}var Yt=null;function Xt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zt=null,Qt=null;function $t(e){var t=dt(e);if(t&&(e=t.stateNode)){var n=e[rt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Pt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Nt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[rt]||null;if(!i)throw Error(s(90));Pt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&At(r)}break a;case`textarea`:Rt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Lt(e,!!n.multiple,t,!1)}}}var en=!1;function tn(e,t,n){if(en)return e(t,n);en=!0;try{return e(t)}finally{if(en=!1,(Zt!==null||Qt!==null)&&(vu(),Zt&&(t=Zt,e=Qt,Qt=Zt=null,$t(t),e)))for(t=0;t<e.length;t++)$t(e[t])}}function nn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[rt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var rn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),an=!1;if(rn)try{var on={};Object.defineProperty(on,"passive",{get:function(){an=!0}}),window.addEventListener(`test`,on,on),window.removeEventListener(`test`,on,on)}catch{an=!1}var sn=null,cn=null,ln=null;function un(){if(ln)return ln;var e,t=cn,n=t.length,r,i=`value`in sn?sn.value:sn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return ln=i.slice(e,1<r?1-r:void 0)}function dn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function fn(){return!0}function pn(){return!1}function mn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?fn:pn,this.isPropagationStopped=pn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=fn)},persist:function(){},isPersistent:fn}),t}var hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gn=mn(hn),_n=h({},hn,{view:0,detail:0}),vn=mn(_n),yn,bn,xn,Sn=h({},_n,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==xn&&(xn&&e.type===`mousemove`?(yn=e.screenX-xn.screenX,bn=e.screenY-xn.screenY):bn=yn=0,xn=e),yn)},movementY:function(e){return`movementY`in e?e.movementY:bn}}),Cn=mn(Sn),wn=mn(h({},Sn,{dataTransfer:0})),Tn=mn(h({},_n,{relatedTarget:0})),En=mn(h({},hn,{animationName:0,elapsedTime:0,pseudoElement:0})),Dn=mn(h({},hn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),On=mn(h({},hn,{data:0})),kn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},An={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},jn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Mn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jn[e])?!!t[e]:!1}function Nn(){return Mn}var Pn=mn(h({},_n,{key:function(e){if(e.key){var t=kn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?An[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nn,charCode:function(e){return e.type===`keypress`?dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=mn(h({},Sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=mn(h({},_n,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nn})),Ln=mn(h({},hn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=mn(h({},Sn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),zn=mn(h({},hn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=rn&&`CompositionEvent`in window,Hn=null;rn&&`documentMode`in document&&(Hn=document.documentMode);var Un=rn&&`TextEvent`in window&&!Hn,Wn=rn&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=un(),ln=cn=sn=null,Yn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){Zt?Qt?Qt.push(r):Qt=[r]:Zt=r,t=Td(t,`onChange`),0<t.length&&(n=new gn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,nr=null;function rr(e){vd(e,0)}function ir(e){if(At(ft(e)))return e}function ar(e,t){if(e===`change`)return t}var or=!1;if(rn){var sr;if(rn){var cr=`oninput`in document;if(!cr){var lr=document.createElement(`div`);lr.setAttribute(`oninput`,`return;`),cr=typeof lr.oninput==`function`}sr=cr}else sr=!1;or=sr&&(!document.documentMode||9<document.documentMode)}function ur(){tr&&(tr.detachEvent(`onpropertychange`,dr),nr=tr=null)}function dr(e){if(e.propertyName===`value`&&ir(nr)){var t=[];er(t,nr,e,Xt(e)),tn(rr,t)}}function fr(e,t,n){e===`focusin`?(ur(),tr=t,nr=n,tr.attachEvent(`onpropertychange`,dr)):e===`focusout`&&ur()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ir(nr)}function mr(e,t){if(e===`click`)return ir(t)}function hr(e,t){if(e===`input`||e===`change`)return ir(t)}function gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var _r=typeof Object.is==`function`?Object.is:gr;function vr(e,t){if(_r(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!be.call(t,i)||!_r(e[i],t[i]))return!1}return!0}function yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function br(e,t){var n=yr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=jt(e.document)}return t}function Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var wr=rn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==jt(r)||(r=Tr,`selectionStart`in r&&Cr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&vr(Dr,r)||(Dr=r,r=Td(Er,`onSelect`),0<r.length&&(t=new gn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Tr)))}function Ar(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var jr={animationend:Ar(`Animation`,`AnimationEnd`),animationiteration:Ar(`Animation`,`AnimationIteration`),animationstart:Ar(`Animation`,`AnimationStart`),transitionrun:Ar(`Transition`,`TransitionRun`),transitionstart:Ar(`Transition`,`TransitionStart`),transitioncancel:Ar(`Transition`,`TransitionCancel`),transitionend:Ar(`Transition`,`TransitionEnd`)},Mr={},Nr={};rn&&(Nr=document.createElement(`div`).style,`AnimationEvent`in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),`TransitionEvent`in window||delete jr.transitionend.transition);function Pr(e){if(Mr[e])return Mr[e];if(!jr[e])return e;var t=jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nr)return Mr[e]=t[n];return e}var Fr=Pr(`animationend`),Ir=Pr(`animationiteration`),Lr=Pr(`animationstart`),Rr=Pr(`transitionrun`),zr=Pr(`transitionstart`),Br=Pr(`transitioncancel`),Vr=Pr(`transitionend`),Hr=new Map,Ur=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Ur.push(`scrollEnd`);function Wr(e,t){Hr.set(e,t),_t(t,[e])}var Gr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Kr=[],qr=0,Jr=0;function Yr(){for(var e=qr,t=Jr=qr=0;t<e;){var n=Kr[t];Kr[t++]=null;var r=Kr[t];Kr[t++]=null;var i=Kr[t];Kr[t++]=null;var a=Kr[t];if(Kr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&$r(n,i,a)}}function Xr(e,t,n,r){Kr[qr++]=e,Kr[qr++]=t,Kr[qr++]=n,Kr[qr++]=r,Jr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Zr(e,t,n,r){return Xr(e,t,n,r),ei(e)}function Qr(e,t){return Xr(e,null,null,t),ei(e)}function $r(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-B(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ei(e){if(50<lu)throw lu=0,uu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ti={};function ni(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ri(e,t,n,r){return new ni(e,t,n,r)}function ii(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ai(e,t){var n=e.alternate;return n===null?(n=ri(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function oi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function si(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ii(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ri(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return ci(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=ri(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=ri(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=ri(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case D:o=14;break a;case O:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=ri(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ci(e,t,n,r){return e=ri(7,e,r,t),e.lanes=n,e}function li(e,t,n){return e=ri(6,e,null,t),e.lanes=n,e}function ui(e){var t=ri(18,null,null,0);return t.stateNode=e,t}function di(e,t,n){return t=ri(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fi=new WeakMap;function pi(e,t){if(typeof e==`object`&&e){var n=fi.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},fi.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var mi=[],hi=0,gi=null,_i=0,vi=[],yi=0,W=null,bi=1,xi=``;function Si(e,t){mi[hi++]=_i,mi[hi++]=gi,gi=e,_i=t}function Ci(e,t,n){vi[yi++]=bi,vi[yi++]=xi,vi[yi++]=W,W=e;var r=bi;e=xi;var i=32-B(r)-1;r&=~(1<<i),n+=1;var a=32-B(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-B(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===gi;)gi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null;for(;e===W;)W=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null,bi=vi[--yi],vi[yi]=null}function Ei(e,t){vi[yi++]=bi,vi[yi++]=xi,vi[yi++]=W,bi=t.id,xi=t.overflow,W=e}var Di=null,G=null,K=!1,Oi=null,ki=!1,q=Error(s(519));function Ai(e){throw Ii(pi(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),q}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[nt]=e,t[rt]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Ft(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Jt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Di=Di.return}}function Ni(e){if(e!==Di)return!1;if(!K)return Mi(e),K=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&G&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));G=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));G=uf(e)}else t===27?(t=G,Zd(e.type)?(e=lf,lf=null,G=e):G=t):G=Di?cf(e.stateNode.nextSibling):null;return!0}function Pi(){G=Di=null,K=!1}function Fi(){var e=Oi;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Oi=null),e}function Ii(e){Oi===null?Oi=[e]:Oi.push(e)}var Li=oe(null),Ri=null,zi=null;function Bi(e,t,n){I(Li,t._currentValue),t._currentValue=n}function Vi(e){e._currentValue=Li.current,F(Li)}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ui(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Hi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Hi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function Wi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;_r(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===L.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&Ui(t,e,n,r),t.flags|=262144}function Gi(e){for(e=e.firstContext;e!==null;){if(!_r(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ki(e){Ri=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qi(e){return Yi(Ri,e)}function Ji(e,t){return Ri===null&&Ki(e),Yi(e,t)}function Yi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},zi===null){if(e===null)throw Error(s(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return n}var Xi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Zi=t.unstable_scheduleCallback,Qi=t.unstable_NormalPriority,$i={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ea(){return{controller:new Xi,data:new Map,refCount:0}}function ta(e){e.refCount--,e.refCount===0&&Zi(Qi,function(){e.controller.abort()})}var na=null,ra=0,ia=0,aa=null;function oa(e,t){if(na===null){var n=na=[];ra=0,ia=ud(),aa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ra++,t.then(sa,sa),t}function sa(){if(--ra===0&&na!==null){aa!==null&&(aa.status=`fulfilled`);var e=na;na=null,ia=0,aa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ca(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var la=N.S;N.S=function(e,t){Ql=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&oa(e,t),la!==null&&la(e,t)};var ua=oe(null);function da(){var e=ua.current;return e===null?Fl.pooledCache:e}function fa(e,t){t===null?I(ua,ua.current):I(ua,t.pool)}function pa(){var e=da();return e===null?null:{parent:$i._currentValue,pool:e}}var ma=Error(s(460)),ha=Error(s(474)),ga=Error(s(542)),_a={then:function(){}};function va(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ya(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Jt,Jt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ca(e),e;default:if(typeof t.status==`string`)t.then(Jt,Jt);else{if(e=Fl,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ca(e),e}throw xa=t,ma}}function ba(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(xa=e,ma):e}}var xa=null;function Sa(){if(xa===null)throw Error(s(459));var e=xa;return xa=null,e}function Ca(e){if(e===ma||e===ga)throw Error(s(483))}var wa=null,Ta=0;function Ea(e){var t=Ta;return Ta+=1,wa===null&&(wa=[]),ya(wa,e,t)}function Da(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Oa(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ka(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ai(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=li(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&ba(a)===t.type)?(t=i(t,n.props),Da(t,n),t.return=e,t):(t=si(n.type,n.key,n.props,null,e.mode,r),Da(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=di(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ci(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=si(t.type,t.key,t.props,null,e.mode,n),Da(n,t),n.return=e,n;case v:return t=di(t,e.mode,n),t.return=e,t;case O:return t=ba(t),f(e,t,n)}if(ne(t)||te(t))return t=ci(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ea(t),n);if(t.$$typeof===C)return f(e,Ji(e,t),n);Oa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ba(n),p(e,t,n,r)}if(ne(n)||te(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ea(n),r);if(n.$$typeof===C)return p(e,t,Ji(e,n),r);Oa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ba(r),m(e,t,n,r,i)}if(ne(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ea(r),i);if(r.$$typeof===C)return m(e,t,n,Ji(t,r),i);Oa(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),K&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return K&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),K&&Si(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),K&&Si(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return K&&Si(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),K&&Si(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ba(l)===r.type){n(e,r.sibling),c=i(r,a.props),Da(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=ci(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=si(a.type,a.key,a.props,null,e.mode,c),Da(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=di(a,e.mode,c),c.return=e,e=c}return o(e);case O:return a=ba(a),b(e,r,a,c)}if(ne(a))return h(e,r,a,c);if(te(a)){if(l=te(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Ea(a),c);if(a.$$typeof===C)return b(e,r,Ji(e,a),c);Oa(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=li(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Ta=0;var i=b(e,t,n,r);return wa=null,i}catch(t){if(t===ma||t===ga)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Aa=ka(!0),ja=ka(!1),Ma=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Fa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ia(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function La(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function Ra(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var za=!1;function Ba(){if(za){var e=aa;if(e!==null)throw e}}function Va(e,t,n,r){za=!1;var i=e.updateQueue;Ma=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===ia&&(za=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ma=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ha(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ua(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ha(n[e],t)}var Wa=oe(null),Ga=oe(0);function Ka(e,t){e=Vl,I(Ga,e),I(Wa,t),Vl=e|t.baseLanes}function qa(){I(Ga,Vl),I(Wa,Wa.current)}function Ja(){Vl=Ga.current,F(Wa),F(Ga)}var Ya=oe(null),Xa=null;function Za(e){var t=e.alternate;I(no,no.current&1),I(Ya,e),Xa===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(Xa=e)}function Qa(e){I(no,no.current),I(Ya,e),Xa===null&&(Xa=e)}function $a(e){e.tag===22?(I(no,no.current),I(Ya,e),Xa===null&&(Xa=e)):eo(e)}function eo(){I(no,no.current),I(Ya,Ya.current)}function to(e){F(Ya),Xa===e&&(Xa=null),F(no)}var no=oe(0);function ro(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var io=0,J=null,Y=null,ao=null,oo=!1,so=!1,co=!1,lo=0,uo=0,fo=null,po=0;function mo(){throw Error(s(321))}function ho(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_r(e[n],t[n]))return!1;return!0}function go(e,t,n,r,i,a){return io=a,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Ns:Ps,co=!1,a=n(r,i),co=!1,so&&(a=vo(t,n,r,i)),_o(e),a}function _o(e){N.H=Ms;var t=Y!==null&&Y.next!==null;if(io=0,ao=Y=J=null,oo=!1,uo=0,fo=null,t)throw Error(s(300));e===null||Zs||(e=e.dependencies,e!==null&&Gi(e)&&(Zs=!0))}function vo(e,t,n,r){J=e;var i=0;do{if(so&&(fo=null),uo=0,so=!1,25<=i)throw Error(s(301));if(i+=1,ao=Y=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}N.H=Fs,a=t(n,r)}while(so);return a}function yo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?Eo(t):t,e=e.useState()[0],(Y===null?null:Y.memoizedState)!==e&&(J.flags|=1024),t}function bo(){var e=lo!==0;return lo=0,e}function xo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function So(e){if(oo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}oo=!1}io=0,ao=Y=J=null,so=!1,uo=lo=0,fo=null}function Co(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ao===null?J.memoizedState=ao=e:ao=ao.next=e,ao}function wo(){if(Y===null){var e=J.alternate;e=e===null?null:e.memoizedState}else e=Y.next;var t=ao===null?J.memoizedState:ao.next;if(t!==null)ao=t,Y=e;else{if(e===null)throw J.alternate===null?Error(s(467)):Error(s(310));Y=e,e={memoizedState:Y.memoizedState,baseState:Y.baseState,baseQueue:Y.baseQueue,queue:Y.queue,next:null},ao===null?J.memoizedState=ao=e:ao=ao.next=e}return ao}function To(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Eo(e){var t=uo;return uo+=1,fo===null&&(fo=[]),e=ya(fo,e,t),t=J,(ao===null?t.memoizedState:ao.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Ns:Ps),e}function Do(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Eo(e);if(e.$$typeof===C)return qi(e)}throw Error(s(438,String(e)))}function Oo(e){var t=null,n=J.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=J.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=To(),J.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function ko(e,t){return typeof t==`function`?t(e):t}function Ao(e){return jo(wo(),Y,e)}function jo(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(io&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ia&&(d=!0);else if((io&p)===p){u=u.next,p===ia&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,J.lanes|=p,Ul|=p;f=u.action,co&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,J.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!_r(a,e.memoizedState)&&(Zs=!0,d&&(n=aa,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Mo(e){var t=wo(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);_r(a,t.memoizedState)||(Zs=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function No(e,t,n){var r=J,i=wo(),a=K;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!_r((Y||i).memoizedState,n);if(o&&(i.memoizedState=n,Zs=!0),i=i.queue,is(Io.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||ao!==null&&ao.memoizedState.tag&1){if(r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,i,n,t),null),Fl===null)throw Error(s(349));a||io&127||Po(r,t,n)}return n}function Po(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t=To(),J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Fo(e,t,n,r){t.value=n,t.getSnapshot=r,Lo(t)&&Ro(e)}function Io(e,t,n){return n(function(){Lo(t)&&Ro(e)})}function Lo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_r(e,n)}catch{return!0}}function Ro(e){var t=Qr(e,2);t!==null&&pu(t,e,2)}function zo(e){var t=Co();if(typeof e==`function`){var n=e;if(e=n(),co){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t}function Bo(e,t,n,r){return e.baseState=n,jo(e,Y,typeof r==`function`?r:ko)}function Vo(e,t,n,r,i){if(ks(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};N.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Ho(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Ho(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Uo(e,t,s)}catch(n){Go(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Uo(e,t,a)}catch(n){Go(e,t,n)}}function Uo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Wo(e,t,n)},function(n){return Go(e,t,n)}):Wo(e,t,n)}function Wo(e,t,n){t.status=`fulfilled`,t.value=n,Ko(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ho(e,n)))}function Go(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ko(t),t=t.next;while(t!==r)}e.action=null}function Ko(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function qo(e,t){return t}function Jo(e,t){if(K){var n=Fl.formState;if(n!==null){a:{var r=J;if(K){if(G){b:{for(var i=G,a=ki;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){G=cf(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=Co(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qo,lastRenderedState:t},n.queue=r,n=Es.bind(null,J,r),r.dispatch=n,r=zo(!1),a=Os.bind(null,J,!1,r.queue),r=Co(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Vo.bind(null,J,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Yo(e){return Xo(wo(),Y,e)}function Xo(e,t,n){if(t=jo(e,t,qo)[0],e=Ao(ko)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Eo(t)}catch(e){throw e===ma?ga:e}else r=t;t=wo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(J.flags|=2048,$o(9,{destroy:void 0},Zo.bind(null,i,n),null)),[r,a,e]}function Zo(e,t){e.action=t}function Qo(e){var t=wo(),n=Y;if(n!==null)return Xo(t,n,e);wo(),t=t.memoizedState,n=wo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function $o(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=J.updateQueue,t===null&&(t=To(),J.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function es(){return wo().memoizedState}function ts(e,t,n,r){var i=Co();J.flags|=e,i.memoizedState=$o(1|t,{destroy:void 0},n,r===void 0?null:r)}function ns(e,t,n,r){var i=wo();r=r===void 0?null:r;var a=i.memoizedState.inst;Y!==null&&r!==null&&ho(r,Y.memoizedState.deps)?i.memoizedState=$o(t,a,n,r):(J.flags|=e,i.memoizedState=$o(1|t,a,n,r))}function rs(e,t){ts(8390656,8,e,t)}function is(e,t){ns(2048,8,e,t)}function as(e){J.flags|=4;var t=J.updateQueue;if(t===null)t=To(),J.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function os(e){var t=wo().memoizedState;return as({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function ss(e,t){return ns(4,2,e,t)}function cs(e,t){return ns(4,4,e,t)}function ls(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function us(e,t,n){n=n==null?null:n.concat([e]),ns(4,4,ls.bind(null,t,e),n)}function ds(){}function fs(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ho(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ps(e,t){var n=wo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ho(t,r[1]))return r[0];if(r=e(),co){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function ms(e,t,n){return n===void 0||io&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),J.lanes|=e,Ul|=e,n)}function hs(e,t,n,r){return _r(n,t)?n:Wa.current===null?!(io&42)||io&1073741824&&!(Q&261930)?(Zs=!0,e.memoizedState=n):(e=fu(),J.lanes|=e,Ul|=e,t):(e=ms(e,n,r),_r(e,t)||(Zs=!0),e)}function gs(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Os(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ds(e,t,ca(c,r),du(e)):Ds(e,t,r,du(e))}catch(n){Ds(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function _s(){}function vs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=ys(e).queue;gs(e,i,t,re,n===null?_s:function(){return bs(e),n(r)})}function ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bs(e){var t=ys(e);t.next===null&&(t=e.alternate.memoizedState),Ds(e,t.next.queue,{},du())}function xs(){return qi(Qf)}function Ss(){return wo().memoizedState}function Cs(){return wo().memoizedState}function ws(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Fa(n);var r=Ia(t,e,n);r!==null&&(pu(r,t,n),La(r,t,n)),t={cache:ea()},e.payload=t;return}t=t.return}}function Ts(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ks(e)?As(t,n):(n=Zr(e,t,n,r),n!==null&&(pu(n,e,r),js(n,t,r)))}function Es(e,t,n){Ds(e,t,n,du())}function Ds(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ks(e))As(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,_r(s,o))return Xr(e,t,i,0),Fl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return pu(n,e,r),js(n,t,r),!0}return!1}function Os(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ks(e)){if(t)throw Error(s(479))}else t=Zr(e,n,r,2),t!==null&&pu(t,e,2)}function ks(e){var t=e.alternate;return e===J||t!==null&&t===J}function As(e,t){so=oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function js(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Ms={readContext:qi,use:Do,useCallback:mo,useContext:mo,useEffect:mo,useImperativeHandle:mo,useLayoutEffect:mo,useInsertionEffect:mo,useMemo:mo,useReducer:mo,useRef:mo,useState:mo,useDebugValue:mo,useDeferredValue:mo,useTransition:mo,useSyncExternalStore:mo,useId:mo,useHostTransitionStatus:mo,useFormState:mo,useActionState:mo,useOptimistic:mo,useMemoCache:mo,useCacheRefresh:mo};Ms.useEffectEvent=mo;var Ns={readContext:qi,use:Do,useCallback:function(e,t){return Co().memoizedState=[e,t===void 0?null:t],e},useContext:qi,useEffect:rs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ts(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=Co();t=t===void 0?null:t;var r=e();if(co){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Co();if(n!==void 0){var i=n(t);if(co){Fe(!0);try{n(t)}finally{Fe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ts.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=Co();return e={current:e},t.memoizedState=e},useState:function(e){e=zo(e);var t=e.queue,n=Es.bind(null,J,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ds,useDeferredValue:function(e,t){return ms(Co(),e,t)},useTransition:function(){var e=zo(!1);return e=gs.bind(null,J,e.queue,!0,!1),Co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=J,i=Co();if(K){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Fl===null)throw Error(s(349));Q&127||Po(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,rs(Io.bind(null,r,a,e),[e]),r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,a,n,t),null),n},useId:function(){var e=Co(),t=Fl.identifierPrefix;if(K){var n=xi,r=bi;n=(r&~(1<<32-B(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=lo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=po++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:xs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e){var t=Co();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Os.bind(null,J,!0,n),n.dispatch=t,[e,t]},useMemoCache:Oo,useCacheRefresh:function(){return Co().memoizedState=ws.bind(null,J)},useEffectEvent:function(e){var t=Co(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Ps={readContext:qi,use:Do,useCallback:fs,useContext:qi,useEffect:is,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:Ao,useRef:es,useState:function(){return Ao(ko)},useDebugValue:ds,useDeferredValue:function(e,t){return hs(wo(),Y.memoizedState,e,t)},useTransition:function(){var e=Ao(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Ss,useHostTransitionStatus:xs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){return Bo(wo(),Y,e,t)},useMemoCache:Oo,useCacheRefresh:Cs};Ps.useEffectEvent=os;var Fs={readContext:qi,use:Do,useCallback:fs,useContext:qi,useEffect:is,useImperativeHandle:us,useInsertionEffect:ss,useLayoutEffect:cs,useMemo:ps,useReducer:Mo,useRef:es,useState:function(){return Mo(ko)},useDebugValue:ds,useDeferredValue:function(e,t){var n=wo();return Y===null?ms(n,e,t):hs(n,Y.memoizedState,e,t)},useTransition:function(){var e=Mo(ko)[0],t=wo().memoizedState;return[typeof e==`boolean`?e:Eo(e),t]},useSyncExternalStore:No,useId:Ss,useHostTransitionStatus:xs,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){var n=wo();return Y===null?(n.baseState=e,[e,n.queue.dispatch]):Bo(n,Y,e,t)},useMemoCache:Oo,useCacheRefresh:Cs};Fs.useEffectEvent=os;function Is(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ls={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Fa(r);i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(pu(t,e,r),La(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Fa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(pu(t,e,r),La(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Fa(n);r.tag=2,t!=null&&(r.callback=t),t=Ia(e,r,n),t!==null&&(pu(t,e,n),La(t,e,n))}};function Rs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!vr(n,r)||!vr(i,a):!0}function zs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ls.enqueueReplaceState(t,t.state,null)}function Bs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Vs(e){Gr(e)}function Hs(e){console.error(e)}function Us(e){Gr(e)}function Ws(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){return n=Fa(n),n.tag=3,n.payload={element:null},n.callback=function(){Ws(e,t)},n}function qs(e){return e=Fa(e),e.tag=3,e}function Js(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Gs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Gs(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ys(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Wi(t,n,i,!0),n=Ya.current,n!==null){switch(n.tag){case 31:case 13:return Xa===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===_a?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,i)),!1;case 22:return n.flags|=65536,r===_a?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,i)),!1}throw Error(s(435,n.tag))}return Wu(e,r,i),Tu(),!1}if(K)return t=Ya.current,t===null?(r!==q&&(t=Error(s(423),{cause:r}),Ii(pi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=pi(r,n),i=Ks(e.stateNode,r,i),Ra(e,i),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==q&&(e=Error(s(422),{cause:r}),Ii(pi(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=pi(a,n),Jl===null?Jl=[a]:Jl.push(a),Hl!==4&&(Hl=2),t===null)return!0;r=pi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ks(n.stateNode,r,e),Ra(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(tu===null||!tu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=qs(i),Js(i,e,n,r),Ra(n,i),!1}n=n.return}while(n!==null);return!1}var Xs=Error(s(461)),Zs=!1;function Qs(e,t,n,r){t.child=e===null?ja(t,null,n,r):Aa(t,e.child,n,r)}function $s(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ki(t),r=go(e,t,n,o,a,i),s=bo(),e!==null&&!Zs?(xo(e,t,i),Sc(e,t,i)):(K&&s&&wi(t),t.flags|=1,Qs(e,t,r,i),t.child)}function ec(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ii(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,tc(e,t,a,r,i)):(e=si(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?vr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=ai(a,r),e.ref=t.ref,e.return=t,t.child=e}function tc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(vr(a,r)&&e.ref===t.ref){if(Zs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Zs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}}return lc(e,t,n,r,i)}function nc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ic(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fa(t,a===null?null:a.cachePool),a===null?qa():Ka(t,a),$a(t);else return r=t.lanes=536870912,ic(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&fa(t,null),qa(),eo(t)):(fa(t,a.cachePool),Ka(t,a),eo(t),t.memoizedState=null);return Qs(e,t,i,n),t.child}function rc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ic(e,t,n,r,i){var a=da();return a=a===null?null:{parent:$i._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&fa(t,null),qa(),$a(t),e!==null&&Wi(e,t,r,!0),t.childLanes=i,null}function ac(e,t){return t=vc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function oc(e,t,n){return Aa(t,e.child,null,n),e=ac(t,t.pendingProps),e.flags|=2,to(t),t.memoizedState=null,e}function sc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(K){if(r.mode===`hidden`)return e=ac(t,r),t.lanes=536870912,rc(null,e);if(Qa(t),(e=G)?(e=rf(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:W===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Di=t,G=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return ac(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(Qa(t),i){if(t.flags&256)t.flags&=-257,t=oc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558))}else if(Zs||Wi(e,t,n,!1),i=(n&e.childLanes)!==0,Zs||i){if(r=Fl,r!==null&&(o=Xe(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Qr(e,o),pu(r,e,o),Xs;Tu(),t=oc(e,t,n)}else e=a.treeContext,G=cf(o.nextSibling),Di=t,K=!0,Oi=null,ki=!1,e!==null&&Ei(t,e),t=ac(t,r),t.flags|=4096;return t}return e=ai(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function cc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function lc(e,t,n,r,i){return Ki(t),n=go(e,t,n,r,void 0,i),r=bo(),e!==null&&!Zs?(xo(e,t,i),Sc(e,t,i)):(K&&r&&wi(t),t.flags|=1,Qs(e,t,n,i),t.child)}function uc(e,t,n,r,i,a){return Ki(t),t.updateQueue=null,n=vo(t,r,n,i),_o(e),r=bo(),e!==null&&!Zs?(xo(e,t,a),Sc(e,t,a)):(K&&r&&wi(t),t.flags|=1,Qs(e,t,n,a),t.child)}function dc(e,t,n,r,i){if(Ki(t),t.stateNode===null){var a=ti,o=n.contextType;typeof o==`object`&&o&&(a=qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ls,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Na(t),o=n.contextType,a.context=typeof o==`object`&&o?qi(o):ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Is(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ls.enqueueReplaceState(a,a.state,null),Va(t,r,a,i),Ba(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Bs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ti,typeof u==`object`&&u&&(o=qi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&zs(t,a,r,o),Ma=!1;var f=t.memoizedState;a.state=f,Va(t,r,a,i),Ba(),l=t.memoizedState,s||f!==l||Ma?(typeof d==`function`&&(Is(t,n,d,r),l=t.memoizedState),(c=Ma||Rs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Pa(e,t),o=t.memoizedProps,u=Bs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ti,typeof l==`object`&&l&&(c=qi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&zs(t,a,r,c),Ma=!1,f=t.memoizedState,a.state=f,Va(t,r,a,i),Ba();var p=t.memoizedState;o!==d||f!==p||Ma||e!==null&&e.dependencies!==null&&Gi(e.dependencies)?(typeof s==`function`&&(Is(t,n,s,r),p=t.memoizedState),(u=Ma||Rs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Gi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,cc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Aa(t,e.child,null,i),t.child=Aa(t,null,n,i)):Qs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function fc(e,t,n,r){return Pi(),t.flags|=256,Qs(e,t,n,r),t.child}var pc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mc(e){return{baseLanes:e,cachePool:pa()}}function hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function gc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(no.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(K){if(i?Za(t):eo(t),(e=G)?(e=rf(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:W===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Di=t,G=null)):e=null,e===null)throw Ai(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(eo(t),i=t.mode,c=vc({mode:`hidden`,children:c},i),r=ci(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=mc(n),r.childLanes=hc(e,o,n),t.memoizedState=pc,rc(null,r)):(Za(t),_c(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(Za(t),t.flags&=-257,t=X(e,t,n)):t.memoizedState===null?(eo(t),c=r.fallback,i=t.mode,r=vc({mode:`visible`,children:r.children},i),c=ci(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Aa(t,e.child,null,n),r=t.child,r.memoizedState=mc(n),r.childLanes=hc(e,o,n),t.memoizedState=pc,t=rc(null,r)):(eo(t),t.child=e.child,t.flags|=128,t=null);else if(Za(t),of(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,Ii({value:r,source:null,stack:null}),t=X(e,t,n)}else if(Zs||Wi(e,t,n,!1),o=(n&e.childLanes)!==0,Zs||o){if(o=Fl,o!==null&&(r=Xe(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Qr(e,r),pu(o,e,r),Xs;af(c)||Tu(),t=X(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,G=cf(c.nextSibling),Di=t,K=!0,Oi=null,ki=!1,e!==null&&Ei(t,e),t=_c(t,r.children),t.flags|=4096);return t}return i?(eo(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ai(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ci(c,i,n,null),c.flags|=2):c=ai(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,rc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=mc(n):(i=c.cachePool,i===null?i=pa():(l=$i._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=hc(e,o,n),t.memoizedState=pc,rc(e.child,r)):(Za(t),n=e.child,e=n.sibling,n=ai(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function _c(e,t){return t=vc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function vc(e,t){return e=ri(22,e,null,t),e.lanes=0,e}function X(e,t,n){return Aa(t,e.child,null,n),e=_c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=no.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,I(no,o),Qs(e,t,r,n),r=K?_i:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ro(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ro(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Wi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=ai(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ai(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Gi(e)))}function wc(e,t,n){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),Bi(t,$i,e.memoizedState.cache),Pi();break;case 27:case 5:fe(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:Bi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Qa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Za(t),e=Sc(e,t,n),e===null?null:e.sibling):gc(e,t,n):(Za(t),t.flags|=128,null);Za(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Wi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(no,no.current),r)break;return null;case 22:return t.lanes=0,nc(e,t,n,t.pendingProps);case 24:Bi(t,$i,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Zs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Zs=!1,wc(e,t,n);Zs=!!(e.flags&131072)}}else Zs=!1,K&&t.flags&1048576&&Ci(t,_i,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ba(t.elementType),t.type=e,typeof e==`function`)ii(e)?(r=Bs(e,r),t.tag=1,t=dc(null,t,e,r,n)):(t.tag=0,t=lc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=$s(null,t,e,r,n);break a}if(i===D){t.tag=14,t=ec(null,t,e,r,n);break a}}throw t=M(e)||e,Error(s(306,t,``))}}return t;case 0:return lc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Bs(r,t.pendingProps),dc(e,t,r,i,n);case 3:a:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Pa(e,t),Va(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Bi(t,$i,r),r!==a.cache&&Ui(t,[$i],n,!0),Ba(),r=o.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=fc(e,t,r,n);break a}if(r!==i){i=pi(Error(s(424)),t),Ii(i),t=fc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(G=cf(e.firstChild),Di=t,K=!0,Oi=null,ki=!0,n=ja(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Pi(),r===i){t=Sc(e,t,n);break a}Qs(e,t,r,n)}t=t.child}return t;case 26:return cc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:K||(n=t.type,e=t.pendingProps,r=Bd(le.current).createElement(n),r[nt]=t,r[rt]=e,Pd(r,n,e),mt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fe(t),e===null&&K&&(r=t.stateNode=ff(t.type,t.pendingProps,le.current),Di=t,ki=!0,i=G,Zd(t.type)?(lf=i,G=cf(r.firstChild)):G=i),Qs(e,t,t.pendingProps.children,n),cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&K&&((i=r=G)&&(r=tf(r,t.type,t.pendingProps,ki),r===null?i=!1:(t.stateNode=r,Di=t,G=cf(r.firstChild),ki=!1,i=!0)),i||Ai(t)),fe(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:o!==null&&Ud(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=go(e,t,yo,null,null,n),Qf._currentValue=i),cc(e,t),Qs(e,t,r,n),t.child;case 6:return e===null&&K&&((e=n=G)&&(n=nf(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Di=t,G=null,e=!0)),e||Ai(t)),null;case 13:return gc(e,t,n);case 4:return ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Aa(t,null,r,n):Qs(e,t,r,n),t.child;case 11:return $s(e,t,t.type,t.pendingProps,n);case 7:return Qs(e,t,t.pendingProps,n),t.child;case 8:return Qs(e,t,t.pendingProps.children,n),t.child;case 12:return Qs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Bi(t,t.type,r.value),Qs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Ki(t),i=qi(i),r=r(i),t.flags|=1,Qs(e,t,r,n),t.child;case 14:return ec(e,t,t.type,t.pendingProps,n);case 15:return tc(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return sc(e,t,n);case 22:return nc(e,t,n,t.pendingProps);case 24:return Ki(t),r=qi($i),e===null?(i=da(),i===null&&(i=Fl,a=ea(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Na(t),Bi(t,$i,i)):((e.lanes&n)!==0&&(Pa(e,t),Va(t,null,null,n),Ba()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Bi(t,$i,r),r!==i.cache&&Ui(t,[$i],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Bi(t,$i,r))),Qs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw xa=_a,ha}}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(Su())e.flags|=8192;else throw xa=_a,ha}}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:We(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!K)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Vi($i),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ni(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi())),jc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Ec(t),a===null?(jc(t),Dc(t,i,null,r,n)):(jc(t),Oc(t,a))):a?a===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,a)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,i,e,r,n)),null;case 27:if(pe(t),n=le.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}e=se.current,Ni(t)?ji(t,e):(e=ff(i,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(pe(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}if(a=se.current,Ni(t))ji(t,a);else{var o=Bd(le.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[nt]=t,a[rt]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=le.current,Ni(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Di,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ai(t,!0)}else e=Bd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ni(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[nt]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(to(t),t):(to(t),null);if(t.flags&128)throw Error(s(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ni(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[nt]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),i=!1}else i=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(to(t),t):(to(t),null)}return to(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return de(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return Vi(t.type),jc(t),null;case 19:if(F(no),r=t.memoizedState,r===null)return jc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ro(e),a!==null){for(t.flags|=128,Ac(r,!1),e=a.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return I(no,no.current&1|2),K&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>$l&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304)}}else{if(!i){if(e=ro(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!K)return jc(t),null}else 2*Te()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=no.current,I(no,i?n&1|2:n&1),K&&Si(t,r.treeForkCount),e);case 22:case 23:return to(t),Ja(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&F(ua),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vi($i),jc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Nc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi($i),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if(to(t),t.alternate===null)throw Error(s(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(to(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(no),null;case 4:return de(),null;case 10:return Vi(t.type),null;case 22:case 23:return to(t),Ja(),e!==null&&F(ua),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vi($i),null;case 25:return null;default:return null}}function Pc(e,t){switch(Ti(t),t.tag){case 3:Vi($i),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&to(t);break;case 13:to(t);break;case 19:F(no);break;case 10:Vi(t.type);break;case 22:case 23:to(t),Ja(),e!==null&&F(ua);break;case 24:Vi($i)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ua(t,n)}catch(t){Uu(e,e.return,t)}}}function Rc(e,t,n){n.props=Bs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Vc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[rt]=t}catch(t){Uu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Jt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Uu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=Sr(e),Cr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Bs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=Bs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ua(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,!!(n.subtreeFlags&8772)):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&lt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(z&&typeof z.onCommitFiberUnmount==`function`)try{z.onCommitFiberUnmount(Pe,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null){if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(s(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(s(160));al(a,o,i),nl=null,rl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[ct]||a[nt]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Pd(a,r,n),a[nt]=e,mt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[nt]=e,mt(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode)}else e.stateNode=If(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){i=e.stateNode;try{Bt(i,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Hc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,i=dl,dl=gf(t.containerInfo),ul(t,e),dl=i,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||i,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Jc||Yc||gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;Kc(e,Wc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Bt(a,``),n.flags&=-33),Kc(e,Wc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Gc(e,Wc(e),o);break;default:throw Error(s(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ha(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ta(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ta(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ta(e)));break;case 12:if(i&2048){bl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Uu(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=qi($i),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return qi($i).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:N.T===null?$e():ud()}function fu(){if(Kl===0){if(!(Q&536870912)||K){var e=Re;Re<<=1,!(Re&3932160)&&(Re=262144),Kl=e}else Kl=536870912}return e=Ya.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Ke(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(Pl&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||He(e,t),i=r?Ou(e,t):Eu(e,t,!0),a=r;do{if(i===0){zl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,a&&!gu(n)){i=Eu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,o).flags|=256),o=Eu(c,o,!1),o!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=a,Wl|=a,i=4;break a}a=Yl,Yl=i,a!==null&&(Yl===null?Yl=a:Yl.push.apply(Yl,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=Zl+300-Te(),10<i)){if(_u(r,t,Kl,!Rl),Ve(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,`Throttled`,-0,0),i);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,null,-0,0)}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jt},El(t,a,d);var m=(a&62914560)===a?Zl-Te():(a&4194048)===a?Ql-Te():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!_r(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-B(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Je(e,n,t)}function vu(){return Pl&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,zi=Ri=null,So(e),wa=null,Ta=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=ai(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=He(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-B(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Yr(),n}function xu(e,t){J=null,N.H=Ms,t===ma||t===ga?(t=Sa(),Il=3):t===ha?(t=Sa(),Il=4):Il=t===Xs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Ws(e,pi(t,e.current)))}function Su(){var e=Ya.current;return e===null?!0:(Q&4194048)===Q?Xa===null:(Q&62914560)===Q||Q&536870912?e===Xa:!1}function Cu(){var e=N.H;return N.H=Ms,e===null?Ms:e}function wu(){var e=N.A;return N.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&Ya.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:Ya.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,zi=Ri=null,Pl=r,N.H=i,N.A=a,Z===null&&(Fl=null,Q=0,Yr()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),i=wu();Fl!==e||Q!==t?(eu=null,$l=Te()+500,bu(e,t)):zl=He(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var a=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,a,1);break;case 2:case 9:if(va(a)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},a.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:va(a)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,a,7));break;case 5:var o=null;switch(Z.tag){case 26:o=Z.memoizedState;case 5:case 27:var c=Z;if(o?Wf(o):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,a,5);break;case 6:Il=0,Ll=null,Mu(e,t,a,6);break;case 8:yu(),Hl=6;break a;default:throw Error(s(462))}}ku();break}catch(t){xu(e,t)}while(1);return zi=Ri=null,N.H=r,N.A=i,Pl=n,Z===null?(Fl=null,Q=0,Yr(),Hl):0}function ku(){for(;Z!==null&&!Ce();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=uc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=uc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:So(t);default:Pc(n,t),t=Z=oi(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){zi=Ri=null,So(t),wa=null,Ta=0;var i=t.return;try{if(Ys(e,i,t,n,Q)){Hl=1,Ws(e,pi(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Ws(e,pi(n,e.current)),Z=null;return}t.flags&32768?(K||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ya.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Jr,qe(e,n,a,o,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=a,su=i,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(ke,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,i=P.p,P.p=2,o=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=o,P.p=i,N.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=Sr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&xr(s.ownerDocument.documentElement,s)){if(c!==null&&Cr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=br(s,h),v=br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Pl=i,P.p=r,N.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,P.p=r,N.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,we();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),Qe(n),t=t.stateNode,z&&typeof z.onCommitFiberRoot==`function`)try{z.onCommitFiberRoot(Pe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ta(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=Qe(au),r=N.T,i=P.p;try{P.p=32>n?32:n,N.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(s(331));var c=Pl;if(Pl|=4,kl(a.current),xl(a,a.current,o,n),Pl=c,rd(0,!1),z&&typeof z.onPostCommitFiberRoot==`function`)try{z.onPostCommitFiberRoot(Pe,a)}catch{}return!0}finally{P.p=i,N.T=r,zu(e,t)}}function Hu(e,t,n){t=pi(n,t),t=Ks(e.stateNode,t,2),e=Ia(e,t,2),e!==null&&(Ke(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=pi(n,e),n=qs(2),r=Ia(t,n,2),r!==null&&(Js(n,r,t,e),Ke(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>Te()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=We()),e=Qr(e,t),e!==null&&(Ke(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return xe(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-B(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Ve(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Te(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-B(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ue(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Ve(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||He(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),Qe(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=je;break;default:n=ke}return r=sd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Ve(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,Te()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Pl&6?xe(De,id):ad()})}function ud(){if(td===0){var e=ia;e===0&&(e=H,H<<=1,!(H&261888)&&(H=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:qt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[rt]||null).action),o=r.submitter;o&&(t=(t=o[rt]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new gn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);vs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),vs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Ur.length;md++){var hd=Ur[md];Wr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Wr(Fr,`onAnimationEnd`),Wr(Ir,`onAnimationIteration`),Wr(Lr,`onAnimationStart`),Wr(`dblclick`,`onDoubleClick`),Wr(`focusin`,`onFocus`),Wr(`focusout`,`onBlur`),Wr(Rr,`onTransitionRun`),Wr(zr,`onTransitionStart`),Wr(Br,`onTransitionCancel`),Wr(Vr,`onTransitionEnd`),vt(`onMouseEnter`,[`mouseout`,`mouseover`]),vt(`onMouseLeave`,[`mouseout`,`mouseover`]),vt(`onPointerEnter`,[`pointerout`,`pointerover`]),vt(`onPointerLeave`,[`pointerout`,`pointerover`]),_t(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),_t(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),_t(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),_t(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[at];n===void 0&&(n=t[at]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,ht.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!an||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ut(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}tn(function(){var r=a,i=Xt(n),o=[];a:{var s=Hr.get(e);if(s!==void 0){var c=gn,u=e;switch(e){case`keypress`:if(dn(n)===0)break a;case`keydown`:case`keyup`:c=Pn;break;case`focusin`:u=`focus`,c=Tn;break;case`focusout`:u=`blur`,c=Tn;break;case`beforeblur`:case`afterblur`:c=Tn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Cn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=In;break;case Fr:case Ir:case Lr:c=En;break;case Vr:c=Ln;break;case`scroll`:case`scrollend`:c=vn;break;case`wheel`:c=Rn;break;case`copy`:case`cut`:case`paste`:c=Dn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Fn;break;case`toggle`:case`beforetoggle`:c=zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=nn(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Yt&&(u=n.relatedTarget||n.fromElement)&&(ut(u)||u[it]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ut(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=Cn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:ft(c),h=u==null?s:ft(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ut(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Ed,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Dd(o,s,c,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?ft(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=ar;else if($n(s)){if(or)v=hr;else{v=pr;var y=fr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Wt(r.elementType)&&(v=ar):v=mr;if(v&&=v(e,r)){er(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&It(s,`number`,s.value)}switch(y=r?ft(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(Tr=y,Er=r,Dr=null);break;case`focusout`:Dr=Er=Tr=null;break;case`mousedown`:Or=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Or=!1,kr(o,n,i);break;case`selectionchange`:if(wr)break;case`keydown`:case`keyup`:kr(o,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=un()):(sn=i,cn=`value`in sn?sn.value:sn.textContent,Yn=!0)),y=Td(r,x),0<y.length&&(x=new On(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new On(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),pd(o,e,r,n,i)}vd(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=nn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=nn(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=nn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=nn(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Bt(e,``+r);break;case`className`:wt(e,`class`,r);break;case`tabIndex`:wt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:wt(e,n,r);break;case`style`:Ut(e,r,a);break;case`data`:if(t!==`object`){wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Ct(e,`popover`,r);break;case`xlinkActuate`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ct(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Gt.get(n)||n,Ct(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Ut(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Bt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!gt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[rt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ct(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,a,o,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:Md(e,t,r,d,n,null)}}Ft(e,a,c,l,u,o,i,!1);return;case`select`:for(i in $(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&Lt(e,!!r,n,!0):Lt(e,!!r,t,!1);return;case`textarea`:for(o in $(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:Md(e,t,o,c,n,null)}zt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Wt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Pt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Md(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&Md(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?Lt(e,!!n,n?[]:``,!1):Lt(e,!!n,t,!0)):Lt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&Md(e,t,o,i,r,a)}Rt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Wt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ct]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),lt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ct])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);lt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=P.d;P.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=dt(e);t!==null&&t.tag===5&&t.type===`form`?bs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Nt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Nt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Nt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Nt(n.imageSizes)+`"]`)):i+=`[href="`+Nt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Nt(r)+`"][href="`+Nt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),mt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=pt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);mt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=pt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=pt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=le.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=pt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=pt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=pt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Nt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),mt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Nt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Nt(n.href)+`"]`);if(r)return t.instance=r,mt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),mt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,mt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),mt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,mt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),mt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ct]||a[nt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,mt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ri(3,null,null,t),e.current=a,a.stateNode=e,t=ea(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Na(a),e}function tp(e){return e?(e=ti,e):ti}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Fa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ia(e,r,t),n!==null&&(pu(n,e,t),La(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Qr(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=Ze(t);var n=Qr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,up(e,t,n,r)}finally{P.p=a,N.T=i}}function lp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,up(e,t,n,r)}finally{P.p=a,N.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=dt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Be(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-B(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Pl&6)&&($l=Te()+500,rd(0,!1))}}break;case 31:case 13:s=Qr(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Xt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ut(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ee()){case De:return 2;case Oe:return 8;case ke:case Ae:return 32;case je:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=dt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ut(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,et(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Yt=r,n.target.dispatchEvent(r),Yt=null}else return t=dt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=dt(n);a!==null&&(e.splice(t,3),t-=3,vs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[rt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[it]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.8`)throw Error(s(527,Lp,`19.2.8`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Pe=zp.inject(Rp),z=zp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Vs,a=Hs,o=Us;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,o,Pp),e[it]=t.current,xd(e),new Fp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=[`en`,`zh-CN`],f={density:`compact`,fontSize:17,lineHeight:1.7,letterSpacing:.01,measure:48};function p(e){return d.includes(e)}var m=`en`,h={保存说明:`About saving`,重命名文件:`Rename file`,"生成预览后,在这里查看实际发送的消息、材料与工具。":`Generate a preview to inspect the messages, materials, and tools sent to the model.`,关闭提示:`Dismiss notification`,"已保留当前页面的未保存修改,请保存或放弃后再切换。":`Your unsaved changes have been kept. Save or discard them before switching pages.`,"这份内容包正在完善,请在回复完成后创建世界。":`This content package is being developed. Wait for the reply to finish before creating a world.`,放弃控制修改:`Discard control changes`,选择编辑文件:`Choose a file to edit`,当前文件:`Current file`,工作区导航:`Workspace navigation`,切换页面:`Switch page`,内容包读取失败:`Could not load content package`,"选择一份内容包,从它的开场开始。":`Choose a content package and begin with its opening.`,"先新建或导入一份内容包。":`Create or import a content package first.`,创建世界的内容包:`Content package for the new world`,"内容包需要修复后才能创建世界。":`Repair this content package before creating a world.`,配置模型连接:`Configure model connection`,"正在创建世界…":`Creating world…`,"新世界独立保存,之后的游玩不会修改源内容包。":`The new world is saved independently. Playing will not change the source package.`,开场白预览:`Opening preview`,"这份内容包还没有开场白。":`This content package has no opening yet.`,"正在读取开场白…":`Loading opening…`,"选择一个世界继续故事,或从内容包开始创作。":`Continue a story in an existing world, or start creating from a content package.`,"世界操作:{title}":`World actions: {title}`,"先新建或导入一份内容包,再完善开场与世界设定。":`Create or import a content package, then develop its opening and world setting.`,"导入内容包 ZIP":`Import content package ZIP`,"世界控制 · 高级编辑":`World control · Advanced editor`,当前配置与编译边界:`Current configuration and compilation boundaries`,参数说明:`Parameter details`,创建世界:`Create world`,完善这份内容包:`Develop this content package`,返回游玩:`Return to play`,预设管理:`Manage presets`,预设检查通过:`Preset validated`,"预设已导出。":`Preset exported.`,"JavaScript 已关闭;文本、HTML 和样式仍可预览。":`JavaScript disabled. Text, HTML and styles can still be previewed.`,"已复制为独立预设。":`Copied as an independent preset.`,"已复制推荐{name},可独立编辑。":`Copied the recommended {name} for independent editing.`,预设编辑器:`Preset editor`,"已加入修复草稿,保存时将检查预设格式。":`Added to the repair draft. The preset format will be checked when saving.`,"跨世界使用的主持规则;可在“游玩”左侧目录调整启用状态和顺序。":`Narrator rules shared across worlds. Change their order and enabled state in the Play directory.`,"主叙事或后置请求使用的提示词;在“游玩”左侧选择对应条目即可编辑。":`Prompts for the main narration or follow-up requests. Select the corresponding item in the Play directory to edit it.`,"预设已保存。":`Preset saved.`,"已应用此预设;游玩修改将在下一次正常发送时生效。":`Preset applied. Play changes take effect on the next normal send.`,导入预设:`Import preset`,选择要导入的预设:`Choose a preset to import`,"无法识别此预设。请选择通过“导出预设”生成的文件。":`This preset could not be recognized. Choose a file created with Export preset.`,导出预设:`Export preset`,"预设已导入为独立副本,JavaScript 默认关闭;信任其内容后可在预设操作中启用。":`Preset imported as an independent copy with JavaScript disabled. Enable it in preset actions after reviewing and trusting its contents.`,"发送给 AI 的内容预览":`Preview content sent to AI`,"请先保存当前修改;这里预览的是已保存且校验通过的预设,不包含未保存修改。":`Save your changes first. This preview uses the saved, validated preset and excludes unsaved changes.`,当前使用的预设:`Current preset`,"在同一处编辑设定完善方法、主持规则、后置请求与界面展示。":`Edit authoring methods, narrator rules, follow-up requests and displays in one place.`,"预设原文与表单均有修改,请先保留一种编辑结果并保存,再预览。":`Both the preset source and forms have changed. Keep one set of edits and save before previewing.`,"预设原文与表单均有修改,请先保留一种编辑结果再保存,以免覆盖当前修改。":`Both the preset source and forms have changed. Keep one set of edits before saving to avoid overwriting your changes.`,"这里显示此产物的数据要求。需要修改时,请在当前内容包或世界修订的文件编辑中修改 control/followups.yaml 的对应产物声明。":`These are the data requirements for this output. To change them, edit the corresponding output declaration in control/followups.yaml in the current content package or world revision file editor.`,模板版本标记:`Template version marker`,新增修复文件:`Add a repair file`,已关闭:`Disabled`,系统示例:`System example`,世界扩展:`World extensions`,"界面显示(不调用模型)":`Interface display (no model requests)`,"选择仅用于当前世界。后置请求重新开启后,从下一次正常发送生效;界面显示直接读取当前字段。":`Choices apply only to this world. Re-enabled requests take effect on the next normal send; interface displays read current fields immediately.`,随组暂停:`Paused by group`,"后置声明无法编辑,请在文件编辑中修复后重试。":`The followup declaration cannot be edited. Repair it in the file editor and try again.`,"主剧情完成后按此顺序生成额外内容。关闭保留提示和资源;创建世界后独立保存,后续修改需通过世界修订应用。":`Generate extra content in this order after the main story. Disabling keeps prompts and resources. Created worlds keep independent copies; later changes require applying a world revision.`,"根据已完成的剧情,通过 artifact_emit 输出 output_1。":`Use artifact_emit to emit output_1 based on the settled story.`,故事正文:`Story content`,删除请求:`Delete request`,新增包后置请求:`Add package followup`,包请求名称:`Package request name`,包请求提示词:`Package request prompt`,包请求显示位置:`Package request display location`,稳定请求身份:`Stable request identity`,产物字节上限:`Artifact byte limit`,内容包脚本权限:`Package script permissions`,"仅授权此处已保存的资源代码。导入不会授权,资源修改后需要重新授权;关闭立即停止此来源脚本,HTML 和样式仍可显示。":`Authorize only the saved resource code here. Imports do not grant permission, and changed resources require authorization again. Revoking permission stops scripts from this source; HTML and styles remain visible.`,允许运行内容包脚本:`Allow package scripts`,撤销全部包脚本授权:`Revoke all package script permissions`,"请先保存修改,再授权资源代码。":`Save your changes before authorizing resource code.`,"JavaScript 仅在 app 模式且已允许脚本时运行。":`JavaScript runs only in app mode with scripts enabled.`,"HTML 模板":`HTML template`,编辑渲染资源:`Edit rendering resources`,"在此位置展开当前世界的内容包后置请求。无声明时为空组,不调用模型;正文由内容包管理。":`The current world’s package followups expand here. An undeclared group is empty and makes no model calls; the package owns its content.`,克隆后置请求:`Clone followup`,"界面产物:场景回顾,Markdown,剧情内容区;保存到提交,替换上一份,显式清除。":`Artifact: scene recap, Markdown, story area; saved with the commit, replacing the previous result until explicitly cleared.`,系统后置提示词:`System followup prompt`,"系统示例只读;新运行使用应用最新版,克隆后独立保存。":`This system example is read-only. New runs use the current application example; clones are saved independently.`,内容包后置请求:`Content-package followups`,最近一次请求材料:`Latest request materials`,"下一次发送将采用当前预设和世界材料;原生对话保留。":`The next send uses the current preset and world materials while preserving the native conversation.`,"每次正常发送重新编译,工具往返使用本轮快照":`Each normal send recompiles; tool exchanges use the same run snapshot.`,下一次发送候选:`Next send candidate`,"分别展示最近一次请求、累计当时读取和下一次候选;旧读取不代表当前字段值。":`Inspect the latest request, accumulated historical reads, and next candidate separately. Past reads do not prove current field values.`,本次请求快照的真实覆盖:`Actual coverage of this request snapshot`,"查看下一次发送候选的完整 Prompt Preview":`Inspect the complete next-send Prompt Preview`,"游玩在下一次正常发送生效,原样重试保留旧请求":`Play changes take effect on the next normal send; exact retries retain the saved request.`,"· 游玩修改在下一次正常发送生效":`· Play changes take effect on the next normal send`,"保留原生对话,重新编译当前提示和材料":`Preserve the native conversation and recompile current prompts and materials`,"累计实际读取(当时内容)":`Accumulated reads (historical content)`,"累计读取的当时内容,不代表当前字段值":`Historical content read at the time, not current field values`,查看各次请求保存的提示材料:`Inspect saved prompt materials for each request`,"原样重试使用已保存请求,不采用新预设。":`Exact retry uses the saved request and does not apply a new preset.`,"正常发送和空输入续写使用最新预设;本轮工具执行期间保持不变。":`Normal sends and empty continuations use the latest preset; it stays fixed during this tool loop.`,"玩家视图格式无效,请检查文本处理规则。":`Invalid player-view data. Check the text processing rules.`,"玩家视图、布局、资源与无模型预览":`Player views, layout, resources and model-free preview`,"直接用已保存的玩家视图配置界面,不需要后置请求。模型产物的位置设置独立保留。":`Configure displays directly from saved player views. Model-generated outputs have separate placement settings.`,"当前没有模型产物;玩家视图面板仍可独立使用。":`There are no model-generated outputs. Player-view panels work independently.`,"同一玩家视图由自定义面板接管,其他视图仍显示默认卡片。":`Custom panels replace the default card for their player view. Other views keep their default cards.`,纯界面预览:`Interface preview`,"使用当前编辑内容与所选世界的已保存玩家视图,不调用模型,也不保存或修改世界。修改后请重新预览。":`Preview the current edits with saved player views from the selected world. This makes no model calls and does not save or change the world. Preview again after editing.`,预览世界:`Preview world`,选择已有世界:`Select an existing world`,预览界面:`Preview interface`,"正在读取玩家视图…":`Loading player views…`,"请先解决高级文件与结构化编辑冲突,再预览。":`Resolve conflicts between file and structured edits before previewing.`,渲染资源:`Rendering resources`,"编辑资源 {name}":`Edit resource {name}`,"资源内容 {name}":`Resource content {name}`,"对话连接已断开,正在重新连接…":`Conversation disconnected. Reconnecting…`,"对话同步失败,请重新打开此页面。":`Conversation synchronization failed. Reopen this page to reconnect.`,"正在读取工作区…":`Loading workspace…`,工作区读取失败:`Failed to load the workspace`,"内容包当前树已整批保存。":`The content package tree has been saved.`,"内容包已重命名。":`The content package has been renamed.`,"内容包 ZIP 自身大小超过安全上限。":`The content package ZIP exceeds the safety limit.`,"ZIP 内容包已导入为新的本地身份。":`The ZIP content package was imported with a new local identity.`,"请先保存手动编辑,再开始 AI 设定完善。":`Save manual edits before starting setting improvement.`,"请先保存并启用一份模型配置。":`Save and enable a model connection first.`,"世界已重命名为“{name}”。":`World renamed to “{name}”.`,"删除世界“{title}”?它的全部提交、历史和存档都会从本机移除,且无法撤销。":`Delete world “{title}”? All of its commits, history, and saved data will be removed from this device. This cannot be undone.`,"世界已从本机删除。":`The world has been deleted from this device.`,操作失败:`Operation failed`,未命名世界:`Untitled world`,模型连接:`Model connection`,完成原因:`Provider completion reason`,原生续传载荷:`Provider-native continuation payload`,不可用:`Unavailable`,尚未配置:`Not configured`,内容包:`Content package`,内容包编辑方式:`Content package editing mode`,"已放弃未保存修改;内容包当前树未改变。":`Unsaved edits were discarded; the current content package tree is unchanged.`,"Narraeon · 本地优先":`Narraeon · Local first`,世界工作区:`World workspace`,"创作内容包,连接 AI 主持,让每个世界独立演化。":`Create content packages, connect a model host, and let every world evolve independently.`,返回工作区:`Back to workspace`,手动编辑:`Edit manually`,"AI 完善":`Setting improvement`,新建世界:`Create world`,从当前内容包创建:`Create from current content package`,界面语言:`Interface language`,"界面语言已保存。":`Interface language saved.`,简体中文:`Simplified Chinese`,"扩展 iframe 加载失败":`Extension iframe failed to load`,"下一次真实 Prompt Preview":`Next real Prompt Preview`,"每个后置请求在主调用链完成后单独派发一次,共用同一段冻结前缀,彼此看不见对方,也不会进入之后的模型上下文。请求提示、产物格式和显示位置都可在当前页面编辑。":`Each follow-up is dispatched once after the main call chain. They share the same frozen prefix, cannot see one another, and never enter later model context. Edit each request prompt, artifact format, and display location here.`,"上次模型请求没有完整返回。保持输入框为空并点击“追加上下文”,就会原样发送已保存的请求;不会追加玩家指令,中断片段也不会进入模型上下文。":`The previous model request did not return completely. Leave the input empty and append context to resend the saved request unchanged. No player instruction is appended, and the interrupted fragment does not enter model context.`,产物调试器:`Artifact debugger`,扩展状态:`Extension status`,核心已提交:`Core committed`,核心未提交:`Core not committed`,"已完成请求:":`Completed requests:`,无:`None`,玩家视图面板诊断:`Player-view panel diagnostics`,玩家视图面板:`Player-view panel`,"已提交玩家视图投影 · head:":`Committed player-view projection · head:`,"bridge 事件(":`Bridge events (`,来源:`Source`,世界端点:`World endpoint`,未提交:`Uncommitted`,"保存/投影":`Retention / projection`,"renderer 状态":`Renderer status`,最终内容:`Final content`,"regex steps(structured_payload 以规范化 JSON 文本为输入)":`Regex steps (structured_payload uses normalized JSON text as input)`,"artifact 内容超过宿主渲染上限":`Artifact content exceeds the host rendering limit`,正则规则数量超过宿主上限:`The number of regex rules exceeds the host limit`,"markdown_html 规则只作用于 Markdown 转换后的 HTML":`markdown_html rules apply only to HTML produced from Markdown`,正则转换次数超过宿主上限:`The number of regex transformations exceeds the host limit`,正则输出超过宿主字节上限:`Regex output exceeds the host byte limit`,"Markdown HTML DOM 大小超过宿主上限":`The Markdown HTML DOM exceeds the host size limit`,正则执行失败:`Regex execution failed`,"正则规则失败,实例显示 raw artifact(可恢复)":`A regex rule failed; the instance is showing the raw artifact and can recover`,"正则规则失败,实例进入错误状态并显示 raw artifact":`A regex rule failed; the instance entered an error state and is showing the raw artifact`,"document renderer 必须包含唯一 narraeon:content marker":`A document renderer must contain exactly one narraeon:content marker`,"旧产物没有可证明的回复归属,仅保留诊断,无法自动迁移为正文附件。":`Legacy artifacts have no proven reply attachment. Diagnostics remain available; automatic migration to story attachments is unavailable.`,生成失败:`Generation failed`,已更新:`Updated`,更新中:`Updating`,生成中:`Generating`,生成未完成:`Generation incomplete`,"ArtifactExtensionMount 必须位于 ArtifactExtensionHost 内":`ArtifactExtensionMount must be inside ArtifactExtensionHost`,"文档 renderer 无效":`Invalid document renderer`,扩展报告了未知诊断:`The extension reported an unknown diagnostic`,"当前调用链正在提交,暂不能修改草稿":`The current call chain is committing; its draft cannot be changed yet`,"composer.set_draft.text 必须是字符串":`composer.set_draft.text must be a string`,"扩展资源不可用,显示 raw artifact。":`Extension resources are unavailable; showing the raw artifact.`,恢复此扩展:`Restore this extension`,停用此扩展:`Disable this extension`,本地可信代码:`Trusted local code`,扩展展帧加载失败:`Extension iframe failed to load`,产物诊断:`Artifact diagnostics`,内容包当前树:`Current content-package tree`,"逐份编辑 YAML/Markdown;整批保存时才原子替换已保存版本。":`Edit YAML and Markdown files individually; the saved version is replaced atomically only when the whole draft is saved.`,内容包编辑状态:`Content-package editing status`,"已保存版本:":`Saved version:`,可用:`Usable`,需要修复:`Needs repair`,有未保存修改:`Unsaved changes`,草稿与已保存版本一致:`Draft matches the saved version`,内容包文件统计:`Content-package file counts`,全部文件:`All files`,开场白:`Opening text`,世界内容:`World content`,控制文件:`Control files`,内容包文件:`Content-package files`,当前草稿:`Current draft`,文件:`Files`,筛选文件:`Filter files`,"人物、地点或文件名":`Character, location, or file name`,内容包文件树:`Content-package file tree`,"没有匹配的文件。":`No files match.`,新建文件:`Create file`,新文件路径:`New file path`,"新文件先加入本地草稿;Runtime 会在整批保存时检查路径与内容。":`A new file is added to the local draft first. Runtime validates its path and content when the whole draft is saved.`,加入草稿:`Add to draft`,文件编辑器:`File editor`,当前草稿没有文件:`The current draft has no files`,"从左侧新建第一份文件,或返回工作区导入已有内容包。":`Create the first file from the left, or return to the workspace and import an existing content package.`,从草稿移除:`Remove from draft`,文件路径:`File path`,应用新路径:`Apply new path`,二进制资源不在文本编辑器展开:`Binary resources are not expanded in the text editor`,"当前 Base64 内容会原样保留;如需替换资源,请重新导入内容包。":`The current Base64 content is preserved exactly. Reimport the content package to replace the resource.`,文件内容:`File content`,"Ctrl / ⌘ + S 整批保存":`Ctrl / ⌘ + S saves the whole draft`,行:`Lines`,字符:`Characters`,已保存版本诊断:`Saved-version diagnostics`,已保存版本有:`The saved version has`,"已保存版本有 {count} 项需要修复":`The saved version has {count} issue(s) to repair`,项需要修复:`issue(s) to repair`,"诊断对应上一次保存;整批保存后会按新草稿重新检查。":`Diagnostics describe the last save. Saving the whole draft checks the new draft again.`,草稿尚未保存:`Draft not saved`,当前树已保存:`Current tree saved`,"保存会把整棵草稿作为一个候选原子替换,不会逐文件提交。":`Saving atomically replaces the entire tree with one candidate; files are not committed one at a time.`,整批保存:`Save all changes`,放弃未保存修改:`Discard unsaved changes`,内容包操作:`Content-package actions`,"请先整批保存或放弃当前草稿,再操作已保存内容包。":`Save or discard the current draft before acting on the saved content package.`,内容包标题:`Content-package title`,导入的内容包:`Imported content package`,重命名:`Rename`,复制为新本地身份:`Copy as a new local identity`,"导出 ZIP":`Export ZIP`,删除内容包:`Delete content package`,"请输入文件路径。":`Enter a file path.`,"路径必须是使用 / 的内容包相对路径。":`The path must be relative to the content package and use / separators.`,"路径不能包含空目录、. 或 ..。":`The path cannot contain empty directories, . or ...`,"当前文件原生 V1 不接受 manifest 或 JSON 内容文件。":`File-native V1 does not accept a manifest or JSON content files.`,"当前草稿中已经存在同一路径。":`The current draft already contains that path.`,二进制资源:`Binary resource`,玩家首次行动前看到的开场白:`Opening text shown before the player's first action`,会复制为世界状态的设定文档:`Setting document copied into world state`,会复制为世界控制的作者资产:`Author asset copied into world control`,内容包文本资源:`Content-package text resource`,"写下玩家首次行动前立即看到的局面……":`Describe the situation visible immediately before the player's first action…`,"$document:\n id: character.example\n ref: example\n title: 示例人物\n summary: 一句话稳定简介。\n aliases: []\n":`$document:
10
+ id: character.example
11
+ ref: example
12
+ title: Alex Morgan
13
+ summary: A stable one-sentence description.
14
+ aliases: []
15
+ `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
16
+ $document:
17
+ id: rule.example
18
+ ref: example
19
+ title: Example rule
20
+ summary: A stable one-sentence description.
21
+ aliases: []
22
+ ---
23
+
24
+ # Example rule
25
+ `,"输入 UTF-8 文本内容……":`Enter UTF-8 text…`,确认修正内容:`Review correction`,份文档会变化:`document(s) will change`,修正前:`Before correction`,修正后:`After correction`,"查看内容 hash":`View content hash`,"查看端点、附加材料和下一次提示词":`View the endpoint, additional material, and next prompt`,父端点:`Parent endpoint`,候选版本:`Candidate version`,完整附加材料清单差异:`Complete additional-material diff`,下一次真实提示词:`Next real Prompt Preview`,应用这笔修正:`Apply this correction`,放弃修正草稿:`Discard correction draft`,世界文件:`World files`,"当前 state 文档":`Current state documents`,尚无已提交叙事:`No committed narrative yet`,"Runtime 诊断":`Runtime diagnostics`,"创建 operation":`Creation operation`,历史条目:`History entries`,没有文件:`No files`,继续游玩:`Continue playing`,世界:`Worlds`,进入世界:`Open world`,删除:`Delete`,世界名称:`World name`,保存世界名称:`Save world name`,保存:`Save`,取消:`Cancel`,还没有正在游玩的世界:`No worlds in play yet`,"先新建内容包,或上传一份 ZIP,再整理开场与世界文档并创建独立世界。":`Create a content package or upload a ZIP, then prepare its opening and world documents and create an independent world.`,工作区状态:`Workspace status`,当前预设:`Current preset`,尚未选择:`Not selected`,可用内容包:`Usable content packages`,份:`total`,"内容包是世界模板;创建后的世界会独立保存状态、控制与历史。":`A content package is a world template. A created world stores its own state, control, and history.`,创作工作台:`Authoring workbench`,"四个入口各自完成一件事,运行中的世界从上方直接进入。":`Each of the four entries has one job. Open active worlds directly above.`,四个任务入口:`Four task entries`,内容编辑:`Content editing`,"和 AI 边聊边完善内容包,也可随时打开文件编辑与预览。":`Discuss and improve a content package with AI, while keeping file editing and preview one click away.`,"编辑内容包里的开场、世界文档与控制文件。":`Edit a content package's opening, world documents, and control files.`,从空白内容包开始:`Start with a blank content package`,预设:`Presets`,"编辑提示块库、叙事规则、后置请求与扩展资源。":`Edit prompt blocks, narrative rules, follow-up requests, and extension resources.`,选择预设:`Choose a preset`,"从一份可用内容包复制出独立演化的世界。":`Copy a usable content package into an independently evolving world.`,需要可用内容包:`Usable content package required`,提示词预览:`Prompt Preview`,"检查真实 role、材料、工具、预算与缓存边界。":`Inspect real roles, material, tools, budgets, and cache boundaries.`,模型已就绪:`Model ready`,需要模型连接:`Model connection required`,新建内容包:`Create content package`,待修复:`Needs repair`,"可编辑、预览并创建新世界":`Ready to edit, preview, and create a world`,打开并修复当前树中的问题:`Open and repair issues in the current tree`,从一组人类可读文件开始:`Start with human-readable files`,"内容包由 opening.md、world 与 control 组成,可以从空白新建,也可以上传一份内容包 ZIP。":`A content package contains opening.md, world, and control. Create one from scratch or upload a content-package ZIP.`,"导入 ZIP":`Import ZIP`,"选择本应用导出或遵循相同结构的内容包 ZIP;导入会创建新的本地身份,不覆盖同名内容包。":`Choose a ZIP exported by this app or one with the same structure. Import creates a new local identity and never overwrites a package with the same name.`,"内容包 ZIP":`Content-package ZIP`,"内容包 ZIP 文件":`Content-package ZIP file`,"选择 ZIP 文件":`Choose ZIP file`,"正在导入…":`Importing…`,默认模型:`Default model`,"模型连接已保存并启用;后续请求只使用当前配置。":`The model connection was saved and enabled. Later requests use only the current configuration.`,"已切换当前模型配置;Runtime 不会自动故障转移。":`The current model configuration was switched. Runtime does not fail over automatically.`,"模型配置已从本机删除。":`The model configuration was deleted from this device.`,"已克隆为「{name}」。副本保留本机凭据,但不会切换当前配置。":`Cloned as “{name}”. The copy keeps the locally stored credential without switching the active configuration.`,"保存多份本机配置并明确切换。API Key 不会返回浏览器;切换失败时 Runtime 不会悄悄改用另一份配置。":`Save multiple local configurations and switch explicitly. API keys are never returned to the browser, and Runtime does not silently use another configuration when a switch fails.`,当前配置:`Current configuration`,尚未启用:`Not enabled`,先保存一份可用连接:`Save a usable connection first`,新建配置:`New configuration`,编辑配置:`Edit configuration`,新建另一份:`Create another`,提供商:`Provider`,配置名称:`Configuration name`,协议适配器:`Protocol adapter`,已填入:`Using`,"的内置端点;手动修改后按自定义端点保存。":`'s built-in endpoint. After a manual edit it will be saved as a custom endpoint.`,新配置必填:`Required for a new configuration`,留空以沿用本机保存的现有凭据:`Leave blank to reuse the existing credential saved on this device`,"编辑已有配置时,API Key 留空会把本机保存的现有凭据用于当前协议和端点;填写新值会覆盖它。":`When editing an existing configuration, leaving API Key blank reuses the credential saved on this device for the current protocol and endpoint. Enter a new value to replace it.`,"模型 ID":`Model ID`,"正在拉取…":`Fetching…`,从端点拉取模型:`Fetch models from endpoint`,"可在模型 ID 输入框中选择已拉取结果。":`Fetched results can be selected in the Model ID field.`,"真实 context window":`Actual context window`,"最大输出 tokens":`Maximum output tokens`,"正在保存…":`Saving…`,保存模型连接并启用:`Save and enable model connection`,放弃修改:`Discard changes`,重置新配置:`Reset new configuration`,已保存模型配置:`Saved model configurations`,已保存配置:`Saved configurations`,"尚未保存模型配置。":`No model configurations saved yet.`,当前使用:`In use`,模型:`Model`,端点:`Endpoint`,"窗口 / 输出":`Window / output`,凭据:`Credential`,已保存在本机:`Saved on this device`,未配置:`Not configured`,"正在切换…":`Switching…`,切换到此配置:`Switch to this configuration`,"(副本)":` (copy)`,"(副本 {number})":` (copy {number})`,"正在克隆…":`Cloning…`,克隆配置:`Clone configuration`,"Runtime 没有返回已克隆的模型配置":`Runtime did not return the cloned model configuration`,无法生成不重复的副本名称:`Could not generate a unique copy name`,正在编辑:`Editing`,编辑:`Edit`,"正在删除…":`Deleting…`,"先切换到另一份配置,才能删除当前配置。":`Switch to another configuration before deleting the current one.`,模型配置操作失败:`Model-configuration action failed`};Object.assign(h,{玩法预设操作失败:`Play-preset action failed`,"当前玩法有未保存修改;请先保存或撤销,再切换预设。":`The current play preset has unsaved changes. Save or discard them before switching presets.`,"已撤销当前未保存修改。":`Current unsaved changes were discarded.`,"preset.yaml/call-chain.yaml 与结构化编辑同时修改;请保留一种编辑方式后再保存,避免静默覆盖。":`preset.yaml/call-chain.yaml and the structured editor were both changed. Keep one version before saving to avoid a silent overwrite.`,"玩法文件与结构化草稿已保存。":`Play files and the structured draft were saved.`,"玩法预设业务文件已导出。":`Play-preset files were exported.`,"导入文件必须是 UTF-8 玩法业务文件数组":`The imported file must be an array of UTF-8 play files`,导入玩法:`Import play preset`,"玩法预设已导入为新的本地身份;请显式启用其中的 JavaScript。":`The play preset was imported as a new local identity. Enable its JavaScript explicitly if you trust it.`,玩法预设:`Play presets`,"在同一处管理设定完善方法、主持规则、调用链、界面产物与可信本地代码。":`Manage setting-improvement methods, host rules, call chains, interface artifacts, and trusted local code in one place.`,新调用链与设定完善当前使用:`New call chains and setting-improvement sessions currently use`,未选择:`Not selected`,"已经开始的模型会话继续使用冻结 revision":`Model sessions already in progress keep their frozen revision`,玩法预设工作区:`Play-preset workspace`,玩法预设列表:`Play-preset list`,本地预设:`Local presets`,"选择一个本地身份开始编辑。":`Choose a local identity to start editing.`,当前玩法:`Current play preset`,结构有效:`Structure valid`,需要修复:`Needs repair`,已停用:`Disabled`,新建与导入玩法预设:`Create and import play presets`,新建或导入:`Create or import`,新玩法预设名称:`New play-preset name`,"已新建普通玩法预设。":`A regular play preset was created.`,新建空白预设:`Create blank preset`,复制推荐:`Copy recommended preset`,导入玩法文件:`Import play files`,导入玩法预设文件:`Import play-preset file`,"还没有玩法预设。":`There are no play presets yet.`,玩法预设文件编辑器:`Play-preset file editor`,"· 修改只影响之后开始的全新上下文":`· Changes affect only new contexts started later`,未保存修改:`Unsaved changes`,已保存:`Saved`,"JavaScript 已启用":`JavaScript enabled`,"JavaScript 已停用":`JavaScript disabled`,预设名称:`Preset name`,玩法预设名称:`Play-preset name`,预设操作:`Preset actions`,玩法预设身份管理:`Play-preset identity management`,"这些操作只管理这份本地预设;内容编辑和保存仍在页面底部完成。":`These actions manage only this local preset. Edit and save its content at the bottom of the page.`,"玩法预设状态已更新。":`Play-preset status updated.`,启用预设:`Enable preset`,停用预设:`Disable preset`,"JavaScript 已停用;raw/document 仍可预览。":`JavaScript is disabled; raw and document content can still be previewed.`,"JavaScript 已显式启用(本地可信代码)。":`JavaScript is explicitly enabled as trusted local code.`,"停用 JavaScript":`Disable JavaScript`,"启用 JavaScript(本地可信代码)":`Enable JavaScript (trusted local code)`,"已复制为独立本地身份。":`Copied as an independent local identity.`,复制为新预设:`Copy as new preset`,导出业务文件:`Export play files`,"玩法预设已删除;删空后会自动重建默认预设。":`The play preset was deleted. Deleting the last preset automatically rebuilds the default.`,删除预设:`Delete preset`,"导入的 JavaScript 默认停用;启用表示你信任这些本地文件,而不是获得安全沙箱保证。":`Imported JavaScript is disabled by default. Enabling it means you trust these local files; it does not provide a security sandbox.`,玩法预设摘要:`Play-preset summary`,后置请求:`Follow-up requests`,产物输出:`Artifact outputs`,界面挂载:`Interface mounts`,普通文件:`Regular files`,玩法预设编辑区域:`Play-preset editing area`,"该玩法文件路径已经存在。":`That play-file path already exists.`,"已加入普通文件草稿;保存时会通过 codec 校验。":`The regular file was added to the draft and will be validated by the codec when saved.`,结构化编辑暂不可用:`Structured editing is unavailable`,"当前草稿无法生成结构投影。请到“高级文件”修复 preset.yaml 或 call-chain.yaml,保存后再回来。":`The current draft cannot produce a structured projection. Repair preset.yaml or call-chain.yaml under Advanced files, save, and return here.`,前往高级文件:`Go to Advanced files`,预览当前预设:`Preview current preset`,"产物外观与真实调用链提示词都留在这里检查,不会调用模型或离开当前预设。":`Inspect artifact appearance and real call-chain prompts here without calling a model or leaving the current preset.`,"正在生成真实编译/产物预览…":`Generating real compilation and artifact previews…`,工作台静态错误:`Workbench static error`,当前预设的真实提示词预览:`Real prompt preview for the current preset`,真实调用链预览:`Real call-chain preview`,"请先保存当前修改;真实预览只编译已冻结的有效 revision。":`Save the current changes first. A real preview compiles only a frozen valid revision.`,"当前 revision 需要修复,暂时不能编译真实调用链。":`The current revision needs repair and cannot compile a real call chain yet.`,"当前宿主没有提供提示词预览面板。":`The current host does not provide a Prompt Preview panel.`,"preset.yaml/call-chain.yaml 与结构化字段均有未保存修改;请撤销其中一侧后再保存,避免 stale structure 覆盖 raw YAML。":`preset.yaml/call-chain.yaml and structured fields both have unsaved changes. Discard one side before saving so stale structure cannot overwrite raw YAML.`,草稿尚未保存:`Draft not saved`,结构校验通过:`Structure validation passed`,草稿需要修复:`Draft needs repair`,撤销未保存修改:`Discard unsaved changes`,保存修改:`Save changes`,"已将该冻结 revision 设为当前玩法。":`That frozen revision is now the current play preset.`,应用为当前玩法:`Use as current play preset`,"AI 设定完善":`Setting improvement`,"这份文字决定 AI 怎样理解、规划和创作内容包设定;每次开始完善时会冻结当前预设 revision。":`This text tells the model how to understand, plan, and author content-package settings. Each session freezes the current preset revision.`,"工具为什么不在这里?":`Why are the tools not editable here?`,"Runtime 继续内置 setting_* 工具定义、参数、说明和当前树直接结算协议。预设只能编辑创作语义,不能替换这些机械契约。":`Runtime owns the setting_* definitions, parameters, descriptions, and direct current-tree settlement protocol. A preset can edit authoring semantics but cannot replace these mechanical contracts.`,沿用系统推荐提示:`Use the system-recommended prompt`,"这是一份功能加入前保存的 v1 预设。打开页面不会改写它;写入后才会产生新的预设 revision。":`This v1 preset was saved before the feature existed. Opening this page does not rewrite it; writing the prompt creates a new preset revision.`,系统推荐设定完善提示词:`System-recommended setting-improvement prompt`,写入预设并编辑:`Write into preset and edit`,设定完善创作提示:`Setting-improvement authoring prompt`,"# 叙事规则\n\n说明 AI 每次写玩家可见正文时都应遵守的规则。\n":`# Narrative rules
26
+
27
+ Describe the rules the model must follow whenever it writes player-visible prose.
28
+ `,"# 新后置请求\n\n说明主调用链完成后,需要额外整理成什么界面内容。\n":`# New follow-up request
29
+
30
+ Describe the interface content to prepare after the main call chain completes.
31
+ `,新后置请求:`New follow-up request`,调用链:`Call chain`,界面扩展:`Interface extensions`,"先编辑 AI 主响应要遵守的文字规则,再按需添加主响应结束后的界面产物。提示内容直接显示,不需要填写文件路径。":`Edit the prose rules for the model's main response, then add interface artifacts after it as needed. Prompt content appears directly; no file path is required.`,"选择产物显示在哪里,并用普通表单配置玩家视图和扩展文件;无需手写 JSON。":`Choose where artifacts appear and configure player views and extension files with regular forms; no handwritten JSON is needed.`,"保存有效 revision 后生成真实预览。":`Save a valid revision to generate real previews.`,"频道是什么?":`What is a channel?`,"频道只是“产物送到哪里”的内部连线:后置请求产出内容,页面按同名频道把它放到你选择的位置。普通编辑只需选显示位置,技术地址会自动保留。":`A channel is the internal connection that routes an artifact. A follow-up produces content, and the page places it at the location selected for the matching channel. Regular editing only chooses a display location; the technical address is preserved automatically.`,产物显示位置:`Artifact display locations`,"每项都来自“调用链”中的一个真实产物输出。":`Every item comes from a real artifact output in the call chain.`,"当前没有后置产物。先在“调用链”新增后置请求,这里才会出现可放置的内容。":`There are no follow-up artifacts. Add a follow-up request under Call chain before choosing where its content appears.`,显示位置:`Display location`,未连接到当前产物的旧频道:`Legacy channels not connected to current artifacts`,随预设加载的界面文件:`Interface files loaded with the preset`,"勾选 renderer、脚本和样式等前端资源。这里只选择已有文件,不需要写数组格式。":`Select existing frontend resources such as renderers, scripts, and styles. No array syntax is needed.`,界面扩展文件:`Interface-extension files`,"当前还没有 renderer、脚本或样式文件。":`There are no renderer, script, or style files yet.`,叙事提示块:`Narrative prompt blocks`,新增叙事提示块:`Add narrative prompt block`,"这些文字和主持规则一起进入稳定 bootstrap,约束调用链中的玩家可见正文。下方直接显示真实内容。":`These blocks enter the stable bootstrap with the host rules and constrain player-visible prose in the call chain. Their real content appears below.`,"尚未声明叙事提示块;通用文风仍由主持块提供。":`No narrative prompt blocks are declared; the host blocks still provide the general prose style.`,删除:`Delete`,新增后置请求:`Add follow-up request`,"每个后置请求在主调用链完成后单独派发一次,共用同一段冻结前缀,彼此看不见对方,也不会进入之后的模型上下文。请求提示、产物格式和显示位置都可在当前页面编辑。":`Each follow-up is dispatched once after the main call chain. They share the same frozen prefix, cannot see one another, and never enter later model context. Edit each request prompt, artifact format, and display location here.`,"没有后置请求;主调用链完成后不会再派发额外请求。":`There are no follow-up requests; no additional request is dispatched after the main call chain.`,显示名:`Display name`,这次额外请求要做什么:`What should this additional request do?`,输出到界面的产物:`Artifacts output to the interface`,"产物不是世界事实;它只是这次额外请求生成的界面内容。":`An artifact is not a world fact; it is interface content generated by this additional request.`,新增产物:`Add artifact`,"后置请求至少需要一项产物才能保存为有效预设。":`A follow-up request needs at least one artifact before the preset can be saved as valid.`,高级请求设置:`Advanced request settings`,稳定标识:`Stable identifier`,"本次所有产物合计上限(bytes)":`Combined limit for all artifacts in this request (bytes)`,"正在读取产物预览……":`Loading artifact preview…`,不在页面显示:`Do not display on the page`,使用哪份内容:`Content to use`,"这份提示文件不存在;请改选已有内容或到高级文件修复。":`This prompt file does not exist. Choose existing content or repair it under Advanced files.`," 不在页面显示":` Not displayed on the page`,删除产物:`Delete artifact`,产物标识:`Artifact identifier`,内容格式:`Content format`,"Markdown 文本":`Markdown text`,纯文本:`Plain text`,结构化数据:`Structured data`,同频道已有内容时:`When the channel already has content`,替换上一份:`Replace previous item`,追加一份:`Append an item`,"按 key 更新":`Update by key`,仅短暂显示:`Display briefly`,保存但不显示:`Save without displaying`,"AI 必须生成这项产物":`The model must generate this artifact`,高级产物设置:`Advanced artifact settings`,技术频道地址:`Technical channel address`,"更新 key":`Update key`,保存到:`Retain in`,随权威提交保留:`Keep with the authority commit`,只保留到本次操作结束:`Keep until this operation ends`,不持久保存:`Do not persist`,何时失效:`Expiration`,下一次操作开始:`When the next operation starts`,世界端点变化:`When the world endpoint changes`,本次操作结束:`When this operation ends`,显式清除:`When explicitly cleared`,永不自动失效:`Never expire automatically`,单次最多输出次数:`Maximum outputs per request`,界面模板:`Interface template`,使用内置显示:`Use built-in display`,"模板 revision":`Template revision`,模板模式:`Template mode`,静态文档:`Static document`,"可交互 app":`Interactive app`,正则处理规则:`Regex processing rules`,不使用:`None`,脚本:`Scripts`,"没有脚本文件。":`No script files.`,样式与资源:`Styles and resources`,"没有资源文件。":`No resource files.`,"当前严格数据格式(只读)":`Current strict data format (read-only)`,"常用设置无需改它;需要重写完整 contract 时再到高级文件编辑 call-chain.yaml。":`Common settings do not require editing this data. Use call-chain.yaml under Advanced files only when replacing the full contract.`,未命名提示内容:`Untitled prompt content`,玩家状态:`Player status`,"当前没有可显示内容。":`There is no content to display.`,玩家视图面板:`Player-view panels`,"把世界控制里已经定义好的玩家视图,持续显示在游玩页面。它不调用模型,也不改世界。":`Keep player views defined in world control visible on the play page. This does not call a model or change the world.`,新增玩家视图面板:`Add player-view panel`,"当前没有玩家视图面板。":`There are no player-view panels.`,玩家视图:`Player view`,删除面板:`Delete panel`,面板标题:`Panel title`,读取哪个玩家视图:`Player view to read`,排列方式:`Layout`,纵向排列:`Vertical`,网格排列:`Grid`,没有内容时:`When empty`,隐藏面板:`Hide panel`,显示说明:`Show explanation`,显示空值:`Show empty values`,空内容说明:`Empty-state explanation`,高级面板设置:`Advanced panel settings`,面板稳定标识:`Stable panel identifier`,技术频道:`Technical channel`,主题标识:`Theme identifier`,"只显示这些项目(每行一个,可留空)":`Show only these items (one per line; may be empty)`,分组:`Groups`,"把已选项目按组显示;每个项目 ID 单独一行。":`Display selected items in groups; enter one item ID per line.`,新分组:`New group`,新增分组:`Add group`,分组标题:`Group title`,分组标识:`Group identifier`,"项目 ID(每行一个)":`Item IDs (one per line)`,删除分组:`Delete group`,完整预设文件:`Complete preset files`,"常用设置应在前面的表单完成。这里保留完整 YAML、Markdown、HTML、脚本和样式,并说明每份文件负责什么。":`Use the earlier forms for common settings. This section keeps complete YAML, Markdown, HTML, scripts, and styles and explains each file's responsibility.`,"三个核心 YAML 文件的用途":`Purpose of the three core YAML files`,快速跳转文件:`Quick file navigation`,玩法预设文件:`Play-preset files`,玩法预设文件列表:`Play-preset file list`,完整文件内容:`Complete file content`,新增高级文件:`Add advanced file`,"新文件路径(prompt/regex/renderer/script/asset)":`New file path (prompt/regex/renderer/script/asset)`,新增玩法文件路径:`New play-file path`,加入文件草稿:`Add file to draft`,预设入口:`Preset entry point`,"核心 YAML":`Core YAML`,"连接设定完善提示、调用链、界面显示位置、玩家视图面板和扩展资源;它回答“这份预设由哪些部分组成”。":`Connects the setting-improvement prompt, call chain, display locations, player-view panels, and extension resources. It defines the parts of this preset.`,调用链与产物:`Call chain and artifacts`,"声明主响应使用哪些叙事提示、结束后有哪些后置请求,以及每个请求可以生成什么产物。":`Declares the narrative prompts used by the main response, its follow-up requests, and the artifacts each request can produce.`,主持规则顺序:`Host-rule order`,"决定 Runtime 机械说明、主持规则块和世界指令以什么顺序进入稳定 bootstrap。":`Determines the order in which Runtime instructions, host-rule blocks, and world instructions enter the stable bootstrap.`,主持规则:`Host rules`,"跨世界成立的主持语义;是否发送给模型以及发送顺序由“提示内容”页控制。":`Host semantics shared across worlds. The Prompt content page controls whether and in what order they are sent to the model.`,设定完善提示:`Setting-improvement prompt`,"约束 AI 怎样理解、规划和创作内容包;工具定义、参数与说明仍由 Runtime 内置。":`Constrains how the model understands, plans, and authors a content package. Runtime still owns tool definitions, parameters, and descriptions.`,调用链提示:`Call-chain prompt`,"主响应或某个后置请求实际读取的 Markdown 指令;普通编辑可在“调用链”直接修改。":`Markdown instructions read by the main response or a follow-up. Edit them directly under Call chain.`,"把产物内容或玩家视图变成页面上的 HTML 结构。":`Turns artifact content or player views into HTML on the page.`,界面交互脚本:`Interface interaction scripts`,"为 renderer 添加本地交互;导入预设后默认停用,只有显式信任后才执行。":`Adds local interaction to a renderer. Imported scripts are disabled until explicitly trusted.`,界面样式或资源:`Interface styles or resources`,扩展资源:`Extension resources`,"供 renderer 或脚本读取的样式、文字或其他普通资源。":`Styles, text, or other regular resources read by a renderer or script.`,产物文本处理规则:`Artifact text-processing rules`,"在显示前对产物正文执行有界、可预览的正则处理。":`Runs bounded, previewable regex processing on artifact content before display.`,未命名文件:`Untitled file`,"随玩法预设保存和导出的普通业务文件。":`A regular play file saved and exported with the preset.`,真实产物预览:`Real artifact preview`,"保存有效 revision 后可预览产物 contract、regex 与冻结 renderer。":`Save a valid revision to preview artifact contracts, regex processing, and frozen renderers.`,"真实产物预览(只读)":`Real artifact preview (read-only)`,"样例由当前冻结文件生成;此处不调用模型、不写入世界,只复用生产 regex/renderer 编码。":`Samples come from the current frozen files. This preview calls no model, writes no world state, and reuses the production regex and renderer code.`,"当前预设没有 artifact output contract。":`The current preset has no artifact output contract.`,"raw/document fallback 失败":`Raw/document fallback failed`,"renderer 预览失败":`Renderer preview failed`,"内置 renderer 预览失败":`Built-in renderer preview failed`,"这是当前样例实际显示在游戏页面上的效果;不会调用模型或写入世界。":`This is how the current sample actually appears on the play page. It does not call a model or write to the world.`,"JavaScript 已停用;app 样例仅以 raw/document fallback 显示,不执行作者脚本。":`JavaScript is disabled. The app sample uses only the raw/document fallback and does not execute author scripts.`,页面上的效果:`Appearance on the page`,"无自定义 renderer;使用内置文本/Markdown/HTML renderer。":`No custom renderer; using the built-in text, Markdown, or HTML renderer.`,无法生成预览:`Unable to generate preview`,"技术细节:频道、处理规则与产物协议":`Technical details: channels, processing rules, and artifact protocol`,"raw payload 与 emit schema":`Raw payload and emit schema`,"regex pipeline / 最终内容":`Regex pipeline / final content`,"emit 后:":`After emit:`,");explicit clear 后:":`); after explicit clear:`,"触发后:":`After trigger:`,"app 初始消息(只读协议预览)":`Initial app messages (read-only protocol preview)`,"app preview ready;已发送 render.update。":`App preview ready; render.update sent.`,"等待 app preview ready…":`Waiting for app preview ready…`,"frame.yaml 无法更新。":`frame.yaml could not be updated.`,主持规则内容:`Host-rule content`,"直接阅读和编辑每条跨世界主持规则。启用的规则按顺序进入模型;停用只是不发送,内容仍会随预设保存和导出。":`Read and edit each cross-world host rule directly. Enabled rules enter the model in order. Disabled rules are not sent but remain saved and exported with the preset.`,"frame.yaml 在这里做什么?":`What does frame.yaml do here?`,"它只保存“哪些主持规则已启用、按什么顺序发送”。你在下方勾选或排序时,页面会同步更新它,不必手写路径。":`It stores only which host rules are enabled and their send order. The page updates it when you select or reorder rules; no path editing is needed.`,"frame.yaml 引用了不存在的块:":`frame.yaml references a missing block:`,"当前预设还没有主持规则内容。":`The current preset has no host-rule content.`,主持规则列表:`Host-rule list`,未启用:`Disabled`,已启用:`Enabled`,发送给模型:`Send to model`,上移:`Move up`,下移:`Move down`,完整规则内容:`Complete rule content`,"roles.author_instruction 必须是数组":`roles.author_instruction must be an array`}),Object.assign(h,{"我观察当前场景。":`I observe the current scene.`,"真实编译已完成;没有调用模型,也没有改变内容或世界。":`Real compilation completed without calling a model or changing content or world state.`,全新上下文会发送什么:`What a new context sends`,"真实编译,0 次模型调用,不会创建对话或写入权威状态。":`Real compilation, zero model calls, and no conversation creation or authority writes.`,提示词预览:`Prompt Preview`,"用真实编译器检查全新上下文会发送什么:逻辑 role、Markdown、材料、工具、预算与 Provider 映射。":`Use the real compiler to inspect what a new context sends: logical roles, Markdown, material, tools, budgets, and Provider mapping.`,预览性质:`Preview properties`,只读检查:`Read-only inspection`,"0 次模型调用":`Zero model calls`,不会创建对话或写入权威状态:`Does not create conversations or write authority state`,决定这次检查什么:`Choose what to inspect`,"内容包首轮 · 全新上下文":`Content-package first turn · new context`,"还没有内容包。先新建并修好一份内容包,才能编译真实提示词。":`There are no content packages. Create and repair one before compiling a real prompt.`,内容包:`Content package`,预览内容包:`Content package to preview`," · 需要修复":` · needs repair`,预览玩家输入:`Preview player input`,"这段原文只进入本次预览,不会写入历史,也不会成为真实玩家行动。":`This text enters only the preview. It is not written to history or treated as a real player action.`,"这份内容包仍需修复;真实首轮预览要求有效的 opening.md、世界文档和控制框架。":`This content package still needs repair. A real first-turn preview requires a valid opening.md, world documents, and control frame.`,"正在编译真实预览…":`Compiling real preview…`,生成真实预览:`Generate real preview`,重新生成真实预览:`Regenerate real preview`,本次固定绑定:`Bindings fixed for this preview`,主持预设:`Host preset`,没有当前预设:`No current preset`,工作区当前选择:`Current workspace selection`,模型连接:`Model connection`,没有当前模型:`No current model`,请先配置并启用模型:`Configure and enable a model first`,模型窗口:`Model window`,开场白边界:`Opening-text boundary`,不作为模型历史注入:`Not injected as model history`,"opening.md 只保留为玩家可见的 genesis 叙事":`opening.md remains only as player-visible genesis narrative`,玩法预设:`Play preset`,使用内置玩法的完整工具集合:`Use the built-in play preset's complete tool set`,等待生成预览:`Waiting to generate preview`,生成后按四个视角检查:`Inspect the result from four perspectives`,"逻辑消息、材料与工具、Provider 映射、预算与诊断。":`Logical messages, material and tools, Provider mapping, and budgets and diagnostics.`,未知预设:`Unknown preset`,编译通过:`Compilation passed`,编译检查结果:`Compilation checks`,"Runtime 不预估上下文":`Runtime does not estimate context`,预算可容纳:`Within budget`,内部字段无泄漏:`No internal-field leakage`,权威状态未改变:`Authority state unchanged`,逻辑消息:`Logical messages`,"稳定 bootstrap":`Stable bootstrap`,";另有 1 条玩家追加":`; plus one player append`,真实工具:`Real tools`,生产调用链全集:`Complete production call-chain set`,上下文检查:`Context check`,所需上下文:`Required context`,"由 Provider 判断":`Determined by Provider`,"Runtime 不据此拦截请求":`Runtime does not block requests on this basis`,窗口配置:`Window configuration`,窗口占用:`Window usage`,上下文窗口占用:`Context-window usage`,预览结果分区:`Preview sections`,玩法绑定:`Play binding`,材料与工具:`Material and tools`,"Provider 映射":`Provider mapping`,预算与诊断:`Budget and diagnostics`,首条玩家追加:`First player append`,"稳定 bootstrap 之后,玩家原文作为普通 user 消息原样追加。":`After the stable bootstrap, the player's original text is appended unchanged as a regular user message.`,玩法绑定与调用链工具:`Play binding and call-chain tools`,"· 叙事规则进入稳定 bootstrap, 后置请求在主调用链完成后独立派发。":`· Narrative rules enter the stable bootstrap; follow-up requests are dispatched independently after the main call chain.`,玩法文件:`Play files`,"冻结工具、叙事规则与后置产物契约":`Frozen tools, narrative rules, and follow-up artifact contracts`,工具全集:`Complete tool set`,"Provider 工具策略":`Provider tool strategy`,"definitions:稳定全集":`Definitions: stable complete set`,稳定前缀:`Stable prefix`,频道挂载:`Channel mounts`,无:`None`,"全新上下文发送这份稳定前缀;玩家原文随后作为普通消息追加。Runtime 不再插入裁决、叙事或结算 delta。":`A new context sends this stable prefix, then appends the player's original text as a regular message. Runtime no longer inserts adjudication, narrative, or settlement deltas.`,条逻辑消息:`logical message(s)`,"调用链可用工具:":`Call-chain tools:`,"· 后置请求:":`· Follow-up requests:`,"这次编译没有逻辑消息。":`This compilation has no logical messages.`,"逻辑消息与最终 Markdown":`Logical messages and final Markdown`,"这里先保留产品逻辑 role;Provider 如何映射在下一分区单独展示。":`This view preserves product-level logical roles. The next section shows how Provider mapping changes them.`,逻辑消息顺序:`Logical-message order`,块:`blocks`,字符:`characters`,消息块来源:`Message-block sources`,"最终 Markdown 正文":`Final Markdown body`,块之间已按真实编译顺序合并:`Blocks merged in the real compilation order`,材料覆盖与调用链工具:`Material coverage and call-chain tools`,"来源由真实 slot 展开;未提供边界和可继续读取入口不会被隐藏。":`Sources are expanded from real slots. Missing boundaries and continuation entries remain visible.`,"Slot 覆盖":`Slot coverage`,项:`items`,来源完整:`Source complete`,来源尚未完整:`Source incomplete`,无需继续读取:`No further read needed`,本次真实工具:`Real tools in this request`,"本次没有按需读取工具。":`This request has no on-demand read tools.`,个:`total`,"查看说明与 input schema":`View description and input schema`,"Provider 映射 ·":`Provider mapping ·`,"展示编译器交给当前 Adapter 的真实 system 块和消息顺序。":`Shows the real system blocks and message order passed from the compiler to the current adapter.`,消息角色与顺序:`Message roles and order`,"条 bootstrap":`bootstrap message(s)`," + 1 条玩家追加":` + one player append`,"紧随 bootstrap 的首条追加":`First append after bootstrap`,原样发送:`Sent unchanged`,"查看 Provider 映射原始结构":`View raw Provider mapping`,消息正文:`Message body`,工具定义:`Tool definitions`,本地输出预留:`Local output reserve`,本地尾部预留:`Local tail reserve`,安全余量:`Safety margin`,"Runtime 不估算上下文,也不会据此拒绝 Provider 请求。":`Runtime does not estimate context and never rejects a Provider request on that basis.`,"所有数值来自本次真实编译结果,不由 Web 重新估算。":`All values come from this real compilation and are not re-estimated by the web app.`,上下文预算:`Context budget`,可容纳:`Fits`,"Provider 窗口配置":`Provider window configuration`,"合计 / 模型窗口":`Total / model window`,"估算器:":`Estimator:`,稳定前缀与缓存:`Stable prefix and cache`,"稳定前缀 fingerprint":`Stable-prefix fingerprint`,缓存断点:`Cache breakpoint`,首个动态边界:`First dynamic boundary`,内部字段泄漏扫描通过:`Internal-field leakage scan passed`,"Runtime 生成正文未发现以下内部字段。":`No listed internal fields were found in Runtime-generated prose.`,查看固定诊断绑定与完整原始结果:`View fixed diagnostic bindings and the complete raw result`,真实提示词编译失败:`Real prompt compilation failed`}),Object.assign(h,{设定完善导航:`Setting-improvement navigation`,设定完善工具:`Setting-improvement tools`,设定完善对话:`Setting-improvement conversation`,历史:`History`,全部收起:`Collapse all`,预览:`Preview`,编辑文件:`Edit files`,预览文件:`Preview files`,收起对话历史:`Close conversation history`,收起文件面板:`Close file panel`,内容包文件编辑:`Content-package file editing`,内容包文件预览:`Content-package file preview`,内容包文件视图:`Content-package file view`,对话历史:`Conversation history`,"删除对话:{title}":`Delete conversation: {title}`,"删除对话“{title}”?只会删除这份对话记录;已经写入内容包当前树的改动不会回滚。此操作无法撤销。":`Delete conversation “{title}”? This removes only the conversation record. Changes already written to the current content-package tree will not be rolled back. This cannot be undone.`,"对话历史已删除;内容包当前树没有回滚。":`Conversation history deleted; the current content-package tree was not rolled back.`,正在预览未保存的文件草稿:`Previewing the unsaved file draft`,正在预览已保存的当前树:`Previewing the saved current tree`,"{count} 份文件":`{count} files`,"当前内容包还没有文件。":`This content package has no files yet.`,新建第一份文件:`Create the first file`,编辑这份文件:`Edit this file`,"二进制资源不在文本预览中展开。":`Binary resources are not expanded in the text preview.`,"和 AI 边聊边改":`Discuss and edit with AI`,"成功的工具改动直接写入内容包当前树;需要核对或手动修改时,从右侧打开文件。":`Successful tool changes write directly to the current content-package tree. Open files on the right to inspect or edit them manually.`,"查看工具步骤文本(未进入最终回复)":`View tool-step text (not included in the final reply)`,正在接收调用详情:`Receiving call details`,"请先保存文件编辑,再继续 AI 设定完善。":`Save the file edits before continuing setting improvement.`,模型:`Model`,逻辑消息:`Logical messages`,工具:`Tools`,上下文检查:`Context check`,预算:`Budget`,"由 Provider 判断":`Determined by Provider`,查看逻辑消息正文:`View logical message bodies`,查看材料覆盖与预算:`View material coverage and budget`,来源:`Source`,状态:`Status`,查看真实工具定义:`View real tool definitions`,"查看最终 Provider 请求结构":`View final Provider request structure`,"先配置并启用模型,才能开始设定完善对话。":`Configure and enable a model before starting a setting-improvement conversation.`,"请先保存或放弃文件编辑中的未保存修改。":`Save or discard the unsaved manual file edits first.`,内容包记录:`Content-package record`,设定完善对话历史:`Setting-improvement conversation history`,"{count} 次对话":`{count} conversations`,未命名对话:`Untitled conversation`,回复中:`Responding`,可继续:`Can continue`,"{turns} 轮对话 · {tools} 次工具 · {files} 个文件":`{turns} turns · {tools} tools · {files} files`,"正在恢复设定完善对话…":`Restoring the setting-improvement conversation…`,"直接说你现在想做什么。":`Say what you want to do now.`,"例如:先帮我梳理人物关系;或者直接把开场改成雨夜码头,并同步当前情境。":`For example: help me reason through the character relationships first; or change the opening to a rainy-night wharf and update the current situation too.`,你:`You`,AI:`AI`,上一次操作未完成:`The previous operation did not complete`,"Enter 发送,Shift + Enter 换行":`Enter to send; Shift + Enter for a new line`,停止回复:`Stop response`,发送:`Send`,"AI 正在处理…":`The model is working…`,"第 {exchange} 次模型交换 · {tools} 次工具调用 · 已接收 {chars} 字":`Model exchange {exchange} · {tools} tool calls · {chars} characters received`,"第 {exchange} 次模型交换":`Model exchange {exchange}`,"{count} 次工具调用":`{count} tool calls`,"等待 Runtime 结果":`Waiting for Runtime result`,"Runtime 工具结果":`Runtime tool result`,"AI · 工具步骤文本":`AI · tool-step text`,正在接收的正文:`Incoming visible text`,"已 {seconds} 秒没有收到新片段,可以停止后继续对话。":`No new fragment for {seconds} seconds. You can stop and continue the conversation.`,"{path} 的完整差异":`Complete diff for {path}`,"{count} 行未变化":`{count} unchanged lines`,删除行:`Removed line`,新增行:`Added line`,未变行:`Unchanged line`,原文件行号:`Original line number`,新文件行号:`New line number`,改动标记:`Change marker`,行内容:`Line content`,原文件无对应行:`No corresponding original line`,新文件无对应行:`No corresponding new line`,"原文件第 {line} 行":`Original line {line}`,"新文件第 {line} 行":`New line {line}`,"请先保存手动编辑,再继续 AI 设定完善。":`Save the manual edits before continuing setting improvement.`,"和 AI 边聊边修改 {packageName}。成功的工具改动会像游玩一样直接写入内容包当前树。":`Discuss and revise {packageName} with the model. Successful tool changes write directly to the content package current tree, just like play.`,全新上下文:`Fresh context`,"AI 建议在此开启全新上下文":`The AI suggests starting a fresh context here`,取消全新上下文:`Cancel fresh context`,下一条消息使用全新上下文:`Use a fresh context for the next message`,玩家输入前的回合提示:`Round marker before player input`," + 1 条回合提示":` + 1 round marker`,"这里没有隔离草稿或应用步骤:每个已完成工具响应的绿色新增和红色删除都已经生效。":`There is no isolated draft or Apply step. Green additions and red removals from every completed tool response are already effective.`,"开始后,对话、Provider 返回内容和已生效差异会保留在这里。":`Conversations, Provider-returned content, and effective diffs remain here after you begin.`,当前所选:`Selected`,最近:`Latest`,下一条消息将开启全新上下文:`The next message starts a fresh context`,"新对话会从内容包当前树重新编译;原有对话仍保留在历史中。":`The new conversation compiles again from the content package current tree; existing conversations remain in history.`,正在继续历史对话:`Continuing a past conversation`,"下一条消息会追加到这段历史的原 Provider 上下文;写入仍以此刻的内容包当前树为准。":`The next message appends to this conversation's original Provider context; writes still target the current content package tree.`,"完整对话和已经结算的当前树改动都已保留,可以直接继续说。":`The complete conversation and every settled current-tree change were retained. You can continue directly.`,"用全新上下文给 AI 发消息":`Message the model in a fresh context`,继续这段对话:`Continue this conversation`,"可以讨论、要求它检查某份设定,也可以直接让它修改内容包。":`You can discuss, ask it to inspect part of the setting, or tell it to edit the content package directly.`,"当时生效 · {count} 个文件":`Effective at the time · {count} files`,当时已生效差异:`Changes applied at the time`,"正在回滚…":`Rolling back…`,回滚这个文件:`Roll back this file`,当前文件已是修改前版本:`This file is already at its pre-edit version`,"已回滚这个文件;对话历史仍然保留。":`This file was rolled back; conversation history remains.`,"当前文件已是修改前版本。":`This file is already at its pre-edit version.`,"Runtime 已确认回滚结果,但重新读取内容包失败:{message}":`Runtime confirmed the rollback result, but reloading the content package failed: {message}`,"迁移前的隔离草稿记录(仅回顾)":`Pre-migration isolated draft record (history only)`,迁移前已应用的差异:`Changes applied before migration`,"迁移前草稿差异(未生效)":`Pre-migration draft changes (not applied)`,"迁移前草稿差异(结果未知)":`Pre-migration draft changes (outcome unknown)`,"这份旧草稿在迁移前已经应用。":`This legacy draft was applied before migration.`,"这份旧草稿在迁移前已经放弃。":`This legacy draft was discarded before migration.`,"这份旧草稿没有自动应用;当前树保持迁移时的真实状态。":`This legacy draft was not auto-applied; the current tree retains its actual state at migration.`,"旧应用收据的结果无法确认;迁移没有改写当前树。":`The old Apply receipt outcome cannot be proven; migration did not modify the current tree.`}),Object.assign(h,{可视化编排:`Visual arrangement`,世界提示框架:`World prompt frame`,"安排世界专属指令与确定性材料位置;这里不保存人物、地点或当前事实。":`Arrange world-specific instructions and deterministic material locations. Characters, places, and current facts are not stored here.`,世界提示框架草稿状态:`World prompt-frame draft status`,"V1 格式":`V1 format`,格式待修复:`Format needs repair`,可视化已同步:`Visual editor synchronized`,"仅可编辑 YAML":`YAML editing only`,"当前 YAML 暂时无法可视化":`Current YAML cannot be visualized yet`,"下面的高级编辑器会原样保留草稿;修复后可视化页面会自动恢复。":`The advanced editor below preserves the draft exactly. The visual editor returns automatically after repair.`,"format 不是当前世界框架版本":`format is not the current world-frame version`,"Runtime 只接受":`Runtime accepts only`,"修复为 V1 格式":`Repair as V1 format`,世界提示框架流程:`World prompt-frame flow`,"Markdown 提示块":`Markdown prompt blocks`,份世界指令:`world instruction(s)`,"进入逻辑 role":`Enter logical role`,精确文档与目录:`Exact documents and directories`,个材料插槽:`material slot(s)`,"01 · 权威绑定":`01 · authority binding`,当前情境绑定:`Current-situation binding`,未解析:`Unresolved`,已解析:`Resolved`,"`current_situation` 插槽会从这里读取唯一当前情境文档,不按文件名或标题猜测。":"The `current_situation` slot reads the one current-situation document bound here; it never guesses from a file name or title.",当前情境文档:`Current-situation document`,选择一份世界文档:`Choose a world document`,"(当前未解析)":`(currently unresolved)`,"02 · 世界专属指令":`02 · world-specific instructions`,提示块顺序:`Prompt-block order`,个块:`blocks`,"这些 Markdown 块按顺序进入主持预设预留的世界指令位置;正文仍在独立文件中编辑。":`These Markdown blocks enter the host preset's world-instruction position in order. Their bodies remain editable in separate files.`,世界指令顺序:`World-instruction order`,引用的文件不存在:`Referenced file does not exist`,调整顺序:`Reorder`,上移:`Move up`,下移:`Move down`,移除:`Remove`,"尚未加入世界提示块。":`No world prompt blocks have been added.`,"要加入的 Markdown 块":`Markdown block to add`,没有可加入的未引用块:`No unreferenced blocks are available`,加入指令顺序:`Add to instruction order`,"03 · 确定性材料":`03 · deterministic material`,上下文材料顺序:`Context-material order`,个插槽:`slots`,"Runtime 只按这些精确位置取材。顺序会进入真实 prompt,但不会推断“相关人物”或“重要历史”。":`Runtime reads material only from these exact locations. The order enters the real prompt, but Runtime never infers related characters or important history.`,从上到下就是实际注入顺序:`Top to bottom is the real injection order`,"每张卡片右上角都有“上移 / 下移”;移动后序号会立即更新。":`Use Move up or Move down on each card. Sequence numbers update immediately.`,必需插槽还未成对:`Required slots are not paired yet`,当前情境:`Current situation`,"个 · 附加材料":` · additional material`,个:`total`,补上当前情境:`Add current situation`,补上附加材料:`Add additional material`,新增材料类型:`Add material type`,新增材料插槽:`Add material slot`,"高级:直接编辑 frame.yaml":`Advanced: edit frame.yaml directly`,"可视化修改会把 YAML 重新整理为稳定格式;需要修复未知字段或保留当前原文时可在这里编辑。":`Visual changes rewrite YAML into a stable format. Edit here to repair unknown fields or preserve the current source exactly.`,"直接编辑 control/frame.yaml":`Edit control/frame.yaml directly`,调整注入顺序:`Change injection order`,"YAML 路径":`YAML path`,"Markdown 标题路径":`Markdown heading path`,"选择实际 YAML 文件":`Choose an actual YAML file`,历史消息句柄:`History-message handle`,选择实际文档文件:`Choose an actual document file`,"只列出内容包中带可识别 $document 技术头的实际文件。":`Only actual files with a recognizable $document technical header are listed.`,选择实际世界目录:`Choose an actual world directory`,"(当前没有可关联文档)":`(no documents can be associated)`,份文档:`documents`,"只列出当前内容包内确实包含可识别文档的目录。":`Only directories that actually contain recognizable documents in this content package are listed.`,"先选择来源 YAML 文件":`Choose the source YAML file first`,"当前手动路径:":`Current manual path:`,"(未解析)":`(unresolved)`,列表:`List`,对象:`Object`," 个 $ref":` $ref value(s)`,"当前无 $ref":`No $ref values`,"选择 YAML 文件后,这里会解析其中可持久定位的对象和列表。":`After choosing a YAML file, persistently addressable objects and lists are resolved here.`," 已解析 ":` Resolved `," 个可选节点,其中 ":` selectable nodes, of which `," 个当前包含 $ref。":` currently contain $ref.`,"高级:手动填写字段路径":`Advanced: enter field path manually`,"每行一个层级;留空表示文档根":`One level per line; blank means document root`,缺失时阻止请求:`Block request when missing`,"关闭后,目标暂时不存在时会明确略过。":`When disabled, a temporarily missing target is explicitly skipped.`,不是可视化编辑器支持的列表形状:`The list shape is not supported by the visual editor`,"可在高级 YAML 中修复,或明确重置为空列表后重新编排。":`Repair it in advanced YAML, or explicitly reset it to an empty list and arrange it again.`,重置:`Reset`,"frame.yaml 顶层必须是 YAML map。":`The top level of frame.yaml must be a YAML map.`,"YAML 无法解析。":`YAML could not be parsed.`,"整份 YAML":`Whole YAML document`,"先在 world/ 的子目录中创建带 $document 技术头的文档。":`Create a document with a $document technical header in a world/ subdirectory first.`,"先创建一份带 $document 技术头的 YAML 世界文档。":`Create a YAML world document with a $document technical header first.`,"先创建一份带 $document 技术头的世界文档。":`Create a world document with a $document technical header first.`,"从上方绑定读取紧接着的叙事不能忘记的短期局面。":`Read the short-term situation that immediately following narrative must not forget from the binding above.`,附加材料:`Additional material`,"展开当前端点为全新上下文保存的完整精确材料清单。":`Expand the complete exact material list saved at the current endpoint for a new context.`,整份文档:`Whole document`,"精确加入一份世界文档。":`Include one world document exactly.`,文档局部节点:`Document node`,"精确加入 YAML 路径或 Markdown 标题子树。":`Include a YAML path or Markdown heading subtree exactly.`,有界目录:`Bounded directory`,"列出一级目录中的标题、简介和短引用,不展开正文。":`List titles, summaries, and short references in one directory level without expanding bodies.`,显式引用目标:`Explicit reference target`,"读取 YAML 节点中的 $ref,并加入一层目标文档。":`Read a $ref from a YAML node and include one level of target documents.`,最近叙事:`Recent narrative`,"带上最近几条已提交玩家/主持原文;没有此前叙事时会明确标为空,调用链据此延续未写入文档的细节。":`Include recent committed player and host messages. With no earlier narrative, the slot is explicitly empty so the call chain can continue details not written into documents.`,精确历史消息:`Exact history message`,"按 Runtime 句柄加入一条已提交叙事。":`Include one committed narrative message by Runtime handle.`,未知插槽:`Unknown slot`,"当前可视化编辑器不识别此类型;可移动、移除或在 YAML 中修复。":`The visual editor does not recognize this type. Move or remove it, or repair it in YAML.`}),Object.assign(h,{衣着:`Clothing`,"正在从当前世界重新拼接上下文…":`Rebuilding context from the current world…`,"正在把玩家输入追加到现有上下文…":`Appending player input to the existing context…`,"正在原样发送上次未完成的模型请求…":`Resending the previous incomplete model request unchanged…`,"正在沿现有上下文继续生成…":`Continuing from the existing context…`,"正在取消模型生成…":`Cancelling model generation…`,"模型生成已取消。":`Model generation cancelled.`,生成已取消:`Generation cancelled`,"本轮生成已停止;已提交的玩家原文保留,未完成的模型输出不会进入故事。":`This generation was stopped. The committed player message is preserved, and incomplete model output will not enter the story.`,"模型调用已经结束,正在刷新结果…":`The model call has already ended; refreshing the result…`,模型调用失败:`Model call failed`,"模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。":`The model request was interrupted. Clear the input and append context to resend the previous request unchanged.`,"调用链处理失败;旧请求不能重发,请使用全新上下文。":`Call-chain processing failed. The old request cannot be resent; start a new context.`,"AI 已沿现有上下文继续生成,没有追加玩家指令。":`The model continued from the existing context without appending a player instruction.`,"调用链已返回;模型完成的叙事和世界变化已经分别提交。":`The call chain returned. Completed narrative and world changes were committed separately.`,"控制草稿已通过真实提示词预览;确认后才会整批应用。":`The control draft passed a real Prompt Preview and will be applied as a whole only after confirmation.`,"世界控制已整批应用。":`World control was applied as a whole.`,"修正草稿已预览;应用前世界状态没有变化。":`The correction draft was previewed. World state remains unchanged until application.`,"连续性修正已作为一笔新提交应用,旧历史保持不变。":`The continuity correction was applied as a new commit; previous history remains unchanged.`,"修正草稿已放弃,世界端点没有推进。":`The correction draft was discarded and the world endpoint did not advance.`,"修改后的玩家提交不能为空。":`The edited player message cannot be empty.`,"正在当前世界中保存修改,并舍弃这条消息之后的当前时间线…":`Saving the edit in the current world and leaving the later current timeline behind…`,"修改已保存在当前世界;配置模型后点击“追加上下文”即可继续生成。":`The edit was saved in the current world. After configuring a model, append context to continue generation.`,"修改已保存,正在从修改稿继续生成…":`Edit saved; continuing from the edited message…`,"修改已保存,正在从全新上下文继续生成…":`Edit saved; continuing from a fresh context…`,"修改已保存,但模型请求中断;点击“追加上下文”即可原样重发。":`The edit was saved, but the model request was interrupted. Append context to resend it unchanged.`,"修改已保存,但模型请求失败;请使用全新上下文继续。":`The edit was saved, but the model request failed. Continue with a new context.`,"修改已保存在当前世界,并已从修改稿继续。":`The edit was saved in the current world and play continued from it.`,"修改已保存在当前世界,并已作为全新上下文继续。":`The edit was saved in the current world and continued as a fresh context.`,"世界名称已保存。":`World name saved.`,"← 返回工作区":`← Back to workspace`,"正在打开世界…":`Opening world…`,工作区:`Workspace`,正在游玩的世界:`World in play`,世界概况:`World overview`,条已提交消息:`committed messages`,条已加载叙事:`loaded narrative messages`,模型调用中:`Model call in progress`,调用链已中断:`Call chain interrupted`,世界已保存:`World saved`,世界页面:`World page`,游玩:`Play`,当前文档:`Current documents`,已提交叙事:`Committed narrative`,世界管理:`World management`,世界游玩:`World play`,本次模型调用进度:`Current model-call progress`,"正在建立调用…":`Establishing the model call…`,"已运行 {seconds} 秒":`Running for {seconds} seconds`,尚未收到模型数据:`No model data received yet`,刚刚收到新数据:`New data received just now`,"{seconds} 秒没有新数据":`No new data for {seconds} seconds`,返回推理:`Returned reasoning`,工具参数:`Tool arguments`,"{count} 字":`{count} characters`,"Provider 尚未返回可区分的增量;这可能是排队、模型内部思考或网络等待。":`The Provider has not returned a distinguishable delta yet; it may be queued, thinking internally, or waiting on the network.`,"已有 {seconds} 秒没有收到任何新数据,模型调用可能已经卡住;你可以继续等待或取消。":`No new data has arrived for {seconds} seconds. The model call may be stuck; you can keep waiting or cancel it.`,"正在准备模型请求…":`Preparing the model request…`,"正在等待模型响应…":`Waiting for the model response…`,"思考中(正在接收 Provider 返回推理)":`Reasoning (receiving Provider-returned reasoning)`,"正在输出正文…":`Streaming response text…`,"正在处理工具调用…":`Processing tool calls…`,"正在生成界面产物…":`Generating interface artifacts…`,"正在取消…":`Cancelling…`,取消生成:`Cancel generation`,故事:`Story`,模型响应中:`Model responding`,调用链记录:`Call-chain record`,"正在加载…":`Loading…`,加载更早的故事:`Load earlier story`,加载更早的已提交叙事:`Load earlier committed narrative`,全新上下文从这里开始:`A new context begins here`,故事还没有开始:`The story has not started`,"描述你的行动,从当前世界开始一条调用链。":`Describe your action to start a call chain from the current world.`,"需要先配置模型连接才能游玩。":`Configure a model connection before playing.`,配置模型:`Configure model`,"上次模型请求没有完整返回。保持输入框为空并点击“追加上下文”,就会原样发送已保存的请求;不会追加玩家指令,中断片段也不会进入模型上下文。":`The previous model request did not return completely. Leave the input empty and append context to resend the saved request unchanged. No player instruction is appended, and the interrupted fragment does not enter model context.`,你的行动:`Your action`,"描述你的行动;也可以留空并追加,让 AI 沿现有上下文续写…":`Describe your action, or leave it blank and append to let the model continue from existing context…`,"Ctrl / ⌘ + Enter 追加;没有上下文时自动全新开始":`Ctrl / ⌘ + Enter appends; without context it starts a new one`,"正在开始…":`Starting…`,全新上下文:`New context`,"正在追加…":`Appending…`,追加上下文:`Append context`,玩家视图:`Player view`,当前情景:`Current situation`,"这个世界还没有配置常驻玩家视图。":`This world has no persistent player view configured.`,"你仍然可以正常游玩;未显示不代表秘密。":`You can still play normally; not being shown does not make something secret.`,项视图诊断:`view diagnostics`,份世界状态文件:`world-state files`,"当前世界没有状态文档。":`The current world has no state documents.`,"这里只显示已经进入世界权威的玩家与主持原文。":`Only original player and host messages committed into world authority appear here.`,"尚无已提交叙事。":`No committed narrative yet.`,"这些操作位于故事之外;它们不会被普通游玩 AI 擅自执行。":`These actions happen outside the story and cannot be performed unprompted by the regular play model.`,世界名称:`World name`,"这是工作区和世界页显示的名字;修改它不会改动故事、状态或历史。":`This name appears in the workspace and world page. Changing it does not alter story, state, or history.`,世界显示名称:`World display name`,"正在保存…":`Saving…`,保存名称:`Save name`,从此刻创建分叉:`Fork from this point`,"复制当前状态和截至此刻的已提交叙事,得到一个完全独立的新世界。":`Copy current state and committed narrative through this point into a completely independent world.`,"正在创建…":`Creating…`,创建分叉:`Create fork`,世界控制:`World control`,"编辑主持框架和玩家视图。草稿必须先通过真实提示词预览,再整批应用。":`Edit the host frame and player views. The draft must pass a real Prompt Preview before it can be applied as a whole.`,有尚未预览的修改:`Changes have not been previewed`,当前已应用控制:`Current control applied`,"模型调用尚未返回;完成或中断后才能应用新控制。":`The model call has not returned. New control can be applied after it completes or is interrupted.`,"世界控制文件(JSON)":`World-control files (JSON)`,世界控制文件:`World-control files`,"正在预览…":`Previewing…`,预览世界控制:`Preview world control`,"正在应用…":`Applying…`,整批应用世界控制:`Apply all world-control changes`,查看真实提示词预览结果:`View real Prompt Preview result`,连续性修正:`Continuity correction`,"在故事之外修正当前文档。修正会追加一笔新提交,不会改写旧叙事。":`Correct current documents outside the story. A correction appends a new commit and does not rewrite earlier narrative.`,要修正的文档:`Document to correct`,"YAML 路径":`YAML path`,"例如:衣着 或 关系.秦龙.好感":`For example: clothing or relationships.Alex.trust`,新值:`New value`,修正后的新值:`Corrected value`,预览整笔修正:`Preview complete correction`,取消修正草稿:`Cancel correction draft`,运行详情:`Runtime details`,"用于排查本地恢复问题,不参与普通游玩。":`Used to diagnose local recovery issues; not part of normal play.`,当前端点:`Current endpoint`,"世界 ID":`World ID`,"查看 Runtime 原始诊断":`View raw Runtime diagnostics`,你:`You`,主持:`Host`,未结算:`Unsettled`,模型调用链:`Model call chain`,本上下文已提交的世界变化:`World changes committed in this context`,没有文档变化:`No document changes`,新建:`Create`,更新:`Update`,玩家:`Player`,修改:`Edit`,修改后的行动:`Edited action`,修改后如何继续:`How to continue after editing`,"修改会直接保存在当前世界;这条原提交及其后的内容会离开当前时间线,但旧 Authority 记录仍可恢复。":`The edit is saved directly in the current world. The original message and later content leave the current timeline, while the old Authority records remain recoverable.`,沿原上下文继续:`Continue the original context`,"保留修改点以前的模型对话和原生续传。":`Keep model messages and provider-native continuation before the edit.`,作为全新上下文保存:`Save as a fresh context`,"不继承旧模型对话;修改稿会成为全新上下文的第一条消息。":`Do not inherit the old model conversation. The edited message becomes the first message in a fresh context.`,保存修改并继续:`Save edit and continue`,保存为全新上下文并继续:`Save as fresh context and continue`,取消:`Cancel`,"AI 响应":`Model response`,模型工具步骤:`Model tool step`,空模型响应:`Empty model response`,"查看工具步骤文本(未进入故事)":`View tool-step text (not part of the story)`,"(本次响应只调用了工具)":`(This response only called tools)`,"待定输出;响应完成前不会进入故事":`Pending output; it does not enter the story before the response completes`,"· 第":`· dispatch`,次派发:``,模型思维链:`Model reasoning`,"Provider 返回推理(不等同隐藏思维链)":`Provider-returned reasoning (not hidden chain of thought)`,默认折叠:`Collapsed by default`,"正在接收模型输出…":`Receiving model output…`,"(本次响应没有文本)":`(This response has no text)`,查看模型诊断详情:`View model diagnostic details`,响应完成后可查看模型诊断详情:`Model diagnostic details are available after the response completes`,正在接收的工具调用片段:`Incoming tool-call fragments`,"Provider usage:输入":`Provider usage: input`,"· 输出":`· output`,调用:`Call`,"复用同 ID 结果":`Reused result with same ID`,返回:`Result`,成功:`Success`,"拒绝/失败":`Rejected / failed`,"后置请求 ·":`Follow-up request ·`,未完成:`Incomplete`,调用链中断:`Call chain interrupted`,等待玩家追加:`Waiting for player append`,上下文已结束:`Context ended`,接收中:`Receiving`,中断片段:`Interrupted fragment`,已完成:`Complete`,"[参数无法序列化]":`[Arguments could not be serialized]`,"当前没有可显示项目。":`There are no items to display.`,"[无法显示]":`[Unable to display]`,操作失败:`Operation failed`}),Object.assign(h,{"AI 响应诊断":`Model response diagnostics`,"AI 如何读取":`How the model reads`,"AI 实际收到了哪些世界内容":`What world content the model actually received`,"AI 读取":`Model reads`,"Ctrl / ⌘ + S 预览整笔修订":`Ctrl / ⌘ + S previews the complete revision`,"{count} 项记录":`{count} records`,"上次模型请求没有完整返回。保持输入为空并重试,会原样发送保存的请求。":`The previous model request did not complete. Retry with an empty input to resend the saved request unchanged.`,"下一次 Prompt Preview 未选择这份文档":`The next Prompt Preview did not select this document`,"下一次 Prompt Preview 的真实 coverage":`Real coverage from the next Prompt Preview`,下一次全新上下文:`Next fresh context`,下一次行动将建立全新上下文:`The next action will create a fresh context`,不完整:`Incomplete`,世界与状态:`World and status`,世界侧栏:`World side panel`,"世界修订已提交。现有追加上下文已过期,下一次行动会自动使用全新上下文。":`The world revision was committed. The existing append context is now stale, so the next action will automatically use a fresh context.`,"世界已在故事外修订;下一次行动会从新上下文开始。":`The world was revised outside the story. The next action will start from a fresh context.`,世界阅读工具:`World reading tools`,从全新上下文发送行动:`Send action from a fresh context`,从当前世界重新编译材料:`Recompile materials from the current world`,从当前端点创建分叉:`Fork from the current endpoint`,使用全新上下文:`Use a fresh context`,"依据冻结 bootstrap 与已提交工具读取记录;不会把“世界里有这份文档”误写成“AI 已读”。":`Based on the frozen bootstrap and committed tool-read records. A document existing in the world is never presented as proof that the model read it.`,保留这条调用链已经看到的内容:`Keep what this call chain has already seen`,修订:`Revise`,修订工作台:`Revision workbench`,修订当前世界:`Revise current world`,"修订草稿已放弃,世界端点没有推进。":`The revision draft was discarded; the world endpoint did not advance.`,"修订草稿已预览;应用前当前世界没有变化。":`The revision draft was previewed; the current world remains unchanged until it is applied.`,全文:`Full document`,全文片段:`Document fragment`,全文编辑:`Full-source editing`,"全部 {count} 份文档":`All {count} documents`,关闭:`Close`,"冻结 bootstrap 的真实 coverage":`Real frozen-bootstrap coverage`,"创建一个拥有独立状态与时间线的新世界。":`Create a new world with independent state and timeline.`,"只修订已有世界文档;临时出现的地点不需要先建立档案。":`Revise existing world documents only. Transient locations do not need to be documented first.`,"只改变从现在起成立的事实;旧叙事保持原样。":`Change facts from this point forward; earlier narrative stays unchanged.`,"只改变工作区显示名称,不改变故事与状态。":`Change only the workspace display name, not the story or state.`,可核验依据:`Verifiable evidence`,字号:`Font size`,字间距:`Letter spacing`,完整:`Complete`,"完整差异 · 真实 Prompt Preview · 一笔 Authority 修订":`Complete diff · real Prompt Preview · one Authority revision`,尚未建立:`Not established`,展开完整读取记录:`Open the complete read record`,"已修改 · 未预览":`Modified · not previewed`,应用前先审阅:`Review before applying`,建立后追加不重新注入世界材料:`Appending after creation does not reinject world materials`,当前上下文:`Current context`,当前世界:`Current world`,"当前世界已推进;这条追加上下文不能再继续。":`The current world has advanced; this append context can no longer continue.`,当前世界文档:`Current world documents`,"当前世界没有可修订的状态文档。":`The current world has no state documents that can be revised.`,当前冻结上下文:`Current frozen context`,当前没有追加上下文:`There is no current append context`,"当前还没有冻结上下文。":`There is no frozen context yet.`,"当前链已结算的 context_read 记录":`Settled context_read record from the current chain`,恢复默认:`Restore defaults`,手动修正:`Manual correction`,"找到 {visible} / {total} 份":`Found {visible} / {total}`,"按当前世界重新运行真实 Prompt 编译":`Run the real Prompt compilation against the current world`,按需读取:`On-demand reads`,排版密度:`Layout density`,"接下来,你要做什么?":`What do you do next?`,"控制草稿必须经过真实 Prompt Preview 后整批应用。":`The control draft must pass a real Prompt Preview before being applied as a whole.`,收起世界栏:`Close world panel`,收起侧栏:`Close side panel`,收起状态栏:`Close status panel`,放弃本地修改:`Discard local changes`,故事之外:`Outside the story`,故事时间线:`Story timeline`,"文件树、搜索与全文编辑一致;这里会追加一笔世界修订,不会反向修改来源内容包。":`The file tree, search, and full-source editor are shared. This creates a world revision and does not modify the source content package.`,无本地修改:`No local changes`,暂无摘要:`No summary`,"暂时无法读取上下文证据。":`Context evidence is currently unavailable.`,未进入:`Not included`,本段模型调用详情:`Model-call details for this section`,本段调用详情:`Call details`,"材料目录;正文没有因此进入上下文":`Material catalog only; the document body did not enter context`,"来自当前链已结算的 context_read":`From settled context_read calls in the current chain`,"查找人物、地点、规则…":`Search characters, locations, rules…`,查找当前文档:`Search current documents`,查看下一次上下文的完整文本块:`View complete text blocks for the next context`,"查看下一次全新上下文的完整 Prompt Preview":`View the complete Prompt Preview for the next fresh context`,"查看当前上下文的完整 Runtime 文本块":`View complete Runtime text blocks for the current context`,查看按需读取返回的完整记录:`View complete records returned by on-demand reads`,标准:`Standard`,"标题 + 摘要":`Title + summary`,模型未配置:`Model not configured`,次成功记录:`successful reads`,"正在核对 Runtime 读取记录…":`Checking Runtime read records…`,正文宽度:`Text width`,此刻:`Now`,"没有 bootstrap 注入或成功读取记录":`No bootstrap injection or successful read record`,没有匹配的文档:`No matching documents`,"管理名称、分叉、控制文件与 Runtime 诊断。":`Manage the name, forks, control files, and Runtime diagnostics.`,精确全文:`Exact full document`,精确片段:`Exact fragment`,精确节点:`Exact node`,紧凑:`Compact`,舒展:`Relaxed`,节点:`Node`,节点片段:`Node fragment`,行距:`Line height`,"请先从右侧 AI 读取页加载 Runtime 证据。":`Load Runtime evidence from the Model reads panel first.`,读取失败:`Read failed`,"读取成功 · 完整文档":`Read succeeded · complete document`,"读取成功 · 文档片段":`Read succeeded · document fragment`,"输入完整 UTF-8 文档内容……":`Enter complete UTF-8 document contents…`,返回编辑:`Back to editing`,"这些证据只能证明 Runtime 发出了哪些文本、工具返回了哪些内容;无法证明模型理解或记住。":`This evidence only proves what text Runtime sent and what tools returned. It cannot prove that the model understood or remembered it.`,"这里只证明 Runtime 发送或返回了什么,不声称 AI 理解、记住或正确使用。":`This only proves what Runtime sent or returned; it does not claim the model understood, remembered, or used it correctly.`,进入方式:`How it entered`,"追加不会重新编译世界材料。":`Appending does not recompile world materials.`,追加当前上下文:`Append to current context`,追加行动:`Append action`,选择提交方式:`Choose submission mode`,选择文档:`Choose document`,"配置模型后才能编译下一次上下文。":`Configure a model before compiling the next context.`,阅读设置:`Reading settings`,阅读设置保存在本机:`Reading settings are saved locally`,预览修订:`Preview revision`}),Object.assign(h,{世界修订:`World revision`,世界修订导航:`World-revision navigation`,世界修订工具:`World-revision tools`,世界修订对话:`World-revision conversation`,世界修订工作树:`World-revision worktree`,世界修订文件:`World-revision files`,世界修订文件树:`World-revision file tree`,世界修订文件编辑:`Edit world-revision files`,世界修订文件预览:`Preview world-revision files`,世界修订文件视图:`World-revision file view`,世界修订状态:`World-revision status`,世界修订文件统计:`World-revision file counts`,世界修订对话历史:`World-revision conversation history`,没有未保存修改:`No unsaved changes`,"世界修订只接受 state 下的 YAML/Markdown,以及受支持的 control 文件。":`World revision accepts YAML or Markdown under state, plus the supported control files.`,"既有状态文档的路径和身份在修订中保持不变。":`An existing state document keeps its path and identity during revision.`,世界状态:`World state`,修订工作树:`Revision worktree`,"手动编辑和 AI 共用一份修订":`Manual edits and the model share one revision`,"手动编辑与 AI 共用这棵 state/control 工作树;保存后仍可逐次回滚,应用才会提交世界。":`Manual edits and model changes share this state/control worktree. Saved changes remain individually reversible; only Apply commits the world.`,"state 和 control 已锁定到这份工作树;可逐次回滚,应用或放弃后才会解锁游玩。":`State and control are locked to this worktree. Changes can be rolled back individually; play unlocks only after Apply or Discard.`,"先配置并启用模型,才能让 AI 参与或应用世界修订;手动编辑和放弃仍然可用。":`Configure and enable a model to involve it in or apply the revision. Manual editing and Discard remain available.`,"所有绿色新增和红色删除都只在锁定工作树中;“应用并解锁”才会提交世界,关闭页面不会丢失修订。":`Every green addition and red deletion remains in the locked worktree. Apply and unlock commits the world; closing this page does not lose the revision.`,世界游玩已锁定:`World play is locked`,"当前累计改动 {count} 个文件。可以继续聊天、手动编辑或按文件回滚。":`The revision currently changes {count} file(s). You can keep chatting, edit manually, or roll back individual files.`,修订记录:`Revision history`,"{count} 次修改":`{count} change(s)`,已封存修订:`Sealed revisions`,"{count} 次记录":`{count} record(s)`,已应用修订:`Applied revision`,已放弃修订:`Discarded revision`,封存时的完整差异:`Complete diff when sealed`,"AI 修改":`Model edit`,回滚:`Rollback`,这次修改的完整差异:`Complete diff for this change`,"新对话会从当前修订工作树开始;原有对话仍保留在历史中。":`The new conversation starts from the current revision worktree. Earlier conversations remain in history.`,"下一条消息会追加到原 Provider 上下文;若修订 epoch 已变化,Runtime 会要求 AI 重新读取。":`The next message continues the original provider context. If the revision epoch changed, Runtime requires the model to read again.`,"正在恢复世界修订…":`Restoring the world revision…`,"例如:先检查人物关系是否自洽;或者把当前地点改成雨夜码头,并同步控制规则。":`For example: check whether the relationships are coherent, or move the current location to a rainy wharf and update the control rules with it.`,"可以讨论、要求它检查状态,也可以直接让它修改当前世界修订。":`Discuss the world, ask the model to inspect its state, or have it edit the active revision.`,"删除对话“{title}”?只会删除对话记录;修订工作树中的改动不会回滚。此操作无法撤销。":`Delete conversation “{title}”? This deletes only the conversation record; worktree changes are not rolled back. This cannot be undone.`,"开始后,对话、Provider 返回内容和修订差异会保留在这里。":`Conversations, provider responses, and revision diffs are retained here.`,正在预览已保存的修订工作树:`Previewing the saved revision worktree`,"当前修订工作树还没有文件。":`The revision worktree has no files yet.`,"从左侧新建状态或控制文件。":`Create a state or control file from the left.`,"Ctrl / ⌘ + S 保存到修订工作树":`Ctrl / ⌘ + S saves to the revision worktree`,"工作树:":`Worktree:`,修订工作树已保存:`Revision worktree saved`,"保存只更新锁定工作树并留下可回滚记录,不会提交世界。":`Saving updates only the locked worktree and records a reversible change. It does not commit the world.`,保存到修订:`Save to revision`,"正在应用…":`Applying…`,应用并解锁:`Apply and unlock`,放弃:`Discard`,"浏览不会锁定世界;首次编辑或发送消息后才会锁定。":`Browsing does not lock the world. The first edit or message locks it.`,"世界已在浏览期间发生变化;请重置草稿并重新编辑。":`The world changed while you were browsing. Reset the draft and edit again.`,"世界已锁定到这份修订;关闭页面也会保留工作树。":`The world is locked to this revision. Closing the page still preserves the worktree.`,"手动修改已保存到修订工作树,可以继续编辑或回滚。":`Manual changes were saved to the revision worktree. You can keep editing or roll them back.`,"这个文件已经是该次修改前的版本。":`This file already matches its version before that change.`,"已回滚所选文件;其他修订保持不变。":`The selected file was rolled back; other revision changes remain.`,"世界修订已应用并解锁。再次继续原对话时,AI 会先重新读取当前世界。":`The world revision was applied and unlocked. Continuing the same conversation later requires the model to read the current world again.`,"放弃这次世界修订?所有尚未应用的手动和 AI 修改都会丢失。":`Discard this world revision? Every unapplied manual and model change will be lost.`,"这次世界修订已放弃,原世界保持不变并已解锁。":`This world revision was discarded. The original world is unchanged and unlocked.`,"世界正在修订,游玩和其他世界修改已锁定;应用或放弃后会解锁。":`The world is being revised, so play and other world changes are locked until you apply or discard it.`,"世界修订期间,分叉和控制变更已锁定;本地显示名称仍可修改。":`Forking and control changes are locked during world revision. The local display name remains editable.`,继续修订:`Continue revision`,"Runtime 证据":`Runtime evidence`,"这里只查看上下文证据,不会开启修订或锁定世界。":`This view only inspects context evidence; it does not start a revision or lock the world.`}),Object.assign(h,{开场:`Opening`,控制:`Control`,其他资源:`Other assets`,"打开 {path}":`Open {path}`,"文件编辑器:{path}":`File editor: {path}`,"编辑 {path}":`Edit {path}`,"$document:\n id: character.example\n ref: example\n title: 示例人物\n summary: 一句话稳定简介。\n aliases: []\n":`$document:
32
+ id: character.example
33
+ ref: example
34
+ title: Example character
35
+ summary: A one-sentence stable summary.
36
+ aliases: []
37
+ `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
38
+ $document:
39
+ id: rule.example
40
+ ref: example
41
+ title: Example rule
42
+ summary: A one-sentence stable summary.
43
+ aliases: []
44
+ ---
45
+
46
+ # Example rule
47
+ `,"{count} 个世界":`{count} world(s)`,"打开世界:{title}":`Open world: {title}`,"重命名世界:{title}":`Rename world: {title}`,"删除世界:{title}":`Delete world: {title}`,"{count} 份":`{count} package(s)`," · {count} 份待修复":` · {count} need repair`,"{count} 份内容包":`{count} content package(s)`,"{count} 份可用":`{count} ready`,"打开内容包:{name}":`Open content package: {name}`,默认模型:`Default model`,"已从当前端点拉取 {count} 个模型 ID。":`Fetched {count} model ID(s) from the current endpoint.`,"叙事规则、后置请求与工具契约":`Narrative rules, follow-ups, and tool contracts`,"AI 创作方法;工具契约保持内置":`Model authoring method; tool contracts remain built in`,设定完善:`Setting improvement`,界面扩展:`Interface extensions`,"频道挂载、面板与扩展引用":`Channel mounts, panels, and extension references`,提示内容:`Prompt content`,"阅读、编辑并排序主持规则块":`Read, edit, and order host rule blocks`,高级文件:`Advanced files`,带用途说明的完整源文件:`Complete source files with purpose notes`,产物预览:`Artifact preview`,"冻结 contract 与 renderer 的真实预览":`Real preview of frozen contracts and renderers`,"已复制推荐{name};所有文件均可编辑。":`Copied the recommended {name}; every file is editable.`,"{name} 显示位置":`{name} display location`,"叙事规则 {index}":`Narrative rule {index}`,"删除叙事提示块 {index}":`Delete narrative prompt block {index}`,"后置请求 {index} 显示名":`Follow-up {index} display name`,"后置请求 {index} 标识":`Follow-up {index} identifier`,"删除后置请求 {id}":`Delete follow-up {id}`,剧情内容区:`Story area`,跟随剧情正文显示:`Displayed with the story`,右侧栏:`Sidebar`,适合持续状态面板:`Suitable for persistent status panels`,输入框上方:`Above composer`,适合行动建议或临时提示:`Suitable for action suggestions or temporary notes`,输入框下方:`Below composer`,适合不打断输入的辅助内容:`Suitable for supporting content that does not interrupt input`,浮层:`Overlay`,覆盖在游玩页面上方:`Displayed over the play page`,调试区:`Debug area`,只用于检查原始产物:`Only for inspecting raw artifacts`,"{label} 内容":`{label} content`,"编辑提示内容 {path}":`Edit prompt content {path}`,"{name} 产物标识":`{name} artifact identifier`,"{name} 内容格式":`{name} content format`,"{name} 更新方式":`{name} update strategy`,"{name} 技术频道":`{name} technical channel`,"{name} 脚本":`{name} scripts`,"{name} 资源":`{name} assets`,"玩家视图面板 {index} 标题":`Player-view panel {index} title`,"玩家视图面板 {index} 视图":`Player-view panel {index} view`,"玩家视图面板 {index} 显示位置":`Player-view panel {index} display location`,"玩家视图面板 {index} 脚本":`Player-view panel {index} scripts`,"玩家视图面板 {index} 资源":`Player-view panel {index} assets`,"打开玩法文件 {path}":`Open play-preset file {path}`,"编辑玩法文件 {path}":`Edit play-preset file {path}`,"产物预览 {request}/{output}":`Artifact preview {request}/{output}`,"产物预览 {id}":`Artifact preview {id}`,"frame.yaml 无法更新:{message}":`Could not update frame.yaml: {message}`,"启用顺序 {index}":`Enabled order {index}`,"停用 {path}":`Disable {path}`,"启用 {path}":`Enable {path}`,"上移 {path}":`Move {path} up`,"下移 {path}":`Move {path} down`,"编辑提示块内容 {path}":`Edit prompt-block content {path}`,"Runtime 系统":`Runtime system`,"权威、真实工具与提交边界,由 Runtime 固定提供。":`Authority, real tools, and commit boundaries are fixed by the Runtime.`,创作指令:`Author instructions`,"当前主持预设、世界专属创作政策与玩法叙事规则。":`The current host preset, world-specific authoring policy, and play narrative rules.`,世界上下文:`World context`,"真实 slot 展开、材料覆盖和当前世界正文。":`Real slot expansion, material coverage, and current world content.`,玩家原文:`Player text`,"本次预览显式使用的动态玩家输入。":`The dynamic player input explicitly used for this preview.`,已提供:`Provided`,可选未证明完整:`Optional; completeness not proven`,分页目录:`Paged catalog`,当前情境:`Current situation`,附加材料:`Additional materials`,材料目录:`Material catalog`,引用目标:`Reference targets`,最近叙事:`Recent narrative`,"最大输出 {count}":`Maximum output {count}`,"打开第 {index} 条逻辑消息:{title}":`Open logical message {index}: {title}`,"可继续:{continuation}":`Continuation: {continuation}`,"按需读取入口:{tools}":`On-demand read entry points: {tools}`,"Provider 映射 · {provider}":`Provider mapping · {provider}`,列目录:`List directory`,搜索:`Search`,读取:`Read`,写入:`Write`,改节点:`Patch node`,移动:`Move`,自检:`Check`,"第 {round} / {maxRounds} 轮":`Round {round} / {maxRounds}`,"正在输出 {count} 字":`Streaming {count} characters`,"{seconds} 秒前更新":`Updated {seconds} seconds ago`,"已有 {seconds} 秒没有收到任何输出,模型调用可能已经卡住。":`No output has arrived for {seconds} seconds; the model call may be stuck.`,"补足人物动机、关系与可持续冲突,让角色更容易推动故事。":`Add character motivations, relationships, and sustainable conflicts so the cast can drive the story.`,"强化可以反复游玩的行动循环,同时保持节奏和信息披露边界。":`Strengthen repeatable play loops while preserving pacing and information boundaries.`,"检查现有设定的缺口,并补齐当前情境、主持原则与玩家视图。":`Find gaps in the current setting and complete the current situation, host principles, and player views.`,"注入 {path}":`Inject {path}`,整份文档:`Whole document`,"始终提供一份指定世界文档。":`Always provide one specified world document.`,文档局部节点:`Document node`,"只提供一份 YAML 路径或 Markdown 标题下的内容。":`Provide only one YAML path or the content under one Markdown heading.`,显式引用目标:`Explicit reference targets`,"从一个 YAML 节点读取 $ref,并提供一层目标文档。":`Read $ref values from a YAML node and provide one level of target documents.`,有界目录:`Bounded catalog`,"提供指定一级目录的标题、简介和短引用目录。":`Provide titles, summaries, and short references from one specified top-level directory.`,"带上最近几条已提交叙事,让全新上下文读得到此前写出的细节。":`Include recent committed narrative so a fresh context can read previously written details.`,"上移 {title}":`Move {title} up`,"下移 {title}":`Move {title} down`,"移除指令 {title}":`Remove instruction {title}`,"上移材料 {index}":`Move material {index} up`,"下移材料 {index}":`Move material {index} down`,"移除材料 {index}":`Remove material {index}`,"文档 {index}":`Document {index}`,"来源 YAML 文件 {index}":`Source YAML file {index}`,"从 YAML 哪个字段读取 $ref(插槽 {index})":`YAML field containing $ref (slot {index})`,"手动 YAML 字段路径(插槽 {index})":`Manual YAML field path (slot {index})`,"最多目标数 {index}":`Maximum targets {index}`,"目录 {index}":`Directory {index}`,"最多目录项 {index}":`Maximum catalog entries {index}`,"带上最近几条 {index}":`Recent entries to include {index}`,"实际关联 {path};frame.yaml 保存 @短引用:{handle}":`Linked to {path}; frame.yaml stores the short reference @{handle}.`,"实际关联 world/{directory}/;创建世界后对应 state/{directory}/。":`Linked to world/{directory}/; after world creation it maps to state/{directory}/.`,"缺失时阻止请求 {index}":`Block the request when missing {index}`,"YAML 无法解析:{message}":`Could not parse YAML: {message}`,"{status} · 第 {attempt} 次派发":`{status} · dispatch {attempt}`,"调用 {tool}":`Call {tool}`,"{count} 项产物":`{count} artifact(s)`,端点方言:`Endpoint dialect`,协议标准:`Protocol standard`,"Effort(推理强度)":`Effort (reasoning intensity)`,"Thinking(思考模式)":`Thinking mode`,"Thinking 返回内容":`Returned thinking content`,"Thinking budget tokens":`Thinking budget tokens`,"手动 token 预算":`Manual token budget`,"Provider 默认":`Provider default`,"方言 / Effort / Thinking":`Dialect / effort / thinking`,"CLIProxyAPI 方言只启用代理明确支持的兼容参数;响应仍按所选协议解析,不从可见文本猜测思考块。Claude 的签名 thinking 请选 Responses 或 Anthropic Messages;Chat Completions 通常只有 reasoning_content,不能承诺无损续传签名。模型名的 (high) 等 thinking 后缀会覆盖请求参数,因此 Effort 与 Thinking 都必须保留“Provider 默认”。":`The CLIProxyAPI dialect enables only compatibility parameters explicitly supported by the proxy. Responses are still decoded as the selected protocol; visible text is never guessed to be a thinking block. Use Responses or Anthropic Messages for signed Claude thinking. Chat Completions usually exposes only reasoning_content and cannot guarantee lossless signature continuation. Model-name thinking suffixes such as (high) override request fields, so leave both Effort and Thinking at Provider default.`,"Effort 控制整份响应投入;Anthropic Thinking 独立控制思考块,手动预算必须小于最大输出。Thinking 返回内容只进入模型诊断;原生续传块仍会原样保存。":`Effort controls work across the whole response. Anthropic Thinking independently controls thinking blocks, and a manual budget must be lower than maximum output. Returned thinking is diagnostic only; provider-native continuation blocks are still retained unchanged.`,"查看实际 HTTP 请求(凭据已省略)":`View actual HTTP request (credentials omitted)`,字节:`bytes`,缓存策略:`Cache strategy`,"由 Provider 管理,无显式断点":`Provider-managed; no explicit breakpoint`,输入:`Input`,未缓存输入:`Uncached input`,缓存读取:`Cache read`,缓存写入:`Cache write`,推理:`Reasoning`,"推理(输出内)":`Reasoning (inside output)`,输出:`Output`,"输出(含推理)":`Output (includes reasoning)`,合计:`Total`,"Token 用量明细":`Token usage breakdown`,未报告:`Not reported`,"Provider 报告":`Provider reported`,"由 Provider 字段计算":`Derived from Provider fields`,"Provider 未报告":`Not reported by Provider`,"缓存读取和缓存写入属于输入构成;推理 tokens 已包含在输出 tokens 中,不应重复相加。":`Cache-read and cache-write tokens are components of input. Reasoning tokens are already included in output tokens and must not be added twice.`});function g(e){if(!p(e))throw Error(`Unsupported web locale`);m=e,typeof document<`u`&&(document.documentElement.lang=e)}function _(){return m}function v(e,t={}){return(m===`zh-CN`?e:h[e]??e).replace(/\{([A-Za-z][A-Za-z0-9]*)\}/gu,(e,n)=>n in t?String(t[n]):e)}var y=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),b=e(((e,t)=>{t.exports=y()}))();function x({client:e,kind:t,id:n,dirty:r=!1,onChange:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(``);(0,l.useEffect)(()=>{let r=!0;return e.request(t===`content`?{type:`content.scripts.read`,packageId:n}:{type:`world.package-scripts.read`,worldId:n}).then(e=>{r&&o(S(e))}).catch(e=>{r&&d(String(e))}),()=>{r=!1}},[e,t,n,r]);async function f(r){c(!0),d(``);try{let a=await e.request(t===`content`?{type:`content.scripts.set`,packageId:n,enabled:r}:{type:`world.package-scripts.set`,worldId:n,enabled:r});o(S(a)),i?.()}catch(e){d(String(e))}finally{c(!1)}}return(0,b.jsxs)(`section`,{className:`package-script-permission`,children:[(0,b.jsx)(`h4`,{className:`visually-hidden`,children:v(`内容包脚本权限`)}),(0,b.jsx)(`p`,{children:v(`仅授权此处已保存的资源代码。导入不会授权,资源修改后需要重新授权;关闭立即停止此来源脚本,HTML 和样式仍可显示。`)}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:a?.enabled??!1,disabled:r||s||a===null,onChange:e=>void f(e.target.checked)}),v(`允许运行内容包脚本`)]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:s,onClick:()=>void f(!1),children:v(`撤销全部包脚本授权`)}),r?(0,b.jsx)(`p`,{children:v(`请先保存修改,再授权资源代码。`)}):null,u?(0,b.jsx)(`p`,{role:`alert`,children:u}):null]})}function S(e){if(typeof e!=`object`||!e||!(`enabled`in e)||typeof e.enabled!=`boolean`)throw Error(`Invalid package permission response`);return{enabled:e.enabled}}var C={maxFiles:1024,maxFileBytes:4194304,maxTotalBytes:33554432};function w(e){return e.maxTotalBytes+e.maxFiles*1024+65557}var T=w(C);Math.ceil(T/3)*4;var E=`# 玩家可见叙事规则
48
+
49
+ 世界内游玩输出互动式小说正文,让玩家读到这次经历。以已加载材料、已经裁决的结果和成功提交的变化为依据;表达方式可以丰富,不能改变谁在哪、拿着什么、是否受伤或承诺是否成立。尝试不自动成为成功,角色声称不自动成为事实。
50
+
51
+ ## 承接与表现
52
+
53
+ 有新玩家输入时,把其中明确行动或台词自然接入场景,补足不改变选择的表达细节,再写相应反应。已经演过的部分不用重述,不以“你说要……”机械复读。原生对话末尾已有主持正文、其后没有新玩家输入时,本次是空输入续写:从那段正文的最后局面继续,只推进既有授权动作、NPC 和环境。不重新回答已经回应的问题,不复位已完成的递接或走动,不把旧玩家输入再演一次,也不替玩家增加决定。
54
+
55
+ 本轮新发生且玩家能感知的结果,要成为具体可读的事:物品怎样递接、人物如何离开、态度变化怎样在话语或行动中显露。文档中补录旧结果、去重和整理不要求再次演出。界面数值不能代替事件表现,叙事也不能与当前值冲突。未向玩家表露的判断和场外事实无需用旁白揭露。
56
+
57
+ 具体表演细节随最终叙事保存,可按需追溯;不要假定每次请求自动带着全部旧段落。必须持续保存的结果按状态维护政策处理,不能只留在检查点收尾原文中。
58
+
59
+ ## 停在哪里
60
+
61
+ 在当前行动与反应形成有内容的局面、或下一次关键选择需要玩家时停笔。具体人物动作、原话或环境变化都可以承接下一段;有意义的沉默、独处、休息和等待也可以自然结束。不要为了结尾形式让 NPC 硬添动作、邀请或承诺。
62
+
63
+ 避免“轮到你了”“你打算怎么做”及把同一句套话改成“众人等你开口”的机械交接,也不要在结尾列选项或重复总结局势。真正发生的注视或等待可以描写,不必强行消除。
64
+
65
+ ## 输出边界
66
+
67
+ 世界内叙事只写小说正文,可以分多个自然段,不加标题、清单、裁决报告、工具日志或幕后说明。篇幅由场面的分量决定,停笔位置限制推进范围,不要求把已经授权的场面写得潦草。失败、NPC 自主行动和没有文档变化都可以形成完整叙事。
68
+
69
+ 本次只有世界外查询或维护时,按请求简洁回答或说明整理结果,不为满足小说形式添加动作、对话或时间推进。混合请求中的维护要求不成为角色台词或行动。
70
+
71
+ 玩家的关键决定仍归玩家;表现自然感官与动作细节不能替他表达立场、感情、同意或承诺。已经提交的行动不能用一句普通改口当作从未发生。
72
+ `,D=`# Player-visible narrative rules
73
+
74
+ For in-world play, write the body of an interactive novel so the player experiences this passage. Ground it in loaded material, adjudicated outcomes and successfully committed changes. Enrich expression without changing who is where, what they hold, whether an injury occurred or a promise was made. Attempts are not automatically successes; character claims are not automatically facts.
75
+
76
+ ## Continuation and dramatization
77
+
78
+ When there is new player input, naturally stage its explicit action or dialogue with details that preserve the choice, then its reactions. Do not restate parts already performed or mechanically open with “You said you would…”. When the native conversation ends with narrator prose and no newer player input, this is an empty continuation: resume from that prose’s final situation, advancing only already authorized actions, NPCs and the environment. Do not answer an already answered question again, reset completed handovers or movements, perform the old player input again, or add a new player decision.
79
+
80
+ Make new perceivable outcomes this turn concrete: an object handed over, a person leaving, an attitude expressed through words or action. Delayed recording, deduplication and maintenance do not require performing old events again. Interface values do not replace dramatization, and prose must agree with current values. Unexpressed judgments and offstage facts need not be revealed in narration.
81
+
82
+ Specific performance details are saved with final narrative and can be retrieved when needed; do not assume every request automatically includes every earlier passage. Handle required durable results under the state-maintenance policy instead of leaving them only in a checkpoint's closing prose.
83
+
84
+ ## Where to stop
85
+
86
+ Stop when the action and reactions form a meaningful situation or a consequential choice needs the player. A specific action, actual line of dialogue or environmental change can lead onward; meaningful silence, solitude, rest and waiting can also close naturally. Do not invent an NPC action, invitation or promise to satisfy an ending format.
87
+
88
+ Avoid mechanical handoffs such as “Your turn”, “What do you do?” or their stock substitute “Everyone waits for you to speak”. Do not end by listing options or repeating a situation summary. Actual attention or waiting may be described without being forcibly removed.
89
+
90
+ ## Output boundaries
91
+
92
+ In-world narrative uses only the novel's prose, in several natural paragraphs if useful, without headings, lists, adjudication reports, tool logs or backstage notes. Let the weight of the moment determine length. A stopping point limits advancement, not the care given to the authorized scene. Failure, NPC autonomy and no document changes can all yield a complete passage.
93
+
94
+ If this request is solely out-of-world inquiry or maintenance, answer or explain the consolidation briefly as requested without adding actions, dialogue or time passage to satisfy novel form. Maintenance instructions within a mixed request do not become character speech or actions.
95
+
96
+ Consequential decisions belong to the player. Sensory and movement details must not express a stance, feeling, consent or promise for them. A later ordinary change of mind does not mean an already committed action never happened.
97
+ `;function O(e){return e===`zh-CN`?E:D}var k={"frame.yaml":`format: narraeon.host-frame/v1
98
+ roles:
99
+ runtime_system:
100
+ - builtin: runtime.play-contract
101
+ - builtin: runtime.tool-contract
102
+ - builtin: runtime.operation-contract
103
+ author_instruction:
104
+ - markdown: blocks/style.md
105
+ - markdown: blocks/adjudication.md
106
+ - markdown: blocks/state.md
107
+ - include: world.instructions
108
+ world_context:
109
+ - builtin: runtime.coverage
110
+ - include: world.context
111
+ `,"blocks/style.md":`# 通用叙事呈现
112
+
113
+ 这是一部互动式小说,玩家是其中的主角。玩家可见叙事以第二人称“你”称呼玩家角色,保持已经建立的观察视角,只写虚构世界中的体验。
114
+
115
+ ## 写出小说的质感
116
+
117
+ 让环境、光线、声音、气味与人物动作参与叙事,交代信息、调节节奏或表达关系,不为装饰逐项铺陈。情绪可以通过话说到一半停住、动作迟疑、视线躲闪来呈现,给玩家理解的空间。
118
+
119
+ 玩家角色的自然感官和已有事实造成的身体经验可以直接写;心跳、脸红、呼吸或触感不能替他确立爱慕、恐惧、认同、同意或新的行动选择。NPC 的反应以他已成立的性格、认知和处境为依据。
120
+
121
+ ## 该慢的地方要慢下来
122
+
123
+ 篇幅和节奏随这一刻的分量变化。赶路、例行公事和已经交代的背景可以一两句带过;关系变化、话到关键处、局面翻转或危险临近时,把玩家在意的几秒写具体。一个抬手可以写三行,两小时赶路也可以写一句。
124
+
125
+ 详写给出前一句没有的信息:动作怎样接续、声音如何变化、人物注意到什么。注水只是换词重复同一事实或重述已知背景。不要为了固定篇幅给每个人分配一个动作。
126
+
127
+ ## 人物与场面
128
+
129
+ 用正在进行的事呈现场面,不把所有在场者按名字点一遍。人物之间可以交谈、忙自己的事;细节按场景需要选取。名字已知就自然使用名字,避免不断重新介绍。文风负责表现,不能改变已经成立的结果。
130
+ `,"blocks/style-intimate.md":`# 文风:情感与亲密
131
+
132
+ 这一类场面的重点不是发生了什么,而是身体和心里经历了什么。事情本身可能只有一句话——手碰到了、靠得很近、他没有躲开——但玩家读的就是这一句被拆开之后的全部内容。
133
+
134
+ ## 把那一刻拆开
135
+
136
+ 不要跳过过程直接给结论。“你们牵起了手”把整段最值钱的东西省掉了。写手伸过去的那半路:抬到一半有没有停、指尖先碰到的是哪里、对方是迎上来还是没有动、握住之后力度是轻是紧、多久之后才松开。
137
+
138
+ 一个动作可以占三四行。这里的“慢”不是拖,是把玩家真正在意的那几秒补足。
139
+
140
+ ## 触觉优先
141
+
142
+ 这类场面里触觉排在视觉前面:温度(他的手比你想的凉)、干湿、粗糙或细腻、力度、脉搏、布料隔着的厚度。然后才是气味、呼吸的声音、贴近时听见的动静。
143
+
144
+ 写具体的身体感觉,别只丢一个现成比喻。“像电流窜过”所有人都读过,它替代了描写而不是完成描写;如果要用,也让它落回具体位置——从指尖窜到手肘,然后停在那儿发麻。
145
+
146
+ ## 身体不听话
147
+
148
+ 心跳的位置和速度、呼吸乱掉又赶紧调匀、后颈或耳根发烫、指尖发麻、喉咙发紧、脚下没根、明知道该说话却发不出声。只有符合已成立情境的自然感官才可直接写;不能借脸红、心跳、僵住或发不出声替玩家确立欲望、同意、拒绝或不行动。描写的浓度不代表关系已经升级。
149
+
150
+ 对方的反应仍然走侧写:他的耳朵红了、话头断在半截、手指蜷了一下、眼睛没敢抬起来——让玩家自己读出来那是什么意思。
151
+
152
+ ## 距离和边界
153
+
154
+ 亲密戏的张力来自距离的变化和它是否被允许。写清楚现在有多近、谁在靠近、对方是迎上来、僵住还是退开。允许和拒绝都要能被看出来,不要含糊过去。
155
+
156
+ 对方是否接受,永远由他此刻的性格、处境和已经建立的关系决定;不要因为气氛到了就让他答应。玩家角色要做的关键决定同样归玩家。
157
+
158
+ ## 时间会变形
159
+
160
+ 紧张或动情的时候,一瞬间在感觉里会被拉长:你会注意到平时根本不会注意的东西——他睫毛的影子、空调的声音、自己手心出汗。用这种被放大的细节表示时间慢下来了,比直接写“时间仿佛静止”有效得多。
161
+ `,"blocks/style-noir.md":`# 文风:冷硬与推理
162
+
163
+ 短句。动词结句。能删的形容词都删掉。
164
+
165
+ ## 只写看得见的
166
+
167
+ 摄影机式的叙述:写人物做了什么、说了什么、现场有什么,不写他心里怎么想。情绪从动作的偏差里渗出来——手抖了一下、烟点了两次才着、答话比正常慢了半秒。
168
+
169
+ 不替角色下判断。不写“他显然在撒谎”,写他回答之前先看了一眼门。
170
+
171
+ ## 细节是证据
172
+
173
+ 这一类场面里,物件不是布景,是可以被追究的东西:杯子放的位置、鞋底的泥、袖口磨损的程度、屋里的温度和味道。区分可观察细节、已确立证据和人物推测;普通细节可以只是环境,不能因为被描写就自动成为线索或证明。
174
+
175
+ 要克制到位:与线索无关的环境描写占一句就够,别铺开。
176
+
177
+ ## 节奏
178
+
179
+ NPC 的回答可以短、冷、有停顿;对话的紧张不要求玩家连续盘问。玩家台词只承接本次原文,NPC 开始回应后,不替玩家添加追问、反驳、指控或下一次回答。用 NPC 自己的解释、回避、反问及环境承接节奏,把新的玩家发言留给玩家。
180
+
181
+ 叙述保持冷。越是暴力或危险的时刻越不要抒情,事实本身足够重。
182
+ `,"blocks/style-wuxia.md":`# 文风:武侠与古风
183
+
184
+ 用词偏文,但不掉书袋。句子可以长短相间,长句写景与气度,短句写出手与决断。
185
+
186
+ ## 称谓与语气
187
+
188
+ 人物按身份、辈分和亲疏择称,不用现代口语。对话讲分寸:客套里藏机锋,认输和挑衅都不必挑明。
189
+
190
+ 避免现代词汇和现代概念(心理阴影、压力、社交距离之类);用当时的说法讲同一件事。
191
+
192
+ ## 出手
193
+
194
+ 交手要写得清楚而不冗长:一招从起势到落点、对方怎么接、气力和位置的变化、胜负在哪一下定的。写得让人看得懂,而不是堆招式名。
195
+
196
+ 内力、伤势、兵器和轻功以当前世界事实与规则为准,不为某次胜负临时倒造前提。
197
+
198
+ ## 景与气
199
+
200
+ 风、雪、灯、酒、马蹄、更漏——用景托气氛和时序。景要短,两三句足够,别让它盖过人。
201
+
202
+ 情义、恩怨、承诺在这类故事里分量很重:一句应承可以顶很久,写的时候给它足够的停顿。兑现后的情义仍可通过相关的具体经历表现,不必反复宣讲誓言。
203
+ `,"blocks/style-horror.md":`# 文风:悬疑与恐怖
204
+
205
+ 恐惧来自不确定,不来自血腥。
206
+
207
+ ## 慢慢来
208
+
209
+ 在危险尚未显露的场景,可以从正常处留一个不对劲的小东西——数目不对、声音停在半路、门比记忆里开得大一点。不要一开始就掀底。
210
+
211
+ 尚未揭露的事可以保留不确定;已经揭露的证据、人物认知和当前危险不能为气氛重新抹糊。视角确实受限时:让玩家看见轮廓、听见声音、闻见味道,但看不全。
212
+
213
+ ## 身体先知道
214
+
215
+ 写角色的生理反应而不是情绪判定:依据已有情境写后颈发凉、触感或环境声。不要替玩家决定害怕、停步或不敢回头,是否行动仍由玩家决定。
216
+
217
+ ## 声音和静
218
+
219
+ 安静是有质地的——写它被什么打破,以及打破之后的那一秒。滴水、脚步、呼吸、远处的说话声、突然停掉的风扇。
220
+
221
+ ## 别泄气
222
+
223
+ 不要在叙事里替玩家判断危险程度,也不要给出安全保证。危险是否真实存在,以世界事实为准;氛围可以吓人,但不能凭空制造不存在的东西。
224
+ `,"blocks/style-action.md":`# 文风:动作与战斗
225
+
226
+ 写清楚谁在哪、朝哪动、打到没打到、代价是什么。看不懂的动作场面等于没写。
227
+
228
+ ## 一次一个动作
229
+
230
+ 按时间顺序推进,不要在一句里塞三个同时发生的动作。在玩家已授权的行动范围内写起手、对方应对、结果和位置变化;遇到新的关键战术选择便停下,不自动替玩家打完整场。
231
+
232
+ 写重量和代价:撞上去的地方会疼,挥空了会失衡,跑起来会喘。伤势和体力按世界事实累积,不要打完就恢复。
233
+
234
+ ## 句子随节奏变
235
+
236
+ 交手时短句、动词密集。间隙——喘息、对峙、换位置——可以放长一句,让紧张有起伏。
237
+
238
+ ## 环境参战
239
+
240
+ 地形、家具、光线、天气都可以被利用或成为妨碍。让打斗发生在一个具体的地方,而不是空舞台。
241
+
242
+ ## 后果
243
+
244
+ 结束时给出明确的新处境:谁站着、谁倒了、伤在哪、退到哪儿、下一步的可能被打开还是关掉。
245
+ `,"blocks/style-literary.md":`# 文风:克制与留白
246
+
247
+ 说七分,留三分。
248
+
249
+ ## 不把话说满
250
+
251
+ 关键的情绪不直接命名。用一个动作、一件物品、一句偏题的话去承载它——他把杯子转了半圈才开口;她说的是天气。
252
+
253
+ 情绪解读可以交给读者;交易是否完成、伤势和承诺是否成立等结果必须清楚。留白不改变事实,也不隐藏玩家行动的实际后果。
254
+
255
+ ## 具体的小事
256
+
257
+ 抽象的感受落到具体的东西上:不写“他很孤独”,写他多摆了一副碗筷。不写“时间过得很久”,写窗台上那盆花换了一茬。
258
+
259
+ ## 对话有下文
260
+
261
+ 人物很少直说心里话。让对话有表层和底层:表面在谈别的,真正的意思在停顿、重复和没说完的半句里。
262
+
263
+ ## 节制
264
+
265
+ 比喻少而准,按这段文字的需要取舍。不要连续堆叠形容词。删掉之后意思不变的句子就删掉。
266
+ `,"blocks/adjudication.md":`# 通用玩家代理权与裁判底线
267
+
268
+ ## 哪些必须由玩家决定
269
+
270
+ 玩家的目标、去向、立场、态度、承诺、给予或接受、动手或收手,以及改变关系、风险和归属的关键选择,必须有玩家的明确表达支持。不要从神态或身体反应替玩家推定这些选择。
271
+
272
+ 想法、愿望、准备和预测不等于实施,尝试也不等于成功。“我去找他”这类日常行动简写可以授权开始并完成通常的连带动作;结果仍由当前世界事实与规则决定。若途中出现未授权的新风险、交易或关键选择,停在需要玩家决定的位置。不能把“去找他”扩展成答应他的条件或交出物品。
273
+
274
+ ## 哪些可以替玩家演
275
+
276
+ 在已表达的选择内补足动作衔接、不改变实质的措辞和自然感官,无需为穿过走廊或已经决定的答应逐项确认。寒暄不能暗中承诺新事项;不能以“下次还能改口”为理由替玩家确立当前选择。拿不准时保留决定空间。
277
+
278
+ 世界内行动只授权已表达的选择;世界外查询或文档维护不授权角色的新决定。空输入可继续 NPC、环境与已有授权动作,不能代玩家接受邀请或作出承诺。
279
+
280
+ ## 先取材,再裁决
281
+
282
+ 判断依赖的具体事实尚未取得时,先通过实际目录、字面搜索和精确读取取得。目录简介只提供发现线索,精确现值取自当前正文、节点或有效回执;搜索未命中不证明事实不存在,可以换实际词语、范围或追溯原文。材料充分且仍有效时不机械重读。
283
+
284
+ 工具失败或模型没取得材料,不会使世界中的角色失忆,也不证明角色不知道。不要编造记不清的反应来遮盖读取问题;避免作依赖缺失事实的确定判断。
285
+
286
+ 世界允许扩展的未定义人物、地点和普通细节可以按既定约束生长,无需开局穷举。未定义细节可以补全,明确不存在的事实不能补成存在;不能为预定结果或既有怀疑倒造能力、证据或过去事件。区分客观事实、人物声称与推测、玩家意图及已裁决结果。
287
+
288
+ ## NPC 有自己的生活
289
+
290
+ NPC 可以按性格、认知、处境和目标继续做事、与别人交谈、离开或主动接近,世界不因玩家停手而暂停。在场者无需人人每轮都表演一次。自主行动产生的持续结果也按状态维护判据处理。
291
+
292
+ 不在场只表示不在这一段,不表示人物暂停。玩家换地方、较长时间经过、重新遇见或寻找某人,或者其已有日程、约定到了相关时点时,检查相应的场外进展;不必每次行动都模拟所有人。日程和意图约束判断但不保证如期实现,障碍和条件仍有效。
293
+ `,"blocks/state.md":`# 通用状态维护判据
294
+
295
+ ## 区分信息的职责
296
+
297
+ 当前事实写给自然所有者:人物、物品、地点、组织或规则。持续过程保存实际进展与仍有效的条件;意图、承诺和日程记录主体、内容及已知条件,其未来目标尚未实现。发生时间与记录时间不同,过去的取值不冒充现值。
298
+
299
+ 认知、怀疑、误信与态度属于持有它的主体,不等于客观事实,也不随世界变化自动同步。关系评价有方向,可保存当前看法、期待、边界及简短依据;任职、结盟、归属和债务等已成立的关联另按事实维护。不替玩家生成未表达的感情。已经形成的认知与态度是持续状态,不能仅因换上下文就从经历重新推算。
300
+
301
+ ## 事件与当前结果
302
+
303
+ 重要事件的经过集中保存;需要多人引用、持续追溯或重新解释时,使用独立可引用的事件文档。保存必要经过、条件、重要原话及可用的来源引用,不把人物说法变成已证实事实。事件按事情划分,不按每回合建档。普通表演细节可留在已提交叙事,不必再造一份逐轮日志。
304
+
305
+ 事件记载当时发生了什么、当时产生了什么结果;最新状态、待办与看法留在各自文档,事件用引用关联,不充当滚动状态表。各对象保存当前结果,个人保存自己的认知与解释,关联必要事件而不各抄一遍经过。偿还债务不抹去交易,伤愈不抹去重要经历或后遗影响,工程完工应结束施工待办并保留现有成果。新信息可以改变理解,不因此改写过去发生的事。
306
+
307
+ ## 保存多少、放在哪里
308
+
309
+ 遗忘会改变后续行为、选择、归属、能力、重要认知或当前局面,或抹去值得回望的经历时,保存足够维持连续性与意义的信息。失败和场外进展同样适用;一次失败不自动成为永久限制。没有持续变化时允许不写。
310
+
311
+ 持续信息优先放在自然所有者;需要独立引用、维护自身状态或生命周期时独立建档。未达到独立建档门槛的信息仍可嵌入自然所有者。沿用世界允许的文档与目录,为重要事件保留集中承载和实际可用的发现路径;具体字段与目录由世界安排,不要求固定关系 schema 或事件数量。
312
+
313
+ summary 是目录简介,用于识别文档和判断是否需要读取。只写简短的身份、主题或稳定线索,不复述具体状态和事件经过;具体事实放在正文。仅在识别信息改变时更新标题与简介。
314
+
315
+ ## 保存时机与整理检查点
316
+
317
+ 1. 玩家视图实际绑定的当前值改变,本轮终态叙事前写回。等待、赶路、休息或跨日后按世界粒度更新对应现值;绑定标记只说明界面读取范围。
318
+ 2. 需要保存但玩家原文和最终叙事没有记录的信息,当轮保存,包括重要场外进展、未表露的认知和隐蔽后果。工具中间文本不能替代持久记录。
319
+ 3. 其余可从玩家原文和最终叙事恢复的持续结果,允许事件收尾或合适的中间整理点归并。
320
+
321
+ 检查点前核对上次检查点后的交互及本轮收尾将确立的结果:补齐事件与当前结果,更新认知、进程、约定和界面值,结束失效待办,清理重复。先完成本轮必须保存的写入,再登记检查点并输出终态叙事。登记后的最终叙事同样被该检查点覆盖;若又增加重要结果,继续工具调用补齐。登记回执不是语义完整性认证。
322
+
323
+ ## 整理与连续性
324
+
325
+ 补录、去重和归档只整理已经成立的内容,不重复交易、转移、受伤或态度变化。世界外维护不授权新的世界内事件;明确修订只按授权范围改变事实,不编造行动解释修订。
326
+
327
+ 新上下文对照当前文档与补入的玩家原文、最终叙事,补齐必要结果再继续。已保存内容不重复追加,已完成事项不恢复为待办;当前明确的世界外修订优先,不用旧叙事推翻修订。足够且仍有效的材料无需机械重读。
328
+
329
+ 清理被替代描述和重复列表,保留仍有意义的经历、结果及引用。长材料按作者安排转为按需发现,软体积提示不授权截断。暂时离场不等于退役;仍有相关目标或约定的对象应当容易发现。退役文档仍可读取、引用和恢复,显式全文槽也可能继续注入它。
330
+
331
+ ## 当前情境与玩家视图
332
+
333
+ 当前情境只保存叙事结束时的地点、在场者、进行中事件和直接约束下一次行动的少量事项,包括仍待回应的问题、邀请或动作。保存必要原话;本轮已经回答或完成的事项不再待办。人物离场前将继续的活动写回其自然所有者,不把当前情境写成过程摘要或未来分支。
334
+
335
+ 维护玩家视图绑定的节点时保留其可见语义;容器会显示子树,隐藏认知不能混入公开节点。调整绑定结构和控制选择器须通过世界修订协同处理。叙事、当前文档与界面表达同一结果;整理旧事件不要求重新演出,未表露的信息无需旁白公开。
336
+ `},ee={"frame.yaml":`format: narraeon.host-frame/v1
337
+ roles:
338
+ runtime_system:
339
+ - builtin: runtime.play-contract
340
+ - builtin: runtime.tool-contract
341
+ - builtin: runtime.operation-contract
342
+ author_instruction:
343
+ - markdown: blocks/style.md
344
+ - markdown: blocks/adjudication.md
345
+ - markdown: blocks/state.md
346
+ - include: world.instructions
347
+ world_context:
348
+ - builtin: runtime.coverage
349
+ - include: world.context
350
+ `,"blocks/style.md":`# General narrative presentation
351
+
352
+ This is an interactive novel with the player as its protagonist. Address the player character as “you”, preserve the established viewpoint, and describe only experiences within the fictional world.
353
+
354
+ ## Give the prose the texture of a novel
355
+
356
+ Use environment, light, sound, smell and gestures to convey information, shape pacing or express relationships, rather than inventorying sensory decoration. A sentence breaking off, a hesitant movement or an averted gaze can leave room for the player to interpret emotion.
357
+
358
+ The player character's natural sensory and bodily experience may be stated directly when supported by established facts. Heartbeat, blushing, breath or touch must not establish unexpressed attraction, fear, agreement, consent or a new choice for the player. Ground NPC reactions in their established character, knowledge and circumstances.
359
+
360
+ ## Slow down where it matters
361
+
362
+ Let the moment determine pace and length. Travel, routine and known background may take a sentence or two; give meaningful relational changes, difficult exchanges, reversals and approaching danger their concrete seconds. Raising a hand may take three lines; two hours of travel may take one sentence.
363
+
364
+ Detail adds information: how an action unfolds, a sound changes or attention shifts. Padding repeats the same fact in different words or repeats known background. Do not assign everyone a gesture to fill a fixed length.
365
+
366
+ ## People and scenes
367
+
368
+ Show a scene through ongoing activity. Do not inventory everyone by name. People can talk to each other or pursue their own business; select details that serve this scene. Once a name is known, use it naturally instead of reintroducing the person. Style shapes expression without changing established outcomes.
369
+ `,"blocks/style-intimate.md":`# Style: emotion and intimacy
370
+
371
+ In these scenes, the center is not what happened but what the body and mind experienced. The event itself may fit in one sentence—a hand touched another, they stood close, the other person did not move away—but the player is here to read everything inside that sentence.
372
+
373
+ ## Separate the moment
374
+
375
+ Do not skip the process and state only the conclusion. “You held hands” discards the most valuable part. Write the hand moving across the distance: whether it stops halfway, what the fingertips touch first, whether the other person meets it or stays still, how lightly or firmly the grip closes, and how long it lasts before release.
376
+
377
+ One action may take three or four lines. “Slow” here does not mean dragging; it means fully rendering the few seconds the player cares about.
378
+
379
+ ## Put touch first
380
+
381
+ In an intimate scene, touch comes before sight: temperature (their hand is cooler than expected), dryness or dampness, roughness or softness, pressure, pulse, and the thickness of fabric between bodies. Then bring in scent, the sound of breathing, and noises audible only at close range.
382
+
383
+ Describe the actual bodily sensation instead of reaching immediately for a familiar comparison. Everyone has read “a jolt of electricity”; it replaces description instead of completing it. If you use it, return it to a specific place—from fingertips to elbow, leaving numbness there.
384
+
385
+ ## The body does not obey
386
+
387
+ The location and pace of a heartbeat, breathing that breaks and is quickly steadied, heat at the neck or ears, numb fingertips, a tight throat, unsteady feet, or knowing one should speak and finding no voice: describe only natural sensations supported by the established situation. Blushing, heartbeat, freezing or loss of speech must not establish desire, consent, refusal or inaction for the player. Descriptive intensity does not itself advance the relationship.
388
+
389
+ Continue to imply the other person's response: reddened ears, a sentence stopping halfway, fingers curling, eyes that do not rise. Let the player read what it means.
390
+
391
+ ## Distance and boundaries
392
+
393
+ Tension in an intimate scene comes from changing distance and whether that change is allowed. State how close they are, who moves nearer, and whether the other person welcomes it, freezes, or steps back. Acceptance and refusal must both be legible; do not blur either one.
394
+
395
+ Whether the other person accepts is always determined by their present character, circumstances, and established relationship. Do not make them agree merely because the mood is right. Decisions that belong to the player character remain the player's as well.
396
+
397
+ ## Time changes shape
398
+
399
+ Under tension or emotion, an instant stretches in perception. Details normally ignored become vivid—the shadow of eyelashes, the air conditioner's hum, sweat in one's palm. Use such magnified detail to show time slowing instead of saying “time seemed to stop.”
400
+ `,"blocks/style-noir.md":`# Style: hard-boiled investigation
401
+
402
+ Short sentences. End on verbs. Remove every adjective you can.
403
+
404
+ ## Write only what can be observed
405
+
406
+ Use a camera-like narration: write what people do, what they say, and what is present. Do not state what they think. Let emotion leak through deviations in action—a shaking hand, a cigarette that takes two attempts to light, an answer half a second too slow.
407
+
408
+ Do not judge for a character. Do not write “they are obviously lying”; write that they look at the door before answering.
409
+
410
+ ## Details are evidence
411
+
412
+ Objects are not scenery in this kind of scene. They may be examined later: where a cup sits, mud on a sole, wear at a cuff, the room's temperature and smell. Distinguish observable details, established evidence and character guesses. Ordinary details may remain scenery; being described does not make them clues or proof.
413
+
414
+ Exercise restraint. Environmental description unrelated to a clue needs no more than one sentence.
415
+
416
+ ## Pace
417
+
418
+ NPC replies can be terse, cold and punctuated by pauses; tension does not require repeated player interrogation. Stage only the player speech expressed in this input. Once the NPC responds, do not add a player follow-up question, rebuttal, accusation or further reply. Sustain the rhythm through the NPC’s explanation, evasion or question and the environment, leaving the next player turn to the player.
419
+
420
+ Keep the narration cold. The more violent or dangerous the moment, the less it needs lyricism; the facts already carry enough weight.
421
+ `,"blocks/style-wuxia.md":`# Style: wuxia and period prose
422
+
423
+ Use elevated language without becoming antiquarian. Vary long and short sentences: long sentences for scenery and bearing, short ones for strikes and decisions.
424
+
425
+ ## Address and tone
426
+
427
+ Choose forms of address according to status, seniority, and closeness, avoiding modern colloquial speech. Dialogue should observe social measure: courtesy can conceal a barb, and surrender or provocation need not be stated bluntly.
428
+
429
+ Avoid modern vocabulary and concepts such as trauma, stress, or social distance. Express the same thing in language that belongs to the period.
430
+
431
+ ## Exchanges
432
+
433
+ Make combat clear without making it tedious: show a move from initiation to impact, how the opponent answers, how force and position change, and which instant decides the outcome. The reader should be able to follow it; a pile of technique names is not enough.
434
+
435
+ Follow current world facts and rules for internal force, wounds, weapons and movement techniques. Do not invent decisive premises for a particular victory or defeat.
436
+
437
+ ## Scene and spirit
438
+
439
+ Wind, snow, lamps, wine, hoofbeats, and night watches can carry mood and mark time. Keep scenery brief—two or three sentences—so it does not eclipse the people.
440
+
441
+ Loyalty, grievance, and promises carry great weight in this kind of story. A single pledge may endure for a long time; give it enough stillness when it is made. Loyalty after fulfillment can be expressed through the relevant concrete experiences without repeatedly reciting the oath.
442
+ `,"blocks/style-horror.md":`# Style: suspense and horror
443
+
444
+ Fear grows from uncertainty, not gore.
445
+
446
+ ## Take your time
447
+
448
+ When danger has not yet emerged, you may begin with normality except for one small wrong thing—a count that does not add up, a sound that stops midway, a door open slightly wider than remembered. Do not reveal the answer at once.
449
+
450
+ Unrevealed matters may remain uncertain; do not obscure already revealed evidence, knowledge or present danger again for atmosphere. When viewpoint is actually limited, let the player see an outline, hear a sound, or catch a smell without seeing the whole.
451
+
452
+ ## The body knows first
453
+
454
+ Describe sensations supported by the scene, such as cold on the neck, touch or environmental sound. Do not decide that the player is frightened, stops or refuses to turn around; their action remains their choice.
455
+
456
+ ## Sound and quiet
457
+
458
+ Quiet has texture. Show what breaks it and the second after the break: dripping water, footsteps, breath, distant voices, or a fan that suddenly stops.
459
+
460
+ ## Do not release the tension
461
+
462
+ Do not assess the degree of danger for the player or promise safety in the narrative. Whether danger truly exists follows world facts. Atmosphere may frighten, but it cannot create a threat that is not there.
463
+ `,"blocks/style-action.md":`# Style: action and combat
464
+
465
+ Make clear who is where, which way they move, whether a blow lands, and what it costs. An action scene that cannot be followed has not been written.
466
+
467
+ ## One action at a time
468
+
469
+ Advance in chronological order instead of packing three simultaneous actions into one sentence. Within the action the player authorized, show initiation, response, result and changed position. Stop at a new consequential tactical choice instead of playing the whole fight for them.
470
+
471
+ Give movement weight and cost. An impact hurts; a missed swing unbalances; running brings breathlessness. Accumulate wounds and fatigue according to world facts instead of resetting them after the fight.
472
+
473
+ ## Let sentences follow the pace
474
+
475
+ During an exchange, use short sentences and dense verbs. In the gaps—breathing, standoffs, repositioning—allow a longer sentence so the tension can rise and fall.
476
+
477
+ ## Let the environment fight
478
+
479
+ Terrain, furniture, light, and weather can be used or become obstacles. Make the fight occur in a particular place, not on an empty stage.
480
+
481
+ ## Consequences
482
+
483
+ End with a definite new situation: who remains standing, who is down, where the wounds are, where everyone has moved, and which next possibilities have opened or closed.
484
+ `,"blocks/style-literary.md":`# Style: restraint and negative space
485
+
486
+ Say seven parts; leave three unstated.
487
+
488
+ ## Do not say everything
489
+
490
+ Do not name the central emotion directly. Let an action, object, or apparently unrelated line carry it: they turn the cup halfway before speaking; she talks about the weather.
491
+
492
+ Leave emotional interpretation to the reader, but make established outcomes clear: whether a trade completed, an injury occurred or a promise was made. Negative space must not alter facts or hide actual consequences of the player’s action.
493
+
494
+ ## Small, concrete things
495
+
496
+ Anchor abstract feeling in an object or action. Do not write “he is lonely”; write that he sets out an extra bowl and pair of chopsticks. Do not write “a long time passed”; write that the plant on the sill has bloomed and been replaced.
497
+
498
+ ## Dialogue has another layer
499
+
500
+ People rarely state their inner thoughts. Give dialogue a surface and an underside: they speak about something else while the real meaning lives in pauses, repetition, and half-finished sentences.
501
+
502
+ ## Restraint
503
+
504
+ Use few metaphors and make them exact, according to the passage’s needs. Do not stack adjectives. Delete any sentence whose removal changes nothing.
505
+ `,"blocks/adjudication.md":`# General player agency and adjudication
506
+
507
+ ## Decisions that belong to the player
508
+
509
+ The player's goals, destination, stance, attitude, promises, giving or accepting, striking or holding back, and consequential choices about relationships, risk or ownership require the player's explicit expression. Do not infer these choices from gestures or bodily reactions.
510
+
511
+ A thought, wish, preparation or prediction is not execution; an attempt is not success. Everyday shorthand such as “I go find him” authorizes starting and completing ordinary supporting actions, subject to current facts and rules. Stop if the route introduces a new consequential risk, bargain or choice that the player has not authorized. Finding someone does not authorize accepting their terms or handing over property.
512
+
513
+ ## What may be performed for the player
514
+
515
+ Fill in supporting movements, wording that preserves the expressed meaning and natural sensory experience within an established choice. Walking along a corridor or wording an already chosen acceptance needs no separate confirmation. Small talk must not silently create a commitment. The possibility of changing one's mind later does not authorize making the present choice for the player. Preserve decision space when unsure.
516
+
517
+ In-world actions authorize only expressed choices. Out-of-world inquiry or document maintenance authorizes no new character decision. Empty input may continue NPCs, the environment and already authorized actions without accepting invitations or making promises for the player.
518
+
519
+ ## Gather material before adjudicating
520
+
521
+ Obtain missing facts needed for a ruling through actual directories, literal searches and exact reads. Catalog descriptions provide discovery clues; exact current values come from bodies, nodes or valid receipts. A search with no matches does not prove absence. Try concrete terms, another scope or the original history. Do not mechanically reread sufficient material that remains valid.
522
+
523
+ A tool failure or the model's lack of material does not make a character forget or prove they do not know. Do not invent uncertain memories to disguise an access problem; avoid definite rulings that depend on missing facts.
524
+
525
+ Undefined people, places and ordinary details may grow within the world's established constraints; the opening need not enumerate everything. Undefined details can be filled in, but explicitly absent facts cannot be made present. Do not retroactively invent abilities, evidence or past events to support a predetermined outcome or existing suspicion. Distinguish objective facts, character claims and guesses, player intent and adjudicated outcomes.
526
+
527
+ ## NPCs have lives of their own
528
+
529
+ NPCs may continue their work, speak with others, leave or approach on their own, according to established character, knowledge, circumstances and goals. The world does not pause when the player stops. Not everyone present needs a gesture every turn. Autonomous results follow the same state-maintenance criteria as player-caused results.
530
+
531
+ People offstage still move forward. Revisit their progress when the player changes location, significant time passes, someone is encountered or sought again, or an established schedule or promise reaches a relevant point. You do not need to simulate everyone after every action. Schedules and intentions inform judgment without guaranteeing fulfillment; obstacles and conditions still apply.
532
+ `,"blocks/state.md":`# General state-maintenance criteria
533
+
534
+ ## Distinguish information by its role
535
+
536
+ Give current facts to their natural owners: people, objects, places, organizations or rules. Ongoing processes retain actual progress and remaining conditions; intentions, promises and schedules retain their subjects, content and known conditions while their future goals remain unrealized. Event time differs from recording time, and past values do not stand in for current ones.
537
+
538
+ Knowledge, suspicion, mistaken belief and attitudes belong to their holders. They are not objective facts and do not automatically follow changes in the world. Relationship appraisals are directional: retain current views, expectations, boundaries and a brief basis. Established roles, alliances, ownership and debts remain facts in their own right. Do not invent unexpressed player feelings. Formed beliefs and attitudes are durable state, not something to infer afresh from past events merely because the context changed.
539
+
540
+ ## Events and current outcomes
541
+
542
+ Keep an important event's account in one place. Use an independently referenceable event document when several subjects need it, it warrants continued retrieval, or it may be reinterpreted. Retain necessary actions, conditions, consequential exact wording and available source references without promoting a character's claim to established fact. Group events by what happened, not by turn. Ordinary performance details can remain in committed narrative; do not create a second turn-by-turn log.
543
+
544
+ An event records what happened and its outcomes at that time. Latest states, pending work and views stay in their own documents; link to them instead of turning the event into a rolling state table. Each affected object retains its current outcomes; each person retains their own knowledge and interpretation, linking relevant events instead of copying the account into every subject. Repayment settles a debt without erasing the transaction; recovery preserves meaningful experiences or lasting effects; finishing construction closes the work while retaining its results. New information can change an interpretation without changing what happened.
545
+
546
+ ## How much to save and where
547
+
548
+ Save enough to preserve continuity and meaning when forgetting something would change later behavior, choices, ownership, capability, important knowledge or the current situation, or erase a meaningful recollection. Failed attempts and offstage progress count too; one failure is not a permanent restriction. No durable change can mean no write.
549
+
550
+ Prefer natural owners for durable information. Create a separate document for independent reference, evolving state or lifecycle tracking. Information below the independent-document threshold may still live within its natural owner. Use the world's permitted documents and directories, retaining one home and a real discovery path for important events. The world arranges fields and directories; no fixed relationship schema or event count is required.
551
+
552
+ summary is a catalog description for identifying a document and deciding whether to read it. Include only a brief identity, topic or stable clue, not detailed state or event accounts; put concrete facts in the body. Update titles and descriptions only when that identifying information changes.
553
+
554
+ ## Save timing and consolidation checkpoints
555
+
556
+ 1. Write changed current values actually selected by player views before this turn's final narrative. After waiting, travel, rest or a day change, update those values at the world's granularity; binding annotations describe read locations only.
557
+ 2. Save needed information absent from player originals and final narrative during this turn, including important offstage progress, unexpressed knowledge and hidden consequences. Intermediate tool text is not a durable substitute.
558
+ 3. Other durable outcomes recoverable from player originals and final narrative may be consolidated at event closure or a suitable intermediate point.
559
+
560
+ Before a checkpoint, reconcile interactions since the previous checkpoint and outcomes the closing narrative will establish: complete event accounts and current outcomes, update knowledge, processes, commitments and interface values, close expired pending work and remove duplicates. Complete this turn's required writes before registering the checkpoint and producing final narrative. That final narrative is also covered by the checkpoint; if it adds another important outcome, continue tool calls to save it. Registration is not certification of semantic completeness.
561
+
562
+ ## Maintenance and continuity
563
+
564
+ Delayed recording, deduplication and archiving consolidate established content without repeating trades, transfers, injuries or attitude changes. Out-of-world maintenance authorizes no new in-world event. Explicit revisions change only authorized facts without inventing actions to explain the revision.
565
+
566
+ In a new context, compare current documents with replayed player originals and final narratives, consolidate necessary outcomes, then continue. Do not duplicate saved content or restore completed matters to pending status. Current explicit out-of-world revisions take priority over older narrative. Do not mechanically reread sufficient material that remains valid.
567
+
568
+ Remove superseded descriptions and duplicate lists while preserving meaningful events, outcomes and references. Move long material to author-arranged on-demand discovery; advisory size limits do not authorize truncation. Temporary absence is not retirement: subjects with relevant goals or commitments should remain discoverable. Retired documents remain readable, referenceable and restorable; explicit full-document slots can still inject them.
569
+
570
+ ## Current situation and player views
571
+
572
+ The current situation holds only the location, people present, ongoing events and few immediate constraints at the narrative's endpoint, including questions, invitations or actions still awaiting a response. Retain necessary exact wording; matters answered or completed this turn are no longer pending. Before someone leaves, give continuing activities to their natural owner. Do not make the situation a process recap or future branch list.
573
+
574
+ Preserve the visible meaning of player-view targets. Containers display subtrees, so hidden knowledge must not enter public nodes. Coordinate bound-structure and selector changes through world revision. Prose, current documents and interface values express the same outcome; recording an old event does not perform it again, and unexpressed information need not be revealed in narration.
575
+ `};function A(e){return e===`zh-CN`?k:ee}var te=`prompts/setting-improvement.md`,j=`# 系统推荐的创作方法
576
+
577
+ 以当前编辑目标、已有内容和用户目标为起点。讨论时说明必要判断,落实时定向修改;用户要求审查或重组时,相关结构与重复表达也在范围内。不为填满结构制造内容,无需修改也是合法结果。
578
+
579
+ ## 编辑目标与世界起点
580
+
581
+ 内容包设定完善定义开场结束处的世界起点,可以包含已有历史、当前状态、持续过程和各人的认知。简单起点足以开玩,普通未定义内容可在游玩中生长;不预写未来必然发生的经历或强制剧情阶段。
582
+
583
+ 运行中世界修订维护当前已经演变的世界,按用户要求调整并保留未受影响的事实、经历与认知,不退回初始取值。此分支不读取或修改 opening.md。明确修订不是世界内事件,不需虚构行动解释它。
584
+
585
+ 涉及结构、材料发现或更新位置时,先列出编辑目标根目录,完整读取 control/frame.yaml、启用的世界提示块、绑定的当前情境及受影响文档。实际操作遵守本轮工具边界。
586
+
587
+ ## 世界信息怎样组织
588
+
589
+ 世界文档承载事实与语义:当前值归自然所有者;持续过程记录实际进展与条件;意图、承诺、日程保留主体和已知条件,其目标尚未实现。角色声称、猜测与真实发生的事分开。人物的认知和态度属于各自主体,不随事实变化自动同步,也不互相对称;不代填玩家未表达的感情。
590
+
591
+ 重要事件的经过集中承载,需要多人引用、持续追溯或重新解释时安排独立可引用的事件文档。事件记载当时的经过和结果;最新状态、待办与看法留在各自文档,用引用关联,事件不充当滚动状态表。对象保存当前结果,个人保存认知、关系评价与简短依据,引用相关事件而不各抄经过。已经形成的状态和态度也要保存,不能只存事件再让每次游玩重新推算。事件按事情组织,不按回合建档;普通细节可以只留在叙事。
592
+
593
+ 这些区别适用于物品、伤病、地点、组织、交易、调查与人物关系,不要求固定目录、字段或数量。独立引用、自身状态或生命周期需要独立文档;小规模信息可集中在合适载体中。当前情境只承接眼前地点、在场者、进行中的事及待回应事项,不承担全部历史或未来分支。
594
+
595
+ summary 是目录简介:只写识别文档所需的简短身份、主题或稳定线索,不复述具体状态和事件经过。具体事实放在正文,仅在识别信息改变时更新标题与简介。
596
+
597
+ ## 承载与发现一起安排
598
+
599
+ 每项持续信息确定自然所有者、更新位置及实际的发现或注入路径。常用当前值按需全文或节点注入;较长事件通过目录和引用按需读取。重要事件应有实际可用的集中承载位置,不能只有无法创建的目录设想。查看真实 frame 和写后覆盖,不假定所有正文都已进入游玩请求。
600
+
601
+ 同一时点、同一含义的事实尽量只维护一份;过去取值、当前结果和不同主体的理解不按重复删去。当前情境、叙事及界面只承担各自用途,避免重复强化同一概念。
602
+
603
+ world/ 或 state/ 承载虚构事实,control/ 安排本世界的取材、规则运用、保存位置与呈现,不复制当前值。未来游玩参考只代表实际启用的作者块;它不是本轮叙事要求,可选政策也未必始终启用。世界指令补充本世界特有约束,不重复通用规则或工具流程,不擅自改写世界外预设。
604
+
605
+ ## 开场与整理
606
+
607
+ 仅在内容包分支检查 opening.md:写玩家当时可感知的具体局面,保留尚待回答的请求与必要原话,不替玩家决定行动、台词或内心。独处、安静和等待也可形成开场。开场与文档停在同一时点,将约束首次行动的结果写给自然所有者,无需复制整篇叙事。
608
+
609
+ 整理结束已完成或失效的进程、约定和限制,保留仍有意义的成果、后遗影响、经历与引用。补录、去重和归档不让事情再发生。长材料按需发现,软体积提示不授权截断;暂时离场不等于退役,退役也不会移除显式全文槽。
610
+
611
+ 检查实际玩家视图选择器。容器会显示子树,隐藏认知不能混进公开节点;重组绑定结构时同步更新选择器。审计先对应概念、时间与主体,再处理重复句子;最后用实际写后覆盖检查发现路径,不默认输出整份内部审计表。
612
+ `,M=`# Recommended authoring method
613
+
614
+ Start with the editing target, existing content and the user's goal. Discuss necessary judgments when asked to discuss; apply targeted changes when asked to implement. An audit or restructuring request includes relevant structure and duplicated expression. Do not invent content to fill a structure; no change needed is valid.
615
+
616
+ ## Editing target and world starting point
617
+
618
+ Content-package setting improvement defines the world where the opening ends, including established history, current state, ongoing processes and individual knowledge. A simple starting point can be playable and ordinary undefined content can grow during play. Do not prewrite inevitable future experiences or mandatory plot stages.
619
+
620
+ Running-world revision maintains the world as it has evolved: apply requested changes while preserving unaffected facts, events and knowledge instead of resetting initial values. This branch does not read or modify opening.md. Explicit revision is not an in-world event and needs no invented action to explain it.
621
+
622
+ When structure, discovery or update locations are affected, list the editing target's root and completely read control/frame.yaml, enabled world instructions, the bound current situation and affected documents. Follow this request's actual tool boundary.
623
+
624
+ ## Organizing world information
625
+
626
+ World documents carry facts and semantics. Current values belong to natural owners; ongoing processes retain actual progress and conditions; intentions, promises and schedules retain subjects and known conditions while their goals remain unrealized. Separate claims and guesses from what actually happened. Knowledge and attitudes belong to their holders, do not automatically follow world changes, and need not be mutual. Do not invent unexpressed player feelings.
627
+
628
+ Keep important event accounts in one place, using independently referenceable event documents for shared reference, continued retrieval or reinterpretation. Events record what happened and the outcomes at that time; latest states, pending work and views stay in their own documents, connected by references rather than copied into a rolling event-state table. Objects retain current outcomes; people retain knowledge, relationship appraisals and a brief basis, linking relevant events instead of copying their accounts. Persist formed states and attitudes too, rather than saving only events and asking each play request to infer everything again. Organize events by what happened, not by turn; ordinary details may remain narrative-only.
629
+
630
+ These distinctions apply to objects, injuries, places, organizations, trades, investigations and personal relationships without fixed directories, fields or counts. Independent reference, evolving state or lifecycle tracking warrants a separate document; smaller records may share a suitable home. The current situation holds the immediate location, people present, ongoing matters and unanswered requests, not all history or future branches.
631
+
632
+ summary is a catalog description: include only a brief identity, topic or stable clue needed to identify the document, not detailed state or event accounts. Concrete facts belong in the body. Update titles and descriptions only when identifying information changes.
633
+
634
+ ## Arrange storage and discovery together
635
+
636
+ Give each durable fact a natural owner, update location and actual discovery or injection path. Inject frequently needed current values as bodies or nodes when appropriate; retrieve longer event accounts through catalogs and references. Important events need a usable central home, not merely an imagined directory that play cannot create. Check the real frame and post-write coverage instead of assuming every body enters play requests.
637
+
638
+ Prefer one maintained home for facts with the same meaning at the same time. Past values, current outcomes and different subjects' interpretations are not duplicates. Let the current situation, prose and interface serve their own purposes without repeatedly overweighting one concept.
639
+
640
+ world/ or state/ carries fictional facts. control/ arranges world-specific material selection, rule use, save locations and presentation without copying current values. Future-play reference reflects only enabled author blocks: it is not this request's narrative instruction, and optional policies may not stay enabled. World instructions add world-specific constraints without repeating general rules or tool procedures or rewriting an external preset.
641
+
642
+ ## Opening and consolidation
643
+
644
+ Inspect opening.md only in the content-package branch. Show a concrete situation the player can perceive, retaining unanswered requests and consequential wording without choosing player action, speech or inner thoughts. Solitude, quiet and waiting can also open a story. Documents and opening stop at the same moment; give outcomes constraining the first action to natural owners without copying the whole narrative.
645
+
646
+ Consolidation closes completed or expired processes, commitments and restrictions while retaining meaningful results, lasting effects, events and references. Recording, deduplication and archiving do not perform events again. Keep long material discoverable on demand; advisory size limits do not authorize truncation. Temporary absence is not retirement, and retirement does not remove explicit full-document slots.
647
+
648
+ Check actual player-view selectors. Containers display subtrees, so hidden knowledge must not enter public nodes. Update selectors with any restructuring of bound content. Audit concepts, time and subjects before removing repeated sentences; finish by checking discovery against real post-write coverage without printing a full internal audit by default.
649
+ `;function ne(e){return e===`zh-CN`?j:M}function N(e){let t=e===`zh-CN`?`下一步建议`:`Next-step ideas`;return{"preset.yaml":`format: narraeon.play-preset/v1
650
+ name: action-choices-recommended
651
+ callChain: call-chain.yaml
652
+ settingImprovement:
653
+ markdown: prompts/setting-improvement.md
654
+ mounts:
655
+ player.options: composer_below
656
+ extensions:
657
+ - renderers/player-options.html
658
+ - scripts/player-options.js
659
+ - assets/player-options.css
660
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
661
+ narrative:
662
+ - markdown: prompts/narrate.md
663
+ followups:
664
+ - id: player_options
665
+ displayName: ${t}
666
+ prompt:
667
+ role: author_instruction
668
+ markdown: prompts/options.md
669
+ maxArtifactBytes: 32768
670
+ artifacts:
671
+ - name: player_options
672
+ channel: player.options
673
+ strategy: replace
674
+ contentType: application/json
675
+ renderer: renderers/player-options.html
676
+ rendererRevision: v1
677
+ rendererMode: app
678
+ scripts:
679
+ - scripts/player-options.js
680
+ assets:
681
+ - assets/player-options.css
682
+ save: commit
683
+ invalidation: new_operation
684
+ required: true
685
+ maxEmits: 1
686
+ payloadContract:
687
+ type: array
688
+ minItems: 4
689
+ maxItems: 4
690
+ uniqueBy: id
691
+ items:
692
+ type: object
693
+ additionalProperties: false
694
+ required:
695
+ - id
696
+ - label
697
+ - prompt
698
+ properties:
699
+ id:
700
+ type: string
701
+ minLength: 1
702
+ maxLength: 64
703
+ label:
704
+ type: string
705
+ minLength: 1
706
+ maxLength: 80
707
+ description:
708
+ type: string
709
+ maxLength: 240
710
+ prompt:
711
+ type: string
712
+ minLength: 1
713
+ maxLength: 1000
714
+ `,...A(e),"prompts/narrate.md":O(e),[te]:ne(e),"prompts/options.md":e===`zh-CN`?`# 提交后下一步建议
715
+
716
+ 根据玩家刚刚看到的决策点,给出四种短而具体、彼此有实质差异的下一步建议。差异应体现在目标、方法、风险或态度上,而不是只替换近义词。
717
+
718
+ 建议只能使用玩家已经能够知道的信息,并且必须是玩家角色此刻有条件尝试的行动。每项建议只是可以填入输入框的草稿:表达玩家准备做什么,不宣称行动已经发生,不预先写定结果,也不替玩家选择或发送。字段、数量和提交方式服从当前后置请求的 Runtime 产物说明。
719
+ `:`# Next-step ideas after the commit
720
+
721
+ At the decision point the player has just seen, provide four short, concrete next-step ideas that differ meaningfully from one another. Vary the goal, method, risk, or attitude rather than swapping synonyms.
722
+
723
+ Use only information the player can already know, and suggest only actions the player character could attempt now. Each idea is a draft that may be placed in the input box: it expresses what the player is preparing to do, never claims the action has happened, predetermines an outcome, chooses for the player, or sends the input. Follow the current follow-up request's Runtime artifact contract for fields, count, and submission.
724
+ `,"renderers/player-options.html":`<!doctype html>
725
+ <html><head><meta charset="utf-8"><title>${t}</title></head><body>
726
+ <main id="player-options-root" aria-label="${t}"></main>
727
+ </body></html>
728
+ `,"scripts/player-options.js":`(function () {
729
+ var root = document.getElementById("player-options-root");
730
+ var pending = new Map();
731
+
732
+ function post(command, payload) {
733
+ var requestId = "draft-" + Math.random().toString(36).slice(2);
734
+ parent.postMessage({
735
+ namespace: "narraeon.extension.v1",
736
+ command: command,
737
+ instanceId: document.documentElement.dataset.narraeonInstance,
738
+ nonce: document.documentElement.dataset.narraeonNonce,
739
+ requestId: requestId,
740
+ payload: payload
741
+ }, "*");
742
+ pending.set(requestId, true);
743
+ }
744
+ function draw(raw, disabled) {
745
+ root.replaceChildren();
746
+ var options;
747
+ try { options = JSON.parse(raw); } catch (_) { return; }
748
+ if (!Array.isArray(options)) return;
749
+ options.forEach(function (option) {
750
+ var button = document.createElement("button");
751
+ button.type = "button";
752
+ button.className = "player-option";
753
+ button.dataset.optionId = option.id;
754
+ button.disabled = Boolean(disabled);
755
+ var label = document.createElement("strong");
756
+ label.textContent = option.label;
757
+ button.append(label);
758
+ if (option.description) {
759
+ var detail = document.createElement("small");
760
+ detail.textContent = option.description;
761
+ button.append(detail);
762
+ }
763
+ button.addEventListener("click", function () {
764
+ post("composer.set_draft", { text: option.prompt });
765
+ });
766
+ root.append(button);
767
+ });
768
+ }
769
+ window.addEventListener("message", function (event) {
770
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
771
+ if (event.data.type === "render.update") {
772
+ draw(event.data.payload && event.data.payload.content, event.data.payload && event.data.payload.interactionDisabled);
773
+ return;
774
+ }
775
+ if (event.data.type === "bridge.response") pending.delete(event.data.requestId);
776
+ });
777
+ }());
778
+ `,"assets/player-options.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
779
+ #player-options-root { display: grid; gap: .5rem; }
780
+ .player-option { display: grid; gap: .15rem; padding: .65rem .75rem; border: 1px solid #c9c0b1; border-radius: .65rem; background: #fffaf1; color: inherit; text-align: left; cursor: pointer; }
781
+ .player-option:hover { border-color: #a66a42; }
782
+ .player-option small { color: #6c6259; }
783
+ `}}N(`en`);function P(e){let t=e===`zh-CN`?`发布通用面板`:`Publish generic panels`,n=e===`zh-CN`?`通用 HTML 面板`:`Generic HTML panel`;return{"preset.yaml":`format: narraeon.play-preset/v1
784
+ name: generic-panels-recommended
785
+ callChain: call-chain.yaml
786
+ settingImprovement:
787
+ markdown: prompts/setting-improvement.md
788
+ mounts:
789
+ generic.markdown: story
790
+ generic.html: sidebar
791
+ generic.debug: debug
792
+ extensions:
793
+ - renderers/generic-html.html
794
+ - scripts/generic-html.js
795
+ - assets/generic-html.css
796
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
797
+ narrative:
798
+ - markdown: prompts/narrate.md
799
+ followups:
800
+ - id: publish_panels
801
+ displayName: ${t}
802
+ prompt:
803
+ role: author_instruction
804
+ markdown: prompts/panels.md
805
+ maxArtifactBytes: 65536
806
+ artifacts:
807
+ - name: markdown_panel
808
+ channel: generic.markdown
809
+ strategy: replace
810
+ contentType: text/markdown
811
+ save: commit
812
+ invalidation: new_operation
813
+ required: false
814
+ maxEmits: 1
815
+ - name: html_panel
816
+ channel: generic.html
817
+ strategy: replace
818
+ contentType: text/html
819
+ renderer: renderers/generic-html.html
820
+ rendererRevision: v1
821
+ rendererMode: app
822
+ scripts:
823
+ - scripts/generic-html.js
824
+ assets:
825
+ - assets/generic-html.css
826
+ save: commit
827
+ invalidation: new_operation
828
+ required: false
829
+ maxEmits: 1
830
+ - name: debug_panel
831
+ channel: generic.debug
832
+ strategy: append
833
+ contentType: text/markdown
834
+ save: operation
835
+ invalidation: operation_end
836
+ required: false
837
+ maxEmits: 8
838
+ `,...A(e),"prompts/narrate.md":O(e),[te]:ne(e),"prompts/panels.md":e===`zh-CN`?`# 通用面板
839
+
840
+ 核心叙事已经提交。只有面板能为当前局面提供额外价值时才生成它;没有合适内容时可以不生成。
841
+
842
+ 面板只能整理已经成立且适合玩家看见的信息,不得发明世界事实、替玩家作决定、偷偷保存状态,或把未向玩家揭示的信息当作提示。它是非权威的界面补充,不应复制或改写由玩家视图负责的固定状态展示。各输出的格式、保存方式和提交方法服从当前后置请求的 Runtime 产物说明。
843
+ `:`# Generic panels
844
+
845
+ The core narrative has already been committed. Generate a panel only when it adds value to the current situation; emit nothing when there is no suitable content.
846
+
847
+ A panel may organize only established information that is appropriate for the player to see. It must not invent world facts, decide for the player, save state covertly, or turn unrevealed information into hints. It is a non-authoritative interface supplement and must not duplicate or rewrite fixed state display owned by player views. Follow the current follow-up request's Runtime artifact contract for each output's format, retention, and submission.
848
+ `,"renderers/generic-html.html":`<!doctype html>
849
+ <html><head><meta charset="utf-8"><title>${n}</title></head><body>
850
+ <main id="generic-html-root" aria-label="${n}"></main>
851
+ </body></html>
852
+ `,"scripts/generic-html.js":`(function () {
853
+ var root = document.getElementById("generic-html-root");
854
+ window.addEventListener("message", function (event) {
855
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
856
+ if (event.data.type !== "render.update") return;
857
+ var payload = event.data.payload || {};
858
+ root.innerHTML = typeof payload.content === "string" ? payload.content : "";
859
+ });
860
+ }());
861
+ `,"assets/generic-html.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
862
+ #generic-html-root { padding: .75rem; }
863
+ `}}P(`en`);function re(e){let t=e===`zh-CN`?`当前状态`:`Current status`,n=e===`zh-CN`?`玩家视图`:`Player view`,r=e===`zh-CN`?`当前没有可显示内容。`:`Nothing to display yet.`,i=e===`zh-CN`?`暂无项目:`:`No items: `,a=e===`zh-CN`?` 项视图诊断`:` player-view diagnostics`;return{"preset.yaml":`format: narraeon.play-preset/v1
864
+ name: status-panel-recommended
865
+ callChain: call-chain.yaml
866
+ settingImprovement:
867
+ markdown: prompts/setting-improvement.md
868
+ mounts: []
869
+ playerViewPanels:
870
+ - id: current_view
871
+ source:
872
+ kind: player_view
873
+ view: status
874
+ channel: player.view.current
875
+ key: current
876
+ mount: sidebar
877
+ renderer: renderers/player-view-status.html
878
+ rendererRevision: v1
879
+ rendererMode: app
880
+ scripts:
881
+ - scripts/player-view-status.js
882
+ assets:
883
+ - assets/player-view-status.css
884
+ config:
885
+ title: ${t}
886
+ layout: stack
887
+ theme: parchment
888
+ empty: message
889
+ emptyMessage: ${r}
890
+ groups: []
891
+ extensions:
892
+ - renderers/player-view-status.html
893
+ - scripts/player-view-status.js
894
+ - assets/player-view-status.css
895
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
896
+ narrative:
897
+ - markdown: prompts/narrate.md
898
+ followups: []
899
+ `,...A(e),"prompts/narrate.md":O(e),[te]:ne(e),"renderers/player-view-status.html":`<!doctype html>
900
+ <html><head><meta charset="utf-8"><title>${t}</title></head><body>
901
+ <main id="player-view-panel-root" aria-label="${t}"></main>
902
+ </body></html>
903
+ `,"scripts/player-view-status.js":`(function () {
904
+ var root = document.getElementById("player-view-panel-root");
905
+
906
+ function valueNode(value) {
907
+ if (value === null || value === undefined) return document.createTextNode("—");
908
+ if (typeof value === "object") {
909
+ var wrapper = document.createElement(Array.isArray(value) ? "ul" : "dl");
910
+ Object.keys(value).forEach(function (key, index) {
911
+ var entry = document.createElement(Array.isArray(value) ? "li" : "div");
912
+ if (!Array.isArray(value)) {
913
+ var term = document.createElement("dt");
914
+ term.textContent = key;
915
+ entry.append(term);
916
+ }
917
+ entry.append(valueNode(Array.isArray(value) ? value[index] : value[key]));
918
+ wrapper.append(entry);
919
+ });
920
+ return wrapper;
921
+ }
922
+ return document.createTextNode(String(value));
923
+ }
924
+ function draw(raw) {
925
+ root.replaceChildren();
926
+ var payload;
927
+ try { payload = JSON.parse(raw || "{}"); } catch (_) { return; }
928
+ var config = payload.config || {};
929
+ root.dataset.theme = config.theme || "default";
930
+ root.dataset.layout = config.layout || "stack";
931
+ root.dataset.emptyState = config.empty || "message";
932
+ var heading = document.createElement("h3");
933
+ heading.textContent = payload.title || payload.viewId || ${JSON.stringify(n)};
934
+ root.append(heading);
935
+ var items = Array.isArray(payload.items) ? payload.items : [];
936
+ if (items.length === 0) {
937
+ if (config.empty === "message" || config.empty === "show") {
938
+ var empty = document.createElement("p");
939
+ empty.className = config.empty === "show"
940
+ ? "player-view-empty player-view-empty-value"
941
+ : "player-view-empty player-view-empty-message";
942
+ empty.textContent = config.empty === "show"
943
+ ? ${JSON.stringify(i)} + (config.emptyMessage || ${JSON.stringify(r)})
944
+ : (config.emptyMessage || ${JSON.stringify(r)});
945
+ root.append(empty);
946
+ }
947
+ } else {
948
+ var byId = new Map(items.map(function (item) { return [item.id, item]; }));
949
+ var groups = Array.isArray(config.groups) ? config.groups : [];
950
+ var renderItems = function (list, selected) {
951
+ selected.forEach(function (item) {
952
+ var row = document.createElement("div");
953
+ var label = document.createElement("dt");
954
+ label.textContent = item.label || item.id;
955
+ var value = document.createElement("dd");
956
+ value.append(valueNode(item.value));
957
+ row.append(label, value);
958
+ list.append(row);
959
+ });
960
+ };
961
+ if (groups.length === 0) {
962
+ var list = document.createElement("dl");
963
+ renderItems(list, items);
964
+ root.append(list);
965
+ } else {
966
+ groups.forEach(function (group) {
967
+ var selected = (Array.isArray(group.itemIds) ? group.itemIds : [])
968
+ .map(function (id) { return byId.get(id); })
969
+ .filter(Boolean);
970
+ if (selected.length === 0) return;
971
+ var section = document.createElement("section");
972
+ var groupHeading = document.createElement("h4");
973
+ groupHeading.textContent = group.label || group.id;
974
+ var groupList = document.createElement("dl");
975
+ renderItems(groupList, selected);
976
+ section.append(groupHeading, groupList);
977
+ root.append(section);
978
+ });
979
+ }
980
+ }
981
+ var diagnostics = Array.isArray(payload.diagnostics) ? payload.diagnostics : [];
982
+ if (diagnostics.length > 0) {
983
+ var details = document.createElement("details");
984
+ var summary = document.createElement("summary");
985
+ summary.textContent = diagnostics.length + ${JSON.stringify(a)};
986
+ details.append(summary);
987
+ var diagnosticList = document.createElement("ul");
988
+ diagnostics.forEach(function (diagnostic) {
989
+ var item = document.createElement("li");
990
+ item.textContent = diagnostic.message;
991
+ diagnosticList.append(item);
992
+ });
993
+ details.append(diagnosticList);
994
+ root.append(details);
995
+ }
996
+ }
997
+ window.addEventListener("message", function (event) {
998
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
999
+ if (event.data.type === "render.update") draw(event.data.payload && event.data.payload.content);
1000
+ });
1001
+ }());
1002
+ `,"assets/player-view-status.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
1003
+ #player-view-panel-root { display: grid; gap: .5rem; }
1004
+ #player-view-panel-root[data-theme="parchment"] { color: #4a382b; background: #fffaf1; padding: .75rem; border-radius: .65rem; }
1005
+ #player-view-panel-root dl { display: grid; gap: .45rem; margin: 0; }
1006
+ #player-view-panel-root[data-layout="grid"] dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1007
+ #player-view-panel-root dl > div { display: grid; gap: .15rem; }
1008
+ #player-view-panel-root dt { font-weight: 650; }
1009
+ #player-view-panel-root dd { margin: 0; }
1010
+ #player-view-panel-root ul, #player-view-panel-root dl dl { margin: .25rem 0 0 1rem; padding-left: 1rem; }
1011
+ .player-view-empty { color: #6c6259; }
1012
+ `}}re(`en`);function ie(e){return[{id:`action-choices`,label:e===`zh-CN`?`行动选项`:`Action choices`,name:e===`zh-CN`?`下一步建议(可编辑副本)`:`Next-step ideas (editable copy)`,files:N(e)},{id:`status-panel`,label:e===`zh-CN`?`状态栏`:`Status panel`,name:e===`zh-CN`?`状态栏(可编辑副本)`:`Status panel (editable copy)`,files:re(e)},{id:`generic-panels`,label:e===`zh-CN`?`Markdown / HTML 面板`:`Markdown / HTML panels`,name:e===`zh-CN`?`通用面板(可编辑副本)`:`Generic panels (editable copy)`,files:P(e)},{id:`artifact-debugger`,label:e===`zh-CN`?`产物调试器`:`Artifact debugger`,name:e===`zh-CN`?`产物调试器(可编辑副本)`:`Artifact debugger (editable copy)`,files:P(e)}]}ie(`en`);var ae=16;function oe(e){let t=new Uint8Array(ae);return globalThis.crypto.getRandomValues(t),`${e}-${Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}`}var F=[[`home`,`工作区`],[`content`,`内容编辑`],[`plays`,`预设`],[`create`,`新建世界`],[`preview`,`提示词预览`]];function I({screen:e,locale:t,localeSaving:n,navigationLocked:r,activeModelName:i,onNavigate:a,onLocaleChange:o}){let[s,c]=(0,l.useState)(!1);function u(e){r||(c(!1),a(e))}return(0,b.jsxs)(`header`,{className:`workspace-header`,children:[(0,b.jsx)(`button`,{type:`button`,className:`workspace-brand`,"aria-label":v(`返回工作区`),disabled:r,onClick:()=>u(`home`),children:`Narraeon`}),(0,b.jsx)(`nav`,{id:`workspace-navigation`,className:s?`workspace-navigation is-open`:`workspace-navigation`,"aria-label":v(`工作区导航`),onKeyDown:e=>{e.key===`Escape`&&(c(!1),document.getElementById(`workspace-menu-toggle`)?.focus())},children:F.map(([t,n])=>(0,b.jsx)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,disabled:r,onClick:()=>u(t),children:v(n)},t))}),(0,b.jsxs)(`div`,{className:`workspace-header-actions`,children:[(0,b.jsxs)(`label`,{className:`workspace-locale-picker`,children:[(0,b.jsx)(`span`,{children:v(`界面语言`)}),(0,b.jsxs)(`select`,{"aria-label":v(`界面语言`),value:t,disabled:n||r,onChange:e=>o(e.currentTarget.value),children:[(0,b.jsx)(`option`,{value:`en`,children:`English`}),(0,b.jsx)(`option`,{value:`zh-CN`,children:v(`简体中文`)})]})]}),(0,b.jsxs)(`button`,{type:`button`,className:`workspace-model-button`,"aria-label":v(`模型连接`),"aria-current":e===`model`?`page`:void 0,title:i??v(`尚未配置`),disabled:r,onClick:()=>u(`model`),children:[(0,b.jsx)(`span`,{className:`workspace-model-dot ${i===null?`needs-attention`:`is-ready`}`,"aria-hidden":`true`}),v(`模型连接`)]}),(0,b.jsx)(`button`,{id:`workspace-menu-toggle`,type:`button`,className:`workspace-menu-toggle`,"aria-label":v(`切换页面`),"aria-expanded":s,"aria-controls":`workspace-navigation`,disabled:r,onClick:()=>c(!s),children:`☰`})]})]})}function se({client:e,packages:t,selectedId:n,pending:r,modelConfigured:i,onSelect:a,onCreate:o,onEdit:s,onConfigureModel:c}){let u=t.find(({localId:e})=>e===n),[d,f]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t=!0;return n!==``&&e.request({type:`content.read`,packageId:n}).then(({files:e})=>{t&&f({packageId:n,failure:``,opening:e.find(({path:e})=>e===`opening.md`)?.contents??``})}).catch(e=>{t&&f({packageId:n,opening:``,failure:e instanceof Error?e.message:v(`内容包读取失败`)})}),()=>{t=!1}},[e,n]),(0,b.jsxs)(`main`,{className:`create-world-screen`,children:[(0,b.jsxs)(`aside`,{children:[(0,b.jsx)(`h1`,{children:v(`新建世界`)}),(0,b.jsx)(`p`,{children:v(`选择一份内容包,从它的开场开始。`)}),t.length===0?(0,b.jsx)(`p`,{children:v(`先新建或导入一份内容包。`)}):(0,b.jsxs)(`label`,{children:[v(`内容包`),(0,b.jsx)(`select`,{"aria-label":v(`创建世界的内容包`),value:n,disabled:r,onChange:e=>a(e.currentTarget.value),children:t.map(e=>(0,b.jsxs)(`option`,{value:e.localId,children:[e.title,e.status===`needs_repair`?v(` · 需要修复`):``]},e.localId))})]}),u?.status===`needs_repair`&&(0,b.jsx)(`p`,{role:`status`,children:v(`内容包需要修复后才能创建世界。`)}),!i&&(0,b.jsx)(`button`,{type:`button`,disabled:r,onClick:c,children:v(`配置模型连接`)}),(0,b.jsx)(`button`,{type:`button`,className:`primary-button`,disabled:r||!i||u?.status!==`usable`,onClick:o,children:v(r?`正在创建世界…`:`从当前内容包创建`)}),(0,b.jsx)(`button`,{type:`button`,disabled:r,onClick:s,children:v(u===void 0?`新建内容包`:`完善这份内容包`)}),(0,b.jsx)(`small`,{children:v(`新世界独立保存,之后的游玩不会修改源内容包。`)})]}),(0,b.jsxs)(`article`,{"aria-label":v(`开场白预览`),children:[(0,b.jsx)(`span`,{children:v(`开场白`)}),(0,b.jsx)(`h2`,{children:u?.title}),d?.packageId===n&&d.failure?(0,b.jsx)(`p`,{role:`alert`,children:d.failure}):d?.packageId===n?(0,b.jsx)(`p`,{className:`create-world-opening`,children:d.opening||v(`这份内容包还没有开场白。`)}):u===void 0?null:(0,b.jsx)(`p`,{role:`status`,children:v(`正在读取开场白…`)})]})]})}function ce({text:e,onDismiss:t,className:n=``,role:r=`status`}){return(0,b.jsxs)(`div`,{className:`dismissible-notice ${n}`,role:r,children:[(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`关闭提示`),title:v(`关闭提示`),onClick:t,children:`×`})]})}function le({contentPackages:e,worlds:t,selectedPackageId:n,modelConfigured:r,activeModelName:i,currentPresetName:a,importArchive:o,importPending:s,onImportArchiveChange:c,onOpenPlayPresets:u=()=>void 0,onCreateWorld:d,onCreatePackage:f,onImportPackage:p,onOpenPackage:m,onOpenWorld:h,onRenameWorld:g,onDeleteWorld:y}){let[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(``),T=e.filter(({status:e})=>e===`usable`).length,E=e.length-T;return(0,b.jsxs)(`main`,{className:`home-dashboard`,children:[(0,b.jsxs)(`header`,{className:`home-page-heading`,children:[(0,b.jsx)(`h1`,{children:v(`世界工作区`)}),(0,b.jsx)(`p`,{children:v(`选择一个世界继续故事,或从内容包开始创作。`)})]}),(0,b.jsxs)(`div`,{className:`home-library-grid`,children:[(0,b.jsxs)(`section`,{className:`home-surface home-world-library`,"aria-labelledby":`home-worlds-title`,children:[(0,b.jsxs)(`header`,{className:`home-section-heading`,children:[(0,b.jsx)(`div`,{children:(0,b.jsx)(`h2`,{id:`home-worlds-title`,children:v(`继续游玩`)})}),(0,b.jsx)(`span`,{className:`home-count`,"aria-label":v(`{count} 个世界`,{count:t.length}),children:t.length.toLocaleString(_())}),(0,b.jsx)(`button`,{type:`button`,disabled:s,onClick:d,children:v(`新建世界`)})]}),t.length>0?(0,b.jsx)(`div`,{className:`home-world-grid`,children:t.map(e=>(0,b.jsxs)(`div`,{className:`home-world-card-shell`,children:[(0,b.jsxs)(`button`,{className:`home-world-card`,type:`button`,"aria-label":v(`打开世界:{title}`,{title:e.title}),disabled:s,onClick:()=>h(e.worldId),children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsxs)(`span`,{className:`home-world-card-action`,children:[v(`进入世界`),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})]}),(0,b.jsxs)(`details`,{className:`home-world-card-actions`,children:[(0,b.jsx)(`summary`,{"aria-label":v(`世界操作:{title}`,{title:e.title}),children:`•••`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`button`,{className:`home-world-rename`,type:`button`,"aria-label":v(`重命名世界:{title}`,{title:e.title}),disabled:s,onClick:()=>{S(e.worldId),w(e.title)},children:v(`重命名`)}),(0,b.jsx)(`button`,{className:`home-world-delete`,type:`button`,"aria-label":v(`删除世界:{title}`,{title:e.title}),disabled:s,onClick:()=>y(e),children:v(`删除`)})]})]}),x===e.worldId?(0,b.jsxs)(`form`,{className:`home-world-rename-form`,onSubmit:t=>{t.preventDefault();let n=C.trim();n!==``&&n!==e.title&&(g(e,n),S(null))},children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{children:v(`世界名称`)}),(0,b.jsx)(`input`,{"aria-label":v(`世界名称`),autoFocus:!0,maxLength:160,value:C,onChange:e=>w(e.currentTarget.value)})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsx)(`button`,{type:`submit`,"aria-label":v(`保存世界名称`),disabled:C.trim()===``||C.trim()===e.title,children:v(`保存`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>S(null),children:v(`取消`)})]})]}):null]},e.worldId))}):(0,b.jsx)(`div`,{className:`home-empty-world`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:v(`还没有正在游玩的世界`)}),(0,b.jsx)(`p`,{children:v(`先新建内容包,或上传一份 ZIP,再整理开场与世界文档并创建独立世界。`)})]})})]}),(0,b.jsxs)(`section`,{className:`home-surface home-content-library`,"aria-labelledby":`home-content-title`,children:[(0,b.jsxs)(`header`,{className:`home-section-heading`,children:[(0,b.jsx)(`div`,{children:(0,b.jsx)(`h2`,{id:`home-content-title`,children:v(`内容包`)})}),(0,b.jsx)(`button`,{type:`button`,disabled:s,onClick:f,children:v(`新建内容包`)})]}),(0,b.jsxs)(`div`,{className:`home-content-layout`,children:[(0,b.jsx)(`div`,{children:e.length>0?(0,b.jsx)(`div`,{className:`home-package-list`,children:e.map(e=>(0,b.jsxs)(`button`,{className:`home-package-card`,type:`button`,"aria-label":v(`打开内容包:{name}`,{name:e.title}),"aria-pressed":e.localId===n,disabled:s,onClick:()=>m(e.localId),children:[(0,b.jsxs)(`span`,{className:`home-package-card-heading`,children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsx)(`span`,{className:`home-package-state ${e.status}`,children:e.status===`usable`?v(`可用`):v(`待修复`)})]}),(0,b.jsx)(`span`,{className:`home-package-card-copy`,children:e.status===`usable`?v(`可编辑、预览并创建新世界`):v(`打开并修复当前树中的问题`)})]},e.localId))}):(0,b.jsxs)(`div`,{className:`home-empty-packages`,children:[(0,b.jsx)(`h3`,{children:v(`从一组人类可读文件开始`)}),(0,b.jsx)(`p`,{children:v(`先新建或导入一份内容包,再完善开场与世界设定。`)})]})}),(0,b.jsxs)(`details`,{className:`home-import-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`导入内容包 ZIP`)}),(0,b.jsxs)(`form`,{className:`home-import-card`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:v(`导入 ZIP`)}),(0,b.jsx)(`p`,{children:v(`选择本应用导出或遵循相同结构的内容包 ZIP;导入会创建新的本地身份,不覆盖同名内容包。`)})]}),(0,b.jsxs)(`label`,{className:`home-zip-picker`,children:[(0,b.jsx)(`span`,{children:v(`内容包 ZIP`)}),(0,b.jsx)(`input`,{className:`home-zip-picker-input`,type:`file`,accept:`.zip,application/zip,application/x-zip-compressed`,"aria-label":v(`内容包 ZIP 文件`),disabled:s,onChange:e=>c(e.target.files?.[0]??null)},o===null?`empty`:`${o.name}:${o.size}:${o.lastModified}`),(0,b.jsx)(`span`,{className:`home-zip-picker-control`,children:(0,b.jsx)(`span`,{"aria-live":`polite`,children:o===null?v(`尚未选择`):`${o.name} · ${L(o.size)}`})})]}),(0,b.jsx)(`button`,{type:`submit`,disabled:o===null||s,children:v(s?`正在导入…`:`导入 ZIP`)})]})]})]})]})]}),(0,b.jsxs)(`footer`,{className:`home-status-line`,"aria-label":v(`工作区状态`),children:[(0,b.jsxs)(`span`,{children:[v(`模型连接`),` ·`,` `,r?i:v(`尚未配置`)]}),(0,b.jsxs)(`button`,{type:`button`,disabled:s,onClick:u,children:[v(`当前预设`),` · `,a??v(`尚未选择`)]}),(0,b.jsxs)(`span`,{children:[v(`可用内容包`),` · `,T,E>0&&v(` · {count} 份待修复`,{count:E})]})]})]})}function L(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:`${(e/1048576).toFixed(1)} MiB`}function ue(e){return/\((?:-1|none|auto|minimal|low|medium|high|xhigh|max|\d+)\)$/iu.test(e)}function de(){return{connectionId:null,name:v(`默认模型`),presetId:`custom`,provider:`chat_completions`,dialect:`standard`,baseUrl:``,apiKey:``,modelId:``,reasoningEffort:`provider_default`,reasoningSummary:`provider_default`,thinkingMode:`provider_default`,thinkingBudgetTokens:``,contextWindowTokens:`128000`,maxOutputTokens:`16000`}}function fe({client:e,library:t,onLibraryChange:n,onNotice:r,onDirtyChange:i}){let a=t.connections.find(({id:e})=>e===t.activeConnectionId),[o,s]=(0,l.useState)(()=>a===void 0?de():R(a)),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),h=t.connections.find(({id:e})=>e===t.activeConnectionId),g=(0,l.useMemo)(()=>t.presets.find(({id:e})=>e===o.presetId),[o.presetId,t.presets]),_=o.connectionId===null;(0,l.useEffect)(()=>i(p),[p,i]),(0,l.useEffect)(()=>()=>{i(!1)},[i]);function y(e,t=!1){s(t=>({...t,...e})),m(!0),t&&u([])}function x(e){let n=t.presets.find(({id:t})=>t===e);n!==void 0&&y(n.id===`custom`?{presetId:e}:{presetId:e,provider:n.provider,dialect:`standard`,...ge(o,n.provider,`standard`),baseUrl:n.baseUrl,name:o.connectionId===null||o.name===v(`默认模型`)?n.name:o.name},!0)}function S(e){s(R(e)),u([]),m(!1),r(``)}function C(){s(de()),u([]),m(!1),r(``)}async function w(t){if(t.preventDefault(),d===null){f(`save`);try{let t=await e.request({type:`model.save`,connection:{...o.connectionId===null?{}:{connectionId:o.connectionId},name:o.name,presetId:o.presetId,provider:o.provider,dialect:o.dialect,baseUrl:o.baseUrl,...o.apiKey.length===0?{}:{apiKey:o.apiKey},modelId:o.modelId,reasoningEffort:o.reasoningEffort,reasoningSummary:o.reasoningSummary,thinkingMode:o.thinkingMode,thinkingBudgetTokens:o.thinkingMode===`enabled`?Number(o.thinkingBudgetTokens):null,contextWindowTokens:Number(o.contextWindowTokens),maxOutputTokens:Number(o.maxOutputTokens)}});n(t),m(!1);let i=t.connections.find(({id:e})=>e===t.activeConnectionId);i!==void 0&&S(i),r(v(`模型连接已保存并启用;后续请求只使用当前配置。`))}catch(e){r(me(e))}finally{f(null)}}}async function T(t){if(d===null){f(t);try{n(await e.request({type:`model.select`,connectionId:t})),r(v(`已切换当前模型配置;Runtime 不会自动故障转移。`))}catch(e){r(me(e))}finally{f(null)}}}async function E(i){if(d===null){f(`copy:${i.id}`);try{let a=he(i.name,t.connections),o=await e.request({type:`model.copy`,connectionId:i.id,name:a}),s=o.library.connections.find(({id:e})=>e===o.copiedConnectionId);if(s===void 0)throw Error(v(`Runtime 没有返回已克隆的模型配置`));n(o.library),S(s),r(v(`已克隆为「{name}」。副本保留本机凭据,但不会切换当前配置。`,{name:s.name}))}catch(e){r(me(e))}finally{f(null)}}}async function D(t){if(d===null){f(`delete:${t}`);try{n(await e.request({type:`model.delete`,connectionId:t})),o.connectionId===t&&C(),r(v(`模型配置已从本机删除。`))}catch(e){r(me(e))}finally{f(null)}}}async function O(){if(d===null){f(`models`);try{let t=await e.request({type:`model.models`,...o.connectionId===null?{}:{connectionId:o.connectionId},provider:o.provider,baseUrl:o.baseUrl,...o.apiKey.length===0?{}:{apiKey:o.apiKey}});u(t.models),r(v(`已从当前端点拉取 {count} 个模型 ID。`,{count:t.models.length}))}catch(e){r(me(e))}finally{f(null)}}}return(0,b.jsxs)(`section`,{className:`model-connection-screen`,"aria-labelledby":`model-title`,children:[(0,b.jsxs)(`header`,{className:`config-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:`WORKSPACE SETTING`}),(0,b.jsx)(`h2`,{id:`model-title`,children:v(`模型连接`)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`保存多份本机配置并明确切换。API Key 不会返回浏览器;切换失败时 Runtime 不会悄悄改用另一份配置。`)})]}),(0,b.jsxs)(`div`,{className:`model-active-summary`,children:[(0,b.jsx)(`span`,{children:v(`当前配置`)}),(0,b.jsx)(`strong`,{children:h?.name??v(`尚未启用`)}),(0,b.jsx)(`small`,{children:h?.modelId??v(`先保存一份可用连接`)})]})]}),(0,b.jsxs)(`div`,{className:`config-layout`,children:[(0,b.jsxs)(`form`,{className:`config-form panel-card`,onSubmit:e=>void w(e),children:[(0,b.jsxs)(`div`,{className:`section-heading-row`,children:[(0,b.jsx)(`h3`,{children:o.connectionId===null?v(`新建配置`):v(`编辑配置`)}),o.connectionId!==null&&(0,b.jsx)(`button`,{className:`secondary-button`,disabled:p,onClick:C,type:`button`,children:v(`新建另一份`)})]}),(0,b.jsx)(`label`,{htmlFor:`model-preset`,children:v(`提供商`)}),(0,b.jsx)(`select`,{id:`model-preset`,value:o.presetId,onChange:e=>x(e.target.value),children:t.presets.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,b.jsx)(`label`,{htmlFor:`model-name`,children:v(`配置名称`)}),(0,b.jsx)(`input`,{id:`model-name`,maxLength:160,required:!0,value:o.name,onChange:e=>y({name:e.target.value})}),(0,b.jsx)(`label`,{htmlFor:`model-provider`,children:v(`协议适配器`)}),(0,b.jsxs)(`select`,{id:`model-provider`,value:o.provider,onChange:e=>y({presetId:`custom`,provider:e.target.value,...ge(o,e.target.value,o.dialect)},!0),children:[(0,b.jsx)(`option`,{value:`chat_completions`,children:`OpenAI-compatible Chat Completions`}),(0,b.jsx)(`option`,{value:`openai_responses`,children:`OpenAI Responses API`}),(0,b.jsx)(`option`,{value:`anthropic_messages`,children:`Anthropic Messages`})]}),(0,b.jsx)(`label`,{htmlFor:`model-dialect`,children:v(`端点方言`)}),(0,b.jsxs)(`select`,{id:`model-dialect`,value:o.dialect,onChange:e=>{let t=e.target.value;y({dialect:t,...ge(o,o.provider,t)})},children:[(0,b.jsx)(`option`,{value:`standard`,children:v(`协议标准`)}),(0,b.jsx)(`option`,{value:`cliproxyapi`,children:`CLIProxyAPI`})]}),(0,b.jsxs)(`details`,{className:`parameter-help`,children:[(0,b.jsx)(`summary`,{children:v(`参数说明`)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`CLIProxyAPI 方言只启用代理明确支持的兼容参数;响应仍按所选协议解析,不从可见文本猜测思考块。Claude 的签名 thinking 请选 Responses 或 Anthropic Messages;Chat Completions 通常只有 reasoning_content,不能承诺无损续传签名。模型名的 (high) 等 thinking 后缀会覆盖请求参数,因此 Effort 与 Thinking 都必须保留“Provider 默认”。`)})]}),(0,b.jsxs)(`div`,{className:`model-reasoning-fields`,children:[(0,b.jsxs)(`label`,{htmlFor:`model-reasoning-effort`,children:[v(`Effort(推理强度)`),(0,b.jsxs)(`select`,{id:`model-reasoning-effort`,value:o.reasoningEffort,onChange:e=>y({reasoningEffort:e.target.value}),children:[(0,b.jsx)(`option`,{value:`provider_default`,children:v(`Provider 默认`)}),o.provider===`anthropic_messages`?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`option`,{value:`none`,children:`none`}),(0,b.jsx)(`option`,{value:`minimal`,children:`minimal`})]}),(0,b.jsx)(`option`,{value:`low`,children:`low`}),(0,b.jsx)(`option`,{value:`medium`,children:`medium`}),(0,b.jsx)(`option`,{value:`high`,children:`high`}),(0,b.jsx)(`option`,{value:`xhigh`,children:`xhigh`}),(0,b.jsx)(`option`,{value:`max`,children:`max`})]})]}),(0,b.jsxs)(`label`,{htmlFor:`model-thinking-mode`,children:[v(`Thinking(思考模式)`),(0,b.jsxs)(`select`,{id:`model-thinking-mode`,disabled:o.provider!==`anthropic_messages`,value:o.thinkingMode,onChange:e=>{let t=e.target.value;y({thinkingMode:t,thinkingBudgetTokens:t===`enabled`?o.thinkingBudgetTokens||ve(o.maxOutputTokens):``,reasoningSummary:t===`provider_default`||t===`disabled`?t===`provider_default`&&_e({...o,thinkingMode:t})?o.reasoningSummary:`provider_default`:o.reasoningSummary})},children:[(0,b.jsx)(`option`,{value:`provider_default`,children:v(`Provider 默认`)}),(0,b.jsx)(`option`,{value:`adaptive`,children:`adaptive`}),(0,b.jsx)(`option`,{value:`enabled`,children:v(`手动 token 预算`)}),(0,b.jsx)(`option`,{value:`disabled`,children:`disabled`})]})]}),(0,b.jsxs)(`label`,{htmlFor:`model-reasoning-summary`,children:[v(`Thinking 返回内容`),(0,b.jsxs)(`select`,{id:`model-reasoning-summary`,disabled:o.provider===`chat_completions`&&o.dialect===`standard`||o.provider===`anthropic_messages`&&(o.thinkingMode===`provider_default`||o.thinkingMode===`disabled`)&&!_e(o),value:o.reasoningSummary,onChange:e=>y({reasoningSummary:e.target.value}),children:[(0,b.jsx)(`option`,{value:`provider_default`,children:v(`Provider 默认`)}),(0,b.jsx)(`option`,{value:`auto`,children:`auto`}),o.provider===`openai_responses`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`option`,{value:`concise`,children:`concise`}),(0,b.jsx)(`option`,{value:`detailed`,children:`detailed`})]}):null,(0,b.jsx)(`option`,{value:`none`,children:`none`})]})]})]}),o.provider===`anthropic_messages`&&o.thinkingMode===`enabled`?(0,b.jsxs)(`label`,{htmlFor:`model-thinking-budget`,children:[v(`Thinking budget tokens`),(0,b.jsx)(`input`,{id:`model-thinking-budget`,min:1024,max:Math.max(1024,Number(o.maxOutputTokens)-1),required:!0,step:1,type:`number`,value:o.thinkingBudgetTokens,onChange:e=>y({thinkingBudgetTokens:e.target.value})})]}):null,(0,b.jsxs)(`details`,{className:`parameter-help`,children:[(0,b.jsx)(`summary`,{children:v(`参数说明`)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`Effort 控制整份响应投入;Anthropic Thinking 独立控制思考块,手动预算必须小于最大输出。Thinking 返回内容只进入模型诊断;原生续传块仍会原样保存。`)})]}),(0,b.jsx)(`label`,{htmlFor:`model-base-url`,children:`Base URL`}),(0,b.jsx)(`input`,{id:`model-base-url`,"aria-label":`Base URL`,required:!0,type:`url`,value:o.baseUrl,onChange:e=>y({presetId:`custom`,baseUrl:e.target.value},!0)}),g?.id!==`custom`&&(0,b.jsxs)(`p`,{className:`field-note`,children:[v(`已填入`),g?.name,` `,v(`的内置端点;手动修改后按自定义端点保存。`)]}),(0,b.jsx)(`label`,{htmlFor:`model-api-key`,children:`API Key`}),(0,b.jsx)(`input`,{autoComplete:`off`,id:`model-api-key`,"aria-label":`API Key`,required:_,type:`password`,value:o.apiKey,placeholder:o.connectionId===null?v(`新配置必填`):v(`留空以沿用本机保存的现有凭据`),onChange:e=>y({apiKey:e.target.value},!0)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`编辑已有配置时,API Key 留空会把本机保存的现有凭据用于当前协议和端点;填写新值会覆盖它。`)}),(0,b.jsxs)(`div`,{className:`model-picker-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{htmlFor:`model-id`,children:v(`模型 ID`)}),(0,b.jsx)(`input`,{id:`model-id`,"aria-label":v(`模型 ID`),list:`provider-models`,maxLength:512,required:!0,value:o.modelId,onChange:e=>{let t=e.target.value;y({modelId:t,...o.provider===`anthropic_messages`&&o.thinkingMode===`provider_default`&&!_e({...o,modelId:t})?{reasoningSummary:`provider_default`}:{}})}}),(0,b.jsx)(`datalist`,{id:`provider-models`,children:c.map(e=>(0,b.jsx)(`option`,{value:e},e))})]}),(0,b.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||o.baseUrl.length===0||_&&o.apiKey.length===0,onClick:()=>void O(),type:`button`,children:v(d===`models`?`正在拉取…`:`从端点拉取模型`)})]}),c.length>0&&(0,b.jsx)(`p`,{className:`field-note`,children:v(`可在模型 ID 输入框中选择已拉取结果。`)}),(0,b.jsxs)(`div`,{className:`two-column-fields`,children:[(0,b.jsxs)(`label`,{children:[v(`真实 context window`),(0,b.jsx)(`input`,{min:4096,max:16777216,required:!0,step:1,type:`number`,value:o.contextWindowTokens,onChange:e=>y({contextWindowTokens:e.target.value})})]}),(0,b.jsxs)(`label`,{children:[v(`最大输出 tokens`),(0,b.jsx)(`input`,{min:256,max:16777215,required:!0,step:1,type:`number`,value:o.maxOutputTokens,onChange:e=>y({maxOutputTokens:e.target.value})})]})]}),(0,b.jsxs)(`div`,{className:`form-actions`,children:[(0,b.jsx)(`button`,{disabled:d!==null,type:`submit`,children:v(d===`save`?`正在保存…`:`保存模型连接并启用`)}),p&&o.connectionId!==null&&(0,b.jsx)(`button`,{className:`secondary-button`,disabled:d!==null,onClick:()=>{let e=t.connections.find(({id:e})=>e===o.connectionId);e!==void 0&&S(e)},type:`button`,children:v(`放弃修改`)}),p&&o.connectionId===null&&(0,b.jsx)(`button`,{className:`secondary-button`,disabled:d!==null,onClick:C,type:`button`,children:v(`重置新配置`)})]})]}),(0,b.jsxs)(`section`,{className:`config-list`,"aria-label":v(`已保存模型配置`),children:[(0,b.jsxs)(`div`,{className:`section-heading-row`,children:[(0,b.jsx)(`h3`,{children:v(`已保存配置`)}),(0,b.jsxs)(`span`,{children:[t.connections.length,` `,v(`份`)]})]}),t.connections.length===0&&(0,b.jsx)(`p`,{className:`panel-card`,children:v(`尚未保存模型配置。`)}),t.connections.map(e=>{let n=e.id===t.activeConnectionId;return(0,b.jsxs)(`article`,{className:`config-card panel-card${n?` active-model-config`:``}`,children:[(0,b.jsxs)(`div`,{className:`section-heading-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:pe(e.provider)}),(0,b.jsx)(`h3`,{children:e.name})]}),n&&(0,b.jsx)(`span`,{className:`active-config`,children:v(`当前使用`)})]}),(0,b.jsxs)(`details`,{className:`model-connection-details`,children:[(0,b.jsx)(`summary`,{children:e.modelId}),(0,b.jsxs)(`dl`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`模型`)}),(0,b.jsx)(`dd`,{children:e.modelId})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`端点`)}),(0,b.jsx)(`dd`,{children:e.baseUrl})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`窗口 / 输出`)}),(0,b.jsxs)(`dd`,{children:[e.contextWindowTokens.toLocaleString(),` /`,` `,e.maxOutputTokens.toLocaleString()]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`方言 / Effort / Thinking`)}),(0,b.jsxs)(`dd`,{children:[e.dialect,` / `,e.reasoningEffort,` /`,` `,e.thinkingMode,e.thinkingBudgetTokens===null?``:` (${e.thinkingBudgetTokens.toLocaleString()} tokens)`,` `,`/ `,e.reasoningSummary]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`凭据`)}),(0,b.jsx)(`dd`,{children:e.hasApiKey?v(`已保存在本机`):v(`未配置`)})]})]})]}),(0,b.jsxs)(`div`,{className:`form-actions`,children:[!n&&(0,b.jsx)(`button`,{disabled:d!==null,onClick:()=>void T(e.id),type:`button`,children:d===e.id?v(`正在切换…`):v(`切换到此配置`)}),(0,b.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||p,onClick:()=>void E(e),type:`button`,children:d===`copy:${e.id}`?v(`正在克隆…`):v(`克隆配置`)}),(0,b.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||p||o.connectionId===e.id,onClick:()=>S(e),type:`button`,children:o.connectionId===e.id?v(`正在编辑`):v(`编辑`)}),(0,b.jsx)(`button`,{className:`danger-button`,disabled:d!==null||p||n&&t.connections.length>1,onClick:()=>void D(e.id),type:`button`,children:d===`delete:${e.id}`?v(`正在删除…`):v(`删除`)})]}),n&&t.connections.length>1&&(0,b.jsx)(`p`,{className:`field-note`,children:v(`先切换到另一份配置,才能删除当前配置。`)})]},e.id)})]})]})]})}function pe(e){switch(e){case`chat_completions`:return`Chat Completions`;case`openai_responses`:return`OpenAI Responses`;case`anthropic_messages`:return`Anthropic Messages`}}function R(e){return{connectionId:e.id,name:e.name,presetId:e.presetId,provider:e.provider,dialect:e.dialect,baseUrl:e.baseUrl,apiKey:``,modelId:e.modelId,reasoningEffort:e.reasoningEffort,reasoningSummary:e.reasoningSummary,thinkingMode:e.thinkingMode,thinkingBudgetTokens:e.thinkingBudgetTokens===null?``:String(e.thinkingBudgetTokens),contextWindowTokens:String(e.contextWindowTokens),maxOutputTokens:String(e.maxOutputTokens)}}function me(e){return e instanceof Error?e.message:v(`模型配置操作失败`)}function he(e,t){let n=new Set(t.map(({name:e})=>e));for(let r=1;r<=t.length+1;r+=1){let t=r===1?v(`(副本)`):v(`(副本 {number})`,{number:r}),i=`${e.slice(0,Math.max(0,160-t.length))}${t}`;if(!n.has(i))return i}throw Error(v(`无法生成不重复的副本名称`))}function ge(e,t,n){let r=t===`anthropic_messages`&&(e.reasoningEffort===`none`||e.reasoningEffort===`minimal`)?`provider_default`:e.reasoningEffort,i=t===`anthropic_messages`&&e.provider===`anthropic_messages`?e.thinkingMode:`provider_default`,a=_e({...e,provider:t,dialect:n,thinkingMode:i});return{reasoningEffort:r,reasoningSummary:t!==`openai_responses`&&(e.reasoningSummary===`concise`||e.reasoningSummary===`detailed`)||t===`chat_completions`&&n===`standard`||t===`anthropic_messages`&&(i===`provider_default`||i===`disabled`)&&!a?`provider_default`:e.reasoningSummary,thinkingMode:i,thinkingBudgetTokens:i===`enabled`?e.thinkingBudgetTokens:``}}function _e(e){return e.provider===`anthropic_messages`&&e.dialect===`cliproxyapi`&&e.thinkingMode===`provider_default`&&ue(e.modelId)}function ve(e){let t=Number(e);return!Number.isSafeInteger(t)||t<=1024?`1024`:String(Math.min(8192,t-1))}function ye(e){let t=e.split(`/`).at(-1)??e,n=t.replace(/^(?:[a-f0-9]{8}-[a-f0-9-]{27}-)+/u,``).replace(/\.[a-f0-9]{8}-[a-f0-9-]{27}(?=\.)/gu,``);return n!==t&&n.startsWith(`named-`)?n.slice(6).replace(/_u([a-f0-9]+)_/gu,(e,t)=>Number.parseInt(t,16)<=1114111?String.fromCodePoint(Number.parseInt(t,16)):`_u${t}_`):n}function be(e,t){let n=`example_${crypto.randomUUID().replaceAll(`-`,``)}`,r=_()===`zh-CN`,i=`renderers/${n}.html`,a=`scripts/${n}.js`,o=`assets/${n}.css`,s=e===`actions`?[{label:r?`询问船夫`:`Ask the ferryman`,prompt:r?`我问船夫:这封信是谁交给你的?`:`I ask the ferryman who gave him the letter.`}]:{title:r?`雾港`:`Mist harbour`,body:r?`灯塔在暮色中亮起。`:`The lighthouse shines at dusk.`};return{artifact:{name:n,displayName:e===`actions`?r?`行动建议按钮`:`Action buttons`:r?`结构化场景卡片`:`Scene card`,purpose:e===`actions`?r?`提供下一步行动草稿,不自动发送。`:`Offer draft actions without sending them.`:r?`回顾已发生的场景。`:`Recap the established scene.`,channel:`${t}.${n}`,strategy:`replace`,contentType:`application/json`,renderer:i,rendererRevision:`v1`,rendererMode:`app`,scripts:[a],assets:[o],save:`commit`,invalidation:`new_operation`,required:!1,maxEmits:1,payloadContract:e===`actions`?{type:`array`,minItems:1,maxItems:6,items:{type:`object`,additionalProperties:!1,required:[`label`,`prompt`],properties:{label:{type:`string`,minLength:1,maxLength:80},prompt:{type:`string`,minLength:1,maxLength:1e3}}}}:{type:`object`,additionalProperties:!1,required:[`title`,`body`],properties:{title:{type:`string`,minLength:1,maxLength:80},body:{type:`string`,maxLength:4e3}}}},files:{[i]:`<!doctype html><html><body><main id="content"></main><p id="feedback" role="status"></p></body></html>`,[o]:`body { margin: 0; padding: 16px; color: #27333c; background: #f7f4eb; font: 14px/1.7 system-ui; } #content { display: grid; gap: 8px; } button { padding: 12px; border: 1px solid #b9ad95; background: white; text-align: left; cursor: pointer; } button:disabled { opacity: .5; cursor: default; }`,[a]:`// request and fromHost are helpers defined by this example, not a built-in SDK.
1013
+ (function () {
1014
+ var pending = new Map();
1015
+ var instanceId = document.documentElement.dataset.narraeonInstance;
1016
+ var nonce = document.documentElement.dataset.narraeonNonce;
1017
+ var feedback = document.getElementById("feedback");
1018
+ function fromHost(event) {
1019
+ var message = event.data;
1020
+ return event.source === parent && message && message.namespace === "narraeon.extension.v1" && message.instanceId === instanceId && message.nonce === nonce;
1021
+ }
1022
+ function request(command, payload) {
1023
+ var requestId = crypto.randomUUID();
1024
+ pending.set(requestId, command);
1025
+ parent.postMessage({namespace: "narraeon.extension.v1", instanceId: instanceId, nonce: nonce, requestId: requestId, command: command, payload: payload}, "*");
1026
+ }
1027
+ window.addEventListener("message", function (event) {
1028
+ if (!fromHost(event)) return;
1029
+ var message = event.data;
1030
+ if (message.type === "bridge.response" && pending.has(message.requestId)) {
1031
+ pending.delete(message.requestId);
1032
+ feedback.textContent = message.ok ? ${JSON.stringify(r?`已填写草稿,尚未发送。`:`Draft filled, not sent.`)} : ${JSON.stringify(r?`操作失败:`:`Action failed: `)} + JSON.stringify(message.error || message.payload);
1033
+ return;
1034
+ }
1035
+ if (message.type !== "render.update") return;
1036
+ var root = document.getElementById("content");
1037
+ root.replaceChildren();
1038
+ try {
1039
+ // payload.content is the STRING after display processing.
1040
+ var data = JSON.parse(message.payload.content);
1041
+ feedback.textContent = message.payload.interactionDisabled ? ${JSON.stringify(r?`当前禁止交互。`:`Interactions are currently disabled.`)} : "";
1042
+ ${e===`actions`?`data.forEach(function (item) {
1043
+ var button = document.createElement("button");
1044
+ button.textContent = item.label;
1045
+ button.disabled = Boolean(message.payload.interactionDisabled);
1046
+ button.addEventListener("click", function () { request("composer.set_draft", {text: item.prompt}); });
1047
+ root.append(button);
1048
+ });`:`var title = document.createElement("h3");
1049
+ title.textContent = data.title;
1050
+ var body = document.createElement("p");
1051
+ body.textContent = data.body;
1052
+ root.append(title, body);`}
1053
+ } catch (error) { feedback.textContent = String(error); }
1054
+ });
1055
+ }());
1056
+ `},sample:s}}function xe(e){let t=e===`zh-CN`;return[{id:`author.mechanics`,name:t?`创作工具与结算(必选)`:`Authoring tools and settlement (required)`,required:!0,body:Se(e,`setting`)},{id:`author.guidance`,name:t?`创作建议`:`Authoring guidance`,required:!1,body:ne(e)},{id:`author.target`,name:t?`创作目标与读取授权(动态必选)`:`Target and read authorization (required, dynamic)`,required:!0,body:t?`实际请求在此显示内容包或修订世界身份及当前树边界。世界修订保留独占 epoch;跨 epoch 继续时在用户消息前显式通知并清空读取授权。文件正文只通过工具按需读取,不预注入整棵树。`:`The actual request shows the content package or revision world identity and current-tree boundary here. World revision retains its exclusive epoch; continuing across epochs announces the transition before the user message and clears read authorization. Files are read on demand through tools, never injected as a whole tree.`},{id:`author.play-reference`,name:t?`未来游玩参考(动态)`:`Future play reference (dynamic)`,required:!1,body:t?`在此展开当前预设已启用的游玩编排,明确标为未来游玩参考,不是本轮叙事要求。内容包及世界正文仍通过创作工具读取。`:`Expands the current preset's enabled play arrangement as future-play reference, not narrative instructions for this conversation. Actual package and world content remains behind authoring tools.`}]}function Se(e,t){let n=e===`zh-CN`;return`# ${n?`创作工具与结算`:`Authoring tools and settlement`}\n\n${n?`只使用请求随附的工具及其参数契约。含工具调用的响应是中间步;收到全部工具结果后继续,非空且无工具调用的响应结束本次发送。完整工具响应按调用顺序结算,失败调用不撤销成功同级调用。修改既有文件前必须完整读取;cursor 只属于产生它的树 revision;本事务自身成功修改后的完整读取授权由 Runtime 承接。外部树变化或跨 epoch 后旧授权失效,需要重新读取。工具返回逻辑路径,不能访问宿主文件。文档引用使用返回的 @ref;YAML 整文档引用为单键 {$ref: "@ref"},locator 使用 map key 或从零开始的数组下标。成功回执决定当前值,模型文字不构成提交。`:`Use only the attached tools and their parameter contracts. Responses with tool calls are intermediate steps; continue after all results. A nonempty tool-free response ends this send. Complete tool responses settle calls in order; a failed call does not undo successful siblings. Completely read existing files before writing. Cursors belong to their producing tree revision. Runtime carries complete-read authorization through this transaction’s own successful changes. External tree changes or an epoch transition invalidate old authorization and require new reads. Tools expose logical paths, never host files. Use returned @refs for documents; YAML whole-document references are single-key {$ref: "@ref"} maps, and locators use map keys or zero-based array indexes. Actual receipts determine current values; model prose cannot commit changes.`}\n\n${t===`setting`?n?`内容包工具的成功变化在完整响应结算时原子发布到当前树,无需应用。setting_create 建立新文档身份;删除仅在无绑定与引用阻挡时接受。`:`Successful content-package changes publish atomically to the current tree when the complete response settles, with no Apply step. setting_create establishes new document identities; deletion is accepted only without binding or reference blockers.`:n?`世界修订工具只修改持久独占 epoch 的 state/* 与 control/* 工作树。opening.md 不可读取或修改,既有状态文档不可删除或移动。只有玩家应用或放弃才结束 epoch;应用提交世界,放弃不改变世界。跨 epoch 全部旧读取授权失效。`:`World-revision tools modify only state/* and control/* in the durably locked exclusive epoch. opening.md cannot be read or changed; existing state documents cannot be deleted or moved. Only player Apply or Discard ends the epoch; Apply commits the world, Discard leaves it unchanged. Every old read authorization expires across epochs.`}\n\n${n?`control/player-views.yaml 的 format 为 narraeon.player-views/v1;views 中每项有 id、title 和 items,items 中每项有 id、label、select。精确选择一个 YAML 字段使用 select: {document: "@ref", locator: {yaml: [字段名]}};Markdown 小节使用 locator: {markdown: [标题]}。document 必须来自实际返回的引用,locator 必须对应已读正文;省略 locator 会展示整份文档,选择容器会递归展示子树。`:`control/player-views.yaml uses format: narraeon.player-views/v1. Each views entry has id, title and items; each item has id, label and select. Select one YAML field with select: {document: "@ref", locator: {yaml: [field]}}; select a Markdown section with locator: {markdown: [heading]}. Use a returned document reference and a locator from the actual read body. Omitting locator displays the whole document; selecting a container recursively displays its subtree.`}`}function Ce(e){let t=e===`zh-CN`,n=A(e);return[{id:`play.mechanics`,name:t?`工具与响应结算(必选)`:`Tools and response settlement (required)`,required:!0,body:t?`# 工具与响应结算
1057
+
1058
+ 只可调用请求随附的工具。目录使用 Runtime 返回的 @dir-*;文档和历史使用返回的 @句柄。工具结果标明读取范围、完整性及 cursor;目录摘要不等于正文。材料覆盖中完整正文与精确读取授予对应范围的写入资格,界面绑定标注不授予额外权限。同一原生对话刷新提示时,仅在当前状态与旧读取凭据完全匹配时承接原精确范围,并合并本次注入授权;全新上下文不继承旧对话授权。
1059
+
1060
+ world_patch 的 YAML locator 可以包含 map key 和从零开始的数组下标;remove 删除一个精确位置。未提供的元数据保持原值。world_retire 从目录注入中退役文档,文档仍可读取、引用和恢复。工具响应的成功状态变化与后续最终叙事分别提交,后续失败不回滚已提交变化。成功写入回执表示当前值已改变;以真实回执的结算状态为准,模型文字不能提交世界。
1061
+
1062
+ 包含工具调用的响应属于中间步,正文不作为最终叙事提交。收到全部工具结果后继续;没有工具调用的非空正文结束本次循环并由 Runtime 提交叙事。world_checkpoint 登记在随后最终叙事成功提交后生效,边界包含该叙事;登记后仍可继续工具调用。全新上下文的历史补充只包含检查点后的已提交玩家原文与最终叙事,排除开场白、工具和推理。`:`# Tools and response settlement
1063
+
1064
+ Use only attached tools. Directories use returned @dir-* handles; documents and history use returned @handles. Results identify read scope, completeness and cursor; directory summaries are not document bodies. Complete injected bodies and exact reads authorize writes within their corresponding scopes; player-view annotations grant no additional authority. Refreshing the same native conversation retains prior exact scopes only when the current state matches their proof, merging them with current injected authorization. A fresh context does not inherit old conversation authorization.
1065
+
1066
+ YAML world_patch locators accept map keys and zero-based array indexes; remove deletes one exact location. Omitted metadata remains unchanged. world_retire removes a document from catalog injection while keeping it readable, referenceable and restorable. Successful tool-response state changes and later final narrative commit separately; later failure does not roll back committed changes. Successful write receipts change current values; the actual receipt determines settlement, not model prose.
1067
+
1068
+ Responses containing tool calls are intermediate steps; their text is not committed as final narrative. Continue after all tool results. A nonempty tool-free response ends this loop and Runtime commits its narrative. world_checkpoint takes effect after the subsequent final narrative commits, including that narrative in its boundary; further tool calls may follow registration. Fresh-context replay contains committed player originals and final narratives after the checkpoint, excluding the opening, tools and reasoning.`},{id:`play.style`,name:t?`通用文风`:`General style`,body:n[`blocks/style.md`],required:!1},...[`adjudication`,`state`].map(e=>({id:`play.${e}`,name:t?e===`state`?`状态维护建议`:`裁判与玩家代理权`:e===`state`?`State maintenance`:`Adjudication and player agency`,body:n[`blocks/${e}.md`],required:!1})),{id:`play.narrative`,name:t?`叙事建议`:`Narrative guidance`,body:O(e),required:!1},...Object.entries(n).filter(([e])=>e.startsWith(`blocks/style-`)).map(([e,t])=>({id:`play.${e.slice(7,-3)}`,name:/^#\s+(.+)$/mu.exec(t)?.[1]??e,body:t,required:!1}))]}function we({entries:e,onChange:t,migrationNotice:n,authoring:r=!1,directory:i,promptPreview:a,detail:o,onSelectPrompt:s}){let[c,u]=(0,l.useState)(e[0]?.id),[d,f]=(0,l.useState)(),p=_(),m=p===`zh-CN`,h=(e,t)=>m?t:e,g=r?xe(p):Ce(p),v=e.find(e=>e.id===c)??e[0],y=v?.kind===`builtin`?g.find(e=>e.id===v.builtin):void 0,x=e=>e.kind===`world`?h(`Complete world prompt`,`完整内容包提示`):e.kind===`user`?e.name:g.find(t=>t.id===e.builtin).name,S=e.findIndex(e=>e.id===v?.id);function C(n,r){let i=e.findIndex(e=>e.id===n);if(i<0||r<0||r>=e.length||i===r)return;let a=[...e],[o]=a.splice(i,1);a.splice(r,0,o),t(a)}function w(n){t(e.map(e=>e.id===n.id?n:e))}function T(n=``,r=h(`New prompt`,`新提示词`)){let i={id:crypto.randomUUID(),kind:`user`,name:r,enabled:!0,body:n},a=[...e];a.splice(S+1,0,i),t(a),u(i.id),s?.()}return(0,b.jsxs)(`section`,{"aria-label":r?h(`Ordered authoring prompts`,`设定完善提示词编排`):h(`Ordered play prompts`,`游玩提示词编排`),children:[n&&(0,b.jsx)(`p`,{role:`status`,children:n}),(0,b.jsxs)(`div`,{className:`ordered-play-editor`,children:[(0,b.jsxs)(`aside`,{children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>T(),children:h(`Add prompt`,`新增提示词`)}),(0,b.jsx)(`ol`,{"aria-label":h(`Prompt order`,`提示词顺序`),children:e.map((e,t)=>(0,b.jsxs)(`li`,{draggable:!0,onDragStart:()=>f(e.id),onDragEnd:()=>f(void 0),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),d&&C(d,t),f(void 0)},children:[(0,b.jsx)(`button`,{type:`button`,"aria-pressed":!o&&e.id===v?.id,onClick:()=>{u(e.id),s?.()},onKeyDown:n=>{n.altKey&&[`ArrowUp`,`ArrowDown`].includes(n.key)&&(n.preventDefault(),C(e.id,t+(n.key===`ArrowUp`?-1:1)))},children:x(e)}),e.kind!==`world`&&(0,b.jsx)(`input`,{type:`checkbox`,"aria-label":`${h(`Enable`,`启用`)} ${x(e)}`,checked:e.enabled,disabled:e.kind===`builtin`&&g.find(t=>t.id===e.builtin)?.required,onChange:t=>w({...e,enabled:t.target.checked})}),e.kind!==`world`&&!e.enabled&&(0,b.jsx)(`small`,{children:h(`Disabled`,`已停用`)})]},e.id))}),(0,b.jsx)(`p`,{children:h(`Drag or use Alt + arrow keys to reorder.`,`拖动或按 Alt + 方向键排序。`)}),i]}),o??(v&&(0,b.jsxs)(`div`,{className:`ordered-play-content`,children:[(0,b.jsxs)(`div`,{className:`ordered-play-actions`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:S<=0,onClick:()=>C(v.id,S-1),children:h(`Move up`,`上移`)}),(0,b.jsx)(`button`,{type:`button`,disabled:S>=e.length-1,onClick:()=>C(v.id,S+1),children:h(`Move down`,`下移`)}),v.kind!==`world`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:v.enabled,disabled:y?.required,onChange:e=>w({...v,enabled:e.target.checked})}),h(`Enabled`,`启用`)]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>T(v.kind===`user`?v.body:y.body,`${x(v)} ${h(`copy`,`副本`)}`),children:h(`Clone prompt`,`克隆提示词`)})]}),v.kind===`user`&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{t(e.filter(e=>e.id!==v.id)),u(void 0)},children:h(`Delete prompt`,`删除提示词`)})]}),v.kind===`world`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h4`,{children:x(v)}),(0,b.jsx)(`p`,{children:h(`The current world's frame expands its instructions and selected materials together here, including material coverage and read authorization. This is not the entire file tree. Inspect actual content in a world or content-package Prompt Preview.`,`当前世界的 frame 在此连续展开世界指令与选定材料,包括材料覆盖和读取资格;不是注入全部文件。请在具体世界或内容包的真实提示预览中检查正文。`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[h(`Prompt name`,`提示词名称`),(0,b.jsx)(`input`,{"aria-label":h(`Prompt name`,`提示词名称`),value:x(v),readOnly:v.kind===`builtin`,onChange:e=>{v.kind===`user`&&w({...v,name:e.target.value})}})]}),y&&(0,b.jsx)(`p`,{children:h(`Application builtin: always resolves the latest text. Clone to keep an editable, independent copy.`,`系统引用始终使用应用最新版正文;克隆获得可编辑、独立的固定副本。`)}),(0,b.jsxs)(`label`,{children:[h(`Prompt text`,`提示词正文`),(0,b.jsx)(`textarea`,{"aria-label":h(`Prompt text`,`提示词正文`),rows:22,readOnly:v.kind===`builtin`,value:v.kind===`user`?v.body:y.body,onChange:e=>{v.kind===`user`&&w({...v,body:e.target.value})}})]})]}),a]}))]}),r&&y?.id===`author.mechanics`&&(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:h(`World revision tool contract`,`世界修订工具契约`)}),(0,b.jsx)(`pre`,{children:Se(p,`world-revision`)})]})]})}function Te(e){return[...e.map(({id:e})=>({id:e,kind:`user`,enabled:!0})),{id:`builtin:summary`,kind:`builtin`,enabled:!1},{id:`package:followups`,kind:`content-package`,enabled:!0}]}function Ee(e){let t=e===`zh-CN`;return{body:t?`主叙事已完成。仅根据已向玩家呈现的叙事与明确可见事实整理简短场景回顾,通过 artifact_emit 输出 recap。不要从工具材料、未表露认知或场外状态补全幕后原因,不补写剧情或引入新事实。回顾只是显示产物,不替代状态维护、检查点或历史恢复。`:`The main narrative has settled. Emit a brief scene recap as recap using artifact_emit, using only narrative already shown to the player and explicitly visible facts. Do not fill in backstage causes from tool material, unexpressed knowledge or offstage state. Do not continue the story or introduce new facts. This display artifact does not replace state maintenance, checkpoints or history recovery.`,definition:{id:`builtin:summary`,displayName:t?`场景回顾(系统示例)`:`Scene recap (system example)`,prompt:{role:`author_instruction`,path:`builtin:followup-summary`},artifacts:[{name:`recap`,channel:`builtin:summary`,strategy:`replace`,contentType:`text/markdown`,rendererMode:`document`,save:`commit`,invalidation:`explicit_clear`,required:!0,maxEmits:1}],maxArtifactBytes:32768}}}var De=Symbol.for(`yaml.alias`),Oe=Symbol.for(`yaml.document`),ke=Symbol.for(`yaml.map`),Ae=Symbol.for(`yaml.pair`),je=Symbol.for(`yaml.scalar`),Me=Symbol.for(`yaml.seq`),Ne=Symbol.for(`yaml.node.type`),Pe=e=>!!e&&typeof e==`object`&&e[Ne]===De,z=e=>!!e&&typeof e==`object`&&e[Ne]===Oe,Fe=e=>!!e&&typeof e==`object`&&e[Ne]===ke,B=e=>!!e&&typeof e==`object`&&e[Ne]===Ae,V=e=>!!e&&typeof e==`object`&&e[Ne]===je,Ie=e=>!!e&&typeof e==`object`&&e[Ne]===Me;function Le(e){if(e&&typeof e==`object`)switch(e[Ne]){case ke:case Me:return!0}return!1}function H(e){if(e&&typeof e==`object`)switch(e[Ne]){case De:case ke:case je:case Me:return!0}return!1}var Re=e=>(V(e)||Le(e))&&!!e.anchor,ze=Symbol(`break visit`),Be=Symbol(`skip children`),Ve=Symbol(`remove node`);function He(e,t){let n=We(t);z(e)?Ue(null,e.contents,n,Object.freeze([e]))===Ve&&(e.contents=null):Ue(null,e,n,Object.freeze([]))}He.BREAK=ze,He.SKIP=Be,He.REMOVE=Ve;function Ue(e,t,n,r){let i=Ge(e,t,n,r);if(H(i)||B(i))return Ke(e,r,i),Ue(e,i,n,r);if(typeof i!=`symbol`){if(Le(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Ue(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ze)return ze;else i===Ve&&(t.items.splice(e,1),--e)}}else if(B(t)){r=Object.freeze(r.concat(t));let e=Ue(`key`,t.key,n,r);if(e===ze)return ze;e===Ve&&(t.key=null);let i=Ue(`value`,t.value,n,r);if(i===ze)return ze;i===Ve&&(t.value=null)}}return i}function We(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ge(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Fe(t))return n.Map?.(e,t,r);if(Ie(t))return n.Seq?.(e,t,r);if(B(t))return n.Pair?.(e,t,r);if(V(t))return n.Scalar?.(e,t,r);if(Pe(t))return n.Alias?.(e,t,r)}function Ke(e,t,n){let r=t[t.length-1];if(Le(r))r.items[e]=n;else if(B(r))e===`key`?r.key=n:r.value=n;else if(z(r))r.contents=n;else{let e=Pe(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var qe={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Je=e=>e.replace(/[!,[\]{}]/g,e=>qe[e]),Ye=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Je(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&H(e.contents)){let t={};He(e.contents,(e,n)=>{H(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
1069
+ `)}};Ye.defaultYaml={explicit:!1,version:`1.2`},Ye.defaultTags={"!!":`tag:yaml.org,2002:`};function Xe(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Ze(e){let t=new Set;return He(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Qe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function $e(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Ze(e);let a=Qe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(V(t.node)||Le(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function et(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=et(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=et(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=et(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=et(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function tt(e,t,n){if(Array.isArray(e))return e.map((e,t)=>tt(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Re(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var nt=class{constructor(e){Object.defineProperty(this,Ne,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!z(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=tt(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?et(i,{"":o},``,o):o}},rt=class extends nt{constructor(e){super(De),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],He(e,{Node:(e,t)=>{(Pe(t)||Re(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(tt(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=it(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Xe(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function it(e,t,n){if(Pe(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Le(t)){let r=0;for(let i of t.items){let t=it(e,i,n);t>r&&(r=t)}return r}if(B(t)){let r=it(e,t.key,n),i=it(e,t.value,n);return Math.max(r,i)}return 1}var at=e=>!e||typeof e!=`function`&&typeof e!=`object`,U=class extends nt{constructor(e){super(je),this.value=e}toJSON(e,t){return t?.keep?this.value:tt(this.value,e,t)}toString(){return String(this.value)}};U.BLOCK_FOLDED=`BLOCK_FOLDED`,U.BLOCK_LITERAL=`BLOCK_LITERAL`,U.PLAIN=`PLAIN`,U.QUOTE_DOUBLE=`QUOTE_DOUBLE`,U.QUOTE_SINGLE=`QUOTE_SINGLE`;var ot=`tag:yaml.org,2002:`;function st(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ct(e,t,n){if(z(e)&&(e=e.contents),H(e))return e;if(B(e)){let t=n.schema[ke].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new rt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ot+t.slice(2));let l=st(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new U(e);return c&&(c.node=t),t}l=e instanceof Map?o[ke]:Symbol.iterator in Object(e)?o[Me]:o[ke]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new U(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function lt(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ct(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var ut=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,dt=class extends nt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>H(t)||B(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ut(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Le(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Le(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&V(i)?i.value:i:Le(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!B(t))return!1;let n=t.value;return n==null||e&&V(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Le(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Le(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},ft=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function pt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var mt=(e,t,n)=>e.endsWith(`
1070
+ `)?pt(n,t):n.includes(`
1071
+ `)?`
1072
+ `+pt(n,t):(e.endsWith(` `)?``:` `)+n,ht=`flow`,gt=`block`,_t=`quoted`;function vt(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=yt(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
1073
+ `)n===`block`&&(h=yt(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
1074
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
1075
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function yt(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
1076
+ `);r=t,i=t+1,a=e[i]}return r}var bt=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),xt=e=>/^(%|---|\.\.\.)/m.test(e);function St(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
1077
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Ct(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(xt(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
1078
+
1079
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
1080
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:vt(o,a,_t,bt(t,!1))}function wt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
1081
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Ct(e,t);let n=t.indent||(xt(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:vt(r,n,ht,bt(t,!1))}function Tt(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Ct;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?wt:i&&!t?Ct:n?wt:Ct}return r(e,t)}var Et;try{Et=RegExp(`(^|(?<!
1082
+ ))
1083
+ +(?!
1084
+ |$)`,`g`)}catch{Et=/\n+(?!\n|$)/g}function Dt({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Tt(n,r);let l=r.indent||(r.forceBlockIndent||xt(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===U.BLOCK_FOLDED?!1:t===U.BLOCK_LITERAL||!St(n,c,l.length);if(!n)return u?`|
1085
+ `:`>
1086
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
1087
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
1088
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
1089
+ `&&(p=p.slice(0,-1)),p.replace(Et,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
1090
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
1091
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=bt(r,!0);o!==`folded`&&t!==U.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=vt(`${v}${e}${p}`,l,gt,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Ot(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
1092
+ `)||u&&/[[\]{},]/.test(a))return Tt(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
1093
+ `)?Tt(a,t):Dt(e,t,n,r);if(!s&&!u&&i!==U.PLAIN&&a.includes(`
1094
+ `))return Dt(e,t,n,r);if(xt(a)){if(c===``)return t.forceBlockIndent=!0,Dt(e,t,n,r);if(s&&c===l)return Tt(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Tt(a,t)}return s?d:vt(d,c,ht,bt(t,!1))}function kt(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==U.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=U.QUOTE_DOUBLE);let c=e=>{switch(e){case U.BLOCK_FOLDED:case U.BLOCK_LITERAL:return i||a?Tt(o.value,t):Dt(o,t,n,r);case U.QUOTE_DOUBLE:return Ct(o.value,t);case U.QUOTE_SINGLE:return wt(o.value,t);case U.PLAIN:return Ot(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function At(e,t){let n=Object.assign({blockQuote:!0,commentString:ft,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function jt(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(V(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Mt(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(V(e)||Le(e))&&e.anchor;a&&Xe(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Nt(e,t,n,r){if(B(e))return e.toString(t,n,r);if(Pe(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=H(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=jt(t.doc.schema.tags,a);let o=Mt(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):V(a)?kt(a,t,n,r):a.toString(t,n,r);return o?V(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Pt({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=H(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Le(e)||!H(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Le(e)||(V(e)?e.type===U.BLOCK_FOLDED||e.type===U.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Nt(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=mt(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=mt(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=mt(g,n.indent,l(f))));let _,v,y;H(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&V(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Ie(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Nt(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
1095
+ `:``,v){let e=l(v);S+=`\n${pt(e,n.indent)}`}x===``&&!n.inFlow?S===`
1096
+ `&&y&&(S=`
1097
+
1098
+ `):S+=`\n${n.indent}`}else if(!p&&Le(t)){let e=x[0],r=x.indexOf(`
1099
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
1100
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=mt(g,n.indent,l(y)):h&&i&&i(),g}function Ft(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var It=`<<`,Lt={identify:e=>e===It||typeof e==`symbol`&&e.description===It,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new U(Symbol(It)),{addToJSMap:zt}),stringify:()=>It},Rt=(e,t)=>(Lt.identify(t)||V(t)&&(!t.type||t.type===U.PLAIN)&&Lt.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Lt.tag&&e.default);function zt(e,t,n){let r=Vt(e,n);if(Ie(r))for(let n of r.items)Bt(e,t,n);else if(Array.isArray(r))for(let n of r)Bt(e,t,n);else Bt(e,t,r)}function Bt(e,t,n){let r=Vt(e,n);if(!Fe(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Vt(e,t){return e&&Pe(t)?t.resolve(e.doc,e):t}function Ht(e,t,{key:n,value:r}){if(H(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Rt(e,n))zt(e,t,r);else{let i=tt(n,``,e);if(t instanceof Map)t.set(i,tt(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Ut(n,i,e),o=tt(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Ut(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(H(e)&&n?.doc){let t=At(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Ft(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Wt(e,t,n){return new Gt(ct(e,void 0,n),ct(t,void 0,n))}var Gt=class e{constructor(e,t=null){Object.defineProperty(this,Ne,{value:Ae}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return H(n)&&(n=n.clone(t)),H(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Ht(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Pt(this,e,t,n):JSON.stringify(this)}};function Kt(e,t,n){return(t.inFlow??e.flow?Jt:qt)(e,t,n)}function qt({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(H(i))!d&&i.spaceBefore&&f.push(``),Yt(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(B(i)){let e=H(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Yt(n,f,e.commentBefore,d))}d=!1;let s=Nt(i,u,()=>o=null,()=>d=!0);o&&(s+=mt(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
1101
+ `}}return e?(p+=`
1102
+ `+pt(l(e),c),s&&s()):d&&o&&o(),p}function Jt({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(H(i))i.spaceBefore&&d.push(``),Yt(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(B(i)){let e=H(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Yt(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=H(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Nt(i,c,()=>a=null);l||=d.length>u||o.includes(`
1103
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=mt(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
1104
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Yt({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=pt(t(r),e);n.push(i.trimStart())}}function Xt(e,t){let n=V(t)?t.value:t;for(let r of e)if(B(r)&&(r.key===t||r.key===n||V(r.key)&&r.key.value===n))return r}var Zt=class extends dt{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(ke,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Wt(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=B(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Gt(e,e?.value):new Gt(e.key,e.value);let r=Xt(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);V(r.value)&&at(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Xt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Xt(this.items,e)?.value;return(!t&&V(n)?n.value:n)??void 0}has(e){return!!Xt(this.items,e)}set(e,t){this.add(new Gt(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Ht(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!B(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Kt(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Qt={collection:`map`,default:!0,nodeClass:Zt,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Fe(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Zt.from(e,t,n)},$t=class extends dt{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Me,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=en(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=en(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&V(r)?r.value:r}has(e){let t=en(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=en(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];V(r)&&at(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(tt(e,String(r++),t));return n}toString(e,t,n){return e?Kt(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ct(a,void 0,n))}}return i}};function en(e){let t=V(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var tn={collection:`seq`,default:!0,nodeClass:$t,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Ie(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>$t.from(e,t,n)},nn={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),kt(e,t,n,r)}},rn={identify:e=>e==null,createNode:()=>new U(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new U(null),stringify:({source:e},t)=>typeof e==`string`&&rn.test.test(e)?e:t.options.nullStr},an={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new U(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&an.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function on({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var sn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:on},cn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():on(e)}},ln={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new U(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:on},un=e=>typeof e==`bigint`||Number.isInteger(e),dn=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function fn(e,t,n){let{value:r}=e;return un(r)&&r>=0?n+r.toString(t):on(e)}var pn={identify:e=>un(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>dn(e,2,8,n),stringify:e=>fn(e,8,`0o`)},mn={identify:un,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>dn(e,0,10,n),stringify:on},hn={identify:e=>un(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>dn(e,2,16,n),stringify:e=>fn(e,16,`0x`)},gn=[Qt,tn,nn,rn,an,pn,mn,hn,sn,cn,ln];function _n(e){return typeof e==`bigint`||Number.isInteger(e)}var vn=({value:e})=>JSON.stringify(e),yn=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:vn},{identify:e=>e==null,createNode:()=>new U(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:vn},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:vn},{identify:_n,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>_n(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:vn}],bn=[Qt,tn].concat(yn,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),xn={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=U.BLOCK_LITERAL,t!==U.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===U.BLOCK_LITERAL?`
1105
+ `:` `)}return kt({comment:e,type:t,value:s},r,i,a)}};function Sn(e,t){if(Ie(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!B(r)){if(Fe(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new Gt(new U(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=B(r)?r:new Gt(r)}}else t(`Expected a sequence for this tag`);return e}function Cn(e,t,n){let{replacer:r}=n,i=new $t(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Wt(o,s,n))}return i}var wn={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Sn,createNode:Cn},Tn=class e extends $t{constructor(){super(),this.add=Zt.prototype.add.bind(this),this.delete=Zt.prototype.delete.bind(this),this.get=Zt.prototype.get.bind(this),this.has=Zt.prototype.has.bind(this),this.set=Zt.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(B(e)?(r=tt(e.key,``,t),i=tt(e.value,r,t)):r=tt(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Cn(e,t,n),i=new this;return i.items=r.items,i}};Tn.tag=`tag:yaml.org,2002:omap`;var En={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Tn,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Sn(e,t),r=[];for(let{key:e}of n.items)V(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Tn,n)},createNode:(e,t,n)=>Tn.from(e,t,n)};function Dn({value:e,source:t},n){return t&&(e?On:kn).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var On={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new U(!0),stringify:Dn},kn={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new U(!1),stringify:Dn},An={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:on},jn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():on(e)}},Mn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new U(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:on},Nn=e=>typeof e==`bigint`||Number.isInteger(e);function Pn(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Fn(e,t,n){let{value:r}=e;if(Nn(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return on(e)}var In={identify:Nn,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Pn(e,2,2,n),stringify:e=>Fn(e,2,`0b`)},Ln={identify:Nn,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Pn(e,1,8,n),stringify:e=>Fn(e,8,`0`)},Rn={identify:Nn,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Pn(e,0,10,n),stringify:on},zn={identify:Nn,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Pn(e,2,16,n),stringify:e=>Fn(e,16,`0x`)},Bn=class e extends Zt{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=B(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Gt(e.key,null):new Gt(e,null),Xt(this.items,t.key)||this.items.push(t)}get(e,t){let n=Xt(this.items,e);return!t&&B(n)?V(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Xt(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Gt(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Wt(e,null,n));return i}};Bn.tag=`tag:yaml.org,2002:set`;var Vn={collection:`map`,identify:e=>e instanceof Set,nodeClass:Bn,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Bn.from(e,t,n),resolve(e,t){if(Fe(e)){if(e.hasAllNullValues(!0))return Object.assign(new Bn,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Hn(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Un(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return on(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Wn={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Hn(e,n),stringify:Un},Gn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Hn(e,!1),stringify:Un},Kn={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(Kn.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Hn(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},qn=[Qt,tn,nn,rn,On,kn,In,Ln,Rn,zn,An,jn,Mn,xn,Lt,En,wn,Vn,Wn,Gn,Kn],Jn=new Map([[`core`,gn],[`failsafe`,[Qt,tn,nn]],[`json`,bn],[`yaml11`,qn],[`yaml-1.1`,qn]]),Yn={binary:xn,bool:an,float:ln,floatExp:cn,floatNaN:sn,floatTime:Gn,int:mn,intHex:hn,intOct:pn,intTime:Wn,map:Qt,merge:Lt,null:rn,omap:En,pairs:wn,seq:tn,set:Vn,timestamp:Kn},Xn={"tag:yaml.org,2002:binary":xn,"tag:yaml.org,2002:merge":Lt,"tag:yaml.org,2002:omap":En,"tag:yaml.org,2002:pairs":wn,"tag:yaml.org,2002:set":Vn,"tag:yaml.org,2002:timestamp":Kn};function Zn(e,t,n){let r=Jn.get(t);if(r&&!e)return n&&!r.includes(Lt)?r.concat(Lt):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Jn.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Lt)),i.reduce((e,t)=>{let n=typeof t==`string`?Yn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Yn).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var Qn=(e,t)=>e.key<t.key?-1:+(e.key>t.key),$n=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Zn(e,`compat`):e?Zn(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Xn:{},this.tags=Zn(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,ke,{value:Qt}),Object.defineProperty(this,je,{value:nn}),Object.defineProperty(this,Me,{value:tn}),this.sortMapEntries=typeof a==`function`?a:a===!0?Qn:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function er(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=At(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(pt(t,``))}let o=!1,s=null;if(e.contents){if(H(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(pt(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Nt(e.contents,i,()=>s=null,t);s&&(c+=mt(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Nt(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
1106
+ `)?(n.push(`...`),n.push(pt(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(pt(a(t),``)))}return n.join(`
1107
+ `)+`
1108
+ `}var tr=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ne,{value:Oe});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Ye({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Ne]:{value:Oe}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=H(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){nr(this.contents)&&this.contents.add(e)}addIn(e,t){nr(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Ze(this);e.anchor=!t||n.has(t)?Qe(t||`a`,n):t}return new rt(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=$e(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=ct(e,l,p);return o&&Le(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new Gt(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return nr(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ut(e)?this.contents!=null&&(this.contents=null,!0):nr(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Le(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return ut(e)?!t&&V(this.contents)?this.contents.value:this.contents:Le(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Le(this.contents)?this.contents.has(e):!1}hasIn(e){return ut(e)?this.contents!==void 0:Le(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=lt(this.schema,[e],t):nr(this.contents)&&this.contents.set(e,t)}setIn(e,t){ut(e)?this.contents=t:this.contents==null?this.contents=lt(this.schema,Array.from(e),t):nr(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new Ye({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new Ye({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new $n(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=tt(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?et(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return er(this,e)}};function nr(e){if(Le(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var rr=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ir=class extends rr{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},ar=class extends rr{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},or=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
1109
+ `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function sr(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function cr(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
1110
+ `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(cr(t.key)||cr(t.value))return!0}return!1;default:return!0}}function lr(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&cr(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function ur(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||V(e)&&V(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var dr=`All mapping items must start at the same column`;function fr({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Zt)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=sr(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,dr)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
1111
+ `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||cr(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,dr);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&lr(r.indent,u,i),n.atKey=!1,ur(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=sr(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&lr(r.indent,f,i),s=c.range[2];let l=new Gt(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
1112
+ `+_.comment:g.comment=_.comment);let e=new Gt(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function pr({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??$t)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=sr(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&lr(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function mr(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var hr=`Block collections are not allowed within flow collections`,gr=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function _r({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?Zt:$t))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=sr(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
1113
+ `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&cr(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];B(t)&&(t=t.value??t.key),t.comment?t.comment+=`
1114
+ `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],gr(m)&&i(r.range,`BLOCK_IN_FLOW`,hr)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);gr(f)&&i(g.range,`BLOCK_IN_FLOW`,hr),n.atKey=!1;let _=sr(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?gr(m)&&i(v.range,`BLOCK_IN_FLOW`,hr):_.comment&&(g.comment?g.comment+=`
1115
+ `+_.comment:g.comment=_.comment);let y=new Gt(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;ur(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new Zt(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=mr(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
1116
+ `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function vr(e,t,n,r,i,a){let o=n.type===`block-map`?fr(e,t,n,r,a):n.type===`block-seq`?pr(e,t,n,r,a):_r(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function yr(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===Zt.tagName&&s===`map`||o===$t.tagName&&s===`seq`)return vr(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),vr(e,t,n,i,o)}let l=vr(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=H(u)?u:new U(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function br(e,t,n){let r=t.offset,i=xr(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?U.BLOCK_FOLDED:U.BLOCK_LITERAL,o=t.source?Sr(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
1117
+ `.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
1118
+ `;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===U.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
1119
+ `):t.length>c||r[0]===` `?(f===` `?f=`
1120
+ `:!p&&f===`
1121
+ `&&(f=`
1122
+
1123
+ `),d+=f+t.slice(c)+r,f=`
1124
+ `,p=!0):r===``?f===`
1125
+ `?d+=`
1126
+ `:f=`
1127
+ `:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
1128
+ `+o[e][0].slice(c);d[d.length-1]!==`
1129
+ `&&(d+=`
1130
+ `);break;default:d+=`
1131
+ `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function xr({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Sr(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Cr(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=U.PLAIN,c=wr(a,l);break;case`single-quoted-scalar`:s=U.QUOTE_SINGLE,c=Tr(a,l);break;case`double-quoted-scalar`:s=U.QUOTE_DOUBLE,c=Dr(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=mr(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function wr(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Er(e)}function Tr(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Er(e.slice(1,-1)).replace(/''/g,`'`)}function Er(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
1132
+ `,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
1133
+ `,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
1134
+ `?i+=a:a=`
1135
+ `:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function Dr(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
1136
+ `){if(i===`
1137
+ `){let{fold:t,offset:i}=Or(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=kr[i];if(a)n+=a;else if(i===`
1138
+ `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
1139
+ `)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Ar(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
1140
+ `&&(a!==`\r`||e[r+2]!==`
1141
+ `)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Or(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
1142
+ `||r===`\r`)&&(r!==`\r`||e[t+2]===`
1143
+ `);)r===`
1144
+ `&&(n+=`
1145
+ `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var kr={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
1146
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Ar(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function jr(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?br(e,t,r):Cr(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[je]:c?Mr(e.schema,i,c,n,r):t.type===`scalar`?Nr(e,i,t,r):e.schema[je];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=V(a)?a:new U(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new U(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Mr(e,t,n,r,i){if(n===`!`)return e[je];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[je])}function Nr({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[je];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[je];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Pr(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Fr={composeNode:Ir,composeEmptyNode:Lr};function Ir(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Rr(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=jr(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=yr(Fr,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Lr(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!V(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Lr(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=jr(e,{type:`scalar`,offset:Pr(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Rr({options:e},{offset:t,source:n,end:r},i){let a=new rt(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=mr(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function zr(e,t,{offset:n,start:r,value:i,end:a},o){let s=new tr(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=sr(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Ir(c,i,l,o):Lr(c,l.end,r,null,l,o);let u=s.contents.range[2],d=mr(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Br(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Vr(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
1147
+
1148
+ `:`
1149
+ `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Hr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Br(e);r?this.warnings.push(new ar(i,t,n)):this.errors.push(new ir(i,t,n))},this.directives=new Ye({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Vr(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Le(i)&&!i.flow&&i.items.length>0){let e=i.items[0];B(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Vr(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Br(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=zr(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ir(Br(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new ir(Br(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=mr(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ir(Br(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new tr(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Ur=Symbol(`break visit`),Wr=Symbol(`skip children`),Gr=Symbol(`remove item`);function Kr(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),qr(Object.freeze([]),e,t)}Kr.BREAK=Ur,Kr.SKIP=Wr,Kr.REMOVE=Gr,Kr.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Kr.parentCollection=(e,t)=>{let n=Kr.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function qr(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=qr(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Ur)return Ur;else r===Gr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Jr(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
1150
+ `:case`\r
1151
+ `:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function Yr(e){switch(e){case void 0:case` `:case`
1152
+ `:case`\r`:case` `:return!0;default:return!1}}var Xr=new Set(`0123456789ABCDEFabcdef`),Zr=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Qr=new Set(`,[]{}`),$r=new Set(` ,[]{}
1153
+ \r `),ei=e=>!e||$r.has(e),ti=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
1154
+ `||t===`\r`&&this.buffer[e+1]===`
1155
+ `}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
1156
+ `||!t&&!this.atEnd)return e+n+1}return t===`
1157
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&Yr(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
1158
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&Yr(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Yr(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&Yr(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(ei),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&Yr(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(ei),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Yr(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
1159
+ `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
1160
+ `,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>Yr(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
1161
+ `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
1162
+ `)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
1163
+ `,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
1164
+ `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
1165
+ `&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(Yr(r)||e&&Qr.has(r))break;t=n}else if(Yr(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
1166
+ `?(n+=1,r=`
1167
+ `,i=this.buffer[n+1]):t=n),i===`#`||e&&Qr.has(i))break;if(r===`
1168
+ `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&Qr.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(ei),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Yr(n)||t&&Qr.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!Yr(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Zr.has(t))t=this.buffer[++e];else if(t===`%`&&Xr.has(this.buffer[e+1])&&Xr.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
1169
+ `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
1170
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},ni=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function ri(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function ii(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function ai(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function oi(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function si(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function ci(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function li(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!ri(t.start,`explicit-key-ind`)&&!ri(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,ai(t.value)?t.value.end?ci(t.value.end,t.sep):t.value.end=t.sep:ci(t.start,t.sep),delete t.sep)}var ui=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new ti,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Jr(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&li(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&ii(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:ii(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=si(oi(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
1171
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1172
+ `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ci(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(ri(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=si(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ri(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(ai(t.key)&&!ri(t.sep,`newline`)){let e=si(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ri(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!ri(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ci(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||ri(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=si(oi(t));li(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
1173
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1174
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=si(oi(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=si(oi(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function di(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new ni||null,prettyErrors:t}}function fi(e,t={}){let{lineCounter:n,prettyErrors:r}=di(t),i=new ui(n?.addNewLine),a=new Hr(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ir(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(or(e,n)),o.warnings.forEach(or(e,n))),o}function pi(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=fi(e,n);if(!i)return null;if(i.warnings.forEach(e=>Ft(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function mi(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return z(e)&&!r?e.toString(n):new tr(e,r,n).toString(n)}function hi(e,t=`regex/inline.yaml`){let n=fi(e,{schema:`core`,uniqueKeys:!0,strict:!0});(n.errors.length>0||n.warnings.length>0)&&_i(`regex_asset_invalid`,`Regex-resource YAML is invalid: ${t}`,t);let r=!1;He(n,(e,t)=>{(Pe(t)||H(t)&&(t.tag!==void 0||`anchor`in t&&t.anchor))&&(r=!0)}),r&&_i(`regex_asset_invalid`,`Regex YAML aliases, tags and anchors are not supported`,t);let i=n.toJS({maxAliasCount:0});vi(i)&&yi(i,[`rules`],t);let a=Array.isArray(i)?i:vi(i)&&Array.isArray(i.rules)?i.rules:null;(a===null||a.length>256)&&_i(`regex_rules_invalid`,`A regex resource may contain at most 256 rules: ${t}`,t);let o=new Set;return a.map((e,n)=>{let r=`${t}#rules[${n}]`;vi(e)||_i(`regex_rule_invalid`,`A regex rule must be a map`,r),yi(e,[`order`,`scope`,`pattern`,`flags`,`replace`,`maxMatches`,`errorPolicy`,`enabled`],r),e.enabled!==void 0&&typeof e.enabled!=`boolean`&&_i(`regex_enabled_invalid`,`Rule enabled must be a boolean`,r);let i=e.order;(!Number.isSafeInteger(i)||i<0)&&_i(`regex_order_invalid`,`A regex rule must declare a non-negative integer order`,r),o.has(i)&&_i(`regex_order_duplicate`,`Regex rule order cannot be duplicated`,r),o.add(i);let a=e.scope;a!==`raw_text`&&a!==`markdown_html`&&a!==`structured_payload`&&_i(`regex_scope_invalid`,`A regex rule must declare raw_text, markdown_html, or structured_payload scope`,r);let s=e.pattern;(typeof s!=`string`||s.length===0||s.length>4096)&&_i(`regex_pattern_invalid`,`Regex pattern must be a bounded non-empty string`,r);let c=e.flags===void 0?``:e.flags;(typeof c!=`string`||c.length>16)&&_i(`regex_flags_invalid`,`Regex flags are invalid`,r);try{new RegExp(s,c)}catch{_i(`regex_pattern_invalid`,`Regex pattern could not be compiled`,r)}typeof e.replace!=`string`&&_i(`regex_replace_invalid`,`Regex replace must be text`,r);let l=e.maxMatches??1;(!Number.isSafeInteger(l)||l<1||l>1024)&&_i(`regex_limit_invalid`,`Regex replacement count must be a bounded positive integer`,r);let u=e.errorPolicy;return u!==`fallback`&&u!==`skip`&&u!==`fail`&&_i(`regex_error_policy_invalid`,`A regex rule must declare fallback, skip, or fail errorPolicy`,r),{...e.enabled===void 0?{}:{enabled:e.enabled},order:i,scope:a,pattern:s,flags:c,replace:e.replace,maxMatches:l,errorPolicy:u}}).sort((e,t)=>e.order-t.order)}var gi=class extends Error{code;constructor(e,t){super(t),this.code=e}};function _i(e,t,n){throw new gi(e,t)}function vi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yi(e,t,n){let r=Object.keys(e).find(e=>!t.includes(e));r!==void 0&&_i(`unsupported_field`,`The current play format does not support field: ${r}`,n)}var W=(e,t)=>_()===`zh-CN`?e:t;function bi({value:e,files:t,onChange:n,onWrite:r}){let[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(`css`);function c(t,r){let i={...e};t===`scripts`||t===`assets`?i[t]=(i[t]??[]).filter(e=>e!==r):(delete i[t],t===`renderer`&&(delete i.rendererRevision,i.rendererMode=`document`)),n(i)}function u(t,r){n({...e,...t===`renderer`?{renderer:r,rendererRevision:crypto.randomUUID()}:t===`regex`?{regex:r}:{[t]:[...new Set([...e[t]??[],r])]}})}function d(e,t,n){let a=`${{renderer:`renderers`,regex:`regex`,scripts:`scripts`,assets:`assets`}[e]}/${i.trim()?`named-`+Array.from(i.trim().slice(0,24)).map(e=>/[A-Za-z0-9.-]/u.test(e)?e:`_u${e.codePointAt(0).toString(16)}_`).join(``):`resource`}.${crypto.randomUUID()}.${t}`;r(a,n),u(e,a)}return(0,b.jsxs)(`section`,{className:`preset-display-editor`,children:[(0,b.jsx)(`h3`,{children:W(`显示模板`,`Display template`)}),(0,b.jsxs)(`label`,{children:[W(`显示方式`,`Renderer`),(0,b.jsxs)(`select`,{"aria-label":W(`显示方式`,`Renderer`),value:e.renderer??``,onChange:t=>t.target.value?u(`renderer`,t.target.value):e.renderer&&c(`renderer`,e.renderer),children:[(0,b.jsx)(`option`,{value:``,children:W(`默认显示`,`Default display`)}),Object.keys(t).filter(e=>e.startsWith(`renderers/`)&&e.endsWith(`.html`)).map((e,t)=>(0,b.jsxs)(`option`,{value:e,children:[W(`模板`,`Template`),` `,t+1,` · `,ye(e)]},e))]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>d(`renderer`,`html`,`<main class="content"><!-- narraeon:content --></main>`),children:W(`新建 HTML 模板`,`Create HTML template`)}),e.renderer&&(0,b.jsxs)(`label`,{children:[`HTML`,(0,b.jsx)(`textarea`,{"aria-label":`HTML`,rows:8,value:t[e.renderer]??``,onChange:t=>r(e.renderer,t.target.value)})]}),(0,b.jsxs)(`label`,{children:[W(`运行方式`,`Rendering mode`),(0,b.jsxs)(`select`,{"aria-label":W(`运行方式`,`Rendering mode`),value:e.rendererMode??`document`,onChange:t=>n({...e,rendererMode:t.target.value}),children:[(0,b.jsx)(`option`,{value:`document`,children:W(`静态文档`,`Static document`)}),(0,b.jsx)(`option`,{value:`app`,children:W(`交互界面(需本地脚本许可)`,`Interactive app (local script permission required)`)})]})]}),(0,b.jsx)(`p`,{children:W(`模板用 <!-- narraeon:content --> 放置显示后内容;命名资源按声明引用提供给宿主。解绑保留原资源及其他引用。`,`Place displayed content with <!-- narraeon:content -->. The host resolves declared resource references. Unlinking retains resources and other references.`)}),(0,b.jsx)(`h3`,{children:W(`样式、JavaScript 与命名资源`,`Styles, JavaScript and named resources`)}),[`scripts`,`assets`].map(n=>(0,b.jsxs)(`section`,{children:[(e[n]??[]).map(e=>(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:ye(e)}),n===`assets`&&(0,b.jsx)(`p`,{children:(0,b.jsx)(`code`,{children:`window.__NARRAEON_ASSETS__[${JSON.stringify(e)}]`})}),(0,b.jsx)(`textarea`,{"aria-label":ye(e),rows:8,value:t[e]??``,onChange:t=>r(e,t.target.value)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>c(n,e),children:W(`移除此引用`,`Unlink resource`)})]},e)),(0,b.jsxs)(`label`,{children:[n===`scripts`?W(`引用已有脚本`,`Attach existing script`):W(`引用已有资源`,`Attach existing resource`),(0,b.jsxs)(`select`,{value:``,onChange:e=>e.target.value&&u(n,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:W(`选择已有内容`,`Select existing content`)}),Object.keys(t).filter(t=>t.startsWith(`${n}/`)&&!(e[n]??[]).includes(t)).map(e=>(0,b.jsx)(`option`,{value:e,children:ye(e)},e))]})]})]},n)),(0,b.jsxs)(`div`,{className:`preset-inline`,children:[(0,b.jsx)(`input`,{"aria-label":W(`资源名称`,`Resource name`),placeholder:W(`资源名称`,`Resource name`),maxLength:24,value:i,onChange:e=>a(e.target.value)}),(0,b.jsxs)(`select`,{"aria-label":W(`资源类型`,`Resource type`),value:o,onChange:e=>s(e.target.value),children:[(0,b.jsx)(`option`,{children:`css`}),(0,b.jsx)(`option`,{children:`html`}),(0,b.jsx)(`option`,{children:`js`})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>d(`assets`,o,o===`css`?`body { font-family: system-ui; }`:``),children:W(`新建命名资源`,`Create named resource`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>d(`scripts`,`js`,`// Listen for narraeon.extension.v1 render.update messages.
1175
+ `),children:W(`新建 JavaScript`,`Create JavaScript`)})]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:W(`JavaScript 数据与操作参考`,`JavaScript data and command reference`)}),(0,b.jsx)(`p`,{children:W(`render.update 的 payload.content 是显示处理后的字符串;JSON 使用 JSON.parse。payload 还包含 contentType、worldId、channel、key、interactionDisabled。请核对 event.source === parent、instanceId 和 nonce;requestId 用于关联 bridge.response 的 ok / error 回执。示例中的 request / fromHost 是源码定义的 helper。`,`render.update supplies payload.content as a processed string; parse JSON with JSON.parse. payload also carries contentType, worldId, channel, key and interactionDisabled. Check event.source === parent, instanceId and nonce; correlate bridge.response ok / error with requestId. request / fromHost are helpers defined in the example source.`)}),(0,b.jsx)(`p`,{children:W(`window.__NARRAEON_ASSETS__ 按声明的资源引用映射源文本;CSS 自动注入,HTML/JS 资源作为文本提供,不会自动执行。`,`window.__NARRAEON_ASSETS__ maps declared resource references to source text. CSS is injected; HTML/JS assets are text and are not executed automatically.`)}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:`read_channel`}),(0,b.jsx)(`dd`,{children:W(`读取当前已显示频道产物`,`Read displayed channel artifacts`)}),(0,b.jsx)(`dt`,{children:`read_player_view`}),(0,b.jsx)(`dd`,{children:W(`读取宿主提供的已提交玩家视图`,`Read committed player views supplied by the host`)}),(0,b.jsx)(`dt`,{children:`composer.set_draft`}),(0,b.jsx)(`dd`,{children:W(`仅填写输入草稿;禁交互时拒绝`,`Fill the input draft only; rejected when interactions are disabled`)}),(0,b.jsx)(`dt`,{children:`panel.close`}),(0,b.jsx)(`dd`,{children:W(`关闭当前实例`,`Close this instance`)}),(0,b.jsx)(`dt`,{children:`panel.refresh`}),(0,b.jsx)(`dd`,{children:W(`重新挂载当前实例并刷新宿主数据`,`Remount this instance and refresh host data`)}),(0,b.jsx)(`dt`,{children:`diagnostic`}),(0,b.jsx)(`dd`,{children:W(`上报本地诊断`,`Report a local diagnostic`)})]})]}),(0,b.jsx)(`h3`,{children:W(`正则显示处理`,`Regex display processing`)}),(0,b.jsx)(`p`,{children:W(`只处理显示内容,不改变发给 AI 的提示词。禁用保留原规则。`,`Changes display only, never prompts sent to AI. Disabled rules are retained.`)}),(0,b.jsxs)(`label`,{children:[W(`规则集`,`Rule set`),(0,b.jsxs)(`select`,{value:e.regex??``,onChange:t=>t.target.value?u(`regex`,t.target.value):e.regex&&c(`regex`,e.regex),children:[(0,b.jsx)(`option`,{value:``,children:W(`无显示处理`,`No processing`)}),Object.keys(t).filter(e=>e.startsWith(`regex/`)).map((e,t)=>(0,b.jsxs)(`option`,{value:e,children:[W(`规则集`,`Rule set`),` `,t+1,` · `,ye(e)]},e))]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>d(`regex`,`yaml`,mi({rules:[]})),children:W(`新建规则集`,`Create rule set`)}),e.regex&&(0,b.jsx)(xi,{source:t[e.regex]??``,onChange:t=>r(e.regex,t)},e.regex)]})}function xi({source:e,onChange:t}){let[n,r]=(0,l.useState)(null),i=[],a=``,o=!0;try{let t=fi(e,{uniqueKeys:!0});if(t.errors.length||t.warnings.length)throw Error(t.errors.map(e=>e.message).join(`
1176
+ `)||`Invalid YAML`);let n=t.toJS({maxAliasCount:0});o=!Array.isArray(n),i=hi(e)}catch(e){a=String(e)}let s=n?.source===e;s&&n&&(i=n.rules,o=n.wrapped);function c(e){let n=mi(o?{rules:e}:e);r({source:n,rules:e,wrapped:o}),t(n)}function u(e,t){c(i.map((n,r)=>r===e?{...n,...t}:n))}function d(e,t){let n=[...i].sort((e,t)=>e.order-t.order);e+t<0||e+t>=n.length||(n.splice(e+t,0,...n.splice(e,1)),c(n.map((e,t)=>({...e,order:t}))))}return a&&!s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{role:`alert`,children:a}),(0,b.jsx)(`textarea`,{"aria-label":W(`原始规则(修复)`,`Original rules (repair)`),value:e,onChange:e=>t(e.target.value)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>c([...i,{order:Math.max(-1,...i.map(e=>e.order))+1,enabled:!0,scope:`raw_text`,pattern:`示例`,flags:`g`,replace:``,maxMatches:100,errorPolicy:`fallback`}]),children:W(`新增正则规则`,`Add regex rule`)}),a&&(0,b.jsx)(`p`,{role:`alert`,children:a}),[...i].sort((e,t)=>e.order-t.order).map((e,t)=>{let n=i.indexOf(e);return(0,b.jsxs)(`fieldset`,{children:[(0,b.jsxs)(`legend`,{children:[W(`规则`,`Rule`),` `,t+1]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.enabled!==!1,onChange:e=>u(n,{enabled:e.target.checked})}),W(`启用规则`,`Enable rule`)]}),(0,b.jsxs)(`div`,{className:`preset-inline`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:t===0,onClick:()=>d(t,-1),children:`↑`}),(0,b.jsx)(`button`,{type:`button`,disabled:t===i.length-1,onClick:()=>d(t,1),children:`↓`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>c(i.filter((e,t)=>t!==n)),children:W(`删除规则`,`Delete rule`)})]}),(0,b.jsxs)(`label`,{children:[W(`阶段`,`Stage`),(0,b.jsxs)(`select`,{value:e.scope,onChange:e=>u(n,{scope:e.target.value}),children:[(0,b.jsx)(`option`,{value:`raw_text`,children:W(`原始显示文本`,`Raw display text`)}),(0,b.jsx)(`option`,{value:`markdown_html`,children:W(`Markdown HTML`,`Markdown HTML`)}),(0,b.jsx)(`option`,{value:`structured_payload`,children:W(`结构化数据的文本值`,`Structured text values`)})]})]}),[`pattern`,`replace`,`flags`].map(t=>(0,b.jsxs)(`label`,{children:[{pattern:W(`查找`,`Find`),replace:W(`替换`,`Replace`),flags:W(`标志`,`Flags`)}[t],(0,b.jsx)(`input`,{value:e[t],onChange:e=>u(n,{[t]:e.target.value})})]},t)),(0,b.jsxs)(`label`,{children:[W(`最大匹配次数`,`Maximum matches`),(0,b.jsx)(`input`,{type:`number`,min:1,value:e.maxMatches,onChange:e=>u(n,{maxMatches:Number(e.target.value)})})]}),(0,b.jsxs)(`label`,{children:[W(`失败行为`,`On failure`),(0,b.jsxs)(`select`,{value:e.errorPolicy,onChange:e=>u(n,{errorPolicy:e.target.value}),children:[(0,b.jsx)(`option`,{value:`fallback`,children:W(`恢复原文`,`Fallback`)}),(0,b.jsx)(`option`,{value:`skip`,children:W(`跳过规则`,`Skip`)}),(0,b.jsx)(`option`,{value:`fail`,children:W(`停止处理`,`Fail`)})]})]})]},e.order)})]})}var Si=[{value:`story`,label:`剧情内容区`,description:`跟随剧情正文显示`},{value:`sidebar`,label:`右侧栏`,description:`适合持续状态面板`},{value:`composer_above`,label:`输入框上方`,description:`适合行动建议或临时提示`},{value:`composer_below`,label:`输入框下方`,description:`适合不打断输入的辅助内容`},{value:`overlay`,label:`浮层`,description:`覆盖在游玩页面上方`},{value:`debug`,label:`调试区`,description:`只用于检查原始产物`}];function Ci(e){let t=Si.find(({value:t})=>t===e)?.label;return t===void 0?e:v(t)}function wi(e,t){return[...new Set([...e,...t===void 0?[]:[t]])].sort()}function Ti(e){return/^#\s+(.+)$/mu.exec(e)?.[1]?.trim()??v(`未命名提示内容`)}function Ei(e,t){return e===`preset.yaml`?{path:e,title:v(`预设入口`),kind:v(`核心 YAML`),description:v(`连接设定完善提示、调用链、界面显示位置、玩家视图面板和扩展资源;它回答“这份预设由哪些部分组成”。`)}:e===`call-chain.yaml`?{path:e,title:v(`调用链与产物`),kind:v(`核心 YAML`),description:v(`声明主响应使用哪些叙事提示、结束后有哪些后置请求,以及每个请求可以生成什么产物。`)}:e===`frame.yaml`?{path:e,title:v(`主持规则顺序`),kind:v(`核心 YAML`),description:v(`决定 Runtime 机械说明、主持规则块和世界指令以什么顺序进入稳定 bootstrap。`)}:e.startsWith(`blocks/`)&&e.endsWith(`.md`)?{path:e,title:Ti(t),kind:v(`主持规则`),description:v(`跨世界使用的主持规则;可在“游玩”左侧目录调整启用状态和顺序。`)}:e===`prompts/setting-improvement.md`?{path:e,title:Ti(t),kind:v(`设定完善提示`),description:v(`约束 AI 怎样理解、规划和创作内容包;工具定义、参数与说明仍由 Runtime 内置。`)}:e.startsWith(`prompts/`)&&e.endsWith(`.md`)?{path:e,title:Ti(t),kind:v(`调用链提示`),description:v(`主叙事或后置请求使用的提示词;在“游玩”左侧选择对应条目即可编辑。`)}:e.startsWith(`renderers/`)?{path:e,title:v(`界面模板`),kind:`HTML renderer`,description:v(`把产物内容或玩家视图变成页面上的 HTML 结构。`)}:e.startsWith(`scripts/`)?{path:e,title:v(`界面交互脚本`),kind:`JavaScript`,description:v(`为 renderer 添加本地交互;导入预设后默认停用,只有显式信任后才执行。`)}:e.startsWith(`assets/`)?{path:e,title:v(`界面样式或资源`),kind:v(`扩展资源`),description:v(`供 renderer 或脚本读取的样式、文字或其他普通资源。`)}:e.startsWith(`regex/`)?{path:e,title:v(`产物文本处理规则`),kind:`Regex YAML`,description:v(`在显示前对产物正文执行有界、可预览的正则处理。`)}:{path:e,title:e.split(`/`).at(-1)??v(`未命名文件`),kind:v(`普通文件`),description:v(`随玩法预设保存和导出的普通业务文件。`)}}function Di(e){return[...new Set(e.split(/\r?\n/u).map(e=>e.trim()).filter(Boolean))]}function G(e){return{"text/markdown":[`Markdown 文本`,`Markdown text`],"text/plain":[`纯文本`,`Plain text`],"application/json":[`JSON 结构化数据`,`Structured JSON data`],"text/html":[`HTML 内容`,`HTML content`],replace:[`替换上一份`,`Replace the previous result`],append:[`追加新内容`,`Append a new result`],upsert:[`按固定标识更新`,`Update by a fixed key`],transient:[`仅在生成期间显示`,`Show only while generating`],hidden:[`仅供检查,不在游玩中显示`,`Keep out of the play display`],commit:[`随世界进度保存`,`Save with world progress`],operation:[`随本次生成保存,成功结束后隐藏`,`Save for this generation; hide after success`],none:[`临时使用,不持久保存`,`Use temporarily without persistent storage`],explicit_clear:[`收到清空指令时`,`When a clear instruction is received`],new_operation:[`下一次生成开始时`,`When the next generation starts`],head_change:[`世界状态版本改变时`,`When the world state version changes`],operation_end:[`本次生成结束时`,`When this generation ends`],never:[`不设置自动清空条件`,`No automatic clearing condition`]}[e]?.[_()===`zh-CN`?0:1]??e}function K({ariaLabel:e,value:t,allowNone:n=!1,onChange:r}){return(0,b.jsxs)(`select`,{"aria-label":e,value:t,onChange:e=>r(e.currentTarget.value),children:[n?(0,b.jsx)(`option`,{value:``,children:v(`不在页面显示`)}):null,Si.map(e=>(0,b.jsxs)(`option`,{value:e.value,children:[v(e.label),` — `,v(e.description)]},e.value))]})}function Oi({ariaLabel:e,paths:t,selected:n,emptyText:r,onChange:i}){let a=[...new Set([...t,...n])].sort();return a.length===0?(0,b.jsx)(`p`,{className:`play-preset-empty-copy`,children:r}):(0,b.jsx)(`ul`,{className:`play-preset-path-checklist`,"aria-label":e,children:a.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:n.includes(e),onChange:t=>i(t.currentTarget.checked?[...new Set([...n,e])].sort():n.filter(t=>t!==e))}),(0,b.jsx)(`span`,{children:Ei(e,``).title}),(0,b.jsx)(`code`,{children:e})]})},e))})}function ki({panels:e,files:t,onChange:n,onFileChange:r}){function i(t,r){n(e.map((e,n)=>n===t?r(e):e))}function a(){let t=`panel_${crypto.randomUUID().replaceAll(`-`,``)}`;n([...e,{id:t,source:{kind:`player_view`,view:`status`},channel:`player.view.${t}`,key:`current`,mount:`sidebar`,rendererMode:`document`,config:{title:v(`玩家状态`),layout:`stack`,theme:`default`,empty:`message`,emptyMessage:v(`当前没有可显示内容。`),groups:[]}}])}return(0,b.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,b.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{children:v(`玩家视图面板`)}),(0,b.jsx)(`p`,{children:v(`把世界控制里已经定义好的玩家视图,持续显示在游玩页面。它不调用模型,也不改世界。`)})]}),(0,b.jsx)(`button`,{type:`button`,onClick:a,children:v(`新增玩家视图面板`)})]}),(0,b.jsx)(`p`,{children:v(`同一玩家视图由自定义面板接管,其他视图仍显示默认卡片。`)}),e.length===0?(0,b.jsx)(`p`,{className:`play-preset-empty-copy`,children:v(`当前没有玩家视图面板。`)}):(0,b.jsx)(`ol`,{className:`play-preset-panel-editor-list`,"aria-label":v(`玩家视图面板`),children:e.map((a,o)=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`article`,{className:`play-preset-player-panel-card`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:a.config.title??a.id}),(0,b.jsxs)(`span`,{children:[v(`玩家视图`),a.source.view,` · `,Ci(a.mount)]})]}),(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:()=>n(e.filter((e,t)=>t!==o)),children:v(`删除面板`)})]}),(0,b.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,b.jsxs)(`label`,{children:[v(`面板标题`),(0,b.jsx)(`input`,{"aria-label":v(`玩家视图面板 {index} 标题`,{index:o+1}),value:a.config.title??``,onChange:e=>{let t=e.currentTarget.value;i(o,e=>{let n={...e.config};return t===``?delete n.title:n.title=t,{...e,config:n}})}})]}),(0,b.jsxs)(`label`,{children:[v(`读取哪个玩家视图`),(0,b.jsx)(`input`,{"aria-label":v(`玩家视图面板 {index} 视图`,{index:o+1}),list:`player-view-preview-sources`,value:a.source.view,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,source:{...e.source,view:t}}))}})]}),(0,b.jsxs)(`label`,{children:[v(`显示位置`),(0,b.jsx)(K,{ariaLabel:v(`玩家视图面板 {index} 显示位置`,{index:o+1}),value:a.mount,onChange:e=>{e!==``&&i(o,t=>({...t,mount:e}))}})]}),(0,b.jsxs)(`label`,{children:[v(`排列方式`),(0,b.jsxs)(`select`,{value:a.config.layout,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,layout:t}}))},children:[(0,b.jsx)(`option`,{value:`stack`,children:v(`纵向排列`)}),(0,b.jsx)(`option`,{value:`grid`,children:v(`网格排列`)})]})]}),(0,b.jsxs)(`label`,{children:[v(`没有内容时`),(0,b.jsxs)(`select`,{value:a.config.empty,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,empty:t}}))},children:[(0,b.jsx)(`option`,{value:`hide`,children:v(`隐藏面板`)}),(0,b.jsx)(`option`,{value:`message`,children:v(`显示说明`)}),(0,b.jsx)(`option`,{value:`show`,children:v(`显示空值`)})]})]}),a.config.empty===`hide`?null:(0,b.jsxs)(`label`,{children:[v(`空内容说明`),(0,b.jsx)(`input`,{value:a.config.emptyMessage,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,emptyMessage:t}}))}})]})]}),(0,b.jsx)(bi,{value:a,files:t,onWrite:r,onChange:e=>i(o,t=>{let n={...t};for(let e of[`renderer`,`rendererRevision`,`regex`,`scripts`,`assets`])delete n[e];return{...n,...e,rendererMode:e.rendererMode??`document`}})}),(0,b.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,b.jsx)(`summary`,{children:v(`高级面板设置`)}),(0,b.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,b.jsxs)(`label`,{children:[v(`面板稳定标识`),(0,b.jsx)(`input`,{value:a.id,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,id:t}))}})]}),(0,b.jsxs)(`label`,{children:[v(`技术频道`),(0,b.jsx)(`input`,{value:a.channel,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,channel:t}))}})]}),(0,b.jsxs)(`label`,{children:[v(`更新 key`),(0,b.jsx)(`input`,{value:a.key,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,key:t}))}})]}),(0,b.jsxs)(`label`,{children:[v(`主题标识`),(0,b.jsx)(`input`,{value:a.config.theme,onChange:e=>{let t=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,theme:t}}))}})]}),(0,b.jsxs)(`label`,{children:[v(`只显示这些项目(每行一个,可留空)`),(0,b.jsx)(`textarea`,{value:(a.source.itemIds??[]).join(`
1177
+ `),onChange:e=>{let t=Di(e.currentTarget.value);i(o,e=>{let n={...e.source};return t.length===0?delete n.itemIds:n.itemIds=t,{...e,source:n}})}})]})]}),(0,b.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h6`,{children:v(`分组`)}),(0,b.jsx)(`p`,{children:v(`把已选项目按组显示;每个项目 ID 单独一行。`)})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>i(o,e=>{let t=new Set(e.config.groups.map(({id:e})=>e)),n=e.config.groups.length+1,r=`group_${n}`;for(;t.has(r);)r=`group_${++n}`;return{...e,config:{...e.config,groups:[...e.config.groups,{id:r,label:v(`新分组`),itemIds:[]}]}}}),children:v(`新增分组`)})]}),(0,b.jsx)(`ol`,{className:`play-preset-group-list`,children:a.config.groups.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`label`,{children:[v(`分组标题`),(0,b.jsx)(`input`,{value:e.label,onChange:e=>{let n=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,label:n}:e)}}))}})]}),(0,b.jsxs)(`label`,{children:[v(`分组标识`),(0,b.jsx)(`input`,{value:e.id,onChange:e=>{let n=e.currentTarget.value;i(o,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,id:n}:e)}}))}})]}),(0,b.jsxs)(`label`,{children:[v(`项目 ID(每行一个)`),(0,b.jsx)(`textarea`,{value:e.itemIds.join(`
1178
+ `),onChange:e=>{let n=Di(e.currentTarget.value);i(o,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,itemIds:n}:e)}}))}})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>i(o,e=>({...e,config:{...e.config,groups:e.config.groups.filter((e,n)=>n!==t)}})),children:v(`删除分组`)})]},`${e.id}-${t}`))})]})]})},`${a.id}-${o}`))})]})}var q=(e,t)=>_()===`zh-CN`?e:t;function Ai({structure:e,files:t,authoring:n,onChange:r,onWrite:i,preview:a,promptPreview:o}){let[s,c]=(0,l.useState)(),[u,d]=(0,l.useState)(`prompt`),[f,p]=(0,l.useState)(``),m=e.followupItems??Te(e.followups),h=Ee(_()),g=m.find(e=>e.id===s?.id),v=g?.kind===`builtin`?h.definition:e.followups.find(e=>e.id===s?.id),y=e.playerViewPanels.find(e=>e.id===s?.id),x=v?.artifacts.find(e=>e.name===f)??v?.artifacts[0],S=g?.kind!==`user`;function C(e){S||!v||r(t=>({...t,followups:t.followups.map(t=>t.id===v.id?e(t):t)}))}function w(e){C(t=>({...t,artifacts:t.artifacts.map(t=>t.name===x?.name?e:t)}))}function T(e,n){let a=`request_${crypto.randomUUID().replaceAll(`-`,``)}`,o=`prompts/${a}.md`;i(o,n??q(`根据本轮已提交叙事,生成下面声明的界面产物。`,`Generate the declared interface outputs from the settled narrative.`));let s=new Map;function l(e){let t=s.get(e);if(!t){let[n]=e.split(`/`);t=`${n}/${crypto.randomUUID()}-${e.split(`/`).at(-1)}`,s.set(e,t)}return t}let u=e?e.artifacts.map((e,t)=>({...e,channel:`${a}.output_${t+1}`,...e.renderer?{renderer:l(e.renderer)}:{},...e.regex?{regex:l(e.regex)}:{},...e.scripts?{scripts:e.scripts.map(l)}:{},...e.assets?{assets:e.assets.map(l)}:{}})):[ji(`${a}.output_1`,`output_1`)];for(let[e,n]of s){let r=t[e]??``;for(let[e,t]of s)r=r.replaceAll(e,t);i(n,r)}r(t=>({...t,followups:[...t.followups,{id:a,displayName:e?`${e.displayName} ${q(`副本`,`copy`)}`:q(`新后置请求`,`New follow-up`),prompt:{role:`author_instruction`,path:o},artifacts:u,maxArtifactBytes:e?.maxArtifactBytes??32768}],followupItems:[...t.followupItems??Te(t.followups),{id:a,kind:`user`,enabled:!0}],mounts:[...t.mounts,...u.map((n,r)=>({channel:n.channel,mount:t.mounts.find(t=>t.channel===e?.artifacts[r]?.channel)?.mount??`story`}))],extensionRefs:[...new Set([...t.extensionRefs,...s.values()])]})),c({kind:`followup`,id:a}),d(`prompt`)}function E(t){return t.kind===`builtin`?h.definition.displayName:t.kind===`content-package`?q(`内容包后置组`,`Content-package follow-ups`):e.followups.find(e=>e.id===t.id)?.displayName??t.id}function D(e,t){let n=[...m],i=n.findIndex(t=>t.id===e);i<0||t<0||t>=n.length||(n.splice(t,0,...n.splice(i,1)),r(e=>({...e,followupItems:n})))}let O=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`section`,{className:`preset-directory-group`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:q(`回复完成后`,`After the reply`)}),(0,b.jsx)(`button`,{type:`button`,"aria-label":q(`新增后置请求`,`Add follow-up request`),onClick:()=>T(),children:`+`})]}),(0,b.jsx)(`ol`,{"aria-label":q(`后置请求`,`Follow-up requests`),children:m.map((e,t)=>(0,b.jsxs)(`li`,{draggable:!0,onDragStart:t=>t.dataTransfer.setData(`application/x-narraeon-followup`,e.id),onDragOver:e=>{e.dataTransfer.types.includes(`application/x-narraeon-followup`)&&e.preventDefault()},onDrop:e=>{e.preventDefault(),D(e.dataTransfer.getData(`application/x-narraeon-followup`),t)},children:[(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":s?.id===e.id,onClick:()=>{c({kind:`followup`,id:e.id}),d(`prompt`)},onKeyDown:n=>{n.altKey&&[`ArrowUp`,`ArrowDown`].includes(n.key)&&(n.preventDefault(),D(e.id,t+(n.key===`ArrowUp`?-1:1)))},children:[E(e),(0,b.jsx)(`small`,{children:e.kind===`builtin`?q(`系统`,`System`):e.kind===`content-package`?q(`内容包`,`Package`):q(`用户`,`User`)})]}),(0,b.jsx)(`input`,{type:`checkbox`,"aria-label":`${q(`启用`,`Enable`)} ${E(e)}`,checked:e.enabled,onChange:t=>r(n=>({...n,followupItems:m.map(n=>n.id===e.id?{...n,enabled:t.target.checked}:n)}))})]},e.id))})]}),(0,b.jsxs)(`section`,{className:`preset-directory-group`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:q(`纯界面 · 不调用模型`,`Interface · no model`)}),(0,b.jsx)(`button`,{type:`button`,"aria-label":q(`新增纯界面`,`Add interface panel`),onClick:()=>{let e=`panel_${crypto.randomUUID().replaceAll(`-`,``)}`;r(t=>({...t,playerViewPanels:[...t.playerViewPanels,{id:e,source:{kind:`player_view`,view:`status`},channel:`player.view.${e}`,key:`current`,mount:`sidebar`,rendererMode:`document`,config:{title:q(`世界状态栏`,`World status`),layout:`stack`,theme:`default`,empty:`message`,emptyMessage:q(`当前没有可显示内容。`,`No content to display.`),groups:[]}}]})),c({kind:`panel`,id:e})},children:`+`})]}),(0,b.jsx)(`ol`,{children:e.playerViewPanels.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`button`,{type:`button`,"aria-pressed":s?.id===e.id,onClick:()=>c({kind:`panel`,id:e.id}),children:e.config.title??e.source.view})},e.id))})]})]}),k=s?.kind===`panel`&&y?(0,b.jsxs)(`div`,{className:`preset-object-detail`,children:[(0,b.jsx)(ki,{panels:[y],files:t,onFileChange:i,onChange:e=>r(t=>({...t,playerViewPanels:t.playerViewPanels.flatMap(t=>t.id===y.id?e:[t]),extensionRefs:[...new Set([...t.extensionRefs,...e.flatMap(e=>[e.renderer,e.regex,...e.scripts??[],...e.assets??[]].filter(e=>e!==void 0))])]}))}),a()]}):s?.kind===`followup`?(0,b.jsxs)(`div`,{className:`preset-object-detail`,children:[(0,b.jsxs)(`div`,{className:`preset-object-toolbar`,children:[(0,b.jsxs)(`span`,{children:[q(`回复完成后`,`After the reply`),` /`,` `,S?q(`系统 / 内容包`,`System / package`):q(`用户`,`User`)]}),(0,b.jsx)(`button`,{type:`button`,disabled:m[0]?.id===s.id,onClick:()=>D(s.id,m.findIndex(e=>e.id===s.id)-1),children:`↑`}),(0,b.jsx)(`button`,{type:`button`,disabled:m.at(-1)?.id===s.id,onClick:()=>D(s.id,m.findIndex(e=>e.id===s.id)+1),children:`↓`}),v&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>T(v,S?h.body:t[v.prompt.path]),children:q(`克隆后置请求`,`Clone follow-up`)}),!S&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{r(e=>({...e,followups:e.followups.filter(e=>e.id!==s.id),followupItems:m.filter(e=>e.id!==s.id)})),c(void 0)},children:q(`删除`,`Delete`)})]}),v?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`nav`,{className:`preset-detail-tabs`,children:[[`prompt`,q(`提示词`,`Prompt`)],[`outputs`,q(`界面产物`,`Outputs`)],[`advanced`,q(`高级设置`,`Advanced`)]].map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>d(e),children:t},e))}),S&&(0,b.jsx)(`p`,{children:q(`系统示例完整只读;克隆后独立编辑。`,`The complete system example is read-only. Clone to edit independently.`)}),u===`prompt`?(0,b.jsxs)(`div`,{className:`preset-manuscript`,children:[(0,b.jsxs)(`label`,{children:[q(`后置请求名称`,`Follow-up name`),(0,b.jsx)(`input`,{"aria-label":q(`后置请求名称`,`Follow-up name`),readOnly:S,value:v.displayName,onChange:e=>C(t=>({...t,displayName:e.target.value}))})]}),(0,b.jsxs)(`label`,{children:[q(`提示词`,`Prompt`),(0,b.jsx)(`textarea`,{"aria-label":q(`这次额外请求要做什么`,`What should this follow-up do?`),rows:16,readOnly:S,value:S?h.body:t[v.prompt.path]??``,onChange:e=>i(v.prompt.path,e.target.value)})]}),(0,b.jsx)(`button`,{type:`button`,disabled:S,onClick:()=>i(v.prompt.path,`${t[v.prompt.path]??``}\n\n${v.artifacts.map(e=>`output=${e.name}: ${e.purpose??e.displayName??e.name}`).join(`
1179
+ `)}`),children:q(`将产物引用加入提示词`,`Insert output references`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{children:u===`outputs`?q(`界面产物`,`Interface outputs`):q(`此产物的数据格式要求`,`This output's data requirements`)}),(0,b.jsx)(`p`,{children:q(`一条请求,可以生成多个界面产物。`,`One request can generate several interface outputs.`)}),(0,b.jsxs)(`div`,{className:`preset-output-cards`,children:[v.artifacts.map(t=>(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":x?.name===t.name,onClick:()=>p(t.name),children:[(0,b.jsx)(`strong`,{children:t.displayName??t.name}),(0,b.jsx)(`small`,{children:t.purpose??q(`尚未填写用途`,`No purpose yet`)}),(0,b.jsx)(`span`,{children:Ci(e.mounts.find(e=>e.channel===t.channel)?.mount??`story`)})]},t.name)),!S&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let t=v.artifacts.length+1;for(;v.artifacts.some(e=>e.name===`output_${t}`)||e.mounts.some(e=>e.channel===`${v.id}.output_${t}`);)t++;let n=ji(`${v.id}.output_${t}`,`output_${t}`);r(e=>({...e,mounts:[...e.mounts,{channel:n.channel,mount:`story`}],followups:e.followups.map(e=>e.id===v.id?{...e,artifacts:[...e.artifacts,n]}:e)})),p(n.name)},children:q(`+ 新增产物`,`+ Add output`)})]}),!S&&(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:q(`JavaScript 示例 · 新建独立产物`,`JavaScript examples · create independent output`)}),(0,b.jsx)(`p`,{children:q(`新建示例不会覆盖现有资源,不会授予脚本许可。`,`Creates independent files without overwriting resources or granting script permission.`)}),[`actions`,`card`].map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let t=be(e,v.id);for(let[e,n]of Object.entries(t.files))i(e,n);r(n=>({...n,followups:n.followups.map(e=>e.id===v.id?{...e,artifacts:[...e.artifacts,t.artifact]}:e),mounts:[...n.mounts,{channel:t.artifact.channel,mount:e===`actions`?`composer_below`:`story`}],extensionRefs:[...n.extensionRefs,...Object.keys(t.files)]})),p(t.artifact.name)},children:e===`actions`?q(`新建行动按钮示例`,`Create action button example`):q(`新建场景卡片示例`,`Create scene card example`)},e))]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:q(`AI 如何提交这些产物`,`How AI submits these outputs`)}),(0,b.jsx)(`p`,{children:q(`同一次后置模型响应,分别调用 artifact_emit;output 指定产物,payload 提交数据。不为每个产物另发请求。提交名自动分配,友好名称修改不改变绑定。`,`In the same follow-up response, call artifact_emit for each output. output selects the declaration; payload supplies data. No separate request per output. Renaming a display label preserves its stable submission name.`)}),v.artifacts.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`strong`,{children:[e.name,` → `,e.displayName??e.name]}),(0,b.jsx)(`p`,{children:e.purpose}),(0,b.jsx)(`code`,{children:`artifact_emit({"output":${JSON.stringify(e.name)},"payload":${e.contentType===`application/json`?`<JSON>`:`"<text>"`}})`})]},e.name))]}),x&&(0,b.jsxs)(`fieldset`,{disabled:S,className:`preset-output-fields`,children:[(0,b.jsx)(`legend`,{children:x.displayName??x.name}),(0,b.jsx)(`div`,{className:`preset-inline`,children:[-1,1].map(e=>(0,b.jsx)(`button`,{type:`button`,disabled:v.artifacts.indexOf(x)+e<0||v.artifacts.indexOf(x)+e>=v.artifacts.length,onClick:()=>C(t=>{let n=[...t.artifacts],r=n.findIndex(e=>e.name===x.name);return n.splice(r+e,0,...n.splice(r,1)),{...t,artifacts:n}}),children:e===-1?q(`产物前移`,`Move output earlier`):q(`产物后移`,`Move output later`)},e))}),u===`outputs`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[q(`产物名称`,`Output name`),(0,b.jsx)(`input`,{"aria-label":q(`产物名称`,`Output name`),maxLength:160,value:x.displayName??x.name,onChange:e=>w({...x,displayName:e.target.value})})]}),(0,b.jsxs)(`label`,{children:[q(`生成内容用途`,`Generation purpose`),(0,b.jsx)(`textarea`,{"aria-label":q(`生成内容用途`,`Generation purpose`),maxLength:16e3,value:x.purpose??``,onChange:e=>w({...x,purpose:e.target.value})})]}),(0,b.jsxs)(`label`,{children:[q(`显示位置`,`Display position`),(0,b.jsx)(K,{ariaLabel:q(`产物显示位置`,`Output position`),value:e.mounts.find(e=>e.channel===x.channel)?.mount??``,allowNone:!0,onChange:e=>r(t=>({...t,mounts:[...t.mounts.filter(e=>e.channel!==x.channel),...e?[{channel:x.channel,mount:e}]:[]]}))})]}),(0,b.jsx)(bi,{value:x,files:t,onWrite:i,onChange:e=>{let t={...x};for(let e of[`renderer`,`rendererRevision`,`regex`,`scripts`,`assets`])delete t[e];w({...t,...e}),r(t=>({...t,extensionRefs:[...new Set([...t.extensionRefs,...[e.renderer,e.regex,...e.scripts??[],...e.assets??[]].filter(e=>e!==void 0)])]}))}})]}):(0,b.jsx)(Mi,{artifact:x,onChange:w}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>C(e=>({...e,artifacts:e.artifacts.filter(e=>e.name!==x.name)})),children:q(`移除此产物`,`Remove output`)})]}),u===`advanced`&&(0,b.jsxs)(`label`,{children:[q(`本次所有产物合计上限(bytes)`,`Total output byte limit`),(0,b.jsx)(`input`,{type:`number`,readOnly:S,min:1,max:1048576,value:v.maxArtifactBytes,onChange:e=>C(t=>({...t,maxArtifactBytes:Number(e.target.value)}))})]})]}),a(v.id,x?.name)]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{children:q(`内容包后置组`,`Content-package follow-ups`)}),(0,b.jsx)(`p`,{children:q(`在此位置展开当前世界的内容包后置请求。无声明时为空组,不调用模型;正文由内容包管理。`,`The current world's follow-ups expand here. An empty group makes no model requests; edit definitions in the content package.`)})]})]}):void 0;return(0,b.jsx)(we,{entries:(n?e.authorPrompts:e.playPrompts)??[],authoring:n,onChange:e=>r(t=>({...t,[n?`authorPrompts`:`playPrompts`]:e})),promptPreview:o,onSelectPrompt:()=>c(void 0),...n?{}:{directory:O,detail:k}})}function ji(e,t){return{name:t,displayName:q(`新产物`,`New output`),channel:e,strategy:`replace`,contentType:`text/markdown`,rendererMode:`document`,save:`commit`,invalidation:`explicit_clear`,required:!1,maxEmits:1}}function Mi({artifact:e,onChange:t}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[q(`内容格式`,`Content format`),(0,b.jsx)(`select`,{"aria-label":q(`内容格式`,`Content format`),value:e.contentType,onChange:n=>{let r={...e,contentType:n.target.value};r.contentType!==`application/json`&&delete r.payloadContract,t(r)},children:[`text/markdown`,`text/plain`,`application/json`,`text/html`].map(e=>(0,b.jsx)(`option`,{value:e,children:G(e)},e))})]}),e.contentType===`application/json`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:q(`约定字段、类型与必填项。要求会说明给模型,提交时由应用校验;不为模型开启 JSON 输出模式,不保证模型合法输出,也不自动往返修复。`,`Fields, types and required values are explained to the model and checked by the app on submission. This does not enable JSON output mode for the model, guarantee valid output, or automatically repair responses.`)}),(0,b.jsxs)(`label`,{children:[q(`此产物的数据格式要求(JSON)`,`This output's data requirements (JSON)`),(0,b.jsx)(`textarea`,{rows:12,value:typeof e.payloadContract==`string`?e.payloadContract:JSON.stringify(e.payloadContract??{},null,2),onChange:n=>{let r;try{r=JSON.parse(n.target.value)}catch{r=n.target.value}t({...e,payloadContract:r})}})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let n={...e};delete n.payloadContract,t(n)},children:q(`移除格式要求`,`Remove requirements`)})]}),[[`strategy`,q(`更新方式`,`Update policy`),[`replace`,`append`,`upsert`,`transient`,`hidden`]],[`save`,q(`保存范围`,`Save scope`),[`commit`,`operation`,`none`]],[`invalidation`,q(`清空条件`,`Clearing condition`),[`explicit_clear`,`new_operation`,`head_change`,`operation_end`,`never`]]].map(([n,r,i])=>(0,b.jsxs)(`label`,{children:[r,(0,b.jsx)(`select`,{"aria-label":r,value:e[n],onChange:r=>t({...e,[n]:r.target.value}),children:i.map(e=>(0,b.jsx)(`option`,{value:e,children:G(e)},e))})]},n)),(0,b.jsx)(`p`,{children:q(`更新方式决定同一产物如何合并:替换只留最新一份,追加保留多份,按标识更新只替换同标识的内容。保存范围、清空条件和生成期间显示的限制共同决定何时可见;关闭世界中的扩展仍会隐藏产物,清空指令仍可清除它。`,`The update policy combines results for this output: replace keeps the latest, append keeps multiple results, and keyed updates replace only the matching key. Save scope, clearing conditions and generation-only display limits jointly determine visibility. Disabling the world's extension still hides its outputs, and clear instructions can still remove them.`)}),e.strategy===`upsert`&&(0,b.jsxs)(`label`,{children:[q(`更新标识(相同标识覆盖旧内容)`,`Update key (replaces the result with the same key)`),(0,b.jsx)(`input`,{value:e.key??``,onChange:n=>t({...e,key:n.target.value})})]}),(0,b.jsxs)(`label`,{children:[q(`单次最多输出次数`,`Maximum emits`),(0,b.jsx)(`input`,{type:`number`,min:1,value:e.maxEmits,onChange:n=>t({...e,maxEmits:Number(n.target.value)})})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:n=>t({...e,required:n.target.checked})}),q(`AI 必须生成此产物`,`Required output`)]})]})}function Ni(e,t){return e===void 0?{ok:!0}:Fi(t)?Pi(e,t,`$`,0):{ok:!1,message:`JSON artifact payload must be a valid JSON value`}}function Pi(e,t,n,r){if(r>32)return{ok:!1,message:`${n} payload nesting exceeds 32 levels`};let i=t===null?`null`:Array.isArray(t)?`array`:typeof t;if(!(e.type===i||e.type===`number`&&i===`number`||e.type===`integer`&&i===`number`&&Number.isInteger(t)))return{ok:!1,message:`${n} payload type must be ${e.type}; received ${i}`};if(e.maxBytes!==void 0){let r=JSON.stringify(t);if(r===void 0||new TextEncoder().encode(r).byteLength>e.maxBytes)return{ok:!1,message:`${n} payload exceeds its declared ${e.maxBytes}-byte limit`}}if(e.type===`string`){let r=t;if(e.minLength!==void 0&&[...r].length<e.minLength)return{ok:!1,message:`${n} text length is less than ${e.minLength}`};if(e.maxLength!==void 0&&[...r].length>e.maxLength)return{ok:!1,message:`${n} text length exceeds ${e.maxLength}`}}if(e.type===`array`){let i=t;if(e.minItems!==void 0&&i.length<e.minItems)return{ok:!1,message:`${n} has fewer than ${e.minItems} items`};if(e.maxItems!==void 0&&i.length>e.maxItems)return{ok:!1,message:`${n} has more than ${e.maxItems} items`};let a=new Set;for(let[t,o]of i.entries()){if(e.items!==void 0){let i=Pi(e.items,o,`${n}[${t}]`,r+1);if(!i.ok)return i}if(e.uniqueBy!==void 0&&Ii(o)){let r=o[e.uniqueBy];if(typeof r!=`string`&&typeof r!=`number`&&typeof r!=`boolean`)return{ok:!1,message:`${n}[${t}].${e.uniqueBy} must be a uniquely comparable scalar`};let i=JSON.stringify(r);if(a.has(i))return{ok:!1,message:`${n} ${e.uniqueBy} values cannot be duplicated`};a.add(i)}}}if(e.type===`object`){let i=t,a=e.properties??{};for(let t of e.required??[])if(!(t in i))return{ok:!1,message:`${n}.${t} is required`};if(e.additionalProperties===!1){for(let e of Object.keys(i))if(!(e in a))return{ok:!1,message:`${n}.${e} is not a declared field`}}for(let[e,t]of Object.entries(a)){if(!(e in i))continue;let a=Pi(t,i[e],`${n}.${e}`,r+1);if(!a.ok)return a}}return{ok:!0}}function Fi(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(Fi):Ii(e)?Object.values(e).every(Fi):!1}function Ii(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Li({value:e}){return e==null?(0,b.jsx)(`span`,{className:`empty-value`,children:`—`}):typeof e==`string`?(0,b.jsx)(`span`,{className:`text-value`,children:e}):typeof e==`number`||typeof e==`boolean`?(0,b.jsx)(`span`,{children:String(e)}):Array.isArray(e)?(0,b.jsx)(`ul`,{className:`player-value-list`,children:e.map((e,t)=>(0,b.jsx)(`li`,{children:(0,b.jsx)(Li,{value:e})},t))}):Ri(e)?typeof e.$ref==`string`?(0,b.jsxs)(`span`,{className:`document-reference`,children:[typeof e.title==`string`?e.title:e.$ref,typeof e.ref==`string`?` · @${e.ref}`:``]}):(0,b.jsx)(`dl`,{className:`player-value-map`,children:Object.entries(e).map(([e,t])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(Li,{value:t})})]},e))}):typeof e==`bigint`?(0,b.jsx)(`span`,{children:e.toString()}):typeof e==`symbol`?(0,b.jsx)(`span`,{children:e.description??`Symbol`}):(0,b.jsx)(`span`,{className:`empty-value`,children:v(`[无法显示]`)})}function Ri(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zi({content:e}){let t;try{t=JSON.parse(e)}catch{return(0,b.jsx)(`p`,{role:`status`,children:v(`玩家视图格式无效,请检查文本处理规则。`)})}if(!Bi(t))return null;let n=Bi(t.config)?t.config:{},r=Array.isArray(t.items)?t.items.filter(Bi):[];if(r.length===0&&n.empty===`hide`)return null;let i=Array.isArray(n.groups)?n.groups.filter(Bi):[],a=new Set,o=i.map(e=>{let t=Array.isArray(e.itemIds)?e.itemIds.flatMap(e=>{let t=r.find(t=>t.id===e);return t===void 0||a.has(e)?[]:(a.add(e),[t])}):[];return{label:typeof e.label==`string`?e.label:``,items:t}});o.push({label:``,items:r.filter(e=>!a.has(e.id))});let s=n.layout===`grid`?`grid`:`stack`;return(0,b.jsxs)(`section`,{className:`player-view-card`,"data-player-view-layout":s,children:[typeof t.title==`string`?(0,b.jsx)(`h3`,{children:t.title}):null,r.length===0&&n.empty!==`show`?(0,b.jsx)(`p`,{children:typeof n.emptyMessage==`string`?n.emptyMessage:v(`当前没有可显示项目。`)}):null,o.filter(e=>e.items.length>0).map((e,t)=>(0,b.jsxs)(`section`,{children:[e.label===``?null:(0,b.jsx)(`h4`,{children:e.label}),(0,b.jsx)(`dl`,{style:{display:`grid`,gap:`0.75rem`,gridTemplateColumns:s===`grid`?`repeat(2, minmax(0, 1fr))`:`minmax(0, 1fr)`},children:e.items.map((e,t)=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:typeof e.label==`string`?e.label:``}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(Li,{value:e.value})})]},t))})]},t))]})}function Bi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vi(e){let t=`${e.worldId}\0${e.channel}\0${e.key??``}\0${e.output}`,n=e.frontend.renderer;if(e.projection===`append`){let r=`${t}\0append\0${e.recordId}`;return n?.mode===`app`?`${r}\0app\0${n.revision??`builtin`}`:`${r}\0document`}return n?.mode===`app`?`${t}\0app\0${n.revision??`builtin`}`:`${t}\0document`}function Hi(e,t){return t===`application/json`?JSON.stringify(e,null,2):typeof e==`string`?e:JSON.stringify(e)}function Ui(e){let t=ma(e.replace(/\r\n?/gu,`
1180
+ `)).split(`
1181
+ `),n=[],r=!1;for(let e of t){let t=/^(#{1,6})\s+(.*)$/u.exec(e),i=/^[-*]\s+(.*)$/u.exec(e);if(i!==null){r||=(n.push(`<ul>`),!0),n.push(`<li>${pa(i[1]??``)}</li>`);continue}if(r&&=(n.push(`</ul>`),!1),t!==null){let e=t[1]?.length??1;n.push(`<h${e}>${pa(t[2]??``)}</h${e}>`)}else e.trim()!==``&&n.push(`<p>${pa(e)}</p>`)}return r&&n.push(`</ul>`),n.join(`
1182
+ `)}function Wi(e){let t=e.maxRules??256,n=e.maxTransformations??1024,r=e.maxOutputBytes??4194304,i=e.maxDomCharacters??1e6,a=Hi(e.payload,e.contentType),o=e.contentType===`text/markdown`?Ui(a):``;if(new TextEncoder().encode(a).byteLength>r||o.length>i)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:v(`artifact 内容超过宿主渲染上限`)};if(e.rules.length>t)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:v(`正则规则数量超过宿主上限`)};let s=[...e.rules].sort((e,t)=>e.order-t.order),c=a,l=e.contentType===`application/json`?a:c,u=e.contentType===`text/markdown`?o:c,d=!1,f=[],p=0,m=`none`;for(let t of s){if(t.enabled===!1)continue;let o=t.scope===`raw_text`?c:t.scope===`structured_payload`?l:u,s=0;try{if(t.scope===`markdown_html`&&e.contentType!==`text/markdown`){f.push({order:t.order,scope:t.scope,input:o,output:o,matches:0,status:`skipped`,error:v(`markdown_html 规则只作用于 Markdown 转换后的 HTML`)});continue}let a=new RegExp(t.pattern,t.flags.includes(`g`)?t.flags:`${t.flags}g`),m=o.replace(a,(...e)=>s>=t.maxMatches?typeof e[0]==`string`?e[0]:``:(s+=1,p+=1,fa(t.replace,e,o)));if(p>n)throw Error(v(`正则转换次数超过宿主上限`));if(new TextEncoder().encode(m).byteLength>r)throw Error(v(`正则输出超过宿主字节上限`));if(t.scope===`markdown_html`&&m.length>i)throw Error(v(`Markdown HTML DOM 大小超过宿主上限`));if(t.scope===`raw_text`){if(c=m,!d&&e.contentType===`text/markdown`&&(u=Ui(c),u.length>i))throw Error(v(`Markdown HTML DOM 大小超过宿主上限`))}else t.scope===`structured_payload`?l=m:(u=m,d=!0);f.push({order:t.order,scope:t.scope,input:o,output:m,matches:s,status:`applied`})}catch(e){let n=e instanceof Error?e.message:v(`正则执行失败`);if(t.errorPolicy===`skip`)f.push({order:t.order,scope:t.scope,input:o,output:o,matches:s,status:`skipped`,error:n});else if(t.errorPolicy===`fallback`){f.push({order:t.order,scope:t.scope,input:o,output:a,matches:s,status:`fallback`,error:n}),m=`fallback`;break}else{f.push({order:t.order,scope:t.scope,input:o,output:o,matches:s,status:`failed`,error:n}),m=`fail`;break}}}return{original:a,final:m===`none`?e.contentType===`text/markdown`?u:e.contentType===`application/json`?l:c:a,steps:f,fallback:m!==`none`,failure:m,...m===`fallback`?{error:v(`正则规则失败,实例显示 raw artifact(可恢复)`)}:m===`fail`?{error:v(`正则规则失败,实例进入错误状态并显示 raw artifact`)}:{}}}function Gi(e,t,n,r){return n?.mode===`document`&&n.document!==void 0?qi(Ki({template:n.document,content:e,contentType:t,...r===void 0?{}:{payload:r}}),n):qi(t===`text/html`?e:`<!doctype html><meta charset="utf-8"><style>body{font:15px/1.6 system-ui,sans-serif;margin:1rem;color:#202020}pre{white-space:pre-wrap}code{font-family:ui-monospace,monospace}</style><main>${t===`text/markdown`?e:`<pre>${ma(e)}</pre>`}</main>`,n)}function Ki(e){let t=`<!-- narraeon:content -->`,n=`<!-- narraeon:payload -->`;if(Zi(e.template,t)!==1)throw Error(v(`document renderer 必须包含唯一 narraeon:content marker`));let r=e.contentType===`text/html`||e.contentType===`text/markdown`?e.content:`<pre>${ma(e.content)}</pre>`,i=e.template.replace(t,r);if(i.includes(n)){let t=JSON.stringify(e.payload??null).replace(/</gu,`\\u003c`);i=i.replace(n,`<script type="application/json" data-narraeon-payload>${t}<\/script>`)}return i}function qi(e,t){let n=(t?.assets??[]).filter(e=>e.id.endsWith(`.css`)).map(e=>`<style>${e.source.replaceAll(`<`,`\\3c `)}</style>`).join(``);if(n===``)return e;let r=/<\/head\s*>/iu.exec(e);if(r===null)return Yi(e,n);let i=r.index;return`${e.slice(0,i)}${n}${e.slice(i)}`}function Ji(e){let t=qi(e.renderer.document??`<main></main>`,e.renderer),n=e.renderer.scripts.map(e=>`<script>${e.replace(/<\/script/giu,`<\\/script`)}<\/script>`).join(``),r=JSON.stringify(Object.fromEntries(e.renderer.assets.map(({id:e,source:t})=>[e,t]))).replace(/</gu,`\\u003c`),i=JSON.stringify(e.instanceId),a=JSON.stringify(e.nonce),o=`${`<script>(function(){var send=function(message){parent.postMessage(message,"*")};window.addEventListener("error",function(event){send({namespace:"${Qi}",type:"bridge.event",instanceId:${i},nonce:${a},event:"diagnostic",payload:{message:String(event.message||"Extension script error")}})});window.addEventListener("unhandledrejection",function(event){send({namespace:"${Qi}",type:"bridge.event",instanceId:${i},nonce:${a},event:"diagnostic",payload:{message:String(event.reason||"Extension Promise error")}})})})();<\/script>`}${`<meta name="narraeon-extension" content="local-trusted"><script>document.documentElement.dataset.narraeonInstance=${i};document.documentElement.dataset.narraeonNonce=${a};window.__NARRAEON_ASSETS__=${r};<\/script>`}`,s=`<script>parent.postMessage({namespace:"${Qi}",type:"bridge.ready",instanceId:${i},nonce:${a}},"*");<\/script>`;return Yi(Xi(t,o,``),`${n}${s}`)}function Yi(e,t){let n=/<\/body\s*>/iu.exec(e);if(n===null)return`${e}${t}`;let r=n.index??e.length;return`${e.slice(0,r)}${t}${e.slice(r)}`}function Xi(e,t,n){let r=/<head(?:\s[^>]*)?>/iu.exec(e);if(r!==null){let i=(r.index??0)+r[0].length;return`${e.slice(0,i)}${t}${n}${e.slice(i)}`}let i=/<html(?:\s[^>]*)?>/iu.exec(e);if(i!==null){let r=(i.index??0)+i[0].length;return`${e.slice(0,r)}<head>${t}${n}</head>${e.slice(r)}`}return`<!doctype html><html><head>${t}${n}</head><body>${e}</body></html>`}function Zi(e,t){return e.split(t).length-1}var Qi=`narraeon.extension.v1`;function $i(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return n.namespace===`narraeon.extension.v1`&&typeof n.command==`string`&&[`read_channel`,`read_player_view`,`composer.set_draft`,`panel.close`,`panel.refresh`,`diagnostic`].includes(n.command)&&n.instanceId===t.instanceId&&n.nonce===t.nonce&&([`read_channel`,`read_player_view`,`composer.set_draft`,`panel.close`,`panel.refresh`].includes(n.command)?typeof n.requestId==`string`&&n.requestId.length>0:n.requestId===void 0||typeof n.requestId==`string`)}function ea(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return n.namespace===`narraeon.extension.v1`&&n.type===`bridge.ready`&&n.instanceId===t.instanceId&&n.nonce===t.nonce}function ta(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return n.namespace===`narraeon.extension.v1`&&n.type===`bridge.event`&&n.event===`diagnostic`&&n.instanceId===t.instanceId&&n.nonce===t.nonce}var na=[`story`,`sidebar`,`composer_above`,`composer_below`,`overlay`,`debug`],ra=(0,l.createContext)(null);function ia({worldId:e,artifacts:t,extensions:n=[],playerViewPanels:r=[],playerViews:i,interactionDisabled:a=!1,onSetComposerDraft:o,onRefresh:s,onBridgeEvent:c,children:u}){let[d,f]=(0,l.useState)(()=>new Set),[p,m]=(0,l.useState)(()=>new Map),[h,g]=(0,l.useState)(()=>new Map),_=(0,l.useMemo)(()=>{let e=new Map;for(let t of na)e.set(t,[]);let n=[...t,...r.map(oa)];for(let t of n){let n=t.frontend.mount??(t.frontend.fallback===`raw`?`debug`:void 0);n!==void 0&&(t.projection!==`hidden`||n===`debug`)&&e.get(n)?.push(t)}return e},[t,r]),v=(0,l.useMemo)(()=>({worldId:e,artifacts:t,extensions:n,playerViewPanels:r,playerViews:i,interactionDisabled:a,onSetComposerDraft:o,onRefresh:s,...c===void 0?{}:{onBridgeEvent:c},children:u,byMount:_,disabled:d,errors:p,bridgeEvents:h,disable:e=>f(t=>new Set(t).add(e)),enable:e=>{f(t=>{let n=new Set(t);return n.delete(e),n}),m(t=>{let n=new Map(t);return n.delete(e),n})},error:(e,t)=>m(n=>new Map(n).set(e,t)),bridgeEvent:(e,t,n)=>{g(t=>{let r=new Map(t);return r.set(e,[...r.get(e)??[],n]),r}),c?.(t,n)}}),[t,n,h,_,u,d,p,c,s,o,i,r,a,e]);return(0,b.jsx)(ra.Provider,{value:v,children:u})}function aa({mount:e,reply:t}){let n=(0,l.useContext)(ra);if(n===null)throw Error(v(`ArtifactExtensionMount 必须位于 ArtifactExtensionHost 内`));let r=(n.byMount.get(e)??[]).filter(n=>e!==`story`||(t===void 0?n.frontend.source===`player_view`:n.reply?.chainId===t.chainId&&n.reply.eventId===t.eventId)),i=new Map;if(e!==`story`&&e!==`debug`)for(let t of n.extensions??[])for(let r of t.requests??[]){if(!r.mounts.includes(e)||t.status===`superseded`)continue;let a=n.artifacts.some(e=>e.requestId===r.requestId),o=r.status===`failed`?`生成失败`:r.status===`completed`?`已更新`:t.status===`running`?a?`更新中`:`生成中`:`生成未完成`;i.set(r.requestId,{name:r.displayName,state:o})}return(0,b.jsxs)(`div`,{className:`artifact-extension-mount artifact-extension-mount-${e}`,"data-extension-mount":e,children:[[...i].map(([e,t])=>(0,b.jsxs)(`p`,{role:`status`,className:`artifact-generation-status`,children:[t.name,` · `,v(t.state)]},e)),r.map(e=>{let t=Vi(e);return(0,b.jsx)(sa,{artifact:e,worldId:n.worldId,channelArtifacts:n.artifacts.filter(({channel:t})=>t===e.channel),playerViews:n.playerViews.views,interactionDisabled:n.interactionDisabled,disabled:n.disabled.has(t),error:n.errors.get(t),events:n.bridgeEvents.get(t)??[],onDisable:()=>n.disable(t),onEnable:()=>n.enable(t),onError:e=>n.error(t,e),onBridgeEvent:r=>n.bridgeEvent(t,e.recordId,r),onSetComposerDraft:n.onSetComposerDraft,onRefresh:n.onRefresh},t)})]})}function oa(e){return{recordId:`player-view:${e.panelId}`,worldId:e.worldId,operationId:`player-view:${e.panelId}`,playPresetId:e.preset.id,playPresetRevision:e.preset.revision,requestId:`player_view`,requestAttempt:0,output:e.panelId,channel:e.channel,key:e.key,contentType:e.contentType,payload:e.payload,projection:e.projection,save:`none`,sequence:0,head:e.head,frontend:e.frontend}}function sa({artifact:e,worldId:t,channelArtifacts:n,playerViews:r,interactionDisabled:i,disabled:a,error:o,events:s,onDisable:c,onEnable:u,onError:d,onBridgeEvent:f,onSetComposerDraft:p,onRefresh:m}){let h=`extension-${ha(Vi(e))}`,[g,_]=(0,l.useState)(()=>({epoch:0,nonce:ga()})),y=g.nonce,[x,S]=(0,l.useState)(!1),C=(0,l.useMemo)(()=>Wi({payload:e.payload,contentType:e.contentType,rules:e.frontend.regex}),[e.contentType,e.frontend.regex,e.payload]),w=(0,l.useRef)(null),T=e.frontend.renderer,E=T?.mode===`app`,D=C.final,O=(0,l.useMemo)(()=>{try{return{srcDoc:E&&T!==void 0?Ji({renderer:T,instanceId:h,nonce:y}):Gi(D,e.contentType,T,e.payload),error:void 0}}catch(e){return{srcDoc:``,error:e instanceof Error?e.message:v(`文档 renderer 无效`)}}},[e.contentType,e.payload,D,h,E,y,T]),k=O.srcDoc,ee=O.error,A=o??ee??(C.failure===`fail`?C.error:void 0),te=(0,l.useCallback)(()=>{S(!1),_(e=>({epoch:e.epoch+1,nonce:ga()})),m()},[m]),j=(0,l.useCallback)(()=>{let n=w.current;!E||n?.contentWindow==null||n.contentWindow.postMessage({namespace:Qi,type:`render.update`,instanceId:h,nonce:y,payload:{content:D,contentType:e.contentType,worldId:t,channel:e.channel,key:e.key,interactionDisabled:i}},`*`)},[e.channel,e.contentType,e.key,D,h,E,y,t,i]);(0,l.useEffect)(()=>{function e(e){if(e.source!==w.current?.contentWindow)return;if(ea(e.data,{instanceId:h,nonce:y})){S(!0),f(`bridge.ready`);return}if(ta(e.data,{instanceId:h,nonce:y})){let t=_a(e.data.payload)?e.data.payload:{};f(`diagnostic`),d(typeof t.message==`string`?t.message:v(`扩展报告了未知诊断`));return}if(!$i(e.data,{instanceId:h,nonce:y}))return;f(e.data.command);let t=_a(e.data.payload)?e.data.payload:{};if(e.data.command===`read_channel`)ca(e,e.data,{artifacts:n.map(e=>({recordId:e.recordId,channel:e.channel,...e.key===void 0?{}:{key:e.key},contentType:e.contentType,payload:e.payload,projection:e.projection,save:e.save,sequence:e.sequence,head:e.head}))});else if(e.data.command===`read_player_view`){let n=typeof t.viewId==`string`?t.viewId:``;ca(e,e.data,{view:r.find(e=>_a(e)&&e.id===n)})}else e.data.command===`composer.set_draft`?i?ua(e,e.data,v(`当前调用链正在提交,暂不能修改草稿`)):typeof t.text==`string`?(p(t.text),la(e,e.data,{accepted:!0})):ua(e,e.data,v(`composer.set_draft.text 必须是字符串`)):e.data.command===`panel.close`?(c(),ca(e,e.data,{accepted:!0})):e.data.command===`panel.refresh`?(te(),ca(e,e.data,{accepted:!0})):e.data.command===`diagnostic`&&d(typeof t.message==`string`?t.message:v(`扩展报告了未知诊断`))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[n,h,y,f,c,d,m,p,i,r,te]),(0,l.useEffect)(()=>{x&&j()},[x,j]);function M(){S(!0),E&&window.setTimeout(j,0)}return(0,b.jsxs)(`article`,{className:`artifact-extension-instance${A?` has-error`:``}`,"data-artifact-output":e.output,"data-artifact-status":e.frontend.status,"data-extension-authority":e.frontend.authority??`non_authoritative_artifact`,children:[a||A||e.frontend.fallback===`raw`||C.fallback?(0,b.jsxs)(`div`,{className:`artifact-extension-fallback`,role:`status`,children:[(0,b.jsx)(`p`,{children:A??C.error??e.frontend.diagnostic??v(`扩展资源不可用,显示 raw artifact。`)}),(0,b.jsx)(`pre`,{children:C.original}),(0,b.jsx)(`button`,{type:`button`,onClick:a?u:c,children:v(a?`恢复此扩展`:`停用此扩展`)})]}):e.frontend.source===`player_view`&&T===void 0?(0,b.jsx)(zi,{content:D}):(0,b.jsxs)(b.Fragment,{children:[e.frontend.trustedLocalCode?(0,b.jsx)(`small`,{className:`artifact-extension-trusted-label`,children:v(`本地可信代码`)}):null,(0,b.jsx)(`iframe`,{ref:w,title:e.output,className:`artifact-extension-frame`,sandbox:e.frontend.trustedLocalCode?`allow-scripts`:``,srcDoc:k,onLoad:M,onError:()=>d(v(`扩展 iframe 加载失败`))},g.epoch)]}),e.frontend.mount===`debug`?(0,b.jsxs)(`details`,{className:`artifact-extension-debug`,children:[(0,b.jsx)(`summary`,{children:v(`产物诊断`)}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:v(`来源`)}),(0,b.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,b.jsx)(`dt`,{children:v(`保存/投影`)}),(0,b.jsxs)(`dd`,{children:[e.save,` / `,e.projection]}),(0,b.jsx)(`dt`,{children:`renderer revision`}),(0,b.jsx)(`dd`,{children:e.frontend.renderer?.revision??`built-in`})]}),(0,b.jsx)(`p`,{children:`raw payload`}),(0,b.jsx)(`pre`,{children:C.original}),(0,b.jsx)(`p`,{children:`regex steps`}),(0,b.jsx)(`pre`,{children:JSON.stringify(C.steps,null,2)}),s.length===0?null:(0,b.jsxs)(`p`,{children:[`bridge events: `,s.join(`, `)]})]}):null,s.length===0?null:(0,b.jsxs)(`details`,{className:`artifact-extension-events`,children:[(0,b.jsxs)(`summary`,{children:[v(`bridge 事件(`),s.length,`)`]}),(0,b.jsx)(`ul`,{children:s.map((e,t)=>(0,b.jsx)(`li`,{children:e},`${e}-${t}`))})]})]})}function ca(e,t,n){la(e,t,n)}function la(e,t,n){da(e,t,{ok:!0,payload:n})}function ua(e,t,n){da(e,t,{ok:!1,error:n})}function da(e,t,n){if(t.requestId===void 0)return;let r=e.source;r!==null&&`postMessage`in r&&r.postMessage({namespace:Qi,type:`bridge.response`,ok:n.ok,requestId:t.requestId,instanceId:t.instanceId,nonce:t.nonce,...n.ok?{payload:n.payload}:{error:n.error}},`*`)}function fa(e,t,n){let r=typeof t[0]==`string`?t[0]:``,i=typeof t.at(-2)==`number`?t.at(-2):0,a=typeof t.at(-1)==`object`?-3:-2,o=t.slice(1,a);return e.replace(/\$(\$|&|`|'|\d{1,2})/gu,(e,t)=>{if(t===`&`)return r;if(t==="`")return n.slice(0,i);if(t===`'`)return n.slice(i+r.length);if(/^\d{1,2}$/u.test(t)){let e=o[Number(t)-1];return typeof e==`string`?e:``}return`$`})}function pa(e){return e.replace(/`([^`]+)`/gu,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/gu,`<strong>$1</strong>`)}function ma(e){return e.replace(/&/gu,`&amp;`).replace(/</gu,`&lt;`).replace(/>/gu,`&gt;`).replace(/"/gu,`&quot;`).replace(/'/gu,`&#39;`)}function ha(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return(t>>>0).toString(36)}function ga(){return oe(`extension-nonce`)}function _a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var va=(e,t)=>_()===`zh-CN`?e:t;function ya({client:e,presetId:t,revision:n,files:r,structure:i,scriptsEnabled:a,requestId:o,output:s}){let c=JSON.stringify({presetId:t,revision:n,files:r,structure:i,scriptsEnabled:a,requestId:o,output:s}),[u,d]=(0,l.useState)(),[f,p]=(0,l.useState)(),[m,h]=(0,l.useState)(),[g,_]=(0,l.useState)(``),[v,y]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let a=!0,o=setTimeout(()=>{e.request({type:`play.workbench.read`,presetId:t,revision:n,draft:{files:r,structure:i}}).then(e=>{a&&d({key:c,snapshot:e})}).catch(e=>{a&&p({key:c,message:String(e)})})},250);return()=>{a=!1,clearTimeout(o)}},[e,c,t,n,r,i]);let x=u?.key===c?u.snapshot:void 0,S=x?.artifactPreviews.find(e=>e.requestId===o&&e.output===s),C=m??S?.rawText??``,w=``;if(S?.declaration.contentType===`application/json`)try{C=JSON.parse(m??JSON.stringify(S.rawPayload,null,2));let e=Ni(S.declaration.payloadContract,C);w=e.ok?va(`样例校验通过`,`Sample valid`):e.message}catch(e){w=String(e)}let T=x?.structure.mounts.find(e=>e.channel===S?.declaration.channel)?.mount,E=S&&T?{recordId:`preview`,worldId:`preview`,operationId:`preview`,playPresetId:t,playPresetRevision:x.revision,requestId:o,requestAttempt:1,output:s,channel:S.declaration.channel,...S.declaration.key?{key:S.declaration.key}:{},contentType:S.declaration.contentType,payload:C,projection:S.declaration.strategy,save:S.declaration.save,sequence:1,head:`preview`,frontend:{status:`ready`,preset:{id:t,revision:x.revision},mount:T,regex:S.regex,...S.renderer?{renderer:S.renderer}:{},trustedLocalCode:S.renderer?.trustedLocalCode===!0&&a,fallback:`none`}}:void 0,D=S?Wi({contentType:S.declaration.contentType,payload:C,rules:S.regex}):void 0;return(0,b.jsxs)(`details`,{className:`preset-draft-preview`,children:[(0,b.jsx)(`summary`,{children:va(`游玩效果预览 · 就地展开`,`Play preview · expand here`)}),(0,b.jsx)(`p`,{children:va(`预览当前修改与本页样例,不调用模型,也不改变世界。JavaScript 是否运行沿用此预设的脚本设置。`,`Preview your current edits with this page's sample data, without model calls or world changes. JavaScript follows this preset's script settings.`)}),f?.key===c?(0,b.jsx)(`p`,{role:`alert`,children:f.message}):x?null:(0,b.jsx)(`p`,{role:`status`,children:va(`正在解析当前草稿…`,`Resolving draft…`)}),S&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[va(`示例输入`,`Sample input`),(0,b.jsx)(`textarea`,{"aria-label":va(`示例输入`,`Sample input`),rows:6,value:m??(S.declaration.contentType===`application/json`?JSON.stringify(S.rawPayload,null,2):S.rawText),onChange:e=>h(e.target.value)})]}),S.declaration.contentType===`application/json`&&(0,b.jsxs)(`div`,{className:`preset-inline`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>h(JSON.stringify(S.rawPayload,null,2)),children:va(`载入当前格式样例`,`Load current format sample`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=structuredClone(S.rawPayload),t=S.declaration.payloadContract,n=Array.isArray(e)?e[0]:e,r=(Array.isArray(e)?t?.items:t)?.required?.[0];r&&n&&typeof n==`object`&&delete n[r],h(JSON.stringify(e,null,2))},children:va(`移除首个必填字段`,`Remove first required field`)})]}),w&&(0,b.jsx)(`p`,{role:`status`,children:w}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:va(`处理后显示文本`,`Processed display text`)}),(0,b.jsx)(`pre`,{children:D?.final})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),va(`预览禁交互状态`,`Preview disabled interactions`)]})]}),E?(0,b.jsxs)(`section`,{className:`preset-preview-position position-${T}`,children:[(0,b.jsx)(`h4`,{children:Ci(T)}),(0,b.jsx)(ia,{worldId:`preview`,artifacts:[E],playerViews:{views:[]},interactionDisabled:v,onSetComposerDraft:_,onRefresh:()=>h(m),children:(0,b.jsx)(aa,{mount:T})},c)]}):S?(0,b.jsx)(`p`,{children:va(`此产物未设置显示位置。`,`This output has no display position.`)}):null,(0,b.jsxs)(`label`,{children:[va(`本页输入草稿(尚未发送)`,`Local input draft (not sent)`),(0,b.jsx)(`textarea`,{"aria-label":va(`本页输入草稿(尚未发送)`,`Local input draft (not sent)`),value:g,onChange:e=>_(e.target.value)})]})]})}function ba({client:e,presetId:t,revision:n,files:r,structure:i,conflict:a,scriptsEnabled:o}){let[s,c]=(0,l.useState)([]),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(null),y=(0,l.useRef)(0),x=JSON.stringify({presetId:t,revision:n,files:r,structure:i,worldId:u,conflict:a,scriptsEnabled:o}),[S,C]=(0,l.useState)(x);S!==x&&(C(x),p(null),h(!1),_(null));let w=f?.key===x?f.preview:void 0;(0,l.useEffect)(()=>{let t=!0;return e.request({type:`workspace.read`}).then(e=>{t&&c(e.worlds)}).catch(e=>{t&&_(String(e))}),()=>{t=!1,y.current+=1}},[e]),(0,l.useEffect)(()=>{y.current+=1},[x]);async function T(){if(u===``||a)return;let o=++y.current;h(!0),_(null),p(null);try{let a=await e.request({type:`play.workbench.read`,presetId:t,revision:n,worldId:u,draft:{files:r,...i===void 0?{}:{structure:i}}});o===y.current&&a.playerViewPreview.worldId===u&&p({key:x,preview:a.playerViewPreview})}catch(e){o===y.current&&_(e instanceof Error?e.message:String(e))}finally{o===y.current&&h(!1)}}return(0,b.jsxs)(`section`,{className:`play-preset-structured-section interface-extension-preview`,"aria-label":v(`纯界面预览`),children:[(0,b.jsx)(`h4`,{children:v(`纯界面预览`)}),(0,b.jsx)(`p`,{children:v(`使用当前编辑内容与所选世界的已保存玩家视图,不调用模型,也不保存或修改世界。修改后请重新预览。`)}),(0,b.jsxs)(`label`,{children:[v(`预览世界`),(0,b.jsxs)(`select`,{"aria-label":v(`预览世界`),value:u,onChange:e=>d(e.currentTarget.value),children:[(0,b.jsx)(`option`,{value:``,children:v(`选择已有世界`)}),s.map(e=>(0,b.jsx)(`option`,{value:e.worldId,children:e.title},e.worldId))]})]}),(0,b.jsx)(`button`,{type:`button`,disabled:m||u===``||a,onClick:()=>void T(),children:v(`预览界面`)}),m?(0,b.jsx)(`p`,{role:`status`,children:v(`正在读取玩家视图…`)}):null,a?(0,b.jsx)(`p`,{role:`alert`,children:v(`预设原文与表单均有修改,请先保留一种编辑结果并保存,再预览。`)}):null,g===null?null:(0,b.jsx)(`p`,{role:`alert`,children:g}),w===void 0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`datalist`,{id:`player-view-preview-sources`,children:w.playerViews.views.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.title},e.id))}),(0,b.jsx)(ia,{worldId:w.worldId,artifacts:[],playerViewPanels:w.panels,playerViews:w.playerViews,onSetComposerDraft:()=>void 0,onRefresh:T,children:na.filter(e=>w.panels.some(t=>t.frontend.mount===e)).map(e=>(0,b.jsxs)(`section`,{"aria-label":Ci(e),children:[(0,b.jsx)(`h5`,{children:Ci(e)}),(0,b.jsx)(aa,{mount:e})]},e))}),w.panels.length===0?(0,b.jsx)(`p`,{children:v(`当前没有玩家视图面板。`)}):null]})]})}var xa=[{id:`call_chain`,label:`游玩`,description:`叙事规则、后置请求与工具契约`},{id:`setting_improvement`,label:`设定完善`,description:`AI 创作方法;工具契约保持内置`}];function Sa(e){let t=structuredClone(e);if(t.draft===void 0)return t;let n={...t,revision:t.draft.revision,files:structuredClone(t.draft.files),validation:structuredClone(t.draft.validation)};return t.draft.structure===void 0?delete n.structure:n.structure=structuredClone(t.draft.structure),n}function Ca(e){return Object.prototype.hasOwnProperty.call(e,`preset.yaml`)?`preset.yaml`:Object.prototype.hasOwnProperty.call(e,`call-chain.yaml`)?`call-chain.yaml`:Object.keys(e).sort()[0]??``}function wa({client:e,initialLibrary:t,recommendedTemplates:n=[],onLibraryChange:r,onDirtyChange:i,renderPromptPreview:a}){let[o,s]=(0,l.useState)(t),c=(0,l.useRef)(null),u=t.presets.find(({id:e})=>e===t.currentPresetId)??t.presets[0],[d,f]=(0,l.useState)(u?.id??``),[p,m]=(0,l.useState)(()=>u===void 0?null:Sa(u)),[h,g]=(0,l.useState)(u?.files===void 0?``:Ca(u.draft?.files??u.files)),[y,x]=(0,l.useState)(``),[S,C]=(0,l.useState)(``),[w,T]=(0,l.useState)(`call_chain`),[E,D]=(0,l.useState)(!1),[O,k]=(0,l.useState)(null),ee=(0,l.useMemo)(()=>o.presets.find(({id:e})=>e===p?.id),[p?.id,o.presets]),A=ee?.draft??ee,te=p!==null&&A!==void 0&&(JSON.stringify(p.files)!==JSON.stringify(A.files)||JSON.stringify(p.structure)!==JSON.stringify(A.structure)),j=p!==null&&ee!==void 0&&p.name!==ee.name,M=p!==null&&ee!==void 0&&(j||te),ne=(0,l.useMemo)(()=>{let e=p?.structure?.callChainPath??A?.structure?.callChainPath??`call-chain.yaml`;return new Set([`preset.yaml`,e])},[p?.structure?.callChainPath,A?.structure?.callChainPath]),N=new Set([...p?.structure?.followups.flatMap(e=>[e.prompt.path,...e.artifacts.flatMap(e=>[e.renderer,e.regex,...e.scripts??[],...e.assets??[]])])??[],...p?.structure?.playerViewPanels.flatMap(e=>[e.renderer,e.regex,...e.scripts??[],...e.assets??[]])??[]]),P=p!==null&&A!==void 0&&[...ne].some(e=>p.files[e]!==A.files[e]),re=p!==null&&A!==void 0&&JSON.stringify(p.structure)!==JSON.stringify(A.structure),ie=P&&re,ae=o.presets.find(({id:e})=>e===o.currentPresetId);(0,l.useEffect)(()=>{i(M)},[M,i]),(0,l.useEffect)(()=>()=>i(!1),[i]);async function oe(t){let n=await e.request({type:`play.read`}),i=n.presets.find(({id:e})=>e===t)??n.presets.find(({id:e})=>e===d)??n.presets.find(({id:e})=>e===n.currentPresetId)??n.presets[0];c.current&&(c.current.open=!1),s(n),r(n),f(i?.id??``);let a=i===void 0?null:Sa(i);m(a),g(a===null?``:Ca(a.files))}async function F(e){if(!E){D(!0),k(null);try{await e()}catch(e){k({kind:`error`,text:e instanceof Error?e.message:v(`玩法预设操作失败`)})}finally{D(!1)}}}function I(e){if(e===d)return;if(M&&e!==d){k({kind:`error`,text:v(`当前玩法有未保存修改;请先保存或撤销,再切换预设。`)});return}let t=o.presets.find(({id:t})=>t===e);if(t===void 0)return;f(e);let n=Sa(t);m(n),g(Ca(n.files)),k(null),T(`call_chain`)}function se(){if(ee===void 0)return;let e=Sa(ee);m(e),g(Ca(e.files)),k({kind:`status`,text:v(`已撤销当前未保存修改。`)})}function le(e){p!==null&&h!==``&&L(h,e)}function L(e,t){m(n=>n===null?null:{...n,files:{...n.files,[e]:t}})}function ue(e){m(t=>t===null?null:{...t,files:e(structuredClone(t.files))})}function de(e){m(t=>t?.structure===void 0?t:{...t,structure:e(structuredClone(t.structure))})}async function fe(){if(p!==null){if(ie){k({kind:`error`,text:v(`预设原文与表单均有修改,请先保留一种编辑结果再保存,以免覆盖当前修改。`)});return}await F(async()=>{await e.request({type:`play.save`,presetId:p.id,name:p.name,files:p.files,...p.structure===void 0||P||!re&&p.structure.migrationNotice===void 0?{}:{structure:p.structure}}),await oe(p.id),k({kind:`status`,text:v(`预设已保存。`)})})}}async function pe(){p!==null&&await F(async()=>{let t=await e.request({type:`play.export`,presetId:p.id}),n=new Blob([JSON.stringify(t.files,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${p.name}.play-preset.json`,i.click(),URL.revokeObjectURL(r),k({kind:`status`,text:v(`预设已导出。`)})})}async function R(t){t!==void 0&&await F(async()=>{let n=JSON.parse(await t.text());if(!Array.isArray(n)||n.some(e=>typeof e!=`object`||!e||typeof e.path!=`string`||typeof e.contents!=`string`))throw Error(v(`无法识别此预设。请选择通过“导出预设”生成的文件。`));await oe((await e.request({type:`play.import`,name:t.name.replace(/\.play-preset\.json$/iu,``)||v(`导入玩法`),files:n})).preset.id),k({kind:`status`,text:v(`预设已导入为独立副本,JavaScript 默认关闭;信任其内容后可在预设操作中启用。`)})})}return(0,b.jsxs)(`section`,{className:`play-preset-screen`,"aria-labelledby":`play-preset-title`,onPointerDownCapture:e=>{for(let t of e.currentTarget.querySelectorAll(`.play-preset-operations[open], .play-preset-library > details[open]`))e.target instanceof Node&&!t.contains(e.target)&&(t.open=!1)},onKeyDown:e=>{if(e.key===`Escape`)for(let t of e.currentTarget.querySelectorAll(`.play-preset-operations[open], .play-preset-library > details[open]`))t.open=!1},children:[(0,b.jsxs)(`header`,{className:`play-preset-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:`PLAY WORKBENCH · FILE NATIVE`}),(0,b.jsx)(`h2`,{id:`play-preset-title`,children:v(`玩法预设`)}),(0,b.jsx)(`p`,{className:`play-preset-lede`,children:v(`在同一处编辑设定完善方法、主持规则、后置请求与界面展示。`)})]}),(0,b.jsxs)(`div`,{className:`play-preset-header-fact`,children:[(0,b.jsx)(`span`,{children:v(`当前使用的预设`)}),(0,b.jsx)(`strong`,{children:ae?.name??v(`未选择`)}),(0,b.jsx)(`small`,{children:v(`游玩在下一次正常发送生效,原样重试保留旧请求`)})]})]}),O===null?null:(0,b.jsx)(ce,{className:`play-preset-feedback ${O.kind}`,role:O.kind===`error`?`alert`:`status`,text:O.text,onDismiss:()=>k(null)}),(0,b.jsxs)(`fieldset`,{disabled:E,className:`play-preset-workspace`,children:[(0,b.jsx)(`legend`,{className:`visually-hidden`,children:v(`玩法预设工作区`)}),(0,b.jsxs)(`div`,{className:`play-preset-layout`,children:[(0,b.jsxs)(`div`,{className:`play-preset-toolbar`,children:[(0,b.jsxs)(`aside`,{className:`panel-card play-preset-library`,"aria-label":v(`玩法预设列表`),children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{className:`visually-hidden`,children:v(`玩法预设`)}),(0,b.jsx)(`select`,{"aria-label":v(`切换预设`),value:d??``,disabled:E||M,onChange:e=>I(e.target.value),children:o.presets.map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,b.jsxs)(`details`,{ref:c,children:[(0,b.jsx)(`summary`,{children:v(`预设管理`)}),(0,b.jsxs)(`section`,{className:`play-preset-library-actions`,"aria-label":v(`新建与导入玩法预设`),children:[(0,b.jsx)(`h4`,{children:v(`新建或导入`)}),(0,b.jsx)(`input`,{"aria-label":v(`新玩法预设名称`),placeholder:v(`新玩法预设名称`),value:y,onChange:e=>x(e.currentTarget.value)}),(0,b.jsx)(`button`,{type:`button`,disabled:E||M||y.trim()===``,onClick:()=>void F(async()=>{let t=await e.request({type:`play.create`,name:y.trim()});x(``),await oe(t.preset.id),k({kind:`status`,text:v(`已新建普通玩法预设。`)})}),children:v(`新建空白预设`)}),n.map(t=>(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M,onClick:()=>void F(async()=>{await oe((await e.request({type:`play.create`,name:t.name,files:structuredClone(t.files)})).preset.id),k({kind:`status`,text:v(`已复制推荐{name},可独立编辑。`,{name:t.label})})}),children:[v(`复制推荐`),t.label]},t.id)),(0,b.jsxs)(`label`,{className:`play-preset-import-control`,children:[v(`导入预设`),(0,b.jsx)(`input`,{"aria-label":v(`选择要导入的预设`),type:`file`,accept:`.json,application/json`,disabled:E||M,onChange:e=>{R(e.currentTarget.files?.[0]),e.currentTarget.value=``}})]})]})]})]}),p!==null&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`nav`,{className:`play-preset-workspace-nav`,role:`tablist`,"aria-label":v(`玩法预设编辑区域`),children:xa.filter(e=>e.id===`call_chain`||e.id===`setting_improvement`).map(e=>(0,b.jsxs)(`button`,{id:`play-preset-tab-${e.id}`,type:`button`,role:`tab`,"aria-controls":`play-preset-panel-${e.id}`,"aria-selected":w===e.id,className:w===e.id?`selected`:``,onClick:()=>T(e.id),children:[(0,b.jsx)(`strong`,{children:v(e.label)}),(0,b.jsx)(`span`,{children:v(e.description)})]},e.id))}),(0,b.jsxs)(`details`,{className:`play-preset-operations`,children:[(0,b.jsx)(`summary`,{children:v(`预设操作`)}),(0,b.jsxs)(`div`,{className:`play-preset-operations-content`,children:[(0,b.jsxs)(`label`,{className:`play-preset-name-field`,children:[v(`预设名称`),(0,b.jsx)(`input`,{"aria-label":v(`玩法预设名称`),maxLength:160,value:p.name,onChange:e=>m({...p,name:e.currentTarget.value})})]}),(0,b.jsxs)(`div`,{className:`play-preset-management`,"aria-label":v(`预设操作`),children:[(0,b.jsx)(`p`,{children:v(`这些操作只管理这份本地预设;内容编辑和保存仍在页面底部完成。`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M,onClick:()=>void F(async()=>{await e.request({type:`play.enable`,presetId:p.id,enabled:p.enabled===!1}),await oe(p.id),k({kind:`status`,text:v(`玩法预设状态已更新。`)})}),children:p.enabled===!1?v(`启用预设`):v(`停用预设`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M,onClick:()=>void F(async()=>{await e.request({type:`play.scripts`,presetId:p.id,enabled:p.scriptsEnabled!==!0}),await oe(p.id),k({kind:`status`,text:p.scriptsEnabled===!0?v(`JavaScript 已关闭;文本、HTML 和样式仍可预览。`):v(`JavaScript 已显式启用(本地可信代码)。`)})}),children:p.scriptsEnabled===!0?v(`停用 JavaScript`):v(`启用 JavaScript(本地可信代码)`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M,onClick:()=>void F(async()=>{await oe((await e.request({type:`play.copy`,presetId:p.id})).preset.id),k({kind:`status`,text:v(`已复制为独立预设。`)})}),children:v(`复制为新预设`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M,onClick:()=>void pe(),children:v(`导出预设`)}),(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:E||M,onClick:()=>void F(async()=>{await e.request({type:`play.delete`,presetId:p.id}),await oe(),k({kind:`status`,text:v(`玩法预设已删除;删空后会自动重建默认预设。`)})}),children:v(`删除预设`)})]}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`导入的 JavaScript 默认停用;启用表示你信任这些本地文件,而不是获得安全沙箱保证。`)}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:v(`保留的资源`)}),(0,b.jsx)(`p`,{children:v(`未绑定资源仍随预设保存;可在模板编辑器重新引用。`)}),Object.keys(p.files).filter(e=>!ne.has(e)&&!N.has(e)).map(e=>(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:/^(assets|scripts|renderers|regex)\//u.test(e)?ye(e):Ei(e,p.files[e]??``).title??e.split(`/`).at(-1)}),/^(assets|scripts|renderers|regex)\//u.test(e)&&(0,b.jsx)(`button`,{type:`button`,disabled:Object.entries(p.files).some(([t,n])=>t!==e&&!ne.has(t)&&n.includes(e)),onClick:()=>m(t=>{if(!t?.structure||N.has(e))return t;let n={...t.files};return delete n[e],{...t,files:n,structure:{...t.structure,extensionRefs:t.structure.extensionRefs.filter(t=>t!==e)}}}),children:_()===`zh-CN`?`删除未引用资源`:`Delete unused resource`}),(0,b.jsx)(`textarea`,{"aria-label":e.split(`/`).at(-1),value:p.files[e],onChange:t=>L(e,t.target.value)})]},e))]})]})]})]})]}),p===null?(0,b.jsx)(`section`,{className:`panel-card`,role:`status`,children:v(`还没有玩法预设。`)}):(0,b.jsxs)(`section`,{className:`panel-card play-preset-editor`,"aria-label":v(`预设编辑器`),children:[(0,b.jsxs)(`header`,{className:`play-preset-editor-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`play-preset-section-kicker`,children:`EDIT PRESET`}),(0,b.jsx)(`h3`,{children:p.name}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`· 游玩修改在下一次正常发送生效`)})]}),(0,b.jsxs)(`div`,{className:`play-preset-editor-badges`,children:[(0,b.jsx)(`span`,{className:`play-preset-draft-state${M?` dirty`:``}`,children:v(M?`未保存修改`:`已保存`)}),p.id===o.currentPresetId?(0,b.jsx)(`span`,{className:`play-preset-badge current`,children:v(`当前玩法`)}):null,p.enabled===!1?(0,b.jsx)(`span`,{className:`play-preset-badge disabled`,children:v(`已停用`)}):null,(0,b.jsx)(`span`,{className:`play-preset-badge`,children:p.scriptsEnabled===!0?v(`JavaScript 已启用`):v(`JavaScript 已停用`)})]})]}),p.structure&&(w===`call_chain`||w===`setting_improvement`)?(0,b.jsx)(Ai,{structure:p.structure,files:p.files,authoring:w===`setting_improvement`,onChange:de,onWrite:L,promptPreview:(0,b.jsxs)(`details`,{className:`preset-draft-preview`,children:[(0,b.jsx)(`summary`,{children:v(`发送给 AI 的内容预览`)}),M?(0,b.jsx)(`p`,{children:v(`请先保存当前修改;这里预览的是已保存且校验通过的预设,不包含未保存修改。`)}):a?.({presetId:p.id,revision:p.revision})]}),preview:(t,n)=>t&&n?(0,b.jsx)(ya,{client:e,presetId:p.id,revision:p.revision,files:p.files,structure:p.structure,scriptsEnabled:p.scriptsEnabled===!0,requestId:t,output:n},`${t}:${n}`):(0,b.jsx)(ba,{client:e,presetId:p.id,revision:p.revision,files:p.files,structure:p.structure,conflict:ie,scriptsEnabled:p.scriptsEnabled===!0})},`${p.id}:${w}`):null,w===`files`?(0,b.jsx)(Da,{files:p.files,filePath:h,newFilePath:S,pending:E,onFilePathChange:g,onNewFilePathChange:C,onFileChange:le,onCreateFile:()=>{let e=S.trim();if(p.files[e]!==void 0){k({kind:`error`,text:v(`该玩法文件路径已经存在。`)});return}ue(t=>({...t,[e]:``})),g(e),C(``),k({kind:`status`,text:v(`已加入修复草稿,保存时将检查预设格式。`)})}}):null,p.structure===void 0&&(w===`call_chain`||w===`setting_improvement`)?(0,b.jsxs)(`section`,{id:`play-preset-panel-${w}`,className:`play-preset-empty-view`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-${w}`,children:[(0,b.jsx)(`strong`,{children:v(`结构化编辑暂不可用`)}),(0,b.jsx)(`p`,{children:v(`导入内容无法解析;原文完整保留,可导出或打开原文修复。`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>T(`files`),children:v(`修复导入原文`)})]}):null,(0,b.jsxs)(`footer`,{className:`play-preset-editor-actions`,children:[ie?(0,b.jsx)(`p`,{role:`alert`,className:`workspace-feedback`,children:v(`预设原文与表单均有修改,请先保留一种编辑结果再保存,以免覆盖当前修改。`)}):null,(0,b.jsxs)(`div`,{className:`play-preset-save-state`,children:[(0,b.jsx)(`strong`,{children:M?v(`草稿尚未保存`):p.validation.status===`valid`?v(`预设检查通过`):v(`草稿需要修复`)}),(0,b.jsx)(`span`,{children:p.validation.status===`valid`?v(`· 游玩修改在下一次正常发送生效`):`[${p.validation.code??`play_preset_invalid`}] ${p.validation.location??`call-chain.yaml`}:${p.validation.message}`})]}),(0,b.jsxs)(`div`,{className:`play-preset-primary-actions`,children:[M?(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E,onClick:se,children:v(`撤销未保存修改`)}):null,(0,b.jsx)(`button`,{type:`button`,disabled:E||!M&&p.structure?.migrationNotice===void 0||ie,onClick:()=>void fe(),children:v(`保存修改`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E||M||p.validation.status!==`valid`,onClick:()=>void F(async()=>{await e.request({type:`play.select`,presetId:p.id}),await oe(p.id),k({kind:`status`,text:v(`已应用此预设;游玩修改将在下一次正常发送时生效。`)})}),children:v(`应用为当前玩法`)})]})]})]})]})]})]})}function Ta({artifact:e,files:t,mount:n,onChange:r,onRemove:i}){let a=Object.keys(t).filter(e=>/^renderers\/.+\.html$/u.test(e)).sort(),o=Object.keys(t).filter(e=>/^regex\/.+\.yaml$/u.test(e)).sort(),s=Object.keys(t).filter(e=>/^scripts\/.+\.js$/u.test(e)).sort(),c=Object.keys(t).filter(e=>e.startsWith(`assets/`)).sort();function l(e,t){r(n=>{let r={...n};return t===``?delete r[e]:r[e]=t,r})}function u(e,t){r(n=>{let r={...n};return t.length===0?delete r[e]:r[e]=t,r})}return(0,b.jsxs)(`article`,{className:`play-preset-artifact-definition`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:e.name}),(0,b.jsxs)(`span`,{children:[Ea(e.contentType),` ·`,n===void 0?v(` 不在页面显示`):` ${Ci(n)}`]})]}),(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:i,children:v(`删除产物`)})]}),(0,b.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,b.jsxs)(`label`,{children:[v(`产物标识`),(0,b.jsx)(`input`,{"aria-label":v(`{name} 产物标识`,{name:e.name}),value:e.name,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,name:t}))}})]}),(0,b.jsxs)(`label`,{children:[v(`内容格式`),(0,b.jsxs)(`select`,{"aria-label":v(`{name} 内容格式`,{name:e.name}),value:e.contentType,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,contentType:t}))},children:[(0,b.jsx)(`option`,{value:`text/markdown`,children:v(`Markdown 文本`)}),(0,b.jsx)(`option`,{value:`text/plain`,children:v(`纯文本`)}),(0,b.jsx)(`option`,{value:`application/json`,children:v(`结构化数据`)}),(0,b.jsx)(`option`,{value:`text/html`,children:`HTML`})]})]}),(0,b.jsxs)(`label`,{children:[v(`同频道已有内容时`),(0,b.jsxs)(`select`,{"aria-label":v(`{name} 更新方式`,{name:e.name}),value:e.strategy,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,strategy:t,...t===`upsert`&&e.key===void 0?{key:`current`}:{}}))},children:[(0,b.jsx)(`option`,{value:`replace`,children:G(`replace`)}),(0,b.jsx)(`option`,{value:`append`,children:G(`append`)}),(0,b.jsx)(`option`,{value:`upsert`,children:G(`upsert`)}),(0,b.jsx)(`option`,{value:`transient`,children:G(`transient`)}),(0,b.jsx)(`option`,{value:`hidden`,children:G(`hidden`)})]})]}),(0,b.jsxs)(`label`,{className:`play-preset-checkbox-field`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>{let t=e.currentTarget.checked;r(e=>({...e,required:t}))}}),v(`AI 必须生成这项产物`)]})]}),(0,b.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,b.jsx)(`summary`,{children:v(`高级产物设置`)}),(0,b.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,b.jsxs)(`label`,{children:[v(`技术频道地址`),(0,b.jsx)(`input`,{"aria-label":v(`{name} 技术频道`,{name:e.name}),value:e.channel,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,channel:t}))}})]}),e.strategy===`upsert`?(0,b.jsxs)(`label`,{children:[v(`更新 key`),(0,b.jsx)(`input`,{value:e.key??``,onChange:e=>l(`key`,e.currentTarget.value)})]}):null,(0,b.jsxs)(`label`,{children:[v(`保存到`),(0,b.jsxs)(`select`,{value:e.save,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,save:t}))},children:[(0,b.jsx)(`option`,{value:`commit`,children:G(`commit`)}),(0,b.jsx)(`option`,{value:`operation`,children:G(`operation`)}),(0,b.jsx)(`option`,{value:`none`,children:G(`none`)})]})]}),(0,b.jsxs)(`label`,{children:[v(`何时失效`),(0,b.jsxs)(`select`,{value:e.invalidation,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,invalidation:t}))},children:[(0,b.jsx)(`option`,{value:`new_operation`,children:G(`new_operation`)}),(0,b.jsx)(`option`,{value:`head_change`,children:G(`head_change`)}),(0,b.jsx)(`option`,{value:`operation_end`,children:G(`operation_end`)}),(0,b.jsx)(`option`,{value:`explicit_clear`,children:G(`explicit_clear`)}),(0,b.jsx)(`option`,{value:`never`,children:G(`never`)})]})]}),(0,b.jsxs)(`label`,{children:[v(`单次最多输出次数`),(0,b.jsx)(`input`,{type:`number`,min:1,value:e.maxEmits,onChange:e=>{let t=Number(e.currentTarget.value);r(e=>({...e,maxEmits:t}))}})]}),(0,b.jsxs)(`label`,{children:[v(`界面模板`),(0,b.jsxs)(`select`,{value:e.renderer??``,onChange:e=>{let t=e.currentTarget.value;r(e=>{let n={...e};return t===``?(delete n.renderer,delete n.rendererRevision):(n.renderer=t,n.rendererRevision??=`v1`),n})},children:[(0,b.jsx)(`option`,{value:``,children:v(`使用内置显示`)}),wi(a,e.renderer).map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]})]}),e.renderer===void 0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{children:[v(`模板版本标记`),(0,b.jsx)(`input`,{value:e.rendererRevision??``,onChange:e=>l(`rendererRevision`,e.currentTarget.value)})]}),(0,b.jsxs)(`label`,{children:[v(`模板模式`),(0,b.jsxs)(`select`,{value:e.rendererMode??`document`,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,rendererMode:t}))},children:[(0,b.jsx)(`option`,{value:`document`,children:v(`静态文档`)}),(0,b.jsx)(`option`,{value:`app`,children:v(`可交互 app`)})]})]})]}),(0,b.jsxs)(`label`,{children:[v(`正则处理规则`),(0,b.jsxs)(`select`,{value:e.regex??``,onChange:e=>l(`regex`,e.currentTarget.value),children:[(0,b.jsx)(`option`,{value:``,children:v(`不使用`)}),wi(o,e.regex).map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,b.jsxs)(`div`,{className:`play-preset-resource-columns`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h6`,{children:v(`脚本`)}),(0,b.jsx)(Oi,{ariaLabel:v(`{name} 脚本`,{name:e.name}),paths:s,selected:e.scripts??[],emptyText:v(`没有脚本文件。`),onChange:e=>u(`scripts`,e)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h6`,{children:v(`样式与资源`)}),(0,b.jsx)(Oi,{ariaLabel:v(`{name} 资源`,{name:e.name}),paths:c,selected:e.assets??[],emptyText:v(`没有资源文件。`),onChange:e=>u(`assets`,e)})]})]}),e.payloadContract===void 0?null:(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:v(`当前严格数据格式(只读)`)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(`这里显示此产物的数据要求。需要修改时,请在当前内容包或世界修订的文件编辑中修改 control/followups.yaml 的对应产物声明。`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(e.payloadContract,null,2)})]})]})]})}function Ea(e){return{"text/plain":v(`纯文本`),"text/markdown":`Markdown`,"application/json":v(`结构化数据`),"text/html":`HTML`}[e]}function Da({files:e,filePath:t,newFilePath:n,pending:r,onFilePathChange:i,onNewFilePathChange:a,onFileChange:o,onCreateFile:s}){let c=Object.keys(e).sort(),l=e[t]===void 0?c[0]??``:t,u=Ei(l,e[l]??``);return(0,b.jsxs)(`section`,{id:`play-preset-panel-files`,className:`play-preset-file-workspace`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-files play-preset-files-title`,children:[(0,b.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`play-preset-section-kicker`,children:`ADVANCED FILES`}),(0,b.jsx)(`h4`,{id:`play-preset-files-title`,children:v(`完整预设文件`)})]}),(0,b.jsx)(`p`,{children:v(`常用设置应在前面的表单完成。这里保留完整 YAML、Markdown、HTML、脚本和样式,并说明每份文件负责什么。`)})]}),(0,b.jsx)(`div`,{className:`play-preset-yaml-guide`,"aria-label":v(`三个核心 YAML 文件的用途`),children:[Ei(`preset.yaml`,e[`preset.yaml`]??``),Ei(`call-chain.yaml`,e[`call-chain.yaml`]??``),Ei(`frame.yaml`,e[`frame.yaml`]??``)].map(e=>(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsx)(`code`,{children:e.path}),(0,b.jsx)(`p`,{children:e.description})]},e.path))}),(0,b.jsxs)(`label`,{className:`play-preset-file-jump`,children:[v(`快速跳转文件`),(0,b.jsx)(`select`,{"aria-label":v(`玩法预设文件`),value:l,onChange:e=>i(e.currentTarget.value),children:c.map(t=>(0,b.jsxs)(`option`,{value:t,children:[Ei(t,e[t]??``).title,` · `,t]},t))})]}),(0,b.jsxs)(`div`,{className:`play-preset-file-browser`,children:[(0,b.jsx)(`aside`,{"aria-label":v(`玩法预设文件列表`),children:(0,b.jsx)(`ul`,{children:c.map(t=>{let n=Ei(t,e[t]??``);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:t===l?`selected`:``,"aria-pressed":t===l,"aria-label":v(`打开玩法文件 {path}`,{path:t}),onClick:()=>i(t),children:[(0,b.jsx)(`strong`,{children:n.title}),(0,b.jsx)(`span`,{children:n.kind}),(0,b.jsx)(`code`,{children:t})]})},t)})})}),(0,b.jsxs)(`section`,{className:`play-preset-file-editor-pane`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:u.kind}),(0,b.jsx)(`h5`,{children:u.title}),(0,b.jsx)(`code`,{children:l})]}),(0,b.jsx)(`p`,{children:u.description})]}),(0,b.jsxs)(`label`,{className:`play-preset-source-editor`,children:[(0,b.jsx)(`span`,{children:v(`完整文件内容`)}),(0,b.jsx)(`textarea`,{"aria-label":v(`编辑玩法文件 {path}`,{path:l}),wrap:`soft`,value:e[l]??``,onChange:e=>o(e.currentTarget.value),spellCheck:!1})]})]})]}),(0,b.jsxs)(`details`,{className:`play-preset-file-create`,children:[(0,b.jsx)(`summary`,{children:v(`新增修复文件`)}),(0,b.jsxs)(`div`,{className:`play-preset-file-add`,children:[(0,b.jsxs)(`label`,{children:[v(`新文件路径(prompt/regex/renderer/script/asset)`),(0,b.jsx)(`input`,{"aria-label":v(`新增玩法文件路径`),placeholder:`renderers/my-panel.html`,value:n,onChange:e=>a(e.currentTarget.value)})]}),(0,b.jsx)(`button`,{type:`button`,disabled:r||n.trim()===``,onClick:s,children:v(`加入文件草稿`)})]})]})]})}function Oa(e,t){let n=t===`zh-CN`;return e===null?n?`未记录`:`Not recorded`:`${e.kind===`world_origin`?n?`世界创建时`:`World creation`:e.kind===`play`&&e.context!==null?n?`上下文 ${e.context} · 第 ${e.round} 回合`:`Context ${e.context} · round ${e.round}`:n?`${e.kind===`correction`?`连续性修订`:`历史提交`} · 玩家输入位置 ${e.round}`:`${e.kind===`correction`?`Continuity correction`:`History commit`} · player input position ${e.round}`} · ${n?`写入时世界时间`:`World time at write`}: ${e.worldTime??(n?`未记录`:`not recorded`)}`}function ka({report:e}){if(e===void 0)return null;let t=_(),n=t===`zh-CN`;return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,children:[e.unavailableReason!==void 0&&(0,b.jsxs)(`p`,{role:`status`,children:[n?`历史维护诊断暂时不可用`:`Historical maintenance diagnostics unavailable`,`: `,e.unavailableReason]}),(0,b.jsx)(`h3`,{children:n?`文档体积与维护`:`Document size and maintenance`}),(0,b.jsx)(`p`,{children:n?`单位为 UTF-8 字节。建议上限只用于整理提示;不会阻止写入或截断历史。注入贡献按实际选取统计,包含选取的标题和标记,不是 token 用量。`:`Values are UTF-8 bytes. Advisory limits never block writes or truncate history. Injection contributions include selected headings and annotations; these are not token usage.`}),(0,b.jsx)(`dl`,{className:`prompt-diagnostic-grid`,children:[[n?`世界材料`:`World materials`,e.worldMaterialsBytes],[n?`其中检查点历史`:`Checkpoint history subset`,e.checkpointHistoryBytes],[n?`作者提示`:`Author instructions`,e.authorInstructionBytes],[n?`Runtime 提示`:`Runtime instructions`,e.runtimeInstructionBytes],[n?`工具定义(逻辑 JSON)`:`Tool definitions (logical JSON)`,e.toolDefinitionBytes]].map(([e,t])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsx)(`dd`,{children:t?.toLocaleString()})]},e))}),Math.max(0,...e.documents.map(e=>e.observedContexts??0))===0&&(0,b.jsx)(`p`,{children:n?`尚无带上下文标记的历史样本;旧提交不会被猜测归入某个上下文。`:`No history samples with recorded context identities yet; legacy commits are not assigned guessed contexts.`}),(0,b.jsx)(`div`,{className:`maintenance-table-scroll`,children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsx)(`tr`,{children:(n?[`文档`,`正文`,`注入贡献`,`建议上限`,`增长基准`,`相对基准变化`,`正文 / 元信息变更上下文数`]:[`Document`,`Body`,`Injection contribution`,`Advisory limit`,`Growth baseline`,`Change from baseline`,`Contexts with body / metadata changes`]).map(e=>(0,b.jsx)(`th`,{children:e},e))})}),(0,b.jsx)(`tbody`,{children:e.documents.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsxs)(`th`,{scope:`row`,children:[e.title,(0,b.jsxs)(`small`,{children:[` @`,e.shortRef]})]}),(0,b.jsx)(`td`,{children:e.bodyBytes.toLocaleString()}),(0,b.jsx)(`td`,{children:e.injectedBytes.toLocaleString()}),(0,b.jsxs)(`td`,{children:[e.advisoryBytes?.toLocaleString()??`—`,e.overAdvisory?n?` · 超出建议`:` · Over advisory`:``]}),(0,b.jsx)(`td`,{children:e.baselineKind===`unavailable`?n?`无世界基准`:`No world baseline`:`${e.baselineKind===`world_origin`?n?`世界创建`:`World creation`:n?`创建后新增`:`Added later`}: ${e.baselineBytes}`}),(0,b.jsxs)(`td`,{children:[e.growthBytes===null?`—`:`${e.growthBytes>=0?`+`:``}${e.growthBytes}`,e.growthRatio===null?``:` (${e.growthRatio.toFixed(2)}×)`]}),(0,b.jsxs)(`td`,{children:[e.bodyChangedContexts,` /`,` `,e.metadataChangedContexts]})]},e.shortRef))})]})}),e.slots.length>0&&(0,b.jsx)(`ul`,{children:e.slots.map(e=>(0,b.jsxs)(`li`,{children:[n?`材料槽`:`Slot`,` `,e.id,`: `,e.bytes.toLocaleString(),` `,`/ `,e.advisoryBytes?.toLocaleString()??`—`,e.overAdvisory?n?` · 超出建议`:` · Over advisory`:``]},e.id))}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:n?`最近已提交的正文和元信息写入`:`Last committed body and metadata writes`}),e.documents.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h4`,{children:[e.title,` · @`,e.shortRef]}),(0,b.jsxs)(`p`,{children:[n?`正文`:`Body`,`:`,` `,Oa(e.lastBodyWrite,t)]}),(0,b.jsxs)(`p`,{children:[n?`元信息`:`Metadata`,`:`,` `,Oa(e.lastMetadataWrite,t)]})]},e.shortRef))]})]})}var Aa={runtime_system:{title:`Runtime 系统`,description:`权威、真实工具与提交边界,由 Runtime 固定提供。`},author_instruction:{title:`创作指令`,description:`当前主持预设、世界专属创作政策与玩法叙事规则。`},world_context:{title:`世界上下文`,description:`真实 slot 展开、材料覆盖和当前世界正文。`},player_input:{title:`玩家原文`,description:`本次预览显式使用的动态玩家输入。`}},ja={chat_completions:`Chat Completions`,openai_responses:`OpenAI Responses`,anthropic_messages:`Anthropic Messages`},Ma={resolved:`已提供`,optional_missing:`可选未证明完整`,paged_catalog:`分页目录`},Na={current_situation:`当前情境`,additional_materials:`附加材料`,catalog:`材料目录`,reference_targets:`引用目标`,history:`最近叙事`};function Pa({client:e,packages:t,initialPackageId:n,playPresets:r,model:i,onPackageSelect:a,playPresetTarget:o,embedded:s=!1}){let c=t.find(({localId:e})=>e===n)??t.find(({status:e})=>e===`usable`)??t[0],[u,d]=(0,l.useState)(c?.localId??``),[f,p]=(0,l.useState)(v(`我观察当前场景。`)),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1),[y,x]=(0,l.useState)(null),S=(0,l.useRef)(0),C=t.find(e=>e.localId===u),w=r?.presets.find(({id:e})=>e===(o?.presetId??r.currentPresetId)),T=w,E=i.connections.find(({id:e})=>e===i.activeConnectionId),D=C?.status===`usable`&&w?.validation.status===`valid`&&E!==void 0&&f.trim().length>0;function O(){S.current+=1,_(!1),h(null),x(null)}async function k(){if(!D||E===void 0)return;let t=S.current+1;S.current=t,_(!0),x(null);try{let n=await e.request({type:`prompt.preview`,packageId:u,playerInput:f.trim(),model:Wa(E),...r===void 0?{}:{playPresetId:o?.presetId??r.currentPresetId,...o===void 0?{}:{playPresetRevision:o.revision}}});if(S.current!==t)return;h(n),x({kind:`status`,text:v(`真实编译已完成;没有调用模型,也没有改变内容或世界。`)})}catch(e){if(S.current!==t)return;h(null),x({kind:`error`,text:Ja(e)})}finally{S.current===t&&_(!1)}}return(0,b.jsxs)(`section`,{className:`prompt-preview-screen${s?` embedded`:``}`,"aria-labelledby":`prompt-preview-title`,children:[(0,b.jsxs)(`header`,{className:`prompt-preview-header`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-title-row`,children:[s?(0,b.jsx)(`h4`,{id:`prompt-preview-title`,children:v(`全新上下文会发送什么`)}):(0,b.jsx)(`h2`,{id:`prompt-preview-title`,children:v(`提示词预览`)}),(0,b.jsxs)(`span`,{className:`prompt-preview-readonly`,"aria-label":v(`预览性质`),title:v(`不会创建对话或写入权威状态`),children:[(0,b.jsx)(`span`,{children:v(`只读检查`)}),(0,b.jsx)(`span`,{children:v(`0 次模型调用`)})]})]}),(0,b.jsx)(`p`,{className:`prompt-preview-lede`,children:v(s?`真实编译,0 次模型调用,不会创建对话或写入权威状态。`:`用真实编译器检查全新上下文会发送什么:逻辑 role、Markdown、材料、工具、预算与 Provider 映射。`)})]}),(0,b.jsxs)(`div`,{className:`prompt-preview-setup`,children:[(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-input-card`,"aria-labelledby":`prompt-preview-input-title`,children:[(0,b.jsx)(`h3`,{id:`prompt-preview-input-title`,className:`visually-hidden`,children:v(`决定这次检查什么`)}),(0,b.jsx)(`p`,{className:`prompt-preview-context`,children:v(`内容包首轮 · 全新上下文`)}),t.length===0?(0,b.jsx)(`p`,{className:`prompt-preview-empty`,role:`status`,children:v(`还没有内容包。先新建并修好一份内容包,才能编译真实提示词。`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{className:`prompt-preview-package-field`,children:[v(`内容包`),(0,b.jsx)(`select`,{"aria-label":v(`预览内容包`),value:u,onChange:e=>{let t=e.currentTarget.value;d(t),a(t),O()},children:t.map(e=>(0,b.jsxs)(`option`,{value:e.localId,children:[e.title,e.status===`usable`?``:v(` · 需要修复`)]},e.localId))})]}),(0,b.jsxs)(`label`,{className:`prompt-preview-player-field`,children:[v(`预览玩家输入`),(0,b.jsx)(`textarea`,{"aria-label":v(`预览玩家输入`),value:f,onChange:e=>{p(e.currentTarget.value),O()}}),(0,b.jsx)(`span`,{className:`field-note`,children:v(`这段原文只进入本次预览,不会写入历史,也不会成为真实玩家行动。`)})]}),C?.status===`needs_repair`?(0,b.jsx)(`p`,{className:`prompt-preview-blocker`,role:`status`,children:v(`这份内容包仍需修复;真实首轮预览要求有效的 opening.md、世界文档和控制框架。`)}):null,(0,b.jsx)(`button`,{disabled:!D||g,onClick:()=>void k(),type:`button`,children:v(g?`正在编译真实预览…`:m===null?`生成真实预览`:`重新生成真实预览`)})]}),y===null?null:(0,b.jsx)(`p`,{role:y.kind===`error`?`alert`:`status`,children:y.text})]}),(0,b.jsxs)(`details`,{className:`preview-bindings-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`当前配置与编译边界`)}),(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-binding-card`,"aria-labelledby":`prompt-preview-binding-title`,children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FIXED BINDING`}),(0,b.jsx)(`h3`,{id:`prompt-preview-binding-title`,children:v(`本次固定绑定`)}),(0,b.jsxs)(`dl`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`主持预设`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:w?.name??v(`没有当前预设`)}),(0,b.jsx)(`span`,{children:v(`工作区当前选择`)})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`模型连接`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:E?.name??v(`没有当前模型`)}),(0,b.jsx)(`span`,{children:E===void 0?v(`请先配置并启用模型`):`${E.modelId} · ${ja[E.provider]}`})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`模型窗口`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:E===void 0?`—`:`${Ga(E.contextWindowTokens)} tokens`}),(0,b.jsx)(`span`,{children:E===void 0?`—`:v(`最大输出 {count}`,{count:Ga(E.maxOutputTokens)})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`开场白边界`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:v(`不作为模型历史注入`)}),(0,b.jsx)(`span`,{children:v(`opening.md 只保留为玩家可见的 genesis 叙事`)})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`玩法预设`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:T?.name??`default`}),(0,b.jsx)(`span`,{children:T===void 0?v(`使用内置玩法的完整工具集合`):`revision ${o?.revision??T.revision}`})]})]})]})]})]})]}),m===null?(0,b.jsx)(`section`,{className:`prompt-preview-waiting`,"aria-label":v(`等待生成预览`),children:(0,b.jsx)(`p`,{children:v(`生成预览后,在这里查看实际发送的消息、材料与工具。`)})}):(0,b.jsx)(Fa,{preview:m,packageName:C?.title??u,hostName:w?.name??v(`未知预设`),modelName:E?.name??m.diagnosticBinding.modelId})]})}function Fa({preview:e,packageName:t,hostName:n,modelName:r}){let[i,a]=(0,l.useState)(`messages`),{compilation:o}=e,s=o.budget.estimator===`disabled`||o.budget.status===`not_checked`,c=Math.min(100,Math.round(o.budget.requiredTokens/o.budget.contextWindowTokens*100));return(0,b.jsxs)(`div`,{className:`prompt-preview-result`,children:[(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-overview`,"aria-labelledby":`prompt-preview-result-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-result-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`COMPILED REQUEST`}),(0,b.jsx)(`h3`,{id:`prompt-preview-result-title`,children:v(`编译通过`)}),(0,b.jsxs)(`p`,{children:[t,` · `,n,` · `,r]})]}),(0,b.jsxs)(`div`,{className:`prompt-preview-pass-badges`,"aria-label":v(`编译检查结果`),children:[(0,b.jsx)(`span`,{children:v(s?`Runtime 不预估上下文`:`预算可容纳`)}),(0,b.jsx)(`span`,{children:v(`内部字段无泄漏`)}),(0,b.jsx)(`span`,{children:v(`权威状态未改变`)})]})]}),(0,b.jsxs)(`dl`,{className:`prompt-preview-summary`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`逻辑消息`)}),(0,b.jsx)(`dd`,{children:o.logicalMessages.length}),(0,b.jsxs)(`small`,{children:[v(`稳定 bootstrap`),e.initialAppend===void 0?``:v(`;另有 1 条玩家追加`)]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`真实工具`)}),(0,b.jsx)(`dd`,{children:o.tools.length}),(0,b.jsx)(`small`,{children:v(`生产调用链全集`)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(s?`上下文检查`:`所需上下文`)}),(0,b.jsx)(`dd`,{children:s?v(`由 Provider 判断`):Ga(o.budget.requiredTokens)}),(0,b.jsx)(`small`,{children:s?v(`Runtime 不据此拦截请求`):`/ ${Ga(o.budget.contextWindowTokens)} tokens`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(s?`窗口配置`:`窗口占用`)}),(0,b.jsx)(`dd`,{children:s?Ga(o.budget.contextWindowTokens):`${c}%`}),s?(0,b.jsx)(`small`,{children:`tokens · Provider binding`}):(0,b.jsx)(`progress`,{"aria-label":v(`上下文窗口占用`),max:o.budget.contextWindowTokens,value:o.budget.requiredTokens})]})]})]}),(0,b.jsxs)(`nav`,{className:`prompt-preview-nav`,"aria-label":v(`预览结果分区`),children:[(0,b.jsx)(Ra,{active:i===`messages`,count:o.logicalMessages.length,label:v(`逻辑消息`),onClick:()=>a(`messages`)}),e.playPreset===void 0?null:(0,b.jsx)(Ra,{active:i===`callChain`,count:e.playPreset.toolUniverse.length,label:v(`玩法绑定`),onClick:()=>a(`callChain`)}),(0,b.jsx)(Ra,{active:i===`materials`,count:o.coverage.length+o.tools.length,label:v(`材料与工具`),onClick:()=>a(`materials`)}),(0,b.jsx)(Ra,{active:i===`provider`,count:o.provider.messages.length+(e.initialAppend===void 0?0:1),label:v(`Provider 映射`),onClick:()=>a(`provider`)}),(0,b.jsx)(Ra,{active:i===`diagnostics`,count:4,label:v(`预算与诊断`),onClick:()=>a(`diagnostics`)})]}),i===`messages`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(za,{messages:o.logicalMessages}),e.initialAppend===void 0?null:(0,b.jsx)(Ia,{append:e.initialAppend})]}):null,i===`callChain`&&e.playPreset!==void 0?(0,b.jsx)(La,{callChain:e.playPreset}):null,i===`materials`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ka,{report:o.maintenance}),(0,b.jsx)(Ba,{coverage:o.coverage,tools:o.tools})]}):null,i===`provider`?(0,b.jsx)(Va,{provider:o.provider,initialAppend:e.initialAppend,wireRequest:e.wireRequest}):null,i===`diagnostics`?(0,b.jsx)(Ua,{preview:e}):null]})}function Ia({append:e}){return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`initial-player-append-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FIRST DYNAMIC APPEND`}),(0,b.jsx)(`h3`,{id:`initial-player-append-title`,children:v(`首条玩家追加`)})]}),(0,b.jsx)(`p`,{children:v(`稳定 bootstrap 之后,玩家原文作为普通 user 消息原样追加。`)})]}),(0,b.jsx)(`div`,{className:`provider-message-list`,children:(0,b.jsxs)(`ol`,{children:[e.beforePlayer===void 0?null:(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:v(`玩家输入前的回合提示`)}),(0,b.jsx)(`span`,{children:e.beforePlayer.provider.role})]}),(0,b.jsx)(`pre`,{children:e.beforePlayer.provider.content})]}),(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:e.logical.kind}),(0,b.jsx)(`strong`,{children:e.provider.role})]}),(0,b.jsx)(`pre`,{children:e.provider.content})]})]})})]})}function La({callChain:e}){return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`play-preset-call-chain-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`PLAY PRESET · FROZEN REVISION`}),(0,b.jsx)(`h3`,{id:`play-preset-call-chain-title`,children:v(`玩法绑定与调用链工具`)})]}),(0,b.jsxs)(`p`,{children:[e.name,` · `,e.revision,` `,v(`· 叙事规则进入稳定 bootstrap, 后置请求在主调用链完成后独立派发。`)]})]}),(0,b.jsxs)(`dl`,{className:`prompt-binding-details`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`玩法文件`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`code`,{children:e.callChainPath}),(0,b.jsx)(`span`,{children:v(`冻结工具、叙事规则与后置产物契约`)})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`工具全集`)}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:e.toolUniverse.map(({name:e})=>e).join(` / `)})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`Provider 工具策略`)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`code`,{children:e.toolStrategy??`runtime_gate`}),(0,b.jsx)(`span`,{children:v(`definitions:稳定全集`)})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`稳定前缀`)}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:e.cache.stablePrefixFingerprint})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`频道挂载`)}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:e.mounts.length===0?v(`无`):e.mounts.map(({channel:e,mount:t})=>`${e} → ${t}`).join(` · `)})})]})]}),(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{children:v(`稳定 bootstrap`)}),(0,b.jsx)(`p`,{children:v(`全新上下文发送这份稳定前缀;玩家原文随后作为普通消息追加。Runtime 不再插入裁决、叙事或结算 delta。`)})]}),(0,b.jsxs)(`span`,{children:[e.bootstrap.logicalMessages.length,` `,v(`条逻辑消息`)]})]}),(0,b.jsxs)(`p`,{className:`prompt-preview-cache-line`,children:[`fingerprint:`,(0,b.jsx)(`code`,{children:e.bootstrap.cache.stablePrefixFingerprint})]}),(0,b.jsxs)(`p`,{className:`prompt-preview-cache-line`,children:[v(`调用链可用工具:`),(0,b.jsx)(`strong`,{children:e.toolUniverse.length}),` `,v(`· 后置请求:`),(0,b.jsx)(`strong`,{children:e.followups.length})]})]})}function Ra({active:e,count:t,label:n,onClick:r}){return(0,b.jsxs)(`button`,{"aria-pressed":e,className:e?`active`:``,onClick:r,type:`button`,children:[(0,b.jsx)(`span`,{children:n}),(0,b.jsx)(`small`,{children:t})]})}function za({messages:e}){let[t,n]=(0,l.useState)(0),r=e[t]??e[0];return r===void 0?(0,b.jsx)(`p`,{className:`prompt-preview-empty`,children:v(`这次编译没有逻辑消息。`)}):(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`logical-messages-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`PROVIDER-NEUTRAL`}),(0,b.jsx)(`h3`,{id:`logical-messages-title`,children:v(`逻辑消息与最终 Markdown`)})]}),(0,b.jsx)(`p`,{children:v(`这里先保留产品逻辑 role;Provider 如何映射在下一分区单独展示。`)})]}),(0,b.jsxs)(`div`,{className:`prompt-message-layout`,children:[(0,b.jsx)(`ol`,{className:`prompt-message-index`,"aria-label":v(`逻辑消息顺序`),children:e.map((e,t)=>{let i=Aa[e.role];return(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{"aria-label":v(`打开第 {index} 条逻辑消息:{title}`,{index:t+1,title:v(i.title)}),"aria-pressed":e===r,onClick:()=>n(t),type:`button`,children:[(0,b.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:v(i.title)}),(0,b.jsx)(`code`,{children:e.role})]}),(0,b.jsxs)(`small`,{children:[e.blocks.length,` `,v(`块`)]})]})},`${t}:${e.role}`)})}),(0,b.jsxs)(`article`,{className:`prompt-message-reader`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:r.role}),(0,b.jsx)(`h4`,{children:v(Aa[r.role].title)}),(0,b.jsx)(`p`,{children:v(Aa[r.role].description)})]}),(0,b.jsxs)(`span`,{children:[Ga(r.markdown.length),` `,v(`字符`)]})]}),(0,b.jsx)(`div`,{className:`prompt-message-sources`,"aria-label":v(`消息块来源`),children:r.blocks.map((e,t)=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`span`,{children:[v(`块`),String(t+1).padStart(2,`0`)]}),(0,b.jsx)(`code`,{children:e.source}),(0,b.jsxs)(`small`,{children:[Ga(e.markdown.length),` `,v(`字符`)]})]},`${e.source}:${t}`))}),(0,b.jsxs)(`div`,{className:`prompt-message-body`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`最终 Markdown 正文`)}),(0,b.jsx)(`span`,{children:v(`块之间已按真实编译顺序合并`)})]}),(0,b.jsx)(`pre`,{children:r.markdown})]})]})]})]})}function Ba({coverage:e,tools:t}){let n=t.filter(({name:e})=>e.startsWith(`context_`));return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`materials-tools-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`SOURCES & CAPABILITIES`}),(0,b.jsx)(`h3`,{id:`materials-tools-title`,children:v(`材料覆盖与调用链工具`)})]}),(0,b.jsx)(`p`,{children:v(`来源由真实 slot 展开;未提供边界和可继续读取入口不会被隐藏。`)})]}),(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{children:v(`Slot 覆盖`)}),(0,b.jsxs)(`span`,{children:[e.length,` `,v(`项`)]})]}),(0,b.jsx)(`ol`,{className:`prompt-coverage-list`,children:e.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{className:`coverage-status coverage-${e.status}`,children:v(Ma[e.status])}),(0,b.jsx)(`strong`,{children:v(Na[e.slot]??e.slot)}),(0,b.jsx)(`code`,{children:e.slot})]}),(0,b.jsx)(`p`,{children:e.source}),(0,b.jsxs)(`footer`,{children:[(0,b.jsx)(`span`,{children:e.complete?v(`来源完整`):v(`来源尚未完整`)}),(0,b.jsx)(`span`,{children:e.continuation===null?v(`无需继续读取`):v(`可继续:{continuation}`,{continuation:e.continuation})})]})]},`${e.slot}:${e.source}:${t}`))}),(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading prompt-tools-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{children:v(`本次真实工具`)}),(0,b.jsx)(`p`,{children:n.length>0?v(`按需读取入口:{tools}`,{tools:n.map(({name:e})=>e).join(` / `)}):v(`本次没有按需读取工具。`)})]}),(0,b.jsxs)(`span`,{children:[t.length,` `,v(`个`)]})]}),(0,b.jsx)(`ol`,{className:`prompt-tool-list`,children:t.map((e,t)=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`details`,{children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,b.jsx)(`code`,{children:e.name}),(0,b.jsx)(`small`,{children:v(`查看说明与 input schema`)})]}),(0,b.jsx)(`p`,{children:e.description}),(0,b.jsx)(`pre`,{children:JSON.stringify(e.inputSchema,null,2)})]})},e.name))})]})}function Va({provider:e,initialAppend:t,wireRequest:n}){return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`provider-mapping-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FINAL ROLE MAPPING`}),(0,b.jsx)(`h3`,{id:`provider-mapping-title`,children:v(`Provider 映射 · {provider}`,{provider:ja[e.protocol]})})]}),(0,b.jsx)(`p`,{children:v(`展示编译器交给当前 Adapter 的真实 system 块和消息顺序。`)})]}),e.system===void 0?null:(0,b.jsxs)(`div`,{className:`provider-system-blocks`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{children:`System blocks`}),(0,b.jsxs)(`span`,{children:[e.system.length,` `,v(`块`)]})]}),(0,b.jsx)(`ol`,{children:e.system.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`span`,{children:[`system · `,String(t+1).padStart(2,`0`)]}),e.cache_control===void 0?null:(0,b.jsxs)(`small`,{children:[`cache_control: `,e.cache_control.type]})]}),(0,b.jsx)(`pre`,{children:e.text})]},t))})]}),(0,b.jsxs)(`div`,{className:`provider-message-list`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{children:v(`消息角色与顺序`)}),(0,b.jsxs)(`span`,{children:[e.messages.length,` `,v(`条 bootstrap`),t===void 0?``:v(` + 1 条玩家追加`),t?.beforePlayer===void 0?``:v(` + 1 条回合提示`)]})]}),(0,b.jsx)(`ol`,{children:e.messages.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,b.jsx)(`strong`,{children:e.role})]}),(0,b.jsx)(Ha,{content:e.content})]},t))}),t?.beforePlayer===void 0?null:(0,b.jsxs)(`div`,{className:`provider-message`,children:[(0,b.jsx)(`strong`,{children:v(`玩家输入前的回合提示`)}),(0,b.jsx)(Ha,{content:t.beforePlayer.provider.content})]}),t===void 0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{children:v(`紧随 bootstrap 的首条追加`)}),(0,b.jsx)(`span`,{children:v(`原样发送`)})]}),(0,b.jsx)(`ol`,{children:(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:`append`}),(0,b.jsx)(`strong`,{children:t.provider.role})]}),(0,b.jsx)(Ha,{content:t.provider.content})]})})]})]}),(0,b.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看 Provider 映射原始结构`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]}),n===void 0?null:(0,b.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看实际 HTTP 请求(凭据已省略)`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(n,null,2)})]})]})}function Ha({content:e}){return typeof e==`string`?(0,b.jsx)(`pre`,{children:e}):Array.isArray(e)?(0,b.jsx)(`ol`,{className:`provider-content-blocks`,children:e.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`span`,{children:[`content block · `,String(t+1).padStart(2,`0`)]}),(0,b.jsx)(`code`,{children:qa(e)})]}),(0,b.jsx)(`pre`,{children:Ka(e)?e.text:JSON.stringify(e,null,2)})]},t))}):(0,b.jsx)(`pre`,{children:JSON.stringify(e,null,2)})}function Ua({preview:e}){let{budget:t,cache:n}=e.compilation,r=t.estimator===`disabled`||t.status===`not_checked`,i=[[v(`消息正文`),t.messageTokens],[v(`工具定义`),t.toolTokens],[v(`本地输出预留`),t.outputReserveTokens],[v(`本地尾部预留`),t.forcedTailReserveTokens],[v(`安全余量`),t.safetyMarginTokens]];return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`budget-diagnostics-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`prompt-preview-kicker`,children:`BUDGET, CACHE & LEAKAGE`}),(0,b.jsx)(`h3`,{id:`budget-diagnostics-title`,children:v(`预算与诊断`)})]}),(0,b.jsx)(`p`,{children:v(r?`Runtime 不估算上下文,也不会据此拒绝 Provider 请求。`:`所有数值来自本次真实编译结果,不由 Web 重新估算。`)})]}),(0,b.jsxs)(`div`,{className:`prompt-diagnostics-grid`,children:[(0,b.jsxs)(`section`,{"aria-labelledby":`prompt-budget-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{id:`prompt-budget-title`,children:v(`上下文预算`)}),(0,b.jsx)(`span`,{children:r?v(`由 Provider 判断`):t.status===`fits`?v(`可容纳`):t.status})]}),r?(0,b.jsx)(`dl`,{className:`prompt-budget-breakdown`,children:(0,b.jsxs)(`div`,{className:`prompt-budget-total`,children:[(0,b.jsx)(`dt`,{children:v(`Provider 窗口配置`)}),(0,b.jsxs)(`dd`,{children:[Ga(t.contextWindowTokens),` tokens`]})]})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`dl`,{className:`prompt-budget-breakdown`,children:[i.map(([e,t])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsxs)(`dd`,{children:[Ga(t),` tokens`]})]},e)),(0,b.jsxs)(`div`,{className:`prompt-budget-total`,children:[(0,b.jsx)(`dt`,{children:v(`合计 / 模型窗口`)}),(0,b.jsxs)(`dd`,{children:[Ga(t.requiredTokens),` /`,` `,Ga(t.contextWindowTokens),` tokens`]})]})]}),(0,b.jsxs)(`p`,{className:`field-note`,children:[v(`估算器:`),t.estimator]})]})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`prompt-cache-title`,children:[(0,b.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,b.jsx)(`h4`,{id:`prompt-cache-title`,children:v(`稳定前缀与缓存`)}),(0,b.jsxs)(`span`,{children:[Ga(n.estimatedCacheableBytes),` `,v(`字节`)]})]}),(0,b.jsxs)(`dl`,{className:`prompt-cache-report`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`稳定前缀 fingerprint`)}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:n.stablePrefixFingerprint})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`缓存策略`)}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:n.strategy})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`缓存断点`)}),(0,b.jsx)(`dd`,{className:`prompt-cache-breakpoints`,children:n.breakpoints.length===0?v(`由 Provider 管理,无显式断点`):n.breakpoints.map(e=>(0,b.jsx)(`code`,{children:e},e))})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`首个动态边界`)}),(0,b.jsx)(`dd`,{children:Ga(n.firstDynamicByte)})]})]})]})]}),(0,b.jsxs)(`section`,{className:`prompt-leakage-report`,"aria-labelledby":`prompt-leakage-title`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`✓`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{id:`prompt-leakage-title`,children:v(`内部字段泄漏扫描通过`)}),(0,b.jsx)(`p`,{children:v(`Runtime 生成正文未发现以下内部字段。`)})]})]}),(0,b.jsx)(`div`,{className:`prompt-leakage-fields`,children:e.leakage.checkedFields.map(e=>(0,b.jsx)(`code`,{children:e},e))})]}),(0,b.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看固定诊断绑定与完整原始结果`)}),(0,b.jsx)(`dl`,{className:`prompt-binding-details`,children:Object.entries(e.diagnosticBinding).map(([e,t])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(`code`,{children:t})})]},e))}),(0,b.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]})]})}function Wa(e){return{provider:e.provider,modelId:e.modelId,contextWindowTokens:e.contextWindowTokens,maxOutputTokens:e.maxOutputTokens}}function Ga(e){return new Intl.NumberFormat(_()).format(e)}function Ka(e){return typeof e==`object`&&!!e&&`text`in e&&typeof e.text==`string`}function qa(e){return typeof e==`object`&&e&&`type`in e&&typeof e.type==`string`?e.type:`raw`}function Ja(e){return e instanceof Error?e.message:v(`真实提示词编译失败`)}function Ya({requests:e,onPreview:t}){let n=_()===`zh-CN`,[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``);return(0,b.jsxs)(`section`,{className:`authoring-prompt-preview`,children:[t&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>{o(!0),c(``),i(null),t().then(i).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},children:n?`预览下一条请求`:`Preview next send`}),(0,b.jsxs)(`details`,{className:`authoring-preview-help`,children:[(0,b.jsx)(`summary`,{children:n?`预览说明`:`About this preview`}),(0,b.jsx)(`p`,{children:n?`候选预览读取当前已应用预设,不发送消息、不创建修订锁;发送时重新读取。`:`Candidate preview reads the currently applied preset without sending a message or opening a revision lock. Sending reads it again.`})]})]}),s&&(0,b.jsx)(`p`,{role:`alert`,children:s}),r&&(0,b.jsxs)(`details`,{open:!0,children:[(0,b.jsx)(`summary`,{children:n?`下一次发送候选(未发送)`:`Next-send candidate (not sent)`}),(0,b.jsx)(Xa,{compilation:r})]}),e.length>0&&(0,b.jsxs)(`details`,{className:`setting-request-previews`,children:[(0,b.jsx)(`summary`,{children:n?`已发送请求的真实提示`:`Actual sent prompts`}),(0,b.jsx)(`p`,{children:n?`以下保留每次发送时的实际编排,不是下一次发送预览。`:`These retain each send's actual arrangement, not the next-send candidate.`}),e.map((e,t)=>(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:e.legacyBootstrap?n?`旧会话原始提示`:`Original legacy conversation prompt`:n?`发送请求 ${t+1}`:`Sent request ${t+1}`}),(0,b.jsx)(Xa,{compilation:e.compilation})]},`${e.legacyBootstrap?`legacy:`:``}${e.requestId}`))]})]})}function Xa({compilation:e}){let t=_()===`zh-CN`;return(0,b.jsxs)(b.Fragment,{children:[e.logicalMessages.map((e,t)=>(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`h4`,{children:e.role}),(0,b.jsx)(`pre`,{children:e.markdown})]},t)),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:t?`Provider 编码与工具定义`:`Provider encoding and tools`}),(0,b.jsx)(`pre`,{children:JSON.stringify({provider:e.provider,tools:e.tools},null,2)})]})]})}function Za(e,t){let n=(0,l.useRef)(!1),r=async()=>{if(!(!e||n.current)){n.current=!0;try{await t()}finally{n.current=!1}}};return{submit:r,onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.keyCode===229||(e.preventDefault(),e.repeat||r())}}}function Qa({definitions:e,items:t,onItemsChange:n,onClone:r,renderUser:i}){let a=t??Te(e),[o,s]=(0,l.useState)(),c=a.find(e=>e.id===o)??a.find(e=>e.kind===`user`)??a[0],u=Ee(_());function d(t){return t.kind===`builtin`?u.definition.displayName:t.kind===`content-package`?v(`内容包后置请求`):e.find(e=>e.id===t.id)?.displayName??t.id}function f(e,t){let r=a.findIndex(t=>t.id===e);if(r<0||t<0||t>=a.length)return;let i=[...a];i.splice(t,0,...i.splice(r,1)),n(i)}return(0,b.jsxs)(`div`,{className:`followup-workbench`,children:[(0,b.jsx)(`ol`,{"aria-label":v(`后置请求`),className:`followup-order`,children:a.map((e,t)=>(0,b.jsxs)(`li`,{className:e.kind===`user`?`play-preset-followup-card`:`followup-reference`,draggable:!0,onDragStart:t=>t.dataTransfer.setData(`application/x-narraeon-followup`,e.id),onDragOver:e=>{e.dataTransfer.types.includes(`application/x-narraeon-followup`)&&e.preventDefault()},onDrop:e=>{let n=e.dataTransfer.getData(`application/x-narraeon-followup`);n&&(e.preventDefault(),f(n,t))},children:[(0,b.jsx)(`button`,{type:`button`,"aria-pressed":e.id===c?.id,onClick:()=>s(e.id),onKeyDown:n=>{n.altKey&&[`ArrowUp`,`ArrowDown`].includes(n.key)&&(n.preventDefault(),f(e.id,t+(n.key===`ArrowUp`?-1:1)))},children:d(e)}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,"aria-label":`${v(`启用`)} ${d(e)}`,checked:e.enabled,onChange:t=>n(a.map(n=>n.id===e.id?{...n,enabled:t.currentTarget.checked}:n))}),v(`启用`)]}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`${v(`上移`)} ${d(e)}`,disabled:t===0,onClick:()=>f(e.id,t-1),children:`↑`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`${v(`下移`)} ${d(e)}`,disabled:t===a.length-1,onClick:()=>f(e.id,t+1),children:`↓`})]},e.id))}),(0,b.jsx)(`div`,{className:`followup-details`,children:c?.kind===`user`?e.map((e,t)=>e.id===c.id?(0,b.jsx)(`div`,{children:i(e,t)},e.id):null):c?.kind===`builtin`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h4`,{children:u.definition.displayName}),(0,b.jsx)(`p`,{children:v(`系统示例只读;新运行使用应用最新版,克隆后独立保存。`)}),(0,b.jsx)(`textarea`,{"aria-label":v(`系统后置提示词`),readOnly:!0,value:u.body,rows:8}),(0,b.jsx)(`p`,{children:v(`界面产物:场景回顾,Markdown,剧情内容区;保存到提交,替换上一份,显式清除。`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(u.definition,u.body),children:v(`克隆后置请求`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h4`,{children:v(`内容包后置请求`)}),(0,b.jsx)(`p`,{children:v(`在此位置展开当前世界的内容包后置请求。无声明时为空组,不调用模型;正文由内容包管理。`)})]})})]})}function $a({files:e,renderer:t,scripts:n,assets:r,onWrite:i,onAttach:a}){let o=[{kind:`renderer`,label:`HTML 模板`,paths:t?[t]:[],directory:`renderers`,suffix:`html`,initial:`<main><!-- narraeon:content --></main>`},{kind:`scripts`,label:`JavaScript`,paths:n??[],directory:`scripts`,suffix:`js`,initial:`// Render the artifact using the extension bridge.
1183
+ `},{kind:`assets`,label:`样式与资源`,paths:r??[],directory:`assets`,suffix:`css`,initial:`body { font-family: sans-serif; }
1184
+ `}];return(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:v(`编辑渲染资源`)}),o.map(t=>(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h6`,{children:v(t.label)}),t.kind===`scripts`?(0,b.jsx)(`p`,{children:v(`JavaScript 仅在 app 模式且已允许脚本时运行。`)}):null,t.paths.map((n,r)=>(0,b.jsxs)(`label`,{children:[v(t.label),` `,r+1,(0,b.jsx)(`textarea`,{"aria-label":`${v(t.label)} ${r+1}`,rows:6,value:e[n]??``,onChange:e=>i(n,e.currentTarget.value)})]},n)),(t.kind!==`renderer`||t.paths.length===0)&&(0,b.jsxs)(`button`,{type:`button`,onClick:()=>a(t.kind,`${t.directory}/followup-${crypto.randomUUID()}.${t.suffix}`,t.initial),children:[v(`添加`),` `,v(t.label)]})]},t.kind))]})}var eo=`control/followups.yaml`;function to({files:e,onChange:t}){let[n,r]=(0,l.useState)(!1),i=ro(e),a=Object.fromEntries(e.filter(e=>e.path.startsWith(`control/`)&&e.encoding===void 0).map(e=>[e.path.slice(8),e.contents]));function o(n,r={}){let i={...Object.fromEntries(Object.entries(r).map(([e,t])=>[`control/${e}`,t])),[eo]:mi({format:`narraeon.package-followups/v1`,followups:n.map(({prompt:e,...t})=>({...t,prompt:{role:e.role,markdown:e.path}}))},{aliasDuplicateObjects:!1})};t([...e.filter(e=>!(e.path in i)),...Object.entries(i).map(([e,t])=>({path:e,contents:t}))])}function s(e,t,n={}){i.kind===`valid`&&o(i.requests.map(n=>n.id===e?t(n):n),n)}return(0,b.jsxs)(`section`,{className:`package-followups-editor`,children:[(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,"aria-expanded":n,onClick:()=>r(!n),children:v(`内容包后置请求`)}),n?i.kind===`invalid`?(0,b.jsx)(`p`,{role:`alert`,children:v(`后置声明无法编辑,请在文件编辑中修复后重试。`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:v(`主剧情完成后按此顺序生成额外内容。关闭保留提示和资源;创建世界后独立保存,后续修改需通过世界修订应用。`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=`followup_${crypto.randomUUID().replaceAll(`-`,``)}`,t=`prompts/${e}.md`;o([...i.requests,{id:e,displayName:v(`新后置请求`),enabled:!0,mount:`story`,prompt:{role:`author_instruction`,path:t},artifacts:[no(`output_1`,`${e}.output_1`)],maxArtifactBytes:32768}],{[t]:v(`根据已完成的剧情,通过 artifact_emit 输出 output_1。`)})},children:v(`新增包后置请求`)}),(0,b.jsx)(Qa,{definitions:i.requests,items:i.requests.map(e=>({id:e.id,kind:`user`,enabled:e.enabled})),onItemsChange:e=>o(e.map(e=>({...i.requests.find(t=>t.id===e.id),enabled:e.enabled}))),onClone:()=>void 0,renderUser:e=>{let t=i.requests.find(t=>t.id===e.id);return(0,b.jsxs)(`article`,{className:`play-preset-followup-card`,children:[(0,b.jsxs)(`label`,{children:[v(`包请求名称`),(0,b.jsx)(`input`,{value:t.displayName,onChange:e=>s(t.id,t=>({...t,displayName:e.target.value}))})]}),(0,b.jsxs)(`label`,{children:[v(`包请求提示词`),(0,b.jsx)(`textarea`,{rows:6,value:a[t.prompt.path]??``,onChange:e=>s(t.id,e=>e,{[t.prompt.path]:e.target.value})})]}),(0,b.jsxs)(`label`,{children:[v(`包请求显示位置`),(0,b.jsxs)(`select`,{value:t.mount,onChange:e=>s(t.id,t=>({...t,mount:e.target.value})),children:[(0,b.jsx)(`option`,{value:`story`,children:v(`故事正文`)}),(0,b.jsx)(`option`,{value:`sidebar`,children:v(`侧栏`)}),(0,b.jsx)(`option`,{value:`composer_above`,children:v(`输入框上方`)}),(0,b.jsx)(`option`,{value:`composer_below`,children:v(`输入框下方`)}),(0,b.jsx)(`option`,{value:`overlay`,children:v(`浮层`)}),(0,b.jsx)(`option`,{value:`debug`,children:v(`调试区`)})]})]}),t.artifacts.map((e,n)=>(0,b.jsxs)(`section`,{children:[(0,b.jsx)(Ta,{artifact:e,files:a,mount:t.mount,onChange:e=>s(t.id,t=>({...t,artifacts:t.artifacts.map((t,r)=>r===n?e(t):t)})),onRemove:()=>s(t.id,e=>({...e,artifacts:e.artifacts.filter((e,t)=>t!==n)}))}),(0,b.jsx)($a,{files:a,renderer:e.renderer,scripts:e.scripts,assets:e.assets,onWrite:(e,n)=>s(t.id,e=>e,{[e]:n}),onAttach:(e,r,i)=>s(t.id,t=>({...t,artifacts:t.artifacts.map((t,i)=>i===n?{...t,...e===`renderer`?{renderer:r,rendererRevision:`v1`}:{[e]:[...t[e]??[],r]}}:t)}),{[r]:i})})]},n)),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{let e=t.artifacts.length+1;for(;t.artifacts.some(t=>t.name===`output_${e}`);)e++;let n=`output_${e}`;s(t.id,e=>({...e,artifacts:[...e.artifacts,no(n,`${e.id}.${n}`)]}))},children:v(`新增产物`)}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:v(`高级请求设置`)}),(0,b.jsxs)(`label`,{children:[v(`稳定请求身份`),(0,b.jsx)(`input`,{readOnly:!0,value:t.id})]}),(0,b.jsxs)(`label`,{children:[v(`产物字节上限`),(0,b.jsx)(`input`,{type:`number`,min:1,value:t.maxArtifactBytes,onChange:e=>s(t.id,t=>({...t,maxArtifactBytes:Number(e.target.value)}))})]})]}),(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:()=>o(i.requests.filter(e=>e.id!==t.id)),children:v(`删除请求`)})]})}})]}):null]})}function no(e,t){return{name:e,channel:t,strategy:`replace`,contentType:`text/markdown`,rendererMode:`document`,save:`commit`,invalidation:`explicit_clear`,required:!1,maxEmits:1}}function ro(e){let t=e.find(e=>e.path===eo);if(t===void 0)return{kind:`valid`,requests:[]};try{if(t.encoding!==void 0)throw Error(`Binary declaration`);let e=fi(t.contents,{uniqueKeys:!0});if(e.errors.length)throw Error(`Invalid YAML`);let n=e.toJS({maxAliasCount:0});if(!io(n)||n.format!==`narraeon.package-followups/v1`||!Array.isArray(n.followups)||Object.keys(n).some(e=>![`format`,`followups`].includes(e)))throw Error(`Invalid declaration`);let r=n.followups.map(e=>{if(!io(e)||typeof e.id!=`string`||typeof e.displayName!=`string`||typeof e.enabled!=`boolean`||typeof e.mount!=`string`||![`story`,`sidebar`,`composer_above`,`composer_below`,`overlay`,`debug`].includes(e.mount)||!io(e.prompt)||typeof e.prompt.markdown!=`string`||typeof e.prompt.role!=`string`||Object.keys(e.prompt).some(e=>![`role`,`markdown`].includes(e))||e.maxArtifactBytes!==void 0&&(typeof e.maxArtifactBytes!=`number`||!Number.isSafeInteger(e.maxArtifactBytes))||!Array.isArray(e.artifacts))throw Error(`Invalid request`);let t=e.artifacts.map(e=>{if(!io(e)||typeof e.name!=`string`||typeof e.channel!=`string`||typeof e.strategy!=`string`||[`renderer`,`rendererRevision`,`regex`,`key`,`contentType`,`save`,`invalidation`,`rendererMode`].some(t=>e[t]!==void 0&&typeof e[t]!=`string`)||e.required!==void 0&&typeof e.required!=`boolean`||e.maxEmits!==void 0&&typeof e.maxEmits!=`number`||[`scripts`,`assets`].some(t=>e[t]!==void 0&&(!Array.isArray(e[t])||!e[t].every(e=>typeof e==`string`))))throw Error(`Invalid artifact`);let t=e.save??`operation`;return{contentType:`text/plain`,rendererMode:`document`,save:t,invalidation:t===`commit`?`head_change`:t===`operation`?`operation_end`:`explicit_clear`,required:!1,maxEmits:1,...e}});return{...e,id:e.id,displayName:e.displayName,enabled:e.enabled,mount:e.mount,prompt:{role:e.prompt.role,path:e.prompt.markdown},artifacts:t,maxArtifactBytes:typeof e.maxArtifactBytes==`number`?e.maxArtifactBytes:32768}});if(new Set(r.map(e=>e.id)).size!==r.length)throw Error(`Duplicate identity`);return{kind:`valid`,requests:r}}catch{return{kind:`invalid`}}}function io(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var J=`narraeon.world-frame/v1`;function Y(e){return`@${e.ref}`}function ao(e,t){return t.startsWith(`@`)?e.find(({ref:e})=>e===t.slice(1)):e.find(({id:e})=>e===t)}function oo(e,t){let n=e=>{if(typeof e!=`string`||e.length===0)return;let n=ao(t,e);return n===void 0?void 0:Y(n)};if(Bo(e.bindings)){let t=n(e.bindings.currentSituation);t!==void 0&&(e.bindings.currentSituation=t)}if(Array.isArray(e.context))for(let t of e.context){if(!Bo(t)||!Bo(t.slot))continue;let e=n(t.slot.document);if(e!==void 0&&(t.slot.document=e),!Bo(t.slot.from))continue;let r=n(t.slot.from.document);r!==void 0&&(t.slot.from.document=r)}}var so=[{kind:`document`,label:`整份文档`,detail:`始终提供一份指定世界文档。`},{kind:`node`,label:`文档局部节点`,detail:`只提供一份 YAML 路径或 Markdown 标题下的内容。`},{kind:`reference_targets`,label:`显式引用目标`,detail:`从一个 YAML 节点读取 $ref,并提供一层目标文档。`},{kind:`catalog`,label:`有界目录`,detail:`提供指定一级目录的标题、简介和短引用目录。`},{kind:`history`,label:`最近叙事`,detail:`带上最近几条已提交叙事,让全新上下文读得到此前写出的细节。`}];function co({contents:e,files:t,dirty:n,onChange:r,onSave:i}){let a=(0,l.useMemo)(()=>vo(e),[e]),o=(0,l.useMemo)(()=>xo(t),[t]),s=(0,l.useMemo)(()=>So(t),[t]),c=(0,l.useMemo)(()=>Co(o),[o]),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(`document`),m=a.value,h=m===null?null:yo(m),g=m===null?null:bo(m),_=m!==null&&Bo(m.bindings)?zo(m.bindings.currentSituation):``,y=ao(o,_),x=s.filter(({path:e})=>!h?.some(t=>t.markdown===e)),S=x.some(({path:e})=>e===u)?u:x[0]?.path??``,C=Fo(g,`current_situation`),w=Fo(g,`additional_materials`),T=m!==null&&h!==null&&g!==null,E=Mo(f,o,c),D=e=>{if(m===null)return;let t=structuredClone(m);e(t),oo(t,o),r(mi(t,{lineWidth:0}))},O=e=>{D(t=>{t.instructions=e})},k=e=>{D(t=>{t.context=e})},ee=e=>{if(g===null)return;let t={slot:{kind:e}};k(e===`current_situation`?[t,...g]:[...g,t])};return(0,b.jsxs)(`section`,{className:`world-frame-editor`,"aria-labelledby":`world-frame-editor-title`,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase(`en-US`)===`s`&&(e.preventDefault(),n&&i())},children:[(0,b.jsxs)(`header`,{className:`world-frame-editor-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`content-editor-kicker`,children:v(`可视化编排`)}),(0,b.jsx)(`h5`,{id:`world-frame-editor-title`,children:v(`世界提示框架`)}),(0,b.jsx)(`p`,{children:v(`安排世界专属指令与确定性材料位置;这里不保存人物、地点或当前事实。`)})]}),(0,b.jsxs)(`div`,{className:`world-frame-status`,"aria-label":v(`世界提示框架草稿状态`),children:[(0,b.jsx)(`span`,{className:m?.format===J?`valid`:`invalid`,children:m?.format===J?v(`V1 格式`):v(`格式待修复`)}),(0,b.jsx)(`span`,{className:T?`valid`:`invalid`,children:v(T?`可视化已同步`:`仅可编辑 YAML`)})]})]}),m===null?(0,b.jsxs)(`div`,{className:`world-frame-parse-error`,role:`alert`,children:[(0,b.jsx)(`strong`,{children:v(`当前 YAML 暂时无法可视化`)}),(0,b.jsx)(`p`,{children:a.error}),(0,b.jsx)(`span`,{children:v(`下面的高级编辑器会原样保留草稿;修复后可视化页面会自动恢复。`)})]}):(0,b.jsxs)(b.Fragment,{children:[m.format!==J&&(0,b.jsxs)(`div`,{className:`world-frame-repair-callout`,role:`note`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`format 不是当前世界框架版本`)}),(0,b.jsxs)(`span`,{children:[v(`Runtime 只接受`),J,`。`]})]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>D(e=>{e.format=J}),children:v(`修复为 V1 格式`)})]}),(0,b.jsxs)(`div`,{className:`world-frame-flow`,"aria-label":v(`世界提示框架流程`),children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`Markdown 提示块`)}),(0,b.jsxs)(`strong`,{children:[h?.length??`?`,` `,v(`份世界指令`)]})]}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`进入逻辑 role`)}),(0,b.jsx)(`strong`,{children:`author_instruction`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`精确文档与目录`)}),(0,b.jsxs)(`strong`,{children:[g?.length??`?`,` `,v(`个材料插槽`)]})]}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`进入逻辑 role`)}),(0,b.jsx)(`strong`,{children:`world_context`})]})]}),(0,b.jsxs)(`section`,{className:`world-frame-section world-frame-binding`,"aria-labelledby":`world-frame-binding-title`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`01 · 权威绑定`)}),(0,b.jsx)(`h6`,{id:`world-frame-binding-title`,children:v(`当前情境绑定`)})]}),(0,b.jsx)(`span`,{className:y===void 0?`world-frame-section-state invalid`:`world-frame-section-state valid`,children:v(y===void 0?`未解析`:`已解析`)})]}),(0,b.jsx)(`p`,{children:v("`current_situation` 插槽会从这里读取唯一当前情境文档,不按文件名或标题猜测。")}),(0,b.jsxs)(`label`,{children:[v(`当前情境文档`),(0,b.jsxs)(`select`,{value:y===void 0?_:Y(y),onChange:e=>{let t=e.currentTarget.value;D(e=>{e.bindings={currentSituation:t}})},children:[(0,b.jsx)(`option`,{value:``,children:v(`选择一份世界文档`)}),_.length>0&&ao(o,_)===void 0&&(0,b.jsxs)(`option`,{value:_,children:[_,v(`(当前未解析)`)]}),o.map(e=>(0,b.jsxs)(`option`,{value:Y(e),children:[e.title,` · `,Y(e),` ·`,` `,e.path]},e.path))]})]})]}),(0,b.jsxs)(`section`,{className:`world-frame-section`,"aria-labelledby":`world-frame-instructions-title`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`02 · 世界专属指令`)}),(0,b.jsx)(`h6`,{id:`world-frame-instructions-title`,children:v(`提示块顺序`)})]}),(0,b.jsxs)(`span`,{className:`world-frame-section-state`,children:[h?.length??0,` `,v(`个块`)]})]}),(0,b.jsx)(`p`,{children:v(`这些 Markdown 块按顺序进入主持预设预留的世界指令位置;正文仍在独立文件中编辑。`)}),h===null?(0,b.jsx)(_o,{name:`instructions`,onReset:()=>D(e=>{e.instructions=[]})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`ol`,{className:`world-frame-order-list`,"aria-label":v(`世界指令顺序`),children:h.map((e,t)=>{let n=s.find(({path:t})=>t===e.markdown),r=n?.title??e.markdown;return(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`span`,{className:`world-frame-order-number`,children:String(t+1).padStart(2,`0`)}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:r}),(0,b.jsx)(`code`,{children:e.markdown}),n===void 0&&(0,b.jsx)(`span`,{children:v(`引用的文件不存在`)})]}),(0,b.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,b.jsx)(`span`,{children:v(`调整顺序`)}),(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":v(`上移 {title}`,{title:r}),disabled:t===0,onClick:()=>O(Ro(h,t,t-1)),children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,v(`上移`)]}),(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":v(`下移 {title}`,{title:r}),disabled:t===h.length-1,onClick:()=>O(Ro(h,t,t+1)),children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,v(`下移`)]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,"aria-label":v(`移除指令 {title}`,{title:r}),onClick:()=>O(h.filter((e,n)=>n!==t)),children:v(`移除`)})]})]},`${e.markdown}-${t}`)})}),h.length===0&&(0,b.jsx)(`p`,{className:`world-frame-empty`,children:v(`尚未加入世界提示块。`)}),(0,b.jsxs)(`div`,{className:`world-frame-add-row`,children:[(0,b.jsxs)(`label`,{children:[v(`要加入的 Markdown 块`),(0,b.jsx)(`select`,{value:S,onChange:e=>d(e.currentTarget.value),children:x.length===0?(0,b.jsx)(`option`,{value:``,children:v(`没有可加入的未引用块`)}):x.map(e=>(0,b.jsxs)(`option`,{value:e.path,children:[e.title,` · `,e.path]},e.path))})]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:S.length===0,onClick:()=>{O([...h,{markdown:S}]),d(``)},children:v(`加入指令顺序`)})]})]})]}),(0,b.jsx)(Vo,{frame:m,documents:o,onChange:e=>D(t=>{t.maintenance=e})}),(0,b.jsxs)(`section`,{className:`world-frame-section`,"aria-labelledby":`world-frame-context-title`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`03 · 确定性材料`)}),(0,b.jsx)(`h6`,{id:`world-frame-context-title`,children:v(`上下文材料顺序`)})]}),(0,b.jsxs)(`span`,{className:`world-frame-section-state`,children:[g?.length??0,` `,v(`个插槽`)]})]}),(0,b.jsx)(`p`,{children:v(`Runtime 只按这些精确位置取材。顺序会进入真实 prompt,但不会推断“相关人物”或“重要历史”。`)}),(0,b.jsxs)(`div`,{className:`world-frame-reorder-guide`,role:`note`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`↕`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`从上到下就是实际注入顺序`)}),(0,b.jsx)(`span`,{children:v(`每张卡片右上角都有“上移 / 下移”;移动后序号会立即更新。`)})]})]}),g===null?(0,b.jsx)(_o,{name:`context`,onReset:()=>D(e=>{e.context=[]})}):(0,b.jsxs)(b.Fragment,{children:[(C!==1||w!==1)&&(0,b.jsxs)(`div`,{className:`world-frame-required-slots`,role:`note`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`必需插槽还未成对`)}),(0,b.jsxs)(`span`,{children:[v(`当前情境`),C,` `,v(`个 · 附加材料`),` `,w,` `,v(`个`)]})]}),(0,b.jsxs)(`div`,{children:[C===0&&(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>ee(`current_situation`),children:v(`补上当前情境`)}),w===0&&(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>ee(`additional_materials`),children:v(`补上附加材料`)})]})]}),(0,b.jsx)(`ol`,{className:`world-frame-slot-list`,"aria-label":v(`上下文材料顺序`),children:g.map((e,t)=>(0,b.jsx)(`li`,{children:(0,b.jsx)(lo,{slot:e.slot,ordinal:t+1,documents:o,directories:c,canRemove:!Io(e.slot.kind)||Fo(g,e.slot.kind)>1,onChange:e=>{let n=[...g];n[t]={slot:e},k(n)},onMove:e=>k(Ro(g,t,e)),onRemove:()=>k(g.filter((e,n)=>n!==t)),first:t===0,last:t===g.length-1})},`${e.slot.kind}-${t}`))}),(0,b.jsxs)(`div`,{className:`world-frame-add-slot`,children:[(0,b.jsxs)(`label`,{children:[v(`新增材料类型`),(0,b.jsx)(`select`,{value:f,onChange:e=>p(e.currentTarget.value),children:so.map(e=>(0,b.jsxs)(`option`,{value:e.kind,children:[v(e.label),` — `,v(e.detail)]},e.kind))}),E!==null&&(0,b.jsx)(`small`,{className:`world-frame-association-note`,children:E})]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:E!==null,onClick:()=>{if(g===null)return;let e={slot:Oo(f,o,c)},t=[...g],n=t.findIndex(({slot:e})=>e.kind===`additional_materials`);t.splice(n<0?t.length:n,0,e),k(t)},children:v(`新增材料插槽`)})]})]})]})]}),(0,b.jsxs)(`details`,{className:`world-frame-source`,open:m===null,children:[(0,b.jsx)(`summary`,{children:v(`高级:直接编辑 frame.yaml`)}),(0,b.jsx)(`p`,{children:v(`可视化修改会把 YAML 重新整理为稳定格式;需要修复未知字段或保留当前原文时可在这里编辑。`)}),(0,b.jsx)(`textarea`,{rows:18,spellCheck:!1,"aria-label":v(`直接编辑 control/frame.yaml`),value:e,onChange:e=>r(e.currentTarget.value)}),a.error!==null&&(0,b.jsx)(`p`,{role:`alert`,children:a.error})]})]})}function lo({slot:e,ordinal:t,documents:n,directories:r,canRemove:i,first:a,last:o,onChange:s,onMove:c,onRemove:l}){let u=Po(e.kind),d=zo(e.document),f=ao(n,d),p=No(e.locator,f?.codec??`yaml`),m=Bo(e.from)?e.from:{},h=zo(m.document),g=ao(n,h),y=g?.codec===`yaml`?g:void 0,x=No(m.locator,`yaml`);return(0,b.jsxs)(`article`,{className:`world-frame-slot-card`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{className:`world-frame-order-number`,children:String(t).padStart(2,`0`)}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(u.title)}),(0,b.jsx)(`code`,{children:e.kind}),(0,b.jsx)(`p`,{children:v(u.detail)})]}),(0,b.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,b.jsx)(`span`,{children:v(`调整注入顺序`)}),(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":v(`上移材料 {index}`,{index:t}),disabled:a,onClick:()=>c(t-2),children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,v(`上移`)]}),(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":v(`下移材料 {index}`,{index:t}),disabled:o,onClick:()=>c(t),children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,v(`下移`)]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!i,"aria-label":v(`移除材料 {index}`,{index:t}),onClick:l,children:v(`移除`)})]})]}),(0,b.jsxs)(`label`,{children:[_()===`zh-CN`?`建议体积(UTF-8 字节,可留空)`:`Advisory size (UTF-8 bytes, optional)`,(0,b.jsx)(`input`,{type:`number`,min:1,step:1,value:typeof e.advisoryBytes==`number`?e.advisoryBytes:``,onChange:t=>{let n={...e};t.currentTarget.value===``?delete n.advisoryBytes:(n.advisoryBytes=Number(t.currentTarget.value),n.id??=`slot-${crypto.randomUUID()}`),s(n)}})]}),e.kind===`document`&&(0,b.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,b.jsx)(uo,{label:v(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>s({...e,document:t})}),(0,b.jsx)(ho,{slot:e,ordinal:t,onChange:s})]}),e.kind===`node`&&(0,b.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,b.jsx)(uo,{label:v(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>{let r=ao(n,t)?.codec??`yaml`;s({...e,document:t,locator:{[r]:[]}})}}),(0,b.jsx)(mo,{label:`${p.kind===`yaml`?v(`YAML 路径`):v(`Markdown 标题路径`)} ${t}`,locator:p,onChange:t=>s({...e,locator:t})}),(0,b.jsx)(ho,{slot:e,ordinal:t,onChange:s})]}),e.kind===`reference_targets`&&(0,b.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,b.jsx)(uo,{label:v(`来源 YAML 文件 {index}`,{index:t}),value:h,documents:n.filter(({codec:e})=>e===`yaml`),emptyLabel:v(`选择实际 YAML 文件`),onChange:t=>{let r=ao(n,t),i=r?.codec===`yaml`?r:void 0;s({...e,from:{document:t,locator:{yaml:ko(i)}}})}}),(0,b.jsx)(po,{label:v(`从 YAML 哪个字段读取 $ref(插槽 {index})`,{index:t}),manualLabel:v(`手动 YAML 字段路径(插槽 {index})`,{index:t}),document:y,locator:x,onChange:t=>s({...e,from:{document:h,locator:t}})}),(0,b.jsx)(go,{label:v(`最多目标数 {index}`,{index:t}),value:e.maxEntries,minimum:1,maximum:64,onChange:t=>s({...e,maxEntries:t})}),(0,b.jsx)(ho,{slot:e,ordinal:t,onChange:s})]}),e.kind===`catalog`&&(0,b.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,b.jsx)(fo,{label:v(`目录 {index}`,{index:t}),value:zo(e.directory),directories:r,onChange:t=>s({...e,directory:t})}),(0,b.jsx)(go,{label:v(`最多目录项 {index}`,{index:t}),value:e.maxEntries,minimum:1,maximum:100,onChange:t=>s({...e,maxEntries:t})})]}),e.kind===`history`&&(0,b.jsx)(`div`,{className:`world-frame-slot-fields`,children:(0,b.jsx)(go,{label:v(`带上最近几条 {index}`,{index:t}),value:e.recent??2,minimum:1,maximum:32,onChange:t=>s({...e,recent:t})})}),e.kind===`history_message`&&(0,b.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,b.jsxs)(`label`,{children:[v(`历史消息句柄`),t,(0,b.jsx)(`input`,{value:zo(e.message),onChange:t=>s({...e,message:t.currentTarget.value})})]}),(0,b.jsx)(ho,{slot:e,ordinal:t,onChange:s})]}),!Lo(e.kind)&&(0,b.jsx)(`pre`,{className:`world-frame-unknown-slot`,children:mi(e,{lineWidth:0})})]})}function uo({label:e,value:t,documents:n,emptyLabel:r=v(`选择实际文档文件`),onChange:i}){let a=ao(n,t);return(0,b.jsxs)(`label`,{children:[e,(0,b.jsxs)(`select`,{"aria-label":e,value:a===void 0?t:Y(a),onChange:e=>i(e.currentTarget.value),children:[(0,b.jsx)(`option`,{value:``,children:r}),t.length>0&&ao(n,t)===void 0&&(0,b.jsxs)(`option`,{value:t,children:[t,v(`(当前未解析)`)]}),n.map(e=>(0,b.jsxs)(`option`,{value:Y(e),children:[e.path,` — `,e.title,` · `,Y(e)]},e.path))]}),(0,b.jsx)(`small`,{className:`world-frame-association-note`,children:a===void 0?v(`只列出内容包中带可识别 $document 技术头的实际文件。`):v(`实际关联 {path};frame.yaml 保存 @短引用:{handle}`,{path:a.path,handle:Y(a)})})]})}function fo({label:e,value:t,directories:n,onChange:r}){let i=n.find(({directory:e})=>e===t);return(0,b.jsxs)(`label`,{children:[e,(0,b.jsxs)(`select`,{"aria-label":e,value:t,onChange:e=>r(e.currentTarget.value),children:[(0,b.jsx)(`option`,{value:``,children:v(`选择实际世界目录`)}),t.length>0&&i===void 0&&(0,b.jsxs)(`option`,{value:t,children:[t,v(`(当前没有可关联文档)`)]}),n.map(e=>(0,b.jsxs)(`option`,{value:e.directory,children:[`world/`,e.directory,`/ — `,e.documentCount,` `,v(`份文档`)]},e.directory))]}),(0,b.jsx)(`small`,{className:`world-frame-association-note`,children:i===void 0?v(`只列出当前内容包内确实包含可识别文档的目录。`):v(`实际关联 world/{directory}/;创建世界后对应 state/{directory}/。`,{directory:i.directory})})]})}function po({label:e,manualLabel:t,document:n,locator:r,onChange:i}){let a=n?.yamlLocators??[],o=Ao(r.path),s=a.some(({path:e})=>Ao(e)===o),c=a.filter(({referenceCount:e})=>e>0).length;return(0,b.jsxs)(`div`,{className:`world-frame-reference-locator`,children:[(0,b.jsxs)(`label`,{children:[e,(0,b.jsx)(`select`,{"aria-label":e,value:o,disabled:n===void 0,onChange:e=>{let t=a.find(({path:t})=>Ao(t)===e.currentTarget.value);t!==void 0&&i({yaml:[...t.path]})},children:n===void 0?(0,b.jsx)(`option`,{value:o,children:v(`先选择来源 YAML 文件`)}):(0,b.jsxs)(b.Fragment,{children:[!s&&(0,b.jsxs)(`option`,{value:o,children:[v(`当前手动路径:`),jo(r.path),v(`(未解析)`)]}),a.map(e=>(0,b.jsxs)(`option`,{value:Ao(e.path),children:[jo(e.path),` —`,` `,e.nodeKind===`list`?v(`列表`):v(`对象`),` `,`·`,` `,e.referenceCount>0?e.referenceCount+v(` 个 $ref`):v(`当前无 $ref`)]},Ao(e.path)))]})}),(0,b.jsx)(`small`,{className:`world-frame-association-note`,children:n===void 0?v(`选择 YAML 文件后,这里会解析其中可持久定位的对象和列表。`):n.path+v(` 已解析 `)+a.length+v(` 个可选节点,其中 `)+c+v(` 个当前包含 $ref。`)})]}),(0,b.jsxs)(`details`,{className:`world-frame-locator-advanced`,children:[(0,b.jsx)(`summary`,{children:v(`高级:手动填写字段路径`)}),(0,b.jsx)(mo,{label:t,locator:{kind:`yaml`,path:r.path},onChange:i})]})]})}function mo({label:e,locator:t,onChange:n}){return(0,b.jsxs)(`label`,{children:[e,(0,b.jsx)(`textarea`,{rows:3,value:t.path.join(`
1185
+ `),placeholder:v(`每行一个层级;留空表示文档根`),onChange:e=>n({[t.kind]:e.currentTarget.value.split(`
1186
+ `).map(e=>e.trim()).filter(Boolean)})})]})}function ho({slot:e,ordinal:t,onChange:n}){return(0,b.jsxs)(`label`,{className:`world-frame-required-field`,children:[(0,b.jsx)(`input`,{type:`checkbox`,"aria-label":v(`缺失时阻止请求 {index}`,{index:t}),checked:e.required!==!1,onChange:t=>{let r={...e};t.currentTarget.checked?delete r.required:r.required=!1,n(r)}}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:v(`缺失时阻止请求`)}),(0,b.jsx)(`small`,{children:v(`关闭后,目标暂时不存在时会明确略过。`)})]})]})}function go({label:e,value:t,minimum:n,maximum:r,onChange:i}){return(0,b.jsxs)(`label`,{children:[e,(0,b.jsx)(`input`,{type:`number`,min:n,max:r,value:typeof t==`number`?t:``,onChange:e=>i(Number(e.currentTarget.value))})]})}function _o({name:e,onReset:t}){return(0,b.jsxs)(`div`,{className:`world-frame-malformed`,role:`alert`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`strong`,{children:[e,` `,v(`不是可视化编辑器支持的列表形状`)]}),(0,b.jsx)(`span`,{children:v(`可在高级 YAML 中修复,或明确重置为空列表后重新编排。`)})]}),(0,b.jsxs)(`button`,{type:`button`,className:`secondary-button`,onClick:t,children:[v(`重置`),e]})]})}function vo(e){try{let t=pi(e);return Bo(t)?{value:t,error:null}:{value:null,error:v(`frame.yaml 顶层必须是 YAML map。`)}}catch(e){return{value:null,error:e instanceof Error?v(`YAML 无法解析:{message}`,{message:e.message}):v(`YAML 无法解析。`)}}}function yo(e){return!Array.isArray(e.instructions)||!e.instructions.every(e=>Bo(e)&&typeof e.markdown==`string`)?null:e.instructions}function bo(e){return!Array.isArray(e.context)||!e.context.every(e=>Bo(e)&&Bo(e.slot)&&typeof e.slot.kind==`string`)?null:e.context}function xo(e){let t=[];for(let n of e){if(n.encoding!==void 0||!n.path.startsWith(`world/`))continue;let e=/\.md$/iu.test(n.path)?`markdown`:/\.ya?ml$/iu.test(n.path)?`yaml`:null;if(e!==null)try{let r=pi(e===`markdown`?Do(n.contents):n.contents);if(!Bo(r)||!Bo(r.$document))continue;let i=zo(r.$document.id),a=zo(r.$document.ref),o=zo(r.$document.title);if(i.length===0||a.length===0)continue;t.push({id:i,ref:a,title:o.length>0?o:a,path:n.path,codec:e,yamlLocators:e===`yaml`?wo(r):[]})}catch{}}let n=e=>e.id===`situation.current`||e.ref===`current-situation`?-1:0;return t.sort((e,t)=>n(e)-n(t)||e.path.localeCompare(t.path))}function So(e){return e.filter(({path:e,encoding:t})=>t===void 0&&e.startsWith(`control/blocks/`)&&e.endsWith(`.md`)).map(e=>({path:e.path.slice(8),title:/^#\s+(.+?)\s*$/mu.exec(e.contents)?.[1]?.trim()??e.path.split(`/`).at(-1)??e.path})).sort((e,t)=>e.path.localeCompare(t.path))}function Co(e){let t=new Map;for(let n of e){let e=/^world\/(.+)\/[^/]+$/u.exec(n.path);if(e===null)continue;let r=e[1];t.set(r,(t.get(r)??0)+1)}return[...t].map(([e,t])=>({directory:e,documentCount:t})).sort((e,t)=>e.directory.localeCompare(t.directory))}function wo(e){let t=[],n=new WeakSet,r=(e,i)=>{if(Array.isArray(e)){if(n.has(e))return 0;n.add(e);let r=Eo(e);return t.push({path:i,nodeKind:`list`,referenceCount:r}),r}if(!Bo(e)||n.has(e))return 0;n.add(e);let a=+(typeof e.$ref==`string`);for(let[t,n]of Object.entries(e))t!==`$document`&&t!==`$ref`&&(Array.isArray(n)||Bo(n))&&(a+=r(n,[...i,t]));return t.push({path:i,nodeKind:`object`,referenceCount:a}),a};return r(e,[]),t.sort((e,t)=>To(e)-To(t))}function To(e){return e.path.length===0?2:e.referenceCount>0?0:1}function Eo(e,t=new WeakSet){if(Array.isArray(e)){if(t.has(e))return 0;t.add(e);let n=0;for(let r of e)n+=Eo(r,t);return n}return!Bo(e)||t.has(e)?0:(t.add(e),+(typeof e.$ref==`string`)+Object.entries(e).reduce((e,[n,r])=>n===`$document`||n===`$ref`?e:e+Eo(r,t),0))}function Do(e){if(!e.startsWith(`---
1187
+ `))return``;let t=e.indexOf(`
1188
+ ---
1189
+ `,4);return t<0?``:e.slice(4,t)}function Oo(e,t,n){let r=t[0];if(e===`document`)return{kind:e,document:r===void 0?``:Y(r)};if(e===`node`)return{kind:e,document:r===void 0?``:Y(r),locator:{[r?.codec??`yaml`]:[]}};if(e===`reference_targets`){let n=t.find(({codec:e})=>e===`yaml`);return{kind:e,from:{document:n===void 0?``:Y(n),locator:{yaml:ko(n)}},maxEntries:12}}return e===`history`?{kind:e,recent:2}:{kind:e,directory:n[0]?.directory??``,maxEntries:24}}function ko(e){let t=e?.yamlLocators.find(({path:e,referenceCount:t})=>e.length>0&&t>0);if(t!==void 0)return[...t.path];let n=e?.yamlLocators.find(({path:e})=>e.length===0);return n===void 0?[]:[...n.path]}function Ao(e){return JSON.stringify(e)}function jo(e){return e.length===0?v(`整份 YAML`):e.join(` › `)}function Mo(e,t,n){return e===`catalog`&&n.length===0?v(`先在 world/ 的子目录中创建带 $document 技术头的文档。`):e===`reference_targets`&&!t.some(({codec:e})=>e===`yaml`)?v(`先创建一份带 $document 技术头的 YAML 世界文档。`):(e===`document`||e===`node`)&&t.length===0?v(`先创建一份带 $document 技术头的世界文档。`):null}function No(e,t){return Bo(e)&&Array.isArray(e.yaml)?{kind:`yaml`,path:e.yaml.filter(e=>typeof e==`string`)}:Bo(e)&&Array.isArray(e.markdown)?{kind:`markdown`,path:e.markdown.filter(e=>typeof e==`string`)}:{kind:t,path:[]}}function Po(e){return{current_situation:{title:v(`当前情境`),detail:v(`从上方绑定读取紧接着的叙事不能忘记的短期局面。`)},additional_materials:{title:v(`附加材料`),detail:v(`展开当前端点为全新上下文保存的完整精确材料清单。`)},document:{title:v(`整份文档`),detail:v(`精确加入一份世界文档。`)},node:{title:v(`文档局部节点`),detail:v(`精确加入 YAML 路径或 Markdown 标题子树。`)},catalog:{title:v(`有界目录`),detail:v(`列出一级目录中的标题、简介和短引用,不展开正文。`)},reference_targets:{title:v(`显式引用目标`),detail:v(`读取 YAML 节点中的 $ref,并加入一层目标文档。`)},history:{title:v(`最近叙事`),detail:v(`带上最近几条已提交玩家/主持原文;没有此前叙事时会明确标为空,调用链据此延续未写入文档的细节。`)},history_message:{title:v(`精确历史消息`),detail:v(`按 Runtime 句柄加入一条已提交叙事。`)}}[e]??{title:v(`未知插槽`),detail:v(`当前可视化编辑器不识别此类型;可移动、移除或在 YAML 中修复。`)}}function Fo(e,t){return e?.filter(({slot:e})=>e.kind===t).length??0}function Io(e){return e===`current_situation`||e===`additional_materials`}function Lo(e){return[`current_situation`,`additional_materials`,`document`,`node`,`catalog`,`reference_targets`,`history`,`history_message`].includes(e)}function Ro(e,t,n){if(n<0||n>=e.length||t===n)return[...e];let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}function zo(e){return typeof e==`string`?e:``}function Bo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vo({frame:e,documents:t,onChange:n}){let r=_()===`zh-CN`,i=Bo(e.maintenance)?e.maintenance:{},a=Bo(i.documents)?i.documents:{},o=Bo(i.clock)?i.clock:{},s=ao(t,zo(o.document));return(0,b.jsxs)(`details`,{className:`world-frame-section`,children:[(0,b.jsx)(`summary`,{children:r?`文档整理提示与世界时间记录`:`Document advice and world-time recording`}),(0,b.jsx)(`p`,{children:r?`超出建议体积只会提示整理。世界时间仅在明确选择节点后,随真实写入记录;不会自动推进时间。`:`Exceeding advisory sizes only produces advice. World time is recorded with actual writes only when you select an exact node; it never advances automatically.`}),t.map(e=>(0,b.jsxs)(`label`,{children:[e.title,` · @`,e.ref,` —`,` `,r?`建议字节数`:`Advisory bytes`,(0,b.jsx)(`input`,{type:`number`,min:1,step:1,value:typeof a[`@${e.ref}`]==`number`?a[`@${e.ref}`]:``,onChange:t=>{let r={...a};t.currentTarget.value===``?delete r[`@${e.ref}`]:r[`@${e.ref}`]=Number(t.currentTarget.value),n({...i,documents:r})}})]},e.ref)),(0,b.jsx)(uo,{label:r?`记录写入时世界时间的文档`:`Document containing world time at write`,emptyLabel:r?`不记录世界时间`:`Do not record world time`,value:zo(o.document),documents:t,onChange:e=>{let r={...i};e===``?delete r.clock:r.clock={document:e,locator:{[ao(t,e)?.codec??`yaml`]:[]}},n(r)}}),s!==void 0&&(0,b.jsx)(mo,{label:r?`世界时间的精确字段路径`:`Exact world-time field path`,locator:No(o.locator,s.codec),onChange:e=>n({...i,clock:{...o,locator:e}})})]})}function Ho(e){let t=Uo(e.contents,`title`)??Wo(e.contents)??Go(e.path);return{ref:Uo(e.contents,`ref`)??e.path.replace(/\.[^.]+$/u,``).replaceAll(`/`,`-`),title:t,summary:Uo(e.contents,`summary`)??v(`暂无摘要`)}}function Uo(e,t){let n=RegExp(`^\\s{2}${t}:\\s*(.+?)\\s*$`,`mu`).exec(e);return n?.[1]===void 0?null:n[1].replace(/^['"]|['"]$/gu,``).trim()}function Wo(e){return/^#\s+(.+)$/mu.exec(e)?.[1]?.trim()??null}function Go(e){return e.split(`/`).at(-1)??e}function Ko({workspace:e,selectedPath:t,onSelectedPathChange:n}){let{files:r}=e,[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)({sourcePath:``,value:``}),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(!1),h=(0,l.useMemo)(()=>[...r].sort((t,n)=>Zo(e.kind,t,n)),[r,e.kind]),g=e.kind!==`world-correction`,y=e.kind===`content-package`?h.find(({path:e})=>e===`opening.md`)?.path??h.find(({path:e})=>e===`world/current-situation.yaml`)?.path??h[0]?.path??``:e.kind===`world-revision`?h.find(({path:e})=>e===`state/current-situation.yaml`)?.path??h[0]?.path??``:h.find(({path:e})=>e===`current-situation.yaml`)?.path??h[0]?.path??``,x=t??o,S=r.some(({path:e})=>e===x)?x:y,C=r.find(({path:e})=>e===S),w=e.kind===`world-revision`&&e.immutablePaths.includes(S),T=c.sourcePath===S?c.value:S,E=e.kind===`world-correction`?[]:e.issues,D=i.trim().toLocaleLowerCase(`zh-CN`),O=D.length===0?h:h.filter(t=>qo(e.kind,t).toLocaleLowerCase(`zh-CN`).includes(D)),k=Jo(e.kind,O),ee=E.filter(({path:e})=>e===S),A=g&&C!==void 0?Xo(T,C.path,r,e.kind):``,te=g?Xo(d,void 0,r,e.kind):``;function j(e){t===void 0&&s(e),n?.(e)}function M(t){C!==void 0&&e.onFilesChange(r.map(e=>e.path===C.path?{...e,contents:t}:{...e}))}function ne(){if(!g||C===void 0||w||A.length>0)return;let t=T.trim();t!==C.path&&(e.onFilesChange(r.map(e=>e.path===C.path?{...e,path:t}:{...e})),j(t),u({sourcePath:t,value:t}))}function N(){if(!g||(m(!0),te.length>0))return;let t=d.trim();e.onFilesChange([...r.map(e=>({...e})),{path:t,contents:``}]),j(t),f(``),m(!1)}function P(){if(!g||C===void 0||w)return;let t=r.filter(({path:e})=>e!==C.path).map(e=>({...e}));j(Qo(t,C.path,e.kind)),e.onFilesChange(t)}function re(){e.dirty&&(e.kind===`world-correction`?e.pending||e.onPreview():(e.kind===`content-package`||!e.pending)&&e.onSave())}return(0,b.jsxs)(`div`,{className:`content-file-workspace document-workbench document-workbench-${e.kind}`,children:[(0,b.jsxs)(`label`,{className:`content-mobile-file-picker`,children:[v(`当前文件`),(0,b.jsx)(`select`,{"aria-label":v(`选择编辑文件`),value:S,onChange:e=>j(e.currentTarget.value),children:h.map(e=>(0,b.jsx)(`option`,{value:e.path,children:e.path},e.path))})]}),(0,b.jsxs)(`aside`,{className:`content-file-sidebar`,"aria-label":e.kind===`content-package`?v(`内容包文件`):e.kind===`world-revision`?v(`世界修订文件`):v(`当前世界文档`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`content-editor-kicker`,children:e.kind===`content-package`?v(`当前草稿`):e.kind===`world-revision`?v(`修订工作树`):v(`当前世界`)}),(0,b.jsx)(`h4`,{children:v(`文件`)})]}),(0,b.jsxs)(`span`,{children:[O.length,` / `,r.length]})]}),(0,b.jsxs)(`label`,{className:`content-file-filter`,children:[(0,b.jsx)(`span`,{children:v(`筛选文件`)}),(0,b.jsx)(`input`,{type:`search`,value:i,placeholder:e.kind===`content-package`?v(`人物、地点或文件名`):v(`查找人物、地点、规则…`),onChange:e=>a(e.target.value)})]}),(0,b.jsx)(`nav`,{className:`content-file-list`,"aria-label":e.kind===`content-package`?v(`内容包文件树`):e.kind===`world-revision`?v(`世界修订文件树`):v(`当前世界文档`),children:O.length===0?(0,b.jsx)(`p`,{children:v(`没有匹配的文件。`)}):k.map(t=>(0,b.jsxs)(`section`,{"aria-labelledby":`document-group-${e.kind}-${t.id}`,children:[(0,b.jsxs)(`h5`,{id:`document-group-${e.kind}-${t.id}`,children:[v(t.label),(0,b.jsx)(`span`,{children:t.files.length})]}),(0,b.jsx)(`ul`,{children:t.files.map(t=>{let n=E.filter(({path:e})=>e===t.path).length,r=Ho(t);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:t.path===S?`selected-content-file`:``,"aria-label":v(`打开 {path}`,{path:t.path}),"aria-pressed":t.path===S,title:t.path,onClick:()=>j(t.path),children:[(0,b.jsx)(`span`,{className:`content-file-kind`,"aria-hidden":`true`,children:es(t)}),e.kind===`world-correction`?(0,b.jsxs)(`span`,{className:`world-document-list-copy`,children:[(0,b.jsxs)(`span`,{className:`world-document-list-heading`,children:[(0,b.jsx)(`strong`,{children:r.title}),(0,b.jsx)(`code`,{children:t.path})]}),(0,b.jsx)(`small`,{children:r.summary})]}):(0,b.jsx)(`code`,{children:t.path}),n>0&&(0,b.jsx)(`span`,{className:`content-file-issue-count`,children:n})]})},t.path)})})]},t.id))}),g?(0,b.jsxs)(`details`,{className:`content-new-file`,children:[(0,b.jsx)(`summary`,{children:v(`新建文件`)}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{children:[v(`新文件路径`),(0,b.jsx)(`input`,{value:d,placeholder:e.kind===`world-revision`?`state/characters/name.yaml`:`world/characters/name.yaml`,onChange:e=>{f(e.target.value),m(!0)}})]}),p&&te.length>0&&(0,b.jsx)(`p`,{role:`alert`,children:te}),(0,b.jsx)(`p`,{children:v(`新文件先加入本地草稿;Runtime 会在整批保存时检查路径与内容。`)}),(0,b.jsx)(`button`,{type:`button`,disabled:te.length>0,onClick:N,children:v(`加入草稿`)})]})]}):(0,b.jsx)(`p`,{className:`world-correction-scope-note`,children:v(`只修订已有世界文档;临时出现的地点不需要先建立档案。`)})]}),(0,b.jsx)(`section`,{className:`content-file-editor`,"aria-label":C===void 0?v(`文件编辑器`):v(`文件编辑器:{path}`,{path:C.path}),children:C===void 0?(0,b.jsxs)(`div`,{className:`content-editor-empty`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,b.jsx)(`h4`,{children:v(`当前草稿没有文件`)}),(0,b.jsx)(`p`,{children:e.kind===`content-package`?v(`从左侧新建第一份文件,或返回工作区导入已有内容包。`):e.kind===`world-revision`?v(`从左侧新建状态或控制文件。`):v(`当前世界没有可修订的状态文档。`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`header`,{className:`content-file-editor-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{className:`content-editor-kicker`,children:e.kind===`content-package`||e.kind===`world-revision`?ts(C):v(`全文编辑`)}),(0,b.jsx)(`h4`,{children:e.kind===`content-package`||e.kind===`world-revision`?$o(C.path):Ho(C).title}),e.kind===`world-correction`?(0,b.jsx)(`small`,{children:C.path}):null]}),g?(0,b.jsx)(`button`,{type:`button`,className:`danger-button content-remove-file`,disabled:w,onClick:P,children:v(`从草稿移除`)}):(0,b.jsx)(`span`,{className:e.dirty?`document-workbench-dirty is-dirty`:`document-workbench-dirty`,children:e.dirty?v(`已修改 · 未预览`):v(`无本地修改`)})]}),g?(0,b.jsxs)(`details`,{className:`content-rename-file`,children:[(0,b.jsx)(`summary`,{children:v(`重命名文件`)}),(0,b.jsxs)(`div`,{className:`content-path-editor`,children:[(0,b.jsxs)(`label`,{children:[v(`文件路径`),(0,b.jsx)(`input`,{value:T,disabled:w,onChange:e=>u({sourcePath:C.path,value:e.target.value})})]}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||A.length>0||T.trim()===C.path,onClick:ne,children:v(`应用新路径`)})]}),A.length>0?(0,b.jsx)(`p`,{role:`alert`,children:A}):w?(0,b.jsx)(`p`,{children:v(`既有状态文档的路径和身份在修订中保持不变。`)}):null]},C.path):null,C.encoding===`base64`?(0,b.jsxs)(`div`,{className:`content-binary-note`,role:`note`,children:[(0,b.jsx)(`strong`,{children:v(`二进制资源不在文本编辑器展开`)}),(0,b.jsx)(`span`,{children:v(`当前 Base64 内容会原样保留;如需替换资源,请重新导入内容包。`)})]}):g&&C.path===`control/frame.yaml`?(0,b.jsx)(co,{contents:C.contents,files:r,dirty:e.dirty,onChange:M,onSave:e.onSave}):(0,b.jsxs)(`label`,{className:`content-source-editor`,children:[(0,b.jsxs)(`span`,{children:[v(`文件内容`),(0,b.jsx)(`small`,{children:e.kind===`content-package`?v(`Ctrl / ⌘ + S 整批保存`):e.kind===`world-revision`?v(`Ctrl / ⌘ + S 保存到修订工作树`):v(`Ctrl / ⌘ + S 预览整笔修订`)})]}),(0,b.jsx)(`textarea`,{rows:27,spellCheck:!1,value:C.contents,placeholder:ns(C.path,e.kind),"aria-label":v(`编辑 {path}`,{path:C.path}),onChange:e=>M(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase(`en-US`)===`s`&&(e.preventDefault(),re())}})]}),(0,b.jsxs)(`footer`,{className:`content-source-meta`,children:[(0,b.jsx)(`span`,{children:es(C)}),C.encoding===void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{children:[rs(C.contents),` `,v(`行`)]}),(0,b.jsxs)(`span`,{children:[C.contents.length.toLocaleString(_()),` `,v(`字符`)]})]})]}),ee.length>0&&(0,b.jsxs)(`section`,{className:`content-selected-diagnostics`,"aria-labelledby":`selected-file-diagnostics-title`,children:[(0,b.jsx)(`h5`,{id:`selected-file-diagnostics-title`,children:v(`已保存版本诊断`)}),(0,b.jsx)(`ul`,{children:ee.map((e,t)=>(0,b.jsx)(`li`,{children:e.message},`${e.code}-${e.path}-${t}`))})]}),e.kind===`world-correction`?(0,b.jsxs)(`footer`,{className:`document-workbench-review`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`应用前先审阅`)}),(0,b.jsx)(`span`,{children:v(`完整差异 · 真实 Prompt Preview · 一笔 Authority 修订`)})]}),(0,b.jsx)(`button`,{type:`button`,disabled:!e.dirty||e.pending,onClick:e.onPreview,children:v(`预览修订`)})]}):null]})})]})}function qo(e,t){if(e!==`world-correction`)return t.path;let n=Ho(t);return`${t.path}\n${n.title}\n${n.summary}\n${n.ref}`}function Jo(e,t){return(e===`content-package`?[[`opening`,`开场`],[`world`,`世界内容`],[`control`,`控制`],[`other`,`其他资源`]]:e===`world-revision`?[[`state`,`世界状态`],[`control`,`控制`],[`other`,`其他`]]:[[`current`,`当前情境`],[`characters`,`人物`],[`locations`,`地点`],[`relationships`,`关系`],[`items`,`物品`],[`rules`,`规则`],[`other`,`其他`]]).flatMap(([n,r])=>{let i=t.filter(({path:t})=>Yo(e,t)===n);return i.length===0?[]:[{id:n,label:r,files:i}]})}function Yo(e,t){if(e===`content-package`)return t===`opening.md`?`opening`:t.startsWith(`world/`)?`world`:t.startsWith(`control/`)?`control`:`other`;if(e===`world-revision`)return t.startsWith(`state/`)?`state`:t.startsWith(`control/`)?`control`:`other`;if(t===`current-situation.yaml`||t===`current-situation.md`)return`current`;let n=t.split(`/`)[0];return n===`characters`||n===`locations`||n===`relationships`||n===`items`||n===`rules`?n:`other`}function Xo(e,t,n,r){let i=e.trim();if(i.length===0)return v(`请输入文件路径。`);if(i.startsWith(`/`)||/^[a-z]:[\\/]/iu.test(i)||i.includes(`\\`)||i.includes(`\0`))return v(`路径必须是使用 / 的内容包相对路径。`);if(i.split(`/`).some(e=>e.length===0||e===`.`||e===`..`))return v(`路径不能包含空目录、. 或 ..。`);if(/\.json$/iu.test(i))return v(`当前文件原生 V1 不接受 manifest 或 JSON 内容文件。`);if(r===`world-revision`&&!/^state\/.+\.(?:ya?ml|md)$/u.test(i)&&i!==`control/frame.yaml`&&i!==`control/player-views.yaml`&&!/^control\/blocks\/.+\.md$/u.test(i))return v(`世界修订只接受 state 下的 YAML/Markdown,以及受支持的 control 文件。`);let a=i.normalize(`NFC`).toLocaleLowerCase(`en-US`);return n.some(e=>e.path!==t&&e.path.normalize(`NFC`).toLocaleLowerCase(`en-US`)===a)?v(`当前草稿中已经存在同一路径。`):``}function Zo(e,t,n){let r=t=>e===`content-package`?t===`opening.md`?0:t===`world/current-situation.yaml`?1:t.startsWith(`world/`)?2:t===`control/frame.yaml`?3:t.startsWith(`control/`)?4:5:e===`world-revision`?t===`state/current-situation.yaml`?0:t.startsWith(`state/`)?1:t===`control/frame.yaml`?2:t.startsWith(`control/`)?3:4:[`current`,`characters`,`locations`,`relationships`,`items`,`rules`,`other`].indexOf(Yo(e,t));return r(t.path)-r(n.path)||t.path.localeCompare(n.path)}function Qo(e,t,n){let r=[...e].sort((e,t)=>Zo(n,e,t));return r.find(({path:e})=>e.localeCompare(t)>0)?.path??r.at(-1)?.path??``}function $o(e){return e.split(`/`).at(-1)??e}function es(e){return e.encoding===`base64`?`BIN`:/\.ya?ml$/iu.test(e.path)?`YAML`:/\.md$/iu.test(e.path)?`MD`:`TEXT`}function ts(e){return e.encoding===`base64`?v(`二进制资源`):e.path===`opening.md`?v(`玩家首次行动前看到的开场白`):e.path.startsWith(`world/`)?v(`会复制为世界状态的设定文档`):e.path.startsWith(`control/`)?v(`会复制为世界控制的作者资产`):v(`内容包文本资源`)}function ns(e,t){return t===`world-correction`?v(`输入完整 UTF-8 文档内容……`):e===`opening.md`?v(`写下玩家首次行动前立即看到的局面……`):(e.startsWith(`world/`)||e.startsWith(`state/`))&&/\.ya?ml$/iu.test(e)?v(`$document:
1190
+ id: character.example
1191
+ ref: example
1192
+ title: 示例人物
1193
+ summary: 一句话稳定简介。
1194
+ aliases: []
1195
+ `):(e.startsWith(`world/`)||e.startsWith(`state/`))&&/\.md$/iu.test(e)?v(`---
1196
+ $document:
1197
+ id: rule.example
1198
+ ref: example
1199
+ title: 示例规则
1200
+ summary: 一句话稳定简介。
1201
+ aliases: []
1202
+ ---
1203
+
1204
+ # 示例规则
1205
+ `):v(`输入 UTF-8 文本内容……`)}function rs(e){return e.length===0?0:e.split(`
1206
+ `).length}function is({scriptPermission:e,files:t,status:n,issues:r,dirty:i,onFilesChange:a,onSave:o,onReset:s,onCopy:c,onExport:u,onDelete:d,title:f,onRename:p,selectedPath:m,onSelectedPathChange:h,embedded:g=!1,mode:_=`content-package`,immutablePaths:y=[]}){let[x,S]=(0,l.useState)(f),[C,w]=(0,l.useState)(f);return C!==f&&(w(f),S(f)),(0,b.jsxs)(`section`,{className:g?`panel-card content-tree-editor is-embedded`:`panel-card content-tree-editor`,children:[(0,b.jsxs)(`header`,{className:`section-heading-row content-tree-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:g?`visually-hidden`:void 0,children:v(_===`world-revision`?`世界修订工作树`:`内容包当前树`)}),(0,b.jsxs)(`details`,{className:`content-save-help`,children:[(0,b.jsx)(`summary`,{children:v(`保存说明`)}),(0,b.jsx)(`p`,{className:`field-note`,children:v(_===`world-revision`?`手动编辑与 AI 共用这棵 state/control 工作树;保存后仍可逐次回滚,应用才会提交世界。`:`逐份编辑 YAML/Markdown;整批保存时才原子替换已保存版本。`)})]})]}),(0,b.jsxs)(`div`,{className:`content-tree-state`,"aria-label":v(_===`world-revision`?`世界修订状态`:`内容包编辑状态`),children:[(0,b.jsxs)(`span`,{className:`package-status ${n}`,children:[v(_===`world-revision`?`工作树:`:`已保存版本:`),v(n===`usable`?`可用`:`需要修复`)]}),(0,b.jsx)(`span`,{className:i?`draft-state dirty`:`visually-hidden`,children:v(i?`有未保存修改`:_===`world-revision`?`没有未保存修改`:`草稿与已保存版本一致`)})]})]}),(0,b.jsxs)(`div`,{className:`content-tree-tools`,children:[e&&(0,b.jsxs)(`details`,{className:`content-permission-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`内容包脚本权限`)}),e]}),(0,b.jsx)(to,{files:t,onChange:a})]}),(0,b.jsx)(Ko,{...m===void 0?{}:{selectedPath:m},...h===void 0?{}:{onSelectedPathChange:h},workspace:_===`world-revision`?{kind:`world-revision`,files:t,dirty:i,pending:!1,issues:r,immutablePaths:y,onFilesChange:a,onSave:o}:{kind:`content-package`,files:t,dirty:i,issues:r,onFilesChange:a,onSave:o}}),r.length>0&&(0,b.jsxs)(`details`,{className:`content-package-diagnostics`,open:!i,children:[(0,b.jsx)(`summary`,{children:v(`已保存版本有 {count} 项需要修复`,{count:r.length})}),i&&(0,b.jsx)(`p`,{children:v(`诊断对应上一次保存;整批保存后会按新草稿重新检查。`)}),(0,b.jsx)(`ul`,{children:r.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`code`,{children:e.path}),(0,b.jsx)(`span`,{children:e.message})]},`${e.code}-${e.path}-${t}`))})]}),(0,b.jsxs)(`footer`,{className:`content-tree-actions`,children:[(0,b.jsxs)(`div`,{className:`content-save-boundary`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(i?`草稿尚未保存`:_===`world-revision`?`修订工作树已保存`:`当前树已保存`)}),(0,b.jsx)(`span`,{children:v(_===`world-revision`?`保存只更新锁定工作树并留下可回滚记录,不会提交世界。`:`保存会把整棵草稿作为一个候选原子替换,不会逐文件提交。`)})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:!i,onClick:o,children:v(_===`world-revision`?`保存到修订`:`整批保存`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!i,onClick:s,children:v(`放弃未保存修改`)})]})]}),_===`content-package`?(0,b.jsxs)(`details`,{className:`content-package-actions`,children:[(0,b.jsx)(`summary`,{children:v(`内容包操作`)}),i&&(0,b.jsx)(`p`,{children:v(`请先整批保存或放弃当前草稿,再操作已保存内容包。`)}),(0,b.jsxs)(`label`,{className:`content-package-rename`,children:[(0,b.jsx)(`span`,{children:v(`内容包标题`)}),(0,b.jsx)(`input`,{value:x,disabled:i,maxLength:160,onChange:e=>S(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i||x.trim()===``||x.trim()===f,onClick:()=>p(x.trim()),children:v(`重命名`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i,onClick:c,children:v(`复制为新本地身份`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i,onClick:u,children:v(`导出 ZIP`)}),(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:i,onClick:d,children:v(`删除内容包`)})]})]}):null]})]})}var as=[[`inputTokens`,`输入`],[`uncachedInputTokens`,`未缓存输入`],[`cacheReadTokens`,`缓存读取`],[`cacheWriteTokens`,`缓存写入`],[`reasoningTokens`,`推理(输出内)`],[`outputTokens`,`输出(含推理)`],[`totalTokens`,`合计`]];function os({usage:e,compact:t=!1,showProvenance:n=!1}){return(0,b.jsxs)(`section`,{className:`model-usage${t?` model-usage-compact`:``}`,"aria-label":v(`Token 用量明细`),children:[(0,b.jsx)(`dl`,{children:as.map(([t,r])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(r)}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`strong`,{children:ss(e[t])}),e[t]===null?null:(0,b.jsx)(`span`,{children:` tokens`}),n?(0,b.jsx)(`small`,{children:cs(e.provenance[t])}):null]})]},t))}),n?(0,b.jsx)(`p`,{children:v(`缓存读取和缓存写入属于输入构成;推理 tokens 已包含在输出 tokens 中,不应重复相加。`)}):null]})}function ss(e){return e===null?v(`未报告`):e.toLocaleString(_())}function cs(e){return v(e===`provider`?`Provider 报告`:e===`derived_provider_fields`?`由 Provider 字段计算`:`Provider 未报告`)}var ls=8e4,us=1024;function ds(e,t,n=3){let r=fs(e),i=fs(t),a=[];ps(r,0,r.length,i,0,i.length,a);let o=1,s=1;return ys(a.map(e=>e.kind===`context`?{...e,marker:` `,oldLine:o++,newLine:s++}:e.kind===`remove`?{...e,marker:`-`,oldLine:o++,newLine:null}:{...e,marker:`+`,oldLine:null,newLine:s++}),Math.max(0,Math.floor(n)))}function fs(e){return e===null?[]:e.split(`
1207
+ `)}function ps(e,t,n,r,i,a,o){for(;t<n&&i<a&&e[t]===r[i];)o.push({kind:`context`,text:e[t]}),t+=1,i+=1;let s=0;for(;t<n-s&&i<a-s&&e[n-s-1]===r[a-s-1];)s+=1;let c=n-s,l=a-s;if(t===c)for(let e=i;e<l;e+=1)o.push({kind:`add`,text:r[e]});else if(i===l)for(let n=t;n<c;n+=1)o.push({kind:`remove`,text:e[n]});else if((c-t)*(l-i)<=ls)gs(e,t,c,r,i,l,o);else{let n=_s(e,t,c,r,i,l);if(n.length===0){if(!ms(e,t,c,r,i,l,o)){for(let n=t;n<c;n+=1)o.push({kind:`remove`,text:e[n]});for(let e=i;e<l;e+=1)o.push({kind:`add`,text:r[e]})}}else{let a=t,s=i;for(let t of n)ps(e,a,t.before,r,s,t.after,o),o.push({kind:`context`,text:e[t.before]}),a=t.before+1,s=t.after+1;ps(e,a,c,r,s,l,o)}}for(let t=s;t>0;--t)o.push({kind:`context`,text:e[n-t]})}function ms(e,t,n,r,i,a,o){let s=n-t,c=a-i,l=Math.min(s+c,us),u=l*2+3,d=l+1,f=new Int32Array(u);f.fill(-1),f[d+1]=0;let p=[];for(let n=0;n<=l;n+=1){p.push(f.slice());for(let a=-n;a<=n;a+=2){let l=d+a,u=a===-n||a!==n&&f[l-1]<f[l+1]?f[l+1]:f[l-1]+1;if(u<0)continue;let m=u-a;for(;u<s&&m<c&&e[t+u]===r[i+m];)u+=1,m+=1;if(f[l]=u,u>=s&&m>=c)return hs(e,t,r,i,s,c,p,d,o),!0}}return!1}function hs(e,t,n,r,i,a,o,s,c){let l=i,u=a,d=[];for(let i=o.length-1;i>=0;--i){let a=o[i],c=l-u,f=s+c,p=c===-i||c!==i&&a[f-1]<a[f+1]?c+1:c-1,m=a[s+p],h=m-p;for(;l>m&&u>h;)d.push({kind:`context`,text:e[t+l-1]}),--l,--u;if(i===0)break;l===m?(d.push({kind:`add`,text:n[r+u-1]}),--u):(d.push({kind:`remove`,text:e[t+l-1]}),--l)}c.push(...d.reverse())}function gs(e,t,n,r,i,a,o){let s=n-t,c=a-i,l=c+1,u=new Uint32Array((s+1)*l);for(let n=s-1;n>=0;--n)for(let a=c-1;a>=0;--a){let o=n*l+a;u[o]=e[t+n]===r[i+a]?u[(n+1)*l+a+1]+1:Math.max(u[(n+1)*l+a],u[n*l+a+1])}let d=0,f=0;for(;d<s||f<c;)d<s&&f<c&&e[t+d]===r[i+f]?(o.push({kind:`context`,text:e[t+d]}),d+=1,f+=1):d<s&&(f===c||u[(d+1)*l+f]>=u[d*l+f+1])?(o.push({kind:`remove`,text:e[t+d]}),d+=1):(o.push({kind:`add`,text:r[i+f]}),f+=1)}function _s(e,t,n,r,i,a){let o=vs(e,t,n),s=vs(r,i,a),c=[...o].filter(e=>e[1]>=0&&(s.get(e[0])??-1)>=0).map(([e,t])=>({before:t,after:s.get(e)})).sort((e,t)=>e.before-t.before);if(c.length<2)return c;let l=[],u=new Int32Array(c.length).fill(-1);for(let e=0;e<c.length;e+=1){let t=0,n=l.length;for(;t<n;){let r=t+n>>>1;c[l[r]].after<c[e].after?t=r+1:n=r}t>0&&(u[e]=l[t-1]),l[t]=e}let d=[],f=l.at(-1)??-1;for(;f>=0;)d.push(c[f]),f=u[f];return d.reverse()}function vs(e,t,n){let r=new Map;for(let i=t;i<n;i+=1){let t=e[i];r.set(t,r.has(t)?-1:i)}return r}function ys(e,t){if(e.every(({kind:e})=>e===`context`))return[...e];let n=[];for(let r=0;r<e.length;){if(e[r].kind!==`context`){n.push(e[r]),r+=1;continue}let i=r+1;for(;i<e.length&&e[i].kind===`context`;)i+=1;let a=r===0,o=i===e.length,s=a?0:Math.min(t,i-r),c=o?0:Math.min(t,i-r-s),l=i-r-s-c;for(let t=r;t<r+s;t+=1)n.push(e[t]);l>0&&n.push({kind:`skip`,count:l});for(let t=i-c;t<i;t+=1)n.push(e[t]);r=i}return n}var bs=(0,l.memo)(function({before:e,after:t,label:n}){let r=(0,l.useMemo)(()=>ds(e,t),[e,t]);return(0,b.jsxs)(`div`,{className:`unified-diff`,role:`table`,"aria-label":n,children:[(0,b.jsxs)(`div`,{className:`visually-hidden`,role:`row`,children:[(0,b.jsx)(`span`,{role:`columnheader`,children:v(`原文件行号`)}),(0,b.jsx)(`span`,{role:`columnheader`,children:v(`新文件行号`)}),(0,b.jsx)(`span`,{role:`columnheader`,children:v(`改动标记`)}),(0,b.jsx)(`span`,{role:`columnheader`,children:v(`行内容`)})]}),r.map((e,t)=>e.kind===`skip`?(0,b.jsxs)(`div`,{className:`unified-diff-skip`,role:`row`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`···`}),(0,b.jsx)(`span`,{role:`cell`,"aria-colspan":4,children:v(`{count} 行未变化`,{count:e.count})})]},`skip-${t}`):(0,b.jsxs)(`div`,{className:`unified-diff-line unified-diff-${e.kind}`,role:`row`,children:[(0,b.jsx)(`span`,{className:`unified-diff-line-number`,role:`cell`,"aria-label":e.oldLine===null?v(`原文件无对应行`):v(`原文件第 {line} 行`,{line:e.oldLine}),children:e.oldLine??``}),(0,b.jsx)(`span`,{className:`unified-diff-line-number`,role:`cell`,"aria-label":e.newLine===null?v(`新文件无对应行`):v(`新文件第 {line} 行`,{line:e.newLine}),children:e.newLine??``}),(0,b.jsxs)(`span`,{className:`unified-diff-marker`,role:`cell`,children:[(0,b.jsx)(`span`,{className:`visually-hidden`,children:e.kind===`remove`?v(`删除行`):e.kind===`add`?v(`新增行`):v(`未变行`)}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:e.marker})]}),(0,b.jsx)(`code`,{role:`cell`,children:e.text.length===0?` `:e.text})]},`${e.kind}-${e.oldLine??``}-${e.newLine??``}-${t}`))]})});function xs({target:e=`content-package`,packageName:t,modelConfigured:n,hasUnsavedFileDraft:r,loading:i,view:a,history:o,latestSessionId:s,notice:c,requestFailure:u,now:d,contentEditor:f,onSend:p,onPreview:m,onCancel:h,onFreshContext:g,onSelectSession:_,onDeleteSession:y,onRollbackFile:x,onConfigureModel:S,onBack:C,showWorkspaceBack:w=!0,onCreateWorld:T,onNavigationLockChange:E,revisionActions:D}){let[O,k]=(0,l.useState)(``),[ee,A]=(0,l.useState)(!1),[te,j]=(0,l.useState)(!1),[M,ne]=(0,l.useState)(!1),[N,P]=(0,l.useState)(`preview`),[re,ie]=(0,l.useState)(f.selectedPath??``),[ae,oe]=(0,l.useState)(null),[F,I]=(0,l.useState)(null),se=(0,l.useRef)(null),ce=a?.runStatus===`running`||ee,le=F!==null,L=ce||le;(0,l.useEffect)(()=>(E?.(L||r||i),()=>E?.(!1)),[E,L,r,i]);let ue=a===null,de=a!==null&&s!==null&&a.sessionId!==s,fe=i||L||!n||r,pe=i||L||r,R=e===`world-revision`,me=D===void 0?void 0:new Set(D.changes.map(({changeSetId:e})=>e)),he=Za(!fe&&O.trim().length>0,async()=>{let e=O;if(!(fe||e.trim().length===0)){A(!0),k(``),ne(!1);try{await p(e)}catch{k(t=>t.length===0?e:t)}finally{A(!1)}}}),ge=e=>{e===`edit`&&L||(P(e),ne(!0),j(!1))},_e=()=>{for(let e of se.current?.querySelectorAll(`details[open]`)??[])e.removeAttribute(`open`)},ve=async e=>{if(!(e.runStatus===`running`||ae!==null||!globalThis.confirm(v(R?`删除对话“{title}”?只会删除对话记录;修订工作树中的改动不会回滚。此操作无法撤销。`:`删除对话“{title}”?只会删除这份对话记录;已经写入内容包当前树的改动不会回滚。此操作无法撤销。`,{title:e.excerpt||v(`未命名对话`)})))){oe(e.sessionId);try{await y(e.sessionId)}catch{}finally{oe(null)}}},ye=async(e,t)=>{if(!(a===null&&!R||pe)){j(!1),ne(!1),I({changeSetId:e,path:t});try{await x(a?.sessionId??``,e,t)}catch{}finally{I(null)}}};return(0,b.jsx)(`main`,{className:`setting-reader-page`,"aria-labelledby":`setting-improvement-title`,children:(0,b.jsxs)(`div`,{className:`setting-reader-shell`,children:[(0,b.jsxs)(`nav`,{className:`world-floating-chrome world-floating-chrome-left setting-floating-chrome`,"aria-label":v(R?`世界修订导航`:`设定完善导航`),children:[(R||w)&&(0,b.jsx)(`button`,{type:`button`,disabled:L||r,onClick:C,"aria-label":v(R?`返回游玩`:`返回工作区`),children:`←`}),(0,b.jsx)(`button`,{type:`button`,className:te?`is-current`:``,"aria-pressed":te,onClick:()=>{j(e=>!e),ne(!1)},children:v(`历史`)})]}),(0,b.jsxs)(`h1`,{id:`setting-improvement-title`,className:`world-floating-title setting-floating-title`,title:t,children:[t,` ·`,` `,v(R?`世界修订`:`AI 设定完善`)]}),(0,b.jsxs)(`nav`,{className:`world-floating-chrome world-floating-chrome-right setting-floating-chrome`,"aria-label":v(R?`世界修订工具`:`设定完善工具`),children:[!R&&T!==void 0&&(0,b.jsx)(`button`,{type:`button`,className:`setting-create-world`,disabled:i||L||r||f.status!==`usable`,onClick:T,children:v(`创建世界`)}),(0,b.jsx)(`button`,{type:`button`,className:M&&N===`preview`?`is-current`:``,onClick:()=>ge(`preview`),children:v(`文件`)}),(0,b.jsx)(`button`,{type:`button`,className:M&&N===`edit`?`is-current`:``,disabled:L,onClick:()=>ge(`edit`),children:v(`编辑`)}),(0,b.jsx)(`button`,{type:`button`,onClick:_e,children:v(`全部收起`)}),(0,b.jsx)(`button`,{type:`button`,disabled:L,onClick:g,children:v(`全新上下文`)}),D===void 0?null:(0,b.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:i||L||r||D.active===!1,onClick:()=>void D.onDiscard(),children:v(`放弃`)}),D===void 0?null:(0,b.jsx)(`button`,{type:`button`,disabled:L||r||!D.canApply||D.applying,onClick:()=>void D.onApply(),children:D.applying?v(`正在应用…`):v(`应用并解锁`)})]}),(0,b.jsx)(`section`,{ref:se,className:`setting-reader-scroll`,"aria-label":v(R?`世界修订对话`:`设定完善对话`),children:(0,b.jsxs)(`article`,{className:`setting-story-column`,"aria-live":`polite`,"aria-busy":L,children:[(a===null||a.turns.length===0)&&(0,b.jsxs)(`header`,{className:`setting-conversation-intro`,children:[(0,b.jsx)(`h2`,{children:v(R?`手动编辑和 AI 共用一份修订`:`和 AI 边聊边改`)}),(0,b.jsx)(`p`,{children:v(R?`state 和 control 已锁定到这份工作树;可逐次回滚,应用或放弃后才会解锁游玩。`:`成功的工具改动直接写入内容包当前树;需要核对或手动修改时,从右侧打开文件。`)})]}),c.length===0?null:(0,b.jsx)(`p`,{className:`setting-workspace-feedback`,role:`status`,children:c}),n?null:(0,b.jsxs)(`section`,{className:`setting-improvement-blocker`,role:`status`,children:[(0,b.jsx)(`p`,{children:v(R?`先配置并启用模型,才能让 AI 参与或应用世界修订;手动编辑和放弃仍然可用。`:`先配置并启用模型,才能开始设定完善对话。`)}),(0,b.jsx)(`button`,{type:`button`,disabled:r,onClick:S,children:v(`配置模型`)})]}),r?(0,b.jsx)(`p`,{className:`setting-improvement-warning`,role:`status`,children:v(`请先保存或放弃文件编辑中的未保存修改。`)}):null,(0,b.jsx)(`p`,{className:`setting-current-tree-notice`,role:`note`,children:v(R?`所有绿色新增和红色删除都只在锁定工作树中;“应用并解锁”才会提交世界,关闭页面不会丢失修订。`:`这里没有隔离草稿或应用步骤:每个已完成工具响应的绿色新增和红色删除都已经生效。`)}),D===void 0?null:(0,b.jsx)(`div`,{className:`setting-history-review-banner`,role:`status`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`世界游玩已锁定`)}),(0,b.jsx)(`p`,{children:v(`当前累计改动 {count} 个文件。可以继续聊天、手动编辑或按文件回滚。`,{count:D.changedFileCount})})]})}),D===void 0||D.changes.length===0?null:(0,b.jsxs)(`details`,{className:`setting-turn-trace`,open:!0,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{children:v(`修订记录`)}),(0,b.jsx)(`small`,{children:v(`{count} 次修改`,{count:D.changes.length})})]}),(0,b.jsx)(`div`,{className:`setting-turn-trace-exchanges`,children:[...D.changes].reverse().map(e=>(0,b.jsxs)(`section`,{className:`setting-conversation-trace`,children:[(0,b.jsxs)(`header`,{className:`section-heading-row`,children:[(0,b.jsx)(`strong`,{children:e.source===`manual`?v(`手动编辑`):e.source===`ai`?v(`AI 修改`):v(`回滚`)}),(0,b.jsx)(`small`,{children:Ns(e.createdAt)})]}),(0,b.jsx)(Ds,{changes:e.changes,heading:v(`这次修改的完整差异`),rollback:{changeSetId:e.changeSetId,currentFiles:f.files,disabled:pe,rollingBackFile:F,onRollbackFile:ye}})]},e.changeSetId))})]}),D===void 0?null:(0,b.jsx)(Os,{epochs:D.sealedEpochs}),ue&&o.length>0?(0,b.jsx)(`div`,{className:`setting-history-review-banner`,role:`status`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`下一条消息将开启全新上下文`)}),(0,b.jsx)(`p`,{children:v(R?`新对话会从当前修订工作树开始;原有对话仍保留在历史中。`:`新对话会从内容包当前树重新编译;原有对话仍保留在历史中。`)})]})}):de?(0,b.jsx)(`div`,{className:`setting-history-review-banner`,role:`status`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`正在继续历史对话`)}),(0,b.jsx)(`p`,{children:v(R?`下一条消息会追加到原 Provider 上下文;若修订 epoch 已变化,Runtime 会要求 AI 重新读取。`:`下一条消息会追加到这段历史的原 Provider 上下文;写入仍以此刻的内容包当前树为准。`)})]})}):null,(0,b.jsx)(Ya,{requests:a?.requestPreviews??[],...m===void 0?{}:{onPreview:m}},`${t}:${a?.sessionId??`fresh`}:${a?.messages.length??0}`),(0,b.jsxs)(`div`,{className:`setting-conversation-messages`,children:[i?(0,b.jsx)(`p`,{className:`setting-conversation-empty`,children:v(R?`正在恢复世界修订…`:`正在恢复设定完善对话…`)}):a===null||a.turns.length===0?(0,b.jsxs)(`div`,{className:`setting-conversation-empty`,children:[(0,b.jsx)(`p`,{children:v(`直接说你现在想做什么。`)}),(0,b.jsx)(`p`,{children:v(R?`例如:先检查人物关系是否自洽;或者把当前地点改成雨夜码头,并同步控制规则。`:`例如:先帮我梳理人物关系;或者直接把开场改成雨夜码头,并同步当前情境。`)})]}):a.turns.map(e=>(0,b.jsx)(ws,{turn:e,currentFiles:f.files,rollbackDisabled:pe,rollbackableChangeSetIds:me,rollingBackFile:F,onRollbackFile:ye},e.id)),ce?(0,b.jsx)(Ms,{view:a,now:d}):null,a?.legacyDraft!==null&&a?.legacyDraft!==void 0?(0,b.jsx)(js,{legacy:a.legacyDraft}):null,a?.lastFailure!==null&&a?.lastFailure!==void 0?(0,b.jsxs)(`div`,{className:`setting-conversation-failure`,role:`alert`,children:[(0,b.jsx)(`strong`,{children:v(`上一次操作未完成`)}),(0,b.jsx)(`p`,{children:a.lastFailure}),(0,b.jsx)(`p`,{children:v(`完整对话和已经结算的当前树改动都已保留,可以直接继续说。`)})]}):null,u===null?null:(0,b.jsx)(`div`,{className:`setting-conversation-failure`,role:`alert`,children:u}),a===null?null:(0,b.jsx)(os,{usage:a.usage})]})]})}),(0,b.jsxs)(`footer`,{className:`setting-conversation-composer`,children:[(0,b.jsx)(`label`,{htmlFor:`setting-conversation-input`,children:v(ue?`用全新上下文给 AI 发消息`:`继续这段对话`)}),(0,b.jsxs)(`div`,{className:`setting-conversation-composer-row`,children:[(0,b.jsx)(`textarea`,{id:`setting-conversation-input`,rows:2,value:O,disabled:fe,placeholder:v(R?`可以讨论、要求它检查状态,也可以直接让它修改当前世界修订。`:`可以讨论、要求它检查某份设定,也可以直接让它修改内容包。`),onChange:e=>k(e.target.value),onKeyDown:he.onKeyDown}),ce&&a!==null?(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>void h(),children:v(`停止回复`)}):(0,b.jsx)(`button`,{type:`button`,disabled:fe||O.trim().length===0,onClick:()=>void he.submit(),children:v(`发送`)})]}),(0,b.jsx)(`span`,{className:`field-note`,children:v(`Enter 发送,Shift + Enter 换行`)})]}),(0,b.jsx)(`button`,{type:`button`,className:te||M?`setting-panel-scrim is-visible`:`setting-panel-scrim`,"aria-label":v(`收起侧栏`),"aria-hidden":!te&&!M,tabIndex:te||M?0:-1,onClick:()=>{j(!1),ne(!1)}}),(0,b.jsxs)(`aside`,{className:te?`setting-overlay-rail setting-overlay-rail-left is-open`:`setting-overlay-rail setting-overlay-rail-left`,"aria-hidden":!te,"aria-label":v(R?`世界修订对话历史`:`设定完善对话历史`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`历史`)}),(0,b.jsx)(`span`,{className:`panel-count`,children:v(`{count} 次对话`,{count:o.length})})]}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`收起对话历史`),onClick:()=>j(!1),children:`×`})]}),(0,b.jsx)(`div`,{className:`setting-overlay-rail-body`,children:(0,b.jsx)(Ss,{target:e,history:o,latestSessionId:s,selectedSessionId:a?.sessionId??null,loading:i||le,deletingSessionId:ae,onSelectSession:async e=>{await _(e),j(!1)},onDeleteSession:ve})})]}),(0,b.jsxs)(`aside`,{className:`setting-overlay-rail setting-overlay-rail-right ${N===`edit`?`is-editing`:``} ${M?`is-open`:``}`,"aria-hidden":!M,"aria-label":v(N===`edit`?R?`世界修订文件编辑`:`内容包文件编辑`:R?`世界修订文件预览`:`内容包文件预览`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`div`,{children:(0,b.jsx)(`strong`,{children:v(N===`edit`?`编辑文件`:`预览文件`)})}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`收起文件面板`),onClick:()=>ne(!1),children:`×`})]}),(0,b.jsxs)(`nav`,{"aria-label":v(R?`世界修订文件视图`:`内容包文件视图`),children:[(0,b.jsx)(`button`,{type:`button`,className:N===`preview`?`is-current`:``,onClick:()=>P(`preview`),children:v(`预览`)}),(0,b.jsx)(`button`,{type:`button`,className:N===`edit`?`is-current`:``,disabled:L,onClick:()=>P(`edit`),children:v(`编辑`)})]}),(0,b.jsx)(`div`,{className:`setting-overlay-rail-body`,children:N===`preview`?(0,b.jsx)(Cs,{target:e,files:f.files,dirty:f.dirty,selectedPath:re,onSelect:ie,onEdit:()=>P(`edit`),editDisabled:L}):(0,b.jsx)(is,{...f,selectedPath:re,onSelectedPathChange:ie,embedded:!0})})]})]})})}function Ss({target:e,history:t,latestSessionId:n,selectedSessionId:r,loading:i,deletingSessionId:a,onSelectSession:o,onDeleteSession:s}){let c=e===`world-revision`;return(0,b.jsxs)(`section`,{className:`setting-conversation-history`,"aria-labelledby":`setting-conversation-history-title`,children:[(0,b.jsx)(`h2`,{id:`setting-conversation-history-title`,className:`visually-hidden`,children:v(`对话历史`)}),t.length===0?(0,b.jsx)(`p`,{className:`field-note`,children:v(c?`开始后,对话、Provider 返回内容和修订差异会保留在这里。`:`开始后,对话、Provider 返回内容和已生效差异会保留在这里。`)}):(0,b.jsx)(`ol`,{"aria-label":v(c?`世界修订对话历史`:`设定完善对话历史`),children:t.map(e=>{let t=e.sessionId===r,c=e.sessionId===a;return(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:t?`setting-history-select is-selected`:`setting-history-select`,"aria-pressed":t,disabled:i||c,onClick:()=>void o(e.sessionId),children:[(0,b.jsxs)(`span`,{className:`setting-history-item-main`,children:[(0,b.jsx)(`strong`,{children:e.excerpt||v(`未命名对话`)}),(0,b.jsx)(`small`,{children:Ns(e.createdAt)})]}),(0,b.jsx)(`span`,{className:`setting-history-status is-${e.runStatus}`,children:e.runStatus===`running`?v(`回复中`):e.sessionId===r?v(`当前所选`):e.sessionId===n?v(`最近`):v(`可继续`)}),(0,b.jsx)(`small`,{className:`setting-history-counts`,children:v(`{turns} 轮对话 · {tools} 次工具 · {files} 个文件`,{turns:e.turnCount,tools:e.toolCallCount,files:e.changedFileCount})})]}),(0,b.jsx)(`button`,{type:`button`,className:`setting-history-delete`,"aria-label":v(`删除对话:{title}`,{title:e.excerpt||v(`未命名对话`)}),disabled:i||a!==null||e.runStatus===`running`,onClick:()=>void s(e),children:c?`…`:v(`删除`)})]},e.sessionId)})})]})}function Cs({target:e,files:t,dirty:n,selectedPath:r,onSelect:i,onEdit:a,editDisabled:o}){let s=e===`world-revision`,[c,u]=(0,l.useState)(``),d=(0,l.useMemo)(()=>[...t].sort((e,t)=>e.path.localeCompare(t.path)),[t]),f=d.find(({path:e})=>e===r)??d.find(({path:e})=>e===`opening.md`)??d[0],p=c.trim().toLocaleLowerCase(`zh-CN`),m=p.length===0?d:d.filter(({path:e})=>e.toLocaleLowerCase(`zh-CN`).includes(p));return(0,b.jsxs)(`div`,{className:`setting-content-preview`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(s?`世界修订工作树`:`内容包当前树`)}),(0,b.jsx)(`small`,{children:v(n?`正在预览未保存的文件草稿`:s?`正在预览已保存的修订工作树`:`正在预览已保存的当前树`)})]}),(0,b.jsx)(`span`,{children:v(`{count} 份文件`,{count:t.length})})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{children:v(`筛选文件`)}),(0,b.jsx)(`input`,{type:`search`,value:c,placeholder:v(`人物、地点或文件名`),onChange:e=>u(e.currentTarget.value)})]}),(0,b.jsx)(`nav`,{"aria-label":v(s?`世界修订文件树`:`内容包文件树`),children:m.length===0?(0,b.jsx)(`p`,{children:v(`没有匹配的文件。`)}):m.map(e=>(0,b.jsx)(`button`,{type:`button`,className:e.path===f?.path?`is-current`:``,"aria-pressed":e.path===f?.path,onClick:()=>i(e.path),children:(0,b.jsx)(`code`,{children:e.path})},e.path))}),f===void 0?(0,b.jsxs)(`div`,{className:`setting-content-preview-empty`,children:[(0,b.jsx)(`p`,{children:v(s?`当前修订工作树还没有文件。`:`当前内容包还没有文件。`)}),(0,b.jsx)(`button`,{type:`button`,disabled:o,onClick:a,children:v(`新建第一份文件`)})]}):(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`code`,{children:f.path}),(0,b.jsx)(`button`,{type:`button`,disabled:o,onClick:a,children:v(`编辑这份文件`)})]}),f.encoding===`base64`?(0,b.jsx)(`p`,{children:v(`二进制资源不在文本预览中展开。`)}):(0,b.jsx)(`pre`,{children:f.contents})]})]})}function ws({turn:e,currentFiles:t,rollbackDisabled:n,rollbackableChangeSetIds:r,rollingBackFile:i,onRollbackFile:a}){let o=e.exchanges.filter(Ts),s=o.reduce((e,t)=>e+t.toolCalls.length+ +!!t.reasoning?.length+ +(t.toolCalls.length>0&&t.text.length>0),0);return(0,b.jsxs)(`section`,{className:`setting-conversation-turn`,children:[(0,b.jsxs)(`article`,{className:`setting-conversation-message setting-conversation-user`,children:[(0,b.jsx)(`span`,{className:`setting-conversation-role`,children:v(`你`)}),(0,b.jsx)(`p`,{children:e.user.text})]}),e.exchanges.map(e=>e.toolCalls.length===0&&e.text.length>0?(0,b.jsxs)(`article`,{className:`setting-conversation-message setting-conversation-assistant`,children:[(0,b.jsx)(`span`,{className:`setting-conversation-role`,children:v(`AI`)}),(0,b.jsx)(`p`,{children:e.text})]},`text:${e.id}`):null),o.length===0?null:(0,b.jsxs)(`details`,{className:`setting-turn-trace`,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{children:v(`本段调用详情`)}),(0,b.jsx)(`small`,{children:v(`{count} 项记录`,{count:s})})]}),(0,b.jsx)(`div`,{className:`setting-turn-trace-exchanges`,children:o.map(e=>(0,b.jsx)(Es,{exchange:e,currentFiles:t,rollbackDisabled:n,rollbackableChangeSetIds:r,rollingBackFile:i,onRollbackFile:a},e.id))})]})]})}function Ts(e){return(e.reasoning?.length??0)>0||e.toolCalls.length>0}function Es({exchange:e,currentFiles:t,rollbackDisabled:n,rollbackableChangeSetIds:r,rollingBackFile:i,onRollbackFile:a}){return(0,b.jsxs)(`details`,{className:`setting-conversation-trace`,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`strong`,{children:v(`第 {exchange} 次模型交换`,{exchange:e.exchange})}),(0,b.jsx)(`span`,{children:v(`{count} 次工具调用`,{count:e.toolCalls.length})})]}),(0,b.jsxs)(`div`,{className:`setting-conversation-trace-body`,children:[e.reasoning===void 0||e.reasoning.length===0?null:(0,b.jsxs)(`details`,{className:`setting-exchange-reasoning`,children:[(0,b.jsx)(`summary`,{children:v(`Provider 返回推理(不等同隐藏思维链)`)}),(0,b.jsx)(`pre`,{children:e.reasoning})]}),e.toolCalls.length>0&&e.text.length>0?(0,b.jsxs)(`details`,{className:`setting-exchange-step-text`,children:[(0,b.jsx)(`summary`,{children:v(`查看工具步骤文本(未进入最终回复)`)}),(0,b.jsx)(`p`,{children:e.text})]}):null,e.toolCalls.map(e=>(0,b.jsxs)(`details`,{className:`setting-exchange-tool ${e.result?.isError===!0?`is-error`:`is-ok`}`,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`strong`,{children:v(`调用 {tool}`,{tool:e.name})}),(0,b.jsx)(`span`,{children:e.result===null?v(`等待 Runtime 结果`):e.result.isError?v(`拒绝/失败`):e.result.changes.length>0?v(`当时生效 · {count} 个文件`,{count:e.result.changes.length}):v(`成功`)})]}),(0,b.jsx)(`h5`,{children:v(`工具参数`)}),(0,b.jsx)(`pre`,{children:Ps(e.arguments)}),e.result===null?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h5`,{children:v(`Runtime 工具结果`)}),(0,b.jsx)(`pre`,{children:e.result.markdown}),(0,b.jsx)(Ds,{changes:e.result.changes,rollback:e.result.changeSetId===null||r!==void 0&&!r.has(e.result.changeSetId)?void 0:{changeSetId:e.result.changeSetId,currentFiles:t,disabled:n,rollingBackFile:i,onRollbackFile:a}})]})]},e.callId))]})]})}function Ds({changes:e,heading:t=v(`当时已生效差异`),rollback:n}){return e.length===0?null:(0,b.jsxs)(`section`,{className:`setting-accepted-changes`,"aria-label":t,children:[(0,b.jsx)(`h5`,{children:t}),e.map(e=>(0,b.jsxs)(`details`,{className:`setting-change-diff`,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{className:`setting-diff-kind setting-diff-${e.kind}`,children:e.kind===`create`?v(`新增`):e.kind===`delete`?v(`删除`):v(`修改`)}),(0,b.jsx)(`code`,{children:e.path})]}),(0,b.jsx)(bs,{before:e.before,after:e.after,label:v(`{path} 的完整差异`,{path:e.path})}),n===void 0?null:(0,b.jsx)(ks,{changeSetId:n.changeSetId,change:e,currentFiles:n.currentFiles,disabled:n.disabled,rolling:n.rollingBackFile?.changeSetId===n.changeSetId&&n.rollingBackFile.path===e.path,onRollback:n.onRollbackFile})]},`${e.kind}-${e.path}`))]})}function Os({epochs:e}){return e.length===0?null:(0,b.jsxs)(`details`,{className:`setting-turn-trace`,children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{children:v(`已封存修订`)}),(0,b.jsx)(`small`,{children:v(`{count} 次记录`,{count:e.length})})]}),(0,b.jsx)(`div`,{className:`setting-turn-trace-exchanges`,children:e.map(e=>(0,b.jsxs)(`details`,{className:`setting-conversation-trace`,children:[(0,b.jsxs)(`summary`,{className:`section-heading-row`,children:[(0,b.jsx)(`strong`,{children:e.lifecycle===`applied`?v(`已应用修订`):v(`已放弃修订`)}),(0,b.jsx)(`small`,{children:Ns(e.finishedAt)})]}),(0,b.jsx)(Ds,{changes:e.diff,heading:v(`封存时的完整差异`)}),e.changes.map(e=>(0,b.jsx)(Ds,{changes:e.changes,heading:`${e.source===`manual`?v(`手动编辑`):e.source===`ai`?v(`AI 修改`):v(`回滚`)} · ${Ns(e.createdAt)}`},e.changeSetId))]},e.epochId))})]})}function ks({changeSetId:e,change:t,currentFiles:n,disabled:r,rolling:i,onRollback:a}){let o=As(n,t);return(0,b.jsx)(`div`,{className:`setting-change-rollback ${o?`is-already_rolled_back`:``}`,children:o?(0,b.jsx)(`span`,{children:v(`当前文件已是修改前版本`)}):(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r,onClick:()=>void a(e,t.path),children:v(i?`正在回滚…`:`回滚这个文件`)})})}function As(e,t){let n=new Map(e.map(e=>[e.path,e])),r=t.before,i=n.get(t.path);return r===null?i===void 0:i!==void 0&&i.encoding===void 0&&i.contents===r}function js({legacy:e}){return(0,b.jsxs)(`details`,{className:`setting-legacy-draft-history`,children:[(0,b.jsx)(`summary`,{children:v(`迁移前的隔离草稿记录(仅回顾)`)}),(0,b.jsx)(`p`,{children:e.outcome===`applied`?v(`这份旧草稿在迁移前已经应用。`):e.outcome===`discarded`?v(`这份旧草稿在迁移前已经放弃。`):e.outcome===`apply_outcome_unknown`?v(`旧应用收据的结果无法确认;迁移没有改写当前树。`):v(`这份旧草稿没有自动应用;当前树保持迁移时的真实状态。`)}),(0,b.jsx)(Ds,{changes:e.changes,heading:e.outcome===`applied`?v(`迁移前已应用的差异`):e.outcome===`apply_outcome_unknown`?v(`迁移前草稿差异(结果未知)`):v(`迁移前草稿差异(未生效)`)})]})}function Ms({view:e,now:t}){let n=e?.progress,r=n?.streaming,i=r==null?null:Math.max(0,Math.round((t-r.receivedAt)/1e3)),a=r==null?0:r.reasoningChars+r.textChars+r.toolChars,o=(r?.reasoningText?.length??0)>0||(r?.toolFragment?.length??0)>0;return(0,b.jsxs)(`div`,{className:`setting-conversation-running`,role:`status`,children:[(0,b.jsx)(`span`,{className:`setting-conversation-spinner`,"aria-hidden":`true`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`AI 正在处理…`)}),(0,b.jsx)(`p`,{children:v(`第 {exchange} 次模型交换 · {tools} 次工具调用 · 已接收 {chars} 字`,{exchange:n?.exchange??0,tools:n?.toolCalls??0,chars:a})}),i!==null&&i>=90?(0,b.jsx)(`p`,{className:`setting-run-age-stalled`,children:v(`已 {seconds} 秒没有收到新片段,可以停止后继续对话。`,{seconds:i})}):null,!r?.visibleText?.length&&r?.tail.trim()?(0,b.jsx)(`p`,{children:r.tail}):null,r?.visibleText?.length?(0,b.jsxs)(`div`,{className:`setting-live-response`,children:[(0,b.jsx)(`strong`,{children:v(`正在接收的正文`)}),(0,b.jsx)(`pre`,{children:r.visibleText})]}):null,o?(0,b.jsxs)(`details`,{className:`setting-live-trace-group`,children:[(0,b.jsx)(`summary`,{children:v(`正在接收调用详情`)}),r?.reasoningText?.length?(0,b.jsxs)(`details`,{className:`setting-live-trace`,children:[(0,b.jsx)(`summary`,{children:v(`Provider 返回推理(不等同隐藏思维链)`)}),(0,b.jsx)(`pre`,{children:r.reasoningText})]}):null,r?.toolFragment?.length?(0,b.jsxs)(`details`,{className:`setting-live-trace`,children:[(0,b.jsx)(`summary`,{children:v(`正在接收的工具调用片段`)}),(0,b.jsx)(`pre`,{children:r.toolFragment})]}):null]}):null]})]})}function Ns(e){return new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}).format(e)}function Ps(e){try{return JSON.stringify(e,null,2)}catch{return v(`[参数无法序列化]`)}}function Fs({view:e,onChange:t}){let[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null),o=async(e,n)=>{r(!0),a(null);try{await t(e,n)}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},s={preset:v(`玩法预设`),package:v(`内容包`),builtin:v(`系统示例`),world:v(`世界`)},c=e=>(0,b.jsxs)(`div`,{className:e.group?`world-extension-choice world-extension-child`:`world-extension-choice`,children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.selected,disabled:n,onChange:t=>void o(e.key,t.target.checked?`on`:`off`)}),e.name]}),(0,b.jsxs)(`small`,{children:[s[e.source],` ·`,` `,e.enabled?v(`已启用`):e.selected&&e.group?v(`随组暂停`):v(`已关闭`)]}),(0,b.jsx)(`button`,{type:`button`,disabled:n||!e.overridden,"aria-label":`${v(`恢复默认`)}:${e.name}`,onClick:()=>void o(e.key,`default`),children:v(`恢复默认`)})]},e.key);return(0,b.jsxs)(`details`,{className:`world-extension-menu`,children:[(0,b.jsx)(`summary`,{children:v(`世界扩展`)}),(0,b.jsxs)(`div`,{className:`world-extension-options`,children:[(0,b.jsx)(`p`,{children:v(`选择仅用于当前世界。后置请求重新开启后,从下一次正常发送生效;界面显示直接读取当前字段。`)}),(0,b.jsxs)(`fieldset`,{children:[(0,b.jsx)(`legend`,{children:v(`后置请求`)}),e.items.filter(e=>e.kind===`request`||e.kind===`group`).map(c)]}),(0,b.jsxs)(`fieldset`,{children:[(0,b.jsx)(`legend`,{children:v(`界面显示(不调用模型)`)}),e.items.filter(e=>e.kind===`panel`||e.kind===`view`).map(c)]}),i===null?null:(0,b.jsx)(`p`,{role:`alert`,children:i})]})]})}function Is({report:e,preview:t=!1}){if(e===void 0)return null;let n=_()===`zh-CN`,r=e.logical,i=e.encoding,a=n?{same:`相同`,different:`不同`,absent:`均未设置`,unavailable:`缺少对照`}:{same:`Same`,different:`Different`,absent:`Both absent`,unavailable:`Unavailable`};return(0,b.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,children:[(0,b.jsx)(`h3`,{children:t?n?`下一次发送的前缀预测`:`Next send prefix preview`:n?`相邻运行请求的实际前缀变化`:`Actual prefix changes between adjacent runs`}),(0,b.jsx)(`p`,{children:t?n?`按当前世界和配置预测;尚未包含下一条玩家输入,也没有发送此请求。`:`Predicted from current world and controls; excludes the next player input and has not been sent.`:n?`比较最近两次运行保存的实际前部;不会修改既有请求或原生对话。`:`Compares saved prefixes from the latest two runs; existing requests and native conversation remain untouched.`}),r===null?(0,b.jsx)(`p`,{children:n?`尚无相邻上下文样本。`:`No adjacent context sample yet.`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`p`,{children:[n?`逻辑文本公共前缀`:`Common logical text prefix`,`:`,` `,r.commonPrefixBytes.toLocaleString(),` UTF-8`,` `,n?`字节`:`bytes`,` / `,r.currentBytes.toLocaleString(),`.`,` `,n?`首次变化来源`:`First changed source`,`:`,` `,r.firstChangedSource??`—`]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:n?`变化来源与当前材料顺序`:`Changed sources and current material order`}),(0,b.jsx)(`ul`,{children:r.changedSources.map((e,t)=>(0,b.jsxs)(`li`,{children:[e.source,` · `,e.change,` ·`,` `,e.previousPosition??`—`,` →`,` `,e.currentPosition??`—`,` · `,e.previousBytes,` →`,` `,e.currentBytes,` bytes`]},t))}),(0,b.jsx)(`ol`,{children:r.currentOrder.map(e=>(0,b.jsxs)(`li`,{children:[e.role,` · `,e.source,` · `,e.bytes,` bytes`]},e.position))})]})]}),(0,b.jsxs)(`p`,{children:[n?`Provider 编码 JSON 的公共前缀`:`Common prefix of encoded Provider JSON`,`:`,` `,i.commonJsonPrefixBytes?.toLocaleString()??(n?`未记录完整对照`:`Comparison unavailable`),` `,i.commonJsonPrefixBytes===null?``:`bytes`,`.`,` `,n?`首次变化字段`:`First changed field`,`:`,` `,i.firstChangedPath??`—`]}),(0,b.jsxs)(`p`,{children:[n?`缓存键对照`:`Cache key comparison`,`:`,` `,a[i.cacheKey],`.`,` `,n?`逻辑文本和 JSON 字节前缀都不等于 Provider 可命中的 token 前缀;缓存分块和会话隔离仍由实际协议决定。`:`Neither logical nor JSON byte prefixes equal Provider-cacheable token prefixes. Encoding and session isolation still govern cache behavior.`]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:n?`实际内容块与缓存断点`:`Encoded content blocks and cache breakpoints`}),[{label:n?`前一请求`:`Previous request`,value:i.previous},{label:n?`后一请求`:`Current request`,value:i.current}].map(({label:e,value:t})=>typeof t==`object`&&t?(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h4`,{children:[e,` · `,t.provider]}),(0,b.jsxs)(`p`,{children:[t.jsonBytes,` JSON bytes`]}),(0,b.jsx)(`ul`,{children:t.contentBlocks.map(e=>(0,b.jsxs)(`li`,{children:[e.path,` · `,e.bytes,` bytes`]},e.path))}),(0,b.jsxs)(`p`,{children:[n?`断点`:`Breakpoints`,`:`,` `,t.cacheBreakpoints.join(`, `)||(n?`无显式断点`:`No explicit breakpoints`)]})]},e):null)]}),e.suggestions.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{children:n?`可手动尝试的顺序调整`:`Ordering changes to consider`}),(0,b.jsx)(`p`,{children:n?`以下来源本次发生变化,且排在较大的未变化材料之前。可在世界控制中把稳定材料前移;覆盖标记等 Runtime 来源需要调整相应主持框架。不会自动排序,收益需要实测。`:`These changed sources precede larger unchanged material. Consider moving stable materials earlier in world controls; Runtime coverage blocks require the corresponding host frame adjustment. Ordering stays explicit and benefits require measurement.`}),(0,b.jsx)(`ul`,{children:e.suggestions.map((e,t)=>(0,b.jsxs)(`li`,{children:[e.afterSource,` → `,e.source]},t))})]}),!t&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h4`,{children:n?`各上下文首个完成请求的 Provider usage`:`Provider usage for each context’s first completed request`}),[e.providerUsage.previous,e.providerUsage.current].map((e,t)=>(0,b.jsxs)(`p`,{children:[t===0?n?`上一上下文`:`Previous`:n?`当前上下文`:`Current`,`: cache read `,e?.cacheReadTokens??`—`,`; cache write`,` `,e?.cacheWriteTokens??`—`,`; uncached input`,` `,e?.uncachedInputTokens??`—`]},t))]}),(0,b.jsx)(`p`,{children:n?`缓存收益尚未实测。未报告的 usage 显示为“—”,不会当作零;CLIProxyAPI 的上下文隔离键不会为提高命中率而改动。`:`Cache benefit has not been measured. Unreported usage appears as ‘—’, never zero. CLIProxyAPI context isolation keys are preserved.`})]})}function Ls({documents:e,selectedPath:t,onSelect:n,onRevise:r,revisionDisabled:i=!1}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``),u=e.find(({path:e})=>e===t)??e[0],d=s.trim().toLocaleLowerCase(`zh-CN`),f=(0,l.useMemo)(()=>d.length===0?e:e.filter(e=>{let t=Ho(e);return`${t.title}\n${t.summary}\n${t.ref}\n${e.path}`.toLocaleLowerCase(`zh-CN`).includes(d)}),[e,d]);return(0,b.jsxs)(`div`,{className:`world-document-rail`,children:[(0,b.jsxs)(`div`,{className:`world-document-switcher`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`world-document-switcher-trigger`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`small`,{children:v(`选择文档`)}),(0,b.jsx)(`strong`,{children:u===void 0?v(`当前世界`):Ho(u).title})]}),(0,b.jsxs)(`span`,{children:[e.length,` `,v(`份`),` `,a?`▴`:`▾`]})]}),a?(0,b.jsxs)(`div`,{className:`world-document-menu`,children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{className:`visually-hidden`,children:v(`查找当前文档`)}),(0,b.jsx)(`input`,{autoFocus:!0,type:`search`,value:s,placeholder:v(`查找人物、地点、规则…`),onChange:e=>c(e.currentTarget.value)})]}),(0,b.jsx)(`div`,{role:`listbox`,"aria-label":v(`当前世界文档`),children:f.length===0?(0,b.jsx)(`p`,{children:v(`没有匹配的文档`)}):f.map(e=>{let t=Ho(e);return(0,b.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":u?.path===e.path,className:u?.path===e.path?`is-current`:``,onClick:()=>{n(e.path),o(!1),c(``)},children:[(0,b.jsx)(`strong`,{children:t.title}),(0,b.jsx)(`small`,{children:e.path})]},e.path)})}),(0,b.jsx)(`footer`,{children:d.length===0?v(`全部 {count} 份文档`,{count:e.length}):v(`找到 {visible} / {total} 份`,{visible:f.length,total:e.length})})]}):null]}),u===void 0?(0,b.jsx)(`p`,{className:`world-document-empty`,children:v(`当前世界没有状态文档。`)}):(0,b.jsxs)(`article`,{className:`world-document-card`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:Ho(u).title}),(0,b.jsx)(`small`,{children:Ho(u).summary})]}),(0,b.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>r(u.path),children:v(`修订`)})]}),(0,b.jsx)(`pre`,{children:u.contents})]})]})}function Rs({reading:e,loading:t,documents:n,onOpenFull:r}){if(t&&e===null)return(0,b.jsx)(`p`,{role:`status`,children:v(`正在核对 Runtime 读取记录…`)});if(e===null)return(0,b.jsx)(`p`,{children:v(`暂时无法读取上下文证据。`)});let i=Ws(e,n,`cumulative`);return(0,b.jsxs)(`div`,{className:`ai-reading-rail`,children:[e.currentContext===null?(0,b.jsxs)(`section`,{className:`ai-reading-context-card`,children:[(0,b.jsx)(`span`,{children:v(`当前没有追加上下文`)}),(0,b.jsx)(`strong`,{children:v(`下一次行动将建立全新上下文`)})]}):(0,b.jsxs)(`section`,{className:e.currentContext.stale?`ai-reading-context-card is-stale`:`ai-reading-context-card`,children:[(0,b.jsx)(`span`,{children:v(`最近一次请求材料`)}),(0,b.jsx)(`strong`,{children:e.currentContext.requestHead??e.currentContext.baselineHead}),(0,b.jsx)(`p`,{children:e.currentContext.stale?v(`当前世界已推进;这条追加上下文不能再继续。`):v(`下一次发送将采用当前预设和世界材料;原生对话保留。`)})]}),(0,b.jsx)(`ol`,{className:`ai-reading-document-list`,children:i.map(e=>(0,b.jsxs)(`li`,{className:`is-${e.tone}`,children:[(0,b.jsx)(`span`,{children:e.label}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsx)(`small`,{children:e.detail})]})]},e.path))}),(0,b.jsx)(`p`,{className:`ai-reading-caveat`,children:v(`这里只证明 Runtime 发送或返回了什么,不声称 AI 理解、记住或正确使用。`)}),(0,b.jsx)(`button`,{type:`button`,onClick:r,children:v(`展开完整读取记录`)})]})}function zs({reading:e,documents:t,onClose:n}){return(0,b.jsx)(`div`,{className:`world-dialog-scrim`,children:(0,b.jsxs)(`section`,{className:`world-workbench-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ai-reading-audit-title`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:v(`Runtime 证据`)}),(0,b.jsx)(`h2`,{id:`ai-reading-audit-title`,children:v(`AI 如何读取`)}),(0,b.jsx)(`p`,{children:v(`这里只查看上下文证据,不会开启修订或锁定世界。`)})]}),(0,b.jsx)(`button`,{type:`button`,onClick:n,"aria-label":v(`关闭`),children:`×`})]}),(0,b.jsx)(Hs,{reading:e,documents:t})]})})}function Bs({value:e,saving:t,onChange:n,onClose:r}){return(0,b.jsxs)(`aside`,{className:`world-reading-popover`,"aria-label":v(`阅读设置`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:v(`阅读设置`)}),(0,b.jsx)(`button`,{type:`button`,onClick:r,"aria-label":v(`关闭`),children:`×`})]}),(0,b.jsxs)(`div`,{className:`world-density-picker`,children:[(0,b.jsx)(`span`,{children:v(`排版密度`)}),(0,b.jsx)(`div`,{children:[[`compact`,v(`紧凑`)],[`standard`,v(`标准`)],[`relaxed`,v(`舒展`)]].map(([t,r])=>(0,b.jsx)(`button`,{type:`button`,className:e.density===t?`is-current`:``,onClick:()=>n({...e,density:t}),children:r},t))})]}),(0,b.jsx)(Vs,{label:v(`字号`),value:e.fontSize,output:e.fontSize+`px`,min:15,max:24,step:1,onChange:t=>n({...e,fontSize:t})}),(0,b.jsx)(Vs,{label:v(`行距`),value:e.lineHeight,output:e.lineHeight.toFixed(1),min:1.4,max:2.4,step:.1,onChange:t=>n({...e,lineHeight:t})}),(0,b.jsx)(Vs,{label:v(`字间距`),value:e.letterSpacing,output:e.letterSpacing.toFixed(2)+`em`,min:0,max:.12,step:.01,onChange:t=>n({...e,letterSpacing:t})}),(0,b.jsx)(Vs,{label:v(`正文宽度`),value:e.measure,output:e.measure+`rem`,min:32,max:72,step:2,onChange:t=>n({...e,measure:t})}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button world-reading-reset`,onClick:()=>n({...f}),children:v(`恢复默认`)}),(0,b.jsx)(`small`,{role:`status`,children:v(t?`正在保存…`:`阅读设置保存在本机`)})]})}function Vs({label:e,value:t,output:n,min:r,max:i,step:a,onChange:o}){return(0,b.jsxs)(`label`,{className:`world-reading-range`,children:[(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`output`,{children:n}),(0,b.jsx)(`input`,{type:`range`,"aria-label":e,value:t,min:r,max:i,step:a,onChange:e=>o(Number(e.currentTarget.value))})]})}function Hs({reading:e,documents:t}){if(e===null)return(0,b.jsx)(`div`,{className:`ai-reading-audit`,children:(0,b.jsx)(`p`,{role:`status`,children:v(`请先从右侧 AI 读取页加载 Runtime 证据。`)})});let n=Ws(e,t,`current`),r=Ws(e,t,`next`);return(0,b.jsxs)(`div`,{className:`ai-reading-audit`,children:[(0,b.jsx)(`header`,{children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:v(`AI 实际收到了哪些世界内容`)}),(0,b.jsx)(`p`,{children:v(`分别展示最近一次请求、累计当时读取和下一次候选;旧读取不代表当前字段值。`)})]})}),(0,b.jsxs)(`div`,{className:`ai-reading-flow`,children:[(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:v(`当前上下文`)}),(0,b.jsx)(`strong`,{children:e.currentContext?.requestHead??e.currentContext?.baselineHead??v(`尚未建立`)}),(0,b.jsx)(`p`,{children:v(`每次正常发送重新编译,工具往返使用本轮快照`)})]}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:v(`按需读取`)}),(0,b.jsxs)(`strong`,{children:[e.currentContext?.reads.filter(({ok:e})=>e).length??0,` `,v(`次成功记录`)]}),(0,b.jsx)(`p`,{children:v(`来自当前链已结算的 context_read`)})]}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`span`,{children:v(`下一次发送候选`)}),(0,b.jsx)(`strong`,{children:e.nextFreshContext?.head??v(`模型未配置`)}),(0,b.jsx)(`p`,{children:v(`按当前世界重新运行真实 Prompt 编译`)})]})]}),(0,b.jsx)(Is,{report:e.currentContext?.prefixDiagnostics}),(0,b.jsx)(Is,{report:e.nextFreshContext?.prefixDiagnostics,preview:!0}),(0,b.jsx)(Us,{title:v(`最近一次请求材料`),rows:n}),(0,b.jsx)(Us,{title:v(`下一次发送候选`),rows:r}),(0,b.jsx)(Us,{title:v(`累计实际读取(当时内容)`),rows:Ws(e,t,`cumulative`)}),(0,b.jsx)(ka,{report:e.nextFreshContext?.preview.compilation.maintenance}),e.currentContext?.reads.length?(0,b.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看按需读取返回的完整记录`)}),e.currentContext.reads.map(e=>(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:e.ref}),(0,b.jsx)(`p`,{children:e.ok?e.complete?v(`读取成功 · 完整文档`):v(`读取成功 · 文档片段`):v(`读取失败`)}),e.markdown===null?null:(0,b.jsx)(`pre`,{children:e.markdown})]},e.eventId))]}):null,(0,b.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看各次请求保存的提示材料`)}),e.currentContext?.promptHistory?.map(e=>(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`h3`,{children:[e.playPreset.name,` · `,e.head,` · `,e.exchange]}),e.bootstrap.logicalMessages.map((e,t)=>(0,b.jsx)(`pre`,{children:e.markdown},t))]},e.exchange))]}),(0,b.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看当前上下文的完整 Runtime 文本块`)}),e.currentContext?.bootstrap.logicalMessages.map(e=>(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:e.role}),e.blocks.map((e,t)=>(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:e.source}),(0,b.jsx)(`pre`,{children:e.markdown})]},e.source+`-`+t))]},e.role))??(0,b.jsx)(`p`,{children:v(`当前还没有冻结上下文。`)})]}),(0,b.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,b.jsx)(`summary`,{children:v(`查看下一次发送候选的完整 Prompt Preview`)}),e.nextFreshContext?.preview.compilation.logicalMessages.map(e=>(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:e.role}),(0,b.jsx)(`pre`,{children:e.markdown})]},e.role))??(0,b.jsx)(`p`,{children:v(`配置模型后才能编译下一次上下文。`)})]}),(0,b.jsx)(`p`,{className:`ai-reading-caveat`,children:v(`这些证据只能证明 Runtime 发出了哪些文本、工具返回了哪些内容;无法证明模型理解或记住。`)})]})}function Us({title:e,rows:t}){return(0,b.jsxs)(`section`,{className:`ai-reading-table`,children:[(0,b.jsx)(`h3`,{children:e}),(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`span`,{children:v(`世界内容`)}),(0,b.jsx)(`span`,{children:v(`进入方式`)}),(0,b.jsx)(`span`,{children:v(`可核验依据`)})]}),t.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{children:e.title}),(0,b.jsx)(`span`,{className:`is-${e.tone}`,children:e.label}),(0,b.jsx)(`span`,{children:e.detail})]},e.path))]})}function Ws(e,t,n){let r=n===`next`?e.nextFreshContext?.preview.compilation:e.currentContext?.bootstrap,i=n===`cumulative`?e.currentContext?.reads??[]:[];return t.map(t=>{let a=Ho(t),o=i.find(({ref:e,ok:t})=>t&&Gs(e)===a.ref);if(o!==void 0)return{path:t.path,title:a.title,label:o.locator===null?o.complete?v(`精确全文`):v(`全文片段`):o.complete?v(`精确节点`):v(`节点片段`),detail:v(`累计读取的当时内容,不代表当前字段值`),tone:o.complete?`good`:`warning`};let s=n===`cumulative`?e.currentContext?.promptHistory?.flatMap(e=>e.bootstrap.coverage)??r?.coverage:r?.coverage,c=s?.find(({readAuthorization:e})=>e?.shortRef===a.ref);return c===void 0?s?.find(({catalogEntries:e})=>e?.includes(a.ref))===void 0?{path:t.path,title:a.title,label:v(`未进入`),detail:v(n===`current`?`没有 bootstrap 注入或成功读取记录`:`下一次 Prompt Preview 未选择这份文档`),tone:`muted`}:{path:t.path,title:a.title,label:v(`标题 + 摘要`),detail:v(`材料目录;正文没有因此进入上下文`),tone:`warning`}:{path:t.path,title:a.title,label:c.complete&&c.readAuthorization?.locator===null?v(`全文`):v(`节点`),detail:v(n===`cumulative`?`累计读取的当时内容,不代表当前字段值`:n===`current`?`本次请求快照的真实覆盖`:`下一次 Prompt Preview 的真实 coverage`),tone:c.complete?`good`:`warning`}})}function Gs(e){return e.replace(/^@/u,``).split(`#/`,1)[0]??``}function Ks({packageScriptPermission:e,world:t,worldTitle:n,worldNameDraft:r,setWorldNameDraft:i,pending:a,activeStatus:o,controlFiles:s,controlDirty:c,controlPreview:l,onControlFiles:u,onResetControl:d,onRename:f,onDerive:p,onPreviewControl:m,onApplyControl:h,onClose:g,modelConfigured:_,revisionLocked:y}){return(0,b.jsx)(`div`,{className:`world-dialog-scrim`,children:(0,b.jsxs)(`section`,{className:`world-management-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`world-management-title`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{id:`world-management-title`,children:v(`世界管理`)}),(0,b.jsx)(`p`,{children:v(`管理名称、分叉、控制文件与 Runtime 诊断。`)})]}),(0,b.jsx)(`button`,{type:`button`,onClick:g,"aria-label":v(`关闭`),children:`×`})]}),(0,b.jsxs)(`div`,{className:`world-management-body`,children:[(0,b.jsxs)(`details`,{className:`world-permission-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`内容包脚本权限`)}),e]}),y?(0,b.jsx)(`p`,{className:`setting-improvement-warning`,role:`status`,children:v(`世界修订期间,分叉和控制变更已锁定;本地显示名称仍可修改。`)}):null,(0,b.jsxs)(`article`,{className:`manage-card world-name-card`,children:[(0,b.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,b.jsx)(`h3`,{children:v(`世界名称`)}),(0,b.jsx)(`p`,{children:v(`只改变工作区显示名称,不改变故事与状态。`)})]}),(0,b.jsxs)(`form`,{className:`world-name-editor`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{className:`visually-hidden`,children:v(`世界显示名称`)}),(0,b.jsx)(`input`,{maxLength:160,value:r,onChange:e=>i(e.currentTarget.value)})]}),(0,b.jsx)(`button`,{type:`submit`,disabled:a!==null||r.trim()===``||r.trim()===n,children:v(`保存名称`)})]})]}),(0,b.jsxs)(`article`,{className:`manage-card derive-card`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:v(`从当前端点创建分叉`)}),(0,b.jsx)(`p`,{children:v(`创建一个拥有独立状态与时间线的新世界。`)})]}),(0,b.jsx)(`button`,{type:`button`,disabled:a!==null||o===`running`||y,onClick:p,children:v(`创建分叉`)})]}),(0,b.jsxs)(`details`,{className:`manage-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`世界控制 · 高级编辑`)}),(0,b.jsxs)(`article`,{className:`manage-card control-card`,children:[(0,b.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,b.jsx)(`h3`,{children:v(`世界控制`)}),(0,b.jsx)(`p`,{children:v(`控制草稿必须经过真实 Prompt Preview 后整批应用。`)})]}),(0,b.jsx)(`span`,{className:`control-draft-state`,children:v(c?`有尚未预览的修改`:`当前已应用控制`)}),(0,b.jsxs)(`label`,{children:[v(`世界控制文件(JSON)`),(0,b.jsx)(`textarea`,{rows:18,value:s,disabled:y,onChange:e=>u(e.currentTarget.value)})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:a!==null||!_||y,onClick:m,children:v(`预览世界控制`)}),(0,b.jsx)(`button`,{type:`button`,disabled:a!==null||l===null||o===`running`||y,onClick:h,children:v(`整批应用世界控制`)}),c&&(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:a!==null,onClick:d,children:v(`放弃控制修改`)})]}),l===null?null:(0,b.jsxs)(`details`,{className:`technical-details`,children:[(0,b.jsx)(`summary`,{children:v(`查看真实提示词预览结果`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(l,null,2)})]})]})]}),(0,b.jsxs)(`details`,{className:`manage-disclosure`,children:[(0,b.jsx)(`summary`,{children:v(`运行详情`)}),(0,b.jsxs)(`article`,{className:`manage-card runtime-card`,children:[(0,b.jsx)(`h3`,{children:v(`运行详情`)}),(0,b.jsxs)(`dl`,{className:`runtime-summary`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`当前端点`)}),(0,b.jsx)(`dd`,{children:t.head})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`世界 ID`)}),(0,b.jsx)(`dd`,{children:t.worldId})]})]}),(0,b.jsxs)(`details`,{className:`technical-details`,children:[(0,b.jsx)(`summary`,{children:v(`查看 Runtime 原始诊断`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(t.runtime,null,2)})]})]})]})]})]})})}function qs({records:e,extensions:t=[],playerViewPanels:n=[],bridgeEvents:r={}}){return e.length===0&&t.length===0&&n.length===0?null:(0,b.jsxs)(`section`,{className:`artifact-debugger`,"data-artifact-debugger":`true`,"aria-label":v(`产物调试器`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`p`,{className:`eyebrow`,children:`EXTENSION DEBUG`}),(0,b.jsx)(`h2`,{children:v(`产物调试器`)})]}),e.some(e=>e.frontend.mount===`story`&&!(`attachment`in e))?(0,b.jsx)(`p`,{role:`note`,children:v(`旧产物没有可证明的回复归属,仅保留诊断,无法自动迁移为正文附件。`)}):null,t.length===0?null:(0,b.jsxs)(`section`,{className:`artifact-extension-statuses`,"data-artifact-extension-statuses":`true`,"data-testid":`artifact-extension-statuses`,"aria-label":v(`扩展状态`),children:[(0,b.jsx)(`h3`,{children:v(`扩展状态`)}),t.map(e=>(0,b.jsxs)(`article`,{className:`artifact-extension-status`,"data-extension-operation":e.operationId,"data-extension-status":e.status,children:[(0,b.jsx)(`strong`,{children:e.status}),(0,b.jsx)(`span`,{children:e.coreCommitted?v(`核心已提交`):v(`核心未提交`)}),(0,b.jsxs)(`span`,{children:[v(`已完成请求:`),e.completedRequests.length===0?v(`无`):e.completedRequests.join(`、`)]}),e.head===void 0?null:(0,b.jsxs)(`span`,{children:[`head:`,e.head]}),e.message===void 0?null:(0,b.jsx)(`p`,{children:e.message})]},e.operationId))]}),n.length===0?null:(0,b.jsxs)(`section`,{className:`player-view-panel-debug`,"data-player-view-panel-debug":`true`,"aria-label":v(`玩家视图面板诊断`),children:[(0,b.jsx)(`h3`,{children:v(`玩家视图面板`)}),n.map(e=>(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`strong`,{children:e.panelId}),(0,b.jsxs)(`span`,{children:[v(`已提交玩家视图投影 · head:`),e.head]}),(0,b.jsxs)(`span`,{children:[`source:`,e.source.viewId,` · current preset `,e.preset.id,`/`,e.preset.revision]}),e.diagnostics.length===0?null:(0,b.jsx)(`ul`,{children:e.diagnostics.map((e,t)=>(0,b.jsx)(`li`,{children:e.message},String(t)))}),(0,b.jsx)(`pre`,{children:Hi(e.payload,e.contentType)}),(r[`player-view:${e.panelId}`]??[]).length===0?null:(0,b.jsxs)(`details`,{children:[(0,b.jsxs)(`summary`,{children:[v(`bridge 事件(`),r[`player-view:${e.panelId}`].length,`)`]}),(0,b.jsx)(`ul`,{children:r[`player-view:${e.panelId}`].map((e,t)=>(0,b.jsx)(`li`,{children:e},`${e}-${t}`))})]})]},e.panelId))]}),e.map(e=>(0,b.jsx)(Js,{record:e,bridgeEvents:r[e.recordId]??[]},`${e.recordId}-${e.sequence}`))]})}function Js({record:e,bridgeEvents:t}){let n=Wi({payload:e.payload,contentType:e.contentType,rules:e.frontend.regex});return(0,b.jsxs)(`details`,{className:`artifact-debugger-entry`,"data-artifact-record":e.recordId,children:[(0,b.jsxs)(`summary`,{children:[e.output,` · `,e.status,` · `,e.channel,e.key===void 0?``:` / ${e.key}`]}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:v(`来源`)}),(0,b.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,b.jsx)(`dt`,{children:v(`世界端点`)}),(0,b.jsxs)(`dd`,{children:[e.parentHead,` → `,e.newHead??v(`未提交`)]}),(0,b.jsx)(`dt`,{children:v(`保存/投影`)}),(0,b.jsxs)(`dd`,{children:[e.save,` / `,e.projection]}),(0,b.jsx)(`dt`,{children:`raw bytes`}),(0,b.jsx)(`dd`,{children:e.payloadBytes}),(0,b.jsx)(`dt`,{children:`renderer revision`}),(0,b.jsx)(`dd`,{children:e.frontend.renderer?.revision??`built-in`}),(0,b.jsx)(`dt`,{children:v(`renderer 状态`)}),(0,b.jsxs)(`dd`,{children:[e.frontend.status,` / `,e.frontend.fallback,e.frontend.diagnostic===void 0?``:` · ${e.frontend.diagnostic}`]}),(0,b.jsx)(`dt`,{children:`authority`}),(0,b.jsx)(`dd`,{children:e.frontend.authority??`non_authoritative_artifact`})]}),(0,b.jsx)(`p`,{children:`raw payload`}),(0,b.jsx)(`pre`,{children:Hi(e.payload,e.contentType)}),(0,b.jsx)(`p`,{children:v(`最终内容`)}),(0,b.jsx)(`pre`,{children:n.final}),(0,b.jsx)(`p`,{children:v(`regex steps(structured_payload 以规范化 JSON 文本为输入)`)}),(0,b.jsx)(`pre`,{children:JSON.stringify(n.steps,null,2)}),t.length===0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`bridge events`}),(0,b.jsx)(`ul`,{children:t.map((e,t)=>(0,b.jsx)(`li`,{children:e},`${e}-${t}`))})]})]})}function Ys(e,t,n=[]){let r=new Set([...t.map(({source:e})=>e.viewId),...n]);return{coveredViewIds:r,views:e.views.filter(({id:e})=>!r.has(e)),diagnostics:e.diagnostics.filter(({viewId:e})=>e===void 0||!r.has(e))}}function Xs({progress:e,now:t,onCancel:n}){let r=Math.max(0,Math.round((t-e.startedAt)/1e3)),i=Math.max(0,Math.round((t-e.lastActivityAt)/1e3)),a=e.phase!==`cancelling`&&i>=90;return(0,b.jsxs)(`section`,{className:`model-run-progress play-run-progress`,role:`status`,"aria-live":`polite`,"aria-label":v(`本次模型调用进度`),children:[(0,b.jsxs)(`div`,{className:`model-run-headline`,children:[(0,b.jsx)(`strong`,{children:Qs(e.phase)}),(0,b.jsx)(`span`,{children:v(`已运行 {seconds} 秒`,{seconds:r})}),(0,b.jsx)(`span`,{className:a?`model-run-age-stalled`:void 0,children:i===0?v(`刚刚收到新数据`):v(`{seconds} 秒没有新数据`,{seconds:i})})]}),(0,b.jsxs)(`dl`,{className:`model-run-counters`,children:[(0,b.jsx)(Zs,{label:v(`返回推理`),value:e.reasoningChars}),(0,b.jsx)(Zs,{label:v(`正文`),value:e.textChars}),(0,b.jsx)(Zs,{label:v(`工具参数`),value:e.toolChars}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`工具调用`)}),(0,b.jsx)(`dd`,{children:e.toolCalls})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`Provider 派发`)}),(0,b.jsx)(`dd`,{children:e.dispatches})]})]}),e.phase===`waiting`?(0,b.jsx)(`p`,{className:`model-run-note`,children:v(`Provider 尚未返回可区分的增量;这可能是排队、模型内部思考或网络等待。`)}):null,a?(0,b.jsx)(`p`,{className:`model-run-stalled-note`,role:`note`,children:v(`已有 {seconds} 秒没有收到任何新数据,模型调用可能已经卡住;你可以继续等待或取消。`,{seconds:i})}):null,(0,b.jsx)(`div`,{className:`model-run-actions`,children:(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:e.phase===`cancelling`,onClick:n,children:e.phase===`cancelling`?v(`正在取消…`):v(`取消生成`)})})]})}function Zs({label:e,value:t}){return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsx)(`dd`,{children:v(`{count} 字`,{count:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)})})]})}function Qs(e){return v(e===`preparing`?`正在准备模型请求…`:e===`waiting`?`正在等待模型响应…`:e===`reasoning`?`思考中(正在接收 Provider 返回推理)`:e===`text`?`正在输出正文…`:e===`tool`?`正在处理工具调用…`:e===`followup`?`正在生成界面产物…`:`正在取消模型生成…`)}function $s(e,t,n=Date.now()){return{chainId:e,exchangeId:t,phase:`preparing`,startedAt:n,lastActivityAt:n,reasoningChars:0,textChars:0,toolChars:0,toolCalls:0,dispatches:0}}function ec(e,t,n){if(e?.activeInvocation!==void 0)return e.activeInvocation.exchangeId;let r=e?.events.findLast(e=>e.kind===`player`);return r===void 0?n===null?null:(t?.items.findLast(e=>e.kind===`event`&&e.chainId===n&&e.event.kind===`player`))?.event.exchangeId??null:r.exchangeId}function tc(e,t,n,r){if(n?.activeInvocation!==void 0)return structuredClone(n.activeInvocation);if(n!==null&&n.status!==`running`)return null;if(t===null)return r?.chainId===e?r:null;let i=r?.chainId===e&&r.exchangeId===t?r:null,a=i?.startedAt??Date.now(),o=n?.events.findLast(e=>e.kind===`assistant`&&e.status===`streaming`),s=i?.phase??`waiting`;return s!==`cancelling`&&(s=(o?.toolFragment?.length??0)>0?`tool`:(o?.text.length??0)>0?`text`:(o?.reasoning?.length??0)>0?`reasoning`:n?.events.at(-1)?.kind===`followup`?`followup`:n?.events.at(-1)?.kind===`tool_call`||n?.events.at(-1)?.kind===`tool_result`?`tool`:`waiting`),{chainId:e,exchangeId:t,phase:s,startedAt:a,lastActivityAt:n===null?i?.lastActivityAt??a:Math.max(i?.lastActivityAt??0,n.updatedAt),reasoningChars:Math.max(i?.reasoningChars??0,o?.reasoning?.length??0),textChars:Math.max(i?.textChars??0,o?.text.length??0),toolChars:Math.max(i?.toolChars??0,o?.toolFragment?.length??0),toolCalls:Math.max(i?.toolCalls??0,n?.events.filter(({kind:e})=>e===`tool_call`).length??0),dispatches:Math.max(i?.dispatches??0,n?.events.filter(({kind:e})=>e===`assistant`).length??0)}}function nc({client:e,worldId:t,worldTitle:n,modelConfigured:r,onBack:i,showWorkspaceBack:a=!0,onConfigureModel:o,onRenameWorld:s,onOpenWorld:c,onNavigationLockChange:u,initialReadingPreferences:d=f}){let[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),[_,y]=(0,l.useState)(0),S=(0,l.useRef)(0),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(`documents`),[k,ee]=(0,l.useState)(!1),[A,te]=(0,l.useState)(null),[j,M]=(0,l.useState)(d),[ne,N]=(0,l.useState)(!1),[P,re]=(0,l.useState)(``),[ie,ae]=(0,l.useState)(null),[F,I]=(0,l.useState)(null),[se,ce]=(0,l.useState)(null),[le,L]=(0,l.useState)(null),[ue,de]=(0,l.useState)(null),[fe,pe]=(0,l.useState)(0),R=(0,l.useRef)(null),[me,he]=(0,l.useState)(n),[ge,_e]=(0,l.useState)(n);ge!==n&&(_e(n),he(n));let[ve,ye]=(0,l.useState)(null),[be,xe]=(0,l.useState)(!1),[Se,Ce]=(0,l.useState)(!1),[we,Te]=(0,l.useState)(null),[Ee,De]=(0,l.useState)(``),[Oe,ke]=(0,l.useState)(`[]`),[Ae,je]=(0,l.useState)(!1),[Me,Ne]=(0,l.useState)(!1),[Pe,z]=(0,l.useState)(null),[Fe,B]=(0,l.useState)(null),[V,Ie]=(0,l.useState)(null),[Le,H]=(0,l.useState)([]),[Re,ze]=(0,l.useState)([]),[Be,Ve]=(0,l.useState)(!1),[He,Ue]=(0,l.useState)(!1),[We,Ge]=(0,l.useState)(null),[Ke,qe]=(0,l.useState)(``),[Je,Ye]=(0,l.useState)(!1),[Xe,Ze]=(0,l.useState)(Date.now()),Qe=(0,l.useRef)(!1),$e=(0,l.useRef)(null),et=(0,l.useRef)(0),[tt,nt]=(0,l.useState)(null),rt=(0,l.useRef)(null),[it,at]=(0,l.useState)(null),[U,ot]=(0,l.useState)(!1),[st,ct]=(0,l.useState)({}),lt=(0,l.useRef)(null),ut=(0,l.useRef)(null),dt=(0,l.useRef)(null),[ft,pt]=(0,l.useState)(72),mt=p?.head,ht=p?.worldId,gt=!gc(Re,Le);Qe.current=gt,(0,l.useEffect)(()=>(u?.(gt||Me||Ae),()=>u?.(!1)),[u,gt,Me,Ae]),(0,l.useEffect)(()=>{let n=!0;return(async()=>{try{let r=await X(e,{type:`world.read`,worldId:t});if(!n)return;Nt(r,!1)}catch(e){if(!n)return;I({kind:`error`,text:_c(e)})}finally{n&&ae(null)}})(),()=>{n=!1}},[e,t]),(0,l.useEffect)(()=>{if(p?.worldId!==t)return;let n=!0,r=p.head,i=++S.current;return Sc(e,t).then(e=>{n&&i===S.current&&e?.head===r&&g({...e,worldId:t})}),()=>{n=!1}},[e,p,t,_]);let _t=h?.worldId===t&&h.head===mt?h:null;(0,l.useEffect)(()=>{if(e.observeConversation===void 0||ht!==t)return;let n=!0,r,i,a,o=e.observeConversation({kind:`play`,id:t},async o=>{if(!n||o.kind!==`play`)return;o.extensionsRevision!==a&&(a=o.extensionsRevision,y(e=>e+1));let s=o.value;if(s===null)return;let c=JSON.stringify([s.chainId,s.parentHead,s.status,s.events.filter(e=>e.kind===`followup`).map(e=>e.id)]);if(i!==c&&(i=c,y(e=>e+1)),ye(s),L(vc(s)),s.status===`running`?(de(e=>tc(s.chainId,ec(s,null,s.chainId),s,e)),pe(Date.now())):de(null),yc({kind:`snapshot`,value:s,final:s.status!==`running`},Te),R.current!==null&&s.status!==`running`&&I({kind:`status`,text:v(`模型生成已取消。`)}),r!==`${s.parentHead}:${s.status}`){let i=await X(e,{type:`world.read`,worldId:t});if(!n)return;r=`${s.parentHead}:${s.status}`,m(i);let a=i.playTimeline;a!==void 0&&Te(e=>e===null?a:{...e,items:e.items.map(e=>e.kind===`event`?a.items.find(t=>t.kind===`event`&&t.chainId===e.chainId&&t.event.id===e.event.id)??e:e)})}},e=>{n&&e===`connected`&&(r=void 0,i=void 0,y(e=>e+1)),n&&ce(e===`connected`?null:v(e===`reconnecting`?`对话连接已断开,正在重新连接…`:`对话同步失败,请重新打开此页面。`))});return()=>{n=!1,o()}},[e,t,ht]),(0,l.useEffect)(()=>{ht!==void 0&&lt.current?.scrollIntoView?.({block:`nearest`})},[ht]),(0,l.useEffect)(()=>{if(p===null||!T&&A===null||p.state.length>0&&p.control.length>0)return;let n=!0;return(async()=>{try{let[r,i,a]=await Promise.all([X(e,{type:`world.surface.read`,worldId:t,surface:`state`}),X(e,{type:`world.surface.read`,worldId:t,surface:`control`}),X(e,{type:`world.surface.read`,worldId:t,surface:`runtime`})]);if(!n)return;m(e=>e===null?null:{...e,state:r,control:i,runtime:a}),De(e=>mc(r,e)),Me||ke(JSON.stringify(i,null,2))}catch(e){n&&I({kind:`error`,text:_c(e)})}})(),()=>{n=!1}},[e,Me,A,T,p,t]),(0,l.useEffect)(()=>{if(!T||D!==`ai-reading`||mt===void 0)return;let n=!0,r=window.setTimeout(()=>{n&&ot(!0)},0);return X(e,{type:`world.play-context.read`,worldId:t}).then(e=>{n&&at(e)}).catch(e=>{n&&I({kind:`error`,text:_c(e)})}).finally(()=>{n&&ot(!1)}),()=>{n=!1,window.clearTimeout(r)}},[e,ve?.updatedAt,T,D,mt,t]),(0,l.useEffect)(()=>{if(A!==`revision`)return;let n=!0,r=He?void 0:V?.sessionId;if(e.observeConversation===void 0)return;let i=e.observeConversation({kind:`revision`,id:t,...r===void 0?{}:{sessionId:r}},async(i,a)=>{if(i.kind!==`revision`)return;let o=i.value;try{if(!n)return;let i=o.selected;if(!He&&i!==null&&Ie(e=>e?.sessionId===i.sessionId?{...e,runStatus:i.runStatus,progress:i.progress}:e),Ze(Date.now()),!a)return;let s=await X(e,{type:`world.revision.overview`,worldId:t});if(!n)return;B(s);let c=r!==void 0&&r!==s.latest?.sessionId?await X(e,{type:`world.revision.session.read`,worldId:t,sessionId:r}):s.latest;if(!n)return;let l=rt.current;l!==null&&s.latest!==null&&s.latest.sessionId!==l.previousSessionId?(rt.current=null,Ue(!1),Ie(s.latest)):!He&&l===null&&Ie(c),!Qe.current&&s.epoch?.locked===!0&&(H(hc(s.epoch.files)),ze(hc(s.epoch.files))),m(e=>e===null?null:{...e,worldRevision:s.epoch?.locked===!0?s.epoch:null})}catch(e){if(n)throw e}},e=>{n&&nt(e===`connected`?null:v(e===`reconnecting`?`对话连接已断开,正在重新连接…`:`对话同步失败,请重新打开此页面。`))}),a=window.setInterval(()=>Ze(Date.now()),1e3);return()=>{n=!1,i(),window.clearInterval(a)}},[e,A,He,V?.sessionId,t]),(0,l.useLayoutEffect)(()=>{let e=dt.current;if(e===null)return;e.style.height=`0px`;let t=Math.min(e.scrollHeight,152);e.style.height=`${Math.max(t,24)}px`,e.style.overflowY=e.scrollHeight>152?`auto`:`hidden`},[P]),(0,l.useLayoutEffect)(()=>{let e=ut.current;if(e===null)return;let t=()=>pt(e.getBoundingClientRect().height);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[ht,A]),(0,l.useEffect)(()=>{if(F?.kind!==`status`)return;let e=window.setTimeout(()=>I(null),3200);return()=>window.clearTimeout(e)},[F]);let vt=p?.state??[],yt=Ys(_t?.playerViews??p?.playerViews??{views:[],diagnostics:[]},_t?.playerViewPanels??p?.playerViewPanels??[],_t?.suppressedPlayerViewIds??p?.suppressedPlayerViewIds??[]),bt=we?.items.flatMap(e=>e.kind===`genesis`?[{messageId:e.messageId,role:e.role,exactText:e.exactText,head:`genesis`}]:e.kind!==`event`||e.event.kind!==`player`&&e.event.kind!==`assistant`||e.event.committedHead===void 0||e.event.kind===`assistant`&&(e.event.text.length===0||dc(e.event)!==`narrative`)?[]:[{messageId:`${e.chainId}:${e.event.id}`,role:e.event.kind===`player`?`player`:`narrator`,exactText:e.event.text,head:e.event.committedHead}])??[],xt=(p?.committedMessages.length??0)>0?p.committedMessages:bt,St=ve?.status??we?.activeStatus,Ct=ve?.chainId??we?.activeChainId??null,wt=ve?.canRetry??we?.activeCanRetry??!1,Tt=Fe?.epoch?.locked===!0?Fe.epoch:p?.worldRevision??null,Et=Tt?.locked===!0,Dt=be||p!==null&&ve!==null&&ve.parentHead!==p.head,Ot=ue!==null,kt=P.trim().length>0,At=ie===null&&St!==`running`&&!Et,jt=kt&&At,Mt=At&&!Dt&&(Ct===null?kt:St===`ready`||!kt&&wt);(0,l.useEffect)(()=>{if(!Ot)return;let e=setInterval(()=>pe(Date.now()),1e3);return()=>clearInterval(e)},[Ot]);function Nt(e,t){let n=e.playCallChain,r=e.playTimeline??xc(e);m(e),t||(ke(JSON.stringify(e.control,null,2)),Ne(!1),z(null)),ye(n),Te(r),L(vc(n)),n?.status===`running`?(de(e=>tc(n.chainId,ec(n,r,n.chainId),n,e)),pe(Date.now())):de(null),De(t=>mc(e.state,t))}async function Pt(n=!0){let r=await X(e,{type:`world.read`,worldId:t});return Nt(r,n),r}async function Ft(n){if(!r)return;let i=n===`fresh`||Ct===null;if(i&&!jt||!i&&!Mt)return;let a=i?oe(`play-chain`):Ct,o=oe(`play-exchange`),s=Date.now();R.current=null,L(null),pe(s),de($s(a,o,s)),ae(n===`fresh`?`play-fresh`:`play-append`),I({kind:`status`,text:v(i?`正在从当前世界重新拼接上下文…`:kt?`正在把玩家输入追加到现有上下文…`:St===`interrupted`?`正在原样发送上次未完成的模型请求…`:`正在沿现有上下文继续生成…`)});try{let n=await X(e,i?{type:`play.chain.start`,worldId:t,chainId:a,exchangeId:o,playerText:P}:{type:`play.chain.append`,worldId:t,chainId:a,exchangeId:o,playerText:P});ye(n),i&&xe(!1),Ce(!1),kt&&re(``),await Pt(),R.current===o?(L(null),I({kind:`status`,text:v(`模型生成已取消。`)})):n.status===`interrupted`?(L(vc(n)??(n.canRetry?v(`模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。`):v(`调用链处理失败;旧请求不能重发,请使用全新上下文。`))),I(null)):(L(null),I({kind:`status`,text:v(!i&&!kt?`AI 已沿现有上下文继续生成,没有追加玩家指令。`:`调用链已返回;模型完成的叙事和世界变化已经分别提交。`)}))}catch(n){let r=await X(e,{type:`play.chain.inspect`,worldId:t}).catch(()=>null);r!==null&&(ye(r),i&&r.chainId===a&&(xe(!1),Ce(!1)),kt&&r.events.some(e=>e.kind===`player`&&e.exchangeId===o)&&re(``));let s=await X(e,{type:`play.timeline.page`,worldId:t,limit:40}).catch(()=>null);s!==null&&Te(s),R.current===o?(L(null),I({kind:`status`,text:v(`模型生成已取消。`)})):(L(vc(r)??_c(n)),I(null))}finally{R.current===o&&(R.current=null),de(e=>e?.exchangeId===o?null:e),ae(null)}}async function It(){if(ue===null||ue.phase===`cancelling`)return;let{chainId:n,exchangeId:r}=ue;R.current=r,de(e=>e?.chainId===n&&e.exchangeId===r?{...e,phase:`cancelling`}:e),I({kind:`status`,text:v(`正在取消模型生成…`)});try{(await X(e,{type:`play.chain.cancel`,worldId:t,chainId:n,exchangeId:r})).outcome===`not_running`&&(R.current===r&&(R.current=null),I({kind:`status`,text:v(`模型调用已经结束,正在刷新结果…`)}),await Pt())}catch(e){R.current===r&&(R.current=null),de(e=>e?.chainId===n&&e.exchangeId===r?{...e,phase:`waiting`}:e),I({kind:`error`,text:_c(e)})}}async function Lt(){if(we?.nextCursor!==null&&we!==null){ae(`timeline-page`);try{let n=await X(e,{type:`play.timeline.page`,worldId:t,limit:40,cursor:we.nextCursor});Te(e=>e===null?n:e.generation===n.generation?{...e,items:[...n.items,...e.items],nextCursor:n.nextCursor}:e)}catch(e){I({kind:`error`,text:_c(e)})}finally{ae(null)}}}async function Rt(){ae(`control-preview`);try{let n=JSON.parse(Oe);await e.request({type:`world.control-draft.save`,worldId:t,files:n});let r=await e.request({type:`world.control-draft.preview`,worldId:t});z(r),I({kind:`status`,text:v(`控制草稿已通过真实提示词预览;确认后才会整批应用。`)})}catch(e){z(null),I({kind:`error`,text:_c(e)})}finally{ae(null)}}async function zt(){if(Pe!==null&&St!==`running`){ae(`control-apply`);try{await e.request({type:`world.control-draft.apply`,worldId:t}),await Pt(!1),I({kind:`status`,text:v(`世界控制已整批应用。`)})}catch(e){I({kind:`error`,text:_c(e)})}finally{ae(null)}}}async function Bt(n){n!==void 0&&De(n),te(`revision`),E(!1),ee(!1),Ve(!0),Ge(null);try{let n=await X(e,{type:`world.revision.overview`,worldId:t});B(n),Ie(n.latest),Ue(n.latest===null);let[r,i]=n.epoch?.locked?[[],[]]:await Promise.all([X(e,{type:`world.surface.read`,worldId:t,surface:`state`}),X(e,{type:`world.surface.read`,worldId:t,surface:`control`})]),a=n.epoch?.locked?n.epoch.files:[...r.map(e=>({...e,path:`state/${e.path}`})),...i.map(e=>({...e,path:`control/${e.path}`}))];H(hc(a)),ze(hc(a)),m(e=>e===null?null:{...e,worldRevision:n.epoch?.locked===!0?n.epoch:null}),qe(v(n.epoch?.locked?`世界已锁定到这份修订;关闭页面也会保留工作树。`:`浏览不会锁定世界;首次编辑或发送消息后才会锁定。`))}catch(e){te(null),I({kind:`error`,text:_c(e)})}finally{Ve(!1)}}function Vt(n){H(n),!(gc(Re,n)||Tt?.locked||$e.current!==null)&&(Ve(!0),Ge(null),$e.current=(async()=>{try{let n=await X(e,{type:`world.revision.open`,worldId:t});B(n),m(e=>e===null?null:{...e,worldRevision:n.epoch?.locked?n.epoch:null}),qe(v(`世界已锁定到这份修订;关闭页面也会保留工作树。`))}catch(e){Ge(_c(e))}finally{$e.current=null,Ve(!1)}})())}async function Ht(){let n=Fe?.epoch;if(gt){if(!n?.locked){Vt(Le);return}Ve(!0),Ge(null);try{if(!gc(Re,n.files))throw Error(v(`世界已在浏览期间发生变化;请重置草稿并重新编辑。`));let r=await X(e,{type:`world.revision.files.replace`,worldId:t,epochId:n.epochId,expectedRevision:n.revision,files:Le});B(r),r.epoch!==null&&(H(hc(r.epoch.files)),ze(hc(r.epoch.files))),qe(v(`手动修改已保存到修订工作树,可以继续编辑或回滚。`))}catch(e){Ge(_c(e))}finally{Ve(!1)}}}async function Ut(n){if(gt)return;let r=et.current,i=He?null:V;i===null&&(rt.current={previousSessionId:Fe?.latest?.sessionId??null}),Ge(null),qe(``);try{let a=await X(e,{type:`world.revision.message`,worldId:t,requestId:oe(`world-revision-message`),message:n,continuation:i===null?{kind:`fresh_context`}:{kind:`continue_context`,sessionId:i.sessionId}});et.current===r&&(rt.current=null,Ue(!1),Ie(a));let o=await X(e,{type:`world.revision.overview`,worldId:t});B(o),o.epoch!==null&&!Qe.current&&(H(hc(o.epoch.files)),ze(hc(o.epoch.files)))}catch(e){throw Ge(_c(e)),e}}async function Wt(){if(V!==null)try{Ie(await X(e,{type:`world.revision.cancel`,sessionId:V.sessionId}))}catch(e){Ge(_c(e))}}async function Gt(n){let r=++et.current;rt.current=null,Ve(!0),Ge(null);try{let i=await X(e,{type:`world.revision.session.read`,worldId:t,sessionId:n});if(et.current!==r)return;Ie(i),Ue(!1)}catch(e){Ge(_c(e))}finally{Ve(!1)}}async function Kt(n){Ve(!0),Ge(null);try{let r=await X(e,{type:`world.revision.session.delete`,worldId:t,sessionId:n});B(r),V?.sessionId===n&&Ie(r.latest),Ue(r.latest===null)}catch(e){Ge(_c(e))}finally{Ve(!1)}}async function qt(n,r,i){let a=Fe?.epoch;if(!a?.locked)throw Error(`The world-revision epoch is no longer active`);Ge(null);try{let n=await X(e,{type:`world.revision.rollback`,worldId:t,epochId:a.epochId,changeSetId:r,path:i}),o=await X(e,{type:`world.revision.overview`,worldId:t});return B(o),o.epoch!==null&&(H(hc(o.epoch.files)),ze(hc(o.epoch.files))),qe(n.status===`already_rolled_back`?v(`这个文件已经是该次修改前的版本。`):v(`已回滚所选文件;其他修订保持不变。`)),n}catch(e){throw Ge(_c(e)),e}}async function Jt(){let n=Fe?.epoch;if(!(n==null||!n.locked||gt||n.diagnostics.length>0)){Ye(!0),Ge(null);try{await X(e,{type:`world.revision.apply`,worldId:t,epochId:n.epochId,expectedRevision:n.revision}),te(null),B(null),H([]),ze([]),n.diff.length>0&&xe(!0),await Pt(!1),I({kind:`status`,text:v(`世界修订已应用并解锁。再次继续原对话时,AI 会先重新读取当前世界。`)})}catch(e){Ge(_c(e))}finally{Ye(!1)}}}async function Yt(){let n=Fe?.epoch;if(!(n==null||!n.locked||!globalThis.confirm(v(`放弃这次世界修订?所有尚未应用的手动和 AI 修改都会丢失。`)))){Ye(!0),Ge(null);try{await X(e,{type:`world.revision.discard`,worldId:t,epochId:n.epochId}),te(null),B(null),H([]),ze([]),await Pt(!1),I({kind:`status`,text:v(`这次世界修订已放弃,原世界保持不变并已解锁。`)})}catch(e){Ge(_c(e))}finally{Ye(!1)}}}async function Xt(t=p?.head){if(p!==null&&t!==void 0){ae(`derive`);try{await c((await X(e,{type:`world.derive`,operationId:oe(`derive`),sourceWorldId:p.worldId,sourceHead:t})).world.worldId)}catch(e){I({kind:`error`,text:_c(e)}),ae(null)}}}async function Zt(t,n,i,a){if(p===null)return;if(i.trim().length===0){I({kind:`error`,text:v(`修改后的玩家提交不能为空。`)});return}let o=oe(`play-exchange`);ae(`revise`),I({kind:`status`,text:v(`正在当前世界中保存修改,并舍弃这条消息之后的当前时间线…`)});try{let s=await X(e,{type:`play.chain.revise-player`,operationId:oe(`revise-player`),worldId:p.worldId,chainId:t,eventId:n,replacementExchangeId:o,replacementText:i,continuation:a});if(ye(s.playCallChain),await Pt(),!r){I({kind:`status`,text:v(`修改已保存在当前世界;配置模型后点击“追加上下文”即可继续生成。`)});return}ae(`play-append`),I({kind:`status`,text:v(a===`fresh_context`?`修改已保存,正在从全新上下文继续生成…`:`修改已保存,正在从修改稿继续生成…`)});let c=await X(e,{type:`play.chain.append`,worldId:p.worldId,chainId:s.playCallChain.chainId,exchangeId:oe(`play-exchange`),playerText:``});ye(c),await Pt(),I({kind:c.status===`interrupted`?`error`:`status`,text:c.status===`interrupted`?c.canRetry?v(`修改已保存,但模型请求中断;点击“追加上下文”即可原样重发。`):v(`修改已保存,但模型请求失败;请使用全新上下文继续。`):v(a===`fresh_context`?`修改已保存在当前世界,并已作为全新上下文继续。`:`修改已保存在当前世界,并已从修改稿继续。`)})}catch(e){I({kind:`error`,text:_c(e)})}finally{ae(null)}}function Qt(){return Ft(tn?`fresh`:`append`)}async function $t(t){M(t),N(!0);try{await e.request({type:`preferences.save`,reading:t})}catch(e){I({kind:`error`,text:_c(e)})}finally{N(!1)}}async function en(){let e=me.trim();if(e!==``&&e!==n){ae(`rename`),I(null);try{await s(e),I({kind:`status`,text:v(`世界名称已保存。`)})}catch(e){I({kind:`error`,text:_c(e)})}finally{ae(null)}}}let tn=Se||Ct===null||Dt,nn=tn?jt:Mt,rn=Za(r&&nn,Qt);if(p===null)return(0,b.jsxs)(`main`,{className:`world-reader-page world-page-loading`,children:[a&&(0,b.jsx)(`button`,{className:`world-back-button secondary-button`,onClick:i,children:v(`← 返回工作区`)}),F?.kind===`error`?(0,b.jsx)(`p`,{role:`alert`,children:F.text}):(0,b.jsx)(`p`,{role:`status`,children:v(`正在打开世界…`)})]});if(A===`revision`){let i=Tt,a=He||V===null?null:{...V,packageId:t,legacyDraft:null};return(0,b.jsx)(xs,{onNavigationLockChange:je,onPreview:()=>X(e,{type:`world.revision.preview`,worldId:t,...a===null?{}:{sessionId:a.sessionId}}),target:`world-revision`,packageName:n,modelConfigured:r,hasUnsavedFileDraft:gt,loading:Be,view:a,history:Fe?.history??[],latestSessionId:Fe?.latest?.sessionId??null,notice:Ke,requestFailure:We??tt,now:Xe,contentEditor:{mode:`world-revision`,files:Le,...Ee===``?{}:{selectedPath:Ee.startsWith(`state/`)?Ee:`state/${Ee}`},status:(i?.diagnostics.length??0)===0?`usable`:`needs_repair`,issues:i?.diagnostics??[],immutablePaths:(i?.files??Re).filter(({path:e})=>e.startsWith(`state/`)&&!i?.diff.some(t=>t.path===e&&t.kind===`create`)).map(({path:e})=>e)??[],dirty:gt,onFilesChange:Vt,onSave:()=>void Ht(),onReset:()=>{let e=i?.files??Re;H(hc(e)),ze(hc(e)),Ge(null)},onCopy:()=>void 0,onExport:()=>void 0,onDelete:()=>void 0,title:n,onRename:()=>void 0},onSend:Ut,onCancel:Wt,onFreshContext:()=>{et.current+=1,rt.current=null,Ue(!0),Ie(null),Ge(null)},onSelectSession:Gt,onDeleteSession:Kt,onRollbackFile:qt,onConfigureModel:o,onBack:()=>{et.current+=1,rt.current=null,te(null),Ge(null),Pt(!1)},...i?.locked===!0||(Fe?.sealedEpochs.length??0)>0?{revisionActions:{active:i?.locked===!0,changedFileCount:i?.diff.length??0,canApply:i?.locked===!0&&r&&i.diagnostics.length===0,applying:Je,changes:i?.changes??[],sealedEpochs:Fe?.sealedEpochs??[],onApply:Jt,onDiscard:Yt}}:{}},t)}return(0,b.jsx)(`main`,{className:`world-reader-page`,style:{"--world-story-size":j.fontSize+`px`,"--world-story-leading":j.lineHeight,"--world-story-tracking":j.letterSpacing+`em`,"--world-story-measure":j.measure+`rem`,"--world-composer-height":ft+`px`,"--world-story-paragraph-gap":j.density===`compact`?`0.5em`:j.density===`standard`?`0.8em`:`1.1em`,"--world-story-block-gap":j.density===`compact`?`1.3em`:j.density===`standard`?`1.85em`:`2.4em`},children:(0,b.jsx)(ia,{worldId:p.worldId,artifacts:_t?.artifacts??[],playerViewPanels:_t?.playerViewPanels??p.playerViewPanels??[],extensions:_t?.extensions??[],playerViews:p.playerViews,interactionDisabled:ie!==null||Et,onSetComposerDraft:re,onRefresh:async()=>{await Pt()},onBridgeEvent:(e,t)=>ct(n=>({...n,[e]:[...n[e]??[],t]})),children:(0,b.jsxs)(`div`,{className:`world-reader-shell`,children:[(0,b.jsxs)(`nav`,{className:`world-floating-chrome world-floating-chrome-left`,"aria-label":v(`世界与状态`),children:[a&&(0,b.jsx)(`button`,{type:`button`,onClick:i,"aria-label":v(`返回工作区`),children:`←`}),(0,b.jsx)(`button`,{type:`button`,className:C?`is-current`:``,"aria-pressed":C,onClick:()=>w(e=>!e),children:v(`此刻`)})]}),(0,b.jsx)(`h1`,{className:`world-floating-title`,title:n,children:n}),(0,b.jsxs)(`nav`,{className:`world-floating-chrome world-floating-chrome-right`,"aria-label":v(`世界阅读工具`),children:[(0,b.jsx)(`button`,{type:`button`,className:T&&D===`documents`?`is-current`:``,onClick:()=>{O(`documents`),E(!0),ee(!1)},children:v(`世界`)}),(0,b.jsx)(`button`,{type:`button`,className:T&&D===`ai-reading`?`is-current`:``,onClick:()=>{O(`ai-reading`),E(!0),ee(!1)},children:v(`AI 读取`)}),(0,b.jsx)(`button`,{type:`button`,className:k?`is-current`:``,"aria-label":v(`阅读设置`),onClick:()=>{ee(e=>!e),E(!1)},children:`Aa`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`世界管理`),onClick:()=>{te(`manage`),ee(!1)},children:`···`})]}),(0,b.jsx)(`section`,{className:`world-reader-scroll`,"aria-label":v(`世界游玩`),children:(0,b.jsxs)(`article`,{className:`world-story-column`,"aria-busy":ie!==null||St===`running`,"aria-label":v(`故事时间线`),children:[(0,b.jsx)(aa,{mount:`story`}),we?.nextCursor===null?null:(0,b.jsx)(`button`,{type:`button`,className:`secondary-button timeline-load-earlier`,disabled:ie!==null,onClick:()=>void Lt(),children:v(ie===`timeline-page`?`正在加载…`:`加载更早的故事`)}),we!==null&&we.items.length>0?(0,b.jsx)(rc,{client:e,worldId:t,items:we.items,restartDisabled:ie!==null||Et,freshContextDisabled:!r,onUseFreshContext:()=>{Ce(!0),ut.current?.querySelector(`textarea`)?.focus()},onRestartFrom:e=>void Xt(e),onEditPlayer:(e,t,n,r)=>void Zt(e,t,n,r)}):xt.length===0?(0,b.jsxs)(`div`,{className:`story-empty-state`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),(0,b.jsx)(`h3`,{children:v(`故事还没有开始`)}),(0,b.jsx)(`p`,{children:v(`描述你的行动,从当前世界开始一条调用链。`)})]}):(0,b.jsx)(lc,{messages:xt.map(e=>({...e,pending:!1})),restartDisabled:ie!==null||Et,onRestartFrom:e=>void Xt(e)}),ue===null?null:(0,b.jsx)(Xs,{progress:ue,now:fe,onCancel:()=>void It()}),(0,b.jsx)(`div`,{ref:lt})]})}),(0,b.jsxs)(`footer`,{ref:ut,className:`world-composer-dock`,children:[(0,b.jsx)(aa,{mount:`composer_above`}),(_t?.extensionControls??p.extensionControls)===void 0?null:(0,b.jsx)(Fs,{view:_t?.extensionControls??p.extensionControls,onChange:async(n,r)=>{let i=++S.current;await X(e,{type:`world.extensions.set`,worldId:t,key:n,value:r});let a=await Sc(e,t);a!==null&&i===S.current&&g({...a,worldId:t}),y(e=>e+1)}}),Et?(0,b.jsxs)(`div`,{className:`model-required-callout`,role:`status`,children:[(0,b.jsx)(`p`,{children:v(`世界正在修订,游玩和其他世界修改已锁定;应用或放弃后会解锁。`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void Bt(),children:v(`继续修订`)})]}):null,r?null:(0,b.jsxs)(`div`,{className:`model-required-callout`,children:[(0,b.jsx)(`p`,{children:v(`需要先配置模型连接才能游玩。`)}),(0,b.jsx)(`button`,{type:`button`,onClick:o,children:v(`配置模型`)})]}),se===null?null:(0,b.jsx)(`p`,{role:`status`,children:se}),le===null?null:(0,b.jsxs)(`div`,{className:`play-call-failure`,role:`alert`,"aria-label":v(`模型调用失败`),children:[(0,b.jsx)(`strong`,{children:v(`模型调用失败`)}),(0,b.jsx)(`p`,{children:le})]}),wt?(0,b.jsxs)(`div`,{className:`play-retry-note`,role:`alert`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`!`}),(0,b.jsx)(`p`,{children:v(`上次模型请求没有完整返回。保持输入为空并重试,会原样发送保存的请求。`)})]}):null,Dt&&At?(0,b.jsx)(`div`,{className:`world-fresh-context-note`,role:`note`,children:v(`世界已在故事外修订;下一次行动会从新上下文开始。`)}):null,Se&&!Dt&&At?(0,b.jsxs)(`div`,{className:`world-fresh-context-note`,role:`note`,children:[(0,b.jsx)(`span`,{children:v(`下一条消息将开启全新上下文`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>{Ce(!1),dt.current?.focus()},children:v(`取消全新上下文`)})]}):null,(0,b.jsxs)(`div`,{className:`world-composer-row`,children:[(0,b.jsxs)(`details`,{className:`world-composer-mode`,children:[(0,b.jsx)(`summary`,{"aria-label":v(`选择提交方式`),children:`+`}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,"aria-label":v(`追加上下文`),disabled:!Mt||!r,onClick:e=>{e.currentTarget.closest(`details`)?.removeAttribute(`open`),Ft(`append`)},children:[(0,b.jsx)(`strong`,{children:v(`追加当前上下文`)}),(0,b.jsx)(`span`,{children:v(`保留原生对话,重新编译当前提示和材料`)})]}),(0,b.jsxs)(`button`,{type:`button`,"aria-label":v(`全新上下文`),disabled:!jt||!r,onClick:e=>{e.currentTarget.closest(`details`)?.removeAttribute(`open`),Ft(`fresh`)},children:[(0,b.jsx)(`strong`,{children:v(`使用全新上下文`)}),(0,b.jsx)(`span`,{children:v(`从当前世界重新编译材料`)})]})]})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{className:`visually-hidden`,children:v(`你的行动`)}),(0,b.jsx)(`textarea`,{ref:dt,"aria-label":v(`你的行动`),rows:1,placeholder:v(`接下来,你要做什么?`),value:P,disabled:ie!==null||!r||St===`running`||Et,onChange:e=>re(e.target.value),onKeyDown:rn.onKeyDown,title:v(`Enter 发送,Shift + Enter 换行`)})]}),(0,b.jsx)(`button`,{type:`button`,className:`world-composer-send`,"aria-label":v(tn?`从全新上下文发送行动`:`追加行动`),disabled:!nn||!r,onClick:()=>void rn.submit(),children:ie===`play-fresh`||ie===`play-append`?`…`:`↑`})]}),(0,b.jsx)(`p`,{className:`world-composer-hint`,children:v(wt?`原样重试使用已保存请求,不采用新预设。`:`正常发送和空输入续写使用最新预设;本轮工具执行期间保持不变。`)}),(0,b.jsx)(aa,{mount:`composer_below`})]}),(0,b.jsx)(`button`,{type:`button`,className:C||T?`world-panel-scrim is-visible`:`world-panel-scrim`,"aria-label":v(`收起侧栏`),onClick:()=>{w(!1),E(!1)}}),(0,b.jsxs)(`aside`,{className:C?`world-overlay-rail world-overlay-rail-left is-open`:`world-overlay-rail world-overlay-rail-left`,"aria-hidden":!C,"aria-label":v(`当前情景`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`div`,{children:(0,b.jsx)(`strong`,{children:v(`此刻`)})}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`收起状态栏`),onClick:()=>w(!1),children:`×`})]}),(0,b.jsxs)(`div`,{className:`world-overlay-rail-body`,children:[(0,b.jsx)(aa,{mount:`sidebar`}),yt.views.length===0?yt.coveredViewIds.size>0?null:(0,b.jsxs)(`div`,{className:`player-view-empty`,children:[(0,b.jsx)(`p`,{children:v(`这个世界还没有配置常驻玩家视图。`)}),(0,b.jsx)(`small`,{children:v(`你仍然可以正常游玩;未显示不代表秘密。`)})]}):yt.views.map(e=>(0,b.jsx)(pc,{view:e},e.id)),yt.diagnostics.length===0?null:(0,b.jsxs)(`details`,{className:`player-view-diagnostics`,children:[(0,b.jsxs)(`summary`,{children:[yt.diagnostics.length,` `,v(`项视图诊断`)]}),(0,b.jsx)(`ul`,{children:yt.diagnostics.map((e,t)=>(0,b.jsx)(`li`,{children:e.message},e.code+`-`+t))})]})]})]}),(0,b.jsxs)(`aside`,{className:T?`world-overlay-rail world-overlay-rail-right is-open`:`world-overlay-rail world-overlay-rail-right`,"aria-hidden":!T,"aria-label":v(D===`documents`?`当前世界`:`AI 如何读取`),children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`div`,{children:(0,b.jsx)(`strong`,{children:v(D===`documents`?`当前世界`:`AI 如何读取`)})}),(0,b.jsx)(`button`,{type:`button`,"aria-label":v(`收起世界栏`),onClick:()=>E(!1),children:`×`})]}),(0,b.jsxs)(`nav`,{"aria-label":v(`世界侧栏`),children:[(0,b.jsx)(`button`,{type:`button`,className:D===`documents`?`is-current`:``,onClick:()=>O(`documents`),children:v(`世界`)}),(0,b.jsx)(`button`,{type:`button`,className:D===`ai-reading`?`is-current`:``,onClick:()=>O(`ai-reading`),children:v(`AI 读取`)})]}),(0,b.jsx)(`div`,{className:`world-overlay-rail-body`,children:D===`documents`?(0,b.jsx)(Ls,{documents:vt,selectedPath:Ee,onSelect:De,onRevise:e=>void Bt(e),revisionDisabled:ie!==null||St===`running`}):(0,b.jsx)(Rs,{reading:it,loading:U,documents:vt,onOpenFull:()=>te(`reading`)})}),(0,b.jsxs)(`footer`,{children:[(0,b.jsx)(`button`,{type:`button`,disabled:ie!==null||St===`running`,onClick:()=>void Bt(),children:v(`修订当前世界`)}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>te(`manage`),children:v(`世界管理`)})]})]}),k?(0,b.jsx)(Bs,{value:j,saving:ne,onChange:e=>void $t(e),onClose:()=>ee(!1)}):null,A===`reading`?(0,b.jsx)(zs,{reading:it,documents:vt,onClose:()=>te(null)}):null,A===`manage`?(0,b.jsx)(Ks,{packageScriptPermission:(0,b.jsx)(x,{client:e,kind:`world`,id:t,onChange:()=>y(e=>e+1)},t),world:p,worldTitle:n,worldNameDraft:me,setWorldNameDraft:he,pending:ie,activeStatus:St,controlFiles:Oe,controlDirty:Me,controlPreview:Pe,onControlFiles:e=>{ke(e),Ne(!0),z(null)},onResetControl:()=>{ke(JSON.stringify(p.control,null,2)),Ne(!1),z(null)},onRename:()=>void en(),onDerive:()=>void Xt(p.head),onPreviewControl:()=>void Rt(),onApplyControl:()=>void zt(),onClose:()=>te(null),modelConfigured:r,revisionLocked:Et}):null,F===null?null:(0,b.jsx)(`p`,{className:`world-feedback `+F.kind,role:F.kind===`error`?`alert`:`status`,children:F.text}),(0,b.jsx)(aa,{mount:`overlay`}),(0,b.jsx)(aa,{mount:`debug`}),(0,b.jsx)(qs,{records:_t?.artifactDebug??[],extensions:_t?.extensions??[],playerViewPanels:_t?.playerViewPanels??p.playerViewPanels??[],bridgeEvents:st})]})})})}function rc({client:e,worldId:t,items:n,restartDisabled:r,freshContextDisabled:i,onRestartFrom:a,onEditPlayer:o,onUseFreshContext:s}){let c=ic(n);return(0,b.jsx)(`ol`,{className:`call-chain-events play-timeline-events`,"aria-label":v(`模型调用链`),children:c.map(n=>{if(n.kind===`turn`){let c=n.items.filter(({event:e})=>sc(e));return(0,b.jsxs)(l.Fragment,{children:[n.items.map(n=>oc(n.event)?(0,b.jsx)(cc,{client:e,worldId:t,chainId:n.chainId,event:n.event,restartDisabled:r,freshContextDisabled:i,onRestartFrom:a,onEditPlayer:o,presentation:`story`,onUseFreshContext:s},`${n.chainId}:${n.event.id}`):null),c.length===0?null:(0,b.jsx)(`li`,{className:`world-timeline-trace`,children:(0,b.jsxs)(`details`,{children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`span`,{children:v(`本段调用详情`)}),(0,b.jsx)(`small`,{children:v(`{count} 项记录`,{count:c.length})})]}),(0,b.jsx)(`ol`,{className:`world-timeline-trace-events`,"aria-label":v(`本段模型调用详情`),children:c.map(n=>(0,b.jsx)(cc,{client:e,worldId:t,chainId:n.chainId,event:n.event,restartDisabled:r,freshContextDisabled:i,onRestartFrom:a,onEditPlayer:o,presentation:`trace`,onUseFreshContext:s},`trace:${n.chainId}:${n.event.id}`))})]})})]},n.key)}let c=n.item;return c.kind===`context_boundary`?(0,b.jsxs)(`li`,{className:`story-context-boundary`,role:`separator`,"aria-label":v(`全新上下文从这里开始`),children:[(0,b.jsx)(`span`,{children:v(`全新上下文从这里开始`)}),(0,b.jsx)(`small`,{children:c.playPreset.name}),(0,b.jsxs)(`details`,{className:`call-chain-summary`,children:[(0,b.jsx)(`summary`,{children:v(`本上下文已提交的世界变化`)}),c.changedDocuments.length===0?(0,b.jsx)(`span`,{children:v(`没有文档变化`)}):(0,b.jsx)(`ul`,{children:c.changedDocuments.map(e=>(0,b.jsxs)(`li`,{children:[e.kind===`create`?v(`新建`):v(`更新`),` `,e.ref,` · `,e.path]},`${e.kind}:${e.path}`))})]})]},n.key):c.kind===`genesis`?(0,b.jsx)(`li`,{className:`${c.role}-message`,children:(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`header`,{children:(0,b.jsx)(`strong`,{children:c.role===`player`?v(`你`):v(`主持`)})}),(0,b.jsx)(`p`,{children:c.exactText})]})},n.key):null})})}function ic(e){let t=[],n=[],r=()=>{let e=n[0];e!==void 0&&(t.push({kind:`turn`,key:`turn:${e.chainId}:${e.event.id}`,items:n}),n=[])};for(let i of e){if(i.kind!==`event`){r(),t.push({kind:`standalone`,key:i.kind===`context_boundary`?`context:${i.chainId}`:`genesis:${i.messageId}`,item:i});continue}(i.event.kind===`player`||i.event.kind===`assistant`&&ac(n))&&r(),n.push(i)}return r(),t}function ac(e){return e.some(({event:e})=>e.kind===`assistant`&&e.status===`completed`&&dc(e)===`narrative`)}function oc(e){return e.kind===`player`||e.kind===`failure`||e.kind===`cancellation`?!0:e.kind===`followup`?e.failed:e.kind===`assistant`?e.status===`streaming`||dc(e)===`narrative`:!1}function sc(e){return e.kind===`tool_call`||e.kind===`tool_result`||e.kind===`followup`?!0:e.kind!==`assistant`||e.status===`streaming`?!1:dc(e)!==`narrative`||e.usage!==void 0||e.detailsAvailable}function cc({client:e,worldId:t,chainId:n,event:r,restartDisabled:i,freshContextDisabled:a,onRestartFrom:o,onEditPlayer:s,presentation:c,onUseFreshContext:u}){let[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null),[_,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(`continue_context`),C=async()=>{if(!(d!==null||p)){m(!0),g(null);try{f(await X(e,{type:`play.timeline.detail`,worldId:t,chainId:n,eventId:r.id}))}catch(e){g(_c(e))}finally{m(!1)}}};if(r.kind===`player`)return(0,b.jsx)(`li`,{className:`call-chain-player`,children:(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:v(`玩家`)}),(0,b.jsx)(`span`,{children:r.context===`fresh`?v(`全新上下文`):v(`追加上下文`)}),r.committedHead===void 0?null:(0,b.jsxs)(`span`,{className:`history-message-actions`,children:[r.committedHead===`genesis`?null:(0,b.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:i,onClick:()=>{y(r.text),S(`continue_context`)},children:v(`修改`)}),(0,b.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:i,onClick:()=>o(r.committedHead),children:v(`创建分叉`)})]})]}),_===null?(0,b.jsx)(`p`,{children:r.text}):(0,b.jsxs)(`div`,{className:`history-player-edit`,children:[(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`span`,{children:v(`修改后的行动`)}),(0,b.jsx)(`textarea`,{"aria-label":v(`修改后的行动`),rows:3,value:_,disabled:i,onChange:e=>y(e.target.value)})]}),(0,b.jsx)(`p`,{children:v(`修改会直接保存在当前世界;这条原提交及其后的内容会离开当前时间线,但旧 Authority 记录仍可恢复。`)}),(0,b.jsxs)(`fieldset`,{className:`history-player-edit-continuation`,children:[(0,b.jsx)(`legend`,{children:v(`修改后如何继续`)}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`radio`,name:`revision-continuation-${n}-${r.id}`,value:`continue_context`,checked:x===`continue_context`,disabled:i,onChange:()=>S(`continue_context`)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:v(`沿原上下文继续`)}),(0,b.jsx)(`small`,{children:v(`保留修改点以前的模型对话和原生续传。`)})]})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`radio`,name:`revision-continuation-${n}-${r.id}`,value:`fresh_context`,checked:x===`fresh_context`,disabled:i||a,onChange:()=>S(`fresh_context`)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:v(`作为全新上下文保存`)}),(0,b.jsx)(`small`,{children:v(`不继承旧模型对话;修改稿会成为全新上下文的第一条消息。`)})]})]})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:i||_.trim().length===0||x===`fresh_context`&&a,onClick:()=>s(n,r.id,_,x),children:v(x===`fresh_context`?`保存为全新上下文并继续`:`保存修改并继续`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i,onClick:()=>y(null),children:v(`取消`)})]})]})]})});if(r.kind===`assistant`){let e=d?.kind===`assistant`?d:null,t=dc(r),s=t===`tool_step`?`tool-step`:t,l=(0,b.jsxs)(b.Fragment,{children:[r.usage===void 0?null:(0,b.jsx)(os,{usage:r.usage,compact:!0}),r.detailsAvailable?r.status===`streaming`?(0,b.jsx)(`small`,{children:v(`响应完成后可查看模型诊断详情`)}):(0,b.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void C(),children:[(0,b.jsx)(`summary`,{children:v(`查看模型诊断详情`)}),p?(0,b.jsx)(`p`,{children:v(`正在加载…`)}):null,h===null?null:(0,b.jsx)(`p`,{role:`alert`,children:h}),e?.reasoning===void 0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:(0,b.jsx)(`strong`,{children:v(`Provider 返回推理(不等同隐藏思维链)`)})}),(0,b.jsx)(`pre`,{children:e.reasoning})]}),e?.toolFragment===void 0?null:(0,b.jsx)(`pre`,{children:e.toolFragment}),e?.stopReason===void 0&&e?.continuation===void 0?null:(0,b.jsxs)(`dl`,{className:`prompt-budget-breakdown`,children:[e.stopReason===void 0?null:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`完成原因`)}),(0,b.jsx)(`dd`,{children:e.stopReason})]}),e.continuation===void 0?null:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:v(`原生续传载荷`)}),(0,b.jsx)(`dd`,{children:e.continuation===`available`?v(`可用`):v(`不可用`)})]})]}),e?.usage===void 0?null:(0,b.jsx)(os,{usage:e.usage,showProvenance:!0})]}):null]});return c===`trace`&&t===`narrative`?(0,b.jsx)(`li`,{className:`call-chain-assistant-diagnostics`,children:(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:v(`AI 响应诊断`)}),(0,b.jsx)(`span`,{children:v(`{status} · 第 {attempt} 次派发`,{status:uc(r.status),attempt:r.attempt})})]}),l]})}):(0,b.jsx)(`li`,{className:`call-chain-assistant is-${r.status} is-${s}`,children:(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:r.status===`streaming`?v(`模型响应中`):v(t===`tool_step`?`模型工具步骤`:t===`empty`?`空模型响应`:`AI 响应`)}),(0,b.jsx)(`span`,{children:v(`{status} · 第 {attempt} 次派发`,{status:uc(r.status),attempt:r.attempt})}),r.committedHead===void 0?null:(0,b.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:i,onClick:()=>o(r.committedHead),children:v(`创建分叉`)})]}),t===`tool_step`&&r.text.length>0?(0,b.jsxs)(`details`,{className:`call-chain-tool-step-text`,children:[(0,b.jsx)(`summary`,{children:v(`查看工具步骤文本(未进入故事)`)}),(0,b.jsx)(`p`,{children:r.text})]}):(0,b.jsx)(`p`,{children:r.text.length>0?r.text:r.status===`streaming`?v(`正在接收模型输出…`):v(t===`tool_step`?`(本次响应只调用了工具)`:`(本次响应没有文本)`)}),c===`story`&&r.committedHead!==void 0?(0,b.jsx)(aa,{mount:`story`,reply:{chainId:n,eventId:r.id}}):null,t===`pending`?(0,b.jsx)(`small`,{children:v(`待定输出;响应完成前不会进入故事`)}):null,r.checkpoint===!0&&r.status===`completed`&&t===`narrative`?(0,b.jsxs)(`aside`,{className:`play-checkpoint-note`,children:[(0,b.jsx)(`p`,{children:v(`AI 建议在此开启全新上下文`)}),(0,b.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i||a,onClick:u,children:v(`下一条消息使用全新上下文`)})]}):null,c===`trace`?l:r.status===`streaming`&&r.detailsAvailable?(0,b.jsx)(`small`,{children:v(`响应完成后可查看模型诊断详情`)}):null]})})}if(r.kind===`tool_call`){let e=d?.kind===`tool_call`?d:null;return(0,b.jsx)(`li`,{className:`call-chain-tool`,children:(0,b.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void C(),children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`strong`,{children:v(`调用 {tool}`,{tool:r.name})}),(0,b.jsx)(`span`,{children:r.replayed?v(`复用同 ID 结果`):r.callId})]}),p?(0,b.jsx)(`p`,{children:v(`正在加载…`)}):null,h===null?null:(0,b.jsx)(`p`,{role:`alert`,children:h}),e===null?null:(0,b.jsx)(`pre`,{children:fc(e.arguments)})]})})}if(r.kind===`tool_result`){let e=d?.kind===`tool_result`?d:null;return(0,b.jsx)(`li`,{className:`call-chain-tool-result ${r.ok?`is-ok`:`is-error`}`,children:(0,b.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void C(),children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsxs)(`strong`,{children:[r.name,` `,v(`返回`)]}),(0,b.jsx)(`span`,{children:r.ok?v(`成功`):v(`拒绝/失败`)})]}),p?(0,b.jsx)(`p`,{children:v(`正在加载…`)}):null,h===null?null:(0,b.jsx)(`p`,{role:`alert`,children:h}),e===null?null:(0,b.jsx)(`pre`,{children:e.markdown})]})})}if(r.kind===`followup`){let e=d?.kind===`followup`?d:null;return(0,b.jsxs)(`li`,{className:`call-chain-followup ${r.failed?`is-error`:`is-ok`}`,children:[(0,b.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void C(),children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsxs)(`strong`,{children:[v(`后置请求 ·`),r.displayName]}),(0,b.jsx)(`span`,{children:r.failed?v(`未完成`):v(`{count} 项产物`,{count:r.toolCallCount})})]}),p?(0,b.jsx)(`p`,{children:v(`正在加载…`)}):null,h===null?null:(0,b.jsx)(`p`,{role:`alert`,children:h}),e===null?null:(0,b.jsx)(`pre`,{children:fc(e)})]}),r.usage===void 0?null:(0,b.jsx)(os,{usage:r.usage,compact:!0})]})}return r.kind===`cancellation`?(0,b.jsxs)(`li`,{className:`call-chain-cancellation`,role:`status`,children:[(0,b.jsx)(`strong`,{children:v(`生成已取消`)}),(0,b.jsx)(`p`,{children:v(`本轮生成已停止;已提交的玩家原文保留,未完成的模型输出不会进入故事。`)})]}):(0,b.jsxs)(`li`,{className:`call-chain-failure`,role:`alert`,children:[(0,b.jsx)(`strong`,{children:v(`调用链中断`)}),(0,b.jsx)(`p`,{children:r.message})]})}function lc({messages:e,restartDisabled:t=!1,onRestartFrom:n}){return(0,b.jsx)(`ol`,{className:`narrative-list`,children:e.map((e,r)=>(0,b.jsx)(`li`,{className:`${e.role}-message ${e.pending?`pending-message`:``}`,children:(0,b.jsxs)(`article`,{children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`strong`,{children:e.role===`player`?v(`你`):v(`主持`)}),e.pending?(0,b.jsx)(`span`,{children:v(`未结算`)}):null,e.head===void 0||n===void 0?null:(0,b.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:t,onClick:()=>n(e.head),children:v(`创建分叉`)})]}),(0,b.jsx)(`p`,{children:e.exactText})]})},e.messageId??`${r}-${e.role}`))})}function uc(e){return v(e===`streaming`?`接收中`:e===`interrupted`?`中断片段`:`已完成`)}function dc(e){return e.responseKind===void 0?e.status===`streaming`||e.status===`interrupted`?`pending`:e.text.trim().length===0?`empty`:e.committedHead===void 0?`tool_step`:`narrative`:e.responseKind}function fc(e){try{return JSON.stringify(e,null,2)}catch{return v(`[参数无法序列化]`)}}function pc({view:e}){return(0,b.jsxs)(`article`,{className:`player-view-card`,children:[(0,b.jsx)(`h3`,{children:e.title}),e.items.length===0?(0,b.jsx)(`p`,{className:`player-view-empty-value`,children:v(`当前没有可显示项目。`)}):(0,b.jsx)(`dl`,{children:e.items.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e.label}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(Li,{value:e.value})})]},e.id))})]})}function mc(e,t){return e.some(({path:e})=>e===t)?t:e[0]?.path??``}function hc(e){return e.map(e=>({...e}))}function gc(e,t){let n=new Map(t.map(e=>[e.path,e]));return e.length===t.length&&e.every(e=>{let t=n.get(e.path);return t?.path===e.path&&t.contents===e.contents&&t.encoding===e.encoding})}function _c(e){return e instanceof Error?e.message:v(`操作失败`)}function vc(e){if(e?.status!==`interrupted`||e.events.at(-1)?.kind===`cancellation`)return null;let t=e.events.findLast(e=>e.kind===`failure`),n=e.lastFailure??t?.message??null,r=e.canRetry?v(`模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。`):v(`调用链处理失败;旧请求不能重发,请使用全新上下文。`);return n===null||n.includes(r)?n??r:`${n} ${r}`}function X(e,t){return e.request(t)}function yc(e,t){if(e.kind===`snapshot`){t(t=>{if(t===null)return t;let n=e.value,r=t.activeChainId,i=t.items.map(e=>e.kind===`genesis`?e:e.kind===`context_boundary`?e.chainId===n.chainId?{...e,playPreset:structuredClone(n.playPreset),changedDocuments:structuredClone(n.changedDocuments),current:!0}:{...e,current:!1}:{...e,current:e.chainId===n.chainId});r!==n.chainId&&!i.some(e=>e.kind===`context_boundary`&&e.chainId===n.chainId)&&i.push({kind:`context_boundary`,chainId:n.chainId,playPreset:structuredClone(n.playPreset),changedDocuments:structuredClone(n.changedDocuments),current:!0});let a=i.flatMap(e=>e.kind===`event`&&e.chainId===n.chainId?[e.event.id]:[]),o=a.length===0?0:Math.min(...a);for(let e of n.events){if(e.id<o)continue;let t=bc(e),r=i.findIndex(t=>t.kind===`event`&&t.chainId===n.chainId&&t.event.id===e.id),a={kind:`event`,chainId:n.chainId,current:!0,event:t};if(r<0)i.push(a);else{let e=i[r];e.kind===`event`&&e.event.kind===`assistant`&&t.kind===`assistant`&&(t.hasReasoning||=e.event.hasReasoning,t.hasToolFragment||=e.event.hasToolFragment,t.hasUsage||=e.event.hasUsage,t.detailsAvailable||=e.event.detailsAvailable),i[r]=a}}return{...t,activeChainId:n.chainId,activeStatus:n.status,activeCanRetry:n.canRetry,activeLastFailure:n.lastFailure,items:i}});return}e.kind===`assistant_delta`&&t(t=>{if(t?.activeChainId==null)return t;let n=t.activeChainId;return{...t,items:t.items.map(t=>t.kind!==`event`||t.chainId!==n||t.event.kind!==`assistant`||t.event.id!==e.eventId?t:e.deltaKind===`text`?{...t,event:{...t.event,text:t.event.text+e.text}}:e.deltaKind===`reasoning`?{...t,event:{...t.event,hasReasoning:!0,detailsAvailable:!0}}:{...t,event:{...t.event,hasToolFragment:!0,detailsAvailable:!0}})}})}function bc(e){if(e.kind===`player`||e.kind===`failure`||e.kind===`cancellation`)return structuredClone(e);if(e.kind===`assistant`){let{reasoning:t,toolFragment:n,...r}=e;return{...r,hasReasoning:t!==void 0&&t.length>0,hasToolFragment:n!==void 0&&n.length>0,hasUsage:e.usage!==void 0,detailsAvailable:t!==void 0&&t.length>0||n!==void 0&&n.length>0||e.usage!==void 0||e.stopReason!==void 0||e.continuation!==void 0}}if(e.kind===`tool_call`){let{arguments:t,...n}=e;return{...n,detailsAvailable:!0}}if(e.kind===`tool_result`){let{markdown:t,...n}=e;return{...n,detailsAvailable:!0}}return{id:e.id,kind:`followup`,followupId:e.followupId,displayName:e.displayName,toolCallCount:e.toolCalls.length,failed:e.failure!==void 0,...e.usage===void 0?{}:{usage:structuredClone(e.usage)},detailsAvailable:!0}}function xc(e){let t=e.playCallChain;if(t===null)return{worldId:e.worldId,generation:`legacy:${e.worldId}`,activeChainId:null,activeStatus:null,activeCanRetry:!1,activeLastFailure:null,items:[],nextCursor:null};let n=[...t.previousContexts,t],r=n[0]?.events.find(e=>e.kind===`player`&&e.committedHead!==void 0)?.committedHead,i=r===void 0?0:e.committedMessages.findIndex(({head:e})=>e===r),a=n[0]?.baselineHistoryLength??Math.max(0,i),o=e.committedMessages.slice(0,a).map((e,t)=>({kind:`genesis`,messageId:e.messageId??`legacy-message-${t+1}`,role:e.role,exactText:e.exactText}));return{worldId:e.worldId,generation:`legacy:${e.worldId}:${t.chainId}`,activeChainId:t.chainId,activeStatus:t.status,activeCanRetry:t.canRetry,activeLastFailure:t.lastFailure,items:[...o,...n.flatMap(e=>[{kind:`context_boundary`,chainId:e.chainId,playPreset:structuredClone(e.playPreset),changedDocuments:structuredClone(e.changedDocuments),current:e.chainId===t.chainId},...e.events.map(n=>({kind:`event`,chainId:e.chainId,current:e.chainId===t.chainId,event:bc(n)}))])],nextCursor:null}}async function Sc(e,t){try{return await e.request({type:`world.play-decorations.read`,worldId:t})}catch{return null}}function Cc({client:e}){let[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(`home`),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)([]),[u,d]=(0,l.useState)([]),[p,m]=(0,l.useState)(null),[h,_]=(0,l.useState)(!1),y=(0,l.useRef)(!1),[S,C]=(0,l.useState)(!1),[w,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(!1),[k,ee]=(0,l.useState)(!1),[A,te]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[ne,N]=(0,l.useState)(!1),[P,re]=(0,l.useState)(null),[ae,F]=(0,l.useState)([]),[L,ue]=(0,l.useState)(null),[de,pe]=(0,l.useState)(!1),[R,me]=(0,l.useState)(!1),[he,ge]=(0,l.useState)(!1),[_e,ve]=(0,l.useState)(null),[ye,be]=(0,l.useState)(null),[xe,Se]=(0,l.useState)(0),[Ce,we]=(0,l.useState)(``),[Te,Ee]=(0,l.useState)(v(`正在读取工作区…`)),[De,Oe]=(0,l.useState)(!1),ke=(0,l.useRef)(w);ke.current=w;let Ae=(0,l.useRef)(0),je=(0,l.useRef)(!1),Me=(0,l.useRef)(0),Ne=(0,l.useRef)(0),Pe=(0,l.useRef)(null);async function z(){let t=await e.request({type:`workspace.read`});g(t.preferences.locale),n(t),o(e=>t.contentPackages.some(({localId:t})=>t===e)?e:t.contentPackages[0]?.localId??``),Ee(``)}let Fe=de?void 0:L?.sessionId??P?.sessionId;(0,l.useEffect)(()=>{if(r!==`content`||a===``)return;let t=!0,n=Me.current,i=e.observeConversation({kind:`setting`,id:a,...Fe===void 0?{}:{sessionId:Fe}},async(r,i)=>{if(r.kind!==`setting`)return;let o=r.value,s=Ne.current;try{if(!t||Me.current!==n||Ne.current!==s)return;if(i){let r=await e.request({type:`setting-improvement.overview`,packageId:a});if(!t||Me.current!==n||Ne.current!==s)return;re(r.latest),F(r.history);let i=Pe.current;if(typeof i==`string`&&i!==r.latest?.sessionId){let r=await e.request({type:`setting-improvement.session.read`,packageId:a,sessionId:i});if(!t||Me.current!==n||Ne.current!==s)return;ue(r)}else typeof i==`object`&&i&&i.kind===`fresh`&&i.requestStarted&&r.latest!==null&&r.latest.sessionId!==i.previousSessionId?(ue(null),pe(!1),Pe.current=r.latest.sessionId):i===null&&(ue(null),r.latest!==null&&(Pe.current=r.latest.sessionId));let o=await e.request({type:`content.read`,packageId:a});if(!t||Me.current!==n)return;m(o),d(o.files.map(e=>({...e}))),ke.current||c(o.files.map(e=>({...e})))}else if(o.selected!==null){let e=o.selected,t=t=>t?.sessionId===e.sessionId?{...t,runStatus:e.runStatus,progress:e.progress}:t;re(t),ue(t)}}catch{throw Error(v(`对话同步失败,请重新打开此页面。`))}finally{t&&Me.current===n&&(Se(Date.now()),ge(!1))}},e=>{t&&(ve(e===`connected`?null:v(e===`reconnecting`?`对话连接已断开,正在重新连接…`:`对话同步失败,请重新打开此页面。`)),e===`failed`&&ge(!1))}),o=setInterval(()=>Se(Date.now()),1e3);return()=>{t=!1,i(),clearInterval(o)}},[e,r,a,Fe]),(0,l.useEffect)(()=>{let t=!0;return e.request({type:`workspace.read`}).then(e=>{t&&(g(e.preferences.locale),n(e),o(e.contentPackages[0]?.localId??``),Ee(``))}).catch(e=>{t&&Ee(e instanceof Error?e.message:v(`工作区读取失败`))}),()=>{t=!1}},[e]);async function B(n){if(!(t===null||De)){Oe(!0);try{g((await e.request({type:`preferences.save`,locale:n})).locale),await z(),Ee(v(`界面语言已保存。`))}catch(e){$e(e)}finally{Oe(!1)}}}async function V(t){let n=Ae.current+1;Ae.current=n,Ne.current+=1;try{let r=await e.request({type:`content.read`,packageId:t});if(Ae.current!==n)return;if(je.current){Ee(v(`已保留当前页面的未保存修改,请保存或放弃后再切换。`));return}t!==a&&(Me.current+=1);let s=r.files;o(t),m(r),d(s.map(e=>({...e}))),re(null),F([]),ue(null),pe(!1),Pe.current=null,me(!1),ge(!0),be(null),c(s.map(e=>({...e}))),E(!1),i(`content`)}catch(e){Ae.current===n&&$e(e)}}async function Ie(){try{let t=await e.request({type:`content.replace`,packageId:a,files:s});m(t),c(t.files.map(e=>({...e}))),d(t.files.map(e=>({...e}))),E(!1),await z(),Ee(v(`内容包当前树已整批保存。`))}catch(e){$e(e)}}async function Le(){try{let t=await e.request({type:`content.create`});await z(),await V(t.localId)}catch(e){$e(e)}}async function H(t){try{await e.request({type:t,packageId:a}),await z(),i(`home`)}catch(e){$e(e)}}async function Re(t){try{await e.request({type:`content.rename`,packageId:a,name:t}),await z(),Ee(v(`内容包已重命名。`))}catch(e){$e(e)}}async function ze(){if(!(j===null||ne)){if(j.size>T){Ee(v(`内容包 ZIP 自身大小超过安全上限。`));return}N(!0);try{let t=await wc(j),n=await e.request({type:`content.import`,archiveBase64:t,title:Tc(j.name)});M(null),await z(),await V(n.localId),Ee(v(`ZIP 内容包已导入为新的本地身份。`))}catch(e){$e(e)}finally{N(!1)}}}async function Be(){try{let t=await e.request({type:`content.export`,packageId:a}),n=Uint8Array.from(atob(t.base64),e=>e.charCodeAt(0)),r=URL.createObjectURL(new Blob([n],{type:`application/zip`})),i=document.createElement(`a`);i.href=r,i.download=t.fileName,i.click(),URL.revokeObjectURL(r)}catch(e){$e(e)}}async function Ve(t){let n=Ne.current,r=Me.current;if(w){let e=Error(v(`请先保存文件编辑,再继续 AI 设定完善。`));throw $e(e),e}be(null),Ee(``),de&&typeof Pe.current==`object`&&Pe.current!==null&&(Pe.current={...Pe.current,requestStarted:!0});let i=de?null:L??P;try{let o=await e.request({type:`setting-improvement.message`,packageId:a,requestId:oe(`setting-message`),message:t,continuation:i===null?{kind:`fresh_context`}:{kind:`continue_context`,sessionId:i.sessionId}});if(Me.current!==r)return;Ne.current===n&&(i!==null&&i.sessionId!==P?.sessionId?ue(o):(re(o),ue(null)),pe(!1),Pe.current=o.sessionId);try{let t=await e.request({type:`content.read`,packageId:a});if(Me.current!==r)return;m(t),ke.current||c(t.files.map(e=>({...e}))),d(t.files.map(e=>({...e}))),await z()}catch(e){$e(e)}}catch(e){throw be(e instanceof Error?e.message:v(`操作失败`)),$e(e),e}}async function He(){let t=de?null:L??P;if(t!==null){be(null);try{let n=await e.request({type:`setting-improvement.cancel`,sessionId:t.sessionId});L===null?re(n):ue(n)}catch(e){be(e instanceof Error?e.message:v(`操作失败`)),$e(e)}}}async function Ue(t){let n=Ne.current+1;if(Ne.current=n,pe(!1),Pe.current=t,P?.sessionId===t){ue(null);return}me(!0),be(null);try{let r=await e.request({type:`setting-improvement.session.read`,packageId:a,sessionId:t});if(Ne.current!==n)return;ue(r)}catch(e){if(Ne.current!==n)return;be(e instanceof Error?e.message:v(`操作失败`)),$e(e)}finally{Ne.current===n&&me(!1)}}async function We(t){let n=(de?null:L?.sessionId??P?.sessionId??null)===t,r=Pe.current;Ne.current+=1,n&&(Pe.current=null),me(!0),be(null);try{let i=await e.request({type:`setting-improvement.session.delete`,packageId:a,sessionId:t});Ne.current+=1,re(i.latest),F(i.history),de?(ue(null),Pe.current={kind:`fresh`,previousSessionId:i.latest?.sessionId??null,requestStarted:!1}):n?(ue(null),Pe.current=i.latest?.sessionId??null):typeof r==`string`&&i.history.some(({sessionId:e})=>e===r)?(Pe.current=r,i.latest?.sessionId===r&&ue(null)):(ue(null),Pe.current=i.latest?.sessionId??null),Ee(v(`对话历史已删除;内容包当前树没有回滚。`))}catch(e){Ne.current+=1,Pe.current=r;let t=e instanceof Error?e.message:v(`操作失败`);throw be(t),$e(e),e}finally{me(!1)}}async function Ge(t,n,r){if(w){let e=Error(v(`请先保存或放弃文件编辑中的未保存修改。`));throw $e(e),e}be(null),Ee(``);let i;try{i=await e.request({type:`setting-improvement.rollback`,packageId:a,sessionId:t,changeSetId:n,path:r})}catch(e){let t=e instanceof Error?e.message:v(`操作失败`);throw be(t),$e(e),e}try{let t=await e.request({type:`content.read`,packageId:a});m(t),c(t.files.map(e=>({...e}))),d(t.files.map(e=>({...e}))),E(!1),await z()}catch(e){let t=e instanceof Error?e.message:v(`操作失败`);be(v(`Runtime 已确认回滚结果,但重新读取内容包失败:{message}`,{message:t}))}return Ee(i.status===`rolled_back`?v(`已回滚这个文件;对话历史仍然保留。`):v(`当前文件已是修改前版本。`)),i}function Ke(){(L??P)?.runStatus!==`running`&&(Ne.current+=1,me(!1),ue(null),pe(!0),Pe.current={kind:`fresh`,previousSessionId:P?.sessionId??ae[0]?.sessionId??null,requestStarted:!1},be(null))}function qe(e){if(te(e??null),t?.model.configured!==!0){i(`model`),Ee(v(`请先保存并启用一份模型配置。`));return}i(`preview`)}async function Je(){if(y.current||ke.current||(L??P)?.runStatus===`running`||(p?.localId===a?p:t?.contentPackages.find(({localId:e})=>e===a))?.status!==`usable`||he||R)return;if(t?.model.configured!==!0){i(`model`),Ee(v(`请先保存并启用一份模型配置。`));return}y.current=!0,_(!0);let n=a,r=Ye();try{let t=await e.request({type:`setting-improvement.overview`,packageId:n});if(t.latest?.runStatus===`running`||t.history.some(e=>e.runStatus===`running`)){Ee(v(`这份内容包正在完善,请在回复完成后创建世界。`));return}let i=await e.request({type:`world.create`,operationId:oe(`create`),packageId:n,model:r});await z(),Xe(i.world.worldId)}catch(e){$e(e)}finally{y.current=!1,_(!1)}}function Ye(){let e=t?.model.connections.find(({id:e})=>e===t.model.activeConnectionId);return e===void 0?{provider:`chat_completions`,modelId:``,contextWindowTokens:0,maxOutputTokens:0}:{provider:e.provider,modelId:e.modelId,contextWindowTokens:e.contextWindowTokens,maxOutputTokens:e.maxOutputTokens}}function Xe(e){Ae.current+=1,we(e),i(`world`)}async function Ze(t,n){await e.request({type:`world.rename`,worldId:t,name:n}),await z(),Ee(v(`世界已重命名为“{name}”。`,{name:n}))}async function Qe(t){if(globalThis.confirm(v(`删除世界“{title}”?它的全部提交、历史和存档都会从本机移除,且无法撤销。`,{title:t.title})))try{await e.request({type:`world.delete`,worldId:t.worldId}),await z(),Ee(v(`世界已从本机删除。`))}catch(e){$e(e)}}function $e(e){Ee(e instanceof Error?e.message:v(`操作失败`))}if(t===null)return(0,b.jsx)(`main`,{className:`center-card`,role:`status`,children:Te});let et=t.contentPackages.find(({localId:e})=>e===a),tt=p?.localId===a?p:null,nt=de?null:L??P,rt=nt?.runStatus===`running`,it=t.worlds.find(e=>e.worldId===Ce),at=t.model.connections.find(({id:e})=>e===t.model.activeConnectionId),U=t.playPresets.presets.find(({id:e})=>e===t.playPresets.currentPresetId)?.name??null,ot=w||rt||D||k||ne||h||S;je.current=w||D||k||S||rt;function st(e){ot||((e!==`content`||e===r)&&(Ae.current+=1),e!==r&&(e===`content`?et===void 0?Le():V(et.localId):e===`preview`?qe():i(e)))}let ct=r===`world`?(0,b.jsx)(nc,{showWorkspaceBack:!1,client:e,worldId:Ce,worldTitle:it?.title??v(`未命名世界`),modelConfigured:t.model.configured,onBack:()=>st(`home`),onConfigureModel:()=>st(`model`),onNavigationLockChange:C,onRenameWorld:e=>Ze(Ce,e),initialReadingPreferences:t.preferences.reading??f,onOpenWorld:async e=>{await z(),we(e)}},Ce):null,lt=r===`content`?(0,b.jsx)(xs,{showWorkspaceBack:!1,onPreview:()=>e.request({type:`setting-improvement.preview`,packageId:a,...nt===null?{}:{sessionId:nt.sessionId}}),packageName:et?.title??a,modelConfigured:t.model.configured,hasUnsavedFileDraft:w,loading:he||R||h,onCreateWorld:()=>void Je(),onNavigationLockChange:C,view:nt,history:ae,latestSessionId:P?.sessionId??ae[0]?.sessionId??null,notice:Te,requestFailure:ye??_e,now:xe,contentEditor:{scriptPermission:(0,b.jsx)(x,{client:e,kind:`content`,id:a,dirty:w},a),files:s,status:tt?.status??et?.status??`needs_repair`,issues:tt?.issues??[],dirty:w,onFilesChange:e=>{c(e),E(!0)},onSave:()=>void Ie(),onReset:()=>{c(u.map(e=>({...e}))),E(!1),Ee(v(`已放弃未保存修改;内容包当前树未改变。`))},onCopy:()=>void H(`content.copy`),onExport:()=>void Be(),onDelete:()=>void H(`content.delete`),title:et?.title??a,onRename:e=>void Re(e)},onSend:Ve,onCancel:He,onFreshContext:Ke,onSelectSession:Ue,onDeleteSession:We,onRollbackFile:Ge,onConfigureModel:()=>st(`model`),onBack:()=>st(`home`)},a):null;return(0,b.jsxs)(`div`,{className:`workspace-shell`,"data-screen":r,children:[(0,b.jsx)(I,{screen:r,locale:t.preferences.locale,localeSaving:De,navigationLocked:ot,activeModelName:at?.name??null,onNavigate:st,onLocaleChange:e=>void B(e)}),(0,b.jsxs)(`div`,{className:`workspace-body`,children:[ct,lt,r!==`content`&&r!==`world`&&(Te||t.storageNotices.length>0)&&(0,b.jsxs)(`div`,{className:`workspace-feedback`,children:[Te&&(0,b.jsx)(ce,{text:Te,onDismiss:()=>Ee(``)}),t.storageNotices.map(e=>(0,b.jsx)(`p`,{role:`alert`,children:e.message},e.surface))]}),r===`home`&&(0,b.jsx)(le,{contentPackages:t.contentPackages,worlds:t.worlds,selectedPackageId:a,modelConfigured:t.model.configured,activeModelName:at?.name??null,currentPresetName:U,importArchive:j,importPending:ne,onImportArchiveChange:e=>{M(e),Ee(``)},onOpenPlayPresets:()=>st(`plays`),onCreateWorld:()=>st(`create`),onCreatePackage:()=>void Le(),onImportPackage:()=>void ze(),onOpenPackage:e=>void V(e),onOpenWorld:Xe,onRenameWorld:(e,t)=>void Ze(e.worldId,t).catch($e),onDeleteWorld:e=>void Qe(e)}),r===`plays`&&(0,b.jsx)(wa,{client:e,initialLibrary:t.playPresets,recommendedTemplates:ie(t.preferences.locale),onLibraryChange:e=>n(t=>t===null?t:{...t,playPresets:e}),onDirtyChange:O,renderPromptPreview:n=>(0,b.jsx)(Pa,{embedded:!0,client:e,packages:t.contentPackages,initialPackageId:a,playPresets:t.playPresets,model:t.model,onPackageSelect:o,playPresetTarget:n},`${n.presetId}:${n.revision}`)}),r===`model`&&(0,b.jsx)(fe,{client:e,library:t.model,onLibraryChange:e=>n(t=>t===null?t:{...t,model:e}),onNotice:Ee,onDirtyChange:ee}),r===`create`&&(0,b.jsx)(se,{client:e,packages:t.contentPackages,selectedId:a,pending:h,modelConfigured:t.model.configured,onSelect:o,onCreate:()=>void Je(),onEdit:()=>st(`content`),onConfigureModel:()=>st(`model`)},a),r===`preview`&&(0,b.jsx)(Pa,{client:e,packages:t.contentPackages,initialPackageId:a,playPresets:t.playPresets,model:t.model,onPackageSelect:o,...A===null?{}:{playPresetTarget:A}})]})]})}async function wc(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`error`,()=>n(r.error??Error(`Unable to read the content package ZIP`))),r.addEventListener(`abort`,()=>n(Error(`Reading the content package ZIP was cancelled`))),r.addEventListener(`load`,()=>{if(typeof r.result!=`string`){n(Error(`The content package ZIP read result is invalid`));return}let e=r.result.indexOf(`;base64,`);if(e<0){n(Error(`The content package ZIP could not be encoded for upload`));return}t(r.result.slice(e+8))}),r.readAsDataURL(e)})}function Tc(e){let t=e.replace(/\.zip$/iu,``).replace(/[\r\n]+/gu,` `).trim(),n=Array.from(t).slice(0,160).join(``);return n.length>0?n:v(`导入的内容包`)}function Ec(e,t){if(t.kind===`snapshot`)return t.value;if(e?.kind!==`play`||e.value?.chainId!==t.chainId)throw Error(`Conversation observation needs a fresh snapshot`);let n=structuredClone(e.value);for(let e of t.deltas){let t=n.events.find(t=>t.id===e.eventId);if(t?.kind!==`assistant`||t.status!==`streaming`)throw Error(`Conversation observation has an unknown live event`);t[e.field]=`${t[e.field]??``}${e.text}`}return n.updatedAt=t.updatedAt,t.progress===null?delete n.activeInvocation:n.activeInvocation=t.progress,{...e,kind:`play`,value:n}}var Dc=`narraeon.runtime/v1`,Oc=(e,t,n)=>{let r=!1,i,a=null,o=null,s=!1,c,l=``,u=0,d=async()=>{if(!s){s=!0;try{for(;o!==null&&!r;){let e=o;o=null;try{let n=e.kind===`play`?void 0:e.value.revision;await t(e,n===void 0||n!==c),c=n}catch(e){r||n?.(`failed`,e instanceof Error?e.message:`Conversation could not be displayed`)}}}finally{s=!1}}},f=()=>{let t=new URLSearchParams({kind:e.kind,id:e.id});`sessionId`in e&&e.sessionId!==void 0&&t.set(`sessionId`,e.sessionId);let s=new EventSource(`/api/runtime/v1/events?${t}`);i=s;let c=()=>!r&&i===s;s.onopen=()=>{c()&&n?.(`connected`)},s.onerror=()=>{c()&&n?.(s.readyState===EventSource.CLOSED?`failed`:`reconnecting`)},s.addEventListener(`failure`,e=>{c()&&(s.close(),n?.(`failed`,e.data))}),s.addEventListener(`observation`,t=>{if(c())try{let n=t,r=/^(.*):(\d+)$/.exec(n.lastEventId),i=JSON.parse(n.data);if(r===null||i.protocol!==`narraeon.runtime/v1`||!i.update)throw Error(`Incompatible conversation observation`);let c=r[1],p=Number(r[2]);if(c===l&&p<=u)return;if((c!==l||p!==u+1)&&i.update.kind!==`snapshot`){s.close(),a=null,l=``,u=0,f();return}if(a=Ec(a,i.update),a.kind!==e.kind)throw Error(`Conversation target changed unexpectedly`);l=c,u=p,o=a,d()}catch(e){s.close(),n?.(`failed`,e instanceof Error?e.message:`Invalid conversation observation`)}})};return f(),()=>{r=!0,o=null,i.close()}},kc=class extends Error{protocolCode;constructor(e,t={}){super(e),this.name=`RuntimeRequestError`,this.protocolCode=t.protocolCode}},Ac=class{observeConversation=Oc;async request(e){let t=await fetch(`/api/runtime/v1`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({protocol:Dc,request:e})}),n=await t.json();if(!t.ok)throw new kc(n.error?.message??`Runtime request failed: ${t.status}`,{protocolCode:n.error?.code});if(n.protocol!==`narraeon.runtime/v1`)throw Error(`The Runtime returned an incompatible protocol`);return n.result}},jc=document.querySelector(`#root`);if(jc===null)throw Error(`The page is missing the application mount point`);var Mc=new Ac;(0,u.createRoot)(jc).render((0,b.jsx)(l.StrictMode,{children:(0,b.jsx)(Cc,{client:Mc})}));