narraeon 0.7.5 → 0.7.6

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.
@@ -0,0 +1,1408 @@
1
+ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),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 A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(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 ee(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,ee(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),ee(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(A,`$&/`)+`/`)+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+j(a,u),c+=ee(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+j(a,u++),c+=ee(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ee(M(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 te(e,t,n){if(e==null)return e;var r=[],i=0;return ee(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:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(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&&j(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&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(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`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?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?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(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,F={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function I(e,t){ie++,re[ie]=e.current,e.current=t}var L=ae(null),R=ae(null),z=ae(null),se=ae(null);function ce(e,t){switch(I(z,t),I(R,e),I(L,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}}oe(L),I(L,e)}function le(){oe(L),oe(R),oe(z)}function ue(e){e.memoizedState!==null&&I(se,e);var t=L.current,n=Hd(t,e.type);t!==n&&(I(R,e),I(L,n))}function B(e){R.current===e&&(oe(L),oe(R)),se.current===e&&(oe(se),Qf._currentValue=F)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!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{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function V(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=V(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var H=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,U=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(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 Be(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=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(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 Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(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 Ue(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function We(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ge(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ke(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-Me(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&&qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Je(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ye(e,t){var n=t&-t;return n=n&42?1:Xe(n),(n&(e.suspendedLanes|t))===0?n:0}function Xe(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 Ze(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Qe(){var e=P.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function $e(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var et=Math.random().toString(36).slice(2),tt=`__reactFiber$`+et,nt=`__reactProps$`+et,rt=`__reactContainer$`+et,it=`__reactEvents$`+et,at=`__reactListeners$`+et,ot=`__reactHandles$`+et,st=`__reactResources$`+et,ct=`__reactMarker$`+et;function lt(e){delete e[tt],delete e[nt],delete e[it],delete e[at],delete e[ot]}function ut(e){var t=e[tt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[rt]||n[tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[tt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function dt(e){if(e=e[tt]||e[rt]){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 H.call(xt,e)?!0:H.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 W(e,t,n){t!=null&&(t=``+Et(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Et(n)}function Rt(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 zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=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 Vt(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||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(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&&Vt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Vt(e,a,t[a])}function Ut(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 Wt=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`]]),Gt=/^[\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 Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=dt(e);if(t&&(e=t.stateNode)){var n=e[nt]||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[nt]||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`:W(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Lt(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(vu(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[nt]||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 nn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,G=null;function cn(){if(G)return G;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.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 G=i.slice(e,1<r?1-r:void 0)}function ln(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 un(){return!0}function dn(){return!1}function fn(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)?un:dn,this.isPropagationStopped=dn,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=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=h({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=h({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(h({},bn,{dataTransfer:0})),Cn=fn(h({},hn,{relatedTarget:0})),wn=fn(h({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(h({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(h({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(h({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(h({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(h({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(h({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(h({},bn,{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})),Ln=fn(h({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=nn&&`CompositionEvent`in window,Bn=null;nn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=nn&&`TextEvent`in window&&!Bn,Hn=nn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),G=sn=on=null,qn=!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 Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=Td(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){vd(e,0)}function nr(e){if(At(ft(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(nn){var ar;if(nn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Yt(e)),en(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(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(!H.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(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=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(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 xr(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 Sr=nn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==jt(r)||(r=Cr,`selectionStart`in r&&xr(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}),Tr&&gr(Tr,r)||(Tr=r,r=Td(wr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};nn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`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(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),_t(t,[e])}var Ur=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)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[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&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(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-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(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 $r={};function ei(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 ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(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 ii(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 ai(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ni(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,L.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return oi(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=ti(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=ti(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=ti(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=ti(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-Me(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,K=!1,Oi=null,ki=!1,Ai=Error(s(519));function ji(e){throw Li(di(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ai}function Mi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[tt]=e,t[nt]=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),Rt(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=qt),t=!0):t=!1,t||ji(e,!0)}function Ni(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Ei=Ei.return}}function Pi(e){if(e!==Ei)return!1;if(!K)return Ni(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&&Di&&ji(e),Ni(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Di=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Di=uf(e)}else t===27?(t=Di,Zd(e.type)?(e=lf,lf=null,Di=e):Di=t):Di=Ei?cf(e.stateNode.nextSibling):null;return!0}function Fi(){Di=Ei=null,K=!1}function Ii(){var e=Oi;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),Oi=null),e}function Li(e){Oi===null?Oi=[e]:Oi.push(e)}var Ri=ae(null),zi=null,Bi=null;function Vi(e,t,n){I(Ri,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=Ri.current,oe(Ri)}function Ui(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 Wi(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),Ui(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),Ui(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 Gi(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;hr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===se.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&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){zi=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(zi,e)}function Yi(e,t){return zi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(s(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var Zi=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()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=ud(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(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 ua=N.S;N.S=function(e,t){$l=be(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=ae(null);function fa(){var e=da.current;return e===null?Il.pooledCache:e}function pa(e,t){t===null?I(da,da.current):I(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(s(460)),ga=Error(s(474)),_a=Error(s(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function q(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),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(qt,qt);else{if(e=Il,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,ha}}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,ha):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===ha||e===_a)throw Error(s(483))}var wa=null,Ta=0;function Ea(e){var t=Ta;return Ta+=1,wa===null&&(wa=[]),q(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=ri(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=si(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=ai(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=li(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=oi(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=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ai(t.type,t.key,t.props,null,e.mode,n),Da(n,t),n.return=e,n;case v:return t=li(t,e.mode,n),t.return=e,t;case O:return t=ba(t),f(e,t,n)}if(ne(t)||M(t))return t=oi(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,Yi(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)||M(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,Yi(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)||M(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,Yi(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&&xi(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&&xi(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&&xi(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&&xi(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&&xi(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&&xi(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=oi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ai(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=li(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(M(a)){if(l=M(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,Yi(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=si(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===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Aa=ka(!0),ja=ka(!1),J=!1;function Ma(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Na(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 Pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ia(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,Je(e,n)}}function La(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}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ra=!1;function za(){if(Ra){var e=oa;if(e!==null)throw e}}function Ba(e,t,n,r){Ra=!1;var i=e.updateQueue;J=!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?(Z&f)===f:(r&f)===f){f!==0&&f===aa&&(Ra=!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:J=!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),Wl|=o,e.lanes=o,e.memoizedState=d}}function Va(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ha(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Va(n[e],t)}var Ua=ae(null),Wa=ae(0);function Ga(e,t){e=Hl,I(Wa,e),I(Ua,t),Hl=e|t.baseLanes}function Ka(){I(Wa,Hl),I(Ua,Ua.current)}function qa(){Hl=Wa.current,oe(Ua),oe(Wa)}var Ja=ae(null),Ya=null;function Xa(e){var t=e.alternate;I(to,to.current&1),I(Ja,e),Ya===null&&(t===null||Ua.current!==null||t.memoizedState!==null)&&(Ya=e)}function Za(e){I(to,to.current),I(Ja,e),Ya===null&&(Ya=e)}function Qa(e){e.tag===22?(I(to,to.current),I(Ja,e),Ya===null&&(Ya=e)):$a(e)}function $a(){I(to,to.current),I(Ja,Ja.current)}function eo(e){oe(Ja),Ya===e&&(Ya=null),oe(to)}var to=ae(0);function no(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 ro=0,Y=null,io=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(!hr(e[n],t[n]))return!1;return!0}function go(e,t,n,r,i,a){return ro=a,Y=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=io!==null&&io.next!==null;if(ro=0,ao=io=Y=null,oo=!1,uo=0,fo=null,t)throw Error(s(300));e===null||Zs||(e=e.dependencies,e!==null&&Ki(e)&&(Zs=!0))}function vo(e,t,n,r){Y=e;var i=0;do{if(so&&(fo=null),uo=0,so=!1,25<=i)throw Error(s(301));if(i+=1,ao=io=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],(io===null?null:io.memoizedState)!==e&&(Y.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}ro=0,ao=io=Y=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?Y.memoizedState=ao=e:ao=ao.next=e,ao}function wo(){if(io===null){var e=Y.alternate;e=e===null?null:e.memoizedState}else e=io.next;var t=ao===null?Y.memoizedState:ao.next;if(t!==null)ao=t,io=e;else{if(e===null)throw Y.alternate===null?Error(s(467)):Error(s(310));io=e,e={memoizedState:io.memoizedState,baseState:io.baseState,baseQueue:io.baseQueue,queue:io.queue,next:null},ao===null?Y.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=q(fo,e,t),t=Y,(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 Ji(e)}throw Error(s(438,String(e)))}function Oo(e){var t=null,n=Y.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Y.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(),Y.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]=A;return t.index++,n}function ko(e,t){return typeof t==`function`?t(e):t}function Ao(e){return jo(wo(),io,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?(ro&f)===f:(Z&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===aa&&(d=!0);else if((ro&p)===p){u=u.next,p===aa&&(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,Y.lanes|=p,Wl|=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,Y.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!hr(a,e.memoizedState)&&(Zs=!0,d&&(n=oa,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);hr(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=Y,i=wo(),a=K;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!hr((io||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),Il===null)throw Error(s(349));a||ro&127||Po(r,t,n)}return n}function Po(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Y.updateQueue,t===null?(t=To(),Y.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!hr(e,n)}catch{return!0}}function Ro(e){var t=Xr(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){je(!0);try{n()}finally{je(!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,io,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=Il.formState;if(n!==null){a:{var r=Y;if(K){if(Di){b:{for(var i=Di,a=ki;i.nodeType!==8;)if(!a||(i=cf(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=cf(i.nextSibling),r=i.data===`F!`;break a}}ji(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,Y,r),r.dispatch=n,r=zo(!1),a=Os.bind(null,Y,!1,r.queue),r=Co(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Vo.bind(null,Y,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Yo(e){return Xo(wo(),io,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===ha?_a:e}else r=t;t=wo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Y.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=io;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=Y.updateQueue,t===null&&(t=To(),Y.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();Y.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;io!==null&&r!==null&&ho(r,io.memoizedState.deps)?i.memoizedState=$o(t,a,n,r):(Y.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){Y.flags|=4;var t=Y.updateQueue;if(t===null)t=To(),Y.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(Fl&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){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function ms(e,t,n){return n===void 0||ro&1073741824&&!(Z&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),Y.lanes|=e,Wl|=e,n)}function hs(e,t,n,r){return hr(n,t)?n:Ua.current===null?!(ro&42)||ro&1073741824&&!(Z&261930)?(Zs=!0,e.memoizedState=n):(e=fu(),Y.lanes|=e,Wl|=e,t):(e=ms(e,n,r),hr(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,la(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,F,n===null?_s:function(){return bs(e),n(r)})}function ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:F},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 Ji(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=Pa(n);var r=Fa(t,e,n);r!==null&&(pu(r,t,n),Ia(r,t,n)),t={cache:ta()},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=Yr(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,hr(s,o))return Jr(e,t,i,0),Il===null&&qr(),!1}catch{}if(n=Yr(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=Yr(e,n,r,2),t!==null&&pu(t,e,2)}function ks(e){var t=e.alternate;return e===Y||t!==null&&t===Y}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,Je(e,n)}}var Ms={readContext:Ji,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:Ji,use:Do,useCallback:function(e,t){return Co().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,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){je(!0);try{e()}finally{je(!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){je(!0);try{n(t)}finally{je(!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,Y,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,Y,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,Y,e.queue,!0,!1),Co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Y,i=Co();if(K){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Il===null)throw Error(s(349));Z&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=Il.identifierPrefix;if(K){var n=bi,r=yi;n=(r&~(1<<32-Me(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,Y,!0,n),n.dispatch=t,[e,t]},useMemoCache:Oo,useCacheRefresh:function(){return Co().memoizedState=ws.bind(null,Y)},useEffectEvent:function(e){var t=Co(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Ps={readContext:Ji,use:Do,useCallback:fs,useContext:Ji,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(),io.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(),io,e,t)},useMemoCache:Oo,useCacheRefresh:Cs};Ps.useEffectEvent=os;var Fs={readContext:Ji,use:Do,useCallback:fs,useContext:Ji,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 io===null?ms(n,e,t):hs(n,io.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 io===null?(n.baseState=e,[e,n.queue.dispatch]):Bo(n,io,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=Pa(r);i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(pu(t,e,r),Ia(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Pa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(pu(t,e,r),Ia(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Pa(n);r.tag=2,t!=null&&(r.callback=t),t=Fa(e,r,n),t!==null&&(pu(t,e,n),Ia(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?!gr(n,r)||!gr(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){Ur(e)}function Hs(e){console.error(e)}function Us(e){Ur(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=Pa(n),n.tag=3,n.payload={element:null},n.callback=function(){Ws(e,t)},n}function qs(e){return e=Pa(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`&&(Q===null?Q=new Set([this]):Q.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&&Gi(t,n,i,!0),n=Ja.current,n!==null){switch(n.tag){case 31:case 13:return Ya===null?Tu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===va?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===va?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=Ja.current,t===null?(r!==Ai&&(t=Error(s(423),{cause:r}),Li(di(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=di(r,n),i=Ks(e.stateNode,r,i),La(e,i),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ai&&(e=Error(s(422),{cause:r}),Li(di(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=di(a,n),Yl===null?Yl=[a]:Yl.push(a),Ul!==4&&(Ul=2),t===null)return!0;r=di(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),La(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`&&(Q===null||!Q.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=qs(i),Js(i,e,n,r),La(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 qi(t),r=go(e,t,n,o,a,i),s=bo(),e!==null&&!Zs?(xo(e,t,i),Cc(e,t,i)):(K&&s&&Ci(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`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,tc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!wc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Cc(e,t,i)}return t.flags|=1,e=ri(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(gr(a,r)&&e.ref===t.ref){if(Zs=!1,t.pendingProps=r=a,wc(e,i))e.flags&131072&&(Zs=!0);else return t.lanes=e.lanes,Cc(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&&pa(t,a===null?null:a.cachePool),a===null?Ka():Ga(t,a),Qa(t);else return r=t.lanes=536870912,ic(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ka(),$a(t)):(pa(t,a.cachePool),Ga(t,a),$a(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=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ka(),Qa(t),e!==null&&Gi(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,eo(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(Za(t),(e=Di)?(e=rf(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw ji(t);return t.lanes=536870912,null}return ac(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(Za(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||Gi(e,t,n,!1),i=(n&e.childLanes)!==0,Zs||i){if(r=Il,r!==null&&(o=Ye(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Xr(e,o),pu(r,e,o),Xs;Tu(),t=oc(e,t,n)}else e=a.treeContext,Di=cf(o.nextSibling),Ei=t,K=!0,Oi=null,ki=!1,e!==null&&Ti(t,e),t=ac(t,r),t.flags|=4096;return t}return e=ri(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 qi(t),n=go(e,t,n,r,void 0,i),r=bo(),e!==null&&!Zs?(xo(e,t,i),Cc(e,t,i)):(K&&r&&Ci(t),t.flags|=1,Qs(e,t,n,i),t.child)}function uc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=vo(t,r,n,i),_o(e),r=bo(),e!==null&&!Zs?(xo(e,t,a),Cc(e,t,a)):(K&&r&&Ci(t),t.flags|=1,Qs(e,t,n,a),t.child)}function dc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(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={},Ma(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,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),Ba(t,r,a,i),za(),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=$r,typeof u==`object`&&u&&(o=Ji(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),J=!1;var f=t.memoizedState;a.state=f,Ba(t,r,a,i),za(),l=t.memoizedState,s||f!==l||J?(typeof d==`function`&&(Is(t,n,d,r),l=t.memoizedState),(c=J||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,Na(e,t),o=t.memoizedProps,u=Bs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(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),J=!1,f=t.memoizedState,a.state=f,Ba(t,r,a,i),za();var p=t.memoizedState;o!==d||f!==p||J||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Is(t,n,s,r),p=t.memoizedState),(u=J||Rs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(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=Cc(e,t,i),e}function fc(e,t,n,r){return Fi(),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:ma()}}function hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),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:!!(to.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(K){if(i?Xa(t):$a(t),(e=Di)?(e=rf(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw ji(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?($a(t),i=t.mode,c=vc({mode:`hidden`,children:c},i),r=oi(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)):(Xa(t),_c(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(Xa(t),t.flags&=-257,t=yc(e,t,n)):t.memoizedState===null?($a(t),c=r.fallback,i=t.mode,r=vc({mode:`visible`,children:r.children},i),c=oi(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)):($a(t),t.child=e.child,t.flags|=128,t=null);else if(Xa(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,Li({value:r,source:null,stack:null}),t=yc(e,t,n)}else if(Zs||Gi(e,t,n,!1),o=(n&e.childLanes)!==0,Zs||o){if(o=Il,o!==null&&(r=Ye(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),pu(o,e,r),Xs;af(c)||Tu(),t=yc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=cf(c.nextSibling),Ei=t,K=!0,Oi=null,ki=!1,e!==null&&Ti(t,e),t=_c(t,r.children),t.flags|=4096);return t}return i?($a(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,i,n,null),c.flags|=2):c=ri(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=ma():(l=ea._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)):(Xa(t),n=e.child,e=n.sibling,n=ri(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=ti(22,e,null,t),e.lanes=0,e}function yc(e,t,n){return Aa(t,e.child,null,n),e=_c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function xc(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 Sc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=to.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,I(to,o),Qs(e,t,r,n),r=K?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bc(e,n,t);else if(e.tag===19)bc(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&&no(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),xc(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&&no(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}xc(t,!0,n,null,a,r);break;case`together`:xc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Cc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Gi(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=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function wc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ki(e)))}function Tc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Vi(t,ea,e.memoizedState.cache),Fi();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Vi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Za(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xa(t),e=Cc(e,t,n),e===null?null:e.sibling):gc(e,t,n):(Xa(t),t.flags|=128,null);Xa(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Sc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(to,to.current),r)break;return null;case 22:return t.lanes=0,nc(e,t,n,t.pendingProps);case 24:Vi(t,ea,e.memoizedState.cache)}return Cc(e,t,n)}function Ec(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Zs=!0;else{if(!wc(e,n)&&!(t.flags&128))return Zs=!1,Tc(e,t,n);Zs=!!(e.flags&131072)}}else Zs=!1,K&&t.flags&1048576&&Si(t,hi,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`)ni(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=te(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(ce(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Na(e,t),Ba(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Vi(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0),za(),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=di(Error(s(424)),t),Li(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(Di=cf(e.firstChild),Ei=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(Fi(),r===i){t=Cc(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(z.current).createElement(n),r[tt]=t,r[nt]=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 ue(t),e===null&&K&&(r=t.stateNode=ff(t.type,t.pendingProps,z.current),Ei=t,ki=!0,i=Di,Zd(t.type)?(lf=i,Di=cf(r.firstChild)):Di=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=Di)&&(r=tf(r,t.type,t.pendingProps,ki),r===null?i=!1:(t.stateNode=r,Ei=t,Di=cf(r.firstChild),ki=!1,i=!0)),i||ji(t)),ue(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=Di)&&(n=nf(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||ji(t)),null;case 13:return gc(e,t,n);case 4:return ce(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,Vi(t,t.type,r.value),Qs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,qi(t),i=Ji(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 Sc(e,t,n);case 31:return sc(e,t,n);case 22:return nc(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(i=fa(),i===null&&(i=Il,a=ta(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ma(t),Vi(t,ea,i)):((e.lanes&n)!==0&&(Na(e,t),Ba(t,null,null,n),za()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Vi(t,ea,r),r!==i.cache&&Wi(t,[ea],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Vi(t,ea,r))),Qs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Dc(e){e.flags|=4}function Oc(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=va,ga}}else e.flags&=-16777217}function kc(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=va,ga}}function Ac(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ue(),e.lanes|=t,Jl|=t)}function jc(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 Mc(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 Nc(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mc(t),null;case 1:return Mc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?Dc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ii())),Mc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Dc(t),a===null?(Mc(t),Oc(t,i,null,r,n)):(Mc(t),kc(t,a))):a?a===e.memoizedState?(Mc(t),t.flags&=-16777217):(Dc(t),Mc(t),kc(t,a)):(e=e.memoizedProps,e!==r&&Dc(t),Mc(t),Oc(t,i,e,r,n)),null;case 27:if(B(t),n=z.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Mc(t),null}e=L.current,Pi(t)?Mi(t,e):(e=ff(i,r,n),t.stateNode=e,Dc(t))}return Mc(t),null;case 5:if(B(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Mc(t),null}if(a=L.current,Pi(t))Mi(t,a);else{var o=Bd(z.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[tt]=t,a[nt]=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&&Dc(t)}}return Mc(t),Oc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Dc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=z.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ei,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[tt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||ji(t,!0)}else e=Bd(e).createTextNode(r),e[tt]=t,t.stateNode=e}return Mc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(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[tt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),e=!1}else n=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(eo(t),t):(eo(t),null);if(t.flags&128)throw Error(s(558))}return Mc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Pi(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[tt]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),i=!1}else i=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(eo(t),t):(eo(t),null)}return eo(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),Ac(t,t.updateQueue),Mc(t),null);case 4:return le(),e===null&&xd(t.stateNode.containerInfo),Mc(t),null;case 10:return Hi(t.type),Mc(t),null;case 19:if(oe(to),r=t.memoizedState,r===null)return Mc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)jc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=no(e),a!==null){for(t.flags|=128,jc(r,!1),e=a.updateQueue,t.updateQueue=e,Ac(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return I(to,to.current&1|2),K&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>eu&&(t.flags|=128,i=!0,jc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=no(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Ac(t,e),jc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!K)return Mc(t),null}else 2*be()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,i=!0,jc(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?(Mc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=to.current,I(to,i?n&1|2:n&1),K&&xi(t,r.treeForkCount),e);case 22:case 23:return eo(t),qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Mc(t),t.subtreeFlags&6&&(t.flags|=8192)):Mc(t),n=t.updateQueue,n!==null&&Ac(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&&oe(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Mc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Pc(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return B(t),null;case 31:if(t.memoizedState!==null){if(eo(t),t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(eo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(to),null;case 4:return le(),null;case 10:return Hi(t.type),null;case 22:case 23:return eo(t),qa(),e!==null&&oe(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Fc(e,t){switch(wi(t),t.tag){case 3:Hi(ea),le();break;case 26:case 27:case 5:B(t);break;case 4:le();break;case 31:t.memoizedState!==null&&eo(t);break;case 13:eo(t);break;case 19:oe(to);break;case 10:Hi(t.type);break;case 22:case 23:eo(t),qa(),e!==null&&oe(da);break;case 24:Hi(ea)}}function Ic(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 Lc(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 Rc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ha(t,n)}catch(t){Uu(e,e.return,t)}}}function zc(e,t,n){n.props=Bs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Bc(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 Vc(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 Hc(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 Uc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[nt]=t}catch(t){Uu(e,e.return,t)}}function Wc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Gc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Wc(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 Kc(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=qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),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,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(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(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[tt]=e,t[nt]=n}catch(t){Uu(e,e.return,t)}}var Yc=!1,Xc=!1,Zc=!1,Qc=typeof WeakSet==`function`?WeakSet:Set,$c=null;function el(e,t){if(e=e.containerInfo,Rd=sp,e=br(e),xr(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,$c=t;$c!==null;)if(t=$c,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$c=e;else for(;$c!==null;){switch(t=$c,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,$c=e;break}$c=t.return}}function tl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:gl(e,n),r&4&&Ic(5,n);break;case 1:if(gl(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&&Rc(n),r&512&&Bc(n,n.return);break;case 3:if(gl(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{Ha(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&Jc(n);case 26:case 5:gl(e,n),t===null&&r&4&&Hc(n),r&512&&Bc(n,n.return);break;case 12:gl(e,n);break;case 31:gl(e,n),r&4&&sl(e,n);break;case 13:gl(e,n),r&4&&cl(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||Yc,!r){t=t!==null&&t.memoizedState!==null||Xc,i=Yc;var a=Xc;Yc=r,(Xc=t)&&!a?vl(e,n,!!(n.subtreeFlags&8772)):gl(e,n),Yc=i,Xc=a}break;case 30:break;default:gl(e,n)}}function nl(e){var t=e.alternate;t!==null&&(e.alternate=null,nl(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 rl=null,il=!1;function al(e,t,n){for(n=n.child;n!==null;)ol(e,t,n),n=n.sibling}function ol(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:Xc||Vc(n,t),al(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xc||Vc(n,t);var r=rl,i=il;Zd(n.type)&&(rl=n.stateNode,il=!1),al(e,t,n),pf(n.stateNode),rl=r,il=i;break;case 5:Xc||Vc(n,t);case 6:if(r=rl,i=il,rl=null,al(e,t,n),rl=r,il=i,rl!==null){if(il)try{(rl.nodeType===9?rl.body:rl.nodeName===`HTML`?rl.ownerDocument.body:rl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{rl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}}break;case 18:rl!==null&&(il?(e=rl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(rl,n.stateNode));break;case 4:r=rl,i=il,rl=n.stateNode.containerInfo,il=!0,al(e,t,n),rl=r,il=i;break;case 0:case 11:case 14:case 15:Lc(2,n,t),Xc||Lc(4,n,t),al(e,t,n);break;case 1:Xc||(Vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&zc(n,t,r)),al(e,t,n);break;case 21:al(e,t,n);break;case 22:Xc=(r=Xc)||n.memoizedState!==null,al(e,t,n),Xc=r;break;default:al(e,t,n)}}function sl(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 cl(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 ll(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qc),t;default:throw Error(s(435,e.tag))}}function ul(e,t){var n=ll(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function dl(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)){rl=c.stateNode,il=!1;break a}break;case 5:rl=c.stateNode,il=!1;break a;case 3:case 4:rl=c.stateNode.containerInfo,il=!0;break a}c=c.return}if(rl===null)throw Error(s(160));ol(a,o,i),rl=null,il=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pl(t,e),t=t.sibling}var fl=null;function pl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dl(t,e),ml(e),r&4&&(Lc(3,e,e.return),Ic(3,e),Lc(5,e,e.return));break;case 1:dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),r&64&&Yc&&(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=fl;if(dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(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[tt]||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[tt]=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[tt]=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&&Uc(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:dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),n!==null&&r&4&&Uc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(dl(t,e),ml(e),r&512&&(Xc||n===null||Vc(n,n.return)),e.flags&32){i=e.stateNode;try{zt(i,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Uc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Zc=!0);break;case 6:if(dl(t,e),ml(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=fl,fl=gf(t.containerInfo),dl(t,e),fl=i,ml(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Zc&&(Zc=!1,hl(e));break;case 4:r=fl,fl=gf(e.stateNode.containerInfo),dl(t,e),ml(e),fl=r;break;case 12:dl(t,e),ml(e);break;case 31:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 13:dl(t,e),ml(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=be()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Yc,d=Xc;if(Yc=u||i,Xc=d||l,dl(t,e),Xc=d,Yc=u,ml(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Yc||Xc||_l(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,ul(e,n))));break;case 19:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 30:break;case 21:break;default:dl(t,e),ml(e)}}function ml(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Wc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;qc(e,Gc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(zt(a,``),n.flags&=-33),qc(e,Gc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Kc(e,Gc(e),o);break;default:throw Error(s(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;hl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function gl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tl(e,t.alternate,t),t=t.sibling}function _l(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Lc(4,t,t.return),_l(t);break;case 1:Vc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&zc(t,t.return,n),_l(t);break;case 27:pf(t.stateNode);case 26:case 5:Vc(t,t.return),_l(t);break;case 22:t.memoizedState===null&&_l(t);break;case 30:_l(t);break;default:_l(t)}e=e.sibling}}function vl(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:vl(i,a,n),Ic(4,a);break;case 1:if(vl(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++)Va(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Rc(a),Bc(a,a.return);break;case 27:Jc(a);case 26:case 5:vl(i,a,n),n&&r===null&&o&4&&Hc(a),Bc(a,a.return);break;case 12:vl(i,a,n);break;case 31:vl(i,a,n),n&&o&4&&sl(i,a);break;case 13:vl(i,a,n),n&&o&4&&cl(i,a);break;case 22:a.memoizedState===null&&vl(i,a,n),Bc(a,a.return);break;case 30:break;default:vl(i,a,n)}t=t.sibling}}function yl(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&&na(n))}function bl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function xl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sl(e,t,n,r),t=t.sibling}function Sl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:xl(e,t,n,r),i&2048&&Ic(9,t);break;case 1:xl(e,t,n,r);break;case 3:xl(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&&na(e)));break;case 12:if(i&2048){xl(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 xl(e,t,n,r);break;case 31:xl(e,t,n,r);break;case 13:xl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?xl(e,t,n,r):(a._visibility|=2,Cl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?xl(e,t,n,r):wl(e,t),i&2048&&yl(o,t);break;case 24:xl(e,t,n,r),i&2048&&bl(t.alternate,t);break;default:xl(e,t,n,r)}}function Cl(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:Cl(a,o,s,c,i),Ic(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Cl(a,o,s,c,i)):u._visibility&2?Cl(a,o,s,c,i):wl(a,o),i&&l&2048&&yl(o.alternate,o);break;case 24:Cl(a,o,s,c,i),i&&l&2048&&bl(o.alternate,o);break;default:Cl(a,o,s,c,i)}t=t.sibling}}function wl(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:wl(n,r),i&2048&&yl(r.alternate,r);break;case 24:wl(n,r),i&2048&&bl(r.alternate,r);break;default:wl(n,r)}t=t.sibling}}var Tl=8192;function El(e,t,n){if(e.subtreeFlags&Tl)for(e=e.child;e!==null;)Dl(e,t,n),e=e.sibling}function Dl(e,t,n){switch(e.tag){case 26:El(e,t,n),e.flags&Tl&&e.memoizedState!==null&&Gf(n,fl,e.memoizedState,e.memoizedProps);break;case 5:El(e,t,n);break;case 3:case 4:var r=fl;fl=gf(e.stateNode.containerInfo),El(e,t,n),fl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Tl,Tl=16777216,El(e,t,n),Tl=r):El(e,t,n));break;default:El(e,t,n)}}function Ol(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 kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Al(e),e=e.sibling}function Al(e){switch(e.tag){case 0:case 11:case 15:kl(e),e.flags&2048&&Lc(9,e,e.return);break;case 3:kl(e);break;case 12:kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):kl(e);break;default:kl(e)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Lc(8,t,t.return),jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Ml(e,t){for(;$c!==null;){var n=$c;switch(n.tag){case 0:case 11:case 15:Lc(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:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,$c=r;else a:for(n=e;$c!==null;){r=$c;var i=r.sibling,a=r.return;if(nl(r),r===n){$c=null;break a}if(i!==null){i.return=a,$c=i;break a}$c=a}}}var Nl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,X=null,Z=0,Ll=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,Q=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Fl&2&&Z!==0?Z&-Z:N.T===null?Qe():ud()}function fu(){if(ql===0){if(!(Z&536870912)||K){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),ql=e}else ql=536870912}return e=Ja.current,e!==null&&(e.flags|=32),ql}function pu(e,t,n){(e===Il&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Z,ql,!1)),Ge(e,n),Fl&2&&e===Il||(e===Il&&(!(Fl&2)&&(Gl|=n),Ul===4&&_u(e,Z,ql,!1)),nd(e))}function mu(e,t,n){if(Fl&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ve(e,t),i=r?Ou(e,t):Eu(e,t,!0),a=r;do{if(i===0){Bl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,a&&!gu(n))i=Eu(e,t,!1),a=!1;else{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=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,o).flags|=256),o=Eu(c,o,!1),o!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=a,Gl|=a,i=4;break a}a=Xl,Xl=i,a!==null&&(Xl===null?Xl=a:Xl.push.apply(Xl,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,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=Ql+300-be(),10<i)){if(_u(r,t,ql,!zl),Be(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,a,`Throttled`,-0,0),i);break a}hu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,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:qt},Dl(t,a,d);var m=(a&62914560)===a?Ql-be():(a&4194048)===a?$l-be():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(!hr(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&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&qe(e,n,t)}function vu(){return Fl&6?!0:(rd(0,!1),!1)}function yu(){if(X!==null){if(Ll===0)var e=X.return;else e=X,Bi=zi=null,So(e),wa=null,Ta=0,e=X;for(;e!==null;)Fc(e.alternate,e),e=e.return;X=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(),Il=e,X=n=ri(e.current,null),Z=t,Ll=0,Rl=null,zl=!1,Bl=Ve(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,qr(),n}function xu(e,t){Y=null,N.H=Ms,t===ha||t===_a?(t=Sa(),Ll=3):t===ga?(t=Sa(),Ll=4):Ll=t===Xs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,X===null&&(Ul=1,Ws(e,di(t,e.current)))}function Su(){var e=Ja.current;return e===null?!0:(Z&4194048)===Z?Ya===null:(Z&62914560)===Z||Z&536870912?e===Ya:!1}function Cu(){var e=N.H;return N.H=Ms,e===null?Ms:e}function wu(){var e=N.A;return N.A=Nl,e}function Tu(){Ul=4,zl||(Z&4194048)!==Z&&Ja.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Il===null||_u(Il,Z,ql,!1)}function Eu(e,t,n){var r=Fl;Fl|=2;var i=Cu(),a=wu();(Il!==e||Z!==t)&&(tu=null,bu(e,t)),t=!1;var o=Ul;a:do try{if(Ll!==0&&X!==null){var s=X,c=Rl;switch(Ll){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:Ja.current===null&&(t=!0);var l=Ll;if(Ll=0,Rl=null,Mu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Ll,Ll=0,Rl=null,Mu(e,s,c,l)}}Du(),o=Ul;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Bi=zi=null,Fl=r,N.H=i,N.A=a,X===null&&(Il=null,Z=0,qr()),o}function Du(){for(;X!==null;)Au(X)}function Ou(e,t){var n=Fl;Fl|=2;var r=Cu(),i=wu();Il!==e||Z!==t?(tu=null,eu=be()+500,bu(e,t)):Bl=Ve(e,t);a:do try{if(Ll!==0&&X!==null){t=X;var a=Rl;b:switch(Ll){case 1:Ll=0,Rl=null,Mu(e,t,a,1);break;case 2:case 9:if(ya(a)){Ll=0,Rl=null,ju(t);break}t=function(){Ll!==2&&Ll!==9||Il!==e||(Ll=7),nd(e)},a.then(t,t);break a;case 3:Ll=7;break a;case 4:Ll=5;break a;case 7:ya(a)?(Ll=0,Rl=null,ju(t)):(Ll=0,Rl=null,Mu(e,t,a,7));break;case 5:var o=null;switch(X.tag){case 26:o=X.memoizedState;case 5:case 27:var c=X;if(o?Wf(o):c.stateNode.complete){Ll=0,Rl=null;var l=c.sibling;if(l!==null)X=l;else{var u=c.return;u===null?X=null:(X=u,Nu(u))}break b}}Ll=0,Rl=null,Mu(e,t,a,5);break;case 6:Ll=0,Rl=null,Mu(e,t,a,6);break;case 8:yu(),Ul=6;break a;default:throw Error(s(462))}}ku();break}catch(t){xu(e,t)}while(1);return Bi=zi=null,N.H=r,N.A=i,Fl=n,X===null?(Il=null,Z=0,qr(),Ul):0}function ku(){for(;X!==null&&!ve();)Au(X)}function Au(e){var t=Ec(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Nu(e):X=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,Z);break;case 11:t=uc(n,t,t.pendingProps,t.type.render,t.ref,Z);break;case 5:So(t);default:Fc(n,t),t=X=ii(t,Hl),t=Ec(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):X=t}function Mu(e,t,n,r){Bi=zi=null,So(t),wa=null,Ta=0;var i=t.return;try{if(Ys(e,i,t,n,Z)){Ul=1,Ws(e,di(n,e.current)),X=null;return}}catch(t){if(i!==null)throw X=i,t;Ul=1,Ws(e,di(n,e.current)),X=null;return}t.flags&32768?(K||r===1?e=!0:Bl||Z&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ja.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,zl);return}e=t.return;var n=Nc(t.alternate,t,Hl);if(n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Ul===0&&(Ul=5)}function Pu(e,t){do{var n=Pc(e.alternate,e);if(n!==null){n.flags&=32767,X=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){X=e;return}X=e=n}while(e!==null);Ul=6,X=null}function Fu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Fl&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Kr,Ke(e,n,a,o,c,l),e===Il&&(X=Il=null,Z=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(we,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=Fl,Fl|=4;try{el(e,t,n)}finally{Fl=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=Fl;Fl|=4;try{pl(t,e);var a=zd,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(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 _=vr(s,h),v=vr(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{Fl=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=Fl;Fl|=4;try{tl(e,t.alternate,t)}finally{Fl=i,P.p=r,N.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,ye();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&&(Q=null),Ze(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,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,na(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=Ze(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,Fl&6)throw Error(s(331));var c=Fl;if(Fl|=4,Al(a.current),Sl(a,a.current,o,n),Fl=c,rd(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,a)}catch{}return!0}finally{P.p=i,N.T=r,zu(e,t)}}function Hu(e,t,n){t=di(n,t),t=Ks(e.stateNode,t,2),e=Fa(e,t,2),e!==null&&(Ge(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`&&(Q===null||!Q.has(r))){e=di(n,e),n=qs(2),r=Fa(t,n,2),r!==null&&(Js(n,r,t,e),Ge(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;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)||(Vl=!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,Il===e&&(Z&n)===n&&(Ul===4||Ul===3&&(Z&62914560)===Z&&300>be()-Ql?!(Fl&2)&&bu(e,0):Kl|=n,Jl===Z&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=Ue()),e=Xr(e,t),e!==null&&(Ge(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 _e(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-Me(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=Z,a=Be(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(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=be(),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-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Z,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&U(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&U(r),Ze(n)){case 2:case 8:n=Ce;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=sd.bind(null,e),n=_e(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&U(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=Z;return r=Be(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,be()),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(){Fl&6?_e(Se,id):ad()})}function ud(){if(td===0){var e=aa;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+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[nt]||null).action),o=r.submitter;o&&(t=(t=o[nt]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`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<Vr.length;md++){var hd=Vr[md];Hr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`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){Ur(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){Ur(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[it];n===void 0&&(n=t[it]=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,!rn||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}en(function(){var r=a,i=Yt(n),o=[];a:{var s=Br.get(e);if(s!==void 0){var c=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:c=Mn;break;case`focusin`:u=`focus`,c=Cn;break;case`focusout`:u=`blur`,c=Cn;break;case`beforeblur`:case`afterblur`:c=Cn;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=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Pn;break;case Nr:case Pr:case Fr:c=wn;break;case zr:c=Fn;break;case`scroll`:case`scrollend`:c=gn;break;case`wheel`:c=In;break;case`copy`:case`cut`:case`paste`:c=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Nn;break;case`toggle`:case`beforetoggle`:c=Ln}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=tn(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!==Jt&&(u=n.relatedTarget||n.fromElement)&&(ut(u)||u[rt]))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=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,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=rr;else if(Zn(s)){if(ir)v=pr;else{v=dr;var y=ur}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Ut(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(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`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(o,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(o,n,i)}var b;if(zn)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 qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(on=i,sn=`value`in on?on.value:on.textContent,qn=!0)),y=Td(r,x),0<y.length&&(x=new En(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new En(`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=tn(e,n),i!=null&&r.unshift(wd(e,i,a)),i=tn(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=tn(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=tn(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===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(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`:Ht(e,r,a);break;case`data`:if(t!==`object`){wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+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=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);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=Kt(``+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=Wt.get(n)||n,Ct(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Ht(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`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=qt);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[nt]||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)}Rt(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(Ut(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)}W(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(Ut(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=z.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[tt]||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:F,_currentValue2:F,_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=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(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=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ma(a),e}function tp(e){return e?(e=$r,e):$r}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Pa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Fa(e,r,t),n!==null&&(pu(n,e,t),Ia(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=Xr(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=Xe(t);var n=Xr(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=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Fl&6)&&(eu=be()+500,rd(0,!1))}}break;case 31:case 13:s=Xr(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=Yt(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(xe()){case Se:return 2;case Ce:return 8;case we:case Te:return 32;case Ee: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,$e(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,$e(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);Jt=r,n.target.dispatchEvent(r),Jt=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[nt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[nt]||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[rt]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qe();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{ke=zp.inject(Rp),Ae=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[rt]=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={archiveBytes:1024**3,extractedBytes:2*1024**3,entries:2e5,entryBytes:256*1024**2},f=16;function p(e){let t=new Uint8Array(f);return globalThis.crypto.getRandomValues(t),`${e}-${Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}`}function m(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}}function h(e,t){if(e.mode!==`tabletop`)return t===`zh-CN`?`互动式小说`:`Interactive fiction`;let n=e.scheme===`bag`?t===`zh-CN`?`混乱袋`:`Chaos bag`:e.scheme;return t===`zh-CN`?`跑团 · ${n}`:`Tabletop · ${n}`}var g=[`en`,`zh-CN`],_={density:`compact`,fontSize:17,lineHeight:1.7,letterSpacing:.01,measure:48,showTechnicalInfo:!1};function v(e){return g.includes(e)}var y={maxFiles:1024,maxFileBytes:4194304,maxTotalBytes:33554432};function b(e){return e.maxTotalBytes+e.maxFiles*1024+65557}var x=b(y);Math.ceil(x/3)*4;var S=`narraeon.runtime/v1`,C=`en`,w={页面出错了:`Something went wrong`,导出诊断日志:`Export diagnostic logs`,"页面显示时发生错误,已保存的故事和世界不受影响。请重新加载页面;如果反复出现,请把下面的技术详情发给开发者。":`The page hit an error while displaying. Your saved stories and worlds are not affected. Reload the page; if this keeps happening, send the technical details below to the developers.`,重新加载页面:`Reload page`,"对话同步失败:{message} 请重新打开此页面。":`Conversation sync failed: {message} Reopen this page.`,"Narraeon 服务请求失败(HTTP {status})。":`The Narraeon request failed (HTTP {status}).`,"Narraeon 服务版本与页面不匹配,请刷新页面。":`The Narraeon service version does not match this page. Refresh the page.`,"无法连接到 Narraeon 服务。请确认服务正在运行、网络连接正常。":`Cannot reach the Narraeon service. Make sure it is running and your network connection works.`,"Narraeon 服务暂时不可用(HTTP {status}),可能正在重启,请稍后重试。":`The Narraeon service is temporarily unavailable (HTTP {status}) and may be restarting. Try again shortly.`,"Narraeon 服务返回了无法识别的响应(HTTP {status})。请稍后重试;如果使用了反向代理,请检查代理配置。":`The Narraeon service returned an unreadable response (HTTP {status}). Try again shortly; if you use a reverse proxy, check its configuration.`,"模型正在生成,请等它完成或先取消,再进行这项操作。":`The model is still generating. Wait for it to finish or cancel it, then try again.`,"世界刚被其他操作更新,这次操作没有生效。请刷新页面后重试。":`The world was just updated by another operation, so this action did not take effect. Refresh the page and try again.`,"世界正在修订,游玩和其他修改已锁定。请先应用或放弃修订。":`The world is being revised, so play and other changes are locked. Apply or discard the revision first.`,"这个世界来自备份,请先开启全新上下文再继续。":`This world came from a backup. Start a fresh context before continuing.`,"当前上下文无法继续,请使用全新上下文。":`The current context cannot continue. Use a fresh context.`,"找不到要操作的对话记录,请刷新页面后重试。":`The conversation record for this action was not found. Refresh the page and try again.`,"世界不存在,可能已被删除。":`This world does not exist; it may have been deleted.`,"世界正在处理另一项操作,请稍后重试。":`The world is busy with another operation. Try again shortly.`,"上一次修改已保存,但还没有完整写入当前世界。请刷新页面;如果仍然失败,请在世界管理中修复世界。":`The last change was saved but has not been fully written to the current world. Refresh the page; if it still fails, repair the world from world management.`,"正在导出世界备份,请等它完成后再操作。":`A world backup is being exported. Wait for it to finish, then try again.`,"世界名称须为 1–160 个字符,且不能换行。":`World names must be 1–160 characters with no line breaks.`,"玩家输入不能为空。":`Player input cannot be empty.`,"修订内容已在别处更新,请刷新后再保存。":`The revision was updated elsewhere. Refresh before saving.`,"请等待或取消正在进行的 AI 回复,再修改这次修订。":`Wait for or cancel the running AI reply before changing this revision.`,"下一次发送将开启全新上下文,尚无实报占用。":`The next message starts a fresh context; no usage has been reported yet.`,"原上下文无法用于这次重新生成。可使用当前模型和预设,从同一条玩家输入开启全新上下文。":`The original context cannot be used for this regeneration. Use the current model and presets to regenerate from the same player input in a fresh context.`,用全新上下文重新生成:`Regenerate with a fresh context`,旧模型配置曾阻止发送:`Previous model settings blocked sending`,"旧版本因模型配置变化阻止了这次发送。切回原协议后,可按上下文当前状态继续。":`An older version blocked this send after the model settings changed. Switch back to the original protocol and continue according to the context's current status.`,"当前模型协议与此上下文不同。切回原协议即可继续;使用新协议请开启全新上下文。":`The selected model protocol differs from this context. Switch back to the original protocol to continue, or start a fresh context with the new protocol.`,复制:`Copy`,主角模板:`Protagonist template`,不使用:`None`,管理主角模板:`Manage protagonist templates`,主角模板列表:`Protagonist template list`,新建主角模板:`New protagonist template`,模板名称:`Template name`,模板正文:`Template body`,"名称为 1–80 个字符;正文为自由 Markdown,最多 16 KiB。":`Use a name of 1–80 characters and a free Markdown body of up to 16 KiB.`,主角模板保存失败:`Could not save protagonist template`,主角模板读取失败:`Could not load protagonist templates`,重新读取主角模板:`Reload protagonist templates`,"放弃未保存的主角模板修改?":`Discard unsaved protagonist template changes?`,"删除这个主角模板?":`Delete this protagonist template?`,应用并开始游玩:`Apply and start playing`,"请按下面的主角模板修改本世界的主角。\n\n- 找到本世界中代表玩家的主角文档,按模板改写姓名、外貌、背景、性格等相关内容。\n- 模板与本世界设定冲突的部分,保留模板的意图,按本世界的规则调整。\n- 只修改主角相关的内容,不修改其他人物、地点、规则或世界控制。\n- 如果本世界中找不到明确的主角文档,先在回复中说明并询问我,不要擅自新建。\n\n主角模板:\n\n{body}":`Please modify this world’s protagonist using the template below.
10
+
11
+ - Find the protagonist document representing the player in this world, and update the name, appearance, background, personality, and other relevant content according to the template.
12
+ - Where the template conflicts with this world’s setting, preserve its intent while adapting it to the world’s rules.
13
+ - Modify only protagonist-related content. Do not modify other characters, locations, rules, or world control.
14
+ - If there is no clear protagonist document, explain this in your reply and ask me first. Do not create one on your own.
15
+
16
+ Protagonist template:
17
+
18
+ {body}`,导出世界备份:`Export world backup`,导出备份:`Export backup`,"正在导出世界备份…":`Exporting world backup…`,"正在导出…":`Exporting…`,"世界备份已开始下载。":`Your world backup download has started.`,"备份已失效或不存在,请重新导出。":`This backup is no longer available or does not exist. Export the world again.`,"下载失败,请重试。":`The download failed. Try again.`,"备份包含完整故事、世界文档和模型调用记录,不包含 API Key 和模型配置。":`Backups include the complete story, world documents, and model call records. API keys and model configuration are excluded.`,"世界备份超过容量限制。":`The world backup exceeds the size limits.`,"正在上传世界备份:{progress}%":`Uploading world backup: {progress}%`,"正在校验并导入世界备份…":`Validating and importing world backup…`,"世界备份已导入,新世界已加入列表。":`World backup imported. The new world is now in your list.`,"世界备份 ZIP 文件":`World backup ZIP file`,"此上下文来自备份;修改后须以本机选择开启全新上下文。":`This context came from a backup. After editing, start a fresh context with your local choices.`,导入世界备份:`Import world backup`,"世界备份上传失败,请重试。":`World backup upload failed. Please try again.`,"这不是有效的世界备份,请选择世界备份 ZIP。":`This is not a valid world backup. Select a world backup ZIP.`,"此世界备份格式不受支持,请升级应用后重试。":`This world backup format is unsupported. Update the app and try again.`,"世界备份包含不安全或冲突的文件路径。":`The world backup contains unsafe or conflicting file paths.`,"世界备份完整性校验失败,未创建世界。":`World backup integrity verification failed. No world was created.`,"请先等待生成结束,并应用或放弃世界修订,再导出备份。":`Wait for generation to finish and apply or discard any world revision before exporting a backup.`,"请先修复世界,再导出备份。":`Repair the world before exporting a backup.`,"世界从备份导入;下一次行动会从新上下文开始":`World imported from backup; your next action will start a fresh context`,保存说明:`About saving`,重命名文件:`Rename file`,"生成预览后,在这里查看实际发送的消息、材料与工具。":`Generate a preview to inspect the messages, materials, and tools sent to the model.`,关闭提示:`Dismiss notification`,"找不到该页面。":`Page not found.`,"找不到该世界。":`World not found.`,"找不到该内容包。":`Content package not found.`,"找不到该预设。":`Preset not found.`,"已保留当前页面的未保存修改,请保存或放弃后再切换。":`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}`,刚刚:`Just now`,活动时间未记录:`Activity time not recorded`,待升级:`Upgrade pending`,"1 回合":`1 turn`,"{count} 回合":`{count} turns`,"先新建或导入一份内容包,再完善开场与世界设定。":`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`,侧栏:`Sidebar`,删除请求:`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 changed elsewhere. Your draft is kept and has not been saved.`,加载最新版本:`Load latest version`,"已放弃草稿,载入内容包最新版本。":`Discarded the draft and loaded the latest content package.`,"内容包版本缺失,请重新读取后再保存。":`The content package version is missing. Reload it before saving.`,"内容包已重命名。":`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:
19
+ id: character.example
20
+ ref: example
21
+ title: Alex Morgan
22
+ summary: A stable one-sentence description.
23
+ aliases: []
24
+ `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
25
+ $document:
26
+ id: rule.example
27
+ ref: example
28
+ title: Example rule
29
+ summary: A stable one-sentence description.
30
+ aliases: []
31
+ ---
32
+
33
+ # Example rule
34
+ `,"输入 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`,"内容包操作:{title}":`Content-package actions: {title}`,"重命名内容包:{title}":`Rename content package: {title}`,"删除内容包:{title}":`Delete content package: {title}`,调整此刻面板宽度:`Resize the current scene panel`,"拖拽调整宽度,双击恢复默认":`Drag to resize; double-click to reset`,保存内容包标题:`Save content-package title`,"删除内容包“{title}”?它会从本机移除,且无法撤销。已创建的世界不受影响。":`Delete content package “{title}”? It will be removed from this device and cannot be restored. Existing worlds are unaffected.`,保存世界名称:`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`,从示例新建:`Create from sample`,从示例开始:`Start with a sample`,"正在创建示例…":`Creating sample…`,"从雨夜旅店的示例故事开始,也可以新建或导入自己的内容包。":`Start with a rainy-night inn story, or create or import your own 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…`,已拉取的模型:`Fetched models`,选择模型:`Select a model`,"选择后会填入模型 ID,也可以手动输入。":`Selecting a model fills in the model ID. You can also enter it manually.`,从端点拉取模型:`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(w,{玩法预设操作失败:`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`,启用:`Enable`,添加:`Add`,切换预设:`Switch preset`,保留的资源:`Retained assets`,"未绑定资源仍随预设保存;可在模板编辑器重新引用。":`Unbound assets are still saved with the preset. Reference them again from the template editor.`,"导入内容无法解析;原文完整保留,可导出或打开原文修复。":`The imported content could not be parsed. Its source is kept intact; export it or open the source to repair it.`,修复导入原文:`Repair imported source`,"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
35
+
36
+ Describe the rules the model must follow whenever it writes player-visible prose.
37
+ `,"# 新后置请求\n\n说明主调用链完成后,需要额外整理成什么界面内容。\n":`# New follow-up request
38
+
39
+ Describe the interface content to prepare after the main call chain completes.
40
+ `,新后置请求:`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(w,{"我观察当前场景。":`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(w,{设定完善导航:`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 inserts a new line. Tap the send button to send.`,"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`,"上下文 —":`Context —`,"上下文 {percent}%":`Context {percent}%`,"上下文已用 {percent}%,建议下一条从全新上下文开始":`Context usage is {percent}%. Consider starting the next message in a fresh context.`,"当前上下文尚无已完成的 AI 响应。":`There is no completed AI response in the current context yet.`,"当前上下文没有记录模型窗口。":`No model context window was recorded for the current context.`,"Provider 未报告最近一次完整响应的输入 token 数。":`The Provider did not report input tokens for the latest completed response.`,"最近一次完整响应的实报输入量:{input} / {window} tokens。仅作提示,不限制发送。":`Reported input for the latest completed response: {input} / {window} tokens. This is informational and does not limit sending.`,"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`,玩家输入后的本轮提示:`Turn guide after player input`," + 1 条本轮提示":` + 1 turn guide`,"与 1 条本轮提示":` and 1 turn guide`,本轮提示:`Turn guide`,"每次发送追加在原生对话末尾,由已启用条目的尾部行按编排顺序拼成;它只属于本次请求,不进入历史、Authority 或回合计数。":`Appended at the end of the native conversation on every send, assembled from the enabled entries' tail lines in arranged order. It belongs to this request only and never enters history, Authority or the round count.`,本轮提示各行来源:`Turn guide line sources`,查看发送的完整本轮提示:`Show the complete turn guide as sent`,本轮提示超出软上限:`Turn guide exceeds its soft limits`,"单行建议不超过 120 字、总行数不超过 10;超出不阻止编译,但尾部正在接近前部规则的体量。":`Keep each line within 120 characters and the total within 10 lines. Exceeding them does not block compilation, but the suffix is approaching the size of the prefix rules.`,"共 {count} 行":`{count} lines in total`,"第 {index} 行超过 120 字":`Line {index} exceeds 120 characters`,"这些 Markdown 块按顺序进入主持预设预留的世界指令位置;正文仍在独立文件中编辑。每项可附一行尾部提示,或只保留尾部提示:它们在每次游玩发送追加的本轮提示中占据世界位置,只放本世界特有且最容易丢的约束。":`These Markdown blocks enter the world-instruction position reserved by the host preset in order; their bodies are edited in separate files. Each entry may carry one tail line, or consist of a tail line alone: these lines take the world position in the turn guide appended on every play send. Keep them to world-specific constraints that are easily lost.`,独立尾部行:`Standalone tail line`,尾部提示:`Tail line`,"尾部提示 {title}":`Tail line for {title}`,留空则本项不进入本轮提示:`Leave empty to keep this entry out of the turn guide`,加入独立尾部行:`Add standalone tail line`," + 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.`,"已暂停:模型调用次数达到单条消息上限":`Paused: this message reached its model-call limit`,"已完成的改动都已保存。可以让 AI 从这里接着做,也可以先查看改动或直接发新消息。":`Every completed change was saved. Let the AI pick up from here, review the changes first, or send a new message.`,继续:`Continue`,已暂停:`Paused`,"用全新上下文给 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(w,{可视化编排:`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(w,{衣着:`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`,导出故事:`Export story`,"导出 Markdown":`Export Markdown`,导出纯文本:`Export plain text`,"故事已导出。":`Story exported.`,"下载当前时间线的开场白、玩家原文与主持正文。":`Download the opening, player inputs and narration on the current timeline.`,世界游玩:`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`,正文:`Text`,工具调用:`Tool calls`,"Provider 派发":`Provider dispatches`,"{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`,重新生成:`Regenerate`,"正在重新生成…":`Regenerating…`,"已重新生成;原回复已离开当前时间线":`Regenerated; the original reply is no longer on the current timeline`,"原回复已离开当前时间线;配置模型后点击“追加上下文”即可重新生成。":`The original reply is no longer on the current timeline. Configure a model, then click "Append context" to regenerate.`,世界控制:`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`,新增:`Add`,玩家:`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`,"扩展内容读取失败:{reason}":`Failed to read extension content: {reason}`,重试:`Retry`}),Object.assign(w,{显示技术信息:`Show technical information`,检查点:`Checkpoint`,"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 changed outside the current context. 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?`,本轮临时要求:`One-turn request`,"只对这一轮生效,不进入故事":`Applies to this turn only; it does not enter the story`,"超过 120 字;仍会发送,但请尽量简短。":`Over 120 characters; it will still be sent, but keep it short.`,"控制草稿必须经过真实 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`,全部展开:`Expand all`,全部收起:`Collapse all`,"{count} 项":`{count} items`,放弃本地修改:`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(w,{"对话历史已删除;修订工作树中的改动没有回滚。":`Conversation history deleted; changes in the revision worktree were not rolled back.`,"Runtime 已确认回滚结果,但重新读取修订工作树失败:{message}":`Runtime confirmed the rollback, but reloading the revision worktree failed: {message}`,世界修订:`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.`,"世界修订已应用并解锁,但刷新世界失败。请重新打开世界:{message}":`The world revision was applied and unlocked, but refreshing the world failed. Please reopen the world: {message}`,"这次世界修订已放弃,原世界保持不变并已解锁,但刷新世界失败。请重新打开世界:{message}":`This world revision was discarded. The original world is unchanged and unlocked, but refreshing failed. Please reopen the world: {message}`,"放弃这次世界修订?所有尚未应用的手动和 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(w,{"d20 {mode} {dice} 取 {die}":`d20 {mode} {dice} keep {die}`,奖励骰取较低的十位:`Bonus dice keep the lower tens`,惩罚骰取较高的十位:`Penalty dice keep the higher tens`,奖励骰:`Bonus dice`,惩罚骰:`Penalty dice`,"抽到 {token}":`Drew {token}`,抽到特殊标记:`Drew a special token`,特殊标记:`Special token`,默认混乱袋:`Default chaos bag`,世界混乱袋:`World chaos bag`,行动:`Action`,修正:`Modifier`,难度:`Difficulty`,掷骰方式:`Roll mode`,掷出的骰:`Dice rolled`,采用的骰:`Die used`,总值:`Total`,"差值(总值 − 难度)":`Margin (total − difficulty)`,结果:`Result`,目标值:`Target`,个位:`Units`,十位骰:`Tens dice`,候选值:`Candidates`,选取:`Selection`,采用的结果:`Result used`,"余量(目标值 − 结果)":`Headroom (target − result)`,属性值:`Value`,袋子:`Bag`,抽到:`Drew`,效果:`Effect`,骰子:`Dice`,左值:`Left operand`,运算:`Operation`,右值:`Right operand`,失败:`Failure`,大成功:`Critical success`,大失败:`Critical failure`,普通:`Normal`,优势:`Advantage`,劣势:`Disadvantage`,加:`Add`,减:`Subtract`,乘:`Multiply`,除:`Divide`,判定结果:`Resolution result`,标记:`Token`,数量:`Count`,本次使用的混乱袋:`Chaos bag used for this check`,玩法:`Gameplay`,互动式小说:`Interactive fiction`,跑团:`Tabletop`,判定方案:`Resolution scheme`,混乱袋:`Chaos bag`,创建:`Create`,"内容包的玩法在创建时确定,之后不能切换。":`A content package's gameplay is fixed when it is created and cannot be switched later.`,"默认方案。掷一颗个位骰,可加奖励骰或惩罚骰;结果不高于目标值即成功。":`Default. Roll one units die, with optional bonus or penalty tens dice; a result at or under the target succeeds.`,"掷一颗 d20 加修正,总值不低于难度即成功;可掷优势或劣势。":`Roll one d20 plus a modifier; a total at or above the difficulty succeeds. Advantage and disadvantage are available.`,"从混乱袋抽一枚标记;数值标记加修正后与难度比较,特殊标记直接决定大成功或大失败。":`Draw one token from the chaos bag. A numeric token adds its modifier and is compared with the difficulty; a special token decides a critical result directly.`,内容包创建失败:`The content package could not be created`,"正在创建内容包…":`Creating content package…`,"玩法模式在创建时固定,不能在互动式小说与跑团之间切换。":`The gameplay mode is fixed when the package is created. It cannot switch between interactive fiction and tabletop.`,"已有世界保持创建时的判定方案;修改只影响之后从这份内容包新建的世界。":`Existing worlds keep the scheme they were created with. A change applies only to worlds created from this package afterwards.`,"判定方案已保存;已有世界保持原方案。":`Resolution scheme saved. Existing worlds keep their scheme.`,"世界玩法身份,修订中保持不变":`World gameplay identity; it stays unchanged during revision`,"内容包玩法身份,只能修改跑团判定方案":`Package gameplay identity; only a tabletop resolution scheme can change`}),Object.assign(w,{开场:`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:
41
+ id: character.example
42
+ ref: example
43
+ title: Example character
44
+ summary: A one-sentence stable summary.
45
+ aliases: []
46
+ `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
47
+ $document:
48
+ id: rule.example
49
+ ref: example
50
+ title: Example rule
51
+ summary: A one-sentence stable summary.
52
+ aliases: []
53
+ ---
54
+
55
+ # Example rule
56
+ `,"{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.`}),Object.assign(w,{模型请求结果未知:`Model request outcome unknown`,"模型请求已发出,但结果未知。旧请求不能重发;为避免重复生成,请从全新上下文继续。":`The model request was dispatched, but its outcome is unknown. The previous request cannot be resent. Continue with a fresh context to avoid duplicate generation.`,模型上下文已达上限:`Model context limit reached`,"当前上下文超过了模型的输入上限。旧请求不能重发,请从全新上下文继续。":`The current context exceeds the model input limit. The previous request cannot be resent. Continue with a fresh context.`,模型输出已达上限:`Model output limit reached`,"模型回复达到输出上限,尚未完成。请在模型配置中调高最大输出 Token,保存后从全新上下文继续。推理也可能占用输出额度。":`The model response reached the output limit before completion. Increase the maximum output tokens in the model configuration, save, then continue with a fresh context. Reasoning may also consume the output budget.`,模型上下文无法继续:`Model context unavailable`,"当前上下文的续传信息缺失或不可用。旧请求不能重发,请从全新上下文继续。":`Continuation data is missing or unavailable. The previous request cannot be resent. Continue with a fresh context.`,模型请求可以重新发送:`Model request can be resent`,"模型拒绝了请求,或请求尚未发出。可以重新发送已保存的请求,不会重复提交玩家原文。":`The model rejected the request, or it was not dispatched. You can resend the saved request without submitting the player text again.`,模型连接发生错误:`Model connection error`,"模型服务未能完成请求。请检查模型连接;也可以从全新上下文继续。":`The model service could not complete the request. Check the model connection, or continue with a fresh context.`,"处理这次请求时发生错误。旧请求不能重发;请查看技术详情,也可以从全新上下文继续。":`An error occurred while processing this request. The previous request cannot be resent. View the technical details, or continue with a fresh context.`,重新发送:`Resend request`,从全新上下文继续:`Continue with a fresh context`,调整最大输出:`Adjust maximum output`,检查模型连接:`Check model connection`,技术详情:`Technical details`});function T(e){if(!v(e))throw Error(`Unsupported web locale`);C=e,typeof document<`u`&&(document.documentElement.lang=e)}function E(){return C}function D(e,t={}){return(C===`zh-CN`?e:w[e]??e).replace(/\{([A-Za-z][A-Za-z0-9]*)\}/gu,(e,n)=>n in t?String(t[n]):e)}var O=[[/^(?:A model request is (?:still|already) running|The call chain is waiting for the model to return)/u,`模型正在生成,请等它完成或先取消,再进行这项操作。`],[/^(?:The parent endpoint of the (?:play|Authority) operation has changed|Another operation has advanced the current world|World advanced before background capture|The call-chain record differs from the current world endpoint|The prepared Authority fact no longer extends the current endpoint)/u,`世界刚被其他操作更新,这次操作没有生效。请刷新页面后重试。`],[/^(?:Play is locked|Timeline editing is locked|World play and other changes are locked|World control drafts are locked) while a world revision is open|^World control is locked while a world revision opens/u,`世界正在修订,游玩和其他修改已锁定。请先应用或放弃修订。`],[/^(?:This world was imported from a backup|This model context was imported from a backup)/u,`这个世界来自备份,请先开启全新上下文再继续。`],[/^(?:The current model context cannot continue|This model context predates durable provider continuation bindings|The selected model connection does not match the frozen model binding)/u,`当前上下文无法继续,请使用全新上下文。`],[/^The selected model protocol differs from this context/u,`当前模型协议与此上下文不同。切回原协议即可继续;使用新协议请开启全新上下文。`],[/^(?:The call chain does not exist|The current world has no model call chain to revise|The model context to revise does not exist|The selected event is not a committed player message)/u,`找不到要操作的对话记录,请刷新页面后重试。`],[/^World does not exist/u,`世界不存在,可能已被删除。`],[/^(?:World Authority is being updated by another durable operation|World Authority commit is being serialized by another process|Another world operation is still finishing|This world already has a durable state operation in progress|World storage is being upgraded by another durable operation|World control is frozen by)/u,`世界正在处理另一项操作,请稍后重试。`],[/^(?:The timeline revision was committed, but current-world materialization|The world has accepted but unrepaired materialization|Please repair the world before exporting a backup)/u,`上一次修改已保存,但还没有完整写入当前世界。请刷新页面;如果仍然失败,请在世界管理中修复世界。`],[/^A world backup is being exported/u,`正在导出世界备份,请等它完成后再操作。`],[/^World name must contain 1 to 160 characters/u,`世界名称须为 1–160 个字符,且不能换行。`],[/^(?:Player text must not be empty|Edited player message cannot be empty)/u,`玩家输入不能为空。`],[/^The world-revision worktree changed; refresh it before writing/u,`修订内容已在别处更新,请刷新后再保存。`],[/^Wait for or cancel the running AI response before changing the revision/u,`请等待或取消正在进行的 AI 回复,再修改这次修订。`]];function k(e){for(let[t,n]of O)if(t.test(e))return D(n);return e}function A(){return D(`无法连接到 Narraeon 服务。请确认服务正在运行、网络连接正常。`)}function j(e){return D(e===502||e===503||e===504?`Narraeon 服务暂时不可用(HTTP {status}),可能正在重启,请稍后重试。`:`Narraeon 服务返回了无法识别的响应(HTTP {status})。请稍后重试;如果使用了反向代理,请检查代理配置。`,{status:e})}var M=(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`,te(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=m(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()}};function ee(e,t){return e===`connected`?null:e===`reconnecting`?D(`对话连接已断开,正在重新连接…`):t===void 0||t.trim()===``?D(`对话同步失败,请重新打开此页面。`):D(`对话同步失败:{message} 请重新打开此页面。`,{message:t})}function te(e){try{let t=JSON.parse(e);return typeof t.message==`string`?k(t.message):void 0}catch{return}}var ne=class extends Error{protocolCode;details;constructor(e,t={}){super(e),this.name=`RuntimeRequestError`,this.protocolCode=t.protocolCode,this.details=t.details}},N=class{observeConversation=M;async request(e){let t;try{t=await fetch(`/api/runtime/v1`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({protocol:S,request:e})})}catch{throw new ne(A())}let n;try{n=await t.json()}catch{throw new ne(j(t.status))}if(!t.ok){let e=typeof n.error==`object`?n.error:null,r=e?.message??n.message;throw new ne(r===void 0?D(`Narraeon 服务请求失败(HTTP {status})。`,{status:t.status}):k(r),{protocolCode:e?.code,details:e?.details})}if(n.protocol!==`narraeon.runtime/v1`)throw Error(D(`Narraeon 服务版本与页面不匹配,请刷新页面。`));return n.result}};function P(){return window.NarraeonAndroid}function F(){return P()!==void 0}function re(){P()?.postMessage(`export-logs`)}var ie=[];function ae(){for(let e=ie.length-1;e>=0;--e)if(ie[e]?.())return!0;return!1}typeof window<`u`&&(window.narraeonAndroidBack=ae);function oe(e,t){let n=(0,l.useEffectEvent)(()=>t()!==!1);(0,l.useEffect)(()=>{if(!e)return;let t=()=>n();return ie.push(t),()=>{ie.splice(ie.indexOf(t),1)}},[e])}async function I(e,t){let n=P();if(n===void 0)return ce(e,t),`started`;let r=`save-${L+=1}`,i=`blob`in t?{type:`save-file`,id:r,fileName:e,mimeType:t.blob.type||`application/octet-stream`,base64:await le(t.blob)}:{type:`save-file`,id:r,fileName:e,mimeType:`application/octet-stream`,path:t.path},a=new Promise((e,t)=>{z.set(r,{resolve:e,reject:t})});return se(n),n.postMessage(JSON.stringify(i)),a}var L=0,R=!1,z=new Map;function se(e){R||(R=!0,e.addEventListener(`message`,e=>{if(typeof e.data!=`string`)return;let t;try{t=JSON.parse(e.data)}catch{return}if(typeof t.id!=`string`)return;let n=z.get(t.id);n!==void 0&&(z.delete(t.id),t.outcome===`saved`||t.outcome===`cancelled`?n.resolve(t.outcome):n.reject(Error(typeof t.error==`string`?t.error:`Save failed`)))}))}function ce(e,t){let n=`blob`in t?URL.createObjectURL(t.blob):t.path;try{let t=document.createElement(`a`);t.href=n,t.download=e,document.body.append(t),t.click(),t.remove()}finally{`blob`in t&&URL.revokeObjectURL(n)}}async function le(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}var ue=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=ue()}))();function de({client:e,worldId:t,label:n=`导出世界备份`,disabled:r=!1,onBusyChange:i}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(!1);async function f(){if(!a){o(!0),i?.(!0),d(!0),c(D(`正在导出世界备份…`));try{let n=await e.request({type:`world.archive.export`,worldId:t,operationId:p(`archive-export`)}),r=`/api/runtime/v1/world-archives/${encodeURIComponent(n.archiveId)}`;await me(r);let i=await I(n.fileName,{path:r});c(i===`cancelled`?``:D(`世界备份已开始下载。`))}catch(e){c(he(e))}finally{o(!1),i?.(!1)}}}return(0,B.jsxs)(`div`,{className:`world-archive-control`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:r||a,onClick:()=>void f(),children:D(a?`正在导出…`:n)}),u?(0,B.jsx)(`p`,{children:D(`备份包含完整故事、世界文档和模型调用记录,不包含 API Key 和模型配置。`)}):null,s?(0,B.jsx)(`p`,{role:`status`,children:s}):null]})}function fe({client:e,disabled:t=!1,onBusyChange:n,onImported:r}){let i=(0,l.useRef)(null),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``);async function u(t){if(!a){if(t.size>d.archiveBytes)c(D(`世界备份超过容量限制。`));else{o(!0),n(!0),c(D(`正在上传世界备份:{progress}%`,{progress:0}));try{let{uploadId:n}=await pe(t,e=>c(D(`正在上传世界备份:{progress}%`,{progress:e})));c(D(`正在校验并导入世界备份…`)),await e.request({type:`world.archive.import`,operationId:p(`archive-import`),uploadId:n}),await r(),c(D(`世界备份已导入,新世界已加入列表。`))}catch(e){c(V(e))}finally{o(!1),n(!1),i.current&&(i.current.value=``)}}}}return(0,B.jsxs)(`div`,{className:`world-archive-control`,children:[(0,B.jsx)(`input`,{ref:i,className:`visually-hidden`,type:`file`,accept:`.zip,application/zip`,"aria-label":D(`世界备份 ZIP 文件`),disabled:t||a,onChange:e=>{let t=e.currentTarget.files?.[0];t&&u(t)}}),(0,B.jsx)(`button`,{type:`button`,disabled:t||a,onClick:()=>i.current?.click(),children:D(a?`正在导入…`:`导入世界备份`)}),s?(0,B.jsx)(`p`,{role:`status`,children:s}):null]})}function pe(e,t){return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`POST`,`/api/runtime/v1/world-archives`),i.setRequestHeader(`Content-Type`,`application/zip`),i.upload.onprogress=e=>{e.lengthComputable&&t(Math.round(100*e.loaded/e.total))},i.onerror=()=>r(Error(D(`世界备份上传失败,请重试。`))),i.onabort=i.onerror,i.onload=()=>{let e;try{e=JSON.parse(i.responseText)}catch{r(new ne(j(i.status)));return}i.status<200||i.status>=300?r(new ne(e.error?.message===void 0?D(`世界备份上传失败,请重试。`):k(e.error.message),{protocolCode:e.error?.code})):n(e)},i.send(e)})}async function me(e){let t;try{t=await fetch(`${e}/check`)}catch{throw new ne(D(`下载失败,请重试。`))}if(t.ok)return;let n=await t.json().catch(()=>void 0);throw new ne(n?.error?.message===void 0?D(`下载失败,请重试。`):k(n.error.message),{protocolCode:n?.error?.code})}function he(e){return e instanceof ne&&e.protocolCode===`invalid_archive`?D(`备份已失效或不存在,请重新导出。`):V(e)}function V(e){switch(e instanceof ne?e.protocolCode:void 0){case`invalid_archive`:return D(`这不是有效的世界备份,请选择世界备份 ZIP。`);case`unsupported_format`:return D(`此世界备份格式不受支持,请升级应用后重试。`);case`limit_exceeded`:return D(`世界备份超过容量限制。`);case`unsafe_path`:return D(`世界备份包含不安全或冲突的文件路径。`);case`integrity_failed`:return D(`世界备份完整性校验失败,未创建世界。`);case`operation_conflict`:return D(`请先等待生成结束,并应用或放弃世界修订,再导出备份。`);case`inconsistent_materialization`:return D(`请先修复世界,再导出备份。`);case void 0:default:return e instanceof Error?e.message:String(e)}}function ge({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(H(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(H(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:D(`内容包脚本权限`)}),(0,B.jsx)(`p`,{children:D(`仅授权此处已保存的资源代码。导入不会授权,资源修改后需要重新授权;关闭立即停止此来源脚本,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)}),D(`允许运行内容包脚本`)]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:s,onClick:()=>void f(!1),children:D(`撤销全部包脚本授权`)}),r?(0,B.jsx)(`p`,{children:D(`请先保存修改,再授权资源代码。`)}):null,u?(0,B.jsx)(`p`,{role:`alert`,children:u}):null]})}function H(e){if(typeof e!=`object`||!e||!(`enabled`in e)||typeof e.enabled!=`boolean`)throw Error(`Invalid package permission response`);return{enabled:e.enabled}}var _e={"frame.yaml":`format: narraeon.host-frame/v1
57
+ roles:
58
+ runtime_system:
59
+ - builtin: runtime.play-contract
60
+ - builtin: runtime.tool-contract
61
+ - builtin: runtime.operation-contract
62
+ author_instruction:
63
+ - markdown: blocks/prose.md
64
+ - markdown: blocks/scene.md
65
+ - markdown: blocks/agency-default.md
66
+ - markdown: blocks/facts.md
67
+ - markdown: blocks/npc.md
68
+ - markdown: blocks/save-timing.md
69
+ - markdown: blocks/ownership.md
70
+ - markdown: blocks/situation.md
71
+ - markdown: blocks/checkpoint-policy.md
72
+ - include: world.instructions
73
+ world_context:
74
+ - builtin: runtime.coverage
75
+ - include: world.context
76
+ `,"blocks/prose.md":`# 叙事质感与节奏
77
+
78
+ 这是一部互动式小说,玩家是其中的主角。
79
+
80
+ ## 写出小说的质感
81
+
82
+ 让环境、光线、声音、气味与人物动作参与叙事,交代信息、调节节奏或表达关系,不为装饰逐项铺陈。情绪可以通过话说到一半停住、动作迟疑、视线躲闪来呈现,给玩家理解的空间。NPC 的反应以他已成立的性格、认知和处境为依据。
83
+
84
+ ## 该慢的地方要慢下来
85
+
86
+ 篇幅和节奏随这一刻的分量变化。赶路、例行公事和已经交代的背景可以一两句带过;关系变化、话到关键处、局面翻转或危险临近时,把玩家在意的几秒写具体。一个抬手可以写三行,两小时赶路也可以写一句;详写几秒的体验,不等于一次推进整场活动。
87
+
88
+ 详写给出前一句没有的信息:动作怎样接续、声音如何变化、人物注意到什么。注水只是换词重复同一事实或重述已知背景。不要为了固定篇幅给每个人分配一个动作。
89
+ `,"blocks/scene.md":`# 人物与场面
90
+
91
+ 用正在进行的事呈现场面,不把所有在场者按名字点一遍,在场者无需人人每轮都表演一次。人物之间可以交谈、忙自己的事;细节按场景需要选取。名字已知就自然使用名字,避免不断重新介绍。
92
+ `,"blocks/person-second.md":`# 人称:第二人称
93
+
94
+ 玩家可见叙事以第二人称“你”称呼玩家角色。玩家的知觉、动作和话语都以“你”写出;其他人物按名字或第三人称称呼。观察视角跟随玩家角色,不写他无法感知的事。
95
+ `,"blocks/person-first.md":`# 人称:第一人称
96
+
97
+ 玩家可见叙事以第一人称“我”写玩家角色,像玩家角色自己在讲述。知觉、判断和情绪只能是“我”能感知到的;其他人物按名字或第三人称称呼。叙述口吻贴近玩家角色已经建立的性格,不替他下结论或表态。本块启用时取代第二人称的要求。
98
+ `,"blocks/person-third.md":`# 人称:第三人称
99
+
100
+ 玩家可见叙事以第三人称写玩家角色:已知名字时用名字,否则用与其性别一致的“他/她”,并与其他人物明确区分。观察视角仍跟随玩家角色,不越入其他人物未表露的内心。玩家原文里的“我”“你”在正文中转为相应的第三人称。本块启用时取代第二人称的要求。
101
+ `,"blocks/continue-stage.md":`# 承接:先演玩家行动
102
+
103
+ 玩家原文是玩家对本轮行动和台词的简写,不是已经成立的小说正文。玩家页面上它以“你”的身份单独显示,正文里还没有它。
104
+
105
+ ## 先写玩家做了什么
106
+
107
+ 每段正文先把玩家这次的行动和台词以叙事方式写出来:动作怎样完成、话怎样说出口、周围的人和环境此刻的样子,然后才写世界的反应。台词可以保留原话,也可以按人物口吻微调措辞,不改变意思、立场和承诺。不用“你说要……”式的旁白转述代替演出。
108
+
109
+ ## 分量
110
+
111
+ 玩家行动本身的篇幅按节奏规则定:平常动作一两句,关键时刻可以拆开写,但不能跳过。要演的是本轮新输入;此前轮次已经演过的内容不再重述。
112
+ `,"blocks/continue-advance.md":`# 承接:直接推进
113
+
114
+ 玩家原文已经是正文的一部分:玩家页面上它以“你”的身份显示,玩家刚读过。不要把它再演一遍。本块启用时取代“先演玩家行动”的要求。
115
+
116
+ ## 从下一件事写起
117
+
118
+ 正文从玩家输入之后发生的第一件事开始:动作的结果、对方的回应、环境的变化。玩家的台词不再复述,直接写听者如何接话。
119
+
120
+ ## 必要的衔接
121
+
122
+ 输入只是简写(“我去找他”)、不交代过程就无法呈现结果时,用最短的衔接把它落到场景里,不扩写玩家的动作和话语本身。
123
+ `,"blocks/agency-default.md":`# 代理权:默认
124
+
125
+ 玩家的目标、去向、立场、态度、承诺、给予或接受、动手或收手,以及改变关系、风险和归属的关键选择,必须有玩家原文的明确表达支持。本块启用时取代其他代理权块。
126
+
127
+ ## 可以替玩家补什么
128
+
129
+ 在已表达的选择内补足动作衔接、不改变实质的措辞和自然感官。“我去找他”这类日常简写允许开始并完成通常的连带动作:穿过走廊、敲门、把东西递过去不必逐项确认。寒暄可以替玩家接,但不能暗中承诺新事项。
130
+
131
+ ## 在哪里交回玩家
132
+
133
+ 途中出现玩家没有表达过的新风险、交易或关键选择时,停在需要玩家决定的位置。不能把“去找他”扩展成提出新请求、答应他的条件或交出物品;NPC 的提议或追问也不构成玩家尚未表达的目标与话语。拿不准时保留决定空间;不能以“下次还能改口”为理由替玩家确立当前选择。
134
+
135
+ ## 感官不是态度
136
+
137
+ 玩家角色的自然感官和已有事实造成的身体经验可以直接写;心跳、脸红、僵住或发不出声不能替他确立爱慕、恐惧、认同、同意、拒绝或新的行动选择。不替玩家生成未表达的感情。世界外查询或文档维护不构成角色的新决定。
138
+ `,"blocks/agency-strict.md":`# 代理权:严格
139
+
140
+ 正文只演玩家原文明确写出的动作和台词。本块启用时取代其他代理权块。
141
+
142
+ 连带动作只做到原文说到的地方:说“去找他”就写到走到门口,敲门和开口都交回玩家;说“把信递过去”就写到递出,对方接不接和玩家接下来说什么留给下一轮。不替玩家补台词、寒暄或回应,不替玩家做任何选择。
143
+
144
+ 玩家角色的自然感官和已有事实造成的身体经验可以直接写;心跳、脸红、僵住或发不出声不能替他确立爱慕、恐惧、认同、同意、拒绝或新的行动选择。不替玩家生成未表达的感情。世界外查询或文档维护不构成角色的新决定。
145
+ `,"blocks/agency-open.md":`# 代理权:放开
146
+
147
+ 玩家把日常部分交给主持:可以替玩家接普通对话、完成日常互动、把当前场景推进到自然段落。玩家角色的台词按他已建立的性格、认知和此前原文的口吻写,不与玩家已表达的立场相反。本块启用时取代其他代理权块。
148
+
149
+ 仍然归玩家的决定:承诺、给予或接受、动手或收手、改变关系、风险和归属的关键选择。写到这些位置就停下交回玩家,不替他答应条件、交出物品或表态。
150
+
151
+ 玩家角色的自然感官和已有事实造成的身体经验可以直接写,但不替玩家生成未表达的感情。世界外查询或文档维护不构成角色的新决定。
152
+ `,"blocks/stop-beat.md":`# 停笔:一拍停
153
+
154
+ 持续活动中,对方的新话语、动作或反应会影响玩家如何接话、调整或继续时,呈现这个反馈就停下,即使不涉及重大决定。开始按腿、教学或交谈不默认包办全过程;普通走路、敲门、递送的连带动作可以自然完成。玩家明确要求略过过程或做到某个终点时,推进到那里。本块启用时取代其他停笔块。
155
+
156
+ 当前行动与反应形成有内容的局面便可以停笔;有意义的沉默、独处、休息和等待也可以自然结束。回复结束不要求世界内事件结束,一个事件跨很多轮是正常的。
157
+ `,"blocks/stop-scene.md":`# 停笔:一场停
158
+
159
+ 一段正文推进到当前场景的自然段落再停:一次交谈谈完一个话题、一段活动做到告一段落、一次移动到达目的地。途中对方的普通反馈由叙事自己接住,不逐拍停下;只在出现代理权块规定归玩家的决定、或场景实际转换时停笔。玩家明确要求停在某处时照办。本块启用时取代其他停笔块。
160
+
161
+ 回复结束不要求世界内事件结束。
162
+ `,"blocks/ending.md":`# 结尾
163
+
164
+ 结尾停在实际发生的最后一句话、一个动作或一个环境变化上。不写“轮到你了”“你打算怎么做”及“众人等你开口”一类的交接句,不在结尾列选项,不重复总结局势,不为了收尾让 NPC 硬添动作、邀请或承诺。真正发生的注视或等待可以描写。
165
+ `,"blocks/output.md":`# 输出边界
166
+
167
+ 世界内叙事只写小说正文,可以分多个自然段,不加标题、清单、裁决报告、工具日志或幕后说明。篇幅由场面的分量决定;停笔位置限制推进范围,不要求把已经允许的场面写得潦草。失败、NPC 自主行动和没有文档变化都可以形成完整叙事。
168
+
169
+ 本轮新发生且玩家能感知的结果要成为具体可读的事:物品怎样递接、人物如何离开、态度变化怎样在话语或行动中显露。界面数值不能代替事件表现,叙事也不能与当前值冲突。文档中补录旧结果、去重和整理不要求再次演出;未向玩家表露的判断和场外事实无需用旁白揭露。
170
+
171
+ 工具、目录、文档、句柄、检索、命中、Runtime 及失败过程只供私下裁决;正文不得出现“没搜到/没找到资料”等内部措辞,信息不足时保持世界内的不确定性。
172
+
173
+ 本次只有世界外查询或维护时,按请求简洁回答或说明整理结果,不为满足小说形式添加动作、对话或时间推进。混合请求中的维护要求不成为角色台词或行动。
174
+ `,"blocks/facts.md":`# 裁决与事实
175
+
176
+ 叙事以已加载材料、已经裁决的结果和成功提交的变化为依据;表达方式可以丰富,不能改变谁在哪、拿着什么、是否受伤或承诺是否成立。尝试不自动成为成功,角色声称不自动成为事实;已经提交的行动不能用一句普通改口当作从未发生。
177
+
178
+ ## 先取材,再裁决
179
+
180
+ 判断依赖的具体事实尚未取得时,先通过实际目录、字面搜索和精确读取取得。目录简介只提供发现线索,精确现值取自当前正文、节点或有效回执;搜索未命中不证明事实不存在,可以换实际词语、范围或追溯原文。材料充分且仍有效时不机械重读。
181
+
182
+ 工具失败或模型没取得材料,不会使世界中的角色失忆,也不证明角色不知道。不要编造记不清的反应来遮盖读取问题;避免作依赖缺失事实的确定判断。
183
+
184
+ 世界允许扩展的未定义人物、地点和普通细节可以按既定约束生长,无需开局穷举。未定义细节可以补全,明确不存在的事实不能补成存在;不能为预定结果或既有怀疑倒造能力、证据或过去事件。区分客观事实、人物声称与推测、玩家意图及已裁决结果。
185
+ `,"blocks/npc.md":`# NPC 有自己的生活
186
+
187
+ NPC 可以按性格、认知、处境和目标继续做事、与别人交谈、离开或主动接近,世界不因玩家停手而暂停。自主行动产生的持续结果也按状态维护判据处理。
188
+
189
+ 不在场只表示不在这一段,不表示人物暂停。玩家换地方、较长时间经过、重新遇见或寻找某人,或者其已有日程、约定到了相关时点时,检查相应的场外进展;不必每次行动都模拟所有人。日程和意图约束判断但不保证如期实现,障碍和条件仍有效。
190
+ `,"blocks/save-timing.md":`# 保存时机与整理
191
+
192
+ 先按停笔位置确定本轮叙事范围,再保存该范围内的事实。每轮最终正文前只有一件必做的事:玩家视图实际绑定的当前值若因本轮变化,先用工具写回。其余按下面的时机择机处理。
193
+
194
+ 1. 玩家视图绑定的当前值改变,本轮终态叙事前写回。等待、赶路、休息或跨日后按世界粒度更新对应现值;绑定标记只说明界面读取范围。
195
+ 2. 当前情境已采用顶层 \`背景\` 时,时间、地点等定位值发生变化应在最终叙事提交前写回该节点,避免在其他情境字段维护同一现值的第二份。没有该字段的世界不必创建,未变化不必写入。
196
+ 3. 需要保存但玩家原文和最终叙事没有记录的信息,当轮保存,包括重要场外进展、未表露的认知和隐蔽后果。工具中间文本不能替代持久记录。
197
+ 4. 其余可从玩家原文和最终叙事恢复的持续结果,允许事件收尾或合适的中间整理点归并。
198
+
199
+ 保存进行中活动的实际进展、必要原话和待回应事项即可整理截至此刻的状态,不把尚未发生的完成结果提前写入。整理随时可以进行:持续活动跨多轮积累了需要归并的进展,或发现重复、过期的记录时,直接在当轮工具调用中归并,不需要等事件结束。只有零散即时变化时,按上述时机继续互动。
200
+
201
+ 补录、去重和归档只整理已经成立的内容,不重复交易、转移、受伤或态度变化。世界外维护不产生新的世界内事件;明确修订只按修订写明的范围改变事实,不编造行动解释修订。新上下文对照当前文档与补入的玩家原文、最终叙事,补齐必要结果再继续;已保存内容不重复追加,已完成事项不恢复为待办;当前明确的世界外修订优先,不用旧叙事推翻修订。足够且仍有效的材料无需机械重读。
202
+
203
+ 清理被替代描述和重复列表,保留仍有意义的经历、结果及引用。长材料按作者安排转为按需发现,软体积提示不是截断的理由。暂时离场不等于退役;仍有相关目标或约定的对象应当容易发现。退役文档仍可读取、引用和恢复,显式全文槽也可能继续注入它。
204
+ `,"blocks/ownership.md":`# 信息归属与事件
205
+
206
+ ## 区分信息的职责
207
+
208
+ 当前事实写给自然所有者:人物、物品、地点、组织或规则。持续过程保存实际进展与仍有效的条件;意图、承诺和日程记录主体、内容及已知条件,其未来目标尚未实现。发生时间与记录时间不同,过去的取值不冒充现值。
209
+
210
+ 认知、怀疑、误信与态度属于持有它的主体,不等于客观事实,也不随世界变化自动同步。关系评价有方向,可保存当前看法、期待、边界及简短依据;任职、结盟、归属和债务等已成立的关联另按事实维护。不替玩家生成未表达的感情。已经形成的认知与态度是持续状态,不能仅因换上下文就从经历重新推算。
211
+
212
+ ## 事件与当前结果
213
+
214
+ 重要事件的经过集中保存;需要多人引用、持续追溯或重新解释时,使用独立可引用的事件文档。保存必要经过、条件、重要原话及可用的来源引用,不把人物说法变成已证实事实。事件按事情划分,不按每回合建档。普通表演细节可留在已提交叙事,不必再造一份逐轮日志。
215
+
216
+ 事件记载当时发生了什么、当时产生了什么结果;最新状态、待办与看法留在各自文档,事件用引用关联,不充当滚动状态表。各对象保存当前结果,个人保存自己的认知与解释,关联必要事件而不各抄一遍经过。偿还债务不抹去交易,伤愈不抹去重要经历或后遗影响,工程完工应结束施工待办并保留现有成果。新信息可以改变理解,不因此改写过去发生的事。
217
+
218
+ ## 保存多少、放在哪里
219
+
220
+ 遗忘会改变后续行为、选择、归属、能力、重要认知或当前局面,或抹去值得回望的经历时,保存足够维持连续性与意义的信息。失败和场外进展同样适用;一次失败不自动成为永久限制。没有持续变化时允许不写。
221
+
222
+ 持续信息优先放在自然所有者;需要独立引用、维护自身状态或生命周期时独立建档。未达到独立建档门槛的信息仍可嵌入自然所有者。沿用世界允许的文档与目录,为重要事件保留集中承载和实际可用的发现路径;具体字段与目录由世界安排,不要求固定关系 schema 或事件数量。
223
+
224
+ summary 是目录简介,用于识别文档和判断是否需要读取。只写简短的身份、主题或稳定线索,不复述具体状态和事件经过;具体事实放在正文。仅在识别信息改变时更新标题与简介。
225
+ `,"blocks/situation.md":`# 当前情境与玩家视图
226
+
227
+ 当前情境只保存叙事结束时的地点、在场者、进行中事件和直接约束下一次行动的少量事项,包括仍待回应的问题、邀请或动作。保存必要原话;本轮已经回答或完成的事项不再待办。人物离场前将继续的活动写回其自然所有者,不把当前情境写成过程摘要或未来分支。
228
+
229
+ 维护玩家视图绑定的节点时保留其可见语义;容器会显示子树,隐藏认知不能混入公开节点。调整绑定结构和控制选择器须通过世界修订协同处理。叙事、当前文档与界面表达同一结果。
230
+ `,"blocks/checkpoint-policy.md":`# 检查点政策
231
+
232
+ world_checkpoint 只用于事件之间的间隙:上一事件已在本轮停笔位置自然告一段落,或场景已实际转换,接下来从全新上下文开始也不会丢失仍然重要的细节。登记前核对上次检查点后的交互,把刚结束事件中后续仍需要的结果写入文档,包括当前状态、重要认知、承诺与待办和界面值;全新上下文只补入检查点之后的原文,上一事件的经过不会再出现。
233
+
234
+ 持续活动中途、对方刚给出需要玩家回应的反馈,或仍有待玩家决定的事项时,不登记。整理不等于检查点,整理随时可做且不需要登记。检查点只标记已经出现的间隙,不是本轮目标:不为了到达间隙而加快节奏、压缩过程、替玩家完成玩家没有表达的步骤或提前结束事件。登记后若叙事又增加重要结果,继续工具调用补齐。
235
+ `,"blocks/style-intimate.md":`# 文风:情感与亲密
236
+
237
+ 这一类场面的重点不是发生了什么,而是身体和心里经历了什么。事情本身可能只有一句话——手碰到了、靠得很近、他没有躲开——但玩家读的就是这一句被拆开之后的全部内容。
238
+
239
+ ## 把那一刻拆开
240
+
241
+ 不要跳过过程直接给结论。“你们牵起了手”把整段最值钱的东西省掉了。详写本轮停笔位置以内的那一刻:手伸过去的半路、指尖碰到哪里、对方是迎上来还是没有动、已经握住时的力度。
242
+
243
+ 一个动作可以占三四行。这里的“慢”不是拖,是把玩家真正在意的那几秒补足。
244
+
245
+ ## 触觉优先
246
+
247
+ 这类场面里触觉排在视觉前面:温度(他的手比你想的凉)、干湿、粗糙或细腻、力度、脉搏、布料隔着的厚度。然后才是气味、呼吸的声音、贴近时听见的动静。
248
+
249
+ 写具体的身体感觉,别只丢一个现成比喻。“像电流窜过”所有人都读过,它替代了描写而不是完成描写;如果要用,也让它落回具体位置——从指尖窜到手肘,然后停在那儿发麻。
250
+
251
+ ## 身体不听话
252
+
253
+ 心跳的位置和速度、呼吸乱掉又赶紧调匀、后颈或耳根发烫、指尖发麻、喉咙发紧、脚下没根、明知道该说话却发不出声。
254
+
255
+ 对方的反应仍然走侧写:他的耳朵红了、话头断在半截、手指蜷了一下、眼睛没敢抬起来——让玩家自己读出来那是什么意思。
256
+
257
+ ## 距离和边界
258
+
259
+ 亲密戏的张力来自距离的变化和它是否被允许。写清楚现在有多近、谁在靠近、对方是迎上来、僵住还是退开。允许和拒绝都要能被看出来,不要含糊过去。
260
+
261
+ 对方是否接受,永远由他此刻的性格、处境和已经建立的关系决定;不要因为气氛到了就让他答应。
262
+
263
+ ## 时间会变形
264
+
265
+ 紧张或动情的时候,一瞬间在感觉里会被拉长:你会注意到平时根本不会注意的东西——他睫毛的影子、空调的声音、自己手心出汗。用这种被放大的细节表示时间慢下来了,比直接写“时间仿佛静止”有效得多。
266
+ `,"blocks/style-noir.md":`# 文风:冷硬与推理
267
+
268
+ 短句。动词结句。能删的形容词都删掉。
269
+
270
+ ## 只写看得见的
271
+
272
+ 摄影机式的叙述:写人物做了什么、说了什么、现场有什么,不写他心里怎么想。情绪从动作的偏差里渗出来——手抖了一下、烟点了两次才着、答话比正常慢了半秒。
273
+
274
+ 不替角色下判断。不写“他显然在撒谎”,写他回答之前先看了一眼门。
275
+
276
+ ## 细节是证据
277
+
278
+ 这一类场面里,物件不是布景,是可以被追究的东西:杯子放的位置、鞋底的泥、袖口磨损的程度、屋里的温度和味道。区分可观察细节、已确立证据和人物推测;普通细节可以只是环境,不能因为被描写就自动成为线索或证明。
279
+
280
+ 要克制到位:与线索无关的环境描写占一句就够,别铺开。
281
+
282
+ ## 节奏
283
+
284
+ NPC 的回答可以短、冷、有停顿;对话的紧张不要求玩家连续盘问。用 NPC 自己的解释、回避、反问及环境承接节奏。
285
+
286
+ 叙述保持冷。越是暴力或危险的时刻越不要抒情,事实本身足够重。
287
+ `,"blocks/style-wuxia.md":`# 文风:武侠与古风
288
+
289
+ 用词偏文,但不掉书袋。句子可以长短相间,长句写景与气度,短句写出手与决断。
290
+
291
+ ## 称谓与语气
292
+
293
+ 人物按身份、辈分和亲疏择称,不用现代口语。对话讲分寸:客套里藏机锋,认输和挑衅都不必挑明。
294
+
295
+ 避免现代词汇和现代概念(心理阴影、压力、社交距离之类);用当时的说法讲同一件事。
296
+
297
+ ## 出手
298
+
299
+ 交手要写得清楚而不冗长:写清出手、对方怎么接、气力和位置的变化。写得让人看得懂,而不是堆招式名;胜负实际已定时再写决定它的那一下。
300
+
301
+ 内力、伤势、兵器和轻功以当前世界事实与规则为准,不为某次胜负临时倒造前提。
302
+
303
+ ## 景与气
304
+
305
+ 风、雪、灯、酒、马蹄、更漏——用景托气氛和时序。景要短,两三句足够,别让它盖过人。
306
+
307
+ 情义、恩怨、承诺在这类故事里分量很重:一句应承可以顶很久,写的时候给它足够的停顿。兑现后的情义仍可通过相关的具体经历表现,不必反复宣讲誓言。
308
+ `,"blocks/style-horror.md":`# 文风:悬疑与恐怖
309
+
310
+ 恐惧来自不确定,不来自血腥。
311
+
312
+ ## 慢慢来
313
+
314
+ 在危险尚未显露的场景,可以从正常处留一个不对劲的小东西——数目不对、声音停在半路、门比记忆里开得大一点。不要一开始就掀底。
315
+
316
+ 尚未揭露的事可以保留不确定;已经揭露的证据、人物认知和当前危险不能为气氛重新抹糊。视角确实受限时:让玩家看见轮廓、听见声音、闻见味道,但看不全。
317
+
318
+ ## 身体先知道
319
+
320
+ 写角色的生理反应而不是情绪判定:依据已有情境写后颈发凉、触感或环境声。
321
+
322
+ ## 声音和静
323
+
324
+ 安静是有质地的——写它被什么打破,以及打破之后的那一秒。滴水、脚步、呼吸、远处的说话声、突然停掉的风扇。
325
+
326
+ ## 别泄气
327
+
328
+ 不要在叙事里替玩家判断危险程度,也不要给出安全保证。危险是否真实存在,以世界事实为准;氛围可以吓人,但不能凭空制造不存在的东西。
329
+ `,"blocks/style-action.md":`# 文风:动作与战斗
330
+
331
+ 写清楚谁在哪、朝哪动、打到没打到、代价是什么。看不懂的动作场面等于没写。
332
+
333
+ ## 按动作顺序写
334
+
335
+ 按时间顺序推进,交代动作之间的衔接:写起手、对方应对、已成立结果和位置变化。一段可以承接多个普通动作,不要求每次只写一个动作。
336
+
337
+ 写重量和代价:撞上去的地方会疼,挥空了会失衡,跑起来会喘。伤势和体力按世界事实累积,不要打完就恢复。
338
+
339
+ ## 句子随节奏变
340
+
341
+ 交手时短句、动词密集。间隙——喘息、对峙、换位置——可以放长一句,让紧张有起伏。
342
+
343
+ ## 环境参战
344
+
345
+ 地形、家具、光线、天气都可以被利用或成为妨碍。让打斗发生在一个具体的地方,而不是空舞台。
346
+
347
+ ## 后果
348
+
349
+ 本轮停笔时让当前处境清楚:位置、已成立的伤势、正在进行的交手与待应对的变化。胜负尚未分出时保留进行中局面。
350
+ `,"blocks/style-literary.md":`# 文风:克制与留白
351
+
352
+ 说七分,留三分。
353
+
354
+ ## 不把话说满
355
+
356
+ 关键的情绪不直接命名。用一个动作、一件物品、一句偏题的话去承载它——他把杯子转了半圈才开口;她说的是天气。
357
+
358
+ 情绪解读可以交给读者;交易是否完成、伤势和承诺是否成立等结果必须清楚。留白不改变事实,也不隐藏玩家行动的实际后果。
359
+
360
+ ## 具体的小事
361
+
362
+ 抽象的感受落到具体的东西上:不写“他很孤独”,写他多摆了一副碗筷。不写“时间过得很久”,写窗台上那盆花换了一茬。
363
+
364
+ ## 对话有下文
365
+
366
+ 人物很少直说心里话。让对话有表层和底层:表面在谈别的,真正的意思在停顿、重复和没说完的半句里。
367
+
368
+ ## 节制
369
+
370
+ 比喻少而准,按这段文字的需要取舍。不要连续堆叠形容词。删掉之后意思不变的句子就删掉。
371
+ `},U={"frame.yaml":`format: narraeon.host-frame/v1
372
+ roles:
373
+ runtime_system:
374
+ - builtin: runtime.play-contract
375
+ - builtin: runtime.tool-contract
376
+ - builtin: runtime.operation-contract
377
+ author_instruction:
378
+ - markdown: blocks/prose.md
379
+ - markdown: blocks/scene.md
380
+ - markdown: blocks/agency-default.md
381
+ - markdown: blocks/facts.md
382
+ - markdown: blocks/npc.md
383
+ - markdown: blocks/save-timing.md
384
+ - markdown: blocks/ownership.md
385
+ - markdown: blocks/situation.md
386
+ - markdown: blocks/checkpoint-policy.md
387
+ - include: world.instructions
388
+ world_context:
389
+ - builtin: runtime.coverage
390
+ - include: world.context
391
+ `,"blocks/prose.md":`# Prose texture and pacing
392
+
393
+ This is an interactive novel with the player as its protagonist.
394
+
395
+ ## Give the prose the texture of a novel
396
+
397
+ 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. Ground NPC reactions in their established character, knowledge and circumstances.
398
+
399
+ ## Slow down where it matters
400
+
401
+ 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. Detailing a few seconds of experience does not mean advancing an entire activity in one reply.
402
+
403
+ 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.
404
+ `,"blocks/scene.md":`# People and scenes
405
+
406
+ Show a scene through ongoing activity. Do not inventory everyone by name, and not everyone present needs a gesture every turn. 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.
407
+ `,"blocks/person-second.md":`# Person: second person
408
+
409
+ Address the player character as “you” in all player-visible narrative. Their perceptions, actions and words are written as “you”; other characters are named or referred to in the third person. The viewpoint follows the player character and does not describe what they cannot perceive.
410
+ `,"blocks/person-first.md":`# Person: first person
411
+
412
+ Write the player character in the first person, “I”, as if the player character were telling the story. Perceptions, judgments and feelings are limited to what “I” can perceive; other characters are named or referred to in the third person. Keep the voice close to the player character's established personality without drawing conclusions or taking stances on their behalf. When this block is enabled it replaces the second-person requirement.
413
+ `,"blocks/person-third.md":`# Person: third person
414
+
415
+ Write the player character in the third person: by name when known, otherwise with a pronoun that matches their gender, clearly distinguished from other characters. The viewpoint still follows the player character and does not enter other characters' unexpressed thoughts. “I” and “you” in the player's text become the corresponding third person in the prose. When this block is enabled it replaces the second-person requirement.
416
+ `,"blocks/continue-stage.md":`# Continuation: stage the player's action first
417
+
418
+ The player's text is shorthand for this turn's action and dialogue, not finished prose of the novel. The player page shows it separately under “you”; the narrative does not contain it yet.
419
+
420
+ ## Write what the player does first
421
+
422
+ Each passage first stages the player's action and dialogue as narrative: how the movement is carried out, how the words come out, what the people and surroundings look like at that moment. Only then write the world's reaction. Dialogue may keep the original words or be lightly adjusted to the character's voice without changing its meaning, stance or commitments. Do not replace the staging with a narrated summary such as “You said you would…”.
423
+
424
+ ## Weight
425
+
426
+ The length of the player's own action follows the pacing rules: an ordinary action takes a sentence or two, a critical moment may be unfolded, but it is never skipped. Stage this turn's new input only; content already performed in earlier turns is not restated.
427
+ `,"blocks/continue-advance.md":`# Continuation: advance directly
428
+
429
+ The player's text is already part of the narrative: the player page shows it under “you” and the player has just read it. Do not perform it again. When this block is enabled it replaces the requirement to stage the player's action first.
430
+
431
+ ## Start with the next thing
432
+
433
+ Begin the passage with the first thing that happens after the player's input: the result of the action, the other person's reply, a change in the surroundings. Do not repeat the player's dialogue; write directly how the listener responds.
434
+
435
+ ## Minimal bridging
436
+
437
+ When the input is shorthand (“I go find him”) and the result cannot be shown without some process, use the shortest bridge that places it in the scene, without expanding the player's own action or words.
438
+ `,"blocks/agency-default.md":`# Agency: default
439
+
440
+ 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 in their text. When this block is enabled it replaces the other agency blocks.
441
+
442
+ ## What may be filled in for the player
443
+
444
+ Within an expressed choice, fill in supporting movements, wording that preserves the meaning, and natural sensory experience. Everyday shorthand such as “I go find him” allows starting and completing ordinary supporting actions: walking the corridor, knocking, handing something over needs no separate confirmation. Small talk may be answered for the player, but it must not silently create a commitment.
445
+
446
+ ## Where to hand back
447
+
448
+ When the route produces a new risk, bargain or consequential choice the player has not expressed, stop at the decision the player must make. Finding someone does not expand into making a new request, accepting their terms or handing over property; an NPC's offer or follow-up question does not constitute a goal or line the player has not expressed. Preserve decision space when unsure; the possibility of changing one's mind later is no reason to settle the present choice for the player.
449
+
450
+ ## Sensation is not stance
451
+
452
+ The player character's natural sensory and bodily experience may be stated directly when supported by established facts; heartbeat, blushing, freezing or loss of speech must not establish attraction, fear, agreement, consent, refusal or a new choice for the player. Do not invent unexpressed player feelings. Out-of-world inquiry or document maintenance constitutes no new character decision.
453
+ `,"blocks/agency-strict.md":`# Agency: strict
454
+
455
+ The prose performs only the actions and dialogue the player's text states explicitly. When this block is enabled it replaces the other agency blocks.
456
+
457
+ Supporting actions go only as far as the text says: “go find him” is written up to reaching the door, and knocking or speaking returns to the player; “hand over the letter” is written up to the handover, and whether it is taken and what the player says next belong to the next turn. Do not fill in lines, small talk or replies for the player, and do not make any choice for them.
458
+
459
+ The player character's natural sensory and bodily experience may be stated directly when supported by established facts; heartbeat, blushing, freezing or loss of speech must not establish attraction, fear, agreement, consent, refusal or a new choice for the player. Do not invent unexpressed player feelings. Out-of-world inquiry or document maintenance constitutes no new character decision.
460
+ `,"blocks/agency-open.md":`# Agency: open
461
+
462
+ The player leaves the everyday part to the narrator: you may answer ordinary conversation for the player, complete routine interaction and carry the current scene to a natural pause. Write the player character's lines in the voice of their established personality, knowledge and earlier text, never against a stance the player has expressed. When this block is enabled it replaces the other agency blocks.
463
+
464
+ Decisions that still belong to the player: promises, giving or accepting, striking or holding back, and consequential choices about relationships, risk or ownership. Stop at those points and hand back; do not accept terms, hand over property or take a stance for them.
465
+
466
+ The player character's natural sensory and bodily experience may be stated directly, but do not invent unexpressed player feelings. Out-of-world inquiry or document maintenance constitutes no new character decision.
467
+ `,"blocks/stop-beat.md":`# Stopping: one beat
468
+
469
+ During an ongoing activity, when the other person's new words, action or reaction could affect how the player replies, adjusts or continues, present that feedback and stop, even without a consequential decision. Starting a leg massage, a lesson or a conversation does not by itself cover the whole activity; ordinary supporting actions in walking, knocking or delivering can complete naturally. When the player explicitly asks to skip the process or reach an endpoint, advance to it. When this block is enabled it replaces the other stopping blocks.
470
+
471
+ You may stop once action and reactions form a meaningful situation; meaningful silence, solitude, rest and waiting can also close naturally. Ending a reply does not require ending the in-world event; one event spanning many turns is normal.
472
+ `,"blocks/stop-scene.md":`# Stopping: one scene
473
+
474
+ Carry a passage to the natural pause of the current scene before stopping: a conversation finishing a topic, an activity reaching a resting point, a journey arriving. Ordinary feedback along the way is absorbed by the narrative instead of stopping at every beat; stop only when a decision the agency block reserves for the player appears, or when the scene actually changes. When the player explicitly asks to stop somewhere, do so. When this block is enabled it replaces the other stopping blocks.
475
+
476
+ Ending a reply does not require ending the in-world event.
477
+ `,"blocks/ending.md":`# Ending
478
+
479
+ End on the last line actually spoken, an action or a change in the surroundings. Do not write handoffs such as “Your turn”, “What do you do?” or “Everyone waits for you to speak”; do not end by listing options or repeating a situation summary; do not invent an NPC action, invitation or promise to close the passage. Actual attention or waiting may be described.
480
+ `,"blocks/output.md":`# Output boundaries
481
+
482
+ 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; the stopping point limits advancement, not the care given to the allowed scene. Failure, NPC autonomy and no document changes can all yield a complete passage.
483
+
484
+ Make new perceivable outcomes this turn concrete: how an object is handed over, how a person leaves, how an attitude shows in words or action. Interface values do not replace dramatization, and prose must agree with current values. Delayed recording, deduplication and maintenance do not require performing old events again; unexpressed judgments and offstage facts need not be revealed in narration.
485
+
486
+ Tools, directories, documents, handles, searches, matches, Runtime and failed procedures serve private adjudication only. The prose must not contain internal wording such as “nothing was found in the records”; keep uncertainty in-world when information is insufficient.
487
+
488
+ 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.
489
+ `,"blocks/facts.md":`# Adjudication and facts
490
+
491
+ Ground the narrative 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, and a later ordinary change of mind does not mean an already committed action never happened.
492
+
493
+ ## Gather material before adjudicating
494
+
495
+ 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.
496
+
497
+ 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.
498
+
499
+ 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.
500
+ `,"blocks/npc.md":`# NPCs have lives of their own
501
+
502
+ 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. Autonomous results follow the same state-maintenance criteria as player-caused results.
503
+
504
+ 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.
505
+ `,"blocks/save-timing.md":`# Save timing and consolidation
506
+
507
+ First fix this turn's narrative scope from the stopping point, then save facts within that scope. Exactly one thing is mandatory before each turn's final prose: if a current value actually bound by a player view changed this turn, write it back with a tool first. Handle everything else at the moments below.
508
+
509
+ 1. Write changed current values bound 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.
510
+ 2. If the current situation already uses the exact top-level \`背景\` field, write changed time, location or other positioning values there before final narrative submission; avoid maintaining a second current copy elsewhere in that situation. Worlds without the field need not create it, and unchanged values need no write.
511
+ 3. 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.
512
+ 4. Other durable outcomes recoverable from player originals and final narrative may be consolidated at event closure or a suitable intermediate point.
513
+
514
+ Recording actual progress in an ongoing activity, necessary exact wording and matters awaiting a response consolidates the state through this moment without writing unrealized completion outcomes in advance. Consolidation can happen at any time: when an ongoing activity has accumulated progress across several turns, or records are duplicated or outdated, consolidate directly in this turn's tool calls without waiting for the event to end. With only isolated immediate changes, continue the interaction under the moments above.
515
+
516
+ Delayed recording, deduplication and archiving consolidate established content without repeating trades, transfers, injuries or attitude changes. Out-of-world maintenance produces no new in-world event; an explicit revision changes only the facts it names, without inventing actions to explain it. 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.
517
+
518
+ 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 are no reason to truncate. 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.
519
+ `,"blocks/ownership.md":`# Information ownership and events
520
+
521
+ ## Distinguish information by its role
522
+
523
+ 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.
524
+
525
+ 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.
526
+
527
+ ## Events and current outcomes
528
+
529
+ 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.
530
+
531
+ 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.
532
+
533
+ ## How much to save and where
534
+
535
+ 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.
536
+
537
+ 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.
538
+
539
+ 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.
540
+ `,"blocks/situation.md":`# Current situation and player views
541
+
542
+ 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.
543
+
544
+ 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.
545
+ `,"blocks/checkpoint-policy.md":`# Checkpoint policy
546
+
547
+ Use world_checkpoint only for gaps between events: the previous event has naturally settled at this turn's stopping point, or the scene has actually changed, and starting a fresh context next would not lose still-important details. Before registration, reconcile interactions since the previous checkpoint and write the finished event's still-needed outcomes into documents, including current state, important knowledge, commitments, pending work and interface values; a fresh context replays only originals after the checkpoint, and the previous event's account will no longer appear.
548
+
549
+ Do not register during an ongoing activity, immediately after feedback needing the player's response, or while matters await the player's decision. Consolidation is not a checkpoint; it can happen at any time and needs no registration. A checkpoint marks a gap that has already appeared, not a goal for this turn: do not accelerate the pace, compress the process, complete steps the player has not expressed or end an event early to reach one. If the narrative after registration adds another important outcome, continue tool calls to save it.
550
+ `,"blocks/style-intimate.md":`# Style: emotion and intimacy
551
+
552
+ 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.
553
+
554
+ ## Separate the moment
555
+
556
+ Do not skip the process and state only the conclusion. “You held hands” discards the most valuable part. Detail the moment within this reply's stopping point: the hand crossing the distance, what the fingertips touch, whether the other person meets it or stays still, and the pressure if the grip has closed.
557
+
558
+ 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.
559
+
560
+ ## Put touch first
561
+
562
+ 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.
563
+
564
+ 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.
565
+
566
+ ## The body does not obey
567
+
568
+ 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.
569
+
570
+ 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.
571
+
572
+ ## Distance and boundaries
573
+
574
+ 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.
575
+
576
+ 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.
577
+
578
+ ## Time changes shape
579
+
580
+ 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.”
581
+ `,"blocks/style-noir.md":`# Style: hard-boiled investigation
582
+
583
+ Short sentences. End on verbs. Remove every adjective you can.
584
+
585
+ ## Write only what can be observed
586
+
587
+ 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.
588
+
589
+ Do not judge for a character. Do not write “they are obviously lying”; write that they look at the door before answering.
590
+
591
+ ## Details are evidence
592
+
593
+ 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.
594
+
595
+ Exercise restraint. Environmental description unrelated to a clue needs no more than one sentence.
596
+
597
+ ## Pace
598
+
599
+ NPC replies can be terse, cold and punctuated by pauses; tension does not require repeated player interrogation. Sustain the rhythm through the NPC’s explanation, evasion or question and the environment.
600
+
601
+ Keep the narration cold. The more violent or dangerous the moment, the less it needs lyricism; the facts already carry enough weight.
602
+ `,"blocks/style-wuxia.md":`# Style: wuxia and period prose
603
+
604
+ Use elevated language without becoming antiquarian. Vary long and short sentences: long sentences for scenery and bearing, short ones for strikes and decisions.
605
+
606
+ ## Address and tone
607
+
608
+ 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.
609
+
610
+ Avoid modern vocabulary and concepts such as trauma, stress, or social distance. Express the same thing in language that belongs to the period.
611
+
612
+ ## Exchanges
613
+
614
+ Make combat clear without making it tedious: show the strike, how the opponent answers, and how force and position change. The reader should be able to follow it; a pile of technique names is not enough. Describe the decisive instant when victory or defeat has actually been determined.
615
+
616
+ 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.
617
+
618
+ ## Scene and spirit
619
+
620
+ 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.
621
+
622
+ 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.
623
+ `,"blocks/style-horror.md":`# Style: suspense and horror
624
+
625
+ Fear grows from uncertainty, not gore.
626
+
627
+ ## Take your time
628
+
629
+ 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.
630
+
631
+ 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.
632
+
633
+ ## The body knows first
634
+
635
+ Describe sensations supported by the scene, such as cold on the neck, touch or environmental sound, rather than an emotional verdict.
636
+
637
+ ## Sound and quiet
638
+
639
+ 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.
640
+
641
+ ## Do not release the tension
642
+
643
+ 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.
644
+ `,"blocks/style-action.md":`# Style: action and combat
645
+
646
+ 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.
647
+
648
+ ## Follow the action sequence
649
+
650
+ Advance in chronological order and connect movements clearly: show initiation, the opponent's response, established results and changed position. A passage may connect several ordinary actions; it need not contain just one action per reply.
651
+
652
+ 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.
653
+
654
+ ## Let sentences follow the pace
655
+
656
+ 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.
657
+
658
+ ## Let the environment fight
659
+
660
+ Terrain, furniture, light, and weather can be used or become obstacles. Make the fight occur in a particular place, not on an empty stage.
661
+
662
+ ## Consequences
663
+
664
+ Make the situation at this reply's stopping point clear: positions, established wounds, an ongoing exchange and changes awaiting a response. Retain an ongoing situation while victory or defeat remains undecided.
665
+ `,"blocks/style-literary.md":`# Style: restraint and negative space
666
+
667
+ Say seven parts; leave three unstated.
668
+
669
+ ## Do not say everything
670
+
671
+ 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.
672
+
673
+ 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.
674
+
675
+ ## Small, concrete things
676
+
677
+ 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.
678
+
679
+ ## Dialogue has another layer
680
+
681
+ 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.
682
+
683
+ ## Restraint
684
+
685
+ Use few metaphors and make them exact, according to the passage’s needs. Do not stack adjectives. Delete any sentence whose removal changes nothing.
686
+ `};function ve(e){return e===`zh-CN`?_e:U}var ye=[`person-second`,`continue-stage`,`stop-beat`,`ending`,`output`];function be(e){let t=ve(e);return ye.map(e=>t[`blocks/${e}.md`].trimEnd()).join(`
687
+
688
+ `).concat(`
689
+ `)}be(`zh-CN`),be(`en`);var xe=`prompts/setting-improvement.md`,Se=`# 系统推荐的创作方法
690
+
691
+ 以当前编辑目标、已有内容和用户目标为起点。讨论时说明必要判断,落实时定向修改;用户要求审查或重组时,相关结构与重复表达也在范围内。不为填满结构制造内容,无需修改也是合法结果。
692
+
693
+ ## 编辑目标与世界起点
694
+
695
+ 内容包设定完善定义开场结束处的世界起点,可以包含已有历史、当前状态、持续过程和各人的认知。简单起点足以开玩,普通未定义内容可在游玩中生长;不预写未来必然发生的经历或强制剧情阶段。
696
+
697
+ 运行中世界修订维护当前已经演变的世界,按用户要求调整并保留未受影响的事实、经历与认知,不退回初始取值。此分支不读取或修改 opening.md。明确修订不是世界内事件,不需虚构行动解释它。
698
+
699
+ 涉及结构、材料发现或更新位置时,先列出编辑目标根目录,完整读取 control/frame.yaml、启用的世界提示块、绑定的当前情境及受影响文档。实际操作遵守本轮工具边界。
700
+
701
+ ## 世界信息怎样组织
702
+
703
+ 世界文档承载事实与语义:当前值归自然所有者;持续过程记录实际进展与条件;意图、承诺、日程保留主体和已知条件,其目标尚未实现。角色声称、猜测与真实发生的事分开。人物的认知和态度属于各自主体,不随事实变化自动同步,也不互相对称;不代填玩家未表达的感情。
704
+
705
+ 重要事件的经过集中承载,需要多人引用、持续追溯或重新解释时安排独立可引用的事件文档。事件记载当时的经过和结果;最新状态、待办与看法留在各自文档,用引用关联,事件不充当滚动状态表。对象保存当前结果,个人保存认知、关系评价与简短依据,引用相关事件而不各抄经过。已经形成的状态和态度也要保存,不能只存事件再让每次游玩重新推算。事件按事情组织,不按回合建档;普通细节可以只留在叙事。
706
+
707
+ 这些区别适用于物品、伤病、地点、组织、交易、调查与人物关系,不要求固定目录、字段或数量。独立引用、自身状态或生命周期需要独立文档;小规模信息可集中在合适载体中。当前情境只承接眼前地点、在场者、进行中的事及待回应事项,不承担全部历史或未来分支。
708
+
709
+ 当前情境的受限 YAML 可选用精确顶层「背景」保存简短定位值,例如「背景: {时间: 青历三年六月初八,夜间, 地点: 南门客栈}」。Runtime 会将该节点的完整值随已提交叙事保存,用于解释旧原文的“明天”“这里”;缺失、null、空白字符串、空映射或空数组不采集,0 和 false 保留。字段内部不设固定 schema,在场名单、待办和长局面留在其他字段;采用后在背景中维护对应现值,避免同一时间地点的第二份现值。无需为未采用的既有内容创建或搬迁字段;运行中修订不会改写旧历史背景。
710
+
711
+ summary 是目录简介:只写识别文档所需的简短身份、主题或稳定线索,不复述具体状态和事件经过。具体事实放在正文,仅在识别信息改变时更新标题与简介。
712
+
713
+ ## 承载与发现一起安排
714
+
715
+ 每项持续信息确定自然所有者、更新位置及实际的发现或注入路径。常用当前值按需全文或节点注入;较长事件通过目录和引用按需读取。重要事件应有实际可用的集中承载位置,不能只有无法创建的目录设想。查看真实 frame 和写后覆盖,不假定所有正文都已进入游玩请求。
716
+
717
+ 同一时点、同一含义的事实尽量只维护一份;过去取值、当前结果和不同主体的理解不按重复删去。当前情境、叙事及界面只承担各自用途,避免重复强化同一概念。
718
+
719
+ world/ 或 state/ 承载虚构事实,control/ 安排本世界的取材、规则运用、保存位置与呈现,不复制当前值。未来游玩参考只代表实际启用的作者块;它不是本轮叙事要求,可选政策也未必始终启用。世界指令补充本世界特有约束,不重复通用规则或工具流程,不擅自改写世界外预设。
720
+
721
+ ## 开场与整理
722
+
723
+ 仅在内容包分支检查 opening.md:写玩家当时可感知的具体局面,保留尚待回答的请求与必要原话,不替玩家决定行动、台词或内心。独处、安静和等待也可形成开场。开场与文档停在同一时点,将约束首次行动的结果写给自然所有者,无需复制整篇叙事。
724
+
725
+ 整理结束已完成或失效的进程、约定和限制,保留仍有意义的成果、后遗影响、经历与引用。补录、去重和归档不让事情再发生。长材料按需发现,软体积提示不授权截断;暂时离场不等于退役,退役也不会移除显式全文槽。
726
+
727
+ 检查实际玩家视图选择器。容器会显示子树,隐藏认知不能混进公开节点;重组绑定结构时同步更新选择器。审计先对应概念、时间与主体,再处理重复句子;最后用实际写后覆盖检查发现路径,不默认输出整份内部审计表。
728
+ `,Ce=`# Recommended authoring method
729
+
730
+ 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.
731
+
732
+ ## Editing target and world starting point
733
+
734
+ 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.
735
+
736
+ 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.
737
+
738
+ 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.
739
+
740
+ ## Organizing world information
741
+
742
+ 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.
743
+
744
+ 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.
745
+
746
+ 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.
747
+
748
+ Restricted YAML current situations may optionally use the exact top-level field 背景 for brief positioning values, for example \`背景: {时间: night on day eight, 地点: South Gate Inn}\`. Runtime saves the complete node with committed narrative to interpret old references to tomorrow or here; missing, null, blank strings and empty maps/lists are unrecorded, while 0 and false survive. Its contents have no fixed schema. Keep attendance, pending matters and long situations elsewhere; when adopted, maintain corresponding current values in this node without a second copy. Do not create or relocate fields in existing content merely to adopt this convention. Running-world revisions never rewrite saved historical backgrounds.
749
+
750
+ 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.
751
+
752
+ ## Arrange storage and discovery together
753
+
754
+ 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.
755
+
756
+ 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.
757
+
758
+ 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.
759
+
760
+ ## Opening and consolidation
761
+
762
+ 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.
763
+
764
+ 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.
765
+
766
+ 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.
767
+ `;function we(e){return e===`zh-CN`?Se:Ce}function Te(e){let t=e===`zh-CN`?`下一步建议`:`Next-step ideas`;return{"preset.yaml":`format: narraeon.play-preset/v1
768
+ name: action-choices-recommended
769
+ callChain: call-chain.yaml
770
+ settingImprovement:
771
+ markdown: prompts/setting-improvement.md
772
+ mounts:
773
+ player.options: composer_below
774
+ extensions:
775
+ - renderers/player-options.html
776
+ - scripts/player-options.js
777
+ - assets/player-options.css
778
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
779
+ narrative:
780
+ - markdown: prompts/narrate.md
781
+ followups:
782
+ - id: player_options
783
+ displayName: ${t}
784
+ prompt:
785
+ role: author_instruction
786
+ markdown: prompts/options.md
787
+ maxArtifactBytes: 32768
788
+ artifacts:
789
+ - name: player_options
790
+ channel: player.options
791
+ strategy: replace
792
+ contentType: application/json
793
+ renderer: renderers/player-options.html
794
+ rendererRevision: v1
795
+ rendererMode: app
796
+ scripts:
797
+ - scripts/player-options.js
798
+ assets:
799
+ - assets/player-options.css
800
+ save: commit
801
+ invalidation: new_operation
802
+ required: true
803
+ maxEmits: 1
804
+ payloadContract:
805
+ type: array
806
+ minItems: 4
807
+ maxItems: 4
808
+ uniqueBy: id
809
+ items:
810
+ type: object
811
+ additionalProperties: false
812
+ required:
813
+ - id
814
+ - label
815
+ - prompt
816
+ properties:
817
+ id:
818
+ type: string
819
+ minLength: 1
820
+ maxLength: 64
821
+ label:
822
+ type: string
823
+ minLength: 1
824
+ maxLength: 80
825
+ description:
826
+ type: string
827
+ maxLength: 240
828
+ prompt:
829
+ type: string
830
+ minLength: 1
831
+ maxLength: 1000
832
+ `,...ve(e),"prompts/narrate.md":be(e),[xe]:we(e),"prompts/options.md":e===`zh-CN`?`# 提交后下一步建议
833
+
834
+ 根据玩家刚刚看到的决策点,给出四种短而具体、彼此有实质差异的下一步建议。差异应体现在目标、方法、风险或态度上,而不是只替换近义词。
835
+
836
+ 建议只能使用玩家已经能够知道的信息,并且必须是玩家角色此刻有条件尝试的行动。每项建议只是可以填入输入框的草稿:表达玩家准备做什么,不宣称行动已经发生,不预先写定结果,也不替玩家选择或发送。字段、数量和提交方式服从当前后置请求的 Runtime 产物说明。
837
+ `:`# Next-step ideas after the commit
838
+
839
+ 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.
840
+
841
+ 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.
842
+ `,"renderers/player-options.html":`<!doctype html>
843
+ <html><head><meta charset="utf-8"><title>${t}</title></head><body>
844
+ <main id="player-options-root" aria-label="${t}"></main>
845
+ </body></html>
846
+ `,"scripts/player-options.js":`(function () {
847
+ var root = document.getElementById("player-options-root");
848
+ var pending = new Map();
849
+
850
+ function post(command, payload) {
851
+ var requestId = "draft-" + Math.random().toString(36).slice(2);
852
+ parent.postMessage({
853
+ namespace: "narraeon.extension.v1",
854
+ command: command,
855
+ instanceId: document.documentElement.dataset.narraeonInstance,
856
+ nonce: document.documentElement.dataset.narraeonNonce,
857
+ requestId: requestId,
858
+ payload: payload
859
+ }, "*");
860
+ pending.set(requestId, true);
861
+ }
862
+ function draw(raw, disabled) {
863
+ root.replaceChildren();
864
+ var options;
865
+ try { options = JSON.parse(raw); } catch (_) { return; }
866
+ if (!Array.isArray(options)) return;
867
+ options.forEach(function (option) {
868
+ var button = document.createElement("button");
869
+ button.type = "button";
870
+ button.className = "player-option";
871
+ button.dataset.optionId = option.id;
872
+ button.disabled = Boolean(disabled);
873
+ var label = document.createElement("strong");
874
+ label.textContent = option.label;
875
+ button.append(label);
876
+ if (option.description) {
877
+ var detail = document.createElement("small");
878
+ detail.textContent = option.description;
879
+ button.append(detail);
880
+ }
881
+ button.addEventListener("click", function () {
882
+ post("composer.set_draft", { text: option.prompt });
883
+ });
884
+ root.append(button);
885
+ });
886
+ }
887
+ window.addEventListener("message", function (event) {
888
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
889
+ if (event.data.type === "render.update") {
890
+ draw(event.data.payload && event.data.payload.content, event.data.payload && event.data.payload.interactionDisabled);
891
+ return;
892
+ }
893
+ if (event.data.type === "bridge.response") pending.delete(event.data.requestId);
894
+ });
895
+ }());
896
+ `,"assets/player-options.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
897
+ #player-options-root { display: grid; gap: .5rem; }
898
+ .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; }
899
+ .player-option:hover { border-color: #a66a42; }
900
+ .player-option small { color: #6c6259; }
901
+ `}}Te(`en`);function Ee(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
902
+ name: generic-panels-recommended
903
+ callChain: call-chain.yaml
904
+ settingImprovement:
905
+ markdown: prompts/setting-improvement.md
906
+ mounts:
907
+ generic.markdown: story
908
+ generic.html: sidebar
909
+ generic.debug: debug
910
+ extensions:
911
+ - renderers/generic-html.html
912
+ - scripts/generic-html.js
913
+ - assets/generic-html.css
914
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
915
+ narrative:
916
+ - markdown: prompts/narrate.md
917
+ followups:
918
+ - id: publish_panels
919
+ displayName: ${t}
920
+ prompt:
921
+ role: author_instruction
922
+ markdown: prompts/panels.md
923
+ maxArtifactBytes: 65536
924
+ artifacts:
925
+ - name: markdown_panel
926
+ channel: generic.markdown
927
+ strategy: replace
928
+ contentType: text/markdown
929
+ save: commit
930
+ invalidation: new_operation
931
+ required: false
932
+ maxEmits: 1
933
+ - name: html_panel
934
+ channel: generic.html
935
+ strategy: replace
936
+ contentType: text/html
937
+ renderer: renderers/generic-html.html
938
+ rendererRevision: v1
939
+ rendererMode: app
940
+ scripts:
941
+ - scripts/generic-html.js
942
+ assets:
943
+ - assets/generic-html.css
944
+ save: commit
945
+ invalidation: new_operation
946
+ required: false
947
+ maxEmits: 1
948
+ - name: debug_panel
949
+ channel: generic.debug
950
+ strategy: append
951
+ contentType: text/markdown
952
+ save: operation
953
+ invalidation: operation_end
954
+ required: false
955
+ maxEmits: 8
956
+ `,...ve(e),"prompts/narrate.md":be(e),[xe]:we(e),"prompts/panels.md":e===`zh-CN`?`# 通用面板
957
+
958
+ 核心叙事已经提交。只有面板能为当前局面提供额外价值时才生成它;没有合适内容时可以不生成。
959
+
960
+ 面板只能整理已经成立且适合玩家看见的信息,不得发明世界事实、替玩家作决定、偷偷保存状态,或把未向玩家揭示的信息当作提示。它是非权威的界面补充,不应复制或改写由玩家视图负责的固定状态展示。各输出的格式、保存方式和提交方法服从当前后置请求的 Runtime 产物说明。
961
+ `:`# Generic panels
962
+
963
+ 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.
964
+
965
+ 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.
966
+ `,"renderers/generic-html.html":`<!doctype html>
967
+ <html><head><meta charset="utf-8"><title>${n}</title></head><body>
968
+ <main id="generic-html-root" aria-label="${n}"></main>
969
+ </body></html>
970
+ `,"scripts/generic-html.js":`(function () {
971
+ var root = document.getElementById("generic-html-root");
972
+ window.addEventListener("message", function (event) {
973
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
974
+ if (event.data.type !== "render.update") return;
975
+ var payload = event.data.payload || {};
976
+ root.innerHTML = typeof payload.content === "string" ? payload.content : "";
977
+ });
978
+ }());
979
+ `,"assets/generic-html.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
980
+ #generic-html-root { padding: .75rem; }
981
+ `}}Ee(`en`);function De(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
982
+ name: status-panel-recommended
983
+ callChain: call-chain.yaml
984
+ settingImprovement:
985
+ markdown: prompts/setting-improvement.md
986
+ mounts: []
987
+ playerViewPanels:
988
+ - id: current_view
989
+ source:
990
+ kind: player_view
991
+ view: status
992
+ channel: player.view.current
993
+ key: current
994
+ mount: sidebar
995
+ renderer: renderers/player-view-status.html
996
+ rendererRevision: v1
997
+ rendererMode: app
998
+ scripts:
999
+ - scripts/player-view-status.js
1000
+ assets:
1001
+ - assets/player-view-status.css
1002
+ config:
1003
+ title: ${t}
1004
+ layout: stack
1005
+ theme: parchment
1006
+ empty: message
1007
+ emptyMessage: ${r}
1008
+ groups: []
1009
+ extensions:
1010
+ - renderers/player-view-status.html
1011
+ - scripts/player-view-status.js
1012
+ - assets/player-view-status.css
1013
+ `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
1014
+ narrative:
1015
+ - markdown: prompts/narrate.md
1016
+ followups: []
1017
+ `,...ve(e),"prompts/narrate.md":be(e),[xe]:we(e),"renderers/player-view-status.html":`<!doctype html>
1018
+ <html><head><meta charset="utf-8"><title>${t}</title></head><body>
1019
+ <main id="player-view-panel-root" aria-label="${t}"></main>
1020
+ </body></html>
1021
+ `,"scripts/player-view-status.js":`(function () {
1022
+ var root = document.getElementById("player-view-panel-root");
1023
+
1024
+ function valueNode(value) {
1025
+ if (value === null || value === undefined) return document.createTextNode("—");
1026
+ if (typeof value === "object") {
1027
+ var wrapper = document.createElement(Array.isArray(value) ? "ul" : "dl");
1028
+ Object.keys(value).forEach(function (key, index) {
1029
+ var entry = document.createElement(Array.isArray(value) ? "li" : "div");
1030
+ if (!Array.isArray(value)) {
1031
+ var term = document.createElement("dt");
1032
+ term.textContent = key;
1033
+ entry.append(term);
1034
+ }
1035
+ entry.append(valueNode(Array.isArray(value) ? value[index] : value[key]));
1036
+ wrapper.append(entry);
1037
+ });
1038
+ return wrapper;
1039
+ }
1040
+ return document.createTextNode(String(value));
1041
+ }
1042
+ function draw(raw) {
1043
+ root.replaceChildren();
1044
+ var payload;
1045
+ try { payload = JSON.parse(raw || "{}"); } catch (_) { return; }
1046
+ var config = payload.config || {};
1047
+ root.dataset.theme = config.theme || "default";
1048
+ root.dataset.layout = config.layout || "stack";
1049
+ root.dataset.emptyState = config.empty || "message";
1050
+ var heading = document.createElement("h3");
1051
+ heading.textContent = payload.title || payload.viewId || ${JSON.stringify(n)};
1052
+ root.append(heading);
1053
+ var items = Array.isArray(payload.items) ? payload.items : [];
1054
+ if (items.length === 0) {
1055
+ if (config.empty === "message" || config.empty === "show") {
1056
+ var empty = document.createElement("p");
1057
+ empty.className = config.empty === "show"
1058
+ ? "player-view-empty player-view-empty-value"
1059
+ : "player-view-empty player-view-empty-message";
1060
+ empty.textContent = config.empty === "show"
1061
+ ? ${JSON.stringify(i)} + (config.emptyMessage || ${JSON.stringify(r)})
1062
+ : (config.emptyMessage || ${JSON.stringify(r)});
1063
+ root.append(empty);
1064
+ }
1065
+ } else {
1066
+ var byId = new Map(items.map(function (item) { return [item.id, item]; }));
1067
+ var groups = Array.isArray(config.groups) ? config.groups : [];
1068
+ var renderItems = function (list, selected) {
1069
+ selected.forEach(function (item) {
1070
+ var row = document.createElement("div");
1071
+ var label = document.createElement("dt");
1072
+ label.textContent = item.label || item.id;
1073
+ var value = document.createElement("dd");
1074
+ value.append(valueNode(item.value));
1075
+ row.append(label, value);
1076
+ list.append(row);
1077
+ });
1078
+ };
1079
+ if (groups.length === 0) {
1080
+ var list = document.createElement("dl");
1081
+ renderItems(list, items);
1082
+ root.append(list);
1083
+ } else {
1084
+ groups.forEach(function (group) {
1085
+ var selected = (Array.isArray(group.itemIds) ? group.itemIds : [])
1086
+ .map(function (id) { return byId.get(id); })
1087
+ .filter(Boolean);
1088
+ if (selected.length === 0) return;
1089
+ var section = document.createElement("section");
1090
+ var groupHeading = document.createElement("h4");
1091
+ groupHeading.textContent = group.label || group.id;
1092
+ var groupList = document.createElement("dl");
1093
+ renderItems(groupList, selected);
1094
+ section.append(groupHeading, groupList);
1095
+ root.append(section);
1096
+ });
1097
+ }
1098
+ }
1099
+ var diagnostics = Array.isArray(payload.diagnostics) ? payload.diagnostics : [];
1100
+ if (diagnostics.length > 0) {
1101
+ var details = document.createElement("details");
1102
+ var summary = document.createElement("summary");
1103
+ summary.textContent = diagnostics.length + ${JSON.stringify(a)};
1104
+ details.append(summary);
1105
+ var diagnosticList = document.createElement("ul");
1106
+ diagnostics.forEach(function (diagnostic) {
1107
+ var item = document.createElement("li");
1108
+ item.textContent = diagnostic.message;
1109
+ diagnosticList.append(item);
1110
+ });
1111
+ details.append(diagnosticList);
1112
+ root.append(details);
1113
+ }
1114
+ }
1115
+ window.addEventListener("message", function (event) {
1116
+ if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
1117
+ if (event.data.type === "render.update") draw(event.data.payload && event.data.payload.content);
1118
+ });
1119
+ }());
1120
+ `,"assets/player-view-status.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
1121
+ #player-view-panel-root { display: grid; gap: .5rem; }
1122
+ #player-view-panel-root[data-theme="parchment"] { color: #4a382b; background: #fffaf1; padding: .75rem; border-radius: .65rem; }
1123
+ #player-view-panel-root dl { display: grid; gap: .45rem; margin: 0; }
1124
+ #player-view-panel-root[data-layout="grid"] dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1125
+ #player-view-panel-root dl > div { display: grid; gap: .15rem; }
1126
+ #player-view-panel-root dt { font-weight: 650; }
1127
+ #player-view-panel-root dd { margin: 0; }
1128
+ #player-view-panel-root ul, #player-view-panel-root dl dl { margin: .25rem 0 0 1rem; padding-left: 1rem; }
1129
+ .player-view-empty { color: #6c6259; }
1130
+ `}}De(`en`);function Oe(e){return[{id:`action-choices`,label:e===`zh-CN`?`行动选项`:`Action choices`,name:e===`zh-CN`?`下一步建议(可编辑副本)`:`Next-step ideas (editable copy)`,files:Te(e)},{id:`status-panel`,label:e===`zh-CN`?`状态栏`:`Status panel`,name:e===`zh-CN`?`状态栏(可编辑副本)`:`Status panel (editable copy)`,files:De(e)},{id:`generic-panels`,label:e===`zh-CN`?`Markdown / HTML 面板`:`Markdown / HTML panels`,name:e===`zh-CN`?`通用面板(可编辑副本)`:`Generic panels (editable copy)`,files:Ee(e)},{id:`artifact-debugger`,label:e===`zh-CN`?`产物调试器`:`Artifact debugger`,name:e===`zh-CN`?`产物调试器(可编辑副本)`:`Artifact debugger (editable copy)`,files:Ee(e)}]}Oe(`en`);var ke=[[`home`,`工作区`],[`content`,`内容编辑`],[`plays`,`预设`],[`create`,`新建世界`],[`preview`,`提示词预览`]];function Ae({screen:e,locale:t,localeSaving:n,navigationLocked:r,activeModelName:i,onNavigate:a,onLocaleChange:o}){let[s,c]=(0,l.useState)(!1);oe(s,()=>c(!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":D(`返回工作区`),disabled:r,onClick:()=>u(`home`),children:`Narraeon`}),(0,B.jsxs)(`nav`,{id:`workspace-navigation`,className:s?`workspace-navigation is-open`:`workspace-navigation`,"aria-label":D(`工作区导航`),onKeyDown:e=>{e.key===`Escape`&&(c(!1),document.getElementById(`workspace-menu-toggle`)?.focus())},children:[ke.map(([t,n])=>(0,B.jsx)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,disabled:r,onClick:()=>u(t),children:D(n)},t)),F()&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{c(!1),re()},children:D(`导出诊断日志`)})]}),(0,B.jsxs)(`div`,{className:`workspace-header-actions`,children:[(0,B.jsxs)(`label`,{className:`workspace-locale-picker`,children:[(0,B.jsx)(`span`,{children:D(`界面语言`)}),(0,B.jsxs)(`select`,{"aria-label":D(`界面语言`),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:D(`简体中文`)})]})]}),(0,B.jsxs)(`button`,{type:`button`,className:`workspace-model-button`,"aria-label":D(`模型连接`),"aria-current":e===`model`?`page`:void 0,title:i??D(`尚未配置`),disabled:r,onClick:()=>u(`model`),children:[(0,B.jsx)(`span`,{className:`workspace-model-dot ${i===null?`needs-attention`:`is-ready`}`,"aria-hidden":`true`}),D(`模型连接`)]}),(0,B.jsx)(`button`,{id:`workspace-menu-toggle`,type:`button`,className:`workspace-menu-toggle`,"aria-label":D(`切换页面`),"aria-expanded":s,"aria-controls":`workspace-navigation`,disabled:r,onClick:()=>c(!s),children:`☰`})]})]})}function je(){return[{scheme:`d100`,label:`d100`,description:D(`默认方案。掷一颗个位骰,可加奖励骰或惩罚骰;结果不高于目标值即成功。`)},{scheme:`d20`,label:`d20`,description:D(`掷一颗 d20 加修正,总值不低于难度即成功;可掷优势或劣势。`)},{scheme:`bag`,label:D(`混乱袋`),description:D(`从混乱袋抽一枚标记;数值标记加修正后与难度比较,特殊标记直接决定大成功或大失败。`)}]}function Me({pending:e,onCancel:t,onCreate:n}){let r=(0,l.useRef)(null),i=(0,l.useId)(),[a,o]=(0,l.useState)(`interactive-fiction`),[s,c]=(0,l.useState)(`d100`),[u,d]=(0,l.useState)(``);(0,l.useEffect)(()=>{let e=r.current;return e!==null&&!e.open&&e.showModal(),()=>{e?.open===!0&&e.close()}},[]),oe(!0,()=>{e||t()});async function f(){if(!e){d(``);try{await n(a===`tabletop`?{mode:`tabletop`,scheme:s}:{mode:`interactive-fiction`})}catch(e){d(e instanceof Error?e.message:D(`内容包创建失败`))}}}return(0,B.jsx)(`dialog`,{ref:r,className:`create-package-dialog`,"aria-labelledby":`${i}-title`,onCancel:n=>{n.preventDefault(),e||t()},children:(0,B.jsxs)(`form`,{className:`create-package-form`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h2`,{id:`${i}-title`,children:D(`新建内容包`)}),(0,B.jsx)(`p`,{children:D(`内容包的玩法在创建时确定,之后不能切换。`)})]}),(0,B.jsxs)(`fieldset`,{className:`create-package-choices`,disabled:e,children:[(0,B.jsx)(`legend`,{children:D(`玩法`)}),(0,B.jsxs)(`label`,{className:`create-package-choice`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`${i}-mode`,value:`interactive-fiction`,checked:a===`interactive-fiction`,onChange:()=>o(`interactive-fiction`)}),(0,B.jsx)(`span`,{children:D(`互动式小说`)})]}),(0,B.jsxs)(`label`,{className:`create-package-choice`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`${i}-mode`,value:`tabletop`,checked:a===`tabletop`,onChange:()=>o(`tabletop`)}),(0,B.jsx)(`span`,{children:D(`跑团`)})]})]}),a===`tabletop`?(0,B.jsxs)(`fieldset`,{className:`create-package-choices`,disabled:e,children:[(0,B.jsx)(`legend`,{children:D(`判定方案`)}),je().map(e=>(0,B.jsxs)(`div`,{className:`create-package-choice-block`,children:[(0,B.jsxs)(`label`,{className:`create-package-choice`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`${i}-scheme`,value:e.scheme,checked:s===e.scheme,"aria-describedby":`${i}-${e.scheme}-description`,onChange:()=>c(e.scheme)}),(0,B.jsx)(`span`,{children:e.label})]}),(0,B.jsx)(`p`,{className:`field-note`,id:`${i}-${e.scheme}-description`,children:e.description})]},e.scheme))]}):null,u===``?null:(0,B.jsx)(`p`,{className:`create-package-failure`,role:`alert`,children:u}),e?(0,B.jsx)(`p`,{role:`status`,children:D(`正在创建内容包…`)}):null,(0,B.jsxs)(`footer`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:e,onClick:t,children:D(`取消`)}),(0,B.jsx)(`button`,{type:`submit`,disabled:e,children:D(`创建`)})]})]})})}function Ne(e,t){return typeof e==`string`&&e.trim().length>0&&[...e].length<=80&&!/[\r\n\u0085\u2028\u2029]/u.test(e)&&typeof t==`string`&&t.trim().length>0&&new TextEncoder().encode(t).byteLength<=16384}function Pe({client:e,templates:t,onChange:n,onClose:r,onNavigationLockChange:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),m=(0,l.useRef)(!1),[h,g]=(0,l.useState)(``),_=s!==(a?.name??``)||u!==(a?.body??``);(0,l.useEffect)(()=>(i?.(_||f),()=>i?.(!1)),[_,f,i]);function v(){return!m.current&&(!_||globalThis.confirm(D(`放弃未保存的主角模板修改?`)))}oe(!0,()=>{!f&&v()&&r()});function y(e){o(e),c(e?.name??``),d(e?.body??``),g(``)}async function b(t){if(!m.current){m.current=!0,p(!0),g(``);try{let r=await e.request(t);n(r),y(t.type===`protagonist-templates.delete`?null:t.type===`protagonist-templates.save`&&t.id!==void 0?r.templates.find(({id:e})=>e===t.id)??null:r.templates.at(-1)??null)}catch(e){g(e instanceof Error?e.message:D(`主角模板保存失败`))}finally{m.current=!1,p(!1)}}}return(0,B.jsx)(`div`,{className:`protagonist-template-scrim`,children:(0,B.jsxs)(`section`,{className:`protagonist-template-manager`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`protagonist-templates-title`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h2`,{id:`protagonist-templates-title`,children:D(`管理主角模板`)}),(0,B.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>{v()&&r()},children:D(`关闭`)})]}),(0,B.jsxs)(`div`,{className:`protagonist-template-columns`,children:[(0,B.jsxs)(`nav`,{"aria-label":D(`主角模板列表`),children:[(0,B.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>{v()&&y(null)},children:D(`新建主角模板`)}),t.map(e=>(0,B.jsx)(`button`,{type:`button`,disabled:f,"aria-pressed":a?.id===e.id,onClick:()=>{v()&&y(e)},children:e.name},e.id))]}),(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),Ne(s,u)&&b({type:`protagonist-templates.save`,...a===null?{}:{id:a.id},name:s,body:u})},children:[(0,B.jsxs)(`label`,{children:[D(`模板名称`),(0,B.jsx)(`input`,{"aria-label":D(`模板名称`),value:s,disabled:f,onChange:e=>c(e.currentTarget.value)})]}),(0,B.jsxs)(`label`,{children:[D(`模板正文`),(0,B.jsx)(`textarea`,{"aria-label":D(`模板正文`),value:u,disabled:f,onChange:e=>d(e.currentTarget.value)})]}),(0,B.jsx)(`small`,{children:D(`名称为 1–80 个字符;正文为自由 Markdown,最多 16 KiB。`)}),h&&(0,B.jsx)(`p`,{role:`alert`,children:h}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{className:`primary-button`,type:`submit`,disabled:f||!_||!Ne(s,u),children:D(`保存`)}),(0,B.jsx)(`button`,{type:`button`,disabled:f||a===null,onClick:()=>{a!==null&&v()&&b({type:`protagonist-templates.copy`,id:a.id})},children:D(`复制`)}),(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:f||a===null,onClick:()=>{a!==null&&!m.current&&globalThis.confirm(D(`删除这个主角模板?`))&&b({type:`protagonist-templates.delete`,id:a.id})},children:D(`删除`)})]})]})]})]})})}function Fe({client:e,packages:t,selectedId:n,pending:r,modelConfigured:i,onSelect:a,onCreate:o,onEdit:s,onConfigureModel:c,onNavigationLockChange:u}){let[d,f]=(0,l.useState)([]),[p,m]=(0,l.useState)(``),[g,_]=(0,l.useState)(!0),[v,y]=(0,l.useState)(``),[b,x]=(0,l.useState)(0),[S,C]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let t=!0;return e.request({type:`protagonist-templates.read`}).then(e=>{t&&(f(e.templates),y(``))}).catch(e=>{t&&y(e instanceof Error?e.message:D(`主角模板读取失败`))}).finally(()=>{t&&_(!1)}),()=>{t=!1}},[e,b]);let w=t.find(({localId:e})=>e===n),[T,O]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t=!0;return n!==``&&e.request({type:`content.read`,packageId:n}).then(({files:e})=>{t&&O({packageId:n,failure:``,opening:e.find(({path:e})=>e===`opening.md`)?.contents??``})}).catch(e=>{t&&O({packageId:n,opening:``,failure:e instanceof Error?e.message:D(`内容包读取失败`)})}),()=>{t=!1}},[e,n]),(0,B.jsxs)(`main`,{className:`create-world-screen`,children:[(0,B.jsxs)(`aside`,{children:[(0,B.jsx)(`h1`,{children:D(`新建世界`)}),(0,B.jsx)(`p`,{children:D(`选择一份内容包,从它的开场开始。`)}),t.length===0?(0,B.jsx)(`p`,{children:D(`先新建或导入一份内容包。`)}):(0,B.jsxs)(`label`,{children:[D(`内容包`),(0,B.jsx)(`select`,{"aria-label":D(`创建世界的内容包`),value:n,disabled:r,onChange:e=>a(e.currentTarget.value),children:t.map(e=>(0,B.jsxs)(`option`,{value:e.localId,children:[`${e.title} · ${h(e.gameplay,E())}`,e.status===`needs_repair`?D(` · 需要修复`):``]},e.localId))})]}),(0,B.jsxs)(`label`,{children:[D(`主角模板`),(0,B.jsxs)(`select`,{"aria-label":D(`主角模板`),value:p,disabled:r||g,onChange:e=>m(e.currentTarget.value),children:[(0,B.jsx)(`option`,{value:``,children:D(`不使用`)}),d.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,B.jsx)(`button`,{type:`button`,disabled:r||g||v!==``,onClick:()=>C(!0),children:D(`管理主角模板`)}),v&&(0,B.jsxs)(`p`,{role:`alert`,children:[v,(0,B.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>{_(!0),x(e=>e+1)},children:D(`重新读取主角模板`)})]}),w?.status===`needs_repair`&&(0,B.jsx)(`p`,{role:`status`,children:D(`内容包需要修复后才能创建世界。`)}),!i&&(0,B.jsx)(`button`,{type:`button`,disabled:r,onClick:c,children:D(`配置模型连接`)}),(0,B.jsx)(`button`,{type:`button`,className:`primary-button`,disabled:r||!i||w?.status!==`usable`,onClick:()=>o(d.find(({id:e})=>e===p)),children:D(r?`正在创建世界…`:`从当前内容包创建`)}),(0,B.jsx)(`button`,{type:`button`,disabled:r,onClick:s,children:D(w===void 0?`新建内容包`:`完善这份内容包`)}),(0,B.jsx)(`small`,{children:D(`新世界独立保存,之后的游玩不会修改源内容包。`)})]}),(0,B.jsxs)(`article`,{"aria-label":D(`开场白预览`),children:[(0,B.jsx)(`span`,{children:D(`开场白`)}),(0,B.jsx)(`h2`,{children:w?.title}),w===void 0?null:(0,B.jsx)(`p`,{className:`create-world-gameplay`,children:h(w.gameplay,E())}),T?.packageId===n&&T.failure?(0,B.jsx)(`p`,{role:`alert`,children:T.failure}):T?.packageId===n?(0,B.jsx)(`p`,{className:`create-world-opening`,children:T.opening||D(`这份内容包还没有开场白。`)}):w===void 0?null:(0,B.jsx)(`p`,{role:`status`,children:D(`正在读取开场白…`)})]}),S&&(0,B.jsx)(Pe,{client:e,templates:d,onChange:e=>{f(e.templates),e.templates.some(({id:e})=>e===p)||m(``)},onClose:()=>C(!1),...u===void 0?{}:{onNavigationLockChange:u}})]})}function Ie({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":D(`关闭提示`),title:D(`关闭提示`),onClick:t,children:`×`})]})}function Le(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return D(`刚刚`);let r=new Intl.RelativeTimeFormat(E(),{numeric:`always`});for(let[e,t]of[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60]])if(n>=t)return r.format(-Math.floor(n/t),e);return D(`刚刚`)}function Re({contentPackages:e,worlds:t,worldBackupImport:n,renderWorldBackupExport:r,selectedPackageId:i,modelConfigured:a,activeModelName:o,currentPresetName:s,importArchive:c,importPending:u,samplePending:d=!1,onImportArchiveChange:f,onOpenPlayPresets:p=()=>void 0,onCreateWorld:m,onCreatePackage:g,onCreateSamplePackage:_,onConfigureModel:v,onImportPackage:y,onOpenPackage:b,onOpenWorld:x,onRenamePackage:S,onDeletePackage:C,onRenameWorld:w,onDeleteWorld:T}){let[O,k]=(0,l.useState)(null),[A,j]=(0,l.useState)(``),[M,ee]=(0,l.useState)(null),[te,ne]=(0,l.useState)(``),N=u||d,P=e.filter(({status:e})=>e===`usable`).length,F=e.length-P;return(0,B.jsxs)(`main`,{className:`home-dashboard`,children:[(0,B.jsxs)(`header`,{className:`home-page-heading`,children:[(0,B.jsx)(`h1`,{children:D(`世界工作区`)}),(0,B.jsx)(`p`,{children:D(`选择一个世界继续故事,或从内容包开始创作。`)})]}),(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:D(`继续游玩`)})}),(0,B.jsx)(`span`,{className:`home-count`,"aria-label":D(`{count} 个世界`,{count:t.length}),children:t.length.toLocaleString(E())}),(0,B.jsx)(`button`,{type:`button`,disabled:N,onClick:m,children:D(`新建世界`)}),n]}),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":D(`打开世界:{title}`,{title:e.title}),disabled:N,onClick:()=>x(e.worldId),children:[(0,B.jsxs)(`span`,{className:`home-world-card-story`,children:[(0,B.jsx)(`strong`,{children:e.title}),(0,B.jsx)(`small`,{className:`home-world-card-gameplay`,children:h(e.gameplay,E())}),(0,B.jsxs)(`span`,{className:`home-world-card-activity`,children:[e.pendingUpgrade===!0?(0,B.jsx)(`span`,{children:D(`待升级`)}):e.lastActivityAt==null?(0,B.jsx)(`span`,{children:D(`活动时间未记录`)}):(0,B.jsx)(`time`,{dateTime:new Date(e.lastActivityAt).toISOString(),title:new Date(e.lastActivityAt).toLocaleString(E()),children:Le(e.lastActivityAt)}),e.pendingUpgrade===!0?null:(0,B.jsx)(`span`,{children:D(e.playerTurns===1?`1 回合`:`{count} 回合`,{count:(e.playerTurns??0).toLocaleString(E())})})]}),e.excerpt==null?null:(0,B.jsx)(`span`,{className:`home-world-card-excerpt`,title:e.excerpt,children:e.excerpt})]}),(0,B.jsxs)(`span`,{className:`home-world-card-action`,children:[D(`进入世界`),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})]}),(0,B.jsxs)(`details`,{className:`home-world-card-actions`,children:[(0,B.jsx)(`summary`,{"aria-label":D(`世界操作:{title}`,{title:e.title}),children:`•••`}),(0,B.jsxs)(`div`,{children:[r?.(e),(0,B.jsx)(`button`,{className:`home-world-rename`,type:`button`,"aria-label":D(`重命名世界:{title}`,{title:e.title}),disabled:N,onClick:()=>{k(e.worldId),j(e.title)},children:D(`重命名`)}),(0,B.jsx)(`button`,{className:`home-world-delete`,type:`button`,"aria-label":D(`删除世界:{title}`,{title:e.title}),disabled:N,onClick:()=>T(e),children:D(`删除`)})]})]}),O===e.worldId?(0,B.jsxs)(`form`,{className:`home-world-rename-form`,onSubmit:t=>{t.preventDefault();let n=A.trim();n!==``&&n!==e.title&&(w(e,n),k(null))},children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:D(`世界名称`)}),(0,B.jsx)(`input`,{"aria-label":D(`世界名称`),autoFocus:!0,maxLength:160,value:A,onChange:e=>j(e.currentTarget.value)})]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`submit`,"aria-label":D(`保存世界名称`),disabled:A.trim()===``||A.trim()===e.title,children:D(`保存`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>k(null),children:D(`取消`)})]})]}):null]},e.worldId))}):(0,B.jsx)(`div`,{className:`home-empty-world`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:D(`还没有正在游玩的世界`)}),(0,B.jsx)(`p`,{children:D(`先新建内容包,或上传一份 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:D(`内容包`)})}),(0,B.jsx)(`button`,{type:`button`,disabled:N,onClick:g,children:D(`新建内容包`)}),(0,B.jsx)(`button`,{type:`button`,disabled:N,onClick:_,children:D(`从示例新建`)})]}),!a&&(0,B.jsx)(`button`,{type:`button`,disabled:N,onClick:v,children:D(`配置模型连接`)}),(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)(`div`,{className:`home-world-card-shell`,children:[(0,B.jsxs)(`button`,{className:`home-package-card`,type:`button`,"aria-label":D(`打开内容包:{name}`,{name:e.title}),"aria-pressed":e.localId===i,disabled:N,onClick:()=>b(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`?D(`可用`):D(`待修复`)})]}),(0,B.jsx)(`span`,{className:`home-package-card-gameplay`,children:h(e.gameplay,E())}),(0,B.jsx)(`span`,{className:`home-package-card-copy`,children:e.status===`usable`?D(`可编辑、预览并创建新世界`):D(`打开并修复当前树中的问题`)})]}),(0,B.jsxs)(`details`,{className:`home-world-card-actions`,children:[(0,B.jsx)(`summary`,{"aria-label":D(`内容包操作:{title}`,{title:e.title}),children:`•••`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{className:`home-world-rename`,type:`button`,"aria-label":D(`重命名内容包:{title}`,{title:e.title}),disabled:N,onClick:()=>{ee(e.localId),ne(e.title)},children:D(`重命名`)}),(0,B.jsx)(`button`,{className:`home-world-delete`,type:`button`,"aria-label":D(`删除内容包:{title}`,{title:e.title}),disabled:N,onClick:()=>C(e),children:D(`删除`)})]})]}),M===e.localId?(0,B.jsxs)(`form`,{className:`home-world-rename-form`,onSubmit:t=>{t.preventDefault();let n=te.trim();n!==``&&n!==e.title&&(S(e,n),ee(null))},children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:D(`内容包标题`)}),(0,B.jsx)(`input`,{"aria-label":D(`内容包标题`),autoFocus:!0,maxLength:160,value:te,onChange:e=>ne(e.currentTarget.value)})]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`submit`,"aria-label":D(`保存内容包标题`),disabled:te.trim()===``||te.trim()===e.title,children:D(`保存`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>ee(null),children:D(`取消`)})]})]}):null]},e.localId))}):(0,B.jsxs)(`div`,{className:`home-empty-packages`,children:[(0,B.jsx)(`h3`,{children:D(`从一组人类可读文件开始`)}),(0,B.jsx)(`p`,{children:D(`从雨夜旅店的示例故事开始,也可以新建或导入自己的内容包。`)}),(0,B.jsx)(`button`,{type:`button`,className:`primary-button`,disabled:N,onClick:_,children:D(d?`正在创建示例…`:`从示例开始`)})]})}),(0,B.jsxs)(`details`,{className:`home-import-disclosure`,children:[(0,B.jsx)(`summary`,{children:D(`导入内容包 ZIP`)}),(0,B.jsxs)(`form`,{className:`home-import-card`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:D(`导入 ZIP`)}),(0,B.jsx)(`p`,{children:D(`选择本应用导出或遵循相同结构的内容包 ZIP;导入会创建新的本地身份,不覆盖同名内容包。`)})]}),(0,B.jsxs)(`label`,{className:`home-zip-picker`,children:[(0,B.jsx)(`span`,{children:D(`内容包 ZIP`)}),(0,B.jsx)(`input`,{className:`home-zip-picker-input`,type:`file`,accept:`.zip,application/zip,application/x-zip-compressed`,"aria-label":D(`内容包 ZIP 文件`),disabled:N,onChange:e=>f(e.target.files?.[0]??null)},c===null?`empty`:`${c.name}:${c.size}:${c.lastModified}`),(0,B.jsx)(`span`,{className:`home-zip-picker-control`,children:(0,B.jsx)(`span`,{"aria-live":`polite`,children:c===null?D(`尚未选择`):`${c.name} · ${ze(c.size)}`})})]}),(0,B.jsx)(`button`,{type:`submit`,disabled:c===null||N,children:D(u?`正在导入…`:`导入 ZIP`)})]})]})]})]})]}),(0,B.jsxs)(`footer`,{className:`home-status-line`,"aria-label":D(`工作区状态`),children:[(0,B.jsxs)(`span`,{children:[D(`模型连接`),` ·`,` `,a?o:D(`尚未配置`)]}),(0,B.jsxs)(`button`,{type:`button`,disabled:N,onClick:p,children:[D(`当前预设`),` · `,s??D(`尚未选择`)]}),(0,B.jsxs)(`span`,{children:[D(`可用内容包`),` · `,P,F>0&&D(` · {count} 份待修复`,{count:F})]})]})]})}function ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:`${(e/1048576).toFixed(1)} MiB`}function Be(e){return/\((?:-1|none|auto|minimal|low|medium|high|xhigh|max|\d+)\)$/iu.test(e)}function Ve(){return{connectionId:null,name:D(`默认模型`),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 He({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?Ve():We(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 v(e,t=!1){s(t=>({...t,...e})),m(!0),t&&u([])}function y(e){v({modelId:e,...o.provider===`anthropic_messages`&&o.thinkingMode===`provider_default`&&!Je({...o,modelId:e})?{reasoningSummary:`provider_default`}:{}})}function b(e){let n=t.presets.find(({id:t})=>t===e);n!==void 0&&v(n.id===`custom`?{presetId:e}:{presetId:e,provider:n.provider,dialect:`standard`,...qe(o,n.provider,`standard`),baseUrl:n.baseUrl,name:o.connectionId===null||o.name===D(`默认模型`)?n.name:o.name},!0)}function x(e){s(We(e)),u([]),m(!1),r(``)}function S(){s(Ve()),u([]),m(!1),r(``)}async function C(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&&x(i),r(D(`模型连接已保存并启用;后续请求只使用当前配置。`))}catch(e){r(Ge(e))}finally{f(null)}}}async function w(t){if(d===null){f(t);try{n(await e.request({type:`model.select`,connectionId:t})),r(D(`已切换当前模型配置;Runtime 不会自动故障转移。`))}catch(e){r(Ge(e))}finally{f(null)}}}async function T(i){if(d===null){f(`copy:${i.id}`);try{let a=Ke(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(D(`Runtime 没有返回已克隆的模型配置`));n(o.library),x(s),r(D(`已克隆为「{name}」。副本保留本机凭据,但不会切换当前配置。`,{name:s.name}))}catch(e){r(Ge(e))}finally{f(null)}}}async function E(t){if(d===null){f(`delete:${t}`);try{n(await e.request({type:`model.delete`,connectionId:t})),o.connectionId===t&&S(),r(D(`模型配置已从本机删除。`))}catch(e){r(Ge(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(D(`已从当前端点拉取 {count} 个模型 ID。`,{count:t.models.length}))}catch(e){r(Ge(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:D(`模型连接`)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`保存多份本机配置并明确切换。API Key 不会返回浏览器;切换失败时 Runtime 不会悄悄改用另一份配置。`)})]}),(0,B.jsxs)(`div`,{className:`model-active-summary`,children:[(0,B.jsx)(`span`,{children:D(`当前配置`)}),(0,B.jsx)(`strong`,{children:h?.name??D(`尚未启用`)}),(0,B.jsx)(`small`,{children:h?.modelId??D(`先保存一份可用连接`)})]})]}),(0,B.jsxs)(`div`,{className:`config-layout`,children:[(0,B.jsxs)(`form`,{className:`config-form panel-card`,onSubmit:e=>void C(e),children:[(0,B.jsxs)(`div`,{className:`section-heading-row`,children:[(0,B.jsx)(`h3`,{children:o.connectionId===null?D(`新建配置`):D(`编辑配置`)}),o.connectionId!==null&&(0,B.jsx)(`button`,{className:`secondary-button`,disabled:p,onClick:S,type:`button`,children:D(`新建另一份`)})]}),(0,B.jsx)(`label`,{htmlFor:`model-preset`,children:D(`提供商`)}),(0,B.jsx)(`select`,{id:`model-preset`,value:o.presetId,onChange:e=>b(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:D(`配置名称`)}),(0,B.jsx)(`input`,{id:`model-name`,maxLength:160,required:!0,value:o.name,onChange:e=>v({name:e.target.value})}),(0,B.jsx)(`label`,{htmlFor:`model-provider`,children:D(`协议适配器`)}),(0,B.jsxs)(`select`,{id:`model-provider`,value:o.provider,onChange:e=>v({presetId:`custom`,provider:e.target.value,...qe(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:D(`端点方言`)}),(0,B.jsxs)(`select`,{id:`model-dialect`,value:o.dialect,onChange:e=>{let t=e.target.value;v({dialect:t,...qe(o,o.provider,t)})},children:[(0,B.jsx)(`option`,{value:`standard`,children:D(`协议标准`)}),(0,B.jsx)(`option`,{value:`cliproxyapi`,children:`CLIProxyAPI`})]}),(0,B.jsxs)(`details`,{className:`parameter-help`,children:[(0,B.jsx)(`summary`,{children:D(`参数说明`)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`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:[D(`Effort(推理强度)`),(0,B.jsxs)(`select`,{id:`model-reasoning-effort`,value:o.reasoningEffort,onChange:e=>v({reasoningEffort:e.target.value}),children:[(0,B.jsx)(`option`,{value:`provider_default`,children:D(`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:[D(`Thinking(思考模式)`),(0,B.jsxs)(`select`,{id:`model-thinking-mode`,disabled:o.provider!==`anthropic_messages`,value:o.thinkingMode,onChange:e=>{let t=e.target.value;v({thinkingMode:t,thinkingBudgetTokens:t===`enabled`?o.thinkingBudgetTokens||Ye(o.maxOutputTokens):``,reasoningSummary:t===`provider_default`||t===`disabled`?t===`provider_default`&&Je({...o,thinkingMode:t})?o.reasoningSummary:`provider_default`:o.reasoningSummary})},children:[(0,B.jsx)(`option`,{value:`provider_default`,children:D(`Provider 默认`)}),(0,B.jsx)(`option`,{value:`adaptive`,children:`adaptive`}),(0,B.jsx)(`option`,{value:`enabled`,children:D(`手动 token 预算`)}),(0,B.jsx)(`option`,{value:`disabled`,children:`disabled`})]})]}),(0,B.jsxs)(`label`,{htmlFor:`model-reasoning-summary`,children:[D(`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`)&&!Je(o),value:o.reasoningSummary,onChange:e=>v({reasoningSummary:e.target.value}),children:[(0,B.jsx)(`option`,{value:`provider_default`,children:D(`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:[D(`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=>v({thinkingBudgetTokens:e.target.value})})]}):null,(0,B.jsxs)(`details`,{className:`parameter-help`,children:[(0,B.jsx)(`summary`,{children:D(`参数说明`)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`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=>v({presetId:`custom`,baseUrl:e.target.value},!0)}),g?.id!==`custom`&&(0,B.jsxs)(`p`,{className:`field-note`,children:[D(`已填入`),g?.name,` `,D(`的内置端点;手动修改后按自定义端点保存。`)]}),(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?D(`新配置必填`):D(`留空以沿用本机保存的现有凭据`),onChange:e=>v({apiKey:e.target.value},!0)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`编辑已有配置时,API Key 留空会把本机保存的现有凭据用于当前协议和端点;填写新值会覆盖它。`)}),(0,B.jsxs)(`div`,{className:`model-picker-row`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{htmlFor:`model-id`,children:D(`模型 ID`)}),(0,B.jsx)(`input`,{id:`model-id`,"aria-label":D(`模型 ID`),maxLength:512,required:!0,value:o.modelId,onChange:e=>y(e.target.value)})]}),(0,B.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||o.baseUrl.length===0||_&&o.apiKey.length===0,onClick:()=>void O(),type:`button`,children:D(d===`models`?`正在拉取…`:`从端点拉取模型`)})]}),c.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{htmlFor:`fetched-model-id`,children:D(`已拉取的模型`)}),(0,B.jsxs)(`select`,{id:`fetched-model-id`,value:c.includes(o.modelId)?o.modelId:``,disabled:d!==null,onChange:e=>y(e.target.value),children:[(0,B.jsx)(`option`,{value:``,disabled:!0,children:D(`选择模型`)}),c.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`选择后会填入模型 ID,也可以手动输入。`)})]}),(0,B.jsxs)(`div`,{className:`two-column-fields`,children:[(0,B.jsxs)(`label`,{children:[D(`真实 context window`),(0,B.jsx)(`input`,{min:4096,max:16777216,required:!0,step:1,type:`number`,value:o.contextWindowTokens,onChange:e=>v({contextWindowTokens:e.target.value})})]}),(0,B.jsxs)(`label`,{children:[D(`最大输出 tokens`),(0,B.jsx)(`input`,{min:256,max:16777215,required:!0,step:1,type:`number`,value:o.maxOutputTokens,onChange:e=>v({maxOutputTokens:e.target.value})})]})]}),(0,B.jsxs)(`div`,{className:`form-actions`,children:[(0,B.jsx)(`button`,{disabled:d!==null,type:`submit`,children:D(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&&x(e)},type:`button`,children:D(`放弃修改`)}),p&&o.connectionId===null&&(0,B.jsx)(`button`,{className:`secondary-button`,disabled:d!==null,onClick:S,type:`button`,children:D(`重置新配置`)})]})]}),(0,B.jsxs)(`section`,{className:`config-list`,"aria-label":D(`已保存模型配置`),children:[(0,B.jsxs)(`div`,{className:`section-heading-row`,children:[(0,B.jsx)(`h3`,{children:D(`已保存配置`)}),(0,B.jsxs)(`span`,{children:[t.connections.length,` `,D(`份`)]})]}),t.connections.length===0&&(0,B.jsx)(`p`,{className:`panel-card`,children:D(`尚未保存模型配置。`)}),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:Ue(e.provider)}),(0,B.jsx)(`h3`,{children:e.name})]}),n&&(0,B.jsx)(`span`,{className:`active-config`,children:D(`当前使用`)})]}),(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:D(`模型`)}),(0,B.jsx)(`dd`,{children:e.modelId})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`端点`)}),(0,B.jsx)(`dd`,{children:e.baseUrl})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`窗口 / 输出`)}),(0,B.jsxs)(`dd`,{children:[e.contextWindowTokens.toLocaleString(),` /`,` `,e.maxOutputTokens.toLocaleString()]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`方言 / 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:D(`凭据`)}),(0,B.jsx)(`dd`,{children:e.hasApiKey?D(`已保存在本机`):D(`未配置`)})]})]})]}),(0,B.jsxs)(`div`,{className:`form-actions`,children:[!n&&(0,B.jsx)(`button`,{disabled:d!==null,onClick:()=>void w(e.id),type:`button`,children:d===e.id?D(`正在切换…`):D(`切换到此配置`)}),(0,B.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||p,onClick:()=>void T(e),type:`button`,children:d===`copy:${e.id}`?D(`正在克隆…`):D(`克隆配置`)}),(0,B.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||p||o.connectionId===e.id,onClick:()=>x(e),type:`button`,children:o.connectionId===e.id?D(`正在编辑`):D(`编辑`)}),(0,B.jsx)(`button`,{className:`danger-button`,disabled:d!==null||p||n&&t.connections.length>1,onClick:()=>void E(e.id),type:`button`,children:d===`delete:${e.id}`?D(`正在删除…`):D(`删除`)})]}),n&&t.connections.length>1&&(0,B.jsx)(`p`,{className:`field-note`,children:D(`先切换到另一份配置,才能删除当前配置。`)})]},e.id)})]})]})]})}function Ue(e){switch(e){case`chat_completions`:return`Chat Completions`;case`openai_responses`:return`OpenAI Responses`;case`anthropic_messages`:return`Anthropic Messages`}}function We(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 Ge(e){return e instanceof Error?e.message:D(`模型配置操作失败`)}function Ke(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?D(`(副本)`):D(`(副本 {number})`,{number:r}),i=`${e.slice(0,Math.max(0,160-t.length))}${t}`;if(!n.has(i))return i}throw Error(D(`无法生成不重复的副本名称`))}function qe(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=Je({...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 Je(e){return e.provider===`anthropic_messages`&&e.dialect===`cliproxyapi`&&e.thinkingMode===`provider_default`&&Be(e.modelId)}function Ye(e){let t=Number(e);return!Number.isSafeInteger(t)||t<=1024?`1024`:String(Math.min(8192,t-1))}function Xe(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`));return[t.slice(0,4).join(``),t.slice(4,6).join(``),t.slice(6,8).join(``),t.slice(8,10).join(``),t.slice(10).join(``)].join(`-`)}function Ze(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 Qe(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}}}function $e(e,t){if(t.type===`delete-resource`){let n=tt(e).get(t.path)??{declared:!1,sources:[]};if(n.declared||n.sources.length)throw Error(`Resource is referenced: ${t.path}${n.sources.length?` (${n.sources.join(`, `)})`:``}`);let r=structuredClone(e);return delete r.files[t.path],r.structure.extensionRefs=r.structure.extensionRefs.filter(e=>e!==t.path),r}if((t.type===`create-followup`||t.type===`clone-followup`)&&(e.structure.followups.some(e=>e.id===t.id)||e.structure.followupItems?.some(e=>e.id===t.id)||e.files[`prompts/${t.id}.md`]!==void 0))throw Error(`Request or prompt already exists: ${t.id}`);let n=structuredClone(e);if(t.type===`create-panel`)return n.structure.playerViewPanels.push({id:t.id,source:{kind:`player_view`,view:`status`},channel:`player.view.${t.id}`,key:`current`,mount:`sidebar`,rendererMode:`document`,config:{title:t.title,layout:`stack`,theme:`default`,empty:`message`,emptyMessage:t.emptyMessage,groups:[]}}),n;if(t.type===`remove-panel`)return n.structure.playerViewPanels=n.structure.playerViewPanels.filter(e=>e.id!==t.id),n;if(t.type===`remove-followup`||t.type===`remove-artifact`){let e=t.type===`remove-followup`?t.id:t.requestId,r=n.structure.followups.find(t=>t.id===e);if(!r)throw Error(`Request does not exist: ${e}`);let i=t.type===`remove-followup`?r.artifacts:r.artifacts.filter(e=>e.name===t.output),a=new Set(i.map(e=>e.channel));t.type===`remove-followup`?(n.structure.followupItems=(n.structure.followupItems??Ze(n.structure.followups)).filter(t=>t.id!==e),n.structure.followups=n.structure.followups.filter(t=>t.id!==e)):r.artifacts=r.artifacts.filter(e=>e.name!==t.output);let o=new Set([...n.structure.followups.flatMap(e=>e.artifacts.map(e=>e.channel)),...n.structure.playerViewPanels.map(e=>e.channel)]);return n.structure.mounts=n.structure.mounts.filter(e=>!a.has(e.channel)||o.has(e.channel)),n}if(t.type===`create-followup`){let e=`prompts/${t.id}.md`,r=at(`${t.id}.output_1`,`output_1`);return n.files[e]=t.body,n.structure.followupItems=[...n.structure.followupItems??Ze(n.structure.followups),{id:t.id,kind:`user`,enabled:!0}],n.structure.followups.push({id:t.id,displayName:t.displayName,prompt:{role:`author_instruction`,path:e},artifacts:[r],maxArtifactBytes:32768}),n.structure.mounts.push({channel:r.channel,mount:`story`}),n}if(t.type===`add-artifact`){let e=n.structure.followups.find(e=>e.id===t.requestId);if(!e)throw Error(`Request does not exist: ${t.requestId}`);for(let[e,r]of Object.entries(t.files??{})){if(n.files[e]!==void 0)throw Error(`Resource already exists: ${e}`);n.files[e]=r}let r=nt(t.artifact);for(let e of r)if(n.files[e]===void 0)throw Error(`Resource does not exist: ${e}`);return e.artifacts.push(structuredClone(t.artifact)),n.structure.mounts.some(e=>e.channel===t.artifact.channel)||n.structure.mounts.push({channel:t.artifact.channel,mount:t.mount??`story`}),n.structure.extensionRefs=[...new Set([...n.structure.extensionRefs,...r,...Object.keys(t.files??{})])],n}if(t.type===`clone-followup`){let r=t.source===`builtin:summary`?Qe(E()):void 0,i=r?.definition??n.structure.followups.find(e=>e.id===t.source);if(!i)throw Error(`Clone source does not exist`);let a=structuredClone(i);a.id=t.id,a.displayName+=E()===`zh-CN`?` 副本`:` copy`;let o=new Map,s=r?.body??e.files[i.prompt.path];if(s===void 0)throw Error(`Resource does not exist: ${i.prompt.path}`);let c=[...i.artifacts.flatMap(nt),...rt(s)];for(let t of c){if(o.has(t))continue;if(e.files[t]===void 0)throw Error(`Resource does not exist: ${t}`);let n=t.lastIndexOf(`/`);o.set(t,`${t.slice(0,n)}/${Xe()}-${t.slice(n+1)}`),c.push(...rt(e.files[t]))}let l=e=>e.replace(it(),e=>o.get(e)??e);for(let[t,r]of o)n.files[r]=l(e.files[t]);a.prompt.path=`prompts/${t.id}.md`,n.files[a.prompt.path]=l(s);let u=new Map;return a.artifacts=a.artifacts.map(e=>{let n={...e},r=u.get(e.channel);return r||(r=`${t.id}.output_${u.size+1}`,u.set(e.channel,r)),n.channel=r,e.renderer&&(n.renderer=o.get(e.renderer)),e.regex&&(n.regex=o.get(e.regex)),e.scripts&&(n.scripts=e.scripts.map(e=>o.get(e))),e.assets&&(n.assets=e.assets.map(e=>o.get(e))),n}),n.structure.followupItems=[...n.structure.followupItems??Ze(n.structure.followups),{id:a.id,kind:`user`,enabled:!0}],n.structure.followups.push(a),n.structure.mounts.push(...(r?i.artifacts.map(e=>({channel:e.channel,mount:`story`})):e.structure.mounts).filter(e=>u.has(e.channel)).map(e=>({...e,channel:u.get(e.channel)}))),n.structure.extensionRefs=[...new Set([...n.structure.extensionRefs,...o.values()])],n}let r=t.target,i=r.kind===`panel`?n.structure.playerViewPanels.find(e=>e.id===r.id):n.structure.followups.find(e=>e.id===r.requestId)?.artifacts.find(e=>e.name===r.output);if(!i)throw Error(`Display declaration does not exist`);let a=t.edit;if(a.type===`mode`)return i.rendererMode=a.mode,n;let{kind:o}=a;if(a.type===`unbind`)return o===`assets`||o===`scripts`?i[o]=(i[o]??[]).filter(e=>e!==a.path):i[o]===a.path&&(delete i[o],o===`renderer`&&(delete i.rendererRevision,i.rendererMode=`document`)),n;let s=a.type===`create`?et(a):a.path;if(a.type===`create`&&(n.files[s]=a.body),n.files[s]===void 0)throw Error(`Resource does not exist: ${s}`);return o===`assets`||o===`scripts`?i[o]=[...new Set([...i[o]??[],s])]:(i[o]=s,o===`renderer`&&(i.rendererRevision=Xe())),n.structure.extensionRefs=[...new Set([...n.structure.extensionRefs,s])],n}function et(e){return`${{renderer:`renderers`,regex:`regex`,scripts:`scripts`,assets:`assets`}[e.kind]}/${e.name.trim()?`named-`+Array.from(e.name.trim().slice(0,24)).map(e=>/[A-Za-z0-9.-]/u.test(e)?e:`_u${e.codePointAt(0).toString(16)}_`).join(``):`resource`}.${Xe()}.${e.suffix}`}function tt(e){let t=new Map;function n(e){let n=t.get(e);return n||(n={declared:!1,sources:[]},t.set(e,n)),n}let r=e.structure,i=[r.settingImprovementPrompt?.path,...r.narrativePrompts.map(e=>e.path),...r.followups.flatMap(e=>[e.prompt.path,...e.artifacts.flatMap(nt)]),...r.playerViewPanels.flatMap(nt)];for(let e of i)e!==void 0&&(n(e).declared=!0);for(let[t,i]of Object.entries(e.files))if(t!==`preset.yaml`&&t!==r.callChainPath)for(let e of new Set(rt(i)))e!==t&&n(e).sources.push(t);return t}function nt(e){return[e.renderer,e.regex,...e.scripts??[],...e.assets??[]].filter(e=>e!==void 0)}function rt(e){return[...e.matchAll(it())].map(e=>e[0])}function it(){return/(?:(?<![A-Za-z0-9_./:@%?=#\\-])|(?<=\s[A-Za-z_:][A-Za-z0-9_:.-]*[\t\n\f\r ]*=))(?:renderers\/[A-Za-z0-9][A-Za-z0-9._-]*\.html|regex\/[A-Za-z0-9][A-Za-z0-9._-]*\.yaml|scripts\/[A-Za-z0-9][A-Za-z0-9._-]*\.js|assets\/[A-Za-z0-9][A-Za-z0-9._/-]*)(?![A-Za-z0-9_./$?%#=\\-])/gu}function at(e,t){return{name:t,displayName:E()===`zh-CN`?`新产物`:`New output`,channel:e,strategy:`replace`,contentType:`text/markdown`,rendererMode:`document`,save:`commit`,invalidation:`explicit_clear`,required:!1,maxEmits:1}}function ot(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 st(e,t){let n=`example_${Xe().replaceAll(`-`,``)}`,r=E()===`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.
1131
+ (function () {
1132
+ var pending = new Map();
1133
+ var instanceId = document.documentElement.dataset.narraeonInstance;
1134
+ var nonce = document.documentElement.dataset.narraeonNonce;
1135
+ var feedback = document.getElementById("feedback");
1136
+ function fromHost(event) {
1137
+ var message = event.data;
1138
+ return event.source === parent && message && message.namespace === "narraeon.extension.v1" && message.instanceId === instanceId && message.nonce === nonce;
1139
+ }
1140
+ function request(command, payload) {
1141
+ var requestId = Array.from(crypto.getRandomValues(new Uint8Array(16)), function (byte) { return byte.toString(16).padStart(2, "0"); }).join("");
1142
+ pending.set(requestId, command);
1143
+ parent.postMessage({namespace: "narraeon.extension.v1", instanceId: instanceId, nonce: nonce, requestId: requestId, command: command, payload: payload}, "*");
1144
+ }
1145
+ window.addEventListener("message", function (event) {
1146
+ if (!fromHost(event)) return;
1147
+ var message = event.data;
1148
+ if (message.type === "bridge.response" && pending.has(message.requestId)) {
1149
+ pending.delete(message.requestId);
1150
+ feedback.textContent = message.ok ? ${JSON.stringify(r?`已填写草稿,尚未发送。`:`Draft filled, not sent.`)} : ${JSON.stringify(r?`操作失败:`:`Action failed: `)} + JSON.stringify(message.error || message.payload);
1151
+ return;
1152
+ }
1153
+ if (message.type !== "render.update") return;
1154
+ var root = document.getElementById("content");
1155
+ root.replaceChildren();
1156
+ try {
1157
+ // payload.content is the STRING after display processing.
1158
+ var data = JSON.parse(message.payload.content);
1159
+ feedback.textContent = message.payload.interactionDisabled ? ${JSON.stringify(r?`当前禁止交互。`:`Interactions are currently disabled.`)} : "";
1160
+ ${e===`actions`?`data.forEach(function (item) {
1161
+ var button = document.createElement("button");
1162
+ button.textContent = item.label;
1163
+ button.disabled = Boolean(message.payload.interactionDisabled);
1164
+ button.addEventListener("click", function () { request("composer.set_draft", {text: item.prompt}); });
1165
+ root.append(button);
1166
+ });`:`var title = document.createElement("h3");
1167
+ title.textContent = data.title;
1168
+ var body = document.createElement("p");
1169
+ body.textContent = data.body;
1170
+ root.append(title, body);`}
1171
+ } catch (error) { feedback.textContent = String(error); }
1172
+ });
1173
+ }());
1174
+ `},sample:s}}function ct(e){return e===`zh-CN`?`## 为实际游玩准备局面
1175
+ - 从玩家眼前值得行动的局面开始:想得到什么、什么阻碍着他们、为什么现在需要决定。先写可互动的人物、地点和线索,再按需补背景;不预写玩家必经的剧情或结局。
1176
+ - 为重要人物写出欲望、顾虑、掌握的信息和能采取的手段;说明冲突各方在无人干预时会怎样行动及玩家能察觉的迹象。推进应有原因,不因玩家偏离预想路线而惩罚他们。
1177
+ - 提供多种可以探索的办法与可利用的环境细节;不要求唯一解,也不把列出的办法当成穷尽选项。调查、准备、装备和盟友应能实际改变处境或判定数值。
1178
+ - 写明所选方案的数值尺度、常见难度参照与准备带来的影响,保持前后一致;角色、战斗和资源体系按世界需要设计。隐藏事实可以保密,明显风险与行动所需信息应让玩家能够获知。
1179
+ - 按实际玩家视图的绑定范围分开放置公开信息和主持秘密。整份文档若会展示给玩家,其中的标题、摘要和任何子字段都不能藏秘密;只绑定公开节点时,主持资料才可放在未展示的节点。当前情境也不天然私密。记录角色各自知道什么,避免主持知道的真相成为玩家或 NPC 的知识。字段结构按世界需要设计。
1180
+ - 开场呈现冲突并停在玩家能决定的位置,不替玩家接受任务或选择路线。让后续主持人能依据人物动机和当前状态继续,而不是依赖一份秘密剧本。
1181
+
1182
+ ### 开场正反例
1183
+ 弱例:“你来到一座繁华港口,这里有悠久的历史。”只有背景,没有眼前可行动的关系。
1184
+ 较好:“明早处刑的走私犯知道你妹妹的下落。他愿意交换情报,条件是今晚带他离开牢房。守卫队长欠你一个人情。”玩家可以求人、调查、交易、潜入或另寻办法;不要预定他们劫狱。
1185
+ 示例仅说明设计方法,不向当前世界添加港口、妹妹或走私犯。`:`## Prepare situations for actual play
1186
+ - Start with something worth acting on: what the player wants, what stands in the way, and why a decision matters now. Prepare people, places and clues before background lore. Do not script a mandatory route or ending.
1187
+ - Give important NPCs desires, concerns, information and available means. Describe what opposing parties do without intervention and signs the player can notice. Develop events causally; do not punish departures from your expected route.
1188
+ - Offer several discoverable approaches and useful environmental details, without requiring a single solution or treating listed approaches as exhaustive. Investigation, preparation, equipment and allies must be able to change circumstances or check inputs.
1189
+ - Document the selected scheme's numeric scale, ordinary difficulty benchmarks and effects of preparation consistently. Design character, combat and resource systems for this world. Secrets may remain hidden; make obvious risks and information needed for decisions discoverable.
1190
+ - Separate public information from GM secrets according to actual player-view bindings. If a whole document is displayed, none of its titles, summaries or nested fields may contain secrets. GM material may occupy an unexposed node when only the public node is bound. The current situation is not inherently private. Track what each character knows; GM knowledge is not player or NPC knowledge. Choose field structures for this world.
1191
+ - End the opening at a player decision, without accepting a mission or choosing a route for them. Prepare motivations and current state that another GM can use, rather than a secret script.
1192
+
1193
+ ### Opening examples
1194
+ Weak: “You arrive at a bustling port with a long history.” This supplies background but no immediate actionable relationship.
1195
+ Better: “A smuggler facing execution tomorrow knows where your missing sister is. He offers the information if you get him out tonight. The guard captain owes you a favour.” The player may negotiate, investigate, trade, infiltrate or find another approach; do not prescribe a jailbreak.
1196
+ These examples illustrate technique; they do not add a port, sister or smuggler to the current world.`}function lt(e){return e===`zh-CN`?`## 主持流程
1197
+ 1. 呈现玩家现在能察觉的局面、可互动细节与明显风险,区分已知事实和人物猜测。保留有依据的秘密,但不要在判定后临时补造机关、敌人或限制来否定结果。
1198
+ 2. 理解玩家想实现的目标和采取的办法。意图清楚就直接推进;只有歧义会显著改变目标、范围或风险时才简短澄清,不逐步索取确认,不替玩家补行动和台词。
1199
+ 3. 对有成败不确定性、风险或对抗且后果值得展开的行动进行判定。纯描述、已完成事实和没有成败问题的衔接可直接叙述;不能因行动显得简单或离谱就绕开需要的判定、预定成败。明确一次判定覆盖的目标和范围,根据已建立的能力、环境、准备及世界难度参照确定数值,再调用当前方案工具。不要先决定剧情结果再倒推难度。
1200
+ 4. 完整兑现工具结果。成功取得约定成果,失败未取得约定成果;大成功和大失败也按回执兑现。已取得的成果成为后续可依靠的事实。新障碍必须有独立原因,不能紧接着取消刚刚的成功;失败也不能用偶然获得等价好处来偷偷改成成功。
1201
+ 5. 让后果带来新的处境和可决定的事情,而不是只有“失败了,再试一次”。根据已建立的风险、人物动机和现场情况决定后果,避免每次失败都升级为灾难。新判定应对应新的目标或实际变化的障碍,不把一个目标拆成连续掷骰直到失败。
1202
+ 6. 用世界工具保存人物数值、资源、关系、位置和重要局势的实际变化。让 NPC 依据动机和已知信息反应,允许玩家说服敌人、绕过冲突或提前解决危机;不把所有路线导回预定场景。无人处理的事情按既有原因发展并留下迹象。
1203
+ 7. 重要选择与后果展开写,重复过程和没有新变化的路程简略带过,也给交谈和喘息留空间。叙述到需要玩家决定的位置就停。可以提示眼前可行的办法,但不能限制玩家只能选它们。
1204
+
1205
+ ### 落笔与保存前的核对
1206
+ - 知识边界:查明哪些文档或节点会进入玩家视图,再决定写在哪里。叙事、公开面板、标题和摘要只呈现玩家已知或当前可察觉的内容;尚未发现的故障原因、敌方计划等保存在不会展示的主持资料中。幕后变化仍须按保存约定落盘,不能为了保密丢掉状态,也不能把主持真相写进公开的当前情境。NPC 只能依据自己获得的信息行动。
1207
+ - 当前状态:一个事实改变后,检查它影响的已有记录及玩家视图绑定,例如人物、借贷、位置、场景现状、可见细节与当前情境。按工具约定读取相关内容,更新受影响字段,删除失效的当前断言或明确改为过去记录,不只在末尾追加相反的新句子。历史不必抹除,无关文档不必重写,也不必把同一事实复制到每处;实际公开值和本轮叙事必须一致。其他持久变化按运行时保存约定处理。
1208
+ - 玩家意图:保留条件、否定的作用范围、尚未决定的事项和执行状态。提议不是已成交,愿意不是已执行,“不要替我接受”不是“我拒绝任何替代方案”。不要把一次有条件的表达写成长期立场。条件未满足时停在玩家保留的决定处。
1209
+ 例如,玩家还只听见异响时,公开情境不能写“必须同时修好阀门与定位销”;查明后才可公开诊断。修好后,既更新“灯已稳定”,也检查“可见细节”中是否还断言异响正在发生。借用完成后,“尚未借用”应移除或标为过去。
1210
+ 玩家说“如果对方不同意这个价,先告诉我,不替我接受别的条件”,可记为“提出该价格;其他条件待玩家决定”,不能记为“不接受替代条件”。这些核对通过读写与叙事完成,不把内部检查清单交给玩家确认。
1211
+
1212
+ ### 连续主持示例:目标、判定、后果、新选择
1213
+ 玩家:“趁换岗,我从排水渠潜入厨房,别惊动守卫。”
1214
+ 主持:依据已知的换岗时间和湿滑通道,说明此次目标是“不惊动守卫进入城堡内部”,确定修正与难度,调用当前判定工具。
1215
+ 若成功:玩家已经进入厨房且未惊动守卫。描述可观察的走廊、厨房人员或线索,停下来让玩家决定。反例:“你成功进入,但守卫立刻发现你。”这抵消了约定成果。
1216
+ 后续玩家:“我偷走守卫腰间的钥匙。”主持确定目标与风险并判定。若失败:钥匙仍在守卫身上;例如守卫察觉并抓住玩家手腕,要求解释。玩家现在可解释、贿赂、逃跑或采取其他行动。不要代选,也不要说“虽然失败,旁边却恰好有一把同样的钥匙”。
1217
+ 若玩家准备了可信的身份文件来解释,应让这份准备影响新的处境或判定;不能为了保住劫狱剧情强制开战。后续若成功说服守卫,就兑现说服的目标。
1218
+ 以上是假设分支,必须由实际回执选择成败,不能照抄成功或失败;示例中的地点、人物和物品不属于当前世界。`:`## GM procedure
1219
+ 1. Describe what the player can perceive, useful details and obvious risks. Distinguish facts from character guesses. Keep grounded secrets, but never invent traps, enemies or restrictions after a check to negate its result.
1220
+ 2. Understand the intended goal and approach. Proceed when clear; ask briefly only when ambiguity materially changes the goal, scope or risk. Do not request confirmation at every step or invent the player's actions and dialogue.
1221
+ 3. Check actions with uncertain success, risk or opposition whose consequences matter. Pure description, established accomplishments and transitions without a success question need no check. Do not bypass a needed check or predetermine success or failure because an action seems easy or absurd. Specify the goal and scope, derive inputs from established abilities, circumstances, preparation and world difficulty benchmarks, then call the selected tool. Never reverse-engineer difficulty from a desired plot result.
1222
+ 4. Honour the complete receipt: success achieves the agreed goal; failure does not. Honour critical outcomes too. Accomplishments remain usable facts. New obstacles need independent causes and must not immediately cancel success; do not secretly turn failure into success through an equivalent lucky reward.
1223
+ 5. Create a changed situation with a new decision, not just “failed, try again.” Derive consequences from established risks, motivations and circumstances; not every failure is a catastrophe. Each new check needs a new goal or a materially changed obstacle. Never split one goal into repeated rolls until it fails.
1224
+ 6. Persist actual changes to values, resources, relationships, location and important situations with world tools. NPCs react according to their motives and information. Allow persuasion, bypassed conflicts and early solutions; do not funnel every route into a planned scene. Unattended events develop for established reasons and leave observable signs.
1225
+ 7. Give consequential choices and outcomes space; compress repetition and uneventful travel, and allow conversation and breathing room. Stop at the player's next decision. Suggested approaches are possibilities, never an exhaustive menu.
1226
+
1227
+ ### Before narrating and saving
1228
+ - Knowledge boundaries: inspect which documents or nodes feed player views before choosing where to write. Narration, public panels, titles and summaries contain only player-known or currently perceptible information. Undiscovered causes and opposing plans belong in unexposed GM material. Still persist offscreen changes under the runtime saving contract; secrecy must neither discard state nor put GM truth into a public current situation. NPCs act only on information they have acquired.
1229
+ - Current state: when a fact changes, inspect affected existing records and player-view bindings, such as characters, loans, locations, scene status, observable details and the current situation. Read relevant content under tool rules, update affected fields, and remove expired current assertions or explicitly mark them as past records instead of merely appending contradictory updates. Preserve history where useful; do not rewrite unrelated documents or duplicate every fact everywhere. Actual public values must agree with this turn's narration. Handle other persistent changes under the runtime saving contract.
1230
+ - Player intent: preserve conditions, the scope of negation, pending decisions and execution status. An offer is not a completed deal; willingness is not execution; “do not accept for me” is not “I reject every alternative.” Do not turn a conditional statement into an enduring stance. If its condition is unmet, stop at the decision reserved for the player.
1231
+ For example, while the player has only heard a rattle, a public situation must not reveal “both valve and pin need repair”; disclose the diagnosis after discovery. After repairs, update “the light is stable” and inspect observable details for a stale assertion that rattling continues. Once a loan occurs, remove “not borrowed yet” or mark it as past.
1232
+ “If they decline my price, tell me first; do not accept other terms for me” can become “offered that price; other terms await the player's decision,” never “rejects alternative terms.” Perform these checks through tools and narration; do not ask the player to approve an internal checklist.
1233
+
1234
+ ### Connected example: goal, check, consequence, next choice
1235
+ Player: “During the shift change, I enter the kitchen through the drain without alerting the guards.”
1236
+ GM: Use the known shift timing and slippery passage, establish the goal as entering the castle unnoticed, determine inputs and call the selected check tool.
1237
+ On success: the player is inside the kitchen without alerting guards. Describe observable corridors, people or clues and let the player decide. Bad: “You enter successfully, but a guard immediately spots you.” This cancels the agreed accomplishment.
1238
+ Later the player tries to steal a guard's keys. Establish the goal and risks, then check. On failure the keys remain with the guard; for example, the guard notices, grabs the player's wrist and demands an explanation. The player can explain, bribe, flee or do something else. Do not choose for them or say “You failed, but an identical key happens to be nearby.”
1239
+ If the player prepared credible identity papers, let that preparation affect the new situation or check. Do not force combat to preserve a jailbreak plot. If subsequent persuasion succeeds, honour its agreed goal.
1240
+ These are hypothetical branches: choose success or failure only from the actual receipt. Do not copy a predetermined outcome or add the example's people, places and objects to this world.`}function ut(e){return e===`zh-CN`?`你是跑团主持人。使用本世界固定的判定工具。先读取角色与相关状态,明确行动目标、属性修正和难度,再调用工具;取得回执后再叙述结果。普通成功必须实现目标,普通失败必须使目标失败,不能按合理性推翻。大成功和大失败遵守工具固定规则,让极端行动和简单行动也可能出现意外。不要看结果后更改目标或难度,也不要为同一行动重掷。数值掷骰仅处理伤害或数量,不能改写判定。随机结果由 Runtime 决定;数值、难度、角色字段和世界规则由你负责。自行维护人物、技能、生命、资源和后果,字段由世界需要决定;用世界工具写入变化。尊重玩家明确的行动与发言,不替玩家选择下一步。`:`You are the tabletop GM. Use this world's fixed resolution tool. Read relevant character state, declare the goal, modifiers and difficulty, then call the tool before narrating. Success must achieve the declared goal; failure must fail it regardless of plausibility. Honour the tool's fixed critical outcomes. Never change the goal or difficulty after a draw or reroll the same action. Auxiliary numeric dice determine damage or quantities, never reverse checks. Runtime decides randomness; you own numbers, difficulty, character fields and world rules. Define and maintain character attributes, skills, health, resources and consequences using world tools. Respect player agency.`}function dt(e){return e===`zh-CN`?`为跑团创作完整可玩的世界。人物字段、数值、难度与世界规则由你负责;随机结果由 Runtime 决定,不要预先决定成败。设定人物的初始属性值、技能、生命或其他需要的数值,说明这些值如何用于当前判定方案,以及难度如何选择。角色字段自由设计,不强制职业、等级或战斗系统。提供合适的开场和玩家视图。`:`Author a playable tabletop world. You own character fields, numbers, difficulty and world rules; Runtime decides randomness, so do not predetermine outcomes. Define initial character values, skills, health or other numeric fields the world needs, and explain how they feed the current resolution scheme and how difficulty is chosen. Choose character fields freely; no class, level or combat engine is mandatory. Provide a suitable opening and player views.`}function ft(e){return`${ut(e)}\n\n${lt(e)}`}function pt(e){return`${dt(e)}\n\n${ct(e)}`}function mt(e){let t=e===`zh-CN`;return[{id:`author.mechanics`,name:t?`创作工具与结算(必选)`:`Authoring tools and settlement (required)`,required:!0,category:`mechanics`,body:ht(e,`setting`)},{id:`author.guidance`,name:t?`创作建议`:`Authoring guidance`,required:!1,category:`policy`,body:we(e)},{id:`author.tabletop`,name:t?`跑团创作建议`:`Tabletop authoring guidance`,required:!1,category:`policy`,body:pt(e),gameplay:`tabletop`},{id:`author.target`,name:t?`创作目标与读取授权(动态必选)`:`Target and read authorization (required, dynamic)`,required:!0,category:`mechanics`,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,category:`policy`,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 ht(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 gt(e,t=!1){return e===`zh-CN`?`已有对话或注入原文足够接续时,不例行检索或重读。缺失信息会影响人物行为、重要承诺、因果或玩家选择时才检索${t?`;仅使用本会话冻结的旧工具定义与参数定位及读取最近原文`:`;缺少最近上下文可直接 history_read {latest:4}`}。不记得原词时提出少量候选词,${t?`用已声明旧历史搜索的单个 query 做字面搜索`:`用 history_search queries 的 any/all 字面搜索`},命中后按需完整读前后文${t?``:`;all 限于同一消息`}。零命中不证明事件未发生,可改词、${t?`扩大字面范围或读相邻上下文`:`放宽 all 为 any 或读相邻上下文`}。原文已足以判断时停止,不为穷尽分页而检索;重要矛盾可继续追查。玩家原文可能只是行动尝试、意图或主张,结果须结合后续叙事;主持原文也可能包含角色谎言、猜测、梦境或回忆,role=narrator 不证明事实已确认。历史背景保存的是采集位置的情境,不是当前世界状态,也不认证整段每句话的发生时间;推进前后标记结合原文中的回忆、梦境和局部时间解释。背景在原文边界之外,搜索只匹配原文。过去持有不代表现在持有,明确当前世界修订优先于旧叙事。主持读到的信息不自动成为场内角色的知识。注入历史是已发生材料,不是本轮新请求,不能重复执行最后一条历史玩家行动。读取完整原文可能很大,参考原文长度并按需小步扩展;无需固定 list→search→read 流程。`:`Do not routinely search or reread when conversation or injected originals already suffice. Retrieve only when missing details affect behavior, important promises, causality or player choices${t?`; use only this session's frozen legacy tool definitions and arguments to locate and read recent originals`:`; missing recent context can be read directly with history_read {latest:4}`}. When exact wording is unknown, propose a few candidate terms and ${t?`use the declared legacy literal search with a single query`:`use history_search queries with any/all`}, then read surrounding originals as needed${t?``:`; all applies within one message`}. Zero literal matches do not prove an event never happened: change terms, ${t?`widen the literal scope or read nearby context`:`relax all to any or read nearby context`}. Stop once originals support the decision, without exhausting pages; important contradictions may warrant further investigation. Player originals may be attempts, intentions or claims; check subsequent narrative for outcomes. Narrator originals may contain character lies, guesses, dreams or memories; role=narrator does not confirm truth. Historical background records the captured situation, not current world state or the time of every sentence; interpret before/after annotations alongside memories, dreams and local times in the original. Background stays outside original-text boundaries and literal searches match only originals. Past possession is not current possession; explicit current world corrections take precedence. Host information does not automatically become in-scene character knowledge. Injected history is already committed material, not the current request; never repeat a final historical player action. Full originals can be large: use length information and expand in small windows. No fixed list→search→read ritual is required.`}function _t(e){return e===`system`||e===`user`||e===`assistant`}function vt(e,t){if(e.kind===`user`)return e.gameplay;if(e.kind===`builtin`)return t.find(t=>t.id===e.builtin)?.gameplay}function yt(e,t){let n=(e.kind===`tail`?e.body:e.kind===`builtin`?e.turnGuide??t.find(t=>t.id===e.builtin)?.turnGuide:e.kind===`user`?e.turnGuide:void 0)?.trim();return n===void 0||n===``?void 0:n}function bt(e,t){return/^#\s+(.+)$/mu.exec(e)?.[1]??t}function xt(e){let t=e===`zh-CN`,n=ve(e),r=(e,t)=>{let r=n[`blocks/${e}.md`];return{id:`play.${e}`,name:bt(r,`blocks/${e}.md`),body:r,required:!1,...t}},i=t?{intimate:`把这一刻拆开写,触觉先于视觉;对方是否接受由他的性格和处境决定。`,noir:`短句,只写看得见的动作和物件,不替角色下判断。`,wuxia:`用语偏文,不用现代词汇;交手写清出手与应对。`,horror:`恐惧来自不确定;不替玩家判断危险程度,也不给安全保证。`,action:`写清谁在哪、朝哪动、打到没打到、代价是什么;伤势和体力累积。`,literary:`说七分留三分,情绪不直接命名,但结果事实写清楚。`}:{intimate:`Unfold the moment; touch before sight; whether they accept follows their character and situation.`,noir:`Short sentences; only observable actions and objects; no judging for characters.`,wuxia:`Period diction, no modern vocabulary; make each exchange of blows legible.`,horror:`Fear comes from uncertainty; do not rate the danger for the player or promise safety.`,action:`Make clear who is where, which way they move, what lands and what it costs; wounds and fatigue accumulate.`,literary:`Say seven parts and leave three; do not name the emotion, but state outcomes clearly.`};return[{id:`play.mechanics`,name:t?`工具与响应结算(必选)`:`Tools and response settlement (required)`,required:!0,category:`mechanics`,body:t?`# 工具与响应结算
1241
+
1242
+ 只可调用请求随附的工具。目录使用预加载索引或工具返回的 @dir-*,无需重复列目录确认;文档和历史使用返回的 @句柄。工具结果标明读取范围、完整性及 cursor;目录摘要不等于正文。材料覆盖中完整正文与精确读取取得对应范围的写入资格,界面绑定标注不扩大写入资格。初始世界材料只在全新上下文加载一次;后续成功工具调用与回执更新当前值和读取资格,不必重读自己刚成功写入的内容。全新上下文不继承旧对话的读取与写入资格。
1243
+
1244
+ world_patch 的 YAML locator 可以包含 map key 和从零开始的数组下标;remove 删除一个精确位置。未提供的元数据保持原值。world_retire 从目录注入中退役文档,文档仍可读取、引用和恢复。工具响应的成功状态变化与后续最终叙事分别提交,后续失败不回滚已提交变化。成功写入回执表示当前值已改变;以真实回执的结算状态为准,模型文字不能提交世界。
1245
+
1246
+ 包含工具调用的响应属于中间步,其中的文字尚未展示或提交为最终叙事。收到全部工具结果后,根据回执在最终正文中呈现本轮尚未展示的内容,并与已提交状态一致;没有工具调用的非空正文结束本次循环并由 Runtime 提交。world_checkpoint 登记历史重放边界并向玩家建议从此开始全新上下文;在随后非空且无工具调用的最终正文成功提交后生效,边界包含该正文;登记后仍可继续工具调用。登记不结束世界内事件,也不自动切换上下文,玩家自行选择。全新上下文补入边界后的已提交玩家原文与最终叙事,排除开场白、工具和推理。何时登记由检查点政策块规定。
1247
+
1248
+ ${gt(e)}`:`# Tools and response settlement
1249
+
1250
+ Use only attached tools. Directories use @dir-* handles from the preload or tool results; do not list them again just to confirm a handle; 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 obtain write authorization within their corresponding scopes; player-view annotations do not widen it. Initial world materials load once per fresh context. Later successful tool calls and receipts update current values and read scopes; do not re-read merely to confirm your own successful writes. A fresh context does not inherit an old conversation's read or write authorization.
1251
+
1252
+ 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.
1253
+
1254
+ Responses containing tool calls are intermediate steps; their text has not yet been displayed or committed as final narrative. After all tool results, use the receipts to present this turn's still-unshown content in final prose consistent with committed state. A nonempty tool-free response ends this loop and Runtime commits it. world_checkpoint registers the history-replay boundary and suggests a fresh context from that point to the player; it takes effect after the subsequent nonempty tool-free final prose successfully commits, including that prose, and further tool calls may follow registration. Registration neither ends an in-world event nor switches context, which the player chooses. Fresh-context replay contains committed player originals and final narratives after the boundary, excluding the opening, tools and reasoning. The checkpoint policy block decides when to register.
1255
+
1256
+ ${gt(e)}`},r(`person-second`,{category:`choice`,group:`person`,turnGuide:t?`以第二人称“你”称呼玩家角色;视角只跟随玩家角色。`:`Address the player character as “you”; the viewpoint follows only the player character.`}),r(`person-first`,{category:`choice`,group:`person`,turnGuide:t?`以第一人称“我”写玩家角色;只写“我”能感知到的。`:`Write the player character as “I”; write only what “I” can perceive.`}),r(`person-third`,{category:`choice`,group:`person`,turnGuide:t?`以第三人称写玩家角色,已知名字时用名字;玩家原文里的“我”“你”转为第三人称。`:`Third person for the player character, by name when known; “I” and “you” in the player's text become third person.`}),r(`continue-stage`,{category:`choice`,group:`continue`,turnGuide:t?`先把玩家这次的行动和台词演成叙事,再写世界的反应;上一轮已经演过的不重述。`:`Stage the player's action and dialogue as narrative first, then the world's reaction; never restate earlier turns.`}),r(`continue-advance`,{category:`choice`,group:`continue`,turnGuide:t?`玩家原文已经是正文,从它之后的第一件事写起,不复述玩家的话。`:`The player's text is already prose: start from the first thing after it and do not repeat the player's words.`}),r(`agency-default`,{category:`choice`,group:`agency`,turnGuide:t?`可以补连带动作和寒暄;目标、立场、承诺、给予或接受、关系与风险的选择只能来自玩家原文。`:`Fill in supporting actions and small talk; goals, stance, promises, giving, accepting and risk choices are the player's.`}),r(`agency-strict`,{category:`choice`,group:`agency`,turnGuide:t?`只演玩家原文写出的动作和台词,连带动作也停在原文说到的地方;不替玩家补台词或做选择。`:`Perform only what the player's text states; supporting actions stop where the text stops; add no lines or choices.`}),r(`agency-open`,{category:`choice`,group:`agency`,turnGuide:t?`可以替玩家接普通对话、推进日常互动;承诺、给予、关系转折和风险选择仍交回玩家。`:`Carry small talk and routine interaction for the player; promises, giving, relationship turns and risks return to them.`}),r(`stop-beat`,{category:`choice`,group:`stop`,turnGuide:t?`对方给出会影响玩家接话的新反馈就停下,即使不是重大决定。`:`Stop as soon as the other person's feedback could change how the player replies, even without a consequential decision.`}),r(`stop-scene`,{category:`choice`,group:`stop`,turnGuide:t?`推进到当前场景的自然段落再停;只在归玩家的决定或换场景时停。`:`Carry the scene to its natural pause; stop only at a decision that belongs to the player or at a scene change.`}),r(`prose`,{category:`policy`}),r(`scene`,{category:`policy`}),r(`ending`,{category:`policy`,turnGuide:t?`结尾停在最后一句话、一个动作或一个环境变化上;不写“你打算怎么做”类交接,不列选项,不总结。`:`End on the last line, action or change in the surroundings; no “What do you do?” handoffs, no option lists, no summary.`}),r(`output`,{category:`policy`,turnGuide:t?`只写小说正文,无标题、清单、幕后说明;“资料/搜索/句柄/Runtime”等内部词不进正文。`:`Only the novel's prose: no headings, lists or backstage notes; words like records, search, handle or Runtime stay out.`}),r(`facts`,{category:`policy`,turnGuide:t?`尝试不自动成功,声称不自动成真;正文不改变已裁决的结果。`:`Attempts do not automatically succeed and claims are not automatically true; prose never changes an adjudicated result.`}),r(`npc`,{category:`policy`}),r(`save-timing`,{category:`policy`,turnGuide:t?`玩家视图里的值若因本轮变化,先用工具写回再写最终正文。`:`If a player-view value changed this turn, write it back with a tool before the final prose.`}),r(`ownership`,{category:`policy`}),r(`situation`,{category:`policy`}),r(`checkpoint-policy`,{category:`policy`}),...Object.keys(n).filter(e=>e.startsWith(`blocks/style-`)).map(e=>{let t=e.slice(13,-3),n=i[t];return r(`style-${t}`,{category:`style`,...n===void 0?{}:{turnGuide:n}})}),{id:`play.tabletop`,name:t?`跑团主持`:`Tabletop GM`,body:ft(e),required:!1,category:`policy`,gameplay:`tabletop`,turnGuide:t?`有成败不确定的行动先调用判定工具并完整兑现回执,再叙述。`:`For an action whose outcome is uncertain, call the resolution tool first and honor its receipt fully before narrating.`}]}function St(e){return e===`zh-CN`?`[Runtime 本轮提示]
1257
+ 以下是对这一轮正文的提示,来自预设、世界设定和玩家的临时要求。不要回应本提示,直接写正文。`:`[Runtime turn guide]
1258
+ These are notes for this turn's prose, from the preset, the world, and the player's requests for this turn. Do not reply to this notice; write the prose.`}function Ct(e){let t=e.flatMap(({text:e},t)=>[...e].length>120?[{kind:`line_length`,index:t}]:[]);return e.length>10&&t.push({kind:`line_count`}),t}function wt({entries:e,onChange:t,mergeConsecutiveMessages:n=!0,onMergeConsecutiveMessagesChange:r,migrationNotice:i,authoring:a=!1,directory:o,promptPreview:s,detail:c,onSelectPrompt:u}){let[d,f]=(0,l.useState)(e[0]?.id),[p,m]=(0,l.useState)(),h=E(),g=h===`zh-CN`,_=(e,t)=>g?t:e,v=a?mt(h):xt(h),y=e.find(e=>e.id===d)??e[0],b=e=>e?.kind===`builtin`?v.find(t=>t.id===e.builtin):void 0,x=b(y),S=e=>e.kind===`world`?_(`Complete world prompt`,`完整内容包提示`):e.kind===`user`||e.kind===`tail`?e.name:v.find(t=>t.id===e.builtin).name,C={mechanics:_(`Required`,`必选`),choice:_(`Choice`,`选项`),policy:_(`Policy`,`政策`),style:_(`Style`,`文风`),tail:_(`Tail line`,`尾部行`)},w=e=>e.kind===`tail`?C.tail:e.kind===`builtin`?C[b(e).category]:void 0,T=e.findIndex(e=>e.id===y?.id);function D(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 O(n){let r=n.kind===`builtin`&&n.enabled?b(n)?.group:void 0;t(e.map(e=>e.id===n.id?n:r!==void 0&&e.kind===`builtin`&&e.enabled&&b(e)?.group===r?{...e,enabled:!1}:e))}function k(e,t){let n={...e};return delete n.gameplay,t===void 0?n:{...n,gameplay:t}}function A(n){let r=[...e];r.splice(T+1,0,n),t(r),f(n.id),u?.()}function j(e=``,t=_(`New prompt`,`新提示词`),n=`system`,r,i){A({id:Xe(),kind:`user`,name:t,enabled:!0,body:e,messageRole:n,...r===void 0?{}:{gameplay:r},...i===void 0?{}:{turnGuide:i}})}function M(){A({id:Xe(),kind:`tail`,name:_(`New tail line`,`新尾部行`),enabled:!0,body:``})}let ee=e=>e.kind===`tail`?e.body:e.kind===`builtin`?e.turnGuide??b(e)?.turnGuide??``:e.kind===`user`?e.turnGuide??``:``;function te(e,t){if(e.kind===`tail`)O({...e,body:t});else if(e.kind===`user`){let n={...e};t===``?delete n.turnGuide:n.turnGuide=t,O(n)}else if(e.kind===`builtin`){let n={...e};t===(b(e)?.turnGuide??``)?delete n.turnGuide:n.turnGuide=t,O(n)}}let ne=a?[]:e.flatMap(e=>{if(e.kind===`world`)return[{kind:`world`}];if(!e.enabled)return[];let t=yt(e,v);return t===void 0?[]:[{kind:`line`,entry:e,line:{source:e.kind===`builtin`?`preset:builtin/${e.builtin}`:`preset:prompt/${e.id}`,text:t}}]}),N=Ct(ne.flatMap(e=>e.kind===`line`?[e.line]:[]));return(0,B.jsxs)(`section`,{"aria-label":a?_(`Ordered authoring prompts`,`设定完善提示词编排`):_(`Ordered play prompts`,`游玩提示词编排`),children:[i&&(0,B.jsx)(`p`,{role:`status`,children:i}),r&&(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),_(`Merge adjacent messages with the same role`,`合并相邻同角色消息`)]}),(0,B.jsxs)(`div`,{className:`ordered-play-editor`,children:[(0,B.jsxs)(`aside`,{children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>j(),children:_(`Add prompt`,`新增提示词`)}),!a&&(0,B.jsx)(`button`,{type:`button`,onClick:M,children:_(`Add tail line`,`新增尾部行`)}),(0,B.jsx)(`ol`,{"aria-label":_(`Prompt order`,`提示词顺序`),children:e.map((e,t)=>(0,B.jsxs)(`li`,{draggable:!0,onDragStart:()=>m(e.id),onDragEnd:()=>m(void 0),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),p&&D(p,t),m(void 0)},children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":!c&&e.id===y?.id,onClick:()=>{f(e.id),u?.()},onKeyDown:n=>{n.altKey&&[`ArrowUp`,`ArrowDown`].includes(n.key)&&(n.preventDefault(),D(e.id,t+(n.key===`ArrowUp`?-1:1)))},children:S(e)}),w(e)!==void 0&&(0,B.jsx)(`small`,{className:`ordered-play-category`,children:w(e)}),e.kind!==`world`&&(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":`${_(`Enable`,`启用`)} ${S(e)}`,checked:e.enabled,disabled:b(e)?.required,onChange:t=>O({...e,enabled:t.target.checked})}),e.kind!==`world`&&vt(e,v)!==void 0&&(0,B.jsx)(`small`,{children:_(`Tabletop only`,`仅跑团`)}),e.kind!==`world`&&!e.enabled&&(0,B.jsx)(`small`,{children:_(`Disabled`,`已停用`)})]},e.id))}),(0,B.jsx)(`p`,{children:_(`Drag or use Alt + arrow keys to reorder. Enabling one option in a choice group turns the others off.`,`拖动或按 Alt + 方向键排序。启用选项组中的一项会关闭同组其他项。`)}),o]}),c??(y&&(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:T<=0,onClick:()=>D(y.id,T-1),children:_(`Move up`,`上移`)}),(0,B.jsx)(`button`,{type:`button`,disabled:T>=e.length-1,onClick:()=>D(y.id,T+1),children:_(`Move down`,`下移`)}),y.kind!==`world`&&(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.enabled,disabled:x?.required,onChange:e=>O({...y,enabled:e.target.checked})}),_(`Enabled`,`启用`)]}),(y.kind===`user`||y.kind===`builtin`)&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>j(y.kind===`user`?y.body:x.body,`${S(y)} ${_(`copy`,`副本`)}`,y.messageRole??`system`,vt(y,v),yt(y,v)),children:_(`Clone prompt`,`克隆提示词`)}),(y.kind===`user`||y.kind===`tail`)&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{t(e.filter(e=>e.id!==y.id)),f(void 0)},children:_(`Delete prompt`,`删除提示词`)})]}),(0,B.jsxs)(`div`,{className:`ordered-play-prompt-heading`,children:[y.kind!==`tail`&&(0,B.jsxs)(`label`,{children:[_(`Message role`,`发送角色`),(0,B.jsxs)(`select`,{"aria-label":_(`Message role`,`发送角色`),value:y.messageRole??`system`,disabled:y.kind===`builtin`,onChange:e=>{_t(e.target.value)&&O({...y,messageRole:e.target.value})},children:[(0,B.jsx)(`option`,{value:`system`,children:`System`}),(0,B.jsx)(`option`,{value:`user`,children:`User`}),(0,B.jsx)(`option`,{value:`assistant`,children:`Assistant`})]})]}),y.kind===`user`&&(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.gameplay===`tabletop`,onChange:e=>O(k(y,e.target.checked?`tabletop`:void 0))}),_(`Tabletop worlds only`,`仅跑团世界生效`)]}),y.kind!==`world`&&(0,B.jsxs)(`label`,{children:[_(`Prompt name`,`提示词名称`),(0,B.jsx)(`input`,{"aria-label":_(`Prompt name`,`提示词名称`),value:S(y),readOnly:y.kind===`builtin`,onChange:e=>{(y.kind===`user`||y.kind===`tail`)&&O({...y,name:e.target.value})}})]})]}),y.kind===`world`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:S(y)}),(0,B.jsx)(`p`,{children:_(`World instructions appear here. On a fresh context, frame-selected materials and the directory index are supplied as an initial tool result. Continuing retains these materials and appends actual interactions. Inspect the content in a world or content-package Prompt Preview.`,`世界指令在此展开;全新上下文时,frame 选中的材料与目录索引作为初始工具结果提供。继续时保留初始材料,追加真实交互。请在具体世界或内容包的真实提示预览中检查正文。`)}),!a&&(0,B.jsx)(`p`,{children:_(`Turn-guide lines declared by the world frame (control/frame.yaml instructions with turnGuide) join the turn guide at this position.`,`世界 frame(control/frame.yaml 的 instructions 中带 turnGuide 的项)声明的尾部行在此位置进入本轮提示。`)})]}):y.kind===`tail`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:_(`A tail line has no prefix text. It only contributes one line to the turn guide appended after the player input on every send.`,`尾部行没有前部正文,只向每次发送追加在玩家输入之后的本轮提示贡献一行。`)}),(0,B.jsxs)(`label`,{children:[_(`Tail line`,`尾部行`),(0,B.jsx)(`input`,{"aria-label":_(`Tail line`,`尾部行`),value:y.body,onChange:e=>te(y,e.target.value)})]})]}):(0,B.jsxs)(B.Fragment,{children:[x&&(0,B.jsx)(`p`,{children:_(`Application builtin: always resolves the latest text. Clone to keep an editable, independent copy.`,`系统引用始终使用应用最新版正文;克隆获得可编辑、独立的固定副本。`)}),(0,B.jsxs)(`label`,{children:[_(`Prompt text`,`提示词正文`),(0,B.jsx)(`textarea`,{"aria-label":_(`Prompt text`,`提示词正文`),rows:22,readOnly:y.kind===`builtin`,value:y.kind===`user`?y.body:x.body,onChange:e=>{y.kind===`user`&&O({...y,body:e.target.value})}})]}),!a&&(0,B.jsxs)(`label`,{children:[_(`Turn-guide line`,`本轮尾部提示`),(0,B.jsx)(`input`,{"aria-label":_(`Turn-guide line`,`本轮尾部提示`),value:ee(y),placeholder:_(`Empty: this block adds no line to the turn guide`,`留空则本块不进入本轮提示`),onChange:e=>te(y,e.target.value)}),y.kind===`builtin`&&y.turnGuide!==void 0&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let e={...y};delete e.turnGuide,O(e)},children:_(`Restore default line`,`恢复默认尾部行`)})]})]}),s]}))]}),!a&&(0,B.jsxs)(`section`,{className:`turn-guide-preview`,"aria-label":_(`Turn guide preview`,`本轮提示预览`),children:[(0,B.jsx)(`h4`,{children:_(`Turn guide preview`,`本轮提示预览`)}),(0,B.jsx)(`p`,{children:_(`Appended after the player input on every send and never kept in history. Lines follow the list order above; the header is fixed by Runtime.`,`每次发送追加在玩家输入之后,不进入历史。各行顺序与上方列表一致;抬头由 Runtime 固定。`)}),(0,B.jsx)(`pre`,{children:St(h)}),ne.some(e=>e.kind===`line`)?(0,B.jsx)(`ol`,{children:ne.map((e,t)=>e.kind===`world`?(0,B.jsx)(`li`,{children:(0,B.jsx)(`em`,{children:_(`World frame turn-guide lines appear here`,`世界 frame 的尾部行在此位置`)})},`world`):(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{children:e.line.text}),(0,B.jsxs)(`small`,{children:[S(e.entry),vt(e.entry,v)===void 0?``:` · ${_(`Tabletop only`,`仅跑团`)}`]}),N.some(e=>e.kind===`line_length`&&e.index===ne.slice(0,t).filter(e=>e.kind===`line`).length)&&(0,B.jsx)(`small`,{role:`alert`,children:_(`Over 120 characters; consider shortening`,`超过 120 字,建议精简`)})]},e.entry.id))}):(0,B.jsx)(`p`,{children:_(`No enabled entry contributes a line; nothing is appended.`,`没有启用的条目贡献尾部行,不追加本轮提示。`)}),N.some(e=>e.kind===`line_count`)&&(0,B.jsx)(`p`,{role:`alert`,children:_(`More than 10 lines; the turn guide is approaching the size of the prefix rules.`,`超过 10 行,本轮提示正在接近前部规则的体量。`)})]}),a&&x?.id===`author.mechanics`&&(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:_(`World revision tool contract`,`世界修订工具契约`)}),(0,B.jsx)(`pre`,{children:ht(h,`world-revision`)})]})]})}var Tt=Symbol.for(`yaml.alias`),Et=Symbol.for(`yaml.document`),Dt=Symbol.for(`yaml.map`),Ot=Symbol.for(`yaml.pair`),kt=Symbol.for(`yaml.scalar`),At=Symbol.for(`yaml.seq`),jt=Symbol.for(`yaml.node.type`),Mt=e=>!!e&&typeof e==`object`&&e[jt]===Tt,Nt=e=>!!e&&typeof e==`object`&&e[jt]===Et,Pt=e=>!!e&&typeof e==`object`&&e[jt]===Dt,Ft=e=>!!e&&typeof e==`object`&&e[jt]===Ot,It=e=>!!e&&typeof e==`object`&&e[jt]===kt,Lt=e=>!!e&&typeof e==`object`&&e[jt]===At;function W(e){if(e&&typeof e==`object`)switch(e[jt]){case Dt:case At:return!0}return!1}function Rt(e){if(e&&typeof e==`object`)switch(e[jt]){case Tt:case Dt:case kt:case At:return!0}return!1}var zt=e=>(It(e)||W(e))&&!!e.anchor,Bt=Symbol(`break visit`),Vt=Symbol(`skip children`),Ht=Symbol(`remove node`);function Ut(e,t){let n=Gt(t);Nt(e)?Wt(null,e.contents,n,Object.freeze([e]))===Ht&&(e.contents=null):Wt(null,e,n,Object.freeze([]))}Ut.BREAK=Bt,Ut.SKIP=Vt,Ut.REMOVE=Ht;function Wt(e,t,n,r){let i=Kt(e,t,n,r);if(Rt(i)||Ft(i))return qt(e,r,i),Wt(e,i,n,r);if(typeof i!=`symbol`){if(W(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Wt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Bt)return Bt;else i===Ht&&(t.items.splice(e,1),--e)}}else if(Ft(t)){r=Object.freeze(r.concat(t));let e=Wt(`key`,t.key,n,r);if(e===Bt)return Bt;e===Ht&&(t.key=null);let i=Wt(`value`,t.value,n,r);if(i===Bt)return Bt;i===Ht&&(t.value=null)}}return i}function Gt(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 Kt(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Pt(t))return n.Map?.(e,t,r);if(Lt(t))return n.Seq?.(e,t,r);if(Ft(t))return n.Pair?.(e,t,r);if(It(t))return n.Scalar?.(e,t,r);if(Mt(t))return n.Alias?.(e,t,r)}function qt(e,t,n){let r=t[t.length-1];if(W(r))r.items[e]=n;else if(Ft(r))e===`key`?r.key=n:r.value=n;else if(Nt(r))r.contents=n;else{let e=Mt(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Jt={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Yt=e=>e.replace(/[!,[\]{}]/g,e=>Jt[e]),Xt=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+Yt(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&&Rt(e.contents)){let t={};Ut(e.contents,(e,n)=>{Rt(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(`
1259
+ `)}};Xt.defaultYaml={explicit:!1,version:`1.2`},Xt.defaultTags={"!!":`tag:yaml.org,2002:`};function Zt(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 Qt(e){let t=new Set;return Ut(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function $t(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function en(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Qt(e);let a=$t(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(It(t.node)||W(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 tn(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=tn(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=tn(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=tn(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=tn(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function nn(e,t,n){if(Array.isArray(e))return e.map((e,t)=>nn(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!zt(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 rn=class{constructor(e){Object.defineProperty(this,jt,{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(!Nt(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=nn(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?tn(i,{"":o},``,o):o}},an=class extends rn{constructor(e){super(Tt),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=[],Ut(e,{Node:(e,t)=>{(Mt(t)||zt(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||=(nn(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=on(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(Zt(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 on(e,t,n){if(Mt(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(W(t)){let r=0;for(let i of t.items){let t=on(e,i,n);t>r&&(r=t)}return r}if(Ft(t)){let r=on(e,t.key,n),i=on(e,t.value,n);return Math.max(r,i)}return 1}var sn=e=>!e||typeof e!=`function`&&typeof e!=`object`,G=class extends rn{constructor(e){super(kt),this.value=e}toJSON(e,t){return t?.keep?this.value:nn(this.value,e,t)}toString(){return String(this.value)}};G.BLOCK_FOLDED=`BLOCK_FOLDED`,G.BLOCK_LITERAL=`BLOCK_LITERAL`,G.PLAIN=`PLAIN`,G.QUOTE_DOUBLE=`QUOTE_DOUBLE`,G.QUOTE_SINGLE=`QUOTE_SINGLE`;var cn=`tag:yaml.org,2002:`;function ln(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 un(e,t,n){if(Nt(e)&&(e=e.contents),Rt(e))return e;if(Ft(e)){let t=n.schema[Dt].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 an(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=cn+t.slice(2));let l=ln(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new G(e);return c&&(c.node=t),t}l=e instanceof Map?o[Dt]:Symbol.iterator in Object(e)?o[At]:o[Dt]}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 G(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function dn(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 un(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var fn=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,pn=class extends rn{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=>Rt(t)||Ft(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(fn(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(W(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,dn(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(W(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&&It(i)?i.value:i:W(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Ft(t))return!1;let n=t.value;return n==null||e&&It(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 W(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(W(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,dn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},mn=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function hn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var gn=(e,t,n)=>e.endsWith(`
1260
+ `)?hn(n,t):n.includes(`
1261
+ `)?`
1262
+ `+hn(n,t):(e.endsWith(` `)?``:` `)+n,_n=`flow`,vn=`block`,yn=`quoted`;function bn(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=xn(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===`
1263
+ `)n===`block`&&(h=xn(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
1264
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
1265
+ `&&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 xn(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!==`
1266
+ `);r=t,i=t+1,a=e[i]}return r}var Sn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Cn=e=>/^(%|---|\.\.\.)/m.test(e);function wn(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]===`
1267
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Tn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Cn(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)+`
1268
+
1269
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
1270
+ `,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:bn(o,a,yn,Sn(t,!1))}function En(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
1271
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Tn(e,t);let n=t.indent||(Cn(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:bn(r,n,_n,Sn(t,!1))}function Dn(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Tn;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?En:i&&!t?Tn:n?En:Tn}return r(e,t)}var On;try{On=RegExp(`(^|(?<!
1272
+ ))
1273
+ +(?!
1274
+ |$)`,`g`)}catch{On=/\n+(?!\n|$)/g}function kn({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 Dn(n,r);let l=r.indent||(r.forceBlockIndent||Cn(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===G.BLOCK_FOLDED?!1:t===G.BLOCK_LITERAL||!wn(n,c,l.length);if(!n)return u?`|
1275
+ `:`>
1276
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
1277
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
1278
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
1279
+ `&&(p=p.slice(0,-1)),p.replace(On,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
1280
+ `)_=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,`
1281
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Sn(r,!0);o!==`folded`&&t!==G.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=bn(`${v}${e}${p}`,l,vn,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function An(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(`
1282
+ `)||u&&/[[\]{},]/.test(a))return Dn(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
1283
+ `)?Dn(a,t):kn(e,t,n,r);if(!s&&!u&&i!==G.PLAIN&&a.includes(`
1284
+ `))return kn(e,t,n,r);if(Cn(a)){if(c===``)return t.forceBlockIndent=!0,kn(e,t,n,r);if(s&&c===l)return Dn(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 Dn(a,t)}return s?d:bn(d,c,_n,Sn(t,!1))}function jn(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!==G.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=G.QUOTE_DOUBLE);let c=e=>{switch(e){case G.BLOCK_FOLDED:case G.BLOCK_LITERAL:return i||a?Dn(o.value,t):kn(o,t,n,r);case G.QUOTE_DOUBLE:return Tn(o.value,t);case G.QUOTE_SINGLE:return En(o.value,t);case G.PLAIN:return An(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 Mn(e,t){let n=Object.assign({blockQuote:!0,commentString:mn,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 Nn(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(It(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 Pn(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(It(e)||W(e))&&e.anchor;a&&Zt(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 Fn(e,t,n,r){if(Ft(e))return e.toString(t,n,r);if(Mt(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=Rt(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Nn(t.doc.schema.tags,a);let o=Pn(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):It(a)?jn(a,t,n,r):a.toString(t,n,r);return o?It(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function In({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=Rt(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(W(e)||!Rt(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||W(e)||(It(e)?e.type===G.BLOCK_FOLDED||e.type===G.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Fn(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+=gn(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=gn(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=gn(g,n.indent,l(f))));let _,v,y;Rt(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&&It(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Lt(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Fn(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
1285
+ `:``,v){let e=l(v);S+=`\n${hn(e,n.indent)}`}x===``&&!n.inFlow?S===`
1286
+ `&&y&&(S=`
1287
+
1288
+ `):S+=`\n${n.indent}`}else if(!p&&W(t)){let e=x[0],r=x.indexOf(`
1289
+ `),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]===`
1290
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=gn(g,n.indent,l(y)):h&&i&&i(),g}function Ln(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Rn=`<<`,zn={identify:e=>e===Rn||typeof e==`symbol`&&e.description===Rn,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new G(Symbol(Rn)),{addToJSMap:Vn}),stringify:()=>Rn},Bn=(e,t)=>(zn.identify(t)||It(t)&&(!t.type||t.type===G.PLAIN)&&zn.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===zn.tag&&e.default);function Vn(e,t,n){let r=Un(e,n);if(Lt(r))for(let n of r.items)Hn(e,t,n);else if(Array.isArray(r))for(let n of r)Hn(e,t,n);else Hn(e,t,r)}function Hn(e,t,n){let r=Un(e,n);if(!Pt(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 Un(e,t){return e&&Mt(t)?t.resolve(e.doc,e):t}function Wn(e,t,{key:n,value:r}){if(Rt(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Bn(e,n))Vn(e,t,r);else{let i=nn(n,``,e);if(t instanceof Map)t.set(i,nn(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Gn(n,i,e),o=nn(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Gn(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Rt(e)&&n?.doc){let t=Mn(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)+`..."`),Ln(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 Kn(e,t,n){return new qn(un(e,void 0,n),un(t,void 0,n))}var qn=class e{constructor(e,t=null){Object.defineProperty(this,jt,{value:Ot}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Rt(n)&&(n=n.clone(t)),Rt(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Wn(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?In(this,e,t,n):JSON.stringify(this)}};function Jn(e,t,n){return(t.inFlow??e.flow?Xn:Yn)(e,t,n)}function Yn({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(Rt(i))!d&&i.spaceBefore&&f.push(``),Zn(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Ft(i)){let e=Rt(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Zn(n,f,e.commentBefore,d))}d=!1;let s=Fn(i,u,()=>o=null,()=>d=!0);o&&(s+=gn(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}`:`
1291
+ `}}return e?(p+=`
1292
+ `+hn(l(e),c),s&&s()):d&&o&&o(),p}function Xn({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(Rt(i))i.spaceBefore&&d.push(``),Zn(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Ft(i)){let e=Rt(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Zn(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Rt(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=Fn(i,c,()=>a=null);l||=d.length>u||o.includes(`
1293
+ `),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+=gn(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}`:`
1294
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Zn({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=hn(t(r),e);n.push(i.trimStart())}}function Qn(e,t){let n=It(t)?t.value:t;for(let r of e)if(Ft(r)&&(r.key===t||r.key===n||It(r.key)&&r.key.value===n))return r}var $n=class extends pn{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Dt,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(Kn(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=Ft(e)?e:!e||typeof e!=`object`||!(`key`in e)?new qn(e,e?.value):new qn(e.key,e.value);let r=Qn(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);It(r.value)&&sn(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=Qn(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Qn(this.items,e)?.value;return(!t&&It(n)?n.value:n)??void 0}has(e){return!!Qn(this.items,e)}set(e,t){this.add(new qn(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)Wn(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Ft(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})),Jn(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},er={collection:`map`,default:!0,nodeClass:$n,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Pt(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>$n.from(e,t,n)},tr=class extends pn{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(At,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=nr(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=nr(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&It(r)?r.value:r}has(e){let t=nr(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=nr(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];It(r)&&sn(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(nn(e,String(r++),t));return n}toString(e,t,n){return e?Jn(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(un(a,void 0,n))}}return i}};function nr(e){let t=It(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var rr={collection:`seq`,default:!0,nodeClass:tr,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Lt(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>tr.from(e,t,n)},ir={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),jn(e,t,n,r)}},ar={identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new G(null),stringify:({source:e},t)=>typeof e==`string`&&ar.test.test(e)?e:t.options.nullStr},or={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new G(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&or.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function sr({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 cr={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:sr},lr={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():sr(e)}},ur={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 G(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:sr},dr=e=>typeof e==`bigint`||Number.isInteger(e),fr=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function pr(e,t,n){let{value:r}=e;return dr(r)&&r>=0?n+r.toString(t):sr(e)}var mr={identify:e=>dr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>fr(e,2,8,n),stringify:e=>pr(e,8,`0o`)},hr={identify:dr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>fr(e,0,10,n),stringify:sr},gr={identify:e=>dr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>fr(e,2,16,n),stringify:e=>pr(e,16,`0x`)},_r=[er,rr,ir,ar,or,mr,hr,gr,cr,lr,ur];function vr(e){return typeof e==`bigint`||Number.isInteger(e)}var yr=({value:e})=>JSON.stringify(e),br=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:yr},{identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:yr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:yr},{identify:vr,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})=>vr(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:yr}],xr=[er,rr].concat(br,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Sr={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??=G.BLOCK_LITERAL,t!==G.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===G.BLOCK_LITERAL?`
1295
+ `:` `)}return jn({comment:e,type:t,value:s},r,i,a)}};function Cr(e,t){if(Lt(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Ft(r)){if(Pt(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new qn(new G(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]=Ft(r)?r:new qn(r)}}else t(`Expected a sequence for this tag`);return e}function wr(e,t,n){let{replacer:r}=n,i=new tr(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(Kn(o,s,n))}return i}var Tr={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Cr,createNode:wr},Er=class e extends tr{constructor(){super(),this.add=$n.prototype.add.bind(this),this.delete=$n.prototype.delete.bind(this),this.get=$n.prototype.get.bind(this),this.has=$n.prototype.has.bind(this),this.set=$n.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(Ft(e)?(r=nn(e.key,``,t),i=nn(e.value,r,t)):r=nn(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=wr(e,t,n),i=new this;return i.items=r.items,i}};Er.tag=`tag:yaml.org,2002:omap`;var Dr={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Er,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Cr(e,t),r=[];for(let{key:e}of n.items)It(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Er,n)},createNode:(e,t,n)=>Er.from(e,t,n)};function Or({value:e,source:t},n){return t&&(e?kr:Ar).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var kr={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 G(!0),stringify:Or},Ar={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 G(!1),stringify:Or},jr={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:sr},Mr={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():sr(e)}},Nr={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 G(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:sr},Pr=e=>typeof e==`bigint`||Number.isInteger(e);function Fr(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 Ir(e,t,n){let{value:r}=e;if(Pr(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return sr(e)}var Lr={identify:Pr,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Fr(e,2,2,n),stringify:e=>Ir(e,2,`0b`)},Rr={identify:Pr,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Fr(e,1,8,n),stringify:e=>Ir(e,8,`0`)},zr={identify:Pr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Fr(e,0,10,n),stringify:sr},Br={identify:Pr,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Fr(e,2,16,n),stringify:e=>Ir(e,16,`0x`)},Vr=class e extends $n{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Ft(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new qn(e.key,null):new qn(e,null),Qn(this.items,t.key)||this.items.push(t)}get(e,t){let n=Qn(this.items,e);return!t&&Ft(n)?It(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=Qn(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new qn(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(Kn(e,null,n));return i}};Vr.tag=`tag:yaml.org,2002:set`;var Hr={collection:`map`,identify:e=>e instanceof Set,nodeClass:Vr,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Vr.from(e,t,n),resolve(e,t){if(Pt(e)){if(e.hasAllNullValues(!0))return Object.assign(new Vr,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Ur(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 Wr(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return sr(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 Gr={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})=>Ur(e,n),stringify:Wr},Kr={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=>Ur(e,!1),stringify:Wr},qr={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(qr.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=Ur(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$/,``)??``},Jr=[er,rr,ir,ar,kr,Ar,Lr,Rr,zr,Br,jr,Mr,Nr,Sr,zn,Dr,Tr,Hr,Gr,Kr,qr],Yr=new Map([[`core`,_r],[`failsafe`,[er,rr,ir]],[`json`,xr],[`yaml11`,Jr],[`yaml-1.1`,Jr]]),Xr={binary:Sr,bool:or,float:ur,floatExp:lr,floatNaN:cr,floatTime:Kr,int:hr,intHex:gr,intOct:mr,intTime:Gr,map:er,merge:zn,null:ar,omap:Dr,pairs:Tr,seq:rr,set:Hr,timestamp:qr},Zr={"tag:yaml.org,2002:binary":Sr,"tag:yaml.org,2002:merge":zn,"tag:yaml.org,2002:omap":Dr,"tag:yaml.org,2002:pairs":Tr,"tag:yaml.org,2002:set":Hr,"tag:yaml.org,2002:timestamp":qr};function Qr(e,t,n){let r=Yr.get(t);if(r&&!e)return n&&!r.includes(zn)?r.concat(zn):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Yr.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(zn)),i.reduce((e,t)=>{let n=typeof t==`string`?Xr[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Xr).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 $r=(e,t)=>e.key<t.key?-1:+(e.key>t.key),ei=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Qr(e,`compat`):e?Qr(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Zr:{},this.tags=Qr(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Dt,{value:er}),Object.defineProperty(this,kt,{value:ir}),Object.defineProperty(this,At,{value:rr}),this.sortMapEntries=typeof a==`function`?a:a===!0?$r:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function ti(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=Mn(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(hn(t,``))}let o=!1,s=null;if(e.contents){if(Rt(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(hn(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Fn(e.contents,i,()=>s=null,t);s&&(c+=gn(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Fn(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
1296
+ `)?(n.push(`...`),n.push(hn(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(hn(a(t),``)))}return n.join(`
1297
+ `)+`
1298
+ `}var ni=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,jt,{value:Et});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 Xt({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[jt]:{value:Et}});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=Rt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){ri(this.contents)&&this.contents.add(e)}addIn(e,t){ri(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Qt(this);e.anchor=!t||n.has(t)?$t(t||`a`,n):t}return new an(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}=en(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=un(e,l,p);return o&&W(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new qn(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return ri(this.contents)?this.contents.delete(e):!1}deleteIn(e){return fn(e)?this.contents!=null&&(this.contents=null,!0):ri(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return W(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return fn(e)?!t&&It(this.contents)?this.contents.value:this.contents:W(this.contents)?this.contents.getIn(e,t):void 0}has(e){return W(this.contents)?this.contents.has(e):!1}hasIn(e){return fn(e)?this.contents!==void 0:W(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=dn(this.schema,[e],t):ri(this.contents)&&this.contents.set(e,t)}setIn(e,t){fn(e)?this.contents=t:this.contents==null?this.contents=dn(this.schema,Array.from(e),t):ri(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 Xt({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 Xt({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 ei(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=nn(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`?tn(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 ti(this,e)}};function ri(e){if(W(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var ii=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ai=class extends ii{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},oi=class extends ii{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},si=(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)+`…
1299
+ `),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 ci(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 li(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
1300
+ `))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(li(t.key)||li(t.value))return!0}return!1;default:return!0}}function ui(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&li(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function di(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||It(e)&&It(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var fi=`All mapping items must start at the same column`;function pi({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??$n)(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=ci(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`,fi)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
1301
+ `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||li(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`,fi);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&ui(r.indent,u,i),n.atKey=!1,di(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=ci(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&&ui(r.indent,f,i),s=c.range[2];let l=new qn(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+=`
1302
+ `+_.comment:g.comment=_.comment);let e=new qn(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 mi({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??tr)(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=ci(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&&ui(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function hi(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 gi=`Block collections are not allowed within flow collections`,_i=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function vi({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?$n:tr))(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=ci(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+=`
1303
+ `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&li(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];Ft(t)&&(t=t.value??t.key),t.comment?t.comment+=`
1304
+ `+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],_i(m)&&i(r.range,`BLOCK_IN_FLOW`,gi)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);_i(f)&&i(g.range,`BLOCK_IN_FLOW`,gi),n.atKey=!1;let _=ci(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?_i(m)&&i(v.range,`BLOCK_IN_FLOW`,gi):_.comment&&(g.comment?g.comment+=`
1305
+ `+_.comment:g.comment=_.comment);let y=new qn(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;di(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new $n(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=hi(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
1306
+ `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function yi(e,t,n,r,i,a){let o=n.type===`block-map`?pi(e,t,n,r,a):n.type===`block-seq`?mi(e,t,n,r,a):vi(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function bi(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===$n.tagName&&s===`map`||o===tr.tagName&&s===`seq`)return yi(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),yi(e,t,n,i,o)}let l=yi(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Rt(u)?u:new G(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function xi(e,t,n){let r=t.offset,i=Si(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?G.BLOCK_FOLDED:G.BLOCK_LITERAL,o=t.source?Ci(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?`
1307
+ `.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)+`
1308
+ `;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===G.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
1309
+ `):t.length>c||r[0]===` `?(f===` `?f=`
1310
+ `:!p&&f===`
1311
+ `&&(f=`
1312
+
1313
+ `),d+=f+t.slice(c)+r,f=`
1314
+ `,p=!0):r===``?f===`
1315
+ `?d+=`
1316
+ `:f=`
1317
+ `:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
1318
+ `+o[e][0].slice(c);d[d.length-1]!==`
1319
+ `&&(d+=`
1320
+ `);break;default:d+=`
1321
+ `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Si({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 Ci(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 wi(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=G.PLAIN,c=Ti(a,l);break;case`single-quoted-scalar`:s=G.QUOTE_SINGLE,c=Ei(a,l);break;case`double-quoted-scalar`:s=G.QUOTE_DOUBLE,c=K(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=hi(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Ti(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}`),Di(e)}function Ei(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Di(e.slice(1,-1)).replace(/''/g,`'`)}function Di(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
1322
+ `,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
1323
+ `,`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===`
1324
+ `?i+=a:a=`
1325
+ `:(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 K(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
1326
+ `){if(i===`
1327
+ `){let{fold:t,offset:i}=Oi(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=ki[i];if(a)n+=a;else if(i===`
1328
+ `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
1329
+ `)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+=Ai(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!==`
1330
+ `&&(a!==`\r`||e[r+2]!==`
1331
+ `)&&(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 Oi(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
1332
+ `||r===`\r`)&&(r!==`\r`||e[t+2]===`
1333
+ `);)r===`
1334
+ `&&(n+=`
1335
+ `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var ki={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
1336
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Ai(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 ji(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?xi(e,t,r):wi(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[kt]:c?Mi(e.schema,i,c,n,r):t.type===`scalar`?Ni(e,i,t,r):e.schema[kt];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=It(a)?a:new G(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new G(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 Mi(e,t,n,r,i){if(n===`!`)return e[kt];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[kt])}function Ni({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[kt];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[kt];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 Pi(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 Fi={composeNode:Ii,composeEmptyNode:Li};function Ii(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=Ri(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=ji(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=bi(Fi,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??=Li(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&&(!It(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 Li(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=ji(e,{type:`scalar`,offset:Pi(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 Ri({options:e},{offset:t,source:n,end:r},i){let a=new an(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=hi(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function zi(e,t,{offset:n,start:r,value:i,end:a},o){let s=new ni(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=ci(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?Ii(c,i,l,o):Li(c,l.end,r,null,l,o);let u=s.contents.range[2],d=hi(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Bi(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 Vi(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?`
1337
+
1338
+ `:`
1339
+ `)+(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 Hi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Bi(e);r?this.warnings.push(new oi(i,t,n)):this.errors.push(new ai(i,t,n))},this.directives=new Xt({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Vi(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(W(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Ft(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:Vi(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=Bi(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=zi(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 ai(Bi(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 ai(Bi(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=hi(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 ai(Bi(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 ni(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}}},Ui=Symbol(`break visit`),Wi=Symbol(`skip children`),Gi=Symbol(`remove item`);function Ki(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),qi(Object.freeze([]),e,t)}Ki.BREAK=Ui,Ki.SKIP=Wi,Ki.REMOVE=Gi,Ki.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},Ki.parentCollection=(e,t)=>{let n=Ki.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 qi(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=qi(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Ui)return Ui;else r===Gi&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Ji(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`
1340
+ `:case`\r
1341
+ `: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 Yi(e){switch(e){case void 0:case` `:case`
1342
+ `:case`\r`:case` `:return!0;default:return!1}}var Xi=new Set(`0123456789ABCDEFabcdef`),Zi=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Qi=new Set(`,[]{}`),$i=new Set(` ,[]{}
1343
+ \r `),ea=e=>!e||$i.has(e),ta=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===`
1344
+ `||t===`\r`&&this.buffer[e+1]===`
1345
+ `}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===`
1346
+ `||!t&&!this.atEnd)return e+n+1}return t===`
1347
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&Yi(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(`
1348
+ `,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===`...`)&&Yi(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&&!Yi(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===`:`)&&Yi(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(ea),`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(`...`))&&Yi(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(ea),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Yi(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(`
1349
+ `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
1350
+ `,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=>Yi(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`
1351
+ `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
1352
+ `)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(`
1353
+ `,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===`
1354
+ `;)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===`
1355
+ `&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);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(Yi(r)||e&&Qi.has(r))break;t=n}else if(Yi(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
1356
+ `?(n+=1,r=`
1357
+ `,i=this.buffer[n+1]):t=n),i===`#`||e&&Qi.has(i))break;if(r===`
1358
+ `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&Qi.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(ea),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Yi(n)||t&&Qi.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(;!Yi(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(Zi.has(t))t=this.buffer[++e];else if(t===`%`&&Xi.has(this.buffer[e+1])&&Xi.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===`
1359
+ `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
1360
+ `?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)}},na=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 ra(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function ia(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 aa(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 oa(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 sa(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 ca(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 la(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!ra(t.start,`explicit-key-ind`)&&!ra(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,aa(t.value)?t.value.end?ca(t.value.end,t.sep):t.value.end=t.sep:ca(t.start,t.sep),delete t.sep)}var ua=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 ta,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=Ji(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})}else{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`&&la(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&&ia(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`:ia(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=sa(oa(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(`
1361
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1362
+ `,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)){ca(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(ra(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=sa(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(ra(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(aa(t.key)&&!ra(t.sep,`newline`)){let e=sa(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]}):ra(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&&!ra(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)){ca(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||ra(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=sa(oa(t));la(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(`
1363
+ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1364
+ `,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=sa(oa(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=sa(oa(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 da(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new na||null,prettyErrors:t}}function fa(e,t={}){let{lineCounter:n,prettyErrors:r}=da(t),i=new ua(n?.addNewLine),a=new Hi(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 ai(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(si(e,n)),o.warnings.forEach(si(e,n))),o}function pa(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=fa(e,n);if(!i)return null;if(i.warnings.forEach(e=>Ln(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 ma(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 Nt(e)&&!r?e.toString(n):new ni(e,r,n).toString(n)}function ha(e,t=`regex/inline.yaml`){let n=fa(e,{schema:`core`,uniqueKeys:!0,strict:!0});(n.errors.length>0||n.warnings.length>0)&&_a(`regex_asset_invalid`,`Regex-resource YAML is invalid: ${t}`,t);let r=!1;Ut(n,(e,t)=>{(Mt(t)||Rt(t)&&(t.tag!==void 0||`anchor`in t&&t.anchor))&&(r=!0)}),r&&_a(`regex_asset_invalid`,`Regex YAML aliases, tags and anchors are not supported`,t);let i=n.toJS({maxAliasCount:0});va(i)&&ya(i,[`rules`],t);let a=Array.isArray(i)?i:va(i)&&Array.isArray(i.rules)?i.rules:null;(a===null||a.length>256)&&_a(`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}]`;va(e)||_a(`regex_rule_invalid`,`A regex rule must be a map`,r),ya(e,[`order`,`scope`,`pattern`,`flags`,`replace`,`maxMatches`,`errorPolicy`,`enabled`],r),e.enabled!==void 0&&typeof e.enabled!=`boolean`&&_a(`regex_enabled_invalid`,`Rule enabled must be a boolean`,r);let i=e.order;(!Number.isSafeInteger(i)||i<0)&&_a(`regex_order_invalid`,`A regex rule must declare a non-negative integer order`,r),o.has(i)&&_a(`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`&&_a(`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)&&_a(`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)&&_a(`regex_flags_invalid`,`Regex flags are invalid`,r);try{new RegExp(s,c)}catch{_a(`regex_pattern_invalid`,`Regex pattern could not be compiled`,r)}typeof e.replace!=`string`&&_a(`regex_replace_invalid`,`Regex replace must be text`,r);let l=e.maxMatches??1;(!Number.isSafeInteger(l)||l<1||l>1024)&&_a(`regex_limit_invalid`,`Regex replacement count must be a bounded positive integer`,r);let u=e.errorPolicy;return u!==`fallback`&&u!==`skip`&&u!==`fail`&&_a(`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 ga=class extends Error{code;constructor(e,t){super(t),this.code=e}};function _a(e,t,n){throw new ga(e,t)}function va(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ya(e,t,n){let r=Object.keys(e).find(e=>!t.includes(e));r!==void 0&&_a(`unsupported_field`,`The current play format does not support field: ${r}`,n)}var q=(e,t)=>E()===`zh-CN`?e:t;function ba({value:e,files:t,onEdit:n,onWrite:r}){let[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(`css`);function c(e,t){n({type:`unbind`,kind:e,path:t})}function u(e,t){n({type:`bind`,kind:e,path:t})}function d(e,t,r){n({type:`create`,kind:e,name:i,suffix:t,body:r})}return(0,B.jsxs)(`section`,{className:`preset-display-editor`,children:[(0,B.jsx)(`h3`,{children:q(`显示模板`,`Display template`)}),(0,B.jsxs)(`label`,{children:[q(`显示方式`,`Renderer`),(0,B.jsxs)(`select`,{"aria-label":q(`显示方式`,`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:q(`默认显示`,`Default display`)}),Object.keys(t).filter(e=>e.startsWith(`renderers/`)&&e.endsWith(`.html`)).map((e,t)=>(0,B.jsxs)(`option`,{value:e,children:[q(`模板`,`Template`),` `,t+1,` · `,ot(e)]},e))]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`renderer`,`html`,`<main class="content"><!-- narraeon:content --></main>`),children:q(`新建 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:[q(`运行方式`,`Rendering mode`),(0,B.jsxs)(`select`,{"aria-label":q(`运行方式`,`Rendering mode`),value:e.rendererMode??`document`,onChange:e=>n({type:`mode`,mode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`document`,children:q(`静态文档`,`Static document`)}),(0,B.jsx)(`option`,{value:`app`,children:q(`交互界面(需本地脚本许可)`,`Interactive app (local script permission required)`)})]})]}),(0,B.jsx)(`p`,{children:q(`模板用 <!-- 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:q(`样式、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:ot(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":ot(e),rows:8,value:t[e]??``,onChange:t=>r(e,t.target.value)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>c(n,e),children:q(`移除此引用`,`Unlink resource`)})]},e)),(0,B.jsxs)(`label`,{children:[n===`scripts`?q(`引用已有脚本`,`Attach existing script`):q(`引用已有资源`,`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:q(`选择已有内容`,`Select existing content`)}),Object.keys(t).filter(t=>t.startsWith(`${n}/`)&&!(e[n]??[]).includes(t)).map(e=>(0,B.jsx)(`option`,{value:e,children:ot(e)},e))]})]})]},n)),(0,B.jsxs)(`div`,{className:`preset-inline`,children:[(0,B.jsx)(`input`,{"aria-label":q(`资源名称`,`Resource name`),placeholder:q(`资源名称`,`Resource name`),maxLength:24,value:i,onChange:e=>a(e.target.value)}),(0,B.jsxs)(`select`,{"aria-label":q(`资源类型`,`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:q(`新建命名资源`,`Create named resource`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`scripts`,`js`,`// Listen for narraeon.extension.v1 render.update messages.
1365
+ `),children:q(`新建 JavaScript`,`Create JavaScript`)})]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:q(`JavaScript 数据与操作参考`,`JavaScript data and command reference`)}),(0,B.jsx)(`p`,{children:q(`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:q(`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:q(`读取当前已显示频道产物`,`Read displayed channel artifacts`)}),(0,B.jsx)(`dt`,{children:`read_player_view`}),(0,B.jsx)(`dd`,{children:q(`读取宿主提供的已提交玩家视图`,`Read committed player views supplied by the host`)}),(0,B.jsx)(`dt`,{children:`composer.set_draft`}),(0,B.jsx)(`dd`,{children:q(`仅填写输入草稿;禁交互时拒绝`,`Fill the input draft only; rejected when interactions are disabled`)}),(0,B.jsx)(`dt`,{children:`panel.close`}),(0,B.jsx)(`dd`,{children:q(`关闭当前实例`,`Close this instance`)}),(0,B.jsx)(`dt`,{children:`panel.refresh`}),(0,B.jsx)(`dd`,{children:q(`重新挂载当前实例并刷新宿主数据`,`Remount this instance and refresh host data`)}),(0,B.jsx)(`dt`,{children:`diagnostic`}),(0,B.jsx)(`dd`,{children:q(`上报本地诊断`,`Report a local diagnostic`)})]})]}),(0,B.jsx)(`h3`,{children:q(`正则显示处理`,`Regex display processing`)}),(0,B.jsx)(`p`,{children:q(`只处理显示内容,不改变发给 AI 的提示词。禁用保留原规则。`,`Changes display only, never prompts sent to AI. Disabled rules are retained.`)}),(0,B.jsxs)(`label`,{children:[q(`规则集`,`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:q(`无显示处理`,`No processing`)}),Object.keys(t).filter(e=>e.startsWith(`regex/`)).map((e,t)=>(0,B.jsxs)(`option`,{value:e,children:[q(`规则集`,`Rule set`),` `,t+1,` · `,ot(e)]},e))]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`regex`,`yaml`,ma({rules:[]})),children:q(`新建规则集`,`Create rule set`)}),e.regex&&(0,B.jsx)(xa,{source:t[e.regex]??``,onChange:t=>r(e.regex,t)},e.regex)]})}function xa({source:e,onChange:t}){let[n,r]=(0,l.useState)(null),i=[],a=``,o=!0;try{let t=fa(e,{uniqueKeys:!0});if(t.errors.length||t.warnings.length)throw Error(t.errors.map(e=>e.message).join(`
1366
+ `)||`Invalid YAML`);let n=t.toJS({maxAliasCount:0});o=!Array.isArray(n),i=ha(e)}catch(e){a=String(e)}let s=n?.source===e;s&&n&&(i=n.rules,o=n.wrapped);function c(e){let n=ma(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":q(`原始规则(修复)`,`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:q(`新增正则规则`,`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:[q(`规则`,`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})}),q(`启用规则`,`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:q(`删除规则`,`Delete rule`)})]}),(0,B.jsxs)(`label`,{children:[q(`阶段`,`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:q(`原始显示文本`,`Raw display text`)}),(0,B.jsx)(`option`,{value:`markdown_html`,children:q(`Markdown HTML`,`Markdown HTML`)}),(0,B.jsx)(`option`,{value:`structured_payload`,children:q(`结构化数据的文本值`,`Structured text values`)})]})]}),[`pattern`,`replace`,`flags`].map(t=>(0,B.jsxs)(`label`,{children:[{pattern:q(`查找`,`Find`),replace:q(`替换`,`Replace`),flags:q(`标志`,`Flags`)}[t],(0,B.jsx)(`input`,{value:e[t],onChange:e=>u(n,{[t]:e.target.value})})]},t)),(0,B.jsxs)(`label`,{children:[q(`最大匹配次数`,`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:[q(`失败行为`,`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:q(`恢复原文`,`Fallback`)}),(0,B.jsx)(`option`,{value:`skip`,children:q(`跳过规则`,`Skip`)}),(0,B.jsx)(`option`,{value:`fail`,children:q(`停止处理`,`Fail`)})]})]})]},e.order)})]})}var Sa=[{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 Ca(e){let t=Sa.find(({value:t})=>t===e)?.label;return t===void 0?e:D(t)}function wa(e,t){return[...new Set([...e,...t===void 0?[]:[t]])].sort()}function Ta(e){return/^#\s+(.+)$/mu.exec(e)?.[1]?.trim()??D(`未命名提示内容`)}function Ea(e,t){return e===`preset.yaml`?{path:e,title:D(`预设入口`),kind:D(`核心 YAML`),description:D(`连接设定完善提示、调用链、界面显示位置、玩家视图面板和扩展资源;它回答“这份预设由哪些部分组成”。`)}:e===`call-chain.yaml`?{path:e,title:D(`调用链与产物`),kind:D(`核心 YAML`),description:D(`声明主响应使用哪些叙事提示、结束后有哪些后置请求,以及每个请求可以生成什么产物。`)}:e===`frame.yaml`?{path:e,title:D(`主持规则顺序`),kind:D(`核心 YAML`),description:D(`决定 Runtime 机械说明、主持规则块和世界指令以什么顺序进入稳定 bootstrap。`)}:e.startsWith(`blocks/`)&&e.endsWith(`.md`)?{path:e,title:Ta(t),kind:D(`主持规则`),description:D(`跨世界使用的主持规则;可在“游玩”左侧目录调整启用状态和顺序。`)}:e===`prompts/setting-improvement.md`?{path:e,title:Ta(t),kind:D(`设定完善提示`),description:D(`约束 AI 怎样理解、规划和创作内容包;工具定义、参数与说明仍由 Runtime 内置。`)}:e.startsWith(`prompts/`)&&e.endsWith(`.md`)?{path:e,title:Ta(t),kind:D(`调用链提示`),description:D(`主叙事或后置请求使用的提示词;在“游玩”左侧选择对应条目即可编辑。`)}:e.startsWith(`renderers/`)?{path:e,title:D(`界面模板`),kind:`HTML renderer`,description:D(`把产物内容或玩家视图变成页面上的 HTML 结构。`)}:e.startsWith(`scripts/`)?{path:e,title:D(`界面交互脚本`),kind:`JavaScript`,description:D(`为 renderer 添加本地交互;导入预设后默认停用,只有显式信任后才执行。`)}:e.startsWith(`assets/`)?{path:e,title:D(`界面样式或资源`),kind:D(`扩展资源`),description:D(`供 renderer 或脚本读取的样式、文字或其他普通资源。`)}:e.startsWith(`regex/`)?{path:e,title:D(`产物文本处理规则`),kind:`Regex YAML`,description:D(`在显示前对产物正文执行有界、可预览的正则处理。`)}:{path:e,title:e.split(`/`).at(-1)??D(`未命名文件`),kind:D(`普通文件`),description:D(`随玩法预设保存和导出的普通业务文件。`)}}function Da(e){return[...new Set(e.split(/\r?\n/u).map(e=>e.trim()).filter(Boolean))]}function Oa(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]?.[E()===`zh-CN`?0:1]??e}function ka({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:D(`不在页面显示`)}):null,Sa.map(e=>(0,B.jsxs)(`option`,{value:e.value,children:[D(e.label),` — `,D(e.description)]},e.value))]})}function Aa({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:Ea(e,``).title}),(0,B.jsx)(`code`,{children:e})]})},e))})}function ja({panels:e,files:t,onChange:n,onFileChange:r,onResourceEdit:i}){function a(t,r){n(e.map((e,n)=>n===t?r(e):e))}function o(){i({type:`create-panel`,id:`panel_${Xe().replaceAll(`-`,``)}`,title:D(`玩家状态`),emptyMessage:D(`当前没有可显示内容。`)})}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:D(`玩家视图面板`)}),(0,B.jsx)(`p`,{children:D(`把世界控制里已经定义好的玩家视图,持续显示在游玩页面。它不调用模型,也不改世界。`)})]}),(0,B.jsx)(`button`,{type:`button`,onClick:o,children:D(`新增玩家视图面板`)})]}),(0,B.jsx)(`p`,{children:D(`同一玩家视图由自定义面板接管,其他视图仍显示默认卡片。`)}),e.length===0?(0,B.jsx)(`p`,{className:`play-preset-empty-copy`,children:D(`当前没有玩家视图面板。`)}):(0,B.jsx)(`ol`,{className:`play-preset-panel-editor-list`,"aria-label":D(`玩家视图面板`),children:e.map((e,n)=>(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:e.config.title??e.id}),(0,B.jsxs)(`span`,{children:[D(`玩家视图`),e.source.view,` · `,Ca(e.mount)]})]}),(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:()=>i({type:`remove-panel`,id:e.id}),children:D(`删除面板`)})]}),(0,B.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,B.jsxs)(`label`,{children:[D(`面板标题`),(0,B.jsx)(`input`,{"aria-label":D(`玩家视图面板 {index} 标题`,{index:n+1}),value:e.config.title??``,onChange:e=>{let t=e.currentTarget.value;a(n,e=>{let n={...e.config};return t===``?delete n.title:n.title=t,{...e,config:n}})}})]}),(0,B.jsxs)(`label`,{children:[D(`读取哪个玩家视图`),(0,B.jsx)(`input`,{"aria-label":D(`玩家视图面板 {index} 视图`,{index:n+1}),list:`player-view-preview-sources`,value:e.source.view,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,source:{...e.source,view:t}}))}})]}),(0,B.jsxs)(`label`,{children:[D(`显示位置`),(0,B.jsx)(ka,{ariaLabel:D(`玩家视图面板 {index} 显示位置`,{index:n+1}),value:e.mount,onChange:e=>{e!==``&&a(n,t=>({...t,mount:e}))}})]}),(0,B.jsxs)(`label`,{children:[D(`排列方式`),(0,B.jsxs)(`select`,{value:e.config.layout,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,layout:t}}))},children:[(0,B.jsx)(`option`,{value:`stack`,children:D(`纵向排列`)}),(0,B.jsx)(`option`,{value:`grid`,children:D(`网格排列`)})]})]}),(0,B.jsxs)(`label`,{children:[D(`没有内容时`),(0,B.jsxs)(`select`,{value:e.config.empty,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,empty:t}}))},children:[(0,B.jsx)(`option`,{value:`hide`,children:D(`隐藏面板`)}),(0,B.jsx)(`option`,{value:`message`,children:D(`显示说明`)}),(0,B.jsx)(`option`,{value:`show`,children:D(`显示空值`)})]})]}),e.config.empty===`hide`?null:(0,B.jsxs)(`label`,{children:[D(`空内容说明`),(0,B.jsx)(`input`,{value:e.config.emptyMessage,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,emptyMessage:t}}))}})]})]}),(0,B.jsx)(ba,{value:e,files:t,onWrite:r,onEdit:t=>i({type:`display`,target:{kind:`panel`,id:e.id},edit:t})}),(0,B.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,B.jsx)(`summary`,{children:D(`高级面板设置`)}),(0,B.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,B.jsxs)(`label`,{children:[D(`面板稳定标识`),(0,B.jsx)(`input`,{value:e.id,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,id:t}))}})]}),(0,B.jsxs)(`label`,{children:[D(`技术频道`),(0,B.jsx)(`input`,{value:e.channel,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,channel:t}))}})]}),(0,B.jsxs)(`label`,{children:[D(`更新 key`),(0,B.jsx)(`input`,{value:e.key,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,key:t}))}})]}),(0,B.jsxs)(`label`,{children:[D(`主题标识`),(0,B.jsx)(`input`,{value:e.config.theme,onChange:e=>{let t=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,theme:t}}))}})]}),(0,B.jsxs)(`label`,{children:[D(`只显示这些项目(每行一个,可留空)`),(0,B.jsx)(`textarea`,{value:(e.source.itemIds??[]).join(`
1367
+ `),onChange:e=>{let t=Da(e.currentTarget.value);a(n,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:D(`分组`)}),(0,B.jsx)(`p`,{children:D(`把已选项目按组显示;每个项目 ID 单独一行。`)})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>a(n,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:D(`新分组`),itemIds:[]}]}}}),children:D(`新增分组`)})]}),(0,B.jsx)(`ol`,{className:`play-preset-group-list`,children:e.config.groups.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`label`,{children:[D(`分组标题`),(0,B.jsx)(`input`,{value:e.label,onChange:e=>{let r=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,n)=>n===t?{...e,label:r}:e)}}))}})]}),(0,B.jsxs)(`label`,{children:[D(`分组标识`),(0,B.jsx)(`input`,{value:e.id,onChange:e=>{let r=e.currentTarget.value;a(n,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,n)=>n===t?{...e,id:r}:e)}}))}})]}),(0,B.jsxs)(`label`,{children:[D(`项目 ID(每行一个)`),(0,B.jsx)(`textarea`,{value:e.itemIds.join(`
1368
+ `),onChange:e=>{let r=Da(e.currentTarget.value);a(n,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,n)=>n===t?{...e,itemIds:r}:e)}}))}})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>a(n,e=>({...e,config:{...e.config,groups:e.config.groups.filter((e,n)=>n!==t)}})),children:D(`删除分组`)})]},`${e.id}-${t}`))})]})]})},`${e.id}-${n}`))})]})}var J=(e,t)=>E()===`zh-CN`?e:t;function Ma({structure:e,files:t,authoring:n,onChange:r,onWrite:i,onResourceEdit:a,preview:o,promptPreview:s}){let[c,u]=(0,l.useState)(),[d,f]=(0,l.useState)(`prompt`),[p,m]=(0,l.useState)(``),h=e.followupItems??Ze(e.followups),g=c?.kind===`followup`&&!h.some(e=>e.id===c.id)&&c.fallback?{...c,id:c.fallback}:c,_=Qe(E()),v=h.find(e=>e.id===g?.id),y=v?.kind===`builtin`?_.definition:e.followups.find(e=>e.id===g?.id),b=e.playerViewPanels.find(e=>e.id===g?.id),x=y?.artifacts.find(e=>e.name===p)??y?.artifacts[0],S=v?.kind!==`user`;function C(e){!S&&y&&r(t=>({...t,followups:t.followups.map(t=>t.id===y.id?e(t):t)}))}function w(e){C(t=>({...t,artifacts:t.artifacts.map(t=>t.name===x?.name?e:t)}))}function T(e){let t=`request_${Xe().replaceAll(`-`,``)}`;a(e?{type:`clone-followup`,id:t,source:e.id}:{type:`create-followup`,id:t,displayName:J(`新后置请求`,`New follow-up`),body:J(`根据本轮已提交叙事,生成下面声明的界面产物。`,`Generate the declared interface outputs from the settled narrative.`)}),u({kind:`followup`,id:t,...e&&g?{fallback:g.id}:{}}),f(`prompt`)}function D(t){return t.kind===`builtin`?_.definition.displayName:t.kind===`content-package`?J(`内容包后置组`,`Content-package follow-ups`):e.followups.find(e=>e.id===t.id)?.displayName??t.id}function O(e,t){let n=[...h],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 k=(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:J(`回复完成后`,`After the reply`)}),(0,B.jsx)(`button`,{type:`button`,"aria-label":J(`新增后置请求`,`Add follow-up request`),onClick:()=>T(),children:`+`})]}),(0,B.jsx)(`ol`,{"aria-label":J(`后置请求`,`Follow-up requests`),children:h.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(),O(e.dataTransfer.getData(`application/x-narraeon-followup`),t)},children:[(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":g?.id===e.id,onClick:()=>{u({kind:`followup`,id:e.id}),f(`prompt`)},onKeyDown:n=>{n.altKey&&[`ArrowUp`,`ArrowDown`].includes(n.key)&&(n.preventDefault(),O(e.id,t+(n.key===`ArrowUp`?-1:1)))},children:[D(e),(0,B.jsx)(`small`,{children:e.kind===`builtin`?J(`系统`,`System`):e.kind===`content-package`?J(`内容包`,`Package`):J(`用户`,`User`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":`${J(`启用`,`Enable`)} ${D(e)}`,checked:e.enabled,onChange:t=>r(n=>({...n,followupItems:h.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:J(`纯界面 · 不调用模型`,`Interface · no model`)}),(0,B.jsx)(`button`,{type:`button`,"aria-label":J(`新增纯界面`,`Add interface panel`),onClick:()=>{let e=`panel_${Xe().replaceAll(`-`,``)}`;a({type:`create-panel`,id:e,title:J(`世界状态栏`,`World status`),emptyMessage:J(`当前没有可显示内容。`,`No content to display.`)}),u({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":g?.id===e.id,onClick:()=>u({kind:`panel`,id:e.id}),children:e.config.title??e.source.view})},e.id))})]})]}),A=g?.kind===`panel`&&b?(0,B.jsxs)(`div`,{className:`preset-object-detail`,children:[(0,B.jsx)(ja,{panels:[b],files:t,onFileChange:i,onResourceEdit:a,onChange:e=>r(t=>({...t,playerViewPanels:t.playerViewPanels.flatMap(t=>t.id===b.id?e:[t])}))}),o()]}):g?.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:[J(`回复完成后`,`After the reply`),` /`,` `,S?J(`系统 / 内容包`,`System / package`):J(`用户`,`User`)]}),(0,B.jsx)(`button`,{type:`button`,disabled:h[0]?.id===g.id,onClick:()=>O(g.id,h.findIndex(e=>e.id===g.id)-1),children:`↑`}),(0,B.jsx)(`button`,{type:`button`,disabled:h.at(-1)?.id===g.id,onClick:()=>O(g.id,h.findIndex(e=>e.id===g.id)+1),children:`↓`}),y&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>T(y),children:J(`克隆后置请求`,`Clone follow-up`)}),!S&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{a({type:`remove-followup`,id:g.id}),u(void 0)},children:J(`删除`,`Delete`)})]}),y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`preset-detail-tabs`,children:[[`prompt`,J(`提示词`,`Prompt`)],[`outputs`,J(`界面产物`,`Outputs`)],[`advanced`,J(`高级设置`,`Advanced`)]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":d===e,onClick:()=>f(e),children:t},e))}),S&&(0,B.jsx)(`p`,{children:J(`系统示例完整只读;克隆后独立编辑。`,`The complete system example is read-only. Clone to edit independently.`)}),d===`prompt`?(0,B.jsxs)(`div`,{className:`preset-manuscript`,children:[(0,B.jsxs)(`label`,{children:[J(`后置请求名称`,`Follow-up name`),(0,B.jsx)(`input`,{"aria-label":J(`后置请求名称`,`Follow-up name`),readOnly:S,value:y.displayName,onChange:e=>C(t=>({...t,displayName:e.target.value}))})]}),(0,B.jsxs)(`label`,{children:[J(`提示词`,`Prompt`),(0,B.jsx)(`textarea`,{"aria-label":J(`这次额外请求要做什么`,`What should this follow-up do?`),rows:16,readOnly:S,value:S?_.body:t[y.prompt.path]??``,onChange:e=>i(y.prompt.path,e.target.value)})]}),(0,B.jsx)(`button`,{type:`button`,disabled:S,onClick:()=>i(y.prompt.path,`${t[y.prompt.path]??``}\n\n${y.artifacts.map(e=>`output=${e.name}: ${e.purpose??e.displayName??e.name}`).join(`
1369
+ `)}`),children:J(`将产物引用加入提示词`,`Insert output references`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{children:d===`outputs`?J(`界面产物`,`Interface outputs`):J(`此产物的数据格式要求`,`This output's data requirements`)}),(0,B.jsx)(`p`,{children:J(`一条请求,可以生成多个界面产物。`,`One request can generate several interface outputs.`)}),(0,B.jsxs)(`div`,{className:`preset-output-cards`,children:[y.artifacts.map(t=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":x?.name===t.name,onClick:()=>m(t.name),children:[(0,B.jsx)(`strong`,{children:t.displayName??t.name}),(0,B.jsx)(`small`,{children:t.purpose??J(`尚未填写用途`,`No purpose yet`)}),(0,B.jsx)(`span`,{children:Ca(e.mounts.find(e=>e.channel===t.channel)?.mount??`story`)})]},t.name)),!S&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let t=y.artifacts.length+1;for(;y.artifacts.some(e=>e.name===`output_${t}`)||e.mounts.some(e=>e.channel===`${y.id}.output_${t}`);)t++;let n=at(`${y.id}.output_${t}`,`output_${t}`);a({type:`add-artifact`,requestId:y.id,artifact:n}),m(n.name)},children:J(`+ 新增产物`,`+ Add output`)})]}),!S&&(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:J(`JavaScript 示例 · 新建独立产物`,`JavaScript examples · create independent output`)}),(0,B.jsx)(`p`,{children:J(`新建示例不会覆盖现有资源,不会授予脚本许可。`,`Creates independent files without overwriting resources or granting script permission.`)}),[`actions`,`card`].map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let t=st(e,y.id);a({type:`add-artifact`,requestId:y.id,...t,mount:e===`actions`?`composer_below`:`story`}),m(t.artifact.name)},children:e===`actions`?J(`新建行动按钮示例`,`Create action button example`):J(`新建场景卡片示例`,`Create scene card example`)},e))]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:J(`AI 如何提交这些产物`,`How AI submits these outputs`)}),(0,B.jsx)(`p`,{children:J(`同一次后置模型响应,分别调用 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.`)}),y.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:y.artifacts.indexOf(x)+e<0||y.artifacts.indexOf(x)+e>=y.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?J(`产物前移`,`Move output earlier`):J(`产物后移`,`Move output later`)},e))}),d===`outputs`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[J(`产物名称`,`Output name`),(0,B.jsx)(`input`,{"aria-label":J(`产物名称`,`Output name`),maxLength:160,value:x.displayName??x.name,onChange:e=>w({...x,displayName:e.target.value})})]}),(0,B.jsxs)(`label`,{children:[J(`生成内容用途`,`Generation purpose`),(0,B.jsx)(`textarea`,{"aria-label":J(`生成内容用途`,`Generation purpose`),maxLength:16e3,value:x.purpose??``,onChange:e=>w({...x,purpose:e.target.value})})]}),(0,B.jsxs)(`label`,{children:[J(`显示位置`,`Display position`),(0,B.jsx)(ka,{ariaLabel:J(`产物显示位置`,`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)(ba,{value:x,files:t,onWrite:i,onEdit:e=>a({type:`display`,target:{kind:`artifact`,requestId:y.id,output:x.name},edit:e})})]}):(0,B.jsx)(Na,{artifact:x,onChange:w}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>a({type:`remove-artifact`,requestId:y.id,output:x.name}),children:J(`移除此产物`,`Remove output`)})]}),d===`advanced`&&(0,B.jsxs)(`label`,{children:[J(`本次所有产物合计上限(bytes)`,`Total output byte limit`),(0,B.jsx)(`input`,{type:`number`,readOnly:S,min:1,max:1048576,value:y.maxArtifactBytes,onChange:e=>C(t=>({...t,maxArtifactBytes:Number(e.target.value)}))})]})]}),o(y.id,x?.name)]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{children:J(`内容包后置组`,`Content-package follow-ups`)}),(0,B.jsx)(`p`,{children:J(`在此位置展开当前世界的内容包后置请求。无声明时为空组,不调用模型;正文由内容包管理。`,`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)(wt,{mergeConsecutiveMessages:e.mergeConsecutiveMessages??!0,onMergeConsecutiveMessagesChange:e=>r(t=>({...t,mergeConsecutiveMessages:e})),entries:(n?e.authorPrompts:e.playPrompts)??[],authoring:n,onChange:e=>r(t=>({...t,[n?`authorPrompts`:`playPrompts`]:e})),promptPreview:s,onSelectPrompt:()=>u(void 0),...n?{}:{directory:k,detail:A}})}function Na({artifact:e,onChange:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[J(`内容格式`,`Content format`),(0,B.jsx)(`select`,{"aria-label":J(`内容格式`,`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:Oa(e)},e))})]}),e.contentType===`application/json`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:J(`约定字段、类型与必填项。要求会说明给模型,提交时由应用校验;不为模型开启 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:[J(`此产物的数据格式要求(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:J(`移除格式要求`,`Remove requirements`)})]}),[[`strategy`,J(`更新方式`,`Update policy`),[`replace`,`append`,`upsert`,`transient`,`hidden`]],[`save`,J(`保存范围`,`Save scope`),[`commit`,`operation`,`none`]],[`invalidation`,J(`清空条件`,`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:Oa(e)},e))})]},n)),(0,B.jsx)(`p`,{children:J(`更新方式决定同一产物如何合并:替换只留最新一份,追加保留多份,按标识更新只替换同标识的内容。保存范围、清空条件和生成期间显示的限制共同决定何时可见;关闭世界中的扩展仍会隐藏产物,清空指令仍可清除它。`,`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:[J(`更新标识(相同标识覆盖旧内容)`,`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:[J(`单次最多输出次数`,`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})}),J(`AI 必须生成此产物`,`Required output`)]})]})}function Pa(e,t){return e===void 0?{ok:!0}:Ia(t)?Fa(e,t,`$`,0):{ok:!1,message:`JSON artifact payload must be a valid JSON value`}}function Fa(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=Fa(e.items,o,`${n}[${t}]`,r+1);if(!i.ok)return i}if(e.uniqueBy!==void 0&&La(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=Fa(t,i[e],`${n}.${e}`,r+1);if(!a.ok)return a}}return{ok:!0}}function Ia(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(Ia):La(e)?Object.values(e).every(Ia):!1}function La(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ra({open:e,onToggle:t,label:n,hint:r}){return(0,B.jsxs)(`button`,{type:`button`,className:`player-fold-toggle`,"aria-expanded":e,onClick:t,children:[(0,B.jsx)(`span`,{className:`player-fold-chevron`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`player-fold-label`,children:n}),e||r===void 0?null:(0,B.jsx)(`small`,{className:`player-fold-hint`,children:r})]})}var za=(0,l.createContext)(null),Ba=za.Provider;function Va(){let[e,t]=(0,l.useState)({all:null,overrides:{}});return{fold:(0,l.useMemo)(()=>({isOpen:(t,n)=>e.overrides[t]??e.all??n,setOpen:(e,n)=>t(t=>({...t,overrides:{...t.overrides,[e]:n}}))}),[e]),expandAll:()=>t({all:!0,overrides:{}}),collapseAll:()=>t({all:!1,overrides:{}})}}function Ha(e,t){let n=(0,l.useContext)(za),[r,i]=(0,l.useState)(t),a=n===null?r:n.isOpen(e,t);return{open:a,toggle:()=>n===null?i(!a):n.setOpen(e,!a)}}function Ua(e){if(Array.isArray(e))return e.length>0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.$ref!=`string`&&Object.keys(t).length>0}function Wa(e){if(Array.isArray(e))return D(`{count} 项`,{count:String(e.length)});let t=Object.keys(e);return D(`{count} 项`,{count:String(t.length)})+` · `+t.slice(0,3).join(`、`)+(t.length>3?`…`:``)}var Ga=[`name`,`title`,`名称`,`名字`,`标题`];function Ka(e,t){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e;for(let e of Ga){let n=t[e];if(typeof n==`string`&&n.trim()!==``)return n}}return`#`+String(t+1)}function qa({value:e,path:t=``}){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,n)=>(0,B.jsx)(Ya,{path:t+`/`+String(n),index:n,entry:e},n))}):Xa(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,n])=>(0,B.jsx)(Ja,{path:t+`/`+e,label:e,value:n,defaultOpen:!1},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:D(`[无法显示]`)})}function Ja({path:e,label:t,value:n,defaultOpen:r}){let{open:i,toggle:a}=Ha(e,r);return Ua(n)?(0,B.jsxs)(`div`,{className:`player-fold-row`,children:[(0,B.jsx)(`dt`,{children:(0,B.jsx)(Ra,{open:i,onToggle:a,label:t,hint:Wa(n)})}),(0,B.jsx)(`dd`,{className:`player-fold-body`,hidden:!i,children:(0,B.jsx)(qa,{value:n,path:e})})]}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:t}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(qa,{value:n,path:e})})]})}function Ya({path:e,index:t,entry:n}){let{open:r,toggle:i}=Ha(e,!1);return Ua(n)?(0,B.jsxs)(`li`,{className:`player-fold-row`,children:[(0,B.jsx)(Ra,{open:r,onToggle:i,label:Ka(n,t),hint:Wa(n)}),(0,B.jsx)(`div`,{className:`player-fold-body`,hidden:!r,children:(0,B.jsx)(qa,{value:n,path:e})})]}):(0,B.jsx)(`li`,{children:(0,B.jsx)(qa,{value:n,path:e})})}function Xa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Za({content:e}){let t;try{t=JSON.parse(e)}catch{return(0,B.jsx)(`p`,{role:`status`,children:D(`玩家视图格式无效,请检查文本处理规则。`)})}if(!eo(t))return null;let n=eo(t.config)?t.config:{},r=Array.isArray(t.items)?t.items.filter(eo):[];if(r.length===0&&n.empty===`hide`)return null;let i=Array.isArray(n.groups)?n.groups.filter(eo):[],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`,c=typeof t.viewId==`string`?t.viewId:typeof t.title==`string`?t.title:`view`;return(0,B.jsxs)(Qa,{viewPath:c,title:typeof t.title==`string`?t.title:null,itemCount:r.length,layout:s,children:[r.length===0&&n.empty!==`show`?(0,B.jsx)(`p`,{children:typeof n.emptyMessage==`string`?n.emptyMessage:D(`当前没有可显示项目。`)}):null,o.filter(e=>e.items.length>0).map((e,t)=>(0,B.jsx)($a,{path:c+`/group:`+String(t),label:e.label,children:(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.jsx)(Ja,{path:c+`/`+(typeof e.id==`string`?e.id:String(t)),label:typeof e.label==`string`?e.label:``,value:e.value,defaultOpen:!0},typeof e.id==`string`?e.id:t))})},t))]})}function Qa({viewPath:e,title:t,itemCount:n,layout:r,children:i}){let{open:a,toggle:o}=Ha(e,!0);return(0,B.jsxs)(`section`,{className:`player-view-card`,"data-player-view-layout":r,children:[t===null?null:(0,B.jsx)(`h3`,{children:(0,B.jsx)(Ra,{open:a,onToggle:o,label:t,hint:D(`{count} 项`,{count:n})})}),(0,B.jsx)(`div`,{className:`player-fold-body`,hidden:t!==null&&!a,children:i})]})}function $a({path:e,label:t,children:n}){let{open:r,toggle:i}=Ha(e,!0);return t===``?(0,B.jsx)(`section`,{children:n}):(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h4`,{children:(0,B.jsx)(Ra,{open:r,onToggle:i,label:t})}),(0,B.jsx)(`div`,{className:`player-fold-body`,hidden:!r,children:n})]})}function eo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function to(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 no(e,t){return t===`application/json`?JSON.stringify(e,null,2):typeof e==`string`?e:JSON.stringify(e)}function ro(e){let t=Oo(e.replace(/\r\n?/gu,`
1370
+ `)).split(`
1371
+ `),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>${Do(i[1]??``)}</li>`);else if(r&&=(n.push(`</ul>`),!1),t!==null){let e=t[1]?.length??1;n.push(`<h${e}>${Do(t[2]??``)}</h${e}>`)}else e.trim()!==``&&n.push(`<p>${Do(e)}</p>`)}return r&&n.push(`</ul>`),n.join(`
1372
+ `)}function Y(e){let t=e.maxRules??256,n=e.maxTransformations??1024,r=e.maxOutputBytes??4194304,i=e.maxDomCharacters??1e6,a=no(e.payload,e.contentType),o=e.contentType===`text/markdown`?ro(a):``;if(new TextEncoder().encode(a).byteLength>r||o.length>i)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:D(`artifact 内容超过宿主渲染上限`)};if(e.rules.length>t)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:D(`正则规则数量超过宿主上限`)};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:D(`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,Eo(t.replace,e,o)));if(p>n)throw Error(D(`正则转换次数超过宿主上限`));if(new TextEncoder().encode(m).byteLength>r)throw Error(D(`正则输出超过宿主字节上限`));if(t.scope===`markdown_html`&&m.length>i)throw Error(D(`Markdown HTML DOM 大小超过宿主上限`));if(t.scope===`raw_text`){if(c=m,!d&&e.contentType===`text/markdown`&&(u=ro(c),u.length>i))throw Error(D(`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:D(`正则执行失败`);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:D(`正则规则失败,实例显示 raw artifact(可恢复)`)}:m===`fail`?{error:D(`正则规则失败,实例进入错误状态并显示 raw artifact`)}:{}}}function io(e,t,n,r){return n?.mode===`document`&&n.document!==void 0?oo(ao({template:n.document,content:e,contentType:t,...r===void 0?{}:{payload:r}}),n):oo(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>${Oo(e)}</pre>`}</main>`,n)}function ao(e){let t=`<!-- narraeon:content -->`,n=`<!-- narraeon:payload -->`;if(uo(e.template,t)!==1)throw Error(D(`document renderer 必须包含唯一 narraeon:content marker`));let r=e.contentType===`text/html`||e.contentType===`text/markdown`?e.content:`<pre>${Oo(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 oo(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 co(e,n);let i=r.index;return`${e.slice(0,i)}${n}${e.slice(i)}`}function so(e){let t=oo(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:"${fo}",type:"bridge.event",instanceId:${i},nonce:${a},event:"diagnostic",payload:{message:String(event.message||"Extension script error")}})});window.addEventListener("unhandledrejection",function(event){send({namespace:"${fo}",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:"${fo}",type:"bridge.ready",instanceId:${i},nonce:${a}},"*");<\/script>`;return co(lo(t,o,``),`${n}${s}`)}function co(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 lo(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 uo(e,t){return e.split(t).length-1}var fo=`narraeon.extension.v1`;function po(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 mo(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 ho(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 go=[`story`,`sidebar`,`composer_above`,`composer_below`,`overlay`,`debug`],_o=(0,l.createContext)(null);function vo({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 go)e.set(t,[]);let n=[...t,...r.map(bo)];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)(_o.Provider,{value:v,children:u})}function yo({mount:e,reply:t}){let n=(0,l.useContext)(_o);if(n===null)throw Error(D(`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,` · `,D(t.state)]},e)),r.map(e=>{let t=to(e);return(0,B.jsx)(xo,{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 bo(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 xo({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-${ko(to(e))}`,[g,_]=(0,l.useState)(()=>({epoch:0,nonce:Ao()})),v=g.nonce,[y,b]=(0,l.useState)(!1),x=(0,l.useMemo)(()=>Y({payload:e.payload,contentType:e.contentType,rules:e.frontend.regex}),[e.contentType,e.frontend.regex,e.payload]),S=(0,l.useRef)(null),C=e.frontend.renderer,w=C?.mode===`app`,T=x.final,E=(0,l.useMemo)(()=>{try{return{srcDoc:w&&C!==void 0?so({renderer:C,instanceId:h,nonce:v}):io(T,e.contentType,C,e.payload),error:void 0}}catch(e){return{srcDoc:``,error:e instanceof Error?e.message:D(`文档 renderer 无效`)}}},[e.contentType,e.payload,T,h,w,v,C]),O=E.srcDoc,k=E.error,A=o??k??(x.failure===`fail`?x.error:void 0),j=(0,l.useCallback)(()=>{b(!1),_(e=>({epoch:e.epoch+1,nonce:Ao()})),m()},[m]),M=(0,l.useCallback)(()=>{let n=S.current;w&&n?.contentWindow!=null&&n.contentWindow.postMessage({namespace:fo,type:`render.update`,instanceId:h,nonce:v,payload:{content:T,contentType:e.contentType,worldId:t,channel:e.channel,key:e.key,interactionDisabled:i}},`*`)},[e.channel,e.contentType,e.key,T,h,w,v,t,i]);(0,l.useEffect)(()=>{function e(e){if(e.source!==S.current?.contentWindow)return;if(mo(e.data,{instanceId:h,nonce:v})){b(!0),f(`bridge.ready`);return}if(ho(e.data,{instanceId:h,nonce:v})){let t=jo(e.data.payload)?e.data.payload:{};f(`diagnostic`),d(typeof t.message==`string`?t.message:D(`扩展报告了未知诊断`));return}if(!po(e.data,{instanceId:h,nonce:v}))return;f(e.data.command);let t=jo(e.data.payload)?e.data.payload:{};if(e.data.command===`read_channel`)So(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:``;So(e,e.data,{view:r.find(e=>jo(e)&&e.id===n)})}else e.data.command===`composer.set_draft`?i?wo(e,e.data,D(`当前调用链正在提交,暂不能修改草稿`)):typeof t.text==`string`?(p(t.text),Co(e,e.data,{accepted:!0})):wo(e,e.data,D(`composer.set_draft.text 必须是字符串`)):e.data.command===`panel.close`?(c(),So(e,e.data,{accepted:!0})):e.data.command===`panel.refresh`?(j(),So(e,e.data,{accepted:!0})):e.data.command===`diagnostic`&&d(typeof t.message==`string`?t.message:D(`扩展报告了未知诊断`))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[n,h,v,f,c,d,m,p,i,r,j]),(0,l.useEffect)(()=>{y&&M()},[y,M]);function ee(){b(!0),w&&window.setTimeout(M,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`||x.fallback?(0,B.jsxs)(`div`,{className:`artifact-extension-fallback`,role:`status`,children:[(0,B.jsx)(`p`,{children:A??x.error??e.frontend.diagnostic??D(`扩展资源不可用,显示 raw artifact。`)}),(0,B.jsx)(`pre`,{children:x.original}),(0,B.jsx)(`button`,{type:`button`,onClick:a?u:c,children:D(a?`恢复此扩展`:`停用此扩展`)})]}):e.frontend.source===`player_view`&&C===void 0?(0,B.jsx)(Za,{content:T}):(0,B.jsxs)(B.Fragment,{children:[e.frontend.trustedLocalCode?(0,B.jsx)(`small`,{className:`artifact-extension-trusted-label`,children:D(`本地可信代码`)}):null,(0,B.jsx)(`iframe`,{ref:S,title:e.output,className:`artifact-extension-frame`,sandbox:e.frontend.trustedLocalCode?`allow-scripts`:``,srcDoc:O,onLoad:ee,onError:()=>d(D(`扩展 iframe 加载失败`))},g.epoch)]}),e.frontend.mount===`debug`?(0,B.jsxs)(`details`,{className:`artifact-extension-debug`,children:[(0,B.jsx)(`summary`,{children:D(`产物诊断`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsx)(`dt`,{children:D(`来源`)}),(0,B.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,B.jsx)(`dt`,{children:D(`保存/投影`)}),(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:x.original}),(0,B.jsx)(`p`,{children:`regex steps`}),(0,B.jsx)(`pre`,{children:JSON.stringify(x.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:[D(`bridge 事件(`),s.length,`)`]}),(0,B.jsx)(`ul`,{children:s.map((e,t)=>(0,B.jsx)(`li`,{children:e},`${e}-${t}`))})]})]})}function So(e,t,n){Co(e,t,n)}function Co(e,t,n){To(e,t,{ok:!0,payload:n})}function wo(e,t,n){To(e,t,{ok:!1,error:n})}function To(e,t,n){if(t.requestId===void 0)return;let r=e.source;r!==null&&`postMessage`in r&&r.postMessage({namespace:fo,type:`bridge.response`,ok:n.ok,requestId:t.requestId,instanceId:t.instanceId,nonce:t.nonce,...n.ok?{payload:n.payload}:{error:n.error}},`*`)}function Eo(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 Do(e){return e.replace(/`([^`]+)`/gu,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/gu,`<strong>$1</strong>`)}function Oo(e){return e.replace(/&/gu,`&amp;`).replace(/</gu,`&lt;`).replace(/>/gu,`&gt;`).replace(/"/gu,`&quot;`).replace(/'/gu,`&#39;`)}function ko(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 Ao(){return p(`extension-nonce`)}function jo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Mo=(e,t)=>E()===`zh-CN`?e:t;function No({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 b=u?.key===c?u.snapshot:void 0,x=b?.artifactPreviews.find(e=>e.requestId===o&&e.output===s),S=m??x?.rawText??``,C=``;if(x?.declaration.contentType===`application/json`)try{S=JSON.parse(m??JSON.stringify(x.rawPayload,null,2));let e=Pa(x.declaration.payloadContract,S);C=e.ok?Mo(`样例校验通过`,`Sample valid`):e.message}catch(e){C=String(e)}let w=b?.structure.mounts.find(e=>e.channel===x?.declaration.channel)?.mount,T=x&&w?{recordId:`preview`,worldId:`preview`,operationId:`preview`,playPresetId:t,playPresetRevision:b.revision,requestId:o,requestAttempt:1,output:s,channel:x.declaration.channel,...x.declaration.key?{key:x.declaration.key}:{},contentType:x.declaration.contentType,payload:S,projection:x.declaration.strategy,save:x.declaration.save,sequence:1,head:`preview`,frontend:{status:`ready`,preset:{id:t,revision:b.revision},mount:w,regex:x.regex,...x.renderer?{renderer:x.renderer}:{},trustedLocalCode:x.renderer?.trustedLocalCode===!0&&a,fallback:`none`}}:void 0,E=x?Y({contentType:x.declaration.contentType,payload:S,rules:x.regex}):void 0;return(0,B.jsxs)(`details`,{className:`preset-draft-preview`,children:[(0,B.jsx)(`summary`,{children:Mo(`游玩效果预览 · 就地展开`,`Play preview · expand here`)}),(0,B.jsx)(`p`,{children:Mo(`预览当前修改与本页样例,不调用模型,也不改变世界。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}):b?null:(0,B.jsx)(`p`,{role:`status`,children:Mo(`正在解析当前草稿…`,`Resolving draft…`)}),x&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[Mo(`示例输入`,`Sample input`),(0,B.jsx)(`textarea`,{"aria-label":Mo(`示例输入`,`Sample input`),rows:6,value:m??(x.declaration.contentType===`application/json`?JSON.stringify(x.rawPayload,null,2):x.rawText),onChange:e=>h(e.target.value)})]}),x.declaration.contentType===`application/json`&&(0,B.jsxs)(`div`,{className:`preset-inline`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>h(JSON.stringify(x.rawPayload,null,2)),children:Mo(`载入当前格式样例`,`Load current format sample`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let e=structuredClone(x.rawPayload),t=x.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:Mo(`移除首个必填字段`,`Remove first required field`)})]}),C&&(0,B.jsx)(`p`,{role:`status`,children:C}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:Mo(`处理后显示文本`,`Processed display text`)}),(0,B.jsx)(`pre`,{children:E?.final})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>y(e.target.checked)}),Mo(`预览禁交互状态`,`Preview disabled interactions`)]})]}),T?(0,B.jsxs)(`section`,{className:`preset-preview-position position-${w}`,children:[(0,B.jsx)(`h4`,{children:Ca(w)}),(0,B.jsx)(vo,{worldId:`preview`,artifacts:[T],playerViews:{views:[]},interactionDisabled:v,onSetComposerDraft:_,onRefresh:()=>h(m),children:(0,B.jsx)(yo,{mount:w})},c)]}):x?(0,B.jsx)(`p`,{children:Mo(`此产物未设置显示位置。`,`This output has no display position.`)}):null,(0,B.jsxs)(`label`,{children:[Mo(`本页输入草稿(尚未发送)`,`Local input draft (not sent)`),(0,B.jsx)(`textarea`,{"aria-label":Mo(`本页输入草稿(尚未发送)`,`Local input draft (not sent)`),value:g,onChange:e=>_(e.target.value)})]})]})}function Po({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),v=(0,l.useRef)(0),y=JSON.stringify({presetId:t,revision:n,files:r,structure:i,worldId:u,conflict:a,scriptsEnabled:o}),[b,x]=(0,l.useState)(y);b!==y&&(x(y),p(null),h(!1),_(null));let S=f?.key===y?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,v.current+=1}},[e]),(0,l.useEffect)(()=>{v.current+=1},[y]);async function C(){if(u===``||a)return;let o=++v.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===v.current&&a.playerViewPreview.worldId===u&&p({key:y,preview:a.playerViewPreview})}catch(e){o===v.current&&_(e instanceof Error?e.message:String(e))}finally{o===v.current&&h(!1)}}return(0,B.jsxs)(`section`,{className:`play-preset-structured-section interface-extension-preview`,"aria-label":D(`纯界面预览`),children:[(0,B.jsx)(`h4`,{children:D(`纯界面预览`)}),(0,B.jsx)(`p`,{children:D(`使用当前编辑内容与所选世界的已保存玩家视图,不调用模型,也不保存或修改世界。修改后请重新预览。`)}),(0,B.jsxs)(`label`,{children:[D(`预览世界`),(0,B.jsxs)(`select`,{"aria-label":D(`预览世界`),value:u,onChange:e=>d(e.currentTarget.value),children:[(0,B.jsx)(`option`,{value:``,children:D(`选择已有世界`)}),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 C(),children:D(`预览界面`)}),m?(0,B.jsx)(`p`,{role:`status`,children:D(`正在读取玩家视图…`)}):null,a?(0,B.jsx)(`p`,{role:`alert`,children:D(`预设原文与表单均有修改,请先保留一种编辑结果并保存,再预览。`)}):null,g===null?null:(0,B.jsx)(`p`,{role:`alert`,children:g}),S===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`datalist`,{id:`player-view-preview-sources`,children:S.playerViews.views.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.title},e.id))}),(0,B.jsx)(vo,{worldId:S.worldId,artifacts:[],playerViewPanels:S.panels,playerViews:S.playerViews,onSetComposerDraft:()=>void 0,onRefresh:C,children:go.filter(e=>S.panels.some(t=>t.frontend.mount===e)).map(e=>(0,B.jsxs)(`section`,{"aria-label":Ca(e),children:[(0,B.jsx)(`h5`,{children:Ca(e)}),(0,B.jsx)(yo,{mount:e})]},e))}),S.panels.length===0?(0,B.jsx)(`p`,{children:D(`当前没有玩家视图面板。`)}):null]})]})}var Fo=[{id:`call_chain`,label:`游玩`,description:`叙事规则、后置请求与工具契约`},{id:`setting_improvement`,label:`设定完善`,description:`AI 创作方法;工具契约保持内置`}];function Io(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 Lo(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]??``}var Ro=`.play-preset-operations[open], .play-preset-library > details[open]`;function zo({client:e,initialLibrary:t,recommendedTemplates:n=[],onLibraryChange:r,onDirtyChange:i,initialSelectedId:a,onSelectionChange:o,renderPromptPreview:s}){let[c,u]=(0,l.useState)(t),d=(0,l.useRef)(null),f=(0,l.useRef)(null);oe(!0,()=>{let e=f.current?.querySelectorAll(Ro)??[];for(let t of e)t.open=!1;return e.length>0});let p=t.presets.find(({id:e})=>e===a)??t.presets.find(({id:e})=>e===t.currentPresetId)??t.presets[0],[m,h]=(0,l.useState)(p?.id??``),[g,_]=(0,l.useState)(()=>p===void 0?null:Io(p)),[v,y]=(0,l.useState)(p?.files===void 0?``:Lo(p.draft?.files??p.files)),[b,x]=(0,l.useState)(``),[S,C]=(0,l.useState)(``),[w,T]=(0,l.useState)(`call_chain`),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(null),M=(0,l.useMemo)(()=>c.presets.find(({id:e})=>e===g?.id),[g?.id,c.presets]),ee=M?.draft??M,te=g!==null&&ee!==void 0&&(JSON.stringify(g.files)!==JSON.stringify(ee.files)||JSON.stringify(g.structure)!==JSON.stringify(ee.structure)),ne=g!==null&&M!==void 0&&g.name!==M.name,N=g!==null&&M!==void 0&&(ne||te),P=(0,l.useMemo)(()=>{let e=g?.structure?.callChainPath??ee?.structure?.callChainPath??`call-chain.yaml`;return new Set([`preset.yaml`,e])},[g?.structure?.callChainPath,ee?.structure?.callChainPath]),F=(0,l.useMemo)(()=>g?.structure?tt({files:g.files,structure:g.structure}):void 0,[g?.files,g?.structure]),re=g!==null&&ee!==void 0&&[...P].some(e=>g.files[e]!==ee.files[e]),ie=g!==null&&ee!==void 0&&JSON.stringify(g.structure)!==JSON.stringify(ee.structure),ae=re&&ie,L=c.presets.find(({id:e})=>e===c.currentPresetId);(0,l.useEffect)(()=>{i(N)},[N,i]),(0,l.useEffect)(()=>()=>i(!1),[i]);async function R(t){let n=await e.request({type:`play.read`}),i=n.presets.find(({id:e})=>e===t)??n.presets.find(({id:e})=>e===m)??n.presets.find(({id:e})=>e===n.currentPresetId)??n.presets[0];d.current&&(d.current.open=!1),u(n),r(n),h(i?.id??``),o?.(i?.id??``);let a=i===void 0?null:Io(i);_(a),y(a===null?``:Lo(a.files))}async function z(e){if(!O){k(!0),j(null);try{await e()}catch(e){j({kind:`error`,text:e instanceof Error?e.message:D(`玩法预设操作失败`)})}finally{k(!1)}}}function se(e){if(e===m)return;if(N&&e!==m){j({kind:`error`,text:D(`当前玩法有未保存修改;请先保存或撤销,再切换预设。`)});return}let t=c.presets.find(({id:t})=>t===e);if(t===void 0)return;h(e),o?.(e);let n=Io(t);_(n),y(Lo(n.files)),j(null),T(`call_chain`)}function ce(){if(M===void 0)return;let e=Io(M);_(e),y(Lo(e.files)),j({kind:`status`,text:D(`已撤销当前未保存修改。`)})}function le(e){g!==null&&v!==``&&ue(v,e)}function ue(e,t){_(n=>n===null?null:{...n,files:{...n.files,[e]:t}})}function de(e){_(t=>t===null?null:{...t,files:e(structuredClone(t.files))})}function fe(e){_(t=>t?.structure===void 0?t:{...t,structure:e(structuredClone(t.structure))})}function pe(e){_(t=>{if(!t?.structure)return t;try{return{...t,...$e({files:t.files,structure:t.structure},e),resourceError:void 0}}catch(e){return{...t,resourceError:e instanceof Error?e.message:D(`玩法预设操作失败`)}}})}async function me(){g!==null&&(ae?j({kind:`error`,text:D(`预设原文与表单均有修改,请先保留一种编辑结果再保存,以免覆盖当前修改。`)}):await z(async()=>{await e.request({type:`play.save`,presetId:g.id,name:g.name,files:g.files,...g.structure===void 0||re||!ie&&g.structure.migrationNotice===void 0?{}:{structure:g.structure}}),await R(g.id),j({kind:`status`,text:D(`预设已保存。`)})}))}async function he(){g!==null&&await z(async()=>{let t=await e.request({type:`play.export`,presetId:g.id}),n=new Blob([JSON.stringify(t.files,null,2)],{type:`application/json`});await I(`${g.name}.play-preset.json`,{blob:n})!==`cancelled`&&j({kind:`status`,text:D(`预设已导出。`)})})}async function V(t){t!==void 0&&await z(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(D(`无法识别此预设。请选择通过“导出预设”生成的文件。`));await R((await e.request({type:`play.import`,name:t.name.replace(/\.play-preset\.json$/iu,``)||D(`导入玩法`),files:n})).preset.id),j({kind:`status`,text:D(`预设已导入为独立副本,JavaScript 默认关闭;信任其内容后可在预设操作中启用。`)})})}return(0,B.jsxs)(`section`,{ref:f,className:`play-preset-screen`,"aria-labelledby":`play-preset-title`,onPointerDownCapture:e=>{for(let t of e.currentTarget.querySelectorAll(Ro))e.target instanceof Node&&!t.contains(e.target)&&(t.open=!1)},onKeyDown:e=>{if(e.key===`Escape`)for(let t of e.currentTarget.querySelectorAll(Ro))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:D(`玩法预设`)}),(0,B.jsx)(`p`,{className:`play-preset-lede`,children:D(`在同一处编辑设定完善方法、主持规则、后置请求与界面展示。`)})]}),(0,B.jsxs)(`div`,{className:`play-preset-header-fact`,children:[(0,B.jsx)(`span`,{children:D(`当前使用的预设`)}),(0,B.jsx)(`strong`,{children:L?.name??D(`未选择`)}),(0,B.jsx)(`small`,{children:D(`游玩在下一次正常发送生效,原样重试保留旧请求`)})]})]}),g?.resourceError&&(0,B.jsx)(Ie,{role:`alert`,className:`play-preset-feedback error`,text:g.resourceError,onDismiss:()=>_(e=>e&&{...e,resourceError:void 0})}),A===null?null:(0,B.jsx)(Ie,{className:`play-preset-feedback ${A.kind}`,role:A.kind===`error`?`alert`:`status`,text:A.text,onDismiss:()=>j(null)}),(0,B.jsxs)(`fieldset`,{disabled:O,className:`play-preset-workspace`,children:[(0,B.jsx)(`legend`,{className:`visually-hidden`,children:D(`玩法预设工作区`)}),(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":D(`玩法预设列表`),children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`visually-hidden`,children:D(`玩法预设`)}),(0,B.jsx)(`select`,{"aria-label":D(`切换预设`),value:m??``,disabled:O||N,onChange:e=>se(e.target.value),children:c.presets.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,B.jsxs)(`details`,{ref:d,children:[(0,B.jsx)(`summary`,{children:D(`预设管理`)}),(0,B.jsxs)(`section`,{className:`play-preset-library-actions`,"aria-label":D(`新建与导入玩法预设`),children:[(0,B.jsx)(`h4`,{children:D(`新建或导入`)}),(0,B.jsx)(`input`,{"aria-label":D(`新玩法预设名称`),placeholder:D(`新玩法预设名称`),value:b,onChange:e=>x(e.currentTarget.value)}),(0,B.jsx)(`button`,{type:`button`,disabled:O||N||b.trim()===``,onClick:()=>void z(async()=>{let t=await e.request({type:`play.create`,name:b.trim()});x(``),await R(t.preset.id),j({kind:`status`,text:D(`已新建普通玩法预设。`)})}),children:D(`新建空白预设`)}),n.map(t=>(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N,onClick:()=>void z(async()=>{await R((await e.request({type:`play.create`,name:t.name,files:structuredClone(t.files)})).preset.id),j({kind:`status`,text:D(`已复制推荐{name},可独立编辑。`,{name:t.label})})}),children:[D(`复制推荐`),t.label]},t.id)),(0,B.jsxs)(`label`,{className:`play-preset-import-control`,children:[D(`导入预设`),(0,B.jsx)(`input`,{"aria-label":D(`选择要导入的预设`),type:`file`,accept:`.json,application/json`,disabled:O||N,onChange:e=>{V(e.currentTarget.files?.[0]),e.currentTarget.value=``}})]})]})]})]}),g!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`play-preset-workspace-nav`,role:`tablist`,"aria-label":D(`玩法预设编辑区域`),children:Fo.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:D(e.label)}),(0,B.jsx)(`span`,{children:D(e.description)})]},e.id))}),(0,B.jsxs)(`details`,{className:`play-preset-operations`,children:[(0,B.jsx)(`summary`,{children:D(`预设操作`)}),(0,B.jsxs)(`div`,{className:`play-preset-operations-content`,children:[(0,B.jsxs)(`label`,{className:`play-preset-name-field`,children:[D(`预设名称`),(0,B.jsx)(`input`,{"aria-label":D(`玩法预设名称`),maxLength:160,value:g.name,onChange:e=>_({...g,name:e.currentTarget.value})})]}),(0,B.jsxs)(`div`,{className:`play-preset-management`,"aria-label":D(`预设操作`),children:[(0,B.jsx)(`p`,{children:D(`这些操作只管理这份本地预设;内容编辑和保存仍在页面底部完成。`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N,onClick:()=>void z(async()=>{await e.request({type:`play.enable`,presetId:g.id,enabled:g.enabled===!1}),await R(g.id),j({kind:`status`,text:D(`玩法预设状态已更新。`)})}),children:g.enabled===!1?D(`启用预设`):D(`停用预设`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N,onClick:()=>void z(async()=>{await e.request({type:`play.scripts`,presetId:g.id,enabled:g.scriptsEnabled!==!0}),await R(g.id),j({kind:`status`,text:g.scriptsEnabled===!0?D(`JavaScript 已关闭;文本、HTML 和样式仍可预览。`):D(`JavaScript 已显式启用(本地可信代码)。`)})}),children:g.scriptsEnabled===!0?D(`停用 JavaScript`):D(`启用 JavaScript(本地可信代码)`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N,onClick:()=>void z(async()=>{await R((await e.request({type:`play.copy`,presetId:g.id})).preset.id),j({kind:`status`,text:D(`已复制为独立预设。`)})}),children:D(`复制为新预设`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N,onClick:()=>void he(),children:D(`导出预设`)}),(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:O||N,onClick:()=>void z(async()=>{await e.request({type:`play.delete`,presetId:g.id}),await R(),j({kind:`status`,text:D(`玩法预设已删除;删空后会自动重建默认预设。`)})}),children:D(`删除预设`)})]}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`导入的 JavaScript 默认停用;启用表示你信任这些本地文件,而不是获得安全沙箱保证。`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`保留的资源`)}),(0,B.jsx)(`p`,{children:D(`未绑定资源仍随预设保存;可在模板编辑器重新引用。`)}),Object.keys(g.files).filter(e=>!P.has(e)&&!F?.get(e)?.declared).map(e=>(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:/^(assets|scripts|renderers|regex)\//u.test(e)?ot(e):Ea(e,g.files[e]??``).title??e.split(`/`).at(-1)}),/^(assets|scripts|renderers|regex)\//u.test(e)&&(0,B.jsx)(`button`,{type:`button`,disabled:!g.structure||F?.get(e)?.declared===!0||(F?.get(e)?.sources.length??0)>0,onClick:()=>pe({type:`delete-resource`,path:e}),children:E()===`zh-CN`?`删除未引用资源`:`Delete unused resource`}),(0,B.jsx)(`textarea`,{"aria-label":e.split(`/`).at(-1),value:g.files[e],onChange:t=>ue(e,t.target.value)})]},e))]})]})]})]})]}),g===null?(0,B.jsx)(`section`,{className:`panel-card`,role:`status`,children:D(`还没有玩法预设。`)}):(0,B.jsxs)(`section`,{className:`panel-card play-preset-editor`,"aria-label":D(`预设编辑器`),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:g.name}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`· 游玩修改在下一次正常发送生效`)})]}),(0,B.jsxs)(`div`,{className:`play-preset-editor-badges`,children:[(0,B.jsx)(`span`,{className:`play-preset-draft-state${N?` dirty`:``}`,children:D(N?`未保存修改`:`已保存`)}),g.id===c.currentPresetId?(0,B.jsx)(`span`,{className:`play-preset-badge current`,children:D(`当前玩法`)}):null,g.enabled===!1?(0,B.jsx)(`span`,{className:`play-preset-badge disabled`,children:D(`已停用`)}):null,(0,B.jsx)(`span`,{className:`play-preset-badge`,children:g.scriptsEnabled===!0?D(`JavaScript 已启用`):D(`JavaScript 已停用`)})]})]}),g.structure&&(w===`call_chain`||w===`setting_improvement`)?(0,B.jsx)(Ma,{structure:g.structure,files:g.files,authoring:w===`setting_improvement`,onChange:fe,onWrite:ue,onResourceEdit:pe,promptPreview:(0,B.jsxs)(`details`,{className:`preset-draft-preview`,children:[(0,B.jsx)(`summary`,{children:D(`发送给 AI 的内容预览`)}),N?(0,B.jsx)(`p`,{children:D(`请先保存当前修改;这里预览的是已保存且校验通过的预设,不包含未保存修改。`)}):s?.({presetId:g.id,revision:g.revision})]}),preview:(t,n)=>t&&n?(0,B.jsx)(No,{client:e,presetId:g.id,revision:g.revision,files:g.files,structure:g.structure,scriptsEnabled:g.scriptsEnabled===!0,requestId:t,output:n},`${t}:${n}`):(0,B.jsx)(Po,{client:e,presetId:g.id,revision:g.revision,files:g.files,structure:g.structure,conflict:ae,scriptsEnabled:g.scriptsEnabled===!0})},`${g.id}:${w}`):null,w===`files`?(0,B.jsx)(Ho,{files:g.files,filePath:v,newFilePath:S,pending:O,onFilePathChange:y,onNewFilePathChange:C,onFileChange:le,onCreateFile:()=>{let e=S.trim();g.files[e]===void 0?(de(t=>({...t,[e]:``})),y(e),C(``),j({kind:`status`,text:D(`已加入修复草稿,保存时将检查预设格式。`)})):j({kind:`error`,text:D(`该玩法文件路径已经存在。`)})}}):null,g.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:D(`结构化编辑暂不可用`)}),(0,B.jsx)(`p`,{children:D(`导入内容无法解析;原文完整保留,可导出或打开原文修复。`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>T(`files`),children:D(`修复导入原文`)})]}):null,(0,B.jsxs)(`footer`,{className:`play-preset-editor-actions`,children:[ae?(0,B.jsx)(`p`,{role:`alert`,className:`workspace-feedback`,children:D(`预设原文与表单均有修改,请先保留一种编辑结果再保存,以免覆盖当前修改。`)}):null,(0,B.jsxs)(`div`,{className:`play-preset-save-state`,children:[(0,B.jsx)(`strong`,{children:N?D(`草稿尚未保存`):g.validation.status===`valid`?D(`预设检查通过`):D(`草稿需要修复`)}),(0,B.jsx)(`span`,{children:g.validation.status===`valid`?D(`· 游玩修改在下一次正常发送生效`):`[${g.validation.code??`play_preset_invalid`}] ${g.validation.location??`call-chain.yaml`}:${g.validation.message}`})]}),(0,B.jsxs)(`div`,{className:`play-preset-primary-actions`,children:[N?(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O,onClick:ce,children:D(`撤销未保存修改`)}):null,(0,B.jsx)(`button`,{type:`button`,disabled:O||!N&&g.structure?.migrationNotice===void 0||ae,onClick:()=>void me(),children:D(`保存修改`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:O||N||g.validation.status!==`valid`,onClick:()=>void z(async()=>{await e.request({type:`play.select`,presetId:g.id}),await R(g.id),j({kind:`status`,text:D(`已应用此预设;游玩修改将在下一次正常发送时生效。`)})}),children:D(`应用为当前玩法`)})]})]})]})]})]})]})}function Bo({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:[Vo(e.contentType),` ·`,n===void 0?D(` 不在页面显示`):` ${Ca(n)}`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:i,children:D(`删除产物`)})]}),(0,B.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,B.jsxs)(`label`,{children:[D(`产物标识`),(0,B.jsx)(`input`,{"aria-label":D(`{name} 产物标识`,{name:e.name}),value:e.name,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,name:t}))}})]}),(0,B.jsxs)(`label`,{children:[D(`内容格式`),(0,B.jsxs)(`select`,{"aria-label":D(`{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:D(`Markdown 文本`)}),(0,B.jsx)(`option`,{value:`text/plain`,children:D(`纯文本`)}),(0,B.jsx)(`option`,{value:`application/json`,children:D(`结构化数据`)}),(0,B.jsx)(`option`,{value:`text/html`,children:`HTML`})]})]}),(0,B.jsxs)(`label`,{children:[D(`同频道已有内容时`),(0,B.jsxs)(`select`,{"aria-label":D(`{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:Oa(`replace`)}),(0,B.jsx)(`option`,{value:`append`,children:Oa(`append`)}),(0,B.jsx)(`option`,{value:`upsert`,children:Oa(`upsert`)}),(0,B.jsx)(`option`,{value:`transient`,children:Oa(`transient`)}),(0,B.jsx)(`option`,{value:`hidden`,children:Oa(`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}))}}),D(`AI 必须生成这项产物`)]})]}),(0,B.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,B.jsx)(`summary`,{children:D(`高级产物设置`)}),(0,B.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,B.jsxs)(`label`,{children:[D(`技术频道地址`),(0,B.jsx)(`input`,{"aria-label":D(`{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:[D(`更新 key`),(0,B.jsx)(`input`,{value:e.key??``,onChange:e=>l(`key`,e.currentTarget.value)})]}):null,(0,B.jsxs)(`label`,{children:[D(`保存到`),(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:Oa(`commit`)}),(0,B.jsx)(`option`,{value:`operation`,children:Oa(`operation`)}),(0,B.jsx)(`option`,{value:`none`,children:Oa(`none`)})]})]}),(0,B.jsxs)(`label`,{children:[D(`何时失效`),(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:Oa(`new_operation`)}),(0,B.jsx)(`option`,{value:`head_change`,children:Oa(`head_change`)}),(0,B.jsx)(`option`,{value:`operation_end`,children:Oa(`operation_end`)}),(0,B.jsx)(`option`,{value:`explicit_clear`,children:Oa(`explicit_clear`)}),(0,B.jsx)(`option`,{value:`never`,children:Oa(`never`)})]})]}),(0,B.jsxs)(`label`,{children:[D(`单次最多输出次数`),(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:[D(`界面模板`),(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:D(`使用内置显示`)}),wa(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:[D(`模板版本标记`),(0,B.jsx)(`input`,{value:e.rendererRevision??``,onChange:e=>l(`rendererRevision`,e.currentTarget.value)})]}),(0,B.jsxs)(`label`,{children:[D(`模板模式`),(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:D(`静态文档`)}),(0,B.jsx)(`option`,{value:`app`,children:D(`可交互 app`)})]})]})]}),(0,B.jsxs)(`label`,{children:[D(`正则处理规则`),(0,B.jsxs)(`select`,{value:e.regex??``,onChange:e=>l(`regex`,e.currentTarget.value),children:[(0,B.jsx)(`option`,{value:``,children:D(`不使用`)}),wa(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:D(`脚本`)}),(0,B.jsx)(Aa,{ariaLabel:D(`{name} 脚本`,{name:e.name}),paths:s,selected:e.scripts??[],emptyText:D(`没有脚本文件。`),onChange:e=>u(`scripts`,e)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h6`,{children:D(`样式与资源`)}),(0,B.jsx)(Aa,{ariaLabel:D(`{name} 资源`,{name:e.name}),paths:c,selected:e.assets??[],emptyText:D(`没有资源文件。`),onChange:e=>u(`assets`,e)})]})]}),e.payloadContract===void 0?null:(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`当前严格数据格式(只读)`)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`这里显示此产物的数据要求。需要修改时,请在当前内容包或世界修订的文件编辑中修改 control/followups.yaml 的对应产物声明。`)}),(0,B.jsx)(`pre`,{children:JSON.stringify(e.payloadContract,null,2)})]})]})]})}function Vo(e){return{"text/plain":D(`纯文本`),"text/markdown":`Markdown`,"application/json":D(`结构化数据`),"text/html":`HTML`}[e]}function Ho({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=Ea(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:D(`完整预设文件`)})]}),(0,B.jsx)(`p`,{children:D(`常用设置应在前面的表单完成。这里保留完整 YAML、Markdown、HTML、脚本和样式,并说明每份文件负责什么。`)})]}),(0,B.jsx)(`div`,{className:`play-preset-yaml-guide`,"aria-label":D(`三个核心 YAML 文件的用途`),children:[Ea(`preset.yaml`,e[`preset.yaml`]??``),Ea(`call-chain.yaml`,e[`call-chain.yaml`]??``),Ea(`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:[D(`快速跳转文件`),(0,B.jsx)(`select`,{"aria-label":D(`玩法预设文件`),value:l,onChange:e=>i(e.currentTarget.value),children:c.map(t=>(0,B.jsxs)(`option`,{value:t,children:[Ea(t,e[t]??``).title,` · `,t]},t))})]}),(0,B.jsxs)(`div`,{className:`play-preset-file-browser`,children:[(0,B.jsx)(`aside`,{"aria-label":D(`玩法预设文件列表`),children:(0,B.jsx)(`ul`,{children:c.map(t=>{let n=Ea(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":D(`打开玩法文件 {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:D(`完整文件内容`)}),(0,B.jsx)(`textarea`,{"aria-label":D(`编辑玩法文件 {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:D(`新增修复文件`)}),(0,B.jsxs)(`div`,{className:`play-preset-file-add`,children:[(0,B.jsxs)(`label`,{children:[D(`新文件路径(prompt/regex/renderer/script/asset)`),(0,B.jsx)(`input`,{"aria-label":D(`新增玩法文件路径`),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:D(`加入文件草稿`)})]})]})]})}function Uo(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 Wo({report:e}){if(e===void 0)return null;let t=E(),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`,`:`,` `,Uo(e.lastBodyWrite,t)]}),(0,B.jsxs)(`p`,{children:[n?`元信息`:`Metadata`,`:`,` `,Uo(e.lastMetadataWrite,t)]})]},e.shortRef))]})]})}var Go={runtime_system:{title:`Runtime 系统`,description:`权威、真实工具与提交边界,由 Runtime 固定提供。`},author_instruction:{title:`创作指令`,description:`当前主持预设、世界专属创作政策与玩法叙事规则。`},world_context:{title:`世界上下文`,description:`真实 slot 展开、材料覆盖和当前世界正文。`},player_input:{title:`玩家原文`,description:`本次预览显式使用的动态玩家输入。`}},Ko={chat_completions:`Chat Completions`,openai_responses:`OpenAI Responses`,anthropic_messages:`Anthropic Messages`},qo={resolved:`已提供`,optional_missing:`可选未证明完整`,paged_catalog:`分页目录`},Jo={current_situation:`当前情境`,additional_materials:`附加材料`,catalog:`材料目录`,reference_targets:`引用目标`,history:`最近叙事`};function Yo({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)(D(`我观察当前场景。`)),[m,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(null),C=(0,l.useRef)(0),w=t.find(e=>e.localId===u),T=r?.presets.find(({id:e})=>e===(o?.presetId??r.currentPresetId)),O=T,k=i.connections.find(({id:e})=>e===i.activeConnectionId),A=w?.status===`usable`&&T?.validation.status===`valid`&&k!==void 0&&f.trim().length>0;function j(){C.current+=1,b(!1),v(null),S(null)}async function M(){if(!A||k===void 0)return;let t=C.current+1;C.current=t,b(!0),S(null);try{let n=await e.request({type:`prompt.preview`,packageId:u,playerInput:f.trim(),...m.trim()===``?{}:{turnNote:m.trim()},model:ss(k),...r===void 0?{}:{playPresetId:o?.presetId??r.currentPresetId,...o===void 0?{}:{playPresetRevision:o.revision}}});if(C.current!==t)return;v(n),S({kind:`status`,text:D(`真实编译已完成;没有调用模型,也没有改变内容或世界。`)})}catch(e){if(C.current!==t)return;v(null),S({kind:`error`,text:ds(e)})}finally{C.current===t&&b(!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:D(`全新上下文会发送什么`)}):(0,B.jsx)(`h2`,{id:`prompt-preview-title`,children:D(`提示词预览`)}),(0,B.jsxs)(`span`,{className:`prompt-preview-readonly`,"aria-label":D(`预览性质`),title:D(`不会创建对话或写入权威状态`),children:[(0,B.jsx)(`span`,{children:D(`只读检查`)}),(0,B.jsx)(`span`,{children:D(`0 次模型调用`)})]})]}),(0,B.jsx)(`p`,{className:`prompt-preview-lede`,children:D(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:D(`决定这次检查什么`)}),(0,B.jsx)(`p`,{className:`prompt-preview-context`,children:D(`内容包首轮 · 全新上下文`)}),t.length===0?(0,B.jsx)(`p`,{className:`prompt-preview-empty`,role:`status`,children:D(`还没有内容包。先新建并修好一份内容包,才能编译真实提示词。`)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`prompt-preview-package-field`,children:[D(`内容包`),(0,B.jsx)(`select`,{"aria-label":D(`预览内容包`),value:u,onChange:e=>{let t=e.currentTarget.value;d(t),a(t),j()},children:t.map(e=>(0,B.jsxs)(`option`,{value:e.localId,children:[e.title,e.status===`usable`?``:D(` · 需要修复`)]},e.localId))})]}),w===void 0?null:(0,B.jsx)(`p`,{className:`prompt-preview-gameplay`,children:h(w.gameplay,E())}),(0,B.jsxs)(`label`,{className:`prompt-preview-player-field`,children:[D(`预览玩家输入`),(0,B.jsx)(`textarea`,{"aria-label":D(`预览玩家输入`),value:f,onChange:e=>{p(e.currentTarget.value),j()}}),(0,B.jsx)(`span`,{className:`field-note`,children:D(`这段原文只进入本次预览,不会写入历史,也不会成为真实玩家行动。`)})]}),(0,B.jsxs)(`label`,{className:`prompt-preview-player-field`,children:[D(`本轮临时要求`),(0,B.jsx)(`input`,{type:`text`,value:m,placeholder:D(`只对这一轮生效,不进入故事`),onChange:e=>{g(e.currentTarget.value.replace(/[\r\n]/gu,``)),j()}})]}),w?.status===`needs_repair`?(0,B.jsx)(`p`,{className:`prompt-preview-blocker`,role:`status`,children:D(`这份内容包仍需修复;真实首轮预览要求有效的 opening.md、世界文档和控制框架。`)}):null,(0,B.jsx)(`button`,{disabled:!A||y,onClick:()=>void M(),type:`button`,children:D(y?`正在编译真实预览…`:_===null?`生成真实预览`:`重新生成真实预览`)})]}),x===null?null:(0,B.jsx)(`p`,{role:x.kind===`error`?`alert`:`status`,children:x.text})]}),(0,B.jsxs)(`details`,{className:`preview-bindings-disclosure`,children:[(0,B.jsx)(`summary`,{children:D(`当前配置与编译边界`)}),(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:D(`本次固定绑定`)}),(0,B.jsxs)(`dl`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`主持预设`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:T?.name??D(`没有当前预设`)}),(0,B.jsx)(`span`,{children:D(`工作区当前选择`)})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`模型连接`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:k?.name??D(`没有当前模型`)}),(0,B.jsx)(`span`,{children:k===void 0?D(`请先配置并启用模型`):`${k.modelId} · ${Ko[k.provider]}`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`模型窗口`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:k===void 0?`—`:`${cs(k.contextWindowTokens)} tokens`}),(0,B.jsx)(`span`,{children:k===void 0?`—`:D(`最大输出 {count}`,{count:cs(k.maxOutputTokens)})})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`开场白边界`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:D(`不作为模型历史注入`)}),(0,B.jsx)(`span`,{children:D(`opening.md 只保留为玩家可见的 genesis 叙事`)})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`玩法预设`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:O?.name??`default`}),(0,B.jsx)(`span`,{children:O===void 0?D(`使用内置玩法的完整工具集合`):`revision ${o?.revision??O.revision}`})]})]})]})]})]})]}),_===null?(0,B.jsx)(`section`,{className:`prompt-preview-waiting`,"aria-label":D(`等待生成预览`),children:(0,B.jsx)(`p`,{children:D(`生成预览后,在这里查看实际发送的消息、材料与工具。`)})}):(0,B.jsx)(Xo,{preview:_,packageName:w?.title??u,hostName:T?.name??D(`未知预设`),modelName:k?.name??_.diagnosticBinding.modelId})]})}function Xo({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:D(`编译通过`)}),(0,B.jsxs)(`p`,{children:[t,` · `,n,` · `,r]})]}),(0,B.jsxs)(`div`,{className:`prompt-preview-pass-badges`,"aria-label":D(`编译检查结果`),children:[(0,B.jsx)(`span`,{children:D(s?`Runtime 不预估上下文`:`预算可容纳`)}),(0,B.jsx)(`span`,{children:D(`内部字段无泄漏`)}),(0,B.jsx)(`span`,{children:D(`权威状态未改变`)})]})]}),(0,B.jsxs)(`dl`,{className:`prompt-preview-summary`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`逻辑消息`)}),(0,B.jsx)(`dd`,{children:o.logicalMessages.length}),(0,B.jsxs)(`small`,{children:[D(`稳定 bootstrap`),e.initialAppend===void 0?``:D(`;另有 1 条玩家追加`),e.initialAppend?.afterPlayer===void 0?``:D(`与 1 条本轮提示`)]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`真实工具`)}),(0,B.jsx)(`dd`,{children:o.tools.length}),(0,B.jsx)(`small`,{children:D(`生产调用链全集`)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(s?`上下文检查`:`所需上下文`)}),(0,B.jsx)(`dd`,{children:s?D(`由 Provider 判断`):cs(o.budget.requiredTokens)}),(0,B.jsx)(`small`,{children:s?D(`Runtime 不据此拦截请求`):`/ ${cs(o.budget.contextWindowTokens)} tokens`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(s?`窗口配置`:`窗口占用`)}),(0,B.jsx)(`dd`,{children:s?cs(o.budget.contextWindowTokens):`${c}%`}),s?(0,B.jsx)(`small`,{children:`tokens · Provider binding`}):(0,B.jsx)(`progress`,{"aria-label":D(`上下文窗口占用`),max:o.budget.contextWindowTokens,value:o.budget.requiredTokens})]})]})]}),(0,B.jsxs)(`nav`,{className:`prompt-preview-nav`,"aria-label":D(`预览结果分区`),children:[(0,B.jsx)($o,{active:i===`messages`,count:o.logicalMessages.length,label:D(`逻辑消息`),onClick:()=>a(`messages`)}),e.playPreset===void 0?null:(0,B.jsx)($o,{active:i===`callChain`,count:e.playPreset.toolUniverse.length,label:D(`玩法绑定`),onClick:()=>a(`callChain`)}),(0,B.jsx)($o,{active:i===`materials`,count:o.coverage.length+o.tools.length,label:D(`材料与工具`),onClick:()=>a(`materials`)}),(0,B.jsx)($o,{active:i===`provider`,count:o.provider.messages.length+(e.initialAppend===void 0?0:1)+(e.initialAppend?.afterPlayer===void 0?0:1),label:D(`Provider 映射`),onClick:()=>a(`provider`)}),(0,B.jsx)($o,{active:i===`diagnostics`,count:4,label:D(`预算与诊断`),onClick:()=>a(`diagnostics`)})]}),i===`messages`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ns,{messages:o.logicalMessages}),e.initialAppend===void 0?null:(0,B.jsx)(Zo,{append:e.initialAppend}),(0,B.jsx)(es,{turnGuide:o.turnGuide})]}):null,i===`callChain`&&e.playPreset!==void 0?(0,B.jsx)(Qo,{callChain:e.playPreset}):null,i===`materials`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Wo,{report:o.maintenance}),(0,B.jsx)(rs,{coverage:o.coverage,tools:o.tools})]}):null,i===`provider`?(0,B.jsx)(is,{provider:o.provider,initialAppend:e.initialAppend,wireRequest:e.wireRequest}):null,i===`diagnostics`?(0,B.jsx)(os,{preview:e}):null]})}function Zo({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:D(`首条玩家追加`)})]}),(0,B.jsx)(`p`,{children:D(`稳定 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:D(`玩家输入前的回合提示`)}),(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})]}),e.afterPlayer===void 0?null:(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:D(`玩家输入后的本轮提示`)}),(0,B.jsx)(`span`,{children:e.afterPlayer.provider.role})]}),(0,B.jsx)(`pre`,{children:e.afterPlayer.provider.content})]})]})})]})}function Qo({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:D(`玩法绑定与调用链工具`)})]}),(0,B.jsxs)(`p`,{children:[e.name,` · `,e.revision,` `,D(`· 叙事规则进入稳定 bootstrap, 后置请求在主调用链完成后独立派发。`)]})]}),(0,B.jsxs)(`dl`,{className:`prompt-binding-details`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`玩法文件`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`code`,{children:e.callChainPath}),(0,B.jsx)(`span`,{children:D(`冻结工具、叙事规则与后置产物契约`)})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`工具全集`)}),(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:D(`Provider 工具策略`)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`code`,{children:e.toolStrategy??`runtime_gate`}),(0,B.jsx)(`span`,{children:D(`definitions:稳定全集`)})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`稳定前缀`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:e.cache.stablePrefixFingerprint})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`频道挂载`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:e.mounts.length===0?D(`无`):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:D(`稳定 bootstrap`)}),(0,B.jsx)(`p`,{children:D(`全新上下文发送这份稳定前缀;玩家原文随后作为普通消息追加。Runtime 不再插入裁决、叙事或结算 delta。`)})]}),(0,B.jsxs)(`span`,{children:[e.bootstrap.logicalMessages.length,` `,D(`条逻辑消息`)]})]}),(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:[D(`调用链可用工具:`),(0,B.jsx)(`strong`,{children:e.toolUniverse.length}),` `,D(`· 后置请求:`),(0,B.jsx)(`strong`,{children:e.followups.length})]})]})}function $o({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 es({turnGuide:e}){return e===void 0?null:(0,B.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`turn-guide-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:`PER-SEND SUFFIX`}),(0,B.jsx)(`h3`,{id:`turn-guide-title`,children:D(`本轮提示`)})]}),(0,B.jsx)(`p`,{children:D(`每次发送追加在原生对话末尾,由已启用条目的尾部行按编排顺序拼成;它只属于本次请求,不进入历史、Authority 或回合计数。`)})]}),(0,B.jsx)(`ol`,{className:`turn-guide-lines`,"aria-label":D(`本轮提示各行来源`),children:e.lines.map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{children:e.text}),(0,B.jsx)(`code`,{children:e.source})]},t))}),(0,B.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,B.jsx)(`summary`,{children:D(`查看发送的完整本轮提示`)}),(0,B.jsx)(`pre`,{children:e.text})]})]})}function ts({turnGuide:e}){if(e===void 0)return null;let t=Ct(e.lines);return t.length===0?null:(0,B.jsxs)(`section`,{className:`prompt-leakage-report turn-guide-warnings`,role:`alert`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`!`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{children:D(`本轮提示超出软上限`)}),(0,B.jsx)(`p`,{children:D(`单行建议不超过 120 字、总行数不超过 10;超出不阻止编译,但尾部正在接近前部规则的体量。`)})]})]}),(0,B.jsx)(`ul`,{children:t.map((t,n)=>(0,B.jsx)(`li`,{children:t.kind===`line_count`?D(`共 {count} 行`,{count:e.lines.length}):D(`第 {index} 行超过 120 字`,{index:(t.index??0)+1})},n))})]})}function ns({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:D(`这次编译没有逻辑消息。`)}):(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:D(`逻辑消息与最终 Markdown`)})]}),(0,B.jsx)(`p`,{children:D(`这里先保留产品逻辑 role;Provider 如何映射在下一分区单独展示。`)})]}),(0,B.jsxs)(`div`,{className:`prompt-message-layout`,children:[(0,B.jsx)(`ol`,{className:`prompt-message-index`,"aria-label":D(`逻辑消息顺序`),children:e.map((e,t)=>{let i=Go[e.role];return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{"aria-label":D(`打开第 {index} 条逻辑消息:{title}`,{index:t+1,title:D(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:D(i.title)}),(0,B.jsx)(`code`,{children:e.role})]}),(0,B.jsxs)(`small`,{children:[e.blocks.length,` `,D(`块`)]})]})},`${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:D(Go[r.role].title)}),(0,B.jsx)(`p`,{children:D(Go[r.role].description)})]}),(0,B.jsxs)(`span`,{children:[cs(r.markdown.length),` `,D(`字符`)]})]}),(0,B.jsx)(`div`,{className:`prompt-message-sources`,"aria-label":D(`消息块来源`),children:r.blocks.map((e,t)=>(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`span`,{children:[D(`块`),String(t+1).padStart(2,`0`)]}),(0,B.jsx)(`code`,{children:e.source}),(0,B.jsxs)(`small`,{children:[cs(e.markdown.length),` `,D(`字符`)]})]},`${e.source}:${t}`))}),(0,B.jsxs)(`div`,{className:`prompt-message-body`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(`最终 Markdown 正文`)}),(0,B.jsx)(`span`,{children:D(`块之间已按真实编译顺序合并`)})]}),(0,B.jsx)(`pre`,{children:r.markdown})]})]})]})]})}function rs({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:D(`材料覆盖与调用链工具`)})]}),(0,B.jsx)(`p`,{children:D(`来源由真实 slot 展开;未提供边界和可继续读取入口不会被隐藏。`)})]}),(0,B.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,B.jsx)(`h4`,{children:D(`Slot 覆盖`)}),(0,B.jsxs)(`span`,{children:[e.length,` `,D(`项`)]})]}),(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:D(qo[e.status])}),(0,B.jsx)(`strong`,{children:D(Jo[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?D(`来源完整`):D(`来源尚未完整`)}),(0,B.jsx)(`span`,{children:e.continuation===null?D(`无需继续读取`):D(`可继续:{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:D(`本次真实工具`)}),(0,B.jsx)(`p`,{children:n.length>0?D(`按需读取入口:{tools}`,{tools:n.map(({name:e})=>e).join(` / `)}):D(`本次没有按需读取工具。`)})]}),(0,B.jsxs)(`span`,{children:[t.length,` `,D(`个`)]})]}),(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:D(`查看说明与 input schema`)})]}),(0,B.jsx)(`p`,{children:e.description}),(0,B.jsx)(`pre`,{children:JSON.stringify(e.inputSchema,null,2)})]})},e.name))})]})}function is({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:D(`Provider 映射 · {provider}`,{provider:Ko[e.protocol]})})]}),(0,B.jsx)(`p`,{children:D(`展示编译器交给当前 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,` `,D(`块`)]})]}),(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:D(`消息角色与顺序`)}),(0,B.jsxs)(`span`,{children:[e.messages.length,` `,D(`条 bootstrap`),t===void 0?``:D(` + 1 条玩家追加`),t?.beforePlayer===void 0?``:D(` + 1 条回合提示`),t?.afterPlayer===void 0?``:D(` + 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)(as,{content:e.content})]},t))}),t?.beforePlayer===void 0?null:(0,B.jsxs)(`div`,{className:`provider-message`,children:[(0,B.jsx)(`strong`,{children:D(`玩家输入前的回合提示`)}),(0,B.jsx)(as,{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:D(`紧随 bootstrap 的首条追加`)}),(0,B.jsx)(`span`,{children:D(`原样发送`)})]}),(0,B.jsxs)(`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)(as,{content:t.provider.content})]}),t.afterPlayer===void 0?null:(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`span`,{children:`turn_guide`}),(0,B.jsx)(`strong`,{children:t.afterPlayer.provider.role})]}),(0,B.jsx)(as,{content:t.afterPlayer.provider.content})]})]})]})]}),(0,B.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,B.jsx)(`summary`,{children:D(`查看 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:D(`查看实际 HTTP 请求(凭据已省略)`)}),(0,B.jsx)(`pre`,{children:JSON.stringify(n,null,2)})]})]})}function as({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:us(e)})]}),(0,B.jsx)(`pre`,{children:ls(e)?e.text:JSON.stringify(e,null,2)})]},t))}):(0,B.jsx)(`pre`,{children:JSON.stringify(e,null,2)})}function os({preview:e}){let{budget:t,cache:n}=e.compilation,r=t.estimator===`disabled`||t.status===`not_checked`,i=[[D(`消息正文`),t.messageTokens],[D(`工具定义`),t.toolTokens],[D(`本地输出预留`),t.outputReserveTokens],[D(`本地尾部预留`),t.forcedTailReserveTokens],[D(`安全余量`),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:D(`预算与诊断`)})]}),(0,B.jsx)(`p`,{children:D(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:D(`上下文预算`)}),(0,B.jsx)(`span`,{children:r?D(`由 Provider 判断`):t.status===`fits`?D(`可容纳`):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:D(`Provider 窗口配置`)}),(0,B.jsxs)(`dd`,{children:[cs(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:[cs(t),` tokens`]})]},e)),(0,B.jsxs)(`div`,{className:`prompt-budget-total`,children:[(0,B.jsx)(`dt`,{children:D(`合计 / 模型窗口`)}),(0,B.jsxs)(`dd`,{children:[cs(t.requiredTokens),` /`,` `,cs(t.contextWindowTokens),` tokens`]})]})]}),(0,B.jsxs)(`p`,{className:`field-note`,children:[D(`估算器:`),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:D(`稳定前缀与缓存`)}),(0,B.jsxs)(`span`,{children:[cs(n.estimatedCacheableBytes),` `,D(`字节`)]})]}),(0,B.jsxs)(`dl`,{className:`prompt-cache-report`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`稳定前缀 fingerprint`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:n.stablePrefixFingerprint})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`缓存策略`)}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(`code`,{children:n.strategy})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`缓存断点`)}),(0,B.jsx)(`dd`,{className:`prompt-cache-breakpoints`,children:n.breakpoints.length===0?D(`由 Provider 管理,无显式断点`):n.breakpoints.map(e=>(0,B.jsx)(`code`,{children:e},e))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`首个动态边界`)}),(0,B.jsx)(`dd`,{children:cs(n.firstDynamicByte)})]})]})]})]}),(0,B.jsx)(ts,{turnGuide:e.compilation.turnGuide}),(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:D(`内部字段泄漏扫描通过`)}),(0,B.jsx)(`p`,{children:D(`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:D(`查看固定诊断绑定与完整原始结果`)}),(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 ss(e){return{provider:e.provider,modelId:e.modelId,contextWindowTokens:e.contextWindowTokens,maxOutputTokens:e.maxOutputTokens}}function cs(e){return new Intl.NumberFormat(E()).format(e)}function ls(e){return typeof e==`object`&&!!e&&`text`in e&&typeof e.text==`string`}function us(e){return typeof e==`object`&&e&&`type`in e&&typeof e.type==`string`?e.type:`raw`}function ds(e){return e instanceof Error?e.message:D(`真实提示词编译失败`)}function fs({requests:e,onPreview:t}){let n=E()===`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)(ps,{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)(ps,{compilation:e.compilation})]},`${e.legacyBootstrap?`legacy:`:``}${e.requestId}`))]})]})}function ps({compilation:e}){let t=E()===`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)})]})]})}var ms=`(hover: none) and (pointer: coarse)`;function hs(){return globalThis.matchMedia?.(ms).matches??!1}function gs(e){let t=globalThis.matchMedia?.(ms);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)}function _s(e,t){let n=(0,l.useSyncExternalStore)(gs,hs,()=>!1),r=(0,l.useRef)(!1),i=async()=>{if(e&&!r.current){r.current=!0;try{await t()}finally{r.current=!1}}};return{submit:i,onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||n&&!e.ctrlKey&&!e.metaKey||e.nativeEvent.isComposing||e.keyCode===229||(e.preventDefault(),e.repeat||i())},enterInsertsNewline:n}}function vs({definitions:e,items:t,onItemsChange:n,onClone:r,renderUser:i}){let a=t??Ze(e),[o,s]=(0,l.useState)(),c=a.find(e=>e.id===o)??a.find(e=>e.kind===`user`)??a[0],u=Qe(E());function d(t){return t.kind===`builtin`?u.definition.displayName:t.kind===`content-package`?D(`内容包后置请求`):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":D(`后置请求`),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":`${D(`启用`)} ${d(e)}`,checked:e.enabled,onChange:t=>n(a.map(n=>n.id===e.id?{...n,enabled:t.currentTarget.checked}:n))}),D(`启用`)]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${D(`上移`)} ${d(e)}`,disabled:t===0,onClick:()=>f(e.id,t-1),children:`↑`}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${D(`下移`)} ${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:D(`系统示例只读;新运行使用应用最新版,克隆后独立保存。`)}),(0,B.jsx)(`textarea`,{"aria-label":D(`系统后置提示词`),readOnly:!0,value:u.body,rows:8}),(0,B.jsx)(`p`,{children:D(`界面产物:场景回顾,Markdown,剧情内容区;保存到提交,替换上一份,显式清除。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(u.definition,u.body),children:D(`克隆后置请求`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{children:D(`内容包后置请求`)}),(0,B.jsx)(`p`,{children:D(`在此位置展开当前世界的内容包后置请求。无声明时为空组,不调用模型;正文由内容包管理。`)})]})})]})}function ys({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.
1373
+ `},{kind:`assets`,label:`样式与资源`,paths:r??[],directory:`assets`,suffix:`css`,initial:`body { font-family: sans-serif; }
1374
+ `}];return(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`编辑渲染资源`)}),o.map(t=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h6`,{children:D(t.label)}),t.kind===`scripts`?(0,B.jsx)(`p`,{children:D(`JavaScript 仅在 app 模式且已允许脚本时运行。`)}):null,t.paths.map((n,r)=>(0,B.jsxs)(`label`,{children:[D(t.label),` `,r+1,(0,B.jsx)(`textarea`,{"aria-label":`${D(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-${Xe()}.${t.suffix}`,t.initial),children:[D(`添加`),` `,D(t.label)]})]},t.kind))]})}var bs=`control/followups.yaml`;function xs({files:e,onChange:t}){let[n,r]=(0,l.useState)(!1),i=Cs(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])),[bs]:ma({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:D(`内容包后置请求`)}),n?i.kind===`invalid`?(0,B.jsx)(`p`,{role:`alert`,children:D(`后置声明无法编辑,请在文件编辑中修复后重试。`)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:D(`主剧情完成后按此顺序生成额外内容。关闭保留提示和资源;创建世界后独立保存,后续修改需通过世界修订应用。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let e=`followup_${Xe().replaceAll(`-`,``)}`,t=`prompts/${e}.md`;o([...i.requests,{id:e,displayName:D(`新后置请求`),enabled:!0,mount:`story`,prompt:{role:`author_instruction`,path:t},artifacts:[Ss(`output_1`,`${e}.output_1`)],maxArtifactBytes:32768}],{[t]:D(`根据已完成的剧情,通过 artifact_emit 输出 output_1。`)})},children:D(`新增包后置请求`)}),(0,B.jsx)(vs,{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:[D(`包请求名称`),(0,B.jsx)(`input`,{value:t.displayName,onChange:e=>s(t.id,t=>({...t,displayName:e.target.value}))})]}),(0,B.jsxs)(`label`,{children:[D(`包请求提示词`),(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:[D(`包请求显示位置`),(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:D(`故事正文`)}),(0,B.jsx)(`option`,{value:`sidebar`,children:D(`侧栏`)}),(0,B.jsx)(`option`,{value:`composer_above`,children:D(`输入框上方`)}),(0,B.jsx)(`option`,{value:`composer_below`,children:D(`输入框下方`)}),(0,B.jsx)(`option`,{value:`overlay`,children:D(`浮层`)}),(0,B.jsx)(`option`,{value:`debug`,children:D(`调试区`)})]})]}),t.artifacts.map((e,n)=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(Bo,{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)(ys,{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,Ss(n,`${e.id}.${n}`)]}))},children:D(`新增产物`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`高级请求设置`)}),(0,B.jsxs)(`label`,{children:[D(`稳定请求身份`),(0,B.jsx)(`input`,{readOnly:!0,value:t.id})]}),(0,B.jsxs)(`label`,{children:[D(`产物字节上限`),(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:D(`删除请求`)})]})}})]}):null]})}function Ss(e,t){return{name:e,channel:t,strategy:`replace`,contentType:`text/markdown`,rendererMode:`document`,save:`commit`,invalidation:`explicit_clear`,required:!1,maxEmits:1}}function Cs(e){let t=e.find(e=>e.path===bs);if(t===void 0)return{kind:`valid`,requests:[]};try{if(t.encoding!==void 0)throw Error(`Binary declaration`);let e=fa(t.contents,{uniqueKeys:!0});if(e.errors.length)throw Error(`Invalid YAML`);let n=e.toJS({maxAliasCount:0});if(!ws(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(!ws(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)||!ws(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(!ws(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 ws(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ts=`narraeon.world-frame/v1`;function Es(e){return`@${e.ref}`}function Ds(e,t){return t.startsWith(`@`)?e.find(({ref:e})=>e===t.slice(1)):e.find(({id:e})=>e===t)}function Os(e,t){let n=e=>{if(typeof e!=`string`||e.length===0)return;let n=Ds(t,e);return n===void 0?void 0:Es(n)};if(sc(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(!sc(t)||!sc(t.slot))continue;let e=n(t.slot.document);if(e!==void 0&&(t.slot.document=e),!sc(t.slot.from))continue;let r=n(t.slot.from.document);r!==void 0&&(t.slot.from.document=r)}}var ks=[{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 As({contents:e,files:t,dirty:n,onChange:r,onSave:i}){let a=(0,l.useMemo)(()=>zs(e),[e]),o=(0,l.useMemo)(()=>Hs(t),[t]),s=(0,l.useMemo)(()=>Us(t),[t]),c=(0,l.useMemo)(()=>Ws(o),[o]),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(`document`),m=a.value,h=m===null?null:Bs(m),g=m===null?null:Vs(m),_=m!==null&&sc(m.bindings)?oc(m.bindings.currentSituation):``,v=Ds(o,_),y=s.filter(({path:e})=>!h?.some(t=>t.markdown===e)),b=y.some(({path:e})=>e===u)?u:y[0]?.path??``,x=nc(g,`current_situation`),S=nc(g,`additional_materials`),C=m!==null&&h!==null&&g!==null,w=$s(f,o,c),T=e=>{if(m===null)return;let t=structuredClone(m);e(t),Os(t,o),r(ma(t,{lineWidth:0}))},E=e=>{T(t=>{t.instructions=e})},O=e=>{T(t=>{t.context=e})},k=e=>{if(g===null)return;let t={slot:{kind:e}};O(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:D(`可视化编排`)}),(0,B.jsx)(`h5`,{id:`world-frame-editor-title`,children:D(`世界提示框架`)}),(0,B.jsx)(`p`,{children:D(`安排世界专属指令与确定性材料位置;这里不保存人物、地点或当前事实。`)})]}),(0,B.jsxs)(`div`,{className:`world-frame-status`,"aria-label":D(`世界提示框架草稿状态`),children:[(0,B.jsx)(`span`,{className:m?.format===Ts?`valid`:`invalid`,children:m?.format===Ts?D(`V1 格式`):D(`格式待修复`)}),(0,B.jsx)(`span`,{className:C?`valid`:`invalid`,children:D(C?`可视化已同步`:`仅可编辑 YAML`)})]})]}),m===null?(0,B.jsxs)(`div`,{className:`world-frame-parse-error`,role:`alert`,children:[(0,B.jsx)(`strong`,{children:D(`当前 YAML 暂时无法可视化`)}),(0,B.jsx)(`p`,{children:a.error}),(0,B.jsx)(`span`,{children:D(`下面的高级编辑器会原样保留草稿;修复后可视化页面会自动恢复。`)})]}):(0,B.jsxs)(B.Fragment,{children:[m.format!==Ts&&(0,B.jsxs)(`div`,{className:`world-frame-repair-callout`,role:`note`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(`format 不是当前世界框架版本`)}),(0,B.jsxs)(`span`,{children:[D(`Runtime 只接受`),Ts,`。`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>T(e=>{e.format=Ts}),children:D(`修复为 V1 格式`)})]}),(0,B.jsxs)(`div`,{className:`world-frame-flow`,"aria-label":D(`世界提示框架流程`),children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:D(`Markdown 提示块`)}),(0,B.jsxs)(`strong`,{children:[h?.length??`?`,` `,D(`份世界指令`)]})]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:D(`进入逻辑 role`)}),(0,B.jsx)(`strong`,{children:`author_instruction`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:D(`精确文档与目录`)}),(0,B.jsxs)(`strong`,{children:[g?.length??`?`,` `,D(`个材料插槽`)]})]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{children:D(`进入逻辑 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:D(`01 · 权威绑定`)}),(0,B.jsx)(`h6`,{id:`world-frame-binding-title`,children:D(`当前情境绑定`)})]}),(0,B.jsx)(`span`,{className:v===void 0?`world-frame-section-state invalid`:`world-frame-section-state valid`,children:D(v===void 0?`未解析`:`已解析`)})]}),(0,B.jsx)(`p`,{children:D("`current_situation` 插槽会从这里读取唯一当前情境文档,不按文件名或标题猜测。")}),(0,B.jsxs)(`label`,{children:[D(`当前情境文档`),(0,B.jsxs)(`select`,{value:v===void 0?_:Es(v),onChange:e=>{let t=e.currentTarget.value;T(e=>{e.bindings={currentSituation:t}})},children:[(0,B.jsx)(`option`,{value:``,children:D(`选择一份世界文档`)}),_.length>0&&Ds(o,_)===void 0&&(0,B.jsxs)(`option`,{value:_,children:[_,D(`(当前未解析)`)]}),o.map(e=>(0,B.jsxs)(`option`,{value:Es(e),children:[e.title,` · `,Es(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:D(`02 · 世界专属指令`)}),(0,B.jsx)(`h6`,{id:`world-frame-instructions-title`,children:D(`提示块顺序`)})]}),(0,B.jsxs)(`span`,{className:`world-frame-section-state`,children:[h?.length??0,` `,D(`个块`)]})]}),(0,B.jsx)(`p`,{children:D(`这些 Markdown 块按顺序进入主持预设预留的世界指令位置;正文仍在独立文件中编辑。每项可附一行尾部提示,或只保留尾部提示:它们在每次游玩发送追加的本轮提示中占据世界位置,只放本世界特有且最容易丢的约束。`)}),h===null?(0,B.jsx)(Rs,{name:`instructions`,onReset:()=>T(e=>{e.instructions=[]})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`ol`,{className:`world-frame-order-list`,"aria-label":D(`世界指令顺序`),children:h.map((e,t)=>{let n=e.markdown===void 0?void 0:s.find(({path:t})=>t===e.markdown),r=n?.title??e.markdown??D(`独立尾部行`),i=e=>E(h.map((n,r)=>{if(r!==t)return n;let i={...n};return e===``&&n.markdown!==void 0?delete i.turnGuide:i.turnGuide=e,i}));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}),e.markdown===void 0?null:(0,B.jsx)(`code`,{children:e.markdown}),e.markdown!==void 0&&n===void 0&&(0,B.jsx)(`span`,{children:D(`引用的文件不存在`)}),(0,B.jsxs)(`label`,{className:`world-frame-turn-guide`,children:[D(`尾部提示`),(0,B.jsx)(`input`,{"aria-label":D(`尾部提示 {title}`,{title:r}),value:e.turnGuide??``,placeholder:D(`留空则本项不进入本轮提示`),onChange:e=>i(e.currentTarget.value)})]})]}),(0,B.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,B.jsx)(`span`,{children:D(`调整顺序`)}),(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":D(`上移 {title}`,{title:r}),disabled:t===0,onClick:()=>E(ac(h,t,t-1)),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,D(`上移`)]}),(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":D(`下移 {title}`,{title:r}),disabled:t===h.length-1,onClick:()=>E(ac(h,t,t+1)),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,D(`下移`)]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,"aria-label":D(`移除指令 {title}`,{title:r}),onClick:()=>E(h.filter((e,n)=>n!==t)),children:D(`移除`)})]})]},`${e.markdown??`tail`}-${t}`)})}),h.length===0&&(0,B.jsx)(`p`,{className:`world-frame-empty`,children:D(`尚未加入世界提示块。`)}),(0,B.jsxs)(`div`,{className:`world-frame-add-row`,children:[(0,B.jsxs)(`label`,{children:[D(`要加入的 Markdown 块`),(0,B.jsx)(`select`,{value:b,onChange:e=>d(e.currentTarget.value),children:y.length===0?(0,B.jsx)(`option`,{value:``,children:D(`没有可加入的未引用块`)}):y.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:b.length===0,onClick:()=>{E([...h,{markdown:b}]),d(``)},children:D(`加入指令顺序`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>E([...h,{turnGuide:``}]),children:D(`加入独立尾部行`)})]})]})]}),(0,B.jsx)(cc,{frame:m,documents:o,onChange:e=>T(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:D(`03 · 确定性材料`)}),(0,B.jsx)(`h6`,{id:`world-frame-context-title`,children:D(`上下文材料顺序`)})]}),(0,B.jsxs)(`span`,{className:`world-frame-section-state`,children:[g?.length??0,` `,D(`个插槽`)]})]}),(0,B.jsx)(`p`,{children:D(`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:D(`从上到下就是实际注入顺序`)}),(0,B.jsx)(`span`,{children:D(`每张卡片右上角都有“上移 / 下移”;移动后序号会立即更新。`)})]})]}),g===null?(0,B.jsx)(Rs,{name:`context`,onReset:()=>T(e=>{e.context=[]})}):(0,B.jsxs)(B.Fragment,{children:[(x!==1||S!==1)&&(0,B.jsxs)(`div`,{className:`world-frame-required-slots`,role:`note`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(`必需插槽还未成对`)}),(0,B.jsxs)(`span`,{children:[D(`当前情境`),x,` `,D(`个 · 附加材料`),` `,S,` `,D(`个`)]})]}),(0,B.jsxs)(`div`,{children:[x===0&&(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>k(`current_situation`),children:D(`补上当前情境`)}),S===0&&(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>k(`additional_materials`),children:D(`补上附加材料`)})]})]}),(0,B.jsx)(`ol`,{className:`world-frame-slot-list`,"aria-label":D(`上下文材料顺序`),children:g.map((e,t)=>(0,B.jsx)(`li`,{children:(0,B.jsx)(js,{slot:e.slot,ordinal:t+1,documents:o,directories:c,canRemove:!rc(e.slot.kind)||nc(g,e.slot.kind)>1,onChange:e=>{let n=[...g];n[t]={slot:e},O(n)},onMove:e=>O(ac(g,t,e)),onRemove:()=>O(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:[D(`新增材料类型`),(0,B.jsx)(`select`,{value:f,onChange:e=>p(e.currentTarget.value),children:ks.map(e=>(0,B.jsxs)(`option`,{value:e.kind,children:[D(e.label),` — `,D(e.detail)]},e.kind))}),w!==null&&(0,B.jsx)(`small`,{className:`world-frame-association-note`,children:w})]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w!==null,onClick:()=>{if(g===null)return;let e={slot:Ys(f,o,c)},t=[...g],n=t.findIndex(({slot:e})=>e.kind===`additional_materials`);t.splice(n<0?t.length:n,0,e),O(t)},children:D(`新增材料插槽`)})]})]})]})]}),(0,B.jsxs)(`details`,{className:`world-frame-source`,open:m===null,children:[(0,B.jsx)(`summary`,{children:D(`高级:直接编辑 frame.yaml`)}),(0,B.jsx)(`p`,{children:D(`可视化修改会把 YAML 重新整理为稳定格式;需要修复未知字段或保留当前原文时可在这里编辑。`)}),(0,B.jsx)(`textarea`,{rows:18,spellCheck:!1,"aria-label":D(`直接编辑 control/frame.yaml`),value:e,onChange:e=>r(e.currentTarget.value)}),a.error!==null&&(0,B.jsx)(`p`,{role:`alert`,children:a.error})]})]})}function js({slot:e,ordinal:t,documents:n,directories:r,canRemove:i,first:a,last:o,onChange:s,onMove:c,onRemove:l}){let u=tc(e.kind),d=oc(e.document),f=Ds(n,d),p=ec(e.locator,f?.codec??`yaml`),m=sc(e.from)?e.from:{},h=oc(m.document),g=Ds(n,h),_=g?.codec===`yaml`?g:void 0,v=ec(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:D(u.title)}),(0,B.jsx)(`code`,{children:e.kind}),(0,B.jsx)(`p`,{children:D(u.detail)})]}),(0,B.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,B.jsx)(`span`,{children:D(`调整注入顺序`)}),(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":D(`上移材料 {index}`,{index:t}),disabled:a,onClick:()=>c(t-2),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,D(`上移`)]}),(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":D(`下移材料 {index}`,{index:t}),disabled:o,onClick:()=>c(t),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,D(`下移`)]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!i,"aria-label":D(`移除材料 {index}`,{index:t}),onClick:l,children:D(`移除`)})]})]}),(0,B.jsxs)(`label`,{children:[E()===`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-${Xe()}`),s(n)}})]}),e.kind===`document`&&(0,B.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,B.jsx)(Ms,{label:D(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>s({...e,document:t})}),(0,B.jsx)(Is,{slot:e,ordinal:t,onChange:s})]}),e.kind===`node`&&(0,B.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,B.jsx)(Ms,{label:D(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>{let r=Ds(n,t)?.codec??`yaml`;s({...e,document:t,locator:{[r]:[]}})}}),(0,B.jsx)(Fs,{label:`${p.kind===`yaml`?D(`YAML 路径`):D(`Markdown 标题路径`)} ${t}`,locator:p,onChange:t=>s({...e,locator:t})}),(0,B.jsx)(Is,{slot:e,ordinal:t,onChange:s})]}),e.kind===`reference_targets`&&(0,B.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,B.jsx)(Ms,{label:D(`来源 YAML 文件 {index}`,{index:t}),value:h,documents:n.filter(({codec:e})=>e===`yaml`),emptyLabel:D(`选择实际 YAML 文件`),onChange:t=>{let r=Ds(n,t),i=r?.codec===`yaml`?r:void 0;s({...e,from:{document:t,locator:{yaml:Xs(i)}}})}}),(0,B.jsx)(Ps,{label:D(`从 YAML 哪个字段读取 $ref(插槽 {index})`,{index:t}),manualLabel:D(`手动 YAML 字段路径(插槽 {index})`,{index:t}),document:_,locator:v,onChange:t=>s({...e,from:{document:h,locator:t}})}),(0,B.jsx)(Ls,{label:D(`最多目标数 {index}`,{index:t}),value:e.maxEntries,minimum:1,maximum:64,onChange:t=>s({...e,maxEntries:t})}),(0,B.jsx)(Is,{slot:e,ordinal:t,onChange:s})]}),e.kind===`catalog`&&(0,B.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,B.jsx)(Ns,{label:D(`目录 {index}`,{index:t}),value:oc(e.directory),directories:r,onChange:t=>s({...e,directory:t})}),(0,B.jsx)(Ls,{label:D(`最多目录项 {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)(Ls,{label:D(`带上最近几条 {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:[D(`历史消息句柄`),t,(0,B.jsx)(`input`,{value:oc(e.message),onChange:t=>s({...e,message:t.currentTarget.value})})]}),(0,B.jsx)(Is,{slot:e,ordinal:t,onChange:s})]}),!ic(e.kind)&&(0,B.jsx)(`pre`,{className:`world-frame-unknown-slot`,children:ma(e,{lineWidth:0})})]})}function Ms({label:e,value:t,documents:n,emptyLabel:r=D(`选择实际文档文件`),onChange:i}){let a=Ds(n,t);return(0,B.jsxs)(`label`,{children:[e,(0,B.jsxs)(`select`,{"aria-label":e,value:a===void 0?t:Es(a),onChange:e=>i(e.currentTarget.value),children:[(0,B.jsx)(`option`,{value:``,children:r}),t.length>0&&Ds(n,t)===void 0&&(0,B.jsxs)(`option`,{value:t,children:[t,D(`(当前未解析)`)]}),n.map(e=>(0,B.jsxs)(`option`,{value:Es(e),children:[e.path,` — `,e.title,` · `,Es(e)]},e.path))]}),(0,B.jsx)(`small`,{className:`world-frame-association-note`,children:a===void 0?D(`只列出内容包中带可识别 $document 技术头的实际文件。`):D(`实际关联 {path};frame.yaml 保存 @短引用:{handle}`,{path:a.path,handle:Es(a)})})]})}function Ns({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:D(`选择实际世界目录`)}),t.length>0&&i===void 0&&(0,B.jsxs)(`option`,{value:t,children:[t,D(`(当前没有可关联文档)`)]}),n.map(e=>(0,B.jsxs)(`option`,{value:e.directory,children:[`world/`,e.directory,`/ — `,e.documentCount,` `,D(`份文档`)]},e.directory))]}),(0,B.jsx)(`small`,{className:`world-frame-association-note`,children:i===void 0?D(`只列出当前内容包内确实包含可识别文档的目录。`):D(`实际关联 world/{directory}/;创建世界后对应 state/{directory}/。`,{directory:i.directory})})]})}function Ps({label:e,manualLabel:t,document:n,locator:r,onChange:i}){let a=n?.yamlLocators??[],o=Zs(r.path),s=a.some(({path:e})=>Zs(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})=>Zs(t)===e.currentTarget.value);t!==void 0&&i({yaml:[...t.path]})},children:n===void 0?(0,B.jsx)(`option`,{value:o,children:D(`先选择来源 YAML 文件`)}):(0,B.jsxs)(B.Fragment,{children:[!s&&(0,B.jsxs)(`option`,{value:o,children:[D(`当前手动路径:`),Qs(r.path),D(`(未解析)`)]}),a.map(e=>(0,B.jsxs)(`option`,{value:Zs(e.path),children:[Qs(e.path),` —`,` `,e.nodeKind===`list`?D(`列表`):D(`对象`),` `,`·`,` `,e.referenceCount>0?e.referenceCount+D(` 个 $ref`):D(`当前无 $ref`)]},Zs(e.path)))]})}),(0,B.jsx)(`small`,{className:`world-frame-association-note`,children:n===void 0?D(`选择 YAML 文件后,这里会解析其中可持久定位的对象和列表。`):n.path+D(` 已解析 `)+a.length+D(` 个可选节点,其中 `)+c+D(` 个当前包含 $ref。`)})]}),(0,B.jsxs)(`details`,{className:`world-frame-locator-advanced`,children:[(0,B.jsx)(`summary`,{children:D(`高级:手动填写字段路径`)}),(0,B.jsx)(Fs,{label:t,locator:{kind:`yaml`,path:r.path},onChange:i})]})]})}function Fs({label:e,locator:t,onChange:n}){return(0,B.jsxs)(`label`,{children:[e,(0,B.jsx)(`textarea`,{rows:3,value:t.path.join(`
1375
+ `),placeholder:D(`每行一个层级;留空表示文档根`),onChange:e=>n({[t.kind]:e.currentTarget.value.split(`
1376
+ `).map(e=>e.trim()).filter(Boolean)})})]})}function Is({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":D(`缺失时阻止请求 {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:D(`缺失时阻止请求`)}),(0,B.jsx)(`small`,{children:D(`关闭后,目标暂时不存在时会明确略过。`)})]})]})}function Ls({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 Rs({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,` `,D(`不是可视化编辑器支持的列表形状`)]}),(0,B.jsx)(`span`,{children:D(`可在高级 YAML 中修复,或明确重置为空列表后重新编排。`)})]}),(0,B.jsxs)(`button`,{type:`button`,className:`secondary-button`,onClick:t,children:[D(`重置`),e]})]})}function zs(e){try{let t=pa(e);return sc(t)?{value:t,error:null}:{value:null,error:D(`frame.yaml 顶层必须是 YAML map。`)}}catch(e){return{value:null,error:e instanceof Error?D(`YAML 无法解析:{message}`,{message:e.message}):D(`YAML 无法解析。`)}}}function Bs(e){return!Array.isArray(e.instructions)||!e.instructions.every(e=>sc(e)&&(typeof e.markdown==`string`||typeof e.turnGuide==`string`)&&(e.markdown===void 0||typeof e.markdown==`string`)&&(e.turnGuide===void 0||typeof e.turnGuide==`string`))?null:e.instructions}function Vs(e){return!Array.isArray(e.context)||!e.context.every(e=>sc(e)&&sc(e.slot)&&typeof e.slot.kind==`string`)?null:e.context}function Hs(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=pa(e===`markdown`?Js(n.contents):n.contents);if(!sc(r)||!sc(r.$document))continue;let i=oc(r.$document.id),a=oc(r.$document.ref),o=oc(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`?Gs(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 Us(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 Ws(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 Gs(e){let t=[],n=new WeakSet,r=(e,i)=>{if(Array.isArray(e)){if(n.has(e))return 0;n.add(e);let r=qs(e);return t.push({path:i,nodeKind:`list`,referenceCount:r}),r}if(!sc(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)||sc(n))&&(a+=r(n,[...i,t]));return t.push({path:i,nodeKind:`object`,referenceCount:a}),a};return r(e,[]),t.sort((e,t)=>Ks(e)-Ks(t))}function Ks(e){return e.path.length===0?2:e.referenceCount>0?0:1}function qs(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+=qs(r,t);return n}return!sc(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+qs(r,t),0))}function Js(e){if(!e.startsWith(`---
1377
+ `))return``;let t=e.indexOf(`
1378
+ ---
1379
+ `,4);return t<0?``:e.slice(4,t)}function Ys(e,t,n){let r=t[0];if(e===`document`)return{kind:e,document:r===void 0?``:Es(r)};if(e===`node`)return{kind:e,document:r===void 0?``:Es(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?``:Es(n),locator:{yaml:Xs(n)}},maxEntries:12}}return e===`history`?{kind:e,recent:2}:{kind:e,directory:n[0]?.directory??``,maxEntries:24}}function Xs(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 Zs(e){return JSON.stringify(e)}function Qs(e){return e.length===0?D(`整份 YAML`):e.join(` › `)}function $s(e,t,n){return e===`catalog`&&n.length===0?D(`先在 world/ 的子目录中创建带 $document 技术头的文档。`):e===`reference_targets`&&!t.some(({codec:e})=>e===`yaml`)?D(`先创建一份带 $document 技术头的 YAML 世界文档。`):(e===`document`||e===`node`)&&t.length===0?D(`先创建一份带 $document 技术头的世界文档。`):null}function ec(e,t){return sc(e)&&Array.isArray(e.yaml)?{kind:`yaml`,path:e.yaml.filter(e=>typeof e==`string`)}:sc(e)&&Array.isArray(e.markdown)?{kind:`markdown`,path:e.markdown.filter(e=>typeof e==`string`)}:{kind:t,path:[]}}function tc(e){return{current_situation:{title:D(`当前情境`),detail:D(`从上方绑定读取紧接着的叙事不能忘记的短期局面。`)},additional_materials:{title:D(`附加材料`),detail:D(`展开当前端点为全新上下文保存的完整精确材料清单。`)},document:{title:D(`整份文档`),detail:D(`精确加入一份世界文档。`)},node:{title:D(`文档局部节点`),detail:D(`精确加入 YAML 路径或 Markdown 标题子树。`)},catalog:{title:D(`有界目录`),detail:D(`列出一级目录中的标题、简介和短引用,不展开正文。`)},reference_targets:{title:D(`显式引用目标`),detail:D(`读取 YAML 节点中的 $ref,并加入一层目标文档。`)},history:{title:D(`最近叙事`),detail:D(`带上最近几条已提交玩家/主持原文;没有此前叙事时会明确标为空,调用链据此延续未写入文档的细节。`)},history_message:{title:D(`精确历史消息`),detail:D(`按 Runtime 句柄加入一条已提交叙事。`)}}[e]??{title:D(`未知插槽`),detail:D(`当前可视化编辑器不识别此类型;可移动、移除或在 YAML 中修复。`)}}function nc(e,t){return e?.filter(({slot:e})=>e.kind===t).length??0}function rc(e){return e===`current_situation`||e===`additional_materials`}function ic(e){return[`current_situation`,`additional_materials`,`document`,`node`,`catalog`,`reference_targets`,`history`,`history_message`].includes(e)}function ac(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 oc(e){return typeof e==`string`?e:``}function sc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cc({frame:e,documents:t,onChange:n}){let r=E()===`zh-CN`,i=sc(e.maintenance)?e.maintenance:{},a=sc(i.documents)?i.documents:{},o=sc(i.clock)?i.clock:{},s=Ds(t,oc(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)(Ms,{label:r?`记录写入时世界时间的文档`:`Document containing world time at write`,emptyLabel:r?`不记录世界时间`:`Do not record world time`,value:oc(o.document),documents:t,onChange:e=>{let r={...i};e===``?delete r.clock:r.clock={document:e,locator:{[Ds(t,e)?.codec??`yaml`]:[]}},n(r)}}),s!==void 0&&(0,B.jsx)(Fs,{label:r?`世界时间的精确字段路径`:`Exact world-time field path`,locator:ec(o.locator,s.codec),onChange:e=>n({...i,clock:{...o,locator:e}})})]})}function lc(e){let t=uc(e.contents,`title`)??dc(e.contents)??fc(e.path);return{ref:uc(e.contents,`ref`)??e.path.replace(/\.[^.]+$/u,``).replaceAll(`/`,`-`),title:t,summary:uc(e.contents,`summary`)??D(`暂无摘要`)}}function uc(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 dc(e){return/^#\s+(.+)$/mu.exec(e)?.[1]?.trim()??null}function fc(e){return e.split(`/`).at(-1)??e}function pc({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)=>vc(e.kind,t,n)),[r,e.kind]),g=e.kind!==`world-correction`,_=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??``,v=t??o,y=r.some(({path:e})=>e===v)?v:_,b=r.find(({path:e})=>e===y),x=e.kind===`world-revision`&&e.immutablePaths.includes(y),S=c.sourcePath===y?c.value:y,C=e.kind===`world-correction`?[]:e.issues,w=i.trim().toLocaleLowerCase(`zh-CN`),T=w.length===0?h:h.filter(t=>mc(e.kind,t).toLocaleLowerCase(`zh-CN`).includes(w)),O=hc(e.kind,T),k=C.filter(({path:e})=>e===y),A=g&&b!==void 0?_c(S,b.path,r,e.kind):``,j=g?_c(d,void 0,r,e.kind):``;function M(e){t===void 0&&s(e),n?.(e)}function ee(t){b!==void 0&&e.onFilesChange(r.map(e=>e.path===b.path?{...e,contents:t}:{...e}))}function te(){if(!g||b===void 0||x||A.length>0)return;let t=S.trim();t!==b.path&&(e.onFilesChange(r.map(e=>e.path===b.path?{...e,path:t}:{...e})),M(t),u({sourcePath:t,value:t}))}function ne(){if(!g||(m(!0),j.length>0))return;let t=d.trim();e.onFilesChange([...r.map(e=>({...e})),{path:t,contents:``}]),M(t),f(``),m(!1)}function N(){if(!g||b===void 0||x)return;let t=r.filter(({path:e})=>e!==b.path).map(e=>({...e}));M(yc(t,b.path,e.kind)),e.onFilesChange(t)}function P(){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:[D(`当前文件`),(0,B.jsx)(`select`,{"aria-label":D(`选择编辑文件`),value:y,onChange:e=>M(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`?D(`内容包文件`):e.kind===`world-revision`?D(`世界修订文件`):D(`当前世界文档`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`content-editor-kicker`,children:e.kind===`content-package`?D(`当前草稿`):e.kind===`world-revision`?D(`修订工作树`):D(`当前世界`)}),(0,B.jsx)(`h4`,{children:D(`文件`)})]}),(0,B.jsxs)(`span`,{children:[T.length,` / `,r.length]})]}),(0,B.jsxs)(`label`,{className:`content-file-filter`,children:[(0,B.jsx)(`span`,{children:D(`筛选文件`)}),(0,B.jsx)(`input`,{type:`search`,value:i,placeholder:e.kind===`content-package`?D(`人物、地点或文件名`):D(`查找人物、地点、规则…`),onChange:e=>a(e.target.value)})]}),(0,B.jsx)(`nav`,{className:`content-file-list`,"aria-label":e.kind===`content-package`?D(`内容包文件树`):e.kind===`world-revision`?D(`世界修订文件树`):D(`当前世界文档`),children:T.length===0?(0,B.jsx)(`p`,{children:D(`没有匹配的文件。`)}):O.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:[D(t.label),(0,B.jsx)(`span`,{children:t.files.length})]}),(0,B.jsx)(`ul`,{children:t.files.map(t=>{let n=C.filter(({path:e})=>e===t.path).length,r=lc(t);return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:t.path===y?`selected-content-file`:``,"aria-label":D(`打开 {path}`,{path:t.path}),"aria-pressed":t.path===y,title:t.path,onClick:()=>M(t.path),children:[(0,B.jsx)(`span`,{className:`content-file-kind`,"aria-hidden":`true`,children:xc(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:D(`新建文件`)}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`label`,{children:[D(`新文件路径`),(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&&j.length>0&&(0,B.jsx)(`p`,{role:`alert`,children:j}),(0,B.jsx)(`p`,{children:D(`新文件先加入本地草稿;Runtime 会在整批保存时检查路径与内容。`)}),(0,B.jsx)(`button`,{type:`button`,disabled:j.length>0,onClick:ne,children:D(`加入草稿`)})]})]}):(0,B.jsx)(`p`,{className:`world-correction-scope-note`,children:D(`只修订已有世界文档;临时出现的地点不需要先建立档案。`)})]}),(0,B.jsx)(`section`,{className:`content-file-editor`,"aria-label":b===void 0?D(`文件编辑器`):D(`文件编辑器:{path}`,{path:b.path}),children:b===void 0?(0,B.jsxs)(`div`,{className:`content-editor-empty`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,B.jsx)(`h4`,{children:D(`当前草稿没有文件`)}),(0,B.jsx)(`p`,{children:e.kind===`content-package`?D(`从左侧新建第一份文件,或返回工作区导入已有内容包。`):e.kind===`world-revision`?D(`从左侧新建状态或控制文件。`):D(`当前世界没有可修订的状态文档。`)})]}):(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`?Cc(b,e.kind):D(`全文编辑`)}),(0,B.jsx)(`h4`,{children:e.kind===`content-package`||e.kind===`world-revision`?bc(b.path):lc(b).title}),e.kind===`world-correction`?(0,B.jsx)(`small`,{children:b.path}):null]}),g?(0,B.jsx)(`button`,{type:`button`,className:`danger-button content-remove-file`,disabled:x,onClick:N,children:D(`从草稿移除`)}):(0,B.jsx)(`span`,{className:e.dirty?`document-workbench-dirty is-dirty`:`document-workbench-dirty`,children:e.dirty?D(`已修改 · 未预览`):D(`无本地修改`)})]}),g?(0,B.jsxs)(`details`,{className:`content-rename-file`,children:[(0,B.jsx)(`summary`,{children:D(`重命名文件`)}),(0,B.jsxs)(`div`,{className:`content-path-editor`,children:[(0,B.jsxs)(`label`,{children:[D(`文件路径`),(0,B.jsx)(`input`,{value:S,disabled:x,onChange:e=>u({sourcePath:b.path,value:e.target.value})})]}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:x||A.length>0||S.trim()===b.path,onClick:te,children:D(`应用新路径`)})]}),A.length>0?(0,B.jsx)(`p`,{role:`alert`,children:A}):x?(0,B.jsx)(`p`,{children:D(`既有状态文档的路径和身份在修订中保持不变。`)}):null]},b.path):null,b.encoding===`base64`?(0,B.jsxs)(`div`,{className:`content-binary-note`,role:`note`,children:[(0,B.jsx)(`strong`,{children:D(`二进制资源不在文本编辑器展开`)}),(0,B.jsx)(`span`,{children:D(`当前 Base64 内容会原样保留;如需替换资源,请重新导入内容包。`)})]}):g&&b.path===`control/frame.yaml`?(0,B.jsx)(As,{contents:b.contents,files:r,dirty:e.dirty,onChange:ee,onSave:e.onSave}):(0,B.jsxs)(`label`,{className:`content-source-editor`,children:[(0,B.jsxs)(`span`,{children:[D(`文件内容`),(0,B.jsx)(`small`,{children:e.kind===`content-package`?D(`Ctrl / ⌘ + S 整批保存`):e.kind===`world-revision`?D(`Ctrl / ⌘ + S 保存到修订工作树`):D(`Ctrl / ⌘ + S 预览整笔修订`)})]}),(0,B.jsx)(`textarea`,{rows:27,spellCheck:!1,readOnly:Sc(b,e.kind),value:b.contents,placeholder:wc(b.path,e.kind),"aria-label":D(`编辑 {path}`,{path:b.path}),onChange:e=>ee(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase(`en-US`)===`s`&&(e.preventDefault(),P())}})]}),(0,B.jsxs)(`footer`,{className:`content-source-meta`,children:[(0,B.jsx)(`span`,{children:xc(b)}),b.encoding===void 0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{children:[Tc(b.contents),` `,D(`行`)]}),(0,B.jsxs)(`span`,{children:[b.contents.length.toLocaleString(E()),` `,D(`字符`)]})]})]}),k.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:D(`已保存版本诊断`)}),(0,B.jsx)(`ul`,{children:k.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:D(`应用前先审阅`)}),(0,B.jsx)(`span`,{children:D(`完整差异 · 真实 Prompt Preview · 一笔 Authority 修订`)})]}),(0,B.jsx)(`button`,{type:`button`,disabled:!e.dirty||e.pending,onClick:e.onPreview,children:D(`预览修订`)})]}):null]})})]})}function mc(e,t){if(e!==`world-correction`)return t.path;let n=lc(t);return`${t.path}\n${n.title}\n${n.summary}\n${n.ref}`}function hc(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})=>gc(e,t)===n);return i.length===0?[]:[{id:n,label:r,files:i}]})}function gc(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 _c(e,t,n,r){let i=e.trim();if(i.length===0)return D(`请输入文件路径。`);if(i.startsWith(`/`)||/^[a-z]:[\\/]/iu.test(i)||i.includes(`\\`)||i.includes(`\0`))return D(`路径必须是使用 / 的内容包相对路径。`);if(i.split(`/`).some(e=>e.length===0||e===`.`||e===`..`))return D(`路径不能包含空目录、. 或 ..。`);let a=i===`control/gameplay.json`&&(r===`content-package`||t===`control/gameplay.json`);if(/\.json$/iu.test(i)&&i!==`control/gameplay.json`)return D(`当前文件原生 V1 不接受 manifest 或 JSON 内容文件。`);if(r===`world-revision`&&!a&&!/^state\/.+\.(?:ya?ml|md)$/u.test(i)&&i!==`control/frame.yaml`&&i!==`control/player-views.yaml`&&!/^control\/blocks\/.+\.md$/u.test(i))return D(`世界修订只接受 state 下的 YAML/Markdown,以及受支持的 control 文件。`);let o=i.normalize(`NFC`).toLocaleLowerCase(`en-US`);return n.some(e=>e.path!==t&&e.path.normalize(`NFC`).toLocaleLowerCase(`en-US`)===o)?D(`当前草稿中已经存在同一路径。`):``}function vc(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(gc(e,t));return r(t.path)-r(n.path)||t.path.localeCompare(n.path)}function yc(e,t,n){let r=[...e].sort((e,t)=>vc(n,e,t));return r.find(({path:e})=>e.localeCompare(t)>0)?.path??r.at(-1)?.path??``}function bc(e){return e.split(`/`).at(-1)??e}function xc(e){return e.encoding===`base64`?`BIN`:/\.ya?ml$/iu.test(e.path)?`YAML`:/\.md$/iu.test(e.path)?`MD`:e.path===`control/gameplay.json`?`JSON`:`TEXT`}function Sc(e,t){return t===`world-revision`&&e.path===`control/gameplay.json`}function Cc(e,t){return e.encoding===`base64`?D(`二进制资源`):e.path===`control/gameplay.json`?D(t===`world-revision`?`世界玩法身份,修订中保持不变`:`内容包玩法身份,只能修改跑团判定方案`):e.path===`opening.md`?D(`玩家首次行动前看到的开场白`):e.path.startsWith(`world/`)?D(`会复制为世界状态的设定文档`):e.path.startsWith(`control/`)?D(`会复制为世界控制的作者资产`):D(`内容包文本资源`)}function wc(e,t){return t===`world-correction`?D(`输入完整 UTF-8 文档内容……`):e===`opening.md`?D(`写下玩家首次行动前立即看到的局面……`):(e.startsWith(`world/`)||e.startsWith(`state/`))&&/\.ya?ml$/iu.test(e)?D(`$document:
1380
+ id: character.example
1381
+ ref: example
1382
+ title: 示例人物
1383
+ summary: 一句话稳定简介。
1384
+ aliases: []
1385
+ `):(e.startsWith(`world/`)||e.startsWith(`state/`))&&/\.md$/iu.test(e)?D(`---
1386
+ $document:
1387
+ id: rule.example
1388
+ ref: example
1389
+ title: 示例规则
1390
+ summary: 一句话稳定简介。
1391
+ aliases: []
1392
+ ---
1393
+
1394
+ # 示例规则
1395
+ `):D(`输入 UTF-8 文本内容……`)}function Tc(e){return e.length===0?0:e.split(`
1396
+ `).length}function Ec({scriptPermission:e,files:t,status:n,issues:r,dirty:i,conflict:a=!1,onFilesChange:o,onSave:s,onLoadLatest:c,onReset:u,onCopy:d,onExport:f,onDelete:p,title:m,onRename:h,selectedPath:g,onSelectedPathChange:_,embedded:v=!1,mode:y=`content-package`,immutablePaths:b=[]}){let[x,S]=(0,l.useState)(m),[C,w]=(0,l.useState)(m);return C!==m&&(w(m),S(m)),(0,B.jsxs)(`section`,{className:v?`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:v?`visually-hidden`:void 0,children:D(y===`world-revision`?`世界修订工作树`:`内容包当前树`)}),(0,B.jsxs)(`details`,{className:`content-save-help`,children:[(0,B.jsx)(`summary`,{children:D(`保存说明`)}),(0,B.jsx)(`p`,{className:`field-note`,children:D(y===`world-revision`?`手动编辑与 AI 共用这棵 state/control 工作树;保存后仍可逐次回滚,应用才会提交世界。`:`逐份编辑 YAML/Markdown;整批保存时才原子替换已保存版本。`)})]})]}),(0,B.jsxs)(`div`,{className:`content-tree-state`,"aria-label":D(y===`world-revision`?`世界修订状态`:`内容包编辑状态`),children:[(0,B.jsxs)(`span`,{className:`package-status ${n}`,children:[D(y===`world-revision`?`工作树:`:`已保存版本:`),D(n===`usable`?`可用`:`需要修复`)]}),(0,B.jsx)(`span`,{className:i?`draft-state dirty`:`visually-hidden`,children:D(i?`有未保存修改`:y===`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:D(`内容包脚本权限`)}),e]}),(0,B.jsx)(xs,{files:t,onChange:o})]}),(0,B.jsx)(pc,{...g===void 0?{}:{selectedPath:g},..._===void 0?{}:{onSelectedPathChange:_},workspace:y===`world-revision`?{kind:`world-revision`,files:t,dirty:i,pending:!1,issues:r,immutablePaths:b,onFilesChange:o,onSave:s}:{kind:`content-package`,files:t,dirty:i,issues:r,onFilesChange:o,onSave:s}}),r.length>0&&(0,B.jsxs)(`details`,{className:`content-package-diagnostics`,open:!i,children:[(0,B.jsx)(`summary`,{children:D(`已保存版本有 {count} 项需要修复`,{count:r.length})}),i&&(0,B.jsx)(`p`,{children:D(`诊断对应上一次保存;整批保存后会按新草稿重新检查。`)}),(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:[a&&c!==void 0&&(0,B.jsxs)(`div`,{className:`content-save-conflict`,role:`alert`,children:[(0,B.jsx)(`p`,{children:D(`内容包已被其他操作修改,草稿已保留,尚未保存。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:c,children:D(`加载最新版本`)})]}),(0,B.jsxs)(`div`,{className:`content-save-boundary`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(i?`草稿尚未保存`:y===`world-revision`?`修订工作树已保存`:`当前树已保存`)}),(0,B.jsx)(`span`,{children:D(y===`world-revision`?`保存只更新锁定工作树并留下可回滚记录,不会提交世界。`:`保存会把整棵草稿作为一个候选原子替换,不会逐文件提交。`)})]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:!i,onClick:s,children:D(y===`world-revision`?`保存到修订`:`整批保存`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!i,onClick:u,children:D(`放弃未保存修改`)})]})]}),y===`content-package`?(0,B.jsxs)(`details`,{className:`content-package-actions`,children:[(0,B.jsx)(`summary`,{children:D(`内容包操作`)}),i&&(0,B.jsx)(`p`,{children:D(`请先整批保存或放弃当前草稿,再操作已保存内容包。`)}),(0,B.jsxs)(`label`,{className:`content-package-rename`,children:[(0,B.jsx)(`span`,{children:D(`内容包标题`)}),(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()===m,onClick:()=>h(x.trim()),children:D(`重命名`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i,onClick:d,children:D(`复制为新本地身份`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:i,onClick:f,children:D(`导出 ZIP`)}),(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:i,onClick:p,children:D(`删除内容包`)})]})]}):null]})]})}var Dc=[[`inputTokens`,`输入`],[`uncachedInputTokens`,`未缓存输入`],[`cacheReadTokens`,`缓存读取`],[`cacheWriteTokens`,`缓存写入`],[`reasoningTokens`,`推理(输出内)`],[`outputTokens`,`输出(含推理)`],[`totalTokens`,`合计`]];function Oc({usage:e,compact:t=!1,showProvenance:n=!1}){return(0,B.jsxs)(`section`,{className:`model-usage${t?` model-usage-compact`:``}`,"aria-label":D(`Token 用量明细`),children:[(0,B.jsx)(`dl`,{children:Dc.map(([t,r])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(r)}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`strong`,{children:kc(e[t])}),e[t]===null?null:(0,B.jsx)(`span`,{children:` tokens`}),n?(0,B.jsx)(`small`,{children:Ac(e.provenance[t])}):null]})]},t))}),n?(0,B.jsx)(`p`,{children:D(`缓存读取和缓存写入属于输入构成;推理 tokens 已包含在输出 tokens 中,不应重复相加。`)}):null]})}function kc(e){return e===null?D(`未报告`):e.toLocaleString(E())}function Ac(e){return D(e===`provider`?`Provider 报告`:e===`derived_provider_fields`?`由 Provider 字段计算`:`Provider 未报告`)}function jc({gameplay:e,disabled:t,onChangeScheme:n}){let r=(0,l.useId)(),[i,a]=(0,l.useState)(null),o=t||i!==null;async function s(t){if(!(o||e.mode!==`tabletop`||e.scheme===t)){a(t);try{await n(t)}finally{a(null)}}}return(0,B.jsxs)(`section`,{className:`package-gameplay`,"aria-labelledby":`${r}-title`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`h3`,{id:`${r}-title`,children:D(`玩法`)}),(0,B.jsx)(`strong`,{className:`package-gameplay-mode`,children:h(e,E())})]}),(0,B.jsx)(`p`,{className:`field-note`,children:D(`玩法模式在创建时固定,不能在互动式小说与跑团之间切换。`)}),e.mode===`tabletop`?(0,B.jsxs)(`fieldset`,{className:`package-gameplay-scheme`,disabled:o,children:[(0,B.jsx)(`legend`,{children:D(`判定方案`)}),je().map(t=>(0,B.jsxs)(`div`,{className:`package-gameplay-choice`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`${r}-scheme`,value:t.scheme,checked:(i??e.scheme)===t.scheme,"aria-describedby":`${r}-${t.scheme}-description`,onChange:()=>void s(t.scheme)}),(0,B.jsx)(`span`,{children:t.label})]}),(0,B.jsx)(`p`,{className:`field-note`,id:`${r}-${t.scheme}-description`,children:t.description})]},t.scheme)),(0,B.jsx)(`p`,{className:`field-note`,children:D(`已有世界保持创建时的判定方案;修改只影响之后从这份内容包新建的世界。`)})]}):null]})}var Mc=8e4,Nc=1024;function Pc(e,t,n=3){let r=Fc(e),i=Fc(t),a=[];Ic(r,0,r.length,i,0,i.length,a);let o=1,s=1;return Hc(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 Fc(e){return e===null?[]:e.split(`
1397
+ `)}function Ic(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)<=Mc)zc(e,t,c,r,i,l,o);else{let n=Bc(e,t,c,r,i,l);if(n.length===0){if(!Lc(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)Ic(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;Ic(e,a,c,r,s,l,o)}}for(let t=s;t>0;--t)o.push({kind:`context`,text:e[n-t]})}function Lc(e,t,n,r,i,a,o){let s=n-t,c=a-i,l=Math.min(s+c,Nc),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 Rc(e,t,r,i,s,c,p,d,o),!0}}return!1}function Rc(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 zc(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 Bc(e,t,n,r,i,a){let o=Vc(e,t,n),s=Vc(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 Vc(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 Hc(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 Uc=(0,l.memo)(function({before:e,after:t,label:n}){let r=(0,l.useMemo)(()=>Pc(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:D(`原文件行号`)}),(0,B.jsx)(`span`,{role:`columnheader`,children:D(`新文件行号`)}),(0,B.jsx)(`span`,{role:`columnheader`,children:D(`改动标记`)}),(0,B.jsx)(`span`,{role:`columnheader`,children:D(`行内容`)})]}),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:D(`{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?D(`原文件无对应行`):D(`原文件第 {line} 行`,{line:e.oldLine}),children:e.oldLine??``}),(0,B.jsx)(`span`,{className:`unified-diff-line-number`,role:`cell`,"aria-label":e.newLine===null?D(`新文件无对应行`):D(`新文件第 {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`?D(`删除行`):e.kind===`add`?D(`新增行`):D(`未变行`)}),(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 Wc({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,initialMessage:m,onInitialMessageStarted:h,onPreview:g,onCancel:_,onResume:v,onFreshContext:y,onSelectSession:b,onDeleteSession:x,onRollbackFile:S,onConfigureModel:C,onBack:w,showWorkspaceBack:T=!0,onCreateWorld:E,onNavigationLockChange:O,packageGameplay:k,draftsLocked:A=!1,revisionActions:j}){let[M,ee]=(0,l.useState)(``),[te,ne]=(0,l.useState)(!1),N=(0,l.useRef)(!1),P=(0,l.useRef)(!1),[F,re]=(0,l.useState)(!1),[ie,ae]=(0,l.useState)(!1),[I,L]=(0,l.useState)(`preview`),[R,z]=(0,l.useState)(f.selectedPath??``),[se,ce]=(0,l.useState)(null),[le,ue]=(0,l.useState)(null),de=(0,l.useRef)(null),fe=a?.runStatus===`running`||te,pe=le!==null,me=j?.applying===!0,he=fe||pe||me;(0,l.useEffect)(()=>(O?.(he||r||i),()=>O?.(!1)),[O,he,r,i]);let V=a===null,ge=a!==null&&s!==null&&a.sessionId!==s,H=i||he||!n||r,_e=i||he||r||A,U=e===`world-revision`,ve=j===void 0?void 0:new Set(j.changes.map(({changeSetId:e})=>e)),ye=(0,l.useCallback)(async e=>{if(!(H||N.current||e.trim().length===0)){N.current=!0,ne(!0),ee(``),ae(!1);try{await p(e)}catch{ee(t=>t.length===0?e:t)}finally{N.current=!1,ne(!1)}}},[H,p]),be=async()=>{if(!(H||N.current)){N.current=!0,ne(!0);try{await v()}catch{}finally{N.current=!1,ne(!1)}}};(0,l.useEffect)(()=>{m===void 0||P.current||H||(P.current=!0,h?.(),ye(m))},[m,H,h,ye]);let xe=_s(!H&&M.trim().length>0,()=>ye(M)),Se=e=>{(e!==`edit`||!he&&!A)&&(L(e),ae(!0),re(!1))},Ce=()=>{for(let e of de.current?.querySelectorAll(`details[open]`)??[])e.removeAttribute(`open`)},we=async e=>{if(e.runStatus!==`running`&&se===null&&globalThis.confirm(D(U?`删除对话“{title}”?只会删除对话记录;修订工作树中的改动不会回滚。此操作无法撤销。`:`删除对话“{title}”?只会删除这份对话记录;已经写入内容包当前树的改动不会回滚。此操作无法撤销。`,{title:e.excerpt||D(`未命名对话`)}))){ce(e.sessionId);try{await x(e.sessionId)}catch{}finally{ce(null)}}},Te=async(e,t)=>{if(!(a===null&&!U||_e)){re(!1),ae(!1),ue({changeSetId:e,path:t});try{await S(a?.sessionId??``,e,t)}catch{}finally{ue(null)}}};return oe(U,()=>{!he&&!r&&w()}),oe(F||ie,()=>{re(!1),ae(!1)}),(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":D(U?`世界修订导航`:`设定完善导航`),children:[(U||T)&&(0,B.jsx)(`button`,{type:`button`,disabled:he||r,onClick:w,"aria-label":D(U?`返回游玩`:`返回工作区`),children:`←`}),(0,B.jsx)(`button`,{type:`button`,className:F?`is-current`:``,"aria-pressed":F,onClick:()=>{re(e=>!e),ae(!1)},children:D(`历史`)})]}),(0,B.jsxs)(`h1`,{id:`setting-improvement-title`,className:`world-floating-title setting-floating-title`,title:t,children:[t,` ·`,` `,D(U?`世界修订`:`AI 设定完善`)]}),(0,B.jsxs)(`nav`,{className:`world-floating-chrome world-floating-chrome-right setting-floating-chrome`,"aria-label":D(U?`世界修订工具`:`设定完善工具`),children:[!U&&E!==void 0&&(0,B.jsx)(`button`,{type:`button`,className:`setting-create-world`,disabled:i||he||r||A||f.status!==`usable`,onClick:E,children:D(`创建世界`)}),(0,B.jsx)(`button`,{type:`button`,className:ie&&I===`preview`?`is-current`:``,onClick:()=>Se(`preview`),children:D(`文件`)}),(0,B.jsx)(`button`,{type:`button`,className:ie&&I===`edit`?`is-current`:``,disabled:he||A,onClick:()=>Se(`edit`),children:D(`编辑`)}),(0,B.jsx)(`button`,{type:`button`,onClick:Ce,children:D(`全部收起`)}),(0,B.jsx)(`button`,{type:`button`,disabled:he||i,onClick:y,children:D(`全新上下文`)}),j===void 0?null:(0,B.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:i||he||r||j.active===!1,onClick:()=>void j.onDiscard(),children:D(`放弃`)}),j===void 0?null:(0,B.jsx)(`button`,{type:`button`,disabled:he||r||!j.canApply||j.applying,className:j.applyLabel===void 0?void 0:`primary-button`,onClick:()=>void j.onApply(),children:j.applying?D(`正在应用…`):j.applyLabel??D(`应用并解锁`)})]}),(0,B.jsx)(`section`,{ref:de,className:`setting-reader-scroll`,"aria-label":D(U?`世界修订对话`:`设定完善对话`),children:(0,B.jsxs)(`article`,{className:`setting-story-column`,"aria-live":`polite`,"aria-busy":he,children:[(a===null||a.turns.length===0)&&(0,B.jsxs)(`header`,{className:`setting-conversation-intro`,children:[(0,B.jsx)(`h2`,{children:D(U?`手动编辑和 AI 共用一份修订`:`和 AI 边聊边改`)}),(0,B.jsx)(`p`,{children:D(U?`state 和 control 已锁定到这份工作树;可逐次回滚,应用或放弃后才会解锁游玩。`:`成功的工具改动直接写入内容包当前树;需要核对或手动修改时,从右侧打开文件。`)})]}),k===void 0?null:(0,B.jsx)(jc,{gameplay:k.gameplay,disabled:he||r||i,onChangeScheme:k.onChangeScheme}),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:D(U?`先配置并启用模型,才能让 AI 参与或应用世界修订;手动编辑和放弃仍然可用。`:`先配置并启用模型,才能开始设定完善对话。`)}),(0,B.jsx)(`button`,{type:`button`,disabled:r,onClick:C,children:D(`配置模型`)})]}),r?(0,B.jsx)(`p`,{className:`setting-improvement-warning`,role:`status`,children:D(`请先保存或放弃文件编辑中的未保存修改。`)}):null,(0,B.jsx)(`p`,{className:`setting-current-tree-notice`,role:`note`,children:D(U?`所有绿色新增和红色删除都只在锁定工作树中;“应用并解锁”才会提交世界,关闭页面不会丢失修订。`:`这里没有隔离草稿或应用步骤:每个已完成工具响应的绿色新增和红色删除都已经生效。`)}),j===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:D(`世界游玩已锁定`)}),(0,B.jsx)(`p`,{children:D(`当前累计改动 {count} 个文件。可以继续聊天、手动编辑或按文件回滚。`,{count:j.changedFileCount})})]})}),j===void 0||j.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:D(`修订记录`)}),(0,B.jsx)(`small`,{children:D(`{count} 次修改`,{count:j.changes.length})})]}),(0,B.jsx)(`div`,{className:`setting-turn-trace-exchanges`,children:[...j.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`?D(`手动编辑`):e.source===`ai`?D(`AI 修改`):D(`回滚`)}),(0,B.jsx)(`small`,{children:nl(e.createdAt)})]}),(0,B.jsx)(Xc,{changes:e.changes,heading:D(`这次修改的完整差异`),rollback:{changeSetId:e.changeSetId,currentFiles:f.files,disabled:_e,rollingBackFile:le,onRollbackFile:Te}})]},e.changeSetId))})]}),j===void 0?null:(0,B.jsx)(Zc,{epochs:j.sealedEpochs}),V&&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:D(`下一条消息将开启全新上下文`)}),(0,B.jsx)(`p`,{children:D(U?`新对话会从当前修订工作树开始;原有对话仍保留在历史中。`:`新对话会从内容包当前树重新编译;原有对话仍保留在历史中。`)})]})}):ge?(0,B.jsx)(`div`,{className:`setting-history-review-banner`,role:`status`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(`正在继续历史对话`)}),(0,B.jsx)(`p`,{children:D(U?`下一条消息会追加到原 Provider 上下文;若修订 epoch 已变化,Runtime 会要求 AI 重新读取。`:`下一条消息会追加到这段历史的原 Provider 上下文;写入仍以此刻的内容包当前树为准。`)})]})}):null,(0,B.jsx)(fs,{requests:a?.requestPreviews??[],...g===void 0?{}:{onPreview:g}},`${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:D(U?`正在恢复世界修订…`:`正在恢复设定完善对话…`)}):a===null||a.turns.length===0?(0,B.jsxs)(`div`,{className:`setting-conversation-empty`,children:[(0,B.jsx)(`p`,{children:D(`直接说你现在想做什么。`)}),(0,B.jsx)(`p`,{children:D(U?`例如:先检查人物关系是否自洽;或者把当前地点改成雨夜码头,并同步控制规则。`:`例如:先帮我梳理人物关系;或者直接把开场改成雨夜码头,并同步当前情境。`)})]}):a.turns.map(e=>(0,B.jsx)(qc,{turn:e,currentFiles:f.files,rollbackDisabled:_e,rollbackableChangeSetIds:ve,rollingBackFile:le,onRollbackFile:Te},e.id)),fe?(0,B.jsx)(tl,{view:a,now:d}):null,a?.legacyDraft!==null&&a?.legacyDraft!==void 0?(0,B.jsx)(el,{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:D(`上一次操作未完成`)}),(0,B.jsx)(`p`,{children:a.lastFailure}),(0,B.jsx)(`p`,{children:D(`完整对话和已经结算的当前树改动都已保留,可以直接继续说。`)})]}):null,a?.runStatus===`paused`&&!fe?(0,B.jsxs)(`div`,{className:`setting-conversation-paused`,role:`status`,children:[(0,B.jsx)(`strong`,{children:D(`已暂停:模型调用次数达到单条消息上限`)}),(0,B.jsx)(`p`,{children:D(`已完成的改动都已保存。可以让 AI 从这里接着做,也可以先查看改动或直接发新消息。`)}),(0,B.jsx)(`button`,{type:`button`,disabled:H,onClick:()=>void be(),children:D(`继续`)})]}):null,u===null?null:(0,B.jsx)(`div`,{className:`setting-conversation-failure`,role:`alert`,children:u}),a===null?null:(0,B.jsx)(Oc,{usage:a.usage})]})]})}),(0,B.jsxs)(`footer`,{className:`setting-conversation-composer`,children:[(0,B.jsx)(`label`,{htmlFor:`setting-conversation-input`,children:D(V?`用全新上下文给 AI 发消息`:`继续这段对话`)}),(0,B.jsxs)(`div`,{className:`setting-conversation-composer-row`,children:[(0,B.jsx)(`textarea`,{id:`setting-conversation-input`,rows:2,value:M,disabled:H,placeholder:D(U?`可以讨论、要求它检查状态,也可以直接让它修改当前世界修订。`:`可以讨论、要求它检查某份设定,也可以直接让它修改内容包。`),onChange:e=>ee(e.target.value),onKeyDown:xe.onKeyDown,enterKeyHint:`enter`}),fe&&a!==null?(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>void _(),children:D(`停止回复`)}):(0,B.jsx)(`button`,{type:`button`,disabled:H||M.trim().length===0,onClick:()=>void xe.submit(),children:D(`发送`)})]}),(0,B.jsx)(`span`,{className:`field-note`,children:D(xe.enterInsertsNewline?`回车换行,点击发送按钮发送`:`Enter 发送,Shift + Enter 换行`)})]}),(0,B.jsx)(`button`,{type:`button`,className:F||ie?`setting-panel-scrim is-visible`:`setting-panel-scrim`,"aria-label":D(`收起侧栏`),"aria-hidden":!F&&!ie,tabIndex:F||ie?0:-1,onClick:()=>{re(!1),ae(!1)}}),(0,B.jsxs)(`aside`,{className:F?`setting-overlay-rail setting-overlay-rail-left is-open`:`setting-overlay-rail setting-overlay-rail-left`,"aria-hidden":!F,"aria-label":D(U?`世界修订对话历史`:`设定完善对话历史`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:D(`历史`)}),(0,B.jsx)(`span`,{className:`panel-count`,children:D(`{count} 次对话`,{count:o.length})})]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":D(`收起对话历史`),onClick:()=>re(!1),children:`×`})]}),(0,B.jsx)(`div`,{className:`setting-overlay-rail-body`,children:(0,B.jsx)(Gc,{target:e,history:o,latestSessionId:s,selectedSessionId:a?.sessionId??null,loading:i||pe||me,deletingSessionId:se,onSelectSession:async e=>{await b(e),re(!1)},onDeleteSession:we})})]}),(0,B.jsxs)(`aside`,{className:`setting-overlay-rail setting-overlay-rail-right ${I===`edit`?`is-editing`:``} ${ie?`is-open`:``}`,"aria-hidden":!ie,"aria-label":D(I===`edit`?U?`世界修订文件编辑`:`内容包文件编辑`:U?`世界修订文件预览`:`内容包文件预览`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:D(I===`edit`?`编辑文件`:`预览文件`)})}),(0,B.jsx)(`button`,{type:`button`,"aria-label":D(`收起文件面板`),onClick:()=>ae(!1),children:`×`})]}),(0,B.jsxs)(`nav`,{"aria-label":D(U?`世界修订文件视图`:`内容包文件视图`),children:[(0,B.jsx)(`button`,{type:`button`,className:I===`preview`?`is-current`:``,onClick:()=>L(`preview`),children:D(`预览`)}),(0,B.jsx)(`button`,{type:`button`,className:I===`edit`?`is-current`:``,disabled:he||A,onClick:()=>L(`edit`),children:D(`编辑`)})]}),(0,B.jsx)(`div`,{className:`setting-overlay-rail-body`,children:I===`preview`?(0,B.jsx)(Kc,{target:e,files:f.files,dirty:f.dirty,selectedPath:R,onSelect:z,onEdit:()=>L(`edit`),editDisabled:he||A}):(0,B.jsx)(`fieldset`,{disabled:he||A,style:{display:`contents`},children:(0,B.jsx)(Ec,{...f,selectedPath:R,onSelectedPathChange:z,embedded:!0})})})]})]})})}function Gc({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:D(`对话历史`)}),t.length===0?(0,B.jsx)(`p`,{className:`field-note`,children:D(c?`开始后,对话、Provider 返回内容和修订差异会保留在这里。`:`开始后,对话、Provider 返回内容和已生效差异会保留在这里。`)}):(0,B.jsx)(`ol`,{"aria-label":D(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||D(`未命名对话`)}),(0,B.jsx)(`small`,{children:nl(e.createdAt)})]}),(0,B.jsx)(`span`,{className:`setting-history-status is-${e.runStatus}`,children:e.runStatus===`running`?D(`回复中`):e.runStatus===`paused`?D(`已暂停`):e.sessionId===r?D(`当前所选`):e.sessionId===n?D(`最近`):D(`可继续`)}),(0,B.jsx)(`small`,{className:`setting-history-counts`,children:D(`{turns} 轮对话 · {tools} 次工具 · {files} 个文件`,{turns:e.turnCount,tools:e.toolCallCount,files:e.changedFileCount})})]}),(0,B.jsx)(`button`,{type:`button`,className:`setting-history-delete`,"aria-label":D(`删除对话:{title}`,{title:e.excerpt||D(`未命名对话`)}),disabled:i||a!==null||e.runStatus===`running`,onClick:()=>void s(e),children:c?`…`:D(`删除`)})]},e.sessionId)})})]})}function Kc({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:D(s?`世界修订工作树`:`内容包当前树`)}),(0,B.jsx)(`small`,{children:D(n?`正在预览未保存的文件草稿`:s?`正在预览已保存的修订工作树`:`正在预览已保存的当前树`)})]}),(0,B.jsx)(`span`,{children:D(`{count} 份文件`,{count:t.length})})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:D(`筛选文件`)}),(0,B.jsx)(`input`,{type:`search`,value:c,placeholder:D(`人物、地点或文件名`),onChange:e=>u(e.currentTarget.value)})]}),(0,B.jsx)(`nav`,{"aria-label":D(s?`世界修订文件树`:`内容包文件树`),children:m.length===0?(0,B.jsx)(`p`,{children:D(`没有匹配的文件。`)}):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:D(s?`当前修订工作树还没有文件。`:`当前内容包还没有文件。`)}),(0,B.jsx)(`button`,{type:`button`,disabled:o,onClick:a,children:D(`新建第一份文件`)})]}):(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:D(`编辑这份文件`)})]}),f.encoding===`base64`?(0,B.jsx)(`p`,{children:D(`二进制资源不在文本预览中展开。`)}):(0,B.jsx)(`pre`,{children:f.contents})]})]})}function qc({turn:e,currentFiles:t,rollbackDisabled:n,rollbackableChangeSetIds:r,rollingBackFile:i,onRollbackFile:a}){let o=e.exchanges.filter(Jc),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:D(`你`)}),(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:D(`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:D(`本段调用详情`)}),(0,B.jsx)(`small`,{children:D(`{count} 项记录`,{count:s})})]}),(0,B.jsx)(`div`,{className:`setting-turn-trace-exchanges`,children:o.map(e=>(0,B.jsx)(Yc,{exchange:e,currentFiles:t,rollbackDisabled:n,rollbackableChangeSetIds:r,rollingBackFile:i,onRollbackFile:a},e.id))})]})]})}function Jc(e){return(e.reasoning?.length??0)>0||e.toolCalls.length>0}function Yc({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:D(`第 {exchange} 次模型交换`,{exchange:e.exchange})}),(0,B.jsx)(`span`,{children:D(`{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:D(`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:D(`查看工具步骤文本(未进入最终回复)`)}),(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:D(`调用 {tool}`,{tool:e.name})}),(0,B.jsx)(`span`,{children:e.result===null?D(`等待 Runtime 结果`):e.result.isError?D(`拒绝/失败`):e.result.changes.length>0?D(`当时生效 · {count} 个文件`,{count:e.result.changes.length}):D(`成功`)})]}),(0,B.jsx)(`h5`,{children:D(`工具参数`)}),(0,B.jsx)(`pre`,{children:rl(e.arguments)}),e.result===null?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h5`,{children:D(`Runtime 工具结果`)}),(0,B.jsx)(`pre`,{children:e.result.markdown}),(0,B.jsx)(Xc,{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 Xc({changes:e,heading:t=D(`当时已生效差异`),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`?D(`新增`):e.kind===`delete`?D(`删除`):D(`修改`)}),(0,B.jsx)(`code`,{children:e.path})]}),(0,B.jsx)(Uc,{before:e.before,after:e.after,label:D(`{path} 的完整差异`,{path:e.path})}),n===void 0?null:(0,B.jsx)(Qc,{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 Zc({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:D(`已封存修订`)}),(0,B.jsx)(`small`,{children:D(`{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`?D(`已应用修订`):D(`已放弃修订`)}),(0,B.jsx)(`small`,{children:nl(e.finishedAt)})]}),(0,B.jsx)(Xc,{changes:e.diff,heading:D(`封存时的完整差异`)}),e.changes.map(e=>(0,B.jsx)(Xc,{changes:e.changes,heading:`${e.source===`manual`?D(`手动编辑`):e.source===`ai`?D(`AI 修改`):D(`回滚`)} · ${nl(e.createdAt)}`},e.changeSetId))]},e.epochId))})]})}function Qc({changeSetId:e,change:t,currentFiles:n,disabled:r,rolling:i,onRollback:a}){let o=$c(n,t);return(0,B.jsx)(`div`,{className:`setting-change-rollback ${o?`is-already_rolled_back`:``}`,children:o?(0,B.jsx)(`span`,{children:D(`当前文件已是修改前版本`)}):(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r,onClick:()=>void a(e,t.path),children:D(i?`正在回滚…`:`回滚这个文件`)})})}function $c(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 el({legacy:e}){return(0,B.jsxs)(`details`,{className:`setting-legacy-draft-history`,children:[(0,B.jsx)(`summary`,{children:D(`迁移前的隔离草稿记录(仅回顾)`)}),(0,B.jsx)(`p`,{children:e.outcome===`applied`?D(`这份旧草稿在迁移前已经应用。`):e.outcome===`discarded`?D(`这份旧草稿在迁移前已经放弃。`):e.outcome===`apply_outcome_unknown`?D(`旧应用收据的结果无法确认;迁移没有改写当前树。`):D(`这份旧草稿没有自动应用;当前树保持迁移时的真实状态。`)}),(0,B.jsx)(Xc,{changes:e.changes,heading:e.outcome===`applied`?D(`迁移前已应用的差异`):e.outcome===`apply_outcome_unknown`?D(`迁移前草稿差异(结果未知)`):D(`迁移前草稿差异(未生效)`)})]})}function tl({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:D(`AI 正在处理…`)}),(0,B.jsx)(`p`,{children:D(`第 {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:D(`已 {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:D(`正在接收的正文`)}),(0,B.jsx)(`pre`,{children:r.visibleText})]}):null,o?(0,B.jsxs)(`details`,{className:`setting-live-trace-group`,children:[(0,B.jsx)(`summary`,{children:D(`正在接收调用详情`)}),r?.reasoningText?.length?(0,B.jsxs)(`details`,{className:`setting-live-trace`,children:[(0,B.jsx)(`summary`,{children:D(`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:D(`正在接收的工具调用片段`)}),(0,B.jsx)(`pre`,{children:r.toolFragment})]}):null]}):null]})]})}function nl(e){return new Intl.DateTimeFormat(E(),{dateStyle:`medium`,timeStyle:`short`}).format(e)}function rl(e){try{return JSON.stringify(e,null,2)}catch{return D(`[参数无法序列化]`)}}var il=class extends Error{latest;constructor(e){super(`The content package changed after this draft was opened`),this.name=`AuthoringConflictError`,this.latest=e}},al={opened:``,locked:``,deleted:`对话历史已删除;内容包当前树没有回滚。`,saved:`内容包当前树已整批保存。`,reset:`已放弃未保存修改;内容包当前树未改变。`,rolledBack:`已回滚这个文件;对话历史仍然保留。`,alreadyRolledBack:`当前文件已是修改前版本。`,rollbackReadFailure:`Runtime 已确认回滚结果,但重新读取内容包失败:{message}`},ol={opened:`浏览不会锁定世界;首次编辑或发送消息后才会锁定。`,locked:`世界已锁定到这份修订;关闭页面也会保留工作树。`,deleted:`对话历史已删除;修订工作树中的改动没有回滚。`,saved:`手动修改已保存到修订工作树,可以继续编辑或回滚。`,reset:null,rolledBack:`已回滚所选文件;其他修订保持不变。`,alreadyRolledBack:`这个文件已经是该次修改前的版本。`,rollbackReadFailure:`Runtime 已确认回滚结果,但重新读取修订工作树失败:{message}`};async function sl(e,t){return await e.request(t)}function cl(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?.contents===e.contents&&t?.encoding===e.encoding})}function ll(e){return!(e instanceof ne)||e.protocolCode!==`content_conflict`?null:e.details?.current??null}function ul(e,t){return{kind:`setting`,messages:al,id:t,read:async()=>{let[n,r]=await Promise.all([sl(e,{type:`setting-improvement.overview`,packageId:t}),sl(e,{type:`content.read`,packageId:t})]);return{...n,files:r.files,packageDetail:r}},readSession:n=>sl(e,{type:`setting-improvement.session.read`,packageId:t,sessionId:n}),send:(n,r)=>sl(e,{type:`setting-improvement.message`,packageId:t,message:n,requestId:p(`setting-message`),continuation:fl(r)}),cancel:t=>sl(e,{type:`setting-improvement.cancel`,sessionId:t}),resume:n=>sl(e,{type:`setting-improvement.resume`,packageId:t,sessionId:n,requestId:p(`setting-resume`)}),deleteSession:async n=>{let r=await sl(e,{type:`setting-improvement.session.delete`,packageId:t,sessionId:n}),i=await sl(e,{type:`content.read`,packageId:t});return{...r,files:i.files,packageDetail:i}},beginEdit:()=>null,save:async(n,r,i)=>{if(r.treeRevision===null)throw Error(D(`内容包版本缺失,请重新读取后再保存。`));let a;try{a=await sl(e,{type:`content.replace`,packageId:t,files:n,baseTreeRevision:r.treeRevision})}catch(e){let t=ll(e);throw t===null?e:new il({...i,files:t.files,packageDetail:t})}return{...i,files:a.files,packageDetail:a}},rollback:(n,r,i)=>sl(e,{type:`setting-improvement.rollback`,packageId:t,sessionId:n,changeSetId:r,path:i}),preview:n=>sl(e,{type:`setting-improvement.preview`,packageId:t,...n===null?{}:{sessionId:n}})}}function dl(e,t){let n=e=>({...e,packageId:t,legacyDraft:null}),r=async r=>{let i=r.epoch?.locked?r.epoch.files:null;if(i===null){let[n,r]=await Promise.all([sl(e,{type:`world.surface.read`,worldId:t,surface:`state`}),sl(e,{type:`world.surface.read`,worldId:t,surface:`control`})]);i=[...n.map(e=>({...e,path:`state/${e.path}`})),...r.map(e=>({...e,path:`control/${e.path}`}))]}return{files:i,latest:r.latest===null?null:n(r.latest),history:r.history,revision:r}},i=e=>{let t=e.revision?.epoch;if(!t?.locked)throw Error(`The world-revision epoch is no longer active`);return t};return{kind:`revision`,messages:ol,id:t,read:async()=>r(await sl(e,{type:`world.revision.overview`,worldId:t})),readSession:async r=>n(await sl(e,{type:`world.revision.session.read`,worldId:t,sessionId:r})),send:async(r,i)=>n(await sl(e,{type:`world.revision.message`,worldId:t,message:r,requestId:p(`world-revision-message`),continuation:fl(i)})),cancel:async t=>n(await sl(e,{type:`world.revision.cancel`,sessionId:t})),resume:async r=>n(await sl(e,{type:`world.revision.resume`,worldId:t,sessionId:r,requestId:p(`world-revision-resume`)})),deleteSession:async n=>r(await sl(e,{type:`world.revision.session.delete`,worldId:t,sessionId:n})),beginEdit:n=>n.revision?.epoch?.locked?null:sl(e,{type:`world.revision.open`,worldId:t}).then(r),save:async(n,a,o)=>{let s=i(o);if(!cl(a.files,s.files))throw Error(D(`世界已在浏览期间发生变化;请重置草稿并重新编辑。`));return r(await sl(e,{type:`world.revision.files.replace`,worldId:t,epochId:s.epochId,expectedRevision:s.revision,files:n}))},rollback:(n,r,a,o)=>sl(e,{type:`world.revision.rollback`,worldId:t,epochId:i(o).epochId,changeSetId:r,path:a}),preview:n=>sl(e,{type:`world.revision.preview`,worldId:t,...n===null?{}:{sessionId:n}}),finish:async(n,r)=>{let a=i(r);await e.request(n===`apply`?{type:`world.revision.apply`,worldId:t,epochId:a.epochId,expectedRevision:a.revision}:{type:`world.revision.discard`,worldId:t,epochId:a.epochId})}}}function fl(e){return e===null?{kind:`fresh_context`}:{kind:`continue_context`,sessionId:e}}var pl=e=>e.map(e=>({...e})),ml=e=>e?.packageDetail?.treeRevision??null,hl=class{state={target:null,view:null,files:[],baseline:[],baselineRevision:null,serverFiles:[],dirty:!1,conflict:!1,draftsLocked:!1,loading:!0,applying:!1,requestFailure:null,observationFailure:null,notice:``,now:0};draftHolds=0;listeners=new Set;unsubscribe;scope=0;active=!1;target;observe;selection=null;selectionVersion=0;observationVersion=0;timer;constructor(e,t){this.target=e,this.observe=t}current(){let e=this.scope,t=this.selectionVersion;return()=>this.active&&e===this.scope&&t===this.selectionVersion}getSnapshot=()=>this.state;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});update(e){this.state={...this.state,...e};for(let e of this.listeners)e()}accept(e){let t=pl(e.files);this.update({target:e,serverFiles:t,...!this.state.dirty&&this.saving===null?{files:pl(t),baseline:pl(t),baselineRevision:ml(e)}:{}})}async holdDraftsWhile(e){let t=this.scope,n=()=>this.active&&t===this.scope;this.draftHolds+=1,this.update({draftsLocked:!0});try{await e(),n()&&await this.refresh()}finally{--this.draftHolds,this.update({draftsLocked:this.draftHolds>0})}}async refresh(){if(!this.active||this.state.applying||this.state.dirty)return;let e=this.current(),t=await this.target.read();e()&&this.accept(t)}async open(){this.close(),this.active=!0,this.selection=null,this.update({target:null,view:null,files:[],baseline:[],baselineRevision:null,serverFiles:[],dirty:!1,conflict:!1,loading:!0,applying:!1,requestFailure:null,observationFailure:null,notice:``});let e=this.current();try{let t=await this.target.read();if(!e())return;this.accept(t),this.selection=t.latest?.sessionId??null,this.update({view:t.latest,loading:!1,now:Date.now(),notice:D(t.revision?.epoch?.locked?this.target.messages.locked:this.target.messages.opened)}),this.observeSelection(),this.timer=setInterval(()=>{this.active&&this.update({now:Date.now()})},1e3)}catch(t){e()&&this.update({requestFailure:gl(t),loading:!1})}}observeSelection(){this.unsubscribe?.();let e=++this.observationVersion,t=this.current(),n=()=>t()&&e===this.observationVersion,r=typeof this.selection==`string`?this.selection:void 0;this.unsubscribe=this.observe?.({kind:this.target.kind,id:this.target.id,...r===void 0?{}:{sessionId:r}},async(e,t)=>{if(n()&&e.kind===this.target.kind){if(t)try{let e=await this.target.read();if(!n())return;let t=this.selection,i=typeof t==`string`&&t!==e.latest?.sessionId?await this.target.readSession(t):e.latest;if(!n())return;this.accept(e),t===null?(this.selection=e.latest?.sessionId??null,this.update({view:i})):typeof t==`string`?this.update({view:i}):t.started&&e.latest!==null&&e.latest.sessionId!==t.previousSessionId&&(this.selection=e.latest.sessionId,this.update({view:e.latest})),r!==(typeof this.selection==`string`?this.selection:void 0)&&this.observeSelection()}catch(e){if(n())throw e}else{let t=e.value.selected,n=this.state.view;t!==null&&n?.sessionId===t.sessionId&&this.update({view:{...n,runStatus:t.runStatus,progress:t.progress}})}n()&&this.update({now:Date.now()})}},(e,t)=>{n()&&this.update({observationFailure:ee(e,t)})})}close(){this.active=!1,this.scope+=1,this.selectionVersion+=1,this.observationVersion+=1,this.editOpening=null,this.saving=null,this.unsubscribe?.(),this.unsubscribe=void 0,clearInterval(this.timer),this.timer=void 0}startFresh(){this.active&&!this.state.applying&&(this.selectionVersion+=1,this.selection={previousSessionId:this.state.target?.latest?.sessionId??null,started:!1},this.update({view:null,loading:!1,requestFailure:null}),this.observeSelection())}async selectSession(e){if(!this.active||this.state.applying)return;this.selectionVersion+=1,this.selection=e;let t=this.current();this.update({view:null,loading:!0,requestFailure:null}),this.observeSelection();try{let n=this.state.target?.latest?.sessionId===e?this.state.target.latest:await this.target.readSession(e);t()&&this.update({view:n})}catch(e){t()&&this.update({requestFailure:gl(e)})}finally{t()&&this.update({loading:!1})}}async send(e){if(!this.active||this.state.applying)return;let t=this.current();if(this.state.dirty)throw Error(D(`请先保存文件编辑,再继续 AI 设定完善。`));typeof this.selection!=`string`&&(this.selection===null?this.selection={previousSessionId:this.state.target?.latest?.sessionId??null,started:!0}:this.selection.started=!0);let n=typeof this.selection==`string`?this.selection:null;await this.settleRequest(t,()=>this.target.send(e,n))}async resume(){if(!this.active||this.state.applying||typeof this.selection!=`string`)return;let e=this.current();if(this.state.dirty)throw Error(D(`请先保存文件编辑,再继续 AI 设定完善。`));let t=this.selection;await this.settleRequest(e,()=>this.target.resume(t))}async settleRequest(e,t){this.update({requestFailure:null,notice:``});try{let n=await t();if(!e())return;this.selection=n.sessionId,this.update({view:n}),this.observeSelection();let r=await this.target.read();e()&&this.accept(r)}catch(t){if(!e())return;throw this.update({requestFailure:gl(t)}),t}}async cancel(){if(!this.active||this.state.applying||typeof this.selection!=`string`)return;let e=this.current();this.update({requestFailure:null});try{let t=await this.target.cancel(this.selection);e()&&(this.update({view:t}),this.observeSelection())}catch(t){e()&&this.update({requestFailure:gl(t)})}}async deleteSession(e){if(!this.active||this.state.applying)return;let t=this.current();this.update({loading:!0,requestFailure:null});try{let n=await this.target.deleteSession(e);if(!t())return;this.accept(n),this.selection===e||this.selection===null?(this.selection=n.latest?.sessionId??null,this.update({view:n.latest}),this.observeSelection()):typeof this.selection==`object`&&!this.selection.started&&(this.selection.previousSessionId=n.latest?.sessionId??null),this.observeSelection(),this.update({notice:D(this.target.messages.deleted)})}catch(e){if(!t())return;throw this.update({requestFailure:gl(e)}),e}finally{t()&&this.update({loading:!1})}}async rollbackFile(e,t,n){let r=this.current();if(this.state.applying||this.state.dirty||this.state.target===null)throw Error(D(`请先保存或放弃文件编辑中的未保存修改。`));this.update({requestFailure:null,notice:``});let i;try{i=await this.target.rollback(e,t,n,this.state.target)}catch(e){throw r()&&this.update({requestFailure:gl(e)}),e}if(!r())return i;try{let e=await this.target.read();r()&&(this.accept(e),this.observeSelection())}catch(e){r()&&this.update({requestFailure:D(this.target.messages.rollbackReadFailure,{message:gl(e)})})}return r()&&this.update({notice:D(i.status===`rolled_back`?this.target.messages.rolledBack:this.target.messages.alreadyRolledBack)}),i}async finish(e){let t=this.state.target,n=t?.revision?.epoch;if(!this.active||this.state.applying||this.state.loading||t===null||!n?.locked||this.state.dirty||this.target.finish===void 0||e===`apply`&&n.diagnostics.length>0)return null;let r=this.current();this.update({applying:!0,requestFailure:null});try{return await this.target.finish(e,t),r()?{changed:n.diff.length>0}:null}catch(e){return r()&&this.update({requestFailure:gl(e)}),null}finally{r()&&this.update({applying:!1})}}async preview(){let e=this.current();try{let t=await this.target.preview(typeof this.selection==`string`?this.selection:null);return e()?t:null}catch(t){if(!e())return null;throw t}}editOpening=null;editFiles(e){!this.active||this.state.applying||this.draftHolds>0||(this.update({files:pl(e),dirty:!cl(this.state.baseline,e)}),this.ensureEditing())}ensureEditing(){if(!this.state.dirty||this.state.target===null||this.editOpening!==null)return;let e=this.target.beginEdit(this.state.target);if(e===null)return;let t=this.current();this.update({loading:!0,requestFailure:null});let n=e.then(e=>{t()&&(this.accept(e),this.update({notice:D(this.target.messages.locked)}))}).catch(e=>{t()&&this.update({requestFailure:gl(e)})}).finally(()=>{this.editOpening===n&&(this.editOpening=null),t()&&this.update({loading:!1})});this.editOpening=n}saving=null;saveFiles(){if(this.saving!==null)return this.saving;let e=pl(this.state.files),t=this.saveDraft(e).finally(()=>{this.saving===t&&(this.saving=null)});return this.saving=t,t}async saveDraft(e){if(!this.active||this.state.applying||!this.state.dirty||this.state.target===null)return;let t=this.current();if(this.ensureEditing(),this.editOpening!==null&&await this.editOpening,t()&&this.state.target!==null){this.update({loading:!0,requestFailure:null});try{let n=await this.target.save(e,{files:this.state.baseline,treeRevision:this.state.baselineRevision},this.state.target);if(!t())return;let r=pl(this.state.files),i=cl(e,r);this.accept(n);let a=pl(n.files);this.update({baseline:a,baselineRevision:ml(n),conflict:!1,...i?{files:pl(a),dirty:!1}:{files:r,dirty:!cl(a,r)},notice:D(this.target.messages.saved)}),this.observeSelection()}catch(e){if(!t())return;e instanceof il?(this.accept(e.latest),this.update({conflict:!0,requestFailure:null})):this.update({requestFailure:gl(e)})}finally{t()&&this.update({loading:!1})}}}loadLatest(){this.active&&!this.state.applying&&this.state.conflict&&this.update({files:pl(this.state.serverFiles),baseline:pl(this.state.serverFiles),baselineRevision:ml(this.state.target),dirty:!1,conflict:!1,requestFailure:null,notice:D(`已放弃草稿,载入内容包最新版本。`)})}resetFiles(){this.active&&!this.state.applying&&this.update({files:pl(this.state.serverFiles),baseline:pl(this.state.serverFiles),baselineRevision:ml(this.state.target),conflict:!1,dirty:!1,requestFailure:null,notice:this.target.messages.reset===null?this.state.notice:D(this.target.messages.reset)})}};function gl(e){return e instanceof Error?e.message:D(`操作失败`)}function _l(e,t,n,r){let i=(0,l.useMemo)(()=>new hl(t===`setting`?ul(e,n):dl(e,n),e.observeConversation),[e,t,n]),a=(0,l.useSyncExternalStore)(i.subscribe,i.getSnapshot);return(0,l.useEffect)(()=>(r&&n!==``&&i.open(),()=>i.close()),[i,r,n]),{workspace:i,state:a}}var vl={configuration_mismatch:{title:`旧模型配置曾阻止发送`,description:`旧版本因模型配置变化阻止了这次发送。切回原协议后,可按上下文当前状态继续。`},outcome_unknown:{title:`模型请求结果未知`,description:`模型请求已发出,但结果未知。旧请求不能重发;为避免重复生成,请从全新上下文继续。`},context_limit:{title:`模型上下文已达上限`,description:`当前上下文超过了模型的输入上限。旧请求不能重发,请从全新上下文继续。`},output_limit:{title:`模型输出已达上限`,description:`模型回复达到输出上限,尚未完成。请在模型配置中调高最大输出 Token,保存后从全新上下文继续。推理也可能占用输出额度。`},context_unavailable:{title:`模型上下文无法继续`,description:`当前上下文的续传信息缺失或不可用。旧请求不能重发,请从全新上下文继续。`},retryable:{title:`模型请求可以重新发送`,description:`模型拒绝了请求,或请求尚未发出。可以重新发送已保存的请求,不会重复提交玩家原文。`},provider_error:{title:`模型连接发生错误`,description:`模型服务未能完成请求。请检查模型连接;也可以从全新上下文继续。`},other:{title:`调用链中断`,description:`处理这次请求时发生错误。旧请求不能重发;请查看技术详情,也可以从全新上下文继续。`}};function yl(e,t){return D(vl[e??(t?`retryable`:`other`)].description)}function bl({failureKind:e,canRetry:t,message:n,recovery:r}){let i=e??(t?`retryable`:`other`),a=vl[i];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:D(a.title)}),(0,B.jsx)(`p`,{children:D(a.description)}),r===void 0?null:(0,B.jsxs)(`div`,{className:`play-failure-actions`,children:[i===`retryable`&&r.canRetry?(0,B.jsx)(`button`,{type:`button`,disabled:r.playDisabled,onClick:r.onRetry,children:D(`重新发送`)}):null,(0,B.jsx)(`button`,{type:`button`,disabled:r.playDisabled,onClick:r.onFreshContext,children:D(`从全新上下文继续`)}),i===`provider_error`||i===`output_limit`?(0,B.jsx)(`button`,{type:`button`,disabled:r.configureDisabled,onClick:r.onConfigureModel,children:D(i===`output_limit`?`调整最大输出`:`检查模型连接`)}):null]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`技术详情`)}),(0,B.jsx)(`pre`,{children:n})]})]})}function xl({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(t){a({key:e,message:t instanceof Error?t.message:String(t)})}finally{r(!1)}},s={preset:D(`玩法预设`),package:D(`内容包`),builtin:D(`系统示例`),world:D(`世界`)},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?D(`已启用`):e.selected&&e.group?D(`随组暂停`):D(`已关闭`)]}),(0,B.jsx)(`button`,{type:`button`,disabled:n||!e.overridden,"aria-label":`${D(`恢复默认`)}:${e.name}`,onClick:()=>void o(e.key,`default`),children:D(`恢复默认`)}),i?.key===e.key?(0,B.jsx)(`p`,{className:`world-extension-failure`,role:`alert`,children:i.message}):null]},e.key);return(0,B.jsxs)(`details`,{className:`world-extension-menu`,children:[(0,B.jsx)(`summary`,{children:D(`世界扩展`)}),(0,B.jsxs)(`div`,{className:`world-extension-options`,children:[(0,B.jsx)(`p`,{children:D(`选择仅用于当前世界。后置请求重新开启后,从下一次正常发送生效;界面显示直接读取当前字段。`)}),(0,B.jsxs)(`fieldset`,{children:[(0,B.jsx)(`legend`,{children:D(`后置请求`)}),e.items.filter(e=>e.kind===`request`||e.kind===`group`).map(c)]}),(0,B.jsxs)(`fieldset`,{children:[(0,B.jsx)(`legend`,{children:D(`界面显示(不调用模型)`)}),e.items.filter(e=>e.kind===`panel`||e.kind===`view`).map(c)]})]})]})}var Sl=`narraeon.checkpoint-context.v1`;function Cl(e,t){try{return window.localStorage.getItem(Tl(e,t))===`handled`}catch{return!1}}function wl(e,t){try{window.localStorage.setItem(Tl(e,t),`handled`)}catch{}}function Tl(e,t){return`${Sl}:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function El({report:e,preview:t=!1}){if(e===void 0)return null;let n=E()===`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 Dl({documents:e,selectedPath:t,onSelect:n,onRevise:r,revisionDisabled:i=!1}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``);oe(a,()=>o(!1));let 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=lc(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:D(`选择文档`)}),(0,B.jsx)(`strong`,{children:u===void 0?D(`当前世界`):lc(u).title})]}),(0,B.jsxs)(`span`,{children:[e.length,` `,D(`份`),` `,a?`▴`:`▾`]})]}),a?(0,B.jsxs)(`div`,{className:`world-document-menu`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`visually-hidden`,children:D(`查找当前文档`)}),(0,B.jsx)(`input`,{autoFocus:!0,type:`search`,value:s,placeholder:D(`查找人物、地点、规则…`),onChange:e=>c(e.currentTarget.value)})]}),(0,B.jsx)(`div`,{role:`listbox`,"aria-label":D(`当前世界文档`),children:f.length===0?(0,B.jsx)(`p`,{children:D(`没有匹配的文档`)}):f.map(e=>{let t=lc(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?D(`全部 {count} 份文档`,{count:e.length}):D(`找到 {visible} / {total} 份`,{visible:f.length,total:e.length})})]}):null]}),u===void 0?(0,B.jsx)(`p`,{className:`world-document-empty`,children:D(`当前世界没有状态文档。`)}):(0,B.jsxs)(`article`,{className:`world-document-card`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:lc(u).title}),(0,B.jsx)(`small`,{children:lc(u).summary})]}),(0,B.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>r(u.path),children:D(`修订`)})]}),(0,B.jsx)(`pre`,{children:u.contents})]})]})}function Ol({reading:e,loading:t,documents:n,onOpenFull:r}){if(t&&e===null)return(0,B.jsx)(`p`,{role:`status`,children:D(`正在核对 Runtime 读取记录…`)});if(e===null)return(0,B.jsx)(`p`,{children:D(`暂时无法读取上下文证据。`)});let i=Pl(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:D(`当前没有追加上下文`)}),(0,B.jsx)(`strong`,{children:D(`下一次行动将建立全新上下文`)})]}):(0,B.jsxs)(`section`,{className:e.currentContext.stale?`ai-reading-context-card is-stale`:`ai-reading-context-card`,children:[(0,B.jsx)(`span`,{children:D(`最近一次请求材料`)}),(0,B.jsx)(`strong`,{children:e.currentContext.requestHead??e.currentContext.baselineHead}),(0,B.jsx)(`p`,{children:e.currentContext.stale?D(`当前世界已推进;这条追加上下文不能再继续。`):D(`下一次发送将采用当前预设和世界材料;原生对话保留。`)})]}),(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:D(`这里只证明 Runtime 发送或返回了什么,不声称 AI 理解、记住或正确使用。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:r,children:D(`展开完整读取记录`)})]})}function kl({reading:e,documents:t,onClose:n}){return oe(!0,n),(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:D(`Runtime 证据`)}),(0,B.jsx)(`h2`,{id:`ai-reading-audit-title`,children:D(`AI 如何读取`)}),(0,B.jsx)(`p`,{children:D(`这里只查看上下文证据,不会开启修订或锁定世界。`)})]}),(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":D(`关闭`),children:`×`})]}),(0,B.jsx)(Ml,{reading:e,documents:t})]})})}function Al({value:e,saving:t,onChange:n,onClose:r}){return oe(!0,r),(0,B.jsxs)(`aside`,{className:`world-reading-popover`,"aria-label":D(`阅读设置`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`strong`,{children:D(`阅读设置`)}),(0,B.jsx)(`button`,{type:`button`,onClick:r,"aria-label":D(`关闭`),children:`×`})]}),(0,B.jsxs)(`label`,{className:`world-reading-technical-toggle`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.showTechnicalInfo,onChange:t=>n({...e,showTechnicalInfo:t.target.checked})}),(0,B.jsx)(`span`,{children:D(`显示技术信息`)})]}),(0,B.jsxs)(`div`,{className:`world-density-picker`,children:[(0,B.jsx)(`span`,{children:D(`排版密度`)}),(0,B.jsx)(`div`,{children:[[`compact`,D(`紧凑`)],[`standard`,D(`标准`)],[`relaxed`,D(`舒展`)]].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)(jl,{label:D(`字号`),value:e.fontSize,output:e.fontSize+`px`,min:15,max:24,step:1,onChange:t=>n({...e,fontSize:t})}),(0,B.jsx)(jl,{label:D(`行距`),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)(jl,{label:D(`字间距`),value:e.letterSpacing,output:e.letterSpacing.toFixed(2)+`em`,min:0,max:.12,step:.01,onChange:t=>n({...e,letterSpacing:t})}),(0,B.jsx)(jl,{label:D(`正文宽度`),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({..._}),children:D(`恢复默认`)}),(0,B.jsx)(`small`,{role:`status`,children:D(t?`正在保存…`:`阅读设置保存在本机`)})]})}function jl({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 Ml({reading:e,documents:t}){if(e===null)return(0,B.jsx)(`div`,{className:`ai-reading-audit`,children:(0,B.jsx)(`p`,{role:`status`,children:D(`请先从右侧 AI 读取页加载 Runtime 证据。`)})});let n=Pl(e,t,`current`),r=Pl(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:D(`AI 实际收到了哪些世界内容`)}),(0,B.jsx)(`p`,{children:D(`分别展示最近一次请求、累计当时读取和下一次候选;旧读取不代表当前字段值。`)})]})}),(0,B.jsxs)(`div`,{className:`ai-reading-flow`,children:[(0,B.jsxs)(`article`,{children:[(0,B.jsx)(`span`,{children:D(`当前上下文`)}),(0,B.jsx)(`strong`,{children:e.currentContext?.requestHead??e.currentContext?.baselineHead??D(`尚未建立`)}),(0,B.jsx)(`p`,{children:D(`每次正常发送重新编译,工具往返使用本轮快照`)})]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(`span`,{children:D(`按需读取`)}),(0,B.jsxs)(`strong`,{children:[e.currentContext?.reads.filter(({ok:e})=>e).length??0,` `,D(`次成功记录`)]}),(0,B.jsx)(`p`,{children:D(`来自当前链已结算的 context_read`)})]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,B.jsxs)(`article`,{children:[(0,B.jsx)(`span`,{children:D(`下一次发送候选`)}),(0,B.jsx)(`strong`,{children:e.nextFreshContext?.head??D(`模型未配置`)}),(0,B.jsx)(`p`,{children:D(`按当前世界重新运行真实 Prompt 编译`)})]})]}),(0,B.jsx)(El,{report:e.currentContext?.prefixDiagnostics}),(0,B.jsx)(El,{report:e.nextFreshContext?.prefixDiagnostics,preview:!0}),(0,B.jsx)(Nl,{title:D(`最近一次请求材料`),rows:n}),(0,B.jsx)(Nl,{title:D(`下一次发送候选`),rows:r}),(0,B.jsx)(Nl,{title:D(`累计实际读取(当时内容)`),rows:Pl(e,t,`cumulative`)}),(0,B.jsx)(Wo,{report:e.nextFreshContext?.preview.compilation.maintenance}),e.currentContext?.reads.length?(0,B.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,B.jsx)(`summary`,{children:D(`查看按需读取返回的完整记录`)}),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?D(`读取成功 · 完整文档`):D(`读取成功 · 文档片段`):D(`读取失败`)}),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:D(`查看各次请求保存的提示材料`)}),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:D(`查看当前上下文的完整 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:D(`当前还没有冻结上下文。`)})]}),(0,B.jsxs)(`details`,{className:`ai-reading-raw`,children:[(0,B.jsx)(`summary`,{children:D(`查看下一次发送候选的完整 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:D(`配置模型后才能编译下一次上下文。`)})]}),(0,B.jsx)(`p`,{className:`ai-reading-caveat`,children:D(`这些证据只能证明 Runtime 发出了哪些文本、工具返回了哪些内容;无法证明模型理解或记住。`)})]})}function Nl({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:D(`世界内容`)}),(0,B.jsx)(`span`,{children:D(`进入方式`)}),(0,B.jsx)(`span`,{children:D(`可核验依据`)})]}),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 Pl(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=lc(t),o=i.find(({ref:e,ok:t})=>t&&Fl(e)===a.ref);if(o!==void 0)return{path:t.path,title:a.title,label:o.locator===null?o.complete?D(`精确全文`):D(`全文片段`):o.complete?D(`精确节点`):D(`节点片段`),detail:D(`累计读取的当时内容,不代表当前字段值`),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:D(`未进入`),detail:D(n===`current`?`没有 bootstrap 注入或成功读取记录`:`下一次 Prompt Preview 未选择这份文档`),tone:`muted`}:{path:t.path,title:a.title,label:D(`标题 + 摘要`),detail:D(`材料目录;正文没有因此进入上下文`),tone:`warning`}:{path:t.path,title:a.title,label:c.complete&&c.readAuthorization?.locator===null?D(`全文`):D(`节点`),detail:D(n===`cumulative`?`累计读取的当时内容,不代表当前字段值`:n===`current`?`本次请求快照的真实覆盖`:`下一次 Prompt Preview 的真实 coverage`),tone:c.complete?`good`:`warning`}})}function Fl(e){return e.replace(/^@/u,``).split(`#/`,1)[0]??``}function Il({worldBackupExport:e,packageScriptPermission:t,world:n,worldTitle:r,worldNameDraft:i,setWorldNameDraft:a,pending:o,activeStatus:s,controlFiles:c,controlDirty:l,controlPreview:u,onControlFiles:d,onResetControl:f,onRename:p,onExportStory:m,onDerive:h,onPreviewControl:g,onApplyControl:_,onClose:v,modelConfigured:y,revisionLocked:b}){return oe(!0,v),(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:D(`世界管理`)}),(0,B.jsx)(`p`,{children:D(`管理名称、分叉、控制文件与 Runtime 诊断。`)})]}),(0,B.jsx)(`button`,{type:`button`,onClick:v,"aria-label":D(`关闭`),children:`×`})]}),(0,B.jsxs)(`div`,{className:`world-management-body`,children:[(0,B.jsxs)(`details`,{className:`world-permission-disclosure`,children:[(0,B.jsx)(`summary`,{children:D(`内容包脚本权限`)}),t]}),b?(0,B.jsx)(`p`,{className:`setting-improvement-warning`,role:`status`,children:D(`世界修订期间,分叉和控制变更已锁定;本地显示名称仍可修改。`)}):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:D(`世界名称`)}),(0,B.jsx)(`p`,{children:D(`只改变工作区显示名称,不改变故事与状态。`)})]}),(0,B.jsxs)(`form`,{className:`world-name-editor`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`visually-hidden`,children:D(`世界显示名称`)}),(0,B.jsx)(`input`,{maxLength:160,value:i,onChange:e=>a(e.currentTarget.value)})]}),(0,B.jsx)(`button`,{type:`submit`,disabled:o!==null||i.trim()===``||i.trim()===r,children:D(`保存名称`)})]})]}),(0,B.jsxs)(`article`,{className:`manage-card`,children:[(0,B.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,B.jsx)(`h3`,{children:D(`导出故事`)}),(0,B.jsx)(`p`,{children:D(`下载当前时间线的开场白、玩家原文与主持正文。`)})]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:o!==null,onClick:()=>m(`markdown`),children:D(`导出 Markdown`)}),(0,B.jsx)(`button`,{type:`button`,disabled:o!==null,onClick:()=>m(`text`),children:D(`导出纯文本`)})]})]}),(0,B.jsxs)(`article`,{className:`manage-card derive-card`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:D(`从当前端点创建分叉`)}),(0,B.jsx)(`p`,{children:D(`创建一个拥有独立状态与时间线的新世界。`)})]}),(0,B.jsx)(`button`,{type:`button`,disabled:o!==null||s===`running`||b,onClick:h,children:D(`创建分叉`)})]}),e,(0,B.jsxs)(`details`,{className:`manage-disclosure`,children:[(0,B.jsx)(`summary`,{children:D(`世界控制 · 高级编辑`)}),(0,B.jsxs)(`article`,{className:`manage-card control-card`,children:[(0,B.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,B.jsx)(`h3`,{children:D(`世界控制`)}),(0,B.jsx)(`p`,{children:D(`控制草稿必须经过真实 Prompt Preview 后整批应用。`)})]}),(0,B.jsx)(`span`,{className:`control-draft-state`,children:D(l?`有尚未预览的修改`:`当前已应用控制`)}),(0,B.jsxs)(`label`,{children:[D(`世界控制文件(JSON)`),(0,B.jsx)(`textarea`,{rows:18,value:c,disabled:b,onChange:e=>d(e.currentTarget.value)})]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:o!==null||!y||b,onClick:g,children:D(`预览世界控制`)}),(0,B.jsx)(`button`,{type:`button`,disabled:o!==null||u===null||s===`running`||b,onClick:_,children:D(`整批应用世界控制`)}),l&&(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:o!==null,onClick:f,children:D(`放弃控制修改`)})]}),u===null?null:(0,B.jsxs)(`details`,{className:`technical-details`,children:[(0,B.jsx)(`summary`,{children:D(`查看真实提示词预览结果`)}),(0,B.jsx)(`pre`,{children:JSON.stringify(u,null,2)})]})]})]}),(0,B.jsxs)(`details`,{className:`manage-disclosure`,children:[(0,B.jsx)(`summary`,{children:D(`运行详情`)}),(0,B.jsxs)(`article`,{className:`manage-card runtime-card`,children:[(0,B.jsx)(`h3`,{children:D(`运行详情`)}),(0,B.jsxs)(`dl`,{className:`runtime-summary`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`当前端点`)}),(0,B.jsx)(`dd`,{children:n.head})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`世界 ID`)}),(0,B.jsx)(`dd`,{children:n.worldId})]})]}),(0,B.jsxs)(`details`,{className:`technical-details`,children:[(0,B.jsx)(`summary`,{children:D(`查看 Runtime 原始诊断`)}),(0,B.jsx)(`pre`,{children:JSON.stringify(n.runtime,null,2)})]})]})]})]})]})})}function X({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":D(`产物调试器`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`p`,{className:`eyebrow`,children:`EXTENSION DEBUG`}),(0,B.jsx)(`h2`,{children:D(`产物调试器`)})]}),e.some(e=>e.frontend.mount===`story`&&!(`attachment`in e))?(0,B.jsx)(`p`,{role:`note`,children:D(`旧产物没有可证明的回复归属,仅保留诊断,无法自动迁移为正文附件。`)}):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":D(`扩展状态`),children:[(0,B.jsx)(`h3`,{children:D(`扩展状态`)}),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?D(`核心已提交`):D(`核心未提交`)}),(0,B.jsxs)(`span`,{children:[D(`已完成请求:`),e.completedRequests.length===0?D(`无`):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":D(`玩家视图面板诊断`),children:[(0,B.jsx)(`h3`,{children:D(`玩家视图面板`)}),n.map(e=>(0,B.jsxs)(`article`,{children:[(0,B.jsx)(`strong`,{children:e.panelId}),(0,B.jsxs)(`span`,{children:[D(`已提交玩家视图投影 · 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:no(e.payload,e.contentType)}),(r[`player-view:${e.panelId}`]??[]).length===0?null:(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{children:[D(`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)(Z,{record:e,bridgeEvents:r[e.recordId]??[]},`${e.recordId}-${e.sequence}`))]})}function Z({record:e,bridgeEvents:t}){let n=Y({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:D(`来源`)}),(0,B.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,B.jsx)(`dt`,{children:D(`世界端点`)}),(0,B.jsxs)(`dd`,{children:[e.parentHead,` → `,e.newHead??D(`未提交`)]}),(0,B.jsx)(`dt`,{children:D(`保存/投影`)}),(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:D(`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:no(e.payload,e.contentType)}),(0,B.jsx)(`p`,{children:D(`最终内容`)}),(0,B.jsx)(`pre`,{children:n.final}),(0,B.jsx)(`p`,{children:D(`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 Ll(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 Rl({chain:e,timeline:t,freshContextSelected:n,freshContextDisabled:r,onUseFreshContext:i}){let a=t===null||e?.chainId===t.activeChainId?e:null,o=a?.chainId??t?.activeChainId,s=t?.items.reduce((e,t)=>t.kind===`event`&&t.chainId===o&&t.event.kind===`assistant`&&t.event.status===`completed`&&(e===void 0||t.event.id>e.id)?t.event:e,void 0),c=a?.latestCompletedResponse,l=c!==void 0&&(s===void 0||c.id>=s.id)?c:s,u=a?.contextWindowTokens,d=l?.usage,f=d?.inputTokens,p=!n&&u!==void 0&&u>0&&f!=null&&d?.provenance.inputTokens!==`unavailable`?f/u*100:null,m=p===null?null:Math.floor(p),h=n?D(`下一次发送将开启全新上下文,尚无实报占用。`):l===void 0?D(`当前上下文尚无已完成的 AI 响应。`):u===void 0||u<=0?D(`当前上下文没有记录模型窗口。`):p===null?D(`Provider 未报告最近一次完整响应的输入 token 数。`):D(`最近一次完整响应的实报输入量:{input} / {window} tokens。仅作提示,不限制发送。`,{input:f,window:u});return(0,B.jsxs)(`div`,{className:`world-context-usage`,children:[p!==null&&p>=85&&!n?(0,B.jsxs)(`div`,{className:`world-context-usage-warning`,role:`status`,children:[(0,B.jsx)(`span`,{children:D(`上下文已用 {percent}%,建议下一条从全新上下文开始`,{percent:m})}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r,onClick:i,children:D(`下一条消息使用全新上下文`)})]}):null,(0,B.jsx)(`small`,{className:`world-context-usage-label`,title:h,children:p===null?D(`上下文 —`):D(`上下文 {percent}%`,{percent:p>0&&p<1?`<1`:m})})]})}function zl({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":D(`本次模型调用进度`),children:[(0,B.jsxs)(`div`,{className:`model-run-headline`,children:[(0,B.jsx)(`strong`,{children:Vl(e.phase)}),(0,B.jsx)(`span`,{children:D(`已运行 {seconds} 秒`,{seconds:r})}),(0,B.jsx)(`span`,{className:a?`model-run-age-stalled`:void 0,children:i===0?D(`刚刚收到新数据`):D(`{seconds} 秒没有新数据`,{seconds:i})})]}),(0,B.jsxs)(`dl`,{className:`model-run-counters`,children:[(0,B.jsx)(Bl,{label:D(`返回推理`),value:e.reasoningChars}),(0,B.jsx)(Bl,{label:D(`正文`),value:e.textChars}),(0,B.jsx)(Bl,{label:D(`工具参数`),value:e.toolChars}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`工具调用`)}),(0,B.jsx)(`dd`,{children:e.toolCalls})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`Provider 派发`)}),(0,B.jsx)(`dd`,{children:e.dispatches})]})]}),e.phase===`waiting`?(0,B.jsx)(`p`,{className:`model-run-note`,children:D(`Provider 尚未返回可区分的增量;这可能是排队、模型内部思考或网络等待。`)}):null,a?(0,B.jsx)(`p`,{className:`model-run-stalled-note`,role:`note`,children:D(`已有 {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`?D(`正在取消…`):D(`取消生成`)})})]})}function Bl({label:e,value:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:D(`{count} 字`,{count:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)})})]})}function Vl(e){return D(e===`preparing`?`正在准备模型请求…`:e===`waiting`?`正在等待模型响应…`:e===`reasoning`?`思考中(正在接收 Provider 返回推理)`:e===`text`?`正在输出正文…`:e===`tool`?`正在处理工具调用…`:e===`followup`?`正在生成界面产物…`:`正在取消模型生成…`)}function Hl(e){switch(e.kind){case`d20`:return Ul(e);case`d100`:return Wl(e);case`bag`:return Gl(e);case`dice`:return Yl(e);case`arithmetic`:return Xl(e)}}function Ul(e){let{modifier:t,difficulty:n,mode:r,dice:i,selected:a,total:o,margin:s}=e,c=r===`normal`?`d20 ${a}`:D(`d20 {mode} {dice} 取 {die}`,{mode:$l(r),dice:i.join(`/`),die:a}),l=e.outcome;return Zl(e.goal,l,[`${c}${iu(t)} = ${o} ${o>=n?`≥`:`<`} ${n}`],[Q(`行动`,e.goal),Q(`修正`,nu(t)),Q(`难度`,String(n)),Q(`掷骰方式`,$l(r)),Q(`掷出的骰`,i.join(`、`)),Q(`采用的骰`,String(a)),Q(`总值`,String(o)),Q(`差值(总值 − 难度)`,nu(s)),Q(`结果`,Ql(l))],null)}function Wl(e){let{target:t,bonusDice:n,penaltyDice:r,units:i,tens:a,candidates:o}=e,{selected:s,margin:c,outcome:l}=e,u=a.length>1?D(n>r?`奖励骰取较低的十位`:`惩罚骰取较高的十位`):null,d=n===r?[]:[D(n>r?`奖励骰`:`惩罚骰`)];return Zl(e.goal,l,[`d100 ${s} ${s<=t?`≤`:`>`} ${t}`,...d],[Q(`行动`,e.goal),Q(`目标值`,String(t)),Q(`奖励骰`,String(n)),Q(`惩罚骰`,String(r)),Q(`个位`,String(i)),Q(`十位骰`,a.join(`、`)),Q(`候选值`,o.join(`、`)),...u===null?[]:[Q(`选取`,u)],Q(`采用的结果`,String(s)),Q(`余量(目标值 − 结果)`,nu(c)),Q(`结果`,Ql(l))],null)}function Gl(e){let{value:t,difficulty:n,drawn:r,tokens:i,defaultBag:a}=e,o=D(a?`默认混乱袋`:`世界混乱袋`),s=Jl(r),c=ql(r)?D(`特殊标记`):r.label,l=i.map(e=>({label:Kl(e),count:String(e.count),effect:e.outcome===void 0?nu(e.modifier??0):Ql(e.outcome)})),u=[Q(`行动`,e.goal),Q(`属性值`,String(t)),Q(`难度`,String(n)),Q(`袋子`,o),Q(`抽到`,c)];if(r.outcome!==void 0)return Zl(e.goal,e.outcome,[s],[...u,Q(`效果`,Ql(r.outcome))],l);let d=r.modifier??0,f=e.total??t+d,p=e.margin??f-n;return Zl(e.goal,e.outcome,[s,`${t}${iu(d)} = ${f} ${f>=n?`≥`:`<`} ${n}`],[...u,Q(`修正`,nu(d)),Q(`总值`,String(f)),Q(`差值(总值 − 难度)`,nu(p)),Q(`结果`,Ql(e.outcome))],l)}function Kl(e){return ql(e)?Ql(e.outcome):e.label}function ql(e){return e.outcome!==void 0&&e.label===e.outcome}function Jl(e){return ql(e)?D(`抽到特殊标记`):D(`抽到 {token}`,{token:e.label})}function Yl(e){let{count:t,sides:n,modifier:r,dice:i,total:a}=e,o=`${t}d${n}${ru(r)}`,s=t===1&&r===0?String(a):`${i.join(` + `)}${r===0?``:iu(r)} = ${a}`;return Zl(e.goal,null,[`${o} = ${s}`],[Q(`行动`,e.goal),Q(`骰子`,`${t}d${n}`),Q(`修正`,nu(r)),Q(`掷出的骰`,i.join(`、`)),Q(`总值`,String(a))],null)}function Xl(e){let{left:t,right:n,operation:r,total:i}=e;return Zl(e.goal,null,[`${au(t)} ${tu(r)} ${au(n)} = ${ou(i)}`],[Q(`行动`,e.goal),Q(`左值`,ou(t)),Q(`运算`,eu(r)),Q(`右值`,ou(n)),Q(`结果`,ou(i))],null)}function Zl(e,t,n,r,i){let a=[e,...n].join(` · `),o=t===null?null:Ql(t);return{tone:t??`neutral`,summary:a,outcome:o,headline:o===null?a:`${a} · ${o}`,facts:r,tokens:i}}function Ql(e){switch(e){case`success`:return D(`成功`);case`failure`:return D(`失败`);case`critical_success`:return D(`大成功`);case`critical_failure`:return D(`大失败`)}}function $l(e){switch(e){case`normal`:return D(`普通`);case`advantage`:return D(`优势`);case`disadvantage`:return D(`劣势`)}}function eu(e){switch(e){case`add`:return D(`加`);case`subtract`:return D(`减`);case`multiply`:return D(`乘`);case`divide`:return D(`除`)}}function tu(e){switch(e){case`add`:return`+`;case`subtract`:return`−`;case`multiply`:return`×`;case`divide`:return`÷`}}function Q(e,t){return{label:D(e),value:t}}function nu(e){return e>0?`+${e}`:e<0?`−${Math.abs(e)}`:`0`}function ru(e){return e===0?``:e>0?`+${e}`:`−${Math.abs(e)}`}function iu(e){return e<0?` + (−${Math.abs(e)})`:` + ${e}`}function au(e){return e<0?`(−${Math.abs(e)})`:ou(e)}function ou(e){let t=String(Number(Math.abs(e).toPrecision(12)));return e<0?`−${t}`:t}function su({receipt:e}){let t=Hl(e);return(0,B.jsx)(`article`,{className:`resolution-card is-${t.tone}`,"aria-label":D(`判定结果`),children:(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:(0,B.jsxs)(`span`,{className:`resolution-headline`,children:[t.summary,t.outcome===null?null:(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`strong`,{className:`resolution-outcome`,children:t.outcome})]})]})}),(0,B.jsx)(`dl`,{className:`resolution-facts`,children:t.facts.map((e,t)=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e.label}),(0,B.jsx)(`dd`,{children:e.value})]},`${t}:${e.label}`))}),t.tokens===null?null:(0,B.jsxs)(`table`,{className:`resolution-tokens`,children:[(0,B.jsx)(`caption`,{children:D(`本次使用的混乱袋`)}),(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:D(`标记`)}),(0,B.jsx)(`th`,{scope:`col`,children:D(`数量`)}),(0,B.jsx)(`th`,{scope:`col`,children:D(`效果`)})]})}),(0,B.jsx)(`tbody`,{children:t.tokens.map((e,t)=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:e.label}),(0,B.jsx)(`td`,{children:e.count}),(0,B.jsx)(`td`,{children:e.effect})]},`${t}:${e.label}`))})]})]})})}function cu(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 lu(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 uu(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 du({client:e,worldId:t,worldTitle:n,modelConfigured:r,onBack:i,showWorkspaceBack:a=!0,onConfigureModel:o,onRenameWorld:s,onOpenWorld:c,onNavigationLockChange:u,onReadingPreferencesChange:d,initialReadingPreferences:f=_,protagonistRevision:m,onProtagonistRevisionStarted:h,onProtagonistRevisionFinished:g}){let[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(0),[w,T]=(0,l.useState)(null),E=(0,l.useRef)(0),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(320),M=Va(),te=(0,l.useRef)(null);function N(e){j(Math.max(240,Math.min(720,window.innerWidth-24,e)))}let[P,F]=(0,l.useState)(!1),[re,ie]=(0,l.useState)(`documents`),[ae,L]=(0,l.useState)(!1);oe(O||P,()=>{k(!1),F(!1)});let[R,z]=(0,l.useState)(m===void 0?null:`revision`),[se,ce]=(0,l.useState)(f),[le,ue]=(0,l.useState)(!1),[fe,pe]=(0,l.useState)(``),[me,he]=(0,l.useState)(``),[V,H]=(0,l.useState)(null),[_e,U]=(0,l.useState)(null),[ve,ye]=(0,l.useState)(null),[be,xe]=(0,l.useState)(null),[Se,Ce]=(0,l.useState)(null),[we,Te]=(0,l.useState)(null),[Ee,De]=(0,l.useState)(0),Oe=(0,l.useRef)(null),ke=(0,l.useRef)(!1),[Ae,je]=(0,l.useState)(n),[Me,Ne]=(0,l.useState)(n);Me!==n&&(Ne(n),je(n));let[Pe,Fe]=(0,l.useState)(null),[Ie,Le]=(0,l.useState)(null),[Re,ze]=(0,l.useState)(!1),[Be,Ve]=(0,l.useState)(null),[He,Ue]=(0,l.useState)(!1),We=He||Be?.worldId===t&&Be.fresh,[Ge,Ke]=(0,l.useState)([]),[qe,Je]=(0,l.useState)(null),[Ye,Xe]=(0,l.useState)(``),[Ze,Qe]=(0,l.useState)(`[]`),[$e,et]=(0,l.useState)(!1),[tt,nt]=(0,l.useState)(!1),[rt,it]=(0,l.useState)(null),{workspace:at,state:ot}=_l(e,`revision`,t,R===`revision`),st=R===`revision`?ot.target?.revision??null:null,ct=ot.files,lt=ot.baseline,ut=ot.dirty,[dt,ft]=(0,l.useState)(null),[pt,mt]=(0,l.useState)(!1),[ht,gt]=(0,l.useState)({}),_t=(0,l.useRef)(null),vt=(0,l.useRef)(null),yt=(0,l.useRef)(null),[bt,xt]=(0,l.useState)(72),St=v?.head,Ct=v?.worldId;(0,l.useEffect)(()=>(u?.(ut||tt||$e),()=>u?.(!1)),[u,ut,tt,$e]),(0,l.useEffect)(()=>{let n=!0;return(async()=>{try{let r=await Du(e,{type:`world.read`,worldId:t});if(!n)return;Wt(r,!1)}catch(e){if(!n)return;U({kind:`error`,text:Tu(e)})}finally{n&&H(null)}})(),()=>{n=!1}},[e,t]),(0,l.useEffect)(()=>{if(v?.worldId!==t)return;let n=!0,r=v.head,i=++E.current;return Pu(e,t).then(e=>{n&&i===E.current&&(T(null),e.head===r&&x({...e,worldId:t}))},e=>{n&&i===E.current&&T({worldId:t,message:Fu(e)})}),()=>{n=!1}},[e,v,t,S]);let wt=b?.worldId===t&&b.head===St?b:null;(0,l.useEffect)(()=>{if(e.observeConversation===void 0||Ct!==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,C(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,C(e=>e+1)),Gt(s),xe(Eu(s)),s.status===`running`?(Te(e=>uu(s.chainId,lu(s,null,s.chainId),s,e)),De(Date.now())):Te(null),ju({kind:`snapshot`,value:s,final:s.status!==`running`},Je),Oe.current!==null&&s.status!==`running`&&U({kind:`status`,text:D(`模型生成已取消。`)}),r!==`${s.parentHead}:${s.status}`){let i=await Du(e,{type:`world.read`,worldId:t});if(!n)return;r=`${s.parentHead}:${s.status}`,y(i);let a=i.playTimeline;a!==void 0&&(Je(e=>Au(e,a)),Le(e=>e?.worldId===a.worldId&&e.chainId===a.activeChainId?e:null),Fe(e=>e!==null&&Ou(a,e)?null:e),Ou(a,s)&&a.activeStatus!==`running`&&Te(null))}},(e,t)=>{n&&e===`connected`&&(r=void 0,i=void 0,C(e=>e+1)),n&&ye(ee(e,t))});return()=>{n=!1,o()}},[e,t,Ct]),(0,l.useEffect)(()=>{Ct!==void 0&&_t.current?.scrollIntoView?.({block:`nearest`})},[Ct]),(0,l.useEffect)(()=>{if(v===null||!P&&R===null||v.state.length>0&&v.control.length>0)return;let n=!0;return(async()=>{try{let[r,i,a]=await Promise.all([Du(e,{type:`world.surface.read`,worldId:t,surface:`state`}),Du(e,{type:`world.surface.read`,worldId:t,surface:`control`}),Du(e,{type:`world.surface.read`,worldId:t,surface:`runtime`})]);if(!n)return;y(e=>e===null?null:{...e,state:r,control:i,runtime:a}),Xe(e=>Cu(r,e)),tt||Qe(JSON.stringify(i,null,2))}catch(e){n&&U({kind:`error`,text:Tu(e)})}})(),()=>{n=!1}},[e,tt,R,P,v,t]),(0,l.useEffect)(()=>{if(!P||re!==`ai-reading`||St===void 0)return;let n=!0,r=window.setTimeout(()=>{n&&mt(!0)},0);return Du(e,{type:`world.play-context.read`,worldId:t}).then(e=>{n&&ft(e)}).catch(e=>{n&&U({kind:`error`,text:Tu(e)})}).finally(()=>{n&&mt(!1)}),()=>{n=!1,window.clearTimeout(r)}},[e,Pe?.updatedAt,P,re,St,t]),(0,l.useEffect)(()=>{let e=at.getSnapshot().target?.revision;return at.subscribe(()=>{let t=at.getSnapshot().target?.revision;t!==void 0&&t!==e&&(e=t,y(e=>e===null?null:{...e,worldRevision:t.epoch?.locked===!0?t.epoch:null}))})},[at]),(0,l.useLayoutEffect)(()=>{let e=yt.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`},[fe]),(0,l.useLayoutEffect)(()=>{let e=vt.current;if(e===null)return;let t=()=>xt(e.getBoundingClientRect().height);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Ct,R]),(0,l.useEffect)(()=>{if(_e?.kind!==`status`)return;let e=window.setTimeout(()=>U(null),3200);return()=>window.clearTimeout(e)},[_e]);let Tt=v?.state??[],Et=Ll(wt?.playerViews??v?.playerViews??{views:[],diagnostics:[]},wt?.playerViewPanels??v?.playerViewPanels??[],wt?.suppressedPlayerViewIds??v?.suppressedPlayerViewIds??[]),Dt=qe?.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||bu(e.event)!==`narrative`)?[]:[{messageId:`${e.chainId}:${e.event.id}`,role:e.event.kind===`player`?`player`:`narrator`,exactText:e.event.text,head:e.event.committedHead}])??[],Ot=(v?.committedMessages.length??0)>0?v.committedMessages:Dt,kt=Pe?.status??qe?.activeStatus,At=Pe?.chainId??qe?.activeChainId??null,jt=qe?.items.findLast(e=>e.kind===`event`&&e.event.kind===`assistant`&&e.event.status===`completed`&&e.event.committedHead!==void 0&&bu(e.event)===`narrative`);if(v?.worldId===t&&jt?.kind===`event`&&jt.event.kind===`assistant`&&jt.event.checkpoint===!0&&jt.event.committedHead!==void 0){let e=`${t}:${jt.event.committedHead}`;Ge.includes(e)||(Ke([...Ge,e]),Ve({worldId:t,head:jt.event.committedHead,fresh:!Cl(t,jt.event.committedHead)}))}let Mt=Pe?.canRetry??qe?.activeCanRetry??!1,Nt=qe?.items.findLast(e=>e.kind===`event`&&e.chainId===At),Pt=Pe?.lastFailureKind??qe?.activeLastFailureKind??(Nt?.kind===`event`&&Nt.event.kind===`failure`?Nt.event.failureKind:void 0),Ft=Mt&&(Pt===void 0||Pt===`retryable`),It=kt===`interrupted`&&Nt?.kind===`event`&&Nt.event.kind===`failure`,Lt=st?.epoch?.locked===!0?st.epoch:v?.worldRevision??null,W=Lt?.locked===!0,Rt=Re||v?.archiveNeedsFreshContext===!0||v!==null&&Pe!==null&&Pe.parentHead!==v.head,zt=we!==null,Bt=fe.trim().length>0,Vt=V===null&&kt!==`running`&&!W,Ht=Bt&&Vt,Ut=Vt&&!Rt&&(At===null?Bt:kt===`ready`||!Bt&&Ft);(0,l.useEffect)(()=>{if(!zt)return;let e=setInterval(()=>De(Date.now()),1e3);return()=>clearInterval(e)},[zt]);function Wt(e,t){let n=e.playCallChain,r=e.playTimeline??Nu(e);y(e),t||(Qe(JSON.stringify(e.control,null,2)),nt(!1),it(null)),Fe(n),Le(t=>n===null?t?.worldId===e.worldId&&t.chainId===r.activeChainId?t:null:ku(n)),Je(r),xe(Eu(n)),n?.status===`running`?(Te(e=>uu(n.chainId,lu(n,r,n.chainId),n,e)),De(Date.now())):Te(null),Xe(t=>Cu(e.state,t))}function Gt(e){Fe(e),Le(ku(e))}async function Kt(n=!0){let r=await Du(e,{type:`world.read`,worldId:t});return Wt(r,n),r}function qt(){Ue(!1),Be?.worldId===t&&(wl(t,Be.head),Ve({...Be,fresh:!1}))}async function Jt(n,i=fe){if(!r||!Vt||ke.current)return;let a=n===`fresh`||At===null,o=i.trim().length>0;if(a?!o:Rt||kt!==`ready`&&(o||!Ft))return;Ce(null),ke.current=!0,qt();let s=a?p(`play-chain`):At,c=p(`play-exchange`),l=Date.now();Oe.current=null,xe(null),De(l),Te(cu(s,c,l)),H(n===`fresh`?`play-fresh`:`play-append`),U({kind:`status`,technical:!0,text:D(a?`正在从当前世界重新拼接上下文…`:o?`正在把玩家输入追加到现有上下文…`:kt===`interrupted`?`正在原样发送上次未完成的模型请求…`:`正在沿现有上下文继续生成…`)});try{let n=await Du(e,a?{type:`play.chain.start`,worldId:t,chainId:s,exchangeId:c,playerText:i,...wu(me)}:{type:`play.chain.append`,worldId:t,chainId:s,exchangeId:c,playerText:i,...wu(me)});Gt(n),n.status===`ready`&&he(``),a&&ze(!1),o&&pe(``),await Kt(),Oe.current===c?(xe(null),U({kind:`status`,text:D(`模型生成已取消。`)})):n.status===`interrupted`?(xe(Eu(n)??(n.canRetry?D(`模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。`):D(`调用链处理失败;旧请求不能重发,请使用全新上下文。`))),U(null)):(xe(null),U({kind:`status`,technical:!0,text:D(!a&&!o?`AI 已沿现有上下文继续生成,没有追加玩家指令。`:`调用链已返回;模型完成的叙事和世界变化已经分别提交。`)}))}catch(n){let r=await Du(e,{type:`play.chain.inspect`,worldId:t}).catch(()=>null);r!==null&&(Gt(r),a&&r.chainId===s&&ze(!1),o&&r.events.some(e=>e.kind===`player`&&e.exchangeId===c)&&pe(``));let i=await Du(e,{type:`play.timeline.page`,worldId:t,limit:40}).catch(()=>null);i!==null&&Je(i),Oe.current===c?(xe(null),U({kind:`status`,text:D(`模型生成已取消。`)})):n instanceof ne&&n.protocolCode===`model_protocol_mismatch`?(xe(null),U({kind:`error`,text:Tu(n)})):(xe(Eu(r)??Tu(n)),U(null))}finally{Oe.current===c&&(Oe.current=null),Te(e=>e?.exchangeId===c?null:e),ke.current=!1,H(null)}}async function Yt(){if(we===null||we.phase===`cancelling`)return;let{chainId:n,exchangeId:r}=we;Oe.current=r,Te(e=>e?.chainId===n&&e.exchangeId===r?{...e,phase:`cancelling`}:e),U({kind:`status`,text:D(`正在取消模型生成…`)});try{(await Du(e,{type:`play.chain.cancel`,worldId:t,chainId:n,exchangeId:r})).outcome===`not_running`&&(Oe.current===r&&(Oe.current=null),U({kind:`status`,text:D(`模型调用已经结束,正在刷新结果…`)}),await Kt())}catch(e){Oe.current===r&&(Oe.current=null),Te(e=>e?.chainId===n&&e.exchangeId===r?{...e,phase:`waiting`}:e),U({kind:`error`,text:Tu(e)})}}async function Xt(){if(qe?.nextCursor!==null&&qe!==null){H(`timeline-page`);try{let n=await Du(e,{type:`play.timeline.page`,worldId:t,limit:40,cursor:qe.nextCursor});Je(e=>e===null?n:e.generation===n.generation?{...e,items:[...n.items,...e.items],nextCursor:n.nextCursor}:e)}catch(e){U({kind:`error`,text:Tu(e)})}finally{H(null)}}}async function Zt(){H(`control-preview`);try{let n=JSON.parse(Ze);await e.request({type:`world.control-draft.save`,worldId:t,files:n});let r=await e.request({type:`world.control-draft.preview`,worldId:t});it(r),U({kind:`status`,text:D(`控制草稿已通过真实提示词预览;确认后才会整批应用。`)})}catch(e){it(null),U({kind:`error`,text:Tu(e)})}finally{H(null)}}async function Qt(){if(rt!==null&&kt!==`running`){H(`control-apply`);try{await e.request({type:`world.control-draft.apply`,worldId:t}),await Kt(!1),U({kind:`status`,text:D(`世界控制已整批应用。`)})}catch(e){U({kind:`error`,text:Tu(e)})}finally{H(null)}}}function $t(e){e!==void 0&&Xe(e),z(`revision`),F(!1),L(!1)}async function en(){let e=await at.finish(`apply`);if(e!==null){at.close(),g?.(),z(null),e.changed&&ze(!0);try{await Kt(!1),U({kind:`status`,text:D(`世界修订已应用并解锁。再次继续原对话时,AI 会先重新读取当前世界。`)})}catch(e){U({kind:`error`,text:D(`世界修订已应用并解锁,但刷新世界失败。请重新打开世界:{message}`,{message:Tu(e)})})}}}async function tn(){if(globalThis.confirm(D(`放弃这次世界修订?所有尚未应用的手动和 AI 修改都会丢失。`))&&await at.finish(`discard`)!==null){at.close(),g?.(),z(null);try{await Kt(!1),U({kind:`status`,text:D(`这次世界修订已放弃,原世界保持不变并已解锁。`)})}catch(e){U({kind:`error`,text:D(`这次世界修订已放弃,原世界保持不变并已解锁,但刷新世界失败。请重新打开世界:{message}`,{message:Tu(e)})})}}}async function nn(t=v?.head){if(v!==null&&t!==void 0){H(`derive`);try{await c((await Du(e,{type:`world.derive`,operationId:p(`derive`),sourceWorldId:v.worldId,sourceHead:t})).world.worldId)}catch(e){U({kind:`error`,text:Tu(e)}),H(null)}}}async function rn(n,i,a,o,s=!1){if(v===null||V!==null||kt===`running`||W)return;if(a.trim().length===0){U({kind:`error`,text:D(`修改后的玩家提交不能为空。`)});return}Ce(null);let c={worldId:t,chainId:n,eventId:i,originalText:a},l=!1,u=p(`play-exchange`);H(`revise`),U({kind:`status`,text:D(s?`正在重新生成…`:`正在当前世界中保存修改,并舍弃这条消息之后的当前时间线…`)});try{let t=await Du(e,{type:`play.chain.revise-player`,operationId:p(`revise-player`),worldId:v.worldId,chainId:n,eventId:i,replacementExchangeId:u,replacementText:a,...wu(me),continuation:o});l=!0,ze(!1),o===`fresh_context`&&qt();let d=t.playCallChain.events.find(e=>e.kind===`player`&&e.exchangeId===u);if(d!==void 0&&(c={...c,chainId:t.playCallChain.chainId,eventId:d.id}),Gt(t.playCallChain),await Kt(),!r){U({kind:`status`,text:D(s?`原回复已离开当前时间线;配置模型后点击“追加上下文”即可重新生成。`:`修改已保存在当前世界;配置模型后点击“追加上下文”即可继续生成。`)});return}H(`play-append`),U({kind:`status`,text:D(s?`正在重新生成…`:o===`fresh_context`?`修改已保存,正在从全新上下文继续生成…`:`修改已保存,正在从修改稿继续生成…`)});let f=await Du(e,{type:`play.chain.append`,worldId:v.worldId,chainId:t.playCallChain.chainId,exchangeId:p(`play-exchange`),playerText:``,...wu(me)});f.status===`ready`&&he(``),s&&o===`continue_context`&&f.status===`interrupted`&&!f.canRetry&&Ce(c),Gt(f),await Kt(),U({kind:f.status===`interrupted`?`error`:`status`,text:f.status===`interrupted`?f.canRetry?D(`修改已保存,但模型请求中断;点击“追加上下文”即可原样重发。`):D(`修改已保存,但模型请求失败;请使用全新上下文继续。`):D(s?`已重新生成;原回复已离开当前时间线`:o===`fresh_context`?`修改已保存在当前世界,并已作为全新上下文继续。`:`修改已保存在当前世界,并已从修改稿继续。`)})}catch(e){s&&o===`continue_context`&&(l||e instanceof ne&&(e.protocolCode===`invalid_request`||e.protocolCode===`model_protocol_mismatch`))&&Ce(c),U({kind:`error`,text:Tu(e)})}finally{H(null)}}function an(){return Jt(ln?`fresh`:`append`)}async function on(t){ce(t),ue(!0);try{await e.request({type:`preferences.save`,reading:t}),d?.(t)}catch(e){U({kind:`error`,text:Tu(e)})}finally{ue(!1)}}async function sn(n){if(V===null){H(`story-export`),U(null);try{let r=await e.request({type:`world.story.export`,worldId:t,format:n});await I(r.fileName,{blob:new Blob([r.content],{type:n===`markdown`?`text/markdown;charset=utf-8`:`text/plain;charset=utf-8`})})!==`cancelled`&&U({kind:`status`,text:D(`故事已导出。`)})}catch(e){U({kind:`error`,text:Tu(e)})}finally{H(null)}}}async function G(){let e=Ae.trim();if(e!==``&&e!==n){H(`rename`),U(null);try{await s(e),U({kind:`status`,text:D(`世界名称已保存。`)})}catch(e){U({kind:`error`,text:Tu(e)})}finally{H(null)}}}let cn={canRetry:Ft&&!Rt,playDisabled:!r||!Vt,configureDisabled:!Vt||ut||tt||$e,onRetry:()=>void Jt(`append`,``),onFreshContext:()=>{Ue(!0),yt.current?.focus()},onConfigureModel:o},ln=We||At===null||Rt,un=ln?Ht:Ut,dn=_s(r&&un,an);if(v===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:D(`← 返回工作区`)}),_e?.kind===`error`?(0,B.jsx)(`p`,{role:`alert`,children:_e.text}):(0,B.jsx)(`p`,{role:`status`,children:D(`正在打开世界…`)})]});if(R===`revision`){let e=Lt,i=ot.view;return(0,B.jsx)(Wc,{onNavigationLockChange:et,onPreview:()=>at.preview(),target:`world-revision`,packageName:n,modelConfigured:r,hasUnsavedFileDraft:ut,loading:ot.loading,view:i,history:st?.history??[],latestSessionId:st?.latest?.sessionId??null,notice:ot.notice,requestFailure:ot.requestFailure??ot.observationFailure,now:ot.now,contentEditor:{mode:`world-revision`,files:ct,...Ye===``?{}:{selectedPath:Ye.startsWith(`state/`)?Ye:`state/${Ye}`},status:(e?.diagnostics.length??0)===0?`usable`:`needs_repair`,issues:e?.diagnostics??[],immutablePaths:(e?.files??lt).filter(({path:t})=>t.startsWith(`state/`)&&!e?.diff.some(e=>e.path===t&&e.kind===`create`)).map(({path:e})=>e)??[],dirty:ut,onFilesChange:e=>at.editFiles(e),onSave:()=>void at.saveFiles(),onReset:()=>at.resetFiles(),onCopy:()=>void 0,onExport:()=>void 0,onDelete:()=>void 0,title:n,onRename:()=>void 0},...ot.target===null||m===void 0||m.started?{}:{initialMessage:m.message,onInitialMessageStarted:()=>{h?.(),at.startFresh()}},onSend:e=>at.send(e),onCancel:()=>at.cancel(),onResume:()=>at.resume(),onFreshContext:()=>at.startFresh(),onSelectSession:e=>at.selectSession(e),onDeleteSession:e=>at.deleteSession(e),onRollbackFile:(e,t,n)=>at.rollbackFile(e,t,n),onConfigureModel:o,onBack:()=>{at.close(),z(null),Kt(!1)},...m!==void 0||e?.locked===!0||(st?.sealedEpochs.length??0)>0?{revisionActions:{active:e?.locked===!0,...m===void 0?{}:{applyLabel:D(`应用并开始游玩`)},changedFileCount:e?.diff.length??0,canApply:e?.locked===!0&&r&&e.diagnostics.length===0,applying:ot.applying,changes:e?.changes??[],sealedEpochs:st?.sealedEpochs??[],onApply:en,onDiscard:tn}}:{}},t)}return(0,B.jsx)(`main`,{className:`world-reader-page ${se.showTechnicalInfo?`is-detailed-mode`:`is-story-mode`}`,style:{"--world-left-rail-width":A+`px`,"--world-story-size":se.fontSize+`px`,"--world-story-leading":se.lineHeight,"--world-story-tracking":se.letterSpacing+`em`,"--world-story-measure":se.measure+`rem`,"--world-composer-height":bt+`px`,"--world-story-paragraph-gap":se.density===`compact`?`0.5em`:se.density===`standard`?`0.8em`:`1.1em`,"--world-story-block-gap":se.density===`compact`?`1.3em`:se.density===`standard`?`1.85em`:`2.4em`},children:(0,B.jsx)(vo,{worldId:v.worldId,artifacts:wt?.artifacts??[],playerViewPanels:wt?.playerViewPanels??v.playerViewPanels??[],extensions:wt?.extensions??[],playerViews:v.playerViews,interactionDisabled:V!==null||W,onSetComposerDraft:pe,onRefresh:async()=>{await Kt()},onBridgeEvent:(e,t)=>gt(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":D(`世界与状态`),children:[a&&(0,B.jsx)(`button`,{type:`button`,onClick:i,"aria-label":D(`返回工作区`),children:`←`}),(0,B.jsx)(`button`,{type:`button`,className:O?`is-current`:``,"aria-pressed":O,onClick:()=>k(e=>!e),children:D(`此刻`)})]}),(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":D(`世界阅读工具`),children:[(0,B.jsx)(`button`,{type:`button`,className:P&&re===`documents`?`is-current`:``,onClick:()=>{ie(`documents`),F(!0),L(!1)},children:D(`世界`)}),(0,B.jsx)(`button`,{type:`button`,className:P&&re===`ai-reading`?`is-current`:``,onClick:()=>{ie(`ai-reading`),F(!0),L(!1)},children:D(`AI 读取`)}),(0,B.jsx)(`button`,{type:`button`,className:ae?`is-current`:``,"aria-label":D(`阅读设置`),onClick:()=>{L(e=>!e),F(!1)},children:`Aa`}),(0,B.jsx)(`button`,{type:`button`,"aria-label":D(`世界管理`),onClick:()=>{z(`manage`),L(!1)},children:`···`})]}),(0,B.jsx)(`section`,{className:`world-reader-scroll`,"aria-label":D(`世界游玩`),children:(0,B.jsxs)(`article`,{className:`world-story-column`,"aria-busy":V!==null||kt===`running`,"aria-label":D(`故事时间线`),children:[(0,B.jsx)(yo,{mount:`story`}),qe?.nextCursor===null?null:(0,B.jsx)(`button`,{type:`button`,className:`secondary-button timeline-load-earlier`,disabled:V!==null,onClick:()=>void Xt(),children:D(V===`timeline-page`?`正在加载…`:`加载更早的故事`)}),qe!==null&&qe.items.length>0?(0,B.jsx)(fu,{client:e,worldId:t,items:qe.items,liveChain:Pe,failureRecovery:kt===`interrupted`&&At!==null?{...cn,chainId:At}:void 0,restartDisabled:V!==null||kt===`running`||W,freshContextDisabled:!r,showTechnicalInfo:se.showTechnicalInfo,onRestartFrom:e=>void nn(e),onEditPlayer:(e,t,n,r)=>void rn(e,t,n,r),onRegeneratePlayer:(e,n,r,i)=>{i||v?.archiveNeedsFreshContext===!0||kt===`interrupted`&&!Ft?Ce({worldId:t,chainId:e,eventId:n,originalText:r}):rn(e,n,r,`continue_context`,!0)}}):Ot.length===0?(0,B.jsxs)(`div`,{className:`story-empty-state`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),(0,B.jsx)(`h3`,{children:D(`故事还没有开始`)}),(0,B.jsx)(`p`,{children:D(`描述你的行动,从当前世界开始一条调用链。`)})]}):(0,B.jsx)(vu,{messages:Ot.map(e=>({...e,pending:!1})),restartDisabled:V!==null||W,onRestartFrom:e=>void nn(e)}),we===null?null:(0,B.jsx)(zl,{progress:we,now:Ee,onCancel:()=>void Yt()}),(0,B.jsx)(`div`,{ref:_t})]})}),(0,B.jsxs)(`footer`,{ref:vt,className:`world-composer-dock`,children:[(0,B.jsx)(yo,{mount:`composer_above`}),w?.worldId===t?(0,B.jsxs)(`div`,{className:`extension-read-failure`,role:`alert`,children:[(0,B.jsx)(`p`,{children:D(`扩展内容读取失败:{reason}`,{reason:w.message})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>C(e=>e+1),children:D(`重试`)})]}):null,(wt?.extensionControls??v.extensionControls)===void 0?null:(0,B.jsx)(xl,{view:wt?.extensionControls??v.extensionControls,onChange:async(n,r)=>{let i=++E.current;await Du(e,{type:`world.extensions.set`,worldId:t,key:n,value:r});try{let n=await Pu(e,t);i===E.current&&(x({...n,worldId:t}),T(null))}catch(e){i===E.current&&T({worldId:t,message:Fu(e)})}C(e=>e+1)}}),W?(0,B.jsxs)(`div`,{className:`model-required-callout`,role:`status`,children:[(0,B.jsx)(`p`,{children:D(`世界正在修订,游玩和其他世界修改已锁定;应用或放弃后会解锁。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void $t(),children:D(`继续修订`)})]}):null,r?null:(0,B.jsxs)(`div`,{className:`model-required-callout`,children:[(0,B.jsx)(`p`,{children:D(`需要先配置模型连接才能游玩。`)}),(0,B.jsx)(`button`,{type:`button`,onClick:o,children:D(`配置模型`)})]}),ve===null?null:(0,B.jsx)(`p`,{role:`status`,children:ve}),be===null||It?null:(0,B.jsx)(`div`,{className:`play-call-failure`,role:`alert`,"aria-label":D(`模型调用失败`),children:(0,B.jsx)(bl,{failureKind:Pt,canRetry:Ft,message:Pe?.lastFailure??qe?.activeLastFailure??be,recovery:cn})}),!Ft||It||be!==null?null:(0,B.jsxs)(`div`,{className:`play-retry-note`,role:`alert`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`!`}),(0,B.jsx)(`p`,{children:D(`上次模型请求没有完整返回。保持输入为空并重试,会原样发送保存的请求。`)})]}),Rt&&Vt?(0,B.jsx)(`div`,{className:`world-fresh-context-note`,role:`note`,children:v?.archiveNeedsFreshContext?D(`世界从备份导入;下一次行动会从新上下文开始`):D(`世界已在当前上下文之外更新;下一次行动会从新上下文开始。`)}):null,We&&!Rt&&Vt?(0,B.jsxs)(`div`,{className:`world-fresh-context-note`,role:`note`,children:[(0,B.jsx)(`span`,{children:D(`下一条消息将开启全新上下文`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>{qt(),yt.current?.focus()},children:D(`取消全新上下文`)})]}):null,Se?.worldId===t?(0,B.jsxs)(`div`,{className:`play-retry-note`,role:`status`,children:[(0,B.jsx)(`p`,{children:D(`原上下文无法用于这次重新生成。可使用当前模型和预设,从同一条玩家输入开启全新上下文。`)}),(0,B.jsx)(`button`,{type:`button`,disabled:!Vt||!r,onClick:()=>void rn(Se.chainId,Se.eventId,Se.originalText,`fresh_context`,!0),children:D(`用全新上下文重新生成`)}),(0,B.jsx)(`button`,{type:`button`,disabled:!Vt,onClick:()=>Ce(null),children:D(`取消`)})]}):null,(0,B.jsx)(Rl,{chain:Ie?.worldId===t?Ie:null,timeline:qe,freshContextSelected:We||Rt||V===`play-fresh`,freshContextDisabled:!Vt||!r,onUseFreshContext:()=>{Ue(!0),yt.current?.focus()}}),(0,B.jsxs)(`div`,{className:`world-composer-row`,children:[(0,B.jsxs)(`details`,{className:`world-composer-mode`,children:[(0,B.jsx)(`summary`,{"aria-label":D(`选择提交方式`),children:`+`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{type:`button`,"aria-label":D(`追加上下文`),disabled:!Ut||!r,onClick:e=>{e.currentTarget.closest(`details`)?.removeAttribute(`open`),Jt(`append`)},children:[(0,B.jsx)(`strong`,{children:D(`追加当前上下文`)}),(0,B.jsx)(`span`,{children:D(`保留原生对话,重新编译当前提示和材料`)})]}),(0,B.jsxs)(`button`,{type:`button`,"aria-label":D(`全新上下文`),disabled:!Ht||!r,onClick:e=>{e.currentTarget.closest(`details`)?.removeAttribute(`open`),Jt(`fresh`)},children:[(0,B.jsx)(`strong`,{children:D(`使用全新上下文`)}),(0,B.jsx)(`span`,{children:D(`从当前世界重新编译材料`)})]})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{className:`visually-hidden`,children:D(`你的行动`)}),(0,B.jsx)(`textarea`,{ref:yt,"aria-label":D(`你的行动`),rows:1,placeholder:D(`接下来,你要做什么?`),value:fe,disabled:V!==null||!r||kt===`running`||W,onChange:e=>pe(e.target.value),onKeyDown:dn.onKeyDown,enterKeyHint:`enter`,title:D(dn.enterInsertsNewline?`回车换行,点击发送按钮发送`:`Enter 发送,Shift + Enter 换行`)})]}),(0,B.jsxs)(`label`,{className:`world-turn-note`,children:[(0,B.jsx)(`span`,{children:D(`本轮临时要求`)}),(0,B.jsx)(`input`,{type:`text`,value:me,placeholder:D(`只对这一轮生效,不进入故事`),disabled:V!==null||!r||kt===`running`||W,onChange:e=>he(e.currentTarget.value.replace(/[\r\n]/gu,``))}),me.length>120?(0,B.jsx)(`span`,{className:`field-note`,role:`status`,children:D(`超过 120 字;仍会发送,但请尽量简短。`)}):null]}),(0,B.jsx)(`button`,{type:`button`,className:`world-composer-send`,"aria-label":D(ln?`从全新上下文发送行动`:`追加行动`),disabled:!un||!r,onClick:()=>void dn.submit(),children:V===`play-fresh`||V===`play-append`?`…`:`↑`})]}),se.showTechnicalInfo?(0,B.jsx)(`p`,{className:`world-composer-hint`,children:D(Ft?`原样重试使用已保存请求,不采用新预设。`:`正常发送和空输入续写使用最新预设;本轮工具执行期间保持不变。`)}):null,(0,B.jsx)(yo,{mount:`composer_below`})]}),(0,B.jsx)(`button`,{type:`button`,className:O||P?`world-panel-scrim is-visible`:`world-panel-scrim`,"aria-label":D(`收起侧栏`),onClick:()=>{k(!1),F(!1)}}),(0,B.jsxs)(`aside`,{className:O?`world-overlay-rail world-overlay-rail-left is-open`:`world-overlay-rail world-overlay-rail-left`,"aria-hidden":!O,"aria-label":D(`当前情景`),children:[(0,B.jsx)(`div`,{className:`world-rail-resize-handle`,role:`separator`,"aria-label":D(`调整此刻面板宽度`),"aria-orientation":`vertical`,"aria-valuemin":240,"aria-valuemax":720,"aria-valuenow":A,tabIndex:O?0:-1,title:D(`拖拽调整宽度,双击恢复默认`),onPointerDown:e=>{e.button===0&&(e.preventDefault(),e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),te.current={pointerId:e.pointerId,x:e.clientX,width:e.currentTarget.parentElement.getBoundingClientRect().width})},onPointerMove:e=>{let t=te.current;t?.pointerId===e.pointerId&&N(t.width+e.clientX-t.x)},onPointerUp:e=>{te.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{te.current=null},onLostPointerCapture:()=>{te.current=null},onDoubleClick:()=>j(320),onKeyDown:e=>{e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),N(A+(e.key===`ArrowRight`?20:-20))):(e.key===`Home`||e.key===`End`)&&(e.preventDefault(),N(e.key===`Home`?240:720))}}),(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:D(`此刻`)})}),(0,B.jsxs)(`div`,{className:`world-rail-header-actions`,children:[(0,B.jsxs)(`div`,{className:`world-rail-fold-actions`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:M.expandAll,children:D(`全部展开`)}),(0,B.jsx)(`button`,{type:`button`,onClick:M.collapseAll,children:D(`全部收起`)})]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":D(`收起状态栏`),onClick:()=>k(!1),children:`×`})]})]}),(0,B.jsx)(Ba,{value:M.fold,children:(0,B.jsxs)(`div`,{className:`world-overlay-rail-body`,children:[(0,B.jsx)(yo,{mount:`sidebar`}),Et.views.length===0?Et.coveredViewIds.size>0?null:(0,B.jsxs)(`div`,{className:`player-view-empty`,children:[(0,B.jsx)(`p`,{children:D(`这个世界还没有配置常驻玩家视图。`)}),(0,B.jsx)(`small`,{children:D(`你仍然可以正常游玩;未显示不代表秘密。`)})]}):Et.views.map(e=>(0,B.jsx)(Su,{view:e},e.id)),Et.diagnostics.length===0?null:(0,B.jsxs)(`details`,{className:`player-view-diagnostics`,children:[(0,B.jsxs)(`summary`,{children:[Et.diagnostics.length,` `,D(`项视图诊断`)]}),(0,B.jsx)(`ul`,{children:Et.diagnostics.map((e,t)=>(0,B.jsx)(`li`,{children:e.message},e.code+`-`+t))})]})]})})]}),(0,B.jsxs)(`aside`,{className:P?`world-overlay-rail world-overlay-rail-right is-open`:`world-overlay-rail world-overlay-rail-right`,"aria-hidden":!P,"aria-label":D(re===`documents`?`当前世界`:`AI 如何读取`),children:[(0,B.jsxs)(`header`,{children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`strong`,{children:D(re===`documents`?`当前世界`:`AI 如何读取`)})}),(0,B.jsx)(`button`,{type:`button`,"aria-label":D(`收起世界栏`),onClick:()=>F(!1),children:`×`})]}),(0,B.jsxs)(`nav`,{"aria-label":D(`世界侧栏`),children:[(0,B.jsx)(`button`,{type:`button`,className:re===`documents`?`is-current`:``,onClick:()=>ie(`documents`),children:D(`世界`)}),(0,B.jsx)(`button`,{type:`button`,className:re===`ai-reading`?`is-current`:``,onClick:()=>ie(`ai-reading`),children:D(`AI 读取`)})]}),(0,B.jsx)(`div`,{className:`world-overlay-rail-body`,children:re===`documents`?(0,B.jsx)(Dl,{documents:Tt,selectedPath:Ye,onSelect:Xe,onRevise:e=>void $t(e),revisionDisabled:V!==null||kt===`running`}):(0,B.jsx)(Ol,{reading:dt,loading:pt,documents:Tt,onOpenFull:()=>z(`reading`)})}),(0,B.jsxs)(`footer`,{children:[(0,B.jsx)(`button`,{type:`button`,disabled:V!==null||kt===`running`,onClick:()=>void $t(),children:D(`修订当前世界`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>z(`manage`),children:D(`世界管理`)})]})]}),ae?(0,B.jsx)(Al,{value:se,saving:le,onChange:e=>void on(e),onClose:()=>L(!1)}):null,R===`reading`?(0,B.jsx)(kl,{reading:dt,documents:Tt,onClose:()=>z(null)}):null,R===`manage`?(0,B.jsx)(Il,{worldBackupExport:(0,B.jsx)(de,{client:e,worldId:t,disabled:V!==null||kt===`running`||W,onBusyChange:e=>H(e?`archive-export`:null)}),packageScriptPermission:(0,B.jsx)(ge,{client:e,kind:`world`,id:t,onChange:()=>C(e=>e+1)},t),world:v,worldTitle:n,worldNameDraft:Ae,setWorldNameDraft:je,pending:V,activeStatus:kt,controlFiles:Ze,controlDirty:tt,controlPreview:rt,onControlFiles:e=>{Qe(e),nt(!0),it(null)},onResetControl:()=>{Qe(JSON.stringify(v.control,null,2)),nt(!1),it(null)},onRename:()=>void G(),onExportStory:e=>void sn(e),onDerive:()=>void nn(v.head),onPreviewControl:()=>void Zt(),onApplyControl:()=>void Qt(),onClose:()=>z(null),modelConfigured:r,revisionLocked:W}):null,_e===null||_e.technical===!0&&!se.showTechnicalInfo?null:(0,B.jsx)(`p`,{className:`world-feedback `+_e.kind,role:_e.kind===`error`?`alert`:`status`,children:_e.text}),(0,B.jsx)(yo,{mount:`overlay`}),(0,B.jsx)(yo,{mount:`debug`}),(0,B.jsx)(X,{records:wt?.artifactDebug??[],extensions:wt?.extensions??[],playerViewPanels:wt?.playerViewPanels??v.playerViewPanels??[],bridgeEvents:ht})]})})})}function fu({liveChain:e,failureRecovery:t,client:n,worldId:r,items:i,restartDisabled:a,freshContextDisabled:o,showTechnicalInfo:s,onRestartFrom:c,onEditPlayer:u,onRegeneratePlayer:d}){let f=pu(i),p=i.findLastIndex(e=>e.kind===`event`&&e.event.kind===`assistant`&&e.event.status===`completed`&&bu(e.event)===`narrative`&&e.event.committedHead!==void 0),m=i[p],h=m?.kind===`event`?i.slice(0,p).findLast(e=>e.kind===`event`&&e.chainId===m.chainId&&hu(e.event)):void 0,g=h?.kind===`event`&&h.event.kind===`player`&&h.event.committedHead!==void 0&&h.event.committedHead!==`genesis`?{chainId:h.chainId,event:h.event,requiresFreshContext:h.requiresFreshContext}:void 0,_=i.findLast(e=>e.kind===`event`&&e.chainId===t?.chainId);return(0,B.jsx)(`ol`,{className:`call-chain-events play-timeline-events`,"aria-label":D(`模型调用链`),children:f.map(i=>{if(i.kind===`turn`){let f=i.items.filter(({event:e})=>gu(e));return(0,B.jsxs)(l.Fragment,{children:[i.items.map(i=>hu(i.event)?(0,B.jsx)(_u,{client:n,worldId:r,chainId:i.chainId,event:i.event,requiresFreshContext:i.requiresFreshContext,liveAssistant:i.event.kind===`assistant`&&i.event.status===`streaming`&&e?.chainId===i.chainId?e.events.find(e=>e.id===i.event.id&&e.kind===`assistant`):void 0,restartDisabled:a,freshContextDisabled:o,showTechnicalInfo:s,onRestartFrom:c,onEditPlayer:u,onRegenerate:i===m&&g!==void 0?()=>d(g.chainId,g.event.id,g.event.text,i.requiresFreshContext===!0||g.requiresFreshContext===!0||i.event.kind===`assistant`&&i.event.continuation===`unavailable`):void 0,presentation:`story`,failureRecovery:_===i?t:void 0},`${i.chainId}:${i.event.id}`):null),!s||f.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:D(`本段调用详情`)}),(0,B.jsx)(`small`,{children:D(`{count} 项记录`,{count:f.length})})]}),(0,B.jsx)(`ol`,{className:`world-timeline-trace-events`,"aria-label":D(`本段模型调用详情`),children:f.map(e=>(0,B.jsx)(_u,{client:n,worldId:r,chainId:e.chainId,event:e.event,requiresFreshContext:e.requiresFreshContext,restartDisabled:a,freshContextDisabled:o,showTechnicalInfo:s,onRestartFrom:c,onEditPlayer:u,presentation:`trace`},`trace:${e.chainId}:${e.event.id}`))})]})})]},i.key)}let f=i.item;return f.kind===`context_boundary`?(0,B.jsx)(`li`,{className:`story-context-boundary`,role:`separator`,"aria-label":D(`全新上下文从这里开始`),children:s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:D(`全新上下文从这里开始`)}),(0,B.jsx)(`small`,{children:f.playPreset.name}),(0,B.jsxs)(`details`,{className:`call-chain-summary`,children:[(0,B.jsx)(`summary`,{children:D(`本上下文已提交的世界变化`)}),f.changedDocuments.length===0?(0,B.jsx)(`span`,{children:D(`没有文档变化`)}):(0,B.jsx)(`ul`,{children:f.changedDocuments.map(e=>(0,B.jsxs)(`li`,{children:[e.kind===`create`?D(`新建`):D(`更新`),` `,e.ref,` · `,e.path]},`${e.kind}:${e.path}`))})]})]}):null},i.key):f.kind===`genesis`?(0,B.jsx)(`li`,{className:`${f.role}-message`,children:(0,B.jsxs)(`article`,{children:[(0,B.jsx)(`header`,{children:(0,B.jsx)(`strong`,{children:f.role===`player`?D(`你`):D(`主持`)})}),(0,B.jsx)(`p`,{children:f.exactText})]})},i.key):null})})}function pu(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)i.kind===`event`?((i.event.kind===`player`||i.event.kind===`assistant`&&mu(n))&&r(),n.push(i)):(r(),t.push({kind:`standalone`,key:i.kind===`context_boundary`?`context:${i.chainId}`:`genesis:${i.messageId}`,item:i}));return r(),t}function mu(e){return e.some(({event:e})=>e.kind===`assistant`&&e.status===`completed`&&bu(e)===`narrative`)}function hu(e){return e.kind===`player`||e.kind===`failure`||e.kind===`cancellation`?!0:e.kind===`followup`?e.failed:e.kind===`tool_result`?e.resolution!==void 0:e.kind===`assistant`?e.status===`streaming`||bu(e)===`narrative`:!1}function gu(e){return e.kind===`tool_call`||e.kind===`tool_result`||e.kind===`followup`?!0:e.kind!==`assistant`||e.status===`streaming`?!1:bu(e)!==`narrative`||e.usage!==void 0||e.detailsAvailable}function _u({liveAssistant:e,failureRecovery:t,client:n,worldId:r,chainId:i,event:a,requiresFreshContext:o=!1,restartDisabled:s,freshContextDisabled:c,showTechnicalInfo:u,onRestartFrom:d,onEditPlayer:f,onRegenerate:p,presentation:m}){let[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(`continue_context`),T=async()=>{if(!(h!==null||_)){v(!0),b(null);try{g(await Du(n,{type:`play.timeline.detail`,worldId:r,chainId:i,eventId:a.id}))}catch(e){b(Tu(e))}finally{v(!1)}}};if(a.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:D(`玩家`)}),u?(0,B.jsx)(`span`,{children:a.context===`fresh`?D(`全新上下文`):D(`追加上下文`)}):null,a.committedHead===void 0?null:(0,B.jsxs)(`span`,{className:`history-message-actions`,children:[a.committedHead===`genesis`?null:(0,B.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:s,onClick:()=>{S(a.text),w(o?`fresh_context`:`continue_context`)},children:D(`修改`)}),(0,B.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:s,onClick:()=>d(a.committedHead),children:D(`创建分叉`)})]})]}),x===null?(0,B.jsx)(`p`,{children:a.text}):(0,B.jsxs)(`div`,{className:`history-player-edit`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:D(`修改后的行动`)}),(0,B.jsx)(`textarea`,{"aria-label":D(`修改后的行动`),rows:3,value:x,disabled:s,onChange:e=>S(e.target.value)})]}),(0,B.jsx)(`p`,{children:D(`修改会直接保存在当前世界;这条原提交及其后的内容会离开当前时间线,但旧 Authority 记录仍可恢复。`)}),(0,B.jsxs)(`fieldset`,{className:`history-player-edit-continuation`,children:[(0,B.jsx)(`legend`,{children:D(`修改后如何继续`)}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`revision-continuation-${i}-${a.id}`,value:`continue_context`,checked:C===`continue_context`,disabled:s||o,onChange:()=>w(`continue_context`)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:D(`沿原上下文继续`)}),(0,B.jsx)(`small`,{children:D(`保留修改点以前的模型对话和原生续传。`)})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`revision-continuation-${i}-${a.id}`,value:`fresh_context`,checked:C===`fresh_context`,disabled:s||c,onChange:()=>w(`fresh_context`)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:D(`作为全新上下文保存`)}),(0,B.jsx)(`small`,{children:D(`不继承旧模型对话;修改稿会成为全新上下文的第一条消息。`)})]})]}),o?(0,B.jsx)(`p`,{children:D(`此上下文来自备份;修改后须以本机选择开启全新上下文。`)}):null]}),(0,B.jsxs)(`div`,{className:`button-row`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:s||x.trim().length===0||C===`fresh_context`&&c,onClick:()=>f(i,a.id,x,C),children:D(C===`fresh_context`?`保存为全新上下文并继续`:`保存修改并继续`)}),(0,B.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:s,onClick:()=>S(null),children:D(`取消`)})]})]})]})});if(a.kind===`assistant`){let t=h?.kind===`assistant`?h:null,n=bu(a),r=n===`tool_step`?`tool-step`:n,o=(0,B.jsxs)(B.Fragment,{children:[a.usage===void 0?null:(0,B.jsx)(Oc,{usage:a.usage,compact:!0}),a.detailsAvailable?a.status===`streaming`?(0,B.jsx)(`small`,{children:D(`响应完成后可查看模型诊断详情`)}):(0,B.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void T(),children:[(0,B.jsx)(`summary`,{children:D(`查看模型诊断详情`)}),_?(0,B.jsx)(`p`,{children:D(`正在加载…`)}):null,y===null?null:(0,B.jsx)(`p`,{role:`alert`,children:y}),t?.reasoning===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:(0,B.jsx)(`strong`,{children:D(`Provider 返回推理(不等同隐藏思维链)`)})}),(0,B.jsx)(`pre`,{children:t.reasoning})]}),t?.toolFragment===void 0?null:(0,B.jsx)(`pre`,{children:t.toolFragment}),t?.stopReason===void 0&&t?.continuation===void 0?null:(0,B.jsxs)(`dl`,{className:`prompt-budget-breakdown`,children:[t.stopReason===void 0?null:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`完成原因`)}),(0,B.jsx)(`dd`,{children:t.stopReason})]}),t.continuation===void 0?null:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:D(`原生续传载荷`)}),(0,B.jsx)(`dd`,{children:t.continuation===`available`?D(`可用`):D(`不可用`)})]})]}),t?.usage===void 0?null:(0,B.jsx)(Oc,{usage:t.usage,showProvenance:!0})]}):null]});return m===`trace`&&n===`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:D(`AI 响应诊断`)}),(0,B.jsx)(`span`,{children:D(`{status} · 第 {attempt} 次派发`,{status:yu(a.status),attempt:a.attempt})})]}),o]})}):(0,B.jsx)(`li`,{className:`call-chain-assistant is-${a.status} is-${r}`,children:(0,B.jsxs)(`article`,{children:[(0,B.jsxs)(`header`,{children:[u?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:a.status===`streaming`?D(`模型响应中`):D(n===`tool_step`?`模型工具步骤`:n===`empty`?`空模型响应`:`AI 响应`)}),(0,B.jsx)(`span`,{children:D(`{status} · 第 {attempt} 次派发`,{status:yu(a.status),attempt:a.attempt})})]}):a.status===`interrupted`?(0,B.jsx)(`strong`,{children:D(`中断片段`)}):null,a.committedHead===void 0?null:(0,B.jsxs)(`span`,{className:`history-message-actions`,children:[p===void 0?null:(0,B.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:s,onClick:p,children:D(`重新生成`)}),(0,B.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:s,onClick:()=>d(a.committedHead),children:D(`创建分叉`)})]})]}),n===`tool_step`&&a.text.length>0?(0,B.jsxs)(`details`,{className:`call-chain-tool-step-text`,children:[(0,B.jsx)(`summary`,{children:D(`查看工具步骤文本(未进入故事)`)}),(0,B.jsx)(`p`,{children:a.text})]}):(0,B.jsx)(`p`,{children:a.text.length>0?a.text:a.status===`streaming`?D(`正在接收模型输出…`):D(n===`tool_step`?`(本次响应只调用了工具)`:`(本次响应没有文本)`)}),m===`story`&&a.committedHead!==void 0?(0,B.jsx)(yo,{mount:`story`,reply:{chainId:i,eventId:a.id}}):null,n===`pending`?(0,B.jsx)(`small`,{children:D(`待定输出;响应完成前不会进入故事`)}):null,u&&a.checkpoint===!0&&a.status===`completed`&&n===`narrative`?(0,B.jsx)(`small`,{className:`play-checkpoint-marker`,children:D(`检查点`)}):null,m===`trace`?o:u&&a.status===`streaming`&&e?.kind===`assistant`&&e.reasoning?(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`Provider 返回推理(不等同隐藏思维链)`)}),(0,B.jsx)(`pre`,{children:e.reasoning})]}):null]})})}if(a.kind===`tool_call`){let e=h?.kind===`tool_call`?h:null;return(0,B.jsx)(`li`,{className:`call-chain-tool`,children:(0,B.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void T(),children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsx)(`strong`,{children:D(`调用 {tool}`,{tool:a.name})}),(0,B.jsx)(`span`,{children:a.replayed?D(`复用同 ID 结果`):a.callId})]}),_?(0,B.jsx)(`p`,{children:D(`正在加载…`)}):null,y===null?null:(0,B.jsx)(`p`,{role:`alert`,children:y}),e===null?null:(0,B.jsx)(`pre`,{children:xu(e.arguments)})]})})}if(a.kind===`tool_result`&&m===`story`&&a.resolution!==void 0)return(0,B.jsx)(`li`,{className:`call-chain-resolution`,children:(0,B.jsx)(su,{receipt:a.resolution})});if(a.kind===`tool_result`){let e=h?.kind===`tool_result`?h:null;return(0,B.jsx)(`li`,{className:`call-chain-tool-result ${a.ok?`is-ok`:`is-error`}`,children:(0,B.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void T(),children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsxs)(`strong`,{children:[a.name,` `,D(`返回`)]}),(0,B.jsx)(`span`,{children:a.ok?D(`成功`):D(`拒绝/失败`)})]}),_?(0,B.jsx)(`p`,{children:D(`正在加载…`)}):null,y===null?null:(0,B.jsx)(`p`,{role:`alert`,children:y}),e===null?null:(0,B.jsx)(`pre`,{children:e.markdown})]})})}if(a.kind===`followup`){let e=h?.kind===`followup`?h:null;return(0,B.jsxs)(`li`,{className:`call-chain-followup ${a.failed?`is-error`:`is-ok`}`,children:[(0,B.jsxs)(`details`,{onToggle:e=>e.currentTarget.open&&void T(),children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsxs)(`strong`,{children:[D(`后置请求 ·`),a.displayName]}),(0,B.jsx)(`span`,{children:a.failed?D(`未完成`):D(`{count} 项产物`,{count:a.toolCallCount})})]}),_?(0,B.jsx)(`p`,{children:D(`正在加载…`)}):null,y===null?null:(0,B.jsx)(`p`,{role:`alert`,children:y}),e===null?null:(0,B.jsx)(`pre`,{children:xu(e)})]}),!u||a.usage===void 0?null:(0,B.jsx)(Oc,{usage:a.usage,compact:!0})]})}return a.kind===`cancellation`?(0,B.jsxs)(`li`,{className:`call-chain-cancellation`,role:`status`,children:[(0,B.jsx)(`strong`,{children:D(`生成已取消`)}),(0,B.jsx)(`p`,{children:D(`本轮生成已停止;已提交的玩家原文保留,未完成的模型输出不会进入故事。`)})]}):(0,B.jsx)(`li`,{className:`call-chain-failure`,role:`alert`,children:(0,B.jsx)(bl,{failureKind:a.failureKind,canRetry:t?.canRetry??!1,message:a.message,recovery:t})})}function vu({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`?D(`你`):D(`主持`)}),e.pending?(0,B.jsx)(`span`,{children:D(`未结算`)}):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:D(`创建分叉`)})]}),(0,B.jsx)(`p`,{children:e.exactText})]})},e.messageId??`${r}-${e.role}`))})}function yu(e){return D(e===`streaming`?`接收中`:e===`interrupted`?`中断片段`:`已完成`)}function bu(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 xu(e){try{return JSON.stringify(e,null,2)}catch{return D(`[参数无法序列化]`)}}function Su({view:e}){let{open:t,toggle:n}=Ha(e.id,!0);return(0,B.jsxs)(`article`,{className:`player-view-card`,children:[(0,B.jsx)(`h3`,{children:(0,B.jsx)(Ra,{open:t,onToggle:n,label:e.title,hint:D(`{count} 项`,{count:e.items.length})})}),e.items.length===0?(0,B.jsx)(`p`,{className:`player-view-empty-value player-fold-body`,hidden:!t,children:D(`当前没有可显示项目。`)}):(0,B.jsx)(`dl`,{className:`player-fold-body`,hidden:!t,children:e.items.map(t=>(0,B.jsx)(Ja,{path:e.id+`/`+t.id,label:t.label,value:t.value,defaultOpen:!0},t.id))})]})}function Cu(e,t){return e.some(({path:e})=>e===t)?t:e[0]?.path??``}function wu(e){let t=e.trim();return t===``?{}:{turnNote:t}}function Tu(e){return e instanceof ne&&e.protocolCode===`model_protocol_mismatch`?D(`当前模型协议与此上下文不同。切回原协议即可继续;使用新协议请开启全新上下文。`):e instanceof Error?e.message:D(`操作失败`)}function Eu(e){if(e?.status!==`interrupted`||e.events.at(-1)?.kind===`cancellation`)return null;let t=e.events.findLast(e=>e.kind===`failure`);return yl(e.lastFailureKind??t?.failureKind,e.canRetry)}function Du(e,t){return e.request(t)}function Ou(e,t){if(e.activeChainId!==t.chainId)return!0;let n=e.items.findLast(e=>e.kind===`event`&&e.chainId===t.chainId);if(n?.kind!==`event`)return!1;let r=t.events.at(-1);return r===void 0||n.event.id>r.id?!0:n.event.id===r.id?t.status===`running`&&e.activeStatus!==`running`||n.event.kind===`assistant`&&n.event.status===`completed`&&r.kind===`assistant`&&r.status!==`completed`:!1}function ku(e){return{worldId:e.worldId,chainId:e.chainId,...e.contextWindowTokens===void 0?{}:{contextWindowTokens:e.contextWindowTokens},...e.latestCompletedResponse===void 0?{}:{latestCompletedResponse:e.latestCompletedResponse}}}function Au(e,t){if(e?.generation!==t.generation)return t;let n=e=>e.kind===`genesis`?`genesis:${e.messageId}`:e.kind===`context_boundary`?`context:${e.chainId}`:`event:${e.chainId}:${e.event.id}`,r=new Map(t.items.map(e=>[n(e),e])),i=e.items.map(e=>{let i=r.get(n(e));return r.delete(n(e)),i??(e.kind===`genesis`?e:{...e,current:e.chainId===t.activeChainId})});return{...t,items:[...i,...r.values()],nextCursor:e.nextCursor}}function ju(e,t){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=Mu(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,...n.requiresFreshContext?{requiresFreshContext:!0}:{}};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,activeLastFailureKind:n.lastFailureKind,items:i}}):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 Mu(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 Nu(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,activeLastFailureKind:t.lastFailureKind,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:Mu(n),...e.requiresFreshContext?{requiresFreshContext:!0}:{}}))])],nextCursor:null}}async function Pu(e,t){return await e.request({type:`world.play-decorations.read`,worldId:t})}function Fu(e){return k(Tu(e))}function Iu(e){switch(e){case``:case`#/`:return{screen:`home`};case`#/create`:return{screen:`create`};case`#/preview`:return{screen:`preview`};case`#/models`:return{screen:`model`};case`#/presets`:return{screen:`plays`};case`#/content`:return{screen:`content`,packageId:``};case`#/world`:return{screen:`world`,worldId:``}}let t=/^#\/(world|content|presets)\/([^/]+)$/u.exec(e);if(t===null)return null;let n;try{n=decodeURIComponent(t[2])}catch{n=``}return t[1]===`world`?{screen:`world`,worldId:n}:t[1]===`content`?{screen:`content`,packageId:n}:{screen:`plays`,presetId:n}}function Lu(e){switch(e.screen){case`home`:return`#/`;case`content`:return`#/content/${encodeURIComponent(e.packageId)}`;case`world`:return`#/world/${encodeURIComponent(e.worldId)}`;case`plays`:return e.presetId?`#/presets/${encodeURIComponent(e.presetId)}`:`#/presets`;case`model`:return`#/models`;case`create`:return`#/create`;case`preview`:return`#/preview`}}function Ru({client:e}){let[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(`home`),a=(0,l.useRef)({screen:`home`}),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(0),d=(0,l.useRef)(0),[f,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!1),v=(0,l.useRef)(!1),[y,b]=(0,l.useState)(!1),[S,C]=(0,l.useState)(!1),[w,E]=(0,l.useState)(!1),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(!1),[M,ee]=(0,l.useState)(null),[te,ne]=(0,l.useState)(null),[N,P]=(0,l.useState)(!1),[F,re]=(0,l.useState)(!1),ie=(0,l.useRef)(!1),[ae,oe]=(0,l.useState)(!1),{workspace:L,state:R}=_l(e,`setting`,f,r===`content`),z=R.dirty,se=R.files,ce=R.target?.packageDetail??null,[le,ue]=(0,l.useState)(``),[pe,me]=(0,l.useState)(null),[he,V]=(0,l.useState)(D(`正在读取工作区…`)),[H,_e]=(0,l.useState)(!1),U=(0,l.useRef)(z);U.current=z;let ve=(0,l.useRef)(0),ye=(0,l.useRef)(!1),be=(0,l.useRef)(!1),xe=z||R.view?.runStatus===`running`||O||A||N||ae||F||h||w;ye.current=xe,be.current=z||R.view?.runStatus===`running`||O||A||w;function Se(e,t){let n=a.current,r=Lu(e);ve.current+=1,n.screen!==e.screen&&(d.current+=1),Lu(n)!==r&&L.close(),a.current=e,e.screen===`content`&&m(e.packageId),e.screen===`world`&&ue(e.worldId),e.screen===`plays`&&s(e.presetId??``),i(e.screen),t===`replace`||n.screen===e.screen?window.history.replaceState(null,``,r):window.history.pushState(null,``,r)}function Ce(){ve.current+=1,window.history.pushState(null,``,Lu(a.current)),V(D(`已保留当前页面的未保存修改,请保存或放弃后再切换。`))}let we=(0,l.useEffectEvent)(e=>{let t=Iu(window.location.hash),n=``;if(t===null?n=D(`找不到该页面。`):t.screen===`world`&&!e.worlds.some(({worldId:e})=>e===t.worldId)?n=D(`找不到该世界。`):t.screen===`content`&&!e.contentPackages.some(({localId:e})=>e===t.packageId)?n=D(`找不到该内容包。`):t.screen===`plays`&&t.presetId!==void 0&&!e.playPresets.presets.some(({id:e})=>e===t.presetId)&&(n=D(`找不到该预设。`)),n||t===null)Se({screen:`home`},`replace`),V(n);else if(t.screen===`content`)ke(t.packageId,`replace`);else if(t.screen===`plays`){let n=t.presetId??e.playPresets.currentPresetId,r=a.current;r.screen===`plays`&&r.presetId!==n&&(d.current+=1,u(e=>e+1)),Se({screen:`plays`,...n?{presetId:n}:{}},`replace`)}else t.screen===`preview`&&!e.model.configured?(Se({screen:`model`},`replace`),V(D(`请先保存并启用一份模型配置。`))):(t.screen===`preview`&&ee(null),Se(t,`replace`))}),Te=(0,l.useEffectEvent)(()=>{if(ye.current||v.current){Ce();return}let r=++ve.current;if(t===null)return;let i=window.location.hash;e.request({type:`workspace.read`}).then(e=>{r===ve.current&&window.location.hash===i&&(ye.current||v.current?Ce():(T(e.preferences.locale),n(e),we(e)))},e=>{r===ve.current&&(window.history.pushState(null,``,Lu(a.current)),Ye(e))})});(0,l.useEffect)(()=>{let e=()=>Te();return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);async function Ee(){let t=await e.request({type:`workspace.read`});T(t.preferences.locale),n(t),m(e=>t.contentPackages.some(({localId:t})=>t===e)?e:t.contentPackages[0]?.localId??``),V(``)}(0,l.useEffect)(()=>{let e=null;return L.subscribe(()=>{let t=L.getSnapshot().target?.packageDetail;t!==void 0&&t!==e&&(e=t,n(e=>e===null?null:{...e,contentPackages:e.contentPackages.map(e=>e.localId===t.localId?{...e,...t}:e)}))})},[L]),(0,l.useEffect)(()=>{let t=!0;return e.request({type:`workspace.read`}).then(e=>{t&&(T(e.preferences.locale),n(e),m(e.contentPackages[0]?.localId??``),V(``),we(e))}).catch(e=>{t&&V(e instanceof Error?e.message:D(`工作区读取失败`))}),()=>{t=!1,ve.current+=1,d.current+=1}},[e]);async function De(n){if(!(t===null||H)){_e(!0);try{T((await e.request({type:`preferences.save`,locale:n})).locale),await Ee(),V(D(`界面语言已保存。`))}catch(e){Ye(e)}finally{_e(!1)}}}async function ke(t,n){let r=ve.current+1;ve.current=r;try{if(await e.request({type:`content.read`,packageId:t}),ve.current!==r)return;if(be.current||n===`replace`&&(ye.current||v.current)){n===`replace`?Ce():V(D(`已保留当前页面的未保存修改,请保存或放弃后再切换。`));return}Se({screen:`content`,packageId:t},n)}catch(e){ve.current===r&&(n===`replace`&&window.history.replaceState(null,``,Lu(a.current)),Ye(e))}}async function je(t){C(!0);try{let n=await e.request({type:`content.create`,gameplay:t});b(!1);try{await Ee(),await ke(n.localId)}catch(e){Ye(e)}}finally{C(!1)}}async function Ne(t){try{await L.holdDraftsWhile(async()=>{await e.request({type:`content.gameplay.set`,packageId:f,scheme:t})}),V(D(`判定方案已保存;已有世界保持原方案。`))}catch(e){Ye(e)}}async function Pe(){if(!(t===null||ie.current||N)){ie.current=!0,re(!0);try{let n=await e.request({type:`content.create-sample`,locale:t.preferences.locale});await Ee(),m(n.localId),Se({screen:`create`})}catch(e){Ye(e)}finally{ie.current=!1,re(!1)}}}async function Le(t,n=f){try{await e.request({type:t,packageId:n}),await Ee(),Se({screen:`home`})}catch(e){Ye(e)}}async function ze(t,n=f){try{await e.request({type:`content.rename`,packageId:n,name:t}),await Ee(),V(D(`内容包已重命名。`))}catch(e){Ye(e)}}async function Be(){if(!(te===null||N)){if(te.size>x)V(D(`内容包 ZIP 自身大小超过安全上限。`));else{P(!0);try{let t=await zu(te),n=await e.request({type:`content.import`,archiveBase64:t,title:Bu(te.name)});ne(null),await Ee(),await ke(n.localId),V(D(`ZIP 内容包已导入为新的本地身份。`))}catch(e){Ye(e)}finally{P(!1)}}}}async function Ve(){try{let t=await e.request({type:`content.export`,packageId:f}),n=Uint8Array.from(atob(t.base64),e=>e.charCodeAt(0));await I(t.fileName,{blob:new Blob([n],{type:`application/zip`})})}catch(e){Ye(e)}}function Ue(e){ee(e??null),t?.model.configured===!0?Se({screen:`preview`}):(Se({screen:`model`}),V(D(`请先保存并启用一份模型配置。`)))}async function We(n){if(v.current||U.current||R.view?.runStatus===`running`||(ce?.localId===f?ce:t?.contentPackages.find(({localId:e})=>e===f))?.status!==`usable`||r===`content`&&R.loading)return;if(t?.model.configured!==!0){Se({screen:`model`}),V(D(`请先保存并启用一份模型配置。`));return}v.current=!0,g(!0);let i=f,a=Ge();try{let t=await e.request({type:`setting-improvement.overview`,packageId:i});if(t.latest?.runStatus===`running`||t.history.some(e=>e.runStatus===`running`)){V(D(`这份内容包正在完善,请在回复完成后创建世界。`));return}let r=await e.request({type:`world.create`,operationId:p(`create`),packageId:i,model:a});n!==void 0&&me({worldId:r.world.worldId,message:D(`请按下面的主角模板修改本世界的主角。
1398
+
1399
+ - 找到本世界中代表玩家的主角文档,按模板改写姓名、外貌、背景、性格等相关内容。
1400
+ - 模板与本世界设定冲突的部分,保留模板的意图,按本世界的规则调整。
1401
+ - 只修改主角相关的内容,不修改其他人物、地点、规则或世界控制。
1402
+ - 如果本世界中找不到明确的主角文档,先在回复中说明并询问我,不要擅自新建。
1403
+
1404
+ 主角模板:
1405
+
1406
+ {body}`,{body:n.body}),started:!1}),await Ee(),Ke(r.world.worldId)}catch(e){Ye(e)}finally{v.current=!1,g(!1)}}function Ge(){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 Ke(e){Se({screen:`world`,worldId:e})}async function qe(t,n){await e.request({type:`world.rename`,worldId:t,name:n}),await Ee(),V(D(`世界已重命名为“{name}”。`,{name:n}))}async function Je(t){if(globalThis.confirm(D(`删除世界“{title}”?它的全部提交、历史和存档都会从本机移除,且无法撤销。`,{title:t.title})))try{await e.request({type:`world.delete`,worldId:t.worldId}),await Ee(),V(D(`世界已从本机删除。`))}catch(e){Ye(e)}}function Ye(e){V(e instanceof Error?e.message:D(`操作失败`))}if(t===null)return(0,B.jsx)(`main`,{className:`center-card`,role:`status`,children:he});let Xe=t.contentPackages.find(({localId:e})=>e===f),Ze=ce?.localId===f?ce:null,Qe=Ze?.gameplay??Xe?.gameplay,$e=R.view,et=t.worlds.find(e=>e.worldId===le),tt=t.model.connections.find(({id:e})=>e===t.model.activeConnectionId),nt=t.playPresets.presets.find(({id:e})=>e===t.playPresets.currentPresetId)?.name??null;function rt(e){xe||((e!==`content`||e===r)&&(ve.current+=1),e!==r&&(e===`content`?Xe===void 0?b(!0):ke(Xe.localId):e===`preview`?Ue():e===`plays`?Se({screen:`plays`,...o||t?.playPresets.currentPresetId?{presetId:o||(t?.playPresets.currentPresetId??``)}:{}}):e===`world`?Ke(le):(Se({screen:e}),e===`home`&&Ee().catch(Ye))))}let it=d.current,at=r===`world`?(0,l.createElement)(du,{showWorkspaceBack:!1,...pe?.worldId===le?{protagonistRevision:pe,onProtagonistRevisionStarted:()=>me(e=>e===null?null:{...e,started:!0}),onProtagonistRevisionFinished:()=>me(null)}:{},key:le,client:e,worldId:le,worldTitle:et?.title??D(`未命名世界`),modelConfigured:t.model.configured,onBack:()=>rt(`home`),onConfigureModel:()=>rt(`model`),onNavigationLockChange:E,onRenameWorld:e=>qe(le,e),initialReadingPreferences:t.preferences.reading??_,onReadingPreferencesChange:e=>n(t=>t===null?null:{...t,preferences:{...t.preferences,reading:e}}),onOpenWorld:async e=>{await Ee(),Ke(e)}}):null,ot=r===`content`?(0,B.jsx)(Wc,{showWorkspaceBack:!1,onPreview:()=>L.preview(),packageName:Xe?.title??f,modelConfigured:t.model.configured,...Qe===void 0?{}:{packageGameplay:{gameplay:Qe,onChangeScheme:Ne}},hasUnsavedFileDraft:z,draftsLocked:R.draftsLocked,loading:R.loading||h,onCreateWorld:()=>void We(),onNavigationLockChange:E,view:$e,history:R.target?.history??[],latestSessionId:R.target?.latest?.sessionId??R.target?.history[0]?.sessionId??null,notice:he||R.notice,requestFailure:R.requestFailure??R.observationFailure,now:R.now,contentEditor:{scriptPermission:(0,B.jsx)(ge,{client:e,kind:`content`,id:f,dirty:z},f),files:se,status:Ze?.status??Xe?.status??`needs_repair`,issues:Ze?.issues??[],dirty:z,conflict:R.conflict,onFilesChange:e=>L.editFiles(e),onSave:()=>{V(``),L.saveFiles()},onLoadLatest:()=>{V(``),L.loadLatest()},onReset:()=>{V(``),L.resetFiles()},onCopy:()=>void Le(`content.copy`),onExport:()=>void Ve(),onDelete:()=>void Le(`content.delete`),title:Xe?.title??f,onRename:e=>void ze(e)},onSend:e=>(V(``),L.send(e)),onCancel:()=>L.cancel(),onResume:()=>(V(``),L.resume()),onFreshContext:()=>L.startFresh(),onSelectSession:e=>L.selectSession(e),onDeleteSession:e=>(V(``),L.deleteSession(e)),onRollbackFile:(e,t,n)=>(V(``),L.rollbackFile(e,t,n)),onConfigureModel:()=>rt(`model`),onBack:()=>rt(`home`)},f):null;return(0,B.jsxs)(`div`,{className:`workspace-shell`,"data-screen":r,children:[(0,B.jsx)(Ae,{screen:r,locale:t.preferences.locale,localeSaving:H,navigationLocked:xe,activeModelName:tt?.name??null,onNavigate:rt,onLocaleChange:e=>void De(e)}),y?(0,B.jsx)(Me,{pending:S,onCancel:()=>b(!1),onCreate:je}):null,(0,B.jsxs)(`div`,{className:`workspace-body`,children:[at,ot,r!==`content`&&(he||t.storageNotices.length>0)&&(0,B.jsxs)(`div`,{className:`workspace-feedback`,children:[he&&(0,B.jsx)(Ie,{text:he,onDismiss:()=>V(``)}),t.storageNotices.map(e=>(0,B.jsx)(`p`,{role:`alert`,children:e.message},e.surface))]}),r===`home`&&(0,B.jsx)(Re,{contentPackages:t.contentPackages,worlds:t.worlds,selectedPackageId:f,modelConfigured:t.model.configured,activeModelName:tt?.name??null,currentPresetName:nt,importArchive:te,importPending:N||ae,worldBackupImport:(0,B.jsx)(fe,{client:e,disabled:N||F||ae,onBusyChange:oe,onImported:Ee}),renderWorldBackupExport:t=>(0,B.jsx)(de,{client:e,worldId:t.worldId,label:`导出备份`,disabled:N||ae||F,onBusyChange:oe}),samplePending:F,onImportArchiveChange:e=>{ne(e),V(``)},onOpenPlayPresets:()=>rt(`plays`),onCreateWorld:()=>rt(`create`),onCreatePackage:()=>b(!0),onCreateSamplePackage:()=>void Pe(),onConfigureModel:()=>rt(`model`),onImportPackage:()=>void Be(),onOpenPackage:e=>void ke(e),onRenamePackage:(e,t)=>void ze(t,e.localId),onDeletePackage:e=>{globalThis.confirm(D(`删除内容包“{title}”?它会从本机移除,且无法撤销。已创建的世界不受影响。`,{title:e.title}))&&Le(`content.delete`,e.localId)},onOpenWorld:Ke,onRenameWorld:(e,t)=>void qe(e.worldId,t).catch(Ye),onDeleteWorld:e=>void Je(e)}),r===`plays`&&(0,B.jsx)(zo,{client:e,initialLibrary:t.playPresets,initialSelectedId:o,onSelectionChange:e=>{a.current.screen===`plays`&&d.current===it&&Se({screen:`plays`,...e?{presetId:e}:{}},`replace`)},recommendedTemplates:Oe(t.preferences.locale),onLibraryChange:e=>n(t=>t===null?t:{...t,playPresets:e}),onDirtyChange:k,renderPromptPreview:n=>(0,B.jsx)(Yo,{embedded:!0,client:e,packages:t.contentPackages,initialPackageId:f,playPresets:t.playPresets,model:t.model,onPackageSelect:m,playPresetTarget:n},`${n.presetId}:${n.revision}`)},c),r===`model`&&(0,B.jsx)(He,{client:e,library:t.model,onLibraryChange:e=>n(t=>t===null?t:{...t,model:e}),onNotice:V,onDirtyChange:j}),r===`create`&&(0,B.jsx)(Fe,{client:e,packages:t.contentPackages,selectedId:f,pending:h,modelConfigured:t.model.configured,onSelect:m,onCreate:e=>void We(e),onNavigationLockChange:E,onEdit:()=>rt(`content`),onConfigureModel:()=>rt(`model`)}),r===`preview`&&(0,B.jsx)(Yo,{client:e,packages:t.contentPackages,initialPackageId:f,playPresets:t.playPresets,model:t.model,onPackageSelect:m,...M===null?{}:{playPresetTarget:M}})]})]})}async function zu(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,`);e<0?n(Error(`The content package ZIP could not be encoded for upload`)):t(r.result.slice(e+8))}),r.readAsDataURL(e)})}function Bu(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:D(`导入的内容包`)}var Vu=class extends l.Component{state={error:null,componentStack:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){this.setState({componentStack:t.componentStack??null}),console.error(e)}render(){let{error:e,componentStack:t}=this.state;if(e===null)return this.props.children;let n=[e.stack??`${e.name}: ${e.message}`].concat(t===null?[]:[t.trim()]).join(`
1407
+
1408
+ `);return(0,B.jsxs)(`main`,{className:`center-card app-error-boundary`,role:`alert`,children:[(0,B.jsx)(`h1`,{children:D(`页面出错了`)}),(0,B.jsx)(`p`,{children:D(`页面显示时发生错误,已保存的故事和世界不受影响。请重新加载页面;如果反复出现,请把下面的技术详情发给开发者。`)}),(0,B.jsx)(`p`,{className:`app-error-message`,children:e.message}),(0,B.jsxs)(`div`,{className:`app-error-actions`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:D(`重新加载页面`)}),F()&&(0,B.jsx)(`button`,{type:`button`,onClick:re,children:D(`导出诊断日志`)})]}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:D(`技术详情`)}),(0,B.jsx)(`pre`,{children:n})]})]})}},Hu=document.querySelector(`#root`);if(Hu===null)throw Error(`The page is missing the application mount point`);var Uu=new N;(0,u.createRoot)(Hu).render((0,B.jsx)(l.StrictMode,{children:(0,B.jsx)(Vu,{children:(0,B.jsx)(Ru,{client:Uu})})}));