narraeon 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/node/protocol/modelConnections.js +49 -0
  2. package/dist/node/protocol/modelUsage.js +39 -0
  3. package/dist/node/protocol/v1.js +35 -0
  4. package/dist/node/runtime/FileNativePhysicalClone.js +86 -0
  5. package/dist/node/runtime/V1Runtime.js +66 -29
  6. package/dist/node/runtime/model/FileNativeModelAdapters.js +730 -287
  7. package/dist/node/runtime/model/ModelConnectionStore.js +123 -2
  8. package/dist/node/runtime/model/ModelHost.js +81 -9
  9. package/dist/node/runtime/model/ModelHostStream.js +61 -1
  10. package/dist/node/runtime/model/SettingAuthorStream.js +16 -113
  11. package/dist/node/runtime/play/FileNativePlayAdvanceStore.js +269 -0
  12. package/dist/node/runtime/play/FileNativePlayTimelineStore.js +1128 -0
  13. package/dist/node/runtime/play/PlayCallChain.js +904 -369
  14. package/dist/node/runtime/play/PlayDocumentTools.js +35 -0
  15. package/dist/node/runtime/play/PlayFollowupRequests.js +43 -26
  16. package/dist/node/runtime/prompt/FileNativePromptCompiler.js +50 -35
  17. package/dist/node/runtime/prompt/FileNativeToolRegistry.js +55 -29
  18. package/dist/node/runtime/setting/DocumentCandidateSettingImprovement.js +9 -4
  19. package/dist/node/runtime/world/FileNativeAuthorityV3.js +971 -0
  20. package/dist/node/runtime/world/FileNativeHistoryProjection.js +39 -0
  21. package/dist/node/runtime/world/FileNativeWorldStorageMigrator.js +1067 -0
  22. package/dist/node/runtime/world/FileNativeWorldStore.js +615 -784
  23. package/dist/node/server/createServer.js +10 -2
  24. package/dist/web/assets/index-D5VqDvjY.js +1192 -0
  25. package/dist/web/assets/index-Xa0s35CJ.css +1 -0
  26. package/dist/web/index.html +2 -2
  27. package/package.json +1 -1
  28. package/dist/web/assets/index-CRGTZ9Ak.css +0 -1
  29. package/dist/web/assets/index-DDx1itzT.js +0 -1192
@@ -1,1192 +0,0 @@
1
- var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function ee(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function E(e,t){return ee(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function te(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?te(``+e.key):t.toString(36)}function ne(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 re(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,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(O,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+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+k(a,u),c+=re(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+k(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(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 A(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ie(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 j=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)},M={map:A,forEach:function(e,t,n){A(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=M,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 ee(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 ee(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ie}},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,j)}catch(e){j(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,D());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){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&&ee());){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&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,O=te.port2;te.port1.onmessage=E,D=function(){O.postMessage(null)}}else D=function(){_(E,0)};function k(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,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,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`),ee=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function ne(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function A(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?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 ee:return`SuspenseList`;case te: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 E:return t=e.displayName||null,t===null?A(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return A(e(t))}catch{}}return null}var ie=Array.isArray,j=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N={pending:!1,data:null,method:null,action:null},P=[],ae=-1;function F(e){return{current:e}}function I(e){0>ae||(e.current=P[ae],P[ae]=null,ae--)}function L(e,t){ae++,P[ae]=e.current,e.current=t}var oe=F(null),R=F(null),z=F(null),se=F(null);function B(e,t){switch(L(z,t),L(R,e),L(oe,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}}I(oe),L(oe,e)}function V(){I(oe),I(R),I(z)}function ce(e){e.memoizedState!==null&&L(se,e);var t=oe.current,n=Hd(t,e.type);t!==n&&(L(R,e),L(oe,n))}function H(e){R.current===e&&(I(oe),I(R)),se.current===e&&(I(se),Qf._currentValue=N)}var le,ue;function U(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
2
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
- `+le+e+ue}var de=!1;function fe(e,t){if(!e||de)return``;de=!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{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?U(n):``}function pe(e,t){switch(e.tag){case 26:case 27:case 5:return U(e.type);case 16:return U(`Lazy`);case 13:return e.child!==t&&t!==null?U(`Suspense Fallback`):U(`Suspense`);case 19:return U(`SuspenseList`);case 0:case 15:return fe(e.type,!1);case 11:return fe(e.type.render,!1);case 1:return fe(e.type,!0);case 31:return U(`Activity`);default:return``}}function me(e){try{var t=``,n=null;do t+=pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
- Error generating stack: `+e.message+`
8
- `+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=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,W=t.unstable_setDisableYieldValue,Oe=null,ke=null;function G(e){if(typeof De==`function`&&W(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var Ae=Math.clz32?Math.clz32:Ne,je=Math.log,Me=Math.LN2;function Ne(e){return e>>>=0,e===0?32:31-(je(e)/Me|0)|0}var Pe=256,Fe=262144,Ie=4194304;function Le(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 Re(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=Le(n))):i=Le(o):i=Le(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Le(n))):i=Le(o)):i=Le(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 ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Be(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 Ve(){var e=Ie;return Ie<<=1,!(Ie&62914560)&&(Ie=4194304),e}function He(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(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-Ae(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&&Ge(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ge(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ae(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ke(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ae(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:Je(n),(n&(e.suspendedLanes|t))===0?n:0}function Je(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 Ye(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Xe(){var e=M.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Ze(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var Qe=Math.random().toString(36).slice(2),$e=`__reactFiber$`+Qe,et=`__reactProps$`+Qe,tt=`__reactContainer$`+Qe,nt=`__reactEvents$`+Qe,rt=`__reactListeners$`+Qe,it=`__reactHandles$`+Qe,at=`__reactResources$`+Qe,ot=`__reactMarker$`+Qe;function st(e){delete e[$e],delete e[et],delete e[nt],delete e[rt],delete e[it]}function ct(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tt]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[$e])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function lt(e){if(e=e[$e]||e[tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ut(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function dt(e){var t=e[at];return t||=e[at]={hoistableStyles:new Map,hoistableScripts:new Map},t}function K(e){e[ot]=!0}var ft=new Set,pt={};function mt(e,t){ht(e,t),ht(e+`Capture`,t)}function ht(e,t){for(pt[e]=t,e=0;e<t.length;e++)ft.add(t[e])}var gt=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]*$`),_t={},vt={};function yt(e){return he.call(vt,e)?!0:he.call(_t,e)?!1:gt.test(e)?vt[e]=!0:(_t[e]=!0,!1)}function bt(e,t,n){if(yt(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 xt(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 St(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 Ct(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function wt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Tt(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 Et(e){if(!e._valueTracker){var t=wt(e)?`checked`:`value`;e._valueTracker=Tt(e,t,``+e[t])}}function Dt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=wt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ot(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 kt=/[\n"\\]/g;function At(e){return e.replace(kt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function jt(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=``+Ct(t)):e.value!==``+Ct(t)&&(e.value=``+Ct(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Nt(e,o,Ct(n)):Nt(e,o,Ct(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=``+Ct(s):e.removeAttribute(`name`)}function Mt(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)){Et(e);return}n=n==null?``:``+Ct(n),t=t==null?n:``+Ct(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),Et(e)}function Nt(e,t,n){t===`number`&&Ot(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Pt(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=``+Ct(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 Ft(e,t,n){if(t!=null&&(t=``+Ct(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ct(n)}function It(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(ie(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=Ct(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Et(e)}function Lt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rt=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 zt(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||Rt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Bt(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&&zt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&zt(e,a,t[a])}function Vt(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 Ht=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`]]),Ut=/^[\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 Wt(e){return Ut.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Gt(){}var Kt=null;function qt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Jt=null,Yt=null;function Xt(e){var t=lt(e);if(t&&(e=t.stateNode)){var n=e[et]||null;a:switch(e=t.stateNode,t.type){case`input`:if(jt(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="`+At(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[et]||null;if(!i)throw Error(s(90));jt(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&&Dt(r)}break a;case`textarea`:Ft(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Pt(e,!!n.multiple,t,!1)}}}var Zt=!1;function Qt(e,t,n){if(Zt)return e(t,n);Zt=!0;try{return e(t)}finally{if(Zt=!1,(Jt!==null||Yt!==null)&&(vu(),Jt&&(t=Jt,e=Yt,Yt=Jt=null,Xt(t),e)))for(t=0;t<e.length;t++)Xt(e[t])}}function $t(e,t){var n=e.stateNode;if(n===null)return null;var r=n[et]||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 en=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),tn=!1;if(en)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){tn=!0}}),window.addEventListener(`test`,nn,nn),window.removeEventListener(`test`,nn,nn)}catch{tn=!1}var rn=null,an=null,on=null;function sn(){if(on)return on;var e,t=an,n=t.length,r,i=`value`in rn?rn.value:rn.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 on=i.slice(e,1<r?1-r:void 0)}function cn(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 ln(){return!0}function un(){return!1}function dn(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)?ln:un,this.isPropagationStopped=un,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=ln)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=ln)},persist:function(){},isPersistent:ln}),t}var fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=dn(fn),mn=h({},fn,{view:0,detail:0}),hn=dn(mn),gn,_n,vn,yn=h({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:An,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!==vn&&(vn&&e.type===`mousemove`?(gn=e.screenX-vn.screenX,_n=e.screenY-vn.screenY):_n=gn=0,vn=e),gn)},movementY:function(e){return`movementY`in e?e.movementY:_n}}),bn=dn(yn),xn=dn(h({},yn,{dataTransfer:0})),Sn=dn(h({},mn,{relatedTarget:0})),Cn=dn(h({},fn,{animationName:0,elapsedTime:0,pseudoElement:0})),wn=dn(h({},fn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Tn=dn(h({},fn,{data:0})),En={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Dn={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`},On={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function kn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=On[e])?!!t[e]:!1}function An(){return kn}var jn=dn(h({},mn,{key:function(e){if(e.key){var t=En[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Dn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:An,charCode:function(e){return e.type===`keypress`?cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Mn=dn(h({},yn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Nn=dn(h({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:An})),Pn=dn(h({},fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Fn=dn(h({},yn,{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})),In=dn(h({},fn,{newState:0,oldState:0})),Ln=[9,13,27,32],Rn=en&&`CompositionEvent`in window,zn=null;en&&`documentMode`in document&&(zn=document.documentMode);var Bn=en&&`TextEvent`in window&&!zn,Vn=en&&(!Rn||zn&&8<zn&&11>=zn),Hn=` `,Un=!1;function Wn(e,t){switch(e){case`keyup`:return Ln.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Gn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Kn=!1;function qn(e,t){switch(e){case`compositionend`:return Gn(t);case`keypress`:return t.which===32?(Un=!0,Hn):null;case`textInput`:return e=t.data,e===Hn&&Un?null:e;default:return null}}function Jn(e,t){if(Kn)return e===`compositionend`||!Rn&&Wn(e,t)?(e=sn(),on=an=rn=null,Kn=!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 Vn&&t.locale!==`ko`?null:t.data;default:return null}}var Yn={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 Xn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Yn[e.type]:t===`textarea`}function Zn(e,t,n,r){Jt?Yt?Yt.push(r):Yt=[r]:Jt=r,t=Td(t,`onChange`),0<t.length&&(n=new pn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Qn=null,$n=null;function er(e){vd(e,0)}function tr(e){if(Dt(ut(e)))return e}function nr(e,t){if(e===`change`)return t}var rr=!1;if(en){var ir;if(en){var ar=`oninput`in document;if(!ar){var or=document.createElement(`div`);or.setAttribute(`oninput`,`return;`),ar=typeof or.oninput==`function`}ir=ar}else ir=!1;rr=ir&&(!document.documentMode||9<document.documentMode)}function sr(){Qn&&(Qn.detachEvent(`onpropertychange`,cr),$n=Qn=null)}function cr(e){if(e.propertyName===`value`&&tr($n)){var t=[];Zn(t,$n,e,qt(e)),Qt(er,t)}}function lr(e,t,n){e===`focusin`?(sr(),Qn=t,$n=n,Qn.attachEvent(`onpropertychange`,cr)):e===`focusout`&&sr()}function ur(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return tr($n)}function dr(e,t){if(e===`click`)return tr(t)}function fr(e,t){if(e===`input`||e===`change`)return tr(t)}function pr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var mr=typeof Object.is==`function`?Object.is:pr;function hr(e,t){if(mr(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(!he.call(t,i)||!mr(e[i],t[i]))return!1}return!0}function gr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _r(e,t){var n=gr(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=gr(n)}}function vr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ot(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=Ot(e.document)}return t}function br(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 xr=en&&`documentMode`in document&&11>=document.documentMode,Sr=null,Cr=null,wr=null,Tr=!1;function Er(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tr||Sr==null||Sr!==Ot(r)||(r=Sr,`selectionStart`in r&&br(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}),wr&&hr(wr,r)||(wr=r,r=Td(Cr,`onSelect`),0<r.length&&(t=new pn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Sr)))}function Dr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Or={animationend:Dr(`Animation`,`AnimationEnd`),animationiteration:Dr(`Animation`,`AnimationIteration`),animationstart:Dr(`Animation`,`AnimationStart`),transitionrun:Dr(`Transition`,`TransitionRun`),transitionstart:Dr(`Transition`,`TransitionStart`),transitioncancel:Dr(`Transition`,`TransitionCancel`),transitionend:Dr(`Transition`,`TransitionEnd`)},kr={},Ar={};en&&(Ar=document.createElement(`div`).style,`AnimationEvent`in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),`TransitionEvent`in window||delete Or.transitionend.transition);function jr(e){if(kr[e])return kr[e];if(!Or[e])return e;var t=Or[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ar)return kr[e]=t[n];return e}var Mr=jr(`animationend`),Nr=jr(`animationiteration`),Pr=jr(`animationstart`),Fr=jr(`transitionrun`),q=jr(`transitionstart`),Ir=jr(`transitioncancel`),Lr=jr(`transitionend`),Rr=new Map,zr=`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(` `);zr.push(`scrollEnd`);function Br(e,t){Rr.set(e,t),mt(t,[e])}var Vr=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)},Hr=[],Ur=0,Wr=0;function Gr(){for(var e=Ur,t=Wr=Ur=0;t<e;){var n=Hr[t];Hr[t++]=null;var r=Hr[t];Hr[t++]=null;var i=Hr[t];Hr[t++]=null;var a=Hr[t];if(Hr[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&&Yr(n,i,a)}}function Kr(e,t,n,r){Hr[Ur++]=e,Hr[Ur++]=t,Hr[Ur++]=n,Hr[Ur++]=r,Wr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function qr(e,t,n,r){return Kr(e,t,n,r),Xr(e)}function Jr(e,t){return Kr(e,null,null,t),Xr(e)}function Yr(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-Ae(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Xr(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 Zr={};function Qr(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 $r(e,t,n,r){return new Qr(e,t,n,r)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=$r(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 ni(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 ri(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ei(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,oe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case te:return e=$r(31,n,t,i),e.elementType=te,e.lanes=a,e;case y:return ii(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=$r(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=$r(13,n,t,i),e.elementType=T,e.lanes=a,e;case ee:return e=$r(19,n,t,i),e.elementType=ee,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 E:o=14;break a;case D:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=$r(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ii(e,t,n,r){return e=$r(7,e,r,t),e.lanes=n,e}function ai(e,t,n){return e=$r(6,e,null,t),e.lanes=n,e}function oi(e){var t=$r(18,null,null,0);return t.stateNode=e,t}function si(e,t,n){return t=$r(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ci=new WeakMap;function li(e,t){if(typeof e==`object`&&e){var n=ci.get(e);return n===void 0?(t={value:e,source:t,stack:me(t)},ci.set(e,t),t):n}return{value:e,source:t,stack:me(t)}}var ui=[],di=0,fi=null,pi=0,mi=[],hi=0,gi=null,_i=1,vi=``;function yi(e,t){ui[di++]=pi,ui[di++]=fi,fi=e,pi=t}function bi(e,t,n){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,gi=e;var r=_i;e=vi;var i=32-Ae(r)-1;r&=~(1<<i),n+=1;var a=32-Ae(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_i=1<<32-Ae(t)+i|n<<i|r,vi=a+e}else _i=1<<a|n<<i|r,vi=e}function xi(e){e.return!==null&&(yi(e,1),bi(e,1,0))}function Si(e){for(;e===fi;)fi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null;for(;e===gi;)gi=mi[--hi],mi[hi]=null,vi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null}function Ci(e,t){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,_i=t.id,vi=t.overflow,gi=e}var wi=null,Ti=null,J=!1,Ei=null,Di=!1,Oi=Error(s(519));function ki(e){throw Fi(li(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Oi}function Ai(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[et]=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),Mt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),It(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=Gt),t=!0):t=!1,t||ki(e,!0)}function ji(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Di=!1;return;case 27:case 3:Di=!0;return;default:wi=wi.return}}function Mi(e){if(e!==wi)return!1;if(!J)return ji(e),J=!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&&Ti&&ki(e),ji(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ti=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ti=uf(e)}else t===27?(t=Ti,Zd(e.type)?(e=lf,lf=null,Ti=e):Ti=t):Ti=wi?cf(e.stateNode.nextSibling):null;return!0}function Ni(){Ti=wi=null,J=!1}function Pi(){var e=Ei;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Ei=null),e}function Fi(e){Ei===null?Ei=[e]:Ei.push(e)}var Ii=F(null),Li=null,Ri=null;function zi(e,t,n){L(Ii,t._currentValue),t._currentValue=n}function Bi(e){e._currentValue=Ii.current,I(Ii)}function Vi(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 Hi(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),Vi(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),Vi(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 Ui(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;mr(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&&Hi(t,e,n,r),t.flags|=262144}function Wi(e){for(e=e.firstContext;e!==null;){if(!mr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gi(e){Li=e,Ri=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ki(e){return Ji(Li,e)}function qi(e,t){return Li===null&&Gi(e),Ji(e,t)}function Ji(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ri===null){if(e===null)throw Error(s(308));Ri=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ri=Ri.next=t;return n}var Yi=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()})}},Xi=t.unstable_scheduleCallback,Zi=t.unstable_NormalPriority,Qi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $i(){return{controller:new Yi,data:new Map,refCount:0}}function ea(e){e.refCount--,e.refCount===0&&Xi(Zi,function(){e.controller.abort()})}var ta=null,na=0,ra=0,ia=null;function aa(e,t){if(ta===null){var n=ta=[];na=0,ra=ud(),ia={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return na++,t.then(oa,oa),t}function oa(){if(--na===0&&ta!==null){ia!==null&&(ia.status=`fulfilled`);var e=ta;ta=null,ra=0,ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sa(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 ca=j.S;j.S=function(e,t){Ql=be(),typeof t==`object`&&t&&typeof t.then==`function`&&aa(e,t),ca!==null&&ca(e,t)};var la=F(null);function ua(){var e=la.current;return e===null?Fl.pooledCache:e}function da(e,t){t===null?L(la,la.current):L(la,t.pool)}function fa(){var e=ua();return e===null?null:{parent:Qi._currentValue,pool:e}}var pa=Error(s(460)),ma=Error(s(474)),ha=Error(s(542)),ga={then:function(){}};function _a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function va(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Gt,Gt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e;default:if(typeof t.status==`string`)t.then(Gt,Gt);else{if(e=Fl,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e}throw ba=t,pa}}function ya(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ba=e,pa):e}}var ba=null;function xa(){if(ba===null)throw Error(s(459));var e=ba;return ba=null,e}function Sa(e){if(e===pa||e===ha)throw Error(s(483))}var Ca=null,wa=0;function Ta(e){var t=wa;return wa+=1,Ca===null&&(Ca=[]),va(Ca,e,t)}function Ea(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Da(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 Oa(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=ti(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=ai(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===D&&ya(a)===t.type)?(t=i(t,n.props),Ea(t,n),t.return=e,t):(t=ri(n.type,n.key,n.props,null,e.mode,r),Ea(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=si(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=ii(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=ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ri(t.type,t.key,t.props,null,e.mode,n),Ea(n,t),n.return=e,n;case v:return t=si(t,e.mode,n),t.return=e,t;case D:return t=ya(t),f(e,t,n)}if(ie(t)||ne(t))return t=ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ta(t),n);if(t.$$typeof===C)return f(e,qi(e,t),n);Da(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 D:return n=ya(n),p(e,t,n,r)}if(ie(n)||ne(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ta(n),r);if(n.$$typeof===C)return p(e,t,qi(e,n),r);Da(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 D:return r=ya(r),m(e,t,n,r,i)}if(ie(r)||ne(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ta(r),i);if(r.$$typeof===C)return m(e,t,n,qi(t,r),i);Da(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),J&&yi(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 J&&yi(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)}),J&&yi(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),J&&yi(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 J&&yi(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)}),J&&yi(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===D&&ya(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ea(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=ii(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ri(a.type,a.key,a.props,null,e.mode,c),Ea(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=si(a,e.mode,c),c.return=e,e=c}return o(e);case D:return a=ya(a),b(e,r,a,c)}if(ie(a))return h(e,r,a,c);if(ne(a)){if(l=ne(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,Ta(a),c);if(a.$$typeof===C)return b(e,r,qi(e,a),c);Da(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=ai(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{wa=0;var i=b(e,t,n,r);return Ca=null,i}catch(t){if(t===pa||t===ha)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ka=Oa(!0),Aa=Oa(!1),ja=!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,X&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(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,Ke(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;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ra=!1;function za(){if(Ra){var e=ia;if(e!==null)throw e}}function Ba(e,t,n,r){Ra=!1;var i=e.updateQueue;ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===ra&&(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:ja=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function 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=F(null),Wa=F(0);function Ga(e,t){e=Vl,L(Wa,e),L(Ua,t),Vl=e|t.baseLanes}function Ka(){L(Wa,Vl),L(Ua,Ua.current)}function qa(){Vl=Wa.current,I(Ua),I(Wa)}var Ja=F(null),Ya=null;function Xa(e){var t=e.alternate;L(to,to.current&1),L(Ja,e),Ya===null&&(t===null||Ua.current!==null||t.memoizedState!==null)&&(Ya=e)}function Za(e){L(to,to.current),L(Ja,e),Ya===null&&(Ya=e)}function Qa(e){e.tag===22?(L(to,to.current),L(Ja,e),Ya===null&&(Ya=e)):$a(e)}function $a(){L(to,to.current),L(Ja,Ja.current)}function eo(e){I(Ja),Ya===e&&(Ya=null),I(to)}var to=F(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(!mr(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,j.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){j.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&&Wi(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)}j.H=Fs,a=t(n,r)}while(so);return a}function yo(){var e=j.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=va(fo,e,t),t=Y,(ao===null?t.memoizedState:ao.next)===null&&(t=t.alternate,j.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 Ki(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]=O;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:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ra&&(d=!0);else if((ro&p)===p){u=u.next,p===ra&&(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,Ul|=p;f=u.action,co&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,Y.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!mr(a,e.memoizedState)&&(Zs=!0,d&&(n=ia,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);mr(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=J;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!mr((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),Fl===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!mr(e,n)}catch{return!0}}function Ro(e){var t=Jr(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){G(!0);try{n()}finally{G(!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)}};j.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=j.T,o={};j.T=o;try{var s=n(i,r),c=j.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),j.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(J){var n=Fl.formState;if(n!==null){a:{var r=Y;if(J){if(Ti){b:{for(var i=Ti,a=Di;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ti=cf(i.nextSibling),r=i.data===`F!`;break a}}ki(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===pa?ha: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(X&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){G(!0);try{e()}finally{G(!1)}}return n.memoizedState=[r,t],r}function ms(e,t,n){return n===void 0||ro&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),Y.lanes|=e,Ul|=e,n)}function hs(e,t,n,r){return mr(n,t)?n:Ua.current===null?!(ro&42)||ro&1073741824&&!(Q&261930)?(Zs=!0,e.memoizedState=n):(e=fu(),Y.lanes|=e,Ul|=e,t):(e=ms(e,n,r),mr(e,t)||(Zs=!0),e)}function gs(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,Os(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ds(e,t,sa(c,r),du(e)):Ds(e,t,r,du(e))}catch(n){Ds(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.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,N,n===null?_s:function(){return bs(e),n(r)})}function ys(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:N},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 Ki(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:$i()},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=qr(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,mr(s,o))return Kr(e,t,i,0),Fl===null&&Gr(),!1}catch{}if(n=qr(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=qr(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,Ke(e,n)}}var Ms={readContext:Ki,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:Ki,use:Do,useCallback:function(e,t){return Co().memoizedState=[e,t===void 0?null:t],e},useContext:Ki,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){G(!0);try{e()}finally{G(!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){G(!0);try{n(t)}finally{G(!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(J){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Fl===null)throw Error(s(349));Q&127||Po(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,rs(Io.bind(null,r,a,e),[e]),r.flags|=2048,$o(9,{destroy:void 0},Fo.bind(null,r,a,n,t),null),n},useId:function(){var e=Co(),t=Fl.identifierPrefix;if(J){var n=vi,r=_i;n=(r&~(1<<32-Ae(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(X&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Ps={readContext:Ki,use:Do,useCallback:fs,useContext:Ki,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:Ki,use:Do,useCallback:fs,useContext:Ki,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?!hr(n,r)||!hr(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){Vr(e)}function Hs(e){console.error(e)}function Us(e){Vr(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`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ys(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ui(t,n,i,!0),n=Ja.current,n!==null){switch(n.tag){case 31:case 13:return Ya===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ga?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===ga?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(J)return t=Ja.current,t===null?(r!==Oi&&(t=Error(s(423),{cause:r}),Fi(li(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=li(r,n),i=Ks(e.stateNode,r,i),La(e,i),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Oi&&(e=Error(s(422),{cause:r}),Fi(li(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=li(a,n),Jl===null?Jl=[a]:Jl.push(a),Hl!==4&&(Hl=2),t===null)return!0;r=li(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`&&(tu===null||!tu.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?Aa(t,null,n,r):ka(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 Gi(t),r=go(e,t,n,o,a,i),s=bo(),e!==null&&!Zs?(xo(e,t,i),Cc(e,t,i)):(J&&s&&xi(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`&&!ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,tc(e,t,a,r,i)):(e=ri(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?hr:n,n(o,r)&&e.ref===t.ref)return Cc(e,t,i)}return t.flags|=1,e=ti(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(hr(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&&da(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&&da(t,null),Ka(),$a(t)):(da(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=ua();return a=a===null?null:{parent:Qi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&da(t,null),Ka(),Qa(t),e!==null&&Ui(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 ka(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(J){if(r.mode===`hidden`)return e=ac(t,r),t.lanes=536870912,rc(null,e);if(Za(t),(e=Ti)?(e=rf(e,Di),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw ki(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||Ui(e,t,n,!1),i=(n&e.childLanes)!==0,Zs||i){if(r=Fl,r!==null&&(o=qe(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Jr(e,o),pu(r,e,o),Xs;Tu(),t=oc(e,t,n)}else e=a.treeContext,Ti=cf(o.nextSibling),wi=t,J=!0,Ei=null,Di=!1,e!==null&&Ci(t,e),t=ac(t,r),t.flags|=4096;return t}return e=ti(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 Gi(t),n=go(e,t,n,r,void 0,i),r=bo(),e!==null&&!Zs?(xo(e,t,i),Cc(e,t,i)):(J&&r&&xi(t),t.flags|=1,Qs(e,t,n,i),t.child)}function uc(e,t,n,r,i,a){return Gi(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)):(J&&r&&xi(t),t.flags|=1,Qs(e,t,n,a),t.child)}function dc(e,t,n,r,i){if(Gi(t),t.stateNode===null){var a=Zr,o=n.contextType;typeof o==`object`&&o&&(a=Ki(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?Ki(o):Zr,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=Zr,typeof u==`object`&&u&&(o=Ki(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),ja=!1;var f=t.memoizedState;a.state=f,Ba(t,r,a,i),za(),l=t.memoizedState,s||f!==l||ja?(typeof d==`function`&&(Is(t,n,d,r),l=t.memoizedState),(c=ja||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=Zr,typeof l==`object`&&l&&(c=Ki(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),ja=!1,f=t.memoizedState,a.state=f,Ba(t,r,a,i),za();var p=t.memoizedState;o!==d||f!==p||ja||e!==null&&e.dependencies!==null&&Wi(e.dependencies)?(typeof s==`function`&&(Is(t,n,s,r),p=t.memoizedState),(u=ja||Rs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Wi(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=ka(t,e.child,null,i),t.child=ka(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 Ni(),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:fa()}}function hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function gc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(to.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(J){if(i?Xa(t):$a(t),(e=Ti)?(e=rf(e,Di),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw ki(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=ii(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=ii(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ka(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,Fi({value:r,source:null,stack:null}),t=yc(e,t,n)}else if(Zs||Ui(e,t,n,!1),o=(n&e.childLanes)!==0,Zs||o){if(o=Fl,o!==null&&(r=qe(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Jr(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,Ti=cf(c.nextSibling),wi=t,J=!0,Ei=null,Di=!1,e!==null&&Ci(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=ti(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ii(c,i,n,null),c.flags|=2):c=ti(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=fa():(l=Qi._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=ti(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=$r(22,e,null,t),e.lanes=0,e}function yc(e,t,n){return ka(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),Vi(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,L(to,o),Qs(e,t,r,n),r=J?pi: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),Ul|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ui(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=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(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&&Wi(e)))}function Tc(e,t,n){switch(t.tag){case 3:B(t,t.stateNode.containerInfo),zi(t,Qi,e.memoizedState.cache),Ni();break;case 27:case 5:ce(t);break;case 4:B(t,t.stateNode.containerInfo);break;case 10:zi(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||=(Ui(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),L(to,to.current),r)break;return null;case 22:return t.lanes=0,nc(e,t,n,t.pendingProps);case 24:zi(t,Qi,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,J&&t.flags&1048576&&bi(t,pi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ya(t.elementType),t.type=e,typeof e==`function`)ei(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===E){t.tag=14,t=ec(null,t,e,r,n);break a}}throw t=A(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(B(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,zi(t,Qi,r),r!==a.cache&&Hi(t,[Qi],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=li(Error(s(424)),t),Fi(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(Ti=cf(e.firstChild),wi=t,J=!0,Ei=null,Di=!0,n=Aa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ni(),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:J||(n=t.type,e=t.pendingProps,r=Bd(z.current).createElement(n),r[$e]=t,r[et]=e,Pd(r,n,e),K(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&J&&(r=t.stateNode=ff(t.type,t.pendingProps,z.current),wi=t,Di=!0,i=Ti,Zd(t.type)?(lf=i,Ti=cf(r.firstChild)):Ti=i),Qs(e,t,t.pendingProps.children,n),cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&J&&((i=r=Ti)&&(r=tf(r,t.type,t.pendingProps,Di),r===null?i=!1:(t.stateNode=r,wi=t,Ti=cf(r.firstChild),Di=!1,i=!0)),i||ki(t)),ce(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&&J&&((e=n=Ti)&&(n=nf(n,t.pendingProps,Di),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||ki(t)),null;case 13:return gc(e,t,n);case 4:return B(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ka(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,zi(t,t.type,r.value),Qs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Gi(t),i=Ki(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 Gi(t),r=Ki(Qi),e===null?(i=ua(),i===null&&(i=Fl,a=$i(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ma(t),zi(t,Qi,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,zi(t,Qi,r),r!==i.cache&&Hi(t,[Qi],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),zi(t,Qi,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 ba=ga,ma}}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 ba=ga,ma}}function Ac(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ve(),e.lanes|=t,ql|=t)}function jc(e,t){if(!J)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(Si(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),Bi(Qi),V(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Mi(t)?Dc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Pi())),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(H(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=oe.current,Mi(t)?Ai(t,e):(e=ff(i,r,n),t.stateNode=e,Dc(t))}return Mc(t),null;case 5:if(H(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=oe.current,Mi(t))Ai(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[$e]=t,a[et]=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,Mi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=wi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||ki(t,!0)}else e=Bd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Mc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Mi(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[$e]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),e=!1}else n=Pi(),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=Mi(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[$e]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mc(t),i=!1}else i=Pi(),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 V(),e===null&&xd(t.stateNode.containerInfo),Mc(t),null;case 10:return Bi(t.type),Mc(t),null;case 19:if(I(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(Hl!==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;)ni(n,e),n=n.sibling;return L(to,to.current&1|2),J&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>$l&&(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&&!J)return Mc(t),null}else 2*be()-r.renderingStartTime>$l&&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,L(to,i?n&1|2:n&1),J&&yi(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&&I(la),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Bi(Qi),Mc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Pc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bi(Qi),V(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return H(t),null;case 31:if(t.memoizedState!==null){if(eo(t),t.alternate===null)throw Error(s(340));Ni()}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));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return I(to),null;case 4:return V(),null;case 10:return Bi(t.type),null;case 22:case 23:return eo(t),qa(),e!==null&&I(la),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Bi(Qi),null;case 25:return null;default:return null}}function Fc(e,t){switch(Si(t),t.tag){case 3:Bi(Qi),V();break;case 26:case 27:case 5:H(t);break;case 4:V();break;case 31:t.memoizedState!==null&&eo(t);break;case 13:eo(t);break;case 19:I(to);break;case 10:Bi(t.type);break;case 22:case 23:eo(t),qa(),e!==null&&I(la);break;case 24:Bi(Qi)}}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[et]=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=Gt));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[$e]=e,t[et]=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=yr(e),br(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&&st(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(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,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[ot]||a[$e]||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[$e]=e,K(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[$e]=e,K(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{Lt(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)&&(Zl=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&&(Lt(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&&ea(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&&ea(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&&ea(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:ea(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=Ki(Qi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ki(Qi).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,X=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return X&2&&Q!==0?Q&-Q:j.T===null?Xe():ud()}function fu(){if(Kl===0){if(!(Q&536870912)||J){var e=Fe;Fe<<=1,!(Fe&3932160)&&(Fe=262144),Kl=e}else Kl=536870912}return e=Ja.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Ue(e,n),(!(X&2)||e!==Fl)&&(e===Fl&&(!(X&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(X&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ze(e,t),i=r?Ou(e,t):Eu(e,t,!0),a=r;do{if(i===0){zl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,a&&!gu(n)){i=Eu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,o).flags|=256),o=Eu(c,o,!1),o!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=a,Wl|=a,i=4;break a}a=Yl,Yl=i,a!==null&&(Yl===null?Yl=a:Yl.push.apply(Yl,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=Zl+300-be(),10<i)){if(_u(r,t,Kl,!Rl),Re(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,`Throttled`,-0,0),i);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,a,null,-0,0)}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gt},Dl(t,a,d);var m=(a&62914560)===a?Zl-be():(a&4194048)===a?Ql-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(!mr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ae(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ge(e,n,t)}function vu(){return X&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Ri=Li=null,So(e),Ca=null,wa=0,e=Z;for(;e!==null;)Fc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=ti(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=ze(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ae(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Gr(),n}function xu(e,t){Y=null,j.H=Ms,t===pa||t===ha?(t=xa(),Il=3):t===ma?(t=xa(),Il=4):Il=t===Xs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Ws(e,li(t,e.current)))}function Su(){var e=Ja.current;return e===null?!0:(Q&4194048)===Q?Ya===null:(Q&62914560)===Q||Q&536870912?e===Ya:!1}function Cu(){var e=j.H;return j.H=Ms,e===null?Ms:e}function wu(){var e=j.A;return j.A=Nl,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&Ja.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=X;X|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:Ja.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ri=Li=null,X=r,j.H=i,j.A=a,Z===null&&(Fl=null,Q=0,Gr()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=X;X|=2;var r=Cu(),i=wu();Fl!==e||Q!==t?(eu=null,$l=be()+500,bu(e,t)):zl=ze(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var a=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,a,1);break;case 2:case 9:if(_a(a)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},a.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:_a(a)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,a,7));break;case 5:var o=null;switch(Z.tag){case 26:o=Z.memoizedState;case 5:case 27:var c=Z;if(o?Wf(o):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,a,5);break;case 6:Il=0,Ll=null,Mu(e,t,a,6);break;case 8:yu(),Hl=6;break a;default:throw Error(s(462))}}ku();break}catch(t){xu(e,t)}while(1);return Ri=Li=null,j.H=r,j.A=i,X=n,Z===null?(Fl=null,Q=0,Gr(),Hl):0}function ku(){for(;Z!==null&&!ve();)Au(Z)}function Au(e){var t=Ec(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=uc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=uc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:So(t);default:Fc(n,t),t=Z=ni(t,Vl),t=Ec(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Ri=Li=null,So(t),Ca=null,wa=0;var i=t.return;try{if(Ys(e,i,t,n,Q)){Hl=1,Ws(e,li(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Ws(e,li(n,e.current)),Z=null;return}t.flags&32768?(J||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=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,Rl);return}e=t.return;var n=Nc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Pc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(X&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Wr,We(e,n,a,o,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=a,su=i,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(we,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=j.T,j.T=null,i=M.p,M.p=2,o=X,X|=4;try{el(e,t,n)}finally{X=o,M.p=i,j.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=j.T,j.T=null;var r=M.p;M.p=2;var i=X;X|=4;try{pl(t,e);var a=zd,o=yr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&vr(s.ownerDocument.documentElement,s)){if(c!==null&&br(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 _=_r(s,h),v=_r(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{X=i,M.p=r,j.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=j.T,j.T=null;var r=M.p;M.p=2;var i=X;X|=4;try{tl(e,t.alternate,t)}finally{X=i,M.p=r,j.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&&(tu=null),Ye(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.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{j.T=t,M.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,ea(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=Ye(au),r=j.T,i=M.p;try{M.p=32>n?32:n,j.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,X&6)throw Error(s(331));var c=X;if(X|=4,Al(a.current),Sl(a,a.current,o,n),X=c,rd(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,a)}catch{}return!0}finally{M.p=i,j.T=r,zu(e,t)}}function Hu(e,t,n){t=li(n,t),t=Ks(e.stateNode,t,2),e=Fa(e,t,2),e!==null&&(Ue(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=li(n,e),n=qs(2),r=Fa(t,n,2),r!==null&&(Js(n,r,t,e),Ue(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)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>be()-Zl?!(X&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ve()),e=Jr(e,t),e!==null&&(Ue(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 ge(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-Ae(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Re(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ze(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-Ae(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Be(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Re(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ze(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Ye(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=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Re(e,e===Fl?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(){X&6?ge(Se,id):ad()})}function ud(){if(td===0){var e=ra;e===0&&(e=Pe,Pe<<=1,!(Pe&261888)&&(Pe=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Wt(``+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[et]||null).action),o=r.submitter;o&&(t=(t=o[et]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new pn(`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<zr.length;md++){var hd=zr[md];Br(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Br(Mr,`onAnimationEnd`),Br(Nr,`onAnimationIteration`),Br(Pr,`onAnimationStart`),Br(`dblclick`,`onDoubleClick`),Br(`focusin`,`onFocus`),Br(`focusout`,`onBlur`),Br(Fr,`onTransitionRun`),Br(q,`onTransitionStart`),Br(Ir,`onTransitionCancel`),Br(Lr,`onTransitionEnd`),ht(`onMouseEnter`,[`mouseout`,`mouseover`]),ht(`onMouseLeave`,[`mouseout`,`mouseover`]),ht(`onPointerEnter`,[`pointerout`,`pointerover`]),ht(`onPointerLeave`,[`pointerout`,`pointerover`]),mt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),mt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),mt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),mt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),mt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),mt(`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){Vr(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){Vr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[nt];n===void 0&&(n=t[nt]=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,ft.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,!tn||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=ct(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}Qt(function(){var r=a,i=qt(n),o=[];a:{var s=Rr.get(e);if(s!==void 0){var c=pn,u=e;switch(e){case`keypress`:if(cn(n)===0)break a;case`keydown`:case`keyup`:c=jn;break;case`focusin`:u=`focus`,c=Sn;break;case`focusout`:u=`blur`,c=Sn;break;case`beforeblur`:case`afterblur`:c=Sn;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=bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Nn;break;case Mr:case Nr:case Pr:c=Cn;break;case Lr:c=Pn;break;case`scroll`:case`scrollend`:c=hn;break;case`wheel`:c=Fn;break;case`copy`:case`cut`:case`paste`:c=wn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Mn;break;case`toggle`:case`beforetoggle`:c=In}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=$t(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!==Kt&&(u=n.relatedTarget||n.fromElement)&&(ct(u)||u[tt]))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?ct(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=bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Mn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:ut(c),h=u==null?s:ut(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ct(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?ut(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=nr;else if(Xn(s)){if(rr)v=fr;else{v=ur;var y=lr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Vt(r.elementType)&&(v=nr):v=dr;if(v&&=v(e,r)){Zn(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Nt(s,`number`,s.value)}switch(y=r?ut(r):window,e){case`focusin`:(Xn(y)||y.contentEditable===`true`)&&(Sr=y,Cr=r,wr=null);break;case`focusout`:wr=Cr=Sr=null;break;case`mousedown`:Tr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Tr=!1,Er(o,n,i);break;case`selectionchange`:if(xr)break;case`keydown`:case`keyup`:Er(o,n,i)}var b;if(Rn)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 Kn?Wn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Vn&&n.locale!==`ko`&&(Kn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Kn&&(b=sn()):(rn=i,an=`value`in rn?rn.value:rn.textContent,Kn=!0)),y=Td(r,x),0<y.length&&(x=new Tn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Gn(n),b!==null&&(x.data=b)))),(b=Bn?qn(e,n):Jn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new Tn(`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=$t(e,n),i!=null&&r.unshift(wd(e,i,a)),i=$t(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=$t(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=$t(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===``||Lt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Lt(e,``+r);break;case`className`:xt(e,`class`,r);break;case`tabIndex`:xt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:xt(e,n,r);break;case`style`:Bt(e,r,a);break;case`data`:if(t!==`object`){xt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Wt(``+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=Wt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Gt);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=Wt(``+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),bt(e,`popover`,r);break;case`xlinkActuate`:St(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:St(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:St(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:St(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:bt(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=Ht.get(n)||n,bt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Bt(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`?Lt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Lt(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Gt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!pt.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[et]||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,``):bt(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)}}Mt(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&&Pt(e,!!r,n,!0):Pt(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)}It(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(Vt(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)}}jt(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?Pt(e,!!n,n?[]:``,!1):Pt(e,!!n,t,!0)):Pt(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)}Ft(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(Vt(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[ot]||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),st(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[ot])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]);st(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=M.d;M.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=lt(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=At(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),K(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="`+At(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+At(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+At(n.imageSizes)+`"]`)):i+=`[href="`+At(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),K(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="`+At(r)+`"][href="`+At(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),K(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=dt(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`);K(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=dt(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`),K(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=dt(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`),K(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=dt(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=dt(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=dt(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="`+At(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),K(t),e.head.appendChild(t))}function Pf(e){return`[src="`+At(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~="`+At(n.href)+`"]`);if(r)return t.instance=r,K(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`),K(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,K(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),K(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,K(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),K(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[ot]||a[$e]||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,K(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),K(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:N,_currentValue2:N,_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=He(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=He(0),this.hiddenUpdates=He(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=$r(3,null,null,t),e.current=a,a.stateNode=e,t=$i(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ma(a),e}function tp(e){return e?(e=Zr,e):Zr}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=Jr(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=Je(t);var n=Jr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,up(e,t,n,r)}finally{M.p=a,j.T=i}}function lp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,up(e,t,n,r)}finally{M.p=a,j.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=lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Le(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ae(o);s.entanglements[1]|=c,o&=~c}nd(a),!(X&6)&&($l=be()+500,rd(0,!1))}}break;case 31:case 13:s=Jr(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=qt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ct(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=lt(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=ct(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,Ze(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,Ze(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);Kt=r,n.target.dispatchEvent(r),Kt=null}else return t=lt(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=lt(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[et]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[et]||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[tt]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();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`));M.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:j,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Oe=zp.inject(Rp),ke=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[tt]=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={maxFiles:1024,maxFileBytes:4194304,maxTotalBytes:33554432};function f(e){return e.maxTotalBytes+e.maxFiles*1024+65557}var p=f(d);Math.ceil(p/3)*4;var m=`# 玩家可见叙事规则
10
-
11
- 当你决定输出玩家可见故事正文时,写成互动式小说,不写成裁决报告、工具日志或主持流程说明。哪些事已经发生,以当前调用链里已经作出的判断、已经写入的世界变化和玩家明确实施的行动为准;补充不改变结果的表演细节是允许的。
12
-
13
- 这一段是互动式小说的正文,不是过程报告。读者是玩家本人,他要的是读下去的体验,不是一份“这次交互发生了什么”的交代。
14
-
15
- ## 怎么写
16
-
17
- 从玩家这次输入写起,把它扩写成完整的场景——他具体怎么做的、什么语气神态、当时的姿态和距离——再接着写它引出的后续。不要用“你说要去找他”这类回指句开头,直接把那个动作演出来。
18
-
19
- 让环境、光线、声音、他人的小动作和身体反应参与进来。情绪和关系尽量侧写,通过动作走形、话说到一半停住、视线躲闪来呈现,而不是直接判定“他很紧张”。玩家没有互动的 NPC 也在做自己的事,让场面里同时发生的事不必都与玩家有关。
20
-
21
- 当前调用链写进世界文档、而玩家角色感知得到的变化,这一段必须演出来:不是复述“他的态度变好了”,是让他做出或说出能看出这一点的那句话、那个动作。写进了文档却没进叙事,玩家就读不到它,对他等于没有发生。已经确定的结果同样不能改:谁在哪、拿着什么、答应了什么,都要保持一致。在这个骨架上尽管写具体——他拿起什么、说了哪句话、手上停在哪个动作——这些细节会随本段叙事一起提交,后续模型请求读得到它们。
22
-
23
- 以玩家原文、已加载的世界材料和当前调用链已经确定的结果为准。结果既包括写进文档的持续变化,也包括只在当前场面成立的直接后果;两者都不得被叙事掩盖或改写。玩家只表达愿望、意图或尝试时,不要擅自把愿望写成已经达成。
24
-
25
- ## 怎么收尾
26
-
27
- **最后一句写某个人做的一件具体的事,或说的一句具体的话。** 他问了什么,原话写出来;他把东西递过来,写他怎么递的;他站起身往门口走,写他走了。这句话本身要有内容,读者读的是这件事,不是读“该我了”。
28
-
29
- 轮到玩家,是他从这件事里自己得出的结论,不需要你告诉他。所以结尾不写场面的状态,只写事件:
30
-
31
- - 不写“没人接话”“屋里安静下来”“空气凝住了”——沉默不是事件,用它收尾等于什么都没发生。
32
- - 不写“两道视线落回你身上”“他等着你的下文”“所有人都在等你开口”——这是把“轮到你了”翻译成了场面语言,和直接问“你打算怎么做”是同一件事,只是穿了小说的皮。
33
- - 不写“你打算怎么做”“接下来你会怎么办”“你可以选择……”,也不要在结尾把局势总结一遍或列出他有哪些选项。
34
-
35
- 如果写到最后发现场上确实没人有动作可做,那说明这一段收早了:让某个人先做点什么——开口、起身、动手、走近——再停。
36
-
37
- ## 边界
38
-
39
- 玩家可见文本只写小说正文,可以分多个自然段;不要标题、清单、解释、工具过程或幕后说明。停笔位置约束的是故事推进到哪里,不是可以写多厚——在这个范围内把场面、反应和氛围写足。
40
-
41
- 篇幅由这一刻的分量决定,不是每段都写成同一个长度。过场收快;玩家真正在意的那一刻停下来,把那几秒拆开写。
42
-
43
- 不要替玩家作出**本该由他决定**的事——改变目标立场、答应或拒绝、交出或收下、动手或收手。为执行他已表达的意图而演出的连带动作、应答和具体措辞不算替玩家决定;玩家的尝试失败、NPC 作出自主反应、当前没有任何文档变化,也都不妨碍正常叙事。
44
- `,h=`# Player-visible narrative rules
45
-
46
- Whenever you produce player-visible story text, write it as an interactive novel, not as an adjudication report, tool log, or explanation of the hosting process. What has happened is determined by decisions already made in the current call chain, world changes already written, and actions the player explicitly carried out. You may add performance details that do not alter those outcomes.
47
-
48
- This is the body of an interactive novel, not a process report. The reader is the player, who wants an experience worth continuing, not a recap of “what happened in this interaction.”
49
-
50
- ## How to write
51
-
52
- Begin with the player's current input. Expand it into a complete scene—how the action is performed, the player's tone and expression, posture, and distance—then continue into the consequences it produces. Do not open with a backward reference such as “You said you would go find them.” Put the action directly on the page.
53
-
54
- Bring in the environment, light, sound, other characters' small movements, and physical reactions. Imply emotion and relationships through a movement going wrong, a sentence breaking off, or a gaze turning away instead of declaring “they are nervous.” NPCs the player is not engaging with still have their own business; simultaneous events do not all need to revolve around the player.
55
-
56
- Any change written to a world document in the current call chain that the player character can perceive must be dramatized here. Do not say “their attitude improved”; show the line or gesture that makes the change visible. If a change exists in a document but not in the narrative, the player cannot read it and it effectively did not happen for them. Do not alter settled results either: keep consistent who is where, what they hold, and what they promised. Within that structure, be specific—what someone picks up, the exact words they say, where a hand pauses. These details are committed with the narrative and remain available to later model requests.
57
-
58
- Follow the player's original text, the loaded world material, and outcomes already settled in the current call chain. Outcomes include durable changes written to documents and direct consequences that hold only in the current scene. The narrative may neither hide nor rewrite either kind. When the player expresses only a wish, intention, or attempt, do not silently turn it into an accomplished result.
59
-
60
- ## How to end
61
-
62
- **Make the final sentence a specific action someone takes or a specific line they say.** If someone asks a question, write the actual question. If they hand something over, show how. If they stand and walk toward the door, write that movement. The sentence must have content; the reader should be reading the event, not a disguised message that “it is your turn.”
63
-
64
- The player can infer that it is their turn. Do not state the condition of the scene at the end; end on an event:
65
-
66
- - Do not end with “no one answers,” “the room falls quiet,” or “the air freezes.” Silence is not an event, and ending on it means nothing happened.
67
- - Do not end with “two pairs of eyes return to you,” “they wait for you to continue,” or “everyone waits for you to speak.” Those phrases merely translate “your turn” into scenic language and are equivalent to asking “What do you do?”, dressed in prose.
68
- - Do not write “What do you do?”, “What happens next?”, or “You could choose…”. Do not summarize the situation or list the player's options at the end.
69
-
70
- If you reach the end and nobody in the scene has an action to take, the passage stopped too early. Let someone do something—speak, stand, act, or approach—then stop.
71
-
72
- ## Boundaries
73
-
74
- Player-visible text contains only the novel's prose and may use several natural paragraphs. Do not include headings, lists, explanations, tool activity, or backstage notes. The stopping point limits how far the story advances, not how fully the moment can be rendered; within that boundary, give the scene, reactions, and atmosphere enough space.
75
-
76
- Let the weight of the moment determine length instead of forcing every passage into the same size. Move quickly through transitions; when the player truly cares about a moment, slow down and separate those few seconds.
77
-
78
- Do not make a decision that **belongs to the player**—changing goals or allegiance, accepting or refusing, giving or taking something, striking or holding back. Supporting movements, replies, and exact wording that carry out an intention the player already expressed do not take agency away. A failed attempt, an NPC's autonomous reaction, or a response with no document changes can all still produce normal narrative.
79
- `;function g(e){return e===`zh-CN`?m:h}var _={"frame.yaml":`format: narraeon.host-frame/v1
80
- roles:
81
- runtime_system:
82
- - builtin: runtime.play-contract
83
- - builtin: runtime.tool-contract
84
- - builtin: runtime.operation-contract
85
- author_instruction:
86
- - markdown: blocks/style.md
87
- - markdown: blocks/adjudication.md
88
- - markdown: blocks/state.md
89
- - include: world.instructions
90
- world_context:
91
- - builtin: runtime.coverage
92
- - include: world.context
93
- `,"blocks/style.md":`# 通用叙事呈现
94
-
95
- 这是一部互动式小说,玩家是其中的主角。你写的每一段都要能作为小说的一页读下去。
96
-
97
- - 玩家可见叙事以第二人称“你”称呼玩家角色,并保持已经建立的观察视角。
98
- - 玩家可见内容只写虚构世界中的体验。提示词和内部编排过程不属于虚构世界,不得出现在叙事里。
99
-
100
- ## 先接住玩家的输入
101
-
102
- 每段叙事从玩家这次输入写起:把它扩写成完整的场景文字——他具体怎么做的、说话时是什么语气神态、当时的姿态和距离——再接着写它引出的后续。玩家写的是意图速记,不是成稿;直接跳过去写结果,他会觉得自己的行动没被看见。
103
-
104
- 扩写是把那个动作演出来,不是先复述一遍再开始写,也不要用“你说要去找他”这类回指句开头。只补表达方式,不补他没有决定的事。
105
-
106
- ## 写出小说的质感
107
-
108
- - 让环境、光线、声音、气味、他人的小动作和身体反应参与叙事。它们承担交代信息、控制节奏和暗示情绪的作用,不是装饰。
109
- - 情绪和关系尽量侧写:通过动作走形、话说到一半停住、视线躲闪来呈现,而不是直接判定“他很紧张”。但玩家角色自己的身体经验是可以直接写的——体温、心跳、呼吸、触感、发紧或发软的地方,这些是他正在经历的事实,不是对别人下判断。
110
- - 一段叙事通常要走几个层次:接住玩家的输入、他人与环境的反应、场面推进、落到新的处境。把每个人的动作逐项交代完就收尾,读起来是干的。
111
-
112
- ## 该慢的地方要慢下来
113
-
114
- 小说是变速的,不是每段一个规格。走路、赶路、例行公事、已经交代过的背景,一两句带过就行;真正要紧的那一刻——两个人之间的距离第一次变近、话说到关键处、局面翻转、危险贴到眼前——要停下来,把那几秒钟拆开写。
115
-
116
- 判断标准是这一刻对玩家意味着什么,不是它占了多少物理时间。一个抬手的动作可以写三行,一段两小时的赶路可以写一句。
117
-
118
- 慢下来的时候写什么:把连贯动作拆成分解动作(手伸到一半停住、又落下),写身体的实感和不受控的反应,写此刻放大的那个细节——对方袖口的味道、指尖的温度、自己心跳的位置。这不是注水:注水是把同一件事换个说法再说一遍,或者把已知背景重述一次;详写是给出上一句还没有的新信息。
119
-
120
- 一段里也不该匀速。要紧的地方铺开,之后收快,落到下一个动作上。
121
- - 不要点名式并列。“甲抱着胳膊,乙坐在下铺”这种把在场的人挨个交代一遍的句子,是清单换了个标点,不是描写。让此刻真正在做事的那个人占住笔墨,其余的人交给余光——没有动作的人可以整段不提。
122
- - 已经知道名字的人就叫名字。“球衣少年”“大个子”这类按外貌贴的标签,只在玩家确实还不知道他是谁时用;一旦通过姓名认识了,就不要再退回标签。
123
- - 具体优先于笼统,白描优先于形容词堆砌。丰富指的是层次和质感——不是把已知背景再说一遍,也不是把一句话拆成三句。
124
- `,"blocks/style-intimate.md":`# 文风:情感与亲密
125
-
126
- 这一类场面的重点不是发生了什么,而是身体和心里经历了什么。事情本身可能只有一句话——手碰到了、靠得很近、他没有躲开——但玩家读的就是这一句被拆开之后的全部内容。
127
-
128
- ## 把那一刻拆开
129
-
130
- 不要跳过过程直接给结论。“你们牵起了手”把整段最值钱的东西省掉了。写手伸过去的那半路:抬到一半有没有停、指尖先碰到的是哪里、对方是迎上来还是没有动、握住之后力度是轻是紧、多久之后才松开。
131
-
132
- 一个动作可以占三四行。这里的“慢”不是拖,是把玩家真正在意的那几秒补足。
133
-
134
- ## 触觉优先
135
-
136
- 这类场面里触觉排在视觉前面:温度(他的手比你想的凉)、干湿、粗糙或细腻、力度、脉搏、布料隔着的厚度。然后才是气味、呼吸的声音、贴近时听见的动静。
137
-
138
- 写具体的身体感觉,别只丢一个现成比喻。“像电流窜过”所有人都读过,它替代了描写而不是完成描写;如果要用,也让它落回具体位置——从指尖窜到手肘,然后停在那儿发麻。
139
-
140
- ## 身体不听话
141
-
142
- 心跳的位置和速度、呼吸乱掉又赶紧调匀、后颈或耳根发烫、指尖发麻、喉咙发紧、脚下没根、明知道该说话却发不出声。这些是玩家角色自己的经验,可以直接写,不用绕成侧写。
143
-
144
- 对方的反应仍然走侧写:他的耳朵红了、话头断在半截、手指蜷了一下、眼睛没敢抬起来——让玩家自己读出来那是什么意思。
145
-
146
- ## 距离和边界
147
-
148
- 亲密戏的张力来自距离的变化和它是否被允许。写清楚现在有多近、谁在靠近、对方是迎上来、僵住还是退开。允许和拒绝都要能被看出来,不要含糊过去。
149
-
150
- 对方是否接受,永远由他此刻的性格、处境和已经建立的关系决定;不要因为气氛到了就让他答应。玩家角色要做的关键决定同样归玩家。
151
-
152
- ## 时间会变形
153
-
154
- 紧张或动情的时候,一瞬间在感觉里会被拉长:你会注意到平时根本不会注意的东西——他睫毛的影子、空调的声音、自己手心出汗。用这种被放大的细节表示时间慢下来了,比直接写“时间仿佛静止”有效得多。
155
- `,"blocks/style-noir.md":`# 文风:冷硬与推理
156
-
157
- 短句。动词结句。能删的形容词都删掉。
158
-
159
- ## 只写看得见的
160
-
161
- 摄影机式的叙述:写人物做了什么、说了什么、现场有什么,不写他心里怎么想。情绪从动作的偏差里渗出来——手抖了一下、烟点了两次才着、答话比正常慢了半秒。
162
-
163
- 不替角色下判断。不写“他显然在撒谎”,写他回答之前先看了一眼门。
164
-
165
- ## 细节是证据
166
-
167
- 这一类场面里,物件不是布景,是可以被追究的东西:杯子放的位置、鞋底的泥、袖口磨损的程度、屋里的温度和味道。写出来的每个细节都应该是玩家有可能用上的。
168
-
169
- 要克制到位:与线索无关的环境描写占一句就够,别铺开。
170
-
171
- ## 节奏
172
-
173
- 对话句子短,来回快。审问和交锋靠停顿制造压力——沉默、答非所问、把问题推回去。
174
-
175
- 叙述保持冷。越是暴力或危险的时刻越不要抒情,事实本身足够重。
176
- `,"blocks/style-wuxia.md":`# 文风:武侠与古风
177
-
178
- 用词偏文,但不掉书袋。句子可以长短相间,长句写景与气度,短句写出手与决断。
179
-
180
- ## 称谓与语气
181
-
182
- 人物按身份、辈分和亲疏择称,不用现代口语。对话讲分寸:客套里藏机锋,认输和挑衅都不必挑明。
183
-
184
- 避免现代词汇和现代概念(心理阴影、压力、社交距离之类);用当时的说法讲同一件事。
185
-
186
- ## 出手
187
-
188
- 交手要写得清楚而不冗长:一招从起势到落点、对方怎么接、气力和位置的变化、胜负在哪一下定的。写得让人看得懂,而不是堆招式名。
189
-
190
- 内力、伤势、兵器和轻功的规矩以世界设定为准,不要临时发明。
191
-
192
- ## 景与气
193
-
194
- 风、雪、灯、酒、马蹄、更漏——用景托气氛和时序。景要短,两三句足够,别让它盖过人。
195
-
196
- 情义、恩怨、承诺在这类故事里分量很重:一句应承可以顶很久,写的时候给它足够的停顿。
197
- `,"blocks/style-horror.md":`# 文风:悬疑与恐怖
198
-
199
- 恐惧来自不确定,不来自血腥。
200
-
201
- ## 慢慢来
202
-
203
- 先让一切正常,只留一个不对劲的小东西——数目不对、声音停在半路、门比记忆里开得大一点。不要一开始就掀底。
204
-
205
- 未知比揭晓可怕。能不写清楚的就别写清楚:让玩家看见轮廓、听见声音、闻见味道,但看不全。
206
-
207
- ## 身体先知道
208
-
209
- 写角色的生理反应而不是情绪判定:后颈发凉、手心出汗、呼吸放轻、脚步下意识停住、不敢回头。玩家会自己得出“害怕”。
210
-
211
- ## 声音和静
212
-
213
- 安静是有质地的——写它被什么打破,以及打破之后的那一秒。滴水、脚步、呼吸、远处的说话声、突然停掉的风扇。
214
-
215
- ## 别泄气
216
-
217
- 不要在叙事里替玩家判断危险程度,也不要给出安全保证。危险是否真实存在,以世界事实为准;氛围可以吓人,但不能凭空制造不存在的东西。
218
- `,"blocks/style-action.md":`# 文风:动作与战斗
219
-
220
- 写清楚谁在哪、朝哪动、打到没打到、代价是什么。看不懂的动作场面等于没写。
221
-
222
- ## 一次一个动作
223
-
224
- 按时间顺序推进,不要在一句里塞三个同时发生的动作。每一下写:起手、对方的应对、结果、位置变化。
225
-
226
- 写重量和代价:撞上去的地方会疼,挥空了会失衡,跑起来会喘。伤势和体力按世界事实累积,不要打完就恢复。
227
-
228
- ## 句子随节奏变
229
-
230
- 交手时短句、动词密集。间隙——喘息、对峙、换位置——可以放长一句,让紧张有起伏。
231
-
232
- ## 环境参战
233
-
234
- 地形、家具、光线、天气都可以被利用或成为妨碍。让打斗发生在一个具体的地方,而不是空舞台。
235
-
236
- ## 后果
237
-
238
- 结束时给出明确的新处境:谁站着、谁倒了、伤在哪、退到哪儿、下一步的可能被打开还是关掉。
239
- `,"blocks/style-literary.md":`# 文风:克制与留白
240
-
241
- 说七分,留三分。
242
-
243
- ## 不把话说满
244
-
245
- 关键的情绪不直接命名。用一个动作、一件物品、一句偏题的话去承载它——他把杯子转了半圈才开口;她说的是天气。
246
-
247
- 结论交给读者。写出足够的线索,然后停住,不要补一句解释。
248
-
249
- ## 具体的小事
250
-
251
- 抽象的感受落到具体的东西上:不写“他很孤独”,写他多摆了一副碗筷。不写“时间过得很久”,写窗台上那盆花换了一茬。
252
-
253
- ## 对话有下文
254
-
255
- 人物很少直说心里话。让对话有表层和底层:表面在谈别的,真正的意思在停顿、重复和没说完的半句里。
256
-
257
- ## 节制
258
-
259
- 比喻少而准,一段一个就够。不要连续堆叠形容词。删掉之后意思不变的句子就删掉。
260
- `,"blocks/adjudication.md":`# 通用玩家代理权与裁判底线
261
-
262
- ## 哪些必须由玩家决定
263
-
264
- 以下只能来自玩家当前输入的明确表达,不得代为决定:他要做的事和要去的地方、对人和事的立场态度、答应或拒绝、交出或收下、动手或收手,以及会改变关系、目标、风险和归属的选择。这些是玩家在玩的东西。
265
-
266
- 玩家表达想法、目标、意图、尝试、准备或预测,不等于目标已经达成。只裁决玩家明确实施的行动,并依据世界事实与规则判断结果。
267
-
268
- ## 哪些可以替玩家演
269
-
270
- 为完成玩家已表达的意图所必需的连带动作、路上的走法、顺手的收拾、寒暄与应答,以及不改变实质的具体措辞,直接替他演出来,不要停下来等他一项项确认。玩家说“我去找他”,就把出门、穿过走廊、敲门写完;玩家说“我答应”,就把答应的话按他的性格和当下气氛说出来。
271
-
272
- 替玩家演的内容必须同时满足两条:不改变上一节列出的任何一项,且玩家下一次输入想推翻或改口时不会被卡住。拿不准就往回收,写成他正要做而尚未做完。
273
-
274
- ## NPC 有自己的生活
275
-
276
- NPC 不是等玩家开口才启动的装置。每个在场的人都有此刻正在做的事、今天要办的事和自己关心的东西。玩家不理他,他就继续做自己的事、跟别人说话、走开,或者主动找上来。世界也一样在走:天色、人流、进行中的活动、别处传来的动静,都不因玩家停手而暂停。
277
-
278
- 场面里同时发生的事不必都与玩家有关。让 NPC 按自己的处境和目标行动,哪怕这会把局面推到玩家没预料的方向——这正是世界活着的样子。前提是符合该 NPC 已经确立的性格、处境和世界事实。
279
-
280
- NPC 自己动起来产生的结果,和玩家行动产生的结果是同一种东西:他换了位置、放下手上的事、改了主意、对谁生了嫌隙,都按状态维护判据逐项处理,该保存的保存。
281
-
282
- ## 不在场的人也在往前走
283
-
284
- 玩家和某个人单独相处,只说明别人不在这一段里,不说明别人按了暂停。不在场的 NPC 仍按自己的处境往前走:手上的事做完了没有、有没有换地方、等的人来了没有、有没有因为等待、错过或听说了什么而改变态度。玩家离开多久,他就往前走多久。
285
-
286
- 不必每次行动都把所有人跑一遍。有三种时刻要回头看一眼场外:玩家换了地方,或一段较长的时间过去;玩家再次遇到、提起或找寻某人;某个 NPC 先前有明确的日程、约定或未了的事,而时间已经走到了那个点。
287
-
288
- 需要他身上的事实才能判断时,先读他的文档再判断;得出的结果写回他自己那一份。不写下来,下次玩家见到他,他就会凭空停在上次离开时的姿势里。
289
-
290
- ## 可以直接描写的
291
-
292
- 无需玩家再次决定的自然感官、不可避免的直接后果,以及 NPC 和环境的反应与自主行动。
293
- `,"blocks/state.md":`# 通用状态维护判据
294
-
295
- ## 先取材,再裁决
296
-
297
- - 以已经注入的世界材料、你在当前调用链精确读取到的原文和玩家明确实施的行动为依据。
298
- - 正确裁决所依赖的具体事实尚未取得时,先用目录、字面搜索和精确读取查找,再作判断——**即使目录里已经看到了对应条目**。目录只注入标题、摘要和引用,不注入正文;看得到某个人物或物品的名字,不等于已经拿到它身上决定当前结果的那条事实。已注入材料不完整,也不等于世界上不存在。
299
- - 确实读不到时,按世界内的不确定处理:相关角色可以没有印象、记不清或需要确认,但不得改写已经成立的世界事实。
300
- - 材料仍不足以支持某个结论时保留不确定性,不补造能够改变裁决的新事实。
301
-
302
- ## 哪些结果需要保存
303
-
304
- 对每项已经成立的结果做一次检验:如果下一次行动开始时忽略它,会不会造成明显矛盾,或实质改变人物行为、可用选择、物品归属、位置、伤势、关系、重要认知或仍在进行的局面?会则保存;不会则让已提交叙事保留细节即可。检验的对象是当前调用链成立的全部结果,不只是玩家动作的直接后果——NPC 自己做的事、场外推进出来的变化同样要过这一关。允许当前调用链没有任何文档变化,不要为了填充状态而制造变化。
305
-
306
- 玩家角色亲自尝试而失败时,**失败经历本身**只有两种情况需要保存:它确立了下一次行动开始时仍然成立的限制(那扇门确实锁着,而钥匙在别处),或者它形成了会显著改变角色后续行为的认知。一次受阻、临时的拒绝,或换个方式就可以再试的失败,不必保存——保存它反而会挡住玩家有意的重试。失败**造成的其他持续后果**(伤势、物品损坏、资源消耗、旁人的警觉或态度变化)不适用这条,仍然逐项按上面的通用检验处理。
307
-
308
- 已经作出的承诺本身可以保存,承诺指向的未来事件不能提前保存为已发生。“秦龙答应下雨时会来”里成立的是这个承诺;“夜里会下雨”和“秦龙届时一定到场”仍是未来事项。
309
-
310
- ## 保存到哪里
311
-
312
- - 每项需要保存的结果,写入最自然承载它的那份世界文档:属于某个人、某个地方或某件东西的持续变化,就写进代表它的那一份;对他人的看法与关系写在产生这个看法的一方。
313
- - 只约束眼前场面、涉及多个对象且没有单一承载文档的信息,写入当前情境。
314
- - 只有当某个对象需要被独立引用、转移或追踪生命周期时,才为它单独建一份文档;否则在已有的承载文档里记录真正需要记住的归属与意义。
315
- - 同一结果既改变长期状态又改变眼前局面时,分别更新对应文档和当前情境,使两处各自表达它需要承担的信息。
316
-
317
- 这个世界具体有哪些文档类型、某类结果该写进哪一份,以世界提示框架的规定为准。
318
-
319
- ## 玩家只能读到叙事
320
-
321
- 世界文档不是玩家看得到的东西。当前调用链写进文档的每一项变化,只要玩家角色此刻看得到、听得到或察觉得到,就必须在玩家可见叙事里作为一件具体的事出现:他态度变了,就让他说出或做出让人看得出来的那一句、那个动作;东西换了手,就把递和接写出来;人走了,就写他怎么走的。只留在文档里等于对玩家没有发生——他下一次行动会按读到的东西判断,读不到就不会有反应。
322
-
323
- 玩家角色感知不到的变化——别处发生的事、他人心里尚未表露的判断——不必写进叙事,但叙事也不得反过来否认它。
324
-
325
- 先写文档还是先写叙事都可以。要求只有一条:当前调用链处理完时,两边讲的是同一件事,没有哪一边独有的情节。
326
-
327
- ## 当前情境的收敛
328
-
329
- 每次状态维护后,把当前情境改成所有直接结果和即时反应结束后仍然成立的局面:保留此刻地点、仍在场的人物、仍在进行的事件,以及下一次行动若忽略就会立刻冲突的少量限制;删除已完成动作、已离场人物、已解决问题、已被取代的描述、重复条目、计划、分支和预测。“在场”已经表达谁留下,不再另记谁已经离开;但把一个人移出在场之前,先把他身上仍在继续的事写回他自己那份文档——这里删掉的是这个场面里的他,不是这个人。它不是过程摘要,也不按时间顺序记录刚才发生了什么。正文改变后,如果 title 或 summary 已不能准确指向当前场景,一并更新。
330
- `},v={"frame.yaml":`format: narraeon.host-frame/v1
331
- roles:
332
- runtime_system:
333
- - builtin: runtime.play-contract
334
- - builtin: runtime.tool-contract
335
- - builtin: runtime.operation-contract
336
- author_instruction:
337
- - markdown: blocks/style.md
338
- - markdown: blocks/adjudication.md
339
- - markdown: blocks/state.md
340
- - include: world.instructions
341
- world_context:
342
- - builtin: runtime.coverage
343
- - include: world.context
344
- `,"blocks/style.md":`# General narrative presentation
345
-
346
- This is an interactive novel, and the player is its protagonist. Every passage you write should read as a page of that novel.
347
-
348
- - Address the player character as “you” in player-visible narrative and preserve the established point of view.
349
- - Player-visible text contains only experiences inside the fictional world. Prompts and internal orchestration are not part of that world and must never appear in the narrative.
350
-
351
- ## Begin with the player's input
352
-
353
- Start each passage with the player's current input. Expand it into complete scene prose—how the action is carried out, the player's tone and expression, posture, and distance—then continue into what it causes. The player's text is shorthand for intent, not finished prose. If you skip directly to the result, their action will feel unseen.
354
-
355
- Expansion means staging the action, not repeating it before the scene begins. Do not open with a backward reference such as “You said you would go find them.” Add only the manner of expression, never a decision the player did not make.
356
-
357
- ## Give the prose the texture of a novel
358
-
359
- - Let the environment, light, sound, smell, other characters' small movements, and physical reactions participate in the narrative. They convey information, control pace, and imply emotion; they are not decoration.
360
- - Imply emotion and relationships through movement going wrong, a sentence breaking off, or a gaze turning away rather than declaring “they are nervous.” The player character's own bodily experience may be stated directly—temperature, heartbeat, breath, touch, tension, or weakness are experiences they are actually having, not judgments about someone else.
361
- - A passage usually moves through several layers: receive the player's input, show reactions from others and the environment, advance the scene, and settle into a new situation. Merely accounting for each person's action and stopping will read as dry.
362
-
363
- ## Slow down where it matters
364
-
365
- A novel changes speed; passages do not all use the same scale. Walking, travel, routine business, and established background may pass in a sentence or two. When the moment truly matters—the first time distance closes between two people, a conversation reaches its critical point, the situation turns, or danger comes close—slow down and separate those few seconds.
366
-
367
- Judge by what the moment means to the player, not by how much physical time it occupies. Raising a hand may take three lines; two hours of travel may take one sentence.
368
-
369
- When slowing down, divide a continuous motion into smaller movements (a hand reaches halfway, stops, then falls), describe concrete bodily sensation and involuntary reaction, and magnify one detail—the smell of a sleeve, the warmth of fingertips, the place where a heartbeat is felt. This is not padding. Padding repeats the same fact in different words or retells known background; close description adds information the previous sentence did not contain.
370
-
371
- A single passage should not move at one speed either. Open up the important moment, then tighten the pace and land on the next action.
372
- - Do not inventory everyone by name. “Alex folds his arms; Morgan sits on the lower bunk” is a list with different punctuation, not description. Give the person actually doing something the page; leave everyone else in peripheral vision. A person with no action may go unmentioned for the whole passage.
373
- - Once a name is known, use it. Labels such as “the boy in the jersey” or “the tall one” are appropriate only while the player truly does not know who someone is. Do not retreat to labels after an introduction.
374
- - Prefer the specific to the general, and direct description to piles of adjectives. Richness means layers and texture, not repeating known background or splitting one sentence into three.
375
- `,"blocks/style-intimate.md":`# Style: emotion and intimacy
376
-
377
- 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.
378
-
379
- ## Separate the moment
380
-
381
- Do not skip the process and state only the conclusion. “You held hands” discards the most valuable part. Write the hand moving across the distance: whether it stops halfway, what the fingertips touch first, whether the other person meets it or stays still, how lightly or firmly the grip closes, and how long it lasts before release.
382
-
383
- 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.
384
-
385
- ## Put touch first
386
-
387
- 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.
388
-
389
- 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.
390
-
391
- ## The body does not obey
392
-
393
- 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: these are the player character's own experiences and may be written directly.
394
-
395
- 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.
396
-
397
- ## Distance and boundaries
398
-
399
- 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.
400
-
401
- Whether the other person accepts is always determined by their present character, circumstances, and established relationship. Do not make them agree merely because the mood is right. Decisions that belong to the player character remain the player's as well.
402
-
403
- ## Time changes shape
404
-
405
- 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.”
406
- `,"blocks/style-noir.md":`# Style: hard-boiled investigation
407
-
408
- Short sentences. End on verbs. Remove every adjective you can.
409
-
410
- ## Write only what can be observed
411
-
412
- 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.
413
-
414
- Do not judge for a character. Do not write “they are obviously lying”; write that they look at the door before answering.
415
-
416
- ## Details are evidence
417
-
418
- 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. Every detail placed on the page should be something the player could potentially use.
419
-
420
- Exercise restraint. Environmental description unrelated to a clue needs no more than one sentence.
421
-
422
- ## Pace
423
-
424
- Keep dialogue short and exchanges quick. Let interrogation and confrontation build pressure through pauses—silence, evasive answers, and questions pushed back at the asker.
425
-
426
- Keep the narration cold. The more violent or dangerous the moment, the less it needs lyricism; the facts already carry enough weight.
427
- `,"blocks/style-wuxia.md":`# Style: wuxia and period prose
428
-
429
- Use elevated language without becoming antiquarian. Vary long and short sentences: long sentences for scenery and bearing, short ones for strikes and decisions.
430
-
431
- ## Address and tone
432
-
433
- 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.
434
-
435
- Avoid modern vocabulary and concepts such as trauma, stress, or social distance. Express the same thing in language that belongs to the period.
436
-
437
- ## Exchanges
438
-
439
- Make combat clear without making it tedious: show a move from initiation to impact, how the opponent answers, how force and position change, and which instant decides the outcome. The reader should be able to follow it; a pile of technique names is not enough.
440
-
441
- Follow the world's established rules for internal force, wounds, weapons, and movement techniques. Do not invent them on the spot.
442
-
443
- ## Scene and spirit
444
-
445
- 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.
446
-
447
- 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.
448
- `,"blocks/style-horror.md":`# Style: suspense and horror
449
-
450
- Fear grows from uncertainty, not gore.
451
-
452
- ## Take your time
453
-
454
- Begin with everything normal 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.
455
-
456
- The unknown is more frightening than the explanation. Leave unclear what can remain unclear: let the player see an outline, hear a sound, or catch a smell without seeing the whole.
457
-
458
- ## The body knows first
459
-
460
- Write physiological reactions instead of naming the emotion: a cold neck, sweating palms, softened breathing, a step that stops by itself, or a refusal to turn around. The player will infer fear.
461
-
462
- ## Sound and quiet
463
-
464
- 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.
465
-
466
- ## Do not release the tension
467
-
468
- 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.
469
- `,"blocks/style-action.md":`# Style: action and combat
470
-
471
- 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.
472
-
473
- ## One action at a time
474
-
475
- Advance in chronological order instead of packing three simultaneous actions into one sentence. For each exchange, show the initiation, the response, the result, and the change in position.
476
-
477
- 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.
478
-
479
- ## Let sentences follow the pace
480
-
481
- 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.
482
-
483
- ## Let the environment fight
484
-
485
- Terrain, furniture, light, and weather can be used or become obstacles. Make the fight occur in a particular place, not on an empty stage.
486
-
487
- ## Consequences
488
-
489
- End with a definite new situation: who remains standing, who is down, where the wounds are, where everyone has moved, and which next possibilities have opened or closed.
490
- `,"blocks/style-literary.md":`# Style: restraint and negative space
491
-
492
- Say seven parts; leave three unstated.
493
-
494
- ## Do not say everything
495
-
496
- 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.
497
-
498
- Leave the conclusion to the reader. Provide enough evidence, then stop without adding an explanation.
499
-
500
- ## Small, concrete things
501
-
502
- 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.
503
-
504
- ## Dialogue has another layer
505
-
506
- 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.
507
-
508
- ## Restraint
509
-
510
- Use few metaphors and make them exact; one per passage is enough. Do not stack adjectives. Delete any sentence whose removal changes nothing.
511
- `,"blocks/adjudication.md":`# General player-agency and adjudication boundaries
512
-
513
- ## What the player must decide
514
-
515
- The following may come only from an explicit expression in the player's current input and must never be decided on their behalf: what they do and where they go; their attitude toward people or events; accepting or refusing; giving or receiving; striking or holding back; and choices that change relationships, goals, risk, or ownership. These are the things the player is here to play.
516
-
517
- A thought, goal, intention, attempt, preparation, or prediction does not mean the goal has been achieved. Adjudicate only actions the player explicitly carries out, using world facts and rules to determine the result.
518
-
519
- ## What may be performed for the player
520
-
521
- Directly perform incidental movements required to carry out an expressed intention, how the player travels, routine tidying, greetings and replies, and exact wording that does not change the substance. Do not stop for confirmation of every step. If the player says “I go find them,” write leaving, crossing the corridor, and knocking. If the player says “I agree,” voice the agreement in a way consistent with their character and the present mood.
522
-
523
- Anything performed for the player must satisfy both conditions: it changes none of the decisions listed above, and it will not trap the player's next input if they want to reverse course or correct themselves. When uncertain, pull back and show the player beginning an action without completing it.
524
-
525
- ## NPCs have lives of their own
526
-
527
- An NPC is not a device that starts only when the player speaks. Everyone present has something they are doing now, something they need to do today, and concerns of their own. If the player ignores them, they continue their task, speak to someone else, leave, or approach the player. The world moves too: daylight, crowds, ongoing activity, and distant sounds do not pause when the player does.
528
-
529
- Not everything happening in a scene needs to concern the player. Let NPCs act from their own circumstances and goals even when that pushes events in an unexpected direction; that is what makes the world feel alive. Their actions must still match established character, circumstances, and world facts.
530
-
531
- Results created by an NPC's own action are the same kind of results as those created by the player. If an NPC changes location, puts down their work, changes their mind, or develops resentment, apply the state-maintenance criteria to each result and save what must persist.
532
-
533
- ## People offstage still move forward
534
-
535
- Being alone with one character means only that others are absent from this passage, not that they are paused. Offstage NPCs continue according to their own circumstances: whether they finish their work, move elsewhere, meet the person they awaited, or change attitude because they waited, missed something, or heard news. If the player is gone for an hour, they advance for an hour.
536
-
537
- You do not need to simulate everyone after every action. Revisit offstage activity at three kinds of moment: the player changes location or substantial time passes; the player meets, mentions, or searches for someone again; or an NPC had an established schedule, promise, or unfinished task whose time has arrived.
538
-
539
- When a judgment depends on facts about an NPC, read that NPC's document first, then write the result back to the same document. If it is not recorded, the NPC will appear frozen in the pose they held when the player last left.
540
-
541
- ## What may be described directly
542
-
543
- Natural sensations that require no new player decision, unavoidable direct consequences, and autonomous reactions or actions from NPCs and the environment.
544
- `,"blocks/state.md":`# General state-maintenance criteria
545
-
546
- ## Gather material before adjudicating
547
-
548
- - Base decisions on world material already injected, source text read precisely in the current call chain, and actions the player explicitly carries out.
549
- - When a decision depends on a specific fact you do not yet have, use directory listing, literal search, and precise reading before deciding—even if the directory already shows a matching entry. A directory supplies only titles, summaries, and references, not document bodies. Seeing a character or item's name does not mean you possess the fact that determines the current outcome. Incomplete injected material does not mean the world lacks the fact.
550
- - If the fact genuinely cannot be read, handle that uncertainty inside the world: a relevant character may have no memory, be unsure, or need to verify it, but established world facts may not be rewritten.
551
- - If the material still cannot support a conclusion, preserve uncertainty instead of inventing a new fact that would change the adjudication.
552
-
553
- ## Which results must be saved
554
-
555
- Apply this test to every result that has become true: if the next action began without it, would that cause an obvious contradiction or materially change character behavior, available choices, ownership, position, injury, relationships, important knowledge, or an ongoing situation? If yes, save it. If no, let the committed narrative preserve the detail. Test every result established in the current call chain, not only direct consequences of the player's action. NPC actions and offstage developments use the same test. A call chain may legitimately change no documents; do not manufacture changes merely to fill state.
556
-
557
- When the player character personally attempts and fails, the **experience of failure itself** needs saving only when it establishes a restriction that still holds at the start of the next action (the door is genuinely locked and the key is elsewhere), or creates knowledge that will significantly affect later behavior. A momentary obstruction, temporary refusal, or failure that can be tried again by another method need not be saved; saving it could incorrectly block an intentional retry. Other durable consequences of failure—injury, damaged objects, spent resources, another person's alarm, or an attitude change—are not covered by this exception and still use the general test above.
558
-
559
- A promise that has been made may be saved, but the future event it concerns cannot be saved as already happened. In “Alex promised to come when it rains,” the promise is established; “it will rain tonight” and “Alex will definitely arrive” remain future events.
560
-
561
- ## Where to save results
562
-
563
- - Write each durable result to the world document that most naturally owns it. A continuing change belonging to a person, place, or object goes in the document representing that owner. Opinions and relationships belong to the person who holds them.
564
- - Information that constrains only the immediate scene, involves several objects, and has no single owner belongs in the current situation.
565
- - Create a separate document for an object only when it must be independently referenced, transferred, or tracked through its lifecycle. Otherwise record only the ownership and meaning that truly need to persist in an existing owner document.
566
- - When one result changes both durable state and the immediate situation, update the owning document and the current situation separately so each expresses only what it must carry.
567
-
568
- Follow the world prompt frame for the document types available in this world and where each kind of result belongs.
569
-
570
- ## The player can read only the narrative
571
-
572
- World documents are not visible to the player. Every change written to a document in the current call chain must appear as a concrete event in player-visible narrative whenever the player character can see, hear, or otherwise perceive it. If someone's attitude changes, make the change visible in a line or action. If an object changes hands, write the giving and receiving. If someone leaves, show how. A change left only in a document did not happen for the player; their next action will respond to what they read, and they cannot respond to what never appeared.
573
-
574
- Changes outside the player character's perception—events elsewhere or another person's unexpressed judgment—do not need to appear in the narrative, but the narrative may not contradict them.
575
-
576
- Documents or narrative may be written first. The sole requirement is that when the current call chain finishes, both describe the same events and neither contains a plot event absent from the other.
577
-
578
- ## Converging the current situation
579
-
580
- After state maintenance, rewrite the current situation to contain only what remains true after direct results and immediate reactions finish: the present location, characters still present, events still in progress, and the few restrictions whose omission would immediately conflict with the next action. Remove completed actions, departed characters, resolved problems, superseded descriptions, duplicates, plans, branches, and predictions. “Present” already identifies who remains, so do not also list who left. Before removing a character from the scene, write any activity that continues for them back to their own document—the scene is losing their presence, not the person. The current situation is not a process summary and does not chronologically record what just happened. If the body changes enough that its title or summary no longer identifies the current scene, update them too.
581
- `};function y(e){return e===`zh-CN`?_:v}var b=`prompts/setting-improvement.md`,x=`# 系统推荐的设定完善方法
582
-
583
- 把本次目标理解为对已有内容包设定的完善,而不是默认从零重建一个新世界。用户直接注入的当前文件是已经成立的事实和约束;其他文件也应按需读取。保留仍然成立的内容,只修改目标真正涉及的部分。
584
-
585
- ## 先理解,再创作
586
-
587
- 需要可见计划时,计划应简洁说明玩家想获得的主要体验、准备保留/调整/建立的内容、语气与边界,以及确实必要的假设。不适用的循环、冲突、多幕结构或次要体验可以省略,不要为了填模板而发明。
588
-
589
- 设定以人类可读的世界文档表达。人物、地点、关键物品、规则和当前情境按自然所有者组织;主持方法、题材边界和本世界特有的创作要求放进世界提示框架。不要把愿望、预测或计划中的未来分支伪装成创建世界时已经发生的事实。
590
-
591
- ## 开场白
592
-
593
- 开场白是这部互动式小说的第一页,玩家读完它就要写下第一个行动。让环境、光线、声音、他人的动作和正在进行的事把场面铺开,用侧写交代气氛与关系,而不是罗列设定或逐条介绍人物。在场的人各自有手头正在做的事——世界在玩家到来之前已经在运转,不要把所有人定格成等待启动的布景。
594
-
595
- 最后一句写某个人做的一件具体的事,或说的一句具体的话:他问了什么就把原话写出来,他把东西递过来就写他怎么递的。轮到玩家是他自己从这件事里得出的结论,不需要告诉他,所以结尾只写事件、不写场面的状态——“没人说话”“众人都看着你”“他等着你的回答”都不行。也不要在结尾罗列选项,那是主持人的声音,不属于这段小说。
596
-
597
- 不得替玩家决定行动、台词或内心:此刻还没有任何玩家输入可以承接。开场白中会继续约束首次行动的事实,必须同时写入自然承载它的世界文档,不能只存在于开场白。
598
-
599
- ## 世界事实与持续状态
600
-
601
- - 世界文档只写创建世界时已经成立的事实和稳定规则。愿望、意图、尝试、计划、可能性、预测、计划中的转折和未来分支都不是已经发生的事实。
602
- - 每项持续信息优先写给它的自然所有者。普通临时对象不必独立建档;只有需要独立引用、转移或追踪生命周期时,才升级为独立文档。
603
- - 当前情境只保留开场动作和即时反应结束后仍然成立的局面:此刻地点、仍在场的人物、仍在进行的事件,以及首次行动若忽略就会立刻冲突的少量限制。它不是背景摘要、事件日志或未来分支清单。
604
- - catalog 的摘要要写成足以帮助主持者判断“是否需要继续读取正文”的一句话,而不是“某某的资料”。正文改变后,标题和摘要也要继续准确。
605
-
606
- ## 世界提示框架
607
-
608
- 主持预设已经提供跨世界通用的文风、玩家代理权、裁决和状态维护判据。内容包的世界提示框架只写本世界特有的部分:题材边界、专属文风、本世界有哪些文档类型、某类结果应该写进哪一份,以及专属规则。不要重复通用判据,也不要描述 Runtime 怎样编排工具。
609
-
610
- 静态提示材料应尽量稳定;会随游玩持续改写的事实放进当前情境或其他自然承载它的世界文档。只有确实需要固定注入正文的材料才长期占用提示词位置。
611
- `,S=`# Recommended setting-improvement method
612
-
613
- Treat the current goal as an improvement to an existing content-package setting, not as an instruction to rebuild a new world from scratch. Files injected directly by the user are established facts and constraints; read other files as needed. Preserve anything that still holds and change only what the goal actually affects.
614
-
615
- ## Understand first, then create
616
-
617
- When a visible plan is requested, keep it concise: state the main experience the player wants, what will be preserved, adjusted, or established, the tone and boundaries, and only the assumptions that are genuinely necessary. Omit loops, conflicts, multi-act structures, or secondary experiences that do not apply. Do not invent material just to fill a template.
618
-
619
- Express the setting through human-readable world documents. Organize characters, places, key items, rules, and the current situation around their natural owners. Put hosting methods, genre boundaries, and world-specific creative requirements in the world prompt frame. Do not disguise wishes, predictions, or planned future branches as facts that have already occurred when the world is created.
620
-
621
- ## Opening
622
-
623
- The opening is the first page of this interactive novel; after reading it, the player will write their first action. Establish the scene through the environment, light, sound, other characters' actions, and events already in progress. Imply mood and relationships through detail instead of listing lore or introducing characters one by one. Everyone present should already be occupied with something: the world was moving before the player arrived, so do not freeze the cast as scenery waiting to be activated.
624
-
625
- Make the last sentence a specific action someone takes or a specific line they say. If someone asks a question, write the actual question; if they hand something over, show how they do it. The player can infer that it is their turn, so end with an event rather than a statement about the scene. Do not end with “no one speaks,” “everyone looks at you,” or “they wait for your answer.” Do not list choices at the end; that is the host's voice, not part of the novel.
626
-
627
- Do not decide the player's action, dialogue, or inner thoughts: there is no player input yet to support them. Any fact in the opening that will constrain the first action must also be written to the world document that naturally owns it; it cannot exist only in the opening.
628
-
629
- ## World facts and durable state
630
-
631
- - World documents contain only facts and stable rules that already hold when the world is created. Wishes, intentions, attempts, plans, possibilities, predictions, planned turns, and future branches are not established facts.
632
- - Write each durable piece of information to its natural owner first. Ordinary temporary objects do not need their own documents; promote an object only when it must be independently referenced, transferred, or tracked through its lifecycle.
633
- - The current situation contains only what remains true after the opening action and immediate reactions finish: the present location, characters still present, events still in progress, and the few constraints whose omission would immediately conflict with the first action. It is not a background summary, event log, or list of future branches.
634
- - Catalog summaries must be informative enough for the host to decide whether to read the full body, rather than saying only “information about X.” Titles and summaries must remain accurate after the body changes.
635
-
636
- ## World prompt frame
637
-
638
- The host preset already provides cross-world rules for prose, player agency, adjudication, and state maintenance. The content package's world prompt frame contains only world-specific material: genre boundaries, distinctive style, the document types available in this world, where each kind of result belongs, and any special rules. Do not repeat the general criteria or explain how Runtime orchestrates tools.
639
-
640
- Keep static prompt material as stable as possible. Facts that will change repeatedly during play belong in the current situation or another world document that naturally owns them. Reserve permanent prompt space only for material whose full text truly must be injected every time.
641
- `;function C(e){return e===`zh-CN`?x:S}function w(e){let t=e===`zh-CN`?`下一步建议`:`Next-step ideas`;return{"preset.yaml":`format: narraeon.play-preset/v1
642
- name: action-choices-recommended
643
- callChain: call-chain.yaml
644
- settingImprovement:
645
- markdown: prompts/setting-improvement.md
646
- mounts:
647
- player.options: composer_below
648
- extensions:
649
- - renderers/player-options.html
650
- - scripts/player-options.js
651
- - assets/player-options.css
652
- `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
653
- narrative:
654
- - markdown: prompts/narrate.md
655
- followups:
656
- - id: player_options
657
- displayName: ${t}
658
- prompt:
659
- role: author_instruction
660
- markdown: prompts/options.md
661
- maxArtifactBytes: 32768
662
- artifacts:
663
- - name: player_options
664
- channel: player.options
665
- strategy: replace
666
- contentType: application/json
667
- renderer: renderers/player-options.html
668
- rendererRevision: v1
669
- rendererMode: app
670
- scripts:
671
- - scripts/player-options.js
672
- assets:
673
- - assets/player-options.css
674
- save: commit
675
- invalidation: new_operation
676
- required: true
677
- maxEmits: 1
678
- payloadContract:
679
- type: array
680
- minItems: 4
681
- maxItems: 4
682
- uniqueBy: id
683
- items:
684
- type: object
685
- additionalProperties: false
686
- required:
687
- - id
688
- - label
689
- - prompt
690
- properties:
691
- id:
692
- type: string
693
- minLength: 1
694
- maxLength: 64
695
- label:
696
- type: string
697
- minLength: 1
698
- maxLength: 80
699
- description:
700
- type: string
701
- maxLength: 240
702
- prompt:
703
- type: string
704
- minLength: 1
705
- maxLength: 1000
706
- `,...y(e),"prompts/narrate.md":g(e),[b]:C(e),"prompts/options.md":e===`zh-CN`?`# 提交后下一步建议
707
-
708
- 根据玩家刚刚看到的决策点,给出四种短而具体、彼此有实质差异的下一步建议。差异应体现在目标、方法、风险或态度上,而不是只替换近义词。
709
-
710
- 建议只能使用玩家已经能够知道的信息,并且必须是玩家角色此刻有条件尝试的行动。每项建议只是可以填入输入框的草稿:表达玩家准备做什么,不宣称行动已经发生,不预先写定结果,也不替玩家选择或发送。字段、数量和提交方式服从当前后置请求的 Runtime 产物说明。
711
- `:`# Next-step ideas after the commit
712
-
713
- 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.
714
-
715
- 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.
716
- `,"renderers/player-options.html":`<!doctype html>
717
- <html><head><meta charset="utf-8"><title>${t}</title></head><body>
718
- <main id="player-options-root" aria-label="${t}"></main>
719
- </body></html>
720
- `,"scripts/player-options.js":`(function () {
721
- var root = document.getElementById("player-options-root");
722
- var pending = new Map();
723
- var styleSource = window.__NARRAEON_ASSETS__ && window.__NARRAEON_ASSETS__["assets/player-options.css"];
724
- if (typeof styleSource === "string") {
725
- var style = document.createElement("style");
726
- style.textContent = styleSource;
727
- document.head.append(style);
728
- }
729
- function post(command, payload) {
730
- var requestId = "draft-" + Math.random().toString(36).slice(2);
731
- parent.postMessage({
732
- namespace: "narraeon.extension.v1",
733
- command: command,
734
- instanceId: document.documentElement.dataset.narraeonInstance,
735
- nonce: document.documentElement.dataset.narraeonNonce,
736
- requestId: requestId,
737
- payload: payload
738
- }, "*");
739
- pending.set(requestId, true);
740
- }
741
- function draw(raw, disabled) {
742
- root.replaceChildren();
743
- var options;
744
- try { options = JSON.parse(raw); } catch (_) { return; }
745
- if (!Array.isArray(options)) return;
746
- options.forEach(function (option) {
747
- var button = document.createElement("button");
748
- button.type = "button";
749
- button.className = "player-option";
750
- button.dataset.optionId = option.id;
751
- button.disabled = Boolean(disabled);
752
- var label = document.createElement("strong");
753
- label.textContent = option.label;
754
- button.append(label);
755
- if (option.description) {
756
- var detail = document.createElement("small");
757
- detail.textContent = option.description;
758
- button.append(detail);
759
- }
760
- button.addEventListener("click", function () {
761
- post("composer.set_draft", { text: option.prompt });
762
- });
763
- root.append(button);
764
- });
765
- }
766
- window.addEventListener("message", function (event) {
767
- if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
768
- if (event.data.type === "render.update") {
769
- draw(event.data.payload && event.data.payload.content, event.data.payload && event.data.payload.interactionDisabled);
770
- return;
771
- }
772
- if (event.data.type === "bridge.response") pending.delete(event.data.requestId);
773
- });
774
- }());
775
- `,"assets/player-options.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
776
- #player-options-root { display: grid; gap: .5rem; }
777
- .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; }
778
- .player-option:hover { border-color: #a66a42; }
779
- .player-option small { color: #6c6259; }
780
- `}}w(`en`);function T(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
781
- name: generic-panels-recommended
782
- callChain: call-chain.yaml
783
- settingImprovement:
784
- markdown: prompts/setting-improvement.md
785
- mounts:
786
- generic.markdown: story
787
- generic.html: sidebar
788
- generic.debug: debug
789
- extensions:
790
- - renderers/generic-html.html
791
- - scripts/generic-html.js
792
- - assets/generic-html.css
793
- `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
794
- narrative:
795
- - markdown: prompts/narrate.md
796
- followups:
797
- - id: publish_panels
798
- displayName: ${t}
799
- prompt:
800
- role: author_instruction
801
- markdown: prompts/panels.md
802
- maxArtifactBytes: 65536
803
- artifacts:
804
- - name: markdown_panel
805
- channel: generic.markdown
806
- strategy: replace
807
- contentType: text/markdown
808
- save: commit
809
- invalidation: new_operation
810
- required: false
811
- maxEmits: 1
812
- - name: html_panel
813
- channel: generic.html
814
- strategy: replace
815
- contentType: text/html
816
- renderer: renderers/generic-html.html
817
- rendererRevision: v1
818
- rendererMode: app
819
- scripts:
820
- - scripts/generic-html.js
821
- assets:
822
- - assets/generic-html.css
823
- save: commit
824
- invalidation: new_operation
825
- required: false
826
- maxEmits: 1
827
- - name: debug_panel
828
- channel: generic.debug
829
- strategy: append
830
- contentType: text/markdown
831
- save: operation
832
- invalidation: operation_end
833
- required: false
834
- maxEmits: 8
835
- `,...y(e),"prompts/narrate.md":g(e),[b]:C(e),"prompts/panels.md":e===`zh-CN`?`# 通用面板
836
-
837
- 核心叙事已经提交。只有面板能为当前局面提供额外价值时才生成它;没有合适内容时可以不生成。
838
-
839
- 面板只能整理已经成立且适合玩家看见的信息,不得发明世界事实、替玩家作决定、偷偷保存状态,或把未向玩家揭示的信息当作提示。它是非权威的界面补充,不应复制或改写由玩家视图负责的固定状态展示。各输出的格式、保存方式和提交方法服从当前后置请求的 Runtime 产物说明。
840
- `:`# Generic panels
841
-
842
- 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.
843
-
844
- 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.
845
- `,"renderers/generic-html.html":`<!doctype html>
846
- <html><head><meta charset="utf-8"><title>${n}</title></head><body>
847
- <main id="generic-html-root" aria-label="${n}"></main>
848
- </body></html>
849
- `,"scripts/generic-html.js":`(function () {
850
- var root = document.getElementById("generic-html-root");
851
- window.addEventListener("message", function (event) {
852
- if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
853
- if (event.data.type !== "render.update") return;
854
- var payload = event.data.payload || {};
855
- root.innerHTML = typeof payload.content === "string" ? payload.content : "";
856
- });
857
- }());
858
- `,"assets/generic-html.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
859
- #generic-html-root { padding: .75rem; }
860
- `}}T(`en`);function ee(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
861
- name: status-panel-recommended
862
- callChain: call-chain.yaml
863
- settingImprovement:
864
- markdown: prompts/setting-improvement.md
865
- mounts: []
866
- playerViewPanels:
867
- - id: current_view
868
- source:
869
- kind: player_view
870
- view: status
871
- channel: player.view.current
872
- key: current
873
- mount: sidebar
874
- renderer: renderers/player-view-status.html
875
- rendererRevision: v1
876
- rendererMode: app
877
- scripts:
878
- - scripts/player-view-status.js
879
- assets:
880
- - assets/player-view-status.css
881
- config:
882
- title: ${t}
883
- layout: stack
884
- theme: parchment
885
- empty: message
886
- emptyMessage: ${r}
887
- groups: []
888
- extensions:
889
- - renderers/player-view-status.html
890
- - scripts/player-view-status.js
891
- - assets/player-view-status.css
892
- `,"call-chain.yaml":`format: narraeon.play-call-chain/v1
893
- narrative:
894
- - markdown: prompts/narrate.md
895
- followups: []
896
- `,...y(e),"prompts/narrate.md":g(e),[b]:C(e),"renderers/player-view-status.html":`<!doctype html>
897
- <html><head><meta charset="utf-8"><title>${t}</title></head><body>
898
- <main id="player-view-panel-root" aria-label="${t}"></main>
899
- </body></html>
900
- `,"scripts/player-view-status.js":`(function () {
901
- var root = document.getElementById("player-view-panel-root");
902
- var styleSource = window.__NARRAEON_ASSETS__ && window.__NARRAEON_ASSETS__["assets/player-view-status.css"];
903
- if (typeof styleSource === "string") {
904
- var style = document.createElement("style");
905
- style.textContent = styleSource;
906
- document.head.append(style);
907
- }
908
- function valueNode(value) {
909
- if (value === null || value === undefined) return document.createTextNode("—");
910
- if (typeof value === "object") {
911
- var wrapper = document.createElement(Array.isArray(value) ? "ul" : "dl");
912
- Object.keys(value).forEach(function (key, index) {
913
- var entry = document.createElement(Array.isArray(value) ? "li" : "div");
914
- if (!Array.isArray(value)) {
915
- var term = document.createElement("dt");
916
- term.textContent = key;
917
- entry.append(term);
918
- }
919
- entry.append(valueNode(Array.isArray(value) ? value[index] : value[key]));
920
- wrapper.append(entry);
921
- });
922
- return wrapper;
923
- }
924
- return document.createTextNode(String(value));
925
- }
926
- function draw(raw) {
927
- root.replaceChildren();
928
- var payload;
929
- try { payload = JSON.parse(raw || "{}"); } catch (_) { return; }
930
- var config = payload.config || {};
931
- root.dataset.theme = config.theme || "default";
932
- root.dataset.layout = config.layout || "stack";
933
- root.dataset.emptyState = config.empty || "message";
934
- var heading = document.createElement("h3");
935
- heading.textContent = payload.title || payload.viewId || ${JSON.stringify(n)};
936
- root.append(heading);
937
- var items = Array.isArray(payload.items) ? payload.items : [];
938
- if (items.length === 0) {
939
- if (config.empty === "message" || config.empty === "show") {
940
- var empty = document.createElement("p");
941
- empty.className = config.empty === "show"
942
- ? "player-view-empty player-view-empty-value"
943
- : "player-view-empty player-view-empty-message";
944
- empty.textContent = config.empty === "show"
945
- ? ${JSON.stringify(i)} + (config.emptyMessage || ${JSON.stringify(r)})
946
- : (config.emptyMessage || ${JSON.stringify(r)});
947
- root.append(empty);
948
- }
949
- } else {
950
- var byId = new Map(items.map(function (item) { return [item.id, item]; }));
951
- var groups = Array.isArray(config.groups) ? config.groups : [];
952
- var renderItems = function (list, selected) {
953
- selected.forEach(function (item) {
954
- var row = document.createElement("div");
955
- var label = document.createElement("dt");
956
- label.textContent = item.label || item.id;
957
- var value = document.createElement("dd");
958
- value.append(valueNode(item.value));
959
- row.append(label, value);
960
- list.append(row);
961
- });
962
- };
963
- if (groups.length === 0) {
964
- var list = document.createElement("dl");
965
- renderItems(list, items);
966
- root.append(list);
967
- } else {
968
- groups.forEach(function (group) {
969
- var selected = (Array.isArray(group.itemIds) ? group.itemIds : [])
970
- .map(function (id) { return byId.get(id); })
971
- .filter(Boolean);
972
- if (selected.length === 0) return;
973
- var section = document.createElement("section");
974
- var groupHeading = document.createElement("h4");
975
- groupHeading.textContent = group.label || group.id;
976
- var groupList = document.createElement("dl");
977
- renderItems(groupList, selected);
978
- section.append(groupHeading, groupList);
979
- root.append(section);
980
- });
981
- }
982
- }
983
- var diagnostics = Array.isArray(payload.diagnostics) ? payload.diagnostics : [];
984
- if (diagnostics.length > 0) {
985
- var details = document.createElement("details");
986
- var summary = document.createElement("summary");
987
- summary.textContent = diagnostics.length + ${JSON.stringify(a)};
988
- details.append(summary);
989
- var diagnosticList = document.createElement("ul");
990
- diagnostics.forEach(function (diagnostic) {
991
- var item = document.createElement("li");
992
- item.textContent = diagnostic.message;
993
- diagnosticList.append(item);
994
- });
995
- details.append(diagnosticList);
996
- root.append(details);
997
- }
998
- }
999
- window.addEventListener("message", function (event) {
1000
- if (!event.data || event.data.namespace !== "narraeon.extension.v1") return;
1001
- if (event.data.type === "render.update") draw(event.data.payload && event.data.payload.content);
1002
- });
1003
- }());
1004
- `,"assets/player-view-status.css":`body { margin: 0; font: 14px/1.45 system-ui, sans-serif; color: #202020; }
1005
- #player-view-panel-root { display: grid; gap: .5rem; }
1006
- #player-view-panel-root[data-theme="parchment"] { color: #4a382b; background: #fffaf1; padding: .75rem; border-radius: .65rem; }
1007
- #player-view-panel-root dl { display: grid; gap: .45rem; margin: 0; }
1008
- #player-view-panel-root[data-layout="grid"] dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1009
- #player-view-panel-root dl > div { display: grid; gap: .15rem; }
1010
- #player-view-panel-root dt { font-weight: 650; }
1011
- #player-view-panel-root dd { margin: 0; }
1012
- #player-view-panel-root ul, #player-view-panel-root dl dl { margin: .25rem 0 0 1rem; padding-left: 1rem; }
1013
- .player-view-empty { color: #6c6259; }
1014
- `}}ee(`en`);function E(e){return[{id:`action-choices`,label:e===`zh-CN`?`行动选项`:`Action choices`,name:e===`zh-CN`?`下一步建议(可编辑副本)`:`Next-step ideas (editable copy)`,files:w(e)},{id:`status-panel`,label:e===`zh-CN`?`状态栏`:`Status panel`,name:e===`zh-CN`?`状态栏(可编辑副本)`:`Status panel (editable copy)`,files:ee(e)},{id:`generic-panels`,label:e===`zh-CN`?`Markdown / HTML 面板`:`Markdown / HTML panels`,name:e===`zh-CN`?`通用面板(可编辑副本)`:`Generic panels (editable copy)`,files:T(e)},{id:`artifact-debugger`,label:e===`zh-CN`?`产物调试器`:`Artifact debugger`,name:e===`zh-CN`?`产物调试器(可编辑副本)`:`Artifact debugger (editable copy)`,files:T(e)}]}E(`en`);var D=[`en`,`zh-CN`];function te(e){return D.includes(e)}var O=`en`,k={"正在读取工作区…":`Loading workspace…`,工作区读取失败:`Failed to load the workspace`,"内容包当前树已整批保存。":`The content package tree has been saved.`,"内容包已重命名。":`The content package has been renamed.`,"内容包 ZIP 自身大小超过安全上限。":`The content package ZIP exceeds the safety limit.`,"ZIP 内容包已导入为新的本地身份。":`The ZIP content package was imported with a new local identity.`,"请先保存手动编辑,再开始 AI 设定完善。":`Save manual edits before starting setting improvement.`,"创作计划已生成;计划阶段只读取了当前设定。":`The creation plan is ready; the planning phase only read the current setting.`,"候选已通过机械检查;可整批应用或放弃。":`The candidate passed mechanical checks and can now be applied or discarded.`,"已按你的意见重出创作计划。":`The creation plan has been regenerated from your feedback.`,"候选已按你的意见修改并重新通过机械检查。":`The candidate was revised from your feedback and passed mechanical checks again.`,"设定候选已整批应用。":`The setting candidate has been applied.`,"设定候选已放弃,当前树未改变。":`The setting candidate was discarded; the current tree is unchanged.`,"请先保存并启用一份模型配置。":`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`,尚未配置:`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`,"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 name`,重命名:`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:
1015
- id: character.example
1016
- ref: example
1017
- title: Alex Morgan
1018
- summary: A stable one-sentence description.
1019
- aliases: []
1020
- `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
1021
- $document:
1022
- id: rule.example
1023
- ref: example
1024
- title: Example rule
1025
- summary: A stable one-sentence description.
1026
- aliases: []
1027
- ---
1028
-
1029
- # Example rule
1030
- `,"输入 UTF-8 文本内容……":`Enter UTF-8 text…`,确认修正内容:`Review correction`,份文档会变化:`document(s) will change`,修正前:`Before correction`,修正后:`After correction`,"查看内容 hash":`View content hash`,"查看端点、附加材料和下一次提示词":`View the endpoint, additional material, and next prompt`,父端点:`Parent endpoint`,候选版本:`Candidate version`,完整附加材料清单差异:`Complete additional-material diff`,下一次真实提示词:`Next real Prompt Preview`,应用这笔修正:`Apply this correction`,放弃修正草稿:`Discard correction draft`,世界文件:`World files`,"当前 state 文档":`Current state documents`,尚无已提交叙事:`No committed narrative yet`,"Runtime 诊断":`Runtime diagnostics`,"创建 operation":`Creation operation`,历史条目:`History entries`,没有文件:`No files`,继续游玩:`Continue playing`,世界:`Worlds`,进入世界:`Open world`,删除:`Delete`,世界名称:`World name`,保存世界名称:`Save world name`,保存:`Save`,取消:`Cancel`,还没有正在游玩的世界:`No worlds in play yet`,"先新建内容包,或上传一份 ZIP,再整理开场与世界文档并创建独立世界。":`Create a content package or upload a ZIP, then prepare its opening and world documents and create an independent world.`,工作区状态:`Workspace status`,当前预设:`Current preset`,尚未选择:`Not selected`,可用内容包:`Usable content packages`,份:`total`,"内容包是世界模板;创建后的世界会独立保存状态、控制与历史。":`A content package is a world template. A created world stores its own state, control, and history.`,创作工作台:`Authoring workbench`,"四个入口各自完成一件事,运行中的世界从上方直接进入。":`Each of the four entries has one job. Open active worlds directly above.`,四个任务入口:`Four task entries`,内容编辑:`Content editing`,"编辑内容包里的开场、世界文档与控制文件。":`Edit a content package's opening, world documents, and control files.`,从空白内容包开始:`Start with a blank content package`,预设:`Presets`,"编辑提示块库、叙事规则、后置请求与扩展资源。":`Edit prompt blocks, narrative rules, follow-up requests, and extension resources.`,选择预设:`Choose a preset`,"从一份可用内容包复制出独立演化的世界。":`Copy a usable content package into an independently evolving world.`,需要可用内容包:`Usable content package required`,提示词预览:`Prompt Preview`,"检查真实 role、材料、工具、预算与缓存边界。":`Inspect real roles, material, tools, budgets, and cache boundaries.`,模型已就绪:`Model ready`,需要模型连接:`Model connection required`,新建内容包:`Create content package`,待修复:`Needs repair`,"可编辑、预览并创建新世界":`Ready to edit, preview, and create a world`,打开并修复当前树中的问题:`Open and repair issues in the current tree`,从一组人类可读文件开始:`Start with human-readable files`,"内容包由 opening.md、world 与 control 组成,可以从空白新建,也可以上传一份内容包 ZIP。":`A content package contains opening.md, world, and control. Create one from scratch or upload a content-package ZIP.`,"导入 ZIP":`Import ZIP`,"选择本应用导出或遵循相同结构的内容包 ZIP;导入会创建新的本地身份,不覆盖同名内容包。":`Choose a ZIP exported by this app or one with the same structure. Import creates a new local identity and never overwrites a package with the same name.`,"内容包 ZIP":`Content-package ZIP`,"内容包 ZIP 文件":`Content-package ZIP file`,"选择 ZIP 文件":`Choose ZIP file`,"正在导入…":`Importing…`,默认模型:`Default model`,"模型连接已保存并启用;后续请求只使用当前配置。":`The model connection was saved and enabled. Later requests use only the current configuration.`,"已切换当前模型配置;Runtime 不会自动故障转移。":`The current model configuration was switched. Runtime does not fail over automatically.`,"模型配置已从本机删除。":`The model configuration was deleted from this device.`,"保存多份本机配置并明确切换。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`,"端点或协议已改变,必须重新填写":`The endpoint or protocol changed; enter it again`,留空以保留当前端点的现有凭据:`Leave blank to keep the existing credential for this endpoint`,"旧凭据只会为同一协议和端点保留,不会静默转发到新端点。":`An old credential is retained only for the same protocol and endpoint; it is never silently forwarded to a new endpoint.`,"模型 ID":`Model ID`,"正在拉取…":`Fetching…`,从端点拉取模型:`Fetch models from endpoint`,"可在模型 ID 输入框中选择已拉取结果。":`Fetched results can be selected in the Model ID field.`,"真实 context window":`Actual context window`,"最大输出 tokens":`Maximum output tokens`,"正在保存…":`Saving…`,保存模型连接并启用:`Save and enable model connection`,放弃修改:`Discard changes`,重置新配置:`Reset new configuration`,已保存模型配置:`Saved model configurations`,已保存配置:`Saved configurations`,"尚未保存模型配置。":`No model configurations saved yet.`,当前使用:`In use`,模型:`Model`,端点:`Endpoint`,"窗口 / 输出":`Window / output`,凭据:`Credential`,已保存在本机:`Saved on this device`,未配置:`Not configured`,"正在切换…":`Switching…`,切换到此配置:`Switch to this configuration`,正在编辑:`Editing`,编辑:`Edit`,"正在删除…":`Deleting…`,"先切换到另一份配置,才能删除当前配置。":`Switch to another configuration before deleting the current one.`,模型配置操作失败:`Model-configuration action failed`};Object.assign(k,{玩法预设操作失败:`Play-preset action failed`,"当前玩法有未保存修改;请先保存或撤销,再切换预设。":`The current play preset has unsaved changes. Save or discard them before switching presets.`,"已撤销当前未保存修改。":`Current unsaved changes were discarded.`,"preset.yaml/call-chain.yaml 与结构化编辑同时修改;请保留一种编辑方式后再保存,避免静默覆盖。":`preset.yaml/call-chain.yaml and the structured editor were both changed. Keep one version before saving to avoid a silent overwrite.`,"玩法文件与结构化草稿已保存。":`Play files and the structured draft were saved.`,"玩法预设业务文件已导出。":`Play-preset files were exported.`,"导入文件必须是 UTF-8 玩法业务文件数组":`The imported file must be an array of UTF-8 play files`,导入玩法:`Import play preset`,"玩法预设已导入为新的本地身份;请显式启用其中的 JavaScript。":`The play preset was imported as a new local identity. Enable its JavaScript explicitly if you trust it.`,玩法预设:`Play presets`,"在同一处管理设定完善方法、主持规则、调用链、界面产物与可信本地代码。":`Manage setting-improvement methods, host rules, call chains, interface artifacts, and trusted local code in one place.`,新调用链与设定完善当前使用:`New call chains and setting-improvement sessions currently use`,未选择:`Not selected`,"已经开始的模型会话继续使用冻结 revision":`Model sessions already in progress keep their frozen revision`,玩法预设工作区:`Play-preset workspace`,玩法预设列表:`Play-preset list`,本地预设:`Local presets`,"选择一个本地身份开始编辑。":`Choose a local identity to start editing.`,当前玩法:`Current play preset`,结构有效:`Structure valid`,需要修复:`Needs repair`,已停用:`Disabled`,新建与导入玩法预设:`Create and import play presets`,新建或导入:`Create or import`,新玩法预设名称:`New play-preset name`,"已新建普通玩法预设。":`A regular play preset was created.`,新建空白预设:`Create blank preset`,复制推荐:`Copy recommended preset`,导入玩法文件:`Import play files`,导入玩法预设文件:`Import play-preset file`,"还没有玩法预设。":`There are no play presets yet.`,玩法预设文件编辑器:`Play-preset file editor`,"· 修改只影响之后开始的全新上下文":`· Changes affect only new contexts started later`,未保存修改:`Unsaved changes`,已保存:`Saved`,"JavaScript 已启用":`JavaScript enabled`,"JavaScript 已停用":`JavaScript disabled`,预设名称:`Preset name`,玩法预设名称:`Play-preset name`,预设操作:`Preset actions`,玩法预设身份管理:`Play-preset identity management`,"这些操作只管理这份本地预设;内容编辑和保存仍在页面底部完成。":`These actions manage only this local preset. Edit and save its content at the bottom of the page.`,"玩法预设状态已更新。":`Play-preset status updated.`,启用预设:`Enable preset`,停用预设:`Disable preset`,"JavaScript 已停用;raw/document 仍可预览。":`JavaScript is disabled; raw and document content can still be previewed.`,"JavaScript 已显式启用(本地可信代码)。":`JavaScript is explicitly enabled as trusted local code.`,"停用 JavaScript":`Disable JavaScript`,"启用 JavaScript(本地可信代码)":`Enable JavaScript (trusted local code)`,"已复制为独立本地身份。":`Copied as an independent local identity.`,复制为新预设:`Copy as new preset`,导出业务文件:`Export play files`,"玩法预设已删除;删空后会自动重建默认预设。":`The play preset was deleted. Deleting the last preset automatically rebuilds the default.`,删除预设:`Delete preset`,"导入的 JavaScript 默认停用;启用表示你信任这些本地文件,而不是获得安全沙箱保证。":`Imported JavaScript is disabled by default. Enabling it means you trust these local files; it does not provide a security sandbox.`,玩法预设摘要:`Play-preset summary`,后置请求:`Follow-up requests`,产物输出:`Artifact outputs`,界面挂载:`Interface mounts`,普通文件:`Regular files`,玩法预设编辑区域:`Play-preset editing area`,"该玩法文件路径已经存在。":`That play-file path already exists.`,"已加入普通文件草稿;保存时会通过 codec 校验。":`The regular file was added to the draft and will be validated by the codec when saved.`,结构化编辑暂不可用:`Structured editing is unavailable`,"当前草稿无法生成结构投影。请到“高级文件”修复 preset.yaml 或 call-chain.yaml,保存后再回来。":`The current draft cannot produce a structured projection. Repair preset.yaml or call-chain.yaml under Advanced files, save, and return here.`,前往高级文件:`Go to Advanced files`,预览当前预设:`Preview current preset`,"产物外观与真实调用链提示词都留在这里检查,不会调用模型或离开当前预设。":`Inspect artifact appearance and real call-chain prompts here without calling a model or leaving the current preset.`,"正在生成真实编译/产物预览…":`Generating real compilation and artifact previews…`,工作台静态错误:`Workbench static error`,当前预设的真实提示词预览:`Real prompt preview for the current preset`,真实调用链预览:`Real call-chain preview`,"请先保存当前修改;真实预览只编译已冻结的有效 revision。":`Save the current changes first. A real preview compiles only a frozen valid revision.`,"当前 revision 需要修复,暂时不能编译真实调用链。":`The current revision needs repair and cannot compile a real call chain yet.`,"当前宿主没有提供提示词预览面板。":`The current host does not provide a Prompt Preview panel.`,"preset.yaml/call-chain.yaml 与结构化字段均有未保存修改;请撤销其中一侧后再保存,避免 stale structure 覆盖 raw YAML。":`preset.yaml/call-chain.yaml and structured fields both have unsaved changes. Discard one side before saving so stale structure cannot overwrite raw YAML.`,草稿尚未保存:`Draft not saved`,结构校验通过:`Structure validation passed`,草稿需要修复:`Draft needs repair`,撤销未保存修改:`Discard unsaved changes`,保存修改:`Save changes`,"已将该冻结 revision 设为当前玩法。":`That frozen revision is now the current play preset.`,应用为当前玩法:`Use as current play preset`,"AI 设定完善":`Setting improvement`,"这份文字决定 AI 怎样理解、规划和创作内容包设定;每次开始完善时会冻结当前预设 revision。":`This text tells the model how to understand, plan, and author content-package settings. Each session freezes the current preset revision.`,"工具为什么不在这里?":`Why are the tools not editable here?`,"Runtime 继续内置 setting_* 工具定义、参数、说明、只读/写入阶段边界和候选终态协议。预设只能编辑创作语义,不能替换这些机械契约。":`Runtime owns the setting_* definitions, parameters, descriptions, read/write phase boundaries, and candidate 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
1031
-
1032
- Describe the rules the model must follow whenever it writes player-visible prose.
1033
- `,"# 新后置请求\n\n说明主调用链完成后,需要额外整理成什么界面内容。\n":`# New follow-up request
1034
-
1035
- Describe the interface content to prepare after the main call chain completes.
1036
- `,新后置请求:`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(k,{"我观察当前场景。":`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 candidate 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 candidates 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(k,{"例如:秦龙的动机再具体一点,别改开场白。":`For example: Make Alex's motivation more specific, but do not change the opening.`,本次生成进度:`Generation progress`,正在生成创作计划:`Generating creation plan`,正在生成候选:`Generating candidate`,第:`Round`,轮:``,"正在建立连接…":`Connecting…`,工具调用:`Tool calls`,自检未通过:`Failed checks`,协议错误:`Protocol errors`,正在写:`Writing`,思考中:`Reasoning`,正文:`Text`,"最近自检:":`Latest check:`,已有:`No output for`,"秒没有收到任何输出,模型调用可能已经卡住。":`seconds; the model call may be stuck.`,"AI 设定完善":`Setting improvement`,"AI 会基于当前树完善设定:可以先只读现有文件并确认计划,也可以直接生成隔离候选。 只有最后整批应用才会替换当前内容包;已有世界不会改变。":`The model can improve the current tree by first reading files and proposing a plan, or by generating an isolated candidate directly. Only applying the whole candidate replaces the content package; existing worlds remain unchanged.`,当前内容包:`Current content package`,正在完善:`Improving`,可用于创建世界:`Ready to create a world`,需要修复:`Needs repair`,设定完善进度:`Setting-improvement progress`,描述目标:`Describe the goal`,说清想获得的体验:`Describe the desired experience`,可选计划:`Optional plan`,只读现有设定后确认方向:`Read the current setting, then confirm direction`,审阅并应用:`Review and apply`,核对完整差异与提示词:`Inspect the complete diff and prompt`,"当前创作会话及直接注入文件已固定。应用或放弃前,手动编辑、上下文选择和内容包切换会暂时停用。":`The current authoring session and directly injected files are frozen. Manual editing, context selection, and content-package switching stay disabled until the candidate is applied or discarded.`,需要先连接模型:`Connect a model first`,"创作计划和候选文件都由当前模型生成。":`The current model generates the creation plan and candidate files.`,配置模型连接:`Configure model connection`,"第 1 步":`Step 1`,"这次想把设定完善成什么样?":`How should this setting be improved?`,"写玩家最终会感受到什么、哪里薄弱、哪些内容不要改。无需描述文件名或技术格式。":`Describe what players should feel, what is weak, and what must not change. You do not need file names or technical formats.`,设定完善目标:`Setting-improvement goal`,"例如:我想让学院生活更有日常节奏。补足室友之间的目标与矛盾,保留轻松基调,不增加数值化好感度,也不要预写未来剧情。":`For example: Give academy life a stronger everyday rhythm. Add goals and conflicts between roommates, keep the light tone, do not add numeric affinity, and do not prewrite future plot.`,目标示例:`Goal examples`,"可以这样写:":`Try one of these:`,"正在生成创作计划…":`Generating creation plan…`,生成可见创作计划:`Generate visible creation plan`,"正在直接生成候选…":`Generating candidate directly…`,"跳过计划,直接生成候选":`Skip plan and generate candidate`,"计划阶段只能读取;直接生成也仍需在最后审阅并整批应用。":`The planning phase is read-only. A directly generated candidate still requires final review and whole-candidate application.`,创作目标已提交:`Authoring goal submitted`,方向已提交:`Direction submitted`,"第 2 步":`Step 2`,"确认 AI 理解的创作方向":`Confirm the model's understanding`,"这里仍然只是计划。AI 已可只读当前树,但确认前不能修改;若方向不对,放弃后修改目标。":`This is still only a plan. The model can read the current tree but cannot modify it before confirmation. If the direction is wrong, discard it and change the goal.`,"正在生成并检查候选…":`Generating and checking candidate…`,确认计划并生成候选:`Confirm plan and generate candidate`,放弃整批候选:`Discard whole candidate`,"让 AI 调整计划":`Ask the model to revise the plan`,"方向不对时不必放弃重来:写下要改什么,AI 会在同一次会话里重出完整计划。":`If the direction is wrong, describe the correction instead of starting over. The model will produce a complete revised plan in the same session.`,"正在重新规划…":`Replanning…`,按意见重出计划:`Regenerate plan from feedback`,创作计划已确认:`Creation plan confirmed`,已确认:`Confirmed`,"第 2 步 · 可选":`Step 2 · optional`,已跳过可见计划:`Visible plan skipped`,"本次按你的目标直接生成候选,仍需审阅完整差异后才能应用。":`This candidate was generated directly from your goal and still requires review of the complete diff before application.`,"AI 的起点":`Model starting point`,当前设定:`Current setting`,个文件:`files`,"计划阶段可通过只读工具查看整棵已保存当前树;勾选的文本文件会额外完整注入首个模型请求。":`Read-only tools can inspect the entire saved tree during planning. Selected text files are additionally injected in full into the first model request.`,手动编辑尚未保存:`Manual edits are not saved`,"这些修改不会进入 AI 候选;请先返回手动编辑并整批保存。":`These changes will not enter the model candidate. Return to manual editing and save the whole draft first.`,当前设定文件统计:`Current setting file counts`,开场白:`Opening text`,世界内容:`World content`,控制文件:`Control files`,"直接注入给 AI":`Inject directly into the model`,"适合指定本次完善必须先看到的核心人物、规则或当前情境。":`Use this for core characters, rules, or the current situation that this session must see first.`,全选文本文件:`Select all text files`,清空注入:`Clear injected files`,"当前内容包还没有文件。":`The current content package has no files.`,筛选文件:`Filter files`,"例如 characters 或 frame":`For example, characters or frame`,当前设定文件:`Current setting files`,"没有匹配的文件。":`No files match.`,开场:`Opening`,世界:`World`,控制:`Control`,二进制:`Binary`,注入:`Inject`,"这是二进制资源,内容不在此处展开。":`This is a binary resource; its content is not expanded here.`,"第 3 步":`Step 3`,"审阅候选,再决定是否应用":`Review the candidate before applying`,机械检查通过:`Mechanical checks passed`,候选需要修复:`Candidate needs repair`,候选摘要:`Candidate summary`,文件变化:`File changes`,新建:`Create`,修改:`Update`,删除:`Delete`,机械检查诊断:`Mechanical-check diagnostics`,完整文件差异:`Complete file diff`,"逐个展开检查;这里显示的就是整批应用将替换的内容。":`Expand each item to inspect exactly what applying the whole candidate will replace.`,"AI 没有改动任何文件。":`The model did not change any files.`,应用前:`Before`,应用后:`After`,这是一次整批替换:`This is a whole-candidate replacement`,"不能只勾选部分文件。放弃会丢弃整个隔离候选,当前内容包保持不变。":`Individual files cannot be selected. Discarding removes the entire isolated candidate and leaves the current content package unchanged.`,"正在整批应用…":`Applying whole candidate…`,整批应用候选:`Apply whole candidate`,"正在放弃…":`Discarding…`,"让 AI 继续改这份候选":`Ask the model to revise this candidate`,"只有一两处不满意时不必整批放弃:写下要改什么,AI 会在当前候选上接着改,已经对的部分保留。":`If only a few parts are wrong, describe the corrections instead of discarding everything. The model will continue from the current candidate and preserve what already works.`,"正在修改候选…":`Revising candidate…`,按意见继续修改:`Continue revision from feedback`,真实提示词预览:`Real Prompt Preview`,"候选已通过和真实请求同源的编译检查。":`The candidate passed the same compilation checks used by a real request.`,无内部字段泄漏:`No internal-field leakage`,模型:`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`}),Object.assign(k,{可视化编排:`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(k,{衣着:`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…`,"模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。":`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…`,"修改已保存,但模型请求中断;点击“追加上下文”即可原样重发。":`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.`,"世界名称已保存。":`World name saved.`,"← 返回工作区":`← Back to workspace`,"正在打开世界…":`Opening world…`,工作区:`Workspace`,正在游玩的世界:`World in play`,世界概况:`World overview`,条已提交消息:`committed messages`,模型调用中:`Model call in progress`,调用链已中断:`Call chain interrupted`,世界已保存:`World saved`,世界页面:`World page`,游玩:`Play`,当前文档:`Current documents`,已提交叙事:`Committed narrative`,世界管理:`World management`,世界游玩:`World play`,故事:`Story`,模型响应中:`Model responding`,调用链记录:`Call-chain record`,全新上下文从这里开始:`A new context begins here`,故事还没有开始:`The story has not started`,"描述你的行动,从当前世界开始一条调用链。":`Describe your action to start a call chain from the current world.`,"需要先配置模型连接才能游玩。":`Configure a model connection before playing.`,配置模型:`Configure model`,"上次模型请求没有完整返回。保持输入框为空并点击“追加上下文”,就会原样发送已保存的请求;不会追加玩家指令,中断片段也不会进入模型上下文。":`The previous model request did not return completely. Leave the input empty and append context to resend the saved request unchanged. No player instruction is appended, and the interrupted fragment does not enter model context.`,你的行动:`Your action`,"描述你的行动;也可以留空并追加,让 AI 沿现有上下文续写…":`Describe your action, or leave it blank and append to let the model continue from existing context…`,"Ctrl / ⌘ + Enter 追加;没有上下文时自动全新开始":`Ctrl / ⌘ + Enter appends; without context it starts a new one`,"正在开始…":`Starting…`,全新上下文:`New context`,"正在追加…":`Appending…`,追加上下文:`Append context`,玩家视图:`Player view`,当前情景:`Current situation`,"这个世界还没有配置常驻玩家视图。":`This world has no persistent player view configured.`,"你仍然可以正常游玩;未显示不代表秘密。":`You can still play normally; not being shown does not make something secret.`,项视图诊断:`view diagnostics`,份世界状态文件:`world-state files`,"当前世界没有状态文档。":`The current world has no state documents.`,"这里只显示已经进入世界权威的玩家与主持原文。":`Only original player and host messages committed into world authority appear here.`,"尚无已提交叙事。":`No committed narrative yet.`,"这些操作位于故事之外;它们不会被普通游玩 AI 擅自执行。":`These actions happen outside the story and cannot be performed unprompted by the regular play model.`,世界名称:`World name`,"这是工作区和世界页显示的名字;修改它不会改动故事、状态或历史。":`This name appears in the workspace and world page. Changing it does not alter story, state, or history.`,世界显示名称:`World display name`,"正在保存…":`Saving…`,保存名称:`Save name`,从此刻创建分叉:`Fork from this point`,"复制当前状态和截至此刻的已提交叙事,得到一个完全独立的新世界。":`Copy current state and committed narrative through this point into a completely independent world.`,"正在创建…":`Creating…`,创建分叉:`Create fork`,世界控制:`World control`,"编辑主持框架和玩家视图。草稿必须先通过真实提示词预览,再整批应用。":`Edit the host frame and player views. The draft must pass a real Prompt Preview before it can be applied as a whole.`,有尚未预览的修改:`Changes have not been previewed`,当前已应用控制:`Current control applied`,"模型调用尚未返回;完成或中断后才能应用新控制。":`The model call has not returned. New control can be applied after it completes or is interrupted.`,"世界控制文件(JSON)":`World-control files (JSON)`,世界控制文件:`World-control files`,"正在预览…":`Previewing…`,预览世界控制:`Preview world control`,"正在应用…":`Applying…`,整批应用世界控制:`Apply all world-control changes`,查看真实提示词预览结果:`View real Prompt Preview result`,连续性修正:`Continuity correction`,"在故事之外修正当前文档。修正会追加一笔新提交,不会改写旧叙事。":`Correct current documents outside the story. A correction appends a new commit and does not rewrite earlier narrative.`,要修正的文档:`Document to correct`,"YAML 路径":`YAML path`,"例如:衣着 或 关系.秦龙.好感":`For example: clothing or relationships.Alex.trust`,新值:`New value`,修正后的新值:`Corrected value`,预览整笔修正:`Preview complete correction`,取消修正草稿:`Cancel correction draft`,运行详情:`Runtime details`,"用于排查本地恢复问题,不参与普通游玩。":`Used to diagnose local recovery issues; not part of normal play.`,当前端点:`Current endpoint`,"世界 ID":`World ID`,"查看 Runtime 原始诊断":`View raw Runtime diagnostics`,你:`You`,主持:`Host`,未结算:`Unsettled`,模型调用链:`Model call chain`,本上下文已提交的世界变化:`World changes committed in this context`,没有文档变化:`No document changes`,新建:`Create`,更新:`Update`,玩家:`Player`,修改:`Edit`,修改后的行动:`Edited action`,"修改会直接保存在当前世界;这条原提交及其后的内容会离开当前时间线,但旧 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.`,保存修改并继续:`Save edit and continue`,取消:`Cancel`,"AI 响应":`Model response`,"· 第":`· dispatch`,次派发:``,模型思维链:`Model reasoning`,默认折叠:`Collapsed by default`,"正在接收模型输出…":`Receiving model output…`,"(本次响应没有文本)":`(This response has no text)`,正在接收的工具调用片段:`Incoming tool-call fragments`,"Provider usage:输入":`Provider usage: input`,"· 输出":`· output`,调用:`Call`,"复用同 ID 结果":`Reused result with same ID`,返回:`Result`,成功:`Success`,"拒绝/失败":`Rejected / failed`,"后置请求 ·":`Follow-up request ·`,未完成:`Incomplete`,调用链中断:`Call chain interrupted`,等待玩家追加:`Waiting for player append`,上下文已结束:`Context ended`,接收中:`Receiving`,中断片段:`Interrupted fragment`,已完成:`Complete`,"[参数无法序列化]":`[Arguments could not be serialized]`,"当前没有可显示项目。":`There are no items to display.`,"[无法显示]":`[Unable to display]`,操作失败:`Operation failed`}),Object.assign(k,{开场:`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:
1037
- id: character.example
1038
- ref: example
1039
- title: Example character
1040
- summary: A one-sentence stable summary.
1041
- aliases: []
1042
- `,"---\n$document:\n id: rule.example\n ref: example\n title: 示例规则\n summary: 一句话稳定简介。\n aliases: []\n---\n\n# 示例规则\n":`---
1043
- $document:
1044
- id: rule.example
1045
- ref: example
1046
- title: Example rule
1047
- summary: A one-sentence stable summary.
1048
- aliases: []
1049
- ---
1050
-
1051
- # Example rule
1052
- `,"{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`,结束候选:`Finish candidate`,"第 {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)`});function ne(e){if(!te(e))throw Error(`Unsupported web locale`);O=e,typeof document<`u`&&(document.documentElement.lang=e)}function re(){return O}function A(e,t={}){return(O===`zh-CN`?e:k[e]??e).replace(/\{([A-Za-z][A-Za-z0-9]*)\}/gu,(e,n)=>n in t?String(t[n]):e)}var ie=Symbol.for(`yaml.alias`),j=Symbol.for(`yaml.document`),M=Symbol.for(`yaml.map`),N=Symbol.for(`yaml.pair`),P=Symbol.for(`yaml.scalar`),ae=Symbol.for(`yaml.seq`),F=Symbol.for(`yaml.node.type`),I=e=>!!e&&typeof e==`object`&&e[F]===ie,L=e=>!!e&&typeof e==`object`&&e[F]===j,oe=e=>!!e&&typeof e==`object`&&e[F]===M,R=e=>!!e&&typeof e==`object`&&e[F]===N,z=e=>!!e&&typeof e==`object`&&e[F]===P,se=e=>!!e&&typeof e==`object`&&e[F]===ae;function B(e){if(e&&typeof e==`object`)switch(e[F]){case M:case ae:return!0}return!1}function V(e){if(e&&typeof e==`object`)switch(e[F]){case ie:case M:case P:case ae:return!0}return!1}var ce=e=>(z(e)||B(e))&&!!e.anchor,H=Symbol(`break visit`),le=Symbol(`skip children`),ue=Symbol(`remove node`);function U(e,t){let n=fe(t);L(e)?de(null,e.contents,n,Object.freeze([e]))===ue&&(e.contents=null):de(null,e,n,Object.freeze([]))}U.BREAK=H,U.SKIP=le,U.REMOVE=ue;function de(e,t,n,r){let i=pe(e,t,n,r);if(V(i)||R(i))return me(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(B(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===H)return H;else i===ue&&(t.items.splice(e,1),--e)}}else if(R(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===H)return H;e===ue&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===H)return H;i===ue&&(t.value=null)}}return i}function fe(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 pe(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(oe(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(R(t))return n.Pair?.(e,t,r);if(z(t))return n.Scalar?.(e,t,r);if(I(t))return n.Alias?.(e,t,r)}function me(e,t,n){let r=t[t.length-1];if(B(r))r.items[e]=n;else if(R(r))e===`key`?r.key=n:r.value=n;else if(L(r))r.contents=n;else{let e=I(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var he={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ge=e=>e.replace(/[!,[\]{}]/g,e=>he[e]),_e=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+ge(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&&V(e.contents)){let t={};U(e.contents,(e,n)=>{V(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(`
1053
- `)}};_e.defaultYaml={explicit:!1,version:`1.2`},_e.defaultTags={"!!":`tag:yaml.org,2002:`};function ve(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 ye(e){let t=new Set;return U(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function be(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xe(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ye(e);let a=be(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(z(t.node)||B(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 Se(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=Se(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=Se(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=Se(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=Se(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Ce(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Ce(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(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 we=class{constructor(e){Object.defineProperty(this,F,{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(!L(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=Ce(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Se(i,{"":o},``,o):o}},Te=class extends we{constructor(e){super(ie),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=[],U(e,{Node:(e,t)=>{(I(t)||ce(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||=(Ce(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=Ee(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(ve(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 Ee(e,t,n){if(I(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(B(t)){let r=0;for(let i of t.items){let t=Ee(e,i,n);t>r&&(r=t)}return r}if(R(t)){let r=Ee(e,t.key,n),i=Ee(e,t.value,n);return Math.max(r,i)}return 1}var De=e=>!e||typeof e!=`function`&&typeof e!=`object`,W=class extends we{constructor(e){super(P),this.value=e}toJSON(e,t){return t?.keep?this.value:Ce(this.value,e,t)}toString(){return String(this.value)}};W.BLOCK_FOLDED=`BLOCK_FOLDED`,W.BLOCK_LITERAL=`BLOCK_LITERAL`,W.PLAIN=`PLAIN`,W.QUOTE_DOUBLE=`QUOTE_DOUBLE`,W.QUOTE_SINGLE=`QUOTE_SINGLE`;var Oe=`tag:yaml.org,2002:`;function ke(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 G(e,t,n){if(L(e)&&(e=e.contents),V(e))return e;if(R(e)){let t=n.schema[M].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 Te(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Oe+t.slice(2));let l=ke(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new W(e);return c&&(c.node=t),t}l=e instanceof Map?o[M]:Symbol.iterator in Object(e)?o[ae]:o[M]}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 W(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(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 G(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends we{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=>V(t)||R(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(B(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(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(B(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&&z(i)?i.value:i:B(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!R(t))return!1;let n=t.value;return n==null||e&&z(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 B(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(B(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Pe(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Fe=(e,t,n)=>e.endsWith(`
1054
- `)?Pe(n,t):n.includes(`
1055
- `)?`
1056
- `+Pe(n,t):(e.endsWith(` `)?``:` `)+n,Ie=`flow`,Le=`block`,Re=`quoted`;function ze(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=Be(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===`
1057
- `)n===`block`&&(h=Be(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
1058
- `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
1059
- `&&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 Be(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!==`
1060
- `);r=t,i=t+1,a=e[i]}return r}var Ve=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),He=e=>/^(%|---|\.\.\.)/m.test(e);function Ue(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]===`
1061
- `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function We(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(He(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)+`
1062
-
1063
- `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
1064
- `,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:ze(o,a,Re,Ve(t,!1))}function Ge(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
1065
- `)||/[ \t]\n|\n[ \t]/.test(e))return We(e,t);let n=t.indent||(He(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:ze(r,n,Ie,Ve(t,!1))}function Ke(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=We;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Ge:i&&!t?We:n?Ge:We}return r(e,t)}var qe;try{qe=RegExp(`(^|(?<!
1066
- ))
1067
- +(?!
1068
- |$)`,`g`)}catch{qe=/\n+(?!\n|$)/g}function Je({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 Ke(n,r);let l=r.indent||(r.forceBlockIndent||He(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===W.BLOCK_FOLDED?!1:t===W.BLOCK_LITERAL||!Ue(n,c,l.length);if(!n)return u?`|
1069
- `:`>
1070
- `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
1071
- `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
1072
- `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
1073
- `&&(p=p.slice(0,-1)),p.replace(qe,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
1074
- `)_=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,`
1075
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Ve(r,!0);o!==`folded`&&t!==W.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=ze(`${v}${e}${p}`,l,Le,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Ye(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(`
1076
- `)||u&&/[[\]{},]/.test(a))return Ke(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
1077
- `)?Ke(a,t):Je(e,t,n,r);if(!s&&!u&&i!==W.PLAIN&&a.includes(`
1078
- `))return Je(e,t,n,r);if(He(a)){if(c===``)return t.forceBlockIndent=!0,Je(e,t,n,r);if(s&&c===l)return Ke(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 Ke(a,t)}return s?d:ze(d,c,Ie,Ve(t,!1))}function Xe(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!==W.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=W.QUOTE_DOUBLE);let c=e=>{switch(e){case W.BLOCK_FOLDED:case W.BLOCK_LITERAL:return i||a?Ke(o.value,t):Je(o,t,n,r);case W.QUOTE_DOUBLE:return We(o.value,t);case W.QUOTE_SINGLE:return Ge(o.value,t);case W.PLAIN:return Ye(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 Ze(e,t){let n=Object.assign({blockQuote:!0,commentString:Ne,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 Qe(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(z(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 $e(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(z(e)||B(e))&&e.anchor;a&&ve(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 et(e,t,n,r){if(R(e))return e.toString(t,n,r);if(I(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=V(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Qe(t.doc.schema.tags,a);let o=$e(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):z(a)?Xe(a,t,n,r):a.toString(t,n,r);return o?z(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function tt({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=V(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(B(e)||!V(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||B(e)||(z(e)?e.type===W.BLOCK_FOLDED||e.type===W.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=et(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+=Fe(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Fe(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Fe(g,n.indent,l(f))));let _,v,y;V(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&&z(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&se(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=et(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
1079
- `:``,v){let e=l(v);S+=`\n${Pe(e,n.indent)}`}x===``&&!n.inFlow?S===`
1080
- `&&y&&(S=`
1081
-
1082
- `):S+=`\n${n.indent}`}else if(!p&&B(t)){let e=x[0],r=x.indexOf(`
1083
- `),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]===`
1084
- `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=Fe(g,n.indent,l(y)):h&&i&&i(),g}function nt(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var rt=`<<`,it={identify:e=>e===rt||typeof e==`symbol`&&e.description===rt,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new W(Symbol(rt)),{addToJSMap:ot}),stringify:()=>rt},at=(e,t)=>(it.identify(t)||z(t)&&(!t.type||t.type===W.PLAIN)&&it.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===it.tag&&e.default);function ot(e,t,n){let r=ct(e,n);if(se(r))for(let n of r.items)st(e,t,n);else if(Array.isArray(r))for(let n of r)st(e,t,n);else st(e,t,r)}function st(e,t,n){let r=ct(e,n);if(!oe(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 ct(e,t){return e&&I(t)?t.resolve(e.doc,e):t}function lt(e,t,{key:n,value:r}){if(V(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(at(e,n))ot(e,t,r);else{let i=Ce(n,``,e);if(t instanceof Map)t.set(i,Ce(r,i,e));else if(t instanceof Set)t.add(i);else{let a=ut(n,i,e),o=Ce(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ut(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(V(e)&&n?.doc){let t=Ze(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)+`..."`),nt(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 dt(e,t,n){return new K(G(e,void 0,n),G(t,void 0,n))}var K=class e{constructor(e,t=null){Object.defineProperty(this,F,{value:N}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return V(n)&&(n=n.clone(t)),V(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return lt(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?tt(this,e,t,n):JSON.stringify(this)}};function ft(e,t,n){return(t.inFlow??e.flow?mt:pt)(e,t,n)}function pt({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(V(i))!d&&i.spaceBefore&&f.push(``),ht(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(R(i)){let e=V(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ht(n,f,e.commentBefore,d))}d=!1;let s=et(i,u,()=>o=null,()=>d=!0);o&&(s+=Fe(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}`:`
1085
- `}}return e?(p+=`
1086
- `+Pe(l(e),c),s&&s()):d&&o&&o(),p}function mt({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(V(i))i.spaceBefore&&d.push(``),ht(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(R(i)){let e=V(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),ht(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=V(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=et(i,c,()=>a=null);l||=d.length>u||o.includes(`
1087
- `),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+=Fe(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}`:`
1088
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function ht({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Pe(t(r),e);n.push(i.trimStart())}}function gt(e,t){let n=z(t)?t.value:t;for(let r of e)if(R(r)&&(r.key===t||r.key===n||z(r.key)&&r.key.value===n))return r}var _t=class extends Me{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(M,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(dt(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=R(e)?e:!e||typeof e!=`object`||!(`key`in e)?new K(e,e?.value):new K(e.key,e.value);let r=gt(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);z(r.value)&&De(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=gt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=gt(this.items,e)?.value;return(!t&&z(n)?n.value:n)??void 0}has(e){return!!gt(this.items,e)}set(e,t){this.add(new K(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)lt(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!R(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})),ft(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},vt={collection:`map`,default:!0,nodeClass:_t,tag:`tag:yaml.org,2002:map`,resolve(e,t){return oe(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>_t.from(e,t,n)},yt=class extends Me{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(ae,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=bt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=bt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&z(r)?r.value:r}has(e){let t=bt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=bt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];z(r)&&De(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(Ce(e,String(r++),t));return n}toString(e,t,n){return e?ft(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(G(a,void 0,n))}}return i}};function bt(e){let t=z(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var xt={collection:`seq`,default:!0,nodeClass:yt,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return se(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>yt.from(e,t,n)},St={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),Xe(e,t,n,r)}},Ct={identify:e=>e==null,createNode:()=>new W(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new W(null),stringify:({source:e},t)=>typeof e==`string`&&Ct.test.test(e)?e:t.options.nullStr},wt={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new W(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&wt.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Tt({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 Et={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:Tt},Dt={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():Tt(e)}},Ot={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 W(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Tt},kt=e=>typeof e==`bigint`||Number.isInteger(e),At=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function jt(e,t,n){let{value:r}=e;return kt(r)&&r>=0?n+r.toString(t):Tt(e)}var Mt={identify:e=>kt(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>At(e,2,8,n),stringify:e=>jt(e,8,`0o`)},Nt={identify:kt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>At(e,0,10,n),stringify:Tt},Pt={identify:e=>kt(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>At(e,2,16,n),stringify:e=>jt(e,16,`0x`)},Ft=[vt,xt,St,Ct,wt,Mt,Nt,Pt,Et,Dt,Ot];function It(e){return typeof e==`bigint`||Number.isInteger(e)}var Lt=({value:e})=>JSON.stringify(e),Rt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Lt},{identify:e=>e==null,createNode:()=>new W(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Lt},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Lt},{identify:It,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})=>It(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:Lt}],zt=[vt,xt].concat(Rt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Bt={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??=W.BLOCK_LITERAL,t!==W.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===W.BLOCK_LITERAL?`
1089
- `:` `)}return Xe({comment:e,type:t,value:s},r,i,a)}};function Vt(e,t){if(se(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!R(r)){if(oe(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new K(new W(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]=R(r)?r:new K(r)}}else t(`Expected a sequence for this tag`);return e}function Ht(e,t,n){let{replacer:r}=n,i=new yt(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(dt(o,s,n))}return i}var Ut={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Vt,createNode:Ht},Wt=class e extends yt{constructor(){super(),this.add=_t.prototype.add.bind(this),this.delete=_t.prototype.delete.bind(this),this.get=_t.prototype.get.bind(this),this.has=_t.prototype.has.bind(this),this.set=_t.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(R(e)?(r=Ce(e.key,``,t),i=Ce(e.value,r,t)):r=Ce(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=Ht(e,t,n),i=new this;return i.items=r.items,i}};Wt.tag=`tag:yaml.org,2002:omap`;var Gt={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Wt,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Vt(e,t),r=[];for(let{key:e}of n.items)z(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Wt,n)},createNode:(e,t,n)=>Wt.from(e,t,n)};function Kt({value:e,source:t},n){return t&&(e?qt:Jt).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var qt={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 W(!0),stringify:Kt},Jt={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 W(!1),stringify:Kt},Yt={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:Tt},Xt={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():Tt(e)}},Zt={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 W(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:Tt},Qt=e=>typeof e==`bigint`||Number.isInteger(e);function $t(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 en(e,t,n){let{value:r}=e;if(Qt(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Tt(e)}var tn={identify:Qt,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>$t(e,2,2,n),stringify:e=>en(e,2,`0b`)},nn={identify:Qt,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>$t(e,1,8,n),stringify:e=>en(e,8,`0`)},rn={identify:Qt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>$t(e,0,10,n),stringify:Tt},an={identify:Qt,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>$t(e,2,16,n),stringify:e=>en(e,16,`0x`)},on=class e extends _t{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=R(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new K(e.key,null):new K(e,null),gt(this.items,t.key)||this.items.push(t)}get(e,t){let n=gt(this.items,e);return!t&&R(n)?z(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=gt(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new K(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(dt(e,null,n));return i}};on.tag=`tag:yaml.org,2002:set`;var sn={collection:`map`,identify:e=>e instanceof Set,nodeClass:on,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>on.from(e,t,n),resolve(e,t){if(oe(e)){if(e.hasAllNullValues(!0))return Object.assign(new on,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function cn(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 ln(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Tt(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 un={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})=>cn(e,n),stringify:ln},dn={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=>cn(e,!1),stringify:ln},fn={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(fn.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=cn(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$/,``)??``},pn=[vt,xt,St,Ct,qt,Jt,tn,nn,rn,an,Yt,Xt,Zt,Bt,it,Gt,Ut,sn,un,dn,fn],mn=new Map([[`core`,Ft],[`failsafe`,[vt,xt,St]],[`json`,zt],[`yaml11`,pn],[`yaml-1.1`,pn]]),hn={binary:Bt,bool:wt,float:Ot,floatExp:Dt,floatNaN:Et,floatTime:dn,int:Nt,intHex:Pt,intOct:Mt,intTime:un,map:vt,merge:it,null:Ct,omap:Gt,pairs:Ut,seq:xt,set:sn,timestamp:fn},gn={"tag:yaml.org,2002:binary":Bt,"tag:yaml.org,2002:merge":it,"tag:yaml.org,2002:omap":Gt,"tag:yaml.org,2002:pairs":Ut,"tag:yaml.org,2002:set":sn,"tag:yaml.org,2002:timestamp":fn};function _n(e,t,n){let r=mn.get(t);if(r&&!e)return n&&!r.includes(it)?r.concat(it):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(mn.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(it)),i.reduce((e,t)=>{let n=typeof t==`string`?hn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(hn).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 vn=(e,t)=>e.key<t.key?-1:+(e.key>t.key),yn=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?_n(e,`compat`):e?_n(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?gn:{},this.tags=_n(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,M,{value:vt}),Object.defineProperty(this,P,{value:St}),Object.defineProperty(this,ae,{value:xt}),this.sortMapEntries=typeof a==`function`?a:a===!0?vn:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function bn(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=Ze(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Pe(t,``))}let o=!1,s=null;if(e.contents){if(V(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Pe(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=et(e.contents,i,()=>s=null,t);s&&(c+=Fe(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(et(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
1090
- `)?(n.push(`...`),n.push(Pe(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(Pe(a(t),``)))}return n.join(`
1091
- `)+`
1092
- `}var xn=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,F,{value:j});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 _e({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[F]:{value:j}});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=V(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Sn(this.contents)&&this.contents.add(e)}addIn(e,t){Sn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=ye(this);e.anchor=!t||n.has(t)?be(t||`a`,n):t}return new Te(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}=xe(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=G(e,l,p);return o&&B(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new K(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Sn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return je(e)?this.contents!=null&&(this.contents=null,!0):Sn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return B(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return je(e)?!t&&z(this.contents)?this.contents.value:this.contents:B(this.contents)?this.contents.getIn(e,t):void 0}has(e){return B(this.contents)?this.contents.has(e):!1}hasIn(e){return je(e)?this.contents!==void 0:B(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ae(this.schema,[e],t):Sn(this.contents)&&this.contents.set(e,t)}setIn(e,t){je(e)?this.contents=t:this.contents==null?this.contents=Ae(this.schema,Array.from(e),t):Sn(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 _e({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 _e({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 yn(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=Ce(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`?Se(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 bn(this,e)}};function Sn(e){if(B(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Cn=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},wn=class extends Cn{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Tn=class extends Cn{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},En=(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)+`…
1093
- `),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 Dn(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 On(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
1094
- `))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(On(t.key)||On(t.value))return!0}return!1;default:return!0}}function kn(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&On(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function An(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||z(e)&&z(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var jn=`All mapping items must start at the same column`;function Mn({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??_t)(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=Dn(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`,jn)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
1095
- `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||On(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`,jn);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&kn(r.indent,u,i),n.atKey=!1,An(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Dn(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&&kn(r.indent,f,i),s=c.range[2];let l=new K(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+=`
1096
- `+_.comment:g.comment=_.comment);let e=new K(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 Nn({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??yt)(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=Dn(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&&kn(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Pn(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 Fn=`Block collections are not allowed within flow collections`,In=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Ln({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?_t:yt))(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=Dn(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+=`
1097
- `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&On(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];R(t)&&(t=t.value??t.key),t.comment?t.comment+=`
1098
- `+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],In(m)&&i(r.range,`BLOCK_IN_FLOW`,Fn)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);In(f)&&i(g.range,`BLOCK_IN_FLOW`,Fn),n.atKey=!1;let _=Dn(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?In(m)&&i(v.range,`BLOCK_IN_FLOW`,Fn):_.comment&&(g.comment?g.comment+=`
1099
- `+_.comment:g.comment=_.comment);let y=new K(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;An(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new _t(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=Pn(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
1100
- `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Rn(e,t,n,r,i,a){let o=n.type===`block-map`?Mn(e,t,n,r,a):n.type===`block-seq`?Nn(e,t,n,r,a):Ln(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function zn(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===_t.tagName&&s===`map`||o===yt.tagName&&s===`seq`)return Rn(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),Rn(e,t,n,i,o)}let l=Rn(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=V(u)?u:new W(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Bn(e,t,n){let r=t.offset,i=Vn(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?W.BLOCK_FOLDED:W.BLOCK_LITERAL,o=t.source?Hn(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?`
1101
- `.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)+`
1102
- `;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===W.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
1103
- `):t.length>c||r[0]===` `?(f===` `?f=`
1104
- `:!p&&f===`
1105
- `&&(f=`
1106
-
1107
- `),d+=f+t.slice(c)+r,f=`
1108
- `,p=!0):r===``?f===`
1109
- `?d+=`
1110
- `:f=`
1111
- `:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
1112
- `+o[e][0].slice(c);d[d.length-1]!==`
1113
- `&&(d+=`
1114
- `);break;default:d+=`
1115
- `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Vn({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 Hn(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 Un(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=W.PLAIN,c=Wn(a,l);break;case`single-quoted-scalar`:s=W.QUOTE_SINGLE,c=Gn(a,l);break;case`double-quoted-scalar`:s=W.QUOTE_DOUBLE,c=qn(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=Pn(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Wn(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}`),Kn(e)}function Gn(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Kn(e.slice(1,-1)).replace(/''/g,`'`)}function Kn(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
1116
- `,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
1117
- `,`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===`
1118
- `?i+=a:a=`
1119
- `:(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 qn(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
1120
- `){if(i===`
1121
- `){let{fold:t,offset:i}=Jn(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Yn[i];if(a)n+=a;else if(i===`
1122
- `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
1123
- `)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+=Xn(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!==`
1124
- `&&(a!==`\r`||e[r+2]!==`
1125
- `)&&(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 Jn(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
1126
- `||r===`\r`)&&(r!==`\r`||e[t+2]===`
1127
- `);)r===`
1128
- `&&(n+=`
1129
- `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Yn={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
1130
- `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Xn(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 Zn(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Bn(e,t,r):Un(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[P]:c?Qn(e.schema,i,c,n,r):t.type===`scalar`?$n(e,i,t,r):e.schema[P];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=z(a)?a:new W(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new W(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 Qn(e,t,n,r,i){if(n===`!`)return e[P];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[P])}function $n({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[P];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[P];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 er(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 tr={composeNode:nr,composeEmptyNode:rr};function nr(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=ir(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=Zn(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=zn(tr,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??=rr(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&&(!z(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 rr(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Zn(e,{type:`scalar`,offset:er(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 ir({options:e},{offset:t,source:n,end:r},i){let a=new Te(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=Pn(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function ar(e,t,{offset:n,start:r,value:i,end:a},o){let s=new xn(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Dn(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?nr(c,i,l,o):rr(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Pn(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function or(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 sr(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?`
1131
-
1132
- `:`
1133
- `)+(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 cr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=or(e);r?this.warnings.push(new Tn(i,t,n)):this.errors.push(new wn(i,t,n))},this.directives=new _e({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=sr(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(B(i)&&!i.flow&&i.items.length>0){let e=i.items[0];R(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:sr(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=or(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=ar(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 wn(or(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 wn(or(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Pn(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 wn(or(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 xn(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}}},lr=Symbol(`break visit`),ur=Symbol(`skip children`),dr=Symbol(`remove item`);function fr(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),pr(Object.freeze([]),e,t)}fr.BREAK=lr,fr.SKIP=ur,fr.REMOVE=dr,fr.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},fr.parentCollection=(e,t)=>{let n=fr.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 pr(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=pr(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===lr)return lr;else r===dr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function mr(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`
1134
- `:case`\r
1135
- `: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 hr(e){switch(e){case void 0:case` `:case`
1136
- `:case`\r`:case` `:return!0;default:return!1}}var gr=new Set(`0123456789ABCDEFabcdef`),_r=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),vr=new Set(`,[]{}`),yr=new Set(` ,[]{}
1137
- \r `),br=e=>!e||yr.has(e),xr=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===`
1138
- `||t===`\r`&&this.buffer[e+1]===`
1139
- `}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===`
1140
- `||!t&&!this.atEnd)return e+n+1}return t===`
1141
- `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&hr(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(`
1142
- `,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===`...`)&&hr(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&&!hr(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===`:`)&&hr(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(br),`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(`...`))&&hr(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(br),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||hr(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(`
1143
- `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
1144
- `,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=>hr(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`
1145
- `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
1146
- `)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(`
1147
- `,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===`
1148
- `;)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===`
1149
- `&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(hr(r)||e&&vr.has(r))break;t=n}else if(hr(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
1150
- `?(n+=1,r=`
1151
- `,i=this.buffer[n+1]):t=n),i===`#`||e&&vr.has(i))break;if(r===`
1152
- `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&vr.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(br),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(hr(n)||t&&vr.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(;!hr(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(_r.has(t))t=this.buffer[++e];else if(t===`%`&&gr.has(this.buffer[e+1])&&gr.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===`
1153
- `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
1154
- `?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)}},Sr=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 Cr(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function wr(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 Tr(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 Er(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 Dr(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 Or(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 kr(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Cr(t.start,`explicit-key-ind`)&&!Cr(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Tr(t.value)?t.value.end?Or(t.value.end,t.sep):t.value.end=t.sep:Or(t.start,t.sep),delete t.sep)}var Ar=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 xr,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=mr(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&kr(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&&wr(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`:wr(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=Dr(Er(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(`
1155
- `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1156
- `,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)){Or(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(Cr(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Dr(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(Cr(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(Tr(t.key)&&!Cr(t.sep,`newline`)){let e=Dr(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]}):Cr(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&&!Cr(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)){Or(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||Cr(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=Dr(Er(t));kr(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(`
1157
- `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
1158
- `,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=Dr(Er(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=Dr(Er(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 jr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Sr||null,prettyErrors:t}}function Mr(e,t={}){let{lineCounter:n,prettyErrors:r}=jr(t),i=new Ar(n?.addNewLine),a=new cr(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 wn(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(En(e,n)),o.warnings.forEach(En(e,n))),o}function Nr(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Mr(e,n);if(!i)return null;if(i.warnings.forEach(e=>nt(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 Pr(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 L(e)&&!r?e.toString(n):new xn(e,r,n).toString(n)}var Fr=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})),q=e(((e,t)=>{t.exports=Fr()}))(),Ir=`narraeon.world-frame/v1`;function Lr(e){return`@${e.ref}`}function Rr(e,t){return t.startsWith(`@`)?e.find(({ref:e})=>e===t.slice(1)):e.find(({id:e})=>e===t)}function zr(e,t){let n=e=>{if(typeof e!=`string`||e.length===0)return;let n=Rr(t,e);return n===void 0?void 0:Lr(n)};if(vi(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(!vi(t)||!vi(t.slot))continue;let e=n(t.slot.document);if(e!==void 0&&(t.slot.document=e),!vi(t.slot.from))continue;let r=n(t.slot.from.document);r!==void 0&&(t.slot.from.document=r)}}var Br=[{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 Vr({contents:e,files:t,dirty:n,onChange:r,onSave:i}){let a=(0,l.useMemo)(()=>Xr(e),[e]),o=(0,l.useMemo)(()=>$r(t),[t]),s=(0,l.useMemo)(()=>ei(t),[t]),c=(0,l.useMemo)(()=>ti(o),[o]),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(`document`),m=a.value,h=m===null?null:Zr(m),g=m===null?null:Qr(m),_=m!==null&&vi(m.bindings)?_i(m.bindings.currentSituation):``,v=Rr(o,_),y=s.filter(({path:e})=>!h?.some(t=>t.markdown===e)),b=y.some(({path:e})=>e===u)?u:y[0]?.path??``,x=pi(g,`current_situation`),S=pi(g,`additional_materials`),C=m!==null&&h!==null&&g!==null,w=ui(f,o,c),T=e=>{if(m===null)return;let t=structuredClone(m);e(t),zr(t,o),r(Pr(t,{lineWidth:0}))},ee=e=>{T(t=>{t.instructions=e})},E=e=>{T(t=>{t.context=e})},D=e=>{if(g===null)return;let t={slot:{kind:e}};E(e===`current_situation`?[t,...g]:[...g,t])};return(0,q.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,q.jsxs)(`header`,{className:`world-frame-editor-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`content-editor-kicker`,children:A(`可视化编排`)}),(0,q.jsx)(`h5`,{id:`world-frame-editor-title`,children:A(`世界提示框架`)}),(0,q.jsx)(`p`,{children:A(`安排世界专属指令与确定性材料位置;这里不保存人物、地点或当前事实。`)})]}),(0,q.jsxs)(`div`,{className:`world-frame-status`,"aria-label":A(`世界提示框架草稿状态`),children:[(0,q.jsx)(`span`,{className:m?.format===Ir?`valid`:`invalid`,children:m?.format===Ir?A(`V1 格式`):A(`格式待修复`)}),(0,q.jsx)(`span`,{className:C?`valid`:`invalid`,children:A(C?`可视化已同步`:`仅可编辑 YAML`)})]})]}),m===null?(0,q.jsxs)(`div`,{className:`world-frame-parse-error`,role:`alert`,children:[(0,q.jsx)(`strong`,{children:A(`当前 YAML 暂时无法可视化`)}),(0,q.jsx)(`p`,{children:a.error}),(0,q.jsx)(`span`,{children:A(`下面的高级编辑器会原样保留草稿;修复后可视化页面会自动恢复。`)})]}):(0,q.jsxs)(q.Fragment,{children:[m.format!==Ir&&(0,q.jsxs)(`div`,{className:`world-frame-repair-callout`,role:`note`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`format 不是当前世界框架版本`)}),(0,q.jsxs)(`span`,{children:[A(`Runtime 只接受`),Ir,`。`]})]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>T(e=>{e.format=Ir}),children:A(`修复为 V1 格式`)})]}),(0,q.jsxs)(`div`,{className:`world-frame-flow`,"aria-label":A(`世界提示框架流程`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`Markdown 提示块`)}),(0,q.jsxs)(`strong`,{children:[h?.length??`?`,` `,A(`份世界指令`)]})]}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`进入逻辑 role`)}),(0,q.jsx)(`strong`,{children:`author_instruction`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`精确文档与目录`)}),(0,q.jsxs)(`strong`,{children:[g?.length??`?`,` `,A(`个材料插槽`)]})]}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`进入逻辑 role`)}),(0,q.jsx)(`strong`,{children:`world_context`})]})]}),(0,q.jsxs)(`section`,{className:`world-frame-section world-frame-binding`,"aria-labelledby":`world-frame-binding-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`01 · 权威绑定`)}),(0,q.jsx)(`h6`,{id:`world-frame-binding-title`,children:A(`当前情境绑定`)})]}),(0,q.jsx)(`span`,{className:v===void 0?`world-frame-section-state invalid`:`world-frame-section-state valid`,children:A(v===void 0?`未解析`:`已解析`)})]}),(0,q.jsx)(`p`,{children:A("`current_situation` 插槽会从这里读取唯一当前情境文档,不按文件名或标题猜测。")}),(0,q.jsxs)(`label`,{children:[A(`当前情境文档`),(0,q.jsxs)(`select`,{value:v===void 0?_:Lr(v),onChange:e=>{let t=e.currentTarget.value;T(e=>{e.bindings={currentSituation:t}})},children:[(0,q.jsx)(`option`,{value:``,children:A(`选择一份世界文档`)}),_.length>0&&Rr(o,_)===void 0&&(0,q.jsxs)(`option`,{value:_,children:[_,A(`(当前未解析)`)]}),o.map(e=>(0,q.jsxs)(`option`,{value:Lr(e),children:[e.title,` · `,Lr(e),` ·`,` `,e.path]},e.path))]})]})]}),(0,q.jsxs)(`section`,{className:`world-frame-section`,"aria-labelledby":`world-frame-instructions-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`02 · 世界专属指令`)}),(0,q.jsx)(`h6`,{id:`world-frame-instructions-title`,children:A(`提示块顺序`)})]}),(0,q.jsxs)(`span`,{className:`world-frame-section-state`,children:[h?.length??0,` `,A(`个块`)]})]}),(0,q.jsx)(`p`,{children:A(`这些 Markdown 块按顺序进入主持预设预留的世界指令位置;正文仍在独立文件中编辑。`)}),h===null?(0,q.jsx)(Yr,{name:`instructions`,onReset:()=>T(e=>{e.instructions=[]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`ol`,{className:`world-frame-order-list`,"aria-label":A(`世界指令顺序`),children:h.map((e,t)=>{let n=s.find(({path:t})=>t===e.markdown),r=n?.title??e.markdown;return(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`span`,{className:`world-frame-order-number`,children:String(t+1).padStart(2,`0`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:r}),(0,q.jsx)(`code`,{children:e.markdown}),n===void 0&&(0,q.jsx)(`span`,{children:A(`引用的文件不存在`)})]}),(0,q.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,q.jsx)(`span`,{children:A(`调整顺序`)}),(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":A(`上移 {title}`,{title:r}),disabled:t===0,onClick:()=>ee(gi(h,t,t-1)),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,A(`上移`)]}),(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":A(`下移 {title}`,{title:r}),disabled:t===h.length-1,onClick:()=>ee(gi(h,t,t+1)),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,A(`下移`)]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,"aria-label":A(`移除指令 {title}`,{title:r}),onClick:()=>ee(h.filter((e,n)=>n!==t)),children:A(`移除`)})]})]},`${e.markdown}-${t}`)})}),h.length===0&&(0,q.jsx)(`p`,{className:`world-frame-empty`,children:A(`尚未加入世界提示块。`)}),(0,q.jsxs)(`div`,{className:`world-frame-add-row`,children:[(0,q.jsxs)(`label`,{children:[A(`要加入的 Markdown 块`),(0,q.jsx)(`select`,{value:b,onChange:e=>d(e.currentTarget.value),children:y.length===0?(0,q.jsx)(`option`,{value:``,children:A(`没有可加入的未引用块`)}):y.map(e=>(0,q.jsxs)(`option`,{value:e.path,children:[e.title,` · `,e.path]},e.path))})]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:b.length===0,onClick:()=>{ee([...h,{markdown:b}]),d(``)},children:A(`加入指令顺序`)})]})]})]}),(0,q.jsxs)(`section`,{className:`world-frame-section`,"aria-labelledby":`world-frame-context-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`03 · 确定性材料`)}),(0,q.jsx)(`h6`,{id:`world-frame-context-title`,children:A(`上下文材料顺序`)})]}),(0,q.jsxs)(`span`,{className:`world-frame-section-state`,children:[g?.length??0,` `,A(`个插槽`)]})]}),(0,q.jsx)(`p`,{children:A(`Runtime 只按这些精确位置取材。顺序会进入真实 prompt,但不会推断“相关人物”或“重要历史”。`)}),(0,q.jsxs)(`div`,{className:`world-frame-reorder-guide`,role:`note`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`↕`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`从上到下就是实际注入顺序`)}),(0,q.jsx)(`span`,{children:A(`每张卡片右上角都有“上移 / 下移”;移动后序号会立即更新。`)})]})]}),g===null?(0,q.jsx)(Yr,{name:`context`,onReset:()=>T(e=>{e.context=[]})}):(0,q.jsxs)(q.Fragment,{children:[(x!==1||S!==1)&&(0,q.jsxs)(`div`,{className:`world-frame-required-slots`,role:`note`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`必需插槽还未成对`)}),(0,q.jsxs)(`span`,{children:[A(`当前情境`),x,` `,A(`个 · 附加材料`),` `,S,` `,A(`个`)]})]}),(0,q.jsxs)(`div`,{children:[x===0&&(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>D(`current_situation`),children:A(`补上当前情境`)}),S===0&&(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>D(`additional_materials`),children:A(`补上附加材料`)})]})]}),(0,q.jsx)(`ol`,{className:`world-frame-slot-list`,"aria-label":A(`上下文材料顺序`),children:g.map((e,t)=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Hr,{slot:e.slot,ordinal:t+1,documents:o,directories:c,canRemove:!mi(e.slot.kind)||pi(g,e.slot.kind)>1,onChange:e=>{let n=[...g];n[t]={slot:e},E(n)},onMove:e=>E(gi(g,t,e)),onRemove:()=>E(g.filter((e,n)=>n!==t)),first:t===0,last:t===g.length-1})},`${e.slot.kind}-${t}`))}),(0,q.jsxs)(`div`,{className:`world-frame-add-slot`,children:[(0,q.jsxs)(`label`,{children:[A(`新增材料类型`),(0,q.jsx)(`select`,{value:f,onChange:e=>p(e.currentTarget.value),children:Br.map(e=>(0,q.jsxs)(`option`,{value:e.kind,children:[A(e.label),` — `,A(e.detail)]},e.kind))}),w!==null&&(0,q.jsx)(`small`,{className:`world-frame-association-note`,children:w})]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w!==null,onClick:()=>{if(g===null)return;let e={slot:oi(f,o,c)},t=[...g],n=t.findIndex(({slot:e})=>e.kind===`additional_materials`);t.splice(n<0?t.length:n,0,e),E(t)},children:A(`新增材料插槽`)})]})]})]})]}),(0,q.jsxs)(`details`,{className:`world-frame-source`,open:m===null,children:[(0,q.jsx)(`summary`,{children:A(`高级:直接编辑 frame.yaml`)}),(0,q.jsx)(`p`,{children:A(`可视化修改会把 YAML 重新整理为稳定格式;需要修复未知字段或保留当前原文时可在这里编辑。`)}),(0,q.jsx)(`textarea`,{rows:18,spellCheck:!1,"aria-label":A(`直接编辑 control/frame.yaml`),value:e,onChange:e=>r(e.currentTarget.value)}),a.error!==null&&(0,q.jsx)(`p`,{role:`alert`,children:a.error})]})]})}function Hr({slot:e,ordinal:t,documents:n,directories:r,canRemove:i,first:a,last:o,onChange:s,onMove:c,onRemove:l}){let u=fi(e.kind),d=_i(e.document),f=Rr(n,d),p=di(e.locator,f?.codec??`yaml`),m=vi(e.from)?e.from:{},h=_i(m.document),g=Rr(n,h),_=g?.codec===`yaml`?g:void 0,v=di(m.locator,`yaml`);return(0,q.jsxs)(`article`,{className:`world-frame-slot-card`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`span`,{className:`world-frame-order-number`,children:String(t).padStart(2,`0`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(u.title)}),(0,q.jsx)(`code`,{children:e.kind}),(0,q.jsx)(`p`,{children:A(u.detail)})]}),(0,q.jsxs)(`div`,{className:`world-frame-order-actions`,children:[(0,q.jsx)(`span`,{children:A(`调整注入顺序`)}),(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":A(`上移材料 {index}`,{index:t}),disabled:a,onClick:()=>c(t-2),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` `,A(`上移`)]}),(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,"aria-label":A(`下移材料 {index}`,{index:t}),disabled:o,onClick:()=>c(t),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` `,A(`下移`)]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!i,"aria-label":A(`移除材料 {index}`,{index:t}),onClick:l,children:A(`移除`)})]})]}),e.kind===`document`&&(0,q.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,q.jsx)(Ur,{label:A(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>s({...e,document:t})}),(0,q.jsx)(qr,{slot:e,ordinal:t,onChange:s})]}),e.kind===`node`&&(0,q.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,q.jsx)(Ur,{label:A(`文档 {index}`,{index:t}),value:d,documents:n,onChange:t=>{let r=Rr(n,t)?.codec??`yaml`;s({...e,document:t,locator:{[r]:[]}})}}),(0,q.jsx)(Kr,{label:`${p.kind===`yaml`?A(`YAML 路径`):A(`Markdown 标题路径`)} ${t}`,locator:p,onChange:t=>s({...e,locator:t})}),(0,q.jsx)(qr,{slot:e,ordinal:t,onChange:s})]}),e.kind===`reference_targets`&&(0,q.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,q.jsx)(Ur,{label:A(`来源 YAML 文件 {index}`,{index:t}),value:h,documents:n.filter(({codec:e})=>e===`yaml`),emptyLabel:A(`选择实际 YAML 文件`),onChange:t=>{let r=Rr(n,t),i=r?.codec===`yaml`?r:void 0;s({...e,from:{document:t,locator:{yaml:si(i)}}})}}),(0,q.jsx)(Gr,{label:A(`从 YAML 哪个字段读取 $ref(插槽 {index})`,{index:t}),manualLabel:A(`手动 YAML 字段路径(插槽 {index})`,{index:t}),document:_,locator:v,onChange:t=>s({...e,from:{document:h,locator:t}})}),(0,q.jsx)(Jr,{label:A(`最多目标数 {index}`,{index:t}),value:e.maxEntries,minimum:1,maximum:64,onChange:t=>s({...e,maxEntries:t})}),(0,q.jsx)(qr,{slot:e,ordinal:t,onChange:s})]}),e.kind===`catalog`&&(0,q.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,q.jsx)(Wr,{label:A(`目录 {index}`,{index:t}),value:_i(e.directory),directories:r,onChange:t=>s({...e,directory:t})}),(0,q.jsx)(Jr,{label:A(`最多目录项 {index}`,{index:t}),value:e.maxEntries,minimum:1,maximum:100,onChange:t=>s({...e,maxEntries:t})})]}),e.kind===`history`&&(0,q.jsx)(`div`,{className:`world-frame-slot-fields`,children:(0,q.jsx)(Jr,{label:A(`带上最近几条 {index}`,{index:t}),value:e.recent??2,minimum:1,maximum:32,onChange:t=>s({...e,recent:t})})}),e.kind===`history_message`&&(0,q.jsxs)(`div`,{className:`world-frame-slot-fields`,children:[(0,q.jsxs)(`label`,{children:[A(`历史消息句柄`),t,(0,q.jsx)(`input`,{value:_i(e.message),onChange:t=>s({...e,message:t.currentTarget.value})})]}),(0,q.jsx)(qr,{slot:e,ordinal:t,onChange:s})]}),!hi(e.kind)&&(0,q.jsx)(`pre`,{className:`world-frame-unknown-slot`,children:Pr(e,{lineWidth:0})})]})}function Ur({label:e,value:t,documents:n,emptyLabel:r=A(`选择实际文档文件`),onChange:i}){let a=Rr(n,t);return(0,q.jsxs)(`label`,{children:[e,(0,q.jsxs)(`select`,{"aria-label":e,value:a===void 0?t:Lr(a),onChange:e=>i(e.currentTarget.value),children:[(0,q.jsx)(`option`,{value:``,children:r}),t.length>0&&Rr(n,t)===void 0&&(0,q.jsxs)(`option`,{value:t,children:[t,A(`(当前未解析)`)]}),n.map(e=>(0,q.jsxs)(`option`,{value:Lr(e),children:[e.path,` — `,e.title,` · `,Lr(e)]},e.path))]}),(0,q.jsx)(`small`,{className:`world-frame-association-note`,children:a===void 0?A(`只列出内容包中带可识别 $document 技术头的实际文件。`):A(`实际关联 {path};frame.yaml 保存 @短引用:{handle}`,{path:a.path,handle:Lr(a)})})]})}function Wr({label:e,value:t,directories:n,onChange:r}){let i=n.find(({directory:e})=>e===t);return(0,q.jsxs)(`label`,{children:[e,(0,q.jsxs)(`select`,{"aria-label":e,value:t,onChange:e=>r(e.currentTarget.value),children:[(0,q.jsx)(`option`,{value:``,children:A(`选择实际世界目录`)}),t.length>0&&i===void 0&&(0,q.jsxs)(`option`,{value:t,children:[t,A(`(当前没有可关联文档)`)]}),n.map(e=>(0,q.jsxs)(`option`,{value:e.directory,children:[`world/`,e.directory,`/ — `,e.documentCount,` `,A(`份文档`)]},e.directory))]}),(0,q.jsx)(`small`,{className:`world-frame-association-note`,children:i===void 0?A(`只列出当前内容包内确实包含可识别文档的目录。`):A(`实际关联 world/{directory}/;创建世界后对应 state/{directory}/。`,{directory:i.directory})})]})}function Gr({label:e,manualLabel:t,document:n,locator:r,onChange:i}){let a=n?.yamlLocators??[],o=ci(r.path),s=a.some(({path:e})=>ci(e)===o),c=a.filter(({referenceCount:e})=>e>0).length;return(0,q.jsxs)(`div`,{className:`world-frame-reference-locator`,children:[(0,q.jsxs)(`label`,{children:[e,(0,q.jsx)(`select`,{"aria-label":e,value:o,disabled:n===void 0,onChange:e=>{let t=a.find(({path:t})=>ci(t)===e.currentTarget.value);t!==void 0&&i({yaml:[...t.path]})},children:n===void 0?(0,q.jsx)(`option`,{value:o,children:A(`先选择来源 YAML 文件`)}):(0,q.jsxs)(q.Fragment,{children:[!s&&(0,q.jsxs)(`option`,{value:o,children:[A(`当前手动路径:`),li(r.path),A(`(未解析)`)]}),a.map(e=>(0,q.jsxs)(`option`,{value:ci(e.path),children:[li(e.path),` —`,` `,e.nodeKind===`list`?A(`列表`):A(`对象`),` `,`·`,` `,e.referenceCount>0?e.referenceCount+A(` 个 $ref`):A(`当前无 $ref`)]},ci(e.path)))]})}),(0,q.jsx)(`small`,{className:`world-frame-association-note`,children:n===void 0?A(`选择 YAML 文件后,这里会解析其中可持久定位的对象和列表。`):n.path+A(` 已解析 `)+a.length+A(` 个可选节点,其中 `)+c+A(` 个当前包含 $ref。`)})]}),(0,q.jsxs)(`details`,{className:`world-frame-locator-advanced`,children:[(0,q.jsx)(`summary`,{children:A(`高级:手动填写字段路径`)}),(0,q.jsx)(Kr,{label:t,locator:{kind:`yaml`,path:r.path},onChange:i})]})]})}function Kr({label:e,locator:t,onChange:n}){return(0,q.jsxs)(`label`,{children:[e,(0,q.jsx)(`textarea`,{rows:3,value:t.path.join(`
1159
- `),placeholder:A(`每行一个层级;留空表示文档根`),onChange:e=>n({[t.kind]:e.currentTarget.value.split(`
1160
- `).map(e=>e.trim()).filter(Boolean)})})]})}function qr({slot:e,ordinal:t,onChange:n}){return(0,q.jsxs)(`label`,{className:`world-frame-required-field`,children:[(0,q.jsx)(`input`,{type:`checkbox`,"aria-label":A(`缺失时阻止请求 {index}`,{index:t}),checked:e.required!==!1,onChange:t=>{let r={...e};t.currentTarget.checked?delete r.required:r.required=!1,n(r)}}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{children:A(`缺失时阻止请求`)}),(0,q.jsx)(`small`,{children:A(`关闭后,目标暂时不存在时会明确略过。`)})]})]})}function Jr({label:e,value:t,minimum:n,maximum:r,onChange:i}){return(0,q.jsxs)(`label`,{children:[e,(0,q.jsx)(`input`,{type:`number`,min:n,max:r,value:typeof t==`number`?t:``,onChange:e=>i(Number(e.currentTarget.value))})]})}function Yr({name:e,onReset:t}){return(0,q.jsxs)(`div`,{className:`world-frame-malformed`,role:`alert`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`strong`,{children:[e,` `,A(`不是可视化编辑器支持的列表形状`)]}),(0,q.jsx)(`span`,{children:A(`可在高级 YAML 中修复,或明确重置为空列表后重新编排。`)})]}),(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,onClick:t,children:[A(`重置`),e]})]})}function Xr(e){try{let t=Nr(e);return vi(t)?{value:t,error:null}:{value:null,error:A(`frame.yaml 顶层必须是 YAML map。`)}}catch(e){return{value:null,error:e instanceof Error?A(`YAML 无法解析:{message}`,{message:e.message}):A(`YAML 无法解析。`)}}}function Zr(e){return!Array.isArray(e.instructions)||!e.instructions.every(e=>vi(e)&&typeof e.markdown==`string`)?null:e.instructions}function Qr(e){return!Array.isArray(e.context)||!e.context.every(e=>vi(e)&&vi(e.slot)&&typeof e.slot.kind==`string`)?null:e.context}function $r(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=Nr(e===`markdown`?ai(n.contents):n.contents);if(!vi(r)||!vi(r.$document))continue;let i=_i(r.$document.id),a=_i(r.$document.ref),o=_i(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`?ni(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 ei(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 ti(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 ni(e){let t=[],n=new WeakSet,r=(e,i)=>{if(Array.isArray(e)){if(n.has(e))return 0;n.add(e);let r=ii(e);return t.push({path:i,nodeKind:`list`,referenceCount:r}),r}if(!vi(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)||vi(n))&&(a+=r(n,[...i,t]));return t.push({path:i,nodeKind:`object`,referenceCount:a}),a};return r(e,[]),t.sort((e,t)=>ri(e)-ri(t))}function ri(e){return e.path.length===0?2:e.referenceCount>0?0:1}function ii(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+=ii(r,t);return n}return!vi(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+ii(r,t),0))}function ai(e){if(!e.startsWith(`---
1161
- `))return``;let t=e.indexOf(`
1162
- ---
1163
- `,4);return t<0?``:e.slice(4,t)}function oi(e,t,n){let r=t[0];if(e===`document`)return{kind:e,document:r===void 0?``:Lr(r)};if(e===`node`)return{kind:e,document:r===void 0?``:Lr(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?``:Lr(n),locator:{yaml:si(n)}},maxEntries:12}}return e===`history`?{kind:e,recent:2}:{kind:e,directory:n[0]?.directory??``,maxEntries:24}}function si(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 ci(e){return JSON.stringify(e)}function li(e){return e.length===0?A(`整份 YAML`):e.join(` › `)}function ui(e,t,n){return e===`catalog`&&n.length===0?A(`先在 world/ 的子目录中创建带 $document 技术头的文档。`):e===`reference_targets`&&!t.some(({codec:e})=>e===`yaml`)?A(`先创建一份带 $document 技术头的 YAML 世界文档。`):(e===`document`||e===`node`)&&t.length===0?A(`先创建一份带 $document 技术头的世界文档。`):null}function di(e,t){return vi(e)&&Array.isArray(e.yaml)?{kind:`yaml`,path:e.yaml.filter(e=>typeof e==`string`)}:vi(e)&&Array.isArray(e.markdown)?{kind:`markdown`,path:e.markdown.filter(e=>typeof e==`string`)}:{kind:t,path:[]}}function fi(e){return{current_situation:{title:A(`当前情境`),detail:A(`从上方绑定读取紧接着的叙事不能忘记的短期局面。`)},additional_materials:{title:A(`附加材料`),detail:A(`展开当前端点为全新上下文保存的完整精确材料清单。`)},document:{title:A(`整份文档`),detail:A(`精确加入一份世界文档。`)},node:{title:A(`文档局部节点`),detail:A(`精确加入 YAML 路径或 Markdown 标题子树。`)},catalog:{title:A(`有界目录`),detail:A(`列出一级目录中的标题、简介和短引用,不展开正文。`)},reference_targets:{title:A(`显式引用目标`),detail:A(`读取 YAML 节点中的 $ref,并加入一层目标文档。`)},history:{title:A(`最近叙事`),detail:A(`带上最近几条已提交玩家/主持原文;没有此前叙事时会明确标为空,调用链据此延续未写入文档的细节。`)},history_message:{title:A(`精确历史消息`),detail:A(`按 Runtime 句柄加入一条已提交叙事。`)}}[e]??{title:A(`未知插槽`),detail:A(`当前可视化编辑器不识别此类型;可移动、移除或在 YAML 中修复。`)}}function pi(e,t){return e?.filter(({slot:e})=>e.kind===t).length??0}function mi(e){return e===`current_situation`||e===`additional_materials`}function hi(e){return[`current_situation`,`additional_materials`,`document`,`node`,`catalog`,`reference_targets`,`history`,`history_message`].includes(e)}function gi(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 _i(e){return typeof e==`string`?e:``}function vi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yi=[{id:`opening`,label:`开场`},{id:`world`,label:`世界内容`},{id:`control`,label:`控制`},{id:`other`,label:`其他资源`}];function bi({files:e,status:t,issues:n,dirty:r,onFilesChange:i,onSave:a,onReset:o,onCopy:s,onExport:c,onDelete:u,displayName:d,onRename:f}){let[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(d),[_,v]=(0,l.useState)(d);_!==d&&(v(d),g(d));let[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)({sourcePath:``,value:``}),[C,w]=(0,l.useState)(``),[T,ee]=(0,l.useState)(!1),E=(0,l.useMemo)(()=>[...e].sort(Ci),[e]),D=E.find(({path:e})=>e===`opening.md`)?.path??E.find(({path:e})=>e===`world/current-situation.yaml`)?.path??E[0]?.path??``,te=e.some(({path:e})=>e===y)?y:D,O=e.find(({path:e})=>e===te),k=x.sourcePath===te?x.value:te,ne=p.trim().toLocaleLowerCase(`zh-CN`),ie=ne.length===0?E:E.filter(({path:e})=>e.toLocaleLowerCase(`zh-CN`).includes(ne)),j=new Map;for(let e of yi)j.set(e.id,[]);for(let e of ie)j.get(Si(e.path))?.push(e);let M=O?xi(k,O.path,e):``,N=xi(C,void 0,e),P=n.filter(({path:e})=>e===te),ae=e.filter(({path:e})=>e.startsWith(`world/`)).length,F=e.filter(({path:e})=>e.startsWith(`control/`)).length,I=e.filter(({path:e})=>e===`opening.md`).length,L=t=>{O!==void 0&&i(e.map(e=>e.path===O.path?{...e,contents:t}:{...e}))};return(0,q.jsxs)(`section`,{className:`panel-card content-tree-editor`,children:[(0,q.jsxs)(`header`,{className:`section-heading-row content-tree-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{children:A(`内容包当前树`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`逐份编辑 YAML/Markdown;整批保存时才原子替换已保存版本。`)})]}),(0,q.jsxs)(`div`,{className:`content-tree-state`,"aria-label":A(`内容包编辑状态`),children:[(0,q.jsxs)(`span`,{className:`package-status ${t}`,children:[A(`已保存版本:`),A(t===`usable`?`可用`:`需要修复`)]}),(0,q.jsx)(`span`,{className:r?`draft-state dirty`:`draft-state`,children:A(r?`有未保存修改`:`草稿与已保存版本一致`)})]})]}),(0,q.jsxs)(`dl`,{className:`content-tree-counts`,"aria-label":A(`内容包文件统计`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`全部文件`)}),(0,q.jsx)(`dd`,{children:e.length})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`开场白`)}),(0,q.jsx)(`dd`,{children:I})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`世界内容`)}),(0,q.jsx)(`dd`,{children:ae})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`控制文件`)}),(0,q.jsx)(`dd`,{children:F})]})]}),(0,q.jsxs)(`div`,{className:`content-file-workspace`,children:[(0,q.jsxs)(`aside`,{className:`content-file-sidebar`,"aria-label":A(`内容包文件`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`content-editor-kicker`,children:A(`当前草稿`)}),(0,q.jsx)(`h4`,{children:A(`文件`)})]}),(0,q.jsxs)(`span`,{children:[ie.length,` / `,e.length]})]}),(0,q.jsxs)(`label`,{className:`content-file-filter`,children:[A(`筛选文件`),(0,q.jsx)(`input`,{type:`search`,value:p,placeholder:A(`人物、地点或文件名`),onChange:e=>m(e.target.value)})]}),(0,q.jsx)(`nav`,{className:`content-file-list`,"aria-label":A(`内容包文件树`),children:ie.length===0?(0,q.jsx)(`p`,{children:A(`没有匹配的文件。`)}):yi.map(({id:e,label:t})=>{let r=j.get(e)??[];return r.length===0?null:(0,q.jsxs)(`section`,{"aria-labelledby":`content-group-${e}`,children:[(0,q.jsxs)(`h5`,{id:`content-group-${e}`,children:[A(t),(0,q.jsx)(`span`,{children:r.length})]}),(0,q.jsx)(`ul`,{children:r.map(e=>{let t=n.filter(({path:t})=>t===e.path).length;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,className:e.path===te?`selected-content-file`:``,"aria-label":A(`打开 {path}`,{path:e.path}),"aria-pressed":e.path===te,title:e.path,onClick:()=>b(e.path),children:[(0,q.jsx)(`span`,{className:`content-file-kind`,"aria-hidden":`true`,children:J(e)}),(0,q.jsx)(`code`,{children:e.path}),t>0&&(0,q.jsx)(`span`,{className:`content-file-issue-count`,children:t})]})},e.path)})})]},e)})}),(0,q.jsxs)(`details`,{className:`content-new-file`,children:[(0,q.jsx)(`summary`,{children:A(`新建文件`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{children:[A(`新文件路径`),(0,q.jsx)(`input`,{value:C,placeholder:`world/characters/name.yaml`,onChange:e=>{w(e.target.value),ee(!0)}})]}),T&&N.length>0&&(0,q.jsx)(`p`,{role:`alert`,children:N}),(0,q.jsx)(`p`,{children:A(`新文件先加入本地草稿;Runtime 会在整批保存时检查路径与内容。`)}),(0,q.jsx)(`button`,{type:`button`,disabled:N.length>0,onClick:()=>{if(ee(!0),N.length>0)return;let t=C.trim();i([...e.map(e=>({...e})),{path:t,contents:``}]),b(t),w(``),ee(!1)},children:A(`加入草稿`)})]})]})]}),(0,q.jsx)(`section`,{className:`content-file-editor`,"aria-label":O===void 0?A(`文件编辑器`):A(`文件编辑器:{path}`,{path:O.path}),children:O===void 0?(0,q.jsxs)(`div`,{className:`content-editor-empty`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,q.jsx)(`h4`,{children:A(`当前草稿没有文件`)}),(0,q.jsx)(`p`,{children:A(`从左侧新建第一份文件,或返回工作区导入已有内容包。`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`header`,{className:`content-file-editor-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`content-editor-kicker`,children:Ei(O)}),(0,q.jsx)(`h4`,{children:Ti(O.path)})]}),(0,q.jsx)(`button`,{type:`button`,className:`danger-button content-remove-file`,onClick:()=>{if(O===void 0)return;let t=e.filter(({path:e})=>e!==O.path).map(e=>({...e}));b(wi(t,O.path)),i(t)},children:A(`从草稿移除`)})]}),(0,q.jsxs)(`div`,{className:`content-path-editor`,children:[(0,q.jsxs)(`label`,{children:[A(`文件路径`),(0,q.jsx)(`input`,{value:k,onChange:e=>S({sourcePath:O.path,value:e.target.value})})]}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:M.length>0||k.trim()===O.path,onClick:()=>{if(O===void 0||M.length>0)return;let t=k.trim();t!==O.path&&(i(e.map(e=>e.path===O.path?{...e,path:t}:{...e})),b(t),S({sourcePath:t,value:t}))},children:A(`应用新路径`)})]}),M.length>0&&(0,q.jsx)(`p`,{role:`alert`,children:M}),O.encoding===`base64`?(0,q.jsxs)(`div`,{className:`content-binary-note`,role:`note`,children:[(0,q.jsx)(`strong`,{children:A(`二进制资源不在文本编辑器展开`)}),(0,q.jsx)(`span`,{children:A(`当前 Base64 内容会原样保留;如需替换资源,请重新导入内容包。`)})]}):O.path===`control/frame.yaml`?(0,q.jsx)(Vr,{contents:O.contents,files:e,dirty:r,onChange:L,onSave:a}):(0,q.jsxs)(`label`,{className:`content-source-editor`,children:[(0,q.jsxs)(`span`,{children:[A(`文件内容`),(0,q.jsx)(`small`,{children:A(`Ctrl / ⌘ + S 整批保存`)})]}),(0,q.jsx)(`textarea`,{rows:27,spellCheck:!1,value:O.contents,placeholder:Di(O.path),"aria-label":A(`编辑 {path}`,{path:O.path}),onChange:e=>L(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase(`en-US`)===`s`&&(e.preventDefault(),r&&a())}})]}),(0,q.jsxs)(`footer`,{className:`content-source-meta`,children:[(0,q.jsx)(`span`,{children:J(O)}),O.encoding===void 0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{children:[Oi(O.contents),` `,A(`行`)]}),(0,q.jsxs)(`span`,{children:[O.contents.length.toLocaleString(re()),` `,A(`字符`)]})]})]}),P.length>0&&(0,q.jsxs)(`section`,{className:`content-selected-diagnostics`,"aria-labelledby":`selected-file-diagnostics-title`,children:[(0,q.jsx)(`h5`,{id:`selected-file-diagnostics-title`,children:A(`已保存版本诊断`)}),(0,q.jsx)(`ul`,{children:P.map((e,t)=>(0,q.jsx)(`li`,{children:e.message},`${e.code}-${e.path}-${t}`))})]})]})})]}),n.length>0&&(0,q.jsxs)(`details`,{className:`content-package-diagnostics`,open:!r,children:[(0,q.jsx)(`summary`,{children:A(`已保存版本有 {count} 项需要修复`,{count:n.length})}),r&&(0,q.jsx)(`p`,{children:A(`诊断对应上一次保存;整批保存后会按新草稿重新检查。`)}),(0,q.jsx)(`ul`,{children:n.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`code`,{children:e.path}),(0,q.jsx)(`span`,{children:e.message})]},`${e.code}-${e.path}-${t}`))})]}),(0,q.jsxs)(`footer`,{className:`content-tree-actions`,children:[(0,q.jsxs)(`div`,{className:`content-save-boundary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(r?`草稿尚未保存`:`当前树已保存`)}),(0,q.jsx)(`span`,{children:A(`保存会把整棵草稿作为一个候选原子替换,不会逐文件提交。`)})]}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:!r,onClick:a,children:A(`整批保存`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!r,onClick:o,children:A(`放弃未保存修改`)})]})]}),(0,q.jsxs)(`details`,{className:`content-package-actions`,children:[(0,q.jsx)(`summary`,{children:A(`内容包操作`)}),r&&(0,q.jsx)(`p`,{children:A(`请先整批保存或放弃当前草稿,再操作已保存内容包。`)}),(0,q.jsxs)(`label`,{className:`content-package-rename`,children:[(0,q.jsx)(`span`,{children:A(`内容包名称`)}),(0,q.jsx)(`input`,{value:h,disabled:r,maxLength:160,onChange:e=>g(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r||h.trim()===``||h.trim()===d,onClick:()=>f(h.trim()),children:A(`重命名`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r,onClick:s,children:A(`复制为新本地身份`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r,onClick:c,children:A(`导出 ZIP`)}),(0,q.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:r,onClick:u,children:A(`删除内容包`)})]})]})]})]})}function xi(e,t,n){let r=e.trim();if(r.length===0)return A(`请输入文件路径。`);if(r.startsWith(`/`)||/^[a-z]:[\\/]/iu.test(r)||r.includes(`\\`)||r.includes(`\0`))return A(`路径必须是使用 / 的内容包相对路径。`);if(r.split(`/`).some(e=>e.length===0||e===`.`||e===`..`))return A(`路径不能包含空目录、. 或 ..。`);if(/\.json$/iu.test(r))return A(`当前文件原生 V1 不接受 manifest 或 JSON 内容文件。`);let i=r.normalize(`NFC`).toLocaleLowerCase(`en-US`);return n.some(e=>e.path!==t&&e.path.normalize(`NFC`).toLocaleLowerCase(`en-US`)===i)?A(`当前草稿中已经存在同一路径。`):``}function Si(e){return e===`opening.md`?`opening`:e.startsWith(`world/`)?`world`:e.startsWith(`control/`)?`control`:`other`}function Ci(e,t){let n=e=>e===`opening.md`?0:e===`world/current-situation.yaml`?1:e.startsWith(`world/`)?2:e===`control/frame.yaml`?3:e.startsWith(`control/`)?4:5;return n(e.path)-n(t.path)||e.path.localeCompare(t.path)}function wi(e,t){let n=[...e].sort(Ci);return n.find(({path:e})=>e.localeCompare(t)>0)?.path??n.at(-1)?.path??``}function Ti(e){return e.split(`/`).at(-1)??e}function J(e){return e.encoding===`base64`?`BIN`:/\.ya?ml$/iu.test(e.path)?`YAML`:/\.md$/iu.test(e.path)?`MD`:`TEXT`}function Ei(e){return e.encoding===`base64`?A(`二进制资源`):e.path===`opening.md`?A(`玩家首次行动前看到的开场白`):e.path.startsWith(`world/`)?A(`会复制为世界状态的设定文档`):e.path.startsWith(`control/`)?A(`会复制为世界控制的作者资产`):A(`内容包文本资源`)}function Di(e){return e===`opening.md`?A(`写下玩家首次行动前立即看到的局面……`):e.startsWith(`world/`)&&/\.ya?ml$/iu.test(e)?A(`$document:
1164
- id: character.example
1165
- ref: example
1166
- title: 示例人物
1167
- summary: 一句话稳定简介。
1168
- aliases: []
1169
- `):e.startsWith(`world/`)&&/\.md$/iu.test(e)?A(`---
1170
- $document:
1171
- id: rule.example
1172
- ref: example
1173
- title: 示例规则
1174
- summary: 一句话稳定简介。
1175
- aliases: []
1176
- ---
1177
-
1178
- # 示例规则
1179
- `):A(`输入 UTF-8 文本内容……`)}function Oi(e){return e.length===0?0:e.split(`
1180
- `).length}function ki({contentPackages:e,worlds:t,selectedPackageId:n,modelConfigured:r,activeModelName:i,currentPresetName:a,importArchive:o,importPending:s,onImportArchiveChange:c,onEditContent:u,onOpenPlayPresets:d=()=>void 0,onCreateWorld:f,onOpenPreview:p,onCreatePackage:m,onImportPackage:h,onOpenPackage:g,onOpenWorld:_,onRenameWorld:v,onDeleteWorld:y}){let[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(``),w=e.filter(({status:e})=>e===`usable`).length,T=e.length-w;return(0,q.jsxs)(`div`,{className:`home-dashboard`,children:[(0,q.jsxs)(`div`,{className:`home-primary-grid`,children:[(0,q.jsxs)(`section`,{className:`home-surface home-world-library`,"aria-labelledby":`home-worlds-title`,children:[(0,q.jsxs)(`header`,{className:`home-section-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`home-section-kicker`,children:`PLAY`}),(0,q.jsx)(`h2`,{id:`home-worlds-title`,children:A(`继续游玩`)})]}),(0,q.jsx)(`span`,{className:`home-count`,"aria-label":A(`{count} 个世界`,{count:t.length}),children:t.length.toLocaleString(re())})]}),t.length>0?(0,q.jsx)(`div`,{className:`home-world-grid`,children:t.map((e,t)=>(0,q.jsxs)(`div`,{className:`home-world-card-shell`,children:[(0,q.jsxs)(`button`,{className:`home-world-card`,type:`button`,"aria-label":A(`打开世界:{title}`,{title:e.title}),disabled:s,onClick:()=>_(e.worldId),children:[(0,q.jsxs)(`span`,{className:`home-world-card-meta`,children:[A(`世界`),String(t+1).padStart(2,`0`)]}),(0,q.jsx)(`strong`,{children:e.title}),(0,q.jsxs)(`span`,{className:`home-world-card-action`,children:[A(`进入世界`),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})]}),(0,q.jsxs)(`div`,{className:`home-world-card-actions`,children:[(0,q.jsx)(`button`,{className:`home-world-rename`,type:`button`,"aria-label":A(`重命名世界:{title}`,{title:e.title}),disabled:s,onClick:()=>{x(e.worldId),C(e.title)},children:A(`重命名`)}),(0,q.jsx)(`button`,{className:`home-world-delete`,type:`button`,"aria-label":A(`删除世界:{title}`,{title:e.title}),disabled:s,onClick:()=>y(e),children:A(`删除`)})]}),b===e.worldId?(0,q.jsxs)(`form`,{className:`home-world-rename-form`,onSubmit:t=>{t.preventDefault();let n=S.trim();n!==``&&n!==e.title&&(v(e,n),x(null))},children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:A(`世界名称`)}),(0,q.jsx)(`input`,{"aria-label":A(`世界名称`),autoFocus:!0,maxLength:160,value:S,onChange:e=>C(e.currentTarget.value)})]}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`submit`,"aria-label":A(`保存世界名称`),disabled:S.trim()===``||S.trim()===e.title,children:A(`保存`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>x(null),children:A(`取消`)})]})]}):null]},e.worldId))}):(0,q.jsxs)(`div`,{className:`home-empty-world`,children:[(0,q.jsx)(`span`,{className:`home-empty-orbit`,"aria-hidden":`true`,children:(0,q.jsx)(`span`,{})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{children:A(`还没有正在游玩的世界`)}),(0,q.jsx)(`p`,{children:A(`先新建内容包,或上传一份 ZIP,再整理开场与世界文档并创建独立世界。`)})]})]})]}),(0,q.jsxs)(`aside`,{className:`home-surface home-readiness`,"aria-label":A(`工作区状态`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`p`,{className:`home-section-kicker`,children:`READY CHECK`}),(0,q.jsx)(`h2`,{children:A(`工作区状态`)})]}),(0,q.jsxs)(`dl`,{className:`home-readiness-list`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`dt`,{children:[(0,q.jsx)(`span`,{className:`home-status-mark ${r?`is-ready`:`needs-attention`}`,"aria-hidden":`true`}),A(`模型连接`)]}),(0,q.jsx)(`dd`,{children:i??A(`尚未配置`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`dt`,{children:[(0,q.jsx)(`span`,{className:`home-status-mark ${a===null?`needs-attention`:`is-ready`}`,"aria-hidden":`true`}),A(`当前预设`)]}),(0,q.jsx)(`dd`,{children:a??A(`尚未选择`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`dt`,{children:[(0,q.jsx)(`span`,{className:`home-status-mark ${w>0?`is-ready`:`needs-attention`}`,"aria-hidden":`true`}),A(`可用内容包`)]}),(0,q.jsxs)(`dd`,{children:[A(`{count} 份`,{count:w}),T>0&&A(` · {count} 份待修复`,{count:T})]})]})]}),(0,q.jsx)(`p`,{className:`home-readiness-note`,children:A(`内容包是世界模板;创建后的世界会独立保存状态、控制与历史。`)})]})]}),(0,q.jsxs)(`section`,{className:`home-task-section`,"aria-labelledby":`home-tasks-title`,children:[(0,q.jsxs)(`header`,{className:`home-section-heading home-task-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`home-section-kicker`,children:`WORKBENCH`}),(0,q.jsx)(`h2`,{id:`home-tasks-title`,children:A(`创作工作台`)})]}),(0,q.jsx)(`p`,{children:A(`四个入口各自完成一件事,运行中的世界从上方直接进入。`)})]}),(0,q.jsxs)(`div`,{className:`home-task-grid`,"aria-label":A(`四个任务入口`),children:[(0,q.jsx)(Ai,{index:`01`,title:A(`内容编辑`),description:A(`编辑内容包里的开场、世界文档与控制文件。`),detail:e.length>0?A(`{count} 份内容包`,{count:e.length}):A(`从空白内容包开始`),disabled:s,onClick:u}),(0,q.jsx)(Ai,{index:`02`,title:A(`预设`),description:A(`编辑提示块库、叙事规则、后置请求与扩展资源。`),detail:a??A(`选择预设`),disabled:s,onClick:d}),(0,q.jsx)(Ai,{index:`03`,title:A(`新建世界`),description:A(`从一份可用内容包复制出独立演化的世界。`),detail:w>0?A(`{count} 份可用`,{count:w}):A(`需要可用内容包`),disabled:s,onClick:f}),(0,q.jsx)(Ai,{index:`04`,title:A(`提示词预览`),description:A(`检查真实 role、材料、工具、预算与缓存边界。`),detail:A(r?`模型已就绪`:`需要模型连接`),disabled:s,onClick:p})]})]}),(0,q.jsxs)(`section`,{className:`home-surface home-content-library`,"aria-labelledby":`home-content-title`,children:[(0,q.jsxs)(`header`,{className:`home-section-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`home-section-kicker`,children:`CONTENT`}),(0,q.jsx)(`h2`,{id:`home-content-title`,children:A(`内容包`)})]}),(0,q.jsx)(`button`,{type:`button`,disabled:s,onClick:m,children:A(`新建内容包`)})]}),(0,q.jsxs)(`div`,{className:`home-content-layout`,children:[(0,q.jsx)(`div`,{children:e.length>0?(0,q.jsx)(`div`,{className:`home-package-list`,children:e.map(e=>(0,q.jsxs)(`button`,{className:`home-package-card`,type:`button`,"aria-label":A(`打开内容包:{name}`,{name:e.displayName}),"aria-pressed":e.localId===n,disabled:s,onClick:()=>g(e.localId),children:[(0,q.jsxs)(`span`,{className:`home-package-card-heading`,children:[(0,q.jsx)(`strong`,{children:e.displayName}),(0,q.jsx)(`span`,{className:`home-package-state ${e.status}`,children:e.status===`usable`?A(`可用`):A(`待修复`)})]}),(0,q.jsx)(`span`,{className:`home-package-card-copy`,children:e.status===`usable`?A(`可编辑、预览并创建新世界`):A(`打开并修复当前树中的问题`)})]},e.localId))}):(0,q.jsxs)(`div`,{className:`home-empty-packages`,children:[(0,q.jsx)(`h3`,{children:A(`从一组人类可读文件开始`)}),(0,q.jsx)(`p`,{children:A(`内容包由 opening.md、world 与 control 组成,可以从空白新建,也可以上传一份内容包 ZIP。`)})]})}),(0,q.jsxs)(`form`,{className:`home-import-card`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`home-section-kicker`,children:`IMPORT`}),(0,q.jsx)(`h3`,{children:A(`导入 ZIP`)}),(0,q.jsx)(`p`,{children:A(`选择本应用导出或遵循相同结构的内容包 ZIP;导入会创建新的本地身份,不覆盖同名内容包。`)})]}),(0,q.jsxs)(`label`,{className:`home-zip-picker`,children:[(0,q.jsx)(`span`,{children:A(`内容包 ZIP`)}),(0,q.jsx)(`input`,{className:`home-zip-picker-input`,type:`file`,accept:`.zip,application/zip,application/x-zip-compressed`,"aria-label":A(`内容包 ZIP 文件`),disabled:s,onChange:e=>c(e.target.files?.[0]??null)},o===null?`empty`:`${o.name}:${o.size}:${o.lastModified}`),(0,q.jsxs)(`span`,{className:`home-zip-picker-control`,children:[(0,q.jsx)(`strong`,{children:A(`选择 ZIP 文件`)}),(0,q.jsx)(`span`,{"aria-live":`polite`,children:o===null?A(`尚未选择`):`${o.name} · ${ji(o.size)}`})]})]}),(0,q.jsx)(`button`,{type:`submit`,disabled:o===null||s,children:A(s?`正在导入…`:`导入 ZIP`)})]})]})]})]})}function Ai({index:e,title:t,description:n,detail:r,disabled:i,onClick:a}){return(0,q.jsxs)(`button`,{type:`button`,className:`home-task-card`,"aria-labelledby":`home-task-title-${e}`,"aria-describedby":`home-task-description-${e} home-task-detail-${e}`,disabled:i,onClick:a,children:[(0,q.jsx)(`span`,{className:`home-task-index`,children:e}),(0,q.jsx)(`span`,{className:`home-task-arrow`,"aria-hidden":`true`,children:`↗`}),(0,q.jsx)(`strong`,{id:`home-task-title-${e}`,children:t}),(0,q.jsx)(`span`,{className:`home-task-description`,id:`home-task-description-${e}`,children:n}),(0,q.jsx)(`span`,{className:`home-task-detail`,id:`home-task-detail-${e}`,children:r})]})}function ji(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:`${(e/1048576).toFixed(1)} MiB`}function Mi(){return{connectionId:null,name:A(`默认模型`),presetId:`custom`,provider:`chat_completions`,baseUrl:``,apiKey:``,modelId:``,contextWindowTokens:`128000`,maxOutputTokens:`16000`}}function Ni({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?Mi():Fi(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]),_=t.connections.find(({id:e})=>e===o.connectionId),v=o.connectionId===null||_?.provider!==o.provider||Li(_?.baseUrl??``)!==Li(o.baseUrl);(0,l.useEffect)(()=>i(p),[p,i]),(0,l.useEffect)(()=>()=>{i(!1)},[i]);function y(e,t=!1){s(t=>({...t,...e})),m(!0),t&&u([])}function b(e){let n=t.presets.find(({id:t})=>t===e);n!==void 0&&y(n.id===`custom`?{presetId:e}:{presetId:e,provider:n.provider,baseUrl:n.baseUrl,name:o.connectionId===null||o.name===A(`默认模型`)?n.name:o.name},!0)}function x(e){s(Fi(e)),u([]),m(!1),r(``)}function S(){s(Mi()),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,baseUrl:o.baseUrl,...o.apiKey.length===0?{}:{apiKey:o.apiKey},modelId:o.modelId,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(A(`模型连接已保存并启用;后续请求只使用当前配置。`))}catch(e){r(Ii(e))}finally{f(null)}}}async function w(t){if(d===null){f(t);try{n(await e.request({type:`model.select`,connectionId:t})),r(A(`已切换当前模型配置;Runtime 不会自动故障转移。`))}catch(e){r(Ii(e))}finally{f(null)}}}async function T(t){if(d===null){f(`delete:${t}`);try{n(await e.request({type:`model.delete`,connectionId:t})),o.connectionId===t&&S(),r(A(`模型配置已从本机删除。`))}catch(e){r(Ii(e))}finally{f(null)}}}async function ee(){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(A(`已从当前端点拉取 {count} 个模型 ID。`,{count:t.models.length}))}catch(e){r(Ii(e))}finally{f(null)}}}return(0,q.jsxs)(`section`,{className:`model-connection-screen`,"aria-labelledby":`model-title`,children:[(0,q.jsxs)(`header`,{className:`config-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`WORKSPACE SETTING`}),(0,q.jsx)(`h2`,{id:`model-title`,children:A(`模型连接`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`保存多份本机配置并明确切换。API Key 不会返回浏览器;切换失败时 Runtime 不会悄悄改用另一份配置。`)})]}),(0,q.jsxs)(`div`,{className:`model-active-summary`,children:[(0,q.jsx)(`span`,{children:A(`当前配置`)}),(0,q.jsx)(`strong`,{children:h?.name??A(`尚未启用`)}),(0,q.jsx)(`small`,{children:h?.modelId??A(`先保存一份可用连接`)})]})]}),(0,q.jsxs)(`div`,{className:`config-layout`,children:[(0,q.jsxs)(`form`,{className:`config-form panel-card`,onSubmit:e=>void C(e),children:[(0,q.jsxs)(`div`,{className:`section-heading-row`,children:[(0,q.jsx)(`h3`,{children:o.connectionId===null?A(`新建配置`):A(`编辑配置`)}),o.connectionId!==null&&(0,q.jsx)(`button`,{className:`secondary-button`,disabled:p,onClick:S,type:`button`,children:A(`新建另一份`)})]}),(0,q.jsx)(`label`,{htmlFor:`model-preset`,children:A(`提供商`)}),(0,q.jsx)(`select`,{id:`model-preset`,value:o.presetId,onChange:e=>b(e.target.value),children:t.presets.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,q.jsx)(`label`,{htmlFor:`model-name`,children:A(`配置名称`)}),(0,q.jsx)(`input`,{id:`model-name`,maxLength:160,required:!0,value:o.name,onChange:e=>y({name:e.target.value})}),(0,q.jsx)(`label`,{htmlFor:`model-provider`,children:A(`协议适配器`)}),(0,q.jsxs)(`select`,{id:`model-provider`,value:o.provider,onChange:e=>y({presetId:`custom`,provider:e.target.value},!0),children:[(0,q.jsx)(`option`,{value:`chat_completions`,children:`OpenAI-compatible Chat Completions`}),(0,q.jsx)(`option`,{value:`openai_responses`,children:`OpenAI Responses API`}),(0,q.jsx)(`option`,{value:`anthropic_messages`,children:`Anthropic Messages`})]}),(0,q.jsx)(`label`,{htmlFor:`model-base-url`,children:`Base URL`}),(0,q.jsx)(`input`,{id:`model-base-url`,"aria-label":`Base URL`,required:!0,type:`url`,value:o.baseUrl,onChange:e=>y({presetId:`custom`,baseUrl:e.target.value},!0)}),g?.id!==`custom`&&(0,q.jsxs)(`p`,{className:`field-note`,children:[A(`已填入`),g?.name,` `,A(`的内置端点;手动修改后按自定义端点保存。`)]}),(0,q.jsx)(`label`,{htmlFor:`model-api-key`,children:`API Key`}),(0,q.jsx)(`input`,{autoComplete:`off`,id:`model-api-key`,"aria-label":`API Key`,required:v,type:`password`,value:o.apiKey,placeholder:o.connectionId===null?A(`新配置必填`):A(v?`端点或协议已改变,必须重新填写`:`留空以保留当前端点的现有凭据`),onChange:e=>y({apiKey:e.target.value},!0)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`旧凭据只会为同一协议和端点保留,不会静默转发到新端点。`)}),(0,q.jsxs)(`div`,{className:`model-picker-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{htmlFor:`model-id`,children:A(`模型 ID`)}),(0,q.jsx)(`input`,{id:`model-id`,"aria-label":A(`模型 ID`),list:`provider-models`,maxLength:512,required:!0,value:o.modelId,onChange:e=>y({modelId:e.target.value})}),(0,q.jsx)(`datalist`,{id:`provider-models`,children:c.map(e=>(0,q.jsx)(`option`,{value:e},e))})]}),(0,q.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||o.baseUrl.length===0||v&&o.apiKey.length===0,onClick:()=>void ee(),type:`button`,children:A(d===`models`?`正在拉取…`:`从端点拉取模型`)})]}),c.length>0&&(0,q.jsx)(`p`,{className:`field-note`,children:A(`可在模型 ID 输入框中选择已拉取结果。`)}),(0,q.jsxs)(`div`,{className:`two-column-fields`,children:[(0,q.jsxs)(`label`,{children:[A(`真实 context window`),(0,q.jsx)(`input`,{min:4096,max:16777216,required:!0,step:1,type:`number`,value:o.contextWindowTokens,onChange:e=>y({contextWindowTokens:e.target.value})})]}),(0,q.jsxs)(`label`,{children:[A(`最大输出 tokens`),(0,q.jsx)(`input`,{min:256,max:16777215,required:!0,step:1,type:`number`,value:o.maxOutputTokens,onChange:e=>y({maxOutputTokens:e.target.value})})]})]}),(0,q.jsxs)(`div`,{className:`form-actions`,children:[(0,q.jsx)(`button`,{disabled:d!==null,type:`submit`,children:A(d===`save`?`正在保存…`:`保存模型连接并启用`)}),p&&o.connectionId!==null&&(0,q.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:A(`放弃修改`)}),p&&o.connectionId===null&&(0,q.jsx)(`button`,{className:`secondary-button`,disabled:d!==null,onClick:S,type:`button`,children:A(`重置新配置`)})]})]}),(0,q.jsxs)(`section`,{className:`config-list`,"aria-label":A(`已保存模型配置`),children:[(0,q.jsxs)(`div`,{className:`section-heading-row`,children:[(0,q.jsx)(`h3`,{children:A(`已保存配置`)}),(0,q.jsxs)(`span`,{children:[t.connections.length,` `,A(`份`)]})]}),t.connections.length===0&&(0,q.jsx)(`p`,{className:`panel-card`,children:A(`尚未保存模型配置。`)}),t.connections.map(e=>{let n=e.id===t.activeConnectionId;return(0,q.jsxs)(`article`,{className:`config-card panel-card${n?` active-model-config`:``}`,children:[(0,q.jsxs)(`div`,{className:`section-heading-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:Pi(e.provider)}),(0,q.jsx)(`h3`,{children:e.name})]}),n&&(0,q.jsx)(`span`,{className:`active-config`,children:A(`当前使用`)})]}),(0,q.jsxs)(`dl`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`模型`)}),(0,q.jsx)(`dd`,{children:e.modelId})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`端点`)}),(0,q.jsx)(`dd`,{children:e.baseUrl})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`窗口 / 输出`)}),(0,q.jsxs)(`dd`,{children:[e.contextWindowTokens.toLocaleString(),` /`,` `,e.maxOutputTokens.toLocaleString()]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`凭据`)}),(0,q.jsx)(`dd`,{children:e.hasApiKey?A(`已保存在本机`):A(`未配置`)})]})]}),(0,q.jsxs)(`div`,{className:`form-actions`,children:[!n&&(0,q.jsx)(`button`,{disabled:d!==null,onClick:()=>void w(e.id),type:`button`,children:d===e.id?A(`正在切换…`):A(`切换到此配置`)}),(0,q.jsx)(`button`,{className:`secondary-button`,disabled:d!==null||p||o.connectionId===e.id,onClick:()=>x(e),type:`button`,children:o.connectionId===e.id?A(`正在编辑`):A(`编辑`)}),(0,q.jsx)(`button`,{className:`danger-button`,disabled:d!==null||p||n&&t.connections.length>1,onClick:()=>void T(e.id),type:`button`,children:d===`delete:${e.id}`?A(`正在删除…`):A(`删除`)})]}),n&&t.connections.length>1&&(0,q.jsx)(`p`,{className:`field-note`,children:A(`先切换到另一份配置,才能删除当前配置。`)})]},e.id)})]})]})]})}function Pi(e){switch(e){case`chat_completions`:return`Chat Completions`;case`openai_responses`:return`OpenAI Responses`;case`anthropic_messages`:return`Anthropic Messages`}}function Fi(e){return{connectionId:e.id,name:e.name,presetId:e.presetId,provider:e.provider,baseUrl:e.baseUrl,apiKey:``,modelId:e.modelId,contextWindowTokens:String(e.contextWindowTokens),maxOutputTokens:String(e.maxOutputTokens)}}function Ii(e){return e instanceof Error?e.message:A(`模型配置操作失败`)}function Li(e){return e.trim().replace(/\/+$/u,``)}function Ri(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 zi(e,t){return t===`application/json`?JSON.stringify(e,null,2):typeof e==`string`?e:JSON.stringify(e)}function Bi(e){let t=ua(e.replace(/\r\n?/gu,`
1181
- `)).split(`
1182
- `),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>${la(i[1]??``)}</li>`);continue}if(r&&=(n.push(`</ul>`),!1),t!==null){let e=t[1]?.length??1;n.push(`<h${e}>${la(t[2]??``)}</h${e}>`)}else e.trim()!==``&&n.push(`<p>${la(e)}</p>`)}return r&&n.push(`</ul>`),n.join(`
1183
- `)}function Vi(e){let t=e.maxRules??256,n=e.maxTransformations??1024,r=e.maxOutputBytes??4194304,i=e.maxDomCharacters??1e6,a=zi(e.payload,e.contentType),o=e.contentType===`text/markdown`?Bi(a):``;if(new TextEncoder().encode(a).byteLength>r||o.length>i)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:A(`artifact 内容超过宿主渲染上限`)};if(e.rules.length>t)return{original:a,final:a,steps:[],fallback:!0,failure:`fallback`,error:A(`正则规则数量超过宿主上限`)};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){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:A(`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,ca(t.replace,e,o)));if(p>n)throw Error(A(`正则转换次数超过宿主上限`));if(new TextEncoder().encode(m).byteLength>r)throw Error(A(`正则输出超过宿主字节上限`));if(t.scope===`markdown_html`&&m.length>i)throw Error(A(`Markdown HTML DOM 大小超过宿主上限`));if(t.scope===`raw_text`){if(c=m,!d&&e.contentType===`text/markdown`&&(u=Bi(c),u.length>i))throw Error(A(`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:A(`正则执行失败`);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:A(`正则规则失败,实例显示 raw artifact(可恢复)`)}:m===`fail`?{error:A(`正则规则失败,实例进入错误状态并显示 raw artifact`)}:{}}}function Hi(e,t,n,r){return n?.mode===`document`&&n.document!==void 0?Ui({template:n.document,content:e,contentType:t,...r===void 0?{}:{payload:r}}):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>${ua(e)}</pre>`}</main>`}function Ui(e){let t=`<!-- narraeon:content -->`,n=`<!-- narraeon:payload -->`;if(qi(e.template,t)!==1)throw Error(A(`document renderer 必须包含唯一 narraeon:content marker`));let r=e.contentType===`text/html`||e.contentType===`text/markdown`?e.content:`<pre>${ua(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 Wi(e){let t=e.renderer.document??`<main></main>`,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:"${Ji}",type:"bridge.event",instanceId:${i},nonce:${a},event:"diagnostic",payload:{message:String(event.message||"Extension script error")}})});window.addEventListener("unhandledrejection",function(event){send({namespace:"${Ji}",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:"${Ji}",type:"bridge.ready",instanceId:${i},nonce:${a}},"*");<\/script>`;return Gi(Ki(t,o,``),`${n}${s}`)}function Gi(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 Ki(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 qi(e,t){return e.split(t).length-1}var Ji=`narraeon.extension.v1`;function Yi(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 Xi(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 Zi(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 Qi=[`story`,`sidebar`,`composer_above`,`composer_below`,`overlay`,`debug`],$i=(0,l.createContext)(null);function ea({worldId:e,artifacts:t,playerViewPanels:n=[],playerViews:r,interactionDisabled:i=!1,onSetComposerDraft:a,onRefresh:o,onBridgeEvent:s,children:c}){let[u,d]=(0,l.useState)(()=>new Set),[f,p]=(0,l.useState)(()=>new Map),[m,h]=(0,l.useState)(()=>new Map),g=(0,l.useMemo)(()=>{let e=new Map;for(let t of Qi)e.set(t,[]);let r=[...t,...n.map(na)];for(let t of r){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,n]),_=(0,l.useMemo)(()=>({worldId:e,artifacts:t,playerViewPanels:n,playerViews:r,interactionDisabled:i,onSetComposerDraft:a,onRefresh:o,...s===void 0?{}:{onBridgeEvent:s},children:c,byMount:g,disabled:u,errors:f,bridgeEvents:m,disable:e=>d(t=>new Set(t).add(e)),enable:e=>{d(t=>{let n=new Set(t);return n.delete(e),n}),p(t=>{let n=new Map(t);return n.delete(e),n})},error:(e,t)=>p(n=>new Map(n).set(e,t)),bridgeEvent:(e,t,n)=>{h(t=>{let r=new Map(t);return r.set(e,[...r.get(e)??[],n]),r}),s?.(t,n)}}),[t,m,g,c,u,f,s,o,a,r,n,i,e]);return(0,q.jsx)($i.Provider,{value:_,children:c})}function ta({mount:e}){let t=(0,l.useContext)($i);if(t===null)throw Error(A(`ArtifactExtensionMount 必须位于 ArtifactExtensionHost 内`));let n=t.byMount.get(e)??[];return(0,q.jsx)(`div`,{className:`artifact-extension-mount artifact-extension-mount-${e}`,"data-extension-mount":e,children:n.map(e=>{let n=Ri(e);return(0,q.jsx)(ra,{artifact:e,worldId:t.worldId,channelArtifacts:t.artifacts.filter(({channel:t})=>t===e.channel),playerViews:t.playerViews.views,interactionDisabled:t.interactionDisabled,disabled:t.disabled.has(n),error:t.errors.get(n),events:t.bridgeEvents.get(n)??[],onDisable:()=>t.disable(n),onEnable:()=>t.enable(n),onError:e=>t.error(n,e),onBridgeEvent:r=>t.bridgeEvent(n,e.recordId,r),onSetComposerDraft:t.onSetComposerDraft,onRefresh:t.onRefresh},n)})})}function na(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 ra({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-${da(Ri(e))}`,[g,_]=(0,l.useState)(()=>({epoch:0,nonce:fa()})),v=g.nonce,[y,b]=(0,l.useState)(!1),x=(0,l.useMemo)(()=>Vi({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,ee=(0,l.useMemo)(()=>{try{return{srcDoc:w&&C!==void 0?Wi({renderer:C,instanceId:h,nonce:v}):Hi(T,e.contentType,C,e.payload),error:void 0}}catch(e){return{srcDoc:``,error:e instanceof Error?e.message:A(`文档 renderer 无效`)}}},[e.contentType,e.payload,T,h,w,v,C]),E=ee.srcDoc,D=ee.error,te=o??D??(x.failure===`fail`?x.error:void 0),O=(0,l.useCallback)(()=>{b(!1),_(e=>({epoch:e.epoch+1,nonce:fa()})),m()},[m]),k=(0,l.useCallback)(()=>{let n=S.current;!w||n?.contentWindow==null||n.contentWindow.postMessage({namespace:Ji,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(Xi(e.data,{instanceId:h,nonce:v})){b(!0),f(`bridge.ready`);return}if(Zi(e.data,{instanceId:h,nonce:v})){let t=pa(e.data.payload)?e.data.payload:{};f(`diagnostic`),d(typeof t.message==`string`?t.message:A(`扩展报告了未知诊断`));return}if(!Yi(e.data,{instanceId:h,nonce:v}))return;f(e.data.command);let t=pa(e.data.payload)?e.data.payload:{};if(e.data.command===`read_channel`)ia(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:``;ia(e,e.data,{view:r.find(e=>pa(e)&&e.id===n)})}else e.data.command===`composer.set_draft`?i?oa(e,e.data,A(`当前调用链正在提交,暂不能修改草稿`)):typeof t.text==`string`?(p(t.text),aa(e,e.data,{accepted:!0})):oa(e,e.data,A(`composer.set_draft.text 必须是字符串`)):e.data.command===`panel.close`?(c(),ia(e,e.data,{accepted:!0})):e.data.command===`panel.refresh`?(O(),ia(e,e.data,{accepted:!0})):e.data.command===`diagnostic`&&d(typeof t.message==`string`?t.message:A(`扩展报告了未知诊断`))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[n,h,v,f,c,d,m,p,i,r,O]),(0,l.useEffect)(()=>{y&&k()},[y,k]);function ne(){b(!0),w&&window.setTimeout(k,0)}return(0,q.jsxs)(`article`,{className:`artifact-extension-instance${te?` has-error`:``}`,"data-artifact-output":e.output,"data-artifact-status":e.frontend.status,"data-extension-authority":e.frontend.authority??`non_authoritative_artifact`,children:[a||te||e.frontend.fallback===`raw`||x.fallback?(0,q.jsxs)(`div`,{className:`artifact-extension-fallback`,role:`status`,children:[(0,q.jsx)(`p`,{children:te??x.error??e.frontend.diagnostic??A(`扩展资源不可用,显示 raw artifact。`)}),(0,q.jsx)(`pre`,{children:x.original}),(0,q.jsx)(`button`,{type:`button`,onClick:a?u:c,children:A(a?`恢复此扩展`:`停用此扩展`)})]}):(0,q.jsxs)(q.Fragment,{children:[e.frontend.trustedLocalCode?(0,q.jsx)(`small`,{className:`artifact-extension-trusted-label`,children:A(`本地可信代码`)}):null,(0,q.jsx)(`iframe`,{ref:S,title:e.output,className:`artifact-extension-frame`,sandbox:e.frontend.trustedLocalCode?`allow-scripts`:``,srcDoc:E,onLoad:ne,onError:()=>d(A(`扩展 iframe 加载失败`))},g.epoch)]}),e.frontend.mount===`debug`?(0,q.jsxs)(`details`,{className:`artifact-extension-debug`,children:[(0,q.jsx)(`summary`,{children:A(`产物诊断`)}),(0,q.jsxs)(`dl`,{children:[(0,q.jsx)(`dt`,{children:A(`来源`)}),(0,q.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,q.jsx)(`dt`,{children:A(`保存/投影`)}),(0,q.jsxs)(`dd`,{children:[e.save,` / `,e.projection]}),(0,q.jsx)(`dt`,{children:`renderer revision`}),(0,q.jsx)(`dd`,{children:e.frontend.renderer?.revision??`built-in`})]}),(0,q.jsx)(`p`,{children:`raw payload`}),(0,q.jsx)(`pre`,{children:x.original}),(0,q.jsx)(`p`,{children:`regex steps`}),(0,q.jsx)(`pre`,{children:JSON.stringify(x.steps,null,2)}),s.length===0?null:(0,q.jsxs)(`p`,{children:[`bridge events: `,s.join(`, `)]})]}):null,s.length===0?null:(0,q.jsxs)(`details`,{className:`artifact-extension-events`,children:[(0,q.jsxs)(`summary`,{children:[A(`bridge 事件(`),s.length,`)`]}),(0,q.jsx)(`ul`,{children:s.map((e,t)=>(0,q.jsx)(`li`,{children:e},`${e}-${t}`))})]})]})}function ia(e,t,n){aa(e,t,n)}function aa(e,t,n){sa(e,t,{ok:!0,payload:n})}function oa(e,t,n){sa(e,t,{ok:!1,error:n})}function sa(e,t,n){if(t.requestId===void 0)return;let r=e.source;r!==null&&`postMessage`in r&&r.postMessage({namespace:Ji,type:`bridge.response`,ok:n.ok,requestId:t.requestId,instanceId:t.instanceId,nonce:t.nonce,...n.ok?{payload:n.payload}:{error:n.error}},`*`)}function ca(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 la(e){return e.replace(/`([^`]+)`/gu,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/gu,`<strong>$1</strong>`)}function ua(e){return e.replace(/&/gu,`&amp;`).replace(/</gu,`&lt;`).replace(/>/gu,`&gt;`).replace(/"/gu,`&quot;`).replace(/'/gu,`&#39;`)}function da(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 fa(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}function pa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ma=[{id:`call_chain`,label:`调用链`,description:`叙事规则、后置请求与工具契约`},{id:`setting_improvement`,label:`设定完善`,description:`AI 创作方法;工具契约保持内置`},{id:`extensions`,label:`界面扩展`,description:`频道挂载、面板与扩展引用`},{id:`blocks`,label:`提示内容`,description:`阅读、编辑并排序主持规则块`},{id:`files`,label:`高级文件`,description:`带用途说明的完整源文件`},{id:`preview`,label:`产物预览`,description:`冻结 contract 与 renderer 的真实预览`}];function ha(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 ga(e){return Object.prototype.hasOwnProperty.call(e,`preset.yaml`)?`preset.yaml`:Object.prototype.hasOwnProperty.call(e,`call-chain.yaml`)?`call-chain.yaml`:Object.keys(e).sort()[0]??``}function _a({client:e,initialLibrary:t,recommendedTemplates:n=[],onLibraryChange:r,onDirtyChange:i,renderPromptPreview:a}){let o=C(re()),[s,c]=(0,l.useState)(t),u=t.presets.find(({id:e})=>e===t.currentPresetId)??t.presets[0],[d,f]=(0,l.useState)(u?.id??``),[p,m]=(0,l.useState)(()=>u===void 0?null:ha(u)),[h,g]=(0,l.useState)(u?.files===void 0?``:ga(u.draft?.files??u.files)),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(`call_chain`),[w,T]=(0,l.useState)(!1),[ee,E]=(0,l.useState)(null),[D,te]=(0,l.useState)(null),[O,k]=(0,l.useState)(!1),[ne,ie]=(0,l.useState)(null),j=(0,l.useRef)(0),M=(0,l.useMemo)(()=>s.presets.find(({id:e})=>e===p?.id),[p?.id,s.presets]),N=M?.draft??M,P=p!==null&&N!==void 0&&(JSON.stringify(p.files)!==JSON.stringify(N.files)||JSON.stringify(p.structure)!==JSON.stringify(N.structure)),ae=p!==null&&M!==void 0&&p.name!==M.name,F=p!==null&&M!==void 0&&(ae||P),I=(0,l.useMemo)(()=>{let e=p?.structure?.callChainPath??N?.structure?.callChainPath??`call-chain.yaml`;return new Set([`preset.yaml`,e])},[p?.structure?.callChainPath,N?.structure?.callChainPath]),L=p!==null&&N!==void 0&&[...I].some(e=>p.files[e]!==N.files[e]),oe=p!==null&&N!==void 0&&JSON.stringify(p.structure)!==JSON.stringify(N.structure),R=L&&oe,z=s.presets.find(({id:e})=>e===s.currentPresetId),se=p?.structure?.followups.length??0,B=p?.structure?.followups.reduce((e,t)=>e+t.artifacts.length,0)??0,V=p?.structure?.mounts.length??0,ce=p===null?0:Object.keys(p.files).length;(0,l.useEffect)(()=>{i(F)},[F,i]),(0,l.useEffect)(()=>()=>i(!1),[i]),(0,l.useEffect)(()=>{let t=p,n=++j.current;if(t?.validation.status!==`valid`||t?.id!==d||F)return;let r=!0;return queueMicrotask(()=>{r&&n===j.current&&k(!0)}),Promise.resolve(e.request({type:`play.workbench.read`,presetId:t.id,revision:t.revision})).then(e=>{e!==void 0&&r&&n===j.current&&e.id===t.id&&e.revision===t.revision&&te(e)}).catch(()=>{r&&n===j.current&&te(null)}).finally(()=>{r&&n===j.current&&k(!1)}),()=>{r=!1}},[e,F,p,d]);let H=p!==null&&p.validation.status===`valid`&&p.id===d&&!F&&D?.id===p.id&&D.revision===p.revision?D:null,le=p!==null&&p.validation.status===`valid`&&p.id===d&&!F&&O;async function ue(t){let n=await e.request({type:`play.read`}),i=n.presets.find(({id:e})=>e===t)??n.presets.find(({id:e})=>e===d)??n.presets.find(({id:e})=>e===n.currentPresetId)??n.presets[0];c(n),r(n),f(i?.id??``);let a=i===void 0?null:ha(i);m(a),g(a===null?``:ga(a.files)),ie(null)}async function U(e){if(!w){T(!0),E(null);try{await e()}catch(e){E({kind:`error`,text:e instanceof Error?e.message:A(`玩法预设操作失败`)})}finally{T(!1)}}}function de(e){if(e===d)return;if(F&&e!==d){E({kind:`error`,text:A(`当前玩法有未保存修改;请先保存或撤销,再切换预设。`)});return}let t=s.presets.find(({id:t})=>t===e);if(t===void 0)return;f(e);let n=ha(t);m(n),g(ga(n.files)),te(null),ie(null),E(null),S(`call_chain`)}function fe(){if(M===void 0)return;let e=ha(M);m(e),g(ga(e.files)),ie(null),E({kind:`status`,text:A(`已撤销当前未保存修改。`)})}function pe(e){p!==null&&h!==``&&me(h,e)}function me(e,t){m(n=>n===null?null:{...n,files:{...n.files,[e]:t}})}function he(e){m(t=>t===null?null:{...t,files:e(structuredClone(t.files))})}function ge(e){m(t=>t?.structure===void 0?t:{...t,structure:e(structuredClone(t.structure))}),ie(null)}async function _e(){if(p!==null){if(R){E({kind:`error`,text:A(`preset.yaml/call-chain.yaml 与结构化编辑同时修改;请保留一种编辑方式后再保存,避免静默覆盖。`)});return}await U(async()=>{await e.request({type:`play.save`,presetId:p.id,name:p.name,files:p.files,...p.structure===void 0||!oe?{}:{structure:p.structure}}),await ue(p.id),E({kind:`status`,text:A(`玩法文件与结构化草稿已保存。`)})})}}async function ve(){p!==null&&await U(async()=>{let t=await e.request({type:`play.export`,presetId:p.id}),n=new Blob([JSON.stringify(t.files,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${p.name}.play-preset.json`,i.click(),URL.revokeObjectURL(r),E({kind:`status`,text:A(`玩法预设业务文件已导出。`)})})}async function ye(t){t!==void 0&&await U(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(A(`导入文件必须是 UTF-8 玩法业务文件数组`));await ue((await e.request({type:`play.import`,name:t.name.replace(/\.play-preset\.json$/iu,``)||A(`导入玩法`),files:n})).preset.id),E({kind:`status`,text:A(`玩法预设已导入为新的本地身份;请显式启用其中的 JavaScript。`)})})}return(0,q.jsxs)(`section`,{className:`play-preset-screen`,"aria-labelledby":`play-preset-title`,children:[(0,q.jsxs)(`header`,{className:`play-preset-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`PLAY WORKBENCH · FILE NATIVE`}),(0,q.jsx)(`h2`,{id:`play-preset-title`,children:A(`玩法预设`)}),(0,q.jsx)(`p`,{className:`play-preset-lede`,children:A(`在同一处管理设定完善方法、主持规则、调用链、界面产物与可信本地代码。`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-header-fact`,children:[(0,q.jsx)(`span`,{children:A(`新调用链与设定完善当前使用`)}),(0,q.jsx)(`strong`,{children:z?.name??A(`未选择`)}),(0,q.jsx)(`small`,{children:A(`已经开始的模型会话继续使用冻结 revision`)})]})]}),ee===null?null:(0,q.jsx)(`div`,{className:`play-preset-feedback ${ee.kind}`,role:ee.kind===`error`?`alert`:`status`,children:ee.text}),(0,q.jsxs)(`fieldset`,{disabled:w,className:`play-preset-workspace`,children:[(0,q.jsx)(`legend`,{className:`visually-hidden`,children:A(`玩法预设工作区`)}),(0,q.jsxs)(`div`,{className:`play-preset-layout`,children:[(0,q.jsxs)(`aside`,{className:`panel-card play-preset-library`,"aria-label":A(`玩法预设列表`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`PRESET LIBRARY`}),(0,q.jsx)(`h3`,{children:A(`本地预设`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`选择一个本地身份开始编辑。`)})]}),(0,q.jsx)(`ul`,{className:`play-preset-list`,children:s.presets.map(e=>{let t=e.id===d;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{className:`play-preset-list-button${t?` selected`:``}`,type:`button`,"aria-pressed":t,disabled:w||F&&!t,onClick:()=>de(e.id),children:[(0,q.jsx)(`span`,{className:`play-preset-list-name`,children:e.name}),(0,q.jsxs)(`span`,{className:`play-preset-list-badges`,children:[e.id===s.currentPresetId?(0,q.jsx)(`span`,{className:`play-preset-badge current`,children:A(`当前玩法`)}):null,(0,q.jsx)(`span`,{className:`play-preset-badge ${e.validation.status}`,children:e.validation.status===`valid`?A(`结构有效`):A(`需要修复`)}),e.enabled===!1?(0,q.jsx)(`span`,{className:`play-preset-badge disabled`,children:A(`已停用`)}):null]})]})},e.id)})}),(0,q.jsxs)(`section`,{className:`play-preset-library-actions`,"aria-label":A(`新建与导入玩法预设`),children:[(0,q.jsx)(`h4`,{children:A(`新建或导入`)}),(0,q.jsx)(`input`,{"aria-label":A(`新玩法预设名称`),placeholder:A(`新玩法预设名称`),value:_,onChange:e=>v(e.currentTarget.value)}),(0,q.jsx)(`button`,{type:`button`,disabled:w||F||_.trim()===``,onClick:()=>void U(async()=>{let t=await e.request({type:`play.create`,name:_.trim()});v(``),await ue(t.preset.id),E({kind:`status`,text:A(`已新建普通玩法预设。`)})}),children:A(`新建空白预设`)}),n.map(t=>(0,q.jsxs)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F,onClick:()=>void U(async()=>{await ue((await e.request({type:`play.create`,name:t.name,files:structuredClone(t.files)})).preset.id),E({kind:`status`,text:A(`已复制推荐{name};所有文件均可编辑。`,{name:t.label})})}),children:[A(`复制推荐`),t.label]},t.id)),(0,q.jsxs)(`label`,{className:`play-preset-import-control`,children:[A(`导入玩法文件`),(0,q.jsx)(`input`,{"aria-label":A(`导入玩法预设文件`),type:`file`,accept:`.json,application/json`,disabled:w||F,onChange:e=>{ye(e.currentTarget.files?.[0]),e.currentTarget.value=``}})]})]})]}),p===null?(0,q.jsx)(`section`,{className:`panel-card`,role:`status`,children:A(`还没有玩法预设。`)}):(0,q.jsxs)(`section`,{className:`panel-card play-preset-editor`,"aria-label":A(`玩法预设文件编辑器`),children:[(0,q.jsxs)(`header`,{className:`play-preset-editor-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`EDIT PRESET`}),(0,q.jsx)(`h3`,{children:p.name}),(0,q.jsxs)(`p`,{className:`field-note`,children:[`revision `,p.revision,` `,A(`· 修改只影响之后开始的全新上下文`)]})]}),(0,q.jsxs)(`div`,{className:`play-preset-editor-badges`,children:[(0,q.jsx)(`span`,{className:`play-preset-draft-state${F?` dirty`:``}`,children:A(F?`未保存修改`:`已保存`)}),p.id===s.currentPresetId?(0,q.jsx)(`span`,{className:`play-preset-badge current`,children:A(`当前玩法`)}):null,p.enabled===!1?(0,q.jsx)(`span`,{className:`play-preset-badge disabled`,children:A(`已停用`)}):null,(0,q.jsx)(`span`,{className:`play-preset-badge`,children:p.scriptsEnabled===!0?A(`JavaScript 已启用`):A(`JavaScript 已停用`)})]})]}),(0,q.jsxs)(`label`,{className:`play-preset-name-field`,children:[A(`预设名称`),(0,q.jsx)(`input`,{"aria-label":A(`玩法预设名称`),maxLength:160,value:p.name,onChange:e=>m({...p,name:e.currentTarget.value})})]}),(0,q.jsxs)(`details`,{className:`play-preset-operations`,children:[(0,q.jsx)(`summary`,{children:A(`预设操作`)}),(0,q.jsxs)(`div`,{className:`play-preset-management`,"aria-label":A(`玩法预设身份管理`),children:[(0,q.jsx)(`p`,{children:A(`这些操作只管理这份本地预设;内容编辑和保存仍在页面底部完成。`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F,onClick:()=>void U(async()=>{await e.request({type:`play.enable`,presetId:p.id,enabled:p.enabled===!1}),await ue(p.id),E({kind:`status`,text:A(`玩法预设状态已更新。`)})}),children:p.enabled===!1?A(`启用预设`):A(`停用预设`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F,onClick:()=>void U(async()=>{await e.request({type:`play.scripts`,presetId:p.id,enabled:p.scriptsEnabled!==!0}),await ue(p.id),E({kind:`status`,text:p.scriptsEnabled===!0?A(`JavaScript 已停用;raw/document 仍可预览。`):A(`JavaScript 已显式启用(本地可信代码)。`)})}),children:p.scriptsEnabled===!0?A(`停用 JavaScript`):A(`启用 JavaScript(本地可信代码)`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F,onClick:()=>void U(async()=>{await ue((await e.request({type:`play.copy`,presetId:p.id})).preset.id),E({kind:`status`,text:A(`已复制为独立本地身份。`)})}),children:A(`复制为新预设`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F,onClick:()=>void ve(),children:A(`导出业务文件`)}),(0,q.jsx)(`button`,{type:`button`,className:`danger-button`,disabled:w||F,onClick:()=>void U(async()=>{await e.request({type:`play.delete`,presetId:p.id}),await ue(),E({kind:`status`,text:A(`玩法预设已删除;删空后会自动重建默认预设。`)})}),children:A(`删除预设`)})]}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`导入的 JavaScript 默认停用;启用表示你信任这些本地文件,而不是获得安全沙箱保证。`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-overview`,"aria-label":A(`玩法预设摘要`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`后置请求`)}),(0,q.jsx)(`strong`,{children:se})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`产物输出`)}),(0,q.jsx)(`strong`,{children:B})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`界面挂载`)}),(0,q.jsx)(`strong`,{children:V})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:A(`普通文件`)}),(0,q.jsx)(`strong`,{children:ce})]})]}),(0,q.jsx)(`nav`,{className:`play-preset-workspace-nav`,role:`tablist`,"aria-label":A(`玩法预设编辑区域`),children:ma.map(e=>(0,q.jsxs)(`button`,{id:`play-preset-tab-${e.id}`,type:`button`,role:`tab`,"aria-controls":`play-preset-panel-${e.id}`,"aria-selected":x===e.id,className:x===e.id?`selected`:``,onClick:()=>S(e.id),children:[(0,q.jsx)(`strong`,{children:A(e.label)}),(0,q.jsx)(`span`,{children:A(e.description)})]},e.id))}),p.structure===void 0||x!==`call_chain`&&x!==`extensions`?null:(0,q.jsx)(ya,{view:x,structure:p.structure,files:p.files,workbench:H,workbenchPending:le,structuredError:ne,onChange:ge,onFileChange:me,onCreateFile:(e,t)=>he(n=>({...n,[e]:t})),onError:ie}),p.structure!==void 0&&x===`setting_improvement`?(0,q.jsx)(va,{structure:p.structure,files:p.files,systemPrompt:o,onChange:ge,onFileChange:me,onCreateFile:(e,t)=>he(n=>({...n,[e]:t}))}):null,x===`blocks`&&(0,q.jsx)(Wa,{files:p.files,pending:w,onChange:e=>he(()=>structuredClone(e)),onFeedback:E}),x===`files`?(0,q.jsx)(Ia,{files:p.files,filePath:h,newFilePath:y,pending:w,onFilePathChange:g,onNewFilePathChange:b,onFileChange:pe,onCreateFile:()=>{let e=y.trim();if(p.files[e]!==void 0){E({kind:`error`,text:A(`该玩法文件路径已经存在。`)});return}he(t=>({...t,[e]:``})),g(e),b(``),E({kind:`status`,text:A(`已加入普通文件草稿;保存时会通过 codec 校验。`)})}}):null,p.structure===void 0&&(x===`call_chain`||x===`extensions`||x===`setting_improvement`)?(0,q.jsxs)(`section`,{id:`play-preset-panel-${x}`,className:`play-preset-empty-view`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-${x}`,children:[(0,q.jsx)(`strong`,{children:A(`结构化编辑暂不可用`)}),(0,q.jsx)(`p`,{children:A(`当前草稿无法生成结构投影。请到“高级文件”修复 preset.yaml 或 call-chain.yaml,保存后再回来。`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,onClick:()=>S(`files`),children:A(`前往高级文件`)})]}):null,x===`preview`?(0,q.jsxs)(`section`,{id:`play-preset-panel-preview`,className:`play-preset-preview-workspace`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-preview`,children:[(0,q.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`FROZEN REVISION`}),(0,q.jsx)(`h4`,{children:A(`预览当前预设`)})]}),(0,q.jsx)(`p`,{children:A(`产物外观与真实调用链提示词都留在这里检查,不会调用模型或离开当前预设。`)})]}),le?(0,q.jsx)(`p`,{role:`status`,children:A(`正在生成真实编译/产物预览…`)}):null,H?.staticErrors.length?(0,q.jsx)(`ul`,{"aria-label":A(`工作台静态错误`),children:H.staticErrors.map(e=>(0,q.jsxs)(`li`,{children:[e.location,` · `,e.message]},`${e.location}:${e.code}`))}):null,(0,q.jsx)(za,{workbench:H}),(0,q.jsxs)(`section`,{className:`play-preset-prompt-preview`,"aria-label":A(`当前预设的真实提示词预览`),children:[(0,q.jsx)(`h3`,{children:A(`真实调用链预览`)}),F?(0,q.jsx)(`p`,{className:`field-note`,children:A(`请先保存当前修改;真实预览只编译已冻结的有效 revision。`)}):p.validation.status===`valid`?a===void 0?(0,q.jsx)(`p`,{className:`field-note`,children:A(`当前宿主没有提供提示词预览面板。`)}):a({presetId:p.id,revision:p.revision}):(0,q.jsx)(`p`,{className:`field-note`,children:A(`当前 revision 需要修复,暂时不能编译真实调用链。`)})]})]}):null,(0,q.jsxs)(`footer`,{className:`play-preset-editor-actions`,children:[R?(0,q.jsx)(`p`,{role:`alert`,className:`workspace-feedback`,children:A(`preset.yaml/call-chain.yaml 与结构化字段均有未保存修改;请撤销其中一侧后再保存,避免 stale structure 覆盖 raw YAML。`)}):null,(0,q.jsxs)(`div`,{className:`play-preset-save-state`,children:[(0,q.jsx)(`strong`,{children:F?A(`草稿尚未保存`):p.validation.status===`valid`?A(`结构校验通过`):A(`草稿需要修复`)}),(0,q.jsx)(`span`,{children:p.validation.status===`valid`?`revision ${p.revision}`:`[${p.validation.code??`play_preset_invalid`}] ${p.validation.location??`call-chain.yaml`}:${p.validation.message}`})]}),(0,q.jsxs)(`div`,{className:`play-preset-primary-actions`,children:[F?(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w,onClick:fe,children:A(`撤销未保存修改`)}):null,(0,q.jsx)(`button`,{type:`button`,disabled:w||!F||R,onClick:()=>void _e(),children:A(`保存修改`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:w||F||p.validation.status!==`valid`,onClick:()=>void U(async()=>{await e.request({type:`play.select`,presetId:p.id}),await ue(p.id),E({kind:`status`,text:A(`已将该冻结 revision 设为当前玩法。`)})}),children:A(`应用为当前玩法`)})]})]})]})]})]})]})}function va({structure:e,files:t,systemPrompt:n,onChange:r,onFileChange:i,onCreateFile:a}){let o=e.settingImprovementPrompt;return(0,q.jsxs)(`section`,{id:`play-preset-panel-setting_improvement`,className:`play-preset-structured-editor`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-setting_improvement`,children:[(0,q.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`AI AUTHORING`}),(0,q.jsx)(`h3`,{children:A(`AI 设定完善`)})]}),(0,q.jsx)(`p`,{children:A(`这份文字决定 AI 怎样理解、规划和创作内容包设定;每次开始完善时会冻结当前预设 revision。`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-concept-note`,children:[(0,q.jsx)(`strong`,{children:A(`工具为什么不在这里?`)}),(0,q.jsx)(`p`,{children:A(`Runtime 继续内置 setting_* 工具定义、参数、说明、只读/写入阶段边界和候选终态协议。预设只能编辑创作语义,不能替换这些机械契约。`)})]}),o===void 0?(0,q.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:A(`沿用系统推荐提示`)}),(0,q.jsx)(`p`,{children:A(`这是一份功能加入前保存的 v1 预设。打开页面不会改写它;写入后才会产生新的预设 revision。`)})]}),(0,q.jsx)(`textarea`,{"aria-label":A(`系统推荐设定完善提示词`),value:n,readOnly:!0,spellCheck:!1}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{a(b,t[`prompts/setting-improvement.md`]?.trim()?t[b]:n),r(e=>({...e,settingImprovementPrompt:{role:`author_instruction`,path:b}}))},children:A(`写入预设并编辑`)})]}):(0,q.jsx)(`div`,{className:`play-preset-structured-section`,children:(0,q.jsx)(Sa,{label:A(`设定完善创作提示`),path:o.path,paths:Aa(t),files:t,onPathChange:e=>r(t=>({...t,settingImprovementPrompt:{...o,path:e}})),onContentsChange:e=>i(o.path,e)})})]})}function ya({view:e,structure:t,files:n,workbench:r,workbenchPending:i,structuredError:a,onChange:o,onFileChange:s,onCreateFile:c,onError:l}){let u=Aa(n),d=t.followups.flatMap((e,t)=>e.artifacts.map((n,r)=>({followup:e,followupIndex:t,artifact:n,artifactIndex:r}))),f=new Set(d.map(({artifact:e})=>e.channel)),p=t.mounts.filter(({channel:e})=>!f.has(e));function m(){let e=Ma(n,`prompts/narrative-${t.narrativePrompts.length+1}.md`);c(e,A(`# 叙事规则
1184
-
1185
- 说明 AI 每次写玩家可见正文时都应遵守的规则。
1186
- `)),o(t=>({...t,narrativePrompts:[...t.narrativePrompts,{role:`author_instruction`,path:e}]}))}function h(){let e=new Set(t.followups.map(({id:e})=>e)),r=t.followups.length+1,i=`followup_${r}`;for(;e.has(i);)r+=1,i=`followup_${r}`;let a=Ma(n,`prompts/${i}.md`),s=`${i}_output`,l=`${i}.output`;c(a,A(`# 新后置请求
1187
-
1188
- 说明主调用链完成后,需要额外整理成什么界面内容。
1189
- `)),o(e=>({...e,mounts:[...e.mounts,{channel:l,mount:`story`}],followups:[...e.followups,{id:i,displayName:A(`新后置请求`),prompt:{role:`author_instruction`,path:a},artifacts:[Ta(s,l)],maxArtifactBytes:32768}]}))}function g(e,t){o(n=>({...n,followups:n.followups.map((n,r)=>r===e?t(n):n)}))}function _(e,t,n){o(r=>{let i=r.followups[e],a=i?.artifacts[t];if(i===void 0||a===void 0)return r;let o=n(a);return{...r,mounts:o.channel===a.channel?r.mounts:r.mounts.map(e=>e.channel===a.channel?{...e,channel:o.channel}:e),followups:r.followups.map((n,r)=>r===e?{...n,artifacts:n.artifacts.map((e,n)=>n===t?o:e)}:n)}})}function v(e,t){o(n=>({...n,mounts:[...n.mounts.filter(t=>t.channel!==e),...t===``?[]:[{channel:e,mount:t}]]}))}return(0,q.jsxs)(`section`,{id:`play-preset-panel-${e}`,className:`play-preset-structured-editor`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-${e}`,children:[(0,q.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:e===`call_chain`?`PLAY CALL CHAIN`:`PRESENTATION`}),(0,q.jsx)(`h3`,{children:A(e===`call_chain`?`调用链`:`界面扩展`)})]}),(0,q.jsx)(`p`,{children:A(e===`call_chain`?`先编辑 AI 主响应要遵守的文字规则,再按需添加主响应结束后的界面产物。提示内容直接显示,不需要填写文件路径。`:`选择产物显示在哪里,并用普通表单配置玩家视图和扩展文件;无需手写 JSON。`)}),i?(0,q.jsx)(`p`,{role:`status`,children:A(`正在生成真实编译/产物预览…`)}):null,r===null&&!i?(0,q.jsx)(`p`,{className:`field-note`,children:A(`保存有效 revision 后生成真实预览。`)}):null,a===null?null:(0,q.jsx)(`p`,{role:`alert`,className:`workspace-feedback`,children:a}),r?.staticErrors.length?(0,q.jsx)(`ul`,{"aria-label":A(`工作台静态错误`),children:r.staticErrors.map(e=>(0,q.jsxs)(`li`,{children:[e.location,` · `,e.message]},`${e.location}:${e.code}`))}):null]}),e===`extensions`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`play-preset-concept-note`,children:[(0,q.jsx)(`strong`,{children:A(`频道是什么?`)}),(0,q.jsx)(`p`,{children:A(`频道只是“产物送到哪里”的内部连线:后置请求产出内容,页面按同名频道把它放到你选择的位置。普通编辑只需选显示位置,技术地址会自动保留。`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,q.jsx)(`div`,{className:`play-preset-section-header`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:A(`产物显示位置`)}),(0,q.jsx)(`p`,{children:A(`每项都来自“调用链”中的一个真实产物输出。`)})]})}),d.length===0?(0,q.jsx)(`p`,{className:`play-preset-empty-copy`,children:A(`当前没有后置产物。先在“调用链”新增后置请求,这里才会出现可放置的内容。`)}):(0,q.jsx)(`div`,{className:`play-preset-placement-list`,children:d.map(({followup:e,artifact:n})=>(0,q.jsxs)(`article`,{className:`play-preset-placement-card`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:n.name}),(0,q.jsx)(`span`,{children:e.displayName}),(0,q.jsx)(`code`,{children:n.channel})]}),(0,q.jsxs)(`label`,{children:[A(`显示位置`),(0,q.jsx)(xa,{ariaLabel:A(`{name} 显示位置`,{name:n.name}),value:t.mounts.find(({channel:e})=>e===n.channel)?.mount??``,allowNone:!0,onChange:e=>v(n.channel,e)})]})]},`${e.id}:${n.name}`))}),p.length===0?null:(0,q.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,q.jsx)(`summary`,{children:A(`未连接到当前产物的旧频道`)}),p.map(e=>(0,q.jsxs)(`div`,{className:`play-preset-inline-editor`,children:[(0,q.jsx)(`code`,{children:e.channel}),(0,q.jsx)(xa,{ariaLabel:A(`{name} 显示位置`,{name:e.channel}),value:e.mount,allowNone:!0,onChange:t=>v(e.channel,t)})]},e.channel))]})]}),(0,q.jsx)(Fa,{panels:t.playerViewPanels,files:n,onChange:e=>o(t=>({...t,playerViewPanels:e}))}),(0,q.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,q.jsx)(`h4`,{children:A(`随预设加载的界面文件`)}),(0,q.jsx)(`p`,{children:A(`勾选 renderer、脚本和样式等前端资源。这里只选择已有文件,不需要写数组格式。`)}),(0,q.jsx)(Ca,{ariaLabel:A(`界面扩展文件`),paths:ja(n),selected:t.extensionRefs,emptyText:A(`当前还没有 renderer、脚本或样式文件。`),onChange:e=>o(t=>({...t,extensionRefs:e}))})]})]}):null,e===`call_chain`?(0,q.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,q.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,q.jsx)(`h4`,{children:A(`叙事提示块`)}),(0,q.jsx)(`button`,{type:`button`,onClick:m,children:A(`新增叙事提示块`)})]}),(0,q.jsx)(`p`,{children:A(`这些文字和主持规则一起进入稳定 bootstrap,约束调用链中的玩家可见正文。下方直接显示真实内容。`)}),t.narrativePrompts.length===0?(0,q.jsx)(`p`,{children:A(`尚未声明叙事提示块;通用文风仍由主持块提供。`)}):null,(0,q.jsx)(`ol`,{"aria-label":A(`叙事提示块`),children:t.narrativePrompts.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(Sa,{label:A(`叙事规则 {index}`,{index:t+1}),path:e.path,paths:u,files:n,onPathChange:e=>o(n=>({...n,narrativePrompts:n.narrativePrompts.map((n,r)=>r===t?{...n,path:e}:n)})),onContentsChange:t=>s(e.path,t)}),(0,q.jsx)(`button`,{type:`button`,"aria-label":A(`删除叙事提示块 {index}`,{index:t+1}),onClick:()=>o(e=>({...e,narrativePrompts:e.narrativePrompts.filter((e,n)=>n!==t)})),children:A(`删除`)})]},`narrative-${t}`))}),(0,q.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,q.jsx)(`h4`,{children:A(`后置请求`)}),(0,q.jsx)(`button`,{type:`button`,onClick:h,children:A(`新增后置请求`)})]}),(0,q.jsx)(`p`,{children:A(`每个后置请求在主调用链完成后单独派发一次,共用同一段冻结前缀,彼此看不见对方,也不会进入之后的模型上下文。请求提示、产物格式和显示位置都可在当前页面编辑。`)}),t.followups.length===0?(0,q.jsx)(`p`,{children:A(`没有后置请求;主调用链完成后不会再派发额外请求。`)}):null,(0,q.jsx)(`ol`,{"aria-label":A(`后置请求`),children:t.followups.map((e,r)=>(0,q.jsxs)(`li`,{className:`play-preset-followup-card`,children:[(0,q.jsxs)(`label`,{children:[A(`显示名`),(0,q.jsx)(`input`,{"aria-label":A(`后置请求 {index} 显示名`,{index:r+1}),value:e.displayName,onChange:e=>{let t=e.currentTarget.value;g(r,e=>({...e,displayName:t}))}})]}),(0,q.jsx)(Sa,{label:A(`这次额外请求要做什么`),path:e.prompt.path,paths:u,files:n,onPathChange:e=>g(r,t=>({...t,prompt:{...t.prompt,path:e}})),onContentsChange:t=>s(e.prompt.path,t)}),(0,q.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h5`,{children:A(`输出到界面的产物`)}),(0,q.jsx)(`p`,{children:A(`产物不是世界事实;它只是这次额外请求生成的界面内容。`)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{let t=Ea(e.artifacts),n=`${e.id}.${t}`;o(e=>({...e,mounts:[...e.mounts,{channel:n,mount:`story`}],followups:e.followups.map((e,i)=>i===r?{...e,artifacts:[...e.artifacts,Ta(t,n)]}:e)}))},children:A(`新增产物`)})]}),e.artifacts.length===0?(0,q.jsx)(`p`,{role:`alert`,children:A(`后置请求至少需要一项产物才能保存为有效预设。`)}):(0,q.jsx)(`ol`,{className:`play-preset-artifact-editor-list`,children:e.artifacts.map((e,i)=>(0,q.jsx)(`li`,{children:(0,q.jsx)(wa,{artifact:e,files:n,mount:t.mounts.find(({channel:t})=>t===e.channel)?.mount,onChange:e=>_(r,i,e),onRemove:()=>o(e=>{let t=e.followups[r]?.artifacts[i];if(t===void 0)return e;let n=e.followups.map((e,t)=>t===r?{...e,artifacts:e.artifacts.filter((e,t)=>t!==i)}:e),a=n.some(e=>e.artifacts.some(({channel:e})=>e===t.channel));return{...e,followups:n,mounts:a?e.mounts:e.mounts.filter(({channel:e})=>e!==t.channel)}})})},`${e.name}-${i}`))}),(0,q.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,q.jsx)(`summary`,{children:A(`高级请求设置`)}),(0,q.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,q.jsxs)(`label`,{children:[A(`稳定标识`),(0,q.jsx)(`input`,{"aria-label":A(`后置请求 {index} 标识`,{index:r+1}),value:e.id,onChange:e=>{let t=e.currentTarget.value;g(r,e=>({...e,id:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`本次所有产物合计上限(bytes)`),(0,q.jsx)(`input`,{type:`number`,min:1,max:1048576,value:e.maxArtifactBytes,onChange:e=>{let t=Number(e.currentTarget.value);g(r,e=>({...e,maxArtifactBytes:t}))}})]})]})]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":A(`删除后置请求 {id}`,{id:e.id}),onClick:()=>o(e=>{let t=new Set(e.followups[r]?.artifacts.map(({channel:e})=>e)??[]),n=e.followups.filter((e,t)=>t!==r),i=new Set(n.flatMap(({artifacts:e})=>e.map(({channel:e})=>e)));return{...e,followups:n,mounts:e.mounts.filter(({channel:e})=>!t.has(e)||i.has(e))}}),children:A(`删除`)})]},`followup-${e.id}-${r}`))}),i?(0,q.jsx)(`p`,{children:A(`正在读取产物预览……`)}):null]}):null]})}var ba=[{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 xa({ariaLabel:e,value:t,allowNone:n=!1,onChange:r}){return(0,q.jsxs)(`select`,{"aria-label":e,value:t,onChange:e=>r(e.currentTarget.value),children:[n?(0,q.jsx)(`option`,{value:``,children:A(`不在页面显示`)}):null,ba.map(e=>(0,q.jsxs)(`option`,{value:e.value,children:[A(e.label),` — `,A(e.description)]},e.value))]})}function Sa({label:e,path:t,paths:n,files:r,onPathChange:i,onContentsChange:a}){let o=[...new Set([...n,t])].sort(),s=r[t];return(0,q.jsxs)(`article`,{className:`play-preset-prompt-card`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e}),(0,q.jsx)(`span`,{children:Na(s??``)})]}),(0,q.jsxs)(`label`,{children:[A(`使用哪份内容`),(0,q.jsx)(`select`,{"aria-label":A(`{label} 内容`,{label:e}),value:t,onChange:e=>i(e.currentTarget.value),children:o.map(e=>(0,q.jsx)(`option`,{value:e,children:Na(r[e]??``)||e},e))})]})]}),(0,q.jsx)(`code`,{children:t}),s===void 0?(0,q.jsx)(`p`,{role:`alert`,children:A(`这份提示文件不存在;请改选已有内容或到高级文件修复。`)}):(0,q.jsx)(`textarea`,{"aria-label":A(`编辑提示内容 {path}`,{path:t}),value:s,onChange:e=>a(e.currentTarget.value),spellCheck:!1})]})}function Ca({ariaLabel:e,paths:t,selected:n,emptyText:r,onChange:i}){let a=[...new Set([...t,...n])].sort();return a.length===0?(0,q.jsx)(`p`,{className:`play-preset-empty-copy`,children:r}):(0,q.jsx)(`ul`,{className:`play-preset-path-checklist`,"aria-label":e,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`label`,{children:[(0,q.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,q.jsx)(`span`,{children:La(e,``).title}),(0,q.jsx)(`code`,{children:e})]})},e))})}function wa({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,q.jsxs)(`article`,{className:`play-preset-artifact-definition`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.name}),(0,q.jsxs)(`span`,{children:[Oa(e.contentType),` ·`,n===void 0?A(` 不在页面显示`):` ${Da(n)}`]})]}),(0,q.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:i,children:A(`删除产物`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,q.jsxs)(`label`,{children:[A(`产物标识`),(0,q.jsx)(`input`,{"aria-label":A(`{name} 产物标识`,{name:e.name}),value:e.name,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,name:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`内容格式`),(0,q.jsxs)(`select`,{"aria-label":A(`{name} 内容格式`,{name:e.name}),value:e.contentType,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,contentType:t}))},children:[(0,q.jsx)(`option`,{value:`text/markdown`,children:A(`Markdown 文本`)}),(0,q.jsx)(`option`,{value:`text/plain`,children:A(`纯文本`)}),(0,q.jsx)(`option`,{value:`application/json`,children:A(`结构化数据`)}),(0,q.jsx)(`option`,{value:`text/html`,children:`HTML`})]})]}),(0,q.jsxs)(`label`,{children:[A(`同频道已有内容时`),(0,q.jsxs)(`select`,{"aria-label":A(`{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,q.jsx)(`option`,{value:`replace`,children:A(`替换上一份`)}),(0,q.jsx)(`option`,{value:`append`,children:A(`追加一份`)}),(0,q.jsx)(`option`,{value:`upsert`,children:A(`按 key 更新`)}),(0,q.jsx)(`option`,{value:`transient`,children:A(`仅短暂显示`)}),(0,q.jsx)(`option`,{value:`hidden`,children:A(`保存但不显示`)})]})]}),(0,q.jsxs)(`label`,{className:`play-preset-checkbox-field`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>{let t=e.currentTarget.checked;r(e=>({...e,required:t}))}}),A(`AI 必须生成这项产物`)]})]}),(0,q.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,q.jsx)(`summary`,{children:A(`高级产物设置`)}),(0,q.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,q.jsxs)(`label`,{children:[A(`技术频道地址`),(0,q.jsx)(`input`,{"aria-label":A(`{name} 技术频道`,{name:e.name}),value:e.channel,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,channel:t}))}})]}),e.strategy===`upsert`?(0,q.jsxs)(`label`,{children:[A(`更新 key`),(0,q.jsx)(`input`,{value:e.key??``,onChange:e=>l(`key`,e.currentTarget.value)})]}):null,(0,q.jsxs)(`label`,{children:[A(`保存到`),(0,q.jsxs)(`select`,{value:e.save,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,save:t}))},children:[(0,q.jsx)(`option`,{value:`commit`,children:A(`随权威提交保留`)}),(0,q.jsx)(`option`,{value:`operation`,children:A(`只保留到本次操作结束`)}),(0,q.jsx)(`option`,{value:`none`,children:A(`不持久保存`)})]})]}),(0,q.jsxs)(`label`,{children:[A(`何时失效`),(0,q.jsxs)(`select`,{value:e.invalidation,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,invalidation:t}))},children:[(0,q.jsx)(`option`,{value:`new_operation`,children:A(`下一次操作开始`)}),(0,q.jsx)(`option`,{value:`head_change`,children:A(`世界端点变化`)}),(0,q.jsx)(`option`,{value:`operation_end`,children:A(`本次操作结束`)}),(0,q.jsx)(`option`,{value:`explicit_clear`,children:A(`显式清除`)}),(0,q.jsx)(`option`,{value:`never`,children:A(`永不自动失效`)})]})]}),(0,q.jsxs)(`label`,{children:[A(`单次最多输出次数`),(0,q.jsx)(`input`,{type:`number`,min:1,value:e.maxEmits,onChange:e=>{let t=Number(e.currentTarget.value);r(e=>({...e,maxEmits:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`界面模板`),(0,q.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,q.jsx)(`option`,{value:``,children:A(`使用内置显示`)}),ka(a,e.renderer).map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]})]}),e.renderer===void 0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{children:[A(`模板 revision`),(0,q.jsx)(`input`,{value:e.rendererRevision??``,onChange:e=>l(`rendererRevision`,e.currentTarget.value)})]}),(0,q.jsxs)(`label`,{children:[A(`模板模式`),(0,q.jsxs)(`select`,{value:e.rendererMode??`document`,onChange:e=>{let t=e.currentTarget.value;r(e=>({...e,rendererMode:t}))},children:[(0,q.jsx)(`option`,{value:`document`,children:A(`静态文档`)}),(0,q.jsx)(`option`,{value:`app`,children:A(`可交互 app`)})]})]})]}),(0,q.jsxs)(`label`,{children:[A(`正则处理规则`),(0,q.jsxs)(`select`,{value:e.regex??``,onChange:e=>l(`regex`,e.currentTarget.value),children:[(0,q.jsx)(`option`,{value:``,children:A(`不使用`)}),ka(o,e.regex).map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,q.jsxs)(`div`,{className:`play-preset-resource-columns`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h6`,{children:A(`脚本`)}),(0,q.jsx)(Ca,{ariaLabel:A(`{name} 脚本`,{name:e.name}),paths:s,selected:e.scripts??[],emptyText:A(`没有脚本文件。`),onChange:e=>u(`scripts`,e)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h6`,{children:A(`样式与资源`)}),(0,q.jsx)(Ca,{ariaLabel:A(`{name} 资源`,{name:e.name}),paths:c,selected:e.assets??[],emptyText:A(`没有资源文件。`),onChange:e=>u(`assets`,e)})]})]}),e.payloadContract===void 0?null:(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`当前严格数据格式(只读)`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`常用设置无需改它;需要重写完整 contract 时再到高级文件编辑 call-chain.yaml。`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.payloadContract,null,2)})]})]})]})}function Ta(e,t){return{name:e,channel:t,strategy:`replace`,contentType:`text/markdown`,save:`commit`,invalidation:`new_operation`,required:!1,maxEmits:1}}function Ea(e){let t=new Set(e.map(({name:e})=>e)),n=e.length+1,r=`output_${n}`;for(;t.has(r);)r=`output_${++n}`;return r}function Da(e){let t=ba.find(({value:t})=>t===e)?.label;return t===void 0?e:A(t)}function Oa(e){return{"text/plain":A(`纯文本`),"text/markdown":`Markdown`,"application/json":A(`结构化数据`),"text/html":`HTML`}[e]}function ka(e,t){return[...new Set([...e,...t===void 0?[]:[t]])].sort()}function Aa(e){return Object.keys(e).filter(e=>e.endsWith(`.md`)&&!e.startsWith(`blocks/`)).sort()}function ja(e){return Object.keys(e).filter(e=>e.startsWith(`renderers/`)||e.startsWith(`scripts/`)||e.startsWith(`assets/`)||e.startsWith(`regex/`)).sort()}function Ma(e,t){if(e[t]===void 0)return t;let n=t.lastIndexOf(`.`),r=n<0?t:t.slice(0,n),i=n<0?``:t.slice(n),a=2;for(;e[`${r}-${a}${i}`]!==void 0;)a+=1;return`${r}-${a}${i}`}function Na(e){return/^#\s+(.+)$/mu.exec(e)?.[1]?.trim()??A(`未命名提示内容`)}function Pa(e){let t=e.split(/\r?\n/u).map(e=>e.trim()).filter(e=>e!==``&&!e.startsWith(`#`)).join(` `);return t.length>88?`${t.slice(0,88)}…`:t}function Fa({panels:e,files:t,onChange:n}){let r=Object.keys(t).filter(e=>/^renderers\/.+\.html$/u.test(e)).sort(),i=Object.keys(t).filter(e=>/^regex\/.+\.yaml$/u.test(e)).sort(),a=Object.keys(t).filter(e=>/^scripts\/.+\.js$/u.test(e)).sort(),o=Object.keys(t).filter(e=>e.startsWith(`assets/`)).sort();function s(t,r){n(e.map((e,n)=>n===t?r(e):e))}function c(){let t=new Set(e.map(({id:e})=>e)),r=e.length+1,i=`panel_${r}`;for(;t.has(i);)i=`panel_${++r}`;n([...e,{id:i,source:{kind:`player_view`,view:`status`},channel:`player.view.${i}`,key:`current`,mount:`sidebar`,rendererMode:`document`,config:{title:A(`玩家状态`),layout:`stack`,theme:`default`,empty:`message`,emptyMessage:A(`当前没有可显示内容。`),groups:[]}}])}return(0,q.jsxs)(`div`,{className:`play-preset-structured-section`,children:[(0,q.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:A(`玩家视图面板`)}),(0,q.jsx)(`p`,{children:A(`把世界控制里已经定义好的玩家视图,持续显示在游玩页面。它不调用模型,也不改世界。`)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:c,children:A(`新增玩家视图面板`)})]}),e.length===0?(0,q.jsx)(`p`,{className:`play-preset-empty-copy`,children:A(`当前没有玩家视图面板。`)}):(0,q.jsx)(`ol`,{className:`play-preset-panel-editor-list`,"aria-label":A(`玩家视图面板`),children:e.map((t,c)=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`article`,{className:`play-preset-player-panel-card`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:t.config.title??t.id}),(0,q.jsxs)(`span`,{children:[A(`玩家视图`),t.source.view,` · `,Da(t.mount)]})]}),(0,q.jsx)(`button`,{type:`button`,className:`danger-button`,onClick:()=>n(e.filter((e,t)=>t!==c)),children:A(`删除面板`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,q.jsxs)(`label`,{children:[A(`面板标题`),(0,q.jsx)(`input`,{"aria-label":A(`玩家视图面板 {index} 标题`,{index:c+1}),value:t.config.title??``,onChange:e=>{let t=e.currentTarget.value;s(c,e=>{let n={...e.config};return t===``?delete n.title:n.title=t,{...e,config:n}})}})]}),(0,q.jsxs)(`label`,{children:[A(`读取哪个玩家视图`),(0,q.jsx)(`input`,{"aria-label":A(`玩家视图面板 {index} 视图`,{index:c+1}),value:t.source.view,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,source:{...e.source,view:t}}))}})]}),(0,q.jsxs)(`label`,{children:[A(`显示位置`),(0,q.jsx)(xa,{ariaLabel:A(`玩家视图面板 {index} 显示位置`,{index:c+1}),value:t.mount,onChange:e=>{e!==``&&s(c,t=>({...t,mount:e}))}})]}),(0,q.jsxs)(`label`,{children:[A(`排列方式`),(0,q.jsxs)(`select`,{value:t.config.layout,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,layout:t}}))},children:[(0,q.jsx)(`option`,{value:`stack`,children:A(`纵向排列`)}),(0,q.jsx)(`option`,{value:`grid`,children:A(`网格排列`)})]})]}),(0,q.jsxs)(`label`,{children:[A(`没有内容时`),(0,q.jsxs)(`select`,{value:t.config.empty,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,empty:t}}))},children:[(0,q.jsx)(`option`,{value:`hide`,children:A(`隐藏面板`)}),(0,q.jsx)(`option`,{value:`message`,children:A(`显示说明`)}),(0,q.jsx)(`option`,{value:`show`,children:A(`显示空值`)})]})]}),t.config.empty===`hide`?null:(0,q.jsxs)(`label`,{children:[A(`空内容说明`),(0,q.jsx)(`input`,{value:t.config.emptyMessage,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,emptyMessage:t}}))}})]})]}),(0,q.jsxs)(`details`,{className:`play-preset-advanced-card`,children:[(0,q.jsx)(`summary`,{children:A(`高级面板设置`)}),(0,q.jsxs)(`div`,{className:`play-preset-form-grid`,children:[(0,q.jsxs)(`label`,{children:[A(`面板稳定标识`),(0,q.jsx)(`input`,{value:t.id,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,id:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`技术频道`),(0,q.jsx)(`input`,{value:t.channel,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,channel:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`更新 key`),(0,q.jsx)(`input`,{value:t.key,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,key:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`主题标识`),(0,q.jsx)(`input`,{value:t.config.theme,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,theme:t}}))}})]}),(0,q.jsxs)(`label`,{children:[A(`只显示这些项目(每行一个,可留空)`),(0,q.jsx)(`textarea`,{value:(t.source.itemIds??[]).join(`
1190
- `),onChange:e=>{let t=Ra(e.currentTarget.value);s(c,e=>{let n={...e.source};return t.length===0?delete n.itemIds:n.itemIds=t,{...e,source:n}})}})]}),(0,q.jsxs)(`label`,{children:[A(`界面模板`),(0,q.jsxs)(`select`,{value:t.renderer??``,onChange:e=>{let t=e.currentTarget.value;s(c,e=>{let n={...e};return t===``?(delete n.renderer,delete n.rendererRevision,n.rendererMode=`document`):(n.renderer=t,n.rendererRevision??=`v1`,n.rendererMode=`app`),n})},children:[(0,q.jsx)(`option`,{value:``,children:A(`使用内置显示`)}),ka(r,t.renderer).map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]})]}),t.renderer===void 0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{children:[A(`模板 revision`),(0,q.jsx)(`input`,{value:t.rendererRevision??``,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,rendererRevision:t}))}})]}),(0,q.jsxs)(`label`,{children:[A(`模板模式`),(0,q.jsxs)(`select`,{value:t.rendererMode,onChange:e=>{let t=e.currentTarget.value;s(c,e=>({...e,rendererMode:t}))},children:[(0,q.jsx)(`option`,{value:`document`,children:A(`静态文档`)}),(0,q.jsx)(`option`,{value:`app`,children:A(`可交互 app`)})]})]})]}),(0,q.jsxs)(`label`,{children:[A(`正则处理规则`),(0,q.jsxs)(`select`,{value:t.regex??``,onChange:e=>{let t=e.currentTarget.value;s(c,e=>{let n={...e};return t===``?delete n.regex:n.regex=t,n})},children:[(0,q.jsx)(`option`,{value:``,children:A(`不使用`)}),ka(i,t.regex).map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,q.jsxs)(`div`,{className:`play-preset-resource-columns`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h6`,{children:A(`脚本`)}),(0,q.jsx)(Ca,{ariaLabel:A(`玩家视图面板 {index} 脚本`,{index:c+1}),paths:a,selected:t.scripts??[],emptyText:A(`没有脚本文件。`),onChange:e=>s(c,t=>{let n={...t};return e.length===0?delete n.scripts:n.scripts=e,n})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h6`,{children:A(`样式与资源`)}),(0,q.jsx)(Ca,{ariaLabel:A(`玩家视图面板 {index} 资源`,{index:c+1}),paths:o,selected:t.assets??[],emptyText:A(`没有资源文件。`),onChange:e=>s(c,t=>{let n={...t};return e.length===0?delete n.assets:n.assets=e,n})})]})]}),(0,q.jsxs)(`div`,{className:`play-preset-section-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h6`,{children:A(`分组`)}),(0,q.jsx)(`p`,{children:A(`把已选项目按组显示;每个项目 ID 单独一行。`)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(c,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:A(`新分组`),itemIds:[]}]}}}),children:A(`新增分组`)})]}),(0,q.jsx)(`ol`,{className:`play-preset-group-list`,children:t.config.groups.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`label`,{children:[A(`分组标题`),(0,q.jsx)(`input`,{value:e.label,onChange:e=>{let n=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,label:n}:e)}}))}})]}),(0,q.jsxs)(`label`,{children:[A(`分组标识`),(0,q.jsx)(`input`,{value:e.id,onChange:e=>{let n=e.currentTarget.value;s(c,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,id:n}:e)}}))}})]}),(0,q.jsxs)(`label`,{children:[A(`项目 ID(每行一个)`),(0,q.jsx)(`textarea`,{value:e.itemIds.join(`
1191
- `),onChange:e=>{let n=Ra(e.currentTarget.value);s(c,e=>({...e,config:{...e.config,groups:e.config.groups.map((e,r)=>r===t?{...e,itemIds:n}:e)}}))}})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(c,e=>({...e,config:{...e.config,groups:e.config.groups.filter((e,n)=>n!==t)}})),children:A(`删除分组`)})]},`${e.id}-${t}`))})]})]})},`${t.id}-${c}`))})]})}function Ia({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=La(l,e[l]??``);return(0,q.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,q.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`ADVANCED FILES`}),(0,q.jsx)(`h4`,{id:`play-preset-files-title`,children:A(`完整预设文件`)})]}),(0,q.jsx)(`p`,{children:A(`常用设置应在前面的表单完成。这里保留完整 YAML、Markdown、HTML、脚本和样式,并说明每份文件负责什么。`)})]}),(0,q.jsx)(`div`,{className:`play-preset-yaml-guide`,"aria-label":A(`三个核心 YAML 文件的用途`),children:[La(`preset.yaml`,e[`preset.yaml`]??``),La(`call-chain.yaml`,e[`call-chain.yaml`]??``),La(`frame.yaml`,e[`frame.yaml`]??``)].map(e=>(0,q.jsxs)(`article`,{children:[(0,q.jsx)(`strong`,{children:e.title}),(0,q.jsx)(`code`,{children:e.path}),(0,q.jsx)(`p`,{children:e.description})]},e.path))}),(0,q.jsxs)(`label`,{className:`play-preset-file-jump`,children:[A(`快速跳转文件`),(0,q.jsx)(`select`,{"aria-label":A(`玩法预设文件`),value:l,onChange:e=>i(e.currentTarget.value),children:c.map(t=>(0,q.jsxs)(`option`,{value:t,children:[La(t,e[t]??``).title,` · `,t]},t))})]}),(0,q.jsxs)(`div`,{className:`play-preset-file-browser`,children:[(0,q.jsx)(`aside`,{"aria-label":A(`玩法预设文件列表`),children:(0,q.jsx)(`ul`,{children:c.map(t=>{let n=La(t,e[t]??``);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,className:t===l?`selected`:``,"aria-pressed":t===l,"aria-label":A(`打开玩法文件 {path}`,{path:t}),onClick:()=>i(t),children:[(0,q.jsx)(`strong`,{children:n.title}),(0,q.jsx)(`span`,{children:n.kind}),(0,q.jsx)(`code`,{children:t})]})},t)})})}),(0,q.jsxs)(`section`,{className:`play-preset-file-editor-pane`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:u.kind}),(0,q.jsx)(`h5`,{children:u.title}),(0,q.jsx)(`code`,{children:l})]}),(0,q.jsx)(`p`,{children:u.description})]}),(0,q.jsxs)(`label`,{className:`play-preset-source-editor`,children:[(0,q.jsx)(`span`,{children:A(`完整文件内容`)}),(0,q.jsx)(`textarea`,{"aria-label":A(`编辑玩法文件 {path}`,{path:l}),wrap:`soft`,value:e[l]??``,onChange:e=>o(e.currentTarget.value),spellCheck:!1})]})]})]}),(0,q.jsxs)(`details`,{className:`play-preset-file-create`,children:[(0,q.jsx)(`summary`,{children:A(`新增高级文件`)}),(0,q.jsxs)(`div`,{className:`play-preset-file-add`,children:[(0,q.jsxs)(`label`,{children:[A(`新文件路径(prompt/regex/renderer/script/asset)`),(0,q.jsx)(`input`,{"aria-label":A(`新增玩法文件路径`),placeholder:`renderers/my-panel.html`,value:n,onChange:e=>a(e.currentTarget.value)})]}),(0,q.jsx)(`button`,{type:`button`,disabled:r||n.trim()===``,onClick:s,children:A(`加入文件草稿`)})]})]})]})}function La(e,t){return e===`preset.yaml`?{path:e,title:A(`预设入口`),kind:A(`核心 YAML`),description:A(`连接设定完善提示、调用链、界面显示位置、玩家视图面板和扩展资源;它回答“这份预设由哪些部分组成”。`)}:e===`call-chain.yaml`?{path:e,title:A(`调用链与产物`),kind:A(`核心 YAML`),description:A(`声明主响应使用哪些叙事提示、结束后有哪些后置请求,以及每个请求可以生成什么产物。`)}:e===`frame.yaml`?{path:e,title:A(`主持规则顺序`),kind:A(`核心 YAML`),description:A(`决定 Runtime 机械说明、主持规则块和世界指令以什么顺序进入稳定 bootstrap。`)}:e.startsWith(`blocks/`)&&e.endsWith(`.md`)?{path:e,title:Na(t),kind:A(`主持规则`),description:A(`跨世界成立的主持语义;是否发送给模型以及发送顺序由“提示内容”页控制。`)}:e===`prompts/setting-improvement.md`?{path:e,title:Na(t),kind:A(`设定完善提示`),description:A(`约束 AI 怎样理解、规划和创作内容包;工具定义、参数与说明仍由 Runtime 内置。`)}:e.startsWith(`prompts/`)&&e.endsWith(`.md`)?{path:e,title:Na(t),kind:A(`调用链提示`),description:A(`主响应或某个后置请求实际读取的 Markdown 指令;普通编辑可在“调用链”直接修改。`)}:e.startsWith(`renderers/`)?{path:e,title:A(`界面模板`),kind:`HTML renderer`,description:A(`把产物内容或玩家视图变成页面上的 HTML 结构。`)}:e.startsWith(`scripts/`)?{path:e,title:A(`界面交互脚本`),kind:`JavaScript`,description:A(`为 renderer 添加本地交互;导入预设后默认停用,只有显式信任后才执行。`)}:e.startsWith(`assets/`)?{path:e,title:A(`界面样式或资源`),kind:A(`扩展资源`),description:A(`供 renderer 或脚本读取的样式、文字或其他普通资源。`)}:e.startsWith(`regex/`)?{path:e,title:A(`产物文本处理规则`),kind:`Regex YAML`,description:A(`在显示前对产物正文执行有界、可预览的正则处理。`)}:{path:e,title:e.split(`/`).at(-1)??A(`未命名文件`),kind:A(`普通文件`),description:A(`随玩法预设保存和导出的普通业务文件。`)}}function Ra(e){return[...new Set(e.split(/\r?\n/u).map(e=>e.trim()).filter(Boolean))]}function za({workbench:e}){return e===null?(0,q.jsxs)(`section`,{className:`play-preset-artifact-preview`,"aria-label":A(`真实产物预览`),children:[(0,q.jsx)(`h3`,{children:A(`真实产物预览`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`保存有效 revision 后可预览产物 contract、regex 与冻结 renderer。`)})]}):(0,q.jsxs)(`section`,{className:`play-preset-artifact-preview`,"aria-label":A(`真实产物预览`),children:[(0,q.jsx)(`h3`,{children:A(`真实产物预览(只读)`)}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`样例由当前冻结文件生成;此处不调用模型、不写入世界,只复用生产 regex/renderer 编码。`)}),e.artifactPreviews.length===0?(0,q.jsx)(`p`,{className:`field-note`,children:A(`当前预设没有 artifact output contract。`)}):e.artifactPreviews.map(t=>(0,q.jsx)(Ba,{preview:t,scriptsEnabled:e.scriptsEnabled!==!1},`${t.requestId}:${t.output}`))]})}function Ba({preview:e,scriptsEnabled:t}){let n=Ua(e.rawPayload),r=Vi({payload:n,contentType:e.declaration.contentType,rules:e.regex}),i=null,a=null,o=e.renderer?.mode===`app`&&t;if(e.renderer?.mode===`app`&&!t)try{i=Hi(r.final,e.declaration.contentType,void 0,n)}catch(e){a=e instanceof Error?e.message:A(`raw/document fallback 失败`)}else if(e.renderer!==void 0)try{i=e.renderer.mode===`app`?Wi({renderer:e.renderer,instanceId:`workbench-${e.requestId}-${e.output}`,nonce:`workbench-preview`}):Hi(r.final,e.declaration.contentType,e.renderer,n)}catch(e){a=e instanceof Error?e.message:A(`renderer 预览失败`)}else try{i=Hi(r.final,e.declaration.contentType,void 0,n)}catch(e){a=e instanceof Error?e.message:A(`内置 renderer 预览失败`)}return(0,q.jsxs)(`article`,{className:`play-preset-artifact-card`,children:[(0,q.jsxs)(`h4`,{children:[e.requestId,` / `,e.output]}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`这是当前样例实际显示在游戏页面上的效果;不会调用模型或写入世界。`)}),e.diagnostics.map(e=>(0,q.jsx)(`p`,{role:`alert`,children:e},e)),e.renderer?.mode===`app`&&!t?(0,q.jsx)(`p`,{className:`field-note`,children:A(`JavaScript 已停用;app 样例仅以 raw/document fallback 显示,不执行作者脚本。`)}):null,(0,q.jsxs)(`section`,{className:`play-preset-artifact-rendered-preview`,"aria-label":A(`页面上的效果`),children:[(0,q.jsx)(`h5`,{children:A(`页面上的效果`)}),a===null&&i!==null?o?(0,q.jsx)(Va,{renderer:e.renderer,content:r.final,rawPayload:n,instanceId:`workbench-${e.requestId}-${e.output}`}):(0,q.jsx)(`iframe`,{title:A(`产物预览 {request}/{output}`,{request:e.requestId,output:e.output}),sandbox:``,srcDoc:i}):e.renderer===void 0?(0,q.jsx)(`p`,{className:`field-note`,children:A(`无自定义 renderer;使用内置文本/Markdown/HTML renderer。`)}):(0,q.jsxs)(`pre`,{role:`alert`,children:[`renderer fallback:`,a??A(`无法生成预览`),`\\n`,e.rawText]})]}),(0,q.jsxs)(`details`,{className:`play-preset-artifact-technical-details`,children:[(0,q.jsx)(`summary`,{children:A(`技术细节:频道、处理规则与产物协议`)}),(0,q.jsxs)(`p`,{className:`field-note`,children:[`channel=`,e.declaration.channel,` · strategy=`,e.declaration.strategy,` · save=`,e.declaration.save,` · invalidation=`,e.declaration.invalidation]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`raw payload 与 emit schema`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.rawPayload,null,2)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.declaration,null,2)})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`regex pipeline / 最终内容`)}),r.steps.map(e=>(0,q.jsxs)(`div`,{className:`field-note`,children:[`#`,e.order,` `,e.scope,` · `,e.status,` · matches=`,e.matches,e.error===void 0?null:` · ${e.error}`]},`${e.order}:${e.scope}`)),(0,q.jsx)(`pre`,{children:r.final})]}),(0,q.jsxs)(`p`,{className:`field-note`,children:[`active projection:`,e.activeProjection.status,` ·`,` `,e.activeProjection.channel,e.activeProjection.key===void 0?``:`/${e.activeProjection.key}`,` `,`· clear:`,e.clear.description]}),(0,q.jsxs)(`div`,{className:`field-note`,children:[A(`emit 后:`),e.simulation.emitted.status,`(`,e.simulation.emitted.identity,A(`);explicit clear 后:`),e.simulation.explicitClear.status,`;`,e.simulation.invalidation.policy,` `,A(`触发后:`),e.simulation.invalidation.status,`(`,e.simulation.invalidation.reason,`)`]}),e.renderer?.mode===`app`?(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`app 初始消息(只读协议预览)`)}),(0,q.jsx)(`pre`,{children:JSON.stringify({namespace:`narraeon.extension.v1`,type:`render.update`,instanceId:`workbench-${e.requestId}-${e.output}`,payload:{content:r.final,interactionDisabled:!1}},null,2)})]}):null]})]})}function Va({renderer:e,content:t,rawPayload:n,instanceId:r}){let i=(0,l.useRef)(null),[a]=(0,l.useState)(()=>`workbench-${Math.random().toString(36).slice(2)}`),[o,s]=(0,l.useState)(!1),c=Wi({renderer:e,instanceId:r,nonce:a}),u=(0,l.useCallback)(()=>{i.current?.contentWindow?.postMessage({namespace:Ji,type:`render.update`,instanceId:r,nonce:a,payload:{content:t,rawPayload:n,interactionDisabled:!1}},`*`)},[t,r,a,n]);return(0,l.useEffect)(()=>{let e=e=>{let t=e.data;e.source!==i.current?.contentWindow||typeof t!=`object`||!t||t.namespace!==`narraeon.extension.v1`||t.type!==`bridge.ready`||t.instanceId!==r||t.nonce!==a||(s(!0),u())};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[r,a,u]),(0,l.useEffect)(()=>{o&&u()},[o,u]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`iframe`,{ref:i,title:A(`产物预览 {id}`,{id:r}),sandbox:`allow-scripts`,srcDoc:c,onLoad:u}),(0,q.jsx)(`p`,{className:`field-note`,role:`status`,children:A(o?`app preview ready;已发送 render.update。`:`等待 app preview ready…`)})]})}function Ha(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ua(e){return e===null?null:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>Ua(e)):Ha(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Ua(t)])):null}function Wa({files:e,pending:t,onChange:n,onFeedback:r}){let i=e[`frame.yaml`]??``,a=(0,l.useMemo)(()=>Ka(i),[i]),o=Object.keys(e).filter(e=>e.startsWith(`blocks/`)&&e.endsWith(`.md`)).sort(),s=o.filter(e=>!a.includes(e)),c=a.filter(t=>e[t]===void 0),u=[...a.filter(t=>e[t]!==void 0),...s],[d,f]=(0,l.useState)(u[0]??``),p=o.includes(d)?d:u[0]??``;function m(t){try{n({...e,"frame.yaml":qa(i,t)})}catch(e){r({kind:`error`,text:e instanceof Error?A(`frame.yaml 无法更新:{message}`,{message:e.message}):A(`frame.yaml 无法更新。`)})}}return(0,q.jsxs)(`section`,{id:`play-preset-panel-blocks`,className:`play-preset-block-workspace`,role:`tabpanel`,"aria-labelledby":`play-preset-tab-blocks play-preset-blocks-title`,children:[(0,q.jsxs)(`header`,{className:`play-preset-workspace-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`play-preset-section-kicker`,children:`BLOCK LIBRARY`}),(0,q.jsx)(`h4`,{id:`play-preset-blocks-title`,children:A(`主持规则内容`)})]}),(0,q.jsx)(`p`,{children:A(`直接阅读和编辑每条跨世界主持规则。启用的规则按顺序进入模型;停用只是不发送,内容仍会随预设保存和导出。`)})]}),(0,q.jsxs)(`div`,{className:`play-preset-concept-note`,children:[(0,q.jsx)(`strong`,{children:A(`frame.yaml 在这里做什么?`)}),(0,q.jsx)(`p`,{children:A(`它只保存“哪些主持规则已启用、按什么顺序发送”。你在下方勾选或排序时,页面会同步更新它,不必手写路径。`)})]}),c.length>0&&(0,q.jsxs)(`p`,{role:`alert`,children:[A(`frame.yaml 引用了不存在的块:`),c.join(`、`)]}),u.length===0?(0,q.jsx)(`p`,{className:`play-preset-empty-copy`,children:A(`当前预设还没有主持规则内容。`)}):(0,q.jsxs)(`div`,{className:`play-preset-block-browser`,children:[(0,q.jsx)(`aside`,{"aria-label":A(`主持规则列表`),children:(0,q.jsx)(`ol`,{children:u.map(t=>{let n=a.indexOf(t),r=e[t]??``;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,className:t===p?`selected`:``,"aria-pressed":t===p,onClick:()=>f(t),children:[(0,q.jsx)(`strong`,{children:Na(r)}),(0,q.jsx)(`span`,{children:n<0?A(`未启用`):A(`启用顺序 {index}`,{index:n+1})}),(0,q.jsx)(`small`,{children:Pa(r)})]})},t)})})}),(0,q.jsxs)(`section`,{className:`play-preset-block-editor`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:a.includes(p)?A(`已启用`):A(`未启用`)}),(0,q.jsx)(`h5`,{children:Na(e[p]??``)}),(0,q.jsx)(`code`,{children:p})]}),(0,q.jsxs)(`div`,{className:`play-preset-block-actions`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a.includes(p),disabled:t,"aria-label":a.includes(p)?A(`停用 {path}`,{path:p}):A(`启用 {path}`,{path:p}),onChange:e=>m(e.currentTarget.checked?[...a,p]:a.filter(e=>e!==p))}),A(`发送给模型`)]}),(0,q.jsx)(`button`,{type:`button`,disabled:t||a.indexOf(p)<=0,"aria-label":A(`上移 {path}`,{path:p}),onClick:()=>m(Ga(a,a.indexOf(p),-1)),children:A(`上移`)}),(0,q.jsx)(`button`,{type:`button`,disabled:t||!a.includes(p)||a.indexOf(p)===a.length-1,"aria-label":A(`下移 {path}`,{path:p}),onClick:()=>m(Ga(a,a.indexOf(p),1)),children:A(`下移`)})]})]}),(0,q.jsxs)(`label`,{children:[A(`完整规则内容`),(0,q.jsx)(`textarea`,{"aria-label":A(`编辑提示块内容 {path}`,{path:p}),value:e[p]??``,onChange:t=>n({...e,[p]:t.currentTarget.value}),spellCheck:!1})]})]})]})]})}function Ga(e,t,n){let r=[...e],i=t+n;return i<0||i>=r.length||([r[t],r[i]]=[r[i],r[t]]),r}function Ka(e){try{let t=Nr(e)?.roles?.author_instruction;return Array.isArray(t)?t.map(e=>typeof e==`object`&&e?e.markdown:void 0).filter(e=>typeof e==`string`):[]}catch{return[]}}function qa(e,t){let n=Mr(e),r=n.getIn([`roles`,`author_instruction`],!0);if(!Ya(r))throw Error(A(`roles.author_instruction 必须是数组`));let i=r.items.filter(e=>!Ja(n,e)),a=[...t.map(e=>({markdown:e})),...i.map(e=>e.toJSON())];return n.setIn([`roles`,`author_instruction`],a),String(n)}function Ja(e,t){let n=t.toJSON?.();return typeof n==`object`&&!!n&&typeof n.markdown==`string`}function Ya(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}var Xa={runtime_system:{title:`Runtime 系统`,description:`权威、真实工具与提交边界,由 Runtime 固定提供。`},author_instruction:{title:`创作指令`,description:`当前主持预设、世界专属创作政策与玩法叙事规则。`},world_context:{title:`世界上下文`,description:`真实 slot 展开、材料覆盖和当前世界正文。`},player_input:{title:`玩家原文`,description:`本次预览显式使用的动态玩家输入。`}},Za={chat_completions:`Chat Completions`,openai_responses:`OpenAI Responses`,anthropic_messages:`Anthropic Messages`},Qa={resolved:`已提供`,optional_missing:`可选未证明完整`,paged_catalog:`分页目录`},$a={current_situation:`当前情境`,additional_materials:`附加材料`,catalog:`材料目录`,reference_targets:`引用目标`,history:`最近叙事`};function eo({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)(A(`我观察当前场景。`)),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),b=(0,l.useRef)(0),x=t.find(e=>e.localId===u),S=r?.presets.find(({id:e})=>e===(o?.presetId??r.currentPresetId)),C=S,w=i.connections.find(({id:e})=>e===i.activeConnectionId),T=x?.status===`usable`&&S?.validation.status===`valid`&&w!==void 0&&f.trim().length>0;function ee(){b.current+=1,_(!1),h(null),y(null)}async function E(){if(!T||w===void 0)return;let t=b.current+1;b.current=t,_(!0),y(null);try{let n=await e.request({type:`prompt.preview`,packageId:u,playerInput:f.trim(),model:lo(w),...r===void 0?{}:{playPresetId:o?.presetId??r.currentPresetId,...o===void 0?{}:{playPresetRevision:o.revision}}});if(b.current!==t)return;h(n),y({kind:`status`,text:A(`真实编译已完成;没有调用模型,也没有改变内容或世界。`)})}catch(e){if(b.current!==t)return;h(null),y({kind:`error`,text:mo(e)})}finally{b.current===t&&_(!1)}}return(0,q.jsxs)(`section`,{className:`prompt-preview-screen${s?` embedded`:``}`,"aria-labelledby":`prompt-preview-title`,children:[s?(0,q.jsxs)(`header`,{className:`prompt-preview-embedded-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`READ ONLY · REAL COMPILER`}),(0,q.jsx)(`h4`,{id:`prompt-preview-title`,children:A(`全新上下文会发送什么`)})]}),(0,q.jsx)(`p`,{children:A(`真实编译,0 次模型调用,不会创建候选或写入权威状态。`)})]}):(0,q.jsxs)(`header`,{className:`prompt-preview-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`READ ONLY · REAL COMPILER`}),(0,q.jsx)(`h2`,{id:`prompt-preview-title`,children:A(`提示词预览`)}),(0,q.jsx)(`p`,{className:`prompt-preview-lede`,children:A(`用真实编译器检查全新上下文会发送什么:逻辑 role、Markdown、材料、工具、预算与 Provider 映射。`)})]}),(0,q.jsxs)(`div`,{className:`prompt-preview-readonly`,"aria-label":A(`预览性质`),children:[(0,q.jsx)(`span`,{children:A(`只读检查`)}),(0,q.jsx)(`strong`,{children:A(`0 次模型调用`)}),(0,q.jsx)(`small`,{children:A(`不会创建候选或写入权威状态`)})]})]}),(0,q.jsxs)(`div`,{className:`prompt-preview-setup`,children:[(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-input-card`,"aria-labelledby":`prompt-preview-input-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-section-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`PREVIEW INPUT`}),(0,q.jsx)(`h3`,{id:`prompt-preview-input-title`,children:A(`决定这次检查什么`)})]}),(0,q.jsx)(`span`,{className:`prompt-preview-mode`,children:A(`内容包首轮 · 全新上下文`)})]}),t.length===0?(0,q.jsx)(`p`,{className:`prompt-preview-empty`,role:`status`,children:A(`还没有内容包。先新建并修好一份内容包,才能编译真实提示词。`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{children:[A(`内容包`),(0,q.jsx)(`select`,{"aria-label":A(`预览内容包`),value:u,onChange:e=>{let t=e.currentTarget.value;d(t),a(t),ee()},children:t.map(e=>(0,q.jsxs)(`option`,{value:e.localId,children:[e.displayName,e.status===`usable`?``:A(` · 需要修复`)]},e.localId))})]}),(0,q.jsxs)(`label`,{children:[A(`预览玩家输入`),(0,q.jsx)(`textarea`,{"aria-label":A(`预览玩家输入`),value:f,onChange:e=>{p(e.currentTarget.value),ee()}}),(0,q.jsx)(`span`,{className:`field-note`,children:A(`这段原文只进入本次预览,不会写入历史,也不会成为真实玩家行动。`)})]}),x?.status===`needs_repair`?(0,q.jsx)(`p`,{className:`prompt-preview-blocker`,role:`status`,children:A(`这份内容包仍需修复;真实首轮预览要求有效的 opening.md、世界文档和控制框架。`)}):null,(0,q.jsx)(`button`,{disabled:!T||g,onClick:()=>void E(),type:`button`,children:A(g?`正在编译真实预览…`:m===null?`生成真实预览`:`重新生成真实预览`)})]}),v===null?null:(0,q.jsx)(`p`,{role:v.kind===`error`?`alert`:`status`,children:v.text})]}),(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-binding-card`,"aria-labelledby":`prompt-preview-binding-title`,children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FIXED BINDING`}),(0,q.jsx)(`h3`,{id:`prompt-preview-binding-title`,children:A(`本次固定绑定`)}),(0,q.jsxs)(`dl`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`主持预设`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`strong`,{children:S?.name??A(`没有当前预设`)}),(0,q.jsx)(`span`,{children:A(`工作区当前选择`)})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`模型连接`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`strong`,{children:w?.name??A(`没有当前模型`)}),(0,q.jsx)(`span`,{children:w===void 0?A(`请先配置并启用模型`):`${w.modelId} · ${Za[w.provider]}`})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`模型窗口`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`strong`,{children:w===void 0?`—`:`${uo(w.contextWindowTokens)} tokens`}),(0,q.jsx)(`span`,{children:w===void 0?`—`:A(`最大输出 {count}`,{count:uo(w.maxOutputTokens)})})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`开场白边界`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`strong`,{children:A(`不作为模型历史注入`)}),(0,q.jsx)(`span`,{children:A(`opening.md 只保留为玩家可见的 genesis 叙事`)})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`玩法预设`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`strong`,{children:C?.name??`default`}),(0,q.jsx)(`span`,{children:C===void 0?A(`使用内置玩法的完整工具集合`):`revision ${o?.revision??C.revision}`})]})]})]})]})]}),m===null?(0,q.jsxs)(`section`,{className:`prompt-preview-waiting`,"aria-label":A(`等待生成预览`),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`01 — 04`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`生成后按四个视角检查`)}),(0,q.jsx)(`p`,{children:A(`逻辑消息、材料与工具、Provider 映射、预算与诊断。`)})]})]}):(0,q.jsx)(to,{preview:m,packageName:x?.displayName??u,hostName:S?.name??A(`未知预设`),modelName:w?.name??m.diagnosticBinding.modelId})]})}function to({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,q.jsxs)(`div`,{className:`prompt-preview-result`,children:[(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-overview`,"aria-labelledby":`prompt-preview-result-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-result-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`COMPILED REQUEST`}),(0,q.jsx)(`h3`,{id:`prompt-preview-result-title`,children:A(`编译通过`)}),(0,q.jsxs)(`p`,{children:[t,` · `,n,` · `,r]})]}),(0,q.jsxs)(`div`,{className:`prompt-preview-pass-badges`,"aria-label":A(`编译检查结果`),children:[(0,q.jsx)(`span`,{children:A(s?`Runtime 不预估上下文`:`预算可容纳`)}),(0,q.jsx)(`span`,{children:A(`内部字段无泄漏`)}),(0,q.jsx)(`span`,{children:A(`权威状态未改变`)})]})]}),(0,q.jsxs)(`dl`,{className:`prompt-preview-summary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`逻辑消息`)}),(0,q.jsx)(`dd`,{children:o.logicalMessages.length}),(0,q.jsxs)(`small`,{children:[A(`稳定 bootstrap`),e.initialAppend===void 0?``:A(`;另有 1 条玩家追加`)]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`真实工具`)}),(0,q.jsx)(`dd`,{children:o.tools.length}),(0,q.jsx)(`small`,{children:A(`生产调用链全集`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(s?`上下文检查`:`所需上下文`)}),(0,q.jsx)(`dd`,{children:s?A(`由 Provider 判断`):uo(o.budget.requiredTokens)}),(0,q.jsx)(`small`,{children:s?A(`Runtime 不据此拦截请求`):`/ ${uo(o.budget.contextWindowTokens)} tokens`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(s?`窗口配置`:`窗口占用`)}),(0,q.jsx)(`dd`,{children:s?uo(o.budget.contextWindowTokens):`${c}%`}),s?(0,q.jsx)(`small`,{children:`tokens · Provider binding`}):(0,q.jsx)(`progress`,{"aria-label":A(`上下文窗口占用`),max:o.budget.contextWindowTokens,value:o.budget.requiredTokens})]})]})]}),(0,q.jsxs)(`nav`,{className:`prompt-preview-nav`,"aria-label":A(`预览结果分区`),children:[(0,q.jsx)(Y,{active:i===`messages`,count:o.logicalMessages.length,label:A(`逻辑消息`),onClick:()=>a(`messages`)}),e.playPreset===void 0?null:(0,q.jsx)(Y,{active:i===`callChain`,count:e.playPreset.toolUniverse.length,label:A(`玩法绑定`),onClick:()=>a(`callChain`)}),(0,q.jsx)(Y,{active:i===`materials`,count:o.coverage.length+o.tools.length,label:A(`材料与工具`),onClick:()=>a(`materials`)}),(0,q.jsx)(Y,{active:i===`provider`,count:o.provider.messages.length+(e.initialAppend===void 0?0:1),label:A(`Provider 映射`),onClick:()=>a(`provider`)}),(0,q.jsx)(Y,{active:i===`diagnostics`,count:4,label:A(`预算与诊断`),onClick:()=>a(`diagnostics`)})]}),i===`messages`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(io,{messages:o.logicalMessages}),e.initialAppend===void 0?null:(0,q.jsx)(no,{append:e.initialAppend})]}):null,i===`callChain`&&e.playPreset!==void 0?(0,q.jsx)(ro,{callChain:e.playPreset}):null,i===`materials`?(0,q.jsx)(ao,{coverage:o.coverage,tools:o.tools}):null,i===`provider`?(0,q.jsx)(oo,{provider:o.provider,initialAppend:e.initialAppend}):null,i===`diagnostics`?(0,q.jsx)(co,{preview:e}):null]})}function no({append:e}){return(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`initial-player-append-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FIRST DYNAMIC APPEND`}),(0,q.jsx)(`h3`,{id:`initial-player-append-title`,children:A(`首条玩家追加`)})]}),(0,q.jsx)(`p`,{children:A(`稳定 bootstrap 之后,玩家原文作为普通 user 消息原样追加。`)})]}),(0,q.jsx)(`div`,{className:`provider-message-list`,children:(0,q.jsx)(`ol`,{children:(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`span`,{children:e.logical.kind}),(0,q.jsx)(`strong`,{children:e.provider.role})]}),(0,q.jsx)(`pre`,{children:e.provider.content})]})})})]})}function ro({callChain:e}){return(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`play-preset-call-chain-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`PLAY PRESET · FROZEN REVISION`}),(0,q.jsx)(`h3`,{id:`play-preset-call-chain-title`,children:A(`玩法绑定与调用链工具`)})]}),(0,q.jsxs)(`p`,{children:[e.name,` · `,e.revision,` `,A(`· 叙事规则进入稳定 bootstrap, 后置请求在主调用链完成后独立派发。`)]})]}),(0,q.jsxs)(`dl`,{className:`prompt-binding-details`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`玩法文件`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`code`,{children:e.callChainPath}),(0,q.jsx)(`span`,{children:A(`冻结工具、叙事规则与后置产物契约`)})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`工具全集`)}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(`code`,{children:e.toolUniverse.map(({name:e})=>e).join(` / `)})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`Provider 工具策略`)}),(0,q.jsxs)(`dd`,{children:[(0,q.jsx)(`code`,{children:e.toolStrategy??`runtime_gate`}),(0,q.jsx)(`span`,{children:A(`definitions:稳定全集`)})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`稳定前缀`)}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(`code`,{children:e.cache.stablePrefixFingerprint})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`频道挂载`)}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(`code`,{children:e.mounts.length===0?A(`无`):e.mounts.map(({channel:e,mount:t})=>`${e} → ${t}`).join(` · `)})})]})]}),(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:A(`稳定 bootstrap`)}),(0,q.jsx)(`p`,{children:A(`全新上下文发送这份稳定前缀;玩家原文随后作为普通消息追加。Runtime 不再插入裁决、叙事或结算 delta。`)})]}),(0,q.jsxs)(`span`,{children:[e.bootstrap.logicalMessages.length,` `,A(`条逻辑消息`)]})]}),(0,q.jsxs)(`p`,{className:`prompt-preview-cache-line`,children:[`fingerprint:`,(0,q.jsx)(`code`,{children:e.bootstrap.cache.stablePrefixFingerprint})]}),(0,q.jsxs)(`p`,{className:`prompt-preview-cache-line`,children:[A(`调用链可用工具:`),(0,q.jsx)(`strong`,{children:e.toolUniverse.length}),` `,A(`· 后置请求:`),(0,q.jsx)(`strong`,{children:e.followups.length})]})]})}function Y({active:e,count:t,label:n,onClick:r}){return(0,q.jsxs)(`button`,{"aria-pressed":e,className:e?`active`:``,onClick:r,type:`button`,children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`small`,{children:t})]})}function io({messages:e}){let[t,n]=(0,l.useState)(e[0]?.role??`runtime_system`),r=e.find(({role:e})=>e===t)??e[0];return r===void 0?(0,q.jsx)(`p`,{className:`prompt-preview-empty`,children:A(`这次编译没有逻辑消息。`)}):(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`logical-messages-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`PROVIDER-NEUTRAL`}),(0,q.jsx)(`h3`,{id:`logical-messages-title`,children:A(`逻辑消息与最终 Markdown`)})]}),(0,q.jsx)(`p`,{children:A(`这里先保留产品逻辑 role;Provider 如何映射在下一分区单独展示。`)})]}),(0,q.jsxs)(`div`,{className:`prompt-message-layout`,children:[(0,q.jsx)(`ol`,{className:`prompt-message-index`,"aria-label":A(`逻辑消息顺序`),children:e.map((e,t)=>{let i=Xa[e.role];return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-label":A(`打开第 {index} 条逻辑消息:{title}`,{index:t+1,title:A(i.title)}),"aria-pressed":e.role===r.role,onClick:()=>n(e.role),type:`button`,children:[(0,q.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{children:A(i.title)}),(0,q.jsx)(`code`,{children:e.role})]}),(0,q.jsxs)(`small`,{children:[e.blocks.length,` `,A(`块`)]})]})},e.role)})}),(0,q.jsxs)(`article`,{className:`prompt-message-reader`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:r.role}),(0,q.jsx)(`h4`,{children:A(Xa[r.role].title)}),(0,q.jsx)(`p`,{children:A(Xa[r.role].description)})]}),(0,q.jsxs)(`span`,{children:[uo(r.markdown.length),` `,A(`字符`)]})]}),(0,q.jsx)(`div`,{className:`prompt-message-sources`,"aria-label":A(`消息块来源`),children:r.blocks.map((e,t)=>(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{children:[A(`块`),String(t+1).padStart(2,`0`)]}),(0,q.jsx)(`code`,{children:e.source}),(0,q.jsxs)(`small`,{children:[uo(e.markdown.length),` `,A(`字符`)]})]},`${e.source}:${t}`))}),(0,q.jsxs)(`div`,{className:`prompt-message-body`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`最终 Markdown 正文`)}),(0,q.jsx)(`span`,{children:A(`块之间已按真实编译顺序合并`)})]}),(0,q.jsx)(`pre`,{children:r.markdown})]})]})]})]})}function ao({coverage:e,tools:t}){let n=t.filter(({name:e})=>e.startsWith(`context_`));return(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`materials-tools-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`SOURCES & CAPABILITIES`}),(0,q.jsx)(`h3`,{id:`materials-tools-title`,children:A(`材料覆盖与调用链工具`)})]}),(0,q.jsx)(`p`,{children:A(`来源由真实 slot 展开;未提供边界和可继续读取入口不会被隐藏。`)})]}),(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{children:A(`Slot 覆盖`)}),(0,q.jsxs)(`span`,{children:[e.length,` `,A(`项`)]})]}),(0,q.jsx)(`ol`,{className:`prompt-coverage-list`,children:e.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`span`,{className:`coverage-status coverage-${e.status}`,children:A(Qa[e.status])}),(0,q.jsx)(`strong`,{children:A($a[e.slot]??e.slot)}),(0,q.jsx)(`code`,{children:e.slot})]}),(0,q.jsx)(`p`,{children:e.source}),(0,q.jsxs)(`footer`,{children:[(0,q.jsx)(`span`,{children:e.complete?A(`来源完整`):A(`来源尚未完整`)}),(0,q.jsx)(`span`,{children:e.continuation===null?A(`无需继续读取`):A(`可继续:{continuation}`,{continuation:e.continuation})})]})]},`${e.slot}:${e.source}:${t}`))}),(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading prompt-tools-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{children:A(`本次真实工具`)}),(0,q.jsx)(`p`,{children:n.length>0?A(`按需读取入口:{tools}`,{tools:n.map(({name:e})=>e).join(` / `)}):A(`本次没有按需读取工具。`)})]}),(0,q.jsxs)(`span`,{children:[t.length,` `,A(`个`)]})]}),(0,q.jsx)(`ol`,{className:`prompt-tool-list`,children:t.map((e,t)=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,q.jsx)(`code`,{children:e.name}),(0,q.jsx)(`small`,{children:A(`查看说明与 input schema`)})]}),(0,q.jsx)(`p`,{children:e.description}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.inputSchema,null,2)})]})},e.name))})]})}function oo({provider:e,initialAppend:t}){return(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`provider-mapping-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`FINAL ROLE MAPPING`}),(0,q.jsx)(`h3`,{id:`provider-mapping-title`,children:A(`Provider 映射 · {provider}`,{provider:Za[e.protocol]})})]}),(0,q.jsx)(`p`,{children:A(`展示编译器交给当前 Adapter 的真实 system 块和消息顺序。`)})]}),e.system===void 0?null:(0,q.jsxs)(`div`,{className:`provider-system-blocks`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{children:`System blocks`}),(0,q.jsxs)(`span`,{children:[e.system.length,` `,A(`块`)]})]}),(0,q.jsx)(`ol`,{children:e.system.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`span`,{children:[`system · `,String(t+1).padStart(2,`0`)]}),e.cache_control===void 0?null:(0,q.jsxs)(`small`,{children:[`cache_control: `,e.cache_control.type]})]}),(0,q.jsx)(`pre`,{children:e.text})]},t))})]}),(0,q.jsxs)(`div`,{className:`provider-message-list`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{children:A(`消息角色与顺序`)}),(0,q.jsxs)(`span`,{children:[e.messages.length,` `,A(`条 bootstrap`),t===void 0?``:A(` + 1 条玩家追加`)]})]}),(0,q.jsx)(`ol`,{children:e.messages.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,q.jsx)(`strong`,{children:e.role})]}),(0,q.jsx)(so,{content:e.content})]},t))}),t===void 0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{children:A(`紧随 bootstrap 的首条追加`)}),(0,q.jsx)(`span`,{children:A(`原样发送`)})]}),(0,q.jsx)(`ol`,{children:(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`span`,{children:`append`}),(0,q.jsx)(`strong`,{children:t.provider.role})]}),(0,q.jsx)(so,{content:t.provider.content})]})})]})]}),(0,q.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,q.jsx)(`summary`,{children:A(`查看 Provider 映射原始结构`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]})]})}function so({content:e}){return typeof e==`string`?(0,q.jsx)(`pre`,{children:e}):Array.isArray(e)?(0,q.jsx)(`ol`,{className:`provider-content-blocks`,children:e.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`span`,{children:[`content block · `,String(t+1).padStart(2,`0`)]}),(0,q.jsx)(`code`,{children:po(e)})]}),(0,q.jsx)(`pre`,{children:fo(e)?e.text:JSON.stringify(e,null,2)})]},t))}):(0,q.jsx)(`pre`,{children:JSON.stringify(e,null,2)})}function co({preview:e}){let{budget:t,cache:n}=e.compilation,r=t.estimator===`disabled`||t.status===`not_checked`,i=[[A(`消息正文`),t.messageTokens],[A(`工具定义`),t.toolTokens],[A(`本地输出预留`),t.outputReserveTokens],[A(`本地尾部预留`),t.forcedTailReserveTokens],[A(`安全余量`),t.safetyMarginTokens]];return(0,q.jsxs)(`section`,{className:`panel-card prompt-preview-detail`,"aria-labelledby":`budget-diagnostics-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-detail-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`prompt-preview-kicker`,children:`BUDGET, CACHE & LEAKAGE`}),(0,q.jsx)(`h3`,{id:`budget-diagnostics-title`,children:A(`预算与诊断`)})]}),(0,q.jsx)(`p`,{children:A(r?`Runtime 不估算上下文,也不会据此拒绝 Provider 请求。`:`所有数值来自本次真实编译结果,不由 Web 重新估算。`)})]}),(0,q.jsxs)(`div`,{className:`prompt-diagnostics-grid`,children:[(0,q.jsxs)(`section`,{"aria-labelledby":`prompt-budget-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{id:`prompt-budget-title`,children:A(`上下文预算`)}),(0,q.jsx)(`span`,{children:r?A(`由 Provider 判断`):t.status===`fits`?A(`可容纳`):t.status})]}),r?(0,q.jsx)(`dl`,{className:`prompt-budget-breakdown`,children:(0,q.jsxs)(`div`,{className:`prompt-budget-total`,children:[(0,q.jsx)(`dt`,{children:A(`Provider 窗口配置`)}),(0,q.jsxs)(`dd`,{children:[uo(t.contextWindowTokens),` tokens`]})]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`dl`,{className:`prompt-budget-breakdown`,children:[i.map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:e}),(0,q.jsxs)(`dd`,{children:[uo(t),` tokens`]})]},e)),(0,q.jsxs)(`div`,{className:`prompt-budget-total`,children:[(0,q.jsx)(`dt`,{children:A(`合计 / 模型窗口`)}),(0,q.jsxs)(`dd`,{children:[uo(t.requiredTokens),` /`,` `,uo(t.contextWindowTokens),` tokens`]})]})]}),(0,q.jsxs)(`p`,{className:`field-note`,children:[A(`估算器:`),t.estimator]})]})]}),(0,q.jsxs)(`section`,{"aria-labelledby":`prompt-cache-title`,children:[(0,q.jsxs)(`div`,{className:`prompt-preview-subsection-heading`,children:[(0,q.jsx)(`h4`,{id:`prompt-cache-title`,children:A(`稳定前缀与缓存`)}),(0,q.jsxs)(`span`,{children:[uo(n.estimatedCacheableTokens),` tokens`]})]}),(0,q.jsxs)(`dl`,{className:`prompt-cache-report`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`稳定前缀 fingerprint`)}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(`code`,{children:n.stablePrefixFingerprint})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`缓存断点`)}),(0,q.jsx)(`dd`,{className:`prompt-cache-breakpoints`,children:n.breakpoints.map(e=>(0,q.jsx)(`code`,{children:e},e))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`首个动态边界`)}),(0,q.jsx)(`dd`,{children:uo(n.firstDynamicByte)})]})]})]})]}),(0,q.jsxs)(`section`,{className:`prompt-leakage-report`,"aria-labelledby":`prompt-leakage-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`✓`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{id:`prompt-leakage-title`,children:A(`内部字段泄漏扫描通过`)}),(0,q.jsx)(`p`,{children:A(`Runtime 生成正文未发现以下内部字段。`)})]})]}),(0,q.jsx)(`div`,{className:`prompt-leakage-fields`,children:e.leakage.checkedFields.map(e=>(0,q.jsx)(`code`,{children:e},e))})]}),(0,q.jsxs)(`details`,{className:`prompt-preview-raw`,children:[(0,q.jsx)(`summary`,{children:A(`查看固定诊断绑定与完整原始结果`)}),(0,q.jsx)(`dl`,{className:`prompt-binding-details`,children:Object.entries(e.diagnosticBinding).map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:e}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(`code`,{children:t})})]},e))}),(0,q.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]})]})}function lo(e){return{provider:e.provider,modelId:e.modelId,contextWindowTokens:e.contextWindowTokens,maxOutputTokens:e.maxOutputTokens}}function uo(e){return new Intl.NumberFormat(re()).format(e)}function fo(e){return typeof e==`object`&&!!e&&`text`in e&&typeof e.text==`string`}function po(e){return typeof e==`object`&&e&&`type`in e&&typeof e.type==`string`?e.type:`raw`}function mo(e){return e instanceof Error?e.message:A(`真实提示词编译失败`)}function ho({label:e,hint:t,action:n,busy:r,onRevise:i}){let[a,o]=(0,l.useState)(``),s=`setting-revise-${e}`;return(0,q.jsxs)(`div`,{className:`setting-revise`,children:[(0,q.jsx)(`label`,{htmlFor:s,children:e}),(0,q.jsx)(`p`,{className:`field-note`,children:t}),(0,q.jsx)(`textarea`,{id:s,rows:3,value:a,disabled:r,placeholder:A(`例如:秦龙的动机再具体一点,别改开场白。`),onChange:e=>o(e.target.value)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r||a.trim().length===0,onClick:()=>{i(a.trim()),o(``)},children:n})]})}var go={setting_list:`列目录`,setting_search:`搜索`,setting_read:`读取`,setting_write_file:`写入`,setting_patch:`改节点`,setting_move:`移动`,setting_preview_candidate:`自检`,setting_finish_candidate:`结束候选`};function _o({phase:e,progress:t,now:n}){let r=t===null||t.updatedAt===0||n===0?null:Math.max(0,Math.round((n-t.updatedAt)/1e3)),i=t?.streaming??null,a=i===null||n===0?r:Math.max(0,Math.round((n-i.receivedAt)/1e3)),o=a!==null&&a>=90,s=i===null?0:i.reasoningChars+i.textChars+i.toolChars;return(0,q.jsxs)(`section`,{className:`setting-run-progress`,"aria-live":`polite`,"aria-label":A(`本次生成进度`),children:[(0,q.jsxs)(`div`,{className:`setting-run-headline`,children:[(0,q.jsx)(`strong`,{children:A(e===`planning`?`正在生成创作计划`:`正在生成候选`)}),(0,q.jsx)(`span`,{className:`setting-run-round`,children:A(`第 {round} / {maxRounds} 轮`,{round:t?.round??0,maxRounds:t?.maxRounds??64})}),(0,q.jsx)(`span`,{className:`setting-run-age${o?` setting-run-age-stalled`:``}`,children:r===null?A(`正在建立连接…`):i===null?A(`{seconds} 秒前更新`,{seconds:r}):A(`正在输出 {count} 字`,{count:vo(s)})})]}),(0,q.jsxs)(`dl`,{className:`setting-run-counters`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`工具调用`)}),(0,q.jsx)(`dd`,{children:t?.toolCalls??0})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`自检未通过`)}),(0,q.jsx)(`dd`,{children:t?.failedChecks??0})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`协议错误`)}),(0,q.jsx)(`dd`,{children:t?.repairs??0})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:`token`}),(0,q.jsxs)(`dd`,{children:[`↑`,vo(t?.usage.inputTokens??0),` ↓`,vo(t?.usage.outputTokens??0)]})]})]}),t?.writing!=null&&(0,q.jsxs)(`p`,{className:`setting-run-writing`,children:[A(`正在写`),(0,q.jsx)(`code`,{children:t.writing})]}),t!=null&&t.recentActions.length>0&&(0,q.jsx)(`ol`,{className:`setting-run-actions`,children:t.recentActions.slice(-5).reverse().map((e,t)=>(0,q.jsxs)(`li`,{className:e.ok?void 0:`setting-run-action-failed`,children:[(0,q.jsx)(`span`,{children:A(go[e.tool]??e.tool)}),e.target!=null&&(0,q.jsx)(`code`,{children:e.target}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`})]},`${String(t)}-${e.tool}-${e.target??``}`))}),i!==null&&i.tail!==``&&(0,q.jsxs)(`p`,{className:`setting-run-tail`,children:[(0,q.jsx)(`span`,{className:`setting-run-tail-kicker`,children:i.textChars===0?A(`思考中`):A(`正文`)}),i.tail]}),t?.lastCheck!=null&&(0,q.jsxs)(`p`,{className:`setting-run-check`,children:[A(`最近自检:`),t.lastCheck]}),o&&(0,q.jsx)(`p`,{className:`setting-run-stalled-note`,role:`note`,children:A(`已有 {seconds} 秒没有收到任何输出,模型调用可能已经卡住。`,{seconds:a})})]})}function vo(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var yo=[`补足人物动机、关系与可持续冲突,让角色更容易推动故事。`,`强化可以反复游玩的行动循环,同时保持节奏和信息披露边界。`,`检查现有设定的缺口,并补齐当前情境、主持原则与玩家视图。`];function bo({packageName:e,packageStatus:t,modelConfigured:n,currentFiles:r,hasUnsavedFileDraft:i,contextPaths:a,contextLocked:o,phase:s,goal:c,plan:l,candidate:u,progress:d,progressNow:f,onGoalChange:p,onContextPathsChange:m,onStart:h,onConfirm:g,onRevisePlan:_,onReviseCandidate:v,onApply:y,onDiscard:b,onConfigureModel:x}){let S=[`planning`,`generating`,`applying`,`discarding`].includes(s),C=u!==null||l===null&&s===`generating`?3:l===null?1:2;return(0,q.jsxs)(`section`,{className:`setting-improvement-workspace`,"aria-labelledby":`setting-improvement-title`,"aria-busy":S,children:[(0,q.jsxs)(`header`,{className:`setting-improvement-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`CONTENT PACKAGE · AI AUTHORING`}),(0,q.jsx)(`h2`,{id:`setting-improvement-title`,children:A(`AI 设定完善`)}),(0,q.jsx)(`p`,{className:`setting-improvement-intro`,children:A(`AI 会基于当前树完善设定:可以先只读现有文件并确认计划,也可以直接生成隔离候选。 只有最后整批应用才会替换当前内容包;已有世界不会改变。`)})]}),(0,q.jsxs)(`div`,{className:`setting-package-context`,"aria-label":A(`当前内容包`),children:[(0,q.jsx)(`span`,{children:A(`正在完善`)}),(0,q.jsx)(`strong`,{children:e}),(0,q.jsx)(`span`,{className:`package-status ${t}`,children:A(t===`usable`?`可用于创建世界`:`需要修复`)})]})]}),(0,q.jsxs)(`div`,{className:`setting-authoring-layout`,children:[(0,q.jsx)(xo,{files:r,hasUnsavedFileDraft:i,contextPaths:a,contextLocked:o,onContextPathsChange:m}),(0,q.jsxs)(`div`,{className:`setting-authoring-flow`,children:[(0,q.jsx)(`ol`,{className:`setting-stepper`,"aria-label":A(`设定完善进度`),children:[[1,A(`描述目标`),A(`说清想获得的体验`)],[2,A(`可选计划`),A(`只读现有设定后确认方向`)],[3,A(`审阅并应用`),A(`核对完整差异与提示词`)]].map(([e,t,n])=>{let r=Number(e),i=r<C?`done`:r===C?`active`:`later`;return(0,q.jsxs)(`li`,{className:`setting-step setting-step-${i}`,"aria-current":i===`active`?`step`:void 0,children:[(0,q.jsx)(`span`,{className:`setting-step-number`,"aria-hidden":`true`,children:i===`done`?`✓`:r}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{children:t}),(0,q.jsx)(`small`,{children:n})]})]},r)})}),(s===`planning`||s===`generating`)&&(0,q.jsx)(_o,{phase:s,progress:d,now:f}),o&&(0,q.jsx)(`p`,{className:`setting-session-lock`,role:`note`,children:A(`当前创作会话及直接注入文件已固定。应用或放弃前,手动编辑、上下文选择和内容包切换会暂时停用。`)}),!n&&(0,q.jsxs)(`div`,{className:`setting-callout`,role:`note`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`需要先连接模型`)}),(0,q.jsx)(`p`,{children:A(`创作计划和候选文件都由当前模型生成。`)})]}),(0,q.jsx)(`button`,{type:`button`,disabled:i,onClick:x,children:A(`配置模型连接`)})]}),l===null&&u===null?(0,q.jsxs)(`section`,{className:`setting-step-card`,"aria-labelledby":`setting-goal-title`,children:[(0,q.jsx)(`div`,{className:`setting-step-heading`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 1 步`)}),(0,q.jsx)(`h3`,{id:`setting-goal-title`,children:A(`这次想把设定完善成什么样?`)})]})}),(0,q.jsx)(`p`,{id:`setting-goal-help`,className:`field-note setting-goal-help`,children:A(`写玩家最终会感受到什么、哪里薄弱、哪些内容不要改。无需描述文件名或技术格式。`)}),(0,q.jsx)(`textarea`,{"aria-label":A(`设定完善目标`),"aria-describedby":`setting-goal-help`,rows:7,value:c,readOnly:S,placeholder:A(`例如:我想让学院生活更有日常节奏。补足室友之间的目标与矛盾,保留轻松基调,不增加数值化好感度,也不要预写未来剧情。`),onChange:e=>p(e.target.value)}),!S&&(0,q.jsxs)(`div`,{className:`setting-goal-examples`,"aria-label":A(`目标示例`),children:[(0,q.jsx)(`span`,{children:A(`可以这样写:`)}),yo.map(e=>(0,q.jsx)(`button`,{type:`button`,className:`setting-example-button`,onClick:()=>p(A(e)),children:A(e)},e))]}),(0,q.jsxs)(`div`,{className:`setting-primary-action`,children:[(0,q.jsxs)(`div`,{className:`setting-decision-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:!n||i||c.trim().length===0||S,onClick:()=>h(`plan_first`),children:A(s===`planning`?`正在生成创作计划…`:`生成可见创作计划`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:!n||i||c.trim().length===0||S,onClick:()=>h(`direct_candidate`),children:A(s===`generating`?`正在直接生成候选…`:`跳过计划,直接生成候选`)})]}),(0,q.jsx)(`span`,{children:A(`计划阶段只能读取;直接生成也仍需在最后审阅并整批应用。`)})]})]}):(0,q.jsxs)(`details`,{className:`setting-completed-step`,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 1 步`)}),(0,q.jsx)(`strong`,{children:A(`创作目标已提交`)})]}),(0,q.jsx)(`span`,{className:`state-label state-label-latest`,children:A(`方向已提交`)})]}),(0,q.jsx)(`p`,{className:`setting-completed-copy`,children:c})]}),l!==null&&u===null&&(0,q.jsxs)(`section`,{className:`setting-step-card`,"aria-labelledby":`setting-plan-title`,children:[(0,q.jsx)(`div`,{className:`setting-step-heading`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 2 步`)}),(0,q.jsx)(`h3`,{id:`setting-plan-title`,children:A(`确认 AI 理解的创作方向`)})]})}),(0,q.jsx)(`p`,{className:`field-note`,children:A(`这里仍然只是计划。AI 已可只读当前树,但确认前不能修改;若方向不对,放弃后修改目标。`)}),(0,q.jsx)(Co,{markdown:l.markdown}),(0,q.jsxs)(`div`,{className:`setting-decision-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:S,onClick:g,children:A(s===`generating`?`正在生成并检查候选…`:`确认计划并生成候选`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:S,onClick:b,children:A(`放弃整批候选`)})]}),(0,q.jsx)(ho,{label:A(`让 AI 调整计划`),hint:A(`方向不对时不必放弃重来:写下要改什么,AI 会在同一次会话里重出完整计划。`),action:A(s===`planning`?`正在重新规划…`:`按意见重出计划`),busy:S,onRevise:_})]}),l!==null&&u!==null&&(0,q.jsxs)(`details`,{className:`setting-completed-step`,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 2 步`)}),(0,q.jsx)(`strong`,{children:A(`创作计划已确认`)})]}),(0,q.jsx)(`span`,{className:`state-label state-label-latest`,children:A(`已确认`)})]}),(0,q.jsx)(Co,{markdown:l.markdown})]}),l===null&&u!==null&&(0,q.jsxs)(`div`,{className:`setting-skipped-plan`,role:`note`,children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 2 步 · 可选`)}),(0,q.jsx)(`strong`,{children:A(`已跳过可见计划`)}),(0,q.jsx)(`span`,{children:A(`本次按你的目标直接生成候选,仍需审阅完整差异后才能应用。`)})]}),u!==null&&(0,q.jsx)(To,{candidate:u,phase:s,onApply:y,onReviseCandidate:v,onDiscard:b})]})]})]})}function xo({files:e,hasUnsavedFileDraft:t,contextPaths:n,contextLocked:r,onContextPathsChange:i}){let[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(``),u=(0,l.useMemo)(()=>[...e].sort(So),[e]),d=u.find(({path:e})=>e===`opening.md`)?.path??u.find(({path:e})=>e===`world/current-situation.yaml`)?.path??u.find(({path:e})=>e.startsWith(`world/`))?.path??u[0]?.path??``,f=e.some(({path:e})=>e===s)?s:d,p=e.find(({path:e})=>e===f),m=(0,l.useMemo)(()=>{let e=a.trim().toLowerCase();return e.length===0?u:u.filter(({path:t})=>t.toLowerCase().includes(e))},[u,a]),h=e.filter(({path:e})=>e.startsWith(`world/`)).length,g=e.filter(({path:e})=>e.startsWith(`control/`)).length,_=e.filter(({path:e})=>e===`opening.md`).length,v=u.filter(({encoding:e})=>e!==`base64`).map(({path:e})=>e),y=new Set(n),b=(e,t)=>{i((t?[...new Set([...n,e])]:n.filter(t=>t!==e)).sort())};return(0,q.jsxs)(`aside`,{className:`setting-current-browser`,"aria-labelledby":`setting-current-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`AI 的起点`)}),(0,q.jsx)(`h3`,{id:`setting-current-title`,children:A(`当前设定`)})]}),(0,q.jsxs)(`span`,{className:`state-label`,children:[e.length,` `,A(`个文件`)]})]}),(0,q.jsx)(`p`,{className:`setting-current-intro`,children:A(`计划阶段可通过只读工具查看整棵已保存当前树;勾选的文本文件会额外完整注入首个模型请求。`)}),t&&(0,q.jsxs)(`div`,{className:`setting-unsaved-warning`,role:`note`,children:[(0,q.jsx)(`strong`,{children:A(`手动编辑尚未保存`)}),(0,q.jsx)(`span`,{children:A(`这些修改不会进入 AI 候选;请先返回手动编辑并整批保存。`)})]}),(0,q.jsxs)(`dl`,{className:`setting-current-counts`,"aria-label":A(`当前设定文件统计`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`开场白`)}),(0,q.jsx)(`dd`,{children:_})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`世界内容`)}),(0,q.jsx)(`dd`,{children:h})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`控制文件`)}),(0,q.jsx)(`dd`,{children:g})]})]}),(0,q.jsxs)(`section`,{className:`setting-context-selection`,"aria-labelledby":`setting-context-selection-title`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{id:`setting-context-selection-title`,children:A(`直接注入给 AI`)}),(0,q.jsxs)(`span`,{children:[n.length,` `,A(`个文件`)]})]}),(0,q.jsx)(`p`,{children:A(`适合指定本次完善必须先看到的核心人物、规则或当前情境。`)}),(0,q.jsxs)(`div`,{className:`setting-context-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r||v.length===0,onClick:()=>i(v),children:A(`全选文本文件`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:r||n.length===0,onClick:()=>i([]),children:A(`清空注入`)})]})]}),e.length===0?(0,q.jsx)(`p`,{className:`setting-empty-state`,children:A(`当前内容包还没有文件。`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{className:`setting-file-filter`,children:[A(`筛选文件`),(0,q.jsx)(`input`,{type:`search`,value:a,placeholder:A(`例如 characters 或 frame`),onChange:e=>o(e.target.value)})]}),(0,q.jsx)(`nav`,{className:`setting-current-file-list`,"aria-label":A(`当前设定文件`),children:m.length===0?(0,q.jsx)(`p`,{children:A(`没有匹配的文件。`)}):(0,q.jsx)(`ul`,{children:m.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`button`,{type:`button`,className:e.path===f?`selected-setting-file`:``,"aria-pressed":e.path===f,title:e.path,onClick:()=>c(e.path),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:e.path===`opening.md`?A(`开场`):e.path.startsWith(`world/`)?A(`世界`):A(`控制`)}),(0,q.jsx)(`code`,{children:e.path})]}),(0,q.jsxs)(`label`,{className:`setting-context-checkbox`,children:[(0,q.jsx)(`input`,{type:`checkbox`,"aria-label":A(`注入 {path}`,{path:e.path}),checked:y.has(e.path),disabled:r||e.encoding===`base64`,onChange:t=>b(e.path,t.target.checked)}),(0,q.jsx)(`span`,{children:e.encoding===`base64`?A(`二进制`):A(`注入`)})]})]},e.path))})}),p!==void 0&&(0,q.jsxs)(`section`,{className:`setting-current-file-preview`,"aria-labelledby":`setting-current-file-title`,children:[(0,q.jsx)(`h4`,{id:`setting-current-file-title`,children:p.path}),p.encoding===`base64`?(0,q.jsx)(`p`,{children:A(`这是二进制资源,内容不在此处展开。`)}):(0,q.jsx)(`pre`,{children:p.contents})]})]})]})}function So(e,t){let n=e=>e===`opening.md`?0:e===`world/current-situation.yaml`?1:e.startsWith(`world/`)?2:e.startsWith(`control/`)?3:4;return n(e.path)-n(t.path)||e.path.localeCompare(t.path)}function Co({markdown:e}){return(0,q.jsx)(`article`,{className:`setting-plan-document`,children:wo(e)})}function wo(e){let t=e.trim().split(/\r?\n/u),n=[],r=[],i=[],a=()=>{r.length!==0&&(n.push((0,q.jsx)(`p`,{children:r.join(` `)},`paragraph-${n.length}`)),r=[])},o=()=>{i.length!==0&&(n.push((0,q.jsx)(`ul`,{children:i.map((e,t)=>(0,q.jsx)(`li`,{children:e},`${t}-${e}`))},`list-${n.length}`)),i=[])};for(let e of t){let t=/^(#{1,4})\s+(.+)$/u.exec(e),s=/^\s*(?:[-*]|\d+\.)\s+(.+)$/u.exec(e);if(t!==null){a(),o();let e=t[2]??``,r=t[1]?.length??1;r===1?n.push((0,q.jsx)(`h3`,{children:e},`heading-${n.length}`)):r===2?n.push((0,q.jsx)(`h4`,{children:e},`heading-${n.length}`)):n.push((0,q.jsx)(`h5`,{children:e},`heading-${n.length}`))}else s===null?e.trim().length===0?(a(),o()):(o(),r.push(e.trim())):(a(),i.push(s[1]??``))}return a(),o(),n}function To({candidate:e,phase:t,onApply:n,onReviseCandidate:r,onDiscard:i}){let{review:a}=e,o={create:a.diff.filter(({kind:e})=>e===`create`).length,modify:a.diff.filter(({kind:e})=>e===`modify`).length,delete:a.diff.filter(({kind:e})=>e===`delete`).length},s=t===`applying`||t===`discarding`;return(0,q.jsxs)(`section`,{className:`setting-step-card setting-review`,"aria-labelledby":`setting-review-title`,children:[(0,q.jsxs)(`div`,{className:`setting-step-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`setting-step-kicker`,children:A(`第 3 步`)}),(0,q.jsx)(`h3`,{id:`setting-review-title`,children:A(`审阅候选,再决定是否应用`)})]}),(0,q.jsx)(`span`,{className:`review-status review-status-${a.status}`,children:a.status===`usable`?A(`机械检查通过`):A(`候选需要修复`)})]}),(0,q.jsxs)(`dl`,{className:`setting-review-summary`,"aria-label":A(`候选摘要`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`文件变化`)}),(0,q.jsx)(`dd`,{children:a.diff.length})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`新建`)}),(0,q.jsx)(`dd`,{children:o.create})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`修改`)}),(0,q.jsx)(`dd`,{children:o.modify})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`删除`)}),(0,q.jsx)(`dd`,{children:o.delete})]})]}),a.diagnostics.length>0&&(0,q.jsxs)(`section`,{className:`setting-diagnostics`,"aria-labelledby":`setting-diagnostics-title`,children:[(0,q.jsx)(`h4`,{id:`setting-diagnostics-title`,children:A(`机械检查诊断`)}),(0,q.jsx)(`ul`,{children:a.diagnostics.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`strong`,{children:e.path}),(0,q.jsx)(`span`,{children:e.message})]},`${e.code}-${e.path}`))})]}),(0,q.jsxs)(`section`,{className:`setting-diff-list`,"aria-labelledby":`setting-diff-title`,children:[(0,q.jsx)(`div`,{className:`setting-subsection-heading`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{id:`setting-diff-title`,children:A(`完整文件差异`)}),(0,q.jsx)(`p`,{children:A(`逐个展开检查;这里显示的就是整批应用将替换的内容。`)})]})}),a.diff.length===0?(0,q.jsx)(`p`,{className:`setting-empty-state`,children:A(`AI 没有改动任何文件。`)}):a.diff.map((e,t)=>(0,q.jsxs)(`details`,{className:`setting-diff`,open:a.diff.length===1||t===0,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`span`,{className:`diff-kind diff-kind-${e.kind}`,children:Do(e.kind)}),(0,q.jsx)(`code`,{children:e.path})]}),(0,q.jsxs)(`div`,{className:`setting-diff-columns`,children:[e.before!==null&&(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h5`,{children:A(`应用前`)}),(0,q.jsx)(`pre`,{children:e.before})]}),e.after!==null&&(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h5`,{children:A(`应用后`)}),(0,q.jsx)(`pre`,{children:e.after})]})]})]},e.path))]}),(0,q.jsx)(Eo,{preview:a.preview}),(0,q.jsxs)(`div`,{className:`setting-apply-boundary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:A(`这是一次整批替换`)}),(0,q.jsx)(`p`,{children:A(`不能只勾选部分文件。放弃会丢弃整个隔离候选,当前内容包保持不变。`)})]}),(0,q.jsxs)(`div`,{className:`setting-decision-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:s||a.status!==`usable`,onClick:n,children:A(t===`applying`?`正在整批应用…`:`整批应用候选`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:s,onClick:i,children:A(t===`discarding`?`正在放弃…`:`放弃整批候选`)})]}),(0,q.jsx)(ho,{label:A(`让 AI 继续改这份候选`),hint:A(`只有一两处不满意时不必整批放弃:写下要改什么,AI 会在当前候选上接着改,已经对的部分保留。`),action:A(t===`generating`?`正在修改候选…`:`按意见继续修改`),busy:s,onRevise:r})]})]})}function Eo({preview:e}){let{budget:t}=e.compilation;return(0,q.jsxs)(`section`,{className:`setting-prompt-preview`,"aria-labelledby":`setting-preview-title`,children:[(0,q.jsxs)(`div`,{className:`setting-subsection-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h4`,{id:`setting-preview-title`,children:A(`真实提示词预览`)}),(0,q.jsx)(`p`,{children:A(`候选已通过和真实请求同源的编译检查。`)})]}),(0,q.jsx)(`span`,{className:`review-status review-status-usable`,children:A(`无内部字段泄漏`)})]}),(0,q.jsxs)(`dl`,{className:`setting-preview-summary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`模型`)}),(0,q.jsx)(`dd`,{children:e.diagnosticBinding.modelId})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`逻辑消息`)}),(0,q.jsx)(`dd`,{children:e.compilation.logicalMessages.length})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`工具`)}),(0,q.jsx)(`dd`,{children:e.compilation.tools.length})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:t.estimator===`disabled`?A(`上下文检查`):A(`预算`)}),(0,q.jsx)(`dd`,{children:t.estimator===`disabled`?A(`由 Provider 判断`):`${Oo(t.requiredTokens)} / ${Oo(t.contextWindowTokens)} tokens`})]})]}),(0,q.jsxs)(`div`,{className:`setting-preview-details`,children:[(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`查看逻辑消息正文`)}),(0,q.jsx)(`ol`,{className:`setting-message-list`,children:e.compilation.logicalMessages.map((e,t)=>(0,q.jsxs)(`li`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`strong`,{children:e.role}),(0,q.jsx)(`span`,{children:e.blocks.map(({source:e})=>e).join(` · `)})]}),(0,q.jsx)(`pre`,{children:e.markdown})]},`${e.role}-${t}`))})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`查看材料覆盖与预算`)}),(0,q.jsx)(`div`,{className:`table-scroll`,children:(0,q.jsxs)(`table`,{children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:`Slot`}),(0,q.jsx)(`th`,{children:A(`来源`)}),(0,q.jsx)(`th`,{children:A(`状态`)})]})}),(0,q.jsx)(`tbody`,{children:e.compilation.coverage.map(e=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:e.slot}),(0,q.jsx)(`td`,{children:e.source}),(0,q.jsx)(`td`,{children:e.status})]},`${e.slot}-${e.source}`))})]})}),(0,q.jsx)(`pre`,{children:JSON.stringify({budget:t,cache:e.compilation.cache},null,2)})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`查看真实工具定义`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.compilation.tools,null,2)})]}),(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`查看最终 Provider 请求结构`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.compilation.provider,null,2)})]})]})]})}function Do(e){return A(e===`create`?`新建`:e===`delete`?`删除`:`修改`)}function Oo(e){return new Intl.NumberFormat(re()).format(e)}function ko({preview:e,pending:t=!1,onApply:n,onCancel:r}){return(0,q.jsxs)(`section`,{className:`correction-preview-panel`,"aria-labelledby":`continuity-correction-title`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`REVIEW BEFORE APPLY`}),(0,q.jsx)(`h4`,{id:`continuity-correction-title`,children:A(`确认修正内容`)})]}),(0,q.jsxs)(`span`,{children:[e.diffs.length,` `,A(`份文档会变化`)]})]}),e.diffs.map(e=>(0,q.jsxs)(`article`,{className:`correction-diff`,children:[(0,q.jsx)(`h3`,{children:e.path}),(0,q.jsxs)(`div`,{className:`correction-diff-columns`,children:[(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h4`,{children:A(`修正前`)}),(0,q.jsx)(`pre`,{children:e.before})]}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h4`,{children:A(`修正后`)}),(0,q.jsx)(`pre`,{children:e.after})]})]}),(0,q.jsxs)(`details`,{className:`technical-details`,children:[(0,q.jsx)(`summary`,{children:A(`查看内容 hash`)}),(0,q.jsxs)(`p`,{children:[e.beforeHash,` → `,e.afterHash]})]})]},e.documentId)),(0,q.jsxs)(`details`,{className:`technical-details`,children:[(0,q.jsx)(`summary`,{children:A(`查看端点、附加材料和下一次提示词`)}),(0,q.jsxs)(`dl`,{className:`correction-technical-summary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`父端点`)}),(0,q.jsx)(`dd`,{children:e.parentHead})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`候选版本`)}),(0,q.jsx)(`dd`,{children:e.candidateVersion})]})]}),(0,q.jsx)(`h4`,{children:A(`完整附加材料清单差异`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(e.materials,null,2)}),(0,q.jsx)(`h4`,{children:A(`下一次真实 Prompt Preview`)}),(0,q.jsx)(`pre`,{children:e.nextPromptMarkdown})]}),(0,q.jsxs)(`div`,{className:`button-row correction-preview-actions`,children:[(0,q.jsx)(`button`,{disabled:t,onClick:n,type:`button`,children:A(`应用这笔修正`)}),(0,q.jsx)(`button`,{className:`secondary-button`,disabled:t,onClick:r,type:`button`,children:A(`放弃修正草稿`)})]})]})}function Ao({records:e,extensions:t=[],playerViewPanels:n=[],bridgeEvents:r={}}){return e.length===0&&t.length===0&&n.length===0?null:(0,q.jsxs)(`section`,{className:`artifact-debugger`,"data-artifact-debugger":`true`,"aria-label":A(`产物调试器`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`EXTENSION DEBUG`}),(0,q.jsx)(`h2`,{children:A(`产物调试器`)})]}),t.length===0?null:(0,q.jsxs)(`section`,{className:`artifact-extension-statuses`,"data-artifact-extension-statuses":`true`,"data-testid":`artifact-extension-statuses`,"aria-label":A(`扩展状态`),children:[(0,q.jsx)(`h3`,{children:A(`扩展状态`)}),t.map(e=>(0,q.jsxs)(`article`,{className:`artifact-extension-status`,"data-extension-operation":e.operationId,"data-extension-status":e.status,children:[(0,q.jsx)(`strong`,{children:e.status}),(0,q.jsx)(`span`,{children:e.coreCommitted?A(`核心已提交`):A(`核心未提交`)}),(0,q.jsxs)(`span`,{children:[A(`已完成请求:`),e.completedRequests.length===0?A(`无`):e.completedRequests.join(`、`)]}),e.head===void 0?null:(0,q.jsxs)(`span`,{children:[`head:`,e.head]}),e.message===void 0?null:(0,q.jsx)(`p`,{children:e.message})]},e.operationId))]}),n.length===0?null:(0,q.jsxs)(`section`,{className:`player-view-panel-debug`,"data-player-view-panel-debug":`true`,"aria-label":A(`玩家视图面板诊断`),children:[(0,q.jsx)(`h3`,{children:A(`玩家视图面板`)}),n.map(e=>(0,q.jsxs)(`article`,{children:[(0,q.jsx)(`strong`,{children:e.panelId}),(0,q.jsxs)(`span`,{children:[A(`已提交玩家视图投影 · head:`),e.head]}),(0,q.jsxs)(`span`,{children:[`source:`,e.source.viewId,` · current preset `,e.preset.id,`/`,e.preset.revision]}),e.diagnostics.length===0?null:(0,q.jsx)(`ul`,{children:e.diagnostics.map((e,t)=>(0,q.jsx)(`li`,{children:e.message},String(t)))}),(0,q.jsx)(`pre`,{children:zi(e.payload,e.contentType)}),(r[`player-view:${e.panelId}`]??[]).length===0?null:(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{children:[A(`bridge 事件(`),r[`player-view:${e.panelId}`].length,`)`]}),(0,q.jsx)(`ul`,{children:r[`player-view:${e.panelId}`].map((e,t)=>(0,q.jsx)(`li`,{children:e},`${e}-${t}`))})]})]},e.panelId))]}),e.map(e=>(0,q.jsx)(jo,{record:e,bridgeEvents:r[e.recordId]??[]},`${e.recordId}-${e.sequence}`))]})}function jo({record:e,bridgeEvents:t}){let n=Vi({payload:e.payload,contentType:e.contentType,rules:e.frontend.regex});return(0,q.jsxs)(`details`,{className:`artifact-debugger-entry`,"data-artifact-record":e.recordId,children:[(0,q.jsxs)(`summary`,{children:[e.output,` · `,e.status,` · `,e.channel,e.key===void 0?``:` / ${e.key}`]}),(0,q.jsxs)(`dl`,{children:[(0,q.jsx)(`dt`,{children:A(`来源`)}),(0,q.jsxs)(`dd`,{children:[e.operationId,` / `,e.requestId,` / attempt`,` `,e.requestAttempt]}),(0,q.jsx)(`dt`,{children:A(`世界端点`)}),(0,q.jsxs)(`dd`,{children:[e.parentHead,` → `,e.newHead??A(`未提交`)]}),(0,q.jsx)(`dt`,{children:A(`保存/投影`)}),(0,q.jsxs)(`dd`,{children:[e.save,` / `,e.projection]}),(0,q.jsx)(`dt`,{children:`raw bytes`}),(0,q.jsx)(`dd`,{children:e.payloadBytes}),(0,q.jsx)(`dt`,{children:`renderer revision`}),(0,q.jsx)(`dd`,{children:e.frontend.renderer?.revision??`built-in`}),(0,q.jsx)(`dt`,{children:A(`renderer 状态`)}),(0,q.jsxs)(`dd`,{children:[e.frontend.status,` / `,e.frontend.fallback,e.frontend.diagnostic===void 0?``:` · ${e.frontend.diagnostic}`]}),(0,q.jsx)(`dt`,{children:`authority`}),(0,q.jsx)(`dd`,{children:e.frontend.authority??`non_authoritative_artifact`})]}),(0,q.jsx)(`p`,{children:`raw payload`}),(0,q.jsx)(`pre`,{children:zi(e.payload,e.contentType)}),(0,q.jsx)(`p`,{children:A(`最终内容`)}),(0,q.jsx)(`pre`,{children:n.final}),(0,q.jsx)(`p`,{children:A(`regex steps(structured_payload 以规范化 JSON 文本为输入)`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(n.steps,null,2)}),t.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{children:`bridge events`}),(0,q.jsx)(`ul`,{children:t.map((e,t)=>(0,q.jsx)(`li`,{children:e},`${e}-${t}`))})]})]})}function Mo(e,t){let n=new Set(t.map(({source:e})=>e.viewId));return{coveredViewIds:n,views:e.views.filter(({id:e})=>!n.has(e)),diagnostics:e.diagnostics.filter(({viewId:e})=>e===void 0||!n.has(e))}}function No({client:e,worldId:t,worldTitle:n,modelConfigured:r,onBack:i,onConfigureModel:a,onRenameWorld:o,onOpenWorld:s}){let[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(`play`),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(n),[x,S]=(0,l.useState)(n);x!==n&&(S(n),b(n));let[C,w]=(0,l.useState)(null),[T,ee]=(0,l.useState)(``),[E,D]=(0,l.useState)(`[]`),[te,O]=(0,l.useState)(!1),[k,ne]=(0,l.useState)(null),[re,ie]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[N,P]=(0,l.useState)(``),[ae,F]=(0,l.useState)(A(`衣着`)),[I,L]=(0,l.useState)(``),[oe,R]=(0,l.useState)({}),z=(0,l.useRef)(null);(0,l.useEffect)(()=>{let n=!0;return(async()=>{try{let[r,i]=await Promise.all([Ko(e,{type:`world.read`,worldId:t}),Yo(e,t)]);if(!n)return;he({...r,artifactDebug:i},!1)}catch(e){if(!n)return;v({kind:`error`,text:Go(e)})}finally{n&&g(null)}})(),()=>{n=!1}},[e,t]),(0,l.useEffect)(()=>{let n=h===`play-fresh`||h===`play-append`;if(n&&e.streamPlayCallChain!==void 0||!n&&C?.status!==`running`)return;let r=!0,i=async()=>{try{let n=await Ko(e,{type:`play.chain.inspect`,worldId:t});if(!r||n===null)return;w(n)}catch{}};i();let a=setInterval(()=>void i(),1e3);return()=>{r=!1,clearInterval(a)}},[e,h,C?.status,t]),(0,l.useEffect)(()=>{d===`play`&&z.current?.scrollIntoView?.({block:`nearest`})},[d]);let se=c?.state??[],B=se.map(Uo),V=B.filter(({path:e})=>/\.ya?ml$/iu.test(e)),ce=se.find(({path:e})=>e===T)??se[0],H=Mo(c?.playerViews??{views:[],diagnostics:[]},c?.playerViewPanels??[]),le=c?.committedMessages??[],ue=C===null?[]:[...C.previousContexts??[],C],U=ue.length===0?le:Fo(le,ue[0]),de=p.trim().length>0,fe=h===null&&C?.status!==`running`,pe=de&&fe,me=fe&&(C===null?de:C.status===`ready`||!de&&C.canRetry);function he(e,t){u(e),t||(D(JSON.stringify(e.control,null,2)),O(!1),ne(null)),w(e.playCallChain),ee(t=>e.state.some(({path:e})=>e===t)?t:e.state[0]?.path??``),P(t=>{let n=e.state.map(Uo).filter(({path:e})=>/\.ya?ml$/iu.test(e));return n.some(({handle:e})=>e===t)?t:n.find(({ref:e})=>e===`qinlong`)?.handle??n[0]?.handle??``})}async function ge(n=!0){let[r,i]=await Promise.all([Ko(e,{type:`world.read`,worldId:t}),Yo(e,t)]);he({...r,artifactDebug:i},n)}async function _e(n){if(!r)return;let i=n===`fresh`||C===null;if(i&&!pe||!i&&!me)return;let a=i?`play-chain-${crypto.randomUUID()}`:C.chainId,o=`play-exchange-${crypto.randomUUID()}`;g(n===`fresh`?`play-fresh`:`play-append`),v({kind:`status`,text:i?A(`正在从当前世界重新拼接上下文…`):de?A(`正在把玩家输入追加到现有上下文…`):C.status===`interrupted`?A(`正在原样发送上次未完成的模型请求…`):A(`正在沿现有上下文继续生成…`)});try{let n=await qo(e,i?{type:`play.chain.start`,worldId:t,chainId:a,exchangeId:o,playerText:p}:{type:`play.chain.append`,worldId:t,chainId:a,exchangeId:o,playerText:p},e=>Jo(e,w));w(n),de&&m(``),await ge(),v({kind:n.status===`interrupted`?`error`:`status`,text:n.status===`interrupted`?n.canRetry?A(`模型请求中断;清空输入后点击追加上下文即可原样发送上次请求。`):A(`调用链处理失败;旧请求不能重发,请使用全新上下文。`):A(!i&&!de?`AI 已沿现有上下文继续生成,没有追加玩家指令。`:`调用链已返回;模型完成的叙事和世界变化已经分别提交。`)})}catch(n){let r=await Ko(e,{type:`play.chain.inspect`,worldId:t}).catch(()=>null);r!==null&&w(r),v({kind:`error`,text:Go(n)})}finally{g(null)}}async function ve(){g(`control-preview`);try{let n=JSON.parse(E);await e.request({type:`world.control-draft.save`,worldId:t,files:n});let r=await e.request({type:`world.control-draft.preview`,worldId:t});ne(r),v({kind:`status`,text:A(`控制草稿已通过真实提示词预览;确认后才会整批应用。`)})}catch(e){ne(null),v({kind:`error`,text:Go(e)})}finally{g(null)}}async function ye(){if(k!==null&&C?.status!==`running`){g(`control-apply`);try{await e.request({type:`world.control-draft.apply`,worldId:t}),await ge(!1),v({kind:`status`,text:A(`世界控制已整批应用。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}}async function be(){if(N.length!==0&&ae.trim().length!==0){g(`correction-preview`);try{let n=re??await Ko(e,{type:`correction.begin`,worldId:t,operationId:`correction-${crypto.randomUUID()}`});ie(n);let r=await Ko(e,{type:`correction.read`,candidateId:n.candidateId,document:N}),i=await Ko(e,{type:`correction.patch`,candidateId:n.candidateId,expectedVersion:n.version,target:N,expectedHash:r.hash,edits:[{op:`replace`,locator:{yaml:ae.split(`.`).filter(Boolean)},value:I}]}),a=await Ko(e,{type:`correction.preview`,candidateId:n.candidateId,expectedVersion:i.version});ie({candidateId:n.candidateId,version:i.version}),M(a),v({kind:`status`,text:A(`修正草稿已预览;应用前世界状态没有变化。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}}async function xe(){if(re!==null&&j!==null){g(`correction-apply`);try{await e.request({type:`correction.apply`,candidateId:re.candidateId,expectedVersion:re.version}),ie(null),M(null),await ge(),v({kind:`status`,text:A(`连续性修正已作为一笔新提交应用,旧历史保持不变。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}}async function Se(){if(re===null){M(null);return}g(`correction-cancel`);try{await e.request({type:`correction.cancel`,candidateId:re.candidateId,expectedVersion:re.version}),ie(null),M(null),v({kind:`status`,text:A(`修正草稿已放弃,世界端点没有推进。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}async function Ce(t=c?.head){if(c!==null&&t!==void 0){g(`derive`);try{await s((await Ko(e,{type:`world.derive`,operationId:`derive-${crypto.randomUUID()}`,sourceWorldId:c.worldId,sourceHead:t})).world.worldId)}catch(e){v({kind:`error`,text:Go(e)}),g(null)}}}async function we(t,n,i){if(c===null)return;if(i.trim().length===0){v({kind:`error`,text:A(`修改后的玩家提交不能为空。`)});return}let a=`play-exchange-${crypto.randomUUID()}`;g(`revise`),v({kind:`status`,text:A(`正在当前世界中保存修改,并舍弃这条消息之后的当前时间线…`)});try{let o=await Ko(e,{type:`play.chain.revise-player`,operationId:`revise-player-${crypto.randomUUID()}`,worldId:c.worldId,chainId:t,eventId:n,replacementExchangeId:a,replacementText:i});if(w(o.playCallChain),await ge(),!r){v({kind:`status`,text:A(`修改已保存在当前世界;配置模型后点击“追加上下文”即可继续生成。`)});return}g(`play-append`),v({kind:`status`,text:A(`修改已保存,正在从修改稿继续生成…`)});let s=await qo(e,{type:`play.chain.append`,worldId:c.worldId,chainId:o.playCallChain.chainId,exchangeId:`play-exchange-${crypto.randomUUID()}`,playerText:``},e=>Jo(e,w));w(s),await ge(),v({kind:s.status===`interrupted`?`error`:`status`,text:s.status===`interrupted`?s.canRetry?A(`修改已保存,但模型请求中断;点击“追加上下文”即可原样重发。`):A(`修改已保存,但模型请求失败;请使用全新上下文继续。`):A(`修改已保存在当前世界,并已从修改稿继续。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}function Te(){_e(`append`)}async function Ee(){let e=y.trim();if(e!==``&&e!==n){g(`rename`),v(null);try{await o(e),v({kind:`status`,text:A(`世界名称已保存。`)})}catch(e){v({kind:`error`,text:Go(e)})}finally{g(null)}}}return c===null?(0,q.jsxs)(`main`,{className:`world-page world-page-loading`,children:[(0,q.jsx)(`button`,{className:`world-back-button secondary-button`,onClick:i,children:A(`← 返回工作区`)}),_?.kind===`error`?(0,q.jsx)(`p`,{role:`alert`,children:_.text}):(0,q.jsx)(`p`,{role:`status`,children:A(`正在打开世界…`)})]}):(0,q.jsxs)(`main`,{className:`world-page`,children:[(0,q.jsxs)(`header`,{className:`world-page-header`,children:[(0,q.jsxs)(`button`,{className:`world-back-button secondary-button`,onClick:i,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`←`}),` `,A(`工作区`)]}),(0,q.jsxs)(`div`,{className:`world-title-block`,children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:A(`正在游玩的世界`)}),(0,q.jsx)(`h1`,{children:n})]}),(0,q.jsxs)(`div`,{className:`world-header-summary`,"aria-label":A(`世界概况`),children:[(0,q.jsxs)(`span`,{children:[le.length,` `,A(`条已提交消息`)]}),(0,q.jsx)(`span`,{className:C?.status===`running`?`is-live`:`is-saved`,children:C?.status===`running`?A(`模型调用中`):C?.status===`interrupted`?A(`调用链已中断`):A(`世界已保存`)})]})]}),(0,q.jsx)(`nav`,{className:`world-section-tabs`,"aria-label":A(`世界页面`),children:[[`play`,A(`游玩`)],[`documents`,A(`当前文档`)],[`history`,A(`已提交叙事`)],[`manage`,A(`世界管理`)]].map(([e,t])=>(0,q.jsx)(`button`,{type:`button`,className:d===e?`is-current`:`secondary-button`,"aria-current":d===e?`page`:void 0,onClick:()=>f(e),children:t},e))}),_===null?null:(0,q.jsx)(`p`,{className:`world-feedback ${_.kind}`,role:_.kind===`error`?`alert`:`status`,children:_.text}),d===`play`&&(0,q.jsx)(ea,{worldId:c.worldId,artifacts:c.artifacts??[],playerViewPanels:c.playerViewPanels??[],playerViews:c.playerViews,interactionDisabled:h!==null,onSetComposerDraft:m,onRefresh:()=>ge(),onBridgeEvent:(e,t)=>R(n=>({...n,[e]:[...n[e]??[],t]})),children:(0,q.jsxs)(`section`,{className:`world-play-layout`,"aria-label":A(`世界游玩`),children:[(0,q.jsxs)(`article`,{className:`story-workspace`,"aria-busy":h!==null||C?.status===`running`,children:[(0,q.jsxs)(`header`,{className:`story-heading`,children:[(0,q.jsx)(`h2`,{children:A(`故事`)}),C?.status===`running`?(0,q.jsx)(`span`,{className:`session-badge`,children:A(`模型响应中`)}):C?.status===`interrupted`?(0,q.jsx)(`span`,{className:`session-badge call-chain-badge`,children:A(`调用链已中断`)}):null]}),(0,q.jsxs)(`div`,{className:`story-transcript`,"aria-label":A(`调用链记录`),children:[(0,q.jsx)(ta,{mount:`story`}),C===null?le.length===0?(0,q.jsxs)(`div`,{className:`story-empty-state`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),(0,q.jsx)(`h3`,{children:A(`故事还没有开始`)}),(0,q.jsx)(`p`,{children:A(`描述你的行动,从当前世界开始一条调用链。`)})]}):(0,q.jsx)(Po,{messages:le.map(e=>({...e,pending:!1})),restartDisabled:h!==null,onRestartFrom:e=>void Ce(e)}):(0,q.jsxs)(q.Fragment,{children:[U.length===0?null:(0,q.jsx)(Po,{messages:U.map(e=>({...e,pending:!1})),restartDisabled:h!==null,onRestartFrom:e=>void Ce(e)}),ue.map((e,t)=>(0,q.jsxs)(l.Fragment,{children:[(0,q.jsx)(`div`,{className:`story-context-boundary`,role:`separator`,"aria-label":A(`全新上下文从这里开始`),children:(0,q.jsx)(`span`,{children:A(`全新上下文从这里开始`)})}),(0,q.jsx)(Io,{chain:e,current:t===ue.length-1,restartDisabled:h!==null,onRestartFrom:e=>void Ce(e),onEditPlayer:(t,n)=>void we(e.chainId,t,n)})]},`${e.chainId}:${t}`))]}),(0,q.jsx)(`div`,{ref:z})]}),(0,q.jsxs)(`footer`,{className:`play-composer`,children:[!r&&(0,q.jsxs)(`div`,{className:`model-required-callout`,children:[(0,q.jsx)(`p`,{children:A(`需要先配置模型连接才能游玩。`)}),(0,q.jsx)(`button`,{type:`button`,onClick:a,children:A(`配置模型`)})]}),(0,q.jsx)(ta,{mount:`composer_above`}),C?.canRetry?(0,q.jsxs)(`div`,{className:`play-retry-note`,role:`alert`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`!`}),(0,q.jsx)(`p`,{children:A(`上次模型请求没有完整返回。保持输入框为空并点击“追加上下文”,就会原样发送已保存的请求;不会追加玩家指令,中断片段也不会进入模型上下文。`)})]}):null,(0,q.jsxs)(`label`,{className:`composer-field`,children:[(0,q.jsx)(`span`,{className:`visually-hidden`,children:A(`你的行动`)}),(0,q.jsx)(`textarea`,{"aria-label":A(`你的行动`),rows:2,placeholder:A(`描述你的行动;也可以留空并追加,让 AI 沿现有上下文续写…`),value:p,disabled:h!==null||!r||C?.status===`running`,onChange:e=>m(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),Te())}})]}),(0,q.jsx)(ta,{mount:`composer_below`}),(0,q.jsxs)(`div`,{className:`composer-actions`,children:[(0,q.jsx)(`p`,{children:A(`Ctrl / ⌘ + Enter 追加;没有上下文时自动全新开始`)}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:!pe||!r,onClick:()=>void _e(`fresh`),children:A(h===`play-fresh`?`正在开始…`:`全新上下文`)}),(0,q.jsx)(`button`,{type:`button`,disabled:!me||!r,onClick:()=>void _e(`append`),children:A(h===`play-append`?`正在追加…`:`追加上下文`)})]})]})]})]}),(0,q.jsxs)(`aside`,{className:`player-view-rail`,"aria-label":A(`玩家视图`),children:[(0,q.jsx)(`h2`,{className:`visually-hidden`,children:A(`当前情景`)}),(0,q.jsx)(ta,{mount:`sidebar`}),H.views.length===0?H.coveredViewIds.size>0?null:(0,q.jsxs)(`div`,{className:`player-view-empty`,children:[(0,q.jsx)(`p`,{children:A(`这个世界还没有配置常驻玩家视图。`)}),(0,q.jsx)(`small`,{children:A(`你仍然可以正常游玩;未显示不代表秘密。`)})]}):H.views.map(e=>(0,q.jsx)(Vo,{view:e},e.id)),H.diagnostics.length===0?null:(0,q.jsxs)(`details`,{className:`player-view-diagnostics`,children:[(0,q.jsxs)(`summary`,{children:[H.diagnostics.length,` `,A(`项视图诊断`)]}),(0,q.jsx)(`ul`,{children:H.diagnostics.map((e,t)=>(0,q.jsx)(`li`,{children:e.message},`${e.code}-${t}`))})]})]}),(0,q.jsx)(ta,{mount:`overlay`}),(0,q.jsx)(ta,{mount:`debug`}),(0,q.jsx)(Ao,{records:c.artifactDebug??[],extensions:c.extensions??[],playerViewPanels:c.playerViewPanels??[],bridgeEvents:oe})]})}),d===`documents`&&(0,q.jsxs)(`section`,{className:`world-browser`,"aria-labelledby":`documents-heading`,children:[(0,q.jsxs)(`aside`,{className:`world-browser-index`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`CURRENT STATE`}),(0,q.jsx)(`h2`,{id:`documents-heading`,children:A(`当前文档`)}),(0,q.jsxs)(`p`,{children:[se.length,` `,A(`份世界状态文件`)]})]}),(0,q.jsx)(`ul`,{children:B.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,className:ce?.path===e.path?`is-selected`:`secondary-button`,onClick:()=>ee(e.path),children:[(0,q.jsx)(`strong`,{children:e.title}),(0,q.jsx)(`span`,{children:e.path})]})},e.path))})]}),(0,q.jsx)(`article`,{className:`world-document-reader`,children:ce===void 0?(0,q.jsx)(`p`,{children:A(`当前世界没有状态文档。`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`WORLD DOCUMENT`}),(0,q.jsx)(`h2`,{children:Uo(ce).title})]}),(0,q.jsx)(`code`,{children:ce.path})]}),(0,q.jsx)(`pre`,{children:ce.contents})]})})]}),d===`history`&&(0,q.jsxs)(`section`,{className:`world-history-page`,"aria-labelledby":`history-heading`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`COMMITTED NARRATIVE`}),(0,q.jsx)(`h2`,{id:`history-heading`,children:A(`已提交叙事`)})]}),(0,q.jsx)(`p`,{children:A(`这里只显示已经进入世界权威的玩家与主持原文。`)})]}),le.length===0?(0,q.jsx)(`div`,{className:`history-empty-state`,children:A(`尚无已提交叙事。`)}):(0,q.jsx)(Po,{messages:le.map(e=>({...e,pending:!1})),restartDisabled:h!==null,onRestartFrom:e=>void Ce(e)})]}),d===`manage`&&(0,q.jsxs)(`section`,{className:`world-manage-page`,"aria-labelledby":`manage-heading`,children:[(0,q.jsxs)(`header`,{className:`world-manage-heading`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`WORLD MANAGEMENT`}),(0,q.jsx)(`h2`,{id:`manage-heading`,children:A(`世界管理`)})]}),(0,q.jsx)(`p`,{children:A(`这些操作位于故事之外;它们不会被普通游玩 AI 擅自执行。`)})]}),(0,q.jsxs)(`div`,{className:`world-manage-grid`,children:[(0,q.jsxs)(`article`,{className:`manage-card world-name-card`,children:[(0,q.jsx)(`span`,{className:`manage-card-number`,children:`01`}),(0,q.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,q.jsx)(`h3`,{children:A(`世界名称`)}),(0,q.jsx)(`p`,{children:A(`这是工作区和世界页显示的名字;修改它不会改动故事、状态或历史。`)})]}),(0,q.jsxs)(`form`,{className:`world-name-editor`,onSubmit:e=>{e.preventDefault(),Ee()},children:[(0,q.jsxs)(`label`,{children:[A(`世界显示名称`),(0,q.jsx)(`input`,{"aria-label":A(`世界显示名称`),maxLength:160,value:y,onChange:e=>b(e.currentTarget.value)})]}),(0,q.jsx)(`button`,{type:`submit`,disabled:h!==null||y.trim()===``||y.trim()===n,children:A(h===`rename`?`正在保存…`:`保存名称`)})]})]}),(0,q.jsxs)(`article`,{className:`manage-card derive-card`,children:[(0,q.jsx)(`span`,{className:`manage-card-number`,children:`02`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{children:A(`从此刻创建分叉`)}),(0,q.jsx)(`p`,{children:A(`复制当前状态和截至此刻的已提交叙事,得到一个完全独立的新世界。`)})]}),(0,q.jsx)(`button`,{type:`button`,disabled:h!==null||C?.status===`running`,onClick:()=>void Ce(c.head),children:A(h===`derive`?`正在创建…`:`创建分叉`)})]}),(0,q.jsxs)(`article`,{className:`manage-card control-card`,children:[(0,q.jsx)(`span`,{className:`manage-card-number`,children:`03`}),(0,q.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,q.jsx)(`h3`,{children:A(`世界控制`)}),(0,q.jsx)(`p`,{children:A(`编辑主持框架和玩家视图。草稿必须先通过真实提示词预览,再整批应用。`)})]}),(0,q.jsx)(`span`,{className:`control-draft-state`,children:A(te?`有尚未预览的修改`:`当前已应用控制`)}),C?.status===`running`?(0,q.jsx)(`p`,{className:`manage-warning`,children:A(`模型调用尚未返回;完成或中断后才能应用新控制。`)}):null,(0,q.jsxs)(`label`,{children:[A(`世界控制文件(JSON)`),(0,q.jsx)(`textarea`,{"aria-label":A(`世界控制文件`),rows:18,value:E,onChange:e=>{D(e.target.value),O(!0),ne(null)}})]}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:h!==null||!r,onClick:()=>void ve(),children:A(h===`control-preview`?`正在预览…`:`预览世界控制`)}),(0,q.jsx)(`button`,{type:`button`,disabled:h!==null||k===null||C?.status===`running`,onClick:()=>void ye(),children:A(h===`control-apply`?`正在应用…`:`整批应用世界控制`)})]}),k===null?null:(0,q.jsxs)(`details`,{className:`technical-details`,children:[(0,q.jsx)(`summary`,{children:A(`查看真实提示词预览结果`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(k,null,2)})]})]}),(0,q.jsxs)(`article`,{className:`manage-card correction-card`,children:[(0,q.jsx)(`span`,{className:`manage-card-number`,children:`04`}),(0,q.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,q.jsx)(`h3`,{children:A(`连续性修正`)}),(0,q.jsx)(`p`,{children:A(`在故事之外修正当前文档。修正会追加一笔新提交,不会改写旧叙事。`)})]}),j===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`correction-fields`,children:[(0,q.jsxs)(`label`,{children:[A(`要修正的文档`),(0,q.jsx)(`select`,{"aria-label":A(`要修正的文档`),value:N,onChange:e=>P(e.target.value),children:V.map(e=>(0,q.jsxs)(`option`,{value:e.handle,children:[e.title,`(@`,e.ref,`)`]},e.handle))})]}),(0,q.jsxs)(`label`,{children:[A(`YAML 路径`),(0,q.jsx)(`input`,{"aria-label":A(`YAML 路径`),placeholder:A(`例如:衣着 或 关系.秦龙.好感`),value:ae,onChange:e=>F(e.target.value)})]}),(0,q.jsxs)(`label`,{children:[A(`新值`),(0,q.jsx)(`textarea`,{"aria-label":A(`修正后的新值`),rows:3,value:I,onChange:e=>L(e.target.value)})]})]}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:h!==null||!r||C?.status===`running`||V.length===0||N.length===0||ae.trim().length===0,onClick:()=>void be(),children:A(h===`correction-preview`?`正在预览…`:`预览整笔修正`)}),re===null?null:(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:h!==null,onClick:()=>void Se(),children:A(`取消修正草稿`)})]})]}):(0,q.jsx)(ko,{preview:j,pending:h!==null,onApply:()=>void xe(),onCancel:()=>void Se()})]}),(0,q.jsxs)(`article`,{className:`manage-card runtime-card`,children:[(0,q.jsx)(`span`,{className:`manage-card-number`,children:`05`}),(0,q.jsxs)(`div`,{className:`manage-card-copy`,children:[(0,q.jsx)(`h3`,{children:A(`运行详情`)}),(0,q.jsx)(`p`,{children:A(`用于排查本地恢复问题,不参与普通游玩。`)})]}),(0,q.jsxs)(`dl`,{className:`runtime-summary`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`当前端点`)}),(0,q.jsx)(`dd`,{children:c.head})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:A(`世界 ID`)}),(0,q.jsx)(`dd`,{children:c.worldId})]})]}),(0,q.jsxs)(`details`,{className:`technical-details`,children:[(0,q.jsx)(`summary`,{children:A(`查看 Runtime 原始诊断`)}),(0,q.jsx)(`pre`,{children:JSON.stringify(c.runtime,null,2)})]})]})]})]})]})}function Po({messages:e,restartDisabled:t=!1,onRestartFrom:n}){return(0,q.jsx)(`ol`,{className:`narrative-list`,children:e.map((e,r)=>(0,q.jsx)(`li`,{className:`${e.role}-message ${e.pending?`pending-message`:``}`,children:(0,q.jsxs)(`article`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`strong`,{children:e.role===`player`?A(`你`):A(`主持`)}),e.pending?(0,q.jsx)(`span`,{children:A(`未结算`)}):null,e.head===void 0||n===void 0?null:(0,q.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:t,onClick:()=>n(e.head),children:A(`创建分叉`)})]}),(0,q.jsx)(`p`,{children:e.exactText})]})},`${r}-${e.role}`))})}function Fo(e,t){if(t.baselineHistoryLength!==void 0)return e.slice(0,t.baselineHistoryLength);let n=t.events.find(e=>e.kind===`player`);if(n?.committedHead===void 0)return e;let r=e.findIndex(({head:e})=>e===n.committedHead);return r<0?e:e.slice(0,r)}function Io({chain:e,current:t,restartDisabled:n,onRestartFrom:r,onEditPlayer:i}){return(0,q.jsxs)(`section`,{className:`play-call-chain`,"aria-label":A(`模型调用链`),children:[(0,q.jsx)(`header`,{className:`play-call-chain-heading`,children:(0,q.jsxs)(`span`,{children:[e.playPreset.name,` ·`,` `,Ro(e.status,t)]})}),(0,q.jsx)(`ol`,{className:`call-chain-events`,children:e.events.map(e=>(0,q.jsx)(Lo,{event:e,restartDisabled:n,onRestartFrom:r,onEditPlayer:i},e.kind===`player`?`${e.id}:${e.exchangeId}`:e.id))}),(0,q.jsxs)(`footer`,{className:`call-chain-summary`,children:[(0,q.jsx)(`strong`,{children:A(`本上下文已提交的世界变化`)}),e.changedDocuments.length===0?(0,q.jsx)(`span`,{children:A(`没有文档变化`)}):(0,q.jsx)(`ul`,{children:e.changedDocuments.map(e=>(0,q.jsxs)(`li`,{children:[e.kind===`create`?A(`新建`):A(`更新`),` `,e.ref,` · `,e.path]},`${e.kind}:${e.path}`))})]})]})}function Lo({event:e,restartDisabled:t,onRestartFrom:n,onEditPlayer:r}){let[i,a]=(0,l.useState)(null);return e.kind===`player`?(0,q.jsx)(`li`,{className:`call-chain-player`,children:(0,q.jsxs)(`article`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`strong`,{children:A(`玩家`)}),(0,q.jsx)(`span`,{children:e.context===`fresh`?A(`全新上下文`):A(`追加上下文`)}),e.committedHead===void 0?null:(0,q.jsxs)(`span`,{className:`history-message-actions`,children:[e.committedHead===`genesis`?null:(0,q.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:t,onClick:()=>a(e.text),children:A(`修改`)}),(0,q.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:t,onClick:()=>n(e.committedHead),children:A(`创建分叉`)})]})]}),i===null?(0,q.jsx)(`p`,{children:e.text}):(0,q.jsxs)(`div`,{className:`history-player-edit`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:A(`修改后的行动`)}),(0,q.jsx)(`textarea`,{"aria-label":A(`修改后的行动`),rows:3,value:i,disabled:t,onChange:e=>a(e.target.value)})]}),(0,q.jsx)(`p`,{children:A(`修改会直接保存在当前世界;这条原提交及其后的内容会离开当前时间线,但旧 Authority 记录仍可恢复。`)}),(0,q.jsxs)(`div`,{className:`button-row`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:t||i.trim().length===0,onClick:()=>r(e.id,i),children:A(`保存修改并继续`)}),(0,q.jsx)(`button`,{type:`button`,className:`secondary-button`,disabled:t,onClick:()=>a(null),children:A(`取消`)})]})]})]})}):e.kind===`assistant`?(0,q.jsx)(`li`,{className:`call-chain-assistant is-${e.status}`,children:(0,q.jsxs)(`article`,{children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(`strong`,{children:A(`AI 响应`)}),(0,q.jsx)(`span`,{children:A(`{status} · 第 {attempt} 次派发`,{status:zo(e.status),attempt:e.attempt})}),e.committedHead===void 0?null:(0,q.jsx)(`button`,{type:`button`,className:`history-restart-button`,disabled:t,onClick:()=>n(e.committedHead),children:A(`创建分叉`)})]}),e.reasoning===void 0||e.reasoning.length===0?null:(0,q.jsxs)(`details`,{className:`call-chain-reasoning`,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`strong`,{children:A(`模型思维链`)}),(0,q.jsx)(`span`,{children:A(`默认折叠`)})]}),(0,q.jsx)(`pre`,{children:e.reasoning})]}),(0,q.jsx)(`p`,{children:e.text.length>0?e.text:e.status===`streaming`?A(`正在接收模型输出…`):A(`(本次响应没有文本)`)}),e.toolFragment===void 0?null:(0,q.jsxs)(`details`,{children:[(0,q.jsx)(`summary`,{children:A(`正在接收的工具调用片段`)}),(0,q.jsx)(`pre`,{children:e.toolFragment})]}),e.usage===void 0?null:(0,q.jsxs)(`small`,{children:[A(`Provider usage:输入`),e.usage.inputTokens??`unavailable`,` `,A(`· 输出`),e.usage.outputTokens??`unavailable`]})]})}):e.kind===`tool_call`?(0,q.jsx)(`li`,{className:`call-chain-tool`,children:(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`strong`,{children:A(`调用 {tool}`,{tool:e.name})}),(0,q.jsx)(`span`,{children:e.replayed?A(`复用同 ID 结果`):e.callId})]}),(0,q.jsx)(`pre`,{children:Bo(e.arguments)})]})}):e.kind===`tool_result`?(0,q.jsx)(`li`,{className:`call-chain-tool-result ${e.ok?`is-ok`:`is-error`}`,children:(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`strong`,{children:[e.name,` `,A(`返回`)]}),(0,q.jsx)(`span`,{children:e.ok?A(`成功`):A(`拒绝/失败`)})]}),(0,q.jsx)(`pre`,{children:e.markdown})]})}):e.kind===`followup`?(0,q.jsx)(`li`,{className:`call-chain-followup ${e.failure===void 0?`is-ok`:`is-error`}`,children:(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsxs)(`strong`,{children:[A(`后置请求 ·`),e.displayName]}),(0,q.jsx)(`span`,{children:e.failure===void 0?A(`{count} 项产物`,{count:e.toolCalls.filter(({ok:e})=>e).length}):A(`未完成`)})]}),e.failure!==void 0&&(0,q.jsx)(`p`,{role:`alert`,children:e.failure}),e.text.trim()!==``&&(0,q.jsx)(`pre`,{children:e.text}),e.toolCalls.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`strong`,{children:[e.name,` · `,e.ok?A(`成功`):A(`拒绝/失败`)]}),(0,q.jsx)(`pre`,{children:Bo(e.arguments)}),(0,q.jsx)(`pre`,{children:e.markdown})]},e.callId)),e.usage!==void 0&&(0,q.jsxs)(`small`,{children:[A(`Provider usage:输入`),e.usage.inputTokens??`unavailable`,` `,A(`· 输出`),e.usage.outputTokens??`unavailable`]})]})}):(0,q.jsxs)(`li`,{className:`call-chain-failure`,role:`alert`,children:[(0,q.jsx)(`strong`,{children:A(`调用链中断`)}),(0,q.jsx)(`p`,{children:e.message})]})}function Ro(e,t){return A(e===`running`?`模型响应中`:e===`interrupted`?`调用链已中断`:t?`等待玩家追加`:`上下文已结束`)}function zo(e){return A(e===`streaming`?`接收中`:e===`interrupted`?`中断片段`:`已完成`)}function Bo(e){try{return JSON.stringify(e,null,2)}catch{return A(`[参数无法序列化]`)}}function Vo({view:e}){return(0,q.jsxs)(`article`,{className:`player-view-card`,children:[(0,q.jsx)(`h3`,{children:e.title}),e.items.length===0?(0,q.jsx)(`p`,{className:`player-view-empty-value`,children:A(`当前没有可显示项目。`)}):(0,q.jsx)(`dl`,{children:e.items.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:e.label}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(Ho,{value:e.value})})]},e.id))})]})}function Ho({value:e}){return e==null?(0,q.jsx)(`span`,{className:`empty-value`,children:`—`}):typeof e==`string`?(0,q.jsx)(`span`,{className:`text-value`,children:e}):typeof e==`number`||typeof e==`boolean`?(0,q.jsx)(`span`,{children:String(e)}):Array.isArray(e)?(0,q.jsx)(`ul`,{className:`player-value-list`,children:e.map((e,t)=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Ho,{value:e})},t))}):Wo(e)?typeof e.$ref==`string`?(0,q.jsxs)(`span`,{className:`document-reference`,children:[typeof e.title==`string`?e.title:e.$ref,typeof e.ref==`string`?` · @${e.ref}`:``]}):(0,q.jsx)(`dl`,{className:`player-value-map`,children:Object.entries(e).map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{children:e}),(0,q.jsx)(`dd`,{children:(0,q.jsx)(Ho,{value:t})})]},e))}):typeof e==`bigint`?(0,q.jsx)(`span`,{children:e.toString()}):typeof e==`symbol`?(0,q.jsx)(`span`,{children:e.description??`Symbol`}):(0,q.jsx)(`span`,{className:`empty-value`,children:A(`[无法显示]`)})}function Uo(e){let t=/^\s{0,4}title:\s*["']?(.+?)["']?\s*$/mu.exec(e.contents)?.[1]??e.path.split(`/`).at(-1)?.replace(/\.(?:ya?ml|md)$/iu,``)??e.path,n=/^\s{0,4}ref:\s*["']?(.+?)["']?\s*$/mu.exec(e.contents)?.[1]??e.path;return{path:e.path,title:t,ref:n,handle:`@${n}`}}function Wo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Go(e){return e instanceof Error?e.message:A(`操作失败`)}function Ko(e,t){return e.request(t)}function qo(e,t,n){return e.streamPlayCallChain===void 0?Ko(e,t):e.streamPlayCallChain(t,n)}function Jo(e,t){if(e.kind===`snapshot`){t(e.value);return}e.kind===`assistant_delta`&&t(t=>t===null?t:{...t,updatedAt:e.updatedAt,events:t.events.map(t=>t.kind!==`assistant`||t.id!==e.eventId?t:e.deltaKind===`text`?{...t,text:t.text+e.text}:e.deltaKind===`reasoning`?{...t,reasoning:`${t.reasoning??``}${e.text}`}:{...t,toolFragment:`${t.toolFragment??``}${e.text}`})})}async function Yo(e,t){try{let n=await e.request({type:`artifacts.debug`,worldId:t});return Array.isArray(n)?n:[]}catch{return[]}}function Xo({client:e}){let[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(`home`),[a,o]=(0,l.useState)(`files`),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)([]),[f,m]=(0,l.useState)([]),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(!1),[C,w]=(0,l.useState)(null),[T,ee]=(0,l.useState)(null),[D,te]=(0,l.useState)(!1),[O,k]=(0,l.useState)(``),[re,ie]=(0,l.useState)([]),[j,M]=(0,l.useState)(``),[N,P]=(0,l.useState)(`idle`),[ae,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(null),[oe,R]=(0,l.useState)(null),[z,se]=(0,l.useState)(0),[B,V]=(0,l.useState)(``),[ce,H]=(0,l.useState)(A(`正在读取工作区…`)),[le,ue]=(0,l.useState)(!1);async function U(){let t=await e.request({type:`workspace.read`});ne(t.preferences.locale),n(t),c(e=>t.contentPackages.some(({localId:t})=>t===e)?e:t.contentPackages[0]?.localId??``),H(``)}(0,l.useEffect)(()=>{if(j===``||N!==`planning`&&N!==`generating`)return;let t=!0,n=async()=>{try{let n=await e.request({type:`setting-improvement.progress`,improvementId:j});t&&R(n)}catch{}finally{t&&se(Date.now())}};n();let r=setInterval(()=>void n(),1e3);return()=>{t=!1,clearInterval(r)}},[e,j,N]),(0,l.useEffect)(()=>{let t=!0;return e.request({type:`workspace.read`}).then(e=>{t&&(ne(e.preferences.locale),n(e),c(e.contentPackages[0]?.localId??``),H(``))}).catch(e=>{t&&H(e instanceof Error?e.message:A(`工作区读取失败`))}),()=>{t=!1}},[e]);async function de(n){if(!(t===null||le)){ue(!0);try{ne((await e.request({type:`preferences.save`,locale:n})).locale),await U(),H(A(`界面语言已保存。`))}catch(e){G(e)}finally{ue(!1)}}}async function fe(t,n=`files`){try{let r=await e.request({type:`content.read`,packageId:t}),a=r.files;c(t),g(r),m(a.map(e=>({...e}))),ie([]),d(a.map(e=>({...e}))),v(!1),o(n),i(`content`)}catch(e){G(e)}}async function pe(){try{let t=await e.request({type:`content.replace`,packageId:s,files:u});g(t),d(t.files.map(e=>({...e}))),m(t.files.map(e=>({...e}))),v(!1),await U(),H(A(`内容包当前树已整批保存。`))}catch(e){G(e)}}async function me(){try{let t=await e.request({type:`content.create`});await U(),await fe(t.localId)}catch(e){G(e)}}async function he(t){try{await e.request({type:t,packageId:s}),await U(),i(`home`)}catch(e){G(e)}}async function ge(t){try{await e.request({type:`content.rename`,packageId:s,name:t}),await U(),H(A(`内容包已重命名。`))}catch(e){G(e)}}async function _e(){if(!(T===null||D)){if(T.size>p){H(A(`内容包 ZIP 自身大小超过安全上限。`));return}te(!0);try{let t=await Zo(T),n=await e.request({type:`content.import`,archiveBase64:t});ee(null),await U(),await fe(n.localId),H(A(`ZIP 内容包已导入为新的本地身份。`))}catch(e){G(e)}finally{te(!1)}}}async function ve(){try{let t=await e.request({type:`content.export`,packageId:s}),n=Uint8Array.from(atob(t.base64),e=>e.charCodeAt(0)),r=URL.createObjectURL(new Blob([n],{type:`application/zip`})),i=document.createElement(`a`);i.href=r,i.download=t.fileName,i.click(),URL.revokeObjectURL(r)}catch(e){G(e)}}async function ye(t){if(_){H(A(`请先保存手动编辑,再开始 AI 设定完善。`));return}let n=`improvement-${crypto.randomUUID()}`;M(n),P(t===`plan_first`?`planning`:`generating`),F(null),L(null),R(null);try{let r=await e.request({type:`setting-improvement.start`,improvementId:n,packageId:s,goal:O,mode:t,contextPaths:re});r.kind===`plan`?(F(r),P(`planned`),H(A(`创作计划已生成;计划阶段只读取了当前设定。`))):(L(r),P(`ready`),H(A(`候选已通过机械检查;可整批应用或放弃。`)))}catch(e){M(``),P(`idle`),G(e)}}async function be(){P(`generating`),R(null);try{let t=await e.request({type:`setting-improvement.confirm`,improvementId:j});L(t),P(`ready`),H(A(`候选已通过机械检查;可整批应用或放弃。`))}catch(e){P(`planned`),G(e)}}async function xe(t){P(`planning`),R(null);try{let n=await e.request({type:`setting-improvement.revise-plan`,improvementId:j,feedback:t});F(n),P(`planned`),H(A(`已按你的意见重出创作计划。`))}catch(e){P(`planned`),G(e)}}async function Se(t){P(`generating`),R(null);try{let n=await e.request({type:`setting-improvement.revise-candidate`,improvementId:j,feedback:t});L(n),P(`ready`),H(A(`候选已按你的意见修改并重新通过机械检查。`))}catch(e){P(`ready`),G(e)}}async function Ce(){P(`applying`);try{await e.request({type:`setting-improvement.apply`,improvementId:j}),M(``),F(null),L(null),k(``),ie([]),P(`idle`),await U(),await fe(s,`improve`),H(A(`设定候选已整批应用。`))}catch(e){P(`ready`),G(e)}}async function we(){let t=I===null?`planned`:`ready`;P(`discarding`);try{await e.request({type:`setting-improvement.discard`,improvementId:j}),M(``),F(null),L(null),P(`idle`),H(A(`设定候选已放弃,当前树未改变。`))}catch(e){P(t),G(e)}}function Te(e){if(w(e??null),t?.model.configured!==!0){i(`model`),H(A(`请先保存并启用一份模型配置。`));return}i(`preview`)}async function Ee(){if(t?.model.configured!==!0){i(`model`),H(A(`请先保存并启用一份模型配置。`));return}try{let t=await e.request({type:`world.create`,operationId:`create-${crypto.randomUUID()}`,packageId:s,model:De()});await U(),W(t.world.worldId)}catch(e){G(e)}}function De(){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 W(e){V(e),i(`world`)}async function Oe(t,n){await e.request({type:`world.rename`,worldId:t,name:n}),await U(),H(A(`世界已重命名为“{name}”。`,{name:n}))}async function ke(t){if(globalThis.confirm(A(`删除世界“{title}”?它的全部提交、历史和存档都会从本机移除,且无法撤销。`,{title:t.title})))try{await e.request({type:`world.delete`,worldId:t.worldId}),await U(),H(A(`世界已从本机删除。`))}catch(e){G(e)}}function G(e){H(e instanceof Error?e.message:A(`操作失败`))}if(t===null)return(0,q.jsx)(`main`,{className:`center-card`,role:`status`,children:ce});let Ae=t.contentPackages.find(({localId:e})=>e===s),je=h?.localId===s?h:null,Me=j.length>0,Ne=t.worlds.find(e=>e.worldId===B),Pe=t.model.connections.find(({id:e})=>e===t.model.activeConnectionId),Fe=t.playPresets.presets.find(({id:e})=>e===t.playPresets.currentPresetId)?.name??null;return r===`world`?(0,q.jsx)(No,{client:e,worldId:B,worldTitle:Ne?.title??A(`未命名世界`),modelConfigured:t.model.configured,onBack:()=>i(`home`),onConfigureModel:()=>i(`model`),onRenameWorld:e=>Oe(B,e),onOpenWorld:async e=>{await U(),V(e)}},B):(0,q.jsxs)(`main`,{className:`workspace-shell`,children:[(0,q.jsxs)(`header`,{className:`workspace-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:A(`Narraeon · 本地优先`)}),(0,q.jsx)(`h1`,{children:A(`世界工作区`)}),r===`home`&&(0,q.jsx)(`p`,{className:`workspace-header-copy`,children:A(`创作内容包,连接 AI 主持,让每个世界独立演化。`)})]}),(0,q.jsxs)(`div`,{className:`workspace-header-actions`,children:[(0,q.jsxs)(`label`,{className:`workspace-locale-picker`,children:[(0,q.jsx)(`span`,{children:A(`界面语言`)}),(0,q.jsxs)(`select`,{"aria-label":A(`界面语言`),value:t.preferences.locale,disabled:le,onChange:e=>void de(e.target.value),children:[(0,q.jsx)(`option`,{value:`en`,children:`English`}),(0,q.jsx)(`option`,{value:`zh-CN`,children:A(`简体中文`)})]})]}),(0,q.jsxs)(`button`,{className:`workspace-model-button secondary-button`,"aria-label":A(`模型连接`),disabled:_||Me||y||x||D,onClick:()=>i(`model`),children:[(0,q.jsx)(`span`,{className:`workspace-model-dot ${t.model.configured?`is-ready`:`needs-attention`}`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`small`,{children:A(`模型连接`)}),(0,q.jsx)(`strong`,{children:Pe?.name??A(`尚未配置`)})]})]}),r!==`home`&&(0,q.jsx)(`button`,{className:`secondary-button`,disabled:_||Me||y||x||D,onClick:()=>i(`home`),children:A(`返回工作区`)})]})]}),(ce||t.storageNotices.length>0)&&(0,q.jsxs)(`div`,{className:`workspace-feedback`,children:[ce&&(0,q.jsx)(`p`,{role:`status`,children:ce}),t.storageNotices.map(e=>(0,q.jsx)(`p`,{role:`alert`,children:e.message},e.surface))]}),r===`home`&&(0,q.jsx)(ki,{contentPackages:t.contentPackages,worlds:t.worlds,selectedPackageId:s,modelConfigured:t.model.configured,activeModelName:Pe?.name??null,currentPresetName:Fe,importArchive:T,importPending:D,onImportArchiveChange:e=>{ee(e),H(``)},onEditContent:()=>Ae===void 0?void me():void fe(Ae.localId),onOpenPlayPresets:()=>i(`plays`),onCreateWorld:()=>i(`create`),onOpenPreview:Te,onCreatePackage:()=>void me(),onImportPackage:()=>void _e(),onOpenPackage:e=>void fe(e),onOpenWorld:W,onRenameWorld:(e,t)=>void Oe(e.worldId,t).catch(G),onDeleteWorld:e=>void ke(e)}),r===`content`&&(0,q.jsxs)(`section`,{className:`content-workbench`,"aria-labelledby":`content-workbench-title`,children:[(0,q.jsxs)(`header`,{className:`content-workbench-header`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`eyebrow`,children:`CONTENT PACKAGE`}),(0,q.jsx)(`h2`,{id:`content-workbench-title`,children:Ae?.displayName??A(`内容包`)})]}),(0,q.jsxs)(`div`,{className:`content-mode-switch`,"aria-label":A(`内容包编辑方式`),children:[(0,q.jsx)(`button`,{type:`button`,className:a===`files`?`selected-mode`:`secondary-button`,"aria-pressed":a===`files`,disabled:Me,onClick:()=>o(`files`),children:A(`手动编辑`)}),(0,q.jsx)(`button`,{type:`button`,className:a===`improve`?`selected-mode`:`secondary-button`,"aria-pressed":a===`improve`,onClick:()=>o(`improve`),children:A(`AI 完善`)})]})]}),a===`files`?(0,q.jsx)(bi,{files:u,status:je?.status??Ae?.status??`needs_repair`,issues:je?.issues??[],dirty:_,onFilesChange:e=>{d(e),v(!0)},onSave:()=>void pe(),onReset:()=>{d(f.map(e=>({...e}))),v(!1),H(A(`已放弃未保存修改;内容包当前树未改变。`))},onCopy:()=>void he(`content.copy`),onExport:()=>void ve(),onDelete:()=>void he(`content.delete`),displayName:Ae?.displayName??s,onRename:e=>void ge(e)}):(0,q.jsx)(bo,{packageName:Ae?.displayName??s,packageStatus:Ae?.status??`needs_repair`,modelConfigured:t.model.configured,currentFiles:f,hasUnsavedFileDraft:_,contextPaths:re,contextLocked:Me,phase:N,goal:O,plan:ae,candidate:I,progress:oe,progressNow:z,onGoalChange:k,onContextPathsChange:ie,onStart:e=>void ye(e),onConfirm:()=>void be(),onRevisePlan:e=>void xe(e),onReviseCandidate:e=>void Se(e),onApply:()=>void Ce(),onDiscard:()=>void we(),onConfigureModel:()=>i(`model`)})]}),r===`plays`&&(0,q.jsx)(_a,{client:e,initialLibrary:t.playPresets,recommendedTemplates:E(t.preferences.locale),onLibraryChange:e=>n(t=>t===null?t:{...t,playPresets:e}),onDirtyChange:b,renderPromptPreview:n=>(0,q.jsx)(eo,{embedded:!0,client:e,packages:t.contentPackages,initialPackageId:s,playPresets:t.playPresets,model:t.model,onPackageSelect:c,playPresetTarget:n},`${n.presetId}:${n.revision}`)}),r===`model`&&(0,q.jsx)(Ni,{client:e,library:t.model,onLibraryChange:e=>n(t=>t===null?t:{...t,model:e}),onNotice:H,onDirtyChange:S}),r===`create`&&(0,q.jsxs)(`section`,{className:`panel-card`,children:[(0,q.jsx)(`h2`,{children:A(`新建世界`)}),(0,q.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),children:t.contentPackages.map(e=>(0,q.jsx)(`option`,{value:e.localId,children:e.displayName},e.localId))}),(0,q.jsx)(`button`,{disabled:!s,onClick:()=>void Ee(),children:A(`从当前内容包创建`)})]}),r===`preview`&&(0,q.jsx)(eo,{client:e,packages:t.contentPackages,initialPackageId:s,playPresets:t.playPresets,model:t.model,onPackageSelect:c,...C===null?{}:{playPresetTarget:C}})]})}async function Zo(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`error`,()=>n(r.error??Error(`Unable to read the content package ZIP`))),r.addEventListener(`abort`,()=>n(Error(`Reading the content package ZIP was cancelled`))),r.addEventListener(`load`,()=>{if(typeof r.result!=`string`){n(Error(`The content package ZIP read result is invalid`));return}let e=r.result.indexOf(`;base64,`);if(e<0){n(Error(`The content package ZIP could not be encoded for upload`));return}t(r.result.slice(e+8))}),r.readAsDataURL(e)})}var Qo=`narraeon.runtime/v1`,$o=class extends Error{protocolCode;constructor(e,t={}){super(e),this.name=`RuntimeRequestError`,this.protocolCode=t.protocolCode}},es=class{async request(e){let t=await fetch(`/api/runtime/v1`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({protocol:Qo,request:e})}),n=await t.json();if(!t.ok)throw new $o(n.error?.message??`Runtime request failed: ${t.status}`,{protocolCode:n.error?.code});if(n.protocol!==`narraeon.runtime/v1`)throw Error(`The Runtime returned an incompatible protocol`);return n.result}async streamPlayCallChain(e,t){let n=await fetch(`/api/runtime/v1`,{method:`POST`,headers:{Accept:`application/x-ndjson`,"Content-Type":`application/json`},body:JSON.stringify({protocol:Qo,request:e})});if(!n.ok)throw new $o((await n.json()).error?.message??`Runtime request failed: ${n.status}`);if(n.body===null)throw new $o(`The Runtime did not return a call-chain stream`);let r=n.body.getReader(),i=new TextDecoder,a=``,o=null;for(;;){let e=await r.read();a+=i.decode(e.value,{stream:!e.done});let n=a.split(`
1192
- `);a=n.pop()??``;for(let e of n){let n=ts(e);if(n!==null){if(n.kind===`error`)throw new $o(n.message);t(n),n.kind===`snapshot`&&n.final&&(o=n.value)}}if(e.done)break}let s=ts(a);if(s!==null){if(s.kind===`error`)throw new $o(s.message);t(s),s.kind===`snapshot`&&s.final&&(o=s.value)}if(o===null)throw new $o(`The Runtime call-chain stream ended before the final snapshot`);return o}};function ts(e){if(e.trim()===``)return null;let t;try{t=JSON.parse(e)}catch{throw new $o(`The Runtime call-chain stream contains invalid JSON`)}if(!ns(t)||t.protocol!==`narraeon.runtime/v1`)throw new $o(`The Runtime returned an incompatible call-chain stream`);let n=t.frame;if(!ns(n)||typeof n.kind!=`string`)throw new $o(`The Runtime call-chain stream is missing a frame`);return n}function ns(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rs=document.querySelector(`#root`);if(rs===null)throw Error(`The page is missing the application mount point`);var is=new es;(0,u.createRoot)(rs).render((0,q.jsx)(l.StrictMode,{children:(0,q.jsx)(Xo,{client:is})}));